mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Cfg: Convert rest of pages
This commit is contained in:
@@ -30,6 +30,11 @@ public class Xoa_sys_cfg implements Gfo_invk {
|
||||
}
|
||||
return this;
|
||||
} private byte[] lang_key = Xol_lang_itm_.Key_en;
|
||||
public void Init_by_app(Xoa_app app) {
|
||||
app.Cfg().Type_mgr().Lists__add("list:" + Cfg__lang, Options_list_lang_.new_());
|
||||
app.Cfg().Bind_many_app(this, Cfg__lang);
|
||||
}
|
||||
private static final String Cfg__lang = "xowa.gui.lang.name";
|
||||
public int Options_version() {return options_version;} public Xoa_sys_cfg Options_version_(int v) {options_version = v; return this;} private int options_version = 1;
|
||||
public Keyval[] Options_lang_list() {if (options_lang_list == null) options_lang_list = Options_list_lang_.new_(); return options_lang_list;} private Keyval[] options_lang_list;
|
||||
public long Free_mem_when() {return free_mem_when;} long free_mem_when;
|
||||
@@ -42,6 +47,7 @@ public class Xoa_sys_cfg implements Gfo_invk {
|
||||
else if (ctx.Match(k, Invk_lang_list)) return Options_lang_list();
|
||||
else if (ctx.Match(k, Invk_options_version)) return options_version;
|
||||
else if (ctx.Match(k, Invk_options_version_)) options_version = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Cfg__lang)) Lang_(m.ReadBry("v"));
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ public class Xoapi_root implements Gfo_invk {
|
||||
public Xoapi_html Html() {return html_api;} private final Xoapi_html html_api = new Xoapi_html();
|
||||
public Xoapi_bldr Bldr() {return bldr_api;} private final Xoapi_bldr bldr_api = new Xoapi_bldr();
|
||||
public Xoapi_usr Usr() {return usr_api;} private final Xoapi_usr usr_api = new Xoapi_usr();
|
||||
public Xoapi_special Special() {return special_api;} private final Xoapi_special special_api = new Xoapi_special();
|
||||
public Xoapi_xtns Xtns() {return xtns_api;} private final Xoapi_xtns xtns_api = new Xoapi_xtns();
|
||||
public Xoapi_app_wikis Wikis() {return app_wikis;} private final Xoapi_app_wikis app_wikis = new Xoapi_app_wikis();
|
||||
public String Test_str() {return test_str;} public void Test_str_(String v) {test_str = v;} private String test_str; // TEST
|
||||
@@ -63,7 +62,6 @@ public class Xoapi_root implements Gfo_invk {
|
||||
else if (ctx.Match(k, Invk_gui)) return gui_api;
|
||||
else if (ctx.Match(k, Invk_html)) return html_api;
|
||||
else if (ctx.Match(k, Invk_usr)) return usr_api;
|
||||
else if (ctx.Match(k, Invk_special)) return special_api;
|
||||
else if (ctx.Match(k, Invk_xtns)) return xtns_api;
|
||||
else if (ctx.Match(k, Invk_exec)) Exec(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_wikis)) return app_wikis;
|
||||
@@ -74,7 +72,7 @@ public class Xoapi_root implements Gfo_invk {
|
||||
private static final String
|
||||
Invk_exec = "exec"
|
||||
, Invk_app = "app", Invk_addon = "addon"
|
||||
, Invk_bldr = "bldr", Invk_nav = "nav", Invk_gui = "gui", Invk_html = "html", Invk_usr = "usr", Invk_special = "special", Invk_xtns = "xtns"
|
||||
, Invk_bldr = "bldr", Invk_nav = "nav", Invk_gui = "gui", Invk_html = "html", Invk_usr = "usr", Invk_xtns = "xtns"
|
||||
, Invk_test_str = "test_str", Invk_test_str_ = "test_str_"
|
||||
, Invk_wikis = "wikis"
|
||||
;
|
||||
|
||||
@@ -21,17 +21,11 @@ public class Xoapi_addon implements Gfo_invk {
|
||||
public void Ctor_by_app(Xoa_app app) {}
|
||||
public Xoapi_addon_search Search() {return search;} private final Xoapi_addon_search search = new Xoapi_addon_search();
|
||||
public Xoapi_addon_bldr Bldr() {return bldr;} private final Xoapi_addon_bldr bldr = new Xoapi_addon_bldr();
|
||||
public boolean Wikis__ctgs__hidden_enabled() {return wikis__ctgs__hidden_enabled;} private boolean wikis__ctgs__hidden_enabled = false;
|
||||
public boolean App__scripting__enabled() {return app__scripting__enabled;} private boolean app__scripting__enabled = false;
|
||||
public String App__update__restart_cmd() {return app__update__restart_cmd;} private String app__update__restart_cmd = "";
|
||||
public String App__update__update_db_src() {return app__update__update_db_src;} private String app__update__update_db_src = "http://xowa.org";
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk__search)) return search;
|
||||
else if (ctx.Match(k, Invk__bldr)) return bldr;
|
||||
else if (ctx.Match(k, Invk__wikis__ctgs__hidden_enabled)) return Yn.To_str(wikis__ctgs__hidden_enabled);
|
||||
else if (ctx.Match(k, Invk__wikis__ctgs__hidden_enabled_)) wikis__ctgs__hidden_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk__app__scripting__enabled)) return Yn.To_str(app__scripting__enabled);
|
||||
else if (ctx.Match(k, Invk__app__scripting__enabled_)) app__scripting__enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk__app__update__restart_cmd)) return app__update__restart_cmd;
|
||||
else if (ctx.Match(k, Invk__app__update__restart_cmd_)) app__update__restart_cmd = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk__app__update__update_db_src)) return app__update__update_db_src;
|
||||
@@ -40,10 +34,6 @@ public class Xoapi_addon implements Gfo_invk {
|
||||
return this;
|
||||
}
|
||||
private static final String Invk__search = "search", Invk__bldr = "bldr"
|
||||
, Invk__wikis__ctgs__hidden_enabled = "wikis__ctgs__hidden_enabled"
|
||||
, Invk__wikis__ctgs__hidden_enabled_ = "wikis__ctgs__hidden_enabled_"
|
||||
, Invk__app__scripting__enabled = "app__scripting__enabled"
|
||||
, Invk__app__scripting__enabled_ = "app__scripting__enabled_"
|
||||
, Invk__app__update__restart_cmd = "app__update__restart_cmd"
|
||||
, Invk__app__update__restart_cmd_ = "app__update__restart_cmd_"
|
||||
, Invk__app__update__update_db_src = "app__update__update_db_src"
|
||||
|
||||
@@ -22,19 +22,14 @@ public class Xoapi_html implements Gfo_invk {
|
||||
page.Ctor_by_app(app);
|
||||
}
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
tidy.Init_by_kit(app);
|
||||
modules.Init_by_kit(app);
|
||||
}
|
||||
public Xoapi_tidy Tidy() {return tidy;} private final Xoapi_tidy tidy = new Xoapi_tidy();
|
||||
public Xoapi_modules Modules() {return modules;} private final Xoapi_modules modules = new Xoapi_modules();
|
||||
public Xoapi_skins Skins() {return skins;} private final Xoapi_skins skins = new Xoapi_skins();
|
||||
public Xoapi_page Page() {return page;} private final Xoapi_page page = new Xoapi_page();
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_tidy)) return tidy;
|
||||
else if (ctx.Match(k, Invk_modules)) return modules;
|
||||
else if (ctx.Match(k, Invk_skins)) return skins;
|
||||
if (ctx.Match(k, Invk_modules)) return modules;
|
||||
else if (ctx.Match(k, Invk_page)) return page;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
private static final String Invk_tidy = "tidy", Invk_modules = "modules", Invk_skins = "skins", Invk_page = "page";
|
||||
private static final String Invk_modules = "modules", Invk_page = "page";
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
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.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
|
||||
import gplx.xowa.apps.apis.xowa.specials.*;
|
||||
public class Xoapi_special implements Gfo_invk {
|
||||
public void Ctor_by_app(Xoae_app app) {
|
||||
}
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
}
|
||||
public Xoapi_search Search() {return search;} private Xoapi_search search = new Xoapi_search();
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_search)) return search;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
private static final String Invk_search = "search";
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import gplx.xowa.apps.apis.xowa.xtns.*;
|
||||
public class Xoapi_xtns implements Gfo_invk {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
scribunto.Init_by_kit(app);
|
||||
wikibase.Init_by_app(app);
|
||||
}
|
||||
public Xoapi_scribunto Scribunto() {return scribunto;} private final Xoapi_scribunto scribunto = new Xoapi_scribunto();
|
||||
public Xoapi_wikibase Wikibase() {return wikibase;} private final Xoapi_wikibase wikibase = new Xoapi_wikibase();
|
||||
|
||||
@@ -19,15 +19,9 @@ package gplx.xowa.apps.apis.xowa.addons; import gplx.*; import gplx.xowa.*; impo
|
||||
import gplx.xowa.apps.apis.xowa.addons.bldrs.*;
|
||||
public class Xoapi_addon_bldr implements Gfo_invk {
|
||||
public Xoapi_central_api Central() {return central;} private final Xoapi_central_api central = new Xoapi_central_api();
|
||||
public Xoapi_sync_api Sync() {return sync;} private final Xoapi_sync_api sync = new Xoapi_sync_api();
|
||||
public boolean Wikis__ctgs__hidden_enabled() {return wikis__ctgs__hidden_enabled;} private boolean wikis__ctgs__hidden_enabled = false;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk__central)) return central;
|
||||
else if (ctx.Match(k, Invk__sync)) return sync;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
private static final String
|
||||
Invk__central = "central"
|
||||
, Invk__sync = "sync"
|
||||
;
|
||||
private static final String Invk__central = "central";
|
||||
}
|
||||
|
||||
@@ -19,18 +19,12 @@ package gplx.xowa.apps.apis.xowa.addons; import gplx.*; import gplx.xowa.*; impo
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.domains.crts.*;
|
||||
import gplx.xowa.apps.apis.xowa.addons.searchs.*;
|
||||
public class Xoapi_addon_search implements Gfo_invk {
|
||||
public Xoapi_addon_search() {}
|
||||
public Xoapi_url_bar Url_bar() {return url_bar;} private final Xoapi_url_bar url_bar = new Xoapi_url_bar();
|
||||
@gplx.Internal protected Xoapi_search_box Search_box() {return search_box;} private final Xoapi_search_box search_box = new Xoapi_search_box();
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk__url_bar)) return url_bar;
|
||||
else if (ctx.Match(k, Invk__search_box)) return search_box;
|
||||
if (ctx.Match(k, Invk__search_box)) return search_box;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
private static final String
|
||||
Invk__url_bar = "url_bar"
|
||||
, Invk__search_box = "search_box"
|
||||
;
|
||||
private static final String Invk__search_box = "search_box";
|
||||
}
|
||||
class Xoapi_search_box implements Gfo_invk {
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
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.apps.apis.xowa.addons.bldrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.addons.*;
|
||||
public class Xoapi_sync_api implements Gfo_invk {
|
||||
private final Xopg_match_mgr auto_page_matcher = new Xopg_match_mgr();
|
||||
public Xoapi_sync_api() {
|
||||
this.Auto_scope_("*:Main_Page");
|
||||
}
|
||||
public boolean Manual_enabled() {return manual_enabled;} private boolean manual_enabled = false;
|
||||
public boolean Auto_enabled() {return auto_enabled;} private boolean auto_enabled = false;
|
||||
public int Auto_interval() {return auto_interval;} private int auto_interval = 60 * 24; // in minutes
|
||||
public String Auto_scope() {return auto_scope;} private String auto_scope;
|
||||
private void Auto_scope_(String v) {
|
||||
this.auto_scope = v;
|
||||
auto_page_matcher.Set(v);
|
||||
}
|
||||
public Xopg_match_mgr Auto_page_matcher() {return auto_page_matcher;}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk__manual_enabled)) return Yn.To_str(manual_enabled);
|
||||
else if (ctx.Match(k, Invk__manual_enabled_)) manual_enabled = m.ReadBool("v");
|
||||
else if (ctx.Match(k, Invk__auto_enabled)) return Yn.To_str(auto_enabled);
|
||||
else if (ctx.Match(k, Invk__auto_enabled_)) auto_enabled = m.ReadBool("v");
|
||||
else if (ctx.Match(k, Invk__auto_interval)) return Int_.To_str(auto_interval);
|
||||
else if (ctx.Match(k, Invk__auto_interval_)) auto_interval = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk__auto_scope)) return auto_scope;
|
||||
else if (ctx.Match(k, Invk__auto_scope_)) Auto_scope_(m.ReadStr("v"));
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
Invk__manual_enabled = "manual_enabled" , Invk__manual_enabled_ = "manual_enabled_"
|
||||
, Invk__auto_enabled = "auto_enabled" , Invk__auto_enabled_ = "auto_enabled_"
|
||||
, Invk__auto_interval = "auto_interval" , Invk__auto_interval_ = "auto_interval_"
|
||||
, Invk__auto_scope = "auto_scope" , Invk__auto_scope_ = "auto_scope_"
|
||||
;
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
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.apps.apis.xowa.addons.searchs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.addons.*;
|
||||
import gplx.xowa.addons.wikis.searchs.searchers.*; import gplx.xowa.addons.wikis.searchs.searchers.crts.*;
|
||||
public class Xoapi_url_bar implements Gfo_invk, Gfo_evt_mgr_owner {
|
||||
public Xoapi_url_bar() {
|
||||
this.evt_mgr = new Gfo_evt_mgr(this);
|
||||
}
|
||||
public Gfo_evt_mgr Evt_mgr() {return evt_mgr;} private final Gfo_evt_mgr evt_mgr;
|
||||
public boolean Enabled() {return enabled;} private boolean enabled = true;
|
||||
public int Search_mode() {return search_mode;} private int search_mode = Xoapi_search_mode_.Tid__title_word;
|
||||
public int Max_results() {return max_results;} private int max_results = 10;
|
||||
public boolean Auto_wildcard() {return auto_wildcard;} private boolean auto_wildcard = true;
|
||||
public Srch_ns_mgr Ns_mgr() {return ns_mgr;} private final Srch_ns_mgr ns_mgr = new Srch_ns_mgr().Add_main_if_empty();
|
||||
public Srch_crt_scanner_syms Syms() {return syms;} private Srch_crt_scanner_syms syms = Srch_search_mgr.Scanner_syms;
|
||||
public Keyval[] Operators() {return symbols;} private Keyval[] symbols = Keyval_.Ary_empty;
|
||||
public int Visible_rows() {return visible_rows;} private int visible_rows = 10;
|
||||
public int Jump_len() {return jump_len;} private int jump_len = 5;
|
||||
private void Ns_ids_(String s) {
|
||||
int[] ns_ids = Int_.Ary_empty;
|
||||
if (String_.Eq(s, "*")) {} // leave as int[0]; ns_mgr will interpret as wildcard
|
||||
else {
|
||||
ns_ids = Int_.Ary_parse(s, ",");
|
||||
}
|
||||
ns_mgr.Add_by_int_ids(ns_ids);
|
||||
Gfo_evt_mgr_.Pub(this, Evt__ns_ids_changed);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk__enabled)) return Yn.To_str(enabled);
|
||||
else if (ctx.Match(k, Invk__enabled_)) enabled = m.ReadBool("v");
|
||||
else if (ctx.Match(k, Invk__search_mode)) return Xoapi_search_mode_.To_str(search_mode);
|
||||
else if (ctx.Match(k, Invk__search_mode_)) search_mode = Xoapi_search_mode_.To_int(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk__max_results)) return Int_.To_str(max_results);
|
||||
else if (ctx.Match(k, Invk__max_results_)) max_results = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk__auto_wildcard)) return Yn.To_str(auto_wildcard);
|
||||
else if (ctx.Match(k, Invk__auto_wildcard_)) auto_wildcard = m.ReadBool("v");
|
||||
else if (ctx.Match(k, Invk__ns_ids)) return Int_.To_str(ns_mgr.To_int_ary(), "|");
|
||||
else if (ctx.Match(k, Invk__ns_ids_)) Ns_ids_(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk__symbols)) return String_.new_u8(syms.To_bry());
|
||||
else if (ctx.Match(k, Invk__symbols_)) syms.Parse(m.ReadBry("v"));
|
||||
else if (ctx.Match(k, Invk__visible_rows)) return Int_.To_str(visible_rows);
|
||||
else if (ctx.Match(k, Invk__visible_rows_)) {visible_rows = m.ReadInt("v"); Gfo_evt_mgr_.Pub_val(this, Evt__visible_rows_changed, visible_rows);}
|
||||
else if (ctx.Match(k, Invk__jump_len)) return Int_.To_str(jump_len);
|
||||
else if (ctx.Match(k, Invk__jump_len_)) {jump_len = m.ReadInt("v"); Gfo_evt_mgr_.Pub_val(this, Evt__jump_len_changed, jump_len);}
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
Invk__enabled = "enabled" , Invk__enabled_ = "enabled_"
|
||||
, Invk__search_mode = "search_mode" , Invk__search_mode_ = "search_mode_"
|
||||
, Invk__max_results = "max_results" , Invk__max_results_ = "max_results_"
|
||||
, Invk__auto_wildcard = "auto_wildcard" , Invk__auto_wildcard_ = "auto_wildcard_"
|
||||
, Invk__ns_ids = "ns_ids" , Invk__ns_ids_ = "ns_ids_"
|
||||
, Invk__symbols = "symbols" , Invk__symbols_ = "symbols_"
|
||||
, Invk__visible_rows = "visible_rows" , Invk__visible_rows_ = "visible_rows_"
|
||||
, Invk__jump_len = "jump_len" , Invk__jump_len_ = "jump_len_"
|
||||
;
|
||||
public static final String
|
||||
Evt__visible_rows_changed = "visible_rows_changed"
|
||||
, Evt__jump_len_changed = "jump_len_changed"
|
||||
, Evt__ns_ids_changed = "ns_ids_changed"
|
||||
;
|
||||
}
|
||||
@@ -17,92 +17,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.apps.apis.xowa.bldrs.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.bldrs.*;
|
||||
import gplx.core.ios.*; import gplx.core.ios.streams.*;
|
||||
import gplx.xowa.wikis.data.*; import gplx.xowa.apps.apis.xowa.bldrs.imports.page_ranks.*;
|
||||
import gplx.xowa.wikis.data.*;
|
||||
public class Xoapi_import implements Gfo_invk {
|
||||
public Xoapi_page_rank Page_rank() {return page_rank;} private final Xoapi_page_rank page_rank = new Xoapi_page_rank();
|
||||
public long Layout_all_max() {return layout_all_max;} private long layout_all_max = 0; // disable by default; may set to 200 MB in future
|
||||
public long Layout_text_max() {return layout_text_max;} private long layout_text_max = Io_size_.To_long_by_int_mb(1500); // 1.0 GB
|
||||
public long Layout_html_max() {return layout_html_max;} private long layout_html_max = Io_size_.To_long_by_int_mb(1500); // 1.0 GB
|
||||
public long Layout_file_max() {return layout_file_max;} private long layout_file_max = Io_size_.To_long_by_int_mb(1500); // 1.0 GB
|
||||
public long Cat_link_db_max() {return cat_link_db_max;} private long cat_link_db_max = Io_size_.To_long_by_int_mb(1500); // 3.6 GB; v1
|
||||
public long Text_db_max() {return text_db_max;} private long text_db_max = Io_size_.To_long_by_int_mb(1500); // 3.0 GB; v1
|
||||
public long Html_db_max() {return html_db_max;} private long html_db_max = Io_size_.To_long_by_int_mb(1500); // 3.0 GB; v2; use same as text
|
||||
public long File_db_max() {return file_db_max;} private long file_db_max = Io_size_.To_long_by_int_mb(1500); // 3.2 GB; v2
|
||||
public byte[] Ns_file_map() {return ns_file_map;} private byte[] ns_file_map = Ns_file_map__each;
|
||||
public byte Zip_tid_text() {return zip_tid_text;} private byte zip_tid_text = Io_stream_tid_.Tid__gzip;
|
||||
public byte Zip_tid_html() {return zip_tid_html;} private byte zip_tid_html = Io_stream_tid_.Tid__gzip;
|
||||
public boolean Hzip_enabled() {return hzip_enabled;} private boolean hzip_enabled = Bool_.Y;
|
||||
public boolean Hzip_mode_is_b256() {return hzip_mode_is_b256;} private boolean hzip_mode_is_b256 = Bool_.Y;
|
||||
public String User_name() {return user_name;} private String user_name = "anonymous";
|
||||
public Xowd_core_db_props New_props(String domain_str, long dump_file_size) {
|
||||
Xow_db_layout layout_text, layout_html, layout_file;
|
||||
if (dump_file_size < layout_all_max)
|
||||
layout_text = layout_html = layout_file = Xow_db_layout.Itm_all;
|
||||
else {
|
||||
layout_text = dump_file_size < layout_text_max ? Xow_db_layout.Itm_few : Xow_db_layout.Itm_lot;
|
||||
layout_html = dump_file_size < layout_html_max ? Xow_db_layout.Itm_few : Xow_db_layout.Itm_lot;
|
||||
layout_file = dump_file_size < layout_file_max ? Xow_db_layout.Itm_few : Xow_db_layout.Itm_lot;
|
||||
}
|
||||
return new Xowd_core_db_props(2, layout_text, layout_html, layout_file, zip_tid_text, zip_tid_html, hzip_enabled, hzip_mode_is_b256);
|
||||
}
|
||||
public byte[] New_ns_file_map(long dump_file_size) {
|
||||
return dump_file_size < layout_text_max
|
||||
? gplx.xowa.bldrs.cmds.Xob_ns_file_itm_parser.Ns_file_map__few
|
||||
: gplx.xowa.bldrs.cmds.Xob_ns_file_itm_parser.Ns_file_map__each; // DB.FEW: DATE:2016-06-07
|
||||
// return dump_file_size < layout_text_max ? Bry_.Empty : Ns_file_map__each;
|
||||
}
|
||||
public void Zip_tid_text_raw_() {zip_tid_text = Io_stream_tid_.Tid__raw;} // TEST:
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_layout_all_max)) return Io_size_.To_str_mb(layout_all_max);
|
||||
else if (ctx.Match(k, Invk_layout_all_max_)) layout_all_max = Io_size_.To_long_by_msg_mb(m, layout_all_max);
|
||||
else if (ctx.Match(k, Invk_layout_text_max)) return Io_size_.To_str_mb(layout_text_max);
|
||||
else if (ctx.Match(k, Invk_layout_text_max_)) layout_text_max = Io_size_.To_long_by_msg_mb(m, layout_text_max);
|
||||
else if (ctx.Match(k, Invk_layout_html_max)) return Io_size_.To_str_mb(layout_html_max);
|
||||
else if (ctx.Match(k, Invk_layout_html_max_)) layout_html_max = Io_size_.To_long_by_msg_mb(m, layout_html_max);
|
||||
else if (ctx.Match(k, Invk_layout_file_max)) return Io_size_.To_str_mb(layout_file_max);
|
||||
else if (ctx.Match(k, Invk_layout_file_max_)) layout_file_max = Io_size_.To_long_by_msg_mb(m, layout_file_max);
|
||||
else if (ctx.Match(k, Invk_cat_link_db_max)) return Io_size_.To_str_mb(cat_link_db_max);
|
||||
if (ctx.Match(k, Invk_cat_link_db_max)) return Io_size_.To_str_mb(cat_link_db_max);
|
||||
else if (ctx.Match(k, Invk_cat_link_db_max_)) cat_link_db_max = Io_size_.To_long_by_msg_mb(m, cat_link_db_max);
|
||||
else if (ctx.Match(k, Invk_text_db_max)) return Io_size_.To_str_mb(text_db_max);
|
||||
else if (ctx.Match(k, Invk_text_db_max_)) text_db_max = Io_size_.To_long_by_msg_mb(m, text_db_max);
|
||||
else if (ctx.Match(k, Invk_html_db_max)) return Io_size_.To_str_mb(html_db_max);
|
||||
else if (ctx.Match(k, Invk_html_db_max_)) html_db_max = Io_size_.To_long_by_msg_mb(m, html_db_max);
|
||||
else if (ctx.Match(k, Invk_file_db_max)) return Io_size_.To_str_mb(file_db_max);
|
||||
else if (ctx.Match(k, Invk_file_db_max_)) file_db_max = Io_size_.To_long_by_msg_mb(m, file_db_max);
|
||||
else if (ctx.Match(k, Invk_ns_file_map)) return String_.new_u8(ns_file_map);
|
||||
else if (ctx.Match(k, Invk_ns_file_map_)) ns_file_map = m.ReadBry("v");
|
||||
else if (ctx.Match(k, Invk_zip_tid_text)) return Io_stream_tid_.To_key(zip_tid_text);
|
||||
else if (ctx.Match(k, Invk_zip_tid_text_)) zip_tid_text = Io_stream_tid_.To_tid(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_zip_tid_list)) return Options_zip_tid__list;
|
||||
else if (ctx.Match(k, Invk_zip_tid_html)) return Io_stream_tid_.To_key(zip_tid_html);
|
||||
else if (ctx.Match(k, Invk_zip_tid_html_)) zip_tid_html = Io_stream_tid_.To_tid(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_hzip_enabled)) return Yn.To_str(hzip_enabled);
|
||||
else if (ctx.Match(k, Invk_hzip_enabled_)) hzip_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_hzip_mode_is_b256)) return Yn.To_str(hzip_mode_is_b256);
|
||||
else if (ctx.Match(k, Invk_hzip_mode_is_b256_)) hzip_mode_is_b256 = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_user_name)) return user_name;
|
||||
else if (ctx.Match(k, Invk_user_name_)) user_name = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk_page_rank)) return page_rank;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final Keyval[] Options_zip_tid__list = Keyval_.Ary(Keyval_.new_("raw", "text"), Keyval_.new_("gzip"), Keyval_.new_("bzip2"), Keyval_.new_("xz"));
|
||||
private static final String
|
||||
Invk_layout_all_max = "layout_all_max" , Invk_layout_all_max_ = "layout_all_max_"
|
||||
, Invk_layout_text_max = "layout_text_max" , Invk_layout_text_max_ = "layout_text_max_"
|
||||
, Invk_layout_html_max = "layout_html_max" , Invk_layout_html_max_ = "layout_html_max_"
|
||||
, Invk_layout_file_max = "layout_file_max" , Invk_layout_file_max_ = "layout_file_max_"
|
||||
, Invk_cat_link_db_max = "cat_link_db_max" , Invk_cat_link_db_max_ = "cat_link_db_max_"
|
||||
, Invk_text_db_max = "text_db_max" , Invk_text_db_max_ = "text_db_max_"
|
||||
, Invk_html_db_max = "html_db_max" , Invk_html_db_max_ = "html_db_max_"
|
||||
, Invk_file_db_max = "file_db_max" , Invk_file_db_max_ = "file_db_max_"
|
||||
, Invk_ns_file_map = "ns_file_map" , Invk_ns_file_map_ = "ns_file_map_"
|
||||
, Invk_zip_tid_text = "zip_tid_text" , Invk_zip_tid_text_ = "zip_tid_text_", Invk_zip_tid_list = "zip_tid_list"
|
||||
, Invk_zip_tid_html = "zip_tid_html" , Invk_zip_tid_html_ = "zip_tid_html_"
|
||||
Invk_cat_link_db_max = "cat_link_db_max" , Invk_cat_link_db_max_ = "cat_link_db_max_"
|
||||
, Invk_user_name = "user_name" , Invk_user_name_ = "user_name_"
|
||||
, Invk_hzip_enabled = "hzip_enabled" , Invk_hzip_enabled_ = "hzip_enabled_"
|
||||
, Invk_hzip_mode_is_b256 = "hzip_mode_is_b256" , Invk_hzip_mode_is_b256_ = "hzip_mode_is_b256_"
|
||||
, Invk_page_rank = "page_rank"
|
||||
;
|
||||
public static final byte[] Ns_file_map__each = Bry_.new_a7("<each>");
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
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.apps.apis.xowa.bldrs.imports.page_ranks; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.bldrs.*; import gplx.xowa.apps.apis.xowa.bldrs.imports.*;
|
||||
public class Xoapi_page_rank implements Gfo_invk {
|
||||
public int Iteration_max() {return iteration_max;} private int iteration_max = 0;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_iteration_max)) return Int_.To_str(iteration_max);
|
||||
else if (ctx.Match(k, Invk_iteration_max_)) iteration_max = m.ReadInt("v");
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
Invk_iteration_max = "iteration_max" , Invk_iteration_max_ = "iteration_max_"
|
||||
;
|
||||
}
|
||||
@@ -20,27 +20,27 @@ import gplx.xowa.apps.apis.xowa.gui.browsers.*;
|
||||
public class Xoapi_browser implements Gfo_invk {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
url.Init_by_kit(app);
|
||||
search.Init_by_kit(app);
|
||||
tabs.Init_by_kit(app);
|
||||
html.Init_by_kit(app);
|
||||
search.Init_by_kit(app);
|
||||
find.Init_by_kit(app);
|
||||
prog.Init_by_kit(app);
|
||||
info.Init_by_kit(app);
|
||||
prog_log.Init_by_kit(app);
|
||||
}
|
||||
public Xoapi_url Url() {return url;} private Xoapi_url url = new Xoapi_url();
|
||||
public Xoapi_search Search() {return search;} private Xoapi_search search = new Xoapi_search();
|
||||
public Xoapi_tabs Tabs() {return tabs;} private Xoapi_tabs tabs = new Xoapi_tabs();
|
||||
public Xoapi_html_box Html() {return html;} private Xoapi_html_box html = new Xoapi_html_box();
|
||||
public Xoapi_search Search() {return search;} private Xoapi_search search = new Xoapi_search();
|
||||
public Xoapi_find Find() {return find;} private Xoapi_find find = new Xoapi_find();
|
||||
public Xoapi_prog Prog() {return prog;} private Xoapi_prog prog = new Xoapi_prog();
|
||||
public Xoapi_info Info() {return info;} private Xoapi_info info = new Xoapi_info();
|
||||
public Xoapi_prog_log Prog_log() {return prog_log;} private Xoapi_prog_log prog_log = new Xoapi_prog_log();
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_url)) return url;
|
||||
else if (ctx.Match(k, Invk_search)) return search;
|
||||
else if (ctx.Match(k, Invk_tabs)) return tabs;
|
||||
else if (ctx.Match(k, Invk_html)) return html;
|
||||
else if (ctx.Match(k, Invk_search)) return search;
|
||||
else if (ctx.Match(k, Invk_find)) return find;
|
||||
else if (ctx.Match(k, Invk_prog)) return prog;
|
||||
else if (ctx.Match(k, Invk_info)) return info;
|
||||
@@ -48,6 +48,6 @@ public class Xoapi_browser implements Gfo_invk {
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
private static final String
|
||||
Invk_url = "url", Invk_search = "search", Invk_tabs = "tabs", Invk_html = "html"
|
||||
Invk_url = "url", Invk_tabs = "tabs", Invk_html = "html", Invk_search = "search"
|
||||
, Invk_find = "find", Invk_prog = "prog", Invk_info = "info", Invk_prog_log = "prog_log";
|
||||
}
|
||||
|
||||
@@ -20,10 +20,8 @@ import gplx.gfui.*; import gplx.gfui.envs.*; import gplx.gfui.controls.standards
|
||||
import gplx.xowa.guis.views.*; import gplx.core.envs.*;
|
||||
public class Xoapi_url implements Gfo_invk {
|
||||
private Xoae_app app;
|
||||
private Xoapi_url_searcher url_searcher;
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
this.app = app;
|
||||
this.url_searcher = new Xoapi_url_searcher(app);
|
||||
}
|
||||
private GfuiComboBox Url_box() {return app.Gui_mgr().Browser_win().Url_box();}
|
||||
public void Focus() {this.Url_box().Focus(); this.Url_box().Sel_(0, String_.Len(this.Url_box().Text()));}
|
||||
@@ -34,8 +32,8 @@ public class Xoapi_url implements Gfo_invk {
|
||||
Xog_tab_itm tab = app.Gui_mgr().Browser_win().Active_tab(); if (tab == Xog_tab_itm_.Null) return;
|
||||
this.Url_box().Text_(tab.Page().Url().To_str());
|
||||
}
|
||||
public void Type() {
|
||||
url_searcher.Search();
|
||||
void Type() {
|
||||
app.Addon_mgr().Itms__search__urlbar().Search();
|
||||
}
|
||||
private void Exec_wkr(boolean new_tab, String urls_text) {
|
||||
if (Op_sys.Cur().Tid_is_wnt())
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
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.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.gfui.controls.standards.*;
|
||||
import gplx.xowa.addons.wikis.searchs.*; import gplx.xowa.addons.wikis.searchs.searchers.*; import gplx.xowa.addons.wikis.searchs.searchers.cbks.*;
|
||||
import gplx.xowa.apps.apis.xowa.addons.searchs.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
class Xoapi_url_searcher implements Gfo_evt_itm {
|
||||
private final Xoae_app app;
|
||||
private final Xoapi_url_bar url_bar_api; private Srch_search_addon addon;
|
||||
private final GfuiComboBox url_bar;
|
||||
public Xoapi_url_searcher(Xoae_app app) { // called by Init_by_kit
|
||||
this.app = app;
|
||||
this.evt_mgr = new Gfo_evt_mgr(this);
|
||||
this.url_bar = app.Gui_mgr().Browser_win().Url_box();
|
||||
this.url_bar_api = app.Api_root().Addon().Search().Url_bar();
|
||||
Gfo_evt_mgr_.Sub_same_many(url_bar_api, this, Xoapi_url_bar.Evt__jump_len_changed, Xoapi_url_bar.Evt__visible_rows_changed, Xoapi_url_bar.Evt__ns_ids_changed);
|
||||
url_bar.Items__jump_len_(url_bar_api.Jump_len());
|
||||
url_bar.Items__visible_rows_(url_bar_api.Visible_rows());
|
||||
}
|
||||
public Gfo_evt_mgr Evt_mgr() {return evt_mgr;} private final Gfo_evt_mgr evt_mgr;
|
||||
public void Search() {
|
||||
if (!url_bar_api.Enabled()) return;
|
||||
Xog_tab_itm active_tab = app.Gui_mgr().Browser_win().Tab_mgr().Active_tab(); if (active_tab == null) return;
|
||||
Xow_wiki wiki = active_tab.Wiki();
|
||||
|
||||
String search_str = url_bar.Text();
|
||||
url_bar.Text_fallback_(search_str);
|
||||
// remove "en.wikipedia.org/wiki/"
|
||||
// String url_bgn = wiki.Domain_str() + gplx.xowa.htmls.hrefs.Xoh_href_.Str__wiki;
|
||||
// if (String_.Has_at_bgn(search_str, url_bgn))
|
||||
// search_str = String_.Mid(search_str, String_.Len(url_bgn));
|
||||
if (String_.Len_eq_0(search_str)) {
|
||||
url_bar.Items__update(String_.Ary_empty);
|
||||
return;
|
||||
}
|
||||
|
||||
if (addon == null) {
|
||||
addon = Srch_search_addon.Get(wiki);
|
||||
}
|
||||
else {
|
||||
if (!Bry_.Eq(wiki.Domain_bry(), addon.Wiki_domain())) // NOTE: url_bar_api caches addon at wiki level; need to check if wiki has changed
|
||||
addon = Srch_search_addon.Get(wiki);
|
||||
}
|
||||
if (addon.Db_mgr().Cfg().Version_id__needs_upgrade()) return; // exit early, else will flash "searching" message below; note that url-bar should not trigger upgrade;
|
||||
url_bar.List_sel_idx_(0); // clear selected list item; EX: search "a" -> page down; sel is row #5 -> search "b" -> sel should not be #5; DATE:2016-03-24
|
||||
if (!url_bar.List_visible()) url_bar.Items__size_to_fit(url_bar_api.Max_results()); // resize offscreen; handles 1st search when dropdown flashes briefly in middle of screen before being moved under bar; DATE:2016-03-24
|
||||
Srch_search_qry qry = Srch_search_qry.New__url_bar(wiki, url_bar_api, Bry_.new_u8(search_str));
|
||||
Srch_rslt_cbk__url_bar cbk = new Srch_rslt_cbk__url_bar(app, url_bar, url_bar_api);
|
||||
Xoa_app_.Usr_dlg().Prog_one("", "", "searching (please wait): ~{0}", search_str);
|
||||
addon.Search(qry, cbk);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Xoapi_url_bar.Evt__jump_len_changed)) {url_bar.Items__jump_len_(m.ReadInt("v"));}
|
||||
else if (ctx.Match(k, Xoapi_url_bar.Evt__visible_rows_changed)) {url_bar.Items__visible_rows_(m.ReadInt("v"));}
|
||||
else if (ctx.Match(k, Xoapi_url_bar.Evt__ns_ids_changed)) {if (addon != null) addon.Clear_rslts_cache();} // invalidate cache when ns changes; else ns_0 rslts will show up in ns_100; DATE:2016-03-24
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -21,16 +21,10 @@ public class Xoapi_modules implements Gfo_invk {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
popups.Init_by_app(app);
|
||||
}
|
||||
public Xoapi_collapsible Collapsible() {return collapsible;} private Xoapi_collapsible collapsible = new Xoapi_collapsible();
|
||||
public Xoapi_navframe Navframe() {return navframe;} private Xoapi_navframe navframe = new Xoapi_navframe();
|
||||
public Xoapi_toc Toc() {return toc;} private Xoapi_toc toc = new Xoapi_toc();
|
||||
public Xoapi_popups Popups() {return popups;} private Xoapi_popups popups = new Xoapi_popups();
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_collapsible)) return collapsible;
|
||||
else if (ctx.Match(k, Invk_navframe)) return navframe;
|
||||
else if (ctx.Match(k, Invk_toc)) return toc;
|
||||
else if (ctx.Match(k, Invk_popups)) return popups;
|
||||
if (ctx.Match(k, Invk_popups)) return popups;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
private static final String Invk_collapsible = "collapsible", Invk_navframe = "navframe", Invk_toc = "toc", Invk_popups = "popups";
|
||||
private static final String Invk_popups = "popups";
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
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.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.apps.apis.xowa.html.skins.*;
|
||||
public class Xoapi_skins implements Gfo_invk {
|
||||
private Hash_adp hash = Hash_adp_.New();
|
||||
public Xoapi_skins() {
|
||||
server.Sidebar_home_enabled_(true);
|
||||
hash.Add("desktop", desktop);
|
||||
hash.Add("server", server);
|
||||
}
|
||||
public Xoapi_skin_app_base Desktop() {return desktop;} private Xoapi_skin_app_base desktop = new Xoapi_skin_app_base();
|
||||
public Xoapi_skin_app_base Server () {return server ;} private Xoapi_skin_app_base server = new Xoapi_skin_app_base();
|
||||
private Gfo_invk Get(String key) {return (Gfo_invk)hash.Get_by(key);}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_get)) return Get(m.ReadStr("v"));
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_get = "get";
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
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.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.htmls.core.htmls.tidy.*;
|
||||
public class Xoapi_tidy implements Gfo_invk {
|
||||
private Xoae_app app;
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
this.app = app;
|
||||
}
|
||||
public void Toggle() {
|
||||
app.Html_mgr().Tidy_mgr().Enabled_toggle();
|
||||
app.Gui_mgr().Browser_win().Page__refresh();
|
||||
}
|
||||
public void Engine_(byte v) {
|
||||
app.Html_mgr().Tidy_mgr().Wkr_tid_(v);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_toggle)) this.Toggle();
|
||||
else if (ctx.Match(k, Invk_engine_tidy_)) Engine_(Xoh_tidy_wkr_.Tid_tidy);
|
||||
else if (ctx.Match(k, Invk_engine_jtidy_)) Engine_(Xoh_tidy_wkr_.Tid_jtidy);
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_toggle = "toggle", Invk_engine_tidy_ = "engine_tidy_", Invk_engine_jtidy_ = "engine_jtidy_";
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
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.apps.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
|
||||
public class Xoapi_collapsible implements Gfo_invk {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
}
|
||||
public boolean Collapsed() {return collapsed;} private boolean collapsed;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_collapsed)) return Yn.To_str(collapsed);
|
||||
else if (ctx.Match(k, Invk_collapsed_)) collapsed = m.ReadYn("v");
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
Invk_collapsed = "collapsed", Invk_collapsed_ = "collapsed_"
|
||||
;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
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.apps.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
|
||||
public class Xoapi_navframe implements Gfo_invk {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
}
|
||||
public boolean Collapsed() {return collapsed;} private boolean collapsed;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_collapsed)) return Yn.To_str(collapsed);
|
||||
else if (ctx.Match(k, Invk_collapsed_)) collapsed = m.ReadYn("v");
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
Invk_collapsed = "collapsed", Invk_collapsed_ = "collapsed_"
|
||||
;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
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.apps.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
|
||||
public class Xoapi_toc implements Gfo_invk {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
}
|
||||
public boolean Collapsed() {return collapsed;} private boolean collapsed = false;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_collapsed)) return Yn.To_str(collapsed);
|
||||
else if (ctx.Match(k, Invk_collapsed_)) collapsed = m.ReadYn("v");
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
Invk_collapsed = "collapsed", Invk_collapsed_ = "collapsed_"
|
||||
;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
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.apps.apis.xowa.html.skins; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
|
||||
public class Xoapi_skin_app_base implements Gfo_invk {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
}
|
||||
public boolean Sidebar_home_enabled() {return sidebar_home_enabled;} public void Sidebar_home_enabled_(boolean v) {sidebar_home_enabled = v;} private boolean sidebar_home_enabled;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_sidebar_home_enabled)) return Yn.To_str(sidebar_home_enabled);
|
||||
else if (ctx.Match(k, Invk_sidebar_home_enabled_)) sidebar_home_enabled = m.ReadYn("v");
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_sidebar_home_enabled = "sidebar_home_enabled", Invk_sidebar_home_enabled_ = "sidebar_home_enabled_";
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
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.apps.apis.xowa.specials; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.domains.crts.*;
|
||||
public class Xoapi_search implements Gfo_invk, Gfo_evt_mgr_owner {
|
||||
private final Xow_domain_crt_kv_itm_mgr multi_wikis_mgr = new Xow_domain_crt_kv_itm_mgr(); private byte[] multi_wikis_bry = Dflt_multi_wikis_bry;
|
||||
private final Xow_domain_crt_kv_itm_mgr multi_sorts_mgr = new Xow_domain_crt_kv_itm_mgr(); private byte[] multi_sorts_bry = Dflt_multi_sorts_bry;
|
||||
public Xoapi_search() {
|
||||
this.evt_mgr = new Gfo_evt_mgr(this);
|
||||
multi_wikis_mgr.Parse_as_itms(multi_wikis_bry);
|
||||
multi_sorts_mgr.Parse_as_arys(multi_sorts_bry);
|
||||
}
|
||||
public Gfo_evt_mgr Evt_mgr() {return evt_mgr;} private Gfo_evt_mgr evt_mgr;
|
||||
public int Results_per_page() {return results_per_page;} private int results_per_page = 100;
|
||||
public boolean Async_db() {return async_db;} private boolean async_db = true;
|
||||
public void Multi_wikis_bry_(byte[] v) {
|
||||
if (!multi_wikis_mgr.Parse_as_itms(v)) return;
|
||||
this.multi_wikis_bry = v;
|
||||
Gfo_evt_mgr_.Pub_val(this, Evt_multi_wikis_changed, v);
|
||||
}
|
||||
public Xow_domain_crt_itm Multi_wikis_crt(Xow_domain_itm cur_domain) {
|
||||
return multi_wikis_mgr.Find_itm(cur_domain, cur_domain);
|
||||
}
|
||||
public void Multi_sorts_bry_(byte[] v) {
|
||||
if (!multi_sorts_mgr.Parse_as_arys(v)) return;
|
||||
this.multi_sorts_bry = v;
|
||||
Gfo_evt_mgr_.Pub_val(this, Evt_multi_sorts_changed, v);
|
||||
}
|
||||
public Xow_domain_crt_itm[] Multi_sorts_crt(Xow_domain_itm cur_domain) {
|
||||
return multi_sorts_mgr.Find_ary(cur_domain, cur_domain);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_results_per_page)) return results_per_page;
|
||||
else if (ctx.Match(k, Invk_results_per_page_)) results_per_page = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_async_db)) return Yn.To_str(async_db);
|
||||
else if (ctx.Match(k, Invk_async_db_)) async_db = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_multi_wikis)) return String_.new_u8(multi_wikis_bry);
|
||||
else if (ctx.Match(k, Invk_multi_wikis_)) Multi_wikis_bry_(m.ReadBry("v"));
|
||||
else if (ctx.Match(k, Invk_multi_sorts)) return String_.new_u8(multi_sorts_bry);
|
||||
else if (ctx.Match(k, Invk_multi_sorts_)) Multi_sorts_bry_(m.ReadBry("v"));
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
Invk_results_per_page = "results_per_page" , Invk_results_per_page_ = "results_per_page_"
|
||||
, Invk_async_db = "async_db" , Invk_async_db_ = "async_db_"
|
||||
, Invk_multi_wikis = "multi_wikis" , Invk_multi_wikis_ = "multi_wikis_"
|
||||
, Invk_multi_sorts = "multi_sorts" , Invk_multi_sorts_ = "multi_sorts_"
|
||||
;
|
||||
public static final String
|
||||
Evt_multi_wikis_changed = "multi_wikis_changed"
|
||||
, Evt_multi_sorts_changed = "multi_sorts_changed"
|
||||
;
|
||||
public static final byte[]
|
||||
Dflt_multi_wikis_bry = Bry_.new_a7("<any>|<self>")
|
||||
, Dflt_multi_sorts_bry = Bry_.new_a7("<any>|<self>,*.wikipedia,*.wikivoyage,*.wiktionary,*.wikisource,*.wikiquote,*.wikibooks,*.wikiversity,*.wikinews")
|
||||
;
|
||||
}
|
||||
@@ -32,20 +32,14 @@ public class Xoapi_cache implements Gfo_invk {
|
||||
return bfr.To_str_and_clear();
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_fsys_size_min)) return cache_mgr.Fsys_size_min() / Io_mgr.Len_mb;
|
||||
else if (ctx.Match(k, Invk_fsys_size_min_)) cache_mgr.Fsys_size_min_(Io_size_.To_long_by_msg_mb(m, cache_mgr.Fsys_size_min()));
|
||||
else if (ctx.Match(k, Invk_fsys_size_max)) return cache_mgr.Fsys_size_max() / Io_mgr.Len_mb;
|
||||
else if (ctx.Match(k, Invk_fsys_size_max_)) cache_mgr.Fsys_size_max_(Io_size_.To_long_by_msg_mb(m, cache_mgr.Fsys_size_max()));
|
||||
else if (ctx.Match(k, Invk_info)) return Info();
|
||||
if (ctx.Match(k, Invk_info)) return Info();
|
||||
else if (ctx.Match(k, Invk_reduce_to_min)) cache_mgr.Reduce(cache_mgr.Fsys_size_min());
|
||||
else if (ctx.Match(k, Invk_reduce_to_zero)) cache_mgr.Reduce(0);
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
Invk_fsys_size_min = "fsys_size_min" , Invk_fsys_size_min_ = "fsys_size_min_"
|
||||
, Invk_fsys_size_max = "fsys_size_max" , Invk_fsys_size_max_ = "fsys_size_max_"
|
||||
, Invk_info = "info"
|
||||
Invk_info = "info"
|
||||
, Invk_reduce_to_min = "reduce_to_min" , Invk_reduce_to_zero = "reduce_to_zero"
|
||||
;
|
||||
}
|
||||
|
||||
@@ -25,24 +25,24 @@ public class Xoapi_wikibase implements Gfo_invk, Gfo_evt_mgr_owner {
|
||||
public byte[][] Core_langs() {return core_langs;} private byte[][] core_langs = Bry_.Ary("en");
|
||||
public byte[][] Sort_langs() {return sort_langs;} private byte[][] sort_langs = Bry_.Ary("en", "de", "es", "fr", "it", "nl", "pl", "ru", "sv");
|
||||
public byte[] Link_wikis() {return link_wikis;} private byte[] link_wikis = Bry_.new_a7("enwiki");
|
||||
public void Init_by_app(Xoae_app app) {
|
||||
app.Cfg().Bind_many_app(this, Cfg__core_langs, Cfg__link_wikis, Cfg__sort_langs);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_core_langs)) return Bry_.Add_w_dlm(Byte_ascii.Semic, core_langs);
|
||||
else if (ctx.Match(k, Invk_core_langs_)) {core_langs = m.ReadBryAry(k, Byte_ascii.Semic); Gfo_evt_mgr_.Pub_val(this, Evt_core_langs_changed, core_langs);}
|
||||
else if (ctx.Match(k, Invk_sort_langs)) return Bry_.Add_w_dlm(Byte_ascii.Semic, sort_langs);
|
||||
else if (ctx.Match(k, Invk_sort_langs_)) {sort_langs = m.ReadBryAry(k, Byte_ascii.Semic); Gfo_evt_mgr_.Pub_val(this, Evt_sort_langs_changed, sort_langs);}
|
||||
else if (ctx.Match(k, Invk_link_wikis)) return String_.new_u8(link_wikis);
|
||||
else if (ctx.Match(k, Invk_link_wikis_)) {link_wikis = m.ReadBry(k); Gfo_evt_mgr_.Pub_val(this, Evt_link_wikis_changed, link_wikis);}
|
||||
if (ctx.Match(k, Cfg__core_langs)) {core_langs = m.ReadBryAry(k, Byte_ascii.Semic); Gfo_evt_mgr_.Pub_val(this, Evt_core_langs_changed, core_langs);}
|
||||
else if (ctx.Match(k, Cfg__sort_langs)) {sort_langs = m.ReadBryAry(k, Byte_ascii.Semic); Gfo_evt_mgr_.Pub_val(this, Evt_sort_langs_changed, sort_langs);}
|
||||
else if (ctx.Match(k, Cfg__link_wikis)) {link_wikis = m.ReadBry(k); Gfo_evt_mgr_.Pub_val(this, Evt_link_wikis_changed, link_wikis);}
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
Invk_core_langs = "core_langs", Invk_core_langs_ = "core_langs_"
|
||||
, Invk_sort_langs = "sort_langs", Invk_sort_langs_ = "sort_langs_"
|
||||
, Invk_link_wikis = "link_wikis", Invk_link_wikis_ = "link_wikis_"
|
||||
;
|
||||
public static final String
|
||||
Evt_core_langs_changed = "core_langs_changed"
|
||||
, Evt_link_wikis_changed = "link_wikis_changed"
|
||||
, Evt_sort_langs_changed = "sort_langs_changed"
|
||||
;
|
||||
private static final String
|
||||
Cfg__core_langs = "xowa.addon.wikibase.pages.core_langs"
|
||||
, Cfg__link_wikis = "xowa.addon.wikibase.pages.link_wikis"
|
||||
, Cfg__sort_langs = "xowa.addon.wikibase.pages.sort_langs"
|
||||
;
|
||||
}
|
||||
|
||||
@@ -37,14 +37,19 @@ public class Xoa_prog_mgr implements Gfo_invk {
|
||||
Process_adp.ini_(this, usr_dlg, app_lilypond , cmd_eval, Process_adp.Run_mode_sync_timeout , 1 * 60, "~{<>bin_plat_dir<>}lilypond\\usr\\bin\\lilypond.exe", "\"-dsafe=#t\" -dbackend=ps --png --header=texidoc -dmidi-extension=midi \"~{file}\"", "file");
|
||||
Process_adp.ini_(this, usr_dlg, app_abc2ly , cmd_eval, Process_adp.Run_mode_sync_timeout , 1 * 60, "~{<>bin_plat_dir<>}lilypond\\usr\\bin\\python.exe", "abc2ly.py -s \"--output=~{target}\" \"~{source}\"", "source", "target");
|
||||
Process_adp.ini_(this, usr_dlg, app_trim_img , cmd_eval, Process_adp.Run_mode_sync_timeout , 1 * 60, "~{<>bin_plat_dir<>}imagemagick\\convert", "-trim \"~{source}\" \"~{target}\"", "source", "target");
|
||||
Process_adp.ini_(this, usr_dlg, app_convert_midi_to_ogg , cmd_eval, Process_adp.Run_mode_sync_timeout , 1 * 60, "~{<>bin_plat_dir<>}timidity\\timidity", "-Ov \"--output-file=~{target}\" \"~{source}\"", "source", "target");
|
||||
Process_adp.ini_(this, usr_dlg, app_midi_to_ogg , cmd_eval, Process_adp.Run_mode_sync_timeout , 1 * 60, "~{<>bin_plat_dir<>}timidity\\timidity", "-Ov \"--output-file=~{target}\" \"~{source}\"", "source", "target");
|
||||
Process_adp.ini_(this, usr_dlg, app_view_text , cmd_eval, Process_adp.Run_mode_async , 0 , "cmd", "/c start \"~{url}\"", "url");
|
||||
|
||||
for (int i = 0; i < apps_by_ext.length; i++) {
|
||||
apps_by_ext[i] = Process_adp.New(usr_dlg, cmd_eval, Process_adp.Run_mode_async, 0, "cmd", "/c start \"\" \"~{file}\"", "file");
|
||||
}
|
||||
app_web = Process_adp.New(usr_dlg, cmd_eval, Process_adp.Run_mode_async, 0, "cmd", "/c start \"\" \"~{url}\"", "url");
|
||||
app.Cfg().Bind_many_app(this, Cfg__web, Cfg__media, Cfg__image, Cfg__svg, Cfg__pdf, Cfg__djvu);
|
||||
app.Cfg().Bind_many_app(this
|
||||
, Cfg__web, Cfg__media, Cfg__image, Cfg__svg, Cfg__pdf, Cfg__djvu
|
||||
, Cfg__gz, Cfg__bz2, Cfg__bz2__stdout_cmd
|
||||
, Cfg__lua
|
||||
, Cfg__lilypond, Cfg__abc2ly, Cfg__trim_img, Cfg__midi_to_ogg
|
||||
);
|
||||
}
|
||||
private Process_adp App_by_ext_key(String ext) {return apps_by_ext[Xof_ext_.Get_id_by_ext_(Bry_.new_a7(ext))];}
|
||||
public Process_adp App_query_img_size() {return app_query_img_size;} private Process_adp app_query_img_size = new Process_adp();
|
||||
@@ -62,25 +67,11 @@ public class Xoa_prog_mgr implements Gfo_invk {
|
||||
public Process_adp App_lilypond() {return app_lilypond;} private Process_adp app_lilypond = new Process_adp();
|
||||
public Process_adp App_abc2ly() {return app_abc2ly;} private Process_adp app_abc2ly = new Process_adp();
|
||||
public Process_adp App_trim_img() {return app_trim_img;} private Process_adp app_trim_img = new Process_adp();
|
||||
public Process_adp App_convert_midi_to_ogg() {return app_convert_midi_to_ogg;} private Process_adp app_convert_midi_to_ogg = new Process_adp();
|
||||
public Process_adp App_convert_midi_to_ogg() {return app_midi_to_ogg;} private Process_adp app_midi_to_ogg = new Process_adp();
|
||||
public Process_adp App_by_ext(String ext) {return App_by_ext_key(String_.Mid(ext, 1));} // ignore 1st . in ext; EX: ".png" -> "png"
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_query_img_size)) return app_query_img_size;
|
||||
else if (ctx.Match(k, Invk_resize_img)) return app_resize_img;
|
||||
else if (ctx.Match(k, Invk_convert_svg_to_png)) return app_convert_svg_to_png;
|
||||
else if (ctx.Match(k, Invk_convert_tex_to_dvi)) return app_convert_tex_to_dvi;
|
||||
if (ctx.Match(k, Invk_convert_tex_to_dvi)) return app_convert_tex_to_dvi;
|
||||
else if (ctx.Match(k, Invk_convert_dvi_to_png)) return app_convert_dvi_to_png;
|
||||
else if (ctx.Match(k, Invk_convert_djvu_to_tiff)) return app_convert_djvu_to_tiff;
|
||||
else if (ctx.Match(k, Invk_view_web)) return app_web;
|
||||
else if (ctx.Match(k, Invk_decompress_bz2)) return app_decompress_bz2;
|
||||
else if (ctx.Match(k, Invk_decompress_zip)) return app_decompress_zip;
|
||||
else if (ctx.Match(k, Invk_decompress_gz)) return app_decompress_gz;
|
||||
else if (ctx.Match(k, Invk_decompress_bz2_by_stdout)) return app_decompress_bz2_by_stdout;
|
||||
else if (ctx.Match(k, Invk_lua)) return app_lua;
|
||||
else if (ctx.Match(k, Invk_lilypond)) return app_lilypond;
|
||||
else if (ctx.Match(k, Invk_abc2ly)) return app_abc2ly;
|
||||
else if (ctx.Match(k, Invk_convert_midi_to_ogg)) return app_convert_midi_to_ogg;
|
||||
else if (ctx.Match(k, Invk_trim_img)) return app_trim_img;
|
||||
|
||||
else if (String_.Eq(k, Cfg__web)) {Init_cmd(m.ReadStr("v"), app_web);}
|
||||
else if (String_.Eq(k, Cfg__media)) {Init_cmd(m.ReadStr("v"), Xof_ext_.Id_ogv, Xof_ext_.Id_webm, Xof_ext_.Id_flac, Xof_ext_.Id_ogg, Xof_ext_.Id_oga, Xof_ext_.Id_mid, Xof_ext_.Id_wav);}
|
||||
@@ -88,10 +79,22 @@ public class Xoa_prog_mgr implements Gfo_invk {
|
||||
else if (String_.Eq(k, Cfg__svg)) {Init_cmd(m.ReadStr("v"), Xof_ext_.Id_svg);}
|
||||
else if (String_.Eq(k, Cfg__pdf)) {Init_cmd(m.ReadStr("v"), Xof_ext_.Id_pdf);}
|
||||
else if (String_.Eq(k, Cfg__djvu)) {Init_cmd(m.ReadStr("v"), Xof_ext_.Id_djvu);}
|
||||
else if (String_.Eq(k, Cfg__gz)) {Init_cmd(m.ReadStr("v"), app_decompress_gz);}
|
||||
else if (String_.Eq(k, Cfg__bz2)) {Init_cmd(m.ReadStr("v"), app_decompress_bz2);}
|
||||
else if (String_.Eq(k, Cfg__bz2__stdout_cmd)) {Init_cmd(m.ReadStr("v"), app_decompress_bz2_by_stdout);}
|
||||
else if (String_.Eq(k, Cfg__query_size)) {Init_cmd(m.ReadStr("v"), app_query_img_size);}
|
||||
else if (String_.Eq(k, Cfg__resize_img)) {Init_cmd(m.ReadStr("v"), app_resize_img);}
|
||||
else if (String_.Eq(k, Cfg__convert_svg_to_png)) {Init_cmd(m.ReadStr("v"), app_convert_svg_to_png);}
|
||||
else if (String_.Eq(k, Cfg__convert_djvu_to_tiff)) {Init_cmd(m.ReadStr("v"), app_convert_djvu_to_tiff);}
|
||||
else if (String_.Eq(k, Cfg__lua)) {Init_cmd(m.ReadStr("v"), app_lua);}
|
||||
else if (String_.Eq(k, Cfg__lilypond)) {Init_cmd(m.ReadStr("v"), app_lilypond);}
|
||||
else if (String_.Eq(k, Cfg__abc2ly)) {Init_cmd(m.ReadStr("v"), app_abc2ly);}
|
||||
else if (String_.Eq(k, Cfg__trim_img)) {Init_cmd(m.ReadStr("v"), app_trim_img);}
|
||||
else if (String_.Eq(k, Cfg__midi_to_ogg)) {Init_cmd(m.ReadStr("v"), app_midi_to_ogg);}
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private void Init_cmd(String exe_and_args, Process_adp proc) {
|
||||
public static void Init_cmd(String exe_and_args, Process_adp proc) {
|
||||
String[] lines = gplx.xowa.addons.apps.cfgs.Xocfg_mgr.Parse_io_cmd(exe_and_args);
|
||||
proc.Exe_and_args_(lines[0], lines[1]);
|
||||
}
|
||||
@@ -107,17 +110,26 @@ public class Xoa_prog_mgr implements Gfo_invk {
|
||||
url_str = Process_adp.Escape_ampersands_if_process_is_cmd(Op_sys.Cur().Tid_is_wnt(), app_web.Exe_url().Raw(), url_str); // escape ampersands; DATE:2014-05-20
|
||||
app_web.Run(url_str);
|
||||
}
|
||||
private static final String Invk_query_img_size = "query_img_size", Invk_resize_img = "resize_img", Invk_convert_svg_to_png = "convert_svg_to_png", Invk_convert_tex_to_dvi = "convert_tex_to_dvi", Invk_convert_dvi_to_png = "convert_dvi_to_png"
|
||||
, Invk_convert_djvu_to_tiff = "convert_djvu_to_tiff", Invk_view_web = "view_web"
|
||||
, Invk_decompress_bz2 = "decompress_bz2", Invk_decompress_zip = "decompress_zip", Invk_decompress_gz = "decompress_gz", Invk_decompress_bz2_by_stdout = "decompress_bz2_by_stdout"
|
||||
, Invk_lua = "lua", Invk_lilypond = "lilypond", Invk_abc2ly = "abc2ly", Invk_trim_img = "trim_img", Invk_convert_midi_to_ogg = "convert_midi_to_ogg"
|
||||
;
|
||||
private static final String Invk_convert_tex_to_dvi = "convert_tex_to_dvi", Invk_convert_dvi_to_png = "convert_dvi_to_png";
|
||||
private static final String
|
||||
Cfg__web = "xowa.app.content_apps.web"
|
||||
, Cfg__media = "xowa.app.content_apps.media"
|
||||
, Cfg__image = "xowa.app.content_apps.image"
|
||||
, Cfg__svg = "xowa.app.content_apps.svg"
|
||||
, Cfg__pdf = "xowa.app.content_apps.pdf"
|
||||
, Cfg__djvu = "xowa.app.content_apps.djvu"
|
||||
Cfg__web = "xowa.app.content_apps.web"
|
||||
, Cfg__media = "xowa.app.content_apps.media"
|
||||
, Cfg__image = "xowa.app.content_apps.image"
|
||||
, Cfg__svg = "xowa.app.content_apps.svg"
|
||||
, Cfg__pdf = "xowa.app.content_apps.pdf"
|
||||
, Cfg__djvu = "xowa.app.content_apps.djvu"
|
||||
, Cfg__bz2__stdout_cmd = "xowa.wiki.import.bz2.stdout_cmd"
|
||||
, Cfg__bz2 = "xowa.wiki.import.apps.bz2"
|
||||
, Cfg__gz = "xowa.wiki.import.apps.gz"
|
||||
, Cfg__query_size = "xowa.wiki.files.apps.query_size"
|
||||
, Cfg__resize_img = "xowa.wiki.files.apps.resize_img"
|
||||
, Cfg__convert_svg_to_png = "xowa.wiki.files.apps.convert_svg_to_png"
|
||||
, Cfg__convert_djvu_to_tiff = "xowa.wiki.files.apps.convert_djvu_to_tiff"
|
||||
, Cfg__lua = "xowa.addon.scribunto.lua.cmd"
|
||||
, Cfg__lilypond = "xowa.addon.score.apps.lilypond"
|
||||
, Cfg__abc2ly = "xowa.addon.score.apps.abc2ly"
|
||||
, Cfg__trim_img = "xowa.addon.score.apps.trim_img"
|
||||
, Cfg__midi_to_ogg = "xowa.addon.score.apps.midi_to_ogg"
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ public class Http_server_mgr implements Gfo_invk {
|
||||
running = val;
|
||||
}
|
||||
public void Run() {
|
||||
app.Cfg().Bind_many_app(this, Cfg__port, Cfg__file_retrieve_mode);
|
||||
if (wkr == null) wkr = new Http_server_socket(this);
|
||||
Thread_adp_.Start_by_key("thread:xowa.http_server.server", wkr, Http_server_socket.Invk_run);
|
||||
Note("HTTP Server started: Navigate to http://localhost:" + Int_.To_str(port));
|
||||
@@ -136,19 +137,15 @@ public class Http_server_mgr implements Gfo_invk {
|
||||
usr_dlg.Note_many("", "", s);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_port)) return port;
|
||||
else if (ctx.Match(k, Invk_port_)) Port_(m.ReadInt("v"));
|
||||
else if (ctx.Match(k, Invk_running)) return Yn.To_str(running);
|
||||
if (ctx.Match(k, Cfg__port)) Port_(m.ReadInt("v"));
|
||||
else if (ctx.Match(k, Cfg__file_retrieve_mode)) retrieve_mode = File_retrieve_mode.Xto_byte(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_running_)) Running_(m.ReadYn("v"));
|
||||
else if (ctx.Match(k, Invk_retrieve_mode)) return File_retrieve_mode.Xto_str(retrieve_mode);
|
||||
else if (ctx.Match(k, Invk_retrieve_mode_)) retrieve_mode = File_retrieve_mode.Xto_byte(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_retrieve_mode_list)) return File_retrieve_mode.Options__list;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
Invk_port = "port", Invk_port_ = "port_"
|
||||
, Invk_running = "running", Invk_running_ = "running_"
|
||||
, Invk_retrieve_mode = "retrieve_mode", Invk_retrieve_mode_ = "retrieve_mode_", Invk_retrieve_mode_list = "retrieve_mode_list"
|
||||
;
|
||||
private static final String Invk_running_ = "running_";
|
||||
private static final String
|
||||
Cfg__port = "xowa.addon.http_server.port"
|
||||
, Cfg__file_retrieve_mode = "xowa.addon.http_server.file_retrieve_mode";
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user