diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-09-24 15:41:23 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-09-24 15:41:23 +0000 |
commit | 2e765255e9ca05c89a8ed921575e937d423953f5 (patch) | |
tree | 207fbf3a3c70525bc359f8e79c363357745f6017 | |
parent | 47e8a7ac4a307b25b0f79f078ac0015ae8680ede (diff) |
improvements (?) for window visibility during session loading - time to test on linux
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2476 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 113 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 3 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_dialogs.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/editor_audio_import.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/sfdb_ui.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/sync-menu.c | 1 | ||||
-rw-r--r-- | libs/ardour/auditioner.cc | 2 | ||||
-rw-r--r-- | libs/pbd/SConscript | 1 | ||||
-rw-r--r-- | libs/pbd/misc.c | 21 | ||||
-rw-r--r-- | libs/pbd/mountpoint.cc | 2 | ||||
-rw-r--r-- | libs/pbd/pbd/misc.h | 15 |
11 files changed, 129 insertions, 45 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 9c612eb220..93cc753807 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -34,6 +34,7 @@ #include <pbd/error.h> #include <pbd/compose.h> +#include <pbd/misc.h> #include <pbd/pathscanner.h> #include <pbd/failed_constructor.h> #include <pbd/enumwriter.h> @@ -191,6 +192,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) have_disk_speed_dialog_displayed = false; _will_create_new_session_automatically = false; session_loaded = false; + loading_dialog = 0; last_speed_displayed = -1.0f; keybindings_path = ARDOUR::find_config_file ("ardour.bindings"); @@ -1958,7 +1960,16 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e { string session_name; string session_path; - + string template_name; + + if (!loading_dialog) { + loading_dialog = new MessageDialog (*new_session_dialog, + _("Starting audio engine"), + false, + Gtk::MESSAGE_INFO, + Gtk::BUTTONS_NONE); + } + int response = Gtk::RESPONSE_NONE; new_session_dialog->set_modal(true); @@ -2002,6 +2013,9 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e have_engine = true; } + loading_dialog->show_all (); + flush_pending (); + create_engine (); /* now handle possible affirmative responses */ @@ -2031,14 +2045,16 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e /* OK == OPEN button */ session_name = new_session_dialog->session_name(); - - if (new_session_dialog->get_current_page() == 1) { - - if (session_name.empty()) { - response = Gtk::RESPONSE_NONE; - continue; - } + + if (session_name.empty()) { + response = Gtk::RESPONSE_NONE; + continue; + } + switch (new_session_dialog->get_current_page()) { + case 1: /* recent session selector */ + case 2: /* audio engine control */ + if (session_name[0] == '/' || (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') || (session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) { @@ -2047,13 +2063,9 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e session_path = new_session_dialog->session_folder(); load_session (session_path, session_name); } - - } else { + break; - if (session_name.empty()) { - response = Gtk::RESPONSE_NONE; - continue; - } + case 0: /* nominally the "new" session creator, but could be in use for an old session */ if (new_session_dialog->get_current_page() == 0 && ARDOUR_COMMAND_LINE::session_name.empty()) { should_be_new = true; @@ -2079,7 +2091,12 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e session_path = Glib::build_filename (session_path, session_name); - if (should_be_new && Glib::file_test (session_path, Glib::FileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { + if (!should_be_new) { + + load_session (session_path, session_name); + continue; /* leaves while() loop because response != NONE */ + + } else if (Glib::file_test (session_path, Glib::FileTest (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); @@ -2096,6 +2113,9 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e switch (msg.run()) { case RESPONSE_YES: + new_session_dialog->hide (); + goto_editor_window (); + flush_pending (); load_session (session_path, session_name); goto done; break; @@ -2104,14 +2124,18 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e 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()) { - + + template_name = new_session_dialog->session_template_name(); + + new_session_dialog->hide (); + goto_editor_window (); + flush_pending (); + load_session (session_path, session_name, &template_name); } else { @@ -2168,6 +2192,10 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e nphysout = (uint32_t) new_session_dialog->output_limit_count(); } + new_session_dialog->hide (); + goto_editor_window (); + flush_pending (); + if (build_session (session_path, session_name, cchns, @@ -2183,6 +2211,10 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e continue; } } + break; + + default: + break; } } @@ -2190,19 +2222,20 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e done: show(); - new_session_dialog->get_window()->set_cursor(); + loading_dialog->hide (); new_session_dialog->hide(); return true; } void -ARDOUR_UI::close_session() +ARDOUR_UI::close_session () { if (!check_audioengine()) { return; } - unload_session(); + unload_session (true); + get_session_parameters ("", true, false); } @@ -2210,19 +2243,22 @@ int ARDOUR_UI::load_session (const string & path, const string & snap_name, string* mix_template) { Session *new_session; - int x; + int unload_status; + int retval = -1; + session_loaded = false; - + if (!check_audioengine()) { return -1; } - x = unload_session (); + unload_status = unload_session (); - if (x < 0) { - return -1; - } else if (x > 0) { - return 0; + if (unload_status < 0) { + goto out; + } else if (unload_status > 0) { + retval = 0; + goto out; } /* if it already exists, we must have write access */ @@ -2231,17 +2267,23 @@ ARDOUR_UI::load_session (const string & path, const string & snap_name, string* MessageDialog msg (*editor, _("You do not have write access to this session.\n" "This prevents the session from being loaded.")); msg.run (); - return -1; + goto out; + } + + if (loading_dialog) { + loading_dialog->set_markup (_("Please wait while Ardour loads your session")); + flush_pending (); } + disable_screen_updates (); + try { new_session = new Session (*engine, path, snap_name, mix_template); } catch (...) { - error << string_compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name) << endmsg; - return -1; + goto out; } connect_to_session (new_session); @@ -2257,7 +2299,12 @@ ARDOUR_UI::load_session (const string & path, const string & snap_name, string* } editor->edit_cursor_position (true); - return 0; + enable_screen_updates (); + flush_pending (); + retval = 0; + + out: + return retval; } int diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 507c253155..1811a4db5a 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -133,7 +133,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI bool get_session_parameters (Glib::ustring path, bool have_engine = false, bool should_be_new = false); gint cmdline_new_session (string path); - int unload_session (); + int unload_session (bool hide_stuff = false); void close_session(); int save_state_canfail (string state_name = ""); @@ -736,6 +736,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI Glib::RefPtr<Gtk::TextBuffer::Tag> ptag, Glib::RefPtr<Gtk::TextBuffer::Tag> mtag, const char *msg); Gtk::Label status_bar_label; Gtk::ToggleButton error_log_button; + Gtk::MessageDialog* loading_dialog; }; #endif /* __ardour_gui_h__ */ diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index fcd75154b4..b5fa7e2396 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -163,7 +163,7 @@ ARDOUR_UI::connect_to_session (Session *s) } int -ARDOUR_UI::unload_session () +ARDOUR_UI::unload_session (bool hide_stuff) { if (session && session->dirty()) { switch (ask_about_saving_session (_("close"))) { @@ -175,7 +175,12 @@ ARDOUR_UI::unload_session () break; } } - editor->hide (); + + if (hide_stuff) { + editor->hide (); + mixer->hide (); + } + second_connection.disconnect (); point_one_second_connection.disconnect (); point_oh_five_second_connection.disconnect (); diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index 0633b5ccaf..863c162c43 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -99,6 +99,7 @@ Editor::external_audio_dialog () case RESPONSE_OK: sfbrowser->hide (); break; + default: // cancel from the browser - we are done sfbrowser->hide (); diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 5767cf12d1..1ba31404ed 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -526,8 +526,6 @@ SoundFileBrowser::update_preview () void SoundFileBrowser::found_list_view_selected () { - cerr << "file selected\n"; - if (!reset_options ()) { set_response_sensitive (RESPONSE_OK, false); } else { @@ -625,8 +623,6 @@ SoundFileOmega::reset_options () abort (); } - cerr << "got " << paths.size() << " paths at depth = " << reset_depth << endl; - if (paths.empty()) { channel_combo.set_sensitive (false); @@ -1139,8 +1135,6 @@ SoundFileOmega::file_selection_changed () return; } - cerr << "file selection changed\n"; - if (!reset_options ()) { set_response_sensitive (RESPONSE_OK, false); } else { diff --git a/gtk2_ardour/sync-menu.c b/gtk2_ardour/sync-menu.c index 1f06939ff5..c471c7f90b 100644 --- a/gtk2_ardour/sync-menu.c +++ b/gtk2_ardour/sync-menu.c @@ -479,6 +479,7 @@ carbon_menu_item_connect (GtkWidget *menu_item, /* * carbon event handler */ +static int eventcnt = 0; static OSStatus menu_event_handler_func (EventHandlerCallRef event_handler_call_ref, diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc index c1fef40151..63f8850c09 100644 --- a/libs/ardour/auditioner.cc +++ b/libs/ardour/auditioner.cc @@ -117,7 +117,6 @@ void Auditioner::audition_region (boost::shared_ptr<Region> region) { if (g_atomic_int_get (&_active)) { - cerr << "re-audition while still active!\n"; /* don't go via session for this, because we are going to remain active. */ @@ -177,6 +176,7 @@ Auditioner::play_audition (nframes_t nframes) } need_butler = _diskstream->commit (this_nframes); + current_frame += this_nframes; if (current_frame >= length) { diff --git a/libs/pbd/SConscript b/libs/pbd/SConscript index a0065f09bd..9e09d5513e 100644 --- a/libs/pbd/SConscript +++ b/libs/pbd/SConscript @@ -29,6 +29,7 @@ dmalloc.cc error.cc fpu.cc id.cc +misc.c mountpoint.cc path.cc pathscanner.cc diff --git a/libs/pbd/misc.c b/libs/pbd/misc.c new file mode 100644 index 0000000000..797be5de45 --- /dev/null +++ b/libs/pbd/misc.c @@ -0,0 +1,21 @@ +#include <pbd/misc.h> + +#ifdef GTKOSX +#include <AppKit/AppKit.h> +#endif + +void +disable_screen_updates () +{ +#ifdef GTKOSX + NSDisableScreenUpdates (); +#endif +} + +void +enable_screen_updates () +{ +#ifdef GTKOSX + NSEnableScreenUpdates(); +#endif +} diff --git a/libs/pbd/mountpoint.cc b/libs/pbd/mountpoint.cc index c1bcb375f3..054aff07de 100644 --- a/libs/pbd/mountpoint.cc +++ b/libs/pbd/mountpoint.cc @@ -141,8 +141,6 @@ mountpoint (string path) } } - free(mntbufp); - return best; } #endif // HAVE_GETMNTENT diff --git a/libs/pbd/pbd/misc.h b/libs/pbd/pbd/misc.h new file mode 100644 index 0000000000..306c00683e --- /dev/null +++ b/libs/pbd/pbd/misc.h @@ -0,0 +1,15 @@ +#ifndef __pbd_misc_h__ +#define __pbd_misc_h__ + +#ifdef __cplusplus +extern "C" { +#endif + + void disable_screen_updates (); + void enable_screen_updates (); + +#ifdef __cplusplus +} +#endif + +#endif /* __pbd_misc_h__ */ |