2 * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef __gtkardour_mini_timeline_h__
20 #define __gtkardour_mini_timeline_h__
25 #include "pbd/signals.h"
27 #include "ardour/ardour.h"
28 #include "ardour/session_handle.h"
30 #include "gtkmm2ext/cairo_widget.h"
31 #include "gtkmm2ext/utils.h"
33 #include "audio_clock.h"
39 class MiniTimeline : public CairoWidget, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
46 void set_session (ARDOUR::Session *);
49 void session_going_away ();
50 void super_rapid_update ();
52 void on_size_request (Gtk::Requisition*);
53 void on_size_allocate (Gtk::Allocation&);
54 void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
55 void on_name_changed ();
57 void parameter_changed (std::string const &);
59 void calculate_time_width ();
60 void calculate_time_spacing ();
61 void update_minitimeline ();
62 void draw_dots (cairo_t*, int left, int right, int y, ArdourCanvas::Color);
63 int draw_mark (cairo_t*, int x0, int x1, int h, const std::string&);
65 void render (cairo_t*, cairo_rectangle_t*);
66 void format_time (framepos_t when);
68 bool on_button_release_event (GdkEventButton *ev);
69 bool on_scroll_event (GdkEventScroll*);
71 Glib::RefPtr<Pango::Layout> _layout;
72 sigc::connection super_rapid_connection;
73 PBD::ScopedConnectionList marker_connection;
74 PBD::ScopedConnectionList session_connection;
76 framepos_t _last_update_frame;
77 AudioClock::Mode _clock_mode;
82 double _px_per_sample;
83 framepos_t _time_granularity;
84 framepos_t _time_span_samples;
87 JumpRange (int l, int r, framepos_t t)
88 : left (l), right (r), to (t) {}
94 typedef std::list <JumpRange> JumpList;