Author: pschweitzer Date: Sat Dec 8 16:17:35 2007 New Revision: 31072
URL: http://svn.reactos.org/svn/reactos?rev=31072&view=rev Log: Updated config tool : - Prompt on cancel button when there are changes - Use Program Files instead of Desktop by default for browsing - Free pidl resources - Converted last parts of the program to Unicode - Attached MessageBoxes to Window - Code cleanup
Modified: trunk/tools/RosBE/RosBE-Windows/Root/ChangeLog.txt trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/de-DE.rc trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/en-US.rc trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/fr-FR.rc trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/ru-RU.rc trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c trunk/tools/RosBE/RosBE-Windows/Tools/config/resources.h
Modified: trunk/tools/RosBE/RosBE-Windows/Root/ChangeLog.txt URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Root/Chan... ============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Root/ChangeLog.txt (original) +++ trunk/tools/RosBE/RosBE-Windows/Root/ChangeLog.txt Sat Dec 8 16:17:35 2007 @@ -7,6 +7,12 @@ - Added help strings when mouse is over a control. (Pierre Schweitzer) - Improved check for log directory (Pierre Schweitzer) - Updated French translation (Pierre Schweitzer) + - Prompt on cancel button when there are changes (Pierre Schweitzer) + - Use Program Files instead of Desktop by default for browsing (Pierre Schweitzer) + - Free Pidl ressources (Pierre Schweitzer) + - Converted last parts of the program to Unicode (Pierre Schweitzer) + - Attached MessageBoxes to Window (Pierre Schweitzer) + - Code cleanup (Pierre Schweitzer)
- Add a pushd/popd to options.cmd so that options.exe pulls up a better default path for MinGW/GCC. (Peter Ward) - Set the working directory for the "Options" shortcut correctly (see above bullet). (Colin Fink)
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/de-DE.rc URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/con... ============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/de-DE.rc (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/de-DE.rc Sat Dec 8 16:17:35 2007 @@ -56,6 +56,8 @@ MSG_FINDMGWDIR, "Bitte wählen Sie den Ordner, in dem MinGW/GCC liegt:" MSG_FINDOBJDIR, "Bitte wählen Sie den Ordner, in den Sie die OBJ Daten speichern wollen:" MSG_FINDOUTDIR, "Bitte wählen Sie den Ordner, in den Sie die OUT Daten speichern wollen:" + MSG_WARNINGBOX, "Warning" + MSG_EXITCHANGE, "Are you sure you want to exit without saving?" /* Help Strings */ HLP_BACKCOLORC, "Auswählen der Hintergrundfarbe des RosBE DOS Fensters." HLP_FONTCOLORC, "Auswählen der Schriftfarbe des RosBE DOS Fensters."
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/en-US.rc URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/con... ============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/en-US.rc (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/en-US.rc Sat Dec 8 16:17:35 2007 @@ -56,6 +56,8 @@ MSG_FINDMGWDIR, "Please choose the directory where MinGW/GCC is located:" MSG_FINDOBJDIR, "Please choose the directory where you want to save OBJ Files to:" MSG_FINDOUTDIR, "Please choose the directory where you want to save OUT Files to:" + MSG_WARNINGBOX, "Warning" + MSG_EXITCHANGE, "Are you sure you want to exit without saving?" /* Help Strings */ HLP_BACKCOLORC, "Choose background color for RosBE DOS windows." HLP_FONTCOLORC, "Choose font color for RosBE DOS windows."
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/fr-FR.rc URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/con... ============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/fr-FR.rc (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/fr-FR.rc Sat Dec 8 16:17:35 2007 @@ -56,6 +56,8 @@ MSG_FINDMGWDIR, "Veuillez sélectionner le répertoire où se situe MingW/GCC :" MSG_FINDOBJDIR, "Veuillez choisir le répertoire où vous désirez sauver les fichiers OBJ :" MSG_FINDOUTDIR, "Veuillez choisir le répertoire où vous désirez sauver les fichiers OUT :" + MSG_WARNINGBOX, "Attention" + MSG_EXITCHANGE, "Êtes-vous sûr de vouloir quitter sans sauvegarder ?" /* Help Strings */ HLP_BACKCOLORC, "Choisissez la couleur de fond pour les fenêtres DOS du RosBE." HLP_FONTCOLORC, "Choisissez la couleur du texte pour les fenêtres DOS du RosBE."
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/ru-RU.rc URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/con... ============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/ru-RU.rc (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/config/lang/ru-RU.rc Sat Dec 8 16:17:35 2007 @@ -58,6 +58,8 @@ MSG_FINDMGWDIR, "Óêàæèòå êàòàëîã ðàñïîëîæåíèÿ êîìïèëÿòîðà MinGW:" MSG_FINDOBJDIR, "Óêàæèòå êàòàëîã ñîõðàíåíèÿ îáúåêòíûõ ôàéëîâ:" MSG_FINDOUTDIR, "Óêàæèòå êàòàëîã ñîõðàíåíèÿ êîìïèëèðîâàííûõ ôàéëîâ:" + MSG_WARNINGBOX, "Warning" + MSG_EXITCHANGE, "Are you sure you want to exit without saving?" /* Help Strings */ HLP_BACKCOLORC, "Âûáåðèòå öâåò ôîíà â îêíå êîíñîëè RosBE" HLP_FONTCOLORC, "Âûáåðèòå öâåò øðèôòà â îêíå êîíñîëè RosBE"
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/con... ============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c Sat Dec 8 16:17:35 2007 @@ -36,17 +36,13 @@ GetDlgItemTextW(hwnd, ID_OUTDIR, outdir, MAX_PATH);
if (writelog && (logdir[0] != 0)) - { if (GetFileAttributes(logdir) == 0xFFFFFFFF) - { if (CreateDirectoryW(logdir, NULL) == 0) { - LoadStringW(hInstance, MSG_DIREFAILED, msgerror, 256); - MessageBoxW(NULL, msgerror, NULL, MB_ICONERROR); + LoadString(hInstance, MSG_DIREFAILED, msgerror, 256); + MessageBox(hwnd, msgerror, NULL, MB_ICONERROR); return FALSE; } - } - }
wcscpy(checkmgw, mingwpath); if ((wcslen(checkmgw) + wcslen(L"\bin\gcc.exe")) < MAX_PATH) @@ -55,7 +51,7 @@ if (hFile == INVALID_HANDLE_VALUE) { LoadString(hInstance, MSG_NOGCCFOUND, msgerror, 256); - MessageBox(NULL, msgerror, NULL, MB_ICONERROR); + MessageBox(hwnd, msgerror, NULL, MB_ICONERROR); return FALSE; } CloseHandle(hFile); @@ -66,24 +62,24 @@ pFile = _wfopen(optionsfile, L"w"); if (pFile) { - fprintf(pFile, "::\n"); - fprintf(pFile, ":: This file has been automatically generated by the ReactOS\n"); - fprintf(pFile, ":: Build Environment options utility.\n"); - fprintf(pFile, "::\n\n"); - fprintf(pFile, "color %X%X\n", background, foreground); - fprintf(pFile, "set _ROSBE_SHOWTIME=%d\n", showtime); - fprintf(pFile, "set _ROSBE_USECCACHE=%d\n", useccache); - fprintf(pFile, "set _ROSBE_STRIP=%d\n", strip); - fprintf(pFile, "set _ROSBE_WRITELOG=%d\n", writelog); - if (logdir[0] != 0) fprintf(pFile, "set _ROSBE_LOGDIR=%S\n", logdir); - if (mingwpath[0] != 0) fprintf(pFile, "set _ROSBE_MINGWPATH=%S\n", mingwpath); - if ((objdir[0] != 0) && objstate) fprintf(pFile, "set _ROSBE_OBJPATH=%S\n", objdir); - if ((outdir[0] != 0) && outstate) fprintf(pFile, "set _ROSBE_OUTPATH=%S\n", outdir); + fwprintf(pFile, L"::\n"); + fwprintf(pFile, L":: This file has been automatically generated by the ReactOS\n"); + fwprintf(pFile, L":: Build Environment options utility.\n"); + fwprintf(pFile, L"::\n\n"); + fwprintf(pFile, L"color %X%X\n", background, foreground); + fwprintf(pFile, L"set _ROSBE_SHOWTIME=%d\n", showtime); + fwprintf(pFile, L"set _ROSBE_USECCACHE=%d\n", useccache); + fwprintf(pFile, L"set _ROSBE_STRIP=%d\n", strip); + fwprintf(pFile, L"set _ROSBE_WRITELOG=%d\n", writelog); + if (logdir[0] != 0) fwprintf(pFile, L"set _ROSBE_LOGDIR=%s\n", logdir); + if (mingwpath[0] != 0) fwprintf(pFile, L"set _ROSBE_MINGWPATH=%s\n", mingwpath); + if ((objdir[0] != 0) && objstate) fwprintf(pFile, L"set _ROSBE_OBJPATH=%s\n", objdir); + if ((outdir[0] != 0) && outstate) fwprintf(pFile, L"set _ROSBE_OUTPATH=%s\n", outdir); fclose(pFile); return TRUE; } LoadString(hInstance, MSG_FILEFAILED, msgerror, 256); - MessageBox(NULL, msgerror, NULL, MB_ICONERROR); + MessageBox(hwnd, msgerror, NULL, MB_ICONERROR); return FALSE; }
@@ -93,7 +89,6 @@ INT NbLines = 0; WCHAR optionsfile[MAX_PATH]; WCHAR *ptr, *ptr2; - TCHAR TTempLine[25+MAX_PATH]; WCHAR WTempLine[25+MAX_PATH]; WCHAR SBTitle[256];
@@ -103,9 +98,8 @@ pFile = _wfopen(optionsfile, L"r"); if (pFile) { - while (fgets((char *)TTempLine, 24+MAX_PATH, pFile)) - { - MultiByteToWideChar(CP_ACP, 0, (char *)TTempLine, -1, WTempLine, sizeof(WTempLine)/sizeof(WTempLine[0])); + while (fgetws(WTempLine, 24+MAX_PATH, pFile)) + { ptr = wcstok(WTempLine, L" "); if (wcscmp(ptr, L"color") == 0) { @@ -137,12 +131,11 @@ else if (wcscmp(ptr, L"_ROSBE_OUTPATH") == 0) wcsncpy(LoadedSettings->outdir, ptr2, wcslen(ptr2)-1); } - free(TTempLine); free(WTempLine); NbLines++; } fclose(pFile); - free(TTempLine); + free(WTempLine); LoadString(hInstance, MSG_SETLOADSUC, SBTitle, 256); SetDlgItemText(hwnd, ID_STATUSBAR, SBTitle); } @@ -206,20 +199,14 @@ GetDlgItemTextW(hwnd, ID_OUTDIR, outdir, MAX_PATH);
if (objstate) - { if ((wcscmp(objdir, DefaultSettings->objdir) != 0) && (wcslen(objdir) > 0)) StateObj = FALSE; - } if (outstate) - { if ((wcscmp(outdir, DefaultSettings->outdir) != 0) && (wcslen(outdir) > 0)) StateOut = FALSE; - } if (writelog) - { if ((wcscmp(logdir, DefaultSettings->logdir) != 0) && (wcslen(logdir) > 0)) StateLog = FALSE; - }
State ^= ((foreground == DefaultSettings->foreground) && (background == DefaultSettings->background) && (showtime == DefaultSettings->showtime) && (writelog == DefaultSettings->writelog) && @@ -327,6 +314,14 @@ } case ID_CANCEL: { + WCHAR BoxMsg[256], BoxTitle[128]; + if ((IsWindowEnabled(GetDlgItem(Dlg, ID_OK))) && (wParam == ID_CANCEL)) + { + LoadString(hInstance, MSG_WARNINGBOX, BoxTitle, 128); + LoadString(hInstance, MSG_EXITCHANGE, BoxMsg, 256); + if (MessageBox(Dlg, BoxMsg, BoxTitle, MB_ICONWARNING | MB_YESNO) == IDNO) + break; + } PostMessage(Dlg, WM_CLOSE, 0, 0); break; } @@ -337,47 +332,57 @@ { BROWSEINFO PathInfo; LPITEMIDLIST pidl; + LPMALLOC pMalloc; INT Control = ID_LOGDIR; INT IDText = MSG_FINDLOGDIR; WCHAR path[MAX_PATH]; WCHAR Text[512];
- ZeroMemory(&PathInfo, sizeof(BROWSEINFO)); - PathInfo.hwndOwner = Dlg; - - if ((wParam == ID_BROWSEMGW) || (wParam == ID_BROWSEOBJ) || (wParam == ID_BROWSEOUT)) + if (SHGetMalloc(&pMalloc) == NOERROR) { - HINSTANCE hDLL; - ILCREATEFROMPATHW ILCreateFromPathW; - Control = ID_MGWDIR; - IDText = MSG_FINDMGWDIR; - if (wParam == ID_BROWSEOBJ) + ZeroMemory(&PathInfo, sizeof(BROWSEINFO)); + PathInfo.hwndOwner = Dlg; + PathInfo.ulFlags = BIF_EDITBOX; + SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidl); + PathInfo.pidlRoot = pidl; + if ((wParam == ID_BROWSEMGW) || (wParam == ID_BROWSEOBJ) || (wParam == ID_BROWSEOUT)) { - Control = ID_OBJDIR; - IDText = MSG_FINDOBJDIR; + HINSTANCE hDLL; + ILCREATEFROMPATHW ILCreateFromPathW; + Control = ID_MGWDIR; + IDText = MSG_FINDMGWDIR; + if (wParam == ID_BROWSEOBJ) + { + Control = ID_OBJDIR; + IDText = MSG_FINDOBJDIR; + } + else if (wParam == ID_BROWSEOUT) + { + Control = ID_OUTDIR; + IDText = MSG_FINDOUTDIR; + } + hDLL = LoadLibrary(L"shell32.dll"); + if (hDLL) + { + ILCreateFromPathW = (ILCREATEFROMPATHW)GetProcAddress(hDLL, "ILCreateFromPathW"); + if (ILCreateFromPathW) + { + GetDlgItemTextW(Dlg, Control, path, MAX_PATH); + PathInfo.pidlRoot = ILCreateFromPathW(path); + } + FreeLibrary(hDLL); + } } - else if (wParam == ID_BROWSEOUT) + LoadString(hInstance, IDText, Text, 512); + PathInfo.lpszTitle = Text; + if ((pidl = SHBrowseForFolder(&PathInfo)) != NULL) { - Control = ID_OUTDIR; - IDText = MSG_FINDOUTDIR; + if (SHGetPathFromIDList(pidl, path)) + SetDlgItemText(Dlg, Control, path); + pMalloc->lpVtbl->Free(pMalloc, pidl); } - hDLL = LoadLibrary(L"shell32.dll"); - if (hDLL) - { - ILCreateFromPathW = (ILCREATEFROMPATHW)GetProcAddress(hDLL, "ILCreateFromPathW"); - if (ILCreateFromPathW) - { - GetDlgItemTextW(Dlg, Control, path, MAX_PATH); - PathInfo.pidlRoot = ILCreateFromPathW(path); - } - FreeLibrary(hDLL); - } + pMalloc->lpVtbl->Release(pMalloc); } - LoadString(hInstance, IDText, Text, 512); - PathInfo.lpszTitle = Text; - pidl = SHBrowseForFolder(&PathInfo); - if (pidl && SHGetPathFromIDList(pidl, path)) - SetDlgItemText(Dlg, Control, path); break; } case ID_OTHEROBJ:
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/config/resources.h URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/con... ============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/config/resources.h (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/config/resources.h Sat Dec 8 16:17:35 2007 @@ -59,18 +59,20 @@ #define MSG_FINDMGWDIR 0x2c #define MSG_FINDOBJDIR 0x2d #define MSG_FINDOUTDIR 0x2e +#define MSG_WARNINGBOX 0x2f +#define MSG_EXITCHANGE 0x30
/* Help Strings */ -#define HLP_BACKCOLORC 0x2f -#define HLP_FONTCOLORC 0x30 -#define HLP_SBUILDTIME 0x31 -#define HLP_CCACHEUSED 0x32 -#define HLP_STRIPEDEXE 0x33 -#define HLP_FINDMGWDIR 0x34 -#define HLP_FINDLOGDIR 0x35 -#define HLP_FINDOBJDIR 0x36 -#define HLP_FINDOUTDIR 0x37 -#define HLP_SAVEBUTTON 0x38 -#define HLP_QUITBUTTON 0x39 -#define HLP_DEFAULTMSG 0x3a +#define HLP_BACKCOLORC 0x31 +#define HLP_FONTCOLORC 0x32 +#define HLP_SBUILDTIME 0x33 +#define HLP_CCACHEUSED 0x34 +#define HLP_STRIPEDEXE 0x35 +#define HLP_FINDMGWDIR 0x36 +#define HLP_FINDLOGDIR 0x37 +#define HLP_FINDOBJDIR 0x38 +#define HLP_FINDOUTDIR 0x39 +#define HLP_SAVEBUTTON 0x3a +#define HLP_QUITBUTTON 0x3b +#define HLP_DEFAULTMSG 0x3c