MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / interface_file_select_ncurses

Function interface_file_select_ncurses

src/phrecn.c:575–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

573#define INTER_FSELECT (LINES-10)
574
575void interface_file_select_ncurses(file_enable_t *files_enable)
576{
577 int current_element_num=0;
578 int offset=0;
579 int old_LINES=0; /* Screen will be cleared */
580 unsigned int menu=0;
581 int enable_status=files_enable[0].enable;
582 static const struct MenuItem menuAdv[]=
583 {
584 {'q',"Quit","Return to main menu"},
585 {0,NULL,NULL}
586 };
587 log_info("\nInterface File Select\n");
588 while(1)
589 {
590 int i;
591 int command;
592 if(old_LINES!=LINES)
593 {
594 aff_copy(stdscr);
595 wmove(stdscr,4,0);
596 wprintw(stdscr,"PhotoRec will try to locate the following files");
597 current_element_num=0;
598 offset=0;
599 old_LINES=LINES;
600 }
601 wmove(stdscr,5,0);
602 wclrtoeol(stdscr);
603 wmove(stdscr,5,4);
604 if(offset>0)
605 wprintw(stdscr,"Previous");
606 for(i=offset; i<offset+INTER_FSELECT && files_enable[i].file_hint!=NULL; i++)
607 {
608 wmove(stdscr,6+i-offset,0);
609 wclrtoeol(stdscr); /* before addstr for BSD compatibility */
610 if(i==current_element_num)
611 {
612 wattrset(stdscr, A_REVERSE);
613 wprintw(stdscr,">[%c] %-4s %s", (files_enable[i].enable==0?' ':'X'),
614 (files_enable[i].file_hint->extension!=NULL?
615 files_enable[i].file_hint->extension:""),
616 files_enable[i].file_hint->description);
617 wattroff(stdscr, A_REVERSE);
618 }
619 else
620 {
621 wprintw(stdscr," [%c] %-4s %s", (files_enable[i].enable==0?' ':'X'),
622 (files_enable[i].file_hint->extension!=NULL?
623 files_enable[i].file_hint->extension:""),
624 files_enable[i].file_hint->description);
625 }
626 }
627 wmove(stdscr,6+INTER_FSELECT,4);
628 wclrtoeol(stdscr); /* before addstr for BSD compatibility */
629 if(files_enable[i].file_hint!=NULL)
630 wprintw(stdscr,"Next");
631 wmove(stdscr,6+INTER_FSELECT+1,0);
632 wclrtoeol(stdscr);

Callers 1

menu_photorecFunction · 0.85

Calls 5

wmenuSelectFunction · 0.85
reset_array_file_enableFunction · 0.85
file_options_saveFunction · 0.85
display_messageFunction · 0.85
aff_copyFunction · 0.70

Tested by

no test coverage detected