Prefix highligted selection by ">", so screen reader software find the

interface less confusing.
This commit is contained in:
Christophe Grenier 2010-05-21 08:47:38 +02:00
parent 969996230f
commit 1041c240cd
16 changed files with 62 additions and 27 deletions

View file

@ -236,10 +236,12 @@ void interface_adv(disk_t *disk_car, const int verbose,const int dump_ind, const
if(element==current_element) if(element==current_element)
{ {
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
waddstr(stdscr, ">");
aff_part(stdscr,AFF_PART_ORDER|AFF_PART_STATUS,disk_car,element->part); aff_part(stdscr,AFF_PART_ORDER|AFF_PART_STATUS,disk_car,element->part);
wattroff(stdscr, A_REVERSE); wattroff(stdscr, A_REVERSE);
} else } else
{ {
waddstr(stdscr, " ");
aff_part(stdscr,AFF_PART_ORDER|AFF_PART_STATUS,disk_car,element->part); aff_part(stdscr,AFF_PART_ORDER|AFF_PART_STATUS,disk_car,element->part);
} }
} }

View file

@ -268,10 +268,17 @@ char *ask_location(const char*msg, const char *src_dir, const char *dst_org)
wmove(window,8-1+i-offset,0); wmove(window,8-1+i-offset,0);
wclrtoeol(window); /* before addstr for BSD compatibility */ wclrtoeol(window); /* before addstr for BSD compatibility */
if(file_walker==current_file) if(file_walker==current_file)
{
wattrset(window, A_REVERSE); wattrset(window, A_REVERSE);
dir_aff_entry(window,file_info); waddstr(window, ">");
if(file_walker==current_file) dir_aff_entry(window,file_info);
wattroff(window, A_REVERSE); wattroff(window, A_REVERSE);
}
else
{
wprintw(window, " ");
dir_aff_entry(window,file_info);
}
} }
if(offset+INTER_DIR<=i) if(offset+INTER_DIR<=i)
break; break;

View file

@ -176,11 +176,11 @@ static void change_part_type_ncurses2(const disk_t *disk_car, partition_t *parti
if(i==current_element_num) if(i==current_element_num)
{ {
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
wprintw(stdscr,"%s", part_name[i].name); wprintw(stdscr,">%s", part_name[i].name);
wattroff(stdscr, A_REVERSE); wattroff(stdscr, A_REVERSE);
} else } else
{ {
wprintw(stdscr,"%s", part_name[i].name); wprintw(stdscr," %s", part_name[i].name);
} }
} }
if(i-offset<INTER_CHGTYPE) if(i-offset<INTER_CHGTYPE)
@ -289,11 +289,11 @@ static void gpt_change_part_type(const disk_t *disk_car, partition_t *partition)
if(i==current_element_num) if(i==current_element_num)
{ {
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
wprintw(stdscr,"%s", gpt_sys_types[i].name); wprintw(stdscr,">%s", gpt_sys_types[i].name);
wattroff(stdscr, A_REVERSE); wattroff(stdscr, A_REVERSE);
} else } else
{ {
wprintw(stdscr,"%s", gpt_sys_types[i].name); wprintw(stdscr," %s", gpt_sys_types[i].name);
} }
} }
if(i-offset<INTER_CHGTYPE) if(i-offset<INTER_CHGTYPE)

View file

@ -86,7 +86,12 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
wmove(window, 6+i-offset, 0); wmove(window, 6+i-offset, 0);
wclrtoeol(window); /* before addstr for BSD compatibility */ wclrtoeol(window); /* before addstr for BSD compatibility */
if(current_file==pos) if(current_file==pos)
{
wattrset(window, A_REVERSE); wattrset(window, A_REVERSE);
waddstr(window, ">");
}
else
waddstr(window, " ");
if((current_file->status&FILE_STATUS_DELETED)!=0 && has_colors()) if((current_file->status&FILE_STATUS_DELETED)!=0 && has_colors())
wbkgdset(window,' ' | COLOR_PAIR(1)); wbkgdset(window,' ' | COLOR_PAIR(1));
if(current_file->stat.st_mtime!=0) if(current_file->stat.st_mtime!=0)
@ -356,6 +361,7 @@ static int dir_partition_aux(disk_t *disk, const partition_t *partition, dir_dat
dir_aff_log(dir_data, dir_list); dir_aff_log(dir_data, dir_list);
if(*current_cmd!=NULL) if(*current_cmd!=NULL)
{ {
/* TODO: handle copy_files */
dir_data->current_directory[current_directory_namelength]='\0'; dir_data->current_directory[current_directory_namelength]='\0';
delete_list_file(dir_list); delete_list_file(dir_list);
return -1; /* Quit */ return -1; /* Quit */

View file

@ -209,7 +209,12 @@ static int ask_root_directory(disk_t *disk_car, const partition_t *partition, co
wmove(window,8+i-offset,0); wmove(window,8+i-offset,0);
wclrtoeol(window); /* before addstr for BSD compatibility */ wclrtoeol(window); /* before addstr for BSD compatibility */
if(current_file==pos) if(current_file==pos)
{
wattrset(window, A_REVERSE); wattrset(window, A_REVERSE);
waddstr(window, ">");
}
else
waddstr(window, " ");
if(current_file->stat.st_mtime!=0) if(current_file->stat.st_mtime!=0)
{ {
tm_p = localtime(&current_file->stat.st_mtime); tm_p = localtime(&current_file->stat.st_mtime);

View file

@ -176,6 +176,7 @@ static int interface_part_bad_ncurses(disk_t *disk_car, list_part_t *list_part)
{ {
char buffer_part_size[100]; char buffer_part_size[100];
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
waddstr(stdscr, ">");
aff_part(stdscr, AFF_PART_BASE, disk_car, parts->part); aff_part(stdscr, AFF_PART_BASE, disk_car, parts->part);
wattroff(stdscr, A_REVERSE); wattroff(stdscr, A_REVERSE);
wmove(stdscr,23,0); wmove(stdscr,23,0);
@ -187,6 +188,7 @@ static int interface_part_bad_ncurses(disk_t *disk_car, list_part_t *list_part)
wprintw(stdscr,"%s",size_to_unit(parts->part->part_size,buffer_part_size)); wprintw(stdscr,"%s",size_to_unit(parts->part->part_size,buffer_part_size));
} else } else
{ {
waddstr(stdscr, " ");
aff_part(stdscr, AFF_PART_BASE, disk_car, parts->part); aff_part(stdscr, AFF_PART_BASE, disk_car, parts->part);
} }
} }

View file

@ -132,11 +132,13 @@ static list_part_t *ask_structure_ncurses(disk_t *disk_car,list_part_t *list_par
wmove(stdscr,6+i-offset,0); wmove(stdscr,6+i-offset,0);
wclrtoeol(stdscr); /* before addstr for BSD compatibility */ wclrtoeol(stdscr); /* before addstr for BSD compatibility */
if(parts==pos) if(parts==pos)
{
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
}
if(structure_status==0 && parts->part->status!=STATUS_DELETED && has_colors()) if(structure_status==0 && parts->part->status!=STATUS_DELETED && has_colors())
wbkgdset(stdscr,' ' | COLOR_PAIR(2)); wbkgdset(stdscr,' ' | COLOR_PAIR(2));
if(parts==pos)
waddstr(stdscr, ">");
else
waddstr(stdscr, " ");
aff_part(stdscr, AFF_PART_STATUS, disk_car, parts->part); aff_part(stdscr, AFF_PART_STATUS, disk_car, parts->part);
if(structure_status==0 && parts->part->status!=STATUS_DELETED && has_colors()) if(structure_status==0 && parts->part->status!=STATUS_DELETED && has_colors())
wbkgdset(stdscr,' ' | COLOR_PAIR(0)); wbkgdset(stdscr,' ' | COLOR_PAIR(0));

View file

@ -205,29 +205,30 @@ static int wmenuUpdate(WINDOW *window, const int yinfo, int y, int x, const stru
if(lenName >= itemLength) if(lenName >= itemLength)
{ {
if( menuType & MENU_BUTTON ) if( menuType & MENU_BUTTON )
snprintf(buff, sizeof(buff),"[%s]",mi); snprintf(buff, sizeof(buff)," [%s]",mi);
else else
snprintf(buff, sizeof(buff),"%s",mi); snprintf(buff, sizeof(buff)," %s",mi);
} }
else else
{ {
if( menuType & MENU_BUTTON ) if( menuType & MENU_BUTTON )
{ {
if(menuType & MENU_VERT) if(menuType & MENU_VERT)
snprintf( buff, sizeof(buff),"[%*s%-*s]", (itemLength - lenNameMax) / 2, "", snprintf( buff, sizeof(buff)," [%*s%-*s]", (itemLength - lenNameMax) / 2, "",
(itemLength - lenNameMax + 1) / 2 + lenNameMax, mi ); (itemLength - lenNameMax + 1) / 2 + lenNameMax, mi );
else else
snprintf( buff, sizeof(buff),"[%*s%-*s]", (itemLength - lenName) / 2, "", snprintf( buff, sizeof(buff)," [%*s%-*s]", (itemLength - lenName) / 2, "",
(itemLength - lenName + 1) / 2 + lenName, mi ); (itemLength - lenName + 1) / 2 + lenName, mi );
} }
else else
snprintf( buff, sizeof(buff),"%*s%-*s", (itemLength - lenName) / 2, "", snprintf( buff, sizeof(buff)," %*s%-*s", (itemLength - lenName) / 2, "",
(itemLength - lenName + 1) / 2 + lenName, mi ); (itemLength - lenName + 1) / 2 + lenName, mi );
} }
/* If current item is selected, highlight it */ /* If current item is selected, highlight it */
if( current == i ) if( current == i )
{ {
wattrset(window, A_REVERSE); wattrset(window, A_REVERSE);
buff[0]='>';
} }
/* Print item */ /* Print item */
@ -800,10 +801,13 @@ int screen_buffer_display_ext(WINDOW *window, const char *options_org, const str
wmove(window,INTER_ANALYSE_Y+i-first_line_to_display,INTER_ANALYSE_X); wmove(window,INTER_ANALYSE_Y+i-first_line_to_display,INTER_ANALYSE_X);
wclrtoeol(window); wclrtoeol(window);
if(i==current_line) if(i==current_line)
{
wattrset(window, A_REVERSE); wattrset(window, A_REVERSE);
wprintw(window, "%-*s", COLS, intr_buffer_screen[i]); wprintw(window, ">%-*s", COLS, intr_buffer_screen[i]);
if(i==current_line)
wattroff(window, A_REVERSE); wattroff(window, A_REVERSE);
}
else
wprintw(window, " %-*s", COLS, intr_buffer_screen[i]);
} }
} }
else else
@ -1062,7 +1066,7 @@ int start_ncurses(const char *prog_name, const char *real_prog_name)
wprintw(stdscr,"Please enlarge the terminal."); wprintw(stdscr,"Please enlarge the terminal.");
wmove(stdscr,LINES-2,0); wmove(stdscr,LINES-2,0);
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
wprintw(stdscr,"[ Quit ]"); waddstr(stdscr,"[ Quit ]");
wattroff(stdscr, A_REVERSE); wattroff(stdscr, A_REVERSE);
wrefresh(stdscr); wrefresh(stdscr);
switch(wgetch(stdscr)) switch(wgetch(stdscr))

View file

@ -79,7 +79,7 @@ int intrf_no_disk_ncurses(const char *prog_name)
#endif #endif
wmove(stdscr,22,0); wmove(stdscr,22,0);
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
wprintw(stdscr,"[ Quit ]"); waddstr(stdscr,"[ Quit ]");
wattroff(stdscr, A_REVERSE); wattroff(stdscr, A_REVERSE);
wrefresh(stdscr); wrefresh(stdscr);
while(wgetch(stdscr)==ERR); while(wgetch(stdscr)==ERR);

View file

@ -1207,7 +1207,12 @@ static void ntfs_undelete_menu_ncurses(disk_t *disk_car, const partition_t *part
wmove(window, 6-1+i-offset, 0); wmove(window, 6-1+i-offset, 0);
wclrtoeol(window); /* before addstr for BSD compatibility */ wclrtoeol(window); /* before addstr for BSD compatibility */
if(file_walker==current_file) if(file_walker==current_file)
{
wattrset(window, A_REVERSE); wattrset(window, A_REVERSE);
waddstr(window, ">");
}
else
waddstr(window, " ");
if((file_info->status&FILE_STATUS_MARKED)!=0 && has_colors()) if((file_info->status&FILE_STATUS_MARKED)!=0 && has_colors())
wbkgdset(window,' ' | COLOR_PAIR(2)); wbkgdset(window,' ' | COLOR_PAIR(2));
if(file_info->stat.st_mtime!=0) if(file_info->stat.st_mtime!=0)

View file

@ -54,7 +54,7 @@ void write_part_mac_warning_ncurses(void)
wprintw(window,"using values displayed by TestDisk"); wprintw(window,"using values displayed by TestDisk");
wmove(window,22,0); wmove(window,22,0);
wattrset(window, A_REVERSE); wattrset(window, A_REVERSE);
wprintw(window,"[ Abort ]"); waddstr(window,"[ Abort ]");
wattroff(window, A_REVERSE); wattroff(window, A_REVERSE);
wrefresh(window); wrefresh(window);
while(wgetch(window)==ERR); while(wgetch(window)==ERR);

View file

@ -105,11 +105,11 @@ static void photorec_disk_selection_ncurses(int verbose, const char *recup_dir,
continue; continue;
wmove(stdscr,8+i-offset,0); wmove(stdscr,8+i-offset,0);
if(element_disk!=current_disk) if(element_disk!=current_disk)
wprintw(stdscr,"%s\n",element_disk->disk->description_short(element_disk->disk)); wprintw(stdscr," %s\n",element_disk->disk->description_short(element_disk->disk));
else else
{ {
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
wprintw(stdscr,"%s\n",element_disk->disk->description_short(element_disk->disk)); wprintw(stdscr,">%s\n",element_disk->disk->description_short(element_disk->disk));
wattroff(stdscr, A_REVERSE); wattroff(stdscr, A_REVERSE);
} }
} }

View file

@ -518,7 +518,7 @@ static void recovery_finished(disk_t *disk, const partition_t *partition, const
wmove(stdscr,22,0); wmove(stdscr,22,0);
wclrtoeol(stdscr); wclrtoeol(stdscr);
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
wprintw(stdscr,"[ Quit ]"); waddstr(stdscr,"[ Quit ]");
wattroff(stdscr, A_REVERSE); wattroff(stdscr, A_REVERSE);
wrefresh(stdscr); wrefresh(stdscr);
log_flush(); log_flush();
@ -1193,7 +1193,7 @@ static void interface_file_select_ncurses(file_enable_t *files_enable)
if(i==current_element_num) if(i==current_element_num)
{ {
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
wprintw(stdscr,"[%c] %-4s %s", (files_enable[i].enable==0?' ':'X'), wprintw(stdscr,">[%c] %-4s %s", (files_enable[i].enable==0?' ':'X'),
(files_enable[i].file_hint->extension!=NULL? (files_enable[i].file_hint->extension!=NULL?
files_enable[i].file_hint->extension:""), files_enable[i].file_hint->extension:""),
files_enable[i].file_hint->description); files_enable[i].file_hint->description);
@ -1201,7 +1201,7 @@ static void interface_file_select_ncurses(file_enable_t *files_enable)
} }
else else
{ {
wprintw(stdscr,"[%c] %-4s %s", (files_enable[i].enable==0?' ':'X'), wprintw(stdscr," [%c] %-4s %s", (files_enable[i].enable==0?' ':'X'),
(files_enable[i].file_hint->extension!=NULL? (files_enable[i].file_hint->extension!=NULL?
files_enable[i].file_hint->extension:""), files_enable[i].file_hint->extension:""),
files_enable[i].file_hint->description); files_enable[i].file_hint->description);

View file

@ -316,10 +316,12 @@ void menu_photorec(disk_t *disk_car, const int verbose, const char *recup_dir, f
if(element==current_element) if(element==current_element)
{ {
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
waddstr(stdscr, ">");
aff_part(stdscr,AFF_PART_ORDER|AFF_PART_STATUS,disk_car,element->part); aff_part(stdscr,AFF_PART_ORDER|AFF_PART_STATUS,disk_car,element->part);
wattroff(stdscr, A_REVERSE); wattroff(stdscr, A_REVERSE);
} else } else
{ {
waddstr(stdscr, " ");
aff_part(stdscr,AFF_PART_ORDER|AFF_PART_STATUS,disk_car,element->part); aff_part(stdscr,AFF_PART_ORDER|AFF_PART_STATUS,disk_car,element->part);
} }
} }

View file

@ -101,11 +101,11 @@ static int testdisk_disk_selection_ncurses(int verbose,int dump_ind, const list_
continue; continue;
wmove(stdscr,8+i-offset,0); wmove(stdscr,8+i-offset,0);
if(element_disk!=current_disk) if(element_disk!=current_disk)
wprintw(stdscr,"%s\n",element_disk->disk->description_short(element_disk->disk)); wprintw(stdscr," %s\n",element_disk->disk->description_short(element_disk->disk));
else else
{ {
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
wprintw(stdscr,"%s\n",element_disk->disk->description_short(element_disk->disk)); wprintw(stdscr,">%s\n",element_disk->disk->description_short(element_disk->disk));
wattroff(stdscr, A_REVERSE); wattroff(stdscr, A_REVERSE);
} }
} }

View file

@ -105,11 +105,11 @@ static struct td_list_head *interface_load_ncurses(disk_t *disk_car, backup_disk
if(backup_walker==backup_current) if(backup_walker==backup_current)
{ {
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
wprintw(stdscr,"%s %s",backup->description,ctime(&backup->my_time)); wprintw(stdscr,">%s %s",backup->description,ctime(&backup->my_time));
wattroff(stdscr, A_REVERSE); wattroff(stdscr, A_REVERSE);
} else } else
{ {
wprintw(stdscr,"%s %s",backup->description,ctime(&backup->my_time)); wprintw(stdscr," %s %s",backup->description,ctime(&backup->my_time));
} }
} }
if(i<=INTER_LOAD && backup==NULL) if(i<=INTER_LOAD && backup==NULL)