Audacity  2.2.2
AColor.cpp
Go to the documentation of this file.
1 
2 /**********************************************************************
3 
4  Audacity: A Digital Audio Editor
5 
6  AColor.cpp
7 
8  Dominic Mazzoni
9 
10 
11 ********************************************************************//********************************************************************/
19 
20 #include "Audacity.h"
21 #include <wx/window.h>
22 #include <wx/colour.h>
23 #include <wx/dc.h>
24 #include <wx/dcmemory.h>
25 #include <wx/settings.h>
26 #include <wx/utils.h>
27 
28 #include "AColor.h"
29 #include "Theme.h"
30 #include "Experimental.h"
31 #include "AllThemeResources.h"
32 
33 void DCUnchanger::operator () (wxDC *pDC) const
34 {
35  if (pDC) {
36  pDC->SetPen(pen);
37  pDC->SetBrush(brush);
38  pDC->SetLogicalFunction(wxRasterOperationMode(logicalOperation));
39  }
40 }
41 
43  : Base{ pDC, ::DCUnchanger{ pDC->GetBrush(), pDC->GetPen(),
44  long(pDC->GetLogicalFunction()) } }
45 {}
46 
47 bool AColor::inited = false;
48 wxBrush AColor::lightBrush[2];
49 wxBrush AColor::mediumBrush[2];
50 wxBrush AColor::darkBrush[2];
51 wxPen AColor::lightPen[2];
52 wxPen AColor::mediumPen[2];
53 wxPen AColor::darkPen[2];
54 
55 wxPen AColor::cursorPen;
56 wxBrush AColor::indicatorBrush[2];
57 wxPen AColor::indicatorPen[2];
58 wxPen AColor::playRegionPen[2];
59 wxBrush AColor::playRegionBrush[2];
60 
61 wxBrush AColor::muteBrush[2];
62 wxBrush AColor::soloBrush;
63 
65 
66 wxBrush AColor::envelopeBrush;
69 
79 wxPen AColor::trackFocusPens[3];
81 
82 wxPen AColor::tooltipPen;
83 wxBrush AColor::tooltipBrush;
84 
85 // The spare pen and brush possibly help us cut down on the
86 // number of pens and brushes we need.
87 wxPen AColor::sparePen;
88 wxBrush AColor::spareBrush;
89 
90 wxPen AColor::uglyPen;
91 wxBrush AColor::uglyBrush;
92 
93 //
94 // Draw an upward or downward pointing arrow.
95 //
96 void AColor::Arrow(wxDC & dc, wxCoord x, wxCoord y, int width, bool down)
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 }
118 
119 //
120 // Draw a line while accounting for differences in wxWidgets versions
121 //
122 void AColor::Line(wxDC & dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
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 }
167 
168 //
169 // Draws a focus rectangle (Taken directly from wxWidgets source)
170 //
171 void AColor::DrawFocus(wxDC & dc, wxRect & rect)
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 }
201 
202 void AColor::Bevel(wxDC & dc, bool up, const wxRect & r)
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 }
220 
221 void AColor::Bevel2
222 (wxDC & dc, bool up, const wxRect & r, bool bSel, bool bHighlight)
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 }
252 
253 wxColour AColor::Blend( const wxColour & c1, const wxColour & c2 )
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 }
261 
262 void AColor::BevelTrackInfo(wxDC & dc, bool up, const wxRect & r, bool highlight)
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 }
285 
286 // Set colour of and select brush and pen.
287 // Use -1 to omit brush or pen.
288 // If pen omitted, then the same colour as the brush will be used.
289 void AColor::UseThemeColour( wxDC * dc, int iBrush, int iPen )
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 }
307 
308 void AColor::Light(wxDC * dc, bool selected, bool highlight)
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 }
318 
319 void AColor::Medium(wxDC * dc, bool selected)
320 {
321  if (!inited)
322  Init();
323  int index = (int) selected;
324  dc->SetBrush(mediumBrush[index]);
325  dc->SetPen(mediumPen[index]);
326 }
327 
328 void AColor::MediumTrackInfo(wxDC * dc, bool selected)
329 {
330 #ifdef EXPERIMENTAL_THEMING
331  UseThemeColour( dc, selected ? clrTrackInfoSelected : clrTrackInfo );
332 #else
333  Medium( dc, selected );
334 #endif
335 }
336 
337 
338 void AColor::Dark(wxDC * dc, bool selected, bool highlight)
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 }
348 
349 void AColor::TrackPanelBackground(wxDC * dc, bool selected)
350 {
351 #ifdef EXPERIMENTAL_THEMING
352  UseThemeColour( dc, selected ? clrMediumSelected : clrTrackBackground );
353 #else
354  Dark( dc, selected );
355 #endif
356 }
357 
358 void AColor::CursorColor(wxDC * dc)
359 {
360  if (!inited)
361  Init();
362 
363  dc->SetLogicalFunction(wxCOPY);
364  dc->SetPen(cursorPen);
365 }
366 
367 void AColor::IndicatorColor(wxDC * dc, bool bIsNotRecording)
368 {
369  if (!inited)
370  Init();
371  int index = (int) bIsNotRecording;
372  dc->SetPen(indicatorPen[index]);
373  dc->SetBrush(indicatorBrush[index]);
374 }
375 
376 void AColor::PlayRegionColor(wxDC * dc, bool locked)
377 {
378  if (!inited)
379  Init();
380  dc->SetPen(playRegionPen[(int)locked]);
381  dc->SetBrush(playRegionBrush[(int)locked]);
382 }
383 
384 void AColor::TrackFocusPen(wxDC * dc, int level)
385 {
386  if (!inited)
387  Init();
388  dc->SetPen(trackFocusPens[level]);
389 }
390 
391 void AColor::SnapGuidePen(wxDC * dc)
392 {
393  if (!inited)
394  Init();
395  dc->SetPen(snapGuidePen);
396 }
397 
398 void AColor::Mute(wxDC * dc, bool on, bool selected, bool soloing)
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 }
412 
413 void AColor::Solo(wxDC * dc, bool on, bool selected)
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 }
427 
428 bool AColor::gradient_inited = 0;
429 
431 {
432  inited=false;
433  Init();
434  gradient_inited=0;
435  PreComputeGradient();
436 }
437 
438 wxColour InvertOfColour( const wxColour & c )
439 {
440  return wxColour( 255-c.Red(), 255-c.Green(), 255-c.Blue() );
441 }
442 
443 // Fix up the cursor colour, if it is 'unacceptable'.
444 // Unacceptable if it is too close to the background colour.
445 wxColour CursorColour( )
446 {
447  wxColour cCursor = theTheme.Colour( clrCursorPen );
448  wxColour cBack = theTheme.Colour( clrMedium );
449 
450  int d = theTheme.ColourDistance( cCursor, cBack );
451 
452  // Pen colour is fine, if there is plenty of contrast.
453  if( d > 200 )
454  return clrCursorPen;
455 
456  // otherwise return same colour as a selection.
457  return theTheme.Colour( clrSelected );
458 }
459 
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 }
546 
547 // These colours are chosen so that black text shows up OK on them.
548 const int AColor_midicolors[16][3] = {
549  {255, 102, 102}, // 1=salmon
550  {204, 0, 0}, // 2=red
551  {255, 117, 23}, // 3=orange
552  {255, 255, 0}, // 4=yellow
553  {0, 204, 0}, // 5=green
554  {0, 204, 204}, // 6=turquoise
555  {125, 125, 255}, // 7=blue
556  {153, 0, 255}, // 8=blue-violet
557 
558  {140, 97, 54}, // 9=brown
559  {120, 120, 120}, // 10=gray (drums)
560  {255, 175, 40}, // 11=lt orange
561  {102, 255, 102}, // 12=lt green
562  {153, 255, 255}, // 13=lt turquoise
563  {190, 190, 255}, // 14=lt blue
564  {204, 102, 255}, // 15=lt blue-violet
565  {255, 51, 204} // 16=lt red-violet
566 };
567 
568 void AColor::MIDIChannel(wxDC * dc, int channel /* 1 - 16 */ )
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 }
583 
584 void AColor::LightMIDIChannel(wxDC * dc, int channel /* 1 - 16 */ )
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 }
601 
602 void AColor::DarkMIDIChannel(wxDC * dc, int channel /* 1 - 16 */ )
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 }
619 
620 
621 
622 unsigned char AColor::gradient_pre[ColorGradientTotal][2][gradientSteps][3];
623 
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) {
665  case ColorGradientUnselected:
666  // not dimmed
667  break;
668 
669  case ColorGradientTimeAndFrequencySelected:
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 
682  case ColorGradientTimeSelected:
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 void PlayRegionColor(wxDC *dc, bool locked)
Definition: AColor.cpp:376
long logicalOperation
Definition: AColor.h:37
static wxBrush labelSelectedBrush
Definition: AColor.h:129
static wxPen tooltipPen
Definition: AColor.h:139
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
const int AColor_midicolors[16][3]
Definition: AColor.cpp:548
static wxBrush indicatorBrush[2]
Definition: AColor.h:113
int ColourDistance(wxColour &From, wxColour &To)
Definition: Theme.cpp:366
static wxPen darkPen[2]
Definition: AColor.h:109
static void CursorColor(wxDC *dc)
Definition: AColor.cpp:358
static wxBrush lightBrush[2]
Definition: AColor.h:104
static void DarkMIDIChannel(wxDC *dc, int channel)
Definition: AColor.cpp:602
wxColour InvertOfColour(const wxColour &c)
Definition: AColor.cpp:438
static void TrackPanelBackground(wxDC *dc, bool selected)
Definition: AColor.cpp:349
static void Arrow(wxDC &dc, wxCoord x, wxCoord y, int width, bool down=true)
Definition: AColor.cpp:96
static wxBrush uglyBrush
Definition: AColor.h:148
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
Definition: AColor.cpp:222
static wxBrush labelSyncLockSelBrush
Definition: AColor.h:130
static wxBrush labelTextNormalBrush
Definition: AColor.h:126
static wxPen mediumPen[2]
Definition: AColor.h:108
Used to restore pen, brush and logical-op in a DC back to what they were.
Definition: AColor.h:25
static wxBrush soloBrush
Definition: AColor.h:118
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:328
static void ReInit()
Definition: AColor.cpp:430
static void DrawFocus(wxDC &dc, wxRect &r)
Definition: AColor.cpp:171
static void Dark(wxDC *dc, bool selected, bool highlight=false)
Definition: AColor.cpp:338
static wxBrush muteBrush[2]
Definition: AColor.h:117
static wxPen uglyPen
Definition: AColor.h:147
static void Medium(wxDC *dc, bool selected)
Definition: AColor.cpp:319
static wxPen lightPen[2]
Definition: AColor.h:107
static void IndicatorColor(wxDC *dc, bool bIsNotRecording)
Definition: AColor.cpp:367
wxBitmap & Bitmap(int iIndex)
Definition: Theme.cpp:1227
static wxPen labelSyncLockSelPen
Definition: AColor.h:133
static wxPen envelopePen
Definition: AColor.h:122
static wxPen cursorPen
Definition: AColor.h:111
wxBrush brush
Definition: AColor.h:35
wxPen pen
Definition: AColor.h:36
wxColour CursorColour()
Definition: AColor.cpp:445
static void Mute(wxDC *dc, bool on, bool selected, bool soloing)
Definition: AColor.cpp:398
static void LightMIDIChannel(wxDC *dc, int channel)
Definition: AColor.cpp:584
static void Bevel(wxDC &dc, bool up, const wxRect &r)
Definition: AColor.cpp:202
void SetBrushColour(wxBrush &Brush, int iIndex)
Definition: Theme.cpp:1215
static wxPen sparePen
Definition: AColor.h:151
static void Solo(wxDC *dc, bool on, bool selected)
Definition: AColor.cpp:413
static wxBrush spareBrush
Definition: AColor.h:152
static wxBrush labelTextEditBrush
Definition: AColor.h:127
static void MIDIChannel(wxDC *dc, int channel)
Definition: AColor.cpp:568
static void Init()
Definition: AColor.cpp:460
static void PreComputeGradient()
Definition: AColor.cpp:624
static void UseThemeColour(wxDC *dc, int iBrush, int iPen=-1)
Definition: AColor.cpp:289
static bool inited
Definition: AColor.h:153
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:122
static wxBrush mediumBrush[2]
Definition: AColor.h:105
static void Light(wxDC *dc, bool selected, bool highlight=false)
Definition: AColor.cpp:308
static wxBrush envelopeBrush
Definition: AColor.h:124
std::unique_ptr< wxDC,::DCUnchanger > Base
Definition: AColor.h:44
static wxBrush tooltipBrush
Definition: AColor.h:140
static void TrackFocusPen(wxDC *dc, int level)
Definition: AColor.cpp:384
static wxPen labelSelectedPen
Definition: AColor.h:132
static void SnapGuidePen(wxDC *dc)
Definition: AColor.cpp:391
static wxBrush darkBrush[2]
Definition: AColor.h:106
static wxPen labelUnselectedPen
Definition: AColor.h:131
static wxColour Blend(const wxColour &c1, const wxColour &c2)
Definition: AColor.cpp:253
static wxPen snapGuidePen
Definition: AColor.h:137
void operator()(wxDC *pDC) const
Definition: AColor.cpp:33
static bool gradient_inited
Definition: AColor.h:142
static void BevelTrackInfo(wxDC &dc, bool up, const wxRect &r, bool highlight=false)
Definition: AColor.cpp:262
static wxPen WideEnvelopePen
Definition: AColor.h:123
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1208
#define wxRasterOperationMode
Definition: ImageRoll.h:23
static wxPen labelSurroundPen
Definition: AColor.h:134
static wxPen indicatorPen[2]
Definition: AColor.h:112
static unsigned char gradient_pre[ColorGradientTotal][2][gradientSteps][3]
Definition: AColor.h:144
static wxPen clippingPen
Definition: AColor.h:120
static wxPen playRegionPen[2]
Definition: AColor.h:114
static wxPen trackFocusPens[3]
Definition: AColor.h:136
ADCChanger()
Definition: AColor.h:46
void SetPenColour(wxPen &Pen, int iIndex)
Definition: Theme.cpp:1221
static wxBrush playRegionBrush[2]
Definition: AColor.h:115
static wxBrush labelUnselectedBrush
Definition: AColor.h:128