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 = 6;
63 const double TimeAxisViewItem::GRAB_HANDLE_WIDTH = 5;
65 int TimeAxisViewItem::NAME_HEIGHT;
66 double TimeAxisViewItem::NAME_Y_OFFSET;
67 double TimeAxisViewItem::NAME_HIGHLIGHT_SIZE;
68 double TimeAxisViewItem::NAME_HIGHLIGHT_THRESH;
71 TimeAxisViewItem::set_constant_heights ()
73 NAME_FONT = get_font_for_style (X_("TimeAxisViewItemName"));
79 Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */
83 layout->set_font_description (NAME_FONT);
84 get_pixel_size (layout, width, height);
86 layout = foo.create_pango_layout (X_("H")); /* just the ascender */
89 NAME_Y_OFFSET = height + 2;
90 NAME_HIGHLIGHT_SIZE = height + 2;
91 NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3;
95 * Construct a new TimeAxisViewItem.
97 * @param it_name the unique name of this item
98 * @param parent the parent canvas group
99 * @param tv the TimeAxisView we are going to be added to
100 * @param spu samples per unit
102 * @param start the start point of this item
103 * @param duration the duration of this item
104 * @param recording true if this is a recording region view
105 * @param automation true if this is an automation region view
107 TimeAxisViewItem::TimeAxisViewItem(
108 const string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color const & base_color,
109 framepos_t start, framecnt_t duration, bool recording, bool automation, Visibility vis
112 , item_name (it_name)
114 , _recregion (recording)
115 , _automation (automation)
119 init (&parent, spu, base_color, start, duration, vis, true, true);
122 TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
125 , PBD::ScopedConnectionList()
126 , trackview (other.trackview)
127 , item_name (other.item_name)
129 , _recregion (other._recregion)
130 , _automation (other._automation)
131 , _dragging (other._dragging)
138 UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a);
139 c.set_rgb_p (r/255.0, g/255.0, b/255.0);
141 /* share the other's parent, but still create a new group */
143 ArdourCanvas::Group* parent = other.group->parent();
145 _selected = other._selected;
147 init (parent, other.samples_per_pixel, c, other.frame_position,
148 other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name);
152 TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, Gdk::Color const & base_color,
153 framepos_t start, framepos_t duration, Visibility vis,
154 bool wide, bool high)
156 group = new ArdourCanvas::Group (parent);
157 CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name()));
158 group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event));
160 samples_per_pixel = fpp;
161 frame_position = start;
162 item_duration = duration;
163 name_connected = false;
165 position_locked = false;
166 max_item_duration = ARDOUR::max_framepos;
167 min_item_duration = 0;
168 show_vestigial = true;
173 wide_enough_for_name = wide;
174 high_enough_for_name = high;
178 warning << "Time Axis Item Duration == 0" << endl;
181 vestigial_frame = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, 1.0, 2.0, trackview.current_height()));
182 CANVAS_DEBUG_NAME (vestigial_frame, string_compose ("vestigial frame for %1", get_item_name()));
183 vestigial_frame->hide ();
184 vestigial_frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_VestigialFrame());
185 vestigial_frame->set_fill_color (ARDOUR_UI::config()->get_canvasvar_VestigialFrame());
187 if (visibility & ShowFrame) {
188 frame = new ArdourCanvas::Rectangle (group,
189 ArdourCanvas::Rect (0.0, 0.0,
190 trackview.editor().sample_to_pixel(duration),
191 trackview.current_height()));
193 CANVAS_DEBUG_NAME (frame, string_compose ("frame for %1", get_item_name()));
196 frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_RecordingRect());
198 frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame());
201 // frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::RIGHT|ArdourCanvas::Rectangle::LEFT));
208 if (visibility & ShowNameHighlight) {
213 if (visibility & FullWidthNameHighlight) {
215 width = trackview.editor().sample_to_pixel(item_duration);
218 width = trackview.editor().sample_to_pixel(item_duration) - 2.0;
221 name_highlight = new ArdourCanvas::Rectangle (group,
222 ArdourCanvas::Rect (start,
223 trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE,
225 trackview.current_height()));
226 CANVAS_DEBUG_NAME (name_highlight, string_compose ("name highlight for %1", get_item_name()));
227 name_highlight->set_data ("timeaxisviewitem", this);
228 name_highlight->set_outline_what (ArdourCanvas::Rectangle::TOP);
229 name_highlight->set_outline_color (RGBA_TO_UINT (0,0,0,255));
235 if (visibility & ShowNameText) {
236 name_text = new ArdourCanvas::Text (group);
237 CANVAS_DEBUG_NAME (name_text, string_compose ("name text for %1", get_item_name()));
238 name_text->set_position (ArdourCanvas::Duple (NAME_X_OFFSET, trackview.current_height() - NAME_Y_OFFSET));
239 name_text->set_font_description (NAME_FONT);
244 /* create our grab handles used for trimming/duration etc */
245 if (!_recregion && !_automation) {
246 double top = TimeAxisViewItem::GRAB_HANDLE_TOP;
247 double width = TimeAxisViewItem::GRAB_HANDLE_WIDTH;
249 frame_handle_start = new ArdourCanvas::DragHandle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()), true);
250 CANVAS_DEBUG_NAME (frame_handle_start, "TAVI frame handle start");
251 frame_handle_start->set_outline (false);
252 frame_handle_start->set_fill (false);
253 frame_handle_start->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::frame_handle_crossing), frame_handle_start));
255 frame_handle_end = new ArdourCanvas::DragHandle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()), false);
256 CANVAS_DEBUG_NAME (frame_handle_end, "TAVI frame handle end");
257 frame_handle_end->set_outline (false);
258 frame_handle_end->set_fill (false);
259 frame_handle_end->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::frame_handle_crossing), frame_handle_end));
261 frame_handle_start = frame_handle_end = 0;
264 set_color (base_color);
266 set_duration (item_duration, this);
267 set_position (start, this);
269 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&TimeAxisViewItem::parameter_changed, this, _1), gui_context ());
270 ARDOUR_UI::config()->ParameterChanged.connect (sigc::mem_fun (*this, &TimeAxisViewItem::parameter_changed));
273 TimeAxisViewItem::~TimeAxisViewItem()
279 TimeAxisViewItem::canvas_group_event (GdkEvent* /*ev*/)
285 TimeAxisViewItem::hide_rect ()
287 rect_visible = false;
290 if (name_highlight) {
291 name_highlight->set_outline_what (ArdourCanvas::Rectangle::What (0));
292 name_highlight->set_fill_color (UINT_RGBA_CHANGE_A (fill_color, 64));
297 TimeAxisViewItem::show_rect ()
302 if (name_highlight) {
303 name_highlight->set_outline_what (ArdourCanvas::Rectangle::TOP);
304 name_highlight->set_fill_color (fill_color);
309 * Set the position of this item on the timeline.
311 * @param pos the new position
312 * @param src the identity of the object that initiated the change
313 * @return true on success
317 TimeAxisViewItem::set_position(framepos_t pos, void* src, double* delta)
319 if (position_locked) {
323 frame_position = pos;
325 /* This sucks. The GnomeCanvas version I am using
326 doesn't correctly implement gnome_canvas_group_set_arg(),
327 so that simply setting the "x" arg of the group
328 fails to move the group. Instead, we have to
329 use gnome_canvas_item_move(), which does the right
330 thing. I see that in GNOME CVS, the current (Sept 2001)
331 version of GNOME Canvas rectifies this issue cleanly.
335 double new_unit_pos = pos / samples_per_pixel;
337 old_unit_pos = group->position().x;
339 if (new_unit_pos != old_unit_pos) {
340 group->set_x_position (new_unit_pos);
344 (*delta) = new_unit_pos - old_unit_pos;
347 PositionChanged (frame_position, src); /* EMIT_SIGNAL */
352 /** @return position of this item on the timeline */
354 TimeAxisViewItem::get_position() const
356 return frame_position;
360 * Set the duration of this item.
362 * @param dur the new duration of this item
363 * @param src the identity of the object that initiated the change
364 * @return true on success
368 TimeAxisViewItem::set_duration (framecnt_t dur, void* src)
370 if ((dur > max_item_duration) || (dur < min_item_duration)) {
371 warning << string_compose (
372 P_("new duration %1 frame is out of bounds for %2", "new duration of %1 frames is out of bounds for %2", dur),
373 get_item_name(), dur)
384 reset_width_dependent_items (trackview.editor().sample_to_pixel (dur));
386 DurationChanged (dur, src); /* EMIT_SIGNAL */
390 /** @return duration of this item */
392 TimeAxisViewItem::get_duration() const
394 return item_duration;
398 * Set the maximum duration that this item can have.
400 * @param dur the new maximum duration
401 * @param src the identity of the object that initiated the change
404 TimeAxisViewItem::set_max_duration(framecnt_t dur, void* src)
406 max_item_duration = dur;
407 MaxDurationChanged(max_item_duration, src); /* EMIT_SIGNAL */
410 /** @return the maximum duration that this item may have */
412 TimeAxisViewItem::get_max_duration() const
414 return max_item_duration;
418 * Set the minimum duration that this item may have.
420 * @param the minimum duration that this item may be set to
421 * @param src the identity of the object that initiated the change
424 TimeAxisViewItem::set_min_duration(framecnt_t dur, void* src)
426 min_item_duration = dur;
427 MinDurationChanged(max_item_duration, src); /* EMIT_SIGNAL */
430 /** @return the minimum duration that this item mey have */
432 TimeAxisViewItem::get_min_duration() const
434 return min_item_duration;
438 * Set whether this item is locked to its current position.
439 * Locked items cannot be moved until the item is unlocked again.
441 * @param yn true to lock this item to its current position
442 * @param src the identity of the object that initiated the change
445 TimeAxisViewItem::set_position_locked(bool yn, void* src)
447 position_locked = yn;
448 set_trim_handle_colors();
449 PositionLockChanged (position_locked, src); /* EMIT_SIGNAL */
452 /** @return true if this item is locked to its current position */
454 TimeAxisViewItem::get_position_locked() const
456 return position_locked;
460 * Set whether the maximum duration constraint is active.
462 * @param active set true to enforce the max duration constraint
463 * @param src the identity of the object that initiated the change
466 TimeAxisViewItem::set_max_duration_active (bool active, void* /*src*/)
468 max_duration_active = active;
471 /** @return true if the maximum duration constraint is active */
473 TimeAxisViewItem::get_max_duration_active() const
475 return max_duration_active;
479 * Set whether the minimum duration constraint is active.
481 * @param active set true to enforce the min duration constraint
482 * @param src the identity of the object that initiated the change
486 TimeAxisViewItem::set_min_duration_active (bool active, void* /*src*/)
488 min_duration_active = active;
491 /** @return true if the maximum duration constraint is active */
493 TimeAxisViewItem::get_min_duration_active() const
495 return min_duration_active;
499 * Set the name of this item.
501 * @param new_name the new name of this item
502 * @param src the identity of the object that initiated the change
506 TimeAxisViewItem::set_item_name(std::string new_name, void* src)
508 if (new_name != item_name) {
509 std::string temp_name = item_name;
510 item_name = new_name;
511 NameChanged (item_name, temp_name, src); /* EMIT_SIGNAL */
515 /** @return the name of this item */
517 TimeAxisViewItem::get_item_name() const
523 * Set selection status.
525 * @param yn true if this item is currently selected
528 TimeAxisViewItem::set_selected(bool yn)
530 if (_selected != yn) {
531 Selectable::set_selected (yn);
536 /** @return the TimeAxisView that this item is on */
538 TimeAxisViewItem::get_time_axis_view () const
544 * Set the displayed item text.
545 * This item is the visual text name displayed on the canvas item, this can be different to the name of the item.
547 * @param new_name the new name text to display
551 TimeAxisViewItem::set_name_text(const string& new_name)
557 name_text_width = pixel_width (new_name, NAME_FONT) + 2;
558 name_text->set (new_name);
563 * Set the height of this item.
565 * @param h new height
568 TimeAxisViewItem::set_height (double height)
572 manage_name_highlight ();
574 if (visibility & ShowNameText) {
575 name_text->set_y_position (height - NAME_Y_OFFSET);
579 frame->set_y1 (height);
580 if (frame_handle_start) {
581 frame_handle_start->set_y1 (height);
582 frame_handle_end->set_y1 (height);
586 vestigial_frame->set_y1 (height - 1);
592 TimeAxisViewItem::manage_name_highlight ()
594 if (!name_highlight) {
598 if (_height < NAME_HIGHLIGHT_THRESH) {
599 high_enough_for_name = false;
601 high_enough_for_name = true;
605 wide_enough_for_name = false;
607 wide_enough_for_name = true;
610 if (name_highlight && wide_enough_for_name && high_enough_for_name) {
612 name_highlight->show();
614 name_highlight->set_y0 ((double) _height - 1 - NAME_HIGHLIGHT_SIZE);
615 name_highlight->set_y1 ((double) _height - 1);
617 /* x0 is always zero */
618 name_highlight->set_x1 (_width-1.0);
621 name_highlight->hide();
628 TimeAxisViewItem::set_color (Gdk::Color const & base_color)
630 compute_colors (base_color);
635 TimeAxisViewItem::get_canvas_frame()
641 TimeAxisViewItem::get_canvas_group()
647 TimeAxisViewItem::get_name_highlight()
649 return name_highlight;
653 * Calculate some contrasting color for displaying various parts of this item, based upon the base color.
655 * @param color the base color of the item
658 TimeAxisViewItem::compute_colors (Gdk::Color const & base_color)
660 unsigned char radius;
665 /* FILL: this is simple */
666 r = base_color.get_red()/256;
667 g = base_color.get_green()/256;
668 b = base_color.get_blue()/256;
669 fill_color = RGBA_TO_UINT(r,g,b,160);
672 if the overall saturation is strong, make the minor colors light.
673 if its weak, make them dark.
675 we do this by moving an equal distance to the other side of the
676 central circle in the color wheel from where we started.
679 radius = (unsigned char) rint (floor (sqrt (static_cast<double>(r*r + g*g + b+b))/3.0f));
680 minor_shift = 125 - radius;
682 /* LABEL: rotate around color wheel by 120 degrees anti-clockwise */
684 r = base_color.get_red()/256;
685 g = base_color.get_green()/256;
686 b = base_color.get_blue()/256;
692 /* red sector => green */
697 /* green sector => blue */
705 /* blue sector => red */
710 /* green sector => blue */
719 label_color = RGBA_TO_UINT(r,g,b,255);
720 r = (base_color.get_red()/256) + 127;
721 g = (base_color.get_green()/256) + 127;
722 b = (base_color.get_blue()/256) + 127;
724 label_color = RGBA_TO_UINT(r,g,b,255);
726 /* XXX can we do better than this ? */
730 //frame_color_r = 192;
731 //frame_color_g = 192;
732 //frame_color_b = 194;
734 //selected_frame_color_r = 182;
735 //selected_frame_color_g = 145;
736 //selected_frame_color_b = 168;
738 //handle_color_r = 25;
739 //handle_color_g = 0;
740 //handle_color_b = 255;
741 //lock_handle_color_r = 235;
742 //lock_handle_color_g = 16;
743 //lock_handle_color_b = 16;
747 * Convenience method to set the various canvas item colors
750 TimeAxisViewItem::set_colors()
754 if (name_highlight) {
755 name_highlight->set_fill_color (fill_color);
761 const double black_r = 0.0;
762 const double black_g = 0.0;
763 const double black_b = 0.0;
765 const double white_r = 1.0;
766 const double white_g = 1.0;
767 const double white_b = 1.0;
769 ArdourCanvas::color_to_rgba (fill_color, r, g, b, a);
771 /* Use W3C contrast guideline calculation */
773 double white_contrast = (max (r, white_r) - min (r, white_r)) +
774 (max (g, white_g) - min (g, white_g)) +
775 (max (b, white_b) - min (b, white_b));
777 double black_contrast = (max (r, black_r) - min (r, black_r)) +
778 (max (g, black_g) - min (g, black_g)) +
779 (max (b, black_b) - min (b, black_b));
781 if (white_contrast > black_contrast) {
783 name_text->set_color (ArdourCanvas::rgba_to_color (1.0, 1.0, 1.0, 1.0));
786 name_text->set_color (ArdourCanvas::rgba_to_color (0.0, 0.0, 0.0, 1.0));
792 ArdourCanvas::color_to_hsv (fill_color, h, s, v);
795 /* fill is black, set text to white */
796 name_text->set_color (ArdourCanvas::rgba_to_color (1.0, 1.0, 1.0, 1.0));
797 } else if (v == 1.0) {
798 /* fill is white, set text to black */
799 name_text->set_color (ArdourCanvas::rgba_to_color (0.0, 0.0, 0.0, 1.0));
802 h = fabs (fmod ((h - 180), 360.0)); /* complementary color */
803 s = 1.0; /* fully saturate */
804 v = 0.9; /* increase lightness/brightness/value */
806 name_text->set_color (ArdourCanvas::hsv_to_color (h, s, v, 1.0));
812 set_trim_handle_colors();
816 TimeAxisViewItem::get_fill_color () const
822 f = ARDOUR_UI::config()->get_canvasvar_SelectedFrameBase();
827 f = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
830 if (high_enough_for_name && !ARDOUR_UI::config()->get_color_regions_using_track_color()) {
831 f = ARDOUR_UI::config()->get_canvasvar_FrameBase();
842 * Sets the frame color depending on whether this item is selected
845 TimeAxisViewItem::set_frame_color()
853 f = get_fill_color ();
856 f = UINT_RGBA_CHANGE_A (f, fill_opacity);
860 f = UINT_RGBA_CHANGE_A (f, 0);
863 frame->set_fill_color (f);
864 set_frame_gradient ();
868 f = ARDOUR_UI::config()->get_canvasvar_SelectedTimeAxisFrame();
870 f = ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame();
874 f = UINT_RGBA_CHANGE_A (f, 64);
877 frame->set_outline_color (f);
882 TimeAxisViewItem::set_frame_gradient ()
884 if (ARDOUR_UI::config()->get_timeline_item_gradient_depth() == 0.0) {
885 frame->set_gradient (ArdourCanvas::Fill::StopList (), 0);
889 ArdourCanvas::Fill::StopList stops;
892 ArdourCanvas::Color f (get_fill_color());
894 /* need to get alpha value */
895 ArdourCanvas::color_to_rgba (f, r, g, b, a);
897 stops.push_back (std::make_pair (0.0, f));
899 /* now a darker version */
901 ArdourCanvas::color_to_hsv (f, h, s, v);
903 v = min (1.0, v * (1.0 - ARDOUR_UI::config()->get_timeline_item_gradient_depth()));
905 ArdourCanvas::Color darker = ArdourCanvas::hsv_to_color (h, s, v, a);
906 stops.push_back (std::make_pair (1.0, darker));
908 frame->set_gradient (stops, true);
912 * Set the colors of the start and end trim handle depending on object state
915 TimeAxisViewItem::set_trim_handle_colors()
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());
929 TimeAxisViewItem::frame_handle_crossing (GdkEvent* ev, ArdourCanvas::Rectangle* item)
932 case GDK_LEAVE_NOTIFY:
933 item->set_fill (false);
935 case GDK_ENTER_NOTIFY:
936 item->set_fill (true);
944 /** @return the frames per pixel */
946 TimeAxisViewItem::get_samples_per_pixel () const
948 return samples_per_pixel;
951 /** Set the frames per pixel of this item.
952 * This item is used to determine the relative visual size and position of this item
953 * based upon its duration and start value.
955 * @param fpp the new frames per pixel
958 TimeAxisViewItem::set_samples_per_pixel (double fpp)
960 samples_per_pixel = fpp;
961 set_position (this->get_position(), this);
962 reset_width_dependent_items ((double) get_duration() / samples_per_pixel);
966 TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
968 _width = pixel_width;
970 manage_name_highlight ();
972 if (pixel_width < 2.0) {
974 if (show_vestigial) {
975 vestigial_frame->show();
982 if (frame_handle_start) {
983 frame_handle_start->hide();
984 frame_handle_end->hide();
988 vestigial_frame->hide();
992 frame->set_x1 (pixel_width);
995 if (frame_handle_start) {
996 if (pixel_width < (3 * TimeAxisViewItem::GRAB_HANDLE_WIDTH)) {
998 * there's less than GRAB_HANDLE_WIDTH of the region between
999 * the right-hand end of frame_handle_start and the left-hand
1000 * end of frame_handle_end, so disable the handles
1003 frame_handle_start->hide();
1004 frame_handle_end->hide();
1006 frame_handle_start->show();
1007 frame_handle_end->set_x0 (pixel_width - (TimeAxisViewItem::GRAB_HANDLE_WIDTH));
1008 frame_handle_end->set_x1 (pixel_width);
1009 frame_handle_end->show();
1016 TimeAxisViewItem::manage_name_text ()
1018 int visible_name_width;
1024 if (!wide_enough_for_name || !high_enough_for_name) {
1029 if (name_text->text().empty()) {
1033 visible_name_width = name_text_width;
1035 if (visible_name_width > _width - NAME_X_OFFSET) {
1036 visible_name_width = _width - NAME_X_OFFSET;
1039 if (visible_name_width < 1) {
1042 name_text->clamp_width (visible_name_width);
1048 * Callback used to remove this time axis item during the gtk idle loop.
1049 * This is used to avoid deleting the obejct while inside the remove_this_item
1052 * @param item the TimeAxisViewItem to remove.
1053 * @param src the identity of the object that initiated the change.
1056 TimeAxisViewItem::idle_remove_this_item(TimeAxisViewItem* item, void* src)
1058 item->ItemRemoved (item->get_item_name(), src); /* EMIT_SIGNAL */
1065 TimeAxisViewItem::set_y (double y)
1067 group->set_y_position (y);
1071 TimeAxisViewItem::parameter_changed (string p)
1073 if (p == "color-regions-using-track-color") {
1075 } else if (p == "timeline-item-gradient-depth") {
1076 set_frame_gradient ();