mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Cfg: Convert 'GUI - Window'
This commit is contained in:
@@ -55,6 +55,7 @@ public class Xog_win_itm implements Gfo_invk, Gfo_evt_itm {
|
||||
public Gfui_html Active_html_box() {return tab_mgr.Active_tab().Html_itm().Html_box();}
|
||||
public Xog_resizer Resizer() {return resizer;} private Xog_resizer resizer = new Xog_resizer();
|
||||
public Gfo_usr_dlg Usr_dlg() {return app.Usr_dlg();}
|
||||
public Xog_win_itm_cfg Cfg() {return cfg;} private final Xog_win_itm_cfg cfg = new Xog_win_itm_cfg();
|
||||
public void Refresh_win_size() {
|
||||
if (win_box != null) // NOTE: will be null when html box adjustment pref is set and application is starting
|
||||
resizer.Exec_win_resize(app, win_box.Width(), win_box.Height());
|
||||
@@ -93,7 +94,7 @@ public class Xog_win_itm implements Gfo_invk, Gfo_evt_itm {
|
||||
else if (ctx.Match(k, Invk_exit)) App__exit();
|
||||
else if (ctx.Match(k, Gfui_html.Evt_link_hover)) {
|
||||
if (this.Active_tab() != null) // NOTE: this.Active_tab() should not be null, but is null when running on raspberry pi; DATE:2016-09-23
|
||||
Xog_win_itm__prog_href_mgr.Hover(app, this.Active_tab().Wiki(), this.Active_page(), Xoh_href_gui_utl.Standardize_xowa_link(m.ReadStr("v")));
|
||||
Xog_win_itm__prog_href_mgr.Hover(app, cfg.Status__show_short_url(), this.Active_tab().Wiki(), this.Active_page(), Xoh_href_gui_utl.Standardize_xowa_link(m.ReadStr("v")));
|
||||
}
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
@@ -289,7 +290,7 @@ public class Xog_win_itm implements Gfo_invk, Gfo_evt_itm {
|
||||
win_box = kit.New_win_app("win");
|
||||
sync_cmd = win_box.Kit().New_cmd_sync(this);
|
||||
Io_url img_dir = app.Fsys_mgr().Bin_xowa_file_dir().GenSubDir_nest("app.window");
|
||||
FontAdp ui_font = app.Gui_mgr().Win_cfg().Font().XtoFontAdp();
|
||||
FontAdp ui_font = app.Gui_mgr().Win_cfg().Font().To_font();
|
||||
go_bwd_btn = Xog_win_itm_.new_btn(app, kit, win_box, img_dir, "go_bwd_btn", "go_bwd.png" );
|
||||
go_fwd_btn = Xog_win_itm_.new_btn(app, kit, win_box, img_dir, "go_fwd_btn", "go_fwd.png" );
|
||||
url_box = Xog_win_itm_.new_cbo(app, kit, win_box, ui_font, "url_box" , true);
|
||||
@@ -315,6 +316,8 @@ public class Xog_win_itm implements Gfo_invk, Gfo_evt_itm {
|
||||
if ( !Env_.Mode_testing()
|
||||
&& app.Mode().Tid_is_gui()) // only run for gui; do not run for tcp/http server; DATE:2014-05-03
|
||||
app.Usr_dlg().Gui_wkr_(new Gfo_usr_dlg__gui__swt(app, kit, prog_box, info_box, info_box));
|
||||
cfg.Init_by_app(app);
|
||||
resizer.Init_by_app(app, this);
|
||||
}
|
||||
public static String Remove_redirect_if_exists(String text) {
|
||||
// remove redirect target; EX: "A -> B" -> "A"
|
||||
|
||||
@@ -53,7 +53,7 @@ public class Xog_win_itm_ {
|
||||
public static void Font_update(Xog_win_itm win, Xol_font_info itm_font) {
|
||||
FontAdp gui_font = win.Url_box().TextMgr().Font();
|
||||
if (!itm_font.Eq(gui_font)) {
|
||||
FontAdp new_font = itm_font.XtoFontAdp();
|
||||
FontAdp new_font = itm_font.To_font();
|
||||
win.Url_box().TextMgr().Font_(new_font);
|
||||
win.Find_box().TextMgr().Font_(new_font);
|
||||
win.Prog_box().TextMgr().Font_(new_font);
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Xog_win_itm__prog_href_mgr {
|
||||
if (!String_.Eq(href, win.Prog_box().Text()))
|
||||
win.Usr_dlg().Prog_direct(href);
|
||||
}
|
||||
public static void Hover(Xoae_app app, Xowe_wiki wiki, Xoae_page page, String href) {
|
||||
public static void Hover(Xoae_app app, boolean show_status_url, Xowe_wiki wiki, Xoae_page page, String href) {
|
||||
Gfo_usr_dlg usr_dlg = app.Usr_dlg();
|
||||
if ( String_.Len_eq_0(href) // href is null / empty; occurs when hovering over empty space
|
||||
|| String_.Eq(href, "file:///")) {
|
||||
@@ -33,7 +33,6 @@ public class Xog_win_itm__prog_href_mgr {
|
||||
}
|
||||
Xoa_url url = Xoa_url.blank();
|
||||
app.Html__href_parser().Parse_as_url(url, Bry_.new_u8(href), wiki, page.Ttl().Page_txt());
|
||||
// Xoa_url url = wiki.Utl__url_parser().Parse(Bry_.new_u8(href));
|
||||
usr_dlg.Prog_direct(String_.new_u8(url.To_bry(!app.Api_root().Gui().Browser().Prog().Show_short_url(), Bool_.Y)));
|
||||
usr_dlg.Prog_direct(String_.new_u8(url.To_bry(!show_status_url, Bool_.Y)));
|
||||
}
|
||||
}
|
||||
|
||||
30
400_xowa/src/gplx/xowa/guis/views/Xog_win_itm_cfg.java
Normal file
30
400_xowa/src/gplx/xowa/guis/views/Xog_win_itm_cfg.java
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.guis.views; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*;
|
||||
public class Xog_win_itm_cfg implements Gfo_invk {
|
||||
public boolean Status__show_short_url() {return status__show_short_url;} private boolean status__show_short_url = true;
|
||||
public void Init_by_app(Xoa_app app) {
|
||||
app.Cfg().Bind_many_app(this, Cfg__status__show_short_url);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Cfg__status__show_short_url)) status__show_short_url = m.ReadYn("v");
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Cfg__status__show_short_url = "xowa.gui.window.status.show_short_url";
|
||||
}
|
||||
Reference in New Issue
Block a user