if (proxy) {
proxy->set_custom_ui_mode (true);
- proxy->toggle ();
+ proxy->show_the_right_window ();
}
}
if (proxy) {
proxy->set_custom_ui_mode (false);
- proxy->toggle ();
+ proxy->show_the_right_window ();
}
}
}
void
-ProcessorWindowProxy::toggle ()
+ProcessorWindowProxy::show_the_right_window ()
{
if (_window && (is_custom != want_custom)) {
/* drop existing window - wrong type */
drop_window ();
+ get (true);
+ setup ();
+ assert (_window);
+ is_custom = want_custom;
}
- is_custom = want_custom;
- WM::ProxyBase::toggle ();
+ toggle ();
}
}
ARDOUR::SessionHandlePtr* session_handle();
- void toggle();
+ void show_the_right_window ();
void set_custom_ui_mode(bool use_custom) { want_custom = use_custom; }
int set_state (const XMLNode&, int);
void
Manager::toggle_window (ProxyBase* proxy)
{
- if (proxy) {
- proxy->toggle ();
+
+ Glib::RefPtr<Gtk::Action> act = ARDOUR_UI::instance()->global_actions.find_action (string_compose ("%1/%2", window_actions->get_name(), proxy->action_name()));
+ if (!act) {
+ return;
+ }
+ Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic (act);
+ if (!tact) {
+ return;
+ }
+
+ if (tact->get_active()) {
+ proxy->present ();
+ } else {
+ proxy->hide ();
}
}
virtual Gtk::Window* get (bool create = false) = 0;
- virtual void toggle ();
-
virtual int set_state (const XMLNode&, int version);
virtual XMLNode& get_state ();
virtual bool delete_event_handler (GdkEventAny *ev);
virtual void setup ();
+ void toggle ();
};
}
#include "pbd/convert.h"
#include "pbd/xml++.h"
+#include "pbd/stacktrace.h"
#include "gtkmm2ext/window_proxy.h"
#include "gtkmm2ext/visibility_tracker.h"
{
if (!_window) {
(void) get (true);
+ setup ();
assert (_window);
/* XXX this is a hack - the window object should really
ensure its components are all visible. sigh.
_window->show_all();
/* we'd like to just call this and nothing else */
_window->present ();
-
} else {
if (_window->is_mapped()) {
save_pos_and_size();
}
+
vistracker->cycle_visibility ();
+
if (_window->is_mapped()) {
if (_width != -1 && _height != -1) {
_window->set_default_size (_width, _height);
bool
WindowProxy::delete_event_handler (GdkEventAny* /*ev*/)
{
- hide();
+ if (_action) {
+ _action->activate ();
+ } else {
+ hide();
+ }
+
return true;
}