13
0

update Window > Mixer accordingly

This commit is contained in:
Robin Gareus 2015-06-26 23:42:11 +02:00
parent 7be99bf6e4
commit 4fc3d98af8
4 changed files with 49 additions and 12 deletions

View File

@ -376,14 +376,58 @@ ARDOUR_UI::goto_mixer_window ()
void
ARDOUR_UI::toggle_mixer_window ()
{
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
if (!act) {
if (!editor || !mixer) {
/* can this really happen?
* keyboard shortcut during session close, maybe?
*/
#ifndef NDEBUG
/* one way to find out: */
printf("ARDOUR_UI::toggle_mixer_window: Editor: %p Mixer: %p\n", editor, mixer);
PBD::stacktrace (std::cerr, 20);
assert (0);
#endif
return;
}
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
bool show = false;
bool obscuring = false;
if (tact->get_active()) {
if (mixer->not_visible ()) {
show = true;
}
else if (editor->get_screen() == mixer->get_screen()) {
gint ex, ey, ew, eh;
gint mx, my, mw, mh;
editor->get_position (ex, ey);
editor->get_size (ew, eh);
mixer->get_position (mx, my);
mixer->get_size (mw, mh);
GdkRectangle e;
GdkRectangle m;
GdkRectangle r;
e.x = ex;
e.y = ey;
e.width = ew;
e.height = eh;
m.x = mx;
m.y = my;
m.width = mw;
m.height = mh;
if (gdk_rectangle_intersect (&e, &m, &r)) {
obscuring = true;
}
}
if (obscuring && editor->property_has_toplevel_focus()) {
show = true;
}
if (show) {
goto_mixer_window ();
} else {
mixer->hide ();

View File

@ -201,7 +201,7 @@ ARDOUR_UI::install_actions ()
if (Profile->get_mixbus())
ActionManager::register_action (common_actions, X_("show-ui-prefs"), _("Show more UI preferences"), sigc::mem_fun (*this, &ARDOUR_UI::show_ui_prefs));
ActionManager::register_toggle_action (common_actions, X_("toggle-mixer"), S_("Window|Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_window));
ActionManager::register_action (common_actions, X_("toggle-mixer"), S_("Window|Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_window));
ActionManager::register_action (common_actions, X_("toggle-editor-mixer"), _("Toggle Editor+Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_editor_mixer));
ActionManager::register_action (common_actions, X_("toggle-meterbridge"), S_("Window|Meterbridge"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_meterbridge));

View File

@ -46,7 +46,6 @@ ARDOUR_UI::create_mixer ()
}
mixer->signal_window_state_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::main_window_state_event_handler), false));
mixer->signal_unmap().connect (sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/toggle-mixer")));
return 0;
}

View File

@ -777,12 +777,6 @@ Mixer_UI::set_session (Session* sess)
if (_visible) {
show_window();
/* Bit of a hack; if we're here, we're opening the mixer because of our
instant XML state having a show-mixer property. Fix up the corresponding
action state.
*/
ActionManager::check_toggleaction ("<Actions>/Common/toggle-mixer");
}
start_updating ();