Author: bfreisen
Date: Sun Dec 27 22:15:08 2009
New Revision: 44777
URL:
http://svn.reactos.org/svn/reactos?rev=44777&view=rev
Log:
Tool box, color palette and status bar can be hidden and shown using menu entry and/or
shortcut.
Modified:
trunk/reactos/base/applications/paint/globalvar.h
trunk/reactos/base/applications/paint/main.c
trunk/reactos/base/applications/paint/winproc.c
Modified: trunk/reactos/base/applications/paint/globalvar.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/gl…
==============================================================================
--- trunk/reactos/base/applications/paint/globalvar.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/globalvar.h [iso-8859-1] Sun Dec 27 22:15:08
2009
@@ -53,6 +53,7 @@
extern HWND hScrollbox;
extern HWND hMainWnd;
extern HWND hPalWin;
+extern HWND hToolBoxContainer;
extern HWND hToolSettings;
extern HWND hTrackbarZoom;
extern CHOOSECOLOR choosecolor;
Modified: trunk/reactos/base/applications/paint/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/ma…
==============================================================================
--- trunk/reactos/base/applications/paint/main.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/main.c [iso-8859-1] Sun Dec 27 22:15:08 2009
@@ -76,6 +76,7 @@
HWND hScrollbox;
HWND hMainWnd;
HWND hPalWin;
+HWND hToolBoxContainer;
HWND hToolSettings;
HWND hTrackbarZoom;
CHOOSECOLOR choosecolor;
@@ -285,6 +286,9 @@
CreateWindowEx(0, _T("STATIC"), _T(""), WS_CHILD | WS_VISIBLE |
SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL,
hThisInstance, NULL);
+ hToolBoxContainer =
+ CreateWindowEx(0, _T("WindowsApp"), _T(""), WS_CHILD |
WS_VISIBLE, 2, 2, 52, 350, hwnd, NULL,
+ hThisInstance, NULL);
/* creating the 16 bitmap radio buttons and setting the bitmap */
@@ -295,7 +299,7 @@
hToolbar =
CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
WS_CHILD | WS_VISIBLE | CCS_NOPARENTALIGN | CCS_VERT |
CCS_NORESIZE | TBSTYLE_TOOLTIPS,
- 3, 3, 50, 205, hwnd, NULL, hThisInstance, NULL);
+ 1, 1, 50, 205, hToolBoxContainer, NULL, hThisInstance, NULL);
hImageList = ImageList_Create(16, 16, ILC_COLOR24 | ILC_MASK, 16, 0);
SendMessage(hToolbar, TB_SETIMAGELIST, 0, (LPARAM) hImageList);
tempBm = LoadImage(hThisInstance, MAKEINTRESOURCE(IDB_TOOLBARICONS), IMAGE_BITMAP,
256, 16, 0);
@@ -327,8 +331,8 @@
/* creating the tool settings child window */
hToolSettings =
- CreateWindowEx(0, _T("ToolSettings"), _T(""), WS_CHILD |
WS_VISIBLE, 7, 210, 42, 140, hwnd, NULL,
- hThisInstance, NULL);
+ CreateWindowEx(0, _T("ToolSettings"), _T(""), WS_CHILD |
WS_VISIBLE, 5, 208, 42, 140,
+ hToolBoxContainer, NULL, hThisInstance, NULL);
hTrackbarZoom =
CreateWindowEx(0, TRACKBAR_CLASS, _T(""), WS_CHILD | TBS_VERT |
TBS_AUTOTICKS, 1, 1, 40, 64,
hToolSettings, NULL, hThisInstance, NULL);
Modified: trunk/reactos/base/applications/paint/winproc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/wi…
==============================================================================
--- trunk/reactos/base/applications/paint/winproc.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/winproc.c [iso-8859-1] Sun Dec 27 22:15:08 2009
@@ -112,6 +112,38 @@
ReleaseDC(hImageArea, hdc);
}
+void
+alignChildrenToMainWindow()
+{
+ int x, y, w, h;
+ RECT clientRect;
+ GetClientRect(hMainWnd, &clientRect);
+
+ if (IsWindowVisible(hToolBoxContainer))
+ {
+ x = 56;
+ w = clientRect.right - 56;
+ }
+ else
+ {
+ x = 0;
+ w = clientRect.right;
+ }
+ if (IsWindowVisible(hPalWin))
+ {
+ y = 49;
+ h = clientRect.bottom - 49;
+ }
+ else
+ {
+ y = 3;
+ h = clientRect.bottom - 3;
+ }
+
+ MoveWindow(hScrollbox, x, y, w, IsWindowVisible(hStatusBar) ? h - 23 : h, TRUE);
+ MoveWindow(hPalWin, x, 9, 255, 32, TRUE);
+}
+
BOOL drawing;
LRESULT CALLBACK
@@ -179,14 +211,10 @@
}
break;
case 1:
- if (undoSteps > 0)
- EnableMenuItem(GetMenu(hMainWnd), IDM_EDITUNDO, MF_ENABLED |
MF_BYCOMMAND);
- else
- EnableMenuItem(GetMenu(hMainWnd), IDM_EDITUNDO, MF_GRAYED |
MF_BYCOMMAND);
- if (redoSteps > 0)
- EnableMenuItem(GetMenu(hMainWnd), IDM_EDITREDO, MF_ENABLED |
MF_BYCOMMAND);
- else
- EnableMenuItem(GetMenu(hMainWnd), IDM_EDITREDO, MF_GRAYED |
MF_BYCOMMAND);
+ EnableMenuItem(GetMenu(hMainWnd), IDM_EDITUNDO,
+ (undoSteps > 0) ? (MF_ENABLED | MF_BYCOMMAND) :
(MF_GRAYED | MF_BYCOMMAND));
+ EnableMenuItem(GetMenu(hMainWnd), IDM_EDITREDO,
+ (redoSteps > 0) ? (MF_ENABLED | MF_BYCOMMAND) :
(MF_GRAYED | MF_BYCOMMAND));
if (IsWindowVisible(hSelection))
{
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITCUT, MF_ENABLED |
MF_BYCOMMAND);
@@ -219,10 +247,15 @@
(MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED |
MF_BYCOMMAND));
break;
}
- if (IsWindowVisible(hStatusBar))
- CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSTATUSBAR, MF_CHECKED |
MF_BYCOMMAND);
- else
- CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSTATUSBAR, MF_UNCHECKED |
MF_BYCOMMAND);
+ CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWTOOLBOX,
+ IsWindowVisible(hToolBoxContainer) ?
+ (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED |
MF_BYCOMMAND));
+ CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWCOLORPALETTE,
+ IsWindowVisible(hPalWin) ?
+ (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED |
MF_BYCOMMAND));
+ CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSTATUSBAR,
+ IsWindowVisible(hStatusBar) ?
+ (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED |
MF_BYCOMMAND));
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSHOWGRID,
showGrid ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED |
MF_BYCOMMAND));
@@ -252,8 +285,7 @@
int test[] = { LOWORD(lParam) - 260, LOWORD(lParam) - 140, LOWORD(lParam)
- 20 };
SendMessage(hStatusBar, WM_SIZE, wParam, lParam);
SendMessage(hStatusBar, SB_SETPARTS, 3, (LPARAM)&test);
- MoveWindow(hScrollbox, 56, 49, LOWORD(lParam) - 56, HIWORD(lParam) - 72,
TRUE);
- //InvalidateRect(hwnd, NULL, TRUE);
+ alignChildrenToMainWindow();
}
if (hwnd == hImageArea)
{
@@ -813,8 +845,17 @@
updateCanvasAndScrollbars();
break;
+ case IDM_VIEWTOOLBOX:
+ ShowWindow(hToolBoxContainer, IsWindowVisible(hToolBoxContainer) ?
SW_HIDE : SW_SHOW);
+ alignChildrenToMainWindow();
+ break;
+ case IDM_VIEWCOLORPALETTE:
+ ShowWindow(hPalWin, IsWindowVisible(hPalWin) ? SW_HIDE : SW_SHOW);
+ alignChildrenToMainWindow();
+ break;
case IDM_VIEWSTATUSBAR:
ShowWindow(hStatusBar, IsWindowVisible(hStatusBar) ? SW_HIDE :
SW_SHOW);
+ alignChildrenToMainWindow();
break;
case IDM_VIEWSHOWGRID: