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

v2.10.3.1

This commit is contained in:
gnosygnu
2015-10-18 22:17:57 -04:00
parent 8e18af05b6
commit 4f43f51b18
1935 changed files with 12500 additions and 12889 deletions

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.apps.cfgs.old; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
import gplx.gfui.*; import gplx.xowa.guis.bnds.*; import gplx.xowa.guis.cmds.*;
import gplx.langs.gfs.*; import gplx.xowa.apps.*;
public class Xocfg_bnd_itm implements GfoInvkAble {
private Xocfg_bnd_mgr mgr;
public Xocfg_bnd_itm(Xocfg_bnd_mgr mgr, Xog_cmd_itm cmd, Xog_bnd_itm bnd) {
this.mgr = mgr; this.cmd = cmd; this.bnd = bnd;
}
public Xog_bnd_itm Bnd() {return bnd;} private Xog_bnd_itm bnd;
public Xog_cmd_itm Cmd() {return cmd;} private Xog_cmd_itm cmd;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_cmd_name)) return cmd.Name_or_missing();
else if (ctx.Match(k, Invk_cmd_tip)) return cmd.Tip_or_missing();
else if (ctx.Match(k, Invk_cmd_uid)) return cmd.Uid();
else if (ctx.Match(k, Invk_cmd_ctg_name)) return cmd.Ctg().Name();
else if (ctx.Match(k, Invk_cmd_ctg_sort)) return cmd.Ctg().Tid();
else if (ctx.Match(k, Invk_bnd_key)) return bnd.Key();
else if (ctx.Match(k, Invk_bnd_uid)) return bnd.Uid();
else if (ctx.Match(k, Invk_bnd_sys)) return Yn.To_str(bnd.Sys());
else if (ctx.Match(k, Invk_bnd_cmd)) return bnd.Cmd();
else if (ctx.Match(k, Invk_bnd_cmd_)) bnd.Cmd_(m.ReadStr("v"));
else if (ctx.Match(k, Invk_bnd_box)) return Xog_bnd_box_.Xto_gui_str(bnd.Box());
else if (ctx.Match(k, Invk_bnd_box_idx)) return bnd.Box();
else if (ctx.Match(k, Invk_bnd_ipt)) return mgr.Bnd_mgr().Bnd_parser().Xto_norm(bnd.Ipt().Key());
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_cmd_uid = "cmd_uid"
, Invk_cmd_name = "cmd_name"
, Invk_cmd_tip = "cmd_tip"
, Invk_cmd_ctg_name = "cmd_ctg_name"
, Invk_cmd_ctg_sort = "cmd_ctg_sort"
, Invk_bnd_key = "bnd_key"
, Invk_bnd_uid = "bnd_uid"
, Invk_bnd_sys = "bnd_sys"
, Invk_bnd_box = "bnd_box"
, Invk_bnd_box_idx = "bnd_box_idx"
, Invk_bnd_ipt = "bnd_ipt"
, Invk_bnd_cmd = "bnd_cmd", Invk_bnd_cmd_ = "bnd_cmd_"
;
}

View File

@@ -0,0 +1,51 @@
/*
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.cfgs.old; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
import gplx.gfui.*; import gplx.xowa.guis.bnds.*;
import gplx.langs.gfs.*; import gplx.xowa.apps.gfs.*;
public class Xocfg_bnd_itm_srl implements GfoInvkAble {
private Xoae_app app;
public Xocfg_bnd_itm_srl(Xoae_app app, String key) {
this.app = app;
this.key = key;
}
public String Key() {return key;} private String key;
public int Box() {return box;} private int box;
public IptArg Ipt() {return ipt;} private IptArg ipt;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_src_)) Src_(app, this, m.ReadStr("v"));
else if (ctx.Match(k, Invk_box_)) box = Xog_bnd_box_.Xto_sys_int(m.ReadStr("v"));
else if (ctx.Match(k, Invk_ipt_)) ipt = IptArg_.parse(m.ReadStr("v"));
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_src_ = "src_", Invk_box_ = "box_", Invk_ipt_ = "ipt_";
public static String Src(Xoae_app app, int box, IptArg ipt) { // box_('browser').ipt_('mod.c+key.q');
Gfs_wtr wtr = app.Gfs_mgr().Wtr();
wtr.Add_set_eq(Key_box, Bry_.new_a7(Xog_bnd_box_.Xto_sys_str(box)));
wtr.Add_set_eq(Key_ipt, Bry_.new_a7(ipt.Key()));
return wtr.Bfr().To_str_and_clear();
} private static final byte[] Key_box = Bry_.new_a7("box"), Key_ipt = Bry_.new_a7("ipt");
public static void Src_(Xoae_app app, Xocfg_bnd_itm_srl itm, String v) {
Xoa_gfs_mgr gfs_mgr = app.Gfs_mgr();
gfs_mgr.Run_str_for(itm, v);
Xog_bnd_itm bnd = app.Gui_mgr().Bnd_mgr().Get_or_null(itm.Key());
if (bnd != null) // should not happen, but guard against backward compatibility issues (deprecating old bindings)
app.Gui_mgr().Bnd_mgr().Set(bnd, itm.Box(), itm.Ipt());
}
}

View File

@@ -0,0 +1,69 @@
/*
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.cfgs.old; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
import gplx.gfui.*; import gplx.xowa.guis.bnds.*; import gplx.xowa.guis.cmds.*;
import gplx.xowa.apps.fmtrs.*;
public class Xocfg_bnd_mgr implements GfoInvkAble, Gfo_sort_able {
private Xog_bnd_mgr_srl bnd_mgr_srl; private Xog_cmd_mgr cmd_mgr;
private Xoa_fmtr_sort_mgr sorter;
public Xocfg_bnd_mgr(Xoae_app app) {
this.app = app; this.bnd_mgr = app.Gui_mgr().Bnd_mgr(); this.cmd_mgr = app.Gui_mgr().Cmd_mgr();
bnd_mgr_srl = new Xog_bnd_mgr_srl(app, bnd_mgr);
sorter = new Xoa_fmtr_sort_mgr(this);
}
public Xoae_app App() {return app;} private Xoae_app app;
public Xog_bnd_mgr Bnd_mgr() {return bnd_mgr;} private Xog_bnd_mgr bnd_mgr;
private Ordered_hash regy;
public void Init() {
regy = Ordered_hash_.New();
int len = bnd_mgr.Len();
for (int i = 0; i < len; i++) {
Xog_bnd_itm bnd = bnd_mgr.Get_at(i);
Xog_cmd_itm cmd = cmd_mgr.Get_or_null(bnd.Cmd()); if (cmd == null) throw Err_.new_unhandled(bnd.Cmd());
Xocfg_bnd_itm cfg_itm = new Xocfg_bnd_itm(this, cmd, bnd);
regy.Add(bnd.Key(), cfg_itm);
}
}
private Xocfg_bnd_itm_srl Init(String key) {return new Xocfg_bnd_itm_srl(app, key);}
public Xocfg_bnd_itm Get_at(int i) {return (Xocfg_bnd_itm)regy.Get_at(i);}
public int Len() {return regy.Count();}
public void Sort(gplx.lists.ComparerAble comparer) {regy.Sort_by(comparer);}
private void Set_bulk(byte[] src) {
try {
bnd_mgr_srl.Load_by_bry(src);
}
catch (Exception e) { // catch errors, so that next cmd (which is page.reload) can still execute
app.Usr_dlg().Warn_many("", "", "failed to set bnds; src=~{0} err=~{1}", String_.new_u8(src), Err_.Message_gplx_full(e));
}
}
private void Show_shortcut_win(String uid, String name, String binding) {
Xog_bnd_win win = new Xog_bnd_win();
win.Show(app.Gui_mgr().Kit(), app.Gui_mgr().Browser_win().Win_box(), bnd_mgr.Bnd_parser(), name, binding);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Xoa_fmtr_itm.Invk_get_at)) return this.Get_at(m.ReadInt("v"));
else if (ctx.Match(k, Xoa_fmtr_itm.Invk_len)) return this.Len();
else if (ctx.Match(k, Xoa_fmtr_itm.Invk_sorter)) return sorter;
else if (ctx.Match(k, Invk_set_bulk)) Set_bulk(m.ReadBry("v"));
else if (ctx.Match(k, Invk_init)) return Init(m.ReadStr("v"));
else if (ctx.Match(k, Invk_show_shortcut_win)) Show_shortcut_win(m.ReadStr("uid"), m.ReadStr("name"), m.ReadStr("binding"));
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_set_bulk = "set_bulk", Invk_init = "init", Invk_show_shortcut_win = "show_shortcut_win";
}

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.apps.cfgs.old; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
public class Xocfg_gui_mgr implements GfoInvkAble {
public Xocfg_gui_mgr(Xoae_app app) {bnd_mgr = new Xocfg_bnd_mgr(app);}
public Xocfg_tab_mgr Tab_mgr() {return tab_mgr;} private Xocfg_tab_mgr tab_mgr = new Xocfg_tab_mgr();
public Xocfg_bnd_mgr Bnd_mgr() {return bnd_mgr;} private Xocfg_bnd_mgr bnd_mgr;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_tabs)) return tab_mgr;
else if (ctx.Match(k, Invk_bnds)) return bnd_mgr;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_tabs = "tabs", Invk_bnds = "bnds";
}

View File

@@ -0,0 +1,34 @@
/*
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.cfgs.old; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
public class Xocfg_regy implements GfoInvkAble {
public Xocfg_regy(Xoae_app app) {
app_cfg = new Xocfg_root(app, Xocfg_root_.Tid_app);
}
public Xocfg_root App() {return app_cfg;} private Xocfg_root app_cfg;
public Xocfg_root Get_or_null(String key) {
if (String_.Eq(key, Key_app)) return app_cfg;
else throw Err_.new_unhandled(key);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_get)) return Get_or_null(m.ReadStrOr("v", Key_app));
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_get = "get";
public static final String Key_app = null;
}

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.apps.cfgs.old; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
public class Xocfg_root implements GfoInvkAble {
public Xocfg_root(Xoae_app app, byte tid) {
this.tid = tid;
this.gui_mgr = new Xocfg_gui_mgr(app);
}
public byte Tid() {return tid;} private byte tid;
public Xocfg_gui_mgr Gui_mgr() {return gui_mgr;} private Xocfg_gui_mgr gui_mgr;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_gui)) return gui_mgr;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_gui = "gui";
}

View File

@@ -0,0 +1,21 @@
/*
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.cfgs.old; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
public class Xocfg_root_ {
public static final byte Tid_app = 0, Tid_wiki = 1, Tid_ns = 2;
}

View File

@@ -0,0 +1,69 @@
/*
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.cfgs.old; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
import gplx.xowa.guis.views.*;
public class Xocfg_tab_btn_mgr implements GfoInvkAble, GfoEvMgrOwner {
public Xocfg_tab_btn_mgr() {
evMgr = GfoEvMgr.new_(this);
}
public GfoEvMgr EvMgr() {return evMgr;} private GfoEvMgr evMgr;
public int Height() {return height;} private int height = 20;
public boolean Place_on_top() {return place_on_top;} private boolean place_on_top = true;
public boolean Curved() {return curved;} private boolean curved = false;
public boolean Close_visible() {return close_visible;} private boolean close_visible = true;
public boolean Unselected_close_visible() {return unselected_close_visible;} private boolean unselected_close_visible = true;
public int Text_min_chars() {return text_min_chars;} public Xocfg_tab_btn_mgr Text_min_chars_(int v) {text_min_chars = v; return this;} private int text_min_chars = -1;
public int Text_max_chars() {return text_max_chars;} public Xocfg_tab_btn_mgr Text_max_chars_(int v) {text_max_chars = v; return this;} private int text_max_chars = 40;
public boolean Hide_if_one() {return hide_if_one;} public Xocfg_tab_btn_mgr Hide_if_one_(boolean v) {hide_if_one = v; return this;} private boolean hide_if_one;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_place_on_top)) return Yn.To_str(place_on_top);
else if (ctx.Match(k, Invk_place_on_top_)) {place_on_top = m.ReadYn("v"); GfoEvMgr_.PubVal(this, Evt_place_on_top_changed, place_on_top);}
else if (ctx.Match(k, Invk_curved)) return Yn.To_str(curved);
else if (ctx.Match(k, Invk_curved_)) {curved = m.ReadYn("v"); GfoEvMgr_.PubVal(this, Evt_curved_changed, curved);}
else if (ctx.Match(k, Invk_height)) return height;
else if (ctx.Match(k, Invk_height_)) {height = m.ReadInt("v"); GfoEvMgr_.PubVal(this, Evt_height_changed, height);}
else if (ctx.Match(k, Invk_close_visible)) return Yn.To_str(close_visible);
else if (ctx.Match(k, Invk_close_visible_)) {close_visible = m.ReadYn("v"); GfoEvMgr_.PubVal(this, Evt_close_visible_changed, close_visible);}
else if (ctx.Match(k, Invk_unselected_close_visible)) return Yn.To_str(unselected_close_visible);
else if (ctx.Match(k, Invk_unselected_close_visible_)) {unselected_close_visible = m.ReadYn("v"); GfoEvMgr_.PubVal(this, Evt_unselected_close_visible_changed, unselected_close_visible);}
else if (ctx.Match(k, Invk_text_min_chars)) return text_min_chars;
else if (ctx.Match(k, Invk_text_min_chars_)) {text_min_chars = m.ReadInt("v"); GfoEvMgr_.PubVal(this, Evt_text_min_chars_changed, text_min_chars);}
else if (ctx.Match(k, Invk_text_max_chars)) return text_max_chars;
else if (ctx.Match(k, Invk_text_max_chars_)) {text_max_chars = m.ReadInt("v"); GfoEvMgr_.PubVal(this, Evt_text_max_chars_changed, text_max_chars);}
else if (ctx.Match(k, Invk_hide_if_one)) return Yn.To_str(hide_if_one);
else if (ctx.Match(k, Invk_hide_if_one_)) {hide_if_one = m.ReadYn("v"); GfoEvMgr_.PubVal(this, Evt_hide_if_one_changed, hide_if_one);}
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_place_on_top = "place_on_top", Invk_place_on_top_ = "place_on_top_"
, Invk_curved = "curved", Invk_curved_ = "curved_"
, Invk_height = "height", Invk_height_ = "height_"
, Invk_close_visible = "close_visible", Invk_close_visible_ = "close_visible_"
, Invk_unselected_close_visible = "unselected_close_visible", Invk_unselected_close_visible_ = "unselected_close_visible_"
, Invk_text_min_chars = "text_min_chars", Invk_text_min_chars_ = "text_min_chars_"
, Invk_text_max_chars = "text_max_chars", Invk_text_max_chars_ = "text_max_chars_"
, Invk_hide_if_one = "hide_if_one", Invk_hide_if_one_ = "hide_if_one_"
;
public static final String
Evt_place_on_top_changed = "place_on_top_changed", Evt_curved_changed = "curved_changed", Evt_height_changed = "height_changed"
, Evt_close_visible_changed = "close_visible_changed", Evt_unselected_close_visible_changed = "unselected_close_visible_changed"
, Evt_text_min_chars_changed = "text_min_chars_changed", Evt_text_max_chars_changed = "text_max_chars_changed"
, Evt_hide_if_one_changed = "hide_if_one_changed"
;
}

View File

@@ -0,0 +1,27 @@
/*
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.cfgs.old; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
public class Xocfg_tab_mgr implements GfoInvkAble {
public Xocfg_tab_new_mgr New_mgr() {return new_mgr;} private Xocfg_tab_new_mgr new_mgr = new Xocfg_tab_new_mgr();
public Xocfg_tab_btn_mgr Btn_mgr() {return btn_mgr;} private Xocfg_tab_btn_mgr btn_mgr = new Xocfg_tab_btn_mgr();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_new)) return new_mgr;
else if (ctx.Match(k, Invk_btns)) return btn_mgr;
else return GfoInvkAble_.Rv_unhandled;
} private static final String Invk_new = "new", Invk_btns = "btns";
}

View File

@@ -0,0 +1,50 @@
/*
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.cfgs.old; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
public class Xocfg_tab_new_mgr implements GfoInvkAble {
public byte Insert_pos() {return insert_pos;} private byte insert_pos = Xocfg_new_tab_pos.Tid_cur_nxt;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_insert_pos)) return Xocfg_new_tab_pos.Xto_str(insert_pos);
else if (ctx.Match(k, Invk_insert_pos_)) insert_pos = Xocfg_new_tab_pos.Xto_tid(m.ReadStr("v"));
else if (ctx.Match(k, Invk_insert_pos_list)) return Xocfg_new_tab_pos.Options__all;
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_insert_pos = "insert_pos", Invk_insert_pos_ = "insert_pos_", Invk_insert_pos_list = "insert_pos_list";
}
class Xocfg_new_tab_pos {
public static final byte Tid_all_bgn = 0, Tid_all_end = 1, Tid_cur_prv = 2, Tid_cur_nxt = 3;
public static final String Key_all_bgn = "first", Key_all_end = "last", Key_cur_prv = "before", Key_cur_nxt = "after";
public static byte Xto_tid(String v) {
if (String_.Eq(v, Key_all_bgn)) return Tid_all_bgn;
else if (String_.Eq(v, Key_all_end)) return Tid_all_end;
else if (String_.Eq(v, Key_cur_prv)) return Tid_all_end;
else if (String_.Eq(v, Key_cur_nxt)) return Tid_all_end;
else throw Err_.new_unhandled(v);
}
public static String Xto_str(byte v) {
switch (v) {
case Tid_all_bgn: return Key_all_bgn;
case Tid_all_end: return Key_all_end;
case Tid_cur_prv: return Key_cur_prv;
case Tid_cur_nxt: return Key_cur_nxt;
default: throw Err_.new_unhandled(v);
}
}
public static KeyVal[] Options__all = KeyVal_.Ary(KeyVal_.new_(Key_all_bgn), KeyVal_.new_(Key_all_end), KeyVal_.new_(Key_cur_prv), KeyVal_.new_(Key_cur_nxt));
}