1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00

Bug 2465 - Treble height Selection Toolbar

This commit is contained in:
yam 2020-06-07 01:15:39 -05:00
parent 1bce7c1979
commit 3b71d1fc1e
3 changed files with 54 additions and 19 deletions

View File

@ -1085,19 +1085,37 @@ bool AudacityApp::OnInit()
// Some GTK themes produce larger combo boxes that make them taller
// than our single toolbar height restriction. This will remove some
// of the extra space themes add.
//
// NOTE: It's important that the widgets are created with an initial
// size, otherwise this override will not work.
#if defined(__WXGTK3__) && defined(HAVE_GTK)
// LLL: I've been unsuccessful at overriding GTK3 styles :-(
GtkWidget *combo = gtk_combo_box_new();
GtkCssProvider *provider = gtk_css_provider_new();
gtk_css_provider_load_from_data(GTK_CSS_PROVIDER(provider),
".linked entry,\n"
".linked button,\n"
".linked combobox box.linked button,\n"
".horizontal.linked entry,\n"
".horizontal.linked button,\n"
".horizontal.linked combobox box.linked button,\n"
"combobox {\n"
" padding-top: 0px;\n"
" padding-bottom: 0px;\n"
" padding-left: 4px;\n"
" padding-right: 4px;\n"
" margin: 0px;\n"
" font-size: 95%;\n"
"}", -1, NULL);
gtk_style_context_add_provider_for_screen(gtk_widget_get_screen(combo),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref(provider);
g_object_unref(combo);
#elif defined(__WXGTK__) && defined(HAVE_GTK)
gtk_rc_parse_string("style \"audacity\" {\n"
" GtkButton::inner_border = { 0, 0, 0, 0 }\n"
" GtkEntry::inner_border = { 0, 0, 0, 0 }\n"
" xthickness = 4\n"
" ythickness = 0\n"
"}\n"
"widget_class \"*GtkCombo*\" style \"audacity\"");
#endif
// Don't use AUDACITY_NAME here.

View File

@ -167,6 +167,20 @@ void DeviceToolBar::Populate()
#endif
Add(mOutput, 30, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 1);
#if defined(__WXGTK3__)
// Nothing special
#elif defined(__WXGTK__)
// Scale the font to fit inside (hopefully)
wxFont font = mHost->GetFont();
font.Scale((double) toolbarSingle / mHost->GetSize().GetHeight());
// Set it
mHost->SetFont(font);
mInput->SetFont(font);
mInputChannels->SetFont(font);
mOutput->SetFont(font);
#endif
mHost->Bind(wxEVT_SET_FOCUS,
&DeviceToolBar::OnFocus,
this);
@ -410,10 +424,7 @@ void DeviceToolBar::FillHosts()
mHost->Enable(false);
}
// mHost->InvalidateBestSize();
mHost->SetMinSize(wxSize(50, wxDefaultCoord));
// mHost->SetMaxSize(wxDefaultSize);
// mHost->SetMaxSize(wxSize(mHost->GetBestSize().x, wxDefaultCoord));
}
void DeviceToolBar::FillHostDevices()
@ -479,10 +490,7 @@ void DeviceToolBar::FillHostDevices()
}
mInput->Enable(mInput->GetCount() ? true : false);
// mInput->InvalidateBestSize();
mInput->SetMinSize(wxSize(50, wxDefaultCoord));
// mInput->SetMaxSize(wxDefaultSize);
// mInput->SetMaxSize(wxSize(mInput->GetBestSize().x, wxDefaultCoord));
for (auto & device : outMaps) {
if (foundHostIndex == device.hostIndex) {
@ -497,10 +505,7 @@ void DeviceToolBar::FillHostDevices()
}
mOutput->Enable(mOutput->GetCount() ? true : false);
// mOutput->InvalidateBestSize();
mOutput->SetMinSize(wxSize(50, wxDefaultCoord));
// mOutput->SetMaxSize(wxDefaultSize);
// mOutput->SetMaxSize(wxSize(mOutput->GetBestSize().x, wxDefaultCoord));
// The setting of the Device is left up to OnChoice
}
@ -548,10 +553,7 @@ void DeviceToolBar::FillInputChannels()
}
mInputChannels->Enable(mInputChannels->GetCount() ? true : false);
// mInputChannels->InvalidateBestSize();
mInputChannels->SetMinSize(wxSize(50, wxDefaultCoord));
// mInputChannels->SetMaxSize(wxDefaultSize);
// mInputChannels->SetMaxSize(wxSize(mInputChannels->GetBestSize().x, wxDefaultCoord));
}
void DeviceToolBar::OnRescannedDevices( wxCommandEvent &event )

View File

@ -198,9 +198,9 @@ void SelectionBar::Populate()
// Top row (mostly labels)
wxColour clrText = theTheme.Colour( clrTrackPanelText );
wxColour clrText2 = *wxBLUE;
AddTitle( XO("Project Rate (Hz)"), mainSizer );
auStaticText *rateLabel = AddTitle( XO("Project Rate (Hz)"), mainSizer );
AddVLine( mainSizer );
AddTitle( XO("Snap-To"), mainSizer );
auStaticText *snapLabel = AddTitle( XO("Snap-To"), mainSizer );
AddVLine( mainSizer );
#ifdef TIME_IN_SELECT_TOOLBAR
AddTitle( XO("Audio Position"), mainSizer );
@ -319,6 +319,21 @@ void SelectionBar::Populate()
mainSizer->Add(hSizer.release(), 0, wxALIGN_TOP | wxRIGHT, 0);
}
#if defined(__WXGTK3__)
// Nothing special
#elif defined(__WXGTK__)
// Ensure the font fits inside (hopefully)
wxFont font = mChoice->GetFont();
font.Scale((double) toolbarSingle / mChoice->GetSize().GetHeight());
rateLabel->SetFont(font);
snapLabel->SetFont(font);
mChoice->SetFont(font);
mRateBox->SetFont(font);
mRateText->SetFont(font);
mSnapTo->SetFont(font);
#endif
// Make sure they are fully expanded to the longest item
mChoice->SetMinSize(wxSize(mChoice->GetBestSize().x, toolbarSingle));
mRateBox->SetMinSize(wxSize(mRateBox->GetBestSize().x, toolbarSingle));