group = new ArdourCanvas::Group (parent);
- init (it_name, spu, base_color, start, duration, vis, true);
+ init (it_name, spu, base_color, start, duration, vis, true, true);
}
TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
: sigc::trackable(other)
+ , PBD::ScopedConnectionList()
, trackview (other.trackview)
{
group = new ArdourCanvas::Group (*parent);
- init (other.item_name, other.samples_per_unit, c, other.frame_position, other.item_duration, other.visibility, other.wide_enough_for_name);
+ _selected = other._selected;
+
+ init (
+ other.item_name, other.samples_per_unit, 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 spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, Visibility vis, bool wide)
+TimeAxisViewItem::init (
+ const string& it_name, double spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, Visibility vis, bool wide, bool high
+ )
{
item_name = it_name ;
samples_per_unit = spu ;
name_pixbuf_width = 0;
last_item_width = 0;
wide_enough_for_name = wide;
+ high_enough_for_name = high;
if (duration == 0) {
warning << "Time Axis Item Duration == 0" << endl ;
if (visibility & ShowNameText) {
name_pixbuf = new ArdourCanvas::Pixbuf(*group);
name_pixbuf->property_x() = NAME_X_OFFSET;
- name_pixbuf->property_y() = trackview.current_height() - 1.0 - NAME_Y_OFFSET;
+ name_pixbuf->property_y() = trackview.current_height() + 1 - NAME_Y_OFFSET;
} else {
name_pixbuf = 0;
{
if (name_highlight) {
if (height < NAME_HIGHLIGHT_THRESH) {
- name_highlight->hide();
- name_pixbuf->hide();
+ name_highlight->hide ();
+ high_enough_for_name = false;
} else {
name_highlight->show();
- if (wide_enough_for_name) {
- name_pixbuf->show();
- }
-
+ high_enough_for_name = true;
}
if (height > NAME_HIGHLIGHT_SIZE) {
}
if (visibility & ShowNameText) {
- name_pixbuf->property_y() = height - 1 - NAME_Y_OFFSET;
+ name_pixbuf->property_y() = height + 1 - NAME_Y_OFFSET;
}
if (frame) {
}
vestigial_frame->property_y2() = height - 1;
+
+ update_name_pixbuf_visibility ();
}
/**
if (name_highlight) {
name_highlight->hide();
- name_pixbuf->hide();
}
if (frame) {
frame_handle_end->hide();
}
+ wide_enough_for_name = false;
+
} else {
vestigial_frame->hide();
if (height < NAME_HIGHLIGHT_THRESH) {
name_highlight->hide();
- name_pixbuf->hide();
+ high_enough_for_name = false;
} else {
name_highlight->show();
if (!get_item_name().empty()) {
reset_name_width (pixel_width);
}
+ high_enough_for_name = true;
}
if (visibility & FullWidthNameHighlight) {
pb_width = it_width - NAME_X_OFFSET;
}
- if (pb_width <= 0 || it_width <= NAME_X_OFFSET) {
+ if (it_width <= NAME_X_OFFSET) {
wide_enough_for_name = false;
- name_pixbuf->hide();
- return;
} else {
wide_enough_for_name = true;
- name_pixbuf->show();
}
- name_pixbuf->property_pixbuf() = pixbuf_from_ustring(item_name, NAME_FONT, pb_width, NAME_HEIGHT, Gdk::Color ("#000000"));
+ update_name_pixbuf_visibility ();
+ if (pb_width > 0) {
+ name_pixbuf->property_pixbuf() = pixbuf_from_ustring(item_name, NAME_FONT, pb_width, NAME_HEIGHT, Gdk::Color ("#000000"));
+ }
}
defer to idle loop, otherwise we'll delete this object
while we're still inside this function ...
*/
- Glib::signal_idle().connect(bind (sigc::ptr_fun (&TimeAxisViewItem::idle_remove_this_item), this, src));
+ Glib::signal_idle().connect(sigc::bind (sigc::ptr_fun (&TimeAxisViewItem::idle_remove_this_item), this, src));
}
/**
}
}
-
+void
+TimeAxisViewItem::update_name_pixbuf_visibility ()
+{
+ if (!name_pixbuf) {
+ return;
+ }
+
+ if (wide_enough_for_name && high_enough_for_name) {
+ name_pixbuf->show ();
+ } else {
+ name_pixbuf->hide ();
+ }
+}