+ t->detach ();
+}
+
+void
+ARDOUR_UI::tabs_page_added (Widget*,guint)
+{
+ if (_tabs.get_n_pages() > 1) {
+
+ std::vector<TargetEntry> drag_target_entries;
+ drag_target_entries.push_back (TargetEntry ("tabbable"));
+
+ editor_visibility_button.drag_source_set (drag_target_entries);
+ mixer_visibility_button.drag_source_set (drag_target_entries);
+ prefs_visibility_button.drag_source_set (drag_target_entries);
+
+ editor_visibility_button.drag_source_set_icon (Gtkmm2ext::pixbuf_from_string (editor->name(),
+ Pango::FontDescription ("Sans 24"),
+ 0, 0,
+ Gdk::Color ("red")));
+ mixer_visibility_button.drag_source_set_icon (Gtkmm2ext::pixbuf_from_string (mixer->name(),
+ Pango::FontDescription ("Sans 24"),
+ 0, 0,
+ Gdk::Color ("red")));
+ prefs_visibility_button.drag_source_set_icon (Gtkmm2ext::pixbuf_from_string (rc_option_editor->name(),
+ Pango::FontDescription ("Sans 24"),
+ 0, 0,
+ Gdk::Color ("red")));
+ }
+}
+
+void
+ARDOUR_UI::tabs_page_removed (Widget*, guint)
+{
+ if (_tabs.get_n_pages() < 2) {
+ editor_visibility_button.drag_source_unset ();
+ mixer_visibility_button.drag_source_unset ();
+ prefs_visibility_button.drag_source_unset ();
+ }
+}
+
+void
+ARDOUR_UI::tabs_switch (GtkNotebookPage*, guint page)
+{
+ if (editor && (page == (guint) _tabs.page_num (editor->contents()))) {
+ editor_visibility_button.set_active_state (Gtkmm2ext::ImplicitActive);
+
+ if (mixer && (mixer->tabbed() || mixer->tabbed_by_default())) {
+ mixer_visibility_button.set_active_state (Gtkmm2ext::Off);
+ }
+
+ if (rc_option_editor && (rc_option_editor->tabbed() || rc_option_editor->tabbed_by_default())) {
+ prefs_visibility_button.set_active_state (Gtkmm2ext::Off);
+ }
+ } else if (mixer && (page == (guint) _tabs.page_num (mixer->contents()))) {
+
+ if (editor && (editor->tabbed() || editor->tabbed_by_default())) {
+ editor_visibility_button.set_active_state (Gtkmm2ext::Off);
+ }
+
+ mixer_visibility_button.set_active_state (Gtkmm2ext::ImplicitActive);
+
+ if (rc_option_editor && (rc_option_editor->tabbed() || rc_option_editor->tabbed_by_default())) {
+ prefs_visibility_button.set_active_state (Gtkmm2ext::Off);
+ }
+
+ } else if (page == (guint) _tabs.page_num (rc_option_editor->contents())) {
+
+ if (editor && (editor->tabbed() || editor->tabbed_by_default())) {
+ editor_visibility_button.set_active_state (Gtkmm2ext::Off);
+ }
+
+ if (mixer && (mixer->tabbed() || mixer->tabbed_by_default())) {
+ mixer_visibility_button.set_active_state (Gtkmm2ext::Off);
+ }
+
+ prefs_visibility_button.set_active_state (Gtkmm2ext::ImplicitActive);
+ }
+
+}
+
+void
+ARDOUR_UI::tabbable_state_change (Tabbable& t)
+{
+ std::vector<std::string> insensitive_action_names;
+ std::vector<std::string> sensitive_action_names;
+ std::vector<std::string> active_action_names;
+ std::vector<std::string> inactive_action_names;
+ Glib::RefPtr<Action> action;
+ std::string downcased_name = downcase (t.name());
+ enum ViewState {
+ Tabbed,
+ Windowed,
+ Hidden
+ };
+ ViewState vs;
+
+ if (t.tabbed()) {
+
+ insensitive_action_names.push_back (string_compose ("attach-%1", downcased_name));
+ sensitive_action_names.push_back (string_compose ("show-%1", downcased_name));
+ sensitive_action_names.push_back (string_compose ("detach-%1", downcased_name));
+ sensitive_action_names.push_back (string_compose ("hide-%1", downcased_name));
+
+ vs = Tabbed;
+
+ } else if (t.tabbed_by_default ()) {
+
+ insensitive_action_names.push_back (string_compose ("attach-%1", downcased_name));
+ insensitive_action_names.push_back (string_compose ("hide-%1", downcased_name));
+ sensitive_action_names.push_back (string_compose ("show-%1", downcased_name));
+ sensitive_action_names.push_back (string_compose ("detach-%1", downcased_name));
+
+ vs = Hidden;
+
+ } else if (t.window_visible()) {
+
+ insensitive_action_names.push_back (string_compose ("detach-%1", downcased_name));
+ sensitive_action_names.push_back (string_compose ("show-%1", downcased_name));
+ sensitive_action_names.push_back (string_compose ("attach-%1", downcased_name));
+ sensitive_action_names.push_back (string_compose ("hide-%1", downcased_name));
+
+ active_action_names.push_back (string_compose ("show-%1", downcased_name));
+ inactive_action_names.push_back (string_compose ("hide-%1", downcased_name));
+
+ vs = Windowed;