diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2019-10-11 14:29:55 -0600 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2019-10-11 14:29:55 -0600 |
commit | 54acf6af6a4b571863e1c69be4defad6b222bc32 (patch) | |
tree | 22249488f032afe53c6768e8d1dabfa8c16b2c32 /gtk2_ardour | |
parent | da2d6312c43213241e0a60656d631a89255d2951 (diff) |
enforce singleton nature of Splash a little more rigorously, and slightly rationalize it's use
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 8 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_session.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_startup.cc | 32 | ||||
-rw-r--r-- | gtk2_ardour/splash.cc | 25 | ||||
-rw-r--r-- | gtk2_ardour/splash.h | 6 | ||||
-rw-r--r-- | gtk2_ardour/startup_fsm.cc | 6 |
7 files changed, 36 insertions, 44 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index e3abe4d028..c9940e73e5 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -341,7 +341,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) , midi_port_matrix (X_("midi-connection-manager"), _("MIDI Connections"), boost::bind (&ARDOUR_UI::create_global_port_matrix, this, ARDOUR::DataType::MIDI)) , key_editor (X_("key-editor"), _("Keyboard Shortcuts"), boost::bind (&ARDOUR_UI::create_key_editor, this)) , video_server_process (0) - , splash (0) , have_configure_timeout (false) , last_configure_time (0) , last_peak_grab (0) diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index d11fb023de..8e73376010 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -190,8 +190,8 @@ public: bool run_startup (bool should_be_new, std::string load_template); - void show_splash (); void hide_splash (); + static void pop_back_splash (Gtk::Window&); void launch_chat (); void launch_manual (); @@ -752,10 +752,6 @@ private: uint32_t rec_enabled_streams; void count_recenabled_streams (ARDOUR::Route&); - Splash* splash; - - void pop_back_splash (Gtk::Window&); - /* cleanup */ Gtk::MenuItem *cleanup_item; @@ -820,8 +816,6 @@ private: Gtk::Label status_bar_label; bool status_bar_button_press (GdkEventButton*); - void loading_message (const std::string& msg); - PBD::ScopedConnectionList forever_connections; PBD::ScopedConnection halt_connection; PBD::ScopedConnection editor_meter_connection; diff --git a/gtk2_ardour/ardour_ui_session.cc b/gtk2_ardour/ardour_ui_session.cc index 0c08c1ee9c..c88ba0adcd 100644 --- a/gtk2_ardour/ardour_ui_session.cc +++ b/gtk2_ardour/ardour_ui_session.cc @@ -352,7 +352,7 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name, } } - loading_message (string_compose (_("Please wait while %1 loads your session"), PROGRAM_NAME)); + BootMessage (string_compose (_("Please wait while %1 loads your session"), PROGRAM_NAME)); try { new_session = new Session (*AudioEngine::instance(), path, snap_name, 0, mix_template); diff --git a/gtk2_ardour/ardour_ui_startup.cc b/gtk2_ardour/ardour_ui_startup.cc index 38a0225f78..1310a89e4d 100644 --- a/gtk2_ardour/ardour_ui_startup.cc +++ b/gtk2_ardour/ardour_ui_startup.cc @@ -325,40 +325,10 @@ ARDOUR_UI::keyboard_settings () const return node; } - -void -ARDOUR_UI::loading_message (const std::string& msg) -{ - if (ARDOUR_COMMAND_LINE::no_splash) { - return; - } - - if (!splash) { - show_splash (); - } - - splash->message (msg); -} - -void -ARDOUR_UI::show_splash () -{ - if (splash == 0) { - try { - splash = new Splash; - } catch (...) { - return; - } - } - - splash->display (); -} - void ARDOUR_UI::hide_splash () { - delete splash; - splash = 0; + Splash::drop (); } void diff --git a/gtk2_ardour/splash.cc b/gtk2_ardour/splash.cc index 9d4f78957e..11e88cb1ad 100644 --- a/gtk2_ardour/splash.cc +++ b/gtk2_ardour/splash.cc @@ -48,6 +48,28 @@ using namespace ARDOUR; Splash* Splash::the_splash = 0; +Splash* +Splash::instance() +{ + if (!the_splash) { + the_splash = new Splash; + } + return the_splash; +} + +bool +Splash::exists () +{ + return the_splash; +} + +void +Splash::drop () +{ + delete the_splash; + the_splash = 0; +} + Splash::Splash () { assert (the_splash == 0); @@ -208,6 +230,9 @@ Splash::expose (GdkEventExpose* ev) void Splash::boot_message (std::string msg) { + if (!is_visible()) { + display (); + } message (msg); } diff --git a/gtk2_ardour/splash.h b/gtk2_ardour/splash.h index fc0a458237..342673cd76 100644 --- a/gtk2_ardour/splash.h +++ b/gtk2_ardour/splash.h @@ -34,10 +34,11 @@ class ARDOUR_UI; class Splash : public Gtk::Window { public: - Splash (); ~Splash (); - static Splash* instance() { return the_splash; } + static Splash* instance(); + static void drop(); + static bool exists (); void display (); void pop_back_for (Gtk::Window&); @@ -51,6 +52,7 @@ public: void hide (); private: + Splash (); static Splash* the_splash; Glib::RefPtr<Gdk::Pixbuf> pixbuf; diff --git a/gtk2_ardour/startup_fsm.cc b/gtk2_ardour/startup_fsm.cc index 390f0672bb..f359865b3a 100644 --- a/gtk2_ardour/startup_fsm.cc +++ b/gtk2_ardour/startup_fsm.cc @@ -42,6 +42,7 @@ #include "gtkmm2ext/application.h" #include <gtkmm2ext/doi.h> +#include "ardour_ui.h" #include "engine_dialog.h" #include "new_user_wizard.h" #include "opts.h" @@ -569,7 +570,7 @@ StartupFSM::check_session_parameters (bool must_be_new) /* does not exist at present */ if (!requested_new) { - // pop_back_splash (session_dialog); + ARDOUR_UI::pop_back_splash (*session_dialog); MessageDialog msg (string_compose (_("There is no existing session at \"%1\""), session_path)); msg.run (); session_dialog->clear_name(); @@ -714,7 +715,7 @@ StartupFSM::ask_about_loading_existing_session (const std::string& session_path) msg.set_title (_("Open Existing Session")); msg.set_wmclass (X_("existing_session"), PROGRAM_NAME); msg.set_position (Gtk::WIN_POS_CENTER); - // pop_back_splash (msg); + ARDOUR_UI::pop_back_splash (msg); switch (msg.run()) { case RESPONSE_YES: @@ -761,3 +762,4 @@ Full information on all the above can be found on the support page at\n\ pre_release_dialog->set_position (WIN_POS_CENTER); pre_release_dialog->present (); } + |