Author: mpiulachs
Date: Sun May 4 16:10:36 2008
New Revision: 33282
URL:
http://svn.reactos.org/svn/reactos?rev=33282&view=rev
Log:
- simple but colorful new GDI screensaver
Added:
trunk/rosapps/applications/screensavers/circles/
trunk/rosapps/applications/screensavers/circles/circles.c (with props)
trunk/rosapps/applications/screensavers/circles/circles.rbuild (with props)
trunk/rosapps/applications/screensavers/circles/circles.rc (with props)
trunk/rosapps/applications/screensavers/circles/circles.spec (with props)
trunk/rosapps/applications/screensavers/circles/lang/
trunk/rosapps/applications/screensavers/circles/lang/en-US.rc (with props)
trunk/rosapps/applications/screensavers/circles/resource.h (with props)
Modified:
trunk/rosapps/applications/screensavers/screensavers.rbuild
Added: trunk/rosapps/applications/screensavers/circles/circles.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/circles/circles.c (added)
+++ trunk/rosapps/applications/screensavers/circles/circles.c [iso-8859-1] Sun May 4
16:10:36 2008
@@ -1,0 +1,120 @@
+/*
+ * Copyright 2008 Marc Piulachs (marc.piulachs(a)codexchange.net)
+ *
+ * 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 <scrnsave.h>
+#include <tchar.h>
+#include "resource.h"
+
+#define RANDOM_COLOR (rand () % 256)
+
+#define APPNAME _T("Circles")
+#define APP_TIMER 1
+#define APP_TIMER_INTERVAL 100
+#define MAX_CIRCLES 50
+
+int circlesCount;
+int width, x, y;
+
+LRESULT WINAPI ScreenSaverProc (HWND hwnd, UINT iMsg, WPARAM wparam,
+ LPARAM lparam)
+{
+ HDC hdc;
+ RECT rect;
+ HBRUSH hbrush, hbrushOld;
+
+ switch (iMsg)
+ {
+ case WM_CREATE:
+ {
+ SetTimer (
+ hwnd,
+ APP_TIMER,
+ APP_TIMER_INTERVAL,
+ NULL);
+ }
+ break;
+ case WM_DESTROY:
+ {
+ KillTimer (hwnd, APP_TIMER);
+ PostQuitMessage (0);
+ return 0;
+ }
+ break;
+ case WM_TIMER:
+ {
+ hdc = GetDC (hwnd);
+ GetClientRect (hwnd, &rect);
+ hbrush = CreateSolidBrush (RGB (RANDOM_COLOR, RANDOM_COLOR, RANDOM_COLOR));
+ hbrushOld = SelectObject (hdc, hbrush);
+
+ x = rand () % rect.right;
+ y = rand () % rect.bottom;
+
+ /* the circle will be 10% of total screen */
+ width = rect.right / 10;
+ if (rect.bottom / 10 < width)
+ width = rect.bottom / 10;
+
+ /* Draw circle on screen */
+ Ellipse (
+ hdc,
+ x,
+ y,
+ x + width,
+ y + width);
+
+ //Track the number of painted circles on scren
+ circlesCount++;
+ if (circlesCount == MAX_CIRCLES)
+ {
+ InvalidateRect (hwnd, NULL, TRUE);
+ circlesCount = 0;
+ }
+
+ SelectObject (hdc, hbrushOld);
+ DeleteObject (hbrush);
+ ReleaseDC (hwnd, hdc);
+
+ return 0;
+ }
+ }
+
+ return DefScreenSaverProc (hwnd, iMsg, wparam, lparam);
+}
+
+
+BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
lParam)
+{
+ return FALSE;
+}
+
+// This function is only called one time before opening the configuration dialog.
+// Use it to show a message that no configuration is necesssary and return FALSE to
indicate that no configuration dialog shall be opened.
+BOOL WINAPI RegisterDialogClasses(HANDLE hInst)
+{
+ TCHAR szMessage[256];
+ TCHAR szTitle[25];
+
+ LoadString(hInst, IDS_TEXT, szMessage, sizeof(szMessage) / sizeof(TCHAR));
+ LoadString(hInst, IDS_DESCRIPTION, szTitle, sizeof(szTitle) / sizeof(TCHAR));
+
+ MessageBox(NULL, szMessage, szTitle, MB_OK | MB_ICONEXCLAMATION);
+
+ return FALSE;
+}
Propchange: trunk/rosapps/applications/screensavers/circles/circles.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rosapps/applications/screensavers/circles/circles.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/circles/circles.rbuild (added)
+++ trunk/rosapps/applications/screensavers/circles/circles.rbuild [iso-8859-1] Sun May 4
16:10:36 2008
@@ -1,0 +1,16 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
+<module name="circles" type="win32scr"
installbase="system32" unicode="true">
+ <importlibrary definition="circles.spec.def" />
+ <include base="circles">.</include>
+ <library>scrnsave</library>
+ <library>kernel32</library>
+ <library>user32</library>
+ <library>gdi32</library>
+
+ <metadata description = "Simple Circles GDI screensaver" />
+
+ <file>circles.c</file>
+ <file>circles.rc</file>
+ <file>circles.spec</file>
+</module>
Propchange: trunk/rosapps/applications/screensavers/circles/circles.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rosapps/applications/screensavers/circles/circles.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/circles/circles.rc (added)
+++ trunk/rosapps/applications/screensavers/circles/circles.rc [iso-8859-1] Sun May 4
16:10:36 2008
@@ -1,0 +1,14 @@
+#include <windows.h>
+#include <scrnsave.h>
+#include "resource.h"
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+#define REACTOS_VERSION_DLL
+#define REACTOS_STR_FILE_DESCRIPTION "Circles ScreenSaver\0"
+#define REACTOS_STR_INTERNAL_NAME "circles\0"
+#define REACTOS_STR_ORIGINAL_FILENAME "circles.scr\0"
+
+#include <reactos/version.rc>
+
+#include "lang/en-US.rc"
Propchange: trunk/rosapps/applications/screensavers/circles/circles.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rosapps/applications/screensavers/circles/circles.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/circles/circles.spec (added)
+++ trunk/rosapps/applications/screensavers/circles/circles.spec [iso-8859-1] Sun May 4
16:10:36 2008
@@ -1,0 +1,2 @@
+@ stdcall ScreenSaverProc(ptr long ptr ptr)
+@ stdcall ScreenSaverConfigureDialog(ptr long ptr ptr)
Propchange: trunk/rosapps/applications/screensavers/circles/circles.spec
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rosapps/applications/screensavers/circles/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/circles/lang/en-US.rc (added)
+++ trunk/rosapps/applications/screensavers/circles/lang/en-US.rc [iso-8859-1] Sun May 4
16:10:36 2008
@@ -1,0 +1,7 @@
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_DESCRIPTION "Circles"
+ IDS_TEXT "No options need to be set."
+END
Propchange: trunk/rosapps/applications/screensavers/circles/lang/en-US.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rosapps/applications/screensavers/circles/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/circles/resource.h (added)
+++ trunk/rosapps/applications/screensavers/circles/resource.h [iso-8859-1] Sun May 4
16:10:36 2008
@@ -1,0 +1,3 @@
+#define IDS_TEXT 3
+#define IDB_WORKSTATION 0x100
+#define IDB_SERVER 0x200
Propchange: trunk/rosapps/applications/screensavers/circles/resource.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rosapps/applications/screensavers/screensavers.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
==============================================================================
--- trunk/rosapps/applications/screensavers/screensavers.rbuild [iso-8859-1] (original)
+++ trunk/rosapps/applications/screensavers/screensavers.rbuild [iso-8859-1] Sun May 4
16:10:36 2008
@@ -1,6 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
<group
xmlns:xi="http://www.w3.org/2001/XInclude">
+ <directory name="circles">
+ <xi:include href="circles/circles.rbuild" />
+ </directory>
<directory name="cylfrac">
<xi:include href="cylfrac/cylfrac.rbuild" />
</directory>