Author: mbosma
Date: Thu May 10 20:38:32 2007
New Revision: 26673
URL:
http://svn.reactos.org/svn/reactos?rev=26673&view=rev
Log:
Config dialog for RosBE.
Added:
trunk/tools/RosBE/Tools/config/
trunk/tools/RosBE/Tools/config/en.rc
trunk/tools/RosBE/Tools/config/makefile
trunk/tools/RosBE/Tools/config/options.c (with props)
trunk/tools/RosBE/Tools/config/options.rc
trunk/tools/RosBE/Tools/config/resources.h (with props)
trunk/tools/RosBE/Tools/config/todo.txt (with props)
Added: trunk/tools/RosBE/Tools/config/en.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/Tools/config/en.rc?rev…
==============================================================================
--- trunk/tools/RosBE/Tools/config/en.rc (added)
+++ trunk/tools/RosBE/Tools/config/en.rc Thu May 10 20:38:32 2007
@@ -1,0 +1,20 @@
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+ID_DIALOG DIALOG DISCARDABLE 0, 0, 304, 220
+STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "RosBE Settings"
+FONT 8, "MS Shell Dlg"
+{
+ // x, pos_hight, width, hight
+ LTEXT "Reactos Build Envirement Settings", 0x0, 15, 12, 114, 13
+ LTEXT "Font Color", 0x0, 12, 45, 114, 13
+ COMBOBOX IDC_FONT, 100, 45, 110, 100, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL |
CBS_DROPDOWNLIST
+ LTEXT "Background Color", 0x0, 12, 81, 114, 13
+ COMBOBOX IDC_BACK, 100, 81, 110, 100, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL |
CBS_DROPDOWNLIST
+ CONTROL "Show Build Time", ID_SHOWBUILDTIME, "button",
BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 81, 123, 110, 21
+ CONTROL "Save Logs", ID_SAVELOGS, "button", BS_AUTOCHECKBOX |
WS_CHILD | WS_VISIBLE | WS_TABSTOP, 20, 123, 60, 21
+ EDITTEXT ID_LOGDIR, 34, 140, 200, 13, WS_TABSTOP
+ PUSHBUTTON "...", ID_BROWSE, 250, 140, 32, 13, WS_TABSTOP
+ PUSHBUTTON "Save", ID_OK, 92, 191, 59, 26, WS_TABSTOP
+ PUSHBUTTON "Cancel", ID_CANCEL, 162, 191, 59, 26, WS_TABSTOP
+}
Added: trunk/tools/RosBE/Tools/config/makefile
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/Tools/config/makefile?…
==============================================================================
--- trunk/tools/RosBE/Tools/config/makefile (added)
+++ trunk/tools/RosBE/Tools/config/makefile Thu May 10 20:38:32 2007
@@ -1,0 +1,29 @@
+TARGET := options.exe
+
+.PHONY: all
+
+all: $(TARGET)
+
+CPP=mingw32-gcc
+CFLAGS := -DWIN32 -DUNICODE -O3
+LFLAGS := -mwindows
+LIBS :=
+
+SRCS := options.c
+RC := options.rc
+
+OBJS := $(SRCS:.c=.o) $(RC:.rc=.coff)
+
+$(TARGET): $(OBJS)
+ $(CPP) $(LFLAGS) -o $@ $(OBJS) $(LIBS)
+
+.c.o: $<
+ $(CPP) $(CFLAGS) -c $< -o $@
+
+$(RC:.rc=.coff):
+ windres $(RCFLAGS) -o $@ $(RC)
+
+.PHONY: clean
+clean:
+ -@del $(TARGET)
+ -@del $(OBJS)
Added: trunk/tools/RosBE/Tools/config/options.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/Tools/config/options.c…
==============================================================================
--- trunk/tools/RosBE/Tools/config/options.c (added)
+++ trunk/tools/RosBE/Tools/config/options.c Thu May 10 20:38:32 2007
@@ -1,0 +1,116 @@
+/*
+ * RosBE Options Dialog (options.c)
+ *
+ * Copyright 2007 by Maarten Bosma
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program ; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <shlobj.h>
+#include "resources.h"
+
+// note: do not change the order - theses are the color under winxp they might differ in
another OSes
+WCHAR* Colors[] = { L"black", L"dark blue", L"green",
L"turquoise", L"dark red", L"violett",
+ L"olive", L"light grey", L"dark grey",
L"light blue", L"light green",
+ L"don't know what this color is called", L"light red",
L"pink", L"yellow", L"white" };
+
+int WriteSettings (HWND hwnd)
+{
+ int foreground, background;
+ BOOL showtime, writelog;
+ WCHAR logpath [MAX_PATH];
+
+ showtime = SendMessage(GetDlgItem(hwnd, ID_SHOWBUILDTIME), BM_GETCHECK, 0, 0) ==
BST_CHECKED;
+ writelog = SendMessage(GetDlgItem(hwnd, ID_SAVELOGS), BM_GETCHECK, 0, 0) ==
BST_CHECKED;
+ foreground = SendMessage(GetDlgItem(hwnd, IDC_BACK), CB_GETCURSEL, 0, 0);
+ background = SendMessage(GetDlgItem(hwnd, IDC_FONT), CB_GETCURSEL, 0, 0);
+ GetDlgItemText(hwnd, ID_LOGDIR, logpath, 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);
+
+ fclose (pFile);
+}
+
+INT_PTR CALLBACK DlgProc(HWND Dlg, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+ int i = 0;
+ switch (Msg)
+ {
+ case WM_INITDIALOG:
+ {
+ for(i = 0; i < sizeof(Colors)/sizeof(char*); i++)
+ {
+ SendMessage(GetDlgItem(Dlg, IDC_BACK), CB_ADDSTRING, 0, (LPARAM)(Colors[i]));
+ SendMessage(GetDlgItem(Dlg, IDC_FONT), CB_ADDSTRING, 0, (LPARAM)(Colors[i]));
+ }
+ SendMessage(GetDlgItem(Dlg, IDC_BACK), CB_SETCURSEL, 0, 0);
+ SendMessage(GetDlgItem(Dlg, IDC_FONT), CB_SETCURSEL, 0xA, 0);
+ EnableWindow (GetDlgItem(Dlg, ID_BROWSE), FALSE);
+ EnableWindow (GetDlgItem(Dlg, ID_LOGDIR), FALSE);
+ return TRUE;
+ }
+
+ case WM_COMMAND:
+ {
+ if (wParam == ID_CANCEL)
+ {
+ PostMessage(Dlg, WM_CLOSE, 0, 0);
+ }
+ else if (wParam == ID_OK)
+ {
+ WriteSettings(Dlg);
+ PostMessage(Dlg, WM_CLOSE, 0, 0);
+ }
+ else if (wParam == ID_BROWSE)
+ {
+ WCHAR Path [MAX_PATH];
+ BROWSEINFO PathInfo = {0};
+ PathInfo.hwndOwner = Dlg;
+ 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);
+ }
+ else if (wParam == ID_SAVELOGS)
+ {
+ BOOL WriteLogSet = SendMessage(GetDlgItem(Dlg, ID_SAVELOGS), BM_GETCHECK, 0, 0)
== BST_CHECKED;
+ EnableWindow (GetDlgItem(Dlg, ID_BROWSE), WriteLogSet);
+ EnableWindow (GetDlgItem(Dlg, ID_LOGDIR), WriteLogSet);
+ }
+ return FALSE;
+ }
+
+ case WM_CLOSE:
+ {
+ EndDialog(Dlg, 0);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow)
+{
+ DialogBox(hInst, MAKEINTRESOURCE(ID_DIALOG), 0, DlgProc);
+ return 0;
+}
Propchange: trunk/tools/RosBE/Tools/config/options.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/tools/RosBE/Tools/config/options.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: trunk/tools/RosBE/Tools/config/options.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/Tools/config/options.r…
==============================================================================
--- trunk/tools/RosBE/Tools/config/options.rc (added)
+++ trunk/tools/RosBE/Tools/config/options.rc Thu May 10 20:38:32 2007
@@ -1,0 +1,4 @@
+#include <windows.h>
+#include "resources.h"
+
+#include "en.rc"
Added: trunk/tools/RosBE/Tools/config/resources.h
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/Tools/config/resources…
==============================================================================
--- trunk/tools/RosBE/Tools/config/resources.h (added)
+++ trunk/tools/RosBE/Tools/config/resources.h Thu May 10 20:38:32 2007
@@ -1,0 +1,9 @@
+#define ID_DIALOG 0x10
+#define ID_OK 0x1
+#define ID_CANCEL 0x2
+#define IDC_FONT 0x1
+#define IDC_BACK 0x2
+#define ID_SAVELOGS 0x5
+#define ID_SHOWBUILDTIME 0x6
+#define ID_LOGDIR 0x7
+#define ID_BROWSE 0x7
Propchange: trunk/tools/RosBE/Tools/config/resources.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/tools/RosBE/Tools/config/resources.h
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: trunk/tools/RosBE/Tools/config/todo.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/Tools/config/todo.txt?…
==============================================================================
--- trunk/tools/RosBE/Tools/config/todo.txt (added)
+++ trunk/tools/RosBE/Tools/config/todo.txt Thu May 10 20:38:32 2007
@@ -1,0 +1,11 @@
+ToDo:
+- Load old settings
+- Disable Save button if there are no changes
+- Check Log path before saving
+- Exe and dialog icon
+- Fix control size / positions
+- Use styled controls (uxtheme) for dialog
+- Find out how to disable
+- Font preview
+- ;abye cool logo as Bitmap
+- find out the name of color 0xB
Propchange: trunk/tools/RosBE/Tools/config/todo.txt
------------------------------------------------------------------------------
svn:eol-style = native