Update of /cvsroot/audacity/audacity-src/src/widgets
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28147/src/widgets

Modified Files:
        ErrorDialog.cpp 
Log Message:
Fix to the browser frame to keep it from falling behind the help dialog and 
getting into a no response situation.  Original fix from Takashi Iwai via 
Michal Seben.

Index: ErrorDialog.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/ErrorDialog.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- ErrorDialog.cpp     28 Mar 2009 06:15:46 -0000      1.14
+++ ErrorDialog.cpp     29 May 2009 05:15:41 -0000      1.15
@@ -118,12 +118,43 @@
    EndModal(true);
 }
 
-void ShowHtmlText( wxWindow * pParent, const wxString &Title, const wxString 
&HtmlText, bool bIsFile = false )
+// Helper class to make browser "simulate" a modal dialog
+class HtmlTextHelpDialog : public BrowserFrame
+{
+public:
+   HtmlTextHelpDialog() : BrowserFrame()
+   {
+      MakeModal( true );
+   }
+   virtual ~HtmlTextHelpDialog()
+   {
+      MakeModal( false );
+      // On Windows, for some odd reason, the Audacity window will be sent to
+      // the back.  So, make sure that doesn't happen.
+      GetParent()->Raise();
+   }
+};
+
+void ShowHtmlText( wxWindow * pParent, const wxString &Title, const wxString 
&HtmlText, bool bIsFile = false, bool bModal = false )
 {
    LinkingHtmlWindow *html;
 
-   BrowserFrame * pWnd = new BrowserFrame();
-   pWnd->Create(pParent, wxID_ANY, Title, wxDefaultPosition, wxDefaultSize, 
wxDEFAULT_FRAME_STYLE);// & ~wxSYSTEM_MENU);
+   BrowserFrame * pWnd;
+   if( bModal )
+      pWnd = new HtmlTextHelpDialog();
+   else
+      pWnd = new BrowserFrame();
+
+   pWnd->Create(pParent, wxID_ANY, Title, wxDefaultPosition, wxDefaultSize,
+#if defined(__WXMAC__)
+      // On OSX, the html frame can go behind the help dialog and if the help
+      // html frame is modal, you can't get back to it.  Pressing escape gets
+      // you out of this, but it's just easier to add the wxSTAY_ON_TOP flag
+      // to prevent it from falling behind the dialog.  Not the perfect 
solution
+      // but acceptable in this case.
+      wxSTAY_ON_TOP |
+#endif
+      wxDEFAULT_FRAME_STYLE);
 
    ShuttleGui S( pWnd, eIsCreating );
 
@@ -195,7 +226,9 @@
       ShowHtmlText(
          this, 
          TitleText(dhelpURL.Mid( 10 ) ),
-         HelpText( dhelpURL.Mid( 10 )) );
+         HelpText( dhelpURL.Mid( 10 )),
+         false,
+         true );
       return;
    }
    OpenInDefaultBrowser( dhelpURL );


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to