Audacity  2.2.2
Public Types | Static Public Member Functions | Static Public Attributes | Static Private Attributes | List of all members
AColor Class Reference

AColor Manages color brushes and pens. More...

#include <AColor.h>

Public Types

enum  ColorGradientChoice {
  ColorGradientUnselected = 0, ColorGradientTimeSelected, ColorGradientTimeAndFrequencySelected, ColorGradientEdge,
  ColorGradientTotal
}
 

Static Public Member Functions

static void Init ()
 
static void ReInit ()
 
static void Arrow (wxDC &dc, wxCoord x, wxCoord y, int width, bool down=true)
 
static void Line (wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
 
static void DrawFocus (wxDC &dc, wxRect &r)
 
static void Bevel (wxDC &dc, bool up, const wxRect &r)
 
static void Bevel2 (wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
 
static void BevelTrackInfo (wxDC &dc, bool up, const wxRect &r, bool highlight=false)
 
static wxColour Blend (const wxColour &c1, const wxColour &c2)
 
static void UseThemeColour (wxDC *dc, int iBrush, int iPen=-1)
 
static void TrackPanelBackground (wxDC *dc, bool selected)
 
static void Light (wxDC *dc, bool selected, bool highlight=false)
 
static void Medium (wxDC *dc, bool selected)
 
static void MediumTrackInfo (wxDC *dc, bool selected)
 
static void Dark (wxDC *dc, bool selected, bool highlight=false)
 
static void CursorColor (wxDC *dc)
 
static void IndicatorColor (wxDC *dc, bool bIsNotRecording)
 
static void PlayRegionColor (wxDC *dc, bool locked)
 
static void Mute (wxDC *dc, bool on, bool selected, bool soloing)
 
static void Solo (wxDC *dc, bool on, bool selected)
 
static void MIDIChannel (wxDC *dc, int channel)
 
static void LightMIDIChannel (wxDC *dc, int channel)
 
static void DarkMIDIChannel (wxDC *dc, int channel)
 
static void TrackFocusPen (wxDC *dc, int level)
 
static void SnapGuidePen (wxDC *dc)
 
static void PreComputeGradient ()
 

Static Public Attributes

static wxBrush lightBrush [2]
 
static wxBrush mediumBrush [2]
 
static wxBrush darkBrush [2]
 
static wxPen lightPen [2]
 
static wxPen mediumPen [2]
 
static wxPen darkPen [2]
 
static wxPen cursorPen
 
static wxPen indicatorPen [2]
 
static wxBrush indicatorBrush [2]
 
static wxPen playRegionPen [2]
 
static wxBrush playRegionBrush [2]
 
static wxBrush muteBrush [2]
 
static wxBrush soloBrush
 
static wxPen clippingPen
 
static wxPen envelopePen
 
static wxPen WideEnvelopePen
 
static wxBrush envelopeBrush
 
static wxBrush labelTextNormalBrush
 
static wxBrush labelTextEditBrush
 
static wxBrush labelUnselectedBrush
 
static wxBrush labelSelectedBrush
 
static wxBrush labelSyncLockSelBrush
 
static wxPen labelUnselectedPen
 
static wxPen labelSelectedPen
 
static wxPen labelSyncLockSelPen
 
static wxPen labelSurroundPen
 
static wxPen trackFocusPens [3]
 
static wxPen snapGuidePen
 
static wxPen tooltipPen
 
static wxBrush tooltipBrush
 
static bool gradient_inited = 0
 
static const int gradientSteps = 512
 
static unsigned char gradient_pre [ColorGradientTotal][2][gradientSteps][3]
 
static wxPen uglyPen
 
static wxBrush uglyBrush
 

Static Private Attributes

static wxPen sparePen
 
static wxBrush spareBrush
 
static bool inited = false
 

Detailed Description

AColor Manages color brushes and pens.

It is also a place to document colour usage policy in Audacity

Definition at line 50 of file AColor.h.

Member Enumeration Documentation

Enumerator
ColorGradientUnselected 
ColorGradientTimeSelected 
ColorGradientTimeAndFrequencySelected 
ColorGradientEdge 
ColorGradientTotal 

Definition at line 53 of file AColor.h.

Member Function Documentation

void AColor::Arrow ( wxDC &  dc,
wxCoord  x,
wxCoord  y,
int  width,
bool  down = true 
)
static

Definition at line 96 of file AColor.cpp.

Referenced by TrackInfo::CloseTitleDrawFunction(), NumericTextCtrl::Layout(), and TrackInfo::MinimizeSyncLockDrawFunction().

97 {
98  if (width & 0x01) {
99  width--;
100  }
101 
102  wxPoint pt[3];
103  int half = width / 2;
104 
105  if (down) {
106  pt[0].x = 0; pt[0].y = 0;
107  pt[1].x = width; pt[1].y = 0;
108  pt[2].x = half; pt[2].y = half;
109  }
110  else {
111  pt[0].x = 0; pt[0].y = half;
112  pt[1].x = half; pt[1].y = 0;
113  pt[2].x = width; pt[2].y = half;
114  }
115 
116  dc.DrawPolygon(3, pt, x, y);
117 }
void AColor::Bevel ( wxDC &  dc,
bool  up,
const wxRect &  r 
)
static

Definition at line 202 of file AColor.cpp.

References Dark(), Light(), and Line().

Referenced by Grabber::DrawGrabber(), NumericTextCtrl::Layout(), MixerBoard::LoadMusicalInstruments(), MixerTrackCluster::OnPaint(), MeterPanel::OnPaint(), and ControlToolBar::Repaint().

203 {
204  if (up)
205  AColor::Light(&dc, false);
206  else
207  AColor::Dark(&dc, false);
208 
209  AColor::Line(dc, r.x, r.y, r.x + r.width, r.y);
210  AColor::Line(dc, r.x, r.y, r.x, r.y + r.height);
211 
212  if (!up)
213  AColor::Light(&dc, false);
214  else
215  AColor::Dark(&dc, false);
216 
217  AColor::Line(dc, r.x + r.width, r.y, r.x + r.width, r.y + r.height);
218  AColor::Line(dc, r.x, r.y + r.height, r.x + r.width, r.y + r.height);
219 }
static void Dark(wxDC *dc, bool selected, bool highlight=false)
Definition: AColor.cpp:338
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:122
static void Light(wxDC *dc, bool selected, bool highlight=false)
Definition: AColor.cpp:308
void AColor::Bevel2 ( wxDC &  dc,
bool  up,
const wxRect &  r,
bool  bSel = false,
bool  bHighlight = false 
)
static

Definition at line 222 of file AColor.cpp.

References ThemeBase::Bitmap(), and theTheme.

Referenced by TrackInfo::CloseTitleDrawFunction(), MixerBoard::MakeButtonBitmap(), TrackInfo::MinimizeSyncLockDrawFunction(), and TrackInfo::MuteOrSoloDrawFunction().

223 {
224  int index = 0;
225  // There are eight button states in the TCP.
226  // A theme might not differentiate between them all. That's up to
227  // the theme designer.
228  // Button highlighted (i.e. hovered over) or not.
229  // Track selected or not
230  // Button up or down.
231  // Highlight in most themes is lighter than not highlighted.
232  if ( bHighlight && bSel)
233  index = up ? bmpHiliteUpButtonExpandSel : bmpHiliteButtonExpandSel;
234  else if ( bHighlight )
235  index = up ? bmpHiliteUpButtonExpand : bmpHiliteButtonExpand;
236  else if( bSel )
237  index = up ? bmpUpButtonExpandSel : bmpDownButtonExpandSel;
238  else
239  index = up ? bmpUpButtonExpand : bmpDownButtonExpand;
240 
241  wxBitmap & Bmp = theTheme.Bitmap( index );
242  wxMemoryDC memDC;
243  memDC.SelectObject(Bmp);
244  int h = wxMin( r.height, Bmp.GetHeight() );
245 
246 
247  dc.Blit( r.x,r.y,r.width/2, h, &memDC, 0, 0 );
248  int r2 = r.width - r.width/2;
249  dc.Blit( r.x+r.width/2,r.y,r2, h, &memDC,
250  Bmp.GetWidth() - r2, 0 );
251 }
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
wxBitmap & Bitmap(int iIndex)
Definition: Theme.cpp:1244
void AColor::BevelTrackInfo ( wxDC &  dc,
bool  up,
const wxRect &  r,
bool  highlight = false 
)
static

Definition at line 262 of file AColor.cpp.

References ThemeBase::Colour(), and theTheme.

Referenced by AdornedRulerPanel::DoDrawEdge(), TrackInfo::DrawBackground(), and TrackArtist::DrawVRuler().

263 {
264 #ifndef EXPERIMENTAL_THEMING
265  Bevel( dc, up, r );
266 #else
267  wxColour col;
268  col = Blend( theTheme.Colour( clrTrackInfo ), up ? wxColour( 255,255,255):wxColour(0,0,0));
269 
270  wxPen pen( highlight ? uglyPen : col );
271  dc.SetPen( pen );
272 
273  dc.DrawLine(r.x, r.y, r.x + r.width, r.y);
274  dc.DrawLine(r.x, r.y, r.x, r.y + r.height);
275 
276  col = Blend( theTheme.Colour( clrTrackInfo ), up ? wxColour(0,0,0): wxColour(255,255,255));
277 
278  pen.SetColour( col );
279  dc.SetPen( highlight ? uglyPen : pen );
280 
281  dc.DrawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height);
282  dc.DrawLine(r.x, r.y + r.height, r.x + r.width + 1, r.y + r.height);
283 #endif
284 }
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
static wxPen uglyPen
Definition: AColor.h:147
static void Bevel(wxDC &dc, bool up, const wxRect &r)
Definition: AColor.cpp:202
static wxColour Blend(const wxColour &c1, const wxColour &c2)
Definition: AColor.cpp:253
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
wxColour AColor::Blend ( const wxColour &  c1,
const wxColour &  c2 
)
static

Definition at line 253 of file AColor.cpp.

254 {
255  wxColour c3(
256  (c1.Red() + c2.Red())/2,
257  (c1.Green() + c2.Green())/2,
258  (c1.Blue() + c2.Blue())/2);
259  return c3;
260 }
void AColor::CursorColor ( wxDC *  dc)
static

Definition at line 358 of file AColor.cpp.

Referenced by EditCursorOverlay::Draw().

359 {
360  if (!inited)
361  Init();
362 
363  dc->SetLogicalFunction(wxCOPY);
364  dc->SetPen(cursorPen);
365 }
static wxPen cursorPen
Definition: AColor.h:111
static void Init()
Definition: AColor.cpp:460
static bool inited
Definition: AColor.h:153
void AColor::Dark ( wxDC *  dc,
bool  selected,
bool  highlight = false 
)
static

Definition at line 338 of file AColor.cpp.

Referenced by Bevel(), TrackInfo::DrawBordersWithin(), Grabber::DrawGrabber(), TrackPanel::DrawShadow(), TrackArtist::DrawTimeSlider(), TrackInfo::MinimizeSyncLockDrawFunction(), ToolBarResizer::OnPaint(), and ToolDock::OnPaint().

339 {
340  if (!inited)
341  Init();
342  int index = (int) selected;
343  auto &brush = highlight ? AColor::uglyBrush : darkBrush[index];
344  dc->SetBrush( brush );
345  auto &pen = highlight ? AColor::uglyPen : darkPen[index];
346  dc->SetPen( pen );
347 }
static wxPen darkPen[2]
Definition: AColor.h:109
static wxBrush uglyBrush
Definition: AColor.h:148
static wxPen uglyPen
Definition: AColor.h:147
static void Init()
Definition: AColor.cpp:460
static bool inited
Definition: AColor.h:153
static wxBrush darkBrush[2]
Definition: AColor.h:106
void AColor::DarkMIDIChannel ( wxDC *  dc,
int  channel 
)
static

Definition at line 602 of file AColor.cpp.

603 {
604  if (channel >= 1 && channel <= 16) {
605  const int *colors = AColor_midicolors[channel - 1];
606 
607  dc->SetPen(wxPen(wxColour(colors[0] / 2,
608  colors[1] / 2,
609  colors[2] / 2), 1, wxSOLID));
610  dc->SetBrush(wxBrush(wxColour(colors[0] / 2,
611  colors[1] / 2,
612  colors[2] / 2), wxSOLID));
613  } else {
614  dc->SetPen(wxPen(wxColour(102, 102, 102), 1, wxSOLID));
615  dc->SetBrush(wxBrush(wxColour(102, 102, 102), wxSOLID));
616  }
617 
618 }
const int AColor_midicolors[16][3]
Definition: AColor.cpp:548
void AColor::DrawFocus ( wxDC &  dc,
wxRect &  r 
)
static

Definition at line 171 of file AColor.cpp.

Referenced by KeyView::OnDrawBackground(), AButton::OnPaint(), MeterPanel::OnPaint(), and ASlider::OnPaint().

172 {
173  // draw the pixels manually: note that to behave in the same manner as
174  // DrawRect(), we must exclude the bottom and right borders from the
175  // rectangle
176  wxCoord x1 = rect.GetLeft(),
177  y1 = rect.GetTop(),
178  x2 = rect.GetRight(),
179  y2 = rect.GetBottom();
180 
181  // -1 for brush, so it just sets the pen colour, and does not change the brush.
182  UseThemeColour( &dc, -1, clrTrackPanelText );
183 
184  wxCoord z;
185  for ( z = x1 + 1; z < x2; z += 2 )
186  dc.DrawPoint(z, y1);
187 
188  wxCoord shift = z == x2 ? 0 : 1;
189  for ( z = y1 + shift; z < y2; z += 2 )
190  dc.DrawPoint(x2, z);
191 
192  shift = z == y2 ? 0 : 1;
193  for ( z = x2 - shift; z > x1; z -= 2 )
194  dc.DrawPoint(z, y2);
195 
196  shift = z == x1 ? 0 : 1;
197  for ( z = y2 - shift; z > y1; z -= 2 )
198  dc.DrawPoint(x1, z);
199 
200 }
static void UseThemeColour(wxDC *dc, int iBrush, int iPen=-1)
Definition: AColor.cpp:289
void AColor::IndicatorColor ( wxDC *  dc,
bool  bIsNotRecording 
)
static

Definition at line 367 of file AColor.cpp.

Referenced by AdornedRulerPanel::DoDrawIndicator(), PlayIndicatorOverlayBase::Draw(), and QuickPlayIndicatorOverlay::Draw().

368 {
369  if (!inited)
370  Init();
371  int index = (int) bIsNotRecording;
372  dc->SetPen(indicatorPen[index]);
373  dc->SetBrush(indicatorBrush[index]);
374 }
static wxBrush indicatorBrush[2]
Definition: AColor.h:113
static void Init()
Definition: AColor.cpp:460
static bool inited
Definition: AColor.h:153
static wxPen indicatorPen[2]
Definition: AColor.h:112
void AColor::Init ( )
static

Definition at line 460 of file AColor.cpp.

References ThemeBase::Colour(), CursorColour(), ThemeBase::SetBrushColour(), ThemeBase::SetPenColour(), and theTheme.

Referenced by AudacityApp::OnInit().

461 {
462  if (inited)
463  return;
464 
465  wxColour light = theTheme.Colour( clrLight );
466  // wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT);
467  wxColour med = theTheme.Colour( clrMedium );
468  // wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
469  wxColour dark = theTheme.Colour( clrDark );
470  // wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW);
471 
472  wxColour lightSelected = theTheme.Colour( clrLightSelected );
473  wxColour medSelected = theTheme.Colour( clrMediumSelected );
474  wxColour darkSelected = theTheme.Colour( clrDarkSelected );
475 
476 
477  clippingPen.SetColour(0xCC, 0x11, 0x00);
478 
479  theTheme.SetPenColour( envelopePen, clrEnvelope );
480  theTheme.SetPenColour( WideEnvelopePen, clrEnvelope );
481  theTheme.SetBrushColour( envelopeBrush, clrEnvelope );
482 
483  WideEnvelopePen.SetWidth( 3 );
484 
485  theTheme.SetBrushColour( labelTextNormalBrush, clrLabelTextNormalBrush );
486  theTheme.SetBrushColour( labelTextEditBrush, clrLabelTextEditBrush );
487  theTheme.SetBrushColour( labelUnselectedBrush, clrLabelUnselectedBrush );
488  theTheme.SetBrushColour( labelSelectedBrush, clrLabelSelectedBrush );
489  theTheme.SetBrushColour( labelSyncLockSelBrush, clrSyncLockSel );
490  theTheme.SetPenColour( labelUnselectedPen, clrLabelUnselectedPen );
491  theTheme.SetPenColour( labelSelectedPen, clrLabelSelectedPen );
492  theTheme.SetPenColour( labelSyncLockSelPen, clrSyncLockSel );
493  theTheme.SetPenColour( labelSurroundPen, clrLabelSurroundPen );
494 
495  // These colors were modified to avoid using reserved colors red and green
496  // for the buttons.
497  theTheme.SetBrushColour( muteBrush[0], clrMuteButtonActive);
498  theTheme.SetBrushColour( muteBrush[1], clrMuteButtonVetoed);
499  theTheme.SetBrushColour( soloBrush, clrMuteButtonActive);
500 
501  cursorPen.SetColour( CursorColour() );
502  theTheme.SetPenColour( indicatorPen[0], clrRecordingPen);
503  theTheme.SetPenColour( indicatorPen[1], clrPlaybackPen);
504  theTheme.SetBrushColour( indicatorBrush[0], clrRecordingBrush);
505  theTheme.SetBrushColour( indicatorBrush[1], clrPlaybackBrush);
506 
507  theTheme.SetBrushColour( playRegionBrush[0],clrRulerRecordingBrush);
508  theTheme.SetPenColour( playRegionPen[0], clrRulerRecordingPen);
509  theTheme.SetBrushColour( playRegionBrush[1],clrRulerPlaybackBrush);
510  theTheme.SetPenColour( playRegionPen[1], clrRulerPlaybackPen);
511 
512  //Determine tooltip color
513  tooltipPen.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOTEXT) );
514  tooltipBrush.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOBK) );
515 
516  uglyPen.SetColour( wxColour{ 0, 255, 0 } ); // saturated green
517  uglyBrush.SetColour( wxColour{ 255, 0, 255 } ); // saturated magenta
518 
519  // A tiny gradient of yellow surrounding the current focused track
520  theTheme.SetPenColour( trackFocusPens[0], clrTrackFocus0);
521  theTheme.SetPenColour( trackFocusPens[1], clrTrackFocus1);
522  theTheme.SetPenColour( trackFocusPens[2], clrTrackFocus2);
523 
524  // A vertical line indicating that the selection or sliding has
525  // been snapped to the nearest boundary.
526  theTheme.SetPenColour( snapGuidePen, clrSnapGuide);
527 
528  // unselected
529  lightBrush[0].SetColour(light);
530  mediumBrush[0].SetColour(med);
531  darkBrush[0].SetColour(dark);
532  lightPen[0].SetColour(light);
533  mediumPen[0].SetColour(med);
534  darkPen[0].SetColour(dark);
535 
536  // selected
537  lightBrush[1].SetColour(lightSelected);
538  mediumBrush[1].SetColour(medSelected);
539  darkBrush[1].SetColour(darkSelected);
540  lightPen[1].SetColour(lightSelected);
541  mediumPen[1].SetColour(medSelected);
542  darkPen[1].SetColour(darkSelected);
543 
544  inited = true;
545 }
static wxBrush labelSelectedBrush
Definition: AColor.h:129
static wxPen tooltipPen
Definition: AColor.h:139
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
static wxBrush indicatorBrush[2]
Definition: AColor.h:113
static wxPen darkPen[2]
Definition: AColor.h:109
static wxBrush lightBrush[2]
Definition: AColor.h:104
static wxBrush uglyBrush
Definition: AColor.h:148
static wxBrush labelSyncLockSelBrush
Definition: AColor.h:130
static wxBrush labelTextNormalBrush
Definition: AColor.h:126
static wxPen mediumPen[2]
Definition: AColor.h:108
static wxBrush soloBrush
Definition: AColor.h:118
static wxBrush muteBrush[2]
Definition: AColor.h:117
static wxPen uglyPen
Definition: AColor.h:147
static wxPen lightPen[2]
Definition: AColor.h:107
static wxPen labelSyncLockSelPen
Definition: AColor.h:133
static wxPen envelopePen
Definition: AColor.h:122
static wxPen cursorPen
Definition: AColor.h:111
wxColour CursorColour()
Definition: AColor.cpp:445
void SetBrushColour(wxBrush &Brush, int iIndex)
Definition: Theme.cpp:1232
static wxBrush labelTextEditBrush
Definition: AColor.h:127
static bool inited
Definition: AColor.h:153
static wxBrush mediumBrush[2]
Definition: AColor.h:105
static wxBrush envelopeBrush
Definition: AColor.h:124
static wxBrush tooltipBrush
Definition: AColor.h:140
static wxPen labelSelectedPen
Definition: AColor.h:132
static wxBrush darkBrush[2]
Definition: AColor.h:106
static wxPen labelUnselectedPen
Definition: AColor.h:131
static wxPen snapGuidePen
Definition: AColor.h:137
static wxPen WideEnvelopePen
Definition: AColor.h:123
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
static wxPen labelSurroundPen
Definition: AColor.h:134
static wxPen indicatorPen[2]
Definition: AColor.h:112
static wxPen clippingPen
Definition: AColor.h:120
static wxPen playRegionPen[2]
Definition: AColor.h:114
static wxPen trackFocusPens[3]
Definition: AColor.h:136
void SetPenColour(wxPen &Pen, int iIndex)
Definition: Theme.cpp:1238
static wxBrush playRegionBrush[2]
Definition: AColor.h:115
static wxBrush labelUnselectedBrush
Definition: AColor.h:128
void AColor::Light ( wxDC *  dc,
bool  selected,
bool  highlight = false 
)
static

Definition at line 308 of file AColor.cpp.

Referenced by Bevel(), QuickPlayIndicatorOverlay::Draw(), Grabber::DrawGrabber(), and TrackArtist::DrawTimeSlider().

309 {
310  if (!inited)
311  Init();
312  int index = (int) selected;
313  auto &brush = highlight ? AColor::uglyBrush : lightBrush[index];
314  dc->SetBrush( brush );
315  auto &pen = highlight ? AColor::uglyPen : lightPen[index];
316  dc->SetPen( pen );
317 }
static wxBrush lightBrush[2]
Definition: AColor.h:104
static wxBrush uglyBrush
Definition: AColor.h:148
static wxPen uglyPen
Definition: AColor.h:147
static wxPen lightPen[2]
Definition: AColor.h:107
static void Init()
Definition: AColor.cpp:460
static bool inited
Definition: AColor.h:153
void AColor::LightMIDIChannel ( wxDC *  dc,
int  channel 
)
static

Definition at line 584 of file AColor.cpp.

585 {
586  if (channel >= 1 && channel <= 16) {
587  const int *colors = AColor_midicolors[channel - 1];
588 
589  dc->SetPen(wxPen(wxColour(127 + colors[0] / 2,
590  127 + colors[1] / 2,
591  127 + colors[2] / 2), 1, wxSOLID));
592  dc->SetBrush(wxBrush(wxColour(127 + colors[0] / 2,
593  127 + colors[1] / 2,
594  127 + colors[2] / 2), wxSOLID));
595  } else {
596  dc->SetPen(wxPen(wxColour(204, 204, 204), 1, wxSOLID));
597  dc->SetBrush(wxBrush(wxColour(204, 204, 204), wxSOLID));
598  }
599 
600 }
const int AColor_midicolors[16][3]
Definition: AColor.cpp:548
void AColor::Line ( wxDC &  dc,
wxCoord  x1,
wxCoord  y1,
wxCoord  x2,
wxCoord  y2 
)
static

Definition at line 122 of file AColor.cpp.

Referenced by Bevel(), TrackInfo::CloseTitleDrawFunction(), EditCursorOverlay::Draw(), PlayIndicatorOverlayBase::Draw(), TimeTrack::Draw(), SnapManager::Draw(), LabelTrack::Draw(), QuickPlayIndicatorOverlay::Draw(), TrackPanel::DrawBordersAroundTrack(), TrackInfo::DrawBordersWithin(), TrackArtist::DrawClipWaveform(), TrackArtist::DrawEnvLine(), Grabber::DrawGrabber(), TrackArtist::DrawIndividualSamples(), LabelStruct::DrawLines(), MeterPanel::DrawMeterBar(), TrackArtist::DrawMinMaxRMS(), TrackArtist::DrawNegativeOffsetTrackArrows(), FreqWindow::DrawPlot(), TrackPanel::DrawShadow(), TrackArtist::DrawTimeSlider(), LWSlider::DrawToBitmap(), TrackArtist::DrawVRuler(), TrackArtist::DrawWaveform(), TrackArtist::DrawWaveformBackground(), KeyView::OnDrawItem(), ToolBarResizer::OnPaint(), EffectAutoDuckPanel::OnPaint(), EffectCompressorPanel::OnPaint(), EffectScienFilterPanel::OnPaint(), ToolFrame::OnPaint(), ExportMixerPanel::OnPaint(), EqualizationPanel::OnPaint(), ToolDock::OnPaint(), AudacityPrintout::OnPrintPage(), and FreqWindow::PlotPaint().

123 {
124  // As of 2.8.9 (possibly earlier), wxDC::DrawLine() on the Mac draws the
125  // last point since it is now based on the NEW wxGraphicsContext system.
126  // Make the other platforms do the same thing since the other platforms
127  // "may" follow they get wxGraphicsContext going.
128 #if defined(__WXMAC__) || defined(__WXGTK3__)
129  dc.DrawLine(x1, y1, x2, y2);
130 #else
131  bool point = false;
132 
133  if (x1 == x2) {
134  if (y1 < y2) {
135  y2++;
136  }
137  else if (y2 < y1) {
138  y1++;
139  }
140  else {
141  point = true;
142  }
143  }
144  else if (y1 == y2) {
145  if (x1 < x2) {
146  x2++;
147  }
148  else if (x2 < x1) {
149  x1++;
150  }
151  else {
152  point = true;
153  }
154  }
155  else {
156  dc.DrawPoint(x2, y2);
157  }
158 
159  if (point) {
160  dc.DrawPoint(x2, y2);
161  }
162  else {
163  dc.DrawLine(x1, y1, x2, y2);
164  }
165 #endif
166 }
void AColor::Medium ( wxDC *  dc,
bool  selected 
)
static

Definition at line 319 of file AColor.cpp.

Referenced by Grabber::DrawGrabber().

320 {
321  if (!inited)
322  Init();
323  int index = (int) selected;
324  dc->SetBrush(mediumBrush[index]);
325  dc->SetPen(mediumPen[index]);
326 }
static wxPen mediumPen[2]
Definition: AColor.h:108
static void Init()
Definition: AColor.cpp:460
static bool inited
Definition: AColor.h:153
static wxBrush mediumBrush[2]
Definition: AColor.h:105
void AColor::MediumTrackInfo ( wxDC *  dc,
bool  selected 
)
static

Definition at line 328 of file AColor.cpp.

Referenced by TrackInfo::DrawBackground(), TrackInfo::MuteOrSoloDrawFunction(), and MixerTrackCluster::OnPaint().

329 {
330 #ifdef EXPERIMENTAL_THEMING
331  UseThemeColour( dc, selected ? clrTrackInfoSelected : clrTrackInfo );
332 #else
333  Medium( dc, selected );
334 #endif
335 }
static void Medium(wxDC *dc, bool selected)
Definition: AColor.cpp:319
static void UseThemeColour(wxDC *dc, int iBrush, int iPen=-1)
Definition: AColor.cpp:289
void AColor::MIDIChannel ( wxDC *  dc,
int  channel 
)
static

Definition at line 568 of file AColor.cpp.

569 {
570  if (channel >= 1 && channel <= 16) {
571  const int *colors = AColor_midicolors[channel - 1];
572 
573  dc->SetPen(wxPen(wxColour(colors[0],
574  colors[1], colors[2]), 1, wxSOLID));
575  dc->SetBrush(wxBrush(wxColour(colors[0],
576  colors[1], colors[2]), wxSOLID));
577  } else {
578  dc->SetPen(wxPen(wxColour(153, 153, 153), 1, wxSOLID));
579  dc->SetBrush(wxBrush(wxColour(153, 153, 153), wxSOLID));
580  }
581 
582 }
const int AColor_midicolors[16][3]
Definition: AColor.cpp:548
void AColor::Mute ( wxDC *  dc,
bool  on,
bool  selected,
bool  soloing 
)
static

Definition at line 398 of file AColor.cpp.

Referenced by TrackInfo::MuteOrSoloDrawFunction().

399 {
400  if (!inited)
401  Init();
402  int index = (int) selected;
403  if (on) {
404  dc->SetPen(*wxBLACK_PEN);
405  dc->SetBrush(muteBrush[(int) soloing]);
406  }
407  else {
408  dc->SetPen(*wxTRANSPARENT_PEN);
409  dc->SetBrush(mediumBrush[index]);
410  }
411 }
static wxBrush muteBrush[2]
Definition: AColor.h:117
static void Init()
Definition: AColor.cpp:460
static bool inited
Definition: AColor.h:153
static wxBrush mediumBrush[2]
Definition: AColor.h:105
void AColor::PlayRegionColor ( wxDC *  dc,
bool  locked 
)
static

Definition at line 376 of file AColor.cpp.

Referenced by AdornedRulerPanel::DoDrawPlayRegion().

377 {
378  if (!inited)
379  Init();
380  dc->SetPen(playRegionPen[(int)locked]);
381  dc->SetBrush(playRegionBrush[(int)locked]);
382 }
static void Init()
Definition: AColor.cpp:460
static bool inited
Definition: AColor.h:153
static wxPen playRegionPen[2]
Definition: AColor.h:114
static wxBrush playRegionBrush[2]
Definition: AColor.h:115
void AColor::PreComputeGradient ( )
static

Definition at line 624 of file AColor.cpp.

References ThemeBase::Colour(), and theTheme.

Referenced by TrackArtist::DrawClipSpectrum().

624  {
625  {
626  if (!gradient_inited) {
627  gradient_inited = 1;
628 
629  for (int selected = 0; selected < ColorGradientTotal; selected++)
630  for (int grayscale = 0; grayscale <= 1; grayscale++) {
631  float r, g, b;
632 
633  int i;
634  for (i=0; i<gradientSteps; i++) {
635  float value = float(i)/gradientSteps;
636 
637  if (grayscale) {
638  r = g = b = 0.84 - 0.84 * value;
639  } else {
640  const int gsteps = 4;
641  float gradient[gsteps + 1][3];
642  theTheme.Colour( clrSpectro1 ) = theTheme.Colour( clrUnselected );
643  theTheme.Colour( clrSpectro1Sel ) = theTheme.Colour( clrSelected );
644  int clrFirst = (selected == ColorGradientUnselected ) ? clrSpectro1 : clrSpectro1Sel;
645  for(int j=0;j<(gsteps+1);j++){
646  wxColour c = theTheme.Colour( clrFirst+j );
647  gradient[ j] [0] = c.Red()/255.0;
648  gradient[ j] [1] = c.Green()/255.0;
649  gradient[ j] [2] = c.Blue()/255.0;
650  }
651 
652 
653  int left = (int)(value * gsteps);
654  int right = (left == gsteps ? gsteps : left + 1);
655 
656  float rweight = (value * gsteps) - left;
657  float lweight = 1.0 - rweight;
658 
659  r = (gradient[left][0] * lweight) + (gradient[right][0] * rweight);
660  g = (gradient[left][1] * lweight) + (gradient[right][1] * rweight);
661  b = (gradient[left][2] * lweight) + (gradient[right][2] * rweight);
662  }
663 
664  switch (selected) {
666  // not dimmed
667  break;
668 
670  if( !grayscale )
671  {
672  float temp;
673  temp = r;
674  r = g;
675  g = b;
676  b = temp;
677  break;
678  }
679  // else fall through to SAME grayscale colour as normal selection.
680  // The white lines show it up clearly enough.
681 
683  // partly dimmed
684  r *= 0.75f;
685  g *= 0.75f;
686  b *= 0.75f;
687  break;
688 
689 
690  // For now edge colour is just black (or white if grey-scale)
691  // Later we might invert or something else funky.
692  case ColorGradientEdge:
693  // fully dimmed
694  r = 1.0f * grayscale;
695  g = 1.0f * grayscale;
696  b = 1.0f * grayscale;
697  break;
698  }
699  gradient_pre[selected][grayscale][i][0] = (unsigned char) (255 * r);
700  gradient_pre[selected][grayscale][i][1] = (unsigned char) (255 * g);
701  gradient_pre[selected][grayscale][i][2] = (unsigned char) (255 * b);
702  }
703  }
704  }
705  }
706 }
static const int gradientSteps
Definition: AColor.h:143
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
static bool gradient_inited
Definition: AColor.h:142
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
static unsigned char gradient_pre[ColorGradientTotal][2][gradientSteps][3]
Definition: AColor.h:144
void AColor::ReInit ( )
static

Definition at line 430 of file AColor.cpp.

Referenced by Theme::ApplyUpdatedImages().

431 {
432  inited=false;
433  Init();
434  gradient_inited=0;
436 }
static void Init()
Definition: AColor.cpp:460
static void PreComputeGradient()
Definition: AColor.cpp:624
static bool inited
Definition: AColor.h:153
static bool gradient_inited
Definition: AColor.h:142
void AColor::SnapGuidePen ( wxDC *  dc)
static

Definition at line 391 of file AColor.cpp.

Referenced by SnapManager::Draw(), and QuickPlayIndicatorOverlay::Draw().

392 {
393  if (!inited)
394  Init();
395  dc->SetPen(snapGuidePen);
396 }
static void Init()
Definition: AColor.cpp:460
static bool inited
Definition: AColor.h:153
static wxPen snapGuidePen
Definition: AColor.h:137
void AColor::Solo ( wxDC *  dc,
bool  on,
bool  selected 
)
static

Definition at line 413 of file AColor.cpp.

Referenced by TrackInfo::MuteOrSoloDrawFunction().

414 {
415  if (!inited)
416  Init();
417  int index = (int) selected;
418  if (on) {
419  dc->SetPen(*wxBLACK_PEN);
420  dc->SetBrush(soloBrush);
421  }
422  else {
423  dc->SetPen(*wxTRANSPARENT_PEN);
424  dc->SetBrush(mediumBrush[index]);
425  }
426 }
static wxBrush soloBrush
Definition: AColor.h:118
static void Init()
Definition: AColor.cpp:460
static bool inited
Definition: AColor.h:153
static wxBrush mediumBrush[2]
Definition: AColor.h:105
void AColor::TrackFocusPen ( wxDC *  dc,
int  level 
)
static

Definition at line 384 of file AColor.cpp.

Referenced by TrackPanel::HighlightFocusedTrack().

385 {
386  if (!inited)
387  Init();
388  dc->SetPen(trackFocusPens[level]);
389 }
static void Init()
Definition: AColor.cpp:460
static bool inited
Definition: AColor.h:153
static wxPen trackFocusPens[3]
Definition: AColor.h:136
void AColor::TrackPanelBackground ( wxDC *  dc,
bool  selected 
)
static

Definition at line 349 of file AColor.cpp.

Referenced by TrackPanel::DrawEverythingElse(), and TrackPanel::DrawOutsideOfTrack().

350 {
351 #ifdef EXPERIMENTAL_THEMING
352  UseThemeColour( dc, selected ? clrMediumSelected : clrTrackBackground );
353 #else
354  Dark( dc, selected );
355 #endif
356 }
static void Dark(wxDC *dc, bool selected, bool highlight=false)
Definition: AColor.cpp:338
static void UseThemeColour(wxDC *dc, int iBrush, int iPen=-1)
Definition: AColor.cpp:289
void AColor::UseThemeColour ( wxDC *  dc,
int  iBrush,
int  iPen = -1 
)
static

Definition at line 289 of file AColor.cpp.

References ThemeBase::Colour(), and theTheme.

Referenced by AdornedRulerPanel::DoDrawBackground(), TimeTrack::Draw(), LWSlider::DrawToBitmap(), TrackArtist::DrawTrack(), and MixerBoard::MakeButtonBitmap().

290 {
291  if (!inited)
292  Init();
293  // do nothing if no colours set.
294  if( (iBrush == -1) && ( iPen ==-1))
295  return;
296  wxColour col = wxColour(0,0,0);
297  if( iBrush !=-1 ){
298  col = theTheme.Colour( iBrush );
299  spareBrush.SetColour( col );
300  dc->SetBrush( spareBrush );
301  }
302  if( iPen != -1)
303  col = theTheme.Colour( iPen );
304  sparePen.SetColour( col );
305  dc->SetPen( sparePen );
306 }
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
static wxPen sparePen
Definition: AColor.h:151
static wxBrush spareBrush
Definition: AColor.h:152
static void Init()
Definition: AColor.cpp:460
static bool inited
Definition: AColor.h:153
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225

Member Data Documentation

wxPen AColor::clippingPen
static

Definition at line 120 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxPen AColor::cursorPen
static

Definition at line 111 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxBrush AColor::darkBrush
static

Definition at line 106 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxPen AColor::darkPen
static

Definition at line 109 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxBrush AColor::envelopeBrush
static
wxPen AColor::envelopePen
static
bool AColor::gradient_inited = 0
static

Definition at line 142 of file AColor.h.

Referenced by TrackArtist::DrawClipSpectrum().

unsigned char AColor::gradient_pre
static

Definition at line 144 of file AColor.h.

Referenced by GetColorGradient().

const int AColor::gradientSteps = 512
static

Definition at line 143 of file AColor.h.

Referenced by GetColorGradient().

wxBrush AColor::indicatorBrush
static

Definition at line 113 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxPen AColor::indicatorPen
static

Definition at line 112 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

bool AColor::inited = false
staticprivate

Definition at line 153 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxBrush AColor::labelSelectedBrush
static

Definition at line 129 of file AColor.h.

Referenced by ADCChanger::ADCChanger(), and LabelTrack::Draw().

wxPen AColor::labelSelectedPen
static

Definition at line 132 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxPen AColor::labelSurroundPen
static

Definition at line 134 of file AColor.h.

Referenced by ADCChanger::ADCChanger(), and LabelTrack::Draw().

wxBrush AColor::labelSyncLockSelBrush
static

Definition at line 130 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxPen AColor::labelSyncLockSelPen
static

Definition at line 133 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxBrush AColor::labelTextEditBrush
static

Definition at line 127 of file AColor.h.

Referenced by ADCChanger::ADCChanger(), and LabelTrack::Draw().

wxBrush AColor::labelTextNormalBrush
static

Definition at line 126 of file AColor.h.

Referenced by ADCChanger::ADCChanger(), and LabelTrack::Draw().

wxBrush AColor::labelUnselectedBrush
static

Definition at line 128 of file AColor.h.

Referenced by ADCChanger::ADCChanger(), and LabelTrack::Draw().

wxPen AColor::labelUnselectedPen
static

Definition at line 131 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxBrush AColor::lightBrush
static

Definition at line 104 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxPen AColor::lightPen
static

Definition at line 107 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxBrush AColor::mediumBrush
static

Definition at line 105 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxPen AColor::mediumPen
static

Definition at line 108 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxBrush AColor::muteBrush
static

Definition at line 117 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxBrush AColor::playRegionBrush
static

Definition at line 115 of file AColor.h.

Referenced by ADCChanger::ADCChanger(), and ExportMixerPanel::OnPaint().

wxPen AColor::playRegionPen
static

Definition at line 114 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxPen AColor::snapGuidePen
static

Definition at line 137 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxBrush AColor::soloBrush
static

Definition at line 118 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxBrush AColor::spareBrush
staticprivate

Definition at line 152 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxPen AColor::sparePen
staticprivate

Definition at line 151 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxBrush AColor::tooltipBrush
static

Definition at line 140 of file AColor.h.

Referenced by ADCChanger::ADCChanger(), and TipPanel::OnPaint().

wxPen AColor::tooltipPen
static

Definition at line 139 of file AColor.h.

Referenced by ADCChanger::ADCChanger(), and TipPanel::OnPaint().

wxPen AColor::trackFocusPens
static

Definition at line 136 of file AColor.h.

Referenced by ADCChanger::ADCChanger().

wxBrush AColor::uglyBrush
static
wxPen AColor::uglyPen
static
wxPen AColor::WideEnvelopePen
static

Definition at line 123 of file AColor.h.

Referenced by ADCChanger::ADCChanger(), and EffectCompressorPanel::OnPaint().


The documentation for this class was generated from the following files: