25#include <wx/dcmemory.h>
26#include <wx/graphics.h>
27#include <wx/settings.h>
85 memDC.SelectObject(bitmap);
89 const auto uw0 = bitmap.GetWidth() / 2;
91 const auto uw2 = bitmap.GetWidth() - uw0 - uw1;
93 const auto vh0 = bitmap.GetHeight() / 2;
95 const auto vh2 = bitmap.GetHeight() - vh1 - vh0;
99 const auto u2 = uw0 + uw1;
103 const auto v2 = vh0 + vh1;
107 const auto xw0 =
std::min(uw0, r.width / 2);
108 const auto xw2 =
std::min(uw2, r.width / 2);
109 const auto xw1 = r.width - xw0 - xw2;
111 const auto yh0 =
std::min(vh0, r.height / 2);
112 const auto yh2 =
std::min(vh2, r.height / 2);
113 const auto yh1 = r.height - yh0 - yh2;
116 const auto x1 = r.x + xw0;
117 const auto x2 = r.x + xw0 + xw1;
120 const auto y1 = r.y + yh0;
121 const auto y2 = r.y + yh0 + yh1;
123 dc.StretchBlit(x0, y0, xw0, yh0, &memDC, u0, v0, uw0, vh0, wxCOPY,
true);
124 dc.StretchBlit(x1, y0, xw1, yh0, &memDC, u1, v0, uw1, vh0, wxCOPY,
true);
125 dc.StretchBlit(x2, y0, xw2, yh0, &memDC, u2, v0, uw2, vh0, wxCOPY,
true);
127 dc.StretchBlit(x0, y1, xw0, yh1, &memDC, u0, v1, uw0, vh1, wxCOPY,
true);
128 dc.StretchBlit(x1, y1, xw1, yh1, &memDC, u1, v1, uw1, vh1, wxCOPY,
true);
129 dc.StretchBlit(x2, y1, xw2, yh1, &memDC, u2, v1, uw2, vh1, wxCOPY,
true);
131 dc.StretchBlit(x0, y2, xw0, yh2, &memDC, u0, v2, uw0, vh2, wxCOPY,
true);
132 dc.StretchBlit(x1, y2, xw1, yh2, &memDC, u1, v2, uw1, vh2, wxCOPY,
true);
133 dc.StretchBlit(x2, y2, xw2, yh2, &memDC, u2, v2, uw2, vh2, wxCOPY,
true);
145 if ( highlight && selected)
146 return up ? bmpHiliteUpButtonExpandSel : bmpHiliteButtonExpandSel;
148 return up ? bmpHiliteUpButtonExpand : bmpHiliteButtonExpand;
150 return up ? bmpUpButtonExpandSel : bmpDownButtonExpandSel;
151 return up ? bmpUpButtonExpand : bmpDownButtonExpand;
165 int half = width / 2;
168 pt[0].x = 0; pt[0].y = 0;
169 pt[1].x = width; pt[1].y = 0;
170 pt[2].x = half; pt[2].y = half;
173 pt[0].x = 0; pt[0].y = half;
174 pt[1].x = half; pt[1].y = 0;
175 pt[2].x = width; pt[2].y = half;
178 dc.DrawPolygon(3, pt, x, y);
185void AColor::Line(wxDC & dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
187 const wxPoint points[] { { x1, y1 }, { x2, y2 } };
188 Lines( dc, 2, points );
194 if ( nPoints <= 1 ) {
196 dc.DrawPoint( points[0] );
200 for (
size_t ii = 0; ii < nPoints - 1; ++ii) {
201 const auto &p1 = points[ii];
202 const auto &p2 = points[ii + 1];
213#if defined(__WXMAC__) || defined(__WXGTK3__)
223#if defined(__WXMAC__) || defined(__WXGTK3__)
226 dc.DrawPoint( points[ nPoints - 1 ] );
238 wxCoord x1 = rect.GetLeft(),
240 x2 = rect.GetRight(),
241 y2 = rect.GetBottom();
247 for ( z = x1 + 1; z < x2; z += 2 )
250 wxCoord shift = z == x2 ? 0 : 1;
251 for ( z = y1 + shift; z < y2; z += 2 )
254 shift = z == y2 ? 0 : 1;
255 for ( z = x2 - shift; z > x1; z -= 2 )
258 shift = z == x1 ? 0 : 1;
259 for ( z = y2 - shift; z > y1; z -= 2 )
279 AColor::Line(dc, r.x + r.width, r.y, r.x + r.width, r.y + r.height);
280 AColor::Line(dc, r.x, r.y + r.height, r.x + r.width, r.y + r.height);
292void AColor::Bevel2(wxDC & dc,
bool up,
const wxRect & r,
bool bSel,
bool bHighlight)
296 memDC.SelectObject(Bmp);
298 int h =
std::min(r.height, Bmp.GetHeight());
300 dc.Blit( r.x,r.y,r.width/2, h, &memDC, 0, 0, wxCOPY,
true );
301 int r2 = r.width - r.width/2;
302 dc.Blit( r.x+r.width/2,r.y,r2, h, &memDC,
303 Bmp.GetWidth() - r2, 0, wxCOPY,
true );
309 srcDC.SelectObject(bitmap);
311 const auto sh = bitmap.GetHeight();
312 const auto dh = rect.height;
313 const auto w0 =
std::min((bitmap.GetWidth() - 1) / 2, rect.width / 2);
314 const auto dx0 = rect.x;
315 const auto dx1 = rect.x + w0;
316 const auto dx2 = rect.x + rect.width - w0;
318 dc.StretchBlit(dx0, rect.y, w0, dh, &srcDC, 0, 0, w0, sh);
319 dc.StretchBlit(dx1, rect.y, rect.width - w0 * 2, dh, &srcDC, w0, 0, 1, sh);
320 dc.StretchBlit(dx2, rect.y, w0, dh, &srcDC, bitmap.GetWidth() - w0, 0, w0, sh);
332 (c1.Red() + c2.Red())/2,
333 (c1.Green() + c2.Green())/2,
334 (c1.Blue() + c2.Blue())/2);
344 col =
Blend(
theTheme.
Colour( clrTrackInfo ), up ? wxColour( 255,255,255):wxColour(0,0,0));
346 wxPen pen( highlight ?
uglyPen : col );
349 dc.DrawLine(r.x, r.y, r.x + r.width, r.y);
350 dc.DrawLine(r.x, r.y, r.x, r.y + r.height);
352 col =
Blend(
theTheme.
Colour( clrTrackInfo ), up ? wxColour(0,0,0): wxColour(255,255,255));
354 pen.SetColour( col );
355 dc.SetPen( highlight ?
uglyPen : pen );
357 dc.DrawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height);
358 dc.DrawLine(r.x, r.y + r.height, r.x + r.width, r.y + r.height);
371 if( (iBrush == -1) && ( iPen ==-1))
373 wxColour col = wxColour(0,0,0);
376 col.Set( col.Red(), col.Green(), col.Blue(), alpha);
391 if( (iBrush == -1) && ( iPen ==-1))
393 wxColour col = wxColour(0,0,0);
396 col.Set( col.Red(), col.Green(), col.Blue(), alpha);
411 int index = (int) selected;
413 dc->SetBrush( brush );
422 int index = (int) selected;
429 UseThemeColour( dc, selected ? clrTrackInfoSelected : clrTrackInfo );
437 int index = (int) selected;
439 dc->SetBrush( brush );
446 UseThemeColour( dc, selected ? clrMediumSelected : clrTrackBackground );
454 dc->SetLogicalFunction(wxCOPY);
462 int index = (int) bIsNotRecording;
485 int index = (int) selected;
487 dc->SetPen(*wxBLACK_PEN);
491 dc->SetPen(*wxTRANSPARENT_PEN);
500 int index = (int) selected;
502 dc->SetPen(*wxBLACK_PEN);
506 dc->SetPen(*wxTRANSPARENT_PEN);
523 return wxColour( 255-c.Red(), 255-c.Green(), 255-c.Blue() );
591 tooltipPen.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOTEXT) );
592 tooltipBrush.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOBK) );
594 uglyPen.SetColour( wxColour{ 0, 255, 0 } );
595 uglyBrush.SetColour( wxColour{ 255, 0, 255 } );
618 lightPen[1].SetColour(lightSelected);
620 darkPen[1].SetColour(darkSelected);
648 if (channel >= 1 && channel <= 16) {
651 dc->SetPen(wxPen(wxColour(colors[0],
652 colors[1], colors[2]), 1, wxPENSTYLE_SOLID));
653 dc->SetBrush(wxBrush(wxColour(colors[0],
654 colors[1], colors[2]), wxBRUSHSTYLE_SOLID));
656 dc->SetPen(wxPen(wxColour(153, 153, 153), 1, wxPENSTYLE_SOLID));
657 dc->SetBrush(wxBrush(wxColour(153, 153, 153), wxBRUSHSTYLE_SOLID));
664 if (channel >= 1 && channel <= 16) {
667 dc->SetPen(wxPen(wxColour(127 + colors[0] / 2,
669 127 + colors[2] / 2), 1, wxPENSTYLE_SOLID));
670 dc->SetBrush(wxBrush(wxColour(127 + colors[0] / 2,
672 127 + colors[2] / 2), wxBRUSHSTYLE_SOLID));
674 dc->SetPen(wxPen(wxColour(204, 204, 204), 1, wxPENSTYLE_SOLID));
675 dc->SetBrush(wxBrush(wxColour(204, 204, 204), wxBRUSHSTYLE_SOLID));
682 if (channel >= 1 && channel <= 16) {
685 dc->SetPen(wxPen(wxColour(colors[0] / 2,
687 colors[2] / 2), 1, wxPENSTYLE_SOLID));
688 dc->SetBrush(wxBrush(wxColour(colors[0] / 2,
690 colors[2] / 2), wxBRUSHSTYLE_SOLID));
692 dc->SetPen(wxPen(wxColour(102, 102, 102), 1, wxPENSTYLE_SOLID));
693 dc->SetBrush(wxBrush(wxColour(102, 102, 102), wxBRUSHSTYLE_SOLID));
717 const int gsteps = 4;
718 float gradient[gsteps + 1][3];
722 for(
int j=0;j<(gsteps+1);j++){
724 gradient[ j] [0] = c.Red()/255.0;
725 gradient[ j] [1] = c.Green()/255.0;
726 gradient[ j] [2] = c.Blue()/255.0;
734 int left = (int)(value * gsteps);
735 int right = (left == gsteps ? gsteps : left + 1);
737 float rweight = (value * gsteps) - left;
738 float lweight = 1.0 - rweight;
740 r = (gradient[left][0] * lweight) + (gradient[right][0] * rweight);
741 g = (gradient[left][1] * lweight) + (gradient[right][1] * rweight);
742 b = (gradient[left][2] * lweight) + (gradient[right][2] * rweight);
774 gradient_pre[selected][1][i][0] = (
unsigned char) (255 * r);
775 gradient_pre[selected][1][i][1] = (
unsigned char) (255 * g);
776 gradient_pre[selected][1][i][2] = (
unsigned char) (255 * b);
797 r = r * 0.75f + 0.25f;
798 g = g * 0.75f + 0.25f;
799 b = b * 0.75f + 0.25f;
808 gradient_pre[selected][3][i][0] = (
unsigned char)(255 * r);
809 gradient_pre[selected][3][i][1] = (
unsigned char)(255 * g);
810 gradient_pre[selected][3][i][2] = (
unsigned char)(255 * b);
818 r = g = b = 0.84 - 0.84 * value;
846 gradient_pre[selected][2][i][0] = (
unsigned char) (255 * r);
847 gradient_pre[selected][2][i][1] = (
unsigned char) (255 * g);
848 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 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 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)