Commit c340ed2
Hide scrollbar when menu is open
Changed files (2)
Diff
@@ -36,11 +36,15 @@ public class AbstractMenu : GLib.Object { if (tab_name == "Preview") { MenuTab.select_overview (); }+ + MainWindow.hide_scrollbar ();+ } else {+ MainWindow.show_scrollbar (); } } } - public bool menu_visibility = false;+ private bool menu_visibility = false; public SubMenu top_menu; SubMenu current_menu;@@ -219,7 +223,7 @@ public class AbstractMenu : GLib.Object { y += height; } - menu_visibility = false;+ show_menu = false; current_menu = (!) top_menu; GlyphCanvas.redraw (); }@@ -36,6 +36,8 @@ public class MainWindow : GLib.Object { /** Number of pixels per mm */ public static double units = 1; + private static double scrollbar_size = -1; + public MainWindow () { singleton = this; @@ -131,10 +133,10 @@ public class MainWindow : GLib.Object { public static void init () { singleton = new MainWindow (); } -- public static RecentFiles get_recent_files_tab () {- return file_tab;- }+ + public static RecentFiles get_recent_files_tab () { + return file_tab; + } public static void open_recent_files_tab () { // FIXME: do not idle @@ -250,8 +252,21 @@ public class MainWindow : GLib.Object { MainWindow.native_window.file_chooser (title, fc, flags); } + public static void hide_scrollbar () { + if (!is_null (MainWindow.native_window)) { + MainWindow.native_window.set_scrollbar_size (-1); + } + } + + public static void show_scrollbar () { + if (!is_null (MainWindow.native_window)) { + MainWindow.native_window.set_scrollbar_size (scrollbar_size); + } + } + public static void set_scrollbar_size (double size) { if (!is_null (MainWindow.native_window)) { + scrollbar_size = size; MainWindow.native_window.set_scrollbar_size (size); } } @@ -290,43 +305,43 @@ public class MainWindow : GLib.Object { public static LigatureList get_ligature_display () { return ligature_display; } -- public static void next_tab () {- TabBar tb = MainWindow.get_tab_bar ();- int n = tb.get_selected () + 1;- - if (!(0 <= n < tb.get_length ())) {- return;- }- - tb.select_tab (n);- }-- public static void previous_tab () {- TabBar tb = MainWindow.get_tab_bar ();- int n = tb.get_selected () - 1;-- if (!(0 <= n < tb.get_length ())) {- return;- }- - tb.select_tab (n);- }-- public static void close_tab () {- TabBar tb = MainWindow.get_tab_bar ();- int n = tb.get_selected ();-- if (!(0 <= n < tb.get_length ())) {- return;- }- - tb.close_tab (n);+ + public static void next_tab () { + TabBar tb = MainWindow.get_tab_bar (); + int n = tb.get_selected () + 1; + + if (!(0 <= n < tb.get_length ())) { + return; + } + + tb.select_tab (n); + } + + public static void previous_tab () { + TabBar tb = MainWindow.get_tab_bar (); + int n = tb.get_selected () - 1; + + if (!(0 <= n < tb.get_length ())) { + return; + } + + tb.select_tab (n); + } + + public static void close_tab () { + TabBar tb = MainWindow.get_tab_bar (); + int n = tb.get_selected (); + + if (!(0 <= n < tb.get_length ())) { + return; + } + + tb.close_tab (n); } public static void set_toolbox (Toolbox tb) { tools = tb; - }+ } } }