mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
- Fix drawing onto loaded bitmaps.
- Don't call CreateCompatibleDC for each paint - Make the floating windows translucent unless the cursor is over them - Put in some temp code for basic sketches. (this functionality needs incorporating into separate tool functions) - change the internal name 'floating toolbars' to 'floating windows' to avoid confusion. svn path=/trunk/; revision=21376
This commit is contained in:
parent
5e4fc1d4c3
commit
e3342f0b3e
17 changed files with 435 additions and 199 deletions
|
@ -33,6 +33,8 @@ BEGIN
|
|||
POPUP "&View"
|
||||
BEGIN
|
||||
MENUITEM "&Tools", ID_TOOLS, CHECKED
|
||||
MENUITEM "&Color", -1, CHECKED
|
||||
MENUITEM "&History", -1, CHECKED
|
||||
MENUITEM "&Status Bar", ID_STATUSBAR, CHECKED
|
||||
END
|
||||
POPUP "&Image"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
TBBUTTON StdButtons[] = {
|
||||
/* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
|
||||
|
||||
TBBUTTON StdButtons[] = {
|
||||
{TBICON_NEW, ID_NEW, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* new */
|
||||
{TBICON_OPEN, ID_OPEN, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* open */
|
||||
{TBICON_SAVE, ID_SAVE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* save */
|
||||
|
@ -22,3 +23,17 @@ TBBUTTON StdButtons[] = {
|
|||
|
||||
{10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
|
||||
};
|
||||
|
||||
TBBUTTON TextButtons[] = {
|
||||
{TBICON_BOLD, ID_BOLD, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* bold */
|
||||
{TBICON_ITALIC, ID_ITALIC, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* italic */
|
||||
{TBICON_ULINE, ID_ULINE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* underline */
|
||||
|
||||
{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 */
|
||||
|
||||
{10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
|
||||
};
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
#include <precomp.h>
|
||||
|
||||
static const TCHAR szFloatWndClass[] = TEXT("ImageSoftFloatWndClass");
|
||||
|
||||
|
||||
|
||||
BOOL
|
||||
ShowHideToolbar(HWND hwnd)
|
||||
{
|
||||
static BOOL Hidden = FALSE;
|
||||
|
||||
ShowWindow(hwnd, Hidden ? SW_SHOW : SW_HIDE);
|
||||
Hidden = ~Hidden;
|
||||
|
||||
return Hidden;
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK
|
||||
FloatToolbarWndProc(HWND hwnd,
|
||||
UINT Message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch(Message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
|
||||
break;
|
||||
|
||||
/*case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDCANCEL)
|
||||
ShowHideToolbar(hwnd);
|
||||
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDC_PRESS:
|
||||
MessageBox(hwnd, _T("Kapow!"), _T("Hit test"),
|
||||
MB_OK | MB_ICONEXCLAMATION);
|
||||
break;
|
||||
}
|
||||
break;*/
|
||||
|
||||
case WM_NCACTIVATE:
|
||||
return DefWindowProc(hwnd, Message, TRUE, lParam);
|
||||
|
||||
case WM_CLOSE:
|
||||
ShowHideToolbar(hwnd);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hwnd,
|
||||
Message,
|
||||
wParam,
|
||||
lParam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
InitFloatWndClass(VOID)
|
||||
{
|
||||
WNDCLASSEX wc = {0};
|
||||
|
||||
wc.cbSize = sizeof(WNDCLASSEX);
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = FloatToolbarWndProc;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = NULL;
|
||||
wc.hCursor = LoadCursor(NULL,
|
||||
IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
||||
wc.lpszClassName = szFloatWndClass;
|
||||
wc.hIconSm = NULL;
|
||||
|
||||
return RegisterClassEx(&wc) != (ATOM)0;
|
||||
}
|
||||
|
||||
VOID
|
||||
UninitFloatWndImpl(VOID)
|
||||
{
|
||||
UnregisterClass(szFloatWndClass,
|
||||
hInstance);
|
||||
}
|
||||
|
169
reactos/base/applications/imagesoft/floatwindow.c
Normal file
169
reactos/base/applications/imagesoft/floatwindow.c
Normal file
|
@ -0,0 +1,169 @@
|
|||
#include <precomp.h>
|
||||
|
||||
static const TCHAR szFloatWndClass[] = TEXT("ImageSoftFloatWndClass");
|
||||
|
||||
#define ID_TIMER 1
|
||||
|
||||
BOOL
|
||||
ShowHideWindow(HWND hwnd)
|
||||
{
|
||||
static BOOL Hidden = FALSE;
|
||||
|
||||
ShowWindow(hwnd, Hidden ? SW_SHOW : SW_HIDE);
|
||||
Hidden = ~Hidden;
|
||||
|
||||
return Hidden;
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK
|
||||
FloatToolbarWndProc(HWND hwnd,
|
||||
UINT Message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch(Message)
|
||||
{
|
||||
static BOOL bOpaque = FALSE;
|
||||
|
||||
case WM_CREATE:
|
||||
|
||||
SetWindowLong(hwnd,
|
||||
GWL_EXSTYLE,
|
||||
GetWindowLong(hwnd,
|
||||
GWL_EXSTYLE) | WS_EX_LAYERED);
|
||||
|
||||
/* set the tranclucency to 60% */
|
||||
SetLayeredWindowAttributes(hwnd,
|
||||
0,
|
||||
(255 * 60) / 100,
|
||||
LWA_ALPHA);
|
||||
|
||||
break;
|
||||
|
||||
case WM_TIMER:
|
||||
{
|
||||
POINT pt;
|
||||
|
||||
if (bOpaque != TRUE)
|
||||
{
|
||||
KillTimer(hwnd,
|
||||
ID_TIMER);
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetCursorPos(&pt))
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
if (GetWindowRect(hwnd,
|
||||
&rect))
|
||||
{
|
||||
if (! PtInRect(&rect,
|
||||
pt))
|
||||
{
|
||||
KillTimer(hwnd,
|
||||
ID_TIMER);
|
||||
|
||||
bOpaque = FALSE;
|
||||
|
||||
SetWindowLong(hwnd,
|
||||
GWL_EXSTYLE,
|
||||
GetWindowLong(hwnd,
|
||||
GWL_EXSTYLE) | WS_EX_LAYERED);
|
||||
|
||||
/* set the tranclucency to 60% */
|
||||
SetLayeredWindowAttributes(hwnd,
|
||||
0,
|
||||
(255 * 60) / 100,
|
||||
LWA_ALPHA);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NCMOUSEMOVE:
|
||||
case WM_MOUSEMOVE:
|
||||
if (bOpaque == FALSE)
|
||||
{
|
||||
SetWindowLong(hwnd,
|
||||
GWL_EXSTYLE,
|
||||
GetWindowLong(hwnd,
|
||||
GWL_EXSTYLE) & ~WS_EX_LAYERED);
|
||||
|
||||
RedrawWindow(hwnd,
|
||||
NULL,
|
||||
NULL,
|
||||
RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
|
||||
bOpaque = TRUE;
|
||||
SetTimer(hwnd,
|
||||
ID_TIMER,
|
||||
200,
|
||||
NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDCANCEL)
|
||||
ShowHideWindow(hwnd);
|
||||
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDC_PRESS:
|
||||
MessageBox(hwnd, _T("Kapow!"), _T("Hit test"),
|
||||
MB_OK | MB_ICONEXCLAMATION);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NCACTIVATE:
|
||||
/* FIXME: needs fully implementing */
|
||||
return DefWindowProc(hwnd,
|
||||
Message,
|
||||
TRUE,
|
||||
lParam);
|
||||
|
||||
case WM_CLOSE:
|
||||
ShowHideWindow(hwnd);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hwnd,
|
||||
Message,
|
||||
wParam,
|
||||
lParam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
InitFloatWndClass(VOID)
|
||||
{
|
||||
WNDCLASSEX wc = {0};
|
||||
|
||||
wc.cbSize = sizeof(WNDCLASSEX);
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = FloatToolbarWndProc;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = NULL;
|
||||
wc.hCursor = LoadCursor(NULL,
|
||||
IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
||||
wc.lpszClassName = szFloatWndClass;
|
||||
wc.hIconSm = NULL;
|
||||
|
||||
return RegisterClassEx(&wc) != (ATOM)0;
|
||||
}
|
||||
|
||||
VOID
|
||||
UninitFloatWndImpl(VOID)
|
||||
{
|
||||
UnregisterClass(szFloatWndClass,
|
||||
hInstance);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "precomp.h"
|
||||
#include <precomp.h>
|
||||
|
||||
HINSTANCE hInstance;
|
||||
HANDLE ProcessHeap;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<library>comdlg32</library>
|
||||
<compilationunit name="unit.c">
|
||||
<file>about.c</file>
|
||||
<file>floattoolbar.c</file>
|
||||
<file>floatwindow.c</file>
|
||||
<file>imageprop.c</file>
|
||||
<file>imagesoft.c</file>
|
||||
<file>imgedwnd.c</file>
|
||||
|
|
|
@ -30,6 +30,13 @@ IDB_MAINPRINTICON BITMAP DISCARDABLE "res/icons/MainPrintIcon.bmp"
|
|||
IDB_MAINPRINTPREICON BITMAP DISCARDABLE "res/icons/MainPrintPreIcon.bmp"
|
||||
IDB_MAINSAVEICON BITMAP DISCARDABLE "res/icons/MainSaveIcon.bmp"
|
||||
|
||||
IDB_TEXTBOLD BITMAP DISCARDABLE "res/icons/TextBoldIcon.bmp"
|
||||
IDB_TEXTITALIC BITMAP DISCARDABLE "res/icons/TextItalicIcon.bmp"
|
||||
IDB_TEXTULINE BITMAP DISCARDABLE "res/icons/TextUnderlineIcon.bmp"
|
||||
IDB_TEXTLEFT BITMAP DISCARDABLE "res/icons/TextAlignLeftIcon.bmp"
|
||||
IDB_TEXTCENTER BITMAP DISCARDABLE "res/icons/TextAlignCenterIcon.bmp"
|
||||
IDB_TEXTRIGHT BITMAP DISCARDABLE "res/icons/TextAlignRightIcon.bmp"
|
||||
|
||||
IDC_PAINTBRUSHCURSOR CURSOR DISCARDABLE "res/cursors/PaintBrushToolCursor.cur"
|
||||
IDC_PAINTBRUSHCURSORMOUSEDOWN CURSOR DISCARDABLE "res/cursors/PaintBrushToolCursorMouseDown.cur"
|
||||
|
||||
|
|
|
@ -46,9 +46,16 @@ InitEditWnd(PEDIT_WND_INFO Info)
|
|||
|
||||
if (Info->OpenInfo != NULL)
|
||||
{
|
||||
HDC hDC = GetDC(Info->hSelf);
|
||||
Info->hDCMem = CreateCompatibleDC(hDC);
|
||||
ReleaseDC(Info->hSelf, hDC);
|
||||
|
||||
if (Info->OpenInfo->CreateNew)
|
||||
{
|
||||
/* FIXME: convert this to a DIB Section */
|
||||
/* set bitmap dimensions */
|
||||
Info->Width = Info->OpenInfo->New.Width;
|
||||
Info->Height = Info->OpenInfo->New.Height;
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -157,10 +164,12 @@ InitEditWnd(PEDIT_WND_INFO Info)
|
|||
fail:
|
||||
if (! hFile)
|
||||
CloseHandle(hFile);
|
||||
|
||||
if (! pbmi)
|
||||
HeapFree(ProcessHeap,
|
||||
0,
|
||||
pbmi);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -170,6 +179,8 @@ DestroyEditWnd(PEDIT_WND_INFO Info)
|
|||
PEDIT_WND_INFO *PrevEditor;
|
||||
PEDIT_WND_INFO Editor;
|
||||
|
||||
DeleteDC(Info->hDCMem);
|
||||
|
||||
/* FIXME - free resources and run down editor */
|
||||
|
||||
/* Remove the image editor from the list */
|
||||
|
@ -196,24 +207,20 @@ ImageEditWndRepaint(PEDIT_WND_INFO Info,
|
|||
|
||||
if (Info->hBitmap)
|
||||
{
|
||||
Info->hDCMem = CreateCompatibleDC(hDC);
|
||||
|
||||
hOldBitmap = (HBITMAP) SelectObject(Info->hDCMem,
|
||||
Info->hBitmap);
|
||||
|
||||
BitBlt(hDC,
|
||||
0,
|
||||
0,
|
||||
Info->Width,
|
||||
Info->Height,
|
||||
lpps->rcPaint.left,
|
||||
lpps->rcPaint.top,
|
||||
lpps->rcPaint.right - lpps->rcPaint.left,
|
||||
lpps->rcPaint.bottom - lpps->rcPaint.top,
|
||||
Info->hDCMem,
|
||||
0,
|
||||
0,
|
||||
lpps->rcPaint.left,
|
||||
lpps->rcPaint.top,
|
||||
SRCCOPY);
|
||||
|
||||
Info->hBitmap = SelectObject(Info->hDCMem, hOldBitmap);
|
||||
|
||||
DeleteDC(Info->hDCMem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,7 +232,9 @@ ImageEditWndProc(HWND hwnd,
|
|||
{
|
||||
PEDIT_WND_INFO Info;
|
||||
LRESULT Ret = 0;
|
||||
static BOOL bLMButtonDown = FALSE;
|
||||
HDC hDC;
|
||||
static INT xMouse, yMouse;
|
||||
static BOOL bLeftButtonDown, bRightButtonDown;
|
||||
|
||||
/* Get the window context */
|
||||
Info = (PEDIT_WND_INFO)GetWindowLongPtr(hwnd,
|
||||
|
@ -262,24 +271,96 @@ ImageEditWndProc(HWND hwnd,
|
|||
break;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
if (! bRightButtonDown)
|
||||
SetCapture(Info->hSelf);
|
||||
|
||||
bLeftButtonDown = TRUE;
|
||||
xMouse = LOWORD(lParam);
|
||||
yMouse = HIWORD(lParam);
|
||||
|
||||
SetCursor(LoadCursor(hInstance,
|
||||
MAKEINTRESOURCE(IDC_PAINTBRUSHCURSORMOUSEDOWN)));
|
||||
bLMButtonDown = TRUE;
|
||||
|
||||
break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
bLMButtonDown = FALSE;
|
||||
if (bLeftButtonDown)
|
||||
SetCapture(NULL);
|
||||
|
||||
bLeftButtonDown = FALSE;
|
||||
|
||||
break;
|
||||
|
||||
case WM_RBUTTONDOWN:
|
||||
if (! bLeftButtonDown)
|
||||
SetCapture(Info->hSelf);
|
||||
|
||||
bRightButtonDown = TRUE;
|
||||
xMouse = LOWORD(lParam);
|
||||
yMouse = HIWORD(lParam);
|
||||
|
||||
SetCursor(LoadCursor(hInstance,
|
||||
MAKEINTRESOURCE(IDC_PAINTBRUSHCURSORMOUSEDOWN)));
|
||||
break;
|
||||
|
||||
case WM_RBUTTONUP:
|
||||
if (bRightButtonDown)
|
||||
SetCapture(NULL);
|
||||
|
||||
bRightButtonDown = FALSE;
|
||||
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
if (bLMButtonDown)
|
||||
SetCursor(LoadCursor(hInstance,
|
||||
MAKEINTRESOURCE(IDC_PAINTBRUSHCURSORMOUSEDOWN)));
|
||||
{
|
||||
HPEN hPen, hPenOld;
|
||||
|
||||
if (!bLeftButtonDown && !bRightButtonDown)
|
||||
break;
|
||||
|
||||
hDC = GetDC(Info->hSelf);
|
||||
|
||||
SelectObject(Info->hDCMem,
|
||||
Info->hBitmap);
|
||||
|
||||
if (bLeftButtonDown)
|
||||
hPen = CreatePen(PS_SOLID,
|
||||
3,
|
||||
RGB(0, 0, 0));
|
||||
else
|
||||
SetCursor(LoadCursor(hInstance,
|
||||
MAKEINTRESOURCE(IDC_PAINTBRUSHCURSOR)));
|
||||
hPen = CreatePen(PS_SOLID,
|
||||
3,
|
||||
RGB(255, 255, 255));
|
||||
|
||||
hPenOld = SelectObject(hDC,
|
||||
hPen);
|
||||
|
||||
MoveToEx(hDC,
|
||||
xMouse,
|
||||
yMouse,
|
||||
NULL);
|
||||
|
||||
MoveToEx(Info->hDCMem,
|
||||
xMouse,
|
||||
yMouse,
|
||||
NULL);
|
||||
|
||||
xMouse = (short)LOWORD(lParam);
|
||||
yMouse = (short)HIWORD(lParam);
|
||||
|
||||
LineTo(hDC,
|
||||
xMouse,
|
||||
yMouse);
|
||||
|
||||
LineTo(Info->hDCMem,
|
||||
xMouse,
|
||||
yMouse);
|
||||
|
||||
DeleteObject(SelectObject(hDC,
|
||||
hPenOld));
|
||||
|
||||
ReleaseDC(Info->hSelf,
|
||||
hDC);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
|
|
|
@ -5,7 +5,7 @@ static const TCHAR szMainWndClass[] = TEXT("ImageSoftWndClass");
|
|||
|
||||
#define ID_MDI_FIRSTCHILD 50000
|
||||
#define ID_MDI_WINDOWMENU 5
|
||||
#define NUM_FLT_TB 3
|
||||
#define NUM_FLT_WND 3
|
||||
|
||||
/* menu hints */
|
||||
static const MENU_HINT MainMenuHintTable[] = {
|
||||
|
@ -27,26 +27,29 @@ static const MENU_HINT SystemMenuHintTable[] = {
|
|||
{SC_NEXTWINDOW, IDS_HINT_SYS_NEXT},
|
||||
};
|
||||
|
||||
static FLT_TB FloatingToolbar[NUM_FLT_TB] = {
|
||||
static FLT_WND FloatingWindow[NUM_FLT_WND] = {
|
||||
{NULL, NULL, 0, 0, 55, 300},
|
||||
{NULL, NULL, 0, 0, 200, 200},
|
||||
{NULL, NULL, 0, 0, 150, 150}
|
||||
};
|
||||
|
||||
|
||||
/* Standard Toolbar */
|
||||
/* Toolbars */
|
||||
#define ID_TOOLBAR_STANDARD 0
|
||||
#define ID_TOOLBAR_TEXT 1
|
||||
static const TCHAR szToolbarStandard[] = TEXT("STANDARD");
|
||||
static const TCHAR szToolbarText[] = TEXT("TEXT");
|
||||
|
||||
|
||||
/* Test Toolbar */
|
||||
#define ID_TOOLBAR_TEST 1
|
||||
#define ID_TOOLBAR_TEST 5
|
||||
static const TCHAR szToolbarTest[] = TEXT("TEST");
|
||||
|
||||
/* Toolbars table */
|
||||
static const DOCKBAR MainDockBars[] = {
|
||||
{ID_TOOLBAR_STANDARD, szToolbarStandard, IDS_TOOLBAR_STANDARD, TOP_DOCK},
|
||||
{ID_TOOLBAR_TEST, szToolbarTest, IDS_TOOLBAR_TEST, TOP_DOCK},
|
||||
{ID_TOOLBAR_TEXT, szToolbarText, IDS_TOOLBAR_TEXT, TOP_DOCK},
|
||||
};
|
||||
|
||||
|
||||
|
@ -108,6 +111,7 @@ MainWndCreateToolbarClient(struct _TOOLBAR_DOCKS *TbDocks,
|
|||
{
|
||||
const TBBUTTON *Buttons = NULL;
|
||||
UINT NumButtons = 0;
|
||||
UINT StartImageRes;
|
||||
HWND hWndClient = NULL;
|
||||
|
||||
UNREFERENCED_PARAMETER(Context);
|
||||
|
@ -119,6 +123,15 @@ MainWndCreateToolbarClient(struct _TOOLBAR_DOCKS *TbDocks,
|
|||
{
|
||||
Buttons = StdButtons;
|
||||
NumButtons = sizeof(StdButtons) / sizeof(StdButtons[0]);
|
||||
StartImageRes = IDB_MAINNEWICON;
|
||||
break;
|
||||
}
|
||||
|
||||
case ID_TOOLBAR_TEXT:
|
||||
{
|
||||
Buttons = TextButtons;
|
||||
NumButtons = sizeof(TextButtons) / sizeof(TextButtons[0]);
|
||||
StartImageRes = IDB_TEXTBOLD;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -158,7 +171,7 @@ MainWndCreateToolbarClient(struct _TOOLBAR_DOCKS *TbDocks,
|
|||
NULL);
|
||||
if (hWndClient != NULL)
|
||||
{
|
||||
HIMAGELIST hMainTBImageList;
|
||||
HIMAGELIST hImageList;
|
||||
|
||||
SendMessage(hWndClient,
|
||||
TB_SETEXTENDEDSTYLE,
|
||||
|
@ -176,18 +189,20 @@ MainWndCreateToolbarClient(struct _TOOLBAR_DOCKS *TbDocks,
|
|||
0,
|
||||
(LPARAM)MAKELONG(TB_BMP_WIDTH, TB_BMP_HEIGHT));
|
||||
|
||||
hMainTBImageList = InitImageList(NUM_MAINTB_IMAGES,
|
||||
IDB_MAINNEWICON);
|
||||
hImageList = InitImageList(NumButtons,
|
||||
StartImageRes);
|
||||
|
||||
ImageList_Destroy((HIMAGELIST)SendMessage(hWndClient,
|
||||
TB_SETIMAGELIST,
|
||||
0,
|
||||
(LPARAM)hMainTBImageList));
|
||||
(LPARAM)hImageList));
|
||||
|
||||
SendMessage(hWndClient,
|
||||
TB_ADDBUTTONS,
|
||||
NumButtons,
|
||||
(LPARAM)&StdButtons);
|
||||
(LPARAM)Buttons);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -224,6 +239,7 @@ MainWndToolbarInsertBand(struct _TOOLBAR_DOCKS *TbDocks,
|
|||
{
|
||||
switch (rbi->wID)
|
||||
{
|
||||
case ID_TOOLBAR_TEXT:
|
||||
case ID_TOOLBAR_STANDARD:
|
||||
{
|
||||
SIZE Size;
|
||||
|
@ -273,6 +289,7 @@ MainWndToolbarDockBand(struct _TOOLBAR_DOCKS *TbDocks,
|
|||
{
|
||||
switch (rbi->wID)
|
||||
{
|
||||
case ID_TOOLBAR_TEXT:
|
||||
case ID_TOOLBAR_STANDARD:
|
||||
{
|
||||
SIZE Size;
|
||||
|
@ -350,30 +367,31 @@ MainWndToolbarChevronPushed(struct _TOOLBAR_DOCKS *TbDocks,
|
|||
}
|
||||
|
||||
static VOID
|
||||
MainWndMoveFloatingToolbars(HWND hwnd, PRECT wndOldPos)
|
||||
MainWndMoveFloatingWindows(HWND hwnd, PRECT wndOldPos)
|
||||
{
|
||||
RECT wndNewPos, TbRect;
|
||||
INT i, xMoved, yMoved;
|
||||
|
||||
GetWindowRect(hwnd,
|
||||
&wndNewPos);
|
||||
if (GetWindowRect(hwnd,
|
||||
&wndNewPos))
|
||||
{
|
||||
|
||||
xMoved = wndNewPos.left - wndOldPos->left;
|
||||
yMoved = wndNewPos.top - wndOldPos->top;
|
||||
|
||||
for (i = 0; i < NUM_FLT_TB; i++)
|
||||
for (i = 0; i < NUM_FLT_WND; i++)
|
||||
{
|
||||
GetWindowRect(FloatingToolbar[i].hSelf,
|
||||
GetWindowRect(FloatingWindow[i].hSelf,
|
||||
&TbRect);
|
||||
|
||||
FloatingToolbar[i].x = TbRect.left + xMoved;
|
||||
FloatingToolbar[i].y = TbRect.top + yMoved;
|
||||
FloatingWindow[i].x = TbRect.left + xMoved;
|
||||
FloatingWindow[i].y = TbRect.top + yMoved;
|
||||
|
||||
MoveWindow(FloatingToolbar[i].hSelf,
|
||||
FloatingToolbar[i].x,
|
||||
FloatingToolbar[i].y,
|
||||
FloatingToolbar[i].Width,
|
||||
FloatingToolbar[i].Height,
|
||||
MoveWindow(FloatingWindow[i].hSelf,
|
||||
FloatingWindow[i].x,
|
||||
FloatingWindow[i].y,
|
||||
FloatingWindow[i].Width,
|
||||
FloatingWindow[i].Height,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
|
@ -381,83 +399,89 @@ MainWndMoveFloatingToolbars(HWND hwnd, PRECT wndOldPos)
|
|||
&wndNewPos,
|
||||
sizeof(RECT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
MainWndResetFloatingToolbars(HWND hwnd)
|
||||
MainWndResetFloatingWindows(HWND hwnd)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
GetWindowRect(hwnd,
|
||||
&rect);
|
||||
if (GetWindowRect(hwnd,
|
||||
&rect))
|
||||
{
|
||||
|
||||
/* tools datum */
|
||||
MoveWindow(FloatingToolbar[0].hSelf,
|
||||
MoveWindow(FloatingWindow[0].hSelf,
|
||||
rect.left + 5,
|
||||
rect.top + 5,
|
||||
FloatingToolbar[0].Width,
|
||||
FloatingToolbar[0].Height,
|
||||
FloatingWindow[0].Width,
|
||||
FloatingWindow[0].Height,
|
||||
TRUE);
|
||||
|
||||
/* colors datum */
|
||||
MoveWindow(FloatingToolbar[1].hSelf,
|
||||
MoveWindow(FloatingWindow[1].hSelf,
|
||||
rect.left + 5,
|
||||
rect.bottom - FloatingToolbar[1].Height - 5,
|
||||
FloatingToolbar[1].Width,
|
||||
FloatingToolbar[1].Height,
|
||||
rect.bottom - FloatingWindow[1].Height - 5,
|
||||
FloatingWindow[1].Width,
|
||||
FloatingWindow[1].Height,
|
||||
TRUE);
|
||||
|
||||
/* history datum */
|
||||
MoveWindow(FloatingToolbar[2].hSelf,
|
||||
rect.right - FloatingToolbar[2].Width - 5,
|
||||
MoveWindow(FloatingWindow[2].hSelf,
|
||||
rect.right - FloatingWindow[2].Width - 5,
|
||||
rect.top + 5,
|
||||
FloatingToolbar[2].Width,
|
||||
FloatingToolbar[2].Height,
|
||||
FloatingWindow[2].Width,
|
||||
FloatingWindow[2].Height,
|
||||
TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static VOID
|
||||
MainWndCreateFloatToolbars(PMAIN_WND_INFO Info)
|
||||
MainWndCreateFloatWindows(PMAIN_WND_INFO Info)
|
||||
{
|
||||
RECT rect;
|
||||
const TBBUTTON *Buttons = NULL;
|
||||
UINT Res, NumButtons = 2;
|
||||
INT i = 0;
|
||||
|
||||
GetWindowRect(Info->hMdiClient,
|
||||
&rect);
|
||||
if (! GetWindowRect(Info->hMdiClient,
|
||||
&rect))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* tools datum */
|
||||
FloatingToolbar[0].x = rect.left + 5;
|
||||
FloatingToolbar[0].y = rect.top + 5;
|
||||
FloatingWindow[0].x = rect.left + 5;
|
||||
FloatingWindow[0].y = rect.top + 5;
|
||||
|
||||
/* colors datum */
|
||||
FloatingToolbar[1].x = rect.left + 5;
|
||||
FloatingToolbar[1].y = rect.bottom - FloatingToolbar[1].Height - 5;
|
||||
FloatingWindow[1].x = rect.left + 5;
|
||||
FloatingWindow[1].y = rect.bottom - FloatingWindow[1].Height - 5;
|
||||
|
||||
/* history datum */
|
||||
FloatingToolbar[2].x = rect.right - FloatingToolbar[2].Width - 5;
|
||||
FloatingToolbar[2].y = rect.top + 5;
|
||||
FloatingWindow[2].x = rect.right - FloatingWindow[2].Width - 5;
|
||||
FloatingWindow[2].y = rect.top + 5;
|
||||
|
||||
for (Res = IDS_FLT_TOOLS; Res < IDS_FLT_TOOLS + NUM_FLT_TB; Res++, i++)
|
||||
for (Res = IDS_FLT_TOOLS; Res < IDS_FLT_TOOLS + NUM_FLT_WND; Res++, i++)
|
||||
{
|
||||
if (! AllocAndLoadString(&FloatingToolbar[i].lpName,
|
||||
if (! AllocAndLoadString(&FloatingWindow[i].lpName,
|
||||
hInstance,
|
||||
Res))
|
||||
{
|
||||
FloatingToolbar[i].lpName = NULL;
|
||||
FloatingWindow[i].lpName = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* create the 'tools' toolbar */
|
||||
FloatingToolbar[i].hSelf = CreateWindowEx(WS_EX_TOOLWINDOW,
|
||||
FloatingWindow[i].hSelf = CreateWindowEx(WS_EX_TOOLWINDOW,
|
||||
TEXT("ImageSoftFloatWndClass"),
|
||||
FloatingToolbar[i].lpName,
|
||||
FloatingWindow[i].lpName,
|
||||
WS_POPUPWINDOW | WS_DLGFRAME | WS_VISIBLE,
|
||||
FloatingToolbar[i].x,
|
||||
FloatingToolbar[i].y,
|
||||
FloatingToolbar[i].Width,
|
||||
FloatingToolbar[i].Height,
|
||||
FloatingWindow[i].x,
|
||||
FloatingWindow[i].y,
|
||||
FloatingWindow[i].Width,
|
||||
FloatingWindow[i].Height,
|
||||
Info->hSelf,
|
||||
NULL,
|
||||
hInstance,
|
||||
|
@ -527,7 +551,7 @@ CreateToolbars(PMAIN_WND_INFO Info)
|
|||
&MainWndDockBarCallbacks);
|
||||
}
|
||||
|
||||
MainWndCreateFloatToolbars(Info);
|
||||
MainWndCreateFloatWindows(Info);
|
||||
}
|
||||
|
||||
static VOID CALLBACK
|
||||
|
@ -707,6 +731,10 @@ MainWndCommand(PMAIN_WND_INFO Info,
|
|||
break;
|
||||
}
|
||||
|
||||
case ID_BOLD:
|
||||
MessageBox(NULL, _T("Bingo"), NULL, 0);
|
||||
break;
|
||||
|
||||
case ID_OPEN:
|
||||
{
|
||||
OPEN_IMAGE_EDIT_INFO OpenInfo;
|
||||
|
@ -861,7 +889,7 @@ MainWndProc(HWND hwnd,
|
|||
|
||||
/* reposition the floating toolbars */
|
||||
if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED))
|
||||
MainWndResetFloatingToolbars(Info->hMdiClient);
|
||||
MainWndResetFloatingWindows(Info->hMdiClient);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -875,6 +903,7 @@ MainWndProc(HWND hwnd,
|
|||
break;
|
||||
|
||||
case WM_NCLBUTTONUP :
|
||||
|
||||
bLBMouseDown = FALSE;
|
||||
DefWindowProc(hwnd,
|
||||
uMsg,
|
||||
|
@ -886,7 +915,7 @@ MainWndProc(HWND hwnd,
|
|||
{
|
||||
/* if the main window is moved, move the toolbars too */
|
||||
if (bLBMouseDown)
|
||||
MainWndMoveFloatingToolbars(hwnd, &wndOldPos);
|
||||
MainWndMoveFloatingWindows(hwnd, &wndOldPos);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -131,6 +131,7 @@ typedef struct _EDIT_WND_INFO
|
|||
struct _EDIT_WND_INFO *Next;
|
||||
POINT ScrollPos;
|
||||
USHORT Zoom;
|
||||
DWORD Tool;
|
||||
|
||||
POPEN_IMAGE_EDIT_INFO OpenInfo; /* Only valid during initialization */
|
||||
|
||||
|
@ -332,7 +333,7 @@ BOOL DoOpenFile(HWND hwnd, LPTSTR lpFileName, LPTSTR lpName);
|
|||
BOOL DoSaveFile(HWND hwnd);
|
||||
|
||||
/* floattoolbar.c */
|
||||
typedef struct _FLT_TB
|
||||
typedef struct _FLT_WND
|
||||
{
|
||||
HWND hSelf;
|
||||
LPTSTR lpName;
|
||||
|
@ -340,10 +341,11 @@ typedef struct _FLT_TB
|
|||
INT y;
|
||||
INT Width;
|
||||
INT Height;
|
||||
} FLT_TB, *PFLT_TB;
|
||||
BOOL bOpaque;
|
||||
} FLT_WND, *PFLT_WND;
|
||||
|
||||
BOOL InitFloatWndClass(VOID);
|
||||
VOID UninitFloatWndImpl(VOID);
|
||||
BOOL ShowHideToolbar(HWND hwnd);
|
||||
BOOL ShowHideWindow(HWND hwnd);
|
||||
|
||||
#endif /* __IMAGESOFT_PRECOMP_H */
|
||||
|
|
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 |
BIN
reactos/base/applications/imagesoft/res/icons/TextBoldIcon.bmp
Normal file
BIN
reactos/base/applications/imagesoft/res/icons/TextBoldIcon.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 824 B |
BIN
reactos/base/applications/imagesoft/res/icons/TextItalicIcon.bmp
Normal file
BIN
reactos/base/applications/imagesoft/res/icons/TextItalicIcon.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 824 B |
Binary file not shown.
After Width: | Height: | Size: 824 B |
|
@ -29,7 +29,12 @@
|
|||
#define ID_EDITCOLOURS 2017
|
||||
#define ID_TOOLS 2018
|
||||
#define ID_STATUSBAR 2019
|
||||
|
||||
#define ID_BOLD 2030
|
||||
#define ID_ITALIC 2031
|
||||
#define ID_ULINE 2032
|
||||
#define ID_TXTLEFT 2033
|
||||
#define ID_TXTCENTER 2034
|
||||
#define ID_TXTRIGHT 2035
|
||||
|
||||
#define ID_REFRESH 3000
|
||||
#define ID_HELP 3001
|
||||
|
@ -77,6 +82,13 @@
|
|||
#define TBICON_HELP 8
|
||||
#define TBICON_EXIT 9
|
||||
|
||||
#define TBICON_BOLD 10
|
||||
#define TBICON_ITALIC 11
|
||||
#define TBICON_ULINE 12
|
||||
#define TBICON_TXTLEFT 13
|
||||
#define TBICON_TXTCENTER 14
|
||||
#define TBICON_TXTRIGHT 15
|
||||
|
||||
/* about box info */
|
||||
#define IDD_ABOUTBOX 200
|
||||
#define IDC_LICENSE_EDIT 201
|
||||
|
@ -87,7 +99,8 @@
|
|||
#define IDS_READY 104
|
||||
#define IDS_TOOLBAR_STANDARD 201
|
||||
#define IDS_TOOLBAR_TEST 202
|
||||
#define IDS_IMAGE_NAME 203
|
||||
#define IDS_TOOLBAR_TEXT 203
|
||||
#define IDS_IMAGE_NAME 210
|
||||
|
||||
/* menu hints */
|
||||
#define IDS_HINT_EXIT 20001
|
||||
|
@ -127,8 +140,6 @@
|
|||
#define IDS_UNIT_KB 4110
|
||||
|
||||
|
||||
|
||||
|
||||
/* toolbar buttons resources
|
||||
* these must be numbered consecutively
|
||||
* see loop in InitImageList */
|
||||
|
@ -142,6 +153,13 @@
|
|||
#define IDB_MAINPASTEICON 10007
|
||||
#define IDB_MAINUNDOICON 10008
|
||||
#define IDB_MAINREDOICON 10009
|
||||
#define IDB_TEXTBOLD 10020
|
||||
#define IDB_TEXTITALIC 10021
|
||||
#define IDB_TEXTULINE 10022
|
||||
#define IDB_TEXTLEFT 10023
|
||||
#define IDB_TEXTCENTER 10024
|
||||
#define IDB_TEXTRIGHT 10025
|
||||
|
||||
|
||||
/* toolbar buttons */
|
||||
#define TBICON_NEW 0
|
||||
|
|
Loading…
Reference in a new issue