summaryrefslogtreecommitdiff
path: root/gtk2_ardour/automation_time_axis.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour/automation_time_axis.cc')
-rw-r--r--gtk2_ardour/automation_time_axis.cc81
1 files changed, 24 insertions, 57 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 099a36c822..36d615453c 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -373,15 +373,19 @@ AutomationTimeAxisView::clear_clicked ()
}
void
-AutomationTimeAxisView::set_height (TrackHeight ht)
+AutomationTimeAxisView::set_height (uint32_t h)
{
- uint32_t h = height_to_pixels (ht);
bool changed = (height != (uint32_t) h) || first_call_to_set_height;
if (first_call_to_set_height)
first_call_to_set_height = false;
+ bool changed_between_small_and_normal = ( (h == hSmall || h == hSmaller) ^ (height == hSmall || height == hSmaller) );
- TimeAxisView::set_height (ht);
+ TimeAxisView* state_parent = get_parent_with_state ();
+ assert(state_parent);
+ XMLNode* xml_node = state_parent->get_automation_child_xml_node (_control->parameter());
+
+ TimeAxisView::set_height (h);
_base_rect->property_y2() = h;
if (_line)
@@ -392,50 +396,16 @@ AutomationTimeAxisView::set_height (TrackHeight ht)
_view->update_contents_y_position_and_height();
}
- TimeAxisView* state_parent = get_parent_with_state ();
- assert(state_parent);
+ char buf[32];
+ snprintf (buf, sizeof (buf), "%u", height);
+ xml_node->add_property ("height", buf);
- XMLNode* xml_node = state_parent->get_automation_child_xml_node(_control->parameter());
- assert(xml_node);
-
- switch (ht) {
- case Largest:
- xml_node->add_property ("track_height", "largest");
- break;
-
- case Large:
- xml_node->add_property ("track_height", "large");
- break;
-
- case Larger:
- xml_node->add_property ("track_height", "larger");
- break;
-
- case Normal:
- xml_node->add_property ("track_height", "normal");
- break;
-
- case Smaller:
- xml_node->add_property ("track_height", "smaller");
- break;
-
- case Small:
- xml_node->add_property ("track_height", "small");
- break;
- }
-
- switch (ht) {
- case Large:
- case Larger:
- case Largest:
- _controller->show ();
-
- case Normal:
- if (ht == Normal)
- _controller->hide();
+ if (changed_between_small_and_normal || first_call_to_set_height) {
+ first_call_to_set_height = false;
+ if (h >= hNormal) {
controls_table.remove (name_hbox);
-
+
if (plugname) {
if (plugname_packed) {
controls_table.remove (*plugname);
@@ -450,18 +420,13 @@ AutomationTimeAxisView::set_height (TrackHeight ht)
hide_name_entry ();
show_name_label ();
name_hbox.show_all ();
-
+
auto_button.show();
height_button.show();
clear_button.show();
hide_button.show_all();
- break;
-
- case Smaller:
- _controller->hide();
-
- case Small:
+ } else if (h >= hSmall) {
controls_table.remove (name_hbox);
if (plugname) {
if (plugname_packed) {
@@ -474,17 +439,17 @@ AutomationTimeAxisView::set_height (TrackHeight ht)
hide_name_entry ();
show_name_label ();
name_hbox.show_all ();
-
+
auto_button.hide();
height_button.hide();
clear_button.hide();
hide_button.hide();
- break;
+ }
}
if (changed) {
/* only emit the signal if the height really changed */
- _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+ _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
}
@@ -900,10 +865,10 @@ AutomationTimeAxisView::color_handler ()
}
}
-void
+int
AutomationTimeAxisView::set_state (const XMLNode& node)
{
- TimeAxisView::set_state (node);
+ return TimeAxisView::set_state (node);
XMLNodeList kids;
XMLNodeConstIterator iter;
@@ -947,7 +912,9 @@ void
AutomationTimeAxisView::update_extra_xml_shown (bool editor_shown)
{
XMLNode* xml_node = get_state_node();
- xml_node->add_property ("shown", editor_shown ? "yes" : "no");
+// if (xml_node) {
+ xml_node->add_property ("shown", editor_shown ? "yes" : "no");
+// }
}
guint32