Index: dialog.h =================================================================== RCS file: /cvs/cygwin-apps/setup/dialog.h,v retrieving revision 2.8 diff -p -u -b -r2.8 dialog.h --- dialog.h 7 Jul 2003 23:19:48 -0000 2.8 +++ dialog.h 23 Jul 2003 03:23:10 -0000 @@ -22,9 +22,6 @@ /* global instance for the application; set in main.cc */ extern HINSTANCE hinstance; -/* used by main.cc to select the next do_* function */ -extern int next_dialog; - /* either "nothing to do" or "setup complete" or something like that */ extern int exit_msg; @@ -35,7 +32,7 @@ extern int exit_msg; D (do_choose); D (do_desktop); D (do_download); -D (do_fromcwd); +bool do_fromcwd(HINSTANCE _h, HWND owner); D (do_ini); D (do_install); D (do_local_dir); @@ -48,9 +45,6 @@ D (do_source); D (do_splash); #undef D - -/* end this dialog and select the next. Pass 0 to exit the program */ -#define NEXT(id) EndDialog((HWND)h, 0), next_dialog = id /* Get the value of an EditText control. Pass the previously stored value and it will free the memory if needed. */ Index: download.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/download.cc,v retrieving revision 2.37 diff -p -u -b -r2.37 download.cc --- download.cc 7 Apr 2003 12:46:55 -0000 2.37 +++ download.cc 23 Jul 2003 03:23:11 -0000 @@ -222,7 +222,7 @@ download_one (packagesource & pkgsource, } static void -do_download_thread (HINSTANCE h, HWND owner) +do_download_thread (HINSTANCE h, HWND owner, int *next_dialog) { int errors = 0; total_download_bytes = 0; @@ -306,7 +306,7 @@ do_download_thread (HINSTANCE h, HWND ow { if (yesno (owner, IDS_DOWNLOAD_INCOMPLETE) == IDYES) { - next_dialog = IDD_SITE; + *next_dialog = IDD_SITE; return; } } @@ -317,10 +317,10 @@ do_download_thread (HINSTANCE h, HWND ow exit_msg = IDS_DOWNLOAD_INCOMPLETE; else if (!unattended_mode) exit_msg = IDS_DOWNLOAD_COMPLETE; - next_dialog = 0; + *next_dialog = 0; } else - next_dialog = IDD_S_INSTALL; + *next_dialog = IDD_S_INSTALL; } static DWORD WINAPI @@ -329,21 +329,22 @@ do_download_reflector (void *p) HANDLE *context; context = (HANDLE *) p; - do_download_thread ((HINSTANCE) context[0], (HWND) context[1]); + do_download_thread ((HINSTANCE) context[0], (HWND) context[1], (int*)(&context[2])); // Tell the progress page that we're done downloading - Progress.PostMessage (WM_APP_DOWNLOAD_THREAD_COMPLETE, 0, next_dialog); + Progress.PostMessage (WM_APP_DOWNLOAD_THREAD_COMPLETE, 0, (int)context[2]); ExitThread(0); } -static HANDLE context[2]; +static HANDLE context[3]; void do_download (HINSTANCE h, HWND owner) { context[0] = h; context[1] = owner; + context[2] = 0; DWORD threadID; CreateThread (NULL, 0, do_download_reflector, context, 0, &threadID); Index: fromcwd.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/fromcwd.cc,v retrieving revision 2.27 diff -p -u -b -r2.27 fromcwd.cc --- fromcwd.cc 19 May 2002 12:54:16 -0000 2.27 +++ fromcwd.cc 23 Jul 2003 03:23:12 -0000 @@ -71,7 +71,7 @@ private: bool found; }; -void +bool do_fromcwd (HINSTANCE h, HWND owner) { // Assume we won't find the INI file. @@ -80,15 +80,14 @@ do_fromcwd (HINSTANCE h, HWND owner) if (found_ini) { // Found INI, load it. - next_dialog = IDD_S_LOAD_INI; - return; + return true; } - next_dialog = IDD_CHOOSE; + // Didn't find it. IniParseFeedback myFeedback; IniDBBuilderPackage myBuilder(myFeedback); ScanFindVisitor myVisitor (myBuilder); Find(".").accept(myVisitor); - return; + return false; } Index: ini.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/ini.cc,v retrieving revision 2.35 diff -p -u -b -r2.35 ini.cc --- ini.cc 5 Jul 2002 05:17:21 -0000 2.35 +++ ini.cc 23 Jul 2003 03:23:13 -0000 @@ -204,7 +204,7 @@ do_remote_ini (HWND owner) } static void -do_ini_thread (HINSTANCE h, HWND owner) +do_ini_thread (HINSTANCE h, HWND owner, int *next_dialog) { size_t ini_count = 0; if (source == IDC_SOURCE_CWD) @@ -214,7 +214,7 @@ do_ini_thread (HINSTANCE h, HWND owner) if (ini_count == 0) { - next_dialog = source == IDC_SOURCE_CWD ? IDD_S_FROM_CWD : IDD_SITE; + *next_dialog = source == IDC_SOURCE_CWD ? IDD_S_FROM_CWD : IDD_SITE; return; } @@ -266,7 +266,7 @@ do_ini_thread (HINSTANCE h, HWND owner) note (owner, IDS_OLD_SETUP_VERSION, version, setup_version.cstr_oneuse()); } - next_dialog = IDD_CHOOSE; + *next_dialog = IDD_CHOOSE; } static DWORD WINAPI @@ -275,21 +275,22 @@ do_ini_thread_reflector(void* p) HANDLE *context; context = (HANDLE*)p; - do_ini_thread((HINSTANCE)context[0], (HWND)context[1]); + do_ini_thread((HINSTANCE)context[0], (HWND)context[1], (int*)(&context[2])); // Tell the progress page that we're done downloading - Progress.PostMessage(WM_APP_SETUP_INI_DOWNLOAD_COMPLETE, 0, next_dialog); + Progress.PostMessage(WM_APP_SETUP_INI_DOWNLOAD_COMPLETE, 0, (int)context[2]); ExitThread(0); } -static HANDLE context[2]; +static HANDLE context[3]; void do_ini (HINSTANCE h, HWND owner) { context[0] = h; context[1] = owner; + context[2] = 0; DWORD threadID; CreateThread (NULL, 0, do_ini_thread_reflector, context, 0, &threadID); Index: localdir.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/localdir.cc,v retrieving revision 2.12 diff -p -u -b -r2.12 localdir.cc --- localdir.cc 9 Nov 2002 14:47:54 -0000 2.12 +++ localdir.cc 23 Jul 2003 03:23:13 -0000 @@ -192,13 +192,14 @@ LocalDirPage::OnNext () { if (source == IDC_SOURCE_CWD) { - do_fromcwd (GetInstance (), GetHWND ()); - if (next_dialog == IDD_S_LOAD_INI) + bool found_ini; + found_ini = do_fromcwd (GetInstance (), GetHWND ()); + if (found_ini) { Progress.SetActivateTask (WM_APP_START_SETUP_INI_DOWNLOAD); return IDD_INSTATUS; } - return next_dialog; + return IDD_CHOOSE; } } else Index: main.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/main.cc,v retrieving revision 2.26 diff -p -u -b -r2.26 main.cc --- main.cc 2 Apr 2003 14:26:27 -0000 2.26 +++ main.cc 23 Jul 2003 03:23:15 -0000 @@ -64,8 +64,6 @@ static const char *cvsid = #include "getopt++/GetOption.h" #include "getopt++/BoolOption.h" -int next_dialog; - HINSTANCE hinstance; static BoolOption UnattendedOption (false, 'q', "quiet-mode", "Unattended setup mode"); @@ -465,8 +463,6 @@ main (int argc, char **argv) LogSingleton::SetInstance (*(theLog = LogFile::createLogFile())); theLog->setFile (LOG_BABBLE, local_dir + "/setup.log.full", false); theLog->setFile (0, local_dir + "/setup.log", true); - - next_dialog = IDD_SPLASH; log (LOG_PLAIN) << "Starting cygwin install, version " << version << endLog;