From 2672b3a019a7c330c97d4a39031d528f7540573b Mon Sep 17 00:00:00 2001 From: mchinen Date: Sun, 23 Jan 2011 05:13:17 +0000 Subject: [PATCH] bug 11 followup: DeviceToolbar - fix mirroring issue when using reset toolbars menu item --- src/toolbars/DeviceToolBar.cpp | 20 +++++++++++++++++++- src/toolbars/DeviceToolBar.h | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/toolbars/DeviceToolBar.cpp b/src/toolbars/DeviceToolBar.cpp index fc9fde67c..fc551a02d 100644 --- a/src/toolbars/DeviceToolBar.cpp +++ b/src/toolbars/DeviceToolBar.cpp @@ -210,6 +210,21 @@ static void AddSources(int deviceIndex, int rate, wxArrayString *hosts, std::vec } } +void DeviceToolBar::DeinitChildren() +{ + mPlayBitmap = NULL; + mRecordBitmap = NULL; + mChannelsLabel = NULL; + + mInput = NULL; + mOutput = NULL; + mInputChannels = NULL; + mHost = NULL; + + mInputDeviceSourceMaps.clear(); + mOutputDeviceSourceMaps.clear(); +} + void DeviceToolBar::Populate() { int i; @@ -218,8 +233,9 @@ void DeviceToolBar::Populate() wxArrayString hosts; wxArrayString channels; - channels.Add(wxT("1 (Mono)")); + DeinitChildren(); + channels.Add(wxT("1 (Mono)")); int nDevices = Pa_GetDeviceCount(); //The heirarchy for devices is Host/device/source. @@ -463,6 +479,8 @@ bool DeviceToolBar::Layout() return ret; } + + //These don't add up to 1 because there is a bit of margin that we allow //the layout sizer to handle. #define kHostWidthRatio 0.13 diff --git a/src/toolbars/DeviceToolBar.h b/src/toolbars/DeviceToolBar.h index d4972dd34..e2fb04970 100644 --- a/src/toolbars/DeviceToolBar.h +++ b/src/toolbars/DeviceToolBar.h @@ -43,6 +43,7 @@ class DeviceToolBar:public ToolBar { void RecreateTipWindows(); void UpdatePrefs(); + void DeinitChildren(); virtual void Populate(); virtual void Repaint(wxDC *dc) {}; virtual void EnableDisableButtons(); @@ -52,6 +53,8 @@ class DeviceToolBar:public ToolBar { void OnChoice(wxCommandEvent & event); + /// When the prefs don't exist this value is used. + /// It should be small enough to work on tiny screens int GetInitialWidth() {return 600;} private: int ChangeHost();