X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Ftime_axis_view_item.h;h=41d75883d36cc53813f10f2366e821ee5a1550e1;hb=e8903a7590caaa46498d3e53c9d7df63edb24090;hp=6a81080e96fe65007383c016d964a9a120a71acd;hpb=b0e4f81eb3a38b7236ec39f11d5211840a064d15;p=ardour.git diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h index 6a81080e96..41d75883d3 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -33,12 +33,12 @@ namespace ArdourCanvas { class Pixbuf; class Rectangle; class Item; - class Group; - class Text; + class Container; + class Text; } -using ARDOUR::framepos_t; -using ARDOUR::framecnt_t; +using ARDOUR::samplepos_t; +using ARDOUR::samplecnt_t; /** * Base class for items that may appear upon a TimeAxisView. @@ -46,17 +46,17 @@ using ARDOUR::framecnt_t; class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList { - public: +public: virtual ~TimeAxisViewItem(); - virtual bool set_position(framepos_t, void*, double* delta = 0); - framepos_t get_position() const; - virtual bool set_duration(framecnt_t, void*); - framecnt_t get_duration() const; - virtual void set_max_duration(framecnt_t, void*); - framecnt_t get_max_duration() const; - virtual void set_min_duration(framecnt_t, void*); - framecnt_t get_min_duration() const; + virtual bool set_position(samplepos_t, void*, double* delta = 0); + samplepos_t get_position() const; + virtual bool set_duration(samplecnt_t, void*); + samplecnt_t get_duration() const; + virtual void set_max_duration(samplecnt_t, void*); + samplecnt_t get_max_duration() const; + virtual void set_min_duration(samplecnt_t, void*); + samplecnt_t get_min_duration() const; virtual void set_position_locked(bool, void*); bool get_position_locked() const; void set_max_duration_active(bool, void*); @@ -71,21 +71,23 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList TimeAxisView& get_time_axis_view () const; void set_name_text(const std::string&); virtual void set_height(double h); + virtual double height() const { return _height; } void set_y (double); - void set_color (Gdk::Color const &); + void set_color (uint32_t); + void set_name_text_color (); - uint32_t get_fill_color () const; + virtual uint32_t get_fill_color () const; - ArdourCanvas::Item* get_canvas_frame(); - ArdourCanvas::Group* get_canvas_group(); + ArdourCanvas::Item* get_canvas_sample(); + ArdourCanvas::Item* get_canvas_group(); ArdourCanvas::Item* get_name_highlight(); virtual void set_samples_per_pixel (double); double get_samples_per_pixel () const; - virtual void drag_start() { _dragging = true; } - virtual void drag_end() { _dragging = false; } + virtual void drag_start(); + virtual void drag_end(); bool dragging() const { return _dragging; } virtual void raise () { return; } @@ -93,9 +95,6 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList virtual void lower () { return; } virtual void lower_to_bottom () { return; } - virtual void hide_rect (); - virtual void show_rect (); - /** @return true if the name area should respond to events */ bool name_active() const { return name_connected; } @@ -107,8 +106,8 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList static const double GRAB_HANDLE_WIDTH; /* these are not constant, but vary with the pixel size - of the font used to display the item name. - */ + * of the font used to display the item name. + */ static int NAME_HEIGHT; static double NAME_Y_OFFSET; static double NAME_HIGHLIGHT_SIZE; @@ -128,19 +127,19 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList sigc::signal NameChanged; /** Emiited when the position of this item changes */ - sigc::signal PositionChanged; + sigc::signal PositionChanged; /** Emitted when the position lock of this item is changed */ sigc::signal PositionLockChanged; /** Emitted when the duration of this item changes */ - sigc::signal DurationChanged; + sigc::signal DurationChanged; /** Emitted when the maximum item duration is changed */ - sigc::signal MaxDurationChanged; + sigc::signal MaxDurationChanged; /** Emitted when the mionimum item duration is changed */ - sigc::signal MinDurationChanged; + sigc::signal MinDurationChanged; enum Visibility { ShowFrame = 0x1, @@ -153,25 +152,22 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList FullWidthNameHighlight = 0x80 }; - protected: - TimeAxisViewItem(const std::string &, ArdourCanvas::Group&, TimeAxisView&, double, Gdk::Color const &, - framepos_t, framecnt_t, bool recording = false, bool automation = false, Visibility v = Visibility (0)); +protected: + TimeAxisViewItem (const std::string &, ArdourCanvas::Item&, TimeAxisView&, double, uint32_t fill_color, + samplepos_t, samplecnt_t, bool recording = false, bool automation = false, Visibility v = Visibility (0)); TimeAxisViewItem (const TimeAxisViewItem&); - void init (ArdourCanvas::Group*, double, Gdk::Color const &, framepos_t, framepos_t, Visibility, bool, bool); + void init (ArdourCanvas::Item*, double, uint32_t, samplepos_t, samplepos_t, Visibility, bool, bool); - virtual bool canvas_group_event (GdkEvent*); + virtual bool canvas_group_event (GdkEvent*); - virtual void compute_colors (Gdk::Color const &); virtual void set_colors(); - virtual void set_frame_color(); - virtual void set_frame_gradient (); + virtual void set_sample_color(); + virtual void set_sample_gradient (); void set_trim_handle_colors(); virtual void reset_width_dependent_items (double); - void reset_name_width (double); - void update_name_text_visibility (); static gint idle_remove_this_item(TimeAxisViewItem*, void*); @@ -182,16 +178,16 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList bool position_locked; /** position of this item on the timeline */ - framepos_t frame_position; + samplepos_t sample_position; /** duration of this item upon the timeline */ - framecnt_t item_duration; + samplecnt_t item_duration; /** maximum duration that this item can have */ - framecnt_t max_item_duration; + samplecnt_t max_item_duration; /** minimum duration that this item can have */ - framecnt_t min_item_duration; + samplecnt_t min_item_duration; /** indicates whether the max duration constraint is active */ bool max_duration_active; @@ -199,7 +195,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList /** indicates whether the min duration constraint is active */ bool min_duration_active; - /** frames per canvas pixel */ + /** samples per canvas pixel */ double samples_per_pixel; /** should the item respond to events */ @@ -214,52 +210,37 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList /** true if the name should respond to events */ bool name_connected; - /** true if a small vestigial rect should be shown when the item gets very narrow */ - bool show_vestigial; - - uint32_t fill_opacity; uint32_t fill_color; - uint32_t frame_color_r; - uint32_t frame_color_g; - uint32_t frame_color_b; - uint32_t selected_frame_color_r; - uint32_t selected_frame_color_g; - uint32_t selected_frame_color_b; - uint32_t label_color; - - uint32_t handle_color_r; - uint32_t handle_color_g; - uint32_t handle_color_b; - uint32_t lock_handle_color_r; - uint32_t lock_handle_color_g; - uint32_t lock_handle_color_b; + uint32_t last_item_width; int name_text_width; bool wide_enough_for_name; bool high_enough_for_name; - bool rect_visible; - ArdourCanvas::Group* group; - ArdourCanvas::Rectangle* vestigial_frame; - ArdourCanvas::Rectangle* frame; + ArdourCanvas::Container* group; + ArdourCanvas::Rectangle* sample; + ArdourCanvas::Rectangle* selection_sample; ArdourCanvas::Text* name_text; ArdourCanvas::Rectangle* name_highlight; - /* with these two values, if frame_handle_start == 0 then frame_handle_end will also be 0 */ - 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 + /* with these two values, if sample_handle_start == 0 then sample_handle_end will also be 0 */ + ArdourCanvas::Rectangle* sample_handle_start; ///< `sample' (fade) handle for the start of the item, or 0 + ArdourCanvas::Rectangle* sample_handle_end; ///< `sample' (fade) handle for the end of the item, or 0 - bool frame_handle_crossing (GdkEvent*, ArdourCanvas::Rectangle*); + bool sample_handle_crossing (GdkEvent*, ArdourCanvas::Rectangle*); double _height; Visibility visibility; + std::string fill_color_name; bool _recregion; bool _automation; ///< true if this is an automation region view bool _dragging; + double _width; private: - void parameter_changed (std::string); + void manage_name_highlight (); + void manage_name_text (); }; /* class TimeAxisViewItem */