Author: bfreisen
Date: Mon Jul 13 14:46:41 2015
New Revision: 68398
URL:
http://svn.reactos.org/svn/reactos?rev=68398&view=rev
Log:
[MSPAINT_NEW]
Pasting a larger-than-current-canvas image now DOES resize the canvas.
(adapted from a patch by Gian Sass)
CORE-9674 #resolve #comment Fixed in r68398
Modified:
trunk/reactos/base/applications/mspaint_new/definitions.h
trunk/reactos/base/applications/mspaint_new/globalvar.h
trunk/reactos/base/applications/mspaint_new/lang/de-DE.rc
trunk/reactos/base/applications/mspaint_new/lang/en-GB.rc
trunk/reactos/base/applications/mspaint_new/lang/en-US.rc
trunk/reactos/base/applications/mspaint_new/main.cpp
trunk/reactos/base/applications/mspaint_new/winproc.cpp
Modified: trunk/reactos/base/applications/mspaint_new/definitions.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint_…
==============================================================================
--- trunk/reactos/base/applications/mspaint_new/definitions.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint_new/definitions.h [iso-8859-1] Mon Jul 13
14:46:41 2015
@@ -220,6 +220,7 @@
#define IDS_ANGLE 932
#define IDS_LOADERRORTEXT 933
+#define IDS_ENLARGEPROMPTTEXT 934
#define WM_TOOLSMODELTOOLCHANGED WM_APP
#define WM_TOOLSMODELSETTINGSCHANGED (WM_APP + 1)
Modified: trunk/reactos/base/applications/mspaint_new/globalvar.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint_…
==============================================================================
--- trunk/reactos/base/applications/mspaint_new/globalvar.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint_new/globalvar.h [iso-8859-1] Mon Jul 13
14:46:41 2015
@@ -31,6 +31,7 @@
class ImageModel;
extern ImageModel imageModel;
+extern BOOL askBeforeEnlarging;
extern POINT start;
extern POINT last;
Modified: trunk/reactos/base/applications/mspaint_new/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint_…
==============================================================================
--- trunk/reactos/base/applications/mspaint_new/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint_new/lang/de-DE.rc [iso-8859-1] Mon Jul 13
14:46:41 2015
@@ -214,4 +214,5 @@
IDS_PERCENTAGE "Der Prozentsatz muss zwischen 1 und 500 liegen."
IDS_ANGLE "Der Winkel muss zwischen -89 und 89 liegen."
IDS_LOADERRORTEXT "Die Datei %s konnte nicht geladen werden."
-END
+ IDS_ENLARGEPROMPTTEXT "Das Bild in der Zwischenablage ist gröÃer als die
Bitmap.\nSoll die Bitmap vergröÃert werden?"
+END
Modified: trunk/reactos/base/applications/mspaint_new/lang/en-GB.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint_…
==============================================================================
--- trunk/reactos/base/applications/mspaint_new/lang/en-GB.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint_new/lang/en-GB.rc [iso-8859-1] Mon Jul 13
14:46:41 2015
@@ -214,4 +214,5 @@
IDS_PERCENTAGE "The percentage must be between 1 and 500."
IDS_ANGLE "The angle must be between -89 and 89."
IDS_LOADERRORTEXT "The file %s could not be loaded."
-END
+ IDS_ENLARGEPROMPTTEXT "The image in the clipboard is larger than the
bitmap.\nWould you like the bitmap enlarged?"
+END
Modified: trunk/reactos/base/applications/mspaint_new/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint_…
==============================================================================
--- trunk/reactos/base/applications/mspaint_new/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint_new/lang/en-US.rc [iso-8859-1] Mon Jul 13
14:46:41 2015
@@ -214,4 +214,5 @@
IDS_PERCENTAGE "The percentage must be between 1 and 500."
IDS_ANGLE "The angle must be between -89 and 89."
IDS_LOADERRORTEXT "The file %s could not be loaded."
-END
+ IDS_ENLARGEPROMPTTEXT "The image in the clipboard is larger than the
bitmap.\nWould you like the bitmap enlarged?"
+END
Modified: trunk/reactos/base/applications/mspaint_new/main.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint_…
==============================================================================
--- trunk/reactos/base/applications/mspaint_new/main.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint_new/main.cpp [iso-8859-1] Mon Jul 13 14:46:41
2015
@@ -24,6 +24,7 @@
STRETCHSKEW stretchSkew;
ImageModel imageModel;
+BOOL askBeforeEnlarging = FALSE; // TODO: initialize from registry
POINT start;
POINT last;
Modified: trunk/reactos/base/applications/mspaint_new/winproc.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint_…
==============================================================================
--- trunk/reactos/base/applications/mspaint_new/winproc.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint_new/winproc.cpp [iso-8859-1] Mon Jul 13
14:46:41 2015
@@ -107,6 +107,47 @@
void CMainWindow::InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window)
{
+ int width = GetDIBWidth(bitmap);
+ int height = GetDIBHeight(bitmap);
+ int curWidth = imageModel.GetWidth();
+ int curHeight = imageModel.GetHeight();
+
+ if (width > curWidth || height > curHeight)
+ {
+ BOOL shouldEnlarge = TRUE;
+
+ if (askBeforeEnlarging)
+ {
+ TCHAR programname[20];
+ TCHAR shouldEnlargePromptText[100];
+
+ LoadString(hProgInstance, IDS_PROGRAMNAME, programname,
SIZEOF(programname));
+ LoadString(hProgInstance, IDS_ENLARGEPROMPTTEXT, shouldEnlargePromptText,
SIZEOF(shouldEnlargePromptText));
+
+ switch (MessageBox(shouldEnlargePromptText, programname, MB_YESNOCANCEL |
MB_ICONQUESTION))
+ {
+ case IDYES:
+ break;
+ case IDNO:
+ shouldEnlarge = FALSE;
+ break;
+ case IDCANCEL:
+ return;
+ }
+ }
+
+ if (shouldEnlarge)
+ {
+ if (width > curWidth)
+ curWidth = width;
+
+ if (height > curHeight)
+ curHeight = height;
+
+ imageModel.Crop(curWidth, curHeight, 0, 0);
+ }
+ }
+
HWND hToolbar = FindWindowEx(toolBoxContainer.m_hWnd, NULL, TOOLBARCLASSNAME, NULL);
SendMessage(hToolbar, TB_CHECKBUTTON, ID_RECTSEL, MAKELPARAM(TRUE, 0));
toolBoxContainer.SendMessage(WM_COMMAND, ID_RECTSEL);