X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fardour_ui_dialogs.cc;h=7d7ee7d60b0df2cf74b8e3f6016bba193134903e;hb=5e7d9d30e28e8022661497244ccd43a1f5a836c6;hp=b9789f34251d6645cc3abae248e0620ae55e01a3;hpb=b5c9a92a584b70b2af172e7240d4a58b007e0608;p=ardour.git diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index b9789f3425..7d7ee7d60b 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -148,6 +148,7 @@ ARDOUR_UI::set_session (Session *s) blink_connection = Timers::blink_connect (sigc::mem_fun(*this, &ARDOUR_UI::blink_handler)); + _session->SaveSessionRequested.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::save_session_at_its_request, this, _1), gui_context()); _session->RecordStateChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::record_state_changed, this), gui_context()); _session->StepEditStatusChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::step_edit_status_change, this, _1), gui_context()); _session->TransportStateChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::map_transport_state, this), gui_context()); @@ -222,8 +223,8 @@ ARDOUR_UI::set_session (Session *s) editor_meter_peak_display.set_name ("meterbridge peakindicator"); editor_meter_peak_display.unset_flags (Gtk::CAN_FOCUS); - editor_meter_peak_display.set_size_request(8, -1); - editor_meter_peak_display.set_corner_radius(3); + editor_meter_peak_display.set_size_request (std::max(9.f, rintf(8.f * ui_scale)), -1); + editor_meter_peak_display.set_corner_radius (3.0); editor_meter_max_peak = -INFINITY; editor_meter_peak_display.signal_button_release_event().connect (sigc::mem_fun(*this, &ARDOUR_UI::editor_meter_peak_button_release), false); @@ -335,7 +336,9 @@ ARDOUR_UI::goto_editor_window () editor->show_window (); editor->present (); /* mixer should now be on top */ - WM::Manager::instance().set_transient_for (editor); + if (ARDOUR_UI::config()->get_transients_follow_front()) { + WM::Manager::instance().set_transient_for (editor); + } _mixer_on_top = false; } @@ -364,21 +367,37 @@ ARDOUR_UI::goto_mixer_window () mixer->show_window (); mixer->present (); /* mixer should now be on top */ - WM::Manager::instance().set_transient_for (mixer); + if (ARDOUR_UI::config()->get_transients_follow_front()) { + WM::Manager::instance().set_transient_for (mixer); + } _mixer_on_top = true; } void ARDOUR_UI::toggle_mixer_window () { - Glib::RefPtr act = ActionManager::get_action (X_("Common"), X_("toggle-mixer")); - if (!act) { - return; + /* thse windows are created in ARDOUR_UI::setup_windows() + * it should be impossible to get here with any of them being NULL + */ + assert (editor && mixer && meterbridge); + + bool show = false; + bool obscuring = false; + + if (mixer->not_visible ()) { + show = true; + } + else if ( (!editor->not_visible () && ARDOUR_UI_UTILS::windows_overlap (editor, mixer)) + || (!meterbridge->not_visible () && ARDOUR_UI_UTILS::windows_overlap (meterbridge, mixer)) + ) { + obscuring = true; } - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + if (obscuring && (editor->property_has_toplevel_focus() || meterbridge->property_has_toplevel_focus())) { + show = true; + } - if (tact->get_active()) { + if (show) { goto_mixer_window (); } else { mixer->hide (); @@ -388,15 +407,28 @@ ARDOUR_UI::toggle_mixer_window () void ARDOUR_UI::toggle_meterbridge () { - Glib::RefPtr act = ActionManager::get_action (X_("Common"), X_("toggle-meterbridge")); - if (!act) { - return; + assert (editor && mixer && meterbridge); + + bool show = false; + bool obscuring = false; + + if (meterbridge->not_visible ()) { + show = true; + } + else if ( (!editor->not_visible() && ARDOUR_UI_UTILS::windows_overlap (editor, meterbridge)) + || (!mixer->not_visible () && ARDOUR_UI_UTILS::windows_overlap (meterbridge, mixer)) + ) { + obscuring = true; } - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + if (obscuring && (editor->property_has_toplevel_focus() || mixer->property_has_toplevel_focus())) { + show = true; + } - if (tact->get_active()) { + if (show) { meterbridge->show_window (); + meterbridge->present (); + meterbridge->raise (); } else { meterbridge->hide_window (NULL); } @@ -406,79 +438,37 @@ void ARDOUR_UI::toggle_editor_mixer () { bool obscuring = false; - /* currently, if windows are on different - screens then we do nothing; but in the - future we may want to bring the window - to the front or something, so I'm leaving this - variable for future use - */ - bool same_screen = true; - - if (editor && mixer) { - - /* remeber: Screen != Monitor (Screen is a separately rendered - * continuous geometry that make include 1 or more monitors. - */ - - if (editor->get_screen() != mixer->get_screen() && (mixer->get_screen() != 0) && (editor->get_screen() != 0)) { - // different screens, so don't do anything - same_screen = false; - } else { - // they are on the same screen, see if they are obscuring each other - - 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 (mixer && !mixer->not_visible() && mixer->property_has_toplevel_focus()) { - if (obscuring && same_screen) { - goto_editor_window(); - } - } else if (editor && !editor->not_visible() && editor->property_has_toplevel_focus()) { - if (obscuring && same_screen) { - goto_mixer_window(); - } - } else if (mixer && mixer->not_visible()) { - if (obscuring && same_screen) { - goto_mixer_window (); - } - } else if (editor && editor->not_visible()) { - if (obscuring && same_screen) { - goto_editor_window (); - } - } else if (obscuring && same_screen) { - //it's unclear what to do here, so just do the opposite of what we did last time (old behavior) - if (_mixer_on_top) { + + if (editor && mixer) { + if (ARDOUR_UI_UTILS::windows_overlap (editor, mixer)) { + obscuring = true; + } + } + + if (mixer && !mixer->not_visible() && mixer->property_has_toplevel_focus()) { + if (obscuring) { + goto_editor_window(); + } + } else if (editor && !editor->not_visible() && editor->property_has_toplevel_focus()) { + if (obscuring) { + goto_mixer_window(); + } + } else if (mixer && mixer->not_visible()) { + if (obscuring) { + goto_mixer_window (); + } + } else if (editor && editor->not_visible()) { + if (obscuring) { + goto_editor_window (); + } + } else if (obscuring) { + //it's unclear what to do here, so just do the opposite of what we did last time (old behavior) + if (_mixer_on_top) { goto_editor_window (); } else { goto_mixer_window (); } - } + } } void