Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv22303
Modified Files:
ShuttleGui.cpp ShuttleGui.h
Log Message:
Layout 'effects' OK/Cancel buttons consistently on all platforms (I hope!).
ShuttleGUI changes by Leland.
Index: ShuttleGui.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/ShuttleGui.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- ShuttleGui.h 4 Jul 2007 10:16:41 -0000 1.21
+++ ShuttleGui.h 29 Jul 2007 11:02:33 -0000 1.22
@@ -278,6 +278,26 @@
struct ViewInfo;
#include <wx/scrolbar.h> // to get wxSB_HORIZONTAL
+// CreateStdButtonSizer defs...should probably move to widgets subdir
+enum
+{
+ eOkButton = 0x0001,
+ eCancelButton = 0x0002,
+ eYesButton = 0x0004,
+ eNoButton = 0x0008,
+ eHelpButton = 0x0010,
+ ePreviewButton = 0x0020,
+ eDebugButton = 0x0040
+};
+
+enum
+{
+ ePreviewID = wxID_LOWEST - 1,
+ eDebugID = wxID_LOWEST - 2
+};
+
+wxSizer *CreateStdButtonSizer( wxWindow *parent, long buttons );
+
// ShuttleGui extends ShuttleGuiBase with Audacity specific extensions.
class ShuttleGui : public ShuttleGuiBase
{
@@ -291,6 +311,6 @@
AdornedRulerPanel * AddAdornedRuler( ViewInfo *pViewInfo );
RulerPanel * AddRulerVertical( float low, float hi, const wxString & Units
);
AttachableScrollBar * AddAttachableScrollBar( long style = wxSB_HORIZONTAL
);
+ void AddStandardButtons( long buttons = eOkButton | eCancelButton );
};
-
#endif
Index: ShuttleGui.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/ShuttleGui.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- ShuttleGui.cpp 4 Jul 2007 10:16:40 -0000 1.30
+++ ShuttleGui.cpp 29 Jul 2007 11:02:33 -0000 1.31
@@ -1798,3 +1798,90 @@
UpdateSizers();
return pAttachableScrollBar;
}
+
+wxSizer *CreateStdButtonSizer(wxWindow *parent, long buttons)
+{
+ wxButton *b = new wxButton( parent, 0, wxEmptyString );
+ int margin;
+
+#if defined(__WXMAC__)
+ margin = 12;
+#elif defined(__WXGTK20__)
+ margin = 12;
+#elif defined(__WXMSW__)
+ margin = b->ConvertDialogToPixels( wxSize( 2, 0 ) ).x;
+#else
+ margin = b->ConvertDialogToPixels( wxSize( 4, 0 ) ).x;
+#endif
+
+ delete b;
+
+ wxStdDialogButtonSizer *bs = new wxStdDialogButtonSizer();
+
+ if( buttons & eOkButton )
+ {
+ b = new wxButton( parent, wxID_OK );
+ b->SetDefault();
+ bs->AddButton( b );
+ }
+
+ if( buttons & eCancelButton )
+ {
+ bs->AddButton( new wxButton( parent, wxID_CANCEL ) );
+ }
+
+ if( buttons & eYesButton )
+ {
+ b = new wxButton( parent, wxID_YES );
+ b->SetDefault();
+ bs->AddButton( b );
+ }
+
+ if( buttons & eNoButton )
+ {
+ bs->AddButton( new wxButton( parent, wxID_NO ) );
+ }
+
+ if( buttons & eHelpButton )
+ {
+ bs->AddButton( new wxButton( parent, wxID_HELP ) );
+ }
+
+ if( buttons & ePreviewButton )
+ {
+ b = new wxButton( parent, ePreviewID, _("Pre&view") );
+ bs->Add( b, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, margin );
+ bs->Add(40,0);
+ }
+
+ if( buttons & eDebugButton )
+ {
+ b = new wxButton( parent, eDebugID, _("&Debug") );
+ bs->Add( b, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, margin );
+ bs->Add(40,0);
+ }
+
+ bs->AddStretchSpacer();
+ bs->Realize();
+ wxSizer * s;
+ s = new wxBoxSizer( wxVERTICAL );
+ s->Add(bs, 1, wxEXPAND | wxALL, 7);
+ s->Add(0, 3); // a little extra space
+
+ return s;
+}
+
+void ShuttleGui::AddStandardButtons(long buttons)
+{
+ if( mShuttleMode != eIsCreating )
+ return;
+
+ StartVerticalLay(false);
+
+ miSizerProp = false;
+ mpSubSizer = CreateStdButtonSizer( mpParent, buttons );
+ UpdateSizers();
+ PopSizer();
+
+ EndVerticalLay();
+}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs