1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.7.1.1'

This commit is contained in:
gnosygnu
2016-07-03 22:41:56 -04:00
parent 1a4ca00c0b
commit 36584a0cc2
220 changed files with 4762 additions and 2627 deletions

View File

@@ -121,7 +121,7 @@ public class Xog_bnd_mgr {
Init_itm(Xog_cmd_itm_.Key_gui_page_view_reload , Xog_bnd_box_.Tid_browser , "key.f5");
Init_itm(Xog_cmd_itm_.Key_gui_page_view_refresh , Xog_bnd_box_.Tid_browser , "mod.s+key.f5");
Init_itm(Xog_cmd_itm_.Key_gui_page_view_save_as , Xog_bnd_box_.Tid_browser , "");
Init_itm(Xog_cmd_itm_.Key_gui_page_view_print , Xog_bnd_box_.Tid_browser , "");
Init_itm(Xog_cmd_itm_.Key_gui_page_view_print , Xog_bnd_box_.Tid_browser , "mod.c+key.p");
Init_itm(Xog_cmd_itm_.Key_gui_page_selection_select_all , Xog_bnd_box_.Tid_browser , "");
Init_itm(Xog_cmd_itm_.Key_gui_page_selection_copy , Xog_bnd_box_.Tid_browser , "");
Init_itm(Xog_cmd_itm_.Key_gui_page_selection_save_file_as , Xog_bnd_box_.Tid_browser , "");

View File

@@ -0,0 +1,59 @@
/*
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.cbks.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.cbks.*;
import gplx.xowa.xtns.gallery.*;
import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
import gplx.xowa.guis.views.*; import gplx.xowa.parsers.lnkis.*;
public class Js_img_mgr {
public static void Update_link_missing(Xog_js_wkr html_itm, String html_id) {
html_itm.Html_redlink(html_id);
}
public static void Update_img(Xoa_page page, Xog_js_wkr js_wkr, Xof_file_itm itm) {
Js_img_mgr.Update_img(page, js_wkr, itm.Html_img_wkr(), itm.Html_uid(), itm.Lnki_type(), itm.Html_elem_tid(), itm.Html_w(), itm.Html_h(), itm.Html_view_url()
, itm.Orig_w(), itm.Orig_h(), itm.Orig_ext(), itm.Html_orig_url(), itm.Orig_ttl(), itm.Html_gallery_mgr_h());
}
private static void Update_img(Xoa_page page, Xog_js_wkr js_wkr, Js_img_wkr img_wkr, int uid, byte lnki_type, byte elem_tid, int html_w, int html_h, Io_url html_view_url
, int orig_w, int orig_h, Xof_ext orig_ext, Io_url html_orig_url, byte[] lnki_ttl, int gallery_mgr_h) {
if (!page.Wiki().App().Mode().Tid_supports_js()) return; // do not update html widget unless app is gui; null ref on http server; DATE:2014-09-17
switch (elem_tid) {
case Xof_html_elem.Tid_gallery_v2:
img_wkr.Js_wkr__update_hdoc(page, js_wkr, uid, html_w, html_h, html_view_url, orig_w, orig_h, orig_ext, html_orig_url, lnki_ttl);
return;
}
String html_id = To_doc_uid(uid);
js_wkr.Html_img_update(html_id, html_view_url.To_http_file_str(), html_w, html_h);
if (Xop_lnki_type.Id_is_thumbable(lnki_type)) { // thumb needs to set cls and width
js_wkr.Html_atr_set(html_id, "class", gplx.xowa.htmls.core.wkrs.imgs.atrs.Xoh_img_cls_.Str__thumbimage);
js_wkr.Html_atr_set("xowa_file_div_" + uid, "style", "width:" + html_w + "px;");
}
switch (elem_tid) {
case Xof_html_elem.Tid_gallery:
js_wkr.Html_atr_set("xowa_gallery_div3_" + uid, "style", "margin:" + Gallery_mgr_wtr_.Calc_vpad(gallery_mgr_h, html_h) + "px auto;");
break;
case Xof_html_elem.Tid_imap:
img_wkr.Js_wkr__update_hdoc(page, js_wkr, uid, html_w, html_h, html_view_url, orig_w, orig_h, orig_ext, html_orig_url, lnki_ttl);
break;
case Xof_html_elem.Tid_vid:
String html_id_vid = "xowa_file_play_" + uid;
js_wkr.Html_atr_set(html_id_vid, "style", "width:" + html_w + "px;max-width:" + (html_w - 2) + "px;");
js_wkr.Html_atr_set(html_id_vid, "href", html_orig_url.To_http_file_str());
break;
}
}
public static String To_doc_uid(int html_uid) {return gplx.xowa.htmls.Xoh_img_mgr.Str__html_uid + Int_.To_str(html_uid);}
}

View File

@@ -0,0 +1,23 @@
/*
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.cbks.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.cbks.*;
import gplx.xowa.files.*;
public interface Js_img_wkr {
void Js_wkr__update_hdoc(Xoa_page page, Xog_js_wkr js_wkr, int html_uid, int html_w, int html_h, Io_url html_view_url
, int orig_w, int orig_h, Xof_ext orig_ext, Io_url html_orig_url, byte[] lnki_ttl);
}

View File

@@ -0,0 +1,29 @@
/*
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.cbks.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.cbks.*;
public interface Xog_js_wkr {
void Html_img_update (String uid, String src, int w, int h);
void Html_redlink (String html_uid);
void Html_atr_set (String uid, String key, String val);
void Html_elem_replace_html (String uid, String html);
void Html_elem_append_above (String uid, String html);
void Html_elem_delete (String elem_id);
void Html_gallery_packed_exec ();
void Html_popups_bind_hover_to_doc ();
}

View File

@@ -0,0 +1,31 @@
/*
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.cbks.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.cbks.*;
public class Xog_js_wkr_ {
public static final Xog_js_wkr Noop = new Xog_js_wkr__noop();
}
class Xog_js_wkr__noop implements Xog_js_wkr {
public void Html_img_update (String uid, String src, int w, int h) {}
public void Html_atr_set (String uid, String key, String val) {}
public void Html_elem_replace_html (String uid, String html) {}
public void Html_elem_append_above (String uid, String html) {}
public void Html_redlink (String html_uid) {}
public void Html_elem_delete (String elem_id) {}
public void Html_gallery_packed_exec() {}
public void Html_popups_bind_hover_to_doc() {}
}

View File

@@ -0,0 +1,38 @@
/*
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.cbks.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.cbks.*;
public class Xog_js_wkr__log implements Xog_js_wkr {
private final List_adp log_list = List_adp_.New();
public void Html_img_update (String uid, String src, int w, int h) {log_list.Add(Object_.Ary(Proc_img_update, uid, src, w, h));}
public void Html_atr_set (String uid, String key, String val) {log_list.Add(Object_.Ary(Proc_atr_set, uid, key, val));}
public void Html_redlink (String uid) {log_list.Add(Object_.Ary(Proc_redlink, uid));}
public void Html_elem_replace_html (String uid, String html) {log_list.Add(Object_.Ary(Proc_replace_html, uid, html));}
public void Html_elem_append_above (String uid, String html) {log_list.Add(Object_.Ary(Proc_append_above, uid, html));}
public void Html_elem_delete (String elem_id) {log_list.Add(Object_.Ary(Proc_delete, elem_id));}
public void Html_gallery_packed_exec() {log_list.Add(Object_.Ary(Proc_gallery_packed_exec));}
public void Html_popups_bind_hover_to_doc() {log_list.Add(Object_.Ary(Proc_popups_bind_hover_to_doc));}
public void Log__clear() {log_list.Clear();}
public int Log__len() {return log_list.Count();}
public Object[] Log__get_at(int i) {return (Object[])log_list.Get_at(i);}
public static final String
Proc_img_update = "img_update", Proc_atr_set = "atr_set", Proc_redlink = "redlink", Proc_replace_html = "replace_html"
, Proc_append_above = "append_above", Proc_delete = "delete", Proc_gallery_packed_exec = "gallery_packed_exec", Proc_popups_bind_hover_to_doc = "popups_bind_hover_to_doc"
;
}

View File

@@ -75,7 +75,7 @@ public class Xog_url_wkr {
Xof_fsdb_itm fsdb = Xof_orig_file_downloader.Make_fsdb(wiki, lnki_ttl, img_size, url_bldr);
if (!Io_mgr.Instance.ExistsFil(href_url)) {
// if (!Xof_orig_file_downloader.Get_to_url(fsdb, href_url, wiki, lnki_ttl, url_bldr))
if (!Xof_file_wkr.Show_img(fsdb, Xoa_app_.Usr_dlg(), wiki.File__bin_mgr(), wiki.File__mnt_mgr(), wiki.App().User().User_db_mgr().Cache_mgr(), wiki.File__repo_mgr(), gplx.xowa.files.gui.Xog_js_wkr_.Noop, img_size, url_bldr, page))
if (!Xof_file_wkr.Show_img(fsdb, Xoa_app_.Usr_dlg(), wiki.File__bin_mgr(), wiki.File__mnt_mgr(), wiki.App().User().User_db_mgr().Cache_mgr(), wiki.File__repo_mgr(), gplx.xowa.guis.cbks.js.Xog_js_wkr_.Noop, img_size, url_bldr, page))
return Rslt_handled;
}
gplx.core.ios.IoItmFil fil = Io_mgr.Instance.QueryFil(href_url);

View File

@@ -18,7 +18,7 @@ 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.*;
import gplx.core.threads.*;
import gplx.xowa.wikis.pages.lnkis.*;
import gplx.xowa.files.gui.*;
import gplx.xowa.guis.cbks.js.*;
public class Xog_async_wkr {
public static void Async(Xog_tab_itm tab) {Xog_async_wkr.Async(tab.Page(), tab.Html_itm());}
public static void Async(Xoae_page page, Xog_html_itm js_wkr) {

View File

@@ -18,7 +18,7 @@ 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.*;
import gplx.core.primitives.*; import gplx.core.btries.*;
import gplx.gfui.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
import gplx.xowa.guis.menus.*; import gplx.xowa.guis.menus.dom.*; import gplx.xowa.files.gui.*;
import gplx.xowa.guis.menus.*; import gplx.xowa.guis.menus.dom.*; import gplx.xowa.guis.cbks.js.*;
import gplx.langs.htmls.*; import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.js.*; import gplx.xowa.htmls.heads.*; import gplx.xowa.wikis.pages.*;
public class Xog_html_itm implements Xog_js_wkr, Gfo_invk, Gfo_evt_itm {
private Xoae_app app; private final Object thread_lock = new Object();
@@ -33,12 +33,12 @@ public class Xog_html_itm implements Xog_js_wkr, Gfo_invk, Gfo_evt_itm {
cmd_async = kit.New_cmd_async(this);
ev_mgr = new Gfo_evt_mgr(this);
}
public Gfo_evt_mgr Evt_mgr() {return ev_mgr;} private Gfo_evt_mgr ev_mgr;
public Gfo_evt_mgr Evt_mgr() {return ev_mgr;} private Gfo_evt_mgr ev_mgr;
public Xog_tab_itm Owner_tab() {return owner_tab;} private Xog_tab_itm owner_tab;
public Gfui_html Html_box() {return html_box;} private Gfui_html html_box;
public Xoh_js_cbk Js_cbk() {return js_cbk;} private Xoh_js_cbk js_cbk;
public Gfo_invk Cmd_sync() {return cmd_sync;} private Gfo_invk cmd_sync;
public Gfo_invk Cmd_async() {return cmd_async;} private Gfo_invk cmd_async;
public Gfo_invk Cmd_sync() {return cmd_sync;} private Gfo_invk cmd_sync;
public Gfo_invk Cmd_async() {return cmd_async;} private Gfo_invk cmd_async;
public void Switch_mem(Xog_html_itm comp) {
Xog_tab_itm temp_owner_tab = owner_tab; // NOTE: reparent owner_tab, since owner_tab will be switching its html_itm
this.owner_tab = comp.owner_tab;
@@ -47,6 +47,7 @@ public class Xog_html_itm implements Xog_js_wkr, Gfo_invk, Gfo_evt_itm {
public void Html_box_(Gfui_html html_box) {
this.html_box = html_box;
html_box.Html_js_cbks_add("xowa_exec", js_cbk);
Gfo_evt_mgr_.Sub_same(html_box, Gfui_html.Evt_zoom_changed, this);
}
public String Html_selected_get_src_or_empty() {return html_box.Html_js_eval_proc_as_str(Xog_js_procs.Selection__get_src_or_empty);}
public String Html_selected_get_href_or_text() {return Html_extract_text(html_box.Html_js_eval_proc_as_str(Xog_js_procs.Selection__get_href_or_text));}
@@ -188,6 +189,9 @@ public class Xog_html_itm implements Xog_js_wkr, Gfo_invk, Gfo_evt_itm {
popup_mnu = popup_mnu_mgr.Html_link();
kit.Set_mnu_popup(html_box, popup_mnu.Under_mnu());
}
private void When_zoom_changed(boolean clicks_is_positive) {
app.Api_root().Gui().Font().Adj(clicks_is_positive ? 1 : -1);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_html_img_update)) html_box.Html_js_eval_proc_as_bool (Xog_js_procs.Doc__elem_img_update , m.ReadStr("elem_id"), m.ReadStr("elem_src"), m.ReadInt("elem_width"), m.ReadInt("elem_height"));
else if (ctx.Match(k, Invk_html_elem_atr_set)) html_box.Html_js_eval_proc_as_str (Xog_js_procs.Doc__atr_set , m.ReadStr("elem_id"), m.ReadStr("atr_key"), m.ReadStr("atr_val"));
@@ -201,6 +205,7 @@ public class Xog_html_itm implements Xog_js_wkr, Gfo_invk, Gfo_evt_itm {
else if (ctx.Match(k, Invk_scroll_page_by_id)) Scroll_page_by_id(m.ReadStr("v"));
else if (ctx.Match(k, Invk_html_elem_focus)) html_box.Html_js_eval_proc_as_str(Xog_js_procs.Doc__elem_focus, m.ReadStr("v"));
else if (ctx.Match(k, GfuiElemKeys.Evt_menu_detected)) When_menu_detected();
else if (ctx.Match(k, Gfui_html.Evt_zoom_changed)) When_zoom_changed(m.ReadBool("clicks_is_positive"));
else return Gfo_invk_.Rv_unhandled;
return this;
}

View File

@@ -79,6 +79,7 @@ public class Xog_layout implements Gfo_invk {
find_bwd_btn.Adj_text(win.Find_bwd_btn());
prog_box.Adj_text(win.Prog_box());
note_box.Adj_text(win.Info_box());
win.Tab_mgr().Tab_mgr().TextMgr().Font_(win.Url_box().TextMgr().Font());
Visible_(false, win.Find_box(), win.Find_bwd_btn(), win.Find_fwd_btn(), win.Find_close_btn());
} private Xog_win_itm win;
public int Box_height_calc(Gfui_kit kit, GfuiElem url_box) {

View File

@@ -32,6 +32,7 @@ public class Xog_layout_box implements Gfo_invk {
public float Font_size() {return font_size;} public Xog_layout_box Font_size_(float v) {font_size = v; return this;} float font_size = Float_.NaN;
public FontStyleAdp Font_style() {return font_style;} public Xog_layout_box Font_style_(FontStyleAdp v) {font_style = v; return this;} FontStyleAdp font_style;
public byte Mode() {return mode;} public Xog_layout_box Mode_(byte v) {mode = v; return this;} private byte mode = Mode_rel;
public FontAdp To_font() {return Font_make(font_name, font_size, font_style);}
public void Adj_size(Rect_ref rect) {
if (w_abs > -1) rect.W_(w_abs); if (w_rel != Int_.Min_value) rect.W_(w_rel + rect.W());
if (h_abs > -1) rect.H_(h_abs); if (h_rel != Int_.Min_value) rect.H_(h_rel + rect.H());
@@ -74,7 +75,7 @@ public class Xog_layout_box implements Gfo_invk {
, Invk_size_abs_ = "size_abs_", Invk_pos_abs_ = "pos_abs_", Invk_rect_abs_ = "rect_abs_", Invk_size_rel_ = "size_rel_", Invk_pos_rel_ = "pos_rel_", Invk_rect_rel_ = "rect_rel_"
, Invk_text_ = "text_"
, Invk_font_name_ = "font_name_", Invk_font_size_ = "font_size_", Invk_font_style_ = "font_style_", Invk_mode_ = "mode_", Invk_owner = "owner";
FontAdp Font_make(String font_name, float font_size, FontStyleAdp font_style) {
private static FontAdp Font_make(String font_name, float font_size, FontStyleAdp font_style) {
String new_font_name = font_name == null ? "Arial" : font_name;
float new_font_size = Float_.IsNaN(font_size) ? 8 : font_size;
FontStyleAdp new_font_style = font_style == null ? FontStyleAdp_.Plain : font_style;

View File

@@ -197,7 +197,7 @@ public class Xog_tab_itm implements Gfo_invk {
this.tab_is_loading = false;
}
}
public void Exec_async_hdump(Xoa_app app, Xow_wiki wiki, gplx.xowa.files.gui.Xog_js_wkr js_wkr, gplx.core.threads.Gfo_thread_pool thread_pool, Xoa_page page, List_adp imgs, int[] redlink_ary) {
public void Exec_async_hdump(Xoa_app app, Xow_wiki wiki, gplx.xowa.guis.cbks.js.Xog_js_wkr js_wkr, gplx.core.threads.Gfo_thread_pool thread_pool, Xoa_page page, List_adp imgs, int[] redlink_ary) {
if (imgs.Count() > 0) {
Xof_file_wkr file_thread = new Xof_file_wkr
( wiki.File__orig_mgr(), wiki.File__bin_mgr(), wiki.File__mnt_mgr()