diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2008-12-23 16:18:54 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2008-12-23 16:18:54 +0000 |
commit | 270f1abe8d2a3e3da369a8e64bc0e6806309304d (patch) | |
tree | 1960d0892fccf599a249ef4ae92ba4239feec93f /gtk2_ardour/canvas-note-event.h | |
parent | c15f5d24fd7615b6cf6914c08fb3c95c988ab4ad (diff) |
* preparation for different color coding schemes
git-svn-id: svn://localhost/ardour2/branches/3.0@4342 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/canvas-note-event.h')
-rw-r--r-- | gtk2_ardour/canvas-note-event.h | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/gtk2_ardour/canvas-note-event.h b/gtk2_ardour/canvas-note-event.h index 9e48db8c24..45403ed664 100644 --- a/gtk2_ardour/canvas-note-event.h +++ b/gtk2_ardour/canvas-note-event.h @@ -20,12 +20,17 @@ #ifndef __gtk_ardour_canvas_midi_event_h__ #define __gtk_ardour_canvas_midi_event_h__ -#include "simplerect.h" -#include "midi_channel_selector.h" + #include <libgnomecanvasmm/text.h> #include <libgnomecanvasmm/widget.h> #include <ardour/midi_model.h> +#include "rgb_macros.h" +#include "ardour_ui.h" +#include "ui_config.h" +#include "simplerect.h" +#include "midi_channel_selector.h" + class Editor; class MidiRegionView; @@ -82,6 +87,35 @@ public: virtual double y2() = 0; const boost::shared_ptr<Evoral::Note> note() const { return _note; } + + inline static uint32_t meter_style_fill_color(uint8_t vel) + { + if (vel < 64) { + return UINT_INTERPOLATE( + ARDOUR_UI::config()->canvasvar_MeterColorBase.get(), + ARDOUR_UI::config()->canvasvar_MeterColorMid.get(), + (vel / (double)63.0)); + } else { + return UINT_INTERPOLATE( + ARDOUR_UI::config()->canvasvar_MeterColorMid.get(), + ARDOUR_UI::config()->canvasvar_MeterColorTop.get(), + ((vel-64) / (double)63.0)); + } + } + + inline static uint32_t meter_style_outline_color(uint8_t vel) + { + return calculate_outline(meter_style_fill_color(vel)); + } + + /// calculate outline colors from fill colors of notes + inline static uint32_t calculate_outline(uint32_t color) + { + return UINT_INTERPOLATE(color, 0x000000ff, 0.5); + } + + /// dividing the hue circle in 16 parts, hand adjusted for equal look, courtesy Thorsten Wilms + static const uint32_t midi_channel_colors[16]; protected: enum State { None, Pressed, Dragging }; |