summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-12-03 02:22:36 +0000
committerCarl Hetherington <carl@carlh.net>2009-12-03 02:22:36 +0000
commit00617d5494985c6bbaea241c6685e0bef0d5b93e (patch)
tree60fad46b6c3b90a6ee4d1f20b07c92ef5a41a25c /gtk2_ardour
parent3538c47d255d56e335d731bca5c738a0f79956a1 (diff)
Fix previous commit.
git-svn-id: svn://localhost/ardour2/branches/3.0@6267 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/time_axis_view_item.cc49
-rw-r--r--gtk2_ardour/time_axis_view_item.h5
2 files changed, 35 insertions, 19 deletions
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 53f8b39ce0..9d77229f54 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -107,7 +107,7 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group&
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);
}
@@ -128,11 +128,16 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
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);
+ 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 ;
@@ -150,6 +155,7 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color const & ba
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 ;
@@ -550,15 +556,12 @@ TimeAxisViewItem::set_height (double height)
{
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) {
@@ -583,6 +586,8 @@ TimeAxisViewItem::set_height (double height)
}
vestigial_frame->property_y2() = height - 1;
+
+ update_name_pixbuf_visibility ();
}
/**
@@ -814,7 +819,6 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
if (name_highlight) {
name_highlight->hide();
- name_pixbuf->hide();
}
if (frame) {
@@ -826,6 +830,8 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
frame_handle_end->hide();
}
+ wide_enough_for_name = false;
+
} else {
vestigial_frame->hide();
@@ -835,12 +841,13 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
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) {
@@ -898,16 +905,16 @@ TimeAxisViewItem::reset_name_width (double /*pixel_width*/)
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"));
+ }
}
@@ -960,5 +967,13 @@ TimeAxisViewItem::set_y (double y)
}
}
-
+void
+TimeAxisViewItem::update_name_pixbuf_visibility ()
+{
+ if (wide_enough_for_name && high_enough_for_name) {
+ name_pixbuf->show ();
+ } else {
+ name_pixbuf->hide ();
+ }
+}
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index 21726eb6ce..f2d4fba25b 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -347,7 +347,7 @@ class TimeAxisViewItem : public Selectable
TimeAxisViewItem (const TimeAxisViewItem& other);
- void init (const std::string& it_name, double spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, Visibility vis, bool);
+ void init (const std::string& it_name, double spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, Visibility vis, bool, bool);
/**
* Calculates some contrasting color for displaying various parts of this item, based upon the base color
@@ -374,6 +374,7 @@ class TimeAxisViewItem : public Selectable
virtual void reset_width_dependent_items (double pixel_width);
void reset_name_width (double pixel_width);
+ void update_name_pixbuf_visibility ();
/**
* Callback used to remove this item during the gtk idle loop
@@ -457,6 +458,7 @@ class TimeAxisViewItem : public Selectable
uint32_t last_item_width;
int name_pixbuf_width;
bool wide_enough_for_name;
+ bool high_enough_for_name;
ArdourCanvas::Group* group;
ArdourCanvas::SimpleRect* vestigial_frame;
@@ -469,7 +471,6 @@ class TimeAxisViewItem : public Selectable
Visibility visibility;
bool _recregion;
-
}; /* class TimeAxisViewItem */
#endif /* __gtk_ardour_time_axis_view_item_h__ */