mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
[MSPAINT]
- Text tool allows text input (I chose a design with separate editor window) svn path=/trunk/; revision=62113
This commit is contained in:
parent
a757b53b36
commit
0dea67635b
|
@ -10,6 +10,7 @@ list(APPEND SOURCE
|
||||||
registry.c
|
registry.c
|
||||||
selection.c
|
selection.c
|
||||||
sizebox.c
|
sizebox.c
|
||||||
|
textedit.c
|
||||||
toolsettings.c
|
toolsettings.c
|
||||||
winproc.c
|
winproc.c
|
||||||
precomp.h)
|
precomp.h)
|
||||||
|
|
|
@ -54,6 +54,8 @@ extern HWND hSelection;
|
||||||
extern HWND hImageArea;
|
extern HWND hImageArea;
|
||||||
extern HBITMAP hSelBm;
|
extern HBITMAP hSelBm;
|
||||||
extern HBITMAP hSelMask;
|
extern HBITMAP hSelMask;
|
||||||
|
extern HWND hwndTextEdit;
|
||||||
|
extern HWND hwndEditCtl;
|
||||||
extern LOGFONT lfTextFont;
|
extern LOGFONT lfTextFont;
|
||||||
extern HFONT hfontTextFont;
|
extern HFONT hfontTextFont;
|
||||||
extern LPTSTR textToolText;
|
extern LPTSTR textToolText;
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "toolsettings.h"
|
#include "toolsettings.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "sizebox.h"
|
#include "sizebox.h"
|
||||||
|
#include "textedit.h"
|
||||||
|
|
||||||
/* FUNCTIONS ********************************************************/
|
/* FUNCTIONS ********************************************************/
|
||||||
|
|
||||||
|
@ -54,9 +55,10 @@ HBITMAP hSelBm;
|
||||||
HBITMAP hSelMask;
|
HBITMAP hSelMask;
|
||||||
LOGFONT lfTextFont;
|
LOGFONT lfTextFont;
|
||||||
HFONT hfontTextFont;
|
HFONT hfontTextFont;
|
||||||
/* TODO: add dialog to edit the currently hard-coded text */
|
HWND hwndTextEdit;
|
||||||
LPTSTR textToolText = _T("Abc\n1234567890");
|
HWND hwndEditCtl;
|
||||||
int textToolTextMaxLen = SIZEOF(textToolText);
|
LPTSTR textToolText = NULL;
|
||||||
|
int textToolTextMaxLen = 0;
|
||||||
|
|
||||||
/* array holding palette colors; may be changed by the user during execution */
|
/* array holding palette colors; may be changed by the user during execution */
|
||||||
int palColors[28];
|
int palColors[28];
|
||||||
|
@ -142,6 +144,7 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument
|
||||||
WNDCLASSEX wclPal;
|
WNDCLASSEX wclPal;
|
||||||
WNDCLASSEX wclSettings;
|
WNDCLASSEX wclSettings;
|
||||||
WNDCLASSEX wclSelection;
|
WNDCLASSEX wclSelection;
|
||||||
|
WNDCLASSEX wclTextEdit;
|
||||||
|
|
||||||
TCHAR progtitle[1000];
|
TCHAR progtitle[1000];
|
||||||
TCHAR resstr[100];
|
TCHAR resstr[100];
|
||||||
|
@ -282,6 +285,21 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument
|
||||||
wclSettings.hbrBackground = GetSysColorBrush(COLOR_HIGHLIGHT);
|
wclSettings.hbrBackground = GetSysColorBrush(COLOR_HIGHLIGHT);
|
||||||
RegisterClassEx (&wclSettings);
|
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_DEFAULTFILENAME, filename, SIZEOF(filename));
|
||||||
LoadString(hThisInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
|
LoadString(hThisInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
|
||||||
_stprintf(progtitle, resstr, filename);
|
_stprintf(progtitle, resstr, filename);
|
||||||
|
@ -512,6 +530,16 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument
|
||||||
/* by moving the window, the things in WM_SIZE are done */
|
/* by moving the window, the things in WM_SIZE are done */
|
||||||
MoveWindow(hwnd, 100, 100, 600, 450, TRUE);
|
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 */
|
/* Make the window visible on the screen */
|
||||||
ShowWindow (hwnd, nFunsterStil);
|
ShowWindow (hwnd, nFunsterStil);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ selectTool(int tool)
|
||||||
pointSP = 0; // resets the point-buffer of the polygon and bezier functions
|
pointSP = 0; // resets the point-buffer of the polygon and bezier functions
|
||||||
InvalidateRect(hToolSettings, NULL, TRUE);
|
InvalidateRect(hToolSettings, NULL, TRUE);
|
||||||
ShowWindow(hTrackbarZoom, (tool == TOOL_ZOOM) ? SW_SHOW : SW_HIDE);
|
ShowWindow(hTrackbarZoom, (tool == TOOL_ZOOM) ? SW_SHOW : SW_HIDE);
|
||||||
|
ShowWindow(hwndTextEdit, (tool == TOOL_TEXT) ? SW_SHOW : SW_HIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -299,17 +300,21 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
EnableMenuItem(menu, IDM_EDITPASTE, ENABLED_IF(GetClipboardData(CF_BITMAP) != NULL));
|
EnableMenuItem(menu, IDM_EDITPASTE, ENABLED_IF(GetClipboardData(CF_BITMAP) != NULL));
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
break;
|
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 */
|
case 3: /* Image menu */
|
||||||
EnableMenuItem(menu, IDM_IMAGECROP, ENABLED_IF(IsWindowVisible(hSelection)));
|
EnableMenuItem(menu, IDM_IMAGECROP, ENABLED_IF(IsWindowVisible(hSelection)));
|
||||||
CheckMenuItem(menu, IDM_IMAGEDRAWOPAQUE, CHECKED_IF(transpBg == 0));
|
CheckMenuItem(menu, IDM_IMAGEDRAWOPAQUE, CHECKED_IF(transpBg == 0));
|
||||||
break;
|
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_VIEWZOOM125, CHECKED_IF(zoom == 125));
|
||||||
CheckMenuItem(menu, IDM_VIEWZOOM25, CHECKED_IF(zoom == 250));
|
CheckMenuItem(menu, IDM_VIEWZOOM25, CHECKED_IF(zoom == 250));
|
||||||
|
@ -1031,6 +1036,8 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
ShowWindow(hStatusBar, IsWindowVisible(hStatusBar) ? SW_HIDE : SW_SHOW);
|
ShowWindow(hStatusBar, IsWindowVisible(hStatusBar) ? SW_HIDE : SW_SHOW);
|
||||||
alignChildrenToMainWindow();
|
alignChildrenToMainWindow();
|
||||||
break;
|
break;
|
||||||
|
case IDM_FORMATICONBAR:
|
||||||
|
ShowWindow(hwndTextEdit, IsWindowVisible(hwndTextEdit) ? SW_HIDE : SW_SHOW);
|
||||||
|
|
||||||
case IDM_VIEWSHOWGRID:
|
case IDM_VIEWSHOWGRID:
|
||||||
showGrid = !showGrid;
|
showGrid = !showGrid;
|
||||||
|
|
Loading…
Reference in a new issue