diff options
author | Robin Gareus <robin@gareus.org> | 2016-12-19 19:12:13 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-12-19 19:12:13 +0100 |
commit | d82abddfff8fed07acf196ad6def85ba84821cda (patch) | |
tree | 3d0b82eb3c0a2798a279c8378bc1ff6a7ecacafd /gtk2_ardour/mini_timeline.h | |
parent | 53be243f6aadb4c5722816ea7c88c335095d56b4 (diff) |
cont'd work on mini-timeline:
* add context-menu to configure visible time-span
* prelight markers on mouse-over
* constrain active click area (mouse-up)
* change scroll-event granularity: multiple of configured span.
Diffstat (limited to 'gtk2_ardour/mini_timeline.h')
-rw-r--r-- | gtk2_ardour/mini_timeline.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/gtk2_ardour/mini_timeline.h b/gtk2_ardour/mini_timeline.h index fd703d3d1a..262b1adad2 100644 --- a/gtk2_ardour/mini_timeline.h +++ b/gtk2_ardour/mini_timeline.h @@ -25,6 +25,7 @@ #include "pbd/signals.h" #include "ardour/ardour.h" +#include "ardour/types.h" #include "ardour/session_handle.h" #include "gtkmm2ext/cairo_widget.h" @@ -36,6 +37,10 @@ namespace ARDOUR { class Session; } +namespace Gtk { + class Menu; +} + class MiniTimeline : public CairoWidget, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList { @@ -60,13 +65,20 @@ private: void calculate_time_spacing (); void update_minitimeline (); void draw_dots (cairo_t*, int left, int right, int y, ArdourCanvas::Color); - int draw_mark (cairo_t*, int x0, int x1, int h, const std::string&); + int draw_mark (cairo_t*, int x0, int x1, const std::string&, bool& prelight); void render (cairo_t*, cairo_rectangle_t*); void format_time (framepos_t when); - bool on_button_release_event (GdkEventButton *ev); + bool on_button_press_event (GdkEventButton*); + bool on_button_release_event (GdkEventButton*); bool on_scroll_event (GdkEventScroll*); + bool on_motion_notify_event (GdkEventMotion*); + bool on_leave_notify_event (GdkEventCrossing*); + + void build_minitl_context_menu (); + void show_minitl_context_menu (); + void set_span (ARDOUR::framecnt_t); Glib::RefPtr<Pango::Layout> _layout; sigc::connection super_rapid_connection; @@ -80,15 +92,22 @@ private: int _n_labels; double _px_per_sample; - framepos_t _time_granularity; - framepos_t _time_span_samples; + ARDOUR::framecnt_t _time_granularity; + ARDOUR::framecnt_t _time_span_samples; + int _marker_height; + + int _pointer_x; + int _pointer_y; + + Gtk::Menu* _minitl_context_menu; struct JumpRange { - JumpRange (int l, int r, framepos_t t) - : left (l), right (r), to (t) {} + JumpRange (int l, int r, framepos_t t, bool p = false) + : left (l), right (r), to (t), prelight (p) {} int left; int right; framepos_t to; + bool prelight; }; typedef std::list <JumpRange> JumpList; |