Add meaningful process indicator to hard drive image creation.
This commit is contained in:
parent
4ba95a1853
commit
b7193df5ac
3 changed files with 10 additions and 6 deletions
|
|
@ -1348,6 +1348,7 @@ static void update_hdd_cdrom(void* hdlg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static volatile int create_drive_pos;
|
||||||
static int create_drive(void* data)
|
static int create_drive(void* data)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
@ -1355,7 +1356,10 @@ static int create_drive(void* data)
|
||||||
FILE* f = (FILE*)data;
|
FILE* f = (FILE*)data;
|
||||||
memset(buf, 0, 512);
|
memset(buf, 0, 512);
|
||||||
for (c = 0; c < (hd_new_cyl * hd_new_hpc * hd_new_spt); c++)
|
for (c = 0; c < (hd_new_cyl * hd_new_hpc * hd_new_spt); c++)
|
||||||
fwrite(buf, 512, 1, f);
|
{
|
||||||
|
create_drive_pos = c;
|
||||||
|
fwrite(buf, 512, 1, f);
|
||||||
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
|
|
@ -1443,7 +1447,7 @@ static int hdnew_dlgproc(void* hdlg, int message, INT_PARAM wParam, LONG_PARAM l
|
||||||
wx_messagebox(hdlg, "Can't open file for write", "PCem error", WX_MB_OK);
|
wx_messagebox(hdlg, "Can't open file for write", "PCem error", WX_MB_OK);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
wx_progressdialogpulse(hdlg, "PCem", "Creating drive, please wait...", create_drive, f);
|
wx_progressdialog(hdlg, "PCem", "Creating drive, please wait...", create_drive, f, hd_new_cyl * hd_new_hpc * hd_new_spt, &create_drive_pos);
|
||||||
|
|
||||||
wx_messagebox(hdlg, "Drive created, remember to partition and format the new drive.", "PCem", WX_MB_OK);
|
wx_messagebox(hdlg, "Drive created, remember to partition and format the new drive.", "PCem", WX_MB_OK);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -749,7 +749,7 @@ static void progress_callback(void* data)
|
||||||
d->active = 0;
|
d->active = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wx_progressdialogpulse(void* window, const char* title, const char* message, WX_CALLBACK callback, void* data)
|
int wx_progressdialog(void* window, const char* title, const char* message, WX_CALLBACK callback, void* data, int range, volatile int *pos)
|
||||||
{
|
{
|
||||||
struct progress_data_t pdata;
|
struct progress_data_t pdata;
|
||||||
pdata.callback = callback;
|
pdata.callback = callback;
|
||||||
|
|
@ -759,10 +759,10 @@ int wx_progressdialogpulse(void* window, const char* title, const char* message,
|
||||||
|
|
||||||
thread_t* t = thread_create(progress_callback, &pdata);
|
thread_t* t = thread_create(progress_callback, &pdata);
|
||||||
|
|
||||||
wxProgressDialog dlg(title, message, 100, (wxWindow*)window, wxPD_APP_MODAL | wxPD_SMOOTH | wxPD_AUTO_HIDE);
|
wxProgressDialog dlg(title, message, range, (wxWindow*)window, wxPD_APP_MODAL | wxPD_SMOOTH | wxPD_AUTO_HIDE);
|
||||||
while (pdata.active)
|
while (pdata.active)
|
||||||
{
|
{
|
||||||
dlg.Pulse();
|
dlg.Update(*pos);
|
||||||
wxMilliSleep(50);
|
wxMilliSleep(50);
|
||||||
}
|
}
|
||||||
thread_kill(t);
|
thread_kill(t);
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ extern "C" {
|
||||||
void* wx_getnativewindow(void* window);
|
void* wx_getnativewindow(void* window);
|
||||||
void wx_callback(void* window, WX_CALLBACK callback, void* data);
|
void wx_callback(void* window, WX_CALLBACK callback, void* data);
|
||||||
void wx_togglewindow(void* window);
|
void wx_togglewindow(void* window);
|
||||||
int wx_progressdialogpulse(void* window, const char* title, const char* message, WX_CALLBACK callback, void* data);
|
int wx_progressdialog(void* window, const char* title, const char* message, WX_CALLBACK callback, void* data, int range, volatile int *pos);
|
||||||
|
|
||||||
void wx_enddialog(void* window, int ret_code);
|
void wx_enddialog(void* window, int ret_code);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue