2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2003 Paul Davis
|
2005-09-25 14:42:24 -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.
|
|
|
|
|
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ardour_gtk_time_axis_h__
|
|
|
|
#define __ardour_gtk_time_axis_h__
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <list>
|
|
|
|
|
2005-11-28 23:41:15 -05:00
|
|
|
#include <gtkmm/box.h>
|
2014-09-08 12:43:08 -04:00
|
|
|
#include <gtkmm/fixed.h>
|
2005-11-28 23:41:15 -05:00
|
|
|
#include <gtkmm/frame.h>
|
2008-09-10 11:03:30 -04:00
|
|
|
#include <gtkmm/drawingarea.h>
|
2005-11-28 23:41:15 -05:00
|
|
|
#include <gtkmm/eventbox.h>
|
|
|
|
#include <gtkmm/table.h>
|
|
|
|
#include <gtkmm/entry.h>
|
|
|
|
#include <gtkmm/label.h>
|
2014-08-31 01:11:24 -04:00
|
|
|
#include <gtkmm/sizegroup.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-01-09 18:24:54 -05:00
|
|
|
#include <gtkmm2ext/focus_entry.h>
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/stateful.h"
|
2009-12-19 15:26:31 -05:00
|
|
|
#include "pbd/signals.h"
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/types.h"
|
|
|
|
#include "ardour/region.h"
|
|
|
|
#include "evoral/Parameter.hpp"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2014-09-04 11:01:28 -04:00
|
|
|
#include "canvas/line.h"
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "prompter.h"
|
|
|
|
#include "axis_view.h"
|
|
|
|
#include "enums.h"
|
|
|
|
#include "editing.h"
|
2005-11-14 11:24:21 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
namespace ARDOUR {
|
|
|
|
class Session;
|
|
|
|
class Region;
|
|
|
|
class Session;
|
|
|
|
class RouteGroup;
|
|
|
|
class Playlist;
|
|
|
|
}
|
|
|
|
|
2005-11-28 23:41:15 -05:00
|
|
|
namespace Gtk {
|
|
|
|
class Menu;
|
|
|
|
}
|
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
namespace ArdourCanvas {
|
|
|
|
class Canvas;
|
2014-06-22 11:41:05 -04:00
|
|
|
class Container;
|
2013-04-04 00:32:52 -04:00
|
|
|
class Item;
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
class PublicEditor;
|
2006-07-23 08:03:19 -04:00
|
|
|
class RegionSelection;
|
2005-09-25 14:42:24 -04:00
|
|
|
class TimeSelection;
|
|
|
|
class PointSelection;
|
|
|
|
class TimeAxisViewItem;
|
|
|
|
class Selection;
|
|
|
|
class Selectable;
|
2008-02-10 13:16:25 -05:00
|
|
|
class RegionView;
|
|
|
|
class GhostRegion;
|
2009-01-05 22:18:09 -05:00
|
|
|
class StreamView;
|
2013-01-19 10:27:04 -05:00
|
|
|
class ArdourDialog;
|
2014-11-16 17:04:27 -05:00
|
|
|
class ItemCounts;
|
2014-12-06 12:20:52 -05:00
|
|
|
class PasteContext;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
/** Abstract base class for time-axis views (horizontal editor 'strips')
|
2005-09-25 14:42:24 -04:00
|
|
|
*
|
|
|
|
* This class provides the basic LHS controls and display methods. This should be
|
|
|
|
* extended to create functional time-axis based views.
|
|
|
|
*/
|
2011-07-06 20:37:13 -04:00
|
|
|
class TimeAxisView : public virtual AxisView
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2014-08-30 14:56:31 -04:00
|
|
|
private:
|
2006-01-17 21:56:51 -05:00
|
|
|
enum NamePackingBits {
|
|
|
|
NameLabelPacked = 0x1,
|
|
|
|
NameEntryPacked = 0x2
|
|
|
|
};
|
|
|
|
|
2014-08-30 14:56:31 -04:00
|
|
|
public:
|
2009-12-17 13:24:23 -05:00
|
|
|
TimeAxisView(ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* parent, ArdourCanvas::Canvas& canvas);
|
2005-09-25 14:42:24 -04:00
|
|
|
virtual ~TimeAxisView ();
|
|
|
|
|
2009-12-25 16:06:52 -05:00
|
|
|
static PBD::Signal1<void,TimeAxisView*> CatchDeletion;
|
|
|
|
|
2014-12-28 09:01:49 -05:00
|
|
|
static void setup_sizes ();
|
|
|
|
|
2009-01-01 19:17:55 -05:00
|
|
|
/** @return index of this TimeAxisView within its parent */
|
|
|
|
int order () const { return _order; }
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-01-05 22:18:09 -05:00
|
|
|
/** @return maximum allowable value of order */
|
|
|
|
static int max_order () { return _max_order; }
|
|
|
|
|
2014-06-22 11:41:05 -04:00
|
|
|
ArdourCanvas::Container* canvas_display () { return _canvas_display; }
|
|
|
|
ArdourCanvas::Container* ghost_group () { return _ghost_group; }
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-01-01 19:17:55 -05:00
|
|
|
/** @return effective height (taking children into account) in canvas units, or
|
2014-08-30 14:56:31 -04:00
|
|
|
0 if this TimeAxisView has not yet been shown */
|
2009-01-01 19:17:55 -05:00
|
|
|
uint32_t effective_height () const { return _effective_height; }
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-01-01 19:17:55 -05:00
|
|
|
/** @return y position, or -1 if hidden */
|
|
|
|
double y_position () const { return _y_position; }
|
|
|
|
|
|
|
|
/** @return our Editor */
|
|
|
|
PublicEditor& editor () const { return _editor; }
|
|
|
|
|
|
|
|
uint32_t current_height() const { return height; }
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2014-12-06 17:46:12 -05:00
|
|
|
void idle_resize (int32_t);
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
virtual guint32 show_at (double y, int& nth, Gtk::VBox *parent);
|
2011-07-06 20:37:13 -04:00
|
|
|
virtual void hide ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
bool touched (double top, double bot);
|
|
|
|
|
2009-01-01 19:17:55 -05:00
|
|
|
/** @return true if hidden, otherwise false */
|
|
|
|
bool hidden () const { return _hidden; }
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-11-04 13:53:21 -04:00
|
|
|
void set_selected (bool);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* potential handler for entered events
|
|
|
|
*/
|
|
|
|
|
|
|
|
virtual void entered () {}
|
|
|
|
virtual void exited () {}
|
|
|
|
|
2015-03-19 16:47:34 -04:00
|
|
|
enum TrackHeightMode {
|
|
|
|
OnlySelf,
|
|
|
|
TotalHeight,
|
|
|
|
HeightPerLane
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual void set_height (uint32_t h, TrackHeightMode m = OnlySelf);
|
2011-02-22 20:04:10 -05:00
|
|
|
void set_height_enum (Height, bool apply_to_selection = false);
|
2005-09-25 14:42:24 -04:00
|
|
|
void reset_height();
|
2006-01-17 21:56:51 -05:00
|
|
|
|
2011-07-06 20:37:13 -04:00
|
|
|
virtual void reset_visual_state ();
|
|
|
|
|
2014-02-25 21:53:04 -05:00
|
|
|
std::pair<TimeAxisView*, double> covers_y_position (double) const;
|
2014-08-30 14:56:31 -04:00
|
|
|
bool covered_by_y_range (double y0, double y1) const;
|
2007-01-09 18:24:54 -05:00
|
|
|
|
2011-02-17 17:35:42 -05:00
|
|
|
virtual void step_height (bool);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-06-21 15:59:56 -04:00
|
|
|
virtual ARDOUR::RouteGroup* route_group() const { return 0; }
|
2007-01-09 18:24:54 -05:00
|
|
|
virtual boost::shared_ptr<ARDOUR::Playlist> playlist() const { return boost::shared_ptr<ARDOUR::Playlist> (); }
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2013-04-12 11:31:50 -04:00
|
|
|
virtual void set_samples_per_pixel (double);
|
2005-09-25 14:42:24 -04:00
|
|
|
virtual void show_selection (TimeSelection&);
|
|
|
|
virtual void hide_selection ();
|
|
|
|
virtual void reshow_selection (TimeSelection&);
|
2012-05-27 16:07:13 -04:00
|
|
|
virtual void show_timestretch (framepos_t start, framepos_t end, int layers, int layer);
|
2005-09-25 14:42:24 -04:00
|
|
|
virtual void hide_timestretch ();
|
|
|
|
|
|
|
|
/* editing operations */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-08-05 09:35:43 -04:00
|
|
|
virtual void cut_copy_clear (Selection&, Editing::CutCopyOp) {}
|
2014-11-16 17:04:27 -05:00
|
|
|
|
|
|
|
/** Paste a selection.
|
|
|
|
* @param pos Position to paste to (session frames).
|
|
|
|
* @param selection Selection to paste.
|
2014-12-06 12:20:52 -05:00
|
|
|
* @param ctx Paste context.
|
2014-11-16 17:04:27 -05:00
|
|
|
*/
|
|
|
|
virtual bool paste (ARDOUR::framepos_t pos,
|
|
|
|
const Selection& selection,
|
2014-12-06 12:20:52 -05:00
|
|
|
PasteContext& ctx) { return false; }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
virtual void set_selected_regionviews (RegionSelection&) {}
|
2005-09-25 14:42:24 -04:00
|
|
|
virtual void set_selected_points (PointSelection&) {}
|
|
|
|
|
2014-07-10 08:17:22 -04:00
|
|
|
virtual void fade_range (TimeSelection&) {}
|
|
|
|
|
2010-12-03 17:26:29 -05:00
|
|
|
virtual boost::shared_ptr<ARDOUR::Region> find_next_region (framepos_t /*pos*/, ARDOUR::RegionPoint, int32_t /*dir*/) {
|
2006-08-29 17:21:48 -04:00
|
|
|
return boost::shared_ptr<ARDOUR::Region> ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2014-08-30 14:56:31 -04:00
|
|
|
void order_selection_trims (ArdourCanvas::Item *item, bool put_start_on_top);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2015-01-09 13:20:02 -05:00
|
|
|
virtual void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable*>&, bool within = false);
|
2009-05-12 13:03:42 -04:00
|
|
|
virtual void get_inverted_selectables (Selection&, std::list<Selectable *>& results);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-02-10 13:16:25 -05:00
|
|
|
void add_ghost (RegionView*);
|
|
|
|
void remove_ghost (RegionView*);
|
|
|
|
void erase_ghost (GhostRegion*);
|
|
|
|
|
2009-01-01 19:17:55 -05:00
|
|
|
/** called at load time when first GUI idle occurs. put
|
|
|
|
expensive data loading/redisplay code in here. */
|
2008-03-17 16:54:03 -04:00
|
|
|
virtual void first_idle () {}
|
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
TimeAxisView* get_parent () { return parent; }
|
|
|
|
void set_parent (TimeAxisView& p);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-01-05 22:18:09 -05:00
|
|
|
virtual LayerDisplay layer_display () const { return Overlaid; }
|
|
|
|
virtual StreamView* view () const { return 0; }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-06-30 14:41:50 -04:00
|
|
|
typedef std::vector<boost::shared_ptr<TimeAxisView> > Children;
|
2010-08-09 13:27:56 -04:00
|
|
|
Children get_child_list ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-01-12 11:14:49 -05:00
|
|
|
SelectionRect* get_selection_rect(uint32_t id);
|
2014-08-30 14:56:31 -04:00
|
|
|
|
2010-05-10 20:09:41 -04:00
|
|
|
static uint32_t preset_height (Height);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2014-08-30 14:56:31 -04:00
|
|
|
protected:
|
2014-08-31 10:12:43 -04:00
|
|
|
static Glib::RefPtr<Gtk::SizeGroup> controls_meters_size_group;
|
2014-09-08 12:43:08 -04:00
|
|
|
static Glib::RefPtr<Gtk::SizeGroup> midi_scroomer_size_group;
|
2014-09-02 12:12:39 -04:00
|
|
|
static unsigned int name_width_px;
|
2009-01-01 19:17:55 -05:00
|
|
|
/* The Standard LHS Controls */
|
2013-01-14 16:46:32 -05:00
|
|
|
Gtk::Table controls_table;
|
2014-09-05 21:36:01 -04:00
|
|
|
Glib::RefPtr<Gtk::SizeGroup> controls_button_size_group;
|
2013-01-14 16:46:32 -05:00
|
|
|
Gtk::EventBox controls_ebox;
|
|
|
|
Gtk::VBox controls_vbox;
|
2014-08-31 13:43:32 -04:00
|
|
|
Gtk::VBox time_axis_vbox;
|
2014-09-03 09:03:35 -04:00
|
|
|
Gtk::HBox time_axis_hbox;
|
2014-08-30 14:56:31 -04:00
|
|
|
Gtk::Frame time_axis_frame;
|
2013-01-14 16:46:32 -05:00
|
|
|
Gtk::HBox name_hbox;
|
2014-08-11 15:44:12 -04:00
|
|
|
Gtk::HBox top_hbox;
|
2013-01-14 16:46:32 -05:00
|
|
|
Gtk::Label name_label;
|
2014-09-08 12:43:08 -04:00
|
|
|
Gtk::Fixed scroomer_placeholder;
|
2014-08-30 14:56:31 -04:00
|
|
|
bool _name_editing;
|
|
|
|
uint32_t height; /* in canvas units */
|
2013-01-14 16:46:32 -05:00
|
|
|
std::string controls_base_unselected_name;
|
|
|
|
std::string controls_base_selected_name;
|
|
|
|
Gtk::Menu* display_menu; /* The standard LHS Track control popup-menus */
|
|
|
|
TimeAxisView* parent;
|
2014-06-22 11:41:05 -04:00
|
|
|
ArdourCanvas::Container* selection_group;
|
|
|
|
ArdourCanvas::Container* _ghost_group;
|
2013-01-14 16:46:32 -05:00
|
|
|
std::list<GhostRegion*> ghosts;
|
|
|
|
std::list<SelectionRect*> free_selection_rects;
|
|
|
|
std::list<SelectionRect*> used_selection_rects;
|
|
|
|
bool _hidden;
|
|
|
|
bool in_destructor;
|
|
|
|
Gtk::Menu* _size_menu;
|
2014-09-04 11:01:28 -04:00
|
|
|
ArdourCanvas::Line* _canvas_separator;
|
2014-06-22 11:41:05 -04:00
|
|
|
ArdourCanvas::Container* _canvas_display;
|
2013-01-14 16:46:32 -05:00
|
|
|
double _y_position;
|
|
|
|
PublicEditor& _editor;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2014-08-30 14:56:31 -04:00
|
|
|
virtual bool can_edit_name() const;
|
2012-12-27 09:08:38 -05:00
|
|
|
|
2005-12-12 15:54:55 -05:00
|
|
|
bool name_entry_key_release (GdkEventKey *ev);
|
2013-01-19 10:27:04 -05:00
|
|
|
bool name_entry_key_press (GdkEventKey *ev);
|
2013-01-20 19:12:06 -05:00
|
|
|
bool name_entry_focus_out (GdkEventFocus *ev);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2014-08-30 14:56:31 -04:00
|
|
|
Gtk::Entry* name_entry;
|
2015-05-27 19:34:04 -04:00
|
|
|
bool ending_name_edit;
|
2014-08-30 14:56:31 -04:00
|
|
|
void begin_name_edit ();
|
|
|
|
void end_name_edit (int);
|
2013-01-14 16:46:32 -05:00
|
|
|
|
2005-12-12 15:54:55 -05:00
|
|
|
/* derived classes can override these */
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-12-12 15:54:55 -05:00
|
|
|
virtual void name_entry_changed ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
/** Handle mouse relaese on our LHS control name ebox.
|
2009-10-14 12:10:01 -04:00
|
|
|
*
|
2005-09-25 14:42:24 -04:00
|
|
|
*@ param ev the event
|
|
|
|
*/
|
2011-07-07 17:45:38 -04:00
|
|
|
virtual bool controls_ebox_button_release (GdkEventButton*);
|
|
|
|
virtual bool controls_ebox_scroll (GdkEventScroll*);
|
|
|
|
virtual bool controls_ebox_button_press (GdkEventButton*);
|
|
|
|
virtual bool controls_ebox_motion (GdkEventMotion*);
|
2011-07-11 08:57:17 -04:00
|
|
|
virtual bool controls_ebox_leave (GdkEventCrossing*);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
/** Display the standard LHS control menu at when.
|
2005-09-25 14:42:24 -04:00
|
|
|
*
|
|
|
|
* @param when the popup activation time
|
|
|
|
*/
|
|
|
|
virtual void popup_display_menu (guint32 when);
|
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
/** Build the standard LHS control menu.
|
2005-09-25 14:42:24 -04:00
|
|
|
* Subclasses should extend this method to add their own menu options.
|
|
|
|
*/
|
|
|
|
virtual void build_display_menu ();
|
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
/** Do whatever needs to be done to dynamically reset the LHS control menu.
|
2005-09-25 14:42:24 -04:00
|
|
|
*/
|
2009-07-21 11:55:17 -04:00
|
|
|
virtual bool handle_display_menu_map_event (GdkEventAny * /*ev*/) { return false; }
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-06-30 14:41:50 -04:00
|
|
|
Children children;
|
2009-07-09 13:58:13 -04:00
|
|
|
bool is_child (TimeAxisView*);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-12-11 21:17:17 -05:00
|
|
|
virtual void remove_child (boost::shared_ptr<TimeAxisView>);
|
2009-07-09 13:58:13 -04:00
|
|
|
void add_child (boost::shared_ptr<TimeAxisView>);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
/* selection display */
|
|
|
|
|
|
|
|
virtual void selection_click (GdkEventButton*);
|
|
|
|
|
2007-06-15 18:08:27 -04:00
|
|
|
void color_handler ();
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2008-04-11 10:06:50 -04:00
|
|
|
void conditionally_add_to_selection ();
|
|
|
|
|
2011-02-16 12:59:28 -05:00
|
|
|
void build_size_menu ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-01-01 19:17:55 -05:00
|
|
|
private:
|
2014-08-30 14:56:31 -04:00
|
|
|
Gtk::VBox* control_parent;
|
2013-01-14 16:46:32 -05:00
|
|
|
int _order;
|
|
|
|
uint32_t _effective_height;
|
|
|
|
double _resize_drag_start;
|
2014-11-01 11:48:22 -04:00
|
|
|
bool _did_resize;
|
2013-01-14 16:46:32 -05:00
|
|
|
GdkCursor* _preresize_cursor;
|
|
|
|
bool _have_preresize_cursor;
|
2014-11-01 11:48:22 -04:00
|
|
|
bool _ebox_release_can_act;
|
2009-01-05 22:18:09 -05:00
|
|
|
|
2011-08-31 11:07:44 -04:00
|
|
|
static uint32_t button_height;
|
2010-05-10 20:09:41 -04:00
|
|
|
static uint32_t extra_height;
|
2009-01-05 22:18:09 -05:00
|
|
|
static int const _max_order;
|
2014-08-30 14:56:31 -04:00
|
|
|
|
2013-01-14 16:46:32 -05:00
|
|
|
void compute_heights ();
|
2011-07-07 17:45:38 -04:00
|
|
|
bool maybe_set_cursor (int y);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}; /* class TimeAxisView */
|
|
|
|
|
|
|
|
#endif /* __ardour_gtk_time_axis_h__ */
|