mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +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
|
||||
selection.c
|
||||
sizebox.c
|
||||
textedit.c
|
||||
toolsettings.c
|
||||
winproc.c
|
||||
precomp.h)
|
||||
|
|
|
@ -54,6 +54,8 @@ extern HWND hSelection;
|
|||
extern HWND hImageArea;
|
||||
extern HBITMAP hSelBm;
|
||||
extern HBITMAP hSelMask;
|
||||
extern HWND hwndTextEdit;
|
||||
extern HWND hwndEditCtl;
|
||||
extern LOGFONT lfTextFont;
|
||||
extern HFONT hfontTextFont;
|
||||
extern LPTSTR textToolText;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "toolsettings.h"
|
||||
#include "selection.h"
|
||||
#include "sizebox.h"
|
||||
#include "textedit.h"
|
||||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
|
@ -54,9 +55,10 @@ HBITMAP hSelBm;
|
|||
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 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument
|
|||
WNDCLASSEX wclPal;
|
||||
WNDCLASSEX wclSettings;
|
||||
WNDCLASSEX wclSelection;
|
||||
WNDCLASSEX wclTextEdit;
|
||||
|
||||
TCHAR progtitle[1000];
|
||||
TCHAR resstr[100];
|
||||
|
@ -282,6 +285,21 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument
|
|||
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 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument
|
|||
/* 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);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ selectTool(int tool)
|
|||
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 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
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 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue