diff --git a/gtk2_ardour/ardour.bindings b/gtk2_ardour/ardour.bindings index 468f958b2b..2c0a48dcc5 100644 --- a/gtk2_ardour/ardour.bindings +++ b/gtk2_ardour/ardour.bindings @@ -70,6 +70,7 @@ (gtk_accel_path "/Editor/edit-cursor-to-range-start" "F1") (gtk_accel_path "/Editor/edit-cursor-to-range-end" "F2") +(gtk_accel_path "/Common/ToggleMaximalEditor" "F11") (gtk_accel_path "/Editor/jump-forward-to-mark" "KP_Right") (gtk_accel_path "/Editor/jump-backward-to-mark" "KP_Left") diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 4874eddc2a..466820a1f2 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -158,6 +158,8 @@ + + @@ -165,8 +167,8 @@ - - + + diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 3b1ebd47d7..c6e9a4546e 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -150,6 +150,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI void toggle_connection_editor (); void toggle_route_params_window (); void toggle_tempo_window (); + void toggle_editing_space(); gint32 select_diskstream (GdkEventButton *ev); @@ -202,6 +203,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI gint exit_on_main_window_close (GdkEventAny *); + void maximise_editing_space (); + void restore_editing_space (); + protected: friend class PublicEditor; diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index a58b38d62b..8d026a43a4 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -225,7 +225,11 @@ ARDOUR_UI::setup_transport () static_cast(&transport_frame))); transport_tearoff->Attach.connect (bind (mem_fun(*this, &ARDOUR_UI::reattach_tearoff), static_cast (&top_packer), static_cast (&transport_frame), 1)); - + transport_tearoff->Hidden.connect (bind (mem_fun(*this, &ARDOUR_UI::detach_tearoff), static_cast(&top_packer), + static_cast(&transport_frame))); + transport_tearoff->Visible.connect (bind (mem_fun(*this, &ARDOUR_UI::reattach_tearoff), static_cast (&top_packer), + static_cast (&transport_frame), 1)); + shuttle_box.set_name ("TransportButton"); goto_start_button.set_name ("TransportButton"); goto_end_button.set_name ("TransportButton"); @@ -857,3 +861,25 @@ ARDOUR_UI::sync_option_changed () session->request_slave_source (Session::JACK); } } + +void +ARDOUR_UI::maximise_editing_space () +{ + if (!editor) { + return; + } + + transport_tearoff->set_visible (false); + editor->maximise_editing_space (); +} + +void +ARDOUR_UI::restore_editing_space () +{ + if (!editor) { + return; + } + + transport_tearoff->set_visible (true); + editor->restore_editing_space (); +} diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index d2f6ea153e..bbd094245c 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -162,6 +162,8 @@ ARDOUR_UI::install_actions () /* windows visibility actions */ + ActionManager::register_toggle_action (common_actions, X_("ToggleMaximalEditor"), _("maximise editor space"), mem_fun (*this, &ARDOUR_UI::toggle_editing_space)); + ActionManager::register_action (common_actions, X_("GotoEditor"), _("Editor"), mem_fun(*this, &ARDOUR_UI::goto_editor_window)); ActionManager::register_action (common_actions, X_("GotoMixer"), _("Mixer"), mem_fun(*this, &ARDOUR_UI::goto_mixer_window)); ActionManager::register_toggle_action (common_actions, X_("ToggleSoundFileBrowser"), _("Sound File Browser"), mem_fun(*this, &ARDOUR_UI::toggle_sound_file_browser)); diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index 14b385e175..91e2d2e2e8 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -186,6 +186,20 @@ ARDOUR_UI::toggle_punch_out () toggle_session_state ("Transport", "TogglePunchOut", &Session::set_punch_out, &Session::get_punch_out); } +void +ARDOUR_UI::toggle_editing_space() +{ + Glib::RefPtr act = ActionManager::get_action ("Common", "ToggleMaximalEditor"); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + if (tact->get_active()) { + maximise_editing_space (); + } else { + restore_editing_space (); + } + } +} + void ARDOUR_UI::toggle_UseHardwareMonitoring() { diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index e7409b4329..fb80907441 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -2484,6 +2484,10 @@ Editor::setup_toolbar () &mouse_mode_tearoff->tearoff_window())); mouse_mode_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast (&toolbar_hbox), &mouse_mode_tearoff->tearoff_window(), 1)); + mouse_mode_tearoff->Hidden.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast(&toolbar_hbox), + &mouse_mode_tearoff->tearoff_window())); + mouse_mode_tearoff->Visible.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast (&toolbar_hbox), + &mouse_mode_tearoff->tearoff_window(), 1)); mouse_move_button.set_name ("MouseModeButton"); mouse_select_button.set_name ("MouseModeButton"); @@ -2684,7 +2688,10 @@ Editor::setup_toolbar () &tools_tearoff->tearoff_window())); tools_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast (&toolbar_hbox), &tools_tearoff->tearoff_window(), 0)); - + tools_tearoff->Hidden.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast(&toolbar_hbox), + &tools_tearoff->tearoff_window())); + tools_tearoff->Visible.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast (&toolbar_hbox), + &tools_tearoff->tearoff_window(), 0)); toolbar_hbox.set_spacing (8); toolbar_hbox.set_border_width (2); @@ -3684,6 +3691,7 @@ Editor::pane_allocation_handler (Allocation &alloc, Paned* which) if ((done = GTK_WIDGET(edit_pane.gobj())->allocation.width > pos)) { edit_pane.set_position (pos); + pre_maximal_pane_position = pos; } } } @@ -3968,3 +3976,20 @@ Editor::session_state_saved (string snap_name) redisplay_snapshots (); } +void +Editor::maximise_editing_space () +{ + mouse_mode_tearoff->set_visible (false); + tools_tearoff->set_visible (false); + + pre_maximal_pane_position = edit_pane.get_position(); + edit_pane.set_position (edit_pane.get_width()); +} + +void +Editor::restore_editing_space () +{ + mouse_mode_tearoff->set_visible (true); + tools_tearoff->set_visible (true); + edit_pane.set_position (pre_maximal_pane_position); +} diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index ccd1ddb0fa..07c4052add 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -310,6 +310,9 @@ class Editor : public PublicEditor void reposition_x_origin (jack_nframes_t sample); + void maximise_editing_space(); + void restore_editing_space(); + protected: void map_transport_state (); void map_position_change (jack_nframes_t); @@ -380,6 +383,7 @@ class Editor : public PublicEditor Editing::MouseMode mouse_mode; void mouse_insert (GdkEventButton *); + int pre_maximal_pane_position; void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*); Gtk::Notebook the_notebook; diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 89afb02bbf..bf184670a4 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -122,6 +122,8 @@ class PublicEditor : public Gtk::Window, public Stateful { virtual void prepare_for_cleanup () = 0; virtual void reposition_x_origin (jack_nframes_t frame) = 0; virtual void remove_last_capture () = 0; + virtual void maximise_editing_space() = 0; + virtual void restore_editing_space() = 0; sigc::signal DisplayControlChanged; sigc::signal ZoomFocusChanged; diff --git a/libs/gtkmm2ext/gtkmm2ext/tearoff.h b/libs/gtkmm2ext/gtkmm2ext/tearoff.h index 8c3ac009a8..fd36cb6416 100644 --- a/libs/gtkmm2ext/gtkmm2ext/tearoff.h +++ b/libs/gtkmm2ext/gtkmm2ext/tearoff.h @@ -34,8 +34,12 @@ class TearOff : public Gtk::HBox TearOff (Gtk::Widget& contents, bool allow_resize = false); virtual ~TearOff (); + void set_visible (bool yn); + sigc::signal Detach; sigc::signal Attach; + sigc::signal Visible; + sigc::signal Hidden; Gtk::Window& tearoff_window() { return own_window; } bool torn_off() const; @@ -51,6 +55,7 @@ class TearOff : public Gtk::HBox double drag_x; double drag_y; bool dragging; + bool _visible; gint tearoff_click (GdkEventButton*); gint close_click (GdkEventButton*); diff --git a/libs/gtkmm2ext/tearoff.cc b/libs/gtkmm2ext/tearoff.cc index 07c24dc0d5..9f915d8227 100644 --- a/libs/gtkmm2ext/tearoff.cc +++ b/libs/gtkmm2ext/tearoff.cc @@ -35,6 +35,7 @@ TearOff::TearOff (Widget& c, bool allow_resize) close_arrow (ARROW_UP, SHADOW_OUT) { dragging = false; + _visible = true; tearoff_event_box.add (tearoff_arrow); tearoff_event_box.set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK); @@ -77,6 +78,27 @@ TearOff::~TearOff () { } +void +TearOff::set_visible (bool yn) +{ + /* don't change visibility if torn off */ + + if (own_window.is_visible()) { + return; + } + + if (_visible != yn) { + _visible = yn; + if (yn) { + show_all(); + Visible (); + } else { + hide (); + Hidden (); + } + } +} + gint TearOff::tearoff_click (GdkEventButton* ev) {