mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
Tool box, color palette and status bar can be hidden and shown using menu entry and/or shortcut.
svn path=/trunk/; revision=44777
This commit is contained in:
parent
2db30d58d2
commit
d90303c704
3 changed files with 63 additions and 17 deletions
|
@ -53,6 +53,7 @@ extern HWND hStatusBar;
|
|||
extern HWND hScrollbox;
|
||||
extern HWND hMainWnd;
|
||||
extern HWND hPalWin;
|
||||
extern HWND hToolBoxContainer;
|
||||
extern HWND hToolSettings;
|
||||
extern HWND hTrackbarZoom;
|
||||
extern CHOOSECOLOR choosecolor;
|
||||
|
|
|
@ -76,6 +76,7 @@ HWND hStatusBar;
|
|||
HWND hScrollbox;
|
||||
HWND hMainWnd;
|
||||
HWND hPalWin;
|
||||
HWND hToolBoxContainer;
|
||||
HWND hToolSettings;
|
||||
HWND hTrackbarZoom;
|
||||
CHOOSECOLOR choosecolor;
|
||||
|
@ -285,6 +286,9 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument
|
|||
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 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument
|
|||
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 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument
|
|||
|
||||
/* 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);
|
||||
|
|
|
@ -112,6 +112,38 @@ drawZoomFrame(int mouseX, int mouseY)
|
|||
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 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
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 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
(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 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
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 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
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:
|
||||
|
|
Loading…
Reference in a new issue