1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-09 05:01:57 +01:00

Improve repainting after a theme change.

Now most things repaint properly after a theme change.  The sliders on the tracks don't yet.
This commit is contained in:
James Crook
2017-04-04 14:43:47 +01:00
parent 017990fac0
commit c17a7f535e
17 changed files with 27 additions and 36 deletions

View File

@@ -59,8 +59,6 @@ END_EVENT_TABLE()
DeviceToolBar::DeviceToolBar()
: ToolBar(DeviceBarID, _("Device"), wxT("Device"), true)
{
mPlayBitmap = NULL;
mRecordBitmap = NULL;
}
DeviceToolBar::~DeviceToolBar()
@@ -87,6 +85,7 @@ void DeviceToolBar::DeinitChildren()
void DeviceToolBar::Populate()
{
SetBackgroundColour( theTheme.Colour( clrMedium ) );
DeinitChildren();
// Hosts
mHost = safenew wxChoice(this,
@@ -97,19 +96,15 @@ void DeviceToolBar::Populate()
Add(mHost, 0, wxALIGN_CENTER);
// Input device
if( mRecordBitmap == NULL )
mRecordBitmap = std::make_unique<wxBitmap>(theTheme.Bitmap(bmpMic));
Add(safenew wxStaticBitmap(this,
wxID_ANY,
*mRecordBitmap), 0, wxALIGN_CENTER);
theTheme.Bitmap(bmpMic)), 0, wxALIGN_CENTER);
mInput = safenew wxChoice(this,
wxID_ANY,
wxDefaultPosition,
wxDefaultSize);
// Input channels
Add(mInput, 0, wxALIGN_CENTER);
mInputChannels = safenew wxChoice(this,
wxID_ANY,
wxDefaultPosition,
@@ -117,12 +112,9 @@ void DeviceToolBar::Populate()
Add(mInputChannels, 0, wxALIGN_CENTER);
// Output device
if( mPlayBitmap == NULL )
mPlayBitmap = std::make_unique<wxBitmap>(theTheme.Bitmap(bmpSpeaker));
Add(safenew wxStaticBitmap(this,
wxID_ANY,
*mPlayBitmap), 0, wxALIGN_CENTER);
theTheme.Bitmap(bmpSpeaker)), 0, wxALIGN_CENTER);
mOutput = safenew wxChoice(this,
wxID_ANY,
wxDefaultPosition,
@@ -473,8 +465,8 @@ void DeviceToolBar::RepositionCombos()
while (constrained && ratioUnused > 0.01f && i < 5) {
i++;
constrained = RepositionCombo(mHost, w, desiredHost, hostRatio, ratioUnused, 0, true);
constrained |= RepositionCombo(mInput, w, desiredInput, inputRatio, ratioUnused, mRecordBitmap->GetWidth(), true);
constrained |= RepositionCombo(mOutput, w, desiredOutput, outputRatio, ratioUnused, mPlayBitmap->GetWidth(), true);
constrained |= RepositionCombo(mInput, w, desiredInput, inputRatio, ratioUnused, theTheme.Bitmap(bmpMic).GetWidth(), true);
constrained |= RepositionCombo(mOutput, w, desiredOutput, outputRatio, ratioUnused, theTheme.Bitmap(bmpSpeaker).GetWidth(), true);
constrained |= RepositionCombo(mInputChannels, w, desiredChannels, channelsRatio, ratioUnused, 0, true);
}