From a2cb195c762ed2a6dc0033db2b69bd5ee7d9e446 Mon Sep 17 00:00:00 2001 From: Benedikt Freisen Date: Mon, 10 Feb 2014 20:53:14 +0000 Subject: [PATCH] [MSPAINT] (forgot to add the files...) - Text tool allows text input (I chose a design with separate editor window) svn path=/trunk/; revision=62114 --- reactos/base/applications/mspaint/textedit.c | 49 ++++++++++++++++++++ reactos/base/applications/mspaint/textedit.h | 9 ++++ 2 files changed, 58 insertions(+) create mode 100644 reactos/base/applications/mspaint/textedit.c create mode 100644 reactos/base/applications/mspaint/textedit.h diff --git a/reactos/base/applications/mspaint/textedit.c b/reactos/base/applications/mspaint/textedit.c new file mode 100644 index 00000000000..253d360cc9d --- /dev/null +++ b/reactos/base/applications/mspaint/textedit.c @@ -0,0 +1,49 @@ +/* + * PROJECT: PAINT for ReactOS + * LICENSE: LGPL + * FILE: base/applications/paint/textedit.c + * PURPOSE: Text editor and font chooser for the text tool + * PROGRAMMERS: Benedikt Freisen + */ + +/* INCLUDES *********************************************************/ + +#include "precomp.h" + +/* FUNCTIONS ********************************************************/ + +LRESULT CALLBACK +TextEditWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_SIZE: + { + RECT clientRect; + GetClientRect(hwnd, &clientRect); + MoveWindow(hwndEditCtl, clientRect.left, clientRect.top, RECT_WIDTH(clientRect), RECT_HEIGHT(clientRect), TRUE); + break; + } + case WM_CLOSE: + ShowWindow(hwnd, SW_HIDE); + break; + case WM_COMMAND: + switch(HIWORD(wParam)) + { + case EN_UPDATE: + { + HeapFree(GetProcessHeap(), 0, textToolText); + textToolTextMaxLen = GetWindowTextLength(hwndEditCtl) + 1; + textToolText = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, sizeof(TCHAR) * textToolTextMaxLen); + GetWindowText(hwndEditCtl, textToolText, textToolTextMaxLen); + ForceRefreshSelectionContents(); + break; + } + } + break; + default: + return DefWindowProc(hwnd, message, wParam, lParam); + } + + return 0; +} diff --git a/reactos/base/applications/mspaint/textedit.h b/reactos/base/applications/mspaint/textedit.h new file mode 100644 index 00000000000..03064e232a7 --- /dev/null +++ b/reactos/base/applications/mspaint/textedit.h @@ -0,0 +1,9 @@ +/* + * PROJECT: PAINT for ReactOS + * LICENSE: LGPL + * FILE: base/applications/paint/textedit.h + * PURPOSE: Text editor and font chooser for the text tool + * PROGRAMMERS: Benedikt Freisen + */ + +LRESULT CALLBACK TextEditWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);