diff options
author | Alexander Kuznetsov <kuzsasha@gmail.com> | 2012-03-16 21:37:45 +0400 |
---|---|---|
committer | Alexander Kuznetsov <kuzsasha@gmail.com> | 2012-03-16 21:37:45 +0400 |
commit | ed44ddd816d3bcd9be2e2097e1087dcdbf9b91e1 (patch) | |
tree | 357e958f56adb04aa07e20af827c8d0b6ba5532f /intern | |
parent | 2caa507b7eaa7d55a0be7bda513f08ecfe4791f1 (diff) |
Patch by Psy-Fi + my minor changes
Adds conformation on exit for windows. Needs to be enabled in user perf.
Tried to edit blender.exe.manifest for more modern dialog look, but didn't work out.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/GHOST_C-api.h | 8 | ||||
-rw-r--r-- | intern/ghost/GHOST_ISystem.h | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_C-api.cpp | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_System.cpp | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_System.h | 7 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.h | 8 |
7 files changed, 45 insertions, 2 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index a22b6bc371c..3add5ccb60a 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -842,6 +842,14 @@ extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection); */ extern int GHOST_toggleConsole(int action); + +/** + * Confirms quitting he program when there is just one window left open + * in the application + */ +extern int GHOST_confirmQuit(GHOST_WindowHandle windowhandle); + + #ifdef __cplusplus } #endif diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index eeee8c0477b..890917f9822 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -392,7 +392,11 @@ public: */ virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0; - + /** + * Confirms quitting he program when there is just one window left open + * in the application + */ + virtual int confirmQuit(GHOST_IWindow * window) const = 0; protected: /** * Initialize the system. diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index 6edfc4287ae..8442f82d886 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -865,3 +865,9 @@ int GHOST_toggleConsole(int action) GHOST_ISystem* system = GHOST_ISystem::getSystem(); return system->toggleConsole(action); } + + +int GHOST_confirmQuit(GHOST_WindowHandle windowhandle){ + GHOST_ISystem* system = GHOST_ISystem::getSystem(); + return system->confirmQuit((GHOST_IWindow*) windowhandle); +} diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp index 944ade3f22b..974f66c666a 100644 --- a/intern/ghost/intern/GHOST_System.cpp +++ b/intern/ghost/intern/GHOST_System.cpp @@ -366,3 +366,9 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window** window, const } return success; } + + +int GHOST_System::confirmQuit(GHOST_IWindow * window) const +{ + return 1; +} diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index de474fe07a5..15a7cf1fdd9 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -297,6 +297,13 @@ public: */ virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0; + /** + * Confirms quitting he program when there is just one window left open + * in the application + */ + virtual int confirmQuit(GHOST_IWindow * window) const; + + protected: /** diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index f4b39d01d9e..1ccca4bc6ba 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1356,3 +1356,9 @@ int GHOST_SystemWin32::toggleConsole(int action) return m_consoleStatus; } + +int GHOST_SystemWin32::confirmQuit(GHOST_IWindow * window) const +{ + return (MessageBox(window ? ((GHOST_WindowWin32*)window)->getHWND() : 0, "Some changes have not been saved.\nDo you really want to quit ?", + "Exit Blender", MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST) == IDOK); +}
\ No newline at end of file diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index 43387f68349..bc2044e549d 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -200,7 +200,13 @@ public: * @return Indication whether the event was handled. */ static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType,GHOST_IWindow* window, int mouseX, int mouseY, void* data); - + +/** + * Confirms quitting he program when there is just one window left open + * in the application + */ + virtual int confirmQuit(GHOST_IWindow * window) const; + protected: /** * Initializes the system. |