mp4chaps Lua script: don't clutter global environment
[ardour.git] / gtk2_ardour / note_base.h
index 059aa9dc8fff3ca6f7f21d066387a90ea065eca4..b7be36ada864b756b9f74eede7931c9bad715234 100644 (file)
@@ -23,7 +23,6 @@
 #include <boost/shared_ptr.hpp>
 
 #include "canvas/types.h"
-#include "evoral/types.hpp"
 
 #include "rgb_macros.h"
 #include "ui_config.h"
@@ -33,6 +32,7 @@ class MidiRegionView;
 
 namespace Evoral {
        template<typename T> class Note;
+       class Beats;
 }
 
 namespace ArdourCanvas {
@@ -52,7 +52,7 @@ namespace ArdourCanvas {
  */
 class NoteBase : public sigc::trackable
 {
-  public:
+public:
        typedef Evoral::Note<Evoral::Beats> NoteType;
 
        NoteBase (MidiRegionView& region, bool, const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>());
@@ -100,26 +100,22 @@ class NoteBase : public sigc::trackable
        const boost::shared_ptr<NoteType> note() const { return _note; }
        MidiRegionView& region_view() const { return _region; }
 
+       static void set_colors ();
+
        inline static uint32_t meter_style_fill_color(uint8_t vel, bool selected) {
                if (selected) {
-                       return UIConfiguration::instance().color_mod ("midi note selected", "midi note");
+                       return _selected_mod_col;
                } else if (vel < 64) {
-                       return UINT_INTERPOLATE(
-                               UIConfiguration::instance().color_mod ("midi note min", "midi note"),
-                               UIConfiguration::instance().color_mod ("midi note mid", "midi note"),
-                               (vel / (double)63.0));
+                       return UINT_INTERPOLATE(_min_col, _mid_col, (vel / (double)63.0));
                } else {
-                       return UINT_INTERPOLATE(
-                               UIConfiguration::instance().color_mod ("midi note mid", "midi note"),
-                               UIConfiguration::instance().color_mod ("midi note max", "midi note"),
-                               ((vel-64) / (double)63.0));
+                       return UINT_INTERPOLATE(_mid_col, _max_col, ((vel - 64) / (double)63.0));
                }
        }
 
        /// calculate outline colors from fill colors of notes
        inline static uint32_t calculate_outline(uint32_t color, bool selected=false) {
                if (selected) {
-                       return UIConfiguration::instance().color ("midi note selected outline");
+                       return _selected_outline_col;
                } else {
                        return UINT_INTERPOLATE(color, 0x000000ff, 0.5);
                }
@@ -150,6 +146,14 @@ protected:
 
 private:
        bool event_handler (GdkEvent *);
+
+       static uint32_t _selected_mod_col;
+       static uint32_t _selected_outline_col;
+       static uint32_t _selected_col;
+       static uint32_t _min_col;
+       static uint32_t _mid_col;
+       static uint32_t _max_col;
+       static bool _color_init;
 };
 
 #endif /* __gtk_ardour_note_h__ */