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

Modified Files:
        ExportMultiple.cpp ExportMultiple.h 
Log Message:
Apply patch from Vidyashankar Vellal for Export Multiple success dialog on 
Windows:   
* lets it be dismissed by ENTER
* matches list background colour with remainder of dialogue

Index: ExportMultiple.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/export/ExportMultiple.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- ExportMultiple.h    23 May 2009 14:50:30 -0000      1.15
+++ ExportMultiple.h    10 Oct 2009 07:58:50 -0000      1.16
@@ -14,6 +14,7 @@
 #include <wx/dialog.h>
 #include <wx/string.h>
 #include <wx/dynarray.h>   // sadly we are using wx dynamic arrays
+#include <wx/listctrl.h>
 
 #include "Export.h"
 #include "../Track.h"
@@ -166,6 +167,26 @@
       
 };
 
+class SuccessDialog : public wxDialog
+{
+public:
+   SuccessDialog(wxWindow *parent, wxWindowID id, const wxString &title) : 
+      wxDialog(parent, id, title) {};
+   void OnKeyDown(wxListEvent& event); // dismisses dialog when <enter> is 
pressed with list control having focus
+   void OnItemActivated(wxListEvent& event); // dismisses dialog when <enter> 
is pressed with list item having focus
+private:
+   DECLARE_EVENT_TABLE()
+};
+
+class MouseEvtHandler : public wxEvtHandler
+{
+public:
+   void OnMouse(wxMouseEvent& event);
+private:
+   DECLARE_EVENT_TABLE()
+};
+
+
 /** \brief A private class used to store the information needed to do an
     * export.
     *

Index: ExportMultiple.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/export/ExportMultiple.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- ExportMultiple.cpp  30 Jun 2009 21:13:48 -0000      1.55
+++ ExportMultiple.cpp  10 Oct 2009 07:58:50 -0000      1.56
@@ -89,6 +89,15 @@
    EVT_TEXT(PrefixID, ExportMultiple::OnPrefix)
 END_EVENT_TABLE()
 
+BEGIN_EVENT_TABLE(SuccessDialog, wxDialog)
+   EVT_LIST_KEY_DOWN(wxID_ANY, SuccessDialog::OnKeyDown)
+   EVT_LIST_ITEM_ACTIVATED(wxID_ANY, SuccessDialog::OnItemActivated) // 
happens when <enter> is pressed with list item having focus
+END_EVENT_TABLE()
+
+BEGIN_EVENT_TABLE(MouseEvtHandler, wxEvtHandler)
+   EVT_LEFT_DCLICK(MouseEvtHandler::OnMouse)
+END_EVENT_TABLE()
+
 ExportMultiple::ExportMultiple(AudacityProject *project)
 : wxDialog(project, wxID_ANY, wxString(_("Export Multiple")))
 {
@@ -530,7 +539,7 @@
                )
              ), mExported.GetCount());
 
-      wxDialog dlg(this,
+      SuccessDialog dlg(this,
                    wxID_ANY,
                    wxString(_("ExportMultiple")));
       ShuttleGui S(&dlg, eIsCreating);
@@ -539,11 +548,17 @@
          S.AddTitle(msg);
          S.SetStyle(wxLC_LIST | wxLC_SINGLE_SEL | wxLC_HRULES | 
wxSUNKEN_BORDER);
          wxListCtrl *l = S.AddListControl();
+         l->SetBackgroundColour(dlg.GetBackgroundColour());
          for (size_t i = 0; i < mExported.GetCount(); i++) {
             l->InsertItem(i, mExported[i]);
          }
          
          S.AddStandardButtons(eOkButton);
+         l->SetFocus();
+
+         // this handles double-click and prevents item activation when a 
list-item is double-clicked
+         MouseEvtHandler *mouseHdlr = new MouseEvtHandler();
+         l->PushEventHandler(mouseHdlr);
       }
       dlg.Fit();
       dlg.Center();
@@ -938,6 +953,23 @@
    }  // phew - end of file name sanitisation procedure
    return newname;
 }
+void SuccessDialog::OnKeyDown(wxListEvent& event)
+{
+   if (event.GetKeyCode() == WXK_RETURN)
+      EndModal(1);
+   else
+      event.Skip(); // allow standard behaviour
+}
+
+void SuccessDialog::OnItemActivated(wxListEvent& event)
+{
+   EndModal(1);
+}
+
+void MouseEvtHandler::OnMouse(wxMouseEvent& event)
+{
+   event.Skip(false);
+}
 
 // Indentation settings for Vim and Emacs and unique identifier for Arch, a
 // version control system. Please do not modify past this point.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to