X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fcanvas-flag.h;h=a9dbb09175a2bbac1d22c5f1a7e7b0ae9ce39568;hb=4f3bddf7ef163c3106ba973123cbc657ebaf4b74;hp=57a78ef99265b027681da5dd675a1d002fe2bb54;hpb=5e7ae490c1616696a733287b62c08416726653ae;p=ardour.git diff --git a/gtk2_ardour/canvas-flag.h b/gtk2_ardour/canvas-flag.h index 57a78ef992..a9dbb09175 100644 --- a/gtk2_ardour/canvas-flag.h +++ b/gtk2_ardour/canvas-flag.h @@ -1,103 +1,60 @@ #ifndef CANVASFLAG_H_ #define CANVASFLAG_H_ +#include #include -#include #include -#include +#include "ardour/midi_model.h" #include "simplerect.h" #include "simpleline.h" +#include "interactive-item.h" class MidiRegionView; namespace Gnome { namespace Canvas { -class CanvasFlagRect; -class CanvasFlagText; - -class CanvasFlag : public Group +class CanvasFlag : public Group, public InteractiveItem { public: CanvasFlag( - MidiRegionView& region, - Group& parent, - double height, - guint outline_color_rgba = 0xc0c0c0ff, - guint fill_color_rgba = 0x07070707, - double x = 0.0, - double y = 0.0 - ) : Group(parent, x, y) - , _text(0) - , _height(height) - , _outline_color_rgba(outline_color_rgba) - , _fill_color_rgba(fill_color_rgba) - , _region(region) - , _line(0) - , _rect(0) + MidiRegionView& region, + Group& parent, + double height, + guint outline_color_rgba = 0xc0c0c0ff, + guint fill_color_rgba = 0x07070707, + double x = 0.0, + double y = 0.0) + : Group(parent, x, y) + , _text(0) + , _height(height) + , _outline_color_rgba(outline_color_rgba) + , _fill_color_rgba(fill_color_rgba) + , _region(region) + , _line(0) + , _rect(0) {} virtual ~CanvasFlag(); virtual bool on_event(GdkEvent* ev); - void set_text(string& a_text); + void set_text(const std::string& a_text); protected: - CanvasFlagText* _text; - double _height; - guint _outline_color_rgba; - guint _fill_color_rgba; - MidiRegionView& _region; + InteractiveText* _text; + double _height; + guint _outline_color_rgba; + guint _fill_color_rgba; + MidiRegionView& _region; private: void delete_allocated_objects(); - SimpleLine* _line; - CanvasFlagRect* _rect; -}; - -class CanvasFlagText: public Text -{ -public: - CanvasFlagText(Group& parent, double x, double y, const Glib::ustring& text) - : Text(parent, x, y, text) { - _parent = dynamic_cast(&parent); -; - } - - virtual bool on_event(GdkEvent* ev) { - if(_parent) { - return _parent->on_event(ev); - } else { - return false; - } - } - -private: - CanvasFlag* _parent; -}; - -class CanvasFlagRect: public SimpleRect -{ -public: - CanvasFlagRect(Group& parent, double x1, double y1, double x2, double y2) - : SimpleRect(parent, x1, y1, x2, y2) { - _parent = dynamic_cast(&parent); - } - - virtual bool on_event(GdkEvent* ev) { - if(_parent) { - return _parent->on_event(ev); - } else { - return false; - } - } - -private: - CanvasFlag* _parent; + SimpleLine* _line; + InteractiveRect* _rect; };