Browse Source

Added menu item to toggle Tabs visibility.

merge-requests/365/head
Physiix 9 years ago
parent
commit
3a64bcad9b
  1. 1
      src/files.h
  2. 4
      src/menu.cc
  3. 6
      src/notebook.cc
  4. 3
      src/notebook.h
  5. 3
      src/window.cc

1
src/files.h

@ -155,6 +155,7 @@ R"RAW(
R"RAW(
"close_tab": "<primary>w",
"window_toggle_split": "",
"window_toggle_tabs": "",
"window_clear_terminal": ""
},
"project": {

4
src/menu.cc

@ -443,6 +443,10 @@ const Glib::ustring menu_xml= R"RAW(<interface>
<attribute name='label' translatable='yes'>_Toggle _Split</attribute>
<attribute name='action'>app.window_toggle_split</attribute>
</item>
<item>
<attribute name='label' translatable='yes'>_Toggle _Tabs _Visibility</attribute>
<attribute name='action'>app.window_toggle_tabs</attribute>
</item>
</section>
<section>
<item>

6
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())

3
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<std::unique_ptr<TabLabel> > 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);

3
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() {

Loading…
Cancel
Save