fix return type in last commit for AutomationLine::control_point_box_size(); catch...
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 31 Oct 2006 21:48:51 +0000 (21:48 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 31 Oct 2006 21:48:51 +0000 (21:48 +0000)
git-svn-id: svn://localhost/ardour2/trunk@1042 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui.cc
gtk2_ardour/automation_line.cc
gtk2_ardour/automation_line.h
libs/ardour/session.cc

index ff75d50cd05ab778afe2c47af220cde149ff3cec..7cf0654b3e794c9d4fe3f3186d5fea106445e610 100644 (file)
@@ -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();
index f81cd565c6049e09e99ad098202c49c205887036..9b04a9d0d47f973a8af9a70d4bcf74625689a0f9 100644 (file)
@@ -294,7 +294,7 @@ AutomationLine::hide ()
        _visible = false;
 }
 
-uint32_t
+double
 AutomationLine::control_point_box_size ()
 {
        if (_height > TimeAxisView::hLarger) {
index 95d7164e3c4184bdb0cdb3a554e3355760f7137f..8269a8714f8bebc9ea2b5c8d65c001a3dcdd3c84 100644 (file)
@@ -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;
index 98d671281a6e16c5e5232ed9cdcab1de9ba48290..99fad0d0130759d63b85f567510b5a4d2e0aec1f 100644 (file)
@@ -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 ();