Author: gedmurphy
Date: Fri Mar 24 22:39:07 2006
New Revision: 21376
URL:
http://svn.reactos.ru/svn/reactos?rev=21376&view=rev
Log:
- 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.
Added:
trunk/reactos/base/applications/imagesoft/floatwindow.c
trunk/reactos/base/applications/imagesoft/res/icons/TextAlignCenterIcon.bmp (with
props)
trunk/reactos/base/applications/imagesoft/res/icons/TextAlignLeftIcon.bmp (with
props)
trunk/reactos/base/applications/imagesoft/res/icons/TextAlignRightIcon.bmp (with
props)
trunk/reactos/base/applications/imagesoft/res/icons/TextBoldIcon.bmp (with props)
trunk/reactos/base/applications/imagesoft/res/icons/TextItalicIcon.bmp (with props)
trunk/reactos/base/applications/imagesoft/res/icons/TextUnderlineIcon.bmp (with
props)
Removed:
trunk/reactos/base/applications/imagesoft/floattoolbar.c
Modified:
trunk/reactos/base/applications/imagesoft/En.rc
trunk/reactos/base/applications/imagesoft/buttons.h
trunk/reactos/base/applications/imagesoft/imagesoft.c
trunk/reactos/base/applications/imagesoft/imagesoft.rbuild
trunk/reactos/base/applications/imagesoft/imagesoft.rc
trunk/reactos/base/applications/imagesoft/imgedwnd.c
trunk/reactos/base/applications/imagesoft/mainwnd.c
trunk/reactos/base/applications/imagesoft/precomp.h
trunk/reactos/base/applications/imagesoft/resource.h
Modified: trunk/reactos/base/applications/imagesoft/En.rc
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
--- trunk/reactos/base/applications/imagesoft/En.rc (original)
+++ trunk/reactos/base/applications/imagesoft/En.rc Fri Mar 24 22:39:07 2006
@@ -33,6 +33,8 @@
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"
Modified: trunk/reactos/base/applications/imagesoft/buttons.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
--- trunk/reactos/base/applications/imagesoft/buttons.h (original)
+++ trunk/reactos/base/applications/imagesoft/buttons.h Fri Mar 24 22:39:07 2006
@@ -1,5 +1,6 @@
+/* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData,
iString */
+
TBBUTTON StdButtons[] = {
- /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
{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 @@
{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 */
+};
Removed: trunk/reactos/base/applications/imagesoft/floattoolbar.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
--- trunk/reactos/base/applications/imagesoft/floattoolbar.c (original)
+++ trunk/reactos/base/applications/imagesoft/floattoolbar.c (removed)
@@ -1,87 +1,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);
-}
-
Added: trunk/reactos/base/applications/imagesoft/floatwindow.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
--- trunk/reactos/base/applications/imagesoft/floatwindow.c (added)
+++ trunk/reactos/base/applications/imagesoft/floatwindow.c Fri Mar 24 22:39:07 2006
@@ -1,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);
+}
+
Modified: trunk/reactos/base/applications/imagesoft/imagesoft.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
--- trunk/reactos/base/applications/imagesoft/imagesoft.c (original)
+++ trunk/reactos/base/applications/imagesoft/imagesoft.c Fri Mar 24 22:39:07 2006
@@ -1,4 +1,4 @@
-#include "precomp.h"
+#include <precomp.h>
HINSTANCE hInstance;
HANDLE ProcessHeap;
Modified: trunk/reactos/base/applications/imagesoft/imagesoft.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
--- trunk/reactos/base/applications/imagesoft/imagesoft.rbuild (original)
+++ trunk/reactos/base/applications/imagesoft/imagesoft.rbuild Fri Mar 24 22:39:07 2006
@@ -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>
Modified: trunk/reactos/base/applications/imagesoft/imagesoft.rc
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
--- trunk/reactos/base/applications/imagesoft/imagesoft.rc (original)
+++ trunk/reactos/base/applications/imagesoft/imagesoft.rc Fri Mar 24 22:39:07 2006
@@ -30,6 +30,13 @@
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"
Modified: trunk/reactos/base/applications/imagesoft/imgedwnd.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
--- trunk/reactos/base/applications/imagesoft/imgedwnd.c (original)
+++ trunk/reactos/base/applications/imagesoft/imgedwnd.c Fri Mar 24 22:39:07 2006
@@ -46,9 +46,16 @@
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 @@
fail:
if (! hFile)
CloseHandle(hFile);
+
if (! pbmi)
HeapFree(ProcessHeap,
0,
pbmi);
+
return FALSE;
}
@@ -169,6 +178,8 @@
{
PEDIT_WND_INFO *PrevEditor;
PEDIT_WND_INFO Editor;
+
+ DeleteDC(Info->hDCMem);
/* FIXME - free resources and run down editor */
@@ -196,24 +207,20 @@
if (Info->hBitmap)
{
- Info->hDCMem = CreateCompatibleDC(hDC);
-
hOldBitmap = (HBITMAP) SelectObject(Info->hDCMem,
- Info->hBitmap);
+ 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 @@
{
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 @@
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:
Modified: trunk/reactos/base/applications/imagesoft/mainwnd.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
--- trunk/reactos/base/applications/imagesoft/mainwnd.c (original)
+++ trunk/reactos/base/applications/imagesoft/mainwnd.c Fri Mar 24 22:39:07 2006
@@ -5,7 +5,7 @@
#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 @@
{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 @@
{
const TBBUTTON *Buttons = NULL;
UINT NumButtons = 0;
+ UINT StartImageRes;
HWND hWndClient = NULL;
UNREFERENCED_PARAMETER(Context);
@@ -119,6 +123,15 @@
{
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 @@
NULL);
if (hWndClient != NULL)
{
- HIMAGELIST hMainTBImageList;
+ HIMAGELIST hImageList;
SendMessage(hWndClient,
TB_SETEXTENDEDSTYLE,
@@ -176,18 +189,20 @@
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 @@
{
switch (rbi->wID)
{
+ case ID_TOOLBAR_TEXT:
case ID_TOOLBAR_STANDARD:
{
SIZE Size;
@@ -273,6 +289,7 @@
{
switch (rbi->wID)
{
+ case ID_TOOLBAR_TEXT:
case ID_TOOLBAR_STANDARD:
{
SIZE Size;
@@ -350,118 +367,125 @@
}
static VOID
-MainWndMoveFloatingToolbars(HWND hwnd, PRECT wndOldPos)
+MainWndMoveFloatingWindows(HWND hwnd, PRECT wndOldPos)
{
RECT wndNewPos, TbRect;
INT i, xMoved, yMoved;
- GetWindowRect(hwnd,
- &wndNewPos);
-
- xMoved = wndNewPos.left - wndOldPos->left;
- yMoved = wndNewPos.top - wndOldPos->top;
-
- for (i = 0; i < NUM_FLT_TB; i++)
- {
- GetWindowRect(FloatingToolbar[i].hSelf,
- &TbRect);
-
- FloatingToolbar[i].x = TbRect.left + xMoved;
- FloatingToolbar[i].y = TbRect.top + yMoved;
-
- MoveWindow(FloatingToolbar[i].hSelf,
- FloatingToolbar[i].x,
- FloatingToolbar[i].y,
- FloatingToolbar[i].Width,
- FloatingToolbar[i].Height,
+ if (GetWindowRect(hwnd,
+ &wndNewPos))
+ {
+
+ xMoved = wndNewPos.left - wndOldPos->left;
+ yMoved = wndNewPos.top - wndOldPos->top;
+
+ for (i = 0; i < NUM_FLT_WND; i++)
+ {
+ GetWindowRect(FloatingWindow[i].hSelf,
+ &TbRect);
+
+ FloatingWindow[i].x = TbRect.left + xMoved;
+ FloatingWindow[i].y = TbRect.top + yMoved;
+
+ MoveWindow(FloatingWindow[i].hSelf,
+ FloatingWindow[i].x,
+ FloatingWindow[i].y,
+ FloatingWindow[i].Width,
+ FloatingWindow[i].Height,
+ TRUE);
+ }
+
+ CopyMemory(wndOldPos,
+ &wndNewPos,
+ sizeof(RECT));
+ }
+}
+
+
+static VOID
+MainWndResetFloatingWindows(HWND hwnd)
+{
+ RECT rect;
+
+ if (GetWindowRect(hwnd,
+ &rect))
+ {
+
+ /* tools datum */
+ MoveWindow(FloatingWindow[0].hSelf,
+ rect.left + 5,
+ rect.top + 5,
+ FloatingWindow[0].Width,
+ FloatingWindow[0].Height,
TRUE);
- }
-
- CopyMemory(wndOldPos,
- &wndNewPos,
- sizeof(RECT));
-}
-
+
+ /* colors datum */
+ MoveWindow(FloatingWindow[1].hSelf,
+ rect.left + 5,
+ rect.bottom - FloatingWindow[1].Height - 5,
+ FloatingWindow[1].Width,
+ FloatingWindow[1].Height,
+ TRUE);
+
+ /* history datum */
+ MoveWindow(FloatingWindow[2].hSelf,
+ rect.right - FloatingWindow[2].Width - 5,
+ rect.top + 5,
+ FloatingWindow[2].Width,
+ FloatingWindow[2].Height,
+ TRUE);
+ }
+}
static VOID
-MainWndResetFloatingToolbars(HWND hwnd)
-{
- RECT rect;
-
- GetWindowRect(hwnd,
- &rect);
-
- /* tools datum */
- MoveWindow(FloatingToolbar[0].hSelf,
- rect.left + 5,
- rect.top + 5,
- FloatingToolbar[0].Width,
- FloatingToolbar[0].Height,
- TRUE);
-
- /* colors datum */
- MoveWindow(FloatingToolbar[1].hSelf,
- rect.left + 5,
- rect.bottom - FloatingToolbar[1].Height - 5,
- FloatingToolbar[1].Width,
- FloatingToolbar[1].Height,
- TRUE);
-
- /* history datum */
- MoveWindow(FloatingToolbar[2].hSelf,
- rect.right - FloatingToolbar[2].Width - 5,
- rect.top + 5,
- FloatingToolbar[2].Width,
- FloatingToolbar[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;
-
- for (Res = IDS_FLT_TOOLS; Res < IDS_FLT_TOOLS + NUM_FLT_TB; Res++, i++)
- {
- if (! AllocAndLoadString(&FloatingToolbar[i].lpName,
+ 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_WND; Res++, i++)
+ {
+ 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,
-
TEXT("ImageSoftFloatWndClass"),
- FloatingToolbar[i].lpName,
- WS_POPUPWINDOW | WS_DLGFRAME |
WS_VISIBLE,
- FloatingToolbar[i].x,
- FloatingToolbar[i].y,
- FloatingToolbar[i].Width,
- FloatingToolbar[i].Height,
- Info->hSelf,
- NULL,
- hInstance,
- 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);
}
@@ -527,7 +551,7 @@
&MainWndDockBarCallbacks);
}
- MainWndCreateFloatToolbars(Info);
+ MainWndCreateFloatWindows(Info);
}
static VOID CALLBACK
@@ -707,6 +731,10 @@
break;
}
+ case ID_BOLD:
+ MessageBox(NULL, _T("Bingo"), NULL, 0);
+ break;
+
case ID_OPEN:
{
OPEN_IMAGE_EDIT_INFO OpenInfo;
@@ -861,7 +889,7 @@
/* reposition the floating toolbars */
if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED))
- MainWndResetFloatingToolbars(Info->hMdiClient);
+ MainWndResetFloatingWindows(Info->hMdiClient);
break;
}
@@ -875,6 +903,7 @@
break;
case WM_NCLBUTTONUP :
+
bLBMouseDown = FALSE;
DefWindowProc(hwnd,
uMsg,
@@ -886,7 +915,7 @@
{
/* if the main window is moved, move the toolbars too */
if (bLBMouseDown)
- MainWndMoveFloatingToolbars(hwnd, &wndOldPos);
+ MainWndMoveFloatingWindows(hwnd, &wndOldPos);
}
break;
Modified: trunk/reactos/base/applications/imagesoft/precomp.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
--- trunk/reactos/base/applications/imagesoft/precomp.h (original)
+++ trunk/reactos/base/applications/imagesoft/precomp.h Fri Mar 24 22:39:07 2006
@@ -131,6 +131,7 @@
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 DoSaveFile(HWND hwnd);
/* floattoolbar.c */
-typedef struct _FLT_TB
+typedef struct _FLT_WND
{
HWND hSelf;
LPTSTR lpName;
@@ -340,10 +341,11 @@
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 */
Added: trunk/reactos/base/applications/imagesoft/res/icons/TextAlignCenterIcon.bmp
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
Binary file - no diff available.
Propchange: trunk/reactos/base/applications/imagesoft/res/icons/TextAlignCenterIcon.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/reactos/base/applications/imagesoft/res/icons/TextAlignLeftIcon.bmp
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
Binary file - no diff available.
Propchange: trunk/reactos/base/applications/imagesoft/res/icons/TextAlignLeftIcon.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/reactos/base/applications/imagesoft/res/icons/TextAlignRightIcon.bmp
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
Binary file - no diff available.
Propchange: trunk/reactos/base/applications/imagesoft/res/icons/TextAlignRightIcon.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/reactos/base/applications/imagesoft/res/icons/TextBoldIcon.bmp
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
Binary file - no diff available.
Propchange: trunk/reactos/base/applications/imagesoft/res/icons/TextBoldIcon.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/reactos/base/applications/imagesoft/res/icons/TextItalicIcon.bmp
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
Binary file - no diff available.
Propchange: trunk/reactos/base/applications/imagesoft/res/icons/TextItalicIcon.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/reactos/base/applications/imagesoft/res/icons/TextUnderlineIcon.bmp
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
Binary file - no diff available.
Propchange: trunk/reactos/base/applications/imagesoft/res/icons/TextUnderlineIcon.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: trunk/reactos/base/applications/imagesoft/resource.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/imagesoft…
==============================================================================
--- trunk/reactos/base/applications/imagesoft/resource.h (original)
+++ trunk/reactos/base/applications/imagesoft/resource.h Fri Mar 24 22:39:07 2006
@@ -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