2016-12-16 19:43:09 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __gtkardour_mini_timeline_h__
|
|
|
|
#define __gtkardour_mini_timeline_h__
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
#include <pangomm.h>
|
|
|
|
|
|
|
|
#include "pbd/signals.h"
|
|
|
|
|
|
|
|
#include "ardour/ardour.h"
|
|
|
|
#include "ardour/session_handle.h"
|
|
|
|
|
|
|
|
#include "gtkmm2ext/cairo_widget.h"
|
|
|
|
#include "gtkmm2ext/utils.h"
|
|
|
|
|
|
|
|
#include "audio_clock.h"
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class Session;
|
|
|
|
}
|
|
|
|
|
|
|
|
class MiniTimeline : public CairoWidget, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
MiniTimeline ();
|
|
|
|
~MiniTimeline ();
|
|
|
|
|
|
|
|
void set_session (ARDOUR::Session *);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void session_going_away ();
|
|
|
|
void super_rapid_update ();
|
|
|
|
|
|
|
|
void on_size_request (Gtk::Requisition*);
|
2016-12-18 16:21:10 -05:00
|
|
|
void on_size_allocate (Gtk::Allocation&);
|
2016-12-16 19:43:09 -05:00
|
|
|
void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
|
|
|
|
void on_name_changed ();
|
|
|
|
void set_colors ();
|
2016-12-17 18:06:39 -05:00
|
|
|
void parameter_changed (std::string const &);
|
2016-12-16 19:43:09 -05:00
|
|
|
|
|
|
|
void calculate_time_width ();
|
2016-12-18 16:21:10 -05:00
|
|
|
void calculate_time_spacing ();
|
2016-12-16 19:43:09 -05:00
|
|
|
void update_minitimeline ();
|
2016-12-17 20:16:09 -05:00
|
|
|
void draw_dots (cairo_t*, int left, int right, int y, ArdourCanvas::Color);
|
2016-12-16 19:43:09 -05:00
|
|
|
int draw_mark (cairo_t*, int x0, int x1, int h, const std::string&);
|
|
|
|
|
|
|
|
void render (cairo_t*, cairo_rectangle_t*);
|
|
|
|
void format_time (framepos_t when);
|
|
|
|
|
|
|
|
bool on_button_release_event (GdkEventButton *ev);
|
|
|
|
bool on_scroll_event (GdkEventScroll*);
|
|
|
|
|
|
|
|
Glib::RefPtr<Pango::Layout> _layout;
|
|
|
|
sigc::connection super_rapid_connection;
|
|
|
|
PBD::ScopedConnectionList marker_connection;
|
2016-12-18 08:52:26 -05:00
|
|
|
PBD::ScopedConnectionList session_connection;
|
2016-12-16 19:43:09 -05:00
|
|
|
|
|
|
|
framepos_t _last_update_frame;
|
|
|
|
AudioClock::Mode _clock_mode;
|
|
|
|
int _time_width;
|
|
|
|
int _time_height;
|
|
|
|
|
2016-12-18 16:21:10 -05:00
|
|
|
int _n_labels;
|
|
|
|
double _px_per_sample;
|
|
|
|
framepos_t _time_granularity;
|
|
|
|
framepos_t _time_span_samples;
|
|
|
|
|
2016-12-16 19:43:09 -05:00
|
|
|
struct JumpRange {
|
|
|
|
JumpRange (int l, int r, framepos_t t)
|
|
|
|
: left (l), right (r), to (t) {}
|
|
|
|
int left;
|
|
|
|
int right;
|
|
|
|
framepos_t to;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::list <JumpRange> JumpList;
|
|
|
|
JumpList _jumplist;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|