2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2005-2009 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
* Copyright (C) 2005-2019 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2005 Karsten Wiese <fzuuzf@googlemail.com>
|
|
|
|
* Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
|
|
|
|
* Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2008-2014 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2017-2019 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.
|
|
|
|
*/
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#ifndef __gtk_ardour_time_axis_view_item_h__
|
|
|
|
#define __gtk_ardour_time_axis_view_item_h__
|
|
|
|
|
|
|
|
#include <string>
|
2013-04-24 15:42:14 -04:00
|
|
|
#include <gdk/gdk.h>
|
2013-04-04 00:32:52 -04:00
|
|
|
#include <gdkmm/color.h>
|
|
|
|
#include <pangomm/fontdescription.h>
|
2009-12-19 15:26:31 -05:00
|
|
|
#include "pbd/signals.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "selectable.h"
|
|
|
|
|
|
|
|
class TimeAxisView;
|
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
namespace ArdourCanvas {
|
|
|
|
class Pixbuf;
|
|
|
|
class Rectangle;
|
|
|
|
class Item;
|
2016-12-21 15:57:39 -05:00
|
|
|
class Container;
|
2019-04-13 11:48:27 -04:00
|
|
|
class Text;
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
using ARDOUR::samplepos_t;
|
|
|
|
using ARDOUR::samplecnt_t;
|
2010-09-17 14:20:37 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
/**
|
2010-04-07 07:03:00 -04:00
|
|
|
* Base class for items that may appear upon a TimeAxisView.
|
2005-09-25 14:42:24 -04:00
|
|
|
*/
|
2010-04-07 07:03:00 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2010-04-07 07:03:00 -04:00
|
|
|
virtual ~TimeAxisViewItem();
|
|
|
|
|
2020-09-26 11:14:59 -04:00
|
|
|
virtual bool set_position(Temporal::timepos_t const &, void*, double* delta = 0);
|
|
|
|
Temporal::timepos_t get_position() const;
|
|
|
|
virtual bool set_duration(Temporal::timecnt_t const &, void*);
|
|
|
|
Temporal::timecnt_t get_duration() const;
|
|
|
|
virtual void set_max_duration(Temporal::timecnt_t const &, void*);
|
|
|
|
Temporal::timecnt_t get_max_duration() const;
|
|
|
|
virtual void set_min_duration(Temporal::timecnt_t const &, void*);
|
|
|
|
Temporal::timecnt_t get_min_duration() const;
|
2010-04-07 07:03:00 -04:00
|
|
|
virtual void set_position_locked(bool, void*);
|
|
|
|
bool get_position_locked() const;
|
|
|
|
void set_max_duration_active(bool, void*);
|
|
|
|
bool get_max_duration_active() const;
|
|
|
|
void set_min_duration_active(bool, void*);
|
|
|
|
bool get_min_duration_active() const;
|
|
|
|
void set_item_name(std::string, void*);
|
|
|
|
virtual std::string get_item_name() const;
|
|
|
|
virtual void set_selected(bool yn);
|
|
|
|
void set_sensitive (bool yn) { _sensitive = yn; }
|
|
|
|
bool sensitive () const { return _sensitive; }
|
2010-09-06 08:34:11 -04:00
|
|
|
TimeAxisView& get_time_axis_view () const;
|
2010-09-14 12:51:02 -04:00
|
|
|
void set_name_text(const std::string&);
|
2010-04-07 07:03:00 -04:00
|
|
|
virtual void set_height(double h);
|
2014-06-18 10:24:59 -04:00
|
|
|
virtual double height() const { return _height; }
|
2010-04-07 07:03:00 -04:00
|
|
|
void set_y (double);
|
2014-06-09 23:28:32 -04:00
|
|
|
void set_color (uint32_t);
|
2014-06-05 12:00:24 -04:00
|
|
|
void set_name_text_color ();
|
2010-06-24 15:46:28 -04:00
|
|
|
|
2022-12-08 23:29:33 -05:00
|
|
|
virtual void set_frame_color();
|
2014-12-16 20:37:16 -05:00
|
|
|
virtual uint32_t get_fill_color () const;
|
2013-06-24 16:28:53 -04:00
|
|
|
|
2019-04-08 15:40:33 -04:00
|
|
|
ArdourCanvas::Item* get_canvas_frame();
|
2014-06-21 11:44:22 -04:00
|
|
|
ArdourCanvas::Item* get_canvas_group();
|
2010-04-07 07:03:00 -04:00
|
|
|
ArdourCanvas::Item* get_name_highlight();
|
|
|
|
|
2013-04-12 11:31:50 -04:00
|
|
|
virtual void set_samples_per_pixel (double);
|
2010-04-07 07:03:00 -04:00
|
|
|
|
2013-04-12 11:31:50 -04:00
|
|
|
double get_samples_per_pixel () const;
|
2010-04-07 07:03:00 -04:00
|
|
|
|
2014-06-13 10:56:46 -04:00
|
|
|
virtual void drag_start();
|
|
|
|
virtual void drag_end();
|
2012-05-07 18:02:17 -04:00
|
|
|
bool dragging() const { return _dragging; }
|
|
|
|
|
2023-06-25 14:44:35 -04:00
|
|
|
virtual void visual_layer_on_top() {}
|
|
|
|
virtual void raise () {}
|
|
|
|
virtual void raise_to_top () {}
|
|
|
|
virtual void lower () {}
|
|
|
|
virtual void lower_to_bottom () {}
|
2011-03-03 09:51:02 -05:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
/** @return true if the name area should respond to events */
|
|
|
|
bool name_active() const { return name_connected; }
|
|
|
|
|
|
|
|
// Default sizes, font and spacing
|
2011-06-02 13:50:37 -04:00
|
|
|
static Pango::FontDescription NAME_FONT;
|
2010-06-03 11:57:31 -04:00
|
|
|
static void set_constant_heights ();
|
2010-04-07 07:03:00 -04:00
|
|
|
static const double NAME_X_OFFSET;
|
2012-04-30 19:00:15 -04:00
|
|
|
static const double GRAB_HANDLE_TOP;
|
|
|
|
static const double GRAB_HANDLE_WIDTH;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
/* these are not constant, but vary with the pixel size
|
2017-07-01 15:11:14 -04:00
|
|
|
* of the font used to display the item name.
|
|
|
|
*/
|
2010-04-07 07:03:00 -04:00
|
|
|
static int NAME_HEIGHT;
|
|
|
|
static double NAME_Y_OFFSET;
|
|
|
|
static double NAME_HIGHLIGHT_SIZE;
|
|
|
|
static double NAME_HIGHLIGHT_THRESH;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Emitted when this Group has been removed.
|
|
|
|
* This is different to the CatchDeletion signal in that this signal
|
|
|
|
* is emitted during the deletion of this Time Axis, and not during
|
|
|
|
* the destructor, this allows us to capture the source of the deletion
|
|
|
|
* event
|
|
|
|
*/
|
|
|
|
|
|
|
|
sigc::signal<void,std::string,void*> ItemRemoved;
|
|
|
|
|
|
|
|
enum Visibility {
|
|
|
|
ShowFrame = 0x1,
|
|
|
|
ShowNameHighlight = 0x2,
|
|
|
|
ShowNameText = 0x4,
|
|
|
|
ShowHandles = 0x8,
|
|
|
|
HideFrameLeft = 0x10,
|
|
|
|
HideFrameRight = 0x20,
|
|
|
|
HideFrameTB = 0x40,
|
|
|
|
FullWidthNameHighlight = 0x80
|
|
|
|
};
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2019-05-29 17:16:00 -04:00
|
|
|
virtual void update_visibility () {}
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
protected:
|
2014-06-21 11:44:22 -04:00
|
|
|
TimeAxisViewItem (const std::string &, ArdourCanvas::Item&, TimeAxisView&, double, uint32_t fill_color,
|
2020-10-15 21:07:15 -04:00
|
|
|
Temporal::timepos_t const &, Temporal::timecnt_t const &, bool recording = false, bool automation = false, Visibility v = Visibility (0));
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
TimeAxisViewItem (const TimeAxisViewItem&);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2020-10-15 21:07:15 -04:00
|
|
|
void init (ArdourCanvas::Item*, double, uint32_t, Temporal::timepos_t const &, Temporal::timecnt_t const &, Visibility, bool, bool);
|
2013-04-25 16:06:12 -04:00
|
|
|
|
2016-12-21 15:57:39 -05:00
|
|
|
virtual bool canvas_group_event (GdkEvent*);
|
2010-04-07 07:03:00 -04:00
|
|
|
|
|
|
|
virtual void set_colors();
|
2019-04-08 14:00:02 -04:00
|
|
|
virtual void set_frame_gradient ();
|
2018-11-25 21:24:32 -05:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
void set_trim_handle_colors();
|
|
|
|
|
|
|
|
virtual void reset_width_dependent_items (double);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
static gint idle_remove_this_item(TimeAxisViewItem*, void*);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
/** time axis that this item is on */
|
|
|
|
TimeAxisView& trackview;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
/** indicates whether this item is locked to its current position */
|
|
|
|
bool position_locked;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
/** position of this item on the timeline */
|
2020-10-15 21:07:15 -04:00
|
|
|
Temporal::timepos_t time_position;
|
2010-04-07 07:03:00 -04:00
|
|
|
|
|
|
|
/** duration of this item upon the timeline */
|
2020-10-15 21:07:15 -04:00
|
|
|
Temporal::timecnt_t item_duration;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
/** maximum duration that this item can have */
|
2020-10-15 21:07:15 -04:00
|
|
|
Temporal::timecnt_t max_item_duration;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
/** minimum duration that this item can have */
|
2020-10-15 21:07:15 -04:00
|
|
|
Temporal::timecnt_t min_item_duration;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
/** indicates whether the max duration constraint is active */
|
|
|
|
bool max_duration_active;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
/** indicates whether the min duration constraint is active */
|
|
|
|
bool min_duration_active;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
/** samples per canvas pixel */
|
2013-04-12 11:31:50 -04:00
|
|
|
double samples_per_pixel;
|
2010-04-07 07:03:00 -04:00
|
|
|
|
|
|
|
/** should the item respond to events */
|
|
|
|
bool _sensitive;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
/**
|
|
|
|
* The unique item name of this Item.
|
|
|
|
* Each item upon a time axis must have a unique id.
|
|
|
|
*/
|
|
|
|
std::string item_name;
|
|
|
|
|
|
|
|
/** true if the name should respond to events */
|
|
|
|
bool name_connected;
|
|
|
|
|
|
|
|
uint32_t fill_color;
|
2014-06-13 10:56:46 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
uint32_t last_item_width;
|
2013-04-15 13:50:05 -04:00
|
|
|
int name_text_width;
|
2010-04-07 07:03:00 -04:00
|
|
|
bool wide_enough_for_name;
|
|
|
|
bool high_enough_for_name;
|
2011-03-03 09:51:02 -05:00
|
|
|
|
2019-04-08 14:00:02 -04:00
|
|
|
ArdourCanvas::Container* group;
|
2018-11-25 21:24:32 -05:00
|
|
|
|
2019-04-08 14:00:02 -04:00
|
|
|
ArdourCanvas::Rectangle* frame;
|
|
|
|
ArdourCanvas::Rectangle* selection_frame;
|
2013-04-15 13:50:05 -04:00
|
|
|
ArdourCanvas::Text* name_text;
|
2013-04-04 00:32:52 -04:00
|
|
|
ArdourCanvas::Rectangle* name_highlight;
|
2010-07-19 19:26:10 -04:00
|
|
|
|
2019-04-08 14:25:05 -04:00
|
|
|
/* with these two values, if frame_handle_start == 0 then frame_handle_end will also be 0 */
|
2019-04-08 18:31:29 -04:00
|
|
|
ArdourCanvas::Rectangle* frame_handle_start; ///< `frame' (fade) handle for the start of the item, or 0
|
|
|
|
ArdourCanvas::Rectangle* frame_handle_end; ///< `frame' (fade) handle for the end of the item, or 0
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2019-04-08 15:40:33 -04:00
|
|
|
bool frame_handle_crossing (GdkEvent*, ArdourCanvas::Rectangle*);
|
2013-04-24 15:42:14 -04:00
|
|
|
|
2010-04-07 07:03:00 -04:00
|
|
|
double _height;
|
|
|
|
Visibility visibility;
|
2014-12-19 12:06:42 -05:00
|
|
|
std::string fill_color_name;
|
2010-04-07 07:03:00 -04:00
|
|
|
bool _recregion;
|
2010-09-01 18:35:46 -04:00
|
|
|
bool _automation; ///< true if this is an automation region view
|
2012-05-07 18:02:17 -04:00
|
|
|
bool _dragging;
|
2017-07-01 12:42:24 -04:00
|
|
|
double _width;
|
2011-02-08 15:01:55 -05:00
|
|
|
|
2019-05-29 17:16:00 -04:00
|
|
|
void manage_name_text ();
|
|
|
|
|
2011-02-08 15:01:55 -05:00
|
|
|
private:
|
|
|
|
void parameter_changed (std::string);
|
2016-12-21 15:57:39 -05:00
|
|
|
void manage_name_highlight ();
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}; /* class TimeAxisViewItem */
|
|
|
|
|
|
|
|
#endif /* __gtk_ardour_time_axis_view_item_h__ */
|