diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-11-16 18:42:48 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-11-16 18:42:48 +0000 |
commit | 2bf3ed423f7aecdaabf5fbb078d9e2f20d26880c (patch) | |
tree | 722c7b81b46f966c6cba9caacc12bbf21663ca7f /gtk2_ardour | |
parent | 7bbf76132164d3bd293c3bfdf2038dd47f1cc63b (diff) |
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
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/actions.cc | 30 | ||||
-rw-r--r-- | gtk2_ardour/audio_region_view.cc | 36 | ||||
-rw-r--r-- | gtk2_ardour/audio_region_view.h | 6 | ||||
-rw-r--r-- | gtk2_ardour/automation_line.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/automation_line.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/automation_time_axis.cc | 13 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 128 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 17 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 41 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 14 | ||||
-rw-r--r-- | gtk2_ardour/marker_time_axis_view.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.cc | 38 |
14 files changed, 171 insertions, 164 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 @@ -86,16 +86,6 @@ ActionManager::init () } RefPtr<Action> -ActionManager::register_action (RefPtr<ActionGroup> group, const char * name, const char * label, slot<void> sl, guint key, Gdk::ModifierType mods) -{ - RefPtr<Action> 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<Action> ActionManager::register_action (RefPtr<ActionGroup> group, const char * name, const char * label, slot<void> sl) { RefPtr<Action> act; @@ -119,16 +109,6 @@ ActionManager::register_action (RefPtr<ActionGroup> group, const char * name, co RefPtr<Action> -ActionManager::register_radio_action (RefPtr<ActionGroup> group, RadioAction::Group& rgroup, const char * name, const char * label, slot<void> sl, guint key, Gdk::ModifierType mods) -{ - RefPtr<Action> 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<Action> ActionManager::register_radio_action (RefPtr<ActionGroup> group, RadioAction::Group& rgroup, const char * name, const char * label, slot<void> sl) { RefPtr<Action> act; @@ -140,16 +120,6 @@ ActionManager::register_radio_action (RefPtr<ActionGroup> group, RadioAction::Gr } RefPtr<Action> -ActionManager::register_toggle_action (RefPtr<ActionGroup> group, const char * name, const char * label, slot<void> sl, guint key, Gdk::ModifierType mods) -{ - RefPtr<Action> 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<Action> ActionManager::register_toggle_action (RefPtr<ActionGroup> group, const char * name, const char * label, slot<void> sl) { RefPtr<Action> act; 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 @@ -251,15 +251,51 @@ AudioRegionView::fade_out_changed () } 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<AutomationList>(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<AutomationList>(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<AutomationList>(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<AutomationList>(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 <libgnomecanvasmm.h> #include <libgnomecanvasmm/polygon.h> #include <sigc++/signal.h> -#include <ardour/region.h> +#include <ardour/audioregion.h> #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_ptr<Ro ignore_state_request = false; first_call_to_set_height = true; - // base_rect = gnome_canvas_item_new (GNOME_CANVAS_GROUP(canvas_display), - // gnome_canvas_simplerect_get_type(), - // "x1", 0.0, - // "y1", 0.0, - // "x2", 1000000.0, - // "outline_color_rgba", color_map[cAutomationTrackOutline], - // /* outline ends and bottom */ - // "outline_what", (guint32) (0x1|0x2|0x8), - // "fill_color_rgba", color_map[cAutomationTrackFill], - // NULL); base_rect = new SimpleRect(*canvas_display); base_rect->property_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<MenuItem*> 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<MenuItem*>::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<Gtk::Action> undo_action; + Glib::RefPtr<Gtk::Action> 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<ARDOUR::AudioRegion>(*arv->audio_region().get(), &before, &after)); + XMLNode &after = alist.get_state(); + session->add_command(new MementoCommand<AutomationList>(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<ARDOUR::Region>(*arv->region().get(), &before, &after)); + XMLNode &after = alist.get_state(); + session->add_command(new MementoCommand<AutomationList>(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 */ |