diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index a44eba3754..59d3caee4c 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -391,6 +391,7 @@ Editor::Editor (AudioEngine& eng) controls_layout.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK); controls_layout.signal_button_release_event().connect (mem_fun(*this, &Editor::edit_controls_button_release)); + controls_layout.signal_size_request().connect (mem_fun (*this, &Editor::controls_layout_size_request)); edit_vscrollbar.set_adjustment (vertical_adjustment); edit_hscrollbar.set_adjustment (horizontal_adjustment); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 349781c406..54b5fd578d 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -651,6 +651,7 @@ class Editor : public PublicEditor Gtk::Layout controls_layout; bool Editor::control_layout_scroll (GdkEventScroll* ev); + void controls_layout_size_request (Gtk::Requisition*); Gtk::HScrollbar edit_hscrollbar; bool edit_hscroll_dragging; diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 0bbb9f55a5..2c0f72ffe4 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -383,13 +383,41 @@ Editor::reset_scrolling_region (Gtk::Allocation* alloc) // XXX what is the correct height value for the time canvas ? this overstates it time_canvas.set_scroll_region ( 0.0, 0.0, max (last_canvas_unit, canvas_width), canvas_height); + controls_layout.queue_resize(); + +} + +void +Editor::controls_layout_size_request (Requisition* req) +{ + TreeModel::Children rows = route_display_model->children(); + TreeModel::Children::iterator i; + double pos; + + for (pos = 0, i = rows.begin(); i != rows.end(); ++i) { + TimeAxisView *tv = (*i)[route_display_columns.tv]; + pos += tv->effective_height; + pos += track_spacing; + } + + RefPtr screen = get_screen(); + + if (!screen) { + screen = Gdk::Screen::get_default(); + } + /* never let the width of the controls area shrink horizontally */ edit_controls_vbox.check_resize(); - int w = max (edit_controls_vbox.get_width(), controls_layout.get_width()); - controls_layout.set_size_request (w, min ((gint) pos, (screen->get_height() - 400))); - controls_layout.set_size (w, (gint) pos); + req->width = max (edit_controls_vbox.get_width(), controls_layout.get_width()); + req->height = min ((gint) pos, (screen->get_height() - 400)); + + /* this one is important: it determines how big the layout thinks it really is, as + opposed to what it displays on the screen + */ + + controls_layout.set_size (req->width, (gint) pos); } bool diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index ce60c18807..e9439b60d6 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -3279,10 +3279,13 @@ void Editor::duplicate_some_regions (AudioRegionSelection& regions, float times) { Playlist *playlist; - + AudioRegionSelection sel = regions; // clear (below) will clear the argument list + begin_reversible_command (_("duplicate region")); - for (AudioRegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) { + selection->clear_audio_regions (); + + for (AudioRegionSelection::iterator i = sel.begin(); i != sel.end(); ++i) { Region& r ((*i)->region); @@ -3296,11 +3299,12 @@ Editor::duplicate_some_regions (AudioRegionSelection& regions, float times) session->add_redo_no_execute (playlist->get_memento()); c.disconnect (); + + if (latest_regionview) { + selection->add (latest_regionview); + } } - if (latest_regionview) { - selection->set (latest_regionview); - } commit_reversible_command (); } diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index b8d280b2bb..73928a62f3 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -81,7 +81,6 @@ Editor::handle_new_route (Route& route) tv->GoingAway.connect (bind (mem_fun(*this, &Editor::remove_route), tv)); editor_mixer_button.set_sensitive(true); - } void diff --git a/libs/ardour/ardour/state_manager.h b/libs/ardour/ardour/state_manager.h index 105ca38dcc..b64a47008c 100644 --- a/libs/ardour/ardour/state_manager.h +++ b/libs/ardour/ardour/state_manager.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include @@ -13,7 +13,6 @@ namespace ARDOUR { typedef uint32_t state_id_t; - class StateManager : public sigc::trackable { public: @@ -36,13 +35,12 @@ class StateManager : public sigc::trackable state_id_t _current_state_id; - static void set_allow_save (bool); - static bool allow_save (); + static void prohibit_save (); + static void allow_save (const char* why, bool dosave); protected: static bool _allow_save; - typedef std::pair DeferredSave; - static std::vector deferred; + static std::set deferred; StateMap states; diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 7a88443dbd..f22fc6f5d8 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1445,7 +1445,7 @@ Session::set_state (const XMLNode& node) return -1; } - StateManager::set_allow_save (false); + StateManager::prohibit_save (); if ((prop = node.property ("name")) != 0) { _name = prop->value (); @@ -1607,7 +1607,7 @@ Session::set_state (const XMLNode& node) _state_of_the_state = Clean; - StateManager::set_allow_save (true); + StateManager::allow_save (_("initial state"), true); if (state_was_pending) { save_state (_current_snapshot_name); @@ -1615,11 +1615,11 @@ Session::set_state (const XMLNode& node) state_was_pending = false; } - ret = 0; + return 0; out: - /* yes, doing it twice doesn't hurt and makes the code easier */ - StateManager::set_allow_save (true); + /* we failed, re-enable state saving but don't actually save internal state */ + StateManager::allow_save (X_("ignored"), false); return ret; } diff --git a/libs/ardour/state_manager.cc b/libs/ardour/state_manager.cc index 4bb44dbc95..cef2817899 100644 --- a/libs/ardour/state_manager.cc +++ b/libs/ardour/state_manager.cc @@ -7,7 +7,7 @@ using namespace ARDOUR; using namespace std; bool StateManager::_allow_save = true; -vector StateManager::deferred; +set StateManager::deferred; StateManager::StateManager () { @@ -19,16 +19,21 @@ StateManager::~StateManager() } void -StateManager::set_allow_save (bool yn) +StateManager::prohibit_save () { - _allow_save = yn; + _allow_save = false; +} - if (yn) { - for (vector::iterator x = deferred.begin(); x != deferred.end(); ++x) { - (*x).first->save_state ((*x).second); +void +StateManager::allow_save (const char* why, bool do_save) +{ + _allow_save = true; + if (do_save) { + for (set::iterator x = deferred.begin(); x != deferred.end(); ++x) { + (*x)->save_state (why); } - deferred.clear (); } + deferred.clear (); } void @@ -69,7 +74,7 @@ void StateManager::save_state (std::string why) { if (!_allow_save) { - deferred.push_back (DeferredSave (this, why)); + deferred.insert (this); return; } diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc index 292753604f..2ea82209bd 100644 --- a/libs/gtkmm2ext/gtk_ui.cc +++ b/libs/gtkmm2ext/gtk_ui.cc @@ -233,7 +233,6 @@ UI::quit () static bool idle_quit () { - cerr << "idle quit, level = " << Main::level() << endl; Main::quit (); return true; }