Render tracks and regions to a background image in the editor summary.
[ardour.git] / gtk2_ardour / ardour_window.cc
index 616cfbcb66d5e4032d0bf822d95307217d1e6e42..b50a83c31f673ab5fff2a460ffde2baa4f33a787 100644 (file)
@@ -23,7 +23,9 @@
 #include <gtkmm2ext/doi.h>
 
 #include "ardour_window.h"
+#include "ardour_ui.h"
 #include "keyboard.h"
+#include "utils.h"
 
 using namespace std;
 using namespace Gtk;
@@ -35,6 +37,7 @@ ArdourWindow::ArdourWindow (string title)
 {
        set_title (title);
        init ();
+       set_position (Gtk::WIN_POS_MOUSE);
 }
 
 ArdourWindow::ArdourWindow (Gtk::Window& parent, string /*title*/)
@@ -48,6 +51,13 @@ ArdourWindow::ArdourWindow (Gtk::Window& parent, string /*title*/)
 
 ArdourWindow::~ArdourWindow ()
 {
+       WM::Manager::instance().remove (proxy);
+}
+
+bool
+ArdourWindow::on_key_press_event (GdkEventKey* ev)
+{
+       return relay_key_press (ev, this);
 }
 
 bool
@@ -71,9 +81,42 @@ ArdourWindow::on_unmap ()
        Window::on_unmap ();
 }
 
+bool
+ArdourWindow::on_delete_event (GdkEventAny*)
+{
+       return false;
+}
+
 void
 ArdourWindow::init ()
 {
        set_border_width (10);
+
+        /* ArdourWindows are not dialogs (they have no "OK" or "Close" button) but
+           they should be considered part of the same "window level" as a dialog. This
+           works on X11 and Quartz, in that:
+           
+           (a) utility & dialog windows are considered to be part of the same level
+           (b) they will float above normal windows without any particular effort
+          (c) present()-ing them will make a utility float over a dialog or
+               vice versa.
+        */
+
+       if (ARDOUR_UI::instance()->config()->get_all_floating_windows_are_dialogs()) {
+               set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
+       } else {
+               set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY);
+       }
+
+       Gtk::Window* parent = WM::Manager::instance().transient_parent();
+
+       if (parent) {
+               set_transient_for (*parent);
+       }
+       
+       ARDOUR_UI::CloseAllDialogs.connect (sigc::mem_fun (*this, &ArdourWindow::hide));
+
+       proxy = new WM::ProxyTemporary (get_title(), this);
+       WM::Manager::instance().register_window (proxy);
 }