changeset 21002:314245afff3a

add a menu entry for showing/hiding the editor horizontal scrollbar * file-editor.cc (show_hscrollbar): new slot; (notice_settings): check menu entry depending on settings, showing/hiding horizontal scroll bar is done in the editor tabs; (construct): add new action to the view menu; (set_shortcuts): set the shortcut for the new action * file-editor.h: new action with new slot * shortcut-manager.cc (do_init_data) initialize shortcut data for show horizontal scrollbar action
author Torsten <ttl@justmail.de>
date Mon, 28 Dec 2015 20:35:51 +0100
parents 1c91ff4cf9ec
children b51078f07886
files libgui/src/m-editor/file-editor.cc libgui/src/m-editor/file-editor.h libgui/src/shortcut-manager.cc
diffstat 3 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Mon Dec 28 19:50:49 2015 +0100
+++ b/libgui/src/m-editor/file-editor.cc	Mon Dec 28 20:35:51 2015 +0100
@@ -1262,6 +1262,11 @@
 {
   toggle_preference ("editor/show_edit_status_bar",true);
 }
+void
+file_editor::show_hscrollbar (bool)
+{
+  toggle_preference ("editor/show_hscroll_bar",true);
+}
 
 void
 file_editor::zoom_in (bool)
@@ -1356,6 +1361,8 @@
   _tool_bar->setVisible (show_it);
   show_it = settings->value ("editor/show_edit_status_bar",true).toBool ();
   _show_statusbar_action->setChecked (show_it);
+  show_it = settings->value ("editor/show_hscroll_bar",true).toBool ();
+  _show_hscrollbar_action->setChecked (show_it);
 
   set_shortcuts ();
 
@@ -1704,6 +1711,10 @@
           tr ("Show &Statusbar"), SLOT (show_statusbar (bool)));
   _show_statusbar_action->setCheckable (true);
 
+  _show_hscrollbar_action = add_action (_view_editor_menu, QIcon (),
+          tr ("Show &Horizontal Scrollbar"), SLOT (show_hscrollbar (bool)));
+  _show_hscrollbar_action->setCheckable (true);
+
   view_menu->addSeparator ();
 
   _zoom_in_action = add_action (view_menu, resource_manager::icon ("zoom-in"),
@@ -2126,6 +2137,7 @@
   shortcut_manager::set_shortcut (_show_longline_action, "editor_view:show_long_line");
   shortcut_manager::set_shortcut (_show_toolbar_action, "editor_view:show_toolbar");
   shortcut_manager::set_shortcut (_show_statusbar_action, "editor_view:show_statusbar");
+  shortcut_manager::set_shortcut (_show_hscrollbar_action, "editor_view:show_hscrollbar");
   shortcut_manager::set_shortcut (_zoom_in_action, "editor_view:zoom_in");
   shortcut_manager::set_shortcut (_zoom_out_action, "editor_view:zoom_out");
   shortcut_manager::set_shortcut (_zoom_normal_action, "editor_view:zoom_normal");
--- a/libgui/src/m-editor/file-editor.h	Mon Dec 28 19:50:49 2015 +0100
+++ b/libgui/src/m-editor/file-editor.h	Mon Dec 28 20:35:51 2015 +0100
@@ -275,6 +275,7 @@
   void show_long_line (bool);
   void show_toolbar (bool);
   void show_statusbar (bool);
+  void show_hscrollbar (bool);
   void zoom_in (bool);
   void zoom_out (bool);
   void zoom_normal (bool);
@@ -352,6 +353,7 @@
   QAction *_show_longline_action;
   QAction *_show_toolbar_action;
   QAction *_show_statusbar_action;
+  QAction *_show_hscrollbar_action;
   QAction *_zoom_in_action;
   QAction *_zoom_out_action;
   QAction *_zoom_normal_action;
--- a/libgui/src/shortcut-manager.cc	Mon Dec 28 19:50:49 2015 +0100
+++ b/libgui/src/shortcut-manager.cc	Mon Dec 28 20:35:51 2015 +0100
@@ -287,6 +287,8 @@
         QKeySequence ());
   init (tr ("Show Statusbar"), "editor_view:show_statusbar",
         QKeySequence ());
+  init (tr ("Show Horizontal Scrollbar"), "editor_view:show_hscrollbar",
+        QKeySequence ());
   init (tr ("Zoom In"), "editor_view:zoom_in", QKeySequence::ZoomIn);
   init (tr ("Zoom Out"), "editor_view:zoom_out", QKeySequence::ZoomOut);
 #if defined (Q_OS_MAC)