13
0

Tidy up Window menu a bit; use ToggleActions for all relevant things, cleanup editor/mixer options a bit.

git-svn-id: svn://localhost/ardour2/branches/3.0@7828 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-09-22 00:41:25 +00:00
parent 4d908a12fd
commit 096f146d94
8 changed files with 58 additions and 18 deletions

View File

@ -433,9 +433,8 @@
</menu>
</menu>
<menu action = 'WindowMenu'>
<menuitem action='goto-editor'/>
<menuitem action='goto-mixer'/>
<menuitem action='toggle-editor-mixer-on-top'/>
<menuitem action='toggle-mixer'/>
<menuitem action='toggle-mixer-on-top'/>
<separator/>

View File

@ -220,7 +220,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
session_loaded = false;
last_speed_displayed = -1.0f;
ignore_dual_punch = false;
_mixer_on_top = false;
original_big_clock_width = -1;
original_big_clock_height = -1;
original_big_clock_font_size = 0;

View File

@ -266,8 +266,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void goto_editor_window ();
void goto_mixer_window ();
void toggle_editor_mixer_on_top ();
bool _mixer_on_top;
void toggle_mixer_window ();
void toggle_mixer_on_top ();
Gtk::ToggleButton preroll_button;
Gtk::ToggleButton postroll_button;

View File

@ -93,7 +93,6 @@ ARDOUR_UI::goto_editor_window ()
editor->show_window ();
editor->present ();
_mixer_on_top = false;
flush_pending ();
}
@ -102,17 +101,51 @@ ARDOUR_UI::goto_mixer_window ()
{
mixer->show_window ();
mixer->present ();
_mixer_on_top = true;
flush_pending ();
}
void
ARDOUR_UI::toggle_editor_mixer_on_top ()
ARDOUR_UI::toggle_mixer_window ()
{
if (_mixer_on_top) {
goto_editor_window ();
} else {
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
if (!act) {
return;
}
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
if (tact->get_active()) {
goto_mixer_window ();
} else {
mixer->hide ();
}
}
void
ARDOUR_UI::toggle_mixer_on_top ()
{
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer-on-top"));
if (!act) {
return;
}
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
if (tact->get_active()) {
/* Toggle the mixer to `visible' if required */
act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
if (act) {
tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
if (!tact->get_active()) {
tact->set_active ();
}
}
goto_mixer_window ();
} else {
goto_editor_window ();
}
}

View File

@ -214,9 +214,8 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_toggle_action (common_actions, X_("KeepTearoffs"), _("Toolbars when Maximised"), mem_fun (*this, &ARDOUR_UI::toggle_keep_tearoffs));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::register_action (common_actions, X_("goto-editor"), _("Show Editor"), sigc::mem_fun(*this, &ARDOUR_UI::goto_editor_window));
ActionManager::register_action (common_actions, X_("goto-mixer"), _("Show Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::goto_mixer_window));
ActionManager::register_action (common_actions, X_("toggle-editor-mixer-on-top"), _("Toggle Editor Mixer on Top"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_editor_mixer_on_top));
ActionManager::register_toggle_action (common_actions, X_("toggle-mixer"), _("Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_window));
ActionManager::register_toggle_action (common_actions, X_("toggle-mixer-on-top"), _("Mixer on Top"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_on_top));
ActionManager::register_toggle_action (common_actions, X_("ToggleRCOptionsEditor"), _("Preferences"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_rc_options_window));
ActionManager::register_toggle_action (common_actions, X_("ToggleSessionOptionsEditor"), _("Properties"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_session_options_window));
act = ActionManager::register_toggle_action (common_actions, X_("ToggleInspector"), _("Tracks and Busses"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_route_params_window));

View File

@ -42,7 +42,9 @@ 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")));
mixer->signal_unmap().connect (sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/toggle-mixer-on-top")));
return 0;
}

View File

@ -542,7 +542,7 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "toggle-rhythm-ferret", _("Rhythm Ferret..."), sigc::mem_fun(*this, &Editor::show_rhythm_ferret));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-log-window", _("Log"),
act = ActionManager::register_toggle_action (editor_actions, "toggle-log-window", _("Log"),
sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::toggle_errors));
ActionManager::session_sensitive_actions.push_back (act);

View File

@ -96,6 +96,7 @@ UI::UI (string namestr, int *argc, char ***argv)
errors = new TextViewer (800,600);
errors->text().set_editable (false);
errors->text().set_name ("ErrorText");
errors->signal_unmap().connect (sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), X_("<Actions>/Editor/toggle-log-window")));
Glib::set_application_name(namestr);
@ -571,7 +572,14 @@ UI::process_error_message (Transmitter::Channel chn, const char *str)
void
UI::toggle_errors ()
{
if (!errors->is_visible()) {
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-log-window"));
if (!act) {
return;
}
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
if (tact->get_active()) {
errors->set_position (WIN_POS_MOUSE);
errors->show ();
} else {