2016-12-16 19:43:09 -05:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2016-2017 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2016-2018 Ben Loftis <ben@harrisonconsoles.com>
|
2016-12-16 19:43:09 -05:00
|
|
|
*
|
2019-08-02 17:26:43 -04:00
|
|
|
* 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.
|
2016-12-16 19:43:09 -05:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2019-08-02 17:26:43 -04:00
|
|
|
* 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.
|
2016-12-16 19:43:09 -05:00
|
|
|
*/
|
|
|
|
|
2024-09-25 20:38:59 -04:00
|
|
|
#pragma once
|
2016-12-16 19:43:09 -05:00
|
|
|
|
|
|
|
#include <list>
|
|
|
|
#include <pangomm.h>
|
|
|
|
|
|
|
|
#include "pbd/signals.h"
|
|
|
|
|
|
|
|
#include "ardour/ardour.h"
|
2016-12-19 13:12:13 -05:00
|
|
|
#include "ardour/types.h"
|
2016-12-16 19:43:09 -05:00
|
|
|
#include "ardour/session_handle.h"
|
|
|
|
|
|
|
|
#include "gtkmm2ext/cairo_widget.h"
|
|
|
|
#include "gtkmm2ext/utils.h"
|
|
|
|
|
|
|
|
#include "audio_clock.h"
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class Session;
|
|
|
|
}
|
|
|
|
|
2016-12-19 13:12:13 -05:00
|
|
|
namespace Gtk {
|
|
|
|
class Menu;
|
|
|
|
}
|
|
|
|
|
2016-12-16 19:43:09 -05:00
|
|
|
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&);
|
2020-04-28 13:45:04 -04:00
|
|
|
void dpi_changed ();
|
2016-12-16 19:43:09 -05:00
|
|
|
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 ();
|
2017-07-17 12:34:35 -04:00
|
|
|
void draw_dots (cairo_t*, int left, int right, int y, Gtkmm2ext::Color);
|
2016-12-19 13:12:13 -05:00
|
|
|
int draw_mark (cairo_t*, int x0, int x1, const std::string&, bool& prelight);
|
2022-02-14 18:44:48 -05:00
|
|
|
int draw_cue (cairo_t*, int x0, int next_cue_left_edge, int tl_width, int cue_index, bool& prelight);
|
2017-04-02 16:20:12 -04:00
|
|
|
int draw_edge (cairo_t*, int x0, int x1, bool left, const std::string&, bool& prelight);
|
2016-12-16 19:43:09 -05:00
|
|
|
|
2017-03-20 12:11:56 -04:00
|
|
|
void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
|
2017-09-18 12:39:17 -04:00
|
|
|
void format_time (samplepos_t when);
|
2016-12-16 19:43:09 -05:00
|
|
|
|
2016-12-19 13:12:13 -05:00
|
|
|
bool on_button_press_event (GdkEventButton*);
|
|
|
|
bool on_button_release_event (GdkEventButton*);
|
2016-12-16 19:43:09 -05:00
|
|
|
bool on_scroll_event (GdkEventScroll*);
|
2016-12-19 13:12:13 -05:00
|
|
|
bool on_motion_notify_event (GdkEventMotion*);
|
|
|
|
bool on_leave_notify_event (GdkEventCrossing*);
|
|
|
|
|
|
|
|
void build_minitl_context_menu ();
|
2017-09-18 12:39:17 -04:00
|
|
|
void set_span (ARDOUR::samplecnt_t);
|
2016-12-16 19:43:09 -05:00
|
|
|
|
|
|
|
Glib::RefPtr<Pango::Layout> _layout;
|
|
|
|
sigc::connection super_rapid_connection;
|
|
|
|
PBD::ScopedConnectionList marker_connection;
|
2022-01-19 18:17:47 -05:00
|
|
|
PBD::ScopedConnectionList tempo_map_connection;
|
2016-12-18 08:52:26 -05:00
|
|
|
PBD::ScopedConnectionList session_connection;
|
2016-12-16 19:43:09 -05:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t _last_update_sample;
|
2016-12-16 19:43:09 -05:00
|
|
|
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;
|
2017-09-18 12:39:17 -04:00
|
|
|
ARDOUR::samplecnt_t _time_granularity;
|
|
|
|
ARDOUR::samplecnt_t _time_span_samples;
|
2016-12-19 13:12:13 -05:00
|
|
|
int _marker_height;
|
|
|
|
|
|
|
|
int _pointer_x;
|
|
|
|
int _pointer_y;
|
|
|
|
|
|
|
|
Gtk::Menu* _minitl_context_menu;
|
2016-12-18 16:21:10 -05:00
|
|
|
|
2018-02-09 09:21:45 -05:00
|
|
|
uint32_t _phead_color;
|
|
|
|
|
2016-12-16 19:43:09 -05:00
|
|
|
struct JumpRange {
|
2022-01-25 17:21:25 -05:00
|
|
|
JumpRange (int l, int r, samplepos_t t, bool p = false)
|
|
|
|
: left (l), right (r), to (t), prelight (p) {}
|
|
|
|
int left;
|
|
|
|
int right;
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t to;
|
2016-12-19 13:12:13 -05:00
|
|
|
bool prelight;
|
2016-12-16 19:43:09 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::list <JumpRange> JumpList;
|
|
|
|
JumpList _jumplist;
|
|
|
|
};
|
|
|
|
|