Author: dreimer
Date: Wed May 20 01:57:07 2015
New Revision: 67833
URL:
http://svn.reactos.org/svn/reactos?rev=67833&view=rev
Log:
[MAZESCR]
INI files for setting parameters? Lets get to the past Win 3.11 standards and make a
configure dialog for that which reads and writes the stuff to the registry.
Removed:
trunk/rosapps/applications/screensavers/mazescr/lang/bg-BG.rc
trunk/rosapps/applications/screensavers/mazescr/lang/es-ES.rc
trunk/rosapps/applications/screensavers/mazescr/lang/fr-FR.rc
trunk/rosapps/applications/screensavers/mazescr/lang/lt-LT.rc
trunk/rosapps/applications/screensavers/mazescr/lang/no-NO.rc
trunk/rosapps/applications/screensavers/mazescr/lang/pl-PL.rc
trunk/rosapps/applications/screensavers/mazescr/lang/ro-RO.rc
trunk/rosapps/applications/screensavers/mazescr/lang/sk-SK.rc
trunk/rosapps/applications/screensavers/mazescr/lang/uk-UA.rc
Modified:
trunk/rosapps/applications/screensavers/mazescr/CMakeLists.txt
trunk/rosapps/applications/screensavers/mazescr/lang/de-DE.rc
trunk/rosapps/applications/screensavers/mazescr/lang/en-US.rc
trunk/rosapps/applications/screensavers/mazescr/maze.c
trunk/rosapps/applications/screensavers/mazescr/maze.rc
trunk/rosapps/applications/screensavers/mazescr/resource.h
Modified: trunk/rosapps/applications/screensavers/mazescr/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/CMakeLists.txt [iso-8859-1]
(original)
+++ trunk/rosapps/applications/screensavers/mazescr/CMakeLists.txt [iso-8859-1] Wed May 20
01:57:07 2015
@@ -4,5 +4,5 @@
set_module_type(mazescr win32gui UNICODE)
set_target_properties(mazescr PROPERTIES SUFFIX ".scr")
target_link_libraries(mazescr scrnsave)
-add_importlibs(mazescr user32 gdi32 msvcrt kernel32)
+add_importlibs(mazescr user32 gdi32 advapi32 msvcrt kernel32)
add_cd_file(TARGET mazescr DESTINATION reactos/system32 FOR all)
Removed: trunk/rosapps/applications/screensavers/mazescr/lang/bg-BG.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/lang/bg-BG.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/lang/bg-BG.rc (removed)
@@ -1,8 +0,0 @@
-LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_DESCRIPTION "ÐкÑанен пÑедпазиÑел
âÐабиÑинÑâ"
- IDS_TITLE "Ðа..."
- IDS_TEXT "ÐÑма нÑжда Ð¾Ñ Ð½Ð°ÑÑÑойки."
-END
Modified: trunk/rosapps/applications/screensavers/mazescr/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/lang/de-DE.rc [iso-8859-1] Wed May 20
01:57:07 2015
@@ -1,8 +1,45 @@
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
-STRINGTABLE DISCARDABLE
+IDD_DLG_SCREEN DIALOGEX DISCARDABLE 0, 0, 276, 112
+STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Maze Bildschirmschoner Einstellungen"
+FONT 8, "MS Shell Dlg"
BEGIN
- IDS_DESCRIPTION "Maze Bildschirmschoner"
- IDS_TITLE "Ãber"
- IDS_TEXT "Keinerlei Einstellungen notwendig."
+ LTEXT "LabyrinthgröÃe:",IDC_STATIC,7,7,90,12,SS_CENTERIMAGE
+ CONTROL
"Slider1",IDC_SLIDER_SIZE,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
WS_TABSTOP,101,7,140,12
+ CTEXT
"Static",IDC_TEXT_SIZE,245,7,24,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
+ LTEXT
"Vor-Lösungsverzögerung:",IDC_STATIC,7,28,90,12,SS_CENTERIMAGE
+ CONTROL
"Slider2",IDC_SLIDER_PRESD,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS
| WS_TABSTOP,101,28,140,12
+ CTEXT
"Static",IDC_TEXT_PRESD,245,28,24,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
+ LTEXT
"Nach-Lösungsverzögerung:",IDC_STATIC,7,49,90,12,SS_CENTERIMAGE
+ CONTROL
"Slider3",IDC_SLIDER_POSTSD,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS
| WS_TABSTOP,101,49,140,12
+ CTEXT
"Static",IDC_TEXT_POSTSD,245,49,24,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
+ LTEXT
"Lösungsverzögerung:",IDC_STATIC,7,70,90,12,SS_CENTERIMAGE
+ CONTROL
"Slider4",IDC_SLIDER_SD,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
WS_TABSTOP,101,70,140,12
+ CTEXT
"Static",IDC_TEXT_SD,245,70,24,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
+ DEFPUSHBUTTON "OK",IDOK,59,91,50,14
+ PUSHBUTTON "Abbrechen",IDCANCEL,113,91,50,14
+ PUSHBUTTON "Ãber",IDABOUT,167,91,50,14
END
+
+IDD_DLG_ABOUT DIALOGEX DISCARDABLE 0, 0, 229, 121
+STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Ãber"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ CTEXT "Maze Bildschirmschoner 1.0",IDC_STATIC,7,7,215,9
+ LTEXT "[06-21-85] Martin Weiss - Original
Code",IDC_STATIC,7,20,215,8
+ LTEXT "[01-29-88] Dave Lemke - Hacked für
X11",IDC_STATIC,7,29,215,8
+ LTEXT "[10-04-88] Richard Hess - UnHacked für
X11",IDC_STATIC,7,38,215,8
+ LTEXT "[03-03-93] Jim Randell - UnHacked für
X11",IDC_STATIC,7,47,215,8
+ LTEXT "[03-07-93] Jamie Zawinski - Bereinigung und Code
Sauberkeit",IDC_STATIC,7,56,215,8
+ LTEXT "[10-08-94] Ge van Geldorp - Portiert auf
Windows",IDC_STATIC,7,65,215,8
+ LTEXT "[08-15-03] Ge van Geldorp - Portiert auf
ReactOS",IDC_STATIC,7,74,215,8
+ CTEXT "R.I.P. Ge van Geldorp, wir vermissen
dich!",IDC_STATIC,7,87,215,10,SS_SUNKEN
+ DEFPUSHBUTTON "OK",IDOK,87,100,56,14
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_DESCRIPTION "Maze Bildschirmschoner"
+END
Modified: trunk/rosapps/applications/screensavers/mazescr/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/lang/en-US.rc [iso-8859-1] Wed May 20
01:57:07 2015
@@ -1,8 +1,45 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-STRINGTABLE DISCARDABLE
+IDD_DLG_SCREEN DIALOGEX DISCARDABLE 0, 0, 276, 112
+STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Maze ScreenSaver Settings"
+FONT 8, "MS Shell Dlg"
BEGIN
- IDS_DESCRIPTION "Maze ScreenSaver"
- IDS_TITLE "About"
- IDS_TEXT "No options need to be set."
+ LTEXT "Maze Size:",IDC_STATIC,7,7,90,12,SS_CENTERIMAGE
+ CONTROL
"Slider1",IDC_SLIDER_SIZE,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
WS_TABSTOP,101,7,140,12
+ CTEXT
"Static",IDC_TEXT_SIZE,245,7,24,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
+ LTEXT "Pre Solve Delay:",IDC_STATIC,7,28,90,12,SS_CENTERIMAGE
+ CONTROL
"Slider2",IDC_SLIDER_PRESD,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS
| WS_TABSTOP,101,28,140,12
+ CTEXT
"Static",IDC_TEXT_PRESD,245,28,24,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
+ LTEXT "Post Solve Delay:",IDC_STATIC,7,49,90,12,SS_CENTERIMAGE
+ CONTROL
"Slider3",IDC_SLIDER_POSTSD,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS
| WS_TABSTOP,101,49,140,12
+ CTEXT
"Static",IDC_TEXT_POSTSD,245,49,24,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
+ LTEXT "Solve Delay:",IDC_STATIC,7,70,90,12,SS_CENTERIMAGE
+ CONTROL
"Slider4",IDC_SLIDER_SD,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
WS_TABSTOP,101,70,140,12
+ CTEXT
"Static",IDC_TEXT_SD,245,70,24,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
+ DEFPUSHBUTTON "OK",IDOK,59,91,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,113,91,50,14
+ PUSHBUTTON "About",IDABOUT,167,91,50,14
END
+
+IDD_DLG_ABOUT DIALOGEX DISCARDABLE 0, 0, 229, 121
+STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "About"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ CTEXT "Maze ScreenSaver 1.0",IDC_STATIC,7,7,215,9
+ LTEXT "[06-21-85] Martin Weiss - Original
Code",IDC_STATIC,7,20,215,8
+ LTEXT "[01-29-88] Dave Lemke - Hacked for
X11",IDC_STATIC,7,29,215,8
+ LTEXT "[10-04-88] Richard Hess - UnHacked for
X11",IDC_STATIC,7,38,215,8
+ LTEXT "[03-03-93] Jim Randell - UnHacked for
X11",IDC_STATIC,7,47,215,8
+ LTEXT "[03-07-93] Jamie Zawinski - Cleanup and Code
tidiness",IDC_STATIC,7,56,215,8
+ LTEXT "[10-08-94] Ge van Geldorp - Ported to
Windows",IDC_STATIC,7,65,215,8
+ LTEXT "[08-15-03] Ge van Geldorp - Ported to
ReactOS",IDC_STATIC,7,74,215,8
+ CTEXT "R.I.P. Ge van Geldorp, we miss
you!",IDC_STATIC,7,87,215,10,SS_SUNKEN
+ DEFPUSHBUTTON "OK",IDOK,87,100,56,14
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_DESCRIPTION "Maze Screensaver"
+END
Removed: trunk/rosapps/applications/screensavers/mazescr/lang/es-ES.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/lang/es-ES.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/lang/es-ES.rc (removed)
@@ -1,8 +0,0 @@
-LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_DESCRIPTION "Laberinto"
- IDS_TITLE "Acerca de"
- IDS_TEXT "Ninguna opción necesita ser configurada."
-END
Removed: trunk/rosapps/applications/screensavers/mazescr/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/lang/fr-FR.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/lang/fr-FR.rc (removed)
@@ -1,8 +0,0 @@
-LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_DESCRIPTION "Ãcran de veille labyrinthe"
- IDS_TITLE "Ã propos de"
- IDS_TEXT "Il n'y a aucune option à définir."
-END
Removed: trunk/rosapps/applications/screensavers/mazescr/lang/lt-LT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/lang/lt-LT.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/lang/lt-LT.rc (removed)
@@ -1,8 +0,0 @@
-LANGUAGE LANG_LITHUANIAN, SUBLANG_DEFAULT
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_DESCRIPTION "Labirintas"
- IDS_TITLE "Apie"
- IDS_TEXT "NÄra keiÄiamų parametrų."
-END
Removed: trunk/rosapps/applications/screensavers/mazescr/lang/no-NO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/lang/no-NO.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/lang/no-NO.rc (removed)
@@ -1,8 +0,0 @@
-LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_DESCRIPTION "Maze Skjermsparer"
- IDS_TITLE "Om"
- IDS_TEXT "Ingen valg trengs å settes."
-END
Removed: trunk/rosapps/applications/screensavers/mazescr/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/lang/pl-PL.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/lang/pl-PL.rc (removed)
@@ -1,15 +0,0 @@
-/*
- * translated by Caemyr - Olaf Siejka (Feb, 2008)
- * Use ReactOS forum PM or IRC to contact me
- *
http://www.reactos.org
- * IRC:
irc.freenode.net #reactos-pl;
- */
-
-LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_DESCRIPTION "Wygaszacz Labirynt"
- IDS_TITLE "O programie"
- IDS_TEXT "Brak opcji do ustawiania."
-END
Removed: trunk/rosapps/applications/screensavers/mazescr/lang/ro-RO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/lang/ro-RO.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/lang/ro-RO.rc (removed)
@@ -1,18 +0,0 @@
-/*
- * PROJECT: ReactOS Maze ScreenSaver
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: rosapps/applications/screensavers/mazescr/lang/ro-RO.rc
- * PURPOSE: Romanian Language File for Maze ScreenSaver
- * TRANSLATOR: Ètefan Fulea (stefan dot fulea at mail dot md)
- */
-
-LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
-
-#pragma code_page(65001)
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_DESCRIPTION "Labirint (animaÈie de inactivitate)"
- IDS_TITLE "Despre"
- IDS_TEXT "Nu este necesarÄ stabilirea de opÈiuni."
-END
Removed: trunk/rosapps/applications/screensavers/mazescr/lang/sk-SK.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/lang/sk-SK.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/lang/sk-SK.rc (removed)
@@ -1,12 +0,0 @@
-/* TRANSLATOR: Mário KaÄmár /Mario Kacmar/ aka Kario (kario(a)szm.sk)
- * DATE OF TR: 30-01-2008
- */
-
-LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_DESCRIPTION "Bludisko - Å¡etriÄ obrazovky"
- IDS_TITLE "Äo je ..."
- IDS_TEXT "Nie sú potrebné žiadne nastavenia."
-END
Removed: trunk/rosapps/applications/screensavers/mazescr/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/lang/uk-UA.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/lang/uk-UA.rc (removed)
@@ -1,16 +0,0 @@
-/*
- * PROJECT: Maze ScreenSaver
- * LICENSE: Public Domain
- * FILE: rosapps/applications/screensavers/mazescr/lang/uk-UA.rc
- * PURPOSE: Ukraianian Language File for Maze ScreenSaver
- * TRANSLATOR: Artem Reznikov
- */
-
-LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_DESCRIPTION "ÐаÑÑавка
""ÐабÑÑинÑ"""
- IDS_TITLE "ÐÑо"
- IDS_TEXT "Ð¦Ñ Ð·Ð°ÑÑавка не Ð¼Ð°Ñ Ð½Ð°Ð»Ð°ÑÑовÑваниÑ
паÑамеÑÑÑв."
-END
Modified: trunk/rosapps/applications/screensavers/mazescr/maze.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/maze.c [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/maze.c [iso-8859-1] Wed May 20
01:57:07 2015
@@ -49,16 +49,17 @@
#define STRICT
+#include <windows.h> /* required for all Windows applications */
+#include <scrnsave.h>
+#include <tchar.h>
#include <stdlib.h>
+#include <commctrl.h>
#include <string.h>
#include <time.h>
-#include <windows.h> /* required for all Windows applications */
-#include <scrnsave.h>
#include "resource.h"
#define APPNAME _T("Maze")
-//static BOOL InitInstance(HWND hParent);
LRESULT CALLBACK ScreenSaverProc(HWND hWnd, UINT message, WPARAM uParam, LPARAM lParam);
static int choose_door();
static long backup();
@@ -71,9 +72,8 @@
HBRUSH hBrushLiving;
HPEN hPenWall;
HDC hDC;
-//static BOOL waiting;
-
-static int solve_delay, pre_solve_delay, post_solve_delay;
+
+static int solve_delay, pre_solve_delay, post_solve_delay, size;
#define MAX_MAZE_SIZE_X ((unsigned long) 1000) // Dynamic detection?
#define MAX_MAZE_SIZE_Y ((unsigned long) 1000) // Dynamic detection?
@@ -119,6 +119,63 @@
static int grid_width, grid_height;
static int bw;
static int state = 1, pathi = 0;
+static LPCWSTR registryPath =
_T("Software\\Microsoft\\ScreenSavers\\mazescr");
+
+static void SetDefaults()
+{
+ size = 10;
+ pre_solve_delay = 5000;
+ post_solve_delay = 5000;
+ solve_delay = 1;
+}
+
+static void ReadRegistry()
+{
+ LONG result;
+ HKEY skey;
+ DWORD valuetype, valuesize, val_size, val_presd, val_postsd, val_sd;
+
+ SetDefaults();
+
+ result = RegOpenKeyEx(HKEY_CURRENT_USER, registryPath, 0, KEY_READ, &skey);
+ if(result != ERROR_SUCCESS)
+ return;
+
+ valuesize = sizeof(DWORD);
+
+ result = RegQueryValueEx(skey, _T("size"), NULL, &valuetype,
(LPBYTE)&val_size, &valuesize);
+ if(result == ERROR_SUCCESS)
+ size = val_size;
+ result = RegQueryValueEx(skey, _T("pre_solve_delay"), NULL, &valuetype,
(LPBYTE)&val_presd, &valuesize);
+ if(result == ERROR_SUCCESS)
+ pre_solve_delay = val_presd;
+ result = RegQueryValueEx(skey, _T("post_solve_delay"), NULL,
&valuetype, (LPBYTE)&val_postsd, &valuesize);
+ if(result == ERROR_SUCCESS)
+ post_solve_delay = val_postsd;
+ result = RegQueryValueEx(skey, _T("solve_delay"), NULL, &valuetype,
(LPBYTE)&val_sd, &valuesize);
+ if(result == ERROR_SUCCESS)
+ solve_delay = val_sd;
+
+ RegCloseKey(skey);
+}
+
+static void WriteRegistry()
+{
+ LONG result;
+ HKEY skey;
+ DWORD disp;
+
+ result = RegCreateKeyEx(HKEY_CURRENT_USER, registryPath, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &skey, &disp);
+ if(result != ERROR_SUCCESS)
+ return;
+
+ RegSetValueEx(skey, _T("size"), 0, REG_DWORD, (LPBYTE)&size,
sizeof(size));
+ RegSetValueEx(skey, _T("pre_solve_delay"), 0, REG_DWORD,
(LPBYTE)&pre_solve_delay, sizeof(pre_solve_delay));
+ RegSetValueEx(skey, _T("post_solve_delay"), 0, REG_DWORD,
(LPBYTE)&post_solve_delay, sizeof(post_solve_delay));
+ RegSetValueEx(skey, _T("solve_delay"), 0, REG_DWORD,
(LPBYTE)&solve_delay, sizeof(solve_delay));
+
+ RegCloseKey(skey);
+}
static void set_maze_sizes(width, height)
int width, height;
@@ -417,7 +474,7 @@
}
}
- hBrush = GetStockObject(WHITE_BRUSH); // FIXME: do not hardcode
+ hBrush = GetStockObject(WHITE_BRUSH);
draw_solid_square(start_x, start_y, start_dir, hDC, hBrush);
draw_solid_square(end_x, end_y, end_dir, hDC, hBrush);
}
@@ -520,14 +577,9 @@
static BOOL OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
{
- int size;
-
srand((unsigned) time(NULL));
- size = GetPrivateProfileIntW(L"maze", L"gridsize", 10,
L"maze.ini");
- pre_solve_delay = GetPrivateProfileIntW(L"maze", L"predelay",
5000, L"maze.ini");
- post_solve_delay = GetPrivateProfileIntW(L"maze", L"postdelay",
5000, L"maze.ini");
- solve_delay = GetPrivateProfileIntW(L"maze", L"solvedelay", 1,
L"maze.ini");
+ ReadRegistry();
if (size < 2) {
size = 7 + (rand() % 30);
@@ -580,6 +632,34 @@
return TRUE;
}
+BOOL WINAPI AboutProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
+{
+ switch(message){
+ case WM_COMMAND:
+ switch(LOWORD(wparam)){
+ case IDOK:
+ EndDialog(hWnd, LOWORD(wparam));
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static void ReadSettings(HWND hWnd)
+{
+ size = SendDlgItemMessage(hWnd, IDC_SLIDER_SIZE, TBM_GETPOS, 0, 0);
+ SetDlgItemInt(hWnd, IDC_TEXT_SIZE, size, FALSE);
+
+ pre_solve_delay = SendDlgItemMessage(hWnd, IDC_SLIDER_PRESD, TBM_GETPOS, 0, 0);
+ SetDlgItemInt(hWnd, IDC_TEXT_PRESD, pre_solve_delay, FALSE);
+
+ post_solve_delay = SendDlgItemMessage(hWnd, IDC_SLIDER_POSTSD, TBM_GETPOS, 0, 0);
+ SetDlgItemInt(hWnd, IDC_TEXT_POSTSD, post_solve_delay, FALSE);
+
+ solve_delay = SendDlgItemMessage(hWnd, IDC_SLIDER_SD, TBM_GETPOS, 0, 0);
+ SetDlgItemInt(hWnd, IDC_TEXT_SD, solve_delay, FALSE);
+}
+
LRESULT CALLBACK ScreenSaverProc(
HWND hWnd, // window handle
UINT message, // type of message
@@ -646,18 +726,48 @@
BOOL WINAPI ScreenSaverConfigureDialog(HWND hWnd, UINT message, WPARAM wparam, LPARAM
lparam)
{
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ ReadRegistry();
+ //Set slider ranges
+ SendDlgItemMessage(hWnd, IDC_SLIDER_SIZE, TBM_SETRANGE, FALSE, MAKELPARAM(5,
64));
+ SendDlgItemMessage(hWnd, IDC_SLIDER_PRESD, TBM_SETRANGE, FALSE, MAKELPARAM(1,
10000));
+ SendDlgItemMessage(hWnd, IDC_SLIDER_POSTSD, TBM_SETRANGE, FALSE,
MAKELPARAM(1, 10000));
+ SendDlgItemMessage(hWnd, IDC_SLIDER_SD, TBM_SETRANGE, FALSE, MAKELPARAM(1,
10000));
+ //Set current values to slider
+ SendDlgItemMessage(hWnd, IDC_SLIDER_SIZE, TBM_SETPOS, TRUE, size);
+ SendDlgItemMessage(hWnd, IDC_SLIDER_PRESD, TBM_SETPOS, TRUE,
pre_solve_delay);
+ SendDlgItemMessage(hWnd, IDC_SLIDER_POSTSD, TBM_SETPOS, TRUE,
post_solve_delay);
+ SendDlgItemMessage(hWnd, IDC_SLIDER_SD, TBM_SETPOS, TRUE, solve_delay);
+ //Set current values to texts
+ SetDlgItemInt(hWnd, IDC_TEXT_SIZE, size, FALSE);
+ SetDlgItemInt(hWnd, IDC_TEXT_PRESD, pre_solve_delay, FALSE);
+ SetDlgItemInt(hWnd, IDC_TEXT_POSTSD, post_solve_delay, FALSE);
+ SetDlgItemInt(hWnd, IDC_TEXT_SD, solve_delay, FALSE);
+ return TRUE;
+ case WM_COMMAND:
+ switch (LOWORD(wparam))
+ {
+ case IDOK:
+ WriteRegistry();
+ EndDialog(hWnd, TRUE);
+ return TRUE;
+ case IDCANCEL:
+ EndDialog(hWnd, TRUE);
+ break;
+ case IDABOUT:
+ DialogBox(hMainInstance, MAKEINTRESOURCE(IDD_DLG_ABOUT), hWnd,
(DLGPROC)AboutProc);
+ break;
+ }
+ case WM_HSCROLL:
+ ReadSettings(hWnd);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL WINAPI RegisterDialogClasses(HANDLE hmodule)
+{
return TRUE;
}
-
-BOOL WINAPI RegisterDialogClasses(HANDLE hmodule)
-{
- TCHAR szTitle[256];
- TCHAR szText[256];
-
- LoadString(hmodule, IDS_TITLE, szTitle, 256);
-
- LoadString(hmodule, IDS_TEXT, szText, 256);
-
- MessageBox(0, szText, szTitle, MB_OK | MB_ICONWARNING);
- return TRUE;
-}
Modified: trunk/rosapps/applications/screensavers/mazescr/maze.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/maze.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/maze.rc [iso-8859-1] Wed May 20
01:57:07 2015
@@ -1,5 +1,4 @@
#include <windows.h>
-#include <scrnsave.h>
#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
@@ -8,46 +7,23 @@
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "Maze ScreenSaver\0"
-#define REACTOS_STR_INTERNAL_NAME "maze\0"
-#define REACTOS_STR_ORIGINAL_FILENAME "maze.scr\0"
+#define REACTOS_STR_INTERNAL_NAME "Maze\0"
+#define REACTOS_STR_ORIGINAL_FILENAME "mazescr.scr\0"
#include <reactos/version.rc>
#include <reactos/manifest_exe.rc>
+#ifndef IDC_STATIC
+#define IDC_STATIC -1
+#endif
+
/* UTF-8 */
#pragma code_page(65001)
-#ifdef LANGUAGE_BG_BG
- #include "lang/bg-BG.rc"
-#endif
#ifdef LANGUAGE_DE_DE
#include "lang/de-DE.rc"
#endif
#ifdef LANGUAGE_EN_US
#include "lang/en-US.rc"
#endif
-#ifdef LANGUAGE_ES_ES
- #include "lang/es-ES.rc"
-#endif
-#ifdef LANGUAGE_FR_FR
- #include "lang/fr-FR.rc"
-#endif
-#ifdef LANGUAGE_LT_LT
- #include "lang/lt-LT.rc"
-#endif
-#ifdef LANGUAGE_NO_NO
- #include "lang/no-NO.rc"
-#endif
-#ifdef LANGUAGE_PL_PL
- #include "lang/pl-PL.rc"
-#endif
-#ifdef LANGUAGE_RO_RO
- #include "lang/ro-RO.rc"
-#endif
-#ifdef LANGUAGE_SK_SK
- #include "lang/sk-SK.rc"
-#endif
-#ifdef LANGUAGE_UK_UA
- #include "lang/uk-UA.rc"
-#endif
Modified: trunk/rosapps/applications/screensavers/mazescr/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/mazescr/resource.h [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/mazescr/resource.h [iso-8859-1] Wed May 20
01:57:07 2015
@@ -1,6 +1,15 @@
#pragma once
-#define IDS_DESCRIPTION 1
-#define IDS_TITLE 2
-#define IDS_TEXT 3
-#define IDI_ICON 101
+#define IDS_DESCRIPTION 1
+#define IDABOUT 10
+#define IDI_ICON 101
+#define IDD_DLG_ABOUT 110
+#define IDC_SLIDER_SIZE 1000
+#define IDC_SLIDER_PRESD 1001
+#define IDC_SLIDER_POSTSD 1002
+#define IDC_SLIDER_SD 1003
+#define IDC_TEXT_SIZE 1004
+#define IDC_TEXT_PRESD 1005
+#define IDC_TEXT_POSTSD 1006
+#define IDC_TEXT_SD 1007
+#define IDD_DLG_SCREEN 2003