Author: bfreisen
Date: Tue Feb 11 11:48:15 2014
New Revision: 62117
URL:
http://svn.reactos.org/svn/reactos?rev=62117&view=rev
Log:
[MSPAINT]
restructuring:
- put window class initialization where it belongs
- add separate window procedure for the scroll box class
Added:
trunk/reactos/base/applications/mspaint/scrollbox.c (with props)
trunk/reactos/base/applications/mspaint/scrollbox.h (with props)
Modified:
trunk/reactos/base/applications/mspaint/CMakeLists.txt
trunk/reactos/base/applications/mspaint/main.c
trunk/reactos/base/applications/mspaint/palette.c
trunk/reactos/base/applications/mspaint/palette.h
trunk/reactos/base/applications/mspaint/selection.c
trunk/reactos/base/applications/mspaint/selection.h
trunk/reactos/base/applications/mspaint/sizebox.c
trunk/reactos/base/applications/mspaint/sizebox.h
trunk/reactos/base/applications/mspaint/textedit.c
trunk/reactos/base/applications/mspaint/textedit.h
trunk/reactos/base/applications/mspaint/toolsettings.c
trunk/reactos/base/applications/mspaint/toolsettings.h
trunk/reactos/base/applications/mspaint/winproc.c
trunk/reactos/base/applications/mspaint/winproc.h
Modified: trunk/reactos/base/applications/mspaint/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/CMakeLists.txt [iso-8859-1] Tue Feb 11
11:48:15 2014
@@ -8,6 +8,7 @@
mouse.c
palette.c
registry.c
+ scrollbox.c
selection.c
sizebox.c
textedit.c
Modified: trunk/reactos/base/applications/mspaint/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/main.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/main.c [iso-8859-1] Tue Feb 11 11:48:15 2014
@@ -11,6 +11,7 @@
#include "precomp.h"
#include "winproc.h"
+#include "scrollbox.h"
#include "palette.h"
#include "toolsettings.h"
#include "selection.h"
@@ -138,13 +139,6 @@
{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
-
- WNDCLASSEX wclScroll;
- WNDCLASSEX wincl;
- WNDCLASSEX wclPal;
- WNDCLASSEX wclSettings;
- WNDCLASSEX wclSelection;
- WNDCLASSEX wclTextEdit;
TCHAR progtitle[1000];
TCHAR resstr[100];
@@ -192,113 +186,17 @@
hProgInstance = hThisInstance;
- /* Necessary */
+ /* initialize common controls library */
InitCommonControls();
- /* initializing and registering the window class used for the main window */
- wincl.hInstance = hThisInstance;
- wincl.lpszClassName = _T("WindowsApp");
- wincl.lpfnWndProc = WindowProcedure;
- wincl.style = CS_DBLCLKS;
- wincl.cbSize = sizeof(WNDCLASSEX);
- wincl.hIcon = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDI_APPICON));
- wincl.hIconSm = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDI_APPICON));
- wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
- wincl.lpszMenuName = NULL;
- wincl.cbClsExtra = 0;
- wincl.cbWndExtra = 0;
- wincl.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
- RegisterClassEx (&wincl);
-
- /* initializing and registering the window class used for the scroll box */
- wclScroll.hInstance = hThisInstance;
- wclScroll.lpszClassName = _T("Scrollbox");
- wclScroll.lpfnWndProc = WindowProcedure;
- wclScroll.style = 0;
- wclScroll.cbSize = sizeof(WNDCLASSEX);
- wclScroll.hIcon = NULL;
- wclScroll.hIconSm = NULL;
- wclScroll.hCursor = LoadCursor(NULL, IDC_ARROW);
- wclScroll.lpszMenuName = NULL;
- wclScroll.cbClsExtra = 0;
- wclScroll.cbWndExtra = 0;
- wclScroll.hbrBackground = GetSysColorBrush(COLOR_APPWORKSPACE);
- RegisterClassEx (&wclScroll);
-
- /* initializing and registering the window class used for the palette window */
- wclPal.hInstance = hThisInstance;
- wclPal.lpszClassName = _T("Palette");
- wclPal.lpfnWndProc = PalWinProc;
- wclPal.style = CS_DBLCLKS;
- wclPal.cbSize = sizeof(WNDCLASSEX);
- wclPal.hIcon = NULL;
- wclPal.hIconSm = NULL;
- wclPal.hCursor = LoadCursor(NULL, IDC_ARROW);
- wclPal.lpszMenuName = NULL;
- wclPal.cbClsExtra = 0;
- wclPal.cbWndExtra = 0;
- wclPal.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
- RegisterClassEx (&wclPal);
-
- /* initializing and registering the window class for the settings window */
- wclSettings.hInstance = hThisInstance;
- wclSettings.lpszClassName = _T("ToolSettings");
- wclSettings.lpfnWndProc = SettingsWinProc;
- wclSettings.style = CS_DBLCLKS;
- wclSettings.cbSize = sizeof(WNDCLASSEX);
- wclSettings.hIcon = NULL;
- wclSettings.hIconSm = NULL;
- wclSettings.hCursor = LoadCursor(NULL, IDC_ARROW);
- wclSettings.lpszMenuName = NULL;
- wclSettings.cbClsExtra = 0;
- wclSettings.cbWndExtra = 0;
- wclSettings.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
- RegisterClassEx (&wclSettings);
-
- /* initializing and registering the window class for the selection frame */
- wclSelection.hInstance = hThisInstance;
- wclSelection.lpszClassName = _T("Selection");
- wclSelection.lpfnWndProc = SelectionWinProc;
- wclSelection.style = CS_DBLCLKS;
- wclSelection.cbSize = sizeof(WNDCLASSEX);
- wclSelection.hIcon = NULL;
- wclSelection.hIconSm = NULL;
- wclSelection.hCursor = LoadCursor(NULL, IDC_SIZEALL);
- wclSelection.lpszMenuName = NULL;
- wclSelection.cbClsExtra = 0;
- wclSelection.cbWndExtra = 0;
- wclSelection.hbrBackground = NULL;
- RegisterClassEx (&wclSelection);
-
- /* initializing and registering the window class for the size boxes */
- wclSettings.hInstance = hThisInstance;
- wclSettings.lpszClassName = _T("Sizebox");
- wclSettings.lpfnWndProc = SizeboxWinProc;
- wclSettings.style = CS_DBLCLKS;
- wclSettings.cbSize = sizeof(WNDCLASSEX);
- wclSettings.hIcon = NULL;
- wclSettings.hIconSm = NULL;
- wclSettings.hCursor = LoadCursor(NULL, IDC_ARROW);
- wclSettings.lpszMenuName = NULL;
- wclSettings.cbClsExtra = 0;
- wclSettings.cbWndExtra = 0;
- wclSettings.hbrBackground = GetSysColorBrush(COLOR_HIGHLIGHT);
- RegisterClassEx (&wclSettings);
-
- /* initializing and registering the window class used for the text editor */
- wclTextEdit.hInstance = hThisInstance;
- wclTextEdit.lpszClassName = _T("TextEdit");
- wclTextEdit.lpfnWndProc = TextEditWinProc;
- wclTextEdit.style = CS_DBLCLKS;
- wclTextEdit.cbSize = sizeof(WNDCLASSEX);
- wclTextEdit.hIcon = LoadIcon(hThisInstance,
MAKEINTRESOURCE(IDI_APPICON));
- wclTextEdit.hIconSm = LoadIcon(hThisInstance,
MAKEINTRESOURCE(IDI_APPICON));
- wclTextEdit.hCursor = LoadCursor(NULL, IDC_ARROW);
- wclTextEdit.lpszMenuName = NULL;
- wclTextEdit.cbClsExtra = 0;
- wclTextEdit.cbWndExtra = 0;
- wclTextEdit.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
- RegisterClassEx (&wclTextEdit);
+ /* register application defined window classes */
+ RegisterWclMain();
+ RegisterWclScrollbox();
+ RegisterWclPal();
+ RegisterWclSettings();
+ RegisterWclSelection();
+ RegisterWclSizebox();
+ RegisterWclTextEdit();
LoadString(hThisInstance, IDS_DEFAULTFILENAME, filename, SIZEOF(filename));
LoadString(hThisInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
@@ -307,12 +205,12 @@
/* create main window */
hwnd =
- CreateWindowEx(0, _T("WindowsApp"), progtitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 544,
+ CreateWindowEx(0, _T("MainWindow"), progtitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 544,
375, HWND_DESKTOP, NULL, hThisInstance, NULL);
hMainWnd = hwnd;
hwndMiniature =
- CreateWindowEx(WS_EX_PALETTEWINDOW, _T("WindowsApp"), miniaturetitle,
+ CreateWindowEx(WS_EX_PALETTEWINDOW, _T("MainWindow"), miniaturetitle,
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME, 180, 200,
120, 100, hwnd,
NULL, hThisInstance, NULL);
@@ -337,7 +235,7 @@
hThisInstance, NULL);
hToolBoxContainer =
- CreateWindowEx(0, _T("WindowsApp"), _T(""), WS_CHILD |
WS_VISIBLE, 2, 2, 52, 350, hwnd, NULL,
+ CreateWindowEx(0, _T("MainWindow"), _T(""), WS_CHILD |
WS_VISIBLE, 2, 2, 52, 350, hwnd, NULL,
hThisInstance, NULL);
/* creating the 16 bitmap radio buttons and setting the bitmap */
@@ -417,7 +315,7 @@
/* creating the window inside the scroll box, on which the image in hDrawingDC's
bitmap is drawn */
hImageArea =
- CreateWindowEx(0, _T("Scrollbox"), _T(""), WS_CHILD |
WS_VISIBLE, 3, 3, imgXRes, imgYRes, hScrlClient,
+ CreateWindowEx(0, _T("MainWindow"), _T(""), WS_CHILD |
WS_VISIBLE, 3, 3, imgXRes, imgYRes, hScrlClient,
NULL, hThisInstance, NULL);
hDC = GetDC(hImageArea);
Modified: trunk/reactos/base/applications/mspaint/palette.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/palette.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/palette.c [iso-8859-1] Tue Feb 11 11:48:15
2014
@@ -9,8 +9,29 @@
/* INCLUDES *********************************************************/
#include "precomp.h"
+#include "palette.h"
/* FUNCTIONS ********************************************************/
+
+void
+RegisterWclPal()
+{
+ WNDCLASSEX wclPal;
+ /* initializing and registering the window class used for the palette window */
+ wclPal.hInstance = hProgInstance;
+ wclPal.lpszClassName = _T("Palette");
+ wclPal.lpfnWndProc = PalWinProc;
+ wclPal.style = CS_DBLCLKS;
+ wclPal.cbSize = sizeof(WNDCLASSEX);
+ wclPal.hIcon = NULL;
+ wclPal.hIconSm = NULL;
+ wclPal.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wclPal.lpszMenuName = NULL;
+ wclPal.cbClsExtra = 0;
+ wclPal.cbWndExtra = 0;
+ wclPal.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
+ RegisterClassEx (&wclPal);
+}
LRESULT CALLBACK
PalWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Modified: trunk/reactos/base/applications/mspaint/palette.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/palette.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/palette.h [iso-8859-1] Tue Feb 11 11:48:15
2014
@@ -6,4 +6,6 @@
* PROGRAMMERS: Benedikt Freisen
*/
+void RegisterWclPal();
+
LRESULT CALLBACK PalWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
Added: trunk/reactos/base/applications/mspaint/scrollbox.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/scrollbox.c (added)
+++ trunk/reactos/base/applications/mspaint/scrollbox.c [iso-8859-1] Tue Feb 11 11:48:15
2014
@@ -0,0 +1,142 @@
+/*
+ * PROJECT: PAINT for ReactOS
+ * LICENSE: LGPL
+ * FILE: scrollbox.c
+ * PURPOSE: Functionality surrounding the scroll box window class
+ * PROGRAMMERS: Benedikt Freisen
+ */
+
+/* INCLUDES *********************************************************/
+
+#include "precomp.h"
+#include "scrollbox.h"
+
+/* FUNCTIONS ********************************************************/
+
+void
+RegisterWclScrollbox()
+{
+ WNDCLASSEX wclScroll;
+ /* initializing and registering the window class used for the scroll box */
+ wclScroll.hInstance = hProgInstance;
+ wclScroll.lpszClassName = _T("Scrollbox");
+ wclScroll.lpfnWndProc = ScrollboxWinProc;
+ wclScroll.style = 0;
+ wclScroll.cbSize = sizeof(WNDCLASSEX);
+ wclScroll.hIcon = NULL;
+ wclScroll.hIconSm = NULL;
+ wclScroll.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wclScroll.lpszMenuName = NULL;
+ wclScroll.cbClsExtra = 0;
+ wclScroll.cbWndExtra = 0;
+ wclScroll.hbrBackground = GetSysColorBrush(COLOR_APPWORKSPACE);
+ RegisterClassEx (&wclScroll);
+}
+
+void
+UpdateScrollbox()
+{
+ RECT clientRectScrollbox;
+ RECT clientRectImageArea;
+ SCROLLINFO si;
+ GetClientRect(hScrollbox, &clientRectScrollbox);
+ GetClientRect(hImageArea, &clientRectImageArea);
+ si.cbSize = sizeof(SCROLLINFO);
+ si.fMask = SIF_PAGE | SIF_RANGE;
+ si.nMax = clientRectImageArea.right + 6 - 1;
+ si.nMin = 0;
+ si.nPage = clientRectScrollbox.right;
+ SetScrollInfo(hScrollbox, SB_HORZ, &si, TRUE);
+ GetClientRect(hScrollbox, &clientRectScrollbox);
+ si.nMax = clientRectImageArea.bottom + 6 - 1;
+ si.nPage = clientRectScrollbox.bottom;
+ SetScrollInfo(hScrollbox, SB_VERT, &si, TRUE);
+ MoveWindow(hScrlClient,
+ -GetScrollPos(hScrollbox, SB_HORZ), -GetScrollPos(hScrollbox, SB_VERT),
+ max(clientRectImageArea.right + 6, clientRectScrollbox.right),
+ max(clientRectImageArea.bottom + 6, clientRectScrollbox.bottom), TRUE);
+}
+
+LRESULT CALLBACK
+ScrollboxWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message)
+ {
+ case WM_SIZE:
+ if (hwnd == hScrollbox)
+ {
+ UpdateScrollbox();
+ }
+ break;
+ case WM_HSCROLL:
+ if (hwnd == hScrollbox)
+ {
+ SCROLLINFO si;
+ si.cbSize = sizeof(SCROLLINFO);
+ si.fMask = SIF_ALL;
+ GetScrollInfo(hScrollbox, SB_HORZ, &si);
+ switch (LOWORD(wParam))
+ {
+ case SB_THUMBTRACK:
+ case SB_THUMBPOSITION:
+ si.nPos = HIWORD(wParam);
+ break;
+ case SB_LINELEFT:
+ si.nPos -= 5;
+ break;
+ case SB_LINERIGHT:
+ si.nPos += 5;
+ break;
+ case SB_PAGELEFT:
+ si.nPos -= si.nPage;
+ break;
+ case SB_PAGERIGHT:
+ si.nPos += si.nPage;
+ break;
+ }
+ SetScrollInfo(hScrollbox, SB_HORZ, &si, TRUE);
+ MoveWindow(hScrlClient, -GetScrollPos(hScrollbox, SB_HORZ),
+ -GetScrollPos(hScrollbox, SB_VERT), imgXRes * zoom / 1000 +
6,
+ imgYRes * zoom / 1000 + 6, TRUE);
+ }
+ break;
+
+ case WM_VSCROLL:
+ if (hwnd == hScrollbox)
+ {
+ SCROLLINFO si;
+ si.cbSize = sizeof(SCROLLINFO);
+ si.fMask = SIF_ALL;
+ GetScrollInfo(hScrollbox, SB_VERT, &si);
+ switch (LOWORD(wParam))
+ {
+ case SB_THUMBTRACK:
+ case SB_THUMBPOSITION:
+ si.nPos = HIWORD(wParam);
+ break;
+ case SB_LINEUP:
+ si.nPos -= 5;
+ break;
+ case SB_LINEDOWN:
+ si.nPos += 5;
+ break;
+ case SB_PAGEUP:
+ si.nPos -= si.nPage;
+ break;
+ case SB_PAGEDOWN:
+ si.nPos += si.nPage;
+ break;
+ }
+ SetScrollInfo(hScrollbox, SB_VERT, &si, TRUE);
+ MoveWindow(hScrlClient, -GetScrollPos(hScrollbox, SB_HORZ),
+ -GetScrollPos(hScrollbox, SB_VERT), imgXRes * zoom / 1000 +
6,
+ imgYRes * zoom / 1000 + 6, TRUE);
+ }
+ break;
+
+ default:
+ return DefWindowProc(hwnd, message, wParam, lParam);
+ }
+
+ return 0;
+}
Propchange: trunk/reactos/base/applications/mspaint/scrollbox.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/base/applications/mspaint/scrollbox.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/scrollbox.h (added)
+++ trunk/reactos/base/applications/mspaint/scrollbox.h [iso-8859-1] Tue Feb 11 11:48:15
2014
@@ -0,0 +1,13 @@
+/*
+ * PROJECT: PAINT for ReactOS
+ * LICENSE: LGPL
+ * FILE: scrollbox.h
+ * PURPOSE: Functionality surrounding the scroll box window class
+ * PROGRAMMERS: Benedikt Freisen
+ */
+
+void RegisterWclScrollbox();
+
+void UpdateScrollbox();
+
+LRESULT CALLBACK ScrollboxWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
lParam);
Propchange: trunk/reactos/base/applications/mspaint/scrollbox.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/base/applications/mspaint/selection.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/selection.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/selection.c [iso-8859-1] Tue Feb 11 11:48:15
2014
@@ -37,6 +37,26 @@
POINTS pos;
POINTS frac;
POINT delta;
+
+void
+RegisterWclSelection()
+{
+ WNDCLASSEX wclSelection;
+ /* initializing and registering the window class for the selection frame */
+ wclSelection.hInstance = hProgInstance;
+ wclSelection.lpszClassName = _T("Selection");
+ wclSelection.lpfnWndProc = SelectionWinProc;
+ wclSelection.style = CS_DBLCLKS;
+ wclSelection.cbSize = sizeof(WNDCLASSEX);
+ wclSelection.hIcon = NULL;
+ wclSelection.hIconSm = NULL;
+ wclSelection.hCursor = LoadCursor(NULL, IDC_SIZEALL);
+ wclSelection.lpszMenuName = NULL;
+ wclSelection.cbClsExtra = 0;
+ wclSelection.cbWndExtra = 0;
+ wclSelection.hbrBackground = NULL;
+ RegisterClassEx (&wclSelection);
+}
BOOL
ColorKeyedMaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC
hdcSrc, int nXSrc, int nYSrc, HBITMAP hbmMask, int xMask, int yMask, DWORD dwRop, COLORREF
keyColor)
Modified: trunk/reactos/base/applications/mspaint/selection.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/selection.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/selection.h [iso-8859-1] Tue Feb 11 11:48:15
2014
@@ -6,6 +6,8 @@
* PROGRAMMERS: Benedikt Freisen
*/
+void RegisterWclSelection();
+
void ForceRefreshSelectionContents();
LRESULT CALLBACK SelectionWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
lParam);
Modified: trunk/reactos/base/applications/mspaint/sizebox.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/sizebox.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/sizebox.c [iso-8859-1] Tue Feb 11 11:48:15
2014
@@ -9,12 +9,33 @@
/* INCLUDES *********************************************************/
#include "precomp.h"
+#include "sizebox.h"
/* FUNCTIONS ********************************************************/
BOOL resizing = FALSE;
short xOrig;
short yOrig;
+
+void
+RegisterWclSizebox()
+{
+ WNDCLASSEX wclSizebox;
+ /* initializing and registering the window class for the size boxes */
+ wclSizebox.hInstance = hProgInstance;
+ wclSizebox.lpszClassName = _T("Sizebox");
+ wclSizebox.lpfnWndProc = SizeboxWinProc;
+ wclSizebox.style = CS_DBLCLKS;
+ wclSizebox.cbSize = sizeof(WNDCLASSEX);
+ wclSizebox.hIcon = NULL;
+ wclSizebox.hIconSm = NULL;
+ wclSizebox.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wclSizebox.lpszMenuName = NULL;
+ wclSizebox.cbClsExtra = 0;
+ wclSizebox.cbWndExtra = 0;
+ wclSizebox.hbrBackground = GetSysColorBrush(COLOR_HIGHLIGHT);
+ RegisterClassEx (&wclSizebox);
+}
LRESULT CALLBACK
SizeboxWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Modified: trunk/reactos/base/applications/mspaint/sizebox.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/sizebox.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/sizebox.h [iso-8859-1] Tue Feb 11 11:48:15
2014
@@ -6,4 +6,6 @@
* PROGRAMMERS: Benedikt Freisen
*/
+void RegisterWclSizebox();
+
LRESULT CALLBACK SizeboxWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
Modified: trunk/reactos/base/applications/mspaint/textedit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/textedit.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/textedit.c [iso-8859-1] Tue Feb 11 11:48:15
2014
@@ -9,8 +9,29 @@
/* INCLUDES *********************************************************/
#include "precomp.h"
+#include "textedit.h"
/* FUNCTIONS ********************************************************/
+
+void
+RegisterWclTextEdit()
+{
+ WNDCLASSEX wclTextEdit;
+ /* initializing and registering the window class used for the text editor */
+ wclTextEdit.hInstance = hProgInstance;
+ wclTextEdit.lpszClassName = _T("TextEdit");
+ wclTextEdit.lpfnWndProc = TextEditWinProc;
+ wclTextEdit.style = CS_DBLCLKS;
+ wclTextEdit.cbSize = sizeof(WNDCLASSEX);
+ wclTextEdit.hIcon = LoadIcon(hProgInstance,
MAKEINTRESOURCE(IDI_APPICON));
+ wclTextEdit.hIconSm = LoadIcon(hProgInstance,
MAKEINTRESOURCE(IDI_APPICON));
+ wclTextEdit.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wclTextEdit.lpszMenuName = NULL;
+ wclTextEdit.cbClsExtra = 0;
+ wclTextEdit.cbWndExtra = 0;
+ wclTextEdit.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
+ RegisterClassEx (&wclTextEdit);
+}
LRESULT CALLBACK
TextEditWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Modified: trunk/reactos/base/applications/mspaint/textedit.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/textedit.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/textedit.h [iso-8859-1] Tue Feb 11 11:48:15
2014
@@ -6,4 +6,6 @@
* PROGRAMMERS: Benedikt Freisen
*/
+void RegisterWclTextEdit();
+
LRESULT CALLBACK TextEditWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
Modified: trunk/reactos/base/applications/mspaint/toolsettings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/toolsettings.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/toolsettings.c [iso-8859-1] Tue Feb 11
11:48:15 2014
@@ -9,10 +9,30 @@
/* INCLUDES *********************************************************/
#include "precomp.h"
+#include "toolsettings.h"
/* FUNCTIONS ********************************************************/
extern void zoomTo(int, int, int);
+
+void RegisterWclSettings()
+{
+ WNDCLASSEX wclSettings;
+ /* initializing and registering the window class for the settings window */
+ wclSettings.hInstance = hProgInstance;
+ wclSettings.lpszClassName = _T("ToolSettings");
+ wclSettings.lpfnWndProc = SettingsWinProc;
+ wclSettings.style = CS_DBLCLKS;
+ wclSettings.cbSize = sizeof(WNDCLASSEX);
+ wclSettings.hIcon = NULL;
+ wclSettings.hIconSm = NULL;
+ wclSettings.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wclSettings.lpszMenuName = NULL;
+ wclSettings.cbClsExtra = 0;
+ wclSettings.cbWndExtra = 0;
+ wclSettings.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
+ RegisterClassEx (&wclSettings);
+}
LRESULT CALLBACK
SettingsWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Modified: trunk/reactos/base/applications/mspaint/toolsettings.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/toolsettings.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/toolsettings.h [iso-8859-1] Tue Feb 11
11:48:15 2014
@@ -6,4 +6,6 @@
* PROGRAMMERS: Benedikt Freisen
*/
+void RegisterWclSettings();
+
LRESULT CALLBACK SettingsWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
Modified: trunk/reactos/base/applications/mspaint/winproc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/winproc.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/winproc.c [iso-8859-1] Tue Feb 11 11:48:15
2014
@@ -11,10 +11,32 @@
#include "precomp.h"
+#include "winproc.h"
#include "dialogs.h"
#include "registry.h"
+#include "scrollbox.h"
/* FUNCTIONS ********************************************************/
+
+void
+RegisterWclMain()
+{
+ WNDCLASSEX wclMain;
+ /* initializing and registering the window class used for the main window */
+ wclMain.hInstance = hProgInstance;
+ wclMain.lpszClassName = _T("MainWindow");
+ wclMain.lpfnWndProc = MainWindowProcedure;
+ wclMain.style = CS_DBLCLKS;
+ wclMain.cbSize = sizeof(WNDCLASSEX);
+ wclMain.hIcon = LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON));
+ wclMain.hIconSm = LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON));
+ wclMain.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wclMain.lpszMenuName = NULL;
+ wclMain.cbClsExtra = 0;
+ wclMain.cbWndExtra = 0;
+ wclMain.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
+ RegisterClassEx (&wclMain);
+}
void
selectTool(int tool)
@@ -212,7 +234,7 @@
BOOL drawing;
LRESULT CALLBACK
-WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) /* handle the messages */
{
@@ -365,93 +387,9 @@
imgXRes * zoom / 1000 + 3,
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
}
- if ((hwnd == hImageArea) || (hwnd == hScrollbox))
- {
- RECT clientRectScrollbox;
- RECT clientRectImageArea;
- SCROLLINFO si;
- GetClientRect(hScrollbox, &clientRectScrollbox);
- GetClientRect(hImageArea, &clientRectImageArea);
- si.cbSize = sizeof(SCROLLINFO);
- si.fMask = SIF_PAGE | SIF_RANGE;
- si.nMax = clientRectImageArea.right + 6 - 1;
- si.nMin = 0;
- si.nPage = clientRectScrollbox.right;
- SetScrollInfo(hScrollbox, SB_HORZ, &si, TRUE);
- GetClientRect(hScrollbox, &clientRectScrollbox);
- si.nMax = clientRectImageArea.bottom + 6 - 1;
- si.nPage = clientRectScrollbox.bottom;
- SetScrollInfo(hScrollbox, SB_VERT, &si, TRUE);
- MoveWindow(hScrlClient,
- -GetScrollPos(hScrollbox, SB_HORZ), -GetScrollPos(hScrollbox,
SB_VERT),
- max(clientRectImageArea.right + 6,
clientRectScrollbox.right),
- max(clientRectImageArea.bottom + 6,
clientRectScrollbox.bottom), TRUE);
- }
- break;
-
- case WM_HSCROLL:
- if (hwnd == hScrollbox)
- {
- SCROLLINFO si;
- si.cbSize = sizeof(SCROLLINFO);
- si.fMask = SIF_ALL;
- GetScrollInfo(hScrollbox, SB_HORZ, &si);
- switch (LOWORD(wParam))
- {
- case SB_THUMBTRACK:
- case SB_THUMBPOSITION:
- si.nPos = HIWORD(wParam);
- break;
- case SB_LINELEFT:
- si.nPos -= 5;
- break;
- case SB_LINERIGHT:
- si.nPos += 5;
- break;
- case SB_PAGELEFT:
- si.nPos -= si.nPage;
- break;
- case SB_PAGERIGHT:
- si.nPos += si.nPage;
- break;
- }
- SetScrollInfo(hScrollbox, SB_HORZ, &si, TRUE);
- MoveWindow(hScrlClient, -GetScrollPos(hScrollbox, SB_HORZ),
- -GetScrollPos(hScrollbox, SB_VERT), imgXRes * zoom / 1000 +
6,
- imgYRes * zoom / 1000 + 6, TRUE);
- }
- break;
-
- case WM_VSCROLL:
- if (hwnd == hScrollbox)
- {
- SCROLLINFO si;
- si.cbSize = sizeof(SCROLLINFO);
- si.fMask = SIF_ALL;
- GetScrollInfo(hScrollbox, SB_VERT, &si);
- switch (LOWORD(wParam))
- {
- case SB_THUMBTRACK:
- case SB_THUMBPOSITION:
- si.nPos = HIWORD(wParam);
- break;
- case SB_LINEUP:
- si.nPos -= 5;
- break;
- case SB_LINEDOWN:
- si.nPos += 5;
- break;
- case SB_PAGEUP:
- si.nPos -= si.nPage;
- break;
- case SB_PAGEDOWN:
- si.nPos += si.nPage;
- break;
- }
- SetScrollInfo(hScrollbox, SB_VERT, &si, TRUE);
- MoveWindow(hScrlClient, -GetScrollPos(hScrollbox, SB_HORZ),
- -GetScrollPos(hScrollbox, SB_VERT), imgXRes * zoom / 1000 +
6,
- imgYRes * zoom / 1000 + 6, TRUE);
+ if (hwnd == hImageArea)
+ {
+ UpdateScrollbox();
}
break;
Modified: trunk/reactos/base/applications/mspaint/winproc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/winproc.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/winproc.h [iso-8859-1] Tue Feb 11 11:48:15
2014
@@ -7,4 +7,6 @@
* PROGRAMMERS: Benedikt Freisen
*/
-LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+void RegisterWclMain();
+
+LRESULT CALLBACK MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM
lParam);