From 34cd3457a2f04526f96342edf52d453973cf21b9 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 31 Oct 2006 21:48:51 +0000 Subject: [PATCH] fix return type in last commit for AutomationLine::control_point_box_size(); catch attempts to use new session dialog to open existing sessions git-svn-id: svn://localhost/ardour2/trunk@1042 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour_ui.cc | 44 +++++++++++++++++++++++++++++----- gtk2_ardour/automation_line.cc | 2 +- gtk2_ardour/automation_line.h | 2 +- libs/ardour/session.cc | 1 + 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index ff75d50cd0..7cf0654b3e 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1608,18 +1608,22 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path) int response = Gtk::RESPONSE_NONE; new_session_dialog->set_modal(true); - new_session_dialog->set_name(predetermined_path); + new_session_dialog->set_name (predetermined_path); new_session_dialog->reset_recent(); new_session_dialog->show(); do { response = new_session_dialog->run (); + + _session_is_new = false; + + if (response == Gtk::RESPONSE_CANCEL || response == Gtk::RESPONSE_DELETE_EVENT) { - if(response == Gtk::RESPONSE_CANCEL || response == Gtk::RESPONSE_DELETE_EVENT) { quit(); return; } else if (response == Gtk::RESPONSE_NONE) { + /* Clear was pressed */ new_session_dialog->reset(); @@ -1671,8 +1675,6 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path) } else { - _session_is_new = true; - if (session_name.empty()) { response = Gtk::RESPONSE_NONE; continue; @@ -1688,14 +1690,43 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path) } else { session_path = new_session_dialog->session_folder(); - + } - + //XXX This is needed because session constructor wants a //non-existant path. hopefully this will be fixed at some point. session_path = Glib::build_filename (session_path, session_name); + if (g_file_test (session_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { + + Glib::ustring str = string_compose (_("This session\n%1\nalready exists. Do you want to open it?"), session_path); + + MessageDialog msg (str, + false, + Gtk::MESSAGE_WARNING, + Gtk::BUTTONS_YES_NO, + true); + + + msg.set_name (X_("CleanupDialog")); + msg.set_wmclass (_("existing_session"), "Ardour"); + msg.set_position (Gtk::WIN_POS_MOUSE); + + switch (msg.run()) { + case RESPONSE_YES: + load_session (session_path, session_name); + goto done; + break; + default: + response = RESPONSE_NONE; + new_session_dialog->reset (); + continue; + } + } + + _session_is_new = true; + std::string template_name = new_session_dialog->session_template_name(); if (new_session_dialog->use_session_template()) { @@ -1755,6 +1786,7 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path) } while (response == Gtk::RESPONSE_NONE); + done: show(); new_session_dialog->get_window()->set_cursor(); new_session_dialog->hide(); diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index f81cd565c6..9b04a9d0d4 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -294,7 +294,7 @@ AutomationLine::hide () _visible = false; } -uint32_t +double AutomationLine::control_point_box_size () { if (_height > TimeAxisView::hLarger) { diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index 95d7164e3c..8269a8714f 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -217,7 +217,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin void reset_line_coords (ControlPoint&); void update_line (); - uint32_t control_point_box_size (); + double control_point_box_size (); struct ModelRepresentation { ARDOUR::AutomationList::iterator start; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 98d671281a..99fad0d013 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -334,6 +334,7 @@ Session::Session (AudioEngine &eng, first_stage_init (fullpath, snapshot_name); new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)); + if (new_session) { if (create (new_session, 0, initial_length)) { throw failed_constructor (); -- 2.30.2