- convert the floating windows to use pointers within the main structure

- allow showing and hiding of floating windows
- implement a rough version of the history interface
- temp draw a suggestion on how the color window could look.
- insert a few menu hints
- lots of half implemented of temp stuff in this commit, but committing now before the patch gets any bigger.

svn path=/trunk/; revision=21651
This commit is contained in:
Ged Murphy 2006-04-18 16:42:54 +00:00
parent 6da6e80112
commit 904d3ca622
14 changed files with 594 additions and 148 deletions

View file

@ -33,8 +33,8 @@ BEGIN
POPUP "&View"
BEGIN
MENUITEM "&Tools", ID_TOOLS, CHECKED
MENUITEM "&Color", -1, CHECKED
MENUITEM "&History", -1, CHECKED
MENUITEM "&Colors", ID_COLOR, CHECKED
MENUITEM "&History", ID_HISTORY, CHECKED
MENUITEM "&Status Bar", ID_STATUSBAR, CHECKED
END
POPUP "&Image"
@ -163,17 +163,36 @@ BEGIN
IDS_TOOLTIP_REDO "Redo"
END
/* Hints */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HINT_BLANK " "
IDS_HINT_NEW " Creates a new document."
IDS_HINT_OPEN " Opens an existing document."
IDS_HINT_CLOSE " Closes this window."
IDS_HINT_CLOSEALL " Closes all windows."
IDS_HINT_SAVE " Saves the active document."
IDS_HINT_SAVEAS " Saves the active document with a new name."
IDS_HINT_PRINTPRE " Previews the printed document."
IDS_HINT_PRINT " Prints the active document."
IDS_HINT_PROP " Shows the properties of the active image."
IDS_HINT_EXIT " Exits this application."
IDS_HINT_TOOLS " Shows or hides the tools floating window."
IDS_HINT_COLORS " Shows or hides the colors floating window."
IDS_HINT_HISTORY " Shows or hides the history floating window."
IDS_HINT_STATUS " Shows or hides the status bar."
IDS_HINT_CASCADE " Arrange windows so they overlap."
IDS_HINT_TILE_HORZ " Arrange windows as non-overlapping tiles."
IDS_HINT_TILE_VERT " Arrange windows as non-overlapping tiles."
IDS_HINT_ARRANGE " Arrange icons at the bottom of the window."
IDS_HINT_NEXT " Activates the next window."
IDS_HINT_SYS_RESTORE " Restores this window to normal size."
IDS_HINT_SYS_MOVE " Moves this window."
IDS_HINT_SYS_SIZE " Resizes this window."
IDS_HINT_SYS_MINIMIZE " Collapses this window to an icon."
IDS_HINT_SYS_MAXIMIZE " Expands this window to fill this screen."
IDS_HINT_SYS_CLOSE " Closes this window."
IDS_HINT_SYS_NEXT " Activates the next window."
END

View file

@ -5,46 +5,52 @@ static const TCHAR szFloatWndClass[] = TEXT("ImageSoftFloatWndClass");
#define ID_TIMER 1
TBBUTTON ToolsButtons[] = {
/* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
{TBICON_RECTSEL, ID_RECTSEL, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* rectangle select */
{TBICON_MOVESEL, ID_MOVESEL, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* move selected pixels */
{TBICON_LASOO, ID_LASOO, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* lasso select */
{TBICON_MOVE, ID_MOVE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* move selection */
{TBICON_ECLIPSESEL, ID_ECLIPSESEL, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* elipse select */
{TBICON_ZOOM, ID_ZOOM, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* zoom */
{TBICON_MAGICWAND, ID_MAGICWAND, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* magic wand */
{TBICON_TEXT, ID_TEXT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* text */
{TBICON_PAINTBRUSH, ID_PAINTBRUSH, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* paintbrush */
{TBICON_ERASER, ID_ERASER, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* eraser */
{TBICON_PENCIL, ID_PENCIL, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* pencil */
{TBICON_COLORPICKER, ID_COLORPICKER, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* color picker */
{TBICON_CLONESTAMP, ID_CLONESTAMP, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* clone stamp */
{TBICON_RECOLORING, ID_RECOLORING, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* recolor */
{TBICON_PAINTBUCKET, ID_PAINTBUCKET, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* paint bucket */
{TBICON_LINE, ID_LINE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* line */
{TBICON_RECTANGLE, ID_RECTANGLE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* rectangle */
{TBICON_ROUNDRECT, ID_ROUNDRECT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* round rectangle */
{TBICON_ECLIPSE, ID_ECLIPSE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* elipse */
{TBICON_FREEFORM, ID_FREEFORM, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* free form */
/* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
{TBICON_RECTSEL, ID_RECTSEL, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* rectangle select */
{TBICON_MOVESEL, ID_MOVESEL, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* move selected pixels */
{TBICON_LASOO, ID_LASOO, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* lasso select */
{TBICON_MOVE, ID_MOVE, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* move selection */
{TBICON_ECLIPSESEL, ID_ECLIPSESEL, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* elipse select */
{TBICON_ZOOM, ID_ZOOM, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* zoom */
{TBICON_MAGICWAND, ID_MAGICWAND, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* magic wand */
{TBICON_TEXT, ID_TEXT, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* text */
{TBICON_PAINTBRUSH, ID_PAINTBRUSH, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* paintbrush */
{TBICON_ERASER, ID_ERASER, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* eraser */
{TBICON_PENCIL, ID_PENCIL, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* pencil */
{TBICON_COLORPICKER, ID_COLORPICKER, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* color picker */
{TBICON_CLONESTAMP, ID_CLONESTAMP, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* clone stamp */
{TBICON_RECOLORING, ID_RECOLORING, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* recolor */
{TBICON_PAINTBUCKET, ID_PAINTBUCKET, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* paint bucket */
{TBICON_LINE, ID_LINE, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* line */
{TBICON_RECTANGLE, ID_RECTANGLE, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* rectangle */
{TBICON_ROUNDRECT, ID_ROUNDRECT, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* round rectangle */
{TBICON_ECLIPSE, ID_ECLIPSE, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* elipse */
{TBICON_FREEFORM, ID_FREEFORM, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* free form */
{10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
};
TBBUTTON HistoryButtons[] = {
{TBICON_BACKSM, ID_BACK, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* back */
{TBICON_UNDOSM, ID_UNDO, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* undo */
{TBICON_REDOSM, ID_REDO, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* redo */
{TBICON_FORWARDSM, ID_FORWARD, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* forward */
{TBICON_DELETESM, ID_DELETE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* delete */
};
BOOL
ShowHideWindow(HWND hwnd)
ShowHideWindow(PFLT_WND FltInfo)
{
static BOOL Hidden = FALSE;
ShowWindow(FltInfo->hSelf, FltInfo->bShow ? SW_HIDE : SW_SHOW);
FltInfo->bShow = ~FltInfo->bShow;
ShowWindow(hwnd, Hidden ? SW_SHOW : SW_HIDE);
Hidden = ~Hidden;
return Hidden;
return FltInfo->bShow;
}
VOID
FloatToolbarCreateToolsGui(PFLT_WND FltTools)
FloatToolbarCreateToolsGui(PMAIN_WND_INFO Info)
{
HWND hTb;
HIMAGELIST hImageList;
@ -57,7 +63,7 @@ FloatToolbarCreateToolsGui(PFLT_WND FltTools)
NULL,
WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_WRAPABLE | CCS_NODIVIDER,
0, 0, 32, 200,
FltTools->hSelf,
Info->fltTools->hSelf,
NULL,
hInstance,
NULL);
@ -77,7 +83,7 @@ FloatToolbarCreateToolsGui(PFLT_WND FltTools)
0,
(LPARAM)MAKELONG(16, 16));
hImageList = InitImageList(20,
hImageList = InitImageList(NumButtons,
IDB_TOOLSRECTSEL);
ImageList_Destroy((HIMAGELIST)SendMessage(hTb,
@ -98,18 +104,216 @@ FloatToolbarCreateToolsGui(PFLT_WND FltTools)
VOID
FloatToolbarCreateColorsGui(PFLT_WND FltColors)
FloatWindowPaintColorPicker(HWND hColorPicker)
{
HDC hdc;
RECT rect;
InvalidateRect(hColorPicker,
NULL,
TRUE);
UpdateWindow(hColorPicker);
hdc = GetDC(hColorPicker);
GetClientRect(hColorPicker,
&rect);
Ellipse(hdc,
rect.left,
rect.top,
rect.right,
rect.bottom);
ReleaseDC(hColorPicker,
hdc);
}
VOID
FloatWindowPaintHueSlider(HWND hHueSlider)
{
HDC hdc;
RECT rect;
InvalidateRect(hHueSlider,
NULL,
TRUE);
UpdateWindow(hHueSlider);
hdc = GetDC(hHueSlider);
GetClientRect(hHueSlider,
&rect);
Rectangle(hdc,
rect.left,
rect.top,
rect.right,
rect.bottom);
ReleaseDC(hHueSlider,
hdc);
return;
}
VOID
FloatToolbarCreateHistoryGui(PFLT_WND FltHistory)
FloatToolbarCreateColorsGui(PMAIN_WND_INFO Info)
{
HWND hColorPicker;
HWND hHueSlider;
HWND hMouseButton;
HWND hMore;
RECT rect;
HBITMAP hMoreBitmap;
return;
GetClientRect(Info->fltColors->hSelf,
&rect);
hColorPicker = CreateWindowEx(0,
WC_STATIC,
NULL,
WS_CHILD | WS_VISIBLE | CBS_DROPDOWN,
2,
2,
rect.right * 0.65,
rect.bottom - 2,
Info->fltColors->hSelf,
NULL,
hInstance,
NULL);
hHueSlider = CreateWindowEx(0,
WC_STATIC,
NULL,
WS_CHILD | WS_VISIBLE | CBS_DROPDOWN,
145,
35,
25,
135,
Info->fltColors->hSelf,
NULL,
hInstance,
NULL);
hMouseButton = CreateWindowEx(0,
WC_COMBOBOX,
NULL,
WS_CHILD | WS_VISIBLE | CBS_DROPDOWN,
118, 5, 75, 25,
Info->fltColors->hSelf,
NULL,
hInstance,
NULL);
//MakeFlatCombo(hMouseButton);
/* temp, just testing */
if (hMouseButton != NULL)
{
SendMessage(hMouseButton, CB_ADDSTRING, 0, (LPARAM)_T("Primary"));
SendMessage(hMouseButton, CB_ADDSTRING, 0, (LPARAM)_T("Secondary"));
SendMessage(hMouseButton, CB_SETCURSEL, 0, 0);
}
hMore = CreateWindowEx(WS_EX_STATICEDGE,
WC_BUTTON,
NULL,
WS_CHILD | WS_VISIBLE | BS_BITMAP,
rect.right - 15,
rect.bottom - 15,
15, 15,
Info->fltColors->hSelf,
NULL,
hInstance,
NULL);
hMoreBitmap = (HBITMAP)LoadImage(hInstance,
MAKEINTRESOURCE(IDB_COLORSMORE),
IMAGE_BITMAP,
12,
11,
LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS);
if (hMoreBitmap != NULL)
{
SendMessage(hMore,
BM_SETIMAGE,
IMAGE_BITMAP,
(LPARAM)hMoreBitmap);
}
/* temp functions for playing about with possible layouts */
FloatWindowPaintHueSlider(hHueSlider);
FloatWindowPaintColorPicker(hColorPicker);
if (hColorPicker != NULL)
{
HDC hDc = GetDC(hColorPicker);
TextOut(hDc, 8, 75, _T("Possible layout?"), 16);
ReleaseDC(hColorPicker, hDc);
}
}
VOID
FloatToolbarCreateHistoryGui(PMAIN_WND_INFO Info)
{
HWND hList;
HWND hButtons;
HIMAGELIST hImageList;
INT NumButtons;
hList = CreateWindowEx(0,
WC_LISTBOX,
NULL,
WS_CHILD | WS_VISIBLE | LBS_EXTENDEDSEL,
0, 0, 143, 100,
Info->fltHistory->hSelf,
NULL,
hInstance,
NULL);
NumButtons = sizeof(HistoryButtons) / sizeof(HistoryButtons[0]);
hButtons = CreateWindowEx(0,
TOOLBARCLASSNAME,
NULL,
WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | CCS_BOTTOM | CCS_NODIVIDER,
0, 0, 0, 0,
Info->fltHistory->hSelf,
NULL,
hInstance,
NULL);
SendMessage(hButtons,
TB_BUTTONSTRUCTSIZE,
sizeof(ToolsButtons[0]),
0);
SendMessage(hButtons,
TB_SETBITMAPSIZE,
0,
(LPARAM)MAKELONG(10, 10));
hImageList = InitImageList(NumButtons,
IDB_HISTBACK);
ImageList_Destroy((HIMAGELIST)SendMessage(hButtons,
TB_SETIMAGELIST,
0,
(LPARAM)hImageList));
SendMessage(hButtons,
TB_SETBUTTONSIZE,
0,
MAKELONG(18, 16));
SendMessage(hButtons,
TB_ADDBUTTONS,
NumButtons,
(LPARAM)HistoryButtons);
}
LRESULT CALLBACK
@ -118,12 +322,27 @@ FloatToolbarWndProc(HWND hwnd,
WPARAM wParam,
LPARAM lParam)
{
PFLT_WND FltInfo;
/* Get the window context */
FltInfo = (PFLT_WND)GetWindowLongPtr(hwnd,
GWLP_USERDATA);
if (FltInfo == NULL && Message != WM_CREATE)
{
goto HandleDefaultMessage;
}
switch(Message)
{
static BOOL bOpaque = FALSE;
case WM_CREATE:
FltInfo = (PFLT_WND)(((LPCREATESTRUCT)lParam)->lpCreateParams);
/*FIXME: read this from registry */
FltInfo->bShow = TRUE;
FltInfo->bOpaque = FALSE;
SetWindowLong(hwnd,
GWL_EXSTYLE,
GetWindowLong(hwnd,
@ -141,7 +360,7 @@ FloatToolbarWndProc(HWND hwnd,
{
POINT pt;
if (bOpaque != TRUE)
if (FltInfo->bOpaque != TRUE)
{
KillTimer(hwnd,
ID_TIMER);
@ -161,7 +380,7 @@ FloatToolbarWndProc(HWND hwnd,
KillTimer(hwnd,
ID_TIMER);
bOpaque = FALSE;
FltInfo->bOpaque = FALSE;
SetWindowLong(hwnd,
GWL_EXSTYLE,
@ -182,7 +401,7 @@ FloatToolbarWndProc(HWND hwnd,
case WM_NCMOUSEMOVE:
case WM_MOUSEMOVE:
if (bOpaque == FALSE)
if (FltInfo->bOpaque == FALSE)
{
SetWindowLong(hwnd,
GWL_EXSTYLE,
@ -194,7 +413,8 @@ FloatToolbarWndProc(HWND hwnd,
NULL,
RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
bOpaque = TRUE;
FltInfo->bOpaque = TRUE;
MessageBox(NULL, _T("in"), _T("Hit test"), MB_OK | MB_ICONEXCLAMATION);
SetTimer(hwnd,
ID_TIMER,
200,
@ -202,9 +422,13 @@ FloatToolbarWndProc(HWND hwnd,
}
break;
case WM_CLOSE:
ShowHideWindow(FltInfo);
break;
case WM_COMMAND:
if (LOWORD(wParam) == IDCANCEL)
ShowHideWindow(hwnd);
ShowHideWindow(FltInfo);
switch(LOWORD(wParam))
{
@ -245,12 +469,16 @@ FloatToolbarWndProc(HWND hwnd,
Message,
TRUE,
lParam);
break;
case WM_CLOSE:
ShowHideWindow(hwnd);
case WM_DESTROY:
SetWindowLongPtr(hwnd,
GWLP_USERDATA,
0);
break;
default:
HandleDefaultMessage:
return DefWindowProc(hwnd,
Message,
wParam,

View file

@ -62,6 +62,7 @@ WinMain(HINSTANCE hThisInstance,
{
if (bRet != (BOOL)-1)
{
//if (Msg.message == WM_SIZE) MessageBox(NULL, _T("Got it"), NULL, 0);
if (!MainWndTranslateMDISysAccel(hMainWnd,
&Msg))
{

View file

@ -31,6 +31,7 @@ IDB_MAINPRINTICON BITMAP DISCARDABLE "res/icons/std/MainPrintIcon.bmp"
IDB_MAINPRINTPREICON BITMAP DISCARDABLE "res/icons/std/MainPrintPreIcon.bmp"
IDB_MAINSAVEICON BITMAP DISCARDABLE "res/icons/std/MainSaveIcon.bmp"
/* text toolbar icons */
IDB_TEXTBOLD BITMAP DISCARDABLE "res/icons/text/TextBoldIcon.bmp"
IDB_TEXTITALIC BITMAP DISCARDABLE "res/icons/text/TextItalicIcon.bmp"
@ -61,6 +62,16 @@ IDB_TOOLSROUNDRECT BITMAP DISCARDABLE "res/icons/tools/ToolsRoundedRectangle.bmp
IDB_TOOLSTEXT BITMAP DISCARDABLE "res/icons/tools/ToolsText.bmp"
IDB_TOOLSZOOM BITMAP DISCARDABLE "res/icons/tools/ToolsZoom.bmp"
/* history window icons */
IDB_HISTBACK BITMAP DISCARDABLE "res/icons/hist/HistBack.bmp"
IDB_HISTUNDO BITMAP DISCARDABLE "res/icons/hist/HistUndo.bmp"
IDB_HISTREDO BITMAP DISCARDABLE "res/icons/hist/HistRedo.bmp"
IDB_HISTFORWARD BITMAP DISCARDABLE "res/icons/hist/HistForward.bmp"
IDB_HISTDELETE BITMAP DISCARDABLE "res/icons/hist/HistDelete.bmp"
/* colors window icons */
IDB_COLORSMORE BITMAP DISCARDABLE "res/icons/color/ColorMore.bmp"
IDB_COLORSLESS BITMAP DISCARDABLE "res/icons/color/ColorLess.bmp"
/* cursors */
IDC_PAINTBRUSHCURSOR CURSOR DISCARDABLE "res/cursors/PaintBrushToolCursor.cur"

View file

@ -41,9 +41,9 @@ TBBUTTON TextButtons[] = {
{10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
{TBICON_TXTLEFT, ID_TXTLEFT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* left justified */
{TBICON_TXTCENTER,ID_TXTCENTER,TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* centered */
{TBICON_TXTRIGHT, ID_TXTRIGHT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* right justified */
{TBICON_TXTLEFT, ID_TXTLEFT, TBSTATE_ENABLED | TBSTATE_CHECKED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0 }, /* left justified */
{TBICON_TXTCENTER,ID_TXTCENTER,TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0 }, /* centered */
{TBICON_TXTRIGHT, ID_TXTRIGHT, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0 }, /* right justified */
{10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
};
@ -53,27 +53,40 @@ TBBUTTON TextButtons[] = {
/* menu hints */
static const MENU_HINT MainMenuHintTable[] = {
/* File Menu */
{ID_CLOSE, IDS_HINT_SYS_CLOSE},
{ID_EXIT, IDS_HINT_EXIT},
{ID_BLANK, IDS_HINT_BLANK},
{ID_NEW, IDS_HINT_NEW},
{ID_OPEN, IDS_HINT_OPEN},
{ID_CLOSE, IDS_HINT_CLOSE},
{ID_CLOSEALL, IDS_HINT_CLOSEALL},
{ID_SAVE, IDS_HINT_SAVE},
{ID_SAVEAS, IDS_HINT_SAVEAS},
{ID_PRINTPRE, IDS_HINT_PRINTPRE},
{ID_PRINT, IDS_HINT_PRINT},
{ID_PROP, IDS_HINT_PROP},
{ID_EXIT, IDS_HINT_EXIT},
/* view menu */
{ID_TOOLS, IDS_HINT_TOOLS},
{ID_COLOR, IDS_HINT_COLORS},
{ID_HISTORY, IDS_HINT_HISTORY},
{ID_STATUSBAR, IDS_HINT_STATUS},
/* Window Menu */
{ID_WINDOW_NEXT, IDS_HINT_SYS_NEXT}
{ID_WINDOW_NEXT, IDS_HINT_NEXT},
{ID_WINDOW_CASCADE, IDS_HINT_CASCADE},
{ID_WINDOW_TILE_HORZ, IDS_HINT_TILE_HORZ},
{ID_WINDOW_TILE_VERT, IDS_HINT_TILE_VERT},
{ID_WINDOW_ARRANGE, IDS_HINT_ARRANGE}
};
static const MENU_HINT SystemMenuHintTable[] = {
{SC_RESTORE, IDS_HINT_SYS_RESTORE},
{SC_MOVE, IDS_HINT_SYS_MOVE},
{SC_SIZE, IDS_HINT_SYS_SIZE},
{SC_MINIMIZE, IDS_HINT_SYS_MINIMIZE},
{SC_MAXIMIZE, IDS_HINT_SYS_MAXIMIZE},
{SC_CLOSE, IDS_HINT_SYS_CLOSE},
{SC_NEXTWINDOW, IDS_HINT_SYS_NEXT},
};
static FLT_WND FloatingWindow[NUM_FLT_WND] = {
{NULL, NULL, 0, 0, 53, 300}, /* tools */
{NULL, NULL, 0, 0, 200, 200}, /* colors */
{NULL, NULL, 0, 0, 150, 150} /* history */
{SC_RESTORE, IDS_HINT_SYS_RESTORE},
{SC_MOVE, IDS_HINT_SYS_MOVE},
{SC_SIZE, IDS_HINT_SYS_SIZE},
{SC_MINIMIZE, IDS_HINT_SYS_MINIMIZE},
{SC_MAXIMIZE, IDS_HINT_SYS_MAXIMIZE},
{SC_CLOSE, IDS_HINT_CLOSE},
{SC_NEXTWINDOW, IDS_HINT_NEXT},
};
@ -205,10 +218,11 @@ MainWndCreateToolbarClient(struct _TOOLBAR_DOCKS *TbDocks,
{
case ID_TOOLBAR_TEXT:
{
HWND hWndCombo;
HWND hFontType;
HWND hFontSize;
/* drop combo box into container window */
hWndCombo = CreateWindowEx(0,
hFontType = CreateWindowEx(0,
WC_COMBOBOX,
NULL,
WS_CHILD | WS_VISIBLE | CBS_DROPDOWN,
@ -217,18 +231,44 @@ MainWndCreateToolbarClient(struct _TOOLBAR_DOCKS *TbDocks,
NULL,
hInstance,
NULL);
if (hWndCombo != NULL)
//MakeFlatCombo(hFontType);
if (hFontType != NULL)
{
SetParent(hWndCombo,
SetParent(hFontType,
hWndClient);
if (!ToolbarInsertSpaceForControl(hWndClient,
hWndCombo,
hFontType,
0,
ID_TXTFONTNAME,
TRUE))
{
DestroyWindow(hWndCombo);
DestroyWindow(hFontType);
}
}
/* drop combo box into container window */
hFontSize = CreateWindowEx(0,
WC_COMBOBOX,
NULL,
WS_CHILD | WS_VISIBLE | CBS_DROPDOWN,
0, 0, 40, 25,
hParent,
NULL,
hInstance,
NULL);
if (hFontSize != NULL)
{
SetParent(hFontSize,
hWndClient);
if (!ToolbarInsertSpaceForControl(hWndClient,
hFontSize,
0,
ID_TXTFONTSIZE,
TRUE))
{
DestroyWindow(hFontSize);
}
}
break;
@ -407,31 +447,38 @@ MainWndToolbarChevronPushed(struct _TOOLBAR_DOCKS *TbDocks,
}
static VOID
MainWndMoveFloatingWindows(HWND hwnd, PRECT wndOldPos)
MainWndMoveFloatingWindows(PMAIN_WND_INFO Info,
PRECT wndOldPos)
{
RECT wndNewPos, TbRect;
INT i, xMoved, yMoved;
PFLT_WND WndArr[NUM_FLT_WND];
if (GetWindowRect(hwnd,
if (GetWindowRect(Info->hSelf,
&wndNewPos))
{
xMoved = wndNewPos.left - wndOldPos->left;
yMoved = wndNewPos.top - wndOldPos->top;
/* store the pointers in an array */
WndArr[0] = Info->fltTools;
WndArr[1] = Info->fltColors;
WndArr[2] = Info->fltHistory;
for (i = 0; i < NUM_FLT_WND; i++)
{
GetWindowRect(FloatingWindow[i].hSelf,
GetWindowRect(WndArr[i]->hSelf,
&TbRect);
FloatingWindow[i].x = TbRect.left + xMoved;
FloatingWindow[i].y = TbRect.top + yMoved;
WndArr[i]->x = TbRect.left + xMoved;
WndArr[i]->y = TbRect.top + yMoved;
MoveWindow(FloatingWindow[i].hSelf,
FloatingWindow[i].x,
FloatingWindow[i].y,
FloatingWindow[i].Width,
FloatingWindow[i].Height,
MoveWindow(WndArr[i]->hSelf,
WndArr[i]->x,
WndArr[i]->y,
WndArr[i]->Width,
WndArr[i]->Height,
TRUE);
}
@ -443,36 +490,36 @@ MainWndMoveFloatingWindows(HWND hwnd, PRECT wndOldPos)
static VOID
MainWndResetFloatingWindows(HWND hwnd)
MainWndResetFloatingWindows(PMAIN_WND_INFO Info)
{
RECT rect;
if (GetWindowRect(hwnd,
if (GetWindowRect(Info->hMdiClient,
&rect))
{
/* tools datum */
MoveWindow(FloatingWindow[0].hSelf,
MoveWindow(Info->fltTools->hSelf,
rect.left + 5,
rect.top + 5,
FloatingWindow[0].Width,
FloatingWindow[0].Height,
Info->fltTools->Width,
Info->fltTools->Height,
TRUE);
/* colors datum */
MoveWindow(FloatingWindow[1].hSelf,
MoveWindow(Info->fltColors->hSelf,
rect.left + 5,
rect.bottom - FloatingWindow[1].Height - 5,
FloatingWindow[1].Width,
FloatingWindow[1].Height,
rect.bottom - Info->fltColors->Height - 5,
Info->fltColors->Width,
Info->fltColors->Height,
TRUE);
/* history datum */
MoveWindow(FloatingWindow[2].hSelf,
rect.right - FloatingWindow[2].Width - 5,
MoveWindow(Info->fltHistory->hSelf,
rect.right - Info->fltHistory->Width - 5,
rect.top + 5,
FloatingWindow[2].Width,
FloatingWindow[2].Height,
Info->fltHistory->Width,
Info->fltHistory->Height,
TRUE);
}
}
@ -482,7 +529,26 @@ MainWndCreateFloatWindows(PMAIN_WND_INFO Info)
{
RECT rect;
UINT Res;
INT i = TOOLS;
PFLT_WND WndArr[NUM_FLT_WND]; /* temp array for looping */
INT i;
Info->fltTools = HeapAlloc(ProcessHeap,
HEAP_ZERO_MEMORY,
sizeof(FLT_WND));
Info->fltColors = HeapAlloc(ProcessHeap,
HEAP_ZERO_MEMORY,
sizeof(FLT_WND));
Info->fltHistory = HeapAlloc(ProcessHeap,
HEAP_ZERO_MEMORY,
sizeof(FLT_WND));
/* set window dimensions */
Info->fltTools->Width = 53;
Info->fltTools->Height = 300;
Info->fltColors->Width = 200;
Info->fltColors->Height = 200;
Info->fltHistory->Width = 150;
Info->fltHistory->Height = 150;
if (! GetWindowRect(Info->hMdiClient,
&rect))
@ -490,61 +556,74 @@ MainWndCreateFloatWindows(PMAIN_WND_INFO Info)
return;
}
/* tools datum */
FloatingWindow[TOOLS].x = rect.left + 5;
FloatingWindow[TOOLS].y = rect.top + 5;
/* Set window datums */
Info->fltTools->x = rect.left + 5;
Info->fltTools->y = rect.top + 5;
/* colors datum */
FloatingWindow[COLORS].x = rect.left + 5;
FloatingWindow[COLORS].y = rect.bottom - FloatingWindow[1].Height - 5;
Info->fltColors->x = rect.left + 5;
Info->fltColors->y = rect.bottom - Info->fltColors->Height - 5;
/* history datum */
FloatingWindow[HISTORY].x = rect.right - FloatingWindow[2].Width - 5;
FloatingWindow[HISTORY].y = rect.top + 5;
Info->fltHistory->x = rect.right - Info->fltHistory->Width - 5;
Info->fltHistory->y = rect.top + 5;
for (Res = IDS_FLT_TOOLS; Res < IDS_FLT_TOOLS + NUM_FLT_WND; Res++, i++)
/* save pointers into array incrementing within the loop*/
WndArr[0] = Info->fltTools;
WndArr[1] = Info->fltColors;
WndArr[2] = Info->fltHistory;
for (i = 0, Res = IDS_FLT_TOOLS; Res < IDS_FLT_TOOLS + NUM_FLT_WND; Res++, i++)
{
if (! AllocAndLoadString(&FloatingWindow[i].lpName,
if (! AllocAndLoadString(&WndArr[i]->lpName,
hInstance,
Res))
{
FloatingWindow[i].lpName = NULL;
WndArr[i]->lpName = NULL;
}
FloatingWindow[i].hSelf = CreateWindowEx(WS_EX_TOOLWINDOW,
TEXT("ImageSoftFloatWndClass"),
FloatingWindow[i].lpName,
WS_POPUPWINDOW | WS_DLGFRAME | WS_VISIBLE,
FloatingWindow[i].x,
FloatingWindow[i].y,
FloatingWindow[i].Width,
FloatingWindow[i].Height,
Info->hSelf,
NULL,
hInstance,
NULL);
WndArr[i]->hSelf = CreateWindowEx(WS_EX_TOOLWINDOW,
TEXT("ImageSoftFloatWndClass"),
WndArr[i]->lpName,
WS_POPUPWINDOW | WS_DLGFRAME | WS_VISIBLE,
WndArr[i]->x,
WndArr[i]->y,
WndArr[i]->Width,
WndArr[i]->Height,
Info->hSelf,
NULL,
hInstance,
WndArr[i]);
}
if (FloatingWindow[TOOLS].hSelf != NULL)
if (Info->fltTools->hSelf != NULL)
{
FloatToolbarCreateToolsGui(&FloatingWindow[TOOLS]);
FloatToolbarCreateToolsGui(Info);
}
if (FloatingWindow[COLORS].hSelf != NULL)
if (Info->fltColors->hSelf != NULL)
{
FloatToolbarCreateColorsGui(&FloatingWindow[COLORS]);
FloatToolbarCreateColorsGui(Info);
}
if (FloatingWindow[HISTORY].hSelf != NULL)
if (Info->fltHistory->hSelf != NULL)
{
FloatToolbarCreateHistoryGui(&FloatingWindow[HISTORY]);
FloatToolbarCreateHistoryGui(Info);
}
}
static VOID
MainWndDestroyFloatWindows(PMAIN_WND_INFO Info)
{
if (Info->fltTools != NULL)
HeapFree(ProcessHeap, 0, Info->fltTools);
if (Info->fltColors != NULL)
HeapFree(ProcessHeap, 0, Info->fltTools);
if (Info->fltHistory != NULL)
HeapFree(ProcessHeap, 0, Info->fltTools);
}
@ -753,9 +832,8 @@ MainWndCommand(PMAIN_WND_INFO Info,
CreateImageEditWindow(Info,
&OpenInfo);
}
break;
}
break;
case ID_BOLD:
MessageBox(NULL, _T("Bingo"), NULL, 0);
@ -784,6 +862,60 @@ MainWndCommand(PMAIN_WND_INFO Info,
}
break;
case ID_TOOLS:
{
HMENU hMenu = GetMenu(Info->hSelf);
if (hMenu != NULL)
{
UINT uCheck;
ShowHideWindow(Info->fltTools);
uCheck = Info->fltTools->bShow ? MF_CHECKED : MF_UNCHECKED;
CheckMenuItem(hMenu,
ID_TOOLS,
uCheck);
}
}
break;
case ID_COLOR:
{
HMENU hMenu = GetMenu(Info->hSelf);
if (hMenu != NULL)
{
UINT uCheck;
ShowHideWindow(Info->fltColors);
uCheck = Info->fltColors->bShow ? MF_CHECKED : MF_UNCHECKED;
CheckMenuItem(hMenu,
ID_COLOR,
uCheck);
}
}
break;
case ID_HISTORY:
{
HMENU hMenu = GetMenu(Info->hSelf);
if (hMenu != NULL)
{
UINT uCheck;
ShowHideWindow(Info->fltHistory);
uCheck = Info->fltHistory->bShow ? MF_CHECKED : MF_UNCHECKED;
CheckMenuItem(hMenu,
ID_HISTORY,
uCheck);
}
}
break;
case ID_EXIT:
SendMessage(Info->hSelf,
WM_CLOSE,
@ -841,6 +973,8 @@ static VOID
DestroyMainWnd(PMAIN_WND_INFO Info)
{
/* FIXME - cleanup allocated resources */
MainWndDestroyFloatWindows(Info);
}
@ -918,7 +1052,7 @@ MainWndProc(HWND hwnd,
/* reposition the floating toolbars */
if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED))
MainWndResetFloatingWindows(Info->hMdiClient);
MainWndResetFloatingWindows(Info);
break;
}
@ -944,7 +1078,7 @@ MainWndProc(HWND hwnd,
{
/* if the main window is moved, move the toolbars too */
if (bLBMouseDown)
MainWndMoveFloatingWindows(hwnd, &wndOldPos);
MainWndMoveFloatingWindows(Info, &wndOldPos);
}
break;
@ -997,13 +1131,13 @@ MainWndProc(HWND hwnd,
LOWORD(wParam),
MainMenuHintTable,
sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]),
IDS_READY))
IDS_HINT_BLANK))
{
MainWndMenuHint(Info,
LOWORD(wParam),
SystemMenuHintTable,
sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]),
IDS_READY);
IDS_HINT_BLANK);
}
}
break;

View file

@ -49,6 +49,7 @@
/* generic definitions and forward declarations */
struct _MAIN_WND_INFO;
struct _EDIT_WND_INFO;
struct _FLT_WND;
typedef enum _MDI_EDITOR_TYPE {
metUnknown = 0,
@ -288,9 +289,12 @@ typedef struct _MAIN_WND_INFO
HWND hSelf;
HWND hMdiClient;
HWND hStatus;
HWND hFloatTools;
int nCmdShow;
struct _FLT_WND *fltTools;
struct _FLT_WND *fltColors;
struct _FLT_WND *fltHistory;
TOOLBAR_DOCKS ToolDocks;
/* Editors */
@ -300,7 +304,7 @@ typedef struct _MAIN_WND_INFO
PVOID ActiveEditor;
/* status flags */
UINT InMenuLoop : 1;
BOOL InMenuLoop : 1;
} MAIN_WND_INFO, *PMAIN_WND_INFO;
BOOL InitMainWindowImpl(VOID);
@ -376,14 +380,17 @@ typedef struct _FLT_WND
INT y;
INT Width;
INT Height;
BOOL bShow : 1;
BOOL bOpaque;
} FLT_WND, *PFLT_WND;
VOID FloatToolbarCreateToolsGui(PFLT_WND FltTools);
VOID FloatToolbarCreateColorsGui(PFLT_WND FltColors);
VOID FloatToolbarCreateHistoryGui(PFLT_WND FltHistory);
VOID FloatToolbarCreateToolsGui(PMAIN_WND_INFO Info);
VOID FloatToolbarCreateColorsGui(PMAIN_WND_INFO Info);
VOID FloatToolbarCreateHistoryGui(PMAIN_WND_INFO Info);
BOOL InitFloatWndClass(VOID);
VOID UninitFloatWndImpl(VOID);
BOOL ShowHideWindow(HWND hwnd);
BOOL ShowHideWindow(PFLT_WND FltInfo);
VOID MakeFlatCombo(HWND hwndCombo);
#endif /* __IMAGESOFT_PRECOMP_H */

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

View file

@ -37,7 +37,14 @@
#define ID_EXIT 2016
#define ID_EDITCOLOURS 2017
#define ID_TOOLS 2018
#define ID_STATUSBAR 2019
#define ID_COLOR 2019
#define ID_HISTORY 2020
#define ID_STATUSBAR 2021
#define ID_BLANK 2022
#define ID_BACK 2025
#define ID_FORWARD 2026
#define ID_DELETE 2027
/* text */
#define ID_BOLD 2030
@ -47,6 +54,7 @@
#define ID_TXTCENTER 2034
#define ID_TXTRIGHT 2035
#define ID_TXTFONTNAME 2036
#define ID_TXTFONTSIZE 2037
/* tools */
#define ID_CLONESTAMP 2050
@ -81,7 +89,28 @@
#define ID_WINDOW_ARRANGE 3006
/* menu hints */
#define IDS_HINT_EXIT 20001
#define IDS_HINT_BLANK 20000
#define IDS_HINT_NEW 20001
#define IDS_HINT_OPEN 20002
#define IDS_HINT_CLOSE 21006
#define IDS_HINT_CLOSEALL 21007
#define IDS_HINT_SAVE 20003
#define IDS_HINT_SAVEAS 20004
#define IDS_HINT_PRINT 20005
#define IDS_HINT_PRINTPRE 20006
#define IDS_HINT_PROP 20007
#define IDS_HINT_EXIT 20008
#define IDS_HINT_TOOLS 20020
#define IDS_HINT_COLORS 20021
#define IDS_HINT_HISTORY 20022
#define IDS_HINT_STATUS 20023
#define IDS_HINT_CASCADE 21009
#define IDS_HINT_TILE_HORZ 21010
#define IDS_HINT_TILE_VERT 21011
#define IDS_HINT_ARRANGE 21012
#define IDS_HINT_NEXT 21013
/* system menu hints */
#define IDS_HINT_SYS_RESTORE 21001
@ -90,7 +119,6 @@
#define IDS_HINT_SYS_MINIMIZE 21004
#define IDS_HINT_SYS_MAXIMIZE 21005
#define IDS_HINT_SYS_CLOSE 21006
#define IDS_HINT_SYS_NEXT 21007
/* Toolbar button bitmaps.
@ -136,7 +164,18 @@
#define IDB_TOOLSECLIPSE 10048
#define IDB_TOOLSFREEFORM 10049
/* toolbar buttons */
#define IDB_HISTBACK 10060
#define IDB_HISTUNDO 10061
#define IDB_HISTREDO 10062
#define IDB_HISTFORWARD 10063
#define IDB_HISTDELETE 10064
#define IDB_COLORSMORE 10080
#define IDB_COLORSLESS 10081
/* TOOLBAR BITMAPS */
/* standard */
#define TBICON_NEW 0
#define TBICON_OPEN 1
#define TBICON_SAVE 2
@ -147,14 +186,14 @@
#define TBICON_PASTE 7
#define TBICON_UNDO 8
#define TBICON_REDO 9
/* text */
#define TBICON_BOLD 0
#define TBICON_ITALIC 1
#define TBICON_ULINE 2
#define TBICON_TXTLEFT 3
#define TBICON_TXTCENTER 4
#define TBICON_TXTRIGHT 5
/* tools */
#define TBICON_RECTSEL 0
#define TBICON_MOVESEL 1
#define TBICON_LASOO 2
@ -175,6 +214,13 @@
#define TBICON_ROUNDRECT 17
#define TBICON_ECLIPSE 18
#define TBICON_FREEFORM 19
/* history */
#define TBICON_BACKSM 0
#define TBICON_UNDOSM 1
#define TBICON_REDOSM 2
#define TBICON_FORWARDSM 3
#define TBICON_DELETESM 4
/* tooltips */
#define IDS_TOOLTIP_NEW 6000