, _automation (automation)
, _dragging (false)
{
- group = new ArdourCanvas::Group (&parent);
- CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", it_name));
-
- init (it_name, spu, base_color, start, duration, vis, true, true);
+ init (it_name, &parent, spu, base_color, start, duration, vis, true, true);
}
TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
/* share the other's parent, but still create a new group */
ArdourCanvas::Group* parent = other.group->parent();
-
- group = new ArdourCanvas::Group (parent);
-
+
_selected = other._selected;
-
- init (other.item_name, other.samples_per_pixel, c, other.frame_position,
+
+ init (other.item_name, parent, other.samples_per_pixel, c, other.frame_position,
other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name);
}
void
-TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & base_color, framepos_t start, framepos_t duration, Visibility vis, bool wide, bool high)
+TimeAxisViewItem::init (const string& it_name, ArdourCanvas::Group* parent, double fpp, Gdk::Color const & base_color,
+ framepos_t start, framepos_t duration, Visibility vis,
+ bool wide, bool high)
{
+ group = new ArdourCanvas::Group (parent);
+ CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name()));
+ group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event));
+
item_name = it_name;
samples_per_pixel = fpp;
frame_position = start;
}
vestigial_frame = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, 1.0, 2.0, trackview.current_height()));
+ CANVAS_DEBUG_NAME (vestigial_frame, string_compose ("vestigial frame for %1", get_item_name()));
vestigial_frame->hide ();
vestigial_frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_VestigialFrame());
vestigial_frame->set_fill_color (ARDOUR_UI::config()->get_canvasvar_VestigialFrame());
ArdourCanvas::Rect (0.0, 1.0,
trackview.editor().sample_to_pixel(duration),
trackview.current_height()));
+ CANVAS_DEBUG_NAME (frame, string_compose ("frame for %1", get_item_name()));
if (_recregion) {
frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_RecordingRect());
ArdourCanvas::Rect (0.0, trackview.editor().sample_to_pixel(item_duration),
trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE,
trackview.current_height()));
+ CANVAS_DEBUG_NAME (name_highlight, string_compose ("name highlight for %1", get_item_name()));
} else {
name_highlight = new ArdourCanvas::Rectangle (group,
ArdourCanvas::Rect (1.0, trackview.editor().sample_to_pixel(item_duration) - 1,
trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE,
trackview.current_height()));
+ CANVAS_DEBUG_NAME (name_highlight, string_compose ("name highlight for %1", get_item_name()));
}
name_highlight->set_data ("timeaxisviewitem", this);
if (visibility & ShowNameText) {
name_text = new ArdourCanvas::Text (group);
+ CANVAS_DEBUG_NAME (name_text, string_compose ("name text for %1", get_item_name()));
name_text->set_position (ArdourCanvas::Duple (NAME_X_OFFSET, trackview.current_height() - NAME_Y_OFFSET));
name_text->set_font_description (NAME_FONT);
double width = TimeAxisViewItem::GRAB_HANDLE_WIDTH;
frame_handle_start = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()));
- frame_handle_start->set_outline_what (ArdourCanvas::Rectangle::What (0));
+ CANVAS_DEBUG_NAME (frame_handle_start, "TAVI frame handle start");
+ frame_handle_start->set_outline (false);
+ frame_handle_start->set_fill (false);
+ frame_handle_start->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::frame_handle_crossing), frame_handle_start));
+
frame_handle_end = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()));
- frame_handle_end->set_outline_what (ArdourCanvas::Rectangle::What (0));
+ CANVAS_DEBUG_NAME (frame_handle_end, "TAVI frame handle end");
+ frame_handle_end->set_outline (false);
+ frame_handle_end->set_fill (false);
+ frame_handle_end->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::frame_handle_crossing), frame_handle_end));
} else {
frame_handle_start = frame_handle_end = 0;
}
delete group;
}
+bool
+TimeAxisViewItem::canvas_group_event (GdkEvent* /*ev*/)
+{
+ return false;
+}
+
void
TimeAxisViewItem::hide_rect ()
{
set_trim_handle_colors();
}
-/**
- * Sets the frame color depending on whether this item is selected
- */
-void
-TimeAxisViewItem::set_frame_color()
+uint32_t
+TimeAxisViewItem::get_fill_color () const
{
uint32_t f = 0;
- if (!frame) {
- return;
- }
-
if (_selected) {
f = ARDOUR_UI::config()->get_canvasvar_SelectedFrameBase();
- if (fill_opacity) {
- f = UINT_RGBA_CHANGE_A (f, fill_opacity);
- }
-
- if (!rect_visible) {
- f = UINT_RGBA_CHANGE_A (f, 0);
- }
-
} else {
if (_recregion) {
} else {
f = fill_color;
}
+ }
+ }
- if (fill_opacity) {
- f = UINT_RGBA_CHANGE_A (f, fill_opacity);
- }
+ return f;
+}
- if (!rect_visible) {
- f = UINT_RGBA_CHANGE_A (f, 0);
- }
- }
+/**
+ * Sets the frame color depending on whether this item is selected
+ */
+void
+TimeAxisViewItem::set_frame_color()
+{
+ uint32_t f = 0;
+
+ if (!frame) {
+ return;
+ }
+
+ f = get_fill_color ();
+
+ if (fill_opacity) {
+ f = UINT_RGBA_CHANGE_A (f, fill_opacity);
+ }
+
+ if (!rect_visible) {
+ f = UINT_RGBA_CHANGE_A (f, 0);
}
frame->set_fill_color (f);
ArdourCanvas::Fill::StopList stops;
double r, g, b, a;
double h, s, v;
- ArdourCanvas::Color f (frame->fill_color());
+ ArdourCanvas::Color f (get_fill_color());
/* need to get alpha value */
ArdourCanvas::color_to_rgba (f, r, g, b, a);
/* now a darker version */
ArdourCanvas::color_to_hsv (f, h, s, v);
- s *= ARDOUR_UI::config()->get_timeline_item_gradient_depth();
- if (s > 1.0) {
- s = 1.0;
- }
+
+ v = min (1.0, v * (1.0 - ARDOUR_UI::config()->get_timeline_item_gradient_depth()));
ArdourCanvas::Color darker = ArdourCanvas::hsv_to_color (h, s, v, a);
stops.push_back (std::make_pair (1.0, darker));
frame_handle_start->set_fill_color (ARDOUR_UI::config()->get_canvasvar_TrimHandleLocked());
frame_handle_end->set_fill_color (ARDOUR_UI::config()->get_canvasvar_TrimHandleLocked());
} else {
- frame_handle_start->set_fill_color (RGBA_TO_UINT (1, 1, 1, 0)); //ARDOUR_UI::config()->get_canvasvar_TrimHandle();
- frame_handle_end->set_fill_color (RGBA_TO_UINT (1, 1, 1, 0)); //ARDOUR_UI::config()->get_canvasvar_TrimHandle();
+ frame_handle_start->set_fill_color (ARDOUR_UI::config()->get_canvasvar_TrimHandle());
+ frame_handle_end->set_fill_color (ARDOUR_UI::config()->get_canvasvar_TrimHandle());
}
}
}
+bool
+TimeAxisViewItem::frame_handle_crossing (GdkEvent* ev, ArdourCanvas::Rectangle* item)
+{
+ switch (ev->type) {
+ case GDK_LEAVE_NOTIFY:
+ item->set_fill (false);
+ break;
+ case GDK_ENTER_NOTIFY:
+ item->set_fill (true);
+ break;
+ default:
+ break;
+ }
+ return false;
+}
+
/** @return the frames per pixel */
double
TimeAxisViewItem::get_samples_per_pixel () const
void
TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
{
-
if (pixel_width < 2.0) {
if (show_vestigial) {
* the right-hand end of frame_handle_start and the left-hand
* end of frame_handle_end, so disable the handles
*/
+
frame_handle_start->hide();
frame_handle_end->hide();
} else {