enforce singleton nature of Splash a little more rigorously, and slightly rationalize...
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 11 Oct 2019 20:29:55 +0000 (14:29 -0600)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 11 Oct 2019 20:29:55 +0000 (14:29 -0600)
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui_session.cc
gtk2_ardour/ardour_ui_startup.cc
gtk2_ardour/splash.cc
gtk2_ardour/splash.h
gtk2_ardour/startup_fsm.cc

index e3abe4d028481b0b1456c3c3b1bc72a9e7b6731d..c9940e73e5edd2de003f0453179ab052be2b59cd 100644 (file)
@@ -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)
index d11fb023de53b508791290362c2d1a9225643d92..8e733760102cbdeee07a1c2c979237b290f72657 100644 (file)
@@ -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;
index 0c08c1ee9c4712888df5e0b43e6ec323b83ce240..c88ba0adcd6f25a6909bffbc290e0d6a5f05ab72 100644 (file)
@@ -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);
index 38a0225f783519ea4355718bd2bd1228b654b16e..1310a89e4dcca63ab557e1edda1ed2579091c029 100644 (file)
@@ -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
index 9d4f78957e2d925f93fd6afb9f867d8f73633076..11e88cb1adcb63e5e73aec0d7b3b62791e3f5e5e 100644 (file)
@@ -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);
 }
 
index fc0a45823735f2b22d5abd884e2a1bcde2bebc9f..342673cd760d2e11ee3621f1fa2c21e141cb66de 100644 (file)
@@ -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;
index 390f0672bbe658be0fa6247052ae04ee0a106feb..f359865b3a8f1b3dd48e9476297bd433b4bbf4a5 100644 (file)
@@ -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 ();
 }
+