X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Ftime_axis_view_item.h;h=80d917704187a75cdc7ba9ad2d670d712c36d6d9;hb=f9f5ec85fbfd15d0008f70d4185a84eeadfd3891;hp=a71f46c275ac53938415bb1d3f837f6fa55d4a14;hpb=60f817b0d2411947c257ecbf0b0376589ea77acd;p=ardour.git diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h index a71f46c275..80d9177041 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -21,12 +21,14 @@ #ifndef __gtk_ardour_time_axis_view_item_h__ #define __gtk_ardour_time_axis_view_item_h__ -#include -#include #include #include +#include + #include "selectable.h" +#include "simplerect.h" +#include "canvas.h" class TimeAxisView; @@ -34,7 +36,7 @@ class TimeAxisView; * A base class for 'items' that may appear upon a TimeAxisView * */ -class TimeAxisViewItem : public sigc::trackable, public Selectable +class TimeAxisViewItem : public Selectable { public: virtual ~TimeAxisViewItem() ; @@ -46,14 +48,14 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable * @param src the identity of the object that initiated the change * @return true if the position change was a success, false otherwise */ - virtual bool set_position(jack_nframes_t pos, void* src, double* delta = 0) ; + virtual bool set_position(nframes_t pos, void* src, double* delta = 0) ; /** * Return the position of this item upon the timeline * * @return the position of this item */ - jack_nframes_t get_position() const ; + nframes_t get_position() const ; /** * Sets the duration of this item @@ -62,13 +64,13 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable * @param src the identity of the object that initiated the change * @return true if the duration change was succesful, false otherwise */ - virtual bool set_duration(jack_nframes_t dur, void* src) ; + virtual bool set_duration(nframes_t dur, void* src) ; /** * Returns the duration of this item * */ - jack_nframes_t get_duration() const ; + nframes_t get_duration() const ; /** * Sets the maximum duration that this item make have. @@ -76,14 +78,14 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable * @param dur the new maximum duration * @param src the identity of the object that initiated the change */ - virtual void set_max_duration(jack_nframes_t dur, void* src) ; + virtual void set_max_duration(nframes_t dur, void* src) ; /** * Returns the maxmimum duration that this item may be set to * * @return the maximum duration that this item may be set to */ - jack_nframes_t get_max_duration() const ; + nframes_t get_max_duration() const ; /** * Sets the minimu duration that this item may be set to @@ -91,14 +93,14 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable * @param the minimum duration that this item may be set to * @param src the identity of the object that initiated the change */ - virtual void set_min_duration(jack_nframes_t dur, void* src) ; + virtual void set_min_duration(nframes_t dur, void* src) ; /** * Returns the minimum duration that this item mey be set to * * @return the nimum duration that this item mey be set to */ - jack_nframes_t get_min_duration() const ; + nframes_t get_min_duration() const ; /** * Sets whether the position of this Item is locked to its current position @@ -166,9 +168,8 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable * Set to true to indicate that this item is currently selected * * @param yn true if this item is currently selected - * @param src the identity of the object that initiated the change */ - virtual void set_selected(bool yn, void* src) ; + virtual void set_selected(bool yn) ; /** * Set to true to indicate that this item should show its selection status @@ -177,13 +178,6 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable */ virtual void set_should_show_selection (bool yn) ; - /** - * Returns whether this item is currently selected. - * - * @return true if this item is currently selected, false otherwise - */ - bool get_selected() const ; - //---------------------------------------------------------------------------------------// // Parent Component Methods @@ -220,22 +214,28 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable /** * */ - GnomeCanvasItem* get_canvas_frame() ; + ArdourCanvas::Item* get_canvas_frame() ; /** * */ - GnomeCanvasItem* get_canvas_group(); + ArdourCanvas::Item* get_canvas_group(); /** * */ - GnomeCanvasItem* get_name_highlight(); + ArdourCanvas::Item* get_name_highlight(); /** * */ - GnomeCanvasItem* get_name_text(); + ArdourCanvas::Text* get_name_text(); + + + /** + * Returns the time axis that this item is upon + */ + TimeAxisView& get_trackview() const { return trackview; } /** * Sets the samples per unit of this item. @@ -264,12 +264,16 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable bool name_active() const { return name_connected; } // Default sizes, font and spacing - static std::string NAME_FONT ; + static Pango::FontDescription NAME_FONT ; + static bool have_name_font; static const double NAME_X_OFFSET ; - static const double NAME_Y_OFFSET ; - static const double NAME_HIGHLIGHT_SIZE ; - static const double NAME_HIGHLIGHT_THRESH ; static const double GRAB_HANDLE_LENGTH ; + /* these are not constant, but vary with the pixel size + of the font used to display the item name. + */ + static double NAME_Y_OFFSET ; + static double NAME_HIGHLIGHT_SIZE ; + static double NAME_HIGHLIGHT_THRESH ; /** * Handles the Removal of this time axis item @@ -296,31 +300,31 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable 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 ; - /** Emitted when the selected status of this item changes */ - sigc::signal Selected ; - - protected: enum Visibility { ShowFrame = 0x1, ShowNameHighlight = 0x2, ShowNameText = 0x4, - ShowHandles = 0x8 + ShowHandles = 0x8, + HideFrameLeft = 0x10, + HideFrameRight = 0x20, + HideFrameTB = 0x40, + FullWidthNameHighlight = 0x80 }; /** @@ -334,15 +338,15 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable * @param start the start point of this item * @param duration the duration of this item */ - TimeAxisViewItem(std::string it_name, GnomeCanvasGroup* parent, TimeAxisView& tv, double spu, Gdk::Color& base_color, - jack_nframes_t start, jack_nframes_t duration, Visibility v = Visibility (0)); + TimeAxisViewItem(const std::string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color& base_color, + nframes_t start, nframes_t duration, Visibility v = Visibility (0)); /** * Calculates some contrasting color for displaying various parts of this item, based upon the base color * * @param color the base color of the item */ - virtual void compute_colors(GdkColor& color) ; + virtual void compute_colors(Gdk::Color& color) ; /** * convenience method to set the various canvas item colors @@ -380,16 +384,16 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable bool position_locked ; /** The posotion of this item on the timeline */ - jack_nframes_t frame_position ; + nframes_t frame_position ; /** the duration of this item upon the timeline */ - jack_nframes_t item_duration ; + nframes_t item_duration ; /** the maximum duration that we allow this item to take */ - jack_nframes_t max_item_duration ; + nframes_t max_item_duration ; /** the minimu duration that we allow this item to take */ - jack_nframes_t min_item_duration ; + nframes_t min_item_duration ; /** indicates whether this Max Duration constraint is active */ bool max_duration_active ; @@ -440,13 +444,15 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable uint32_t lock_handle_color_g ; uint32_t lock_handle_color_b ; - GnomeCanvasItem* group ; /* the group */ - GnomeCanvasItem* vestigial_frame ; /* simplerect */ - GnomeCanvasItem* frame ; /* simplerect */ - GnomeCanvasItem* name_text ; /* text */ - GnomeCanvasItem* name_highlight ; /* simplerect */ - GnomeCanvasItem* frame_handle_start ; /* simplerect */ - GnomeCanvasItem* frame_handle_end ; /* simplerect */ + ArdourCanvas::Group* group; + ArdourCanvas::SimpleRect* vestigial_frame; + ArdourCanvas::SimpleRect* frame; + ArdourCanvas::Text* name_text; + ArdourCanvas::SimpleRect* name_highlight; + ArdourCanvas::SimpleRect* frame_handle_start; + ArdourCanvas::SimpleRect* frame_handle_end; + + Visibility visibility; }; /* class TimeAxisViewItem */