Update of /cvsroot/audacity/audacity-src/src
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23296/src
Modified Files:
Screenshot.cpp
Log Message:
Fixes crash when window is minimized and if there is no project window on OSX.
Index: Screenshot.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Screenshot.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- Screenshot.cpp 7 Apr 2009 05:40:14 -0000 1.21
+++ Screenshot.cpp 7 Apr 2009 06:23:47 -0000 1.22
@@ -72,6 +72,9 @@
void CaptureToolbar(int type, wxString name);
void OnCloseWindow(wxCloseEvent & e);
+ void OnUIUpdate(wxUpdateUIEvent & e);
+
+ void OnDirChoose(wxCommandEvent & e);
void OnMainWindowSmall(wxCommandEvent & e);
void OnMainWindowLarge(wxCommandEvent & e);
@@ -108,8 +111,6 @@
void OnCaptureFirstTrack(wxCommandEvent & e);
void OnCaptureSecondTrack(wxCommandEvent & e);
- void OnDirChoose(wxCommandEvent & e);
-
wxCheckBox *mDelayCheckBox;
wxTextCtrl *mDirectoryTextBox;
wxToggleButton *mBlue;
@@ -234,6 +235,8 @@
BEGIN_EVENT_TABLE(ScreenFrame, wxFrame)
EVT_CLOSE(ScreenFrame::OnCloseWindow)
+ EVT_UPDATE_UI(IdCaptureFullScreen, ScreenFrame::OnUIUpdate)
+
EVT_BUTTON(IdMainWindowSmall, ScreenFrame::OnMainWindowSmall)
EVT_BUTTON(IdMainWindowLarge, ScreenFrame::OnMainWindowLarge)
EVT_TOGGLEBUTTON(IdToggleBackgroundBlue,
ScreenFrame::OnToggleBackgroundBlue)
@@ -270,7 +273,6 @@
EVT_BUTTON(IdCaptureSecondTrack, ScreenFrame::OnCaptureSecondTrack)
EVT_BUTTON(IdDirChoose, ScreenFrame::OnDirChoose)
-
END_EVENT_TABLE();
ScreenFrame::ScreenFrame(wxWindow * parent, wxWindowID id)
@@ -278,6 +280,8 @@
wxDefaultPosition, wxDefaultSize,
#if !defined(__WXMSW__)
wxFRAME_TOOL_WINDOW|
+#else
+ wxSTAY_ON_TOP|
#endif
wxSYSTEM_MENU|wxCAPTION|wxCLOSE_BOX)
{
@@ -556,7 +560,7 @@
r.Intersect(wxRect(0, 0, screenW, screenH));
// Convert to screen coordinates if needed
- if (window->GetParent() && !window->IsTopLevel()) {
+ if (window && window->GetParent() && !window->IsTopLevel()) {
r.SetPosition(window->GetParent()->ClientToScreen(r.GetPosition()));
}
@@ -626,6 +630,31 @@
Destroy();
}
+void ScreenFrame::OnUIUpdate(wxUpdateUIEvent & e)
+{
+ wxTopLevelWindow *top = GetFrontWindow();
+ bool needupdate = false;
+ bool enable = false;
+
+ if ((!top || top->IsIconized()) && mDirectoryTextBox->IsEnabled()) {
+ needupdate = true;
+ enable = false;
+ }
+ else if ((top && !top->IsIconized()) && !mDirectoryTextBox->IsEnabled()) {
+ needupdate = true;
+ enable = true;
+ }
+
+ if (needupdate) {
+ for (int i = IdMainWindowSmall; i < IdLastDelayedEvent; i++) {
+ wxWindow *w = wxWindow::FindWindowById(i, this);
+ if (w) {
+ w->Enable(enable);
+ }
+ }
+ }
+}
+
void ScreenFrame::OnDirChoose(wxCommandEvent & e)
{
wxString current = mDirectoryTextBox->GetValue();
@@ -682,6 +711,10 @@
void ScreenFrame::OnCaptureWindowContents(wxCommandEvent & e)
{
wxTopLevelWindow *w = GetFrontWindow();
+ if (!w) {
+ return;
+ }
+
int x = 0, y = 0;
int width, height;
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs