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);
342#ifndef EXPERIMENTAL_THEMING
349 col =
Blend(
theTheme.
Colour( clrTrackInfo ), up ? wxColour( 255,255,255):wxColour(0,0,0));
351 wxPen pen( highlight ?
uglyPen : col );
354 dc.DrawLine(r.x, r.y, r.x + r.width, r.y);
355 dc.DrawLine(r.x, r.y, r.x, r.y + r.height);
357 col =
Blend(
theTheme.
Colour( clrTrackInfo ), up ? wxColour(0,0,0): wxColour(255,255,255));
359 pen.SetColour( col );
360 dc.SetPen( highlight ?
uglyPen : pen );
362 dc.DrawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height);
363 dc.DrawLine(r.x, r.y + r.height, r.x + r.width, r.y + r.height);
377 if( (iBrush == -1) && ( iPen ==-1))
379 wxColour col = wxColour(0,0,0);
382 col.Set( col.Red(), col.Green(), col.Blue(), alpha);
397 if( (iBrush == -1) && ( iPen ==-1))
399 wxColour col = wxColour(0,0,0);
402 col.Set( col.Red(), col.Green(), col.Blue(), alpha);
417 int index = (int) selected;
419 dc->SetBrush( brush );
428 int index = (int) selected;
435#ifdef EXPERIMENTAL_THEMING
436 UseThemeColour( dc, selected ? clrTrackInfoSelected : clrTrackInfo );
447 int index = (int) selected;
449 dc->SetBrush( brush );
456#ifdef EXPERIMENTAL_THEMING
457 UseThemeColour( dc, selected ? clrMediumSelected : clrTrackBackground );
459 Dark( dc, selected );
468 dc->SetLogicalFunction(wxCOPY);
476 int index = (int) bIsNotRecording;
499 int index = (int) selected;
501 dc->SetPen(*wxBLACK_PEN);
505 dc->SetPen(*wxTRANSPARENT_PEN);
514 int index = (int) selected;
516 dc->SetPen(*wxBLACK_PEN);
520 dc->SetPen(*wxTRANSPARENT_PEN);
537 return wxColour( 255-c.Red(), 255-c.Green(), 255-c.Blue() );
610 tooltipPen.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOTEXT) );
611 tooltipBrush.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOBK) );
613 uglyPen.SetColour( wxColour{ 0, 255, 0 } );
614 uglyBrush.SetColour( wxColour{ 255, 0, 255 } );
637 lightPen[1].SetColour(lightSelected);
639 darkPen[1].SetColour(darkSelected);
667 if (channel >= 1 && channel <= 16) {
670 dc->SetPen(wxPen(wxColour(colors[0],
671 colors[1], colors[2]), 1, wxPENSTYLE_SOLID));
672 dc->SetBrush(wxBrush(wxColour(colors[0],
673 colors[1], colors[2]), wxBRUSHSTYLE_SOLID));
675 dc->SetPen(wxPen(wxColour(153, 153, 153), 1, wxPENSTYLE_SOLID));
676 dc->SetBrush(wxBrush(wxColour(153, 153, 153), wxBRUSHSTYLE_SOLID));
683 if (channel >= 1 && channel <= 16) {
686 dc->SetPen(wxPen(wxColour(127 + colors[0] / 2,
688 127 + colors[2] / 2), 1, wxPENSTYLE_SOLID));
689 dc->SetBrush(wxBrush(wxColour(127 + colors[0] / 2,
691 127 + colors[2] / 2), wxBRUSHSTYLE_SOLID));
693 dc->SetPen(wxPen(wxColour(204, 204, 204), 1, wxPENSTYLE_SOLID));
694 dc->SetBrush(wxBrush(wxColour(204, 204, 204), wxBRUSHSTYLE_SOLID));
701 if (channel >= 1 && channel <= 16) {
704 dc->SetPen(wxPen(wxColour(colors[0] / 2,
706 colors[2] / 2), 1, wxPENSTYLE_SOLID));
707 dc->SetBrush(wxBrush(wxColour(colors[0] / 2,
709 colors[2] / 2), wxBRUSHSTYLE_SOLID));
711 dc->SetPen(wxPen(wxColour(102, 102, 102), 1, wxPENSTYLE_SOLID));
712 dc->SetBrush(wxBrush(wxColour(102, 102, 102), wxBRUSHSTYLE_SOLID));
736 const int gsteps = 4;
737 float gradient[gsteps + 1][3];
741 for(
int j=0;j<(gsteps+1);j++){
743 gradient[ j] [0] = c.Red()/255.0;
744 gradient[ j] [1] = c.Green()/255.0;
745 gradient[ j] [2] = c.Blue()/255.0;
753 int left = (int)(value * gsteps);
754 int right = (left == gsteps ? gsteps : left + 1);
756 float rweight = (value * gsteps) - left;
757 float lweight = 1.0 - rweight;
759 r = (gradient[left][0] * lweight) + (gradient[right][0] * rweight);
760 g = (gradient[left][1] * lweight) + (gradient[right][1] * rweight);
761 b = (gradient[left][2] * lweight) + (gradient[right][2] * rweight);
793 gradient_pre[selected][1][i][0] = (
unsigned char) (255 * r);
794 gradient_pre[selected][1][i][1] = (
unsigned char) (255 * g);
795 gradient_pre[selected][1][i][2] = (
unsigned char) (255 * b);
816 r = r * 0.75f + 0.25f;
817 g = g * 0.75f + 0.25f;
818 b = b * 0.75f + 0.25f;
827 gradient_pre[selected][3][i][0] = (
unsigned char)(255 * r);
828 gradient_pre[selected][3][i][1] = (
unsigned char)(255 * g);
829 gradient_pre[selected][3][i][2] = (
unsigned char)(255 * b);
837 r = g = b = 0.84 - 0.84 * value;
865 gradient_pre[selected][2][i][0] = (
unsigned char) (255 * r);
866 gradient_pre[selected][2][i][1] = (
unsigned char) (255 * g);
867 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)