diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-01-05 03:18:44 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-01-05 03:18:44 +0000 |
commit | 2fcdf14e2b63753be7b9cd74a442fa5aefbfb401 (patch) | |
tree | 25c98b803239a87bfbf93a22d506bedef43b3e7c | |
parent | f020b4e1e66dedba8d150a646347ec2b02b8ac52 (diff) |
lots of small fixes for various irritations, return of snapshots, region list hiding stuff, etc etc etc
git-svn-id: svn://localhost/trunk/ardour2@241 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour.bindings | 30 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 177 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 26 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas_events.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_region_list.cc | 168 | ||||
-rw-r--r-- | gtk2_ardour/editor_route_list.cc | 49 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 104 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.h | 23 | ||||
-rw-r--r-- | libs/ardour/ardour/state_manager.h | 2 | ||||
-rw-r--r-- | libs/ardour/audioengine.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session.cc | 50 |
14 files changed, 247 insertions, 397 deletions
diff --git a/gtk2_ardour/ardour.bindings b/gtk2_ardour/ardour.bindings index aa047c0fa5..089baa9f1d 100644 --- a/gtk2_ardour/ardour.bindings +++ b/gtk2_ardour/ardour.bindings @@ -1,25 +1,26 @@ -; this file is an automated accelerator map dump - -(gtk_accel_path "<Actions>/Editor/set-playhead" "p") - -(gtk_accel_path "<Actions>/Common/Quit" "<Control>q") -(gtk_accel_path "<Actions>/Common/Save" "<Control>s") +; this file is NOT an automated accelerator map dump (gtk_accel_path "<Actions>/Transport/ToggleRoll" "space") (gtk_accel_path "<Actions>/Transport/ToggleRollForgetCapture" "<Control>space") -(gtk_accel_path "<Actions>/Transport/Forward" "Right") -(gtk_accel_path "<Actions>/Transport/Rewind" "Left") -(gtk_accel_path "<Actions>/Transport/Record" "R") -(gtk_accel_path "<Actions>/Transport/loop" "l") +(gtk_accel_path "<Actions>/Transport/Forward" "<control>Right") +(gtk_accel_path "<Actions>/Transport/Rewind" "<control>Left") (gtk_accel_path "<Actions>/Transport/GotoStart" "Home") (gtk_accel_path "<Actions>/Transport/GotoEnd" "End") +(gtk_accel_path "<Actions>/Editor/align-regions-sync-relative" "a") (gtk_accel_path "<Actions>/Editor/set-edit-cursor" "e") -(gtk_accel_path "<Actions>/Editor/cut" "<Control>x") +(gtk_accel_path "<Actions>/Transport/loop" "l") +(gtk_accel_path "<Actions>/Editor/set-playhead" "p") +(gtk_accel_path "<Actions>/Transport/Record" "R") + (gtk_accel_path "<Actions>/Editor/copy" "<Control>c") +(gtk_accel_path "<Actions>/Common/Quit" "<Control>q") +(gtk_accel_path "<Actions>/Editor/redo" "<Control>r") +(gtk_accel_path "<Actions>/Common/Save" "<Control>s") (gtk_accel_path "<Actions>/Editor/paste" "<Control>v") +(gtk_accel_path "<Actions>/Editor/cut" "<Control>x") (gtk_accel_path "<Actions>/Editor/undo" "<Control>z") -(gtk_accel_path "<Actions>/Editor/redo" "<Control>r") + (gtk_accel_path "<Actions>/Editor/scroll-tracks-down" "Page_Down") (gtk_accel_path "<Actions>/Editor/scroll-tracks-up" "Page_Up") (gtk_accel_path "<Actions>/Editor/step-tracks-down" "Down") @@ -30,7 +31,6 @@ (gtk_accel_path "<Actions>/Editor/temporal-zoom-in" "minus") (gtk_accel_path "<Actions>/Editor/temporal-zoom-out" "equal") -(gtk_accel_path "<Actions>/Editor/align-regions-sync-relative" "a") (gtk_accel_path "<Actions>/Editor/align-regions-sync" "<meta>a") (gtk_accel_path "<Actions>/Editor/align-regions-end" "<meta><control>a") (gtk_accel_path "<Actions>/Editor/align-regions-start-relative" "<control>a") @@ -56,8 +56,8 @@ (gtk_accel_path "<Actions>/Editor/edit-cursor-to-range-start" "F1") (gtk_accel_path "<Actions>/Editor/edit-cursor-to-range-end" "F2") -(gtk_accel_path "<Actions>/Editor/jump-forward-to-mark" "KP_Right") -(gtk_accel_path "<Actions>/Editor/jump-backward-to-mark" "KP_Left") +(gtk_accel_path "<Actions>/Editor/jump-forward-to-mark" "<control>KP_Right") +(gtk_accel_path "<Actions>/Editor/jump-backward-to-mark" "<control>KP_Left") (gtk_accel_path "<Actions>/Editor/add-location-from-playhead" "KP_Enter") diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 67323ac07b..fd5f8ed989 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -501,7 +501,7 @@ ARDOUR_UI::every_point_one_seconds () timersub (&now, &last_peak_grab, &diff); if ((diff.tv_usec + (diff.tv_sec * 1000000)) >= engine->usecs_per_cycle()) { - IO::GrabPeakPower(); /* EMIT_SIGNAL */ + // IO::GrabPeakPower(); /* EMIT_SIGNAL */ last_peak_grab = now; } diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index bca1643b40..5bc2590446 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -319,6 +319,7 @@ Editor::Editor (AudioEngine& eng) show_gain_after_trim = false; no_zoom_repos_update = false; ignore_route_list_reorder = false; + no_route_list_redisplay = false; verbose_cursor_on = true; route_removal = false; track_spacing = 0; @@ -496,9 +497,9 @@ Editor::Editor (AudioEngine& eng) zoom_out_full_button.set_name ("EditorTimeButton"); ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_full_button, _("Zoom to session")); - zoom_in_button.add (*(manage (new Gtk::Image (Stock::ZOOM_IN, ICON_SIZE_BUTTON)))); - zoom_out_button.add (*(manage (new Gtk::Image (Stock::ZOOM_OUT, ICON_SIZE_BUTTON)))); - zoom_out_full_button.add (*(manage (new Gtk::Image (Stock::ZOOM_FIT, ICON_SIZE_BUTTON)))); + zoom_in_button.add (*(manage (new Image (Stock::ZOOM_IN, ICON_SIZE_BUTTON)))); + zoom_out_button.add (*(manage (new Image (Stock::ZOOM_OUT, ICON_SIZE_BUTTON)))); + zoom_out_full_button.add (*(manage (new Image (Stock::ZOOM_FIT, ICON_SIZE_BUTTON)))); zoom_in_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::temporal_zoom_step), false)); zoom_out_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::temporal_zoom_step), true)); @@ -525,24 +526,18 @@ Editor::Editor (AudioEngine& eng) route_list_display.append_column (_("Tracks"), route_display_columns.text); route_list_display.set_headers_visible (false); route_list_display.set_name ("TrackListDisplay"); - route_list_display.get_selection()->set_mode (Gtk::SELECTION_MULTIPLE); + route_list_display.get_selection()->set_mode (SELECTION_MULTIPLE); route_list_display.set_reorderable (true); - route_list_display.set_size_request (75,-1); - route_list_display.set_headers_visible (true); - route_list_display.set_headers_clickable (true); - - // GTK2FIX - // route_list_display.signal_rows_reordered().connect (mem_fun (*this, &Editor::queue_route_list_reordered)); + route_display_model->signal_rows_reordered().connect (mem_fun (*this, &Editor::route_list_reordered)); route_display_model->set_sort_func (0, mem_fun (*this, &Editor::route_list_compare_func)); route_display_model->set_sort_column (0, SORT_ASCENDING); route_list_scroller.add (route_list_display); - route_list_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); + route_list_scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC); route_list_display.get_selection()->signal_changed().connect (mem_fun (*this, &Editor::route_display_selection_changed)); - route_list_display.signal_columns_changed().connect (mem_fun(*this, &Editor::route_list_column_click)); edit_group_list_button_label.set_text (_("Edit Groups")); edit_group_list_button_label.set_name ("EditGroupTitleButton"); @@ -564,17 +559,14 @@ Editor::Editor (AudioEngine& eng) active_cell->property_radio() = false; edit_group_display.set_name ("MixerGroupList"); - //edit_group_display.set_shadow_type (Gtk::SHADOW_IN); - edit_group_display.columns_autosize (); - edit_group_display.get_selection()->set_mode (Gtk::SELECTION_MULTIPLE); + edit_group_display.get_selection()->set_mode (SELECTION_MULTIPLE); edit_group_display.set_reorderable (false); edit_group_display.set_size_request (75, -1); - edit_group_display.set_headers_visible (true); edit_group_list_scroller.add (edit_group_display); - edit_group_list_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + edit_group_list_scroller.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC); edit_group_list_button.signal_clicked().connect (mem_fun(*this, &Editor::edit_group_list_button_clicked)); edit_group_display.signal_button_press_event().connect (mem_fun(*this, &Editor::edit_group_list_button_press_event)); @@ -597,8 +589,11 @@ Editor::Editor (AudioEngine& eng) region_list_model->set_sort_column (0, SORT_ASCENDING); region_list_display.set_model (region_list_model); - CellRendererText* renderer = Gtk::manage( new Gtk::CellRendererText() ); + CellRendererText* renderer = manage( new CellRendererText() ); region_list_display.append_column (_("Regions"), *renderer); + region_list_display.set_headers_visible (false); + + region_list_display.get_selection()->set_select_function (mem_fun (*this, &Editor::region_list_selection_filter)); TreeViewColumn* tv_col = region_list_display.get_column(0); tv_col->add_attribute(renderer->property_text(), region_list_columns.name); @@ -606,12 +601,12 @@ Editor::Editor (AudioEngine& eng) region_list_display.set_reorderable (true); - region_list_display.get_selection()->set_mode (SELECTION_SINGLE); + region_list_display.get_selection()->set_mode (SELECTION_MULTIPLE); region_list_display.add_object_drag (region_list_columns.region.index(), "regions"); /* setup DnD handling */ - list<Gtk::TargetEntry> region_list_target_table; + list<TargetEntry> region_list_target_table; region_list_target_table.push_back (TargetEntry ("text/plain")); region_list_target_table.push_back (TargetEntry ("text/uri-list")); @@ -640,15 +635,29 @@ Editor::Editor (AudioEngine& eng) named_selection_display.set_size_request (100, -1); named_selection_display.set_name ("RegionListDisplay"); - named_selection_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE); + named_selection_display.get_selection()->set_mode (SELECTION_SINGLE); named_selection_display.set_size_request (100, -1); - named_selection_display.set_headers_visible (true); - named_selection_display.set_headers_clickable (true); - named_selection_display.signal_button_press_event().connect (mem_fun(*this, &Editor::named_selection_display_button_press)); + named_selection_display.signal_button_press_event().connect (mem_fun(*this, &Editor::named_selection_display_button_press), false); named_selection_display.get_selection()->signal_changed().connect (mem_fun (*this, &Editor::named_selection_display_selection_changed)); + /* SNAPSHOTS */ + + snapshot_display_model = ListStore::create (snapshot_display_columns); + snapshot_display.set_model (snapshot_display_model); + snapshot_display.append_column (X_("snapshot"), snapshot_display_columns.visible_name); + snapshot_display.set_name ("SnapshotDisplayList"); + snapshot_display.set_size_request (75, -1); + snapshot_display.set_headers_visible (false); + snapshot_display.set_reorderable (false); + snapshot_display_scroller.add (snapshot_display); + snapshot_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); + + snapshot_display.get_selection()->signal_changed().connect (mem_fun(*this, &Editor::snapshot_display_selection_changed)); + snapshot_display.signal_button_press_event().connect (mem_fun (*this, &Editor::snapshot_display_button_press), false); + the_notebook.append_page (region_list_scroller, _("Regions")); the_notebook.append_page (route_list_scroller, _("Tracks/Busses")); + the_notebook.append_page (snapshot_display_scroller, _("Snapshots")); the_notebook.append_page (edit_group_vbox, _("Edit Groups")); the_notebook.append_page (named_selection_scroller, _("Chunks")); the_notebook.set_show_tabs (true); @@ -661,7 +670,7 @@ Editor::Editor (AudioEngine& eng) edit_pane.pack1 (edit_frame, true, true); edit_pane.pack2 (*notebook_tearoff, true, true); - edit_pane.signal_size_allocate().connect_notify (bind (mem_fun(*this, &Editor::pane_allocation_handler), static_cast<Gtk::Paned*> (&edit_pane))); + edit_pane.signal_size_allocate().connect_notify (bind (mem_fun(*this, &Editor::pane_allocation_handler), static_cast<Paned*> (&edit_pane))); top_hbox.pack_start (toolbar_frame, true, true); @@ -692,8 +701,8 @@ Editor::Editor (AudioEngine& eng) /* nudge stuff */ - nudge_forward_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(right_arrow_xpm))))); - nudge_backward_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(left_arrow_xpm))))); + nudge_forward_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(right_arrow_xpm))))); + nudge_backward_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(left_arrow_xpm))))); ARDOUR_UI::instance()->tooltips().set_tip (nudge_forward_button, _("Nudge region/selection forwards")); ARDOUR_UI::instance()->tooltips().set_tip (nudge_backward_button, _("Nudge region/selection backwards")); @@ -1230,7 +1239,7 @@ Editor::connect_to_session (Session *t) update_punch_range_view (true); session->ControlChanged.connect (mem_fun(*this, &Editor::queue_session_control_changed)); - + session->StateSaved.connect (mem_fun(*this, &Editor::session_state_saved)); refresh_location_display (); session->locations()->added.connect (mem_fun(*this, &Editor::add_new_location)); @@ -1243,19 +1252,13 @@ Editor::connect_to_session (Session *t) redisplay_regions (); redisplay_named_selections (); + redisplay_snapshots (); - // GTK2FIX - // route_list_display.set_model (Glib::RefPtr<TreeModel>(0)); route_display_model->clear (); - + no_route_list_redisplay = true; session->foreach_route (this, &Editor::handle_new_route); - // route_list_display.select_all (); - // GTK2FIX - //route_list_display.sort (); - - route_list_reordered (); - - // route_list_display.set_model (route_display_model); + no_route_list_redisplay = false; + route_list_display.get_selection()->select_all (); for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { (static_cast<TimeAxisView*>(*i))->set_samples_per_unit (frames_per_unit); @@ -2472,9 +2475,9 @@ Editor::setup_toolbar () mouse_mode_tearoff = manage (new TearOff (mouse_mode_button_table)); mouse_mode_tearoff->set_name ("MouseModeBase"); - mouse_mode_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Gtk::Box*>(&toolbar_hbox), + mouse_mode_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox), &mouse_mode_tearoff->tearoff_window())); - mouse_mode_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Gtk::Box*> (&toolbar_hbox), + mouse_mode_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox), &mouse_mode_tearoff->tearoff_window(), 1)); mouse_move_button.set_name ("MouseModeButton"); @@ -2491,12 +2494,12 @@ Editor::setup_toolbar () ARDOUR_UI::instance()->tooltips().set_tip (mouse_timefx_button, _("stretch/shrink regions")); ARDOUR_UI::instance()->tooltips().set_tip (mouse_audition_button, _("listen to specific regions")); - mouse_move_button.unset_flags (Gtk::CAN_FOCUS); - mouse_select_button.unset_flags (Gtk::CAN_FOCUS); - mouse_gain_button.unset_flags (Gtk::CAN_FOCUS); - mouse_zoom_button.unset_flags (Gtk::CAN_FOCUS); - mouse_timefx_button.unset_flags (Gtk::CAN_FOCUS); - mouse_audition_button.unset_flags (Gtk::CAN_FOCUS); + mouse_move_button.unset_flags (CAN_FOCUS); + mouse_select_button.unset_flags (CAN_FOCUS); + mouse_gain_button.unset_flags (CAN_FOCUS); + mouse_zoom_button.unset_flags (CAN_FOCUS); + mouse_timefx_button.unset_flags (CAN_FOCUS); + mouse_audition_button.unset_flags (CAN_FOCUS); mouse_select_button.signal_toggled().connect (bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseRange)); mouse_select_button.signal_button_release_event().connect (mem_fun(*this, &Editor::mouse_select_button_release)); @@ -2660,9 +2663,9 @@ Editor::setup_toolbar () tools_tearoff = new TearOff (*hbox); tools_tearoff->set_name ("MouseModeBase"); - tools_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Gtk::Box*>(&toolbar_hbox), + tools_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox), &tools_tearoff->tearoff_window())); - tools_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Gtk::Box*> (&toolbar_hbox), + tools_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox), &tools_tearoff->tearoff_window(), 0)); @@ -2675,7 +2678,7 @@ Editor::setup_toolbar () toolbar_base.set_name ("ToolBarBase"); toolbar_base.add (toolbar_hbox); - toolbar_frame.set_shadow_type (Gtk::SHADOW_OUT); + toolbar_frame.set_shadow_type (SHADOW_OUT); toolbar_frame.set_name ("BaseFrame"); toolbar_frame.add (toolbar_base); } @@ -3308,7 +3311,7 @@ Editor::duplicate_dialog (bool dup_region) win.add_button (Stock::OK, RESPONSE_ACCEPT); win.add_button (Stock::CANCEL, RESPONSE_CANCEL); - win.set_position (Gtk::WIN_POS_MOUSE); + win.set_position (WIN_POS_MOUSE); entry.set_text ("1"); set_size_request_to_display_given_text (entry, X_("12345678"), 20, 15); @@ -3629,7 +3632,7 @@ Editor::ensure_float (Window& win) } void -Editor::pane_allocation_handler (Gtk::Allocation &alloc, Gtk::Paned* which) +Editor::pane_allocation_handler (Allocation &alloc, Paned* which) { /* recover or initialize pane positions. do this here rather than earlier because we don't want the positions to change the child allocations, which they seem to do. @@ -3651,7 +3654,7 @@ Editor::pane_allocation_handler (Gtk::Allocation &alloc, Gtk::Paned* which) height = atoi(geometry->property("y_size")->value()); } - if (which == static_cast<Gtk::Paned*> (&edit_pane)) { + if (which == static_cast<Paned*> (&edit_pane)) { if (done[0]) { return; @@ -3671,7 +3674,7 @@ Editor::pane_allocation_handler (Gtk::Allocation &alloc, Gtk::Paned* which) } void -Editor::detach_tearoff (Gtk::Box* b, Gtk::Window* w) +Editor::detach_tearoff (Box* b, Window* w) { if (tools_tearoff->torn_off() && mouse_mode_tearoff->torn_off()) { @@ -3680,7 +3683,7 @@ Editor::detach_tearoff (Gtk::Box* b, Gtk::Window* w) } void -Editor::reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n) +Editor::reattach_tearoff (Box* b, Window* w, int32_t n) { if (toolbar_frame.get_parent() == 0) { top_hbox.pack_end (toolbar_frame); @@ -3790,7 +3793,7 @@ Editor::playlist_deletion_dialog (Playlist* pl) "If deleted, audio files used by it alone by will cleaned."), pl->name())); - dialog.set_position (Gtk::WIN_POS_CENTER); + dialog.set_position (WIN_POS_CENTER); dialog.get_vbox()->pack_start (label); dialog.add_button (_("Delete playlist"), RESPONSE_ACCEPT); @@ -3889,3 +3892,67 @@ Editor::control_layout_scroll (GdkEventScroll* ev) return false; } + +void +Editor::snapshot_display_selection_changed () +{ + if (snapshot_display.get_selection()->count_selected_rows() > 0) { + + TreeModel::iterator i = snapshot_display.get_selection()->get_selected(); + + cerr << "snapshot selected\n"; + + Glib::ustring snap_name = (*i)[snapshot_display_columns.real_name]; + + cerr << "name is " << snap_name << endl; + + if (snap_name.length() == 0) { + return; + } + + if (session->snap_name() == snap_name) { + return; + } + + ARDOUR_UI::instance()->load_session(session->path(), string (snap_name)); + } +} + +bool +Editor::snapshot_display_button_press (GdkEventButton* ev) +{ + return false; +} + +void +Editor::redisplay_snapshots () +{ + if (session == 0) { + return; + } + + vector<string*>* states; + + if ((states = session->possible_states()) == 0) { + return; + } + + snapshot_display_model->clear (); + + for (vector<string*>::iterator i = states->begin(); i != states->end(); ++i) { + string statename = *(*i); + TreeModel::Row row = *(snapshot_display_model->append()); + row[snapshot_display_columns.visible_name] = statename; + row[snapshot_display_columns.real_name] = statename; + } + + delete states; +} + +void +Editor::session_state_saved (string snap_name) +{ + ENSURE_GUI_THREAD (bind (mem_fun(*this, &Editor::session_state_saved), snap_name)); + redisplay_snapshots (); +} + diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index f644605b3e..74a565cd91 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -697,6 +697,7 @@ class Editor : public PublicEditor Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action; void region_list_selection_changed (); + bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn); Gtk::Menu *region_list_menu; Gtk::ScrolledWindow region_list_scroller; @@ -722,6 +723,26 @@ class Editor : public PublicEditor int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator); + /* snapshots */ + + Gtk::ScrolledWindow snapshot_display_scroller; + struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord { + SnapshotDisplayModelColumns() { + add (visible_name); + add (real_name); + } + Gtk::TreeModelColumn<Glib::ustring> visible_name; + Gtk::TreeModelColumn<Glib::ustring> real_name; + }; + + SnapshotDisplayModelColumns snapshot_display_columns; + Glib::RefPtr<Gtk::ListStore> snapshot_display_model; + Gtk::TreeView snapshot_display; + + bool snapshot_display_button_press (GdkEventButton*); + void snapshot_display_selection_changed (); + void redisplay_snapshots(); + /* named selections */ struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord { @@ -1008,8 +1029,9 @@ class Editor : public PublicEditor void route_display_selection_changed (); void redisplay_route_list(); - gint route_list_reordered (); + void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what); bool ignore_route_list_reorder; + bool no_route_list_redisplay; void queue_route_list_reordered (); struct DragInfo { @@ -1786,6 +1808,8 @@ class Editor : public PublicEditor void init_colormap (); bool on_key_press_event (GdkEventKey*); + + void session_state_saved (string); }; #endif /* __ardour_editor_h__ */ diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index c1762a4149..0bbb9f55a5 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -95,7 +95,8 @@ Editor::initialize_canvas () track_canvas.set_name ("EditorMainCanvas"); track_canvas.add_events (Gdk::POINTER_MOTION_HINT_MASK|Gdk::SCROLL_MASK); track_canvas.signal_leave_notify_event().connect (mem_fun(*this, &Editor::left_track_canvas)); - + track_canvas.set_flags (CAN_FOCUS); + /* set up drag-n-drop */ vector<TargetEntry> target_table; @@ -128,6 +129,7 @@ Editor::initialize_canvas () time_canvas.set_name ("EditorTimeCanvas"); time_canvas.add_events (Gdk::POINTER_MOTION_HINT_MASK); + time_canvas.set_flags (CAN_FOCUS); meter_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, 0.0); tempo_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, timebar_height); diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index da38a79d11..ac4eafc9e6 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -80,6 +80,10 @@ Editor::track_canvas_event (GdkEvent *event, ArdourCanvas::Item* item) track_canvas.get_pointer (x, y); return track_canvas_motion (event); + case GDK_BUTTON_PRESS: + track_canvas.grab_focus(); + break; + case GDK_BUTTON_RELEASE: switch (event->button.button) { case 4: @@ -90,6 +94,7 @@ Editor::track_canvas_event (GdkEvent *event, ArdourCanvas::Item* item) break; case GDK_SCROLL: + track_canvas.grab_focus(); track_canvas_scroll (&event->scroll); break; diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 90714ed8df..fa0649faf1 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -287,6 +287,8 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp { jack_nframes_t where = event_frame (event, 0, 0); + track_canvas.grab_focus(); + if (session && session->actively_recording()) { return TRUE; } diff --git a/gtk2_ardour/editor_region_list.cc b/gtk2_ardour/editor_region_list.cc index 0fd41ae66f..04f59944b8 100644 --- a/gtk2_ardour/editor_region_list.cc +++ b/gtk2_ardour/editor_region_list.cc @@ -45,142 +45,6 @@ using namespace Gtk; using namespace Glib; using namespace Editing; -#define wave_cursor_width 43 -#define wave_cursor_height 61 -#define wave_cursor_x_hot 0 -#define wave_cursor_y_hot 25 -static const gchar wave_cursor_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, -0x03, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, -0x02, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, -0x02, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, -0x02, - 0x02, 0x04, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x00, 0x04, 0x00, -0x02, - 0x02, 0x04, 0x00, 0x04, 0x00, 0x02, 0x02, 0x0c, 0x08, 0x0c, 0x00, -0x02, - 0x02, 0x1c, 0x08, 0x0c, 0x00, 0x02, 0x02, 0x1c, 0x08, 0x0c, 0x04, -0x02, - 0x02, 0x3c, 0x18, 0x0c, 0x04, 0x02, 0x02, 0x7c, 0x18, 0x1c, 0x0c, -0x02, - 0x82, 0xfc, 0x38, 0x1c, 0x0c, 0x02, 0xc2, 0xfc, 0x78, 0x3c, 0x1c, -0x02, - 0xe2, 0xfd, 0xf9, 0x7d, 0x1c, 0x02, 0xf2, 0xff, 0xfb, 0xff, 0x1c, -0x02, - 0xfa, 0xff, 0xfb, 0xff, 0x3f, 0x02, 0xfe, 0xff, 0xff, 0xff, 0xff, -0x03, - 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfa, 0xff, 0xff, 0xff, 0x3f, -0x02, - 0xf2, 0xff, 0xfb, 0xfd, 0x3c, 0x02, 0xe2, 0xfd, 0x7b, 0x7c, 0x1c, -0x02, - 0xc2, 0xfc, 0x39, 0x3c, 0x1c, 0x02, 0x82, 0xfc, 0x18, 0x1c, 0x1c, -0x02, - 0x02, 0xfc, 0x18, 0x1c, 0x0c, 0x02, 0x02, 0x7c, 0x18, 0x0c, 0x0c, -0x02, - 0x02, 0x3c, 0x08, 0x0c, 0x04, 0x02, 0x02, 0x1c, 0x08, 0x0c, 0x04, -0x02, - 0x02, 0x1c, 0x08, 0x0c, 0x00, 0x02, 0x02, 0x0c, 0x00, 0x04, 0x00, -0x02, - 0x02, 0x04, 0x00, 0x04, 0x00, 0x02, 0x02, 0x04, 0x00, 0x00, 0x00, -0x02, - 0x02, 0x04, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, -0x02, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, -0x02, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, -0x02, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, 0xff, 0xff, 0xff, -0x03, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -#define wave_cursor_mask_width 43 -#define wave_cursor_mask_height 61 -#define wave_cursor_mask_x_hot 0 -#define wave_cursor_mask_y_hot 25 -static const gchar wave_cursor_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, -0x00, - 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x0c, 0x00, -0x00, - 0x00, 0x1c, 0x08, 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x08, 0x0c, 0x04, -0x00, - 0x00, 0x3c, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x7c, 0x18, 0x1c, 0x0c, -0x00, - 0x80, 0xfc, 0x38, 0x1c, 0x0c, 0x00, 0xc0, 0xfc, 0x78, 0x3c, 0x1c, -0x00, - 0xe0, 0xfd, 0xf9, 0x7d, 0x1c, 0x00, 0xf0, 0xff, 0xfb, 0xff, 0x1c, -0x00, - 0xf8, 0xff, 0xfb, 0xff, 0x3f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, -0x07, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0xff, 0x3f, -0x00, - 0xf0, 0xff, 0xfb, 0xfd, 0x3c, 0x00, 0xe0, 0xfd, 0x7b, 0x7c, 0x1c, -0x00, - 0xc0, 0xfc, 0x39, 0x3c, 0x1c, 0x00, 0x80, 0xfc, 0x18, 0x1c, 0x1c, -0x00, - 0x00, 0xfc, 0x18, 0x1c, 0x0c, 0x00, 0x00, 0x7c, 0x18, 0x0c, 0x0c, -0x00, - 0x00, 0x3c, 0x08, 0x0c, 0x04, 0x00, 0x00, 0x1c, 0x08, 0x0c, 0x04, -0x00, - 0x00, 0x1c, 0x08, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x04, 0x00, -0x00, - 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -GdkCursor *wave_cursor = 0; - void Editor::handle_audio_region_removed (AudioRegion* ignored) { @@ -218,7 +82,7 @@ Editor::add_audio_region_to_region_display (AudioRegion *region) if (region->hidden()) { - TreeModel::iterator iter = region_list_model->get_iter (_("/Hidden")); + TreeModel::iterator iter = region_list_model->get_iter ("0"); TreeModel::Row parent; TreeModel::Row child; @@ -228,8 +92,19 @@ Editor::add_audio_region_to_region_display (AudioRegion *region) parent[region_list_columns.name] = _("Hidden"); parent[region_list_columns.region] = 0; + } else { - parent = *iter; + + if ((*iter)[region_list_columns.name] != _("Hidden")) { + + parent = *(region_list_model->insert(iter)); + parent[region_list_columns.name] = _("Hidden"); + parent[region_list_columns.region] = 0; + + } else { + parent = *iter; + } + } row = *(region_list_model->append (parent.children())); @@ -547,6 +422,16 @@ Editor::region_list_sorter (TreeModel::iterator a, TreeModel::iterator b) Region* r1 = (*a)[region_list_columns.region]; Region* r2 = (*b)[region_list_columns.region]; + /* handle rows without regions, like "Hidden" */ + + if (r1 == 0) { + return -1; + } + + if (r2 == 0) { + return 1; + } + AudioRegion* region1 = dynamic_cast<AudioRegion*> (r1); AudioRegion* region2 = dynamic_cast<AudioRegion*> (r2); @@ -697,3 +582,10 @@ Editor::region_list_display_drag_data_received (const RefPtr<Gdk::DragContext>& } } +bool +Editor::region_list_selection_filter (const RefPtr<TreeModel>& model, const TreeModel::Path& path, bool yn) +{ + /* not possible to select rows that do not represent regions, like "Hidden" */ + + return (*(model->get_iter (path)))[region_list_columns.region] != 0; +} diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index a3c295d47e..b8d280b2bb 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -63,7 +63,7 @@ Editor::handle_new_route (Route& route) ignore_route_list_reorder = true; - if (tv->marked_for_display()) { + if (!no_route_list_redisplay && tv->marked_for_display()) { route_list_display.get_selection()->select (row); } @@ -90,7 +90,7 @@ Editor::handle_gui_changes (const string & what, void *src) ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::handle_gui_changes), what, src)); if (what == "track_height") { - route_list_reordered (); + redisplay_route_list (); } } @@ -147,7 +147,6 @@ Editor::route_name_changed (TimeAxisView *tv) void Editor::route_display_selection_changed () { - TimeAxisView *tv; TreeModel::Children rows = route_display_model->children(); TreeModel::Children::iterator i; @@ -155,6 +154,7 @@ Editor::route_display_selection_changed () for (i = rows.begin(); i != rows.end(); ++i) { tv = (*i)[route_display_columns.tv]; + if (!selection->is_selected (i)) { tv->set_marked_for_display (false); } else { @@ -169,7 +169,7 @@ Editor::route_display_selection_changed () } } - route_list_reordered (); + redisplay_route_list (); } void @@ -201,41 +201,33 @@ Editor::select_strip_in_display (TimeAxisView* tv) } void -Editor::queue_route_list_reordered () - +Editor::route_list_reordered (const TreeModel::Path& path,const TreeModel::iterator& iter,int* what) { - /* the problem here is that we are called *before* the - list has been reordered. so just queue up - the actual re-drawer to happen once the re-ordering - is complete. - */ - - Glib::signal_idle().connect (mem_fun(*this, &Editor::route_list_reordered)); + redisplay_route_list (); } void Editor::redisplay_route_list () { - route_list_reordered (); -} - -gint -Editor::route_list_reordered () -{ TreeModel::Children rows = route_display_model->children(); TreeModel::Children::iterator i; uint32_t position; uint32_t order; int n; - + + if (no_route_list_redisplay) { + return; + } + for (n = 0, order = 0, position = 0, i = rows.begin(); i != rows.end(); ++i, ++order) { TimeAxisView *tv = (*i)[route_display_columns.tv]; AudioTimeAxisView* at; + if (!ignore_route_list_reorder) { - /* this reorder is caused by user action, so reassign sort order keys - to tracks. - */ + /* this reorder is caused by user action, so reassign sort order keys + to tracks. + */ if ((at = dynamic_cast<AudioTimeAxisView*> (tv)) != 0) { at->route().set_order_key (N_("editor"), order); @@ -254,7 +246,6 @@ Editor::route_list_reordered () controls_layout.queue_resize (); reset_scrolling_region (); - return FALSE; } void @@ -284,16 +275,6 @@ Editor::hide_all_tracks (bool with_select) } void -Editor::route_list_column_click () -{ - if (route_list_menu == 0) { - build_route_list_menu (); - } - - route_list_menu->popup (0, 0); -} - -void Editor::build_route_list_menu () { using namespace Menu_Helpers; diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index c9423f0490..bde1fd46e6 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -101,15 +101,6 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) group_display_scroller.add (group_display); group_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); - snapshot_display_model = ListStore::create (snapshot_display_columns); - snapshot_display.set_model (snapshot_display_model); - snapshot_display.append_column (X_("mixgroups"), snapshot_display_columns.visible_name); - snapshot_display.set_name ("MixerSnapshotDisplayList"); - snapshot_display.set_size_request (75, -1); - snapshot_display.set_reorderable (true); - snapshot_display_scroller.add (snapshot_display); - snapshot_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); - group_display_vbox.pack_start (group_display_button, false, false); group_display_vbox.pack_start (group_display_scroller, true, true); @@ -122,10 +113,7 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) group_display_frame.add (group_display_vbox); rhs_pane1.add1 (track_display_frame); - rhs_pane1.add2 (rhs_pane2); - - rhs_pane2.add1 (group_display_frame); - rhs_pane2.add2 (snapshot_display_scroller); + rhs_pane1.add2 (group_display_frame); list_vpacker.pack_start (rhs_pane1, true, true); @@ -137,18 +125,14 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) rhs_pane1.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler), static_cast<Gtk::Paned*> (&rhs_pane1))); - rhs_pane2.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler), - static_cast<Gtk::Paned*> (&rhs_pane2))); list_hpane.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler), static_cast<Gtk::Paned*> (&list_hpane))); rhs_pane1.set_data ("collapse-direction", (gpointer) 0); - rhs_pane2.set_data ("collapse-direction", (gpointer) 0); list_hpane.set_data ("collapse-direction", (gpointer) 1); rhs_pane1.signal_button_release_event().connect (bind (ptr_fun (pane_handler), static_cast<Paned*>(&rhs_pane1))); - rhs_pane2.signal_button_release_event().connect (bind (ptr_fun (pane_handler), static_cast<Paned*>(&rhs_pane2))); list_hpane.signal_button_release_event().connect (bind (ptr_fun (pane_handler), static_cast<Paned*>(&list_hpane))); global_vpacker.pack_start (list_hpane, true, true); @@ -169,9 +153,6 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) group_display.signal_button_press_event().connect (mem_fun (*this, &Mixer_UI::group_display_button_press)); group_display.get_selection()->signal_changed().connect (mem_fun (*this, &Mixer_UI::group_display_selection_changed)); - snapshot_display.get_selection()->signal_changed().connect (mem_fun(*this, &Mixer_UI::snapshot_display_selection_changed)); - snapshot_display.signal_button_press_event().connect (mem_fun (*this, &Mixer_UI::snapshot_display_button_press)); - _plugin_selector = new PluginSelector (PluginManager::the_manager()); signal_configure_event().connect (mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::configure_handler)); @@ -275,7 +256,7 @@ Mixer_UI::follow_strip_selection () } } -gint +bool Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) { if (ev->button == 1) { @@ -296,7 +277,7 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) } } - return TRUE; + return true; } void @@ -320,9 +301,6 @@ Mixer_UI::connect_to_session (Session* sess) session->foreach_mix_group(this, &Mixer_UI::add_mix_group); - session->StateSaved.connect (mem_fun(*this, &Mixer_UI::session_state_saved)); - redisplay_snapshots (); - _plugin_selector->set_session (session); start_updating (); @@ -493,26 +471,6 @@ Mixer_UI::show_strip (MixerStrip* ms) } void - Mixer_UI::snapshot_display_selection_changed () - { - TreeModel::iterator i = snapshot_display.get_selection()->get_selected(); - - Glib::ustring snap_name = (*i)[snapshot_display_columns.real_name]; - - if (session->snap_name() == snap_name) { - return; - } - - ARDOUR_UI::instance()->load_session(session->path(), string (snap_name)); - } - - bool - Mixer_UI::snapshot_display_button_press (GdkEventButton* ev) - { - return false; - } - - void Mixer_UI::track_display_selection_changed () { MixerStrip* strip; @@ -783,48 +741,17 @@ Mixer_UI::add_mix_group (RouteGroup* group) group->FlagsChanged.connect (bind (mem_fun(*this, &Mixer_UI::group_flags_changed), group)); } -void -Mixer_UI::redisplay_snapshots () -{ - if (session == 0) { - return; - } - - vector<string*>* states; - if ((states = session->possible_states()) == 0) { - return; - } - - snapshot_display_model->clear (); - - for (vector<string*>::iterator i = states->begin(); i != states->end(); ++i) { - string statename = *(*i); - const TreeModel::Row & row = *snapshot_display_model->append(); - row[snapshot_display_columns.visible_name] = statename; - row[snapshot_display_columns.real_name] = statename; - } - - delete states; -} - -void -Mixer_UI::session_state_saved (string snap_name) -{ - ENSURE_GUI_THREAD (bind (mem_fun(*this, &Mixer_UI::session_state_saved), snap_name)); - redisplay_snapshots (); -} - -gint +bool Mixer_UI::strip_scroller_button_release (GdkEventButton* ev) { using namespace Menu_Helpers; if (Keyboard::is_context_menu_event (ev)) { ARDOUR_UI::instance()->add_route(); - return TRUE; + return true; } - return FALSE; + return false; } void @@ -909,8 +836,6 @@ Mixer_UI::get_state (void) snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&rhs_pane1)->gobj())); geometry->add_property(X_("mixer_rhs_pane1_pos"), string(buf)); - snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&rhs_pane2)->gobj())); - geometry->add_property(X_("mixer_rhs_pane2_pos"), string(buf)); snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&list_hpane)->gobj())); geometry->add_property(X_("mixer_list_hpane_pos"), string(buf)); @@ -959,23 +884,6 @@ Mixer_UI::pane_allocation_handler (Allocation& alloc, Gtk::Paned* which) rhs_pane1.set_position (pos); } - } else if (which == static_cast<Gtk::Paned*> (&rhs_pane2)) { - - if (done[1]) { - return; - } - - if (!geometry || (prop = geometry->property("mixer_rhs_pane2_pos")) == 0) { - pos = height / 3; - snprintf (buf, sizeof(buf), "%d", pos); - } else { - pos = atoi (prop->value()); - } - - if ((done[1] = GTK_WIDGET(rhs_pane2.gobj())->allocation.height > pos)) { - rhs_pane2.set_position (pos); - } - } else if (which == static_cast<Gtk::Paned*> (&list_hpane)) { if (done[2]) { diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 71443a6896..bc77108bea 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -92,12 +92,10 @@ class Mixer_UI : public Gtk::Window Gtk::Button group_display_button; Gtk::ScrolledWindow track_display_scroller; Gtk::ScrolledWindow group_display_scroller; - Gtk::ScrolledWindow snapshot_display_scroller; Gtk::VBox group_display_vbox; Gtk::Frame track_display_frame; Gtk::Frame group_display_frame; Gtk::VPaned rhs_pane1; - Gtk::VPaned rhs_pane2; Gtk::HBox strip_packer; Gtk::HBox out_packer; Gtk::HPaned list_hpane; @@ -106,7 +104,7 @@ class Mixer_UI : public Gtk::Window list<MixerStrip *> strips; - gint strip_scroller_button_release (GdkEventButton*); + bool strip_scroller_button_release (GdkEventButton*); void add_strip (ARDOUR::Route*); void remove_strip (MixerStrip *); @@ -190,39 +188,22 @@ class Mixer_UI : public Gtk::Window Gtk::TreeModelColumn<ARDOUR::RouteGroup*> group; }; - struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord { - SnapshotDisplayModelColumns() { - add (visible_name); - add (real_name); - } - Gtk::TreeModelColumn<Glib::ustring> visible_name; - Gtk::TreeModelColumn<Glib::ustring> real_name; - }; - TrackDisplayModelColumns track_display_columns; GroupDisplayModelColumns group_display_columns; - SnapshotDisplayModelColumns snapshot_display_columns; Gtk::TreeView track_display; Gtk::TreeView group_display; - Gtk::TreeView snapshot_display; Glib::RefPtr<Gtk::ListStore> track_display_model; Glib::RefPtr<Gtk::ListStore> group_display_model; - Glib::RefPtr<Gtk::ListStore> snapshot_display_model; bool track_display_button_press (GdkEventButton*); bool group_display_button_press (GdkEventButton*); - bool snapshot_display_button_press (GdkEventButton*); void track_display_selection_changed (); void group_display_selection_changed (); - void snapshot_display_selection_changed (); - - void redisplay_snapshots(); - void session_state_saved (string); - gint strip_button_release_event (GdkEventButton*, MixerStrip*); + bool strip_button_release_event (GdkEventButton*, MixerStrip*); RouteRedirectSelection _selection; diff --git a/libs/ardour/ardour/state_manager.h b/libs/ardour/ardour/state_manager.h index 9dc2ea66ad..faedc120ee 100644 --- a/libs/ardour/ardour/state_manager.h +++ b/libs/ardour/ardour/state_manager.h @@ -13,7 +13,7 @@ namespace ARDOUR { typedef uint32_t state_id_t; - class StateManager : virtual public sigc::trackable +class StateManager : public sigc::trackable { public: struct State { diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index a32cb0a714..e3c9549663 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -398,8 +398,6 @@ void AudioEngine::set_session (Session *s) { if (!session) { - s->set_block_size (jack_get_buffer_size (_jack)); - s->set_frame_rate (jack_get_sample_rate (_jack)); session = s; } } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 021c2935d2..ab218e4804 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -375,6 +375,7 @@ Session::~Session () delete _click_io; } + if (auditioner) { delete auditioner; } @@ -562,6 +563,9 @@ Session::when_engine_running () first_time_running.disconnect (); + set_block_size (_engine.frames_per_cycle()); + set_frame_rate (_engine.frame_rate()); + /* every time we reconnect, recompute worst case output latencies */ _engine.Running.connect (sigc::bind (mem_fun (*this, &Session::set_worst_io_latencies), true)); @@ -1309,46 +1313,32 @@ Session::set_frame_rate (jack_nframes_t frames_per_second) void Session::set_block_size (jack_nframes_t nframes) { - /** \fn void Session::set_block_size(jack_nframes_t) - the AudioEngine object that calls this guarantees - that it will not be called while we are also in - ::process(). Its also fine to do things that block - here. + /* the AudioEngine guarantees + that it will not be called while we are also in + ::process(). It is therefore fine to do things that block + here. */ { LockMonitor lm (route_lock, __LINE__, __FILE__); - + vector<Sample*>::iterator i; + uint32_t np; + current_block_size = nframes; - - for (vector<Sample*>::iterator i = _passthru_buffers.begin(); i != _passthru_buffers.end(); ++i) { - free(*i); - - Sample *buf; -#ifdef NO_POSIX_MEMALIGN - buf = (Sample *) malloc(current_block_size * sizeof(Sample)); -#else - posix_memalign((void **)&buf,16,current_block_size * 4); -#endif - *i = buf; - - memset (*i, 0, sizeof (Sample) * current_block_size); + + for (np = 0, i = _passthru_buffers.begin(); i != _passthru_buffers.end(); ++i, ++np) { + free (*i); } for (vector<Sample*>::iterator i = _silent_buffers.begin(); i != _silent_buffers.end(); ++i) { - free(*i); - - Sample *buf; -#ifdef NO_POSIX_MEMALIGN - buf = (Sample *) malloc(current_block_size * sizeof(Sample)); -#else - posix_memalign((void **)&buf,16,current_block_size * 4); -#endif - *i = buf; - - memset (*i, 0, sizeof (Sample) * current_block_size); + free (*i); } + _passthru_buffers.clear (); + _silent_buffers.clear (); + + ensure_passthru_buffers (np); + if (_gain_automation_buffer) { delete [] _gain_automation_buffer; } |