X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Froute_time_axis.cc;h=f5f0f1dd103f1031c38e765b87601ead9f16ff51;hb=39aec8e0ca34feb78be8cc526fa57687b5cbe642;hp=8dca7be480f2042e06f46e156169c0976cb24269;hpb=79986643c0c904f6574bb5323e2233a43a9e622e;p=ardour.git diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 8dca7be480..f5f0f1dd10 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -60,8 +61,6 @@ #include "gui_thread.h" #include "keyboard.h" #include "playlist_selector.h" -#include "plugin_selector.h" -#include "plugin_ui.h" #include "point_selection.h" #include "prompter.h" #include "public_editor.h" @@ -105,9 +104,6 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh ignore_toggle = false; - mute_button->set_active (false); - solo_button->set_active (false); - mute_button->set_name ("TrackMuteButton"); solo_button->set_name ("SoloButton"); edit_group_button.set_name ("TrackGroupButton"); @@ -119,18 +115,6 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh hide_button.add (*(manage (new Image (get_xpm("small_x.xpm"))))); - solo_button->signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false); - mute_button->signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false); - playlist_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false); - automation_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false); - size_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false); - visual_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false); - hide_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false); - - solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false); - solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false); - mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false); - mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false); edit_group_button.signal_button_release_event().connect (mem_fun(*this, &RouteTimeAxisView::edit_click), false); playlist_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::playlist_click)); automation_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::automation_click)); @@ -138,10 +122,13 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh visual_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::visual_click)); hide_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::hide_click)); + solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false); + solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false); + mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false); + mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false); + if (is_track()) { - rec_enable_button->set_active (false); rec_enable_button->set_name ("TrackRecordEnableButton"); - rec_enable_button->signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false); rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press)); controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record")); @@ -186,17 +173,12 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh /* map current state of the route */ update_diskstream_display (); - solo_changed(0); - mute_changed(0); - //redirects_changed (0); - //reset_redirect_automation_curves (); + redirects_changed (0); + reset_redirect_automation_curves (); y_position = -1; - _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)); - _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); _route->redirects_changed.connect (mem_fun(*this, &RouteTimeAxisView::redirects_changed)); _route->name_changed.connect (mem_fun(*this, &RouteTimeAxisView::route_name_changed)); - _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); if (is_track()) { @@ -216,6 +198,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh editor.ZoomChanged.connect (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit)); ColorChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler)); + } RouteTimeAxisView::~RouteTimeAxisView () @@ -251,9 +234,6 @@ RouteTimeAxisView::set_playlist (Playlist *newplaylist) assert(pl); modified_connection.disconnect (); - state_changed_connection.disconnect (); - - state_changed_connection = pl->StateChanged.connect (mem_fun(*this, &RouteTimeAxisView::playlist_state_changed)); modified_connection = pl->Modified.connect (mem_fun(*this, &RouteTimeAxisView::playlist_modified)); } @@ -476,7 +456,7 @@ RouteTimeAxisView::build_display_menu () void -RouteTimeAxisView::show_timestretch (jack_nframes_t start, jack_nframes_t end) +RouteTimeAxisView::show_timestretch (nframes_t start, nframes_t end) { double x1; double x2; @@ -606,19 +586,19 @@ RouteTimeAxisView::set_height (TrackHeight h) show_name_entry (); hide_name_label (); - mute_button->show_all(); - solo_button->show_all(); + mute_button->show(); + solo_button->show(); if (rec_enable_button) - rec_enable_button->show_all(); + rec_enable_button->show(); - edit_group_button.show_all(); - hide_button.show_all(); - visual_button.show_all(); - size_button.show_all(); - automation_button.show_all(); + edit_group_button.show(); + hide_button.show(); + visual_button.show(); + size_button.show(); + automation_button.show(); if (is_track() && track()->mode() == ARDOUR::Normal) { - playlist_button.show_all(); + playlist_button.show(); } break; @@ -626,10 +606,10 @@ RouteTimeAxisView::set_height (TrackHeight h) show_name_entry (); hide_name_label (); - mute_button->show_all(); - solo_button->show_all(); + mute_button->show(); + solo_button->show(); if (rec_enable_button) - rec_enable_button->show_all(); + rec_enable_button->show(); edit_group_button.hide (); hide_button.hide (); @@ -729,7 +709,7 @@ RouteTimeAxisView::rename_current_playlist () ArdourPrompter prompter (true); string name; - Diskstream *const ds = get_diskstream(); + boost::shared_ptr ds = get_diskstream(); if (!ds || ds->destructive()) return; @@ -760,7 +740,7 @@ RouteTimeAxisView::use_copy_playlist (bool prompt) { string name; - Diskstream *const ds = get_diskstream(); + boost::shared_ptr ds = get_diskstream(); if (!ds || ds->destructive()) return; @@ -801,7 +781,7 @@ RouteTimeAxisView::use_new_playlist (bool prompt) { string name; - Diskstream *const ds = get_diskstream(); + boost::shared_ptr ds = get_diskstream(); if (!ds || ds->destructive()) return; @@ -839,7 +819,7 @@ RouteTimeAxisView::use_new_playlist (bool prompt) void RouteTimeAxisView::clear_playlist () { - Diskstream *const ds = get_diskstream(); + boost::shared_ptr ds = get_diskstream(); if (!ds || ds->destructive()) return; @@ -879,8 +859,7 @@ RouteTimeAxisView::selection_click (GdkEventButton* ev) switch (Keyboard::selection_type (ev->state)) { case Selection::Toggle: - /* XXX this is not right */ - editor.get_selection().add (*tracks); + editor.get_selection().toggle (*tracks); break; case Selection::Set: @@ -910,7 +889,7 @@ RouteTimeAxisView::set_selected_regionviews (RegionSelection& regions) } void -RouteTimeAxisView::get_selectables (jack_nframes_t start, jack_nframes_t end, double top, double bot, list& results) +RouteTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list& results) { double speed = 1.0; @@ -918,8 +897,8 @@ RouteTimeAxisView::get_selectables (jack_nframes_t start, jack_nframes_t end, do speed = get_diskstream()->speed(); } - jack_nframes_t start_adjusted = session_frame_to_track_frame(start, speed); - jack_nframes_t end_adjusted = session_frame_to_track_frame(end, speed); + nframes_t start_adjusted = session_frame_to_track_frame(start, speed); + nframes_t end_adjusted = session_frame_to_track_frame(end, speed); if (_view && ((top < 0.0 && bot < 0.0)) || touched (top, bot)) { _view->get_selectables (start_adjusted, end_adjusted, results); @@ -965,7 +944,7 @@ RouteTimeAxisView::name() const Playlist * RouteTimeAxisView::playlist () const { - Diskstream *ds; + boost::shared_ptr ds; if ((ds = get_diskstream()) != 0) { return ds->playlist(); @@ -1012,24 +991,24 @@ RouteTimeAxisView::hide_click () editor.hide_track_in_display (*this); } -Region* -RouteTimeAxisView::find_next_region (jack_nframes_t pos, RegionPoint point, int32_t dir) +boost::shared_ptr +RouteTimeAxisView::find_next_region (nframes_t pos, RegionPoint point, int32_t dir) { - Diskstream *stream; + boost::shared_ptr stream; Playlist *playlist; if ((stream = get_diskstream()) != 0 && (playlist = stream->playlist()) != 0) { return playlist->find_next_region (pos, point, dir); } - return 0; + return boost::shared_ptr (); } bool RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) { Playlist* what_we_got; - Diskstream* ds = get_diskstream(); + boost::shared_ptr ds = get_diskstream(); Playlist* playlist; bool ret = false; @@ -1050,12 +1029,12 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) } } + XMLNode &before = playlist->get_state(); switch (op) { case Cut: - _session.add_undo (playlist->get_memento()); if ((what_we_got = playlist->cut (time)) != 0) { editor.get_cut_buffer().add (what_we_got); - _session.add_redo_no_execute (playlist->get_memento()); + _session.add_command( new MementoCommand(*playlist, &before, &playlist->get_state())); ret = true; } break; @@ -1066,9 +1045,8 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) break; case Clear: - _session.add_undo (playlist->get_memento()); if ((what_we_got = playlist->cut (time)) != 0) { - _session.add_redo_no_execute (playlist->get_memento()); + _session.add_command( new MementoCommand(*playlist, &before, &playlist->get_state())); what_we_got->unref (); ret = true; } @@ -1079,7 +1057,7 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) } bool -RouteTimeAxisView::paste (jack_nframes_t pos, float times, Selection& selection, size_t nth) +RouteTimeAxisView::paste (nframes_t pos, float times, Selection& selection, size_t nth) { if (!is_track()) { return false; @@ -1097,9 +1075,9 @@ RouteTimeAxisView::paste (jack_nframes_t pos, float times, Selection& selection, if (get_diskstream()->speed() != 1.0f) pos = session_frame_to_track_frame(pos, get_diskstream()->speed() ); - _session.add_undo (playlist->get_memento()); + XMLNode &before = playlist->get_state(); playlist->paste (**p, pos, times); - _session.add_redo_no_execute (playlist->get_memento()); + _session.add_command( new MementoCommand(*playlist, &before, &playlist->get_state())); return true; } @@ -1196,13 +1174,6 @@ RouteTimeAxisView::color_handler (ColorID id, uint32_t val) } } -bool -RouteTimeAxisView::select_me (GdkEventButton* ev) -{ - editor.get_selection().add (this); - return false; -} - void RouteTimeAxisView::show_all_automation () {