summaryrefslogtreecommitdiffstats
path: root/src/tdisksel.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2008-08-25 23:15:17 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2008-08-25 23:15:17 +0200
commitd5d0a9a74f20ab8288f81ec96be48636dd6e0686 (patch)
treed9ca34d754825448472b3670afaef7a8d43f38e6 /src/tdisksel.c
parentc943ebd716ad2f71d2f73abc821e266be552a36f (diff)
Split the interface in several files, part 2
Text interface needs 24 lines instead of 25
Diffstat (limited to 'src/tdisksel.c')
-rw-r--r--src/tdisksel.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/tdisksel.c b/src/tdisksel.c
index eddf12d..528dba1 100644
--- a/src/tdisksel.c
+++ b/src/tdisksel.c
@@ -48,7 +48,11 @@
#include "tdisksel.h"
#ifdef HAVE_NCURSES
-#define NBR_DISK_MAX 10
+#define NBR_DISK_MAX (LINES-6-8)
+#define INTER_DISK_X 0
+#define INTER_DISK_Y (8+NBR_DISK_MAX)
+#define INTER_NOTE_Y (LINES-4)
+
static int testdisk_disk_selection_ncurses(int verbose,int dump_ind, const list_disk_t *list_disk, const int saveheader, char **current_cmd)
{
int command='Q';
@@ -84,9 +88,12 @@ static int testdisk_disk_selection_ncurses(int verbose,int dump_ind, const list_
wmove(stdscr,7,0);
wprintw(stdscr,"Select a media (use Arrow keys, then press Enter):");
#endif
- for(i=0,element_disk=list_disk;(element_disk!=NULL) && (i<offset);element_disk=element_disk->next,i++);
- for(;element_disk!=NULL && (i-offset)<NBR_DISK_MAX;i++,element_disk=element_disk->next)
+ for(i=0,element_disk=list_disk;
+ element_disk!=NULL && i<offset+NBR_DISK_MAX;
+ i++, element_disk=element_disk->next)
{
+ if(i<offset)
+ continue;
wmove(stdscr,8+i-offset,0);
if(element_disk!=current_disk)
wprintw(stdscr,"%s\n",element_disk->disk->description_short(element_disk->disk));
@@ -102,7 +109,7 @@ static int testdisk_disk_selection_ncurses(int verbose,int dump_ind, const list_
else
options="PNOQ";
{
- int line=20;
+ int line=INTER_NOTE_Y;
mvwaddstr(stdscr,line++,0,"Note: ");
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(DJGPP)
#else
@@ -124,7 +131,7 @@ static int testdisk_disk_selection_ncurses(int verbose,int dump_ind, const list_
wmove(stdscr,line++,0);
wprintw(stdscr,"detection, and install the latest OS patches and disk drivers.");
}
- command = wmenuSelect_ext(stdscr, LINES-1, INTER_MAIN_Y, INTER_MAIN_X, menuMain, 8,
+ command = wmenuSelect_ext(stdscr, INTER_NOTE_Y-1, INTER_DISK_Y, INTER_DISK_X, menuMain, 8,
options, MENU_HORIZ | MENU_BUTTON | MENU_ACCEPT_OTHERS, &menu,NULL);
switch(command)
{