Author: dreimer
Date: Sun Oct 7 17:31:29 2007
New Revision: 29437
URL:
http://svn.reactos.org/svn/reactos?rev=29437&view=rev
Log:
Another nice Patch by Pierre Schweitzer.
- Save button is disabled until a parameter is changed
- Definitively fixed resources IDs
- Added check to see if MingW dir is right (look up gcc)
- Added check to test if log dir exists and if it doesn't, it's created
- Added check to avoid writing in a non-existant file
- Updated todo list
Modified:
trunk/tools/RosBE-Windows/Tools/config/lang/de-DE.rc
trunk/tools/RosBE-Windows/Tools/config/lang/en-US.rc
trunk/tools/RosBE-Windows/Tools/config/lang/fr-FR.rc
trunk/tools/RosBE-Windows/Tools/config/lang/ru-RU.rc
trunk/tools/RosBE-Windows/Tools/config/options.c
trunk/tools/RosBE-Windows/Tools/config/resources.h
trunk/tools/RosBE-Windows/Tools/config/todo.txt
Modified: trunk/tools/RosBE-Windows/Tools/config/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/l…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/config/lang/de-DE.rc (original)
+++ trunk/tools/RosBE-Windows/Tools/config/lang/de-DE.rc Sun Oct 7 17:31:29 2007
@@ -4,7 +4,7 @@
STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "RosBE Einstellungen"
FONT 8, "MS Shell Dlg"
-{
+BEGIN
// x, pos_hight, width, hight
LTEXT "Reactos Build Environment Einstellungen", 0x0, 10, 10, 140, 13
LTEXT "Hintergrundfarbe", 0x0, 10, 35, 60, 12
@@ -17,6 +17,13 @@
PUSHBUTTON "...", ID_BROWSE, 215, 110, 30, 13, WS_TABSTOP | WS_DISABLED
EDITTEXT ID_MGWDIR, 10, 127, 200, 13, WS_TABSTOP
PUSHBUTTON "...", ID_BROWSEMGW, 215, 127, 30, 13, WS_TABSTOP
- PUSHBUTTON "Speichern", ID_OK, 63, 155, 59, 26, WS_TABSTOP
+ PUSHBUTTON "Speichern", ID_OK, 63, 155, 59, 26, WS_TABSTOP | WS_DISABLED
PUSHBUTTON "Abbrechen", ID_CANCEL, 133, 155, 59, 26, WS_TABSTOP
-}
+END
+
+STRINGTABLE
+BEGIN
+ MSG_NOGCCFOUND, "No GCC compiler found ! Please check your directory."
+ MSG_FILEFAILED, "Failed to create options.cmd !"
+ MSG_DIREFAILED, "Failed to create log directory !"
+END
Modified: trunk/tools/RosBE-Windows/Tools/config/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/l…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/config/lang/en-US.rc (original)
+++ trunk/tools/RosBE-Windows/Tools/config/lang/en-US.rc Sun Oct 7 17:31:29 2007
@@ -4,7 +4,7 @@
STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "RosBE Settings"
FONT 8, "MS Shell Dlg"
-{
+BEGIN
// x, pos_hight, width, hight
LTEXT "Reactos Build Environment Settings", 0x0, 10, 10, 140, 13
LTEXT "Background Color", 0x0, 10, 35, 60, 12
@@ -17,6 +17,13 @@
PUSHBUTTON "...", ID_BROWSE, 215, 110, 30, 13, WS_TABSTOP | WS_DISABLED
EDITTEXT ID_MGWDIR, 10, 127, 200, 13, WS_TABSTOP
PUSHBUTTON "...", ID_BROWSEMGW, 215, 127, 30, 13, WS_TABSTOP
- PUSHBUTTON "Save", ID_OK, 63, 155, 59, 26, WS_TABSTOP
+ PUSHBUTTON "Save", ID_OK, 63, 155, 59, 26, WS_TABSTOP | WS_DISABLED
PUSHBUTTON "Cancel", ID_CANCEL, 133, 155, 59, 26, WS_TABSTOP
-}
+END
+
+STRINGTABLE
+BEGIN
+ MSG_NOGCCFOUND, "No GCC compiler found ! Please check your directory."
+ MSG_FILEFAILED, "Failed to create options.cmd !"
+ MSG_DIREFAILED, "Failed to create log directory !"
+END
Modified: trunk/tools/RosBE-Windows/Tools/config/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/l…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/config/lang/fr-FR.rc (original)
+++ trunk/tools/RosBE-Windows/Tools/config/lang/fr-FR.rc Sun Oct 7 17:31:29 2007
@@ -4,19 +4,26 @@
STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Paramètre du RosBE"
FONT 8, "MS Shell Dlg"
-{
+BEGIN
// x, pos_hight, width, hight
- LTEXT "Paramètres de l'Environnement de Compilation de ReactOS", 0x0, 10,
10, 140, 13
- LTEXT "Couleur d'arrière plan", 0x0, 10, 35, 60, 12
+ LTEXT "Paramètres de l'Environnement de Compilation de ReactOS", 0x0, 10,
10, 240, 15
+ LTEXT "Couleur d'arrière plan", 0x0, 10, 35, 60, 17
COMBOBOX IDC_FONT, 100, 35, 110, 100, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL |
CBS_DROPDOWNLIST
- LTEXT "Couleur de la police", 0x0, 10, 60, 60, 12
+ LTEXT "Couleur de la police", 0x0, 10, 60, 60, 17
COMBOBOX IDC_BACK, 100, 60, 110, 100, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL |
CBS_DROPDOWNLIST
- CONTROL "Montrer le temps de compilation", ID_SHOWBUILDTIME,
"button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 85, 90, 21
- CONTROL "Sauvegarder le journal", ID_SAVELOGS, "button",
BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 115, 85, 60, 21
+ CONTROL "Montrer le temps de compilation", ID_SHOWBUILDTIME,
"button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 85, 110, 21
+ CONTROL "Sauvegarder le journal", ID_SAVELOGS, "button",
BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 135, 85, 85, 21
EDITTEXT ID_LOGDIR, 10, 110, 200, 13, WS_TABSTOP | WS_DISABLED
PUSHBUTTON "...", ID_BROWSE, 215, 110, 30, 13, WS_TABSTOP | WS_DISABLED
EDITTEXT ID_MGWDIR, 10, 127, 200, 13, WS_TABSTOP
PUSHBUTTON "...", ID_BROWSEMGW, 215, 127, 30, 13, WS_TABSTOP
- PUSHBUTTON "Sauvegarder", ID_OK, 63, 155, 59, 26, WS_TABSTOP
+ PUSHBUTTON "Sauvegarder", ID_OK, 63, 155, 59, 26, WS_TABSTOP | WS_DISABLED
PUSHBUTTON "Annuler", ID_CANCEL, 133, 155, 59, 26, WS_TABSTOP
-}
+END
+
+STRINGTABLE
+BEGIN
+ MSG_NOGCCFOUND, "Impossible de trouver le compilateur GCC ! Veuillez vérifier
votre répertoire."
+ MSG_FILEFAILED, "Impossible de créer options.cmd !"
+ MSG_DIREFAILED, "Impossible de créer le répertoire pour le journal !"
+END
Modified: trunk/tools/RosBE-Windows/Tools/config/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/l…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/config/lang/ru-RU.rc (original)
+++ trunk/tools/RosBE-Windows/Tools/config/lang/ru-RU.rc Sun Oct 7 17:31:29 2007
@@ -4,7 +4,7 @@
STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Óñòàíîâêè RosBE"
FONT 8, "MS Shell Dlg"
-{
+BEGIN
// x, pos_hight, width, hight
LTEXT "Óñòàíîâêè ïåðåìåííûõ êîìïèëÿòîðà ÐåàêòÎÑ", 0x0, 10, 10, 140, 13
LTEXT "Öâåò Ôîíà", 0x0, 10, 35, 60, 12
@@ -17,6 +17,13 @@
PUSHBUTTON "...", ID_BROWSE, 215, 110, 30, 13, WS_TABSTOP | WS_DISABLED
EDITTEXT ID_MGWDIR, 10, 127, 200, 13, WS_TABSTOP
PUSHBUTTON "...", ID_BROWSEMGW, 215, 127, 30, 13, WS_TABSTOP
- PUSHBUTTON "Ñîõðàíèòü", ID_OK, 63, 155, 59, 26, WS_TABSTOP
+ PUSHBUTTON "Ñîõðàíèòü", ID_OK, 63, 155, 59, 26, WS_TABSTOP | WS_DISABLED
PUSHBUTTON "Îòìåíèòü", ID_CANCEL, 133, 155, 59, 26, WS_TABSTOP
-}
+END
+
+STRINGTABLE
+BEGIN
+ MSG_NOGCCFOUND, "No GCC compiler found ! Please check your directory."
+ MSG_FILEFAILED, "Failed to create options.cmd !"
+ MSG_DIREFAILED, "Failed to create log directory !"
+END
Modified: trunk/tools/RosBE-Windows/Tools/config/options.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/o…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/config/options.c (original)
+++ trunk/tools/RosBE-Windows/Tools/config/options.c Sun Oct 7 17:31:29 2007
@@ -35,12 +35,15 @@
HINSTANCE hInstance;
-VOID
+INT
WriteSettings(HWND hwnd)
{
int foreground, background;
BOOL showtime, writelog;
- WCHAR logpath[MAX_PATH], mingwpath[MAX_PATH];
+ WCHAR logpath[MAX_PATH], mingwpath[MAX_PATH], checkmgw[MAX_PATH],
checklog[MAX_PATH];
+ WCHAR msgerror[256];
+ HANDLE hFile;
+ FILE *pFile;
showtime = SendMessage(GetDlgItem(hwnd, ID_SHOWBUILDTIME), BM_GETCHECK, 0, 0) ==
BST_CHECKED;
writelog = SendMessage(GetDlgItem(hwnd, ID_SAVELOGS), BM_GETCHECK, 0, 0) ==
BST_CHECKED;
@@ -49,16 +52,56 @@
GetDlgItemText(hwnd, ID_LOGDIR, logpath, MAX_PATH);
GetDlgItemText(hwnd, ID_MGWDIR, mingwpath, MAX_PATH);
- FILE *pFile = fopen("options.cmd", "w");
-
- fprintf(pFile, "REM This file has been automatically created by RosBE Options
Dialog\n\n");
- fprintf(pFile, "color %X%X\n", background, foreground);
- fprintf(pFile, "set ROSBE_SHOWTIME=%d\n", showtime);
- fprintf(pFile, "set ROSBE_WRITELOG=%d\n", writelog);
- fprintf(pFile, "set ROSBE_LOGPATH=%S\n", logpath);
- fprintf(pFile, "set ROSBE_MINGWPATH=%S\n", mingwpath);
-
- fclose(pFile);
+ if (writelog)
+ {
+ GetCurrentDirectory(MAX_PATH, checklog);
+ if (SetCurrentDirectory(logpath))
+ {
+ SetCurrentDirectory(checklog);
+ }
+ else
+ {
+ if (!CreateDirectory(logpath, NULL))
+ {
+ LoadString(hInstance, MSG_DIREFAILED, msgerror, 256);
+ MessageBox(NULL, msgerror, NULL, MB_ICONERROR);
+ return FALSE;
+ }
+ }
+ }
+
+ wcscpy(checkmgw, mingwpath);
+ wcscat(checkmgw, L"\\bin\\gcc.exe");
+ hFile = CreateFile(checkmgw, (INT)NULL, (INT)NULL, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ LoadString(hInstance, MSG_NOGCCFOUND, msgerror, 256);
+ MessageBox(NULL, msgerror, NULL, MB_ICONERROR);
+ return FALSE;
+ }
+ else
+ {
+ CloseHandle(hFile);
+ }
+
+ pFile = fopen("options.cmd", "w");
+ if (pFile)
+ {
+ fprintf(pFile, "REM This file has been automatically created by RosBE
Options Dialog\n\n");
+ fprintf(pFile, "color %X%X\n", background, foreground);
+ fprintf(pFile, "set ROSBE_SHOWTIME=%d\n", showtime);
+ fprintf(pFile, "set ROSBE_WRITELOG=%d\n", writelog);
+ fprintf(pFile, "set ROSBE_LOGPATH=%S\n", logpath);
+ fprintf(pFile, "set ROSBE_MINGWPATH=%S\n", mingwpath);
+ fclose(pFile);
+ return TRUE;
+ }
+ else
+ {
+ LoadString(hInstance, MSG_FILEFAILED, msgerror, 256);
+ MessageBox(NULL, msgerror, NULL, MB_ICONERROR);
+ return FALSE;
+ }
}
INT_PTR CALLBACK
@@ -102,7 +145,7 @@
}
else if (wParam == ID_OK)
{
- WriteSettings(Dlg);
+ if (WriteSettings(Dlg))
PostMessage(Dlg, WM_CLOSE, 0, 0);
}
else if (wParam == ID_BROWSE)
@@ -114,7 +157,10 @@
PathInfo.lpszTitle = L"Please choose a directory where the the logs
should be stored:";
LPITEMIDLIST pidl = SHBrowseForFolder(&PathInfo);
if (pidl && SHGetPathFromIDList(pidl, Path))
+ {
SetDlgItemText(Dlg, ID_LOGDIR, Path);
+ EnableWindow(GetDlgItem(Dlg, ID_OK), TRUE);
+ }
}
else if (wParam == ID_BROWSEMGW)
{
@@ -135,7 +181,10 @@
PathInfo.lpszTitle = L"Please choose the directory where MingW is
located:";
LPITEMIDLIST pidl = SHBrowseForFolder(&PathInfo);
if (pidl && SHGetPathFromIDList(pidl, MGWPath))
+ {
SetDlgItemText(Dlg, ID_MGWDIR, MGWPath);
+ EnableWindow(GetDlgItem(Dlg, ID_OK), TRUE);
+ }
}
else if (wParam == ID_SAVELOGS)
{
@@ -144,6 +193,10 @@
EnableWindow(GetDlgItem(Dlg, ID_BROWSE), WriteLogSet);
EnableWindow(GetDlgItem(Dlg, ID_LOGDIR), WriteLogSet);
}
+ else if ((wParam == ID_SHOWBUILDTIME) || ((LOWORD(wParam) == IDC_FONT)
&& (HIWORD(wParam) == CBN_SELCHANGE)) || ((LOWORD(wParam) == IDC_BACK) &&
(HIWORD(wParam) == CBN_SELCHANGE)))
+ {
+ EnableWindow(GetDlgItem(Dlg, ID_OK), TRUE);
+ }
return FALSE;
}
Modified: trunk/tools/RosBE-Windows/Tools/config/resources.h
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/r…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/config/resources.h (original)
+++ trunk/tools/RosBE-Windows/Tools/config/resources.h Sun Oct 7 17:31:29 2007
@@ -1,3 +1,4 @@
+/* Controls */
#define ID_OK 0x1
#define ID_CANCEL 0x2
#define ID_OPTICON 0x3
@@ -7,7 +8,12 @@
#define ID_BROWSE 0x7
#define ID_MGWDIR 0x8
#define ID_BROWSEMGW 0x9
-#define ID_DIALOG 0x10
-#define IDC_FONT 0x1
-#define IDC_BACK 0x2
+#define ID_DIALOG 0xa
+#define IDC_FONT 0xb
+#define IDC_BACK 0xc
+/* Strings */
+#define MSG_NOGCCFOUND 0x50
+#define MSG_FILEFAILED 0x51
+#define MSG_DIREFAILED 0x52
+
Modified: trunk/tools/RosBE-Windows/Tools/config/todo.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/t…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/config/todo.txt (original)
+++ trunk/tools/RosBE-Windows/Tools/config/todo.txt Sun Oct 7 17:31:29 2007
@@ -1,5 +1,5 @@
ToDo:
- Load old settings
-- Disable Save button if there are no changes
-- Check validity of log path before saving
+- Improve Save button status (disabled if no changes, even if user played with param)
- Font preview
+- Fix FIXME