mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-23 07:29:46 +02: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:
parent
017990fac0
commit
c17a7f535e
@ -245,6 +245,7 @@ void Theme::ApplyUpdatedImages()
|
|||||||
{
|
{
|
||||||
AColor::ReInit();
|
AColor::ReInit();
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = GetActiveProject();
|
||||||
|
p->SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
p->ResetColours();
|
p->ResetColours();
|
||||||
for( int ii = 0; ii < ToolBarCount; ++ii )
|
for( int ii = 0; ii < ToolBarCount; ++ii )
|
||||||
{
|
{
|
||||||
|
@ -3203,6 +3203,7 @@ void TrackArtist::UpdatePrefs()
|
|||||||
{
|
{
|
||||||
mdBrange = gPrefs->Read(ENV_DB_KEY, mdBrange);
|
mdBrange = gPrefs->Read(ENV_DB_KEY, mdBrange);
|
||||||
mShowClipping = gPrefs->Read(wxT("/GUI/ShowClipping"), mShowClipping);
|
mShowClipping = gPrefs->Read(wxT("/GUI/ShowClipping"), mShowClipping);
|
||||||
|
SetColours();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draws the sync-lock bitmap, tiled; always draws stationary relative to the DC
|
// Draws the sync-lock bitmap, tiled; always draws stationary relative to the DC
|
||||||
|
@ -165,6 +165,7 @@ void ControlToolBar::MakeAlternateImages(AButton &button, int idx,
|
|||||||
|
|
||||||
void ControlToolBar::Populate()
|
void ControlToolBar::Populate()
|
||||||
{
|
{
|
||||||
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
MakeButtonBackgroundsLarge();
|
MakeButtonBackgroundsLarge();
|
||||||
|
|
||||||
mPause = MakeButton(bmpPause, bmpPause, bmpPauseDisabled,
|
mPause = MakeButton(bmpPause, bmpPause, bmpPauseDisabled,
|
||||||
|
@ -59,8 +59,6 @@ END_EVENT_TABLE()
|
|||||||
DeviceToolBar::DeviceToolBar()
|
DeviceToolBar::DeviceToolBar()
|
||||||
: ToolBar(DeviceBarID, _("Device"), wxT("Device"), true)
|
: ToolBar(DeviceBarID, _("Device"), wxT("Device"), true)
|
||||||
{
|
{
|
||||||
mPlayBitmap = NULL;
|
|
||||||
mRecordBitmap = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceToolBar::~DeviceToolBar()
|
DeviceToolBar::~DeviceToolBar()
|
||||||
@ -87,6 +85,7 @@ void DeviceToolBar::DeinitChildren()
|
|||||||
|
|
||||||
void DeviceToolBar::Populate()
|
void DeviceToolBar::Populate()
|
||||||
{
|
{
|
||||||
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
DeinitChildren();
|
DeinitChildren();
|
||||||
// Hosts
|
// Hosts
|
||||||
mHost = safenew wxChoice(this,
|
mHost = safenew wxChoice(this,
|
||||||
@ -97,19 +96,15 @@ void DeviceToolBar::Populate()
|
|||||||
Add(mHost, 0, wxALIGN_CENTER);
|
Add(mHost, 0, wxALIGN_CENTER);
|
||||||
|
|
||||||
// Input device
|
// Input device
|
||||||
if( mRecordBitmap == NULL )
|
|
||||||
mRecordBitmap = std::make_unique<wxBitmap>(theTheme.Bitmap(bmpMic));
|
|
||||||
|
|
||||||
Add(safenew wxStaticBitmap(this,
|
Add(safenew wxStaticBitmap(this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
*mRecordBitmap), 0, wxALIGN_CENTER);
|
theTheme.Bitmap(bmpMic)), 0, wxALIGN_CENTER);
|
||||||
|
|
||||||
mInput = safenew wxChoice(this,
|
mInput = safenew wxChoice(this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
wxDefaultPosition,
|
wxDefaultPosition,
|
||||||
wxDefaultSize);
|
wxDefaultSize);
|
||||||
|
// Input channels
|
||||||
Add(mInput, 0, wxALIGN_CENTER);
|
Add(mInput, 0, wxALIGN_CENTER);
|
||||||
|
|
||||||
mInputChannels = safenew wxChoice(this,
|
mInputChannels = safenew wxChoice(this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
wxDefaultPosition,
|
wxDefaultPosition,
|
||||||
@ -117,12 +112,9 @@ void DeviceToolBar::Populate()
|
|||||||
Add(mInputChannels, 0, wxALIGN_CENTER);
|
Add(mInputChannels, 0, wxALIGN_CENTER);
|
||||||
|
|
||||||
// Output device
|
// Output device
|
||||||
if( mPlayBitmap == NULL )
|
|
||||||
mPlayBitmap = std::make_unique<wxBitmap>(theTheme.Bitmap(bmpSpeaker));
|
|
||||||
Add(safenew wxStaticBitmap(this,
|
Add(safenew wxStaticBitmap(this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
*mPlayBitmap), 0, wxALIGN_CENTER);
|
theTheme.Bitmap(bmpSpeaker)), 0, wxALIGN_CENTER);
|
||||||
|
|
||||||
mOutput = safenew wxChoice(this,
|
mOutput = safenew wxChoice(this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
wxDefaultPosition,
|
wxDefaultPosition,
|
||||||
@ -473,8 +465,8 @@ void DeviceToolBar::RepositionCombos()
|
|||||||
while (constrained && ratioUnused > 0.01f && i < 5) {
|
while (constrained && ratioUnused > 0.01f && i < 5) {
|
||||||
i++;
|
i++;
|
||||||
constrained = RepositionCombo(mHost, w, desiredHost, hostRatio, ratioUnused, 0, true);
|
constrained = RepositionCombo(mHost, w, desiredHost, hostRatio, ratioUnused, 0, true);
|
||||||
constrained |= RepositionCombo(mInput, w, desiredInput, inputRatio, ratioUnused, mRecordBitmap->GetWidth(), true);
|
constrained |= RepositionCombo(mInput, w, desiredInput, inputRatio, ratioUnused, theTheme.Bitmap(bmpMic).GetWidth(), true);
|
||||||
constrained |= RepositionCombo(mOutput, w, desiredOutput, outputRatio, ratioUnused, mPlayBitmap->GetWidth(), true);
|
constrained |= RepositionCombo(mOutput, w, desiredOutput, outputRatio, ratioUnused, theTheme.Bitmap(bmpSpeaker).GetWidth(), true);
|
||||||
constrained |= RepositionCombo(mInputChannels, w, desiredChannels, channelsRatio, ratioUnused, 0, true);
|
constrained |= RepositionCombo(mInputChannels, w, desiredChannels, channelsRatio, ratioUnused, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,11 +65,8 @@ class DeviceToolBar final : public ToolBar {
|
|||||||
void RepositionCombos();
|
void RepositionCombos();
|
||||||
void SetNames();
|
void SetNames();
|
||||||
void RegenerateTooltips() override;
|
void RegenerateTooltips() override;
|
||||||
|
|
||||||
void ShowComboDialog(wxChoice *combo, const wxString &title);
|
void ShowComboDialog(wxChoice *combo, const wxString &title);
|
||||||
|
|
||||||
std::unique_ptr<wxBitmap> mPlayBitmap, mRecordBitmap;
|
|
||||||
|
|
||||||
wxChoice *mInput;
|
wxChoice *mInput;
|
||||||
wxChoice *mOutput;
|
wxChoice *mOutput;
|
||||||
wxChoice *mInputChannels;
|
wxChoice *mInputChannels;
|
||||||
|
@ -124,6 +124,7 @@ AButton *EditToolBar::AddButton(
|
|||||||
|
|
||||||
void EditToolBar::Populate()
|
void EditToolBar::Populate()
|
||||||
{
|
{
|
||||||
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
MakeButtonBackgroundsSmall();
|
MakeButtonBackgroundsSmall();
|
||||||
|
|
||||||
/* Buttons */
|
/* Buttons */
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include <wx/gbsizer.h>
|
#include <wx/gbsizer.h>
|
||||||
|
|
||||||
#include "MeterToolBar.h"
|
#include "MeterToolBar.h"
|
||||||
|
#include "../AllThemeResources.h"
|
||||||
#include "../AudioIO.h"
|
#include "../AudioIO.h"
|
||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
#include "../widgets/Meter.h"
|
#include "../widgets/Meter.h"
|
||||||
@ -105,6 +105,7 @@ void MeterToolBar::ReCreateButtons()
|
|||||||
|
|
||||||
void MeterToolBar::Populate()
|
void MeterToolBar::Populate()
|
||||||
{
|
{
|
||||||
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
wxASSERT(mProject); // to justify safenew
|
wxASSERT(mProject); // to justify safenew
|
||||||
Add((mSizer = safenew wxGridBagSizer()), 1, wxEXPAND);
|
Add((mSizer = safenew wxGridBagSizer()), 1, wxEXPAND);
|
||||||
|
|
||||||
|
@ -57,8 +57,6 @@ END_EVENT_TABLE()
|
|||||||
MixerToolBar::MixerToolBar()
|
MixerToolBar::MixerToolBar()
|
||||||
: ToolBar(MixerBarID, _("Mixer"), wxT("Mixer"))
|
: ToolBar(MixerBarID, _("Mixer"), wxT("Mixer"))
|
||||||
{
|
{
|
||||||
mPlayBitmap = NULL;
|
|
||||||
mRecordBitmap = NULL;
|
|
||||||
mInputSliderVolume = 0.0;
|
mInputSliderVolume = 0.0;
|
||||||
mOutputSliderVolume = 0.0;
|
mOutputSliderVolume = 0.0;
|
||||||
}
|
}
|
||||||
@ -74,26 +72,21 @@ void MixerToolBar::Create(wxWindow *parent)
|
|||||||
|
|
||||||
void MixerToolBar::Populate()
|
void MixerToolBar::Populate()
|
||||||
{
|
{
|
||||||
if( mRecordBitmap == NULL )
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
mRecordBitmap = std::make_unique<wxBitmap>(theTheme.Bitmap(bmpMic));
|
// Recording icon and slider
|
||||||
|
|
||||||
Add(safenew wxStaticBitmap(this,
|
Add(safenew wxStaticBitmap(this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
*mRecordBitmap), 0, wxALIGN_CENTER);
|
theTheme.Bitmap(bmpMic)), 0, wxALIGN_CENTER);
|
||||||
|
|
||||||
mInputSlider = safenew ASlider(this, wxID_ANY, _("Recording Volume"),
|
mInputSlider = safenew ASlider(this, wxID_ANY, _("Recording Volume"),
|
||||||
wxDefaultPosition, wxSize(130, 25));
|
wxDefaultPosition, wxSize(130, 25));
|
||||||
mInputSlider->SetScroll(0.1f, 2.0f);
|
mInputSlider->SetScroll(0.1f, 2.0f);
|
||||||
mInputSlider->SetName(_("Slider Recording"));
|
mInputSlider->SetName(_("Slider Recording"));
|
||||||
Add(mInputSlider, 0, wxALIGN_CENTER);
|
Add(mInputSlider, 0, wxALIGN_CENTER);
|
||||||
|
|
||||||
if( mPlayBitmap == NULL )
|
// Playback icon and slider
|
||||||
mPlayBitmap = std::make_unique<wxBitmap>(theTheme.Bitmap(bmpSpeaker));
|
|
||||||
|
|
||||||
Add(safenew wxStaticBitmap(this,
|
Add(safenew wxStaticBitmap(this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
*mPlayBitmap), 0, wxALIGN_CENTER);
|
theTheme.Bitmap(bmpSpeaker)), 0, wxALIGN_CENTER);
|
||||||
|
|
||||||
mOutputSlider = safenew ASlider(this, wxID_ANY, _("Playback Volume"),
|
mOutputSlider = safenew ASlider(this, wxID_ANY, _("Playback Volume"),
|
||||||
wxDefaultPosition, wxSize(130, 25));
|
wxDefaultPosition, wxSize(130, 25));
|
||||||
mOutputSlider->SetScroll(0.1f, 2.0f);
|
mOutputSlider->SetScroll(0.1f, 2.0f);
|
||||||
|
@ -61,8 +61,6 @@ class MixerToolBar final : public ToolBar {
|
|||||||
void InitializeMixerToolBar();
|
void InitializeMixerToolBar();
|
||||||
void SetToolTips();
|
void SetToolTips();
|
||||||
|
|
||||||
std::unique_ptr<wxBitmap> mPlayBitmap, mRecordBitmap;
|
|
||||||
|
|
||||||
ASlider *mInputSlider;
|
ASlider *mInputSlider;
|
||||||
ASlider *mOutputSlider;
|
ASlider *mOutputSlider;
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ AButton *ScrubbingToolBar::AddButton
|
|||||||
|
|
||||||
void ScrubbingToolBar::Populate()
|
void ScrubbingToolBar::Populate()
|
||||||
{
|
{
|
||||||
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
MakeButtonBackgroundsSmall();
|
MakeButtonBackgroundsSmall();
|
||||||
|
|
||||||
/* Buttons */
|
/* Buttons */
|
||||||
|
@ -111,6 +111,7 @@ void SelectionBar::Create(wxWindow * parent)
|
|||||||
|
|
||||||
void SelectionBar::Populate()
|
void SelectionBar::Populate()
|
||||||
{
|
{
|
||||||
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
mLeftTime = mRightTime = mAudioTime = nullptr;
|
mLeftTime = mRightTime = mAudioTime = nullptr;
|
||||||
|
|
||||||
// This will be inherited by all children:
|
// This will be inherited by all children:
|
||||||
|
@ -52,6 +52,7 @@ with changes in the SpectralSelectionBar.
|
|||||||
#include "SpectralSelectionBar.h"
|
#include "SpectralSelectionBar.h"
|
||||||
|
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
|
#include "../AllThemeResources.h"
|
||||||
#include "../SelectedRegion.h"
|
#include "../SelectedRegion.h"
|
||||||
#include "../widgets/NumericTextCtrl.h"
|
#include "../widgets/NumericTextCtrl.h"
|
||||||
|
|
||||||
@ -106,6 +107,7 @@ void SpectralSelectionBar::Create(wxWindow * parent)
|
|||||||
|
|
||||||
void SpectralSelectionBar::Populate()
|
void SpectralSelectionBar::Populate()
|
||||||
{
|
{
|
||||||
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
gPrefs->Read(preferencePath, &mbCenterAndWidth, true);
|
gPrefs->Read(preferencePath, &mbCenterAndWidth, true);
|
||||||
|
|
||||||
// This will be inherited by all children:
|
// This will be inherited by all children:
|
||||||
|
@ -142,9 +142,9 @@ void ToolBarResizer::OnPaint( wxPaintEvent & event )
|
|||||||
// Under GTK, we specifically set the toolbar background to the background
|
// Under GTK, we specifically set the toolbar background to the background
|
||||||
// colour in the system theme.
|
// colour in the system theme.
|
||||||
#if defined( __WXGTK__ )
|
#if defined( __WXGTK__ )
|
||||||
dc.SetBackground( wxBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND ) ) );
|
// dc.SetBackground( wxBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND ) ) );
|
||||||
#endif
|
#endif
|
||||||
|
dc.SetBackground( wxBrush( theTheme.Colour( clrMedium ) ) );
|
||||||
dc.Clear();
|
dc.Clear();
|
||||||
|
|
||||||
wxSize sz = GetSize();
|
wxSize sz = GetSize();
|
||||||
|
@ -874,9 +874,8 @@ void ToolDock::OnPaint( wxPaintEvent & WXUNUSED(event) )
|
|||||||
//
|
//
|
||||||
// Under GTK, we don't set the toolbar background to the background
|
// Under GTK, we don't set the toolbar background to the background
|
||||||
// colour in the system theme. Instead we use our own colour.
|
// colour in the system theme. Instead we use our own colour.
|
||||||
#if defined( __WXGTK__ )
|
|
||||||
dc.SetBackground( wxBrush( theTheme.Colour( clrMedium )));
|
dc.SetBackground( wxBrush( theTheme.Colour( clrMedium )));
|
||||||
#endif
|
|
||||||
dc.Clear();
|
dc.Clear();
|
||||||
|
|
||||||
// Set the gap color
|
// Set the gap color
|
||||||
|
@ -1285,6 +1285,7 @@ void ToolManager::OnIndicatorPaint( wxPaintEvent & event )
|
|||||||
// TODO: Better to use a bitmap than a triangular region.
|
// TODO: Better to use a bitmap than a triangular region.
|
||||||
wxWindow *w = (wxWindow *)event.GetEventObject();
|
wxWindow *w = (wxWindow *)event.GetEventObject();
|
||||||
wxPaintDC dc( w );
|
wxPaintDC dc( w );
|
||||||
|
// TODO: Better (faster) to use the existing spare brush.
|
||||||
wxBrush brush( theTheme.Colour( clrTrackPanelText ) );
|
wxBrush brush( theTheme.Colour( clrTrackPanelText ) );
|
||||||
dc.SetBackground( brush );
|
dc.SetBackground( brush );
|
||||||
dc.Clear();
|
dc.Clear();
|
||||||
|
@ -186,6 +186,7 @@ AButton * ToolsToolBar::MakeTool( teBmps eTool,
|
|||||||
|
|
||||||
void ToolsToolBar::Populate()
|
void ToolsToolBar::Populate()
|
||||||
{
|
{
|
||||||
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
MakeButtonBackgroundsSmall();
|
MakeButtonBackgroundsSmall();
|
||||||
Add(mToolSizer = safenew wxGridSizer(2, 3, 1, 1));
|
Add(mToolSizer = safenew wxGridSizer(2, 3, 1, 1));
|
||||||
|
|
||||||
|
@ -172,6 +172,7 @@ void TranscriptionToolBar::MakeAlternateImages(
|
|||||||
|
|
||||||
void TranscriptionToolBar::Populate()
|
void TranscriptionToolBar::Populate()
|
||||||
{
|
{
|
||||||
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
// Very similar to code in ControlToolBar...
|
// Very similar to code in ControlToolBar...
|
||||||
// Very similar to code in EditToolBar
|
// Very similar to code in EditToolBar
|
||||||
MakeButtonBackgroundsSmall();
|
MakeButtonBackgroundsSmall();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user