Author: hbelusca
Date: Sat Mar  2 20:44:09 2013
New Revision: 58408

URL: http://svn.reactos.org/svn/reactos?rev=58408&view=rev
Log:
[PAINT]
- Fix the "grey panel" bug when doing File --> New.
- Add the possibility, when doing File --> New, to save the drawing the user 
did before actually reset it, and take into account whether he/she cancels the 
operation in the middle.
Patch by Marco Vaiano, slightly modified by me.

CORE-5642 #resolve #comment Committed in revision r58408. Thanks :)

Modified:
    trunk/reactos/base/applications/mspaint/winproc.c

Modified: trunk/reactos/base/applications/mspaint/winproc.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/winproc.c?rev=58408&r1=58407&r2=58408&view=diff
==============================================================================
--- trunk/reactos/base/applications/mspaint/winproc.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/winproc.c [iso-8859-1] Sat Mar  2 
20:44:09 2013
@@ -710,12 +710,38 @@
                     SendMessage(hwnd, WM_CLOSE, wParam, lParam);
                     break;
                 case IDM_FILENEW:
-                    ShowWindow(hSelection, SW_HIDE);
-                    clearHistory();
-
-                    Rectangle(hDrawingDC, 0 - 1, 0 - 1, imgXRes + 1, imgYRes + 
1);
-                    SendMessage(hImageArea, WM_PAINT, 0, 0);
-                    break;
+                {
+                    BOOL reset = TRUE;
+                    if (!imageSaved)
+                    {
+                        TCHAR programname[20];
+                        TCHAR saveprompttext[100];
+                        TCHAR temptext[500];
+                        LoadString(hProgInstance, IDS_PROGRAMNAME, 
programname, SIZEOF(programname));
+                        LoadString(hProgInstance, IDS_SAVEPROMPTTEXT, 
saveprompttext, SIZEOF(saveprompttext));
+                        _stprintf(temptext, saveprompttext, filename);
+                        switch (MessageBox(hwnd, temptext, programname, 
MB_YESNOCANCEL | MB_ICONQUESTION))
+                        {
+                            case IDNO:
+                                imageSaved = TRUE;
+                                break;
+                            case IDYES:
+                                SendMessage(hwnd, WM_COMMAND, IDM_FILESAVEAS, 
0);
+                                break;
+                            case IDCANCEL:
+                                reset = FALSE;
+                                break;
+                        }
+                    }
+                    if (reset && imageSaved)
+                    {
+                        Rectangle(hDrawingDC, 0 - 1, 0 - 1, imgXRes + 1, 
imgYRes + 1);
+                        SendMessage(hImageArea, WM_PAINT, 0, 0);
+                        updateCanvasAndScrollbars();
+                        clearHistory();
+                    }
+                    break;
+                }
                 case IDM_FILEOPEN:
                     if (GetOpenFileName(&ofn) != 0)
                     {


Reply via email to