25#include <wx/dcmemory.h>
26#include <wx/graphics.h>
27#include <wx/settings.h>
87 memDC.SelectObject(bitmap);
91 const auto uw0 = bitmap.GetWidth() / 2;
93 const auto uw2 = bitmap.GetWidth() - uw0 - uw1;
95 const auto vh0 = bitmap.GetHeight() / 2;
97 const auto vh2 = bitmap.GetHeight() - vh1 - vh0;
101 const auto u2 = uw0 + uw1;
105 const auto v2 = vh0 + vh1;
109 const auto xw0 =
std::min(uw0, r.width / 2);
110 const auto xw2 =
std::min(uw2, r.width / 2);
111 const auto xw1 = r.width - xw0 - xw2;
113 const auto yh0 =
std::min(vh0, r.height / 2);
114 const auto yh2 =
std::min(vh2, r.height / 2);
115 const auto yh1 = r.height - yh0 - yh2;
118 const auto x1 = r.x + xw0;
119 const auto x2 = r.x + xw0 + xw1;
122 const auto y1 = r.y + yh0;
123 const auto y2 = r.y + yh0 + yh1;
125 dc.StretchBlit(x0, y0, xw0, yh0, &memDC, u0, v0, uw0, vh0, wxCOPY,
true);
126 dc.StretchBlit(x1, y0, xw1, yh0, &memDC, u1, v0, uw1, vh0, wxCOPY,
true);
127 dc.StretchBlit(x2, y0, xw2, yh0, &memDC, u2, v0, uw2, vh0, wxCOPY,
true);
129 dc.StretchBlit(x0, y1, xw0, yh1, &memDC, u0, v1, uw0, vh1, wxCOPY,
true);
130 dc.StretchBlit(x1, y1, xw1, yh1, &memDC, u1, v1, uw1, vh1, wxCOPY,
true);
131 dc.StretchBlit(x2, y1, xw2, yh1, &memDC, u2, v1, uw2, vh1, wxCOPY,
true);
133 dc.StretchBlit(x0, y2, xw0, yh2, &memDC, u0, v2, uw0, vh2, wxCOPY,
true);
134 dc.StretchBlit(x1, y2, xw1, yh2, &memDC, u1, v2, uw1, vh2, wxCOPY,
true);
135 dc.StretchBlit(x2, y2, xw2, yh2, &memDC, u2, v2, uw2, vh2, wxCOPY,
true);
147 if ( highlight && selected)
148 return up ? bmpHiliteUpButtonExpandSel : bmpHiliteButtonExpandSel;
150 return up ? bmpHiliteUpButtonExpand : bmpHiliteButtonExpand;
152 return up ? bmpUpButtonExpandSel : bmpDownButtonExpandSel;
153 return up ? bmpUpButtonExpand : bmpDownButtonExpand;
167 int half = width / 2;
170 pt[0].x = 0; pt[0].y = 0;
171 pt[1].x = width; pt[1].y = 0;
172 pt[2].x = half; pt[2].y = half;
175 pt[0].x = 0; pt[0].y = half;
176 pt[1].x = half; pt[1].y = 0;
177 pt[2].x = width; pt[2].y = half;
180 dc.DrawPolygon(3, pt, x, y);
187void AColor::Line(wxDC & dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
189 const wxPoint points[] { { x1, y1 }, { x2, y2 } };
190 Lines( dc, 2, points );
196 if ( nPoints <= 1 ) {
198 dc.DrawPoint( points[0] );
202 for (
size_t ii = 0; ii < nPoints - 1; ++ii) {
203 const auto &p1 = points[ii];
204 const auto &p2 = points[ii + 1];
215#if defined(__WXMAC__) || defined(__WXGTK3__)
225#if defined(__WXMAC__) || defined(__WXGTK3__)
228 dc.DrawPoint( points[ nPoints - 1 ] );
240 wxCoord x1 = rect.GetLeft(),
242 x2 = rect.GetRight(),
243 y2 = rect.GetBottom();
249 for ( z = x1 + 1; z < x2; z += 2 )
252 wxCoord shift = z == x2 ? 0 : 1;
253 for ( z = y1 + shift; z < y2; z += 2 )
256 shift = z == y2 ? 0 : 1;
257 for ( z = x2 - shift; z > x1; z -= 2 )
260 shift = z == x1 ? 0 : 1;
261 for ( z = y2 - shift; z > y1; z -= 2 )
281 AColor::Line(dc, r.x + r.width, r.y, r.x + r.width, r.y + r.height);
282 AColor::Line(dc, r.x, r.y + r.height, r.x + r.width, r.y + r.height);
294void AColor::Bevel2(wxDC & dc,
bool up,
const wxRect & r,
bool bSel,
bool bHighlight)
298 memDC.SelectObject(Bmp);
300 int h =
std::min(r.height, Bmp.GetHeight());
302 dc.Blit( r.x,r.y,r.width/2, h, &memDC, 0, 0, wxCOPY,
true );
303 int r2 = r.width - r.width/2;
304 dc.Blit( r.x+r.width/2,r.y,r2, h, &memDC,
305 Bmp.GetWidth() - r2, 0, wxCOPY,
true );
311 srcDC.SelectObject(bitmap);
313 const auto sh = bitmap.GetHeight();
314 const auto dh = rect.height;
315 const auto w0 =
std::min((bitmap.GetWidth() - 1) / 2, rect.width / 2);
316 const auto dx0 = rect.x;
317 const auto dx1 = rect.x + w0;
318 const auto dx2 = rect.x + rect.width - w0;
320 dc.StretchBlit(dx0, rect.y, w0, dh, &srcDC, 0, 0, w0, sh);
321 dc.StretchBlit(dx1, rect.y, rect.width - w0 * 2, dh, &srcDC, w0, 0, 1, sh);
322 dc.StretchBlit(dx2, rect.y, w0, dh, &srcDC, bitmap.GetWidth() - w0, 0, w0, sh);
334 (c1.Red() + c2.Red())/2,
335 (c1.Green() + c2.Green())/2,
336 (c1.Blue() + c2.Blue())/2);
346 col =
Blend(
theTheme.
Colour( clrTrackInfo ), up ? wxColour( 255,255,255):wxColour(0,0,0));
348 wxPen pen( highlight ?
uglyPen : col );
351 dc.DrawLine(r.x, r.y, r.x + r.width, r.y);
352 dc.DrawLine(r.x, r.y, r.x, r.y + r.height);
354 col =
Blend(
theTheme.
Colour( clrTrackInfo ), up ? wxColour(0,0,0): wxColour(255,255,255));
356 pen.SetColour( col );
357 dc.SetPen( highlight ?
uglyPen : pen );
359 dc.DrawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height);
360 dc.DrawLine(r.x, r.y + r.height, r.x + r.width, r.y + r.height);
373 if( (iBrush == -1) && ( iPen ==-1))
375 wxColour col = wxColour(0,0,0);
378 col.Set( col.Red(), col.Green(), col.Blue(), alpha);
393 if( (iBrush == -1) && ( iPen ==-1))
395 wxColour col = wxColour(0,0,0);
398 col.Set( col.Red(), col.Green(), col.Blue(), alpha);
413 int index = (int) selected;
415 dc->SetBrush( brush );
424 int index = (int) selected;
431 UseThemeColour( dc, selected ? clrTrackInfoSelected : clrTrackInfo );
439 int index = (int) selected;
441 dc->SetBrush( brush );
448 UseThemeColour( dc, selected ? clrMediumSelected : clrTrackBackground );
456 dc->SetLogicalFunction(wxCOPY);
464 int index = (int) bIsNotRecording;
487 int index = (int) selected;
489 dc->SetPen(*wxBLACK_PEN);
493 dc->SetPen(*wxTRANSPARENT_PEN);
502 int index = (int) selected;
504 dc->SetPen(*wxBLACK_PEN);
508 dc->SetPen(*wxTRANSPARENT_PEN);
525 return wxColour( 255-c.Red(), 255-c.Green(), 255-c.Blue() );
598 tooltipPen.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOTEXT) );
599 tooltipBrush.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOBK) );
601 uglyPen.SetColour( wxColour{ 0, 255, 0 } );
602 uglyBrush.SetColour( wxColour{ 255, 0, 255 } );
625 lightPen[1].SetColour(lightSelected);
627 darkPen[1].SetColour(darkSelected);
655 if (channel >= 1 && channel <= 16) {
658 dc->SetPen(wxPen(wxColour(colors[0],
659 colors[1], colors[2]), 1, wxPENSTYLE_SOLID));
660 dc->SetBrush(wxBrush(wxColour(colors[0],
661 colors[1], colors[2]), wxBRUSHSTYLE_SOLID));
663 dc->SetPen(wxPen(wxColour(153, 153, 153), 1, wxPENSTYLE_SOLID));
664 dc->SetBrush(wxBrush(wxColour(153, 153, 153), wxBRUSHSTYLE_SOLID));
671 if (channel >= 1 && channel <= 16) {
674 dc->SetPen(wxPen(wxColour(127 + colors[0] / 2,
676 127 + colors[2] / 2), 1, wxPENSTYLE_SOLID));
677 dc->SetBrush(wxBrush(wxColour(127 + colors[0] / 2,
679 127 + colors[2] / 2), wxBRUSHSTYLE_SOLID));
681 dc->SetPen(wxPen(wxColour(204, 204, 204), 1, wxPENSTYLE_SOLID));
682 dc->SetBrush(wxBrush(wxColour(204, 204, 204), wxBRUSHSTYLE_SOLID));
689 if (channel >= 1 && channel <= 16) {
692 dc->SetPen(wxPen(wxColour(colors[0] / 2,
694 colors[2] / 2), 1, wxPENSTYLE_SOLID));
695 dc->SetBrush(wxBrush(wxColour(colors[0] / 2,
697 colors[2] / 2), wxBRUSHSTYLE_SOLID));
699 dc->SetPen(wxPen(wxColour(102, 102, 102), 1, wxPENSTYLE_SOLID));
700 dc->SetBrush(wxBrush(wxColour(102, 102, 102), wxBRUSHSTYLE_SOLID));
724 const int gsteps = 4;
725 float gradient[gsteps + 1][3];
729 for(
int j=0;j<(gsteps+1);j++){
731 gradient[ j] [0] = c.Red()/255.0;
732 gradient[ j] [1] = c.Green()/255.0;
733 gradient[ j] [2] = c.Blue()/255.0;
741 int left = (int)(value * gsteps);
742 int right = (left == gsteps ? gsteps : left + 1);
744 float rweight = (value * gsteps) - left;
745 float lweight = 1.0 - rweight;
747 r = (gradient[left][0] * lweight) + (gradient[right][0] * rweight);
748 g = (gradient[left][1] * lweight) + (gradient[right][1] * rweight);
749 b = (gradient[left][2] * lweight) + (gradient[right][2] * rweight);
781 gradient_pre[selected][1][i][0] = (
unsigned char) (255 * r);
782 gradient_pre[selected][1][i][1] = (
unsigned char) (255 * g);
783 gradient_pre[selected][1][i][2] = (
unsigned char) (255 * b);
804 r = r * 0.75f + 0.25f;
805 g = g * 0.75f + 0.25f;
806 b = b * 0.75f + 0.25f;
815 gradient_pre[selected][3][i][0] = (
unsigned char)(255 * r);
816 gradient_pre[selected][3][i][1] = (
unsigned char)(255 * g);
817 gradient_pre[selected][3][i][2] = (
unsigned char)(255 * b);
825 r = g = b = 0.84 - 0.84 * value;
853 gradient_pre[selected][2][i][0] = (
unsigned char) (255 * r);
854 gradient_pre[selected][2][i][1] = (
unsigned char) (255 * g);
855 gradient_pre[selected][2][i][2] = (
unsigned char) (255 * b);
wxColour InvertOfColour(const wxColour &c)
const int AColor_midicolors[16][3]
const unsigned char specColormap[256][3]
const unsigned char freqSelColormap[256][3]
const unsigned char selColormap[256][3]
static wxBrush mediumBrush[2]
static void Arrow(wxDC &dc, wxCoord x, wxCoord y, int width, bool down=true)
static wxBrush labelSelectedBrush
static wxBrush darkBrush[2]
static void Solo(wxDC *dc, bool on, bool selected)
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
static wxPen trackFocusPens[3]
static wxPen WideEnvelopePen
static void IndicatorColor(wxDC *dc, bool bIsNotRecording)
static void Mute(wxDC *dc, bool on, bool selected, bool soloing)
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
@ ColorGradientUnselected
@ ColorGradientTimeAndFrequencySelected
@ ColorGradientTimeSelected
static wxColour Blend(const wxColour &c1, const wxColour &c2)
static void PreComputeGradient()
static wxBrush lightBrush[2]
static wxBrush playRegionBrush[1]
static void SnapGuidePen(wxDC *dc)
static void CursorColor(wxDC *dc)
static void Lines(wxDC &dc, size_t nPoints, const wxPoint points[])
static wxPen labelSurroundPen
static void Bevel(wxDC &dc, bool up, const wxRect &r)
static wxBrush muteBrush[2]
static void Light(wxDC *dc, bool selected, bool highlight=false)
static void LightMIDIChannel(wxDC *dc, int channel)
static wxPen mediumPen[2]
static void MediumTrackInfo(wxDC *dc, bool selected)
static void ApplyUpdatedImages()
static wxBrush envelopeBrush
static wxBrush labelTextNormalBrush
static wxBrush labelTextEditBrush
static const int gradientSteps
static void DrawHStretch(wxDC &dc, const wxRect &rect, wxBitmap &bitmap)
static void Dark(wxDC *dc, bool selected, bool highlight=false)
static void Medium(wxDC *dc, bool selected)
static void ButtonStretch(wxDC &dc, bool up, const wxRect &r, bool selected=false, bool highlight=false)
Draw a button that fills a given rect.
static wxBrush labelSyncLockSelBrush
static unsigned char gradient_pre[ColorGradientTotal][colorSchemes][gradientSteps][3]
static wxPen labelSelectedPen
static wxBrush tooltipBrush
static void MIDIChannel(wxDC *dc, int channel)
static wxBrush indicatorBrush[2]
static void TrackFocusPen(wxDC *dc, int level)
static void BevelTrackInfo(wxDC &dc, bool up, const wxRect &r, bool highlight=false)
static void TrackPanelBackground(wxDC *dc, bool selected)
static wxBrush labelUnselectedBrush
static void DrawFrame(wxDC &dc, const wxRect &r, wxBitmap &bitmap)
static wxPen snapGuidePen
static wxPen indicatorPen[2]
static wxBrush spareBrush
static void UseThemeColour(wxDC *dc, int iBrush, int iPen=-1, int alpha=255)
static void DarkMIDIChannel(wxDC *dc, int channel)
static void DrawFocus(wxDC &dc, wxRect &r)
static wxPen labelUnselectedPen
static bool gradient_inited
static wxPen labelSyncLockSelPen
CallbackReturn Publish(const Message &message)
Send a message to connected callbacks.
wxColour & Colour(int iIndex)
void SetBrushColour(wxBrush &Brush, int iIndex)
wxBitmap & Bitmap(int iIndex)
int ColourDistance(wxColour &From, wxColour &To)
void SetPenColour(wxPen &Pen, int iIndex)
void DrawNinePatch(wxDC &dc, wxBitmap &bitmap, const wxRect &r)
int GetButtonImageIndex(bool up, bool selected, bool highlight)