mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-21 15:08:01 +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 "Audacity.h"
|
||||||
#include "AColor.h"
|
#include <wx/window.h>
|
||||||
|
|
||||||
#include <wx/colour.h>
|
#include <wx/colour.h>
|
||||||
#include <wx/dc.h>
|
#include <wx/dc.h>
|
||||||
#include <wx/dcmemory.h>
|
#include <wx/dcmemory.h>
|
||||||
#include <wx/settings.h>
|
#include <wx/settings.h>
|
||||||
#include <wx/utils.h>
|
#include <wx/utils.h>
|
||||||
|
|
||||||
|
#include "AColor.h"
|
||||||
#include "Theme.h"
|
#include "Theme.h"
|
||||||
#include "Experimental.h"
|
#include "Experimental.h"
|
||||||
#include "AllThemeResources.h"
|
#include "AllThemeResources.h"
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
#include "Audacity.h"
|
#include "Audacity.h"
|
||||||
#include "Experimental.h"
|
|
||||||
#include "MixerBoard.h"
|
|
||||||
|
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -21,6 +19,9 @@
|
|||||||
#include <wx/icon.h>
|
#include <wx/icon.h>
|
||||||
#include <wx/settings.h> // for wxSystemSettings::GetColour and wxSystemSettings::GetMetric
|
#include <wx/settings.h> // for wxSystemSettings::GetColour and wxSystemSettings::GetMetric
|
||||||
|
|
||||||
|
#include "Theme.h"
|
||||||
|
#include "Experimental.h"
|
||||||
|
#include "MixerBoard.h"
|
||||||
#include "AColor.h"
|
#include "AColor.h"
|
||||||
#include "AllThemeResources.h"
|
#include "AllThemeResources.h"
|
||||||
#include "AudioIO.h"
|
#include "AudioIO.h"
|
||||||
@ -187,11 +188,13 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
|
|||||||
wxPoint ctrlPos(kDoubleInset, kDoubleInset);
|
wxPoint ctrlPos(kDoubleInset, kDoubleInset);
|
||||||
wxSize ctrlSize(size.GetWidth() - kQuadrupleInset, TRACK_NAME_HEIGHT);
|
wxSize ctrlSize(size.GetWidth() - kQuadrupleInset, TRACK_NAME_HEIGHT);
|
||||||
mStaticText_TrackName =
|
mStaticText_TrackName =
|
||||||
safenew wxStaticText(this, -1, mTrack->GetName(), ctrlPos, ctrlSize,
|
safenew auStaticText(this, mTrack->GetName());
|
||||||
wxALIGN_CENTRE | wxST_NO_AUTORESIZE | wxSUNKEN_BORDER);
|
|
||||||
//v Useful when different tracks are different colors, but not now.
|
//v Useful when different tracks are different colors, but not now.
|
||||||
// mStaticText_TrackName->SetBackgroundColour(this->GetTrackColor());
|
// mStaticText_TrackName->SetBackgroundColour(this->GetTrackColor());
|
||||||
|
mStaticText_TrackName->SetForegroundColour(theTheme.Colour(clrMedium));
|
||||||
mStaticText_TrackName->SetForegroundColour(theTheme.Colour(clrTrackPanelText));
|
mStaticText_TrackName->SetForegroundColour(theTheme.Colour(clrTrackPanelText));
|
||||||
|
mStaticText_TrackName->SetSize( ctrlSize );
|
||||||
|
mStaticText_TrackName->SetPosition( ctrlPos );
|
||||||
|
|
||||||
|
|
||||||
// gain and velocity sliders at left (both in same place)
|
// gain and velocity sliders at left (both in same place)
|
||||||
|
@ -70,6 +70,7 @@ class NoteTrack;
|
|||||||
class PlayableTrack;
|
class PlayableTrack;
|
||||||
|
|
||||||
class WaveTrack;
|
class WaveTrack;
|
||||||
|
class auStaticText;
|
||||||
|
|
||||||
class MixerTrackCluster final : public wxPanelWrapper
|
class MixerTrackCluster final : public wxPanelWrapper
|
||||||
{
|
{
|
||||||
@ -140,7 +141,7 @@ private:
|
|||||||
AudacityProject* mProject;
|
AudacityProject* mProject;
|
||||||
|
|
||||||
// controls
|
// controls
|
||||||
wxStaticText* mStaticText_TrackName;
|
auStaticText* mStaticText_TrackName;
|
||||||
wxBitmapButton* mBitmapButton_MusicalInstrument;
|
wxBitmapButton* mBitmapButton_MusicalInstrument;
|
||||||
AButton* mToggleButton_Mute;
|
AButton* mToggleButton_Mute;
|
||||||
AButton* mToggleButton_Solo;
|
AButton* mToggleButton_Solo;
|
||||||
|
@ -1265,3 +1265,36 @@ void ThemeBase::RotateImageInto( int iTo, int iFrom, bool bClockwise )
|
|||||||
wxImage img2 = img.Rotate90( bClockwise );
|
wxImage img2 = img.Rotate90( bClockwise );
|
||||||
ReplaceImage( iTo, &img2 );
|
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 "Audacity.h"
|
||||||
|
|
||||||
|
#include <wx/wx.h>
|
||||||
#include <wx/bitmap.h>
|
#include <wx/bitmap.h>
|
||||||
#include <wx/colour.h>
|
#include <wx/colour.h>
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
@ -174,6 +175,20 @@ public:
|
|||||||
bool mbInitialised;
|
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;
|
extern AUDACITY_DLL_API Theme theTheme;
|
||||||
|
|
||||||
#endif // __AUDACITY_THEME__
|
#endif // __AUDACITY_THEME__
|
||||||
|
@ -1159,6 +1159,8 @@ void TrackPanel::OnPlayback(wxCommandEvent &e)
|
|||||||
void TrackPanel::OnTrackListResizing(wxCommandEvent & e)
|
void TrackPanel::OnTrackListResizing(wxCommandEvent & e)
|
||||||
{
|
{
|
||||||
Track *t = (Track *) e.GetClientData();
|
Track *t = (Track *) e.GetClientData();
|
||||||
|
// A deleted track can trigger the event. In which case do nothing here.
|
||||||
|
if( t )
|
||||||
UpdateVRuler(t);
|
UpdateVRuler(t);
|
||||||
e.Skip();
|
e.Skip();
|
||||||
}
|
}
|
||||||
|
@ -208,8 +208,9 @@ wxRadioButton * SelectionBar::AddRadioButton( const wxString & Name,
|
|||||||
return pBtn;
|
return pBtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxStaticText * SelectionBar::AddTitle( const wxString & Title, int id, wxSizer * pSizer ){
|
auStaticText * SelectionBar::AddTitle( const wxString & Title, wxSizer * pSizer ){
|
||||||
wxStaticText * pTitle = safenew wxStaticText(this, id,Title );
|
auStaticText * pTitle = safenew auStaticText(this, Title );
|
||||||
|
pTitle->SetBackgroundColour( theTheme.Colour( clrMedium ));
|
||||||
pTitle->SetForegroundColour( theTheme.Colour( clrTrackPanelText ) );
|
pTitle->SetForegroundColour( theTheme.Colour( clrTrackPanelText ) );
|
||||||
pSizer->Add( pTitle,0, wxALIGN_CENTER_VERTICAL | wxRIGHT, (Title.Length() == 1 ) ? 0:5);
|
pSizer->Add( pTitle,0, wxALIGN_CENTER_VERTICAL | wxRIGHT, (Title.Length() == 1 ) ? 0:5);
|
||||||
return pTitle;
|
return pTitle;
|
||||||
@ -222,7 +223,6 @@ NumericTextCtrl * SelectionBar::AddTime( const wxString Name, int id, wxSizer *
|
|||||||
NumericTextCtrl * pCtrl = safenew NumericTextCtrl(
|
NumericTextCtrl * pCtrl = safenew NumericTextCtrl(
|
||||||
NumericConverter::TIME, this, id, formatName, 0.0, mRate);
|
NumericConverter::TIME, this, id, formatName, 0.0, mRate);
|
||||||
pCtrl->SetName(Name);
|
pCtrl->SetName(Name);
|
||||||
pCtrl->SetForegroundColour( theTheme.Colour( clrTrackPanelText ) );
|
|
||||||
pCtrl->EnableMenu();
|
pCtrl->EnableMenu();
|
||||||
pSizer->Add(pCtrl, 0, wxALIGN_TOP | wxRIGHT, 5);
|
pSizer->Add(pCtrl, 0, wxALIGN_TOP | wxRIGHT, 5);
|
||||||
return pCtrl;
|
return pCtrl;
|
||||||
@ -238,6 +238,7 @@ void SelectionBar::AddVLine( wxSizer * pSizer ){
|
|||||||
void SelectionBar::Populate()
|
void SelectionBar::Populate()
|
||||||
{
|
{
|
||||||
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
|
|
||||||
mStartTime = mEndTime = mLengthTime = mCenterTime = mAudioTime = nullptr;
|
mStartTime = mEndTime = mLengthTime = mCenterTime = mAudioTime = nullptr;
|
||||||
#ifdef SEL_RADIO_TITLE
|
#ifdef SEL_RADIO_TITLE
|
||||||
mStartEndProxy = mStartLengthProxy = mLengthEndProxy = mLengthCenterProxy = nullptr;
|
mStartEndProxy = mStartLengthProxy = mLengthEndProxy = mLengthCenterProxy = nullptr;
|
||||||
@ -273,26 +274,15 @@ void SelectionBar::Populate()
|
|||||||
|
|
||||||
wxColour clrText = theTheme.Colour( clrTrackPanelText );
|
wxColour clrText = theTheme.Colour( clrTrackPanelText );
|
||||||
wxColour clrText2 = *wxBLUE;
|
wxColour clrText2 = *wxBLUE;
|
||||||
wxStaticText * pProjRate = safenew wxStaticText(this, -1, _("Project Rate (Hz):"),
|
AddTitle( _("Project Rate (Hz):"), mainSizer );
|
||||||
// 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);
|
|
||||||
AddVLine( mainSizer );
|
AddVLine( mainSizer );
|
||||||
|
AddTitle( _("Snap-To"), mainSizer );
|
||||||
AddTitle( _("Snap-To"), -1, mainSizer );
|
|
||||||
#ifdef OPTIONS_BUTTON
|
#ifdef OPTIONS_BUTTON
|
||||||
// Not enough room to say 'Selection Options". There is a tooltip instead.
|
// Not enough room to say 'Selection Options". There is a tooltip instead.
|
||||||
AddTitle( wxT(""), -1, mainSizer );
|
AddTitle( wxT(""), mainSizer );
|
||||||
#endif
|
#endif
|
||||||
AddVLine( mainSizer );
|
AddVLine( mainSizer );
|
||||||
|
AddTitle( _("Audio Position"), mainSizer );
|
||||||
AddTitle( _("Audio Position"), -1, mainSizer );
|
|
||||||
AddVLine( mainSizer );
|
AddVLine( mainSizer );
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ class SelectionBar final : public ToolBar {
|
|||||||
private:
|
private:
|
||||||
wxRadioButton * AddRadioButton( const wxString & Name, int id,
|
wxRadioButton * AddRadioButton( const wxString & Name, int id,
|
||||||
wxSizer * pSizer, long style);
|
wxSizer * pSizer, long style);
|
||||||
wxStaticText * AddTitle( const wxString & Title, int id,
|
auStaticText * AddTitle( const wxString & Title,
|
||||||
wxSizer * pSizer );
|
wxSizer * pSizer );
|
||||||
NumericTextCtrl * AddTime( const wxString Name, int id, wxSizer * pSizer );
|
NumericTextCtrl * AddTime( const wxString Name, int id, wxSizer * pSizer );
|
||||||
void AddVLine( wxSizer * pSizer );
|
void AddVLine( wxSizer * pSizer );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user