From 3a64bcad9b016e531223f808fa26048eeecb8803 Mon Sep 17 00:00:00 2001 From: Physiix Date: Wed, 15 Feb 2017 19:46:42 -0500 Subject: [PATCH] Added menu item to toggle Tabs visibility. --- src/files.h | 1 + src/menu.cc | 4 ++++ src/notebook.cc | 6 ++++++ src/notebook.h | 3 +++ src/window.cc | 3 +++ 5 files changed, 17 insertions(+) diff --git a/src/files.h b/src/files.h index 2432ad3..bb34238 100644 --- a/src/files.h +++ b/src/files.h @@ -155,6 +155,7 @@ R"RAW( R"RAW( "close_tab": "w", "window_toggle_split": "", + "window_toggle_tabs": "", "window_clear_terminal": "" }, "project": { diff --git a/src/menu.cc b/src/menu.cc index 585cbf0..7c7147a 100644 --- a/src/menu.cc +++ b/src/menu.cc @@ -443,6 +443,10 @@ const Glib::ustring menu_xml= R"RAW( _Toggle _Split app.window_toggle_split + + _Toggle _Tabs _Visibility + app.window_toggle_tabs +
diff --git a/src/notebook.cc b/src/notebook.cc index 48ef5b8..4d361f6 100644 --- a/src/notebook.cc +++ b/src/notebook.cc @@ -604,6 +604,12 @@ void Notebook::toggle_split() { } split=!split; } +void Notebook::toggle_tabs() { + Notebook::tabs_visible =! Notebook::tabs_visible; + //Show / Hide tabs for each notbook. + for(auto& notebook : Notebook::notebooks) + notebook.set_show_tabs(Notebook::tabs_visible); +} boost::filesystem::path Notebook::get_current_folder() { if(!Directories::get().path.empty()) diff --git a/src/notebook.h b/src/notebook.h index 7f8074d..4a19833 100644 --- a/src/notebook.h +++ b/src/notebook.h @@ -46,6 +46,8 @@ public: void next(); void previous(); void toggle_split(); + /// Hide/Show tabs. + void toggle_tabs(); boost::filesystem::path get_current_folder(); Gtk::Label status_location; @@ -79,6 +81,7 @@ private: std::vector > tab_labels; bool split=false; + bool tabs_visible = true; //Flag set to true when the tabs are visible. size_t last_index=-1; void set_current_view(Source::View *view); diff --git a/src/window.cc b/src/window.cc index 0699d04..a73ae40 100644 --- a/src/window.cc +++ b/src/window.cc @@ -1183,6 +1183,9 @@ void Window::set_menu_actions() { menu.add_action("window_clear_terminal", [this] { Terminal::get().clear(); }); + menu.add_action("window_toggle_tabs", [this] { + Notebook::get().toggle_tabs(); + }); } void Window::activate_menu_items() {