From 909a715332de90b666446f59adaff230c6388756 Mon Sep 17 00:00:00 2001 From: gnosygnu Date: Tue, 28 Mar 2017 07:57:28 -0400 Subject: [PATCH] Gui: Use constants for showing / hiding search / allpages --- 400_xowa/src/gplx/xowa/guis/views/Xog_win_itm.java | 14 ++++++++------ .../src/gplx/xowa/guis/views/Xog_win_itm_.java | 10 +++++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/400_xowa/src/gplx/xowa/guis/views/Xog_win_itm.java b/400_xowa/src/gplx/xowa/guis/views/Xog_win_itm.java index 70d86bc02..165fb4d4b 100644 --- a/400_xowa/src/gplx/xowa/guis/views/Xog_win_itm.java +++ b/400_xowa/src/gplx/xowa/guis/views/Xog_win_itm.java @@ -338,12 +338,14 @@ public class Xog_win_itm implements Gfo_invk, Gfo_evt_itm { .Spacing_w_(4) // sets space between buttons, or else very squished .Spacing_h_(0) // not needed since only one row, but be explicit ); - int toolbar_text_height = 24; - url_box.Layout_data_(new Swt_layout_data__grid().Grab_excess_w_(true).Align_w__fill_().Min_w_(100).Hint_h_(toolbar_text_height)); - search_box.Layout_data_(new Swt_layout_data__grid().Hint_w_(160).Hint_h_(toolbar_text_height)); - search_exec_btn.Layout_data_(new Swt_layout_data__grid().Align_w__fill_().Hint_w_(16).Hint_h_(toolbar_text_height)); - allpages_box.Layout_data_(new Swt_layout_data__grid().Hint_w_(160).Hint_h_(toolbar_text_height)); - allpages_exec_btn.Layout_data_(new Swt_layout_data__grid().Align_w__fill_().Hint_w_(20).Hint_h_(toolbar_text_height)); // force 20 width to add even more space to right-hand of screen + int toolbar_grp_h = Xog_win_itm_.Toolbar_grp_h; // WORKAROUND.SWT: need to specify height, else SWT will shrink textbox on re-layout when showing / hiding search / allpages; DATE:2017-03-28 + int toolbar_txt_w = Xog_win_itm_.Toolbar_txt_w; + int toolbar_btn_w = Xog_win_itm_.Toolbar_btn_w; + url_box.Layout_data_(new Swt_layout_data__grid().Grab_excess_w_(true).Align_w__fill_().Min_w_(100).Hint_h_(toolbar_grp_h)); + search_box.Layout_data_(new Swt_layout_data__grid().Hint_w_(toolbar_txt_w).Hint_h_(toolbar_grp_h)); + search_exec_btn.Layout_data_(new Swt_layout_data__grid().Align_w__fill_().Hint_w_(toolbar_btn_w).Hint_h_(toolbar_grp_h)); + allpages_box.Layout_data_(new Swt_layout_data__grid().Hint_w_(toolbar_txt_w).Hint_h_(toolbar_grp_h)); + allpages_exec_btn.Layout_data_(new Swt_layout_data__grid().Align_w__fill_().Hint_w_(toolbar_btn_w).Hint_h_(toolbar_grp_h)); // force 20 width to add even more space to right-hand of screen // tab / html space tab_mgr.Init_by_kit(kit); diff --git a/400_xowa/src/gplx/xowa/guis/views/Xog_win_itm_.java b/400_xowa/src/gplx/xowa/guis/views/Xog_win_itm_.java index af8e0bd70..41cdfbf7a 100644 --- a/400_xowa/src/gplx/xowa/guis/views/Xog_win_itm_.java +++ b/400_xowa/src/gplx/xowa/guis/views/Xog_win_itm_.java @@ -29,14 +29,14 @@ public class Xog_win_itm_ { public static void Show_widget(boolean show, GfuiElem box, GfuiElem btn) { int box_w, btn_w; if (show) { - box_w = 160; - btn_w = 16; + box_w = Toolbar_txt_w; + btn_w = Toolbar_btn_w; } else { box_w = 0; btn_w = 0; } - box.Layout_data_(new gplx.gfui.layouts.swts.Swt_layout_data__grid().Hint_w_(box_w).Hint_h_(24)); + box.Layout_data_(new gplx.gfui.layouts.swts.Swt_layout_data__grid().Hint_w_(box_w).Hint_h_(Toolbar_grp_h)); // WORKAROUND.SWT: need to specify height, else SWT will shrink textbox on re-layout when showing / hiding search / allpages; DATE:2017-03-28 btn.Layout_data_(new gplx.gfui.layouts.swts.Swt_layout_data__grid().Hint_w_(btn_w).Align_w__fill_()); } public static Gfui_grp new_grp(Xoae_app app, Gfui_kit kit, GfuiElem win, String id) { @@ -72,4 +72,8 @@ public class Xog_win_itm_ { } } public static String new_tiptext(Xoae_app app, int id) {return String_.new_u8(app.Usere().Lang().Msg_mgr().Val_by_id(app.Usere().Wiki(), id));} + public static final int + Toolbar_grp_h = 24 + , Toolbar_txt_w = 160 + , Toolbar_btn_w = 16; }