]> git.saurik.com Git - wxWidgets.git/commitdiff
added screenshot capturing for debugging purposes
authorVáclav Slavík <vslavik@fastmail.fm>
Thu, 18 Oct 2001 22:51:05 +0000 (22:51 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Thu, 18 Oct 2001 22:51:05 +0000 (22:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12078 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mgl/window.cpp

index b79394efbc7489b4df5257f3c65c8a8cc1cd3a7a..dac506d5186ae21523d726edc4ca99391bd0fa6d 100644 (file)
@@ -173,6 +173,21 @@ static wxWindowMGL* wxGetTopLevelParent(wxWindowMGL *win)
     return p;
 }
 
+#ifdef __WXDEBUG__
+// Add an easy way to capture screenshots:
+static void CaptureScreenshot()
+{
+    wxBusyCursor bcur;
+    
+    static int screenshot_num = 0;
+    char screenshot[128];
+    sprintf(screenshot, "screenshot-%03i.png", screenshot_num++);
+    g_displayDC->savePNGFromDC(screenshot, 0, 0, 
+                               g_displayDC->sizex(), 
+                               g_displayDC->sizey());
+}
+#endif
+
 // ---------------------------------------------------------------------------
 // MGL_WM hooks:
 // ---------------------------------------------------------------------------
@@ -467,6 +482,14 @@ static ibool wxWindowKeybHandler(window_t *wnd, event_t *e)
     
         ret = win->GetEventHandler()->ProcessEvent(event);
 
+
+#ifdef __WXDEBUG__
+        // Add an easy way to capture screenshots:
+        if ( event.m_keyCode == WXK_F1 && 
+             event.m_shiftDown && event.m_controlDown )
+            CaptureScreenshot();
+#endif
+
 #if wxUSE_ACCEL
         if ( !ret )
         {