diff options
-rw-r--r-- | gtk2_ardour/ardour.menus | 26 | ||||
-rw-r--r-- | gtk2_ardour/audio_time_axis.cc | 18 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 9 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 51 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 67 | ||||
-rw-r--r-- | gtk2_ardour/editor_route_list.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/mnemonic-us.bindings.in | 27 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.cc | 18 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.h | 4 |
11 files changed, 198 insertions, 38 deletions
diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 17f11abd00..c5e81d9546 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -340,6 +340,32 @@ <menuitem action='scroll-forward'/> <menuitem action='scroll-backward'/> </menu> + <menu action="SavedViewMenu"> + <menuitem action='save-visual-state-1'/> + <menuitem action='goto-visual-state-1'/> + <menuitem action='save-visual-state-2'/> + <menuitem action='goto-visual-state-2'/> + <menuitem action='save-visual-state-3'/> + <menuitem action='goto-visual-state-3'/> + <menuitem action='save-visual-state-4'/> + <menuitem action='goto-visual-state-4'/> + <menuitem action='save-visual-state-5'/> + <menuitem action='goto-visual-state-5'/> + <menuitem action='save-visual-state-6'/> + <menuitem action='goto-visual-state-6'/> + <menuitem action='save-visual-state-7'/> + <menuitem action='goto-visual-state-7'/> + <menuitem action='save-visual-state-8'/> + <menuitem action='goto-visual-state-8'/> + <menuitem action='save-visual-state-9'/> + <menuitem action='goto-visual-state-9'/> + <menuitem action='save-visual-state-10'/> + <menuitem action='goto-visual-state-10'/> + <menuitem action='save-visual-state-11'/> + <menuitem action='goto-visual-state-11'/> + <menuitem action='save-visual-state-12'/> + <menuitem action='goto-visual-state-12'/> + </menu> <menuitem action='ToggleMaximalEditor'/> <menuitem action='show-editor-mixer'/> diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index f47e0ec33f..18a0d12199 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -169,15 +169,21 @@ AudioTimeAxisView::set_state (const XMLNode& node) if ((ret = TimeAxisView::set_state (node)) != 0) { return ret; } - - if ((prop = node.property ("shown_editor")) != 0) { - if (prop->value() == "no") { - _marked_for_display = false; + + /* if the TimeAxisView had marked this not for display, + then do not allow this to override it. + */ + + if ((prop = node.property ("marked_for_display")) == 0) { + if ((prop = node.property ("shown_editor")) != 0) { + if (prop->value() == "no") { + _marked_for_display = false; + } else { + _marked_for_display = true; + } } else { _marked_for_display = true; } - } else { - _marked_for_display = true; } XMLNodeList nlist = node.children(); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 6d26394038..263171f3eb 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -4187,12 +4187,6 @@ Editor::use_visual_state (VisualState& vs) set_zoom_focus (vs.zoom_focus); reposition_and_zoom (vs.leftmost_frame, vs.frames_per_unit); - if (vs.zoomed_to_region) { - for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - (*i)->set_height_scaling_factor (1.0); - } - } - for (list<TAVState>::iterator i = vs.track_states.begin(); i != vs.track_states.end(); ++i) { TrackViewList::iterator t; diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index fef19140e1..91677acb1f 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -372,6 +372,9 @@ class Editor : public PublicEditor void show_rhythm_ferret(); + void goto_visual_state (uint32_t); + void save_visual_state (uint32_t); + protected: void map_transport_state (); void map_position_change (nframes_t); @@ -407,6 +410,12 @@ class Editor : public PublicEditor void use_visual_state (VisualState&); bool no_save_visual; void swap_visual_state (); + + std::vector<VisualState*> visual_states; + sigc::connection visual_state_op_connection; + void start_visual_state_op (uint32_t n); + void cancel_visual_state_op (uint32_t n); + bool end_visual_state_op (uint32_t n); nframes_t leftmost_frame; double frames_per_unit; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 1b4fa9eaa9..5093c87576 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -73,6 +73,7 @@ Editor::register_actions () ActionManager::register_action (editor_actions, X_("RegionEditOps"), _("Region operations")); ActionManager::register_action (editor_actions, X_("RegionGainMenu"), _("Gain")); ActionManager::register_action (editor_actions, X_("RulerMenu"), _("Rulers")); + ActionManager::register_action (editor_actions, X_("SavedViewMenu"), _("Views")); ActionManager::register_action (editor_actions, X_("ScrollMenu"), _("Scroll")); ActionManager::register_action (editor_actions, X_("SecondaryClockMenu"), _("Secondary Clock")); ActionManager::register_action (editor_actions, X_("Select"), _("Select")); @@ -193,6 +194,56 @@ Editor::register_actions () ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "save-visual-state-1", _("Save View 1"), bind (mem_fun (*this, &Editor::save_visual_state), 0)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "goto-visual-state-1", _("Goto View 1"), bind (mem_fun (*this, &Editor::goto_visual_state), 0)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "save-visual-state-2", _("Save View 2"), bind (mem_fun (*this, &Editor::save_visual_state), 1)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "goto-visual-state-2", _("Goto View 2"), bind (mem_fun (*this, &Editor::goto_visual_state), 1)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "save-visual-state-3", _("Save View 3"), bind (mem_fun (*this, &Editor::save_visual_state), 2)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "goto-visual-state-3", _("Goto View 3"), bind (mem_fun (*this, &Editor::goto_visual_state), 2)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "save-visual-state-4", _("Save View 4"), bind (mem_fun (*this, &Editor::save_visual_state), 3)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "goto-visual-state-4", _("Goto View 4"), bind (mem_fun (*this, &Editor::goto_visual_state), 3)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "save-visual-state-5", _("Save View 5"), bind (mem_fun (*this, &Editor::save_visual_state), 4)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "goto-visual-state-5", _("Goto View 5"), bind (mem_fun (*this, &Editor::goto_visual_state), 4)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "save-visual-state-6", _("Save View 6"), bind (mem_fun (*this, &Editor::save_visual_state), 5)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "goto-visual-state-6", _("Goto View 6"), bind (mem_fun (*this, &Editor::goto_visual_state), 5)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "save-visual-state-7", _("Save View 7"), bind (mem_fun (*this, &Editor::save_visual_state), 6)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "goto-visual-state-7", _("Goto View 7"), bind (mem_fun (*this, &Editor::goto_visual_state), 6)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "save-visual-state-8", _("Save View 8"), bind (mem_fun (*this, &Editor::save_visual_state), 7)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "goto-visual-state-8", _("Goto View 8"), bind (mem_fun (*this, &Editor::goto_visual_state), 7)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "save-visual-state-9", _("Save View 9"), bind (mem_fun (*this, &Editor::save_visual_state), 8)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "goto-visual-state-9", _("Goto View 9"), bind (mem_fun (*this, &Editor::goto_visual_state), 8)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "save-visual-state-10", _("Save View 10"), bind (mem_fun (*this, &Editor::save_visual_state), 9)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "goto-visual-state-10", _("Goto View 10"), bind (mem_fun (*this, &Editor::goto_visual_state), 9)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "save-visual-state-11", _("Save View 11"), bind (mem_fun (*this, &Editor::save_visual_state), 10)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "goto-visual-state-11", _("Goto View 11"), bind (mem_fun (*this, &Editor::goto_visual_state), 10)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "save-visual-state-12", _("Save View 12"), bind (mem_fun (*this, &Editor::save_visual_state), 11)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "goto-visual-state-12", _("Goto View 12"), bind (mem_fun (*this, &Editor::goto_visual_state), 11)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (editor_actions, "goto-mark-1", _("Locate to Mark 1"), bind (mem_fun (*this, &Editor::goto_nth_marker), 0)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "goto-mark-2", _("Locate to Mark 2"), bind (mem_fun (*this, &Editor::goto_nth_marker), 1)); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 3c9a81b843..c30f3dbf0f 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1736,7 +1736,7 @@ Editor::temporal_zoom_region (bool both_axes) nframes_t range = end - start; double new_fpu = (double)range / (double)canvas_width; - nframes_t extra_samples = one_centimeter_in_pixels * new_fpu; + nframes_t extra_samples = (nframes_t) floor (one_centimeter_in_pixels * new_fpu); if (start > extra_samples) { start -= extra_samples; @@ -1761,12 +1761,12 @@ Editor::temporal_zoom_region (bool both_axes) temporal_zoom_by_frame (start, end, "zoom to region"); if (both_axes) { - double per_track_height = (canvas_height - 10.0) / tracks.size(); + uint32_t per_track_height = (uint32_t) floor ((canvas_height - 10.0) / tracks.size()); /* set visible track heights appropriately */ for (set<TimeAxisView*>::iterator t = tracks.begin(); t != tracks.end(); ++t) { - (*t)->set_height_scaling_factor (per_track_height/(*t)->current_height()); + (*t)->set_height (per_track_height); } /* hide irrelevant tracks */ @@ -5884,6 +5884,11 @@ Editor::fit_tracks () uint32_t child_heights = 0; for (TrackSelection::iterator t = selection->tracks.begin(); t != selection->tracks.end(); ++t) { + + if (!(*t)->marked_for_display()) { + continue; + } + child_heights += ((*t)->effective_height - (*t)->current_height()); } @@ -5902,3 +5907,59 @@ Editor::fit_tracks () redo_visual_stack.push_back (current_visual_state()); } + +void +Editor::save_visual_state (uint32_t n) +{ + while (visual_states.size() <= n) { + visual_states.push_back (0); + } + + if (visual_states[n] != 0) { + delete visual_states[n]; + } + + visual_states[n] = current_visual_state (true); + gdk_beep (); +} + +void +Editor::goto_visual_state (uint32_t n) +{ + if (visual_states.size() < n) { + return; + } + + if (visual_states[n] == 0) { + return; + } + + use_visual_state (*visual_states[n]); +} + +void +Editor::start_visual_state_op (uint32_t n) +{ + if (visual_state_op_connection.empty()) { + visual_state_op_connection = Glib::signal_timeout().connect (bind (mem_fun (*this, &Editor::end_visual_state_op), n), 2000); + } else { + cancel_visual_state_op (n); + } +} + +void +Editor::cancel_visual_state_op (uint32_t n) +{ + + visual_state_op_connection.disconnect(); + goto_visual_state (n); +} + +bool +Editor::end_visual_state_op (uint32_t n) +{ + visual_state_op_connection.disconnect(); + save_visual_state (n); + // FLASH SCREEN OR SOMETHING + return false; // do not call again +} diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index dae674a4f5..94b541dc43 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -201,9 +201,9 @@ Editor::hide_track_in_display (TimeAxisView& tv, bool temponly) for (i = rows.begin(); i != rows.end(); ++i) { if ((*i)[route_display_columns.tv] == &tv) { (*i)[route_display_columns.visible] = false; - if (temponly) { - tv.set_marked_for_display (false); - } + // if (temponly) { + tv.set_marked_for_display (false); + // } break; } } diff --git a/gtk2_ardour/mnemonic-us.bindings.in b/gtk2_ardour/mnemonic-us.bindings.in index c882923837..3932c930f6 100644 --- a/gtk2_ardour/mnemonic-us.bindings.in +++ b/gtk2_ardour/mnemonic-us.bindings.in @@ -179,6 +179,33 @@ (gtk_accel_path "<Actions>/Editor/select-range-between-cursors" "F6") (gtk_accel_path "<Actions>/Common/ToggleMaximalEditor" "F11") +(gtk_accel_path "<Actions>/Editor/goto-visual-state-1" "<%PRIMARY%>F1") +(gtk_accel_path "<Actions>/Editor/goto-visual-state-2" "<%PRIMARY%>F2") +(gtk_accel_path "<Actions>/Editor/goto-visual-state-3" "<%PRIMARY%>F3") +(gtk_accel_path "<Actions>/Editor/goto-visual-state-4" "<%PRIMARY%>F4") +(gtk_accel_path "<Actions>/Editor/goto-visual-state-5" "<%PRIMARY%>F5") +(gtk_accel_path "<Actions>/Editor/goto-visual-state-6" "<%PRIMARY%>F6") +(gtk_accel_path "<Actions>/Editor/goto-visual-state-7" "<%PRIMARY%>F7") +(gtk_accel_path "<Actions>/Editor/goto-visual-state-8" "<%PRIMARY%>F8") +(gtk_accel_path "<Actions>/Editor/goto-visual-state-9" "<%PRIMARY%>F9") +(gtk_accel_path "<Actions>/Editor/goto-visual-state-10" "<%PRIMARY%>F10") +(gtk_accel_path "<Actions>/Editor/goto-visual-state-11" "<%PRIMARY%>F11") +(gtk_accel_path "<Actions>/Editor/goto-visual-state-12" "<%PRIMARY%>F12") + +(gtk_accel_path "<Actions>/Editor/save-visual-state-1" "<%PRIMARY%><%TERTIARY%>F1") +(gtk_accel_path "<Actions>/Editor/save-visual-state-2" "<%PRIMARY%><%TERTIARY%>F2") +(gtk_accel_path "<Actions>/Editor/save-visual-state-3" "<%PRIMARY%><%TERTIARY%>F3") +(gtk_accel_path "<Actions>/Editor/save-visual-state-4" "<%PRIMARY%><%TERTIARY%>F4") +(gtk_accel_path "<Actions>/Editor/save-visual-state-5" "<%PRIMARY%><%TERTIARY%>F5") +(gtk_accel_path "<Actions>/Editor/save-visual-state-6" "<%PRIMARY%><%TERTIARY%>F6") +(gtk_accel_path "<Actions>/Editor/save-visual-state-7" "<%PRIMARY%><%TERTIARY%>F7") +(gtk_accel_path "<Actions>/Editor/save-visual-state-8" "<%PRIMARY%><%TERTIARY%>F8") +(gtk_accel_path "<Actions>/Editor/save-visual-state-9" "<%PRIMARY%><%TERTIARY%>F9") +(gtk_accel_path "<Actions>/Editor/save-visual-state-10" "<%PRIMARY%><%TERTIARY%>F10") +(gtk_accel_path "<Actions>/Editor/save-visual-state-11" "<%PRIMARY%><%TERTIARY%>F11") +(gtk_accel_path "<Actions>/Editor/save-visual-state-12" "<%PRIMARY%><%TERTIARY%>F12") + + ;; numbers (gtk_accel_path "<Actions>/Editor/toggle-edit-mode" "1") diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 07a7142b3b..db71753aaf 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -517,6 +517,7 @@ RouteTimeAxisView::build_display_menu () route_active_menu_item->set_active (_route->active()); items.push_back (SeparatorElem()); + items.push_back (MenuElem (_("Hide"), mem_fun(*this, &RouteTimeAxisView::hide_click))); items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route))); } @@ -697,6 +698,7 @@ RouteTimeAxisView::set_height (uint32_t h) int gmlen = h - 5; bool height_changed = (height == 0) || (h != height); lm.setup_meters (gmlen); + TimeAxisView::set_height (h); ensure_xml_node (); @@ -752,7 +754,7 @@ RouteTimeAxisView::set_height (uint32_t h) playlist_button.hide (); } - } else if (height >= hSmall) { + } else { hide_meter (); hide_name_entry (); diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index d90698db0e..c7373f5b2e 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -91,7 +91,6 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie _hidden = false; height = 0; effective_height = 0; - height_scaling_factor = 1.0; parent = rent; _has_state = false; last_name_entry_key_press_event = 0; @@ -342,13 +341,6 @@ TimeAxisView::hide () } void -TimeAxisView::set_height_scaling_factor (double hsf) -{ - height_scaling_factor = hsf; - set_height (height); -} - -void TimeAxisView::step_height (bool bigger) { if (bigger) { @@ -376,8 +368,9 @@ void TimeAxisView::set_height(uint32_t h) { height = h; + controls_frame.set_size_request (-1, current_height() + ((order == 0) ? 1 : 0)); - //cerr << "TimeAxisView::set_height_pixels() called h = " << h << endl;//DEBUG + if (canvas_item_visible (selection_group)) { /* resize the selection rect */ show_selection (editor.get_selection().time); @@ -534,7 +527,6 @@ TimeAxisView::conditionally_add_to_selection () Selection& s (editor.get_selection()); if (!s.selected (this)) { - cerr << "set selected track\n"; editor.set_selected_track (*this, Selection::Set); } } @@ -930,8 +922,6 @@ TimeAxisView::get_state () snprintf (buf, sizeof(buf), "%u", height); node->add_property ("height", buf); - snprintf (buf, sizeof(buf), "%f", height_scaling_factor); - node->add_property ("height_scaling_factor", buf); node->add_property ("marked_for_display", (_marked_for_display ? "1" : "0")); return *node; } @@ -945,10 +935,6 @@ TimeAxisView::set_state (const XMLNode& node) _marked_for_display = (prop->value() == "1"); } - if ((prop = node.property ("height_scaling_factor")) != 0) { - height_scaling_factor = atof (prop->value()); - } - if ((prop = node.property ("track_height")) != 0) { if (prop->value() == "largest") { diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index ec11f6dfdb..ee950cfac8 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -97,12 +97,10 @@ class TimeAxisView : public virtual AxisView, public Stateful PublicEditor& editor; uint32_t effective_height; /* in canvas units */ - double height_scaling_factor; /* used to zoom the track height without changing it */ double y_position; int order; - uint32_t current_height() const { return (uint32_t) floor (height * height_scaling_factor); } - void set_height_scaling_factor (double); + uint32_t current_height() const { return height; } ArdourCanvas::Group *canvas_display; Gtk::VBox *control_parent; |