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>
|
|
|
|
#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>
|
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
|
|
|
|
|
|
|
#include "prompter.h"
|
|
|
|
#include "axis_view.h"
|
|
|
|
#include "enums.h"
|
|
|
|
#include "editing.h"
|
2005-11-14 11:42:29 -05:00
|
|
|
#include "canvas.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;
|
|
|
|
}
|
|
|
|
|
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;
|
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.
|
|
|
|
*/
|
2009-07-09 13:58:13 -04:00
|
|
|
class TimeAxisView : public virtual AxisView, public PBD::Stateful
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-01-17 21:56:51 -05:00
|
|
|
private:
|
|
|
|
enum NamePackingBits {
|
|
|
|
NameLabelPacked = 0x1,
|
|
|
|
NameEntryPacked = 0x2
|
|
|
|
};
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
public:
|
2006-01-17 21:56:51 -05:00
|
|
|
|
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-01-01 19:17:55 -05:00
|
|
|
XMLNode& get_state ();
|
2009-10-15 14:56:11 -04:00
|
|
|
int set_state (const XMLNode&, int version);
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-12-25 16:06:52 -05:00
|
|
|
static PBD::Signal1<void,TimeAxisView*> CatchDeletion;
|
|
|
|
|
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; }
|
|
|
|
|
2009-01-01 19:17:55 -05:00
|
|
|
ArdourCanvas::Group* canvas_display () { return _canvas_display; }
|
|
|
|
ArdourCanvas::Group* canvas_background () { return _canvas_background; }
|
|
|
|
ArdourCanvas::Group* 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
|
|
|
|
0 if this TimeAxisView has not yet been shown */
|
|
|
|
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
|
|
|
|
|
|
|
bool resizer_button_press (GdkEventButton*);
|
|
|
|
bool resizer_button_release (GdkEventButton*);
|
|
|
|
bool resizer_motion (GdkEventMotion*);
|
|
|
|
bool resizer_expose (GdkEventExpose*);
|
|
|
|
|
|
|
|
void idle_resize (uint32_t);
|
|
|
|
|
2006-01-17 21:56:51 -05:00
|
|
|
void hide_name_label ();
|
|
|
|
void hide_name_entry ();
|
|
|
|
void show_name_label ();
|
|
|
|
void show_name_entry ();
|
|
|
|
|
2010-01-08 21:36:47 -05:00
|
|
|
virtual bool set_visibility (bool);
|
2005-09-25 14:42:24 -04:00
|
|
|
virtual guint32 show_at (double y, int& nth, Gtk::VBox *parent);
|
|
|
|
|
2008-10-04 06:38:20 -04:00
|
|
|
void clip_to_viewport ();
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
bool touched (double top, double bot);
|
|
|
|
|
2009-01-01 19:17:55 -05:00
|
|
|
/** Hide this TrackView */
|
2005-09-25 14:42:24 -04:00
|
|
|
virtual void hide ();
|
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
|
|
|
|
|
|
|
virtual void set_selected (bool);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* potential handler for entered events
|
|
|
|
*/
|
|
|
|
|
|
|
|
virtual void entered () {}
|
|
|
|
virtual void exited () {}
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
virtual void set_height (uint32_t h);
|
2010-05-10 20:09:41 -04:00
|
|
|
void set_height (Height);
|
2005-09-25 14:42:24 -04:00
|
|
|
void reset_height();
|
2006-01-17 21:56:51 -05:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
std::pair<TimeAxisView*, ARDOUR::layer_t> covers_y_position (double);
|
2007-01-09 18:24:54 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Steps through the defined heights for this TrackView.
|
2005-09-25 14:42:24 -04:00
|
|
|
* Sets bigger to true to step up in size, set to fals eot step smaller.
|
|
|
|
*
|
|
|
|
* @param bigger true if stepping should increase in size, false otherwise
|
|
|
|
*/
|
|
|
|
virtual void step_height (bool bigger);
|
|
|
|
|
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
|
|
|
|
|
|
|
virtual void set_samples_per_unit (double);
|
|
|
|
virtual void show_selection (TimeSelection&);
|
|
|
|
virtual void hide_selection ();
|
|
|
|
virtual void reshow_selection (TimeSelection&);
|
2006-10-21 15:01:50 -04:00
|
|
|
virtual void show_timestretch (nframes_t start, nframes_t end);
|
2005-09-25 14:42:24 -04:00
|
|
|
virtual void hide_timestretch ();
|
|
|
|
|
|
|
|
virtual void hide_dependent_views (TimeAxisViewItem&) {}
|
|
|
|
virtual void reveal_dependent_views (TimeAxisViewItem&) {}
|
|
|
|
|
|
|
|
/* 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) {}
|
2010-08-05 09:36:38 -04:00
|
|
|
virtual bool paste (ARDOUR::framepos_t, float /*times*/, Selection&, size_t /*nth*/) { 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&) {}
|
|
|
|
|
2009-07-21 11:55:17 -04:00
|
|
|
virtual boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_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
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
void order_selection_trims (ArdourCanvas::Item *item, bool put_start_on_top);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-08-06 19:28:44 -04:00
|
|
|
virtual void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable*>&);
|
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
|
|
|
bool has_state () const;
|
|
|
|
|
|
|
|
/* call this on the parent */
|
|
|
|
|
2010-09-07 19:26:21 -04:00
|
|
|
virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter, int) { return 0; }
|
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);
|
2010-05-10 20:09:41 -04:00
|
|
|
|
|
|
|
static uint32_t preset_height (Height);
|
2010-01-12 11:14:49 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
protected:
|
2009-01-01 19:17:55 -05:00
|
|
|
/* The Standard LHS Controls */
|
|
|
|
Gtk::HBox controls_hbox;
|
|
|
|
Gtk::Table controls_table;
|
|
|
|
Gtk::EventBox controls_ebox;
|
|
|
|
Gtk::VBox controls_vbox;
|
2010-04-03 18:35:44 -04:00
|
|
|
Gtk::VBox time_axis_vbox;
|
2009-01-01 19:17:55 -05:00
|
|
|
Gtk::DrawingArea resizer;
|
|
|
|
Gtk::HBox resizer_box;
|
|
|
|
Gtk::HBox name_hbox;
|
|
|
|
Gtk::Frame name_frame;
|
|
|
|
Gtkmm2ext::FocusEntry name_entry;
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
uint32_t height; /* in canvas units */
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
std::string controls_base_unselected_name;
|
|
|
|
std::string controls_base_selected_name;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-12-12 15:54:55 -05:00
|
|
|
bool name_entry_button_press (GdkEventButton *ev);
|
|
|
|
bool name_entry_button_release (GdkEventButton *ev);
|
|
|
|
bool name_entry_key_release (GdkEventKey *ev);
|
|
|
|
void name_entry_activated ();
|
|
|
|
sigc::connection name_entry_key_timeout;
|
|
|
|
bool name_entry_key_timed_out ();
|
|
|
|
guint32 last_name_entry_key_press_event;
|
2009-10-14 12:10:01 -04: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 ();
|
|
|
|
virtual bool name_entry_focus_in (GdkEventFocus *ev);
|
|
|
|
virtual bool name_entry_focus_out (GdkEventFocus *ev);
|
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
|
|
|
|
*/
|
2005-12-23 10:34:02 -05:00
|
|
|
virtual bool controls_ebox_button_release (GdkEventButton *ev);
|
|
|
|
virtual bool controls_ebox_scroll (GdkEventScroll *ev);
|
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
|
|
|
|
|
|
|
/* The standard LHS Track control popup-menus */
|
|
|
|
|
|
|
|
Gtk::Menu *display_menu;
|
|
|
|
|
|
|
|
Gtk::Label name_label;
|
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
TimeAxisView* parent;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
/** Find the parent with state */
|
2009-07-09 13:58:13 -04:00
|
|
|
TimeAxisView* get_parent_with_state();
|
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
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
void remove_child (boost::shared_ptr<TimeAxisView>);
|
|
|
|
void add_child (boost::shared_ptr<TimeAxisView>);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
/* selection display */
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
ArdourCanvas::Group *selection_group;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
std::list<GhostRegion*> ghosts;
|
2008-02-10 13:16:25 -05:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
std::list<SelectionRect*> free_selection_rects;
|
|
|
|
std::list<SelectionRect*> used_selection_rects;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
virtual void selection_click (GdkEventButton*);
|
|
|
|
|
|
|
|
bool _hidden;
|
|
|
|
bool _has_state;
|
2008-02-10 13:16:25 -05:00
|
|
|
bool in_destructor;
|
2006-01-17 21:56:51 -05:00
|
|
|
NamePackingBits name_packing;
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
void set_heights (uint32_t h);
|
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 ();
|
|
|
|
|
2009-01-01 19:17:55 -05:00
|
|
|
ArdourCanvas::Group* _canvas_display;
|
|
|
|
double _y_position;
|
|
|
|
PublicEditor& _editor;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-01-01 19:17:55 -05:00
|
|
|
private:
|
|
|
|
|
|
|
|
ArdourCanvas::Group* _canvas_background;
|
|
|
|
Gtk::VBox* control_parent;
|
|
|
|
int _order;
|
|
|
|
uint32_t _effective_height;
|
|
|
|
double _resize_drag_start;
|
|
|
|
ArdourCanvas::Group* _ghost_group;
|
2009-01-05 22:18:09 -05:00
|
|
|
|
2010-05-10 20:09:41 -04:00
|
|
|
void compute_heights ();
|
|
|
|
static uint32_t extra_height;
|
|
|
|
static uint32_t smaller_height;
|
|
|
|
|
2009-01-05 22:18:09 -05:00
|
|
|
static int const _max_order;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}; /* class TimeAxisView */
|
|
|
|
|
|
|
|
#endif /* __ardour_gtk_time_axis_h__ */
|
|
|
|
|