Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv9701/src
Modified Files:
Experimental.h ShuttleGui.cpp ShuttleGui.h WaveTrack.cpp
Log Message:
-Improvements to backgrounds when theming
Index: WaveTrack.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/WaveTrack.cpp,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- WaveTrack.cpp 3 Jul 2007 08:40:38 -0000 1.104
+++ WaveTrack.cpp 4 Jul 2007 10:16:41 -0000 1.105
@@ -422,6 +422,10 @@
//printf("paste: entering WaveTrack::Paste\n");
+ // JKC Added...
+ if( src == NULL )
+ return false;
+
if (src->GetKind() != Track::Wave)
return false;
Index: Experimental.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Experimental.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Experimental.h 21 Jun 2007 13:36:06 -0000 1.8
+++ Experimental.h 4 Jul 2007 10:16:40 -0000 1.9
@@ -30,9 +30,15 @@
//Uncomment the next #define to enable experimental features.
//#define EXPERIMENTAL_FEATURES
-//#define EXPERIMENTAL_MODULES
-//#define EXPERIMENTAL_THEME_PREFS
+// JKC July-2007: We're temporarily using EXPERIMENTAL_MODULES to
+// switch on all experimental features.
+#ifdef EXPERIMENTAL_MODULES
+#define EXPERIMENTAL_THEMING
+#define EXPERIMENTAL_THEME_PREFS
+#endif
+
//#define RIGHT_ALIGNED_TEXTBOXES
+//#define EXPERIMENTAL_VOICE_DETECTION
#ifdef EXPERIMENTAL_FEATURES
// The first experimental feature is a notebook that adds
Index: ShuttleGui.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/ShuttleGui.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- ShuttleGui.h 24 Jun 2007 23:19:14 -0000 1.20
+++ ShuttleGui.h 4 Jul 2007 10:16:41 -0000 1.21
@@ -45,12 +45,16 @@
class wxSlider;
class wxTreeListCtrl;
class wxNotebook;
+typedef wxWindow wxNotebookPage; // so far, any window can be a page
class wxButton;
class wxBitmapButton;
class wxRadioButton;
class wxBitmap;
class wxPanel;
class wxSizer;
+class wxStaticBox;
+class wxMenuBar;
+class wxMenu;
class Shuttle;
class WrappedType;
@@ -67,8 +71,9 @@
void AddPrompt(const wxString &Prompt);
void AddUnits(const wxString &Prompt);
void AddTitle(const wxString &Prompt);
- wxWindow * AddWindow(wxWindow * pWindow );
+ wxWindow * AddWindow(wxWindow * pWindow, int Flags = wxALIGN_CENTRE | wxALL
);
wxSlider * AddSlider(const wxString &Prompt, int pos, int Max, int Min = 0);
+ wxSlider * AddVSlider(const wxString &Prompt, int pos, int Max);
wxTreeCtrl * AddTree();
wxRadioButton * AddRadioButton( const wxString & Prompt );
wxRadioButton * AddRadioButtonToGroup( const wxString & Prompt);
@@ -83,6 +88,8 @@
wxCheckBox * AddCheckBoxOnRight( const wxString &Prompt, const wxString
&Selected);
wxComboBox * AddCombo( const wxString &Prompt, const wxString
&Selected,const wxArrayString * pChoices );
wxChoice * AddChoice( const wxString &Prompt, const wxString &Selected,
const wxArrayString * pChoices );
+ wxMenuBar * AddMenuBar( );
+ wxMenu * AddMenu( const wxString & Title );
void AddIcon( wxBitmap * pBmp);
void AddIconButton( const wxString & Command, const wxString &
Params,wxBitmap * pBmp );
void AddFixedText( const wxString & Str, bool bCenter = false );
@@ -106,12 +113,13 @@
void StartThreeColumn(){StartMultiColumn(3);};
void EndThreeColumn(){EndMultiColumn();};
- void StartStatic( const wxString & Str, int iProp=0 );
+ wxStaticBox * StartStatic( const wxString & Str, int iProp=0 );
void EndStatic();
wxNotebook * StartNotebook();
void EndNotebook();
- void StartNotebookPage( const wxString Name );
+ wxNotebookPage * StartNotebookPage( const wxString Name );
+ void StartNotebookPage( const wxString Name, wxNotebookPage * pPage );
void EndNotebookPage();
wxPanel * StartInvisiblePanel();
void EndInvisiblePanel();
@@ -149,6 +157,8 @@
wxSlider * TieSlider( const wxString &Prompt, WrappedType & WrappedRef,
const int max, const int min = 0 );
wxSlider * TieSlider( const wxString &Prompt, int &pos, const int max,
const int min = 0);
+ wxSlider * TieSlider( const wxString &Prompt, float &pos, const float fMin,
const float fMax);
+ wxSlider * TieVSlider( const wxString &Prompt, float &pos, const float
fMin, const float fMax);
wxRadioButton * TieRadioButton( const wxString & Prompt, WrappedType
&WrappedRef);
wxRadioButton * TieRadioButton( const wxString &Prompt, const int iValue);
@@ -197,8 +207,14 @@
void SetStretchyCol( int i );
void SetStretchyRow( int i );
-protected:
+//--Some Additions since June 2007 that don't fit in elsewhere...
+ wxWindow * GetParent() {return mpParent;};
+ ShuttleGuiBase & Prop( int iProp );
+ int GetId() {return miIdNext;};
void UseUpId();
+
+protected:
+ void SetProportions( int Default );
void PushSizer();
void PopSizer();
@@ -238,11 +254,15 @@
int miId;
int miIdNext;
int miIdSetByUser;
+ // Proportion set by user rather than default.
+ int miPropSetByUser;
wxSizer * mpSubSizer;
wxSizer * mpSizer;
wxWindow * mpParent;
wxWindow * mpWind;
+ wxMenuBar * mpMenuBar;
+ wxMenu * mpMenu;
};
// A rarely used helper function that sets a pointer
@@ -266,6 +286,7 @@
~ShuttleGui(void);
public:
ShuttleGui & Id(int id );
+ ShuttleGui & Prop( int iProp ){ ShuttleGuiBase::Prop(iProp); return
*this;}; // Has to be here too, to return a ShuttleGui and not a ShuttleGuiBase.
GuiWaveTrack * AddGuiWaveTrack( const wxString & Name);
AdornedRulerPanel * AddAdornedRuler( ViewInfo *pViewInfo );
RulerPanel * AddRulerVertical( float low, float hi, const wxString & Units
);
Index: ShuttleGui.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/ShuttleGui.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- ShuttleGui.cpp 24 Jun 2007 23:19:14 -0000 1.29
+++ ShuttleGui.cpp 4 Jul 2007 10:16:40 -0000 1.30
@@ -106,12 +106,6 @@
#include "Shuttle.h"
#include "WrappedType.h"
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-
-
ShuttleGuiBase::ShuttleGuiBase(wxWindow * pParent, teShuttleMode ShuttleMode )
{
wxASSERT( (pParent != NULL ) || ( ShuttleMode != eIsCreating));
@@ -139,6 +133,7 @@
miBorder = 5;
miStyle = 0;
miProp=0;
+ miPropSetByUser=-1;
miSizerProp=0;
mSizerDepth=-1;
@@ -252,12 +247,13 @@
/// Very generic 'Add' function. We can add anything we like.
/// Useful for unique controls
-wxWindow * ShuttleGuiBase::AddWindow(wxWindow * pWindow )
+wxWindow * ShuttleGuiBase::AddWindow(wxWindow * pWindow, int Flags )
{
if( mShuttleMode != eIsCreating )
return pWindow;
mpWind = pWindow;
- UpdateSizersC();
+ SetProportions( 0 );
+ UpdateSizersCore(false, Flags);
return pWindow;
}
@@ -491,7 +487,7 @@
if( mShuttleMode != eIsCreating )
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxTextCtrl);
wxTextCtrl * pTextCtrl;
- miProp=1;
+ SetProportions( 1 );
mpWind = pTextCtrl = new wxTextCtrl(mpParent, miId, Value,
wxDefaultPosition, wxDefaultSize, Style( wxTE_MULTILINE ));
UpdateSizers();
@@ -520,7 +516,7 @@
if( mShuttleMode != eIsCreating )
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxListCtrl);
wxListCtrl * pListCtrl;
- miProp=1;
+ SetProportions( 1 );
mpWind = pListCtrl = new wxListCtrl(mpParent, miId,
wxDefaultPosition, wxDefaultSize, Style( wxLC_ICON ));
pListCtrl->SetMinSize( wxSize( 120,150 ));
@@ -534,7 +530,7 @@
if( mShuttleMode != eIsCreating )
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxListCtrl);
wxListCtrl * pListCtrl;
- miProp=1;
+ SetProportions( 1 );
mpWind = pListCtrl = new wxListCtrl(mpParent, miId,
wxDefaultPosition, wxSize(230,120),//wxDefaultSize,
Style( wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxSUNKEN_BORDER ));
@@ -549,7 +545,7 @@
if( mShuttleMode != eIsCreating )
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxTreeCtrl);
wxTreeCtrl * pTreeCtrl;
- miProp=1;
+ SetProportions( 1 );
mpWind = pTreeCtrl = new wxTreeCtrl(mpParent, miId, wxDefaultPosition,
wxDefaultSize,
Style( wxTR_HAS_BUTTONS ));
pTreeCtrl->SetMinSize( wxSize( 120,650 ));
@@ -570,23 +566,52 @@
UpdateSizersC();
}
+ShuttleGuiBase & ShuttleGuiBase::Prop( int iProp )
+{
+ miPropSetByUser = iProp;
+ return *this;
+}
+
+wxMenuBar * ShuttleGuiBase::AddMenuBar( )
+{
+ mpMenuBar = new wxMenuBar( );
+
+ wxFrame * pFrame = (wxFrame*)mpParent;
+ pFrame->SetThemeEnabled( true );
+ mpMenuBar->SetThemeEnabled( true );
+ pFrame->SetMenuBar(mpMenuBar);
+
+ return mpMenuBar;
+}
+
+wxMenu * ShuttleGuiBase::AddMenu( const wxString & Title )
+{
+ mpMenu = new wxMenu;
+ mpMenuBar->Append( mpMenu, Title );
+ return mpMenu;
+}
+
+
+
/// Starts a static box around a number of controls.
/// @param Str The text of the title for the box.
/// @param iProp The resizing proportion value.
/// Use iProp == 0 for a minimum sized static box.
/// Use iProp == 1 for a box that grows if there is space to spare.
-void ShuttleGuiBase::StartStatic(const wxString &Str, int iProp)
+wxStaticBox * ShuttleGuiBase::StartStatic(const wxString &Str, int iProp)
{
UseUpId();
mBoxName = Str;
if( mShuttleMode != eIsCreating )
- return;
+ return NULL;
+ wxStaticBox * pBox = new wxStaticBox(mpParent, miId,
+ Str );
mpSubSizer = new wxStaticBoxSizer(
- new wxStaticBox(mpParent, miId,
- Str ),
+ pBox,
wxVERTICAL );
miSizerProp = iProp;
UpdateSizers();
+ return pBox;
}
void ShuttleGuiBase::EndStatic()
@@ -617,10 +642,10 @@
mpWind->SetBackgroundColour(
iStyle==0
- ? wxColour( 190,200,230) :
+ ? wxColour( 245,244,240) :
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)
);
- miProp=1;
+ SetProportions( 1 );
if( iStyle==2 )
{
UpdateSizersAtStart();
@@ -699,7 +724,7 @@
wxNotebook * pNotebook;
mpWind = pNotebook = new wxNotebook(mpParent,
miId, wxDefaultPosition, wxDefaultSize, Style( 0 ));
- miProp=1;
+ SetProportions( 1 );
UpdateSizers();
mpParent = pNotebook;
return pNotebook;
@@ -712,10 +737,10 @@
}
-void ShuttleGuiBase::StartNotebookPage( const wxString Name )
+wxNotebookPage * ShuttleGuiBase::StartNotebookPage( const wxString Name )
{
if( mShuttleMode != eIsCreating )
- return;
+ return NULL;
// return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
wxNotebook * pNotebook = (wxNotebook*)mpParent;
wxNotebookPage * pPage = new wxPanel(mpParent );
@@ -724,7 +749,30 @@
Name);
PushSizer();
- miProp=1;
+ SetProportions( 1 );
+ mpParent = pPage;
+ mpSizer = new wxBoxSizer( wxVERTICAL );
+ mpSizer->SetMinSize(250,500);
+ pPage->SetSizer( mpSizer );
+// UpdateSizers();
+ return pPage;
+}
+
+void ShuttleGuiBase::StartNotebookPage( const wxString Name, wxNotebookPage *
pPage )
+{
+ if( mShuttleMode != eIsCreating )
+ return;
+// return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
+ wxNotebook * pNotebook = (wxNotebook*)mpParent;
+// wxNotebookPage * pPage = new wxPanel(mpParent );
+ pPage->Create( mpParent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL, wxT("panel"));
+
+ pNotebook->AddPage(
+ pPage,
+ Name);
+ PushSizer();
+
+ SetProportions( 1 );
mpParent = pPage;
mpSizer = new wxBoxSizer( wxVERTICAL );
mpSizer->SetMinSize(250,500);
@@ -756,7 +804,7 @@
};
~InvisiblePanel(){;};
void OnPaint( wxPaintEvent &event );
- void OnErase(wxEraseEvent &evt){;};
+ void OnErase(wxEraseEvent &/*evt*/){;};
DECLARE_EVENT_TABLE()
};
@@ -786,7 +834,7 @@
mpWind->SetBackgroundColour(
wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)
);
- miProp=1;
+ SetProportions( 1 );
miBorder=0;
UpdateSizers(); // adds window in to current sizer.
@@ -1159,6 +1207,27 @@
return TieSlider( Prompt, WrappedRef, max, min );
}
+wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, float &pos,
const float fMin, const float fMax)
+{
+ const float RoundFix=0.0000001f;
+ int iVal=(pos-fMin+RoundFix)*100.0/(fMax-fMin);
+ wxSlider * pWnd = TieSlider( Prompt, iVal, 100 );
+ pos = iVal*(fMax-fMin)*0.01+fMin;
+ return pWnd;
+}
+
+wxSlider * ShuttleGuiBase::TieVSlider( const wxString &Prompt, float &pos,
const float fMin, const float fMax)
+{
+ int iVal=(pos-fMin)*100.0/(fMax-fMin);
+// if( mShuttleMode == eIsCreating )
+// {
+// return AddVSlider( Prompt, iVal, 100 );
+// }
+ wxSlider * pWnd = TieSlider( Prompt, iVal, 100 );
+ pos = iVal*(fMax-fMin)*0.01+fMin;
+ return pWnd;
+}
+
wxChoice * ShuttleGuiBase::TieChoice(
const wxString &Prompt,
wxString &Selected,
@@ -1385,7 +1454,7 @@
{
wxChoice * pChoice=(wxChoice*)NULL;
- int TempIndex;
+ int TempIndex=0;
// int TempIndex = TranslateToIndex( Default, TranslatedChoices );
wxString TempStr = Default;
WrappedType WrappedRef( TempStr );
@@ -1405,7 +1474,7 @@
/// are integers, not Strings.
/// @param Prompt The prompt shown beside the control.
/// @param SettingName The setting name as stored in gPrefs
-/// @parsm Default The default value for this control (translated)
+/// @param Default The default value for this control (translated)
/// @param Choices An array of choices that appear on screen.
/// @param TranslatedChoices The correcponding values (as an integer array)
wxChoice * ShuttleGuiBase::TieChoice(
@@ -1495,6 +1564,18 @@
miId = miIdNext++;
}
+void ShuttleGuiBase::SetProportions( int Default )
+{
+ if( miPropSetByUser >=0 )
+ {
+ miProp = miPropSetByUser;
+ miPropSetByUser =-1;
+ return;
+ }
+ miProp = Default;
+}
+
+
void ShuttleGuiBase::UpdateSizersCore(bool bPrepend, int Flags)
{
if( mpWind && mpParent )
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs