mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-03 00:59:43 +02:00
Bug 1701 - Mac: Text descriptors in Selection Toolbar become invisible after Open command
Problem was that on mac enable/disable clears the colour back to black. The easiest workaround was to create a new class auStaticText that does all that we need for wxStaticText.
This commit is contained in:
parent
f2ee945da0
commit
dc05b94fd1
@ -18,14 +18,14 @@ It is also a place to document colour usage policy in Audacity
|
||||
*//********************************************************************/
|
||||
|
||||
#include "Audacity.h"
|
||||
#include "AColor.h"
|
||||
|
||||
#include <wx/window.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/dc.h>
|
||||
#include <wx/dcmemory.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/utils.h>
|
||||
|
||||
#include "AColor.h"
|
||||
#include "Theme.h"
|
||||
#include "Experimental.h"
|
||||
#include "AllThemeResources.h"
|
||||
|
@ -10,8 +10,6 @@
|
||||
**********************************************************************/
|
||||
|
||||
#include "Audacity.h"
|
||||
#include "Experimental.h"
|
||||
#include "MixerBoard.h"
|
||||
|
||||
#include <cfloat>
|
||||
#include <math.h>
|
||||
@ -21,6 +19,9 @@
|
||||
#include <wx/icon.h>
|
||||
#include <wx/settings.h> // for wxSystemSettings::GetColour and wxSystemSettings::GetMetric
|
||||
|
||||
#include "Theme.h"
|
||||
#include "Experimental.h"
|
||||
#include "MixerBoard.h"
|
||||
#include "AColor.h"
|
||||
#include "AllThemeResources.h"
|
||||
#include "AudioIO.h"
|
||||
@ -187,11 +188,13 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
|
||||
wxPoint ctrlPos(kDoubleInset, kDoubleInset);
|
||||
wxSize ctrlSize(size.GetWidth() - kQuadrupleInset, TRACK_NAME_HEIGHT);
|
||||
mStaticText_TrackName =
|
||||
safenew wxStaticText(this, -1, mTrack->GetName(), ctrlPos, ctrlSize,
|
||||
wxALIGN_CENTRE | wxST_NO_AUTORESIZE | wxSUNKEN_BORDER);
|
||||
safenew auStaticText(this, mTrack->GetName());
|
||||
//v Useful when different tracks are different colors, but not now.
|
||||
// mStaticText_TrackName->SetBackgroundColour(this->GetTrackColor());
|
||||
mStaticText_TrackName->SetForegroundColour(theTheme.Colour(clrMedium));
|
||||
mStaticText_TrackName->SetForegroundColour(theTheme.Colour(clrTrackPanelText));
|
||||
mStaticText_TrackName->SetSize( ctrlSize );
|
||||
mStaticText_TrackName->SetPosition( ctrlPos );
|
||||
|
||||
|
||||
// gain and velocity sliders at left (both in same place)
|
||||
|
@ -70,6 +70,7 @@ class NoteTrack;
|
||||
class PlayableTrack;
|
||||
|
||||
class WaveTrack;
|
||||
class auStaticText;
|
||||
|
||||
class MixerTrackCluster final : public wxPanelWrapper
|
||||
{
|
||||
@ -140,7 +141,7 @@ private:
|
||||
AudacityProject* mProject;
|
||||
|
||||
// controls
|
||||
wxStaticText* mStaticText_TrackName;
|
||||
auStaticText* mStaticText_TrackName;
|
||||
wxBitmapButton* mBitmapButton_MusicalInstrument;
|
||||
AButton* mToggleButton_Mute;
|
||||
AButton* mToggleButton_Solo;
|
||||
|
@ -1265,3 +1265,36 @@ void ThemeBase::RotateImageInto( int iTo, int iFrom, bool bClockwise )
|
||||
wxImage img2 = img.Rotate90( bClockwise );
|
||||
ReplaceImage( iTo, &img2 );
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(auStaticText, wxWindow)
|
||||
EVT_PAINT(auStaticText::OnPaint)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
auStaticText::auStaticText(wxWindow* parent, wxString textIn) :
|
||||
wxWindow(parent, wxID_ANY)
|
||||
{
|
||||
int textWidth, textHeight;
|
||||
|
||||
int fontSize = 11;
|
||||
#ifdef __WXMSW__
|
||||
fontSize = 9;
|
||||
#endif
|
||||
wxFont font(fontSize, wxDEFAULT, wxNORMAL, wxNORMAL);
|
||||
GetTextExtent(textIn, &textWidth, &textHeight, NULL, NULL, &font);
|
||||
|
||||
SetFont( font );
|
||||
SetMinSize( wxSize(textWidth, textHeight) );
|
||||
SetBackgroundColour( theTheme.Colour( clrMedium));
|
||||
SetForegroundColour( theTheme.Colour( clrTrackPanelText));
|
||||
SetName(textIn);
|
||||
}
|
||||
|
||||
void auStaticText::OnPaint(wxPaintEvent & evt)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
//dc.SetTextForeground( theTheme.Colour( clrTrackPanelText));
|
||||
dc.DrawText( GetName(), 0,0);
|
||||
}
|
||||
|
||||
|
||||
|
15
src/Theme.h
15
src/Theme.h
@ -16,6 +16,7 @@
|
||||
|
||||
#include "Audacity.h"
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/defs.h>
|
||||
@ -174,6 +175,20 @@ public:
|
||||
bool mbInitialised;
|
||||
};
|
||||
|
||||
// A bit cheeky - putting a themable wxStaticText control into
|
||||
// theme, rather than in a new file. Saves sorting out makefiles (for now).
|
||||
class wxWindow;
|
||||
class wxString;
|
||||
class wxPaintEvent;
|
||||
|
||||
class auStaticText : public wxWindow
|
||||
{
|
||||
public:
|
||||
auStaticText(wxWindow* parent, wxString text);
|
||||
void OnPaint(wxPaintEvent & evt);
|
||||
DECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
extern AUDACITY_DLL_API Theme theTheme;
|
||||
|
||||
#endif // __AUDACITY_THEME__
|
||||
|
@ -1159,7 +1159,9 @@ void TrackPanel::OnPlayback(wxCommandEvent &e)
|
||||
void TrackPanel::OnTrackListResizing(wxCommandEvent & e)
|
||||
{
|
||||
Track *t = (Track *) e.GetClientData();
|
||||
UpdateVRuler(t);
|
||||
// A deleted track can trigger the event. In which case do nothing here.
|
||||
if( t )
|
||||
UpdateVRuler(t);
|
||||
e.Skip();
|
||||
}
|
||||
|
||||
|
@ -208,8 +208,9 @@ wxRadioButton * SelectionBar::AddRadioButton( const wxString & Name,
|
||||
return pBtn;
|
||||
}
|
||||
|
||||
wxStaticText * SelectionBar::AddTitle( const wxString & Title, int id, wxSizer * pSizer ){
|
||||
wxStaticText * pTitle = safenew wxStaticText(this, id,Title );
|
||||
auStaticText * SelectionBar::AddTitle( const wxString & Title, wxSizer * pSizer ){
|
||||
auStaticText * pTitle = safenew auStaticText(this, Title );
|
||||
pTitle->SetBackgroundColour( theTheme.Colour( clrMedium ));
|
||||
pTitle->SetForegroundColour( theTheme.Colour( clrTrackPanelText ) );
|
||||
pSizer->Add( pTitle,0, wxALIGN_CENTER_VERTICAL | wxRIGHT, (Title.Length() == 1 ) ? 0:5);
|
||||
return pTitle;
|
||||
@ -222,7 +223,6 @@ NumericTextCtrl * SelectionBar::AddTime( const wxString Name, int id, wxSizer *
|
||||
NumericTextCtrl * pCtrl = safenew NumericTextCtrl(
|
||||
NumericConverter::TIME, this, id, formatName, 0.0, mRate);
|
||||
pCtrl->SetName(Name);
|
||||
pCtrl->SetForegroundColour( theTheme.Colour( clrTrackPanelText ) );
|
||||
pCtrl->EnableMenu();
|
||||
pSizer->Add(pCtrl, 0, wxALIGN_TOP | wxRIGHT, 5);
|
||||
return pCtrl;
|
||||
@ -238,6 +238,7 @@ void SelectionBar::AddVLine( wxSizer * pSizer ){
|
||||
void SelectionBar::Populate()
|
||||
{
|
||||
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||
|
||||
mStartTime = mEndTime = mLengthTime = mCenterTime = mAudioTime = nullptr;
|
||||
#ifdef SEL_RADIO_TITLE
|
||||
mStartEndProxy = mStartLengthProxy = mLengthEndProxy = mLengthCenterProxy = nullptr;
|
||||
@ -273,26 +274,15 @@ void SelectionBar::Populate()
|
||||
|
||||
wxColour clrText = theTheme.Colour( clrTrackPanelText );
|
||||
wxColour clrText2 = *wxBLUE;
|
||||
wxStaticText * pProjRate = safenew wxStaticText(this, -1, _("Project Rate (Hz):"),
|
||||
// LLL: On my Ubuntu 7.04 install, the label wraps to two lines
|
||||
// and I could not figure out why. Thus...hackage.
|
||||
#if defined(__WXGTK__)
|
||||
wxDefaultPosition, wxSize(110, -1));
|
||||
#else
|
||||
wxDefaultPosition, wxDefaultSize);
|
||||
#endif
|
||||
pProjRate->SetForegroundColour( clrText );
|
||||
mainSizer->Add(pProjRate,0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||
AddTitle( _("Project Rate (Hz):"), mainSizer );
|
||||
AddVLine( mainSizer );
|
||||
|
||||
AddTitle( _("Snap-To"), -1, mainSizer );
|
||||
AddTitle( _("Snap-To"), mainSizer );
|
||||
#ifdef OPTIONS_BUTTON
|
||||
// Not enough room to say 'Selection Options". There is a tooltip instead.
|
||||
AddTitle( wxT(""), -1, mainSizer );
|
||||
AddTitle( wxT(""), mainSizer );
|
||||
#endif
|
||||
AddVLine( mainSizer );
|
||||
|
||||
AddTitle( _("Audio Position"), -1, mainSizer );
|
||||
AddTitle( _("Audio Position"), mainSizer );
|
||||
AddVLine( mainSizer );
|
||||
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ class SelectionBar final : public ToolBar {
|
||||
private:
|
||||
wxRadioButton * AddRadioButton( const wxString & Name, int id,
|
||||
wxSizer * pSizer, long style);
|
||||
wxStaticText * AddTitle( const wxString & Title, int id,
|
||||
auStaticText * AddTitle( const wxString & Title,
|
||||
wxSizer * pSizer );
|
||||
NumericTextCtrl * AddTime( const wxString Name, int id, wxSizer * pSizer );
|
||||
void AddVLine( wxSizer * pSizer );
|
||||
|
Loading…
x
Reference in New Issue
Block a user