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