Code: Select all
Index: src/prefs/GUIPrefs.cpp
===================================================================
--- src/prefs/GUIPrefs.cpp (revision 11419)
+++ src/prefs/GUIPrefs.cpp (working copy)
@@ -20,6 +20,7 @@
#include "../Audacity.h"
#include <wx/defs.h>
+#include <wx/clrpicker.h>
#include "../AudacityApp.h"
#include "../Languages.h"
@@ -128,6 +129,34 @@
S.TieCheckBox(_("&Show track name in waveform display"),
wxT("/GUI/ShowTrackNameInWaveform"),
false);
+ S.StartThreeColumn();
+ {
+ int fontSize = gPrefs->Read(wxT("/GUI/FontSizeForNameInWaveform"), (int)8);
+ mFontSizeCtrl = S.TieNumericTextBox(_("Font size for track name in waveform display"), wxT("/GUI/FontSizeForNameInWaveform"), fontSize, 4);
+ mFontSizeCtrl->SetSizeHints(wxSize(50,20));
+ S.AddUnits(_(" Color: "));
+ }
+ wxPoint fontSizeCtrlLocation = mFontSizeCtrl->GetPosition();
+ fontSizeCtrlLocation.x = 320;
+ fontSizeCtrlLocation.y += 200;
+ wxString red;
+ long redValue = 0;
+ if (gPrefs->Read(wxT("/GUI/FontColorRedForNameInWaveform"), &red))
+ red.ToLong(&redValue);
+
+ wxString green;
+ long greenValue = 0;
+ if (gPrefs->Read(wxT("/GUI/FontColorGreenForNameInWaveform"), &green))
+ green.ToLong(&greenValue);
+
+ wxString blue;
+ long blueValue = 0;
+ if (gPrefs->Read(wxT("/GUI/FontColorBlueForNameInWaveform"), &blue))
+ blue.ToLong(&blueValue);
+
+ wxColour fontColor(redValue, greenValue, blueValue);
+ fontColorPickerCtrl = NULL;
+ fontColorPickerCtrl = new wxColourPickerCtrl((wxWindow *)this, wxID_ANY, fontColor, fontSizeCtrlLocation);
}
S.EndStatic();
@@ -152,6 +181,26 @@
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
+ //validate user's choice of font size
+ long fontSize = 8;
+ mFontSizeCtrl->GetValue().ToLong(&fontSize);
+ if (fontSize < 8) {
+ fontSize = 8;
+ gPrefs->Write(wxT("/GUI/FontSizeForNameInWaveform"), (int)8);
+ wxMessageBox(_("Font size must be no smaller than 8; setting to 8."));
+ }
+ //else if (fontSize > TOO_BIG) {//how big is too big?
+ if (fontColorPickerCtrl) {
+ wxColour fontColor = fontColorPickerCtrl->GetColour();
+ unsigned char red = fontColor.Red();
+ unsigned char green = fontColor.Green();
+ unsigned char blue = fontColor.Blue();
+ //gPrefs->Write(wxT("/GUI/FontColorRedForNameInWaveform"), red);
+ //gPrefs->Write(wxT("/GUI/FontColorGreenForNameInWaveform"), green);
+ //gPrefs->Write(wxT("/GUI/FontColorBlueForNameInWaveform"), blue);
+ delete fontColorPickerCtrl;
+ }
+
// If language has changed, we want to change it now, not on the next reboot.
wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
if (lang == wxT(""))
Index: src/prefs/GUIPrefs.h
===================================================================
--- src/prefs/GUIPrefs.h (revision 11419)
+++ src/prefs/GUIPrefs.h (working copy)
@@ -17,6 +17,7 @@
#include <wx/arrstr.h>
#include <wx/window.h>
+#include <wx/clrpicker.h>
#include "../ShuttleGui.h"
@@ -41,6 +42,8 @@
wxArrayString mRangeCodes;
wxArrayString mRangeChoices;
+ wxTextCtrl * mFontSizeCtrl;
+ wxColourPickerCtrl * fontColorPickerCtrl;
};
#endif
Index: src/TrackArtist.cpp
===================================================================
--- src/TrackArtist.cpp (revision 11419)
+++ src/TrackArtist.cpp (working copy)
@@ -321,7 +321,10 @@
dc.DrawRectangle(clip);
#endif
- wxFont labelFont(8, wxSWISS, wxNORMAL, wxNORMAL);
+
+ int fontSize = gPrefs->Read(wxT("/GUI/FontSizeForNameInWaveform"), (int)8);
+
+ wxFont labelFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL);
dc.SetFont(labelFont);
gPrefs->Read(wxT("/GUI/ShowTrackNameInWaveform"), &mbShowTrackNameInWaveform, false);
@@ -403,8 +406,29 @@
case WaveTrack::WaveformDisplay:
DrawWaveform(wt, dc, r, viewInfo,
drawEnvelope, drawSamples, drawSliders, false, muted);
- if (mbShowTrackNameInWaveform && wt->GetChannel() != Track::RightChannel) // so left or mono only
+
+ if (mbShowTrackNameInWaveform && wt->GetChannel() != Track::RightChannel) { // so left or mono only
+ const wxColour& originalForegroundTextColor = dc.GetTextForeground();
+ wxString red;
+ long redValue = 0;
+ if (gPrefs->Read(wxT("/GUI/FontColorRedForNameInWaveform"), &red))
+ red.ToLong(&redValue);
+
+ wxString green;
+ long greenValue = 0;
+ if (gPrefs->Read(wxT("/GUI/FontColorGreenForNameInWaveform"), &green))
+ green.ToLong(&greenValue);
+
+ wxString blue;
+ long blueValue = 0;
+ if (gPrefs->Read(wxT("/GUI/FontColorBlueForNameInWaveform"), &blue))
+ blue.ToLong(&blueValue);
+
+ wxColour newForegroundColor(redValue, greenValue, blueValue);
+ dc.SetTextForeground(newForegroundColor);
dc.DrawText (wt->GetName(), r.x+10, r.y); // move right 10 pixels to avoid overwriting <- symbol
+ dc.SetTextForeground(originalForegroundTextColor);
+ }
break;
case WaveTrack::WaveformDBDisplay:
DrawWaveform(wt, dc, r, viewInfo,
Code: Select all
[GUI]
[...]
ShowTrackNameInWaveform=1
FontSizeForNameInWaveform=14
FontColorRedForNameInWaveform=240
FontColorGreenForNameInWaveform=0
FontColorBlueForNameInWaveform=240