mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-14 22:51:11 +02:00
Bug 11 followup: DeviceToolBar - fix initial size conditions when audacity.cfg is not present
This commit is contained in:
@@ -68,6 +68,10 @@ DeviceToolBar::~DeviceToolBar()
|
||||
void DeviceToolBar::Create(wxWindow *parent)
|
||||
{
|
||||
ToolBar::Create(parent);
|
||||
|
||||
// Simulate a size event to set initial meter placement/size
|
||||
wxSizeEvent dummy;
|
||||
OnSize(dummy);
|
||||
}
|
||||
|
||||
void DeviceToolBar::RecreateTipWindows()
|
||||
@@ -330,9 +334,7 @@ void DeviceToolBar::Populate()
|
||||
|
||||
FillHostDevices();
|
||||
FillInputChannels();
|
||||
Layout();
|
||||
}
|
||||
|
||||
void DeviceToolBar::OnFocus(wxFocusEvent &event)
|
||||
{
|
||||
wxCommandEvent e(EVT_CAPTURE_KEYBOARD);
|
||||
@@ -463,10 +465,10 @@ bool DeviceToolBar::Layout()
|
||||
|
||||
//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.14
|
||||
#define kHostWidthRatio 0.13
|
||||
#define kInputWidthRatio 0.32
|
||||
#define kOutputWidthRatio 0.32
|
||||
#define kChannelsWidthRatio 0.2
|
||||
#define kChannelsWidthRatio 0.19
|
||||
|
||||
void DeviceToolBar::RepositionCombos()
|
||||
{
|
||||
@@ -487,9 +489,10 @@ void DeviceToolBar::RepositionCombos()
|
||||
if (dockw < w)
|
||||
w = dockw;
|
||||
}
|
||||
|
||||
desiredHost = mHost->GetBestSize();
|
||||
if (desiredHost.x > w * kHostWidthRatio){
|
||||
desiredHost.SetWidth(w *kHostWidthRatio);
|
||||
desiredHost.SetWidth(w * kHostWidthRatio);
|
||||
}
|
||||
mHost->SetMinSize(desiredHost);
|
||||
mHost->SetMaxSize(desiredHost);
|
||||
@@ -517,10 +520,10 @@ void DeviceToolBar::RepositionCombos()
|
||||
if (chanLabel.x > w * kChannelsWidthRatio)
|
||||
chanLabel.SetWidth(w * kChannelsWidthRatio);
|
||||
chanLabel.x -= mInputChannels->GetBestSize().GetX();
|
||||
if (chanLabel.x > 0) {
|
||||
mChannelsLabel->SetMinSize(chanLabel);
|
||||
mChannelsLabel->SetMaxSize(chanLabel);
|
||||
}
|
||||
if (chanLabel.x < 0)
|
||||
chanLabel.x = 0;
|
||||
mChannelsLabel->SetMinSize(chanLabel);
|
||||
mChannelsLabel->SetMaxSize(chanLabel);
|
||||
|
||||
desiredChannels = mInputChannels->GetBestSize();
|
||||
desiredChannels.x += mChannelsLabel->GetSize().GetX();
|
||||
|
@@ -52,6 +52,7 @@ class DeviceToolBar:public ToolBar {
|
||||
|
||||
void OnChoice(wxCommandEvent & event);
|
||||
|
||||
int GetInitialWidth() {return 600;}
|
||||
private:
|
||||
int ChangeHost();
|
||||
void FillHostDevices();
|
||||
|
@@ -44,6 +44,8 @@ class MeterToolBar:public ToolBar {
|
||||
|
||||
virtual void OnSize(wxSizeEvent & event);
|
||||
|
||||
int GetInitialWidth() {return 160;}
|
||||
|
||||
private:
|
||||
void RegenerateTooltips();
|
||||
|
||||
|
@@ -267,7 +267,7 @@ void ToolBar::ReCreateButtons()
|
||||
SetInitialSize(sz);
|
||||
if(IsResizable())
|
||||
{// EM: allows narrow Meter Toolbar
|
||||
sz.SetWidth(160);
|
||||
sz.SetWidth(GetInitialWidth());
|
||||
SetMinSize(sz);
|
||||
}
|
||||
Layout();
|
||||
|
@@ -100,6 +100,8 @@ class ToolBar:public wxPanel
|
||||
bool IsVisible();
|
||||
bool IsDocked();
|
||||
|
||||
/// Resizable toolbars should implement this.
|
||||
virtual int GetInitialWidth() {return -1;}
|
||||
protected:
|
||||
|
||||
AButton *MakeButton(teBmps eUp,
|
||||
|
Reference in New Issue
Block a user