Author: bfreisen
Date: Mon Feb 10 20:49:15 2014
New Revision: 62113
URL:
http://svn.reactos.org/svn/reactos?rev=62113&view=rev
Log:
[MSPAINT]
- Text tool allows text input (I chose a design with separate editor window)
Modified:
trunk/reactos/base/applications/mspaint/CMakeLists.txt
trunk/reactos/base/applications/mspaint/globalvar.h
trunk/reactos/base/applications/mspaint/main.c
trunk/reactos/base/applications/mspaint/winproc.c
Modified: trunk/reactos/base/applications/mspaint/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/CMakeLists.txt [iso-8859-1] Mon Feb 10
20:49:15 2014
@@ -10,6 +10,7 @@
registry.c
selection.c
sizebox.c
+ textedit.c
toolsettings.c
winproc.c
precomp.h)
Modified: trunk/reactos/base/applications/mspaint/globalvar.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/globalvar.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/globalvar.h [iso-8859-1] Mon Feb 10 20:49:15
2014
@@ -54,6 +54,8 @@
extern HWND hImageArea;
extern HBITMAP hSelBm;
extern HBITMAP hSelMask;
+extern HWND hwndTextEdit;
+extern HWND hwndEditCtl;
extern LOGFONT lfTextFont;
extern HFONT hfontTextFont;
extern LPTSTR textToolText;
Modified: trunk/reactos/base/applications/mspaint/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/main.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/main.c [iso-8859-1] Mon Feb 10 20:49:15 2014
@@ -15,6 +15,7 @@
#include "toolsettings.h"
#include "selection.h"
#include "sizebox.h"
+#include "textedit.h"
/* FUNCTIONS ********************************************************/
@@ -54,9 +55,10 @@
HBITMAP hSelMask;
LOGFONT lfTextFont;
HFONT hfontTextFont;
-/* TODO: add dialog to edit the currently hard-coded text */
-LPTSTR textToolText = _T("Abc\n1234567890");
-int textToolTextMaxLen = SIZEOF(textToolText);
+HWND hwndTextEdit;
+HWND hwndEditCtl;
+LPTSTR textToolText = NULL;
+int textToolTextMaxLen = 0;
/* array holding palette colors; may be changed by the user during execution */
int palColors[28];
@@ -142,6 +144,7 @@
WNDCLASSEX wclPal;
WNDCLASSEX wclSettings;
WNDCLASSEX wclSelection;
+ WNDCLASSEX wclTextEdit;
TCHAR progtitle[1000];
TCHAR resstr[100];
@@ -282,6 +285,21 @@
wclSettings.hbrBackground = GetSysColorBrush(COLOR_HIGHLIGHT);
RegisterClassEx (&wclSettings);
+ /* initializing and registering the window class used for the text editor */
+ wclTextEdit.hInstance = hThisInstance;
+ wclTextEdit.lpszClassName = _T("TextEdit");
+ wclTextEdit.lpfnWndProc = TextEditWinProc;
+ wclTextEdit.style = CS_DBLCLKS;
+ wclTextEdit.cbSize = sizeof(WNDCLASSEX);
+ wclTextEdit.hIcon = LoadIcon(hThisInstance,
MAKEINTRESOURCE(IDI_APPICON));
+ wclTextEdit.hIconSm = LoadIcon(hThisInstance,
MAKEINTRESOURCE(IDI_APPICON));
+ wclTextEdit.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wclTextEdit.lpszMenuName = NULL;
+ wclTextEdit.cbClsExtra = 0;
+ wclTextEdit.cbWndExtra = 0;
+ wclTextEdit.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
+ RegisterClassEx (&wclTextEdit);
+
LoadString(hThisInstance, IDS_DEFAULTFILENAME, filename, SIZEOF(filename));
LoadString(hThisInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
_stprintf(progtitle, resstr, filename);
@@ -512,6 +530,16 @@
/* by moving the window, the things in WM_SIZE are done */
MoveWindow(hwnd, 100, 100, 600, 450, TRUE);
+ /* creating the text editor window for the text tool */
+ hwndTextEdit =
+ CreateWindowEx(0, _T("TextEdit"), _T(""),
WS_OVERLAPPEDWINDOW, 300, 0, 300,
+ 200, hwnd, NULL, hThisInstance, NULL);
+ /* creating the edit control within the editor window */
+ hwndEditCtl =
+ CreateWindowEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""),
+ WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
ES_MULTILINE | ES_NOHIDESEL | ES_AUTOHSCROLL | ES_AUTOVSCROLL,
+ 0, 0, 100, 100, hwndTextEdit, NULL, hThisInstance, NULL);
+
/* Make the window visible on the screen */
ShowWindow (hwnd, nFunsterStil);
Modified: trunk/reactos/base/applications/mspaint/winproc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/winproc.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/winproc.c [iso-8859-1] Mon Feb 10 20:49:15
2014
@@ -24,6 +24,7 @@
pointSP = 0; // resets the point-buffer of the polygon and bezier
functions
InvalidateRect(hToolSettings, NULL, TRUE);
ShowWindow(hTrackbarZoom, (tool == TOOL_ZOOM) ? SW_SHOW : SW_HIDE);
+ ShowWindow(hwndTextEdit, (tool == TOOL_TEXT) ? SW_SHOW : SW_HIDE);
}
void
@@ -299,17 +300,21 @@
EnableMenuItem(menu, IDM_EDITPASTE,
ENABLED_IF(GetClipboardData(CF_BITMAP) != NULL));
CloseClipboard();
break;
+ case 2: /* View menu */
+ CheckMenuItem(menu, IDM_VIEWTOOLBOX,
CHECKED_IF(IsWindowVisible(hToolBoxContainer)));
+ CheckMenuItem(menu, IDM_VIEWCOLORPALETTE,
CHECKED_IF(IsWindowVisible(hPalWin)));
+ CheckMenuItem(menu, IDM_VIEWSTATUSBAR,
CHECKED_IF(IsWindowVisible(hStatusBar)));
+ CheckMenuItem(menu, IDM_FORMATICONBAR,
CHECKED_IF(IsWindowVisible(hwndTextEdit)));
+ EnableMenuItem(menu, IDM_FORMATICONBAR, ENABLED_IF(activeTool ==
TOOL_TEXT));
+
+ CheckMenuItem(menu, IDM_VIEWSHOWGRID,
CHECKED_IF(showGrid));
+ CheckMenuItem(menu, IDM_VIEWSHOWMINIATURE,
CHECKED_IF(showMiniature));
+ break;
case 3: /* Image menu */
EnableMenuItem(menu, IDM_IMAGECROP,
ENABLED_IF(IsWindowVisible(hSelection)));
CheckMenuItem(menu, IDM_IMAGEDRAWOPAQUE, CHECKED_IF(transpBg == 0));
break;
}
- CheckMenuItem(menu, IDM_VIEWTOOLBOX,
CHECKED_IF(IsWindowVisible(hToolBoxContainer)));
- CheckMenuItem(menu, IDM_VIEWCOLORPALETTE,
CHECKED_IF(IsWindowVisible(hPalWin)));
- CheckMenuItem(menu, IDM_VIEWSTATUSBAR,
CHECKED_IF(IsWindowVisible(hStatusBar)));
-
- CheckMenuItem(menu, IDM_VIEWSHOWGRID, CHECKED_IF(showGrid));
- CheckMenuItem(menu, IDM_VIEWSHOWMINIATURE, CHECKED_IF(showMiniature));
CheckMenuItem(menu, IDM_VIEWZOOM125, CHECKED_IF(zoom == 125));
CheckMenuItem(menu, IDM_VIEWZOOM25, CHECKED_IF(zoom == 250));
@@ -1031,6 +1036,8 @@
ShowWindow(hStatusBar, IsWindowVisible(hStatusBar) ? SW_HIDE :
SW_SHOW);
alignChildrenToMainWindow();
break;
+ case IDM_FORMATICONBAR:
+ ShowWindow(hwndTextEdit, IsWindowVisible(hwndTextEdit) ? SW_HIDE :
SW_SHOW);
case IDM_VIEWSHOWGRID:
showGrid = !showGrid;