[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

svn path=/trunk/; revision=68398
This commit is contained in:
Benedikt Freisen 2015-07-13 14:46:41 +00:00
parent ef9c79d518
commit d9f3b5c508
7 changed files with 47 additions and 0 deletions

View file

@ -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)

View file

@ -31,6 +31,7 @@ extern STRETCHSKEW stretchSkew;
class ImageModel;
extern ImageModel imageModel;
extern BOOL askBeforeEnlarging;
extern POINT start;
extern POINT last;

View file

@ -214,4 +214,5 @@ BEGIN
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."
IDS_ENLARGEPROMPTTEXT "Das Bild in der Zwischenablage ist größer als die Bitmap.\nSoll die Bitmap vergrößert werden?"
END

View file

@ -214,4 +214,5 @@ BEGIN
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."
IDS_ENLARGEPROMPTTEXT "The image in the clipboard is larger than the bitmap.\nWould you like the bitmap enlarged?"
END

View file

@ -214,4 +214,5 @@ BEGIN
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."
IDS_ENLARGEPROMPTTEXT "The image in the clipboard is larger than the bitmap.\nWould you like the bitmap enlarged?"
END

View file

@ -24,6 +24,7 @@ int heightSetInDlg;
STRETCHSKEW stretchSkew;
ImageModel imageModel;
BOOL askBeforeEnlarging = FALSE; // TODO: initialize from registry
POINT start;
POINT last;

View file

@ -107,6 +107,47 @@ void CMainWindow::UpdateApplicationProperties(HBITMAP bitmap, LPTSTR newfilename
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);