From 2bf3ed423f7aecdaabf5fbb078d9e2f20d26880c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 16 Nov 2006 18:42:48 +0000 Subject: track naming patch from brian; slightly modified F11-bug workaround from brian; undo/redo items in edit menu now show operation to be undone/redone; canvas allocations now handled by an idle handler; region views respond to changes in fade/in/out curves ; undo/redo possible for some fade in/out operations; automation tracks extend to max_frames git-svn-id: svn://localhost/ardour2/trunk@1134 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/actions.cc | 30 -------- gtk2_ardour/audio_region_view.cc | 36 ++++++++++ gtk2_ardour/audio_region_view.h | 6 +- gtk2_ardour/automation_line.cc | 2 +- gtk2_ardour/automation_line.h | 2 +- gtk2_ardour/automation_time_axis.cc | 13 +--- gtk2_ardour/editor.cc | 128 +++++++++++----------------------- gtk2_ardour/editor.h | 17 +++-- gtk2_ardour/editor_actions.cc | 4 +- gtk2_ardour/editor_canvas.cc | 41 +++++++---- gtk2_ardour/editor_mouse.cc | 14 ++-- gtk2_ardour/marker_time_axis_view.cc | 2 +- gtk2_ardour/public_editor.h | 2 +- gtk2_ardour/time_axis_view.cc | 38 +++++++++- libs/ardour/ardour/audioregion.h | 5 +- libs/ardour/ardour/automation_event.h | 2 +- libs/ardour/ardour/session.h | 17 +++-- libs/ardour/audioregion.cc | 36 +++++++--- libs/ardour/automation_event.cc | 14 ++-- libs/ardour/panner.cc | 2 +- libs/ardour/session.cc | 2 +- libs/ardour/session_state.cc | 23 +++--- libs/pbd/pbd/undo.h | 4 +- libs/pbd/undo.cc | 15 ++++ 24 files changed, 252 insertions(+), 203 deletions(-) diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index 88d0187592..2fe305cf84 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -85,16 +85,6 @@ ActionManager::init () } } -RefPtr -ActionManager::register_action (RefPtr group, const char * name, const char * label, slot sl, guint key, Gdk::ModifierType mods) -{ - RefPtr act = register_action (group, name, label, sl); - cerr << "Reset A accel for " << name << endl; - AccelMap::add_entry (act->get_accel_path(), key, mods); - - return act; -} - RefPtr ActionManager::register_action (RefPtr group, const char * name, const char * label, slot sl) { @@ -118,16 +108,6 @@ ActionManager::register_action (RefPtr group, const char * name, co } -RefPtr -ActionManager::register_radio_action (RefPtr group, RadioAction::Group& rgroup, const char * name, const char * label, slot sl, guint key, Gdk::ModifierType mods) -{ - RefPtr act = register_radio_action (group, rgroup, name, label, sl); - cerr << "Reset B accel for " << name << endl; - AccelMap::add_entry (act->get_accel_path(), key, mods); - - return act; -} - RefPtr ActionManager::register_radio_action (RefPtr group, RadioAction::Group& rgroup, const char * name, const char * label, slot sl) { @@ -139,16 +119,6 @@ ActionManager::register_radio_action (RefPtr group, RadioAction::Gr return act; } -RefPtr -ActionManager::register_toggle_action (RefPtr group, const char * name, const char * label, slot sl, guint key, Gdk::ModifierType mods) -{ - RefPtr act = register_toggle_action (group,name, label, sl); - cerr << "Reset C accel for " << name << endl; - AccelMap::add_entry (act->get_accel_path(), key, mods); - - return act; -} - RefPtr ActionManager::register_toggle_action (RefPtr group, const char * name, const char * label, slot sl) { diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index a7c2afacb2..dd2f972970 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -250,16 +250,52 @@ AudioRegionView::fade_out_changed () reset_fade_out_shape (); } +void +AudioRegionView::set_fade_in_shape (AudioRegion::FadeShape shape) +{ + AutomationList& alist = audio_region()->fade_in(); + XMLNode& before (alist.get_state()); + trackview.session().begin_reversible_command ("fade in shape"); + audio_region()->set_fade_in_shape (shape); + XMLNode& after (alist.get_state()); + trackview.session().add_command (new MementoCommand(alist, &before, &after)); + trackview.session().commit_reversible_command (); +} + +void +AudioRegionView::set_fade_out_shape (AudioRegion::FadeShape shape) +{ + AutomationList& alist = audio_region()->fade_out(); + XMLNode& before (alist.get_state()); + trackview.session().begin_reversible_command ("fade out shape"); + audio_region()->set_fade_out_shape (shape); + XMLNode& after (alist.get_state()); + trackview.session().add_command (new MementoCommand(alist, &before, &after)); + trackview.session().commit_reversible_command (); +} + void AudioRegionView::set_fade_in_active (bool yn) { + AutomationList& alist = audio_region()->fade_in(); + XMLNode& before (alist.get_state()); + trackview.session().begin_reversible_command ("fade in shape"); audio_region()->set_fade_in_active (yn); + XMLNode& after (alist.get_state()); + trackview.session().add_command (new MementoCommand(alist, &before, &after)); + trackview.session().commit_reversible_command (); } void AudioRegionView::set_fade_out_active (bool yn) { + AutomationList& alist = audio_region()->fade_out(); + XMLNode& before (alist.get_state()); + trackview.session().begin_reversible_command ("fade out shape"); audio_region()->set_fade_out_active (yn); + XMLNode& after (alist.get_state()); + trackview.session().add_command (new MementoCommand(alist, &before, &after)); + trackview.session().commit_reversible_command (); } void diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index 798999062d..0ced1aca55 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "region_view.h" #include "route_time_axis.h" @@ -93,7 +93,9 @@ class AudioRegionView : public RegionView void reset_fade_out_shape_width (nframes_t); void set_fade_in_active (bool); void set_fade_out_active (bool); - + void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape); + void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape); + virtual void entered (); virtual void exited (); diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index b7846dd79a..44c100fd37 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -1179,7 +1179,7 @@ AutomationLine::hide_selection () } void -AutomationLine::list_changed (Change ignored) +AutomationLine::list_changed () { queue_reset (); } diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index 8269a8714f..b73a1c548a 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -202,7 +202,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin virtual void change_model_range (ARDOUR::AutomationList::iterator,ARDOUR::AutomationList::iterator, double delta, float ydelta); void reset_callback (const ARDOUR::AutomationList&); - void list_changed (ARDOUR::Change); + void list_changed (); virtual bool event_handler (GdkEvent*); diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 9375a90544..2efb621b37 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -43,24 +43,15 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptrproperty_x1() = 0.0; base_rect->property_y1() = 0.0; - base_rect->property_x2() = 1000000.0; + base_rect->property_x2() = max_frames; base_rect->property_outline_color_rgba() = color_map[cAutomationTrackOutline]; /* outline ends and bottom */ base_rect->property_outline_what() = (guint32) (0x1|0x2|0x8); base_rect->property_fill_color_rgba() = color_map[cAutomationTrackFill]; + //base_rect->property_fill_color_rgba() = color_map[cEnteredControlPoint]; base_rect->set_data ("trackview", this); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 34756ec1ed..ccc3e6f4ee 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -307,6 +307,7 @@ Editor::Editor (AudioEngine& eng) edit_cursor = 0; playhead_cursor = 0; button_release_can_deselect = true; + canvas_idle_queued = false; location_marker_color = color_map[cLocationMarker]; location_range_color = color_map[cLocationRange]; @@ -1120,6 +1121,7 @@ Editor::connect_to_session (Session *t) update_title (); session->GoingAway.connect (mem_fun(*this, &Editor::session_going_away)); + session->history().Changed.connect (mem_fun (*this, &Editor::history_changed)); /* These signals can all be emitted by a non-GUI thread. Therefore the handlers for them must not attempt to directly interact with the GUI, @@ -1312,7 +1314,6 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i } MenuList& items (fade_context_menu.items()); - AudioRegion& ar (*arv->audio_region().get()); // FIXME items.clear (); @@ -1327,11 +1328,11 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i items.push_back (SeparatorElem()); - items.push_back (MenuElem (_("Linear"), bind (mem_fun (ar, &AudioRegion::set_fade_in_shape), AudioRegion::Linear))); - items.push_back (MenuElem (_("Slowest"), bind (mem_fun (ar, &AudioRegion::set_fade_in_shape), AudioRegion::LogB))); - items.push_back (MenuElem (_("Slow"), bind (mem_fun (ar, &AudioRegion::set_fade_in_shape), AudioRegion::Fast))); - items.push_back (MenuElem (_("Fast"), bind (mem_fun (ar, &AudioRegion::set_fade_in_shape), AudioRegion::LogA))); - items.push_back (MenuElem (_("Fastest"), bind (mem_fun (ar, &AudioRegion::set_fade_in_shape), AudioRegion::Slow))); + items.push_back (MenuElem (_("Linear"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::Linear))); + items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::LogB))); + items.push_back (MenuElem (_("Slow"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::Fast))); + items.push_back (MenuElem (_("Fast"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::LogA))); + items.push_back (MenuElem (_("Fastest"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::Slow))); break; case FadeOutItem: @@ -1344,13 +1345,14 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i items.push_back (SeparatorElem()); - items.push_back (MenuElem (_("Linear"), bind (mem_fun (ar, &AudioRegion::set_fade_out_shape), AudioRegion::Linear))); - items.push_back (MenuElem (_("Slowest"), bind (mem_fun (ar, &AudioRegion::set_fade_out_shape), AudioRegion::Fast))); - items.push_back (MenuElem (_("Slow"), bind (mem_fun (ar, &AudioRegion::set_fade_out_shape), AudioRegion::LogB))); - items.push_back (MenuElem (_("Fast"), bind (mem_fun (ar, &AudioRegion::set_fade_out_shape), AudioRegion::LogA))); - items.push_back (MenuElem (_("Fastest"), bind (mem_fun (ar, &AudioRegion::set_fade_out_shape), AudioRegion::Slow))); + items.push_back (MenuElem (_("Linear"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::Linear))); + items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::Fast))); + items.push_back (MenuElem (_("Slow"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::LogB))); + items.push_back (MenuElem (_("Fast"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::LogA))); + items.push_back (MenuElem (_("Fastest"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::Slow))); break; + default: fatal << _("programming error: ") << X_("non-fade canvas item passed to popup_fade_context_menu()") @@ -3291,89 +3293,27 @@ Editor::set_edit_group_mute (Route& route, bool yn) } void -Editor::set_edit_menu (Menu& menu) -{ - edit_menu = &menu; - edit_menu->signal_map_event().connect (mem_fun(*this, &Editor::edit_menu_map_handler)); -} - -bool -Editor::edit_menu_map_handler (GdkEventAny* ev) +Editor::history_changed () { - using namespace Menu_Helpers; - MenuList& edit_items = edit_menu->items(); string label; - /* Nuke all the old items */ - - edit_items.clear (); - - if (session == 0) { - return false; - } - - if (session->undo_depth() == 0) { - label = _("Undo"); - } else { - label = string_compose(_("Undo (%1)"), session->next_undo()); - } - - edit_items.push_back (MenuElem (label, bind (mem_fun(*this, &Editor::undo), 1U))); - - if (session->undo_depth() == 0) { - edit_items.back().set_sensitive (false); - } - - if (session->redo_depth() == 0) { - label = _("Redo"); - } else { - label = string_compose(_("Redo (%1)"), session->next_redo()); - } - - edit_items.push_back (MenuElem (label, bind (mem_fun(*this, &Editor::redo), 1U))); - if (session->redo_depth() == 0) { - edit_items.back().set_sensitive (false); - } - - vector mitems; - - edit_items.push_back (SeparatorElem()); - edit_items.push_back (MenuElem (_("Cut"), mem_fun(*this, &Editor::cut))); - mitems.push_back (&edit_items.back()); - edit_items.push_back (MenuElem (_("Copy"), mem_fun(*this, &Editor::copy))); - mitems.push_back (&edit_items.back()); - edit_items.push_back (MenuElem (_("Paste"), bind (mem_fun(*this, &Editor::paste), 1.0f))); - mitems.push_back (&edit_items.back()); - edit_items.push_back (SeparatorElem()); - edit_items.push_back (MenuElem (_("Align"), bind (mem_fun(*this, &Editor::align), ARDOUR::SyncPoint))); - mitems.push_back (&edit_items.back()); - edit_items.push_back (MenuElem (_("Align Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint))); - mitems.push_back (&edit_items.back()); - edit_items.push_back (SeparatorElem()); - - if (selection->empty()) { - for (vector::iterator i = mitems.begin(); i != mitems.end(); ++i) { - (*i)->set_sensitive (false); + if (undo_action && session) { + if (session->undo_depth() == 0) { + label = _("Undo"); + } else { + label = string_compose(_("Undo (%1)"), session->next_undo()); } + undo_action->property_label() = label; } - Menu* import_menu = manage (new Menu()); - import_menu->set_name ("ArdourContextMenu"); - MenuList& import_items = import_menu->items(); - - import_items.push_back (MenuElem (_("... as new track"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsTrack))); - import_items.push_back (MenuElem (_("... as new region"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion))); - - edit_items.push_back (MenuElem (_("Import audio (copy)"), *import_menu)); - edit_items.push_back (SeparatorElem()); - - edit_items.push_back (MenuElem (_("Remove last capture"), mem_fun(*this, &Editor::remove_last_capture))); - - if (!session->have_captured()) { - edit_items.back().set_sensitive (false); + if (redo_action && session) { + if (session->redo_depth() == 0) { + label = _("Redo"); + } else { + label = string_compose(_("Redo (%1)"), session->next_redo()); + } + redo_action->property_label() = label; } - - return false; } void @@ -4047,24 +3987,34 @@ Editor::session_state_saved (string snap_name) void Editor::maximise_editing_space () { + initial_ruler_update_required = true; + mouse_mode_tearoff->set_visible (false); tools_tearoff->set_visible (false); pre_maximal_pane_position = edit_pane.get_position(); + pre_maximal_editor_width = this->get_width(); + edit_pane.set_position (edit_pane.get_width()); + fullscreen(); } void Editor::restore_editing_space () { + initial_ruler_update_required = true; + + unfullscreen(); + mouse_mode_tearoff->set_visible (true); tools_tearoff->set_visible (true); - edit_pane.set_position (pre_maximal_pane_position); - unfullscreen(); + edit_pane.set_position ( + pre_maximal_pane_position + abs(this->get_width() - pre_maximal_editor_width) + ); } void diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 5c792d89c7..740fce2588 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -174,8 +174,6 @@ class Editor : public PublicEditor /* undo related */ - void set_edit_menu (Gtk::Menu&); - nframes_t unit_to_frame (double unit) { return (nframes_t) rint (unit * frames_per_unit); } @@ -354,6 +352,7 @@ class Editor : public PublicEditor Editing::MouseMode mouse_mode; int pre_maximal_pane_position; + int pre_maximal_editor_width; void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*); Gtk::Notebook the_notebook; @@ -1125,7 +1124,10 @@ class Editor : public PublicEditor bool track_canvas_event (GdkEvent* event, ArdourCanvas::Item*); bool track_canvas_scroll (GdkEventScroll* event); + Gtk::Allocation canvas_allocation; + bool canvas_idle_queued; void track_canvas_allocate (Gtk::Allocation alloc); + bool track_canvas_idle (); void set_edit_cursor (GdkEvent* event); void set_playhead_cursor (GdkEvent* event); @@ -1621,11 +1623,6 @@ class Editor : public PublicEditor void duplicate_dialog (bool for_region); - /* edit menu */ - - Gtk::Menu* edit_menu; - bool edit_menu_map_handler (GdkEventAny*); - nframes_t event_frame (GdkEvent*, double* px = 0, double* py = 0); void time_fx_motion (ArdourCanvas::Item*, GdkEvent*); @@ -1783,6 +1780,12 @@ class Editor : public PublicEditor bool on_key_press_event (GdkEventKey*); void session_state_saved (string); + + Glib::RefPtr undo_action; + Glib::RefPtr redo_action; + + void history_changed (); + }; #endif /* __ardour_editor_h__ */ diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 3f0af44865..a55aee6232 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -201,9 +201,9 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, "set-region-sync-position", _("Set Region Sync Position"), mem_fun(*this, &Editor::kbd_set_sync_position)); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (editor_actions, "undo", _("Undo"), bind (mem_fun(*this, &Editor::undo), 1U)); + undo_action = act = ActionManager::register_action (editor_actions, "undo", _("Undo"), bind (mem_fun(*this, &Editor::undo), 1U)); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (editor_actions, "redo", _("Redo"), bind (mem_fun(*this, &Editor::redo), 1U)); + redo_action = act = ActionManager::register_action (editor_actions, "redo", _("Redo"), bind (mem_fun(*this, &Editor::redo), 1U)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "export-session", _("Export Session"), mem_fun(*this, &Editor::export_session)); diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 6f57a51010..8f6203c40d 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -275,9 +275,32 @@ Editor::initialize_canvas () void Editor::track_canvas_allocate (Gtk::Allocation alloc) { + canvas_allocation = alloc; - canvas_width = alloc.get_width(); - canvas_height = alloc.get_height(); + if (!initial_ruler_update_required) { + if (!canvas_idle_queued) { + /* call this first so that we do stuff before any pending redraw */ + Glib::signal_idle().connect (mem_fun (*this, &Editor::track_canvas_idle), false); + canvas_idle_queued = true; + } + return; + } + + initial_ruler_update_required = false; + + track_canvas_idle (); +} + +bool +Editor::track_canvas_idle () +{ + + if (canvas_idle_queued) { + canvas_idle_queued = false; + } + + canvas_width = canvas_allocation.get_width(); + canvas_height = canvas_allocation.get_height(); zoom_range_clock.set ((nframes_t) floor ((canvas_width * frames_per_unit))); edit_cursor->set_position (edit_cursor->current_frame); @@ -319,18 +342,12 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc) transport_punchout_line->property_y2() = canvas_height; } - if (is_visible() && initial_ruler_update_required) { - /* - this is really dumb, but signal_size_allocate() gets emitted intermittently - depending on whether the canvas contents are visible or not. - we only want to do this once - */ - update_fixed_rulers(); - tempo_map_changed (Change (0)); - initial_ruler_update_required = false; - } + update_fixed_rulers(); + tempo_map_changed (Change (0)); Resized (); /* EMIT_SIGNAL */ + + return false; } void diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index da35763a14..7cf67922b8 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1818,12 +1818,13 @@ Editor::fade_in_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* even } begin_reversible_command (_("change fade in length")); - XMLNode &before = arv->audio_region()->get_state(); + AutomationList& alist = arv->audio_region()->fade_in(); + XMLNode &before = alist.get_state(); arv->audio_region()->set_fade_in_length (fade_length); - XMLNode &after = arv->audio_region()->get_state(); - session->add_command(new MementoCommand(*arv->audio_region().get(), &before, &after)); + XMLNode &after = alist.get_state(); + session->add_command(new MementoCommand(alist, &before, &after)); commit_reversible_command (); fade_in_drag_motion_callback (item, event); } @@ -1913,12 +1914,13 @@ Editor::fade_out_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* eve } begin_reversible_command (_("change fade out length")); - XMLNode &before = arv->region()->get_state(); + AutomationList& alist = arv->audio_region()->fade_out(); + XMLNode &before = alist.get_state(); arv->audio_region()->set_fade_out_length (fade_length); - XMLNode &after = arv->region()->get_state(); - session->add_command(new MementoCommand(*arv->region().get(), &before, &after)); + XMLNode &after = alist.get_state(); + session->add_command(new MementoCommand(alist, &before, &after)); commit_reversible_command (); fade_out_drag_motion_callback (item, event); diff --git a/gtk2_ardour/marker_time_axis_view.cc b/gtk2_ardour/marker_time_axis_view.cc index 55d5742e8e..b6e87f8715 100644 --- a/gtk2_ardour/marker_time_axis_view.cc +++ b/gtk2_ardour/marker_time_axis_view.cc @@ -57,7 +57,7 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv) canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group); canvas_rect->property_x1() = 0.0; canvas_rect->property_y1() = 0.0; - canvas_rect->property_x2() = 1000000.0; + canvas_rect->property_x2() = max_frames; canvas_rect->property_y2() = (double)20; canvas_rect->property_outline_color_rgba() = color_map[cMarkerTrackOutline]; canvas_rect->property_fill_color_rgba() = stream_base_color; diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index a364eaba6f..fedb8abb8b 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -86,7 +86,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway virtual void new_region_from_selection () = 0; virtual void separate_region_from_selection () = 0; virtual void toggle_playback (bool with_abort) = 0; - virtual void set_edit_menu (Gtk::Menu&) = 0; virtual nframes_t unit_to_frame (double unit) = 0; virtual double frame_to_unit (nframes_t frame) = 0; virtual double frame_to_unit (double frame) = 0; @@ -114,6 +113,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway virtual bool set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove = false) = 0; virtual void set_selected_mixer_strip (TimeAxisView&) = 0; virtual void hide_track_in_display (TimeAxisView& tv) = 0; + virtual void show_track_in_display (TimeAxisView& tv) = 0; virtual void set_follow_playhead (bool yn) = 0; virtual void toggle_follow_playhead () = 0; virtual bool follow_playhead() const = 0; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 783a41e0a1..da7d3863d7 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -234,7 +234,7 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent) if (canvas_item_visible ((*i)->canvas_display)) { ++nth; - effective_height += (*i)->show_at (y + effective_height, nth, parent); + effective_height += (*i)->show_at (y + 1 + effective_height, nth, parent); } } @@ -373,8 +373,43 @@ TimeAxisView::set_height_pixels (uint32_t h) bool TimeAxisView::name_entry_key_release (GdkEventKey* ev) { + PublicEditor::TrackViewList *allviews = 0; + PublicEditor::TrackViewList::iterator i; + switch (ev->keyval) { + case GDK_Escape: + name_entry.select_region (0,0); + controls_ebox.grab_focus (); + name_entry_changed (); + return true; + + /* Shift+Tab Keys Pressed. Note that for Shift+Tab, GDK actually + * generates a different ev->keyval, rather than setting + * ev->state. + */ + case GDK_ISO_Left_Tab: case GDK_Tab: + name_entry_changed (); + allviews = editor.get_valid_views (0); + if (allviews != 0) { + i = find (allviews->begin(), allviews->end(), this); + if (i != allviews->end()) { + do { + if(ev->keyval == GDK_Tab) { + if(++i == allviews->end()) { return true; } + } else { + if(i-- == allviews->begin()) { return true; } + } + } while((*i)->hidden()); + + if((*i)->height_style == Small) { + (*i)->set_height(Smaller); + } + + (*i)->name_entry.grab_focus(); + } + } + return true; case GDK_Up: case GDK_Down: name_entry_changed (); @@ -424,6 +459,7 @@ TimeAxisView::name_entry_focus_out (GdkEventFocus* ev) last_name_entry_key_press_event = 0; name_entry_key_timeout.disconnect (); name_entry.set_name ("EditorTrackNameDisplay"); + name_entry.select_region (0,0); /* do the real stuff */ diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 6deeff05c4..1d389cec1a 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -171,8 +171,11 @@ class AudioRegion : public Region void recompute_at_start (); void recompute_at_end (); - void envelope_changed (Change); + void envelope_changed (); + void fade_in_changed (); + void fade_out_changed (); void source_offset_changed (); + void listen_to_my_curves (); void source_deleted (); diff --git a/libs/ardour/ardour/automation_event.h b/libs/ardour/ardour/automation_event.h index 459ec2b6cf..e5c194e683 100644 --- a/libs/ardour/ardour/automation_event.h +++ b/libs/ardour/ardour/automation_event.h @@ -152,7 +152,7 @@ class AutomationList : public PBD::StatefulDestructible (obj.*method)(*this); } - sigc::signal StateChanged; + sigc::signal StateChanged; XMLNode& get_state(void); int set_state (const XMLNode &s); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index a5a2d6b59a..55376bcd77 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -742,16 +742,19 @@ class Session : public PBD::StatefulDestructible /* History (for editors, mixers, UIs etc.) */ void undo (uint32_t n) { - history.undo (n); + _history.undo (n); } + void redo (uint32_t n) { - history.redo (n); + _history.redo (n); } - uint32_t undo_depth() const { return history.undo_depth(); } - uint32_t redo_depth() const { return history.redo_depth(); } - string next_undo() const { return history.next_undo(); } - string next_redo() const { return history.next_redo(); } + UndoHistory& history() { return _history; } + + uint32_t undo_depth() const { return _history.undo_depth(); } + uint32_t redo_depth() const { return _history.redo_depth(); } + string next_undo() const { return _history.next_undo(); } + string next_redo() const { return _history.next_redo(); } void begin_reversible_command (string cmd_name); void commit_reversible_command (Command* cmd = 0); @@ -1568,7 +1571,7 @@ class Session : public PBD::StatefulDestructible void reverse_diskstream_buffers (); - UndoHistory history; + UndoHistory _history; UndoTransaction* current_trans; GlobalRouteBooleanState get_global_route_boolean (bool (Route::*method)(void) const); diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index e0f851e2f0..b0ad4472bb 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -80,7 +80,7 @@ AudioRegion::AudioRegion (boost::shared_ptr src, nframes_t start, n set_default_fades (); set_default_envelope (); - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } AudioRegion::AudioRegion (boost::shared_ptr src, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags) @@ -105,7 +105,7 @@ AudioRegion::AudioRegion (boost::shared_ptr src, nframes_t start, n set_default_fades (); set_default_envelope (); - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } AudioRegion::AudioRegion (SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags) @@ -132,7 +132,7 @@ AudioRegion::AudioRegion (SourceList& srcs, nframes_t start, nframes_t length, c set_default_fades (); set_default_envelope (); - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } @@ -196,7 +196,7 @@ AudioRegion::AudioRegion (boost::shared_ptr other, nframes_t _scale_amplitude = other->_scale_amplitude; - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } AudioRegion::AudioRegion (boost::shared_ptr other) @@ -237,7 +237,7 @@ AudioRegion::AudioRegion (boost::shared_ptr other) _fade_in_disabled = 0; _fade_out_disabled = 0; - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } AudioRegion::AudioRegion (boost::shared_ptr src, const XMLNode& node) @@ -261,7 +261,7 @@ AudioRegion::AudioRegion (boost::shared_ptr src, const XMLNode& nod throw failed_constructor(); } - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node) @@ -301,7 +301,7 @@ AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node) throw failed_constructor(); } - _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + listen_to_my_curves (); } AudioRegion::~AudioRegion () @@ -316,6 +316,14 @@ AudioRegion::~AudioRegion () GoingAway (); /* EMIT SIGNAL */ } +void +AudioRegion::listen_to_my_curves () +{ + _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); + _fade_in.StateChanged.connect (mem_fun (*this, &AudioRegion::fade_in_changed)); + _fade_out.StateChanged.connect (mem_fun (*this, &AudioRegion::fade_out_changed)); +} + bool AudioRegion::verify_length (nframes_t len) { @@ -1248,7 +1256,19 @@ AudioRegion::normalize_to (float target_dB) } void -AudioRegion::envelope_changed (Change ignored) +AudioRegion::fade_in_changed () +{ + send_change (FadeInChanged); +} + +void +AudioRegion::fade_out_changed () +{ + send_change (FadeOutChanged); +} + +void +AudioRegion::envelope_changed () { send_change (EnvelopeChanged); } diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc index cc2554a704..f5c9d3609a 100644 --- a/libs/ardour/automation_event.cc +++ b/libs/ardour/automation_event.cc @@ -192,7 +192,7 @@ AutomationList::maybe_signal_changed () if (_frozen) { changed_when_thawed = true; } else { - StateChanged (Change (0)); + StateChanged (); } } @@ -583,7 +583,7 @@ AutomationList::thaw () { _frozen = false; if (changed_when_thawed) { - StateChanged(Change(0)); /* EMIT SIGNAL */ + StateChanged(); /* EMIT SIGNAL */ } } @@ -1255,13 +1255,13 @@ AutomationList::set_state (const XMLNode& node) return deserialize_events (node); } - if (node.name() == X_("Envelope") && (nsos = node.child (X_("AutomationList")))) { - /* new school in old school clothing */ - return set_state (*nsos); - } - if (node.name() == X_("Envelope") || node.name() == X_("FadeOut") || node.name() == X_("FadeIn")) { + if ((nsos = node.child (X_("AutomationList")))) { + /* new school in old school clothing */ + return set_state (*nsos); + } + /* old school */ const XMLNodeList& elist = node.children(); diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index 00b31f314d..faf2f14fb3 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -259,7 +259,7 @@ BaseStereoPanner::load (istream& in, string path, uint32_t& linecnt) /* now that we are done loading */ - _automation.StateChanged (Change (0)); + _automation.StateChanged (); return 0; } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 34615c4966..7e3b061656 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -405,7 +405,7 @@ Session::~Session () /* clear history so that no references to objects are held any more */ - history.clear (); + _history.clear (); /* clear state tree so that no references to objects are held any more */ diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index f80c9e9a82..94d9fe6b50 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -2097,7 +2097,7 @@ Session::commit_reversible_command (Command *cmd) gettimeofday (&now, 0); current_trans->set_timestamp (now); - history.add (current_trans); + _history.add (current_trans); } Session::GlobalRouteBooleanState @@ -2647,7 +2647,7 @@ Session::cleanup_sources (Session::cleanup_report& rep) /* dump the history list */ - history.clear (); + _history.clear (); /* save state so we don't end up a session file referring to non-existent sources. @@ -2798,7 +2798,7 @@ Session::save_history (string snapshot_name) string xml_path; string bak_path; - tree.set_root (&history.get_state()); + tree.set_root (&_history.get_state()); if (snapshot_name.empty()) { snapshot_name = _current_snapshot_name; @@ -2825,14 +2825,13 @@ Session::save_history (string snapshot_name) * possible to fix. */ - if (unlink (xml_path.c_str())) - { - error << string_compose (_("could not remove corrupt history file %1"), xml_path) << endmsg; + if (unlink (xml_path.c_str())) { + error << string_compose (_("could not remove corrupt history file %1"), xml_path) << endmsg; } else { - if (rename (bak_path.c_str(), xml_path.c_str())) - { - error << string_compose (_("could not restore history file from backup %1"), bak_path) << endmsg; - } + if (rename (bak_path.c_str(), xml_path.c_str())) + { + error << string_compose (_("could not restore history file from backup %1"), bak_path) << endmsg; + } } return -1; @@ -2862,7 +2861,7 @@ Session::restore_history (string snapshot_name) } /* replace history */ - history.clear(); + _history.clear(); for (XMLNodeConstIterator it = tree.root()->children().begin(); it != tree.root()->children().end(); it++) { @@ -2895,7 +2894,7 @@ Session::restore_history (string snapshot_name) } } - history.add (ut); + _history.add (ut); } return 0; diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h index 277c41c2af..eb46750e4f 100644 --- a/libs/pbd/pbd/undo.h +++ b/libs/pbd/pbd/undo.h @@ -74,7 +74,7 @@ class UndoTransaction : public Command friend void command_death (UndoTransaction*, Command *); }; -class UndoHistory +class UndoHistory : public sigc::trackable { public: UndoHistory(); @@ -97,6 +97,8 @@ class UndoHistory XMLNode &get_state(); void save_state(); + sigc::signal Changed; + private: bool _clearing; std::list UndoList; diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc index 442a5439f2..277b83bfce 100644 --- a/libs/pbd/undo.cc +++ b/libs/pbd/undo.cc @@ -157,6 +157,8 @@ UndoHistory::add (UndoTransaction* const ut) UndoList.push_back (ut); /* we are now owners of the transaction */ + + Changed (); /* EMIT SIGNAL */ } void @@ -168,6 +170,8 @@ UndoHistory::remove (UndoTransaction* const ut) UndoList.remove (ut); RedoList.remove (ut); + + Changed (); /* EMIT SIGNAL */ } void @@ -182,6 +186,8 @@ UndoHistory::undo (unsigned int n) ut->undo (); RedoList.push_back (ut); } + + Changed (); /* EMIT SIGNAL */ } void @@ -196,6 +202,8 @@ UndoHistory::redo (unsigned int n) ut->redo (); UndoList.push_back (ut); } + + Changed (); /* EMIT SIGNAL */ } void @@ -204,6 +212,9 @@ UndoHistory::clear_redo () _clearing = true; RedoList.clear (); _clearing = false; + + Changed (); /* EMIT SIGNAL */ + } void @@ -212,6 +223,8 @@ UndoHistory::clear_undo () _clearing = true; UndoList.clear (); _clearing = false; + + Changed (); /* EMIT SIGNAL */ } void @@ -219,6 +232,8 @@ UndoHistory::clear () { clear_undo (); clear_redo (); + + Changed (); /* EMIT SIGNAL */ } XMLNode & UndoHistory::get_state() -- cgit v1.2.3