2 Copyright (C) 2003 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "pbd/error.h"
23 #include "pbd/stacktrace.h"
25 #include "ardour/types.h"
26 #include "ardour/ardour.h"
28 #include "gtkmm2ext/utils.h"
29 #include "gtkmm2ext/gui_thread.h"
31 #include "canvas/group.h"
32 #include "canvas/rectangle.h"
33 #include "canvas/debug.h"
34 #include "canvas/drag_handle.h"
35 #include "canvas/text.h"
36 #include "canvas/utils.h"
38 #include "ardour_ui.h"
40 * ardour_ui.h was moved up in the include list
41 * due to a conflicting definition of 'Rect' between
42 * Apple's MacTypes.h file and GTK
45 #include "public_editor.h"
46 #include "time_axis_view_item.h"
47 #include "time_axis_view.h"
49 #include "rgb_macros.h"
54 using namespace Editing;
57 using namespace ARDOUR;
58 using namespace Gtkmm2ext;
60 Pango::FontDescription TimeAxisViewItem::NAME_FONT;
61 const double TimeAxisViewItem::NAME_X_OFFSET = 15.0;
62 const double TimeAxisViewItem::GRAB_HANDLE_TOP = 0.0;
63 const double TimeAxisViewItem::GRAB_HANDLE_WIDTH = 10.0;
64 const double TimeAxisViewItem::RIGHT_EDGE_SHIFT = 1.0;
66 int TimeAxisViewItem::NAME_HEIGHT;
67 double TimeAxisViewItem::NAME_Y_OFFSET;
68 double TimeAxisViewItem::NAME_HIGHLIGHT_SIZE;
69 double TimeAxisViewItem::NAME_HIGHLIGHT_THRESH;
72 TimeAxisViewItem::set_constant_heights ()
74 NAME_FONT = get_font_for_style (X_("TimeAxisViewItemName"));
80 Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */
84 layout->set_font_description (NAME_FONT);
85 get_pixel_size (layout, width, height);
87 layout = foo.create_pango_layout (X_("H")); /* just the ascender */
90 NAME_Y_OFFSET = height + 1;
91 NAME_HIGHLIGHT_SIZE = height + 2;
92 NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3;
96 * Construct a new TimeAxisViewItem.
98 * @param it_name the unique name of this item
99 * @param parent the parent canvas group
100 * @param tv the TimeAxisView we are going to be added to
101 * @param spu samples per unit
103 * @param start the start point of this item
104 * @param duration the duration of this item
105 * @param recording true if this is a recording region view
106 * @param automation true if this is an automation region view
108 TimeAxisViewItem::TimeAxisViewItem(
109 const string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color const & base_color,
110 framepos_t start, framecnt_t duration, bool recording, bool automation, Visibility vis
113 , frame_position (-1)
114 , item_name (it_name)
116 , _recregion (recording)
117 , _automation (automation)
121 init (&parent, spu, base_color, start, duration, vis, true, true);
124 TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
127 , PBD::ScopedConnectionList()
128 , trackview (other.trackview)
129 , frame_position (-1)
130 , item_name (other.item_name)
132 , _recregion (other._recregion)
133 , _automation (other._automation)
134 , _dragging (other._dragging)
141 UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a);
142 c.set_rgb_p (r/255.0, g/255.0, b/255.0);
144 /* share the other's parent, but still create a new group */
146 ArdourCanvas::Group* parent = other.group->parent();
148 _selected = other._selected;
150 init (parent, other.samples_per_pixel, c, other.frame_position,
151 other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name);
155 TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, Gdk::Color const & base_color,
156 framepos_t start, framepos_t duration, Visibility vis,
157 bool wide, bool high)
159 group = new ArdourCanvas::Group (parent);
160 CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name()));
161 group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event));
163 samples_per_pixel = fpp;
164 frame_position = start;
165 item_duration = duration;
166 name_connected = false;
168 position_locked = false;
169 max_item_duration = ARDOUR::max_framepos;
170 min_item_duration = 0;
171 show_vestigial = true;
176 wide_enough_for_name = wide;
177 high_enough_for_name = high;
181 warning << "Time Axis Item Duration == 0" << endl;
184 vestigial_frame = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, 1.0, 2.0, trackview.current_height()));
185 CANVAS_DEBUG_NAME (vestigial_frame, string_compose ("vestigial frame for %1", get_item_name()));
186 vestigial_frame->hide ();
187 vestigial_frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_VestigialFrame());
188 vestigial_frame->set_fill_color (ARDOUR_UI::config()->get_canvasvar_VestigialFrame());
190 if (visibility & ShowFrame) {
191 frame = new ArdourCanvas::Rectangle (group,
192 ArdourCanvas::Rect (0.0, 0.0,
193 trackview.editor().sample_to_pixel(duration) + RIGHT_EDGE_SHIFT,
194 trackview.current_height() - 1.0));
196 CANVAS_DEBUG_NAME (frame, string_compose ("frame for %1", get_item_name()));
198 frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
201 frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_RecordingRect());
203 frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame());
206 frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::RIGHT|ArdourCanvas::Rectangle::LEFT));
213 if (visibility & ShowNameHighlight) {
218 if (visibility & FullWidthNameHighlight) {
220 width = trackview.editor().sample_to_pixel(item_duration) + RIGHT_EDGE_SHIFT;
223 width = trackview.editor().sample_to_pixel(item_duration) - 2.0 + RIGHT_EDGE_SHIFT;
226 name_highlight = new ArdourCanvas::Rectangle (group,
227 ArdourCanvas::Rect (start,
228 trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE,
229 width - 2.0 + RIGHT_EDGE_SHIFT,
230 trackview.current_height() - 1.0));
231 CANVAS_DEBUG_NAME (name_highlight, string_compose ("name highlight for %1", get_item_name()));
232 name_highlight->set_data ("timeaxisviewitem", this);
233 name_highlight->set_outline_what (ArdourCanvas::Rectangle::TOP);
234 name_highlight->set_outline_color (RGBA_TO_UINT (0,0,0,255));
240 if (visibility & ShowNameText) {
241 name_text = new ArdourCanvas::Text (group);
242 CANVAS_DEBUG_NAME (name_text, string_compose ("name text for %1", get_item_name()));
243 name_text->set_position (ArdourCanvas::Duple (NAME_X_OFFSET, trackview.current_height() - NAME_Y_OFFSET));
244 name_text->set_font_description (NAME_FONT);
249 /* create our grab handles used for trimming/duration etc */
250 if (!_recregion && !_automation) {
251 double top = TimeAxisViewItem::GRAB_HANDLE_TOP;
252 double width = TimeAxisViewItem::GRAB_HANDLE_WIDTH;
254 frame_handle_start = new ArdourCanvas::DragHandle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()), true);
255 CANVAS_DEBUG_NAME (frame_handle_start, "TAVI frame handle start");
256 frame_handle_start->set_outline (false);
257 frame_handle_start->set_fill (false);
258 frame_handle_start->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::frame_handle_crossing), frame_handle_start));
260 frame_handle_end = new ArdourCanvas::DragHandle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()), false);
261 CANVAS_DEBUG_NAME (frame_handle_end, "TAVI frame handle end");
262 frame_handle_end->set_outline (false);
263 frame_handle_end->set_fill (false);
264 frame_handle_end->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::frame_handle_crossing), frame_handle_end));
266 frame_handle_start = frame_handle_end = 0;
269 set_color (base_color);
271 set_duration (item_duration, this);
272 set_position (start, this);
274 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&TimeAxisViewItem::parameter_changed, this, _1), gui_context ());
275 ARDOUR_UI::config()->ParameterChanged.connect (sigc::mem_fun (*this, &TimeAxisViewItem::parameter_changed));
278 TimeAxisViewItem::~TimeAxisViewItem()
284 TimeAxisViewItem::canvas_group_event (GdkEvent* /*ev*/)
290 TimeAxisViewItem::hide_rect ()
292 rect_visible = false;
295 if (name_highlight) {
296 name_highlight->set_outline_what (ArdourCanvas::Rectangle::What (0));
297 name_highlight->set_fill_color (UINT_RGBA_CHANGE_A (fill_color, 64));
302 TimeAxisViewItem::show_rect ()
307 if (name_highlight) {
308 name_highlight->set_outline_what (ArdourCanvas::Rectangle::TOP);
309 name_highlight->set_fill_color (fill_color);
314 * Set the position of this item on the timeline.
316 * @param pos the new position
317 * @param src the identity of the object that initiated the change
318 * @return true on success
322 TimeAxisViewItem::set_position(framepos_t pos, void* src, double* delta)
324 if (position_locked) {
328 frame_position = pos;
330 double new_unit_pos = trackview.editor().sample_to_pixel (pos);
333 (*delta) = new_unit_pos - group->position().x;
338 if (new_unit_pos == group->position().x) {
343 group->set_x_position (new_unit_pos);
345 PositionChanged (frame_position, src); /* EMIT_SIGNAL */
350 /** @return position of this item on the timeline */
352 TimeAxisViewItem::get_position() const
354 return frame_position;
358 * Set the duration of this item.
360 * @param dur the new duration of this item
361 * @param src the identity of the object that initiated the change
362 * @return true on success
366 TimeAxisViewItem::set_duration (framecnt_t dur, void* src)
368 if ((dur > max_item_duration) || (dur < min_item_duration)) {
369 warning << string_compose (
370 P_("new duration %1 frame is out of bounds for %2", "new duration of %1 frames is out of bounds for %2", dur),
371 get_item_name(), dur)
382 reset_width_dependent_items (trackview.editor().sample_to_pixel (dur));
384 DurationChanged (dur, src); /* EMIT_SIGNAL */
388 /** @return duration of this item */
390 TimeAxisViewItem::get_duration() const
392 return item_duration;
396 * Set the maximum duration that this item can have.
398 * @param dur the new maximum duration
399 * @param src the identity of the object that initiated the change
402 TimeAxisViewItem::set_max_duration(framecnt_t dur, void* src)
404 max_item_duration = dur;
405 MaxDurationChanged(max_item_duration, src); /* EMIT_SIGNAL */
408 /** @return the maximum duration that this item may have */
410 TimeAxisViewItem::get_max_duration() const
412 return max_item_duration;
416 * Set the minimum duration that this item may have.
418 * @param the minimum duration that this item may be set to
419 * @param src the identity of the object that initiated the change
422 TimeAxisViewItem::set_min_duration(framecnt_t dur, void* src)
424 min_item_duration = dur;
425 MinDurationChanged(max_item_duration, src); /* EMIT_SIGNAL */
428 /** @return the minimum duration that this item mey have */
430 TimeAxisViewItem::get_min_duration() const
432 return min_item_duration;
436 * Set whether this item is locked to its current position.
437 * Locked items cannot be moved until the item is unlocked again.
439 * @param yn true to lock this item to its current position
440 * @param src the identity of the object that initiated the change
443 TimeAxisViewItem::set_position_locked(bool yn, void* src)
445 position_locked = yn;
446 set_trim_handle_colors();
447 PositionLockChanged (position_locked, src); /* EMIT_SIGNAL */
450 /** @return true if this item is locked to its current position */
452 TimeAxisViewItem::get_position_locked() const
454 return position_locked;
458 * Set whether the maximum duration constraint is active.
460 * @param active set true to enforce the max duration constraint
461 * @param src the identity of the object that initiated the change
464 TimeAxisViewItem::set_max_duration_active (bool active, void* /*src*/)
466 max_duration_active = active;
469 /** @return true if the maximum duration constraint is active */
471 TimeAxisViewItem::get_max_duration_active() const
473 return max_duration_active;
477 * Set whether the minimum duration constraint is active.
479 * @param active set true to enforce the min duration constraint
480 * @param src the identity of the object that initiated the change
484 TimeAxisViewItem::set_min_duration_active (bool active, void* /*src*/)
486 min_duration_active = active;
489 /** @return true if the maximum duration constraint is active */
491 TimeAxisViewItem::get_min_duration_active() const
493 return min_duration_active;
497 * Set the name of this item.
499 * @param new_name the new name of this item
500 * @param src the identity of the object that initiated the change
504 TimeAxisViewItem::set_item_name(std::string new_name, void* src)
506 if (new_name != item_name) {
507 std::string temp_name = item_name;
508 item_name = new_name;
509 NameChanged (item_name, temp_name, src); /* EMIT_SIGNAL */
513 /** @return the name of this item */
515 TimeAxisViewItem::get_item_name() const
521 * Set selection status.
523 * @param yn true if this item is currently selected
526 TimeAxisViewItem::set_selected(bool yn)
528 if (_selected != yn) {
529 Selectable::set_selected (yn);
534 /** @return the TimeAxisView that this item is on */
536 TimeAxisViewItem::get_time_axis_view () const
542 * Set the displayed item text.
543 * This item is the visual text name displayed on the canvas item, this can be different to the name of the item.
545 * @param new_name the new name text to display
549 TimeAxisViewItem::set_name_text(const string& new_name)
555 name_text_width = pixel_width (new_name, NAME_FONT) + 2;
556 name_text->set (new_name);
561 * Set the height of this item.
563 * @param h new height
566 TimeAxisViewItem::set_height (double height)
570 manage_name_highlight ();
572 if (visibility & ShowNameText) {
573 name_text->set_y_position (height - NAME_Y_OFFSET);
577 frame->set_y1 (height);
578 if (frame_handle_start) {
579 frame_handle_start->set_y1 (height);
580 frame_handle_end->set_y1 (height);
584 vestigial_frame->set_y1 (height - 1.0);
590 TimeAxisViewItem::manage_name_highlight ()
592 if (!name_highlight) {
596 if (_height < NAME_HIGHLIGHT_THRESH) {
597 high_enough_for_name = false;
599 high_enough_for_name = true;
603 wide_enough_for_name = false;
605 wide_enough_for_name = true;
608 if (name_highlight && wide_enough_for_name && high_enough_for_name) {
610 name_highlight->show();
611 name_highlight->set (ArdourCanvas::Rect (0.0, (double) _height - NAME_HIGHLIGHT_SIZE, _width+RIGHT_EDGE_SHIFT, (double) _height - 1.0));
614 name_highlight->hide();
621 TimeAxisViewItem::set_color (Gdk::Color const & base_color)
623 compute_colors (base_color);
628 TimeAxisViewItem::get_canvas_frame()
634 TimeAxisViewItem::get_canvas_group()
640 TimeAxisViewItem::get_name_highlight()
642 return name_highlight;
646 * Calculate some contrasting color for displaying various parts of this item, based upon the base color.
648 * @param color the base color of the item
651 TimeAxisViewItem::compute_colors (Gdk::Color const & base_color)
653 unsigned char radius;
658 /* FILL: this is simple */
659 r = base_color.get_red()/256;
660 g = base_color.get_green()/256;
661 b = base_color.get_blue()/256;
662 fill_color = RGBA_TO_UINT(r,g,b,160);
665 if the overall saturation is strong, make the minor colors light.
666 if its weak, make them dark.
668 we do this by moving an equal distance to the other side of the
669 central circle in the color wheel from where we started.
672 radius = (unsigned char) rint (floor (sqrt (static_cast<double>(r*r + g*g + b+b))/3.0f));
673 minor_shift = 125 - radius;
675 /* LABEL: rotate around color wheel by 120 degrees anti-clockwise */
677 r = base_color.get_red()/256;
678 g = base_color.get_green()/256;
679 b = base_color.get_blue()/256;
685 /* red sector => green */
690 /* green sector => blue */
698 /* blue sector => red */
703 /* green sector => blue */
712 label_color = RGBA_TO_UINT(r,g,b,255);
713 r = (base_color.get_red()/256) + 127;
714 g = (base_color.get_green()/256) + 127;
715 b = (base_color.get_blue()/256) + 127;
717 label_color = RGBA_TO_UINT(r,g,b,255);
719 /* XXX can we do better than this ? */
723 //frame_color_r = 192;
724 //frame_color_g = 192;
725 //frame_color_b = 194;
727 //selected_frame_color_r = 182;
728 //selected_frame_color_g = 145;
729 //selected_frame_color_b = 168;
731 //handle_color_r = 25;
732 //handle_color_g = 0;
733 //handle_color_b = 255;
734 //lock_handle_color_r = 235;
735 //lock_handle_color_g = 16;
736 //lock_handle_color_b = 16;
740 * Convenience method to set the various canvas item colors
743 TimeAxisViewItem::set_colors()
747 if (name_highlight) {
748 name_highlight->set_fill_color (fill_color);
754 const double black_r = 0.0;
755 const double black_g = 0.0;
756 const double black_b = 0.0;
758 const double white_r = 1.0;
759 const double white_g = 1.0;
760 const double white_b = 1.0;
762 ArdourCanvas::color_to_rgba (fill_color, r, g, b, a);
764 /* Use W3C contrast guideline calculation */
766 double white_contrast = (max (r, white_r) - min (r, white_r)) +
767 (max (g, white_g) - min (g, white_g)) +
768 (max (b, white_b) - min (b, white_b));
770 double black_contrast = (max (r, black_r) - min (r, black_r)) +
771 (max (g, black_g) - min (g, black_g)) +
772 (max (b, black_b) - min (b, black_b));
774 if (white_contrast > black_contrast) {
776 name_text->set_color (ArdourCanvas::rgba_to_color (1.0, 1.0, 1.0, 1.0));
779 name_text->set_color (ArdourCanvas::rgba_to_color (0.0, 0.0, 0.0, 1.0));
785 ArdourCanvas::color_to_hsv (fill_color, h, s, v);
788 /* fill is black, set text to white */
789 name_text->set_color (ArdourCanvas::rgba_to_color (1.0, 1.0, 1.0, 1.0));
790 } else if (v == 1.0) {
791 /* fill is white, set text to black */
792 name_text->set_color (ArdourCanvas::rgba_to_color (0.0, 0.0, 0.0, 1.0));
795 h = fabs (fmod ((h - 180), 360.0)); /* complementary color */
796 s = 1.0; /* fully saturate */
797 v = 0.9; /* increase lightness/brightness/value */
799 name_text->set_color (ArdourCanvas::hsv_to_color (h, s, v, 1.0));
805 set_trim_handle_colors();
809 TimeAxisViewItem::get_fill_color () const
815 f = ARDOUR_UI::config()->get_canvasvar_SelectedFrameBase();
820 f = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
823 if (high_enough_for_name && !ARDOUR_UI::config()->get_color_regions_using_track_color()) {
824 f = ARDOUR_UI::config()->get_canvasvar_FrameBase();
835 * Sets the frame color depending on whether this item is selected
838 TimeAxisViewItem::set_frame_color()
846 f = get_fill_color ();
849 f = UINT_RGBA_CHANGE_A (f, fill_opacity);
853 f = UINT_RGBA_CHANGE_A (f, 0);
856 frame->set_fill_color (f);
857 set_frame_gradient ();
861 f = ARDOUR_UI::config()->get_canvasvar_SelectedTimeAxisFrame();
863 f = ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame();
867 f = UINT_RGBA_CHANGE_A (f, 64);
870 frame->set_outline_color (f);
875 TimeAxisViewItem::set_frame_gradient ()
877 if (ARDOUR_UI::config()->get_timeline_item_gradient_depth() == 0.0) {
878 frame->set_gradient (ArdourCanvas::Fill::StopList (), 0);
882 ArdourCanvas::Fill::StopList stops;
885 ArdourCanvas::Color f (get_fill_color());
887 /* need to get alpha value */
888 ArdourCanvas::color_to_rgba (f, r, g, b, a);
890 stops.push_back (std::make_pair (0.0, f));
892 /* now a darker version */
894 ArdourCanvas::color_to_hsv (f, h, s, v);
896 v = min (1.0, v * (1.0 - ARDOUR_UI::config()->get_timeline_item_gradient_depth()));
898 ArdourCanvas::Color darker = ArdourCanvas::hsv_to_color (h, s, v, a);
899 stops.push_back (std::make_pair (1.0, darker));
901 frame->set_gradient (stops, true);
905 * Set the colors of the start and end trim handle depending on object state
908 TimeAxisViewItem::set_trim_handle_colors()
911 /* Leave them transparent for now */
912 if (frame_handle_start) {
913 frame_handle_start->set_fill_color (0x00000000);
914 frame_handle_end->set_fill_color (0x00000000);
917 if (frame_handle_start) {
918 if (position_locked) {
919 frame_handle_start->set_fill_color (ARDOUR_UI::config()->get_canvasvar_TrimHandleLocked());
920 frame_handle_end->set_fill_color (ARDOUR_UI::config()->get_canvasvar_TrimHandleLocked());
922 frame_handle_start->set_fill_color (ARDOUR_UI::config()->get_canvasvar_TrimHandle());
923 frame_handle_end->set_fill_color (ARDOUR_UI::config()->get_canvasvar_TrimHandle());
930 TimeAxisViewItem::frame_handle_crossing (GdkEvent* ev, ArdourCanvas::Rectangle* item)
933 case GDK_LEAVE_NOTIFY:
934 /* always hide the handle whenever we leave, no matter what mode */
935 item->set_fill (false);
937 case GDK_ENTER_NOTIFY:
938 if (trackview.editor().effective_mouse_mode() == Editing::MouseObject &&
939 !trackview.editor().internal_editing()) {
940 /* never set this to be visible in internal
941 edit mode. Note, however, that we do need to
942 undo visibility (LEAVE_NOTIFY case above) no
943 matter what the mode is.
945 item->set_fill (true);
954 /** @return the frames per pixel */
956 TimeAxisViewItem::get_samples_per_pixel () const
958 return samples_per_pixel;
961 /** Set the frames per pixel of this item.
962 * This item is used to determine the relative visual size and position of this item
963 * based upon its duration and start value.
965 * @param fpp the new frames per pixel
968 TimeAxisViewItem::set_samples_per_pixel (double fpp)
970 samples_per_pixel = fpp;
971 set_position (this->get_position(), this);
972 reset_width_dependent_items ((double) get_duration() / samples_per_pixel);
976 TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
978 _width = pixel_width;
980 manage_name_highlight ();
982 if (pixel_width < 2.0) {
984 if (show_vestigial) {
985 vestigial_frame->show();
992 if (frame_handle_start) {
993 frame_handle_start->hide();
994 frame_handle_end->hide();
998 vestigial_frame->hide();
1002 frame->set_x1 (pixel_width + RIGHT_EDGE_SHIFT);
1005 if (frame_handle_start) {
1006 if (pixel_width < (3 * TimeAxisViewItem::GRAB_HANDLE_WIDTH)) {
1008 * there's less than GRAB_HANDLE_WIDTH of the region between
1009 * the right-hand end of frame_handle_start and the left-hand
1010 * end of frame_handle_end, so disable the handles
1013 frame_handle_start->hide();
1014 frame_handle_end->hide();
1016 frame_handle_start->show();
1017 frame_handle_end->set_x0 (pixel_width + RIGHT_EDGE_SHIFT - (TimeAxisViewItem::GRAB_HANDLE_WIDTH));
1018 frame_handle_end->set_x1 (pixel_width + RIGHT_EDGE_SHIFT);
1019 frame_handle_end->show();
1026 TimeAxisViewItem::manage_name_text ()
1028 int visible_name_width;
1034 if (!wide_enough_for_name || !high_enough_for_name) {
1039 if (name_text->text().empty()) {
1043 visible_name_width = name_text_width;
1045 if (visible_name_width > _width - NAME_X_OFFSET) {
1046 visible_name_width = _width - NAME_X_OFFSET;
1049 if (visible_name_width < 1) {
1052 name_text->clamp_width (visible_name_width);
1058 * Callback used to remove this time axis item during the gtk idle loop.
1059 * This is used to avoid deleting the obejct while inside the remove_this_item
1062 * @param item the TimeAxisViewItem to remove.
1063 * @param src the identity of the object that initiated the change.
1066 TimeAxisViewItem::idle_remove_this_item(TimeAxisViewItem* item, void* src)
1068 item->ItemRemoved (item->get_item_name(), src); /* EMIT_SIGNAL */
1075 TimeAxisViewItem::set_y (double y)
1077 group->set_y_position (y);
1081 TimeAxisViewItem::parameter_changed (string p)
1083 if (p == "color-regions-using-track-color") {
1085 } else if (p == "timeline-item-gradient-depth") {
1086 set_frame_gradient ();