Commit 125636e2 authored by Chips-fr's avatar Chips-fr
Browse files

keep position between select file windows session

parent ccfd6516
......@@ -18,7 +18,7 @@ How to compile on Raspbian:
You need to install gcc-4.8 (or edit Makefile) and install some dev package.
In order to do this enter the following in command line:
sudo apt-get install gcc-4.8
sudo apt-get install g++-4.8
sudo apt-get install libsdl1.2-dev
sudo apt-get install libsdl-gfx1.2-dev
sudo apt-get install libsdl-ttf2.0-dev
......
......@@ -331,10 +331,8 @@ bool EditFilesysHardfile(int unit_no)
txtSectors->setText("32");
txtBlocksize->setText("512");
}
EditFilesysHardfileLoop();
ExitEditFilesysHardfile();
if(dialogResult)
{
if(unit_no >= 0)
......@@ -347,6 +345,5 @@ bool EditFilesysHardfile(int unit_no)
atoi(txtReserved->getText().c_str()), atoi(txtBlocksize->getText().c_str()),
atoi(txtBootPri->getText().c_str()), 0, 0);
}
return dialogResult;
}
......@@ -18,6 +18,10 @@
#define DIALOG_WIDTH 520
#define DIALOG_HEIGHT 400
#ifdef RASPBERRY
#define FILE_SELECT_KEEP_POSITION
#endif
static bool dialogResult = false;
static bool dialogFinished = false;
static char workingDir[MAX_PATH];
......@@ -201,10 +205,9 @@ static void InitSelectFile(const char *title)
wndSelectFile->add(scrAreaFiles);
gui_top->add(wndSelectFile);
lstFiles->requestFocus();
lstFiles->setSelected(0);
wndSelectFile->requestModalFocus();
}
......@@ -294,6 +297,9 @@ static void SelectFileLoop(void)
}
}
#ifdef FILE_SELECT_KEEP_POSITION
static int Already_init = 0;
#endif
bool SelectFile(const char *title, char *value, const char *filter[])
{
......@@ -301,15 +307,37 @@ bool SelectFile(const char *title, char *value, const char *filter[])
dialogFinished = false;
filefilter = filter;
#ifdef FILE_SELECT_KEEP_POSITION
if (Already_init == 0)
{
InitSelectFile(title);
Already_init = 1;
} else
{
strncpy(value,workingDir,MAX_PATH);
wndSelectFile->setCaption(title);
wndSelectFile->requestModalFocus();
wndSelectFile->setVisible(true);
gui_top->moveToTop(wndSelectFile);
}
#endif
extractPath(value, workingDir);
checkfoldername(workingDir);
checkfilename(value);
SelectFileLoop();
#ifdef FILE_SELECT_KEEP_POSITION
wndSelectFile->releaseModalFocus();
wndSelectFile->setVisible(false);
#else
ExitSelectFile();
#endif
if(dialogResult)
strncpy(value, workingDir, MAX_PATH);
#ifdef FILE_SELECT_KEEP_POSITION
else
strncpy(workingDir,value, MAX_PATH);
#endif
return dialogResult;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment