/*
- Copyright (C) 2004 Paul Davis
+ * Copyright (C) 2019 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#include "ardour_message.h"
+#include "splash.h"
- $Id$
+using namespace Gtk;
-*/
+ArdourMessageDialog::ArdourMessageDialog (const Glib::ustring& message,
+ bool use_markup,
+ Gtk::MessageType type,
+ Gtk::ButtonsType buttons,
+ bool modal)
+ : Gtk::MessageDialog (message, use_markup, type, buttons, modal)
+ , _splash_pushed (false)
+{
+ set_position (WIN_POS_MOUSE);
+}
-#include <gtkmm/stock.h>
+ArdourMessageDialog::ArdourMessageDialog (Gtk::Window& parent,
+ const Glib::ustring& message,
+ bool use_markup,
+ Gtk::MessageType type,
+ Gtk::ButtonsType buttons,
+ bool modal)
+ : Gtk::MessageDialog (parent, message, use_markup, type, buttons, modal)
+ , _splash_pushed (false)
+{
+ set_transient_for (parent);
+ set_position (WIN_POS_MOUSE);
+}
-#include "ardour_message.h"
-#include "i18n.h"
+ArdourMessageDialog::~ArdourMessageDialog ()
+{
+ pop_splash ();
+}
-using namespace std;
-using namespace Gtk;
+int
+ArdourMessageDialog::run ()
+{
+ push_splash ();
+ int rv = Gtk::MessageDialog::run ();
+ pop_splash ();
+ return rv;
+}
-ArdourMessage::ArdourMessage (Gtk::Window* parent,
- string name, string msg,
- bool grab_focus, bool auto_run)
- : ArdourDialog (name),
- label (msg, 0.5, 0.5)
-{
- label.set_name (X_("PrompterLabel"));
- label.show ();
-
- get_vbox()->pack_start (label);
-
- Button* ok_button = add_button (Stock::OK, RESPONSE_ACCEPT);
-
- set_name (X_("Prompter"));
- set_position (Gtk::WIN_POS_MOUSE);
- set_modal (true);
- set_type_hint (Gdk::WINDOW_TYPE_HINT_MENU);
-
- if (grab_focus) {
- ok_button->grab_focus ();
- }
+void
+ArdourMessageDialog::show ()
+{
+ push_splash ();
+ Gtk::MessageDialog::show ();
+}
- if (parent) {
- set_transient_for (*parent);
- }
+void
+ArdourMessageDialog::hide ()
+{
+ Gtk::MessageDialog::hide ();
+ pop_splash ();
+}
- if (auto_run) {
- run ();
+void
+ArdourMessageDialog::pop_splash ()
+{
+ if (_splash_pushed) {
+ Splash* spl = Splash::instance();
+ if (spl) {
+ spl->pop_front();
+ }
+ _splash_pushed = false;
}
}
-ArdourMessage::~ArdourMessage()
+void
+ArdourMessageDialog::push_splash ()
{
+ if (Splash::exists()) {
+ Splash* spl = Splash::instance();
+ if (spl->is_visible()) {
+ spl->pop_back_for (*this);
+ _splash_pushed = true;
+ }
+ }
}