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:
@@ -56,7 +56,7 @@ public class IptArg_ {
|
||||
if (String_.Eq(bgn, "wheel")) return IptMouseWheel_.parse(raw);
|
||||
else if (String_.Eq(bgn, "mouse")) return IptMouseBtn_.parse(raw);
|
||||
else if (String_.Eq(bgn, "key")) return IptKey_.parse(raw);
|
||||
else return IptMacro._.parse(raw);
|
||||
else return IptMacro.Instance.parse(raw);
|
||||
}
|
||||
// NOTE: the following two methods should theoretically be interface methods, but since they are only used by two procs, they will be handled with if/else
|
||||
@gplx.Internal protected static IptEventType EventType_default(IptArg arg) {
|
||||
@@ -83,13 +83,13 @@ class IptMacro {
|
||||
if (regy == null) Init();
|
||||
Ordered_hash list = (Ordered_hash)regy.Get_by(prefix);
|
||||
if (list == null) {
|
||||
list = Ordered_hash_.new_();
|
||||
list = Ordered_hash_.New();
|
||||
regy.Add(prefix, list);
|
||||
}
|
||||
list.Add_if_dupe_use_nth(alias, arg);
|
||||
}
|
||||
void Init() {
|
||||
regy = Ordered_hash_.new_();
|
||||
regy = Ordered_hash_.New();
|
||||
Reg("mod", "c", IptKey_.add_(IptKey_.Ctrl));
|
||||
Reg("mod", "a", IptKey_.add_(IptKey_.Alt));
|
||||
Reg("mod", "s", IptKey_.add_(IptKey_.Shift));
|
||||
@@ -114,5 +114,5 @@ class IptMacro {
|
||||
}
|
||||
Ordered_hash regy;
|
||||
static Err parse_err(String raw, String loc) {return Err_.new_("gfui", "could not parse IptArg", "raw", raw, "loc", loc).Trace_ignore_add_1_();}
|
||||
public static final IptMacro _ = new IptMacro(); IptMacro() {}
|
||||
public static final IptMacro Instance = new IptMacro(); IptMacro() {}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class IptBndMgr implements SrlAble {
|
||||
List_adp del = List_adp_.new_();
|
||||
for (int i = 0; i < cfgs.Count(); i++) {
|
||||
IptCfgPtr ptr = (IptCfgPtr)cfgs.Get_at(i);
|
||||
IptCfg cfg = IptCfgRegy._.GetOrNew(ptr.CfgKey());
|
||||
IptCfg cfg = IptCfgRegy.Instance.GetOrNew(ptr.CfgKey());
|
||||
cfg.Owners_del(ptr.CfgKey());
|
||||
for (IptBndHash list : regy) {
|
||||
for (int j = 0; j < list.Count(); j++) {
|
||||
@@ -134,7 +134,7 @@ public class IptBndMgr implements SrlAble {
|
||||
if (evData.EventType() == IptEventType_.KeyDown) {
|
||||
chainP = chainMgr.Process(evData.EventArg());
|
||||
if (!String_.Eq(chainP, "") && itm == null)
|
||||
UsrDlg_._.Note("cancelled... {0}", chainP);
|
||||
UsrDlg_.Instance.Note("cancelled... {0}", chainP);
|
||||
}
|
||||
if (itm == null) {
|
||||
return false;
|
||||
@@ -148,7 +148,7 @@ public class IptBndMgr implements SrlAble {
|
||||
return this;
|
||||
}
|
||||
IptArgChainMgr chainMgr = new IptArgChainMgr();
|
||||
Ordered_hash hash = Ordered_hash_.new_(); IptEventType curTypes = IptEventType_.None;
|
||||
Ordered_hash hash = Ordered_hash_.New(); IptEventType curTypes = IptEventType_.None;
|
||||
public static IptBndMgr new_() {return new IptBndMgr();}
|
||||
IptBndHash[] regy = new IptBndHash[8];
|
||||
IptBndMgr() {ClearLists();}
|
||||
@@ -206,7 +206,7 @@ class IptBndHash implements SrlAble {
|
||||
((IptBndListItm)hash.Get_at(i)).Srl(m);
|
||||
return this;
|
||||
}
|
||||
Ordered_hash hash = Ordered_hash_.new_();
|
||||
Ordered_hash hash = Ordered_hash_.New();
|
||||
public IptBndHash(IptEventType eventType) {this.eventType = eventType;}
|
||||
}
|
||||
class IptBndListItm implements SrlAble {
|
||||
@@ -219,7 +219,7 @@ class IptBndListItm implements SrlAble {
|
||||
IptBnd bnd = (IptBnd)list.Get_at(i);
|
||||
try {bnd.Exec(evData);}
|
||||
catch (Exception exc) {
|
||||
UsrDlg_._.Stop(UsrMsg.new_("Error while processing event").Add("bnd", SrlAble_.To_str(bnd)).Add("exc", Err_.Message_lang(exc)));
|
||||
UsrDlg_.Instance.Stop(UsrMsg.new_("Error while processing event").Add("bnd", SrlAble_.To_str(bnd)).Add("exc", Err_.Message_lang(exc)));
|
||||
return false;
|
||||
}
|
||||
if (evData.CancelIteration) break;
|
||||
@@ -248,7 +248,7 @@ class IptArgChainMgr {
|
||||
}
|
||||
active = hash;
|
||||
activeKey = activeKey + arg.Key() + ",";
|
||||
UsrDlg_._.Note("{0} pressed...", activeKey);
|
||||
UsrDlg_.Instance.Note("{0} pressed...", activeKey);
|
||||
return "";
|
||||
}
|
||||
public String ActiveKey() {return activeKey;}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class IptBnd_upDownRange implements InjectAble, GfoInvkAble, GfoEvObj {
|
||||
if (ctx.Match(k, Invk_TxtBox_dec)) ExecCmd(cmd, curVal - 1);
|
||||
else if (ctx.Match(k, Invk_TxtBox_inc)) ExecCmd(cmd, curVal + 1);
|
||||
else if (ctx.Match(k, Invk_TxtBox_exec)) {
|
||||
Object valObj = IntClassXtn._.ParseOrNull(txtBox.Text()); if (valObj == null) throw Err_.new_wo_type("invalid int", "text", txtBox.Text());
|
||||
Object valObj = IntClassXtn.Instance.ParseOrNull(txtBox.Text()); if (valObj == null) throw Err_.new_wo_type("invalid int", "text", txtBox.Text());
|
||||
ExecCmd(doIt, Int_.cast(valObj));
|
||||
}
|
||||
else if (ctx.Match(k, evt)) WhenEvt(ctx, m);
|
||||
@@ -41,7 +41,7 @@ public class IptBnd_upDownRange implements InjectAble, GfoInvkAble, GfoEvObj {
|
||||
public int Adj() {return adj;} public IptBnd_upDownRange Adj_(int v) {adj = v; return this;} int adj;
|
||||
void WhenEvt(GfsCtx ctx, GfoMsg m) {
|
||||
curVal = m.ReadInt(arg) + adj;
|
||||
txtBox.Text_(Int_.Xto_str(curVal));
|
||||
txtBox.Text_(Int_.To_str(curVal));
|
||||
}
|
||||
void ExecCmd(String c, int val) {
|
||||
GfoInvkAble_.InvkCmd_val(src, c, val - adj);
|
||||
|
||||
@@ -70,7 +70,7 @@ class IptCfg_base implements IptCfg {
|
||||
}
|
||||
list.Add(owner);
|
||||
owner.IptBnds().Cfgs().Add(new IptCfgPtr(cfgKey, bndKey));
|
||||
} Ordered_hash owners = Ordered_hash_.new_();
|
||||
} Ordered_hash owners = Ordered_hash_.New();
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.MatchIn(k, Invk_Add, Invk_set)) {
|
||||
String bndKey = m.ReadStr("bndKey");
|
||||
@@ -82,7 +82,7 @@ class IptCfg_base implements IptCfg {
|
||||
return this;
|
||||
} public static final String Invk_Add = "Add", Invk_set = "set";
|
||||
public IptCfg_base(String cfgKey) {this.cfgKey = cfgKey;}
|
||||
Ordered_hash hash = Ordered_hash_.new_();
|
||||
Ordered_hash hash = Ordered_hash_.New();
|
||||
public Object NewByKey(Object o) {return new IptCfg_base((String)o);} @gplx.Internal protected static final IptCfg HashProto = new IptCfg_base(); @gplx.Internal protected IptCfg_base() {}
|
||||
}
|
||||
class IptCfgPtr {
|
||||
|
||||
@@ -27,7 +27,7 @@ public class IptCfgRegy implements GfoInvkAble {
|
||||
}
|
||||
return this;
|
||||
} public static final String Invk_Get = "Get", Invk_get = "get";
|
||||
Ordered_hash hash = Ordered_hash_.new_();
|
||||
public static final IptCfgRegy _ = new IptCfgRegy();
|
||||
Ordered_hash hash = Ordered_hash_.New();
|
||||
public static final IptCfgRegy Instance = new IptCfgRegy();
|
||||
public IptCfgRegy() {}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class IptCfg_ {
|
||||
public static final IptCfg Null = IptCfg_null._;
|
||||
public static IptCfg new_(String key) {return IptCfgRegy._.GetOrNew(key);}
|
||||
public static final IptCfg Null = IptCfg_null.Instance;
|
||||
public static IptCfg new_(String key) {return IptCfgRegy.Instance.GetOrNew(key);}
|
||||
}
|
||||
class IptCfg_null implements IptCfg {
|
||||
public String CfgKey() {return "<<NULL KEY>>";}
|
||||
@@ -27,5 +27,5 @@ class IptCfg_null implements IptCfg {
|
||||
public void Owners_del(String key) {}
|
||||
public Object NewByKey(Object o) {return this;}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {return GfoInvkAble_.Rv_unhandled;}
|
||||
public static final IptCfg_null _ = new IptCfg_null(); IptCfg_null() {}
|
||||
public static final IptCfg_null Instance = new IptCfg_null(); IptCfg_null() {}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.gfui; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class IptCfg_tst {
|
||||
@Before public void setup() {
|
||||
IptCfgRegy._.Clear();
|
||||
IptCfgRegy.Instance.Clear();
|
||||
box = new IptBndsOwner_mok();
|
||||
cfg = new IptCfg_mok();
|
||||
key = IptBndsOwner_mok.Invk_Reg;
|
||||
|
||||
@@ -30,7 +30,7 @@ class IptEventMgr implements GfoInvkAble {
|
||||
@gplx.Internal protected static void ExecKeyPress(GfuiElem sender, IptEvtDataKeyHeld keyPressState) {
|
||||
// Tfds.Write(keyPressState.KeyChar());
|
||||
if (keyHandled) {keyPressState.Handled_set(true); return;}
|
||||
IptEventData iptData = IptEventData.new_(sender, IptEventType_.KeyPress, IptKeyStrMgr._.FetchByKeyPress((int)(byte)keyPressState.KeyChar()), keyStateCur, keyPressState, mouseStateCur);
|
||||
IptEventData iptData = IptEventData.new_(sender, IptEventType_.KeyPress, IptKeyStrMgr.Instance.FetchByKeyPress((int)(byte)keyPressState.KeyChar()), keyStateCur, keyPressState, mouseStateCur);
|
||||
sender.IptBnds().Process(iptData);
|
||||
SendData(iptData);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class IptEvtDataKey {
|
||||
IptKey keyArg = IptKey_.api_(val);
|
||||
return new_(keyArg);
|
||||
}
|
||||
@gplx.Internal protected static IptEvtDataKey new_(IptKey key) {
|
||||
public static IptEvtDataKey new_(IptKey key) {
|
||||
IptEvtDataKey rv = new IptEvtDataKey();
|
||||
rv.key = key;
|
||||
return rv;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class IptKey implements IptArg {
|
||||
public String Key() {return key;} private final String key;
|
||||
public int Val() {return val;} private final int val;
|
||||
public boolean Eq(IptArg comp) {return String_.Eq(key, comp.Key());}
|
||||
public String XtoUiStr() {return IptKeyStrMgr._.To_str(this);}
|
||||
public String XtoUiStr() {return IptKeyStrMgr.Instance.To_str(this);}
|
||||
public IptKey Add(IptKey comp) {return IptKey_.add_(this, comp);}
|
||||
public boolean Mod_shift() {return Bitmask_.Has_int(val, IptKey_.Shift.Val());}
|
||||
public boolean Mod_ctrl() {return Bitmask_.Has_int(val, IptKey_.Ctrl.Val());}
|
||||
|
||||
@@ -70,6 +70,6 @@ class IptKeyStrMgr {
|
||||
charKeys[charVal] = k;
|
||||
}
|
||||
IptKey[] charKeys;
|
||||
Hash_adp literals; Ordered_hash keys = Ordered_hash_.new_();
|
||||
public static final IptKeyStrMgr _ = new IptKeyStrMgr(); IptKeyStrMgr() {}
|
||||
Hash_adp literals; Ordered_hash keys = Ordered_hash_.New();
|
||||
public static final IptKeyStrMgr Instance = new IptKeyStrMgr(); IptKeyStrMgr() {}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class IptKeyStrMgr_tst {
|
||||
tst_FetchByKeyPress('A', IptKey_.add_(IptKey_.A, IptKey_.Shift));
|
||||
tst_FetchByKeyPress('1', IptKey_.add_(IptKey_.D1));
|
||||
tst_FetchByKeyPress('!', IptKey_.add_(IptKey_.D1, IptKey_.Shift));
|
||||
} void tst_FetchByKeyPress(char c, IptKey expd) {Tfds.Eq(expd.Key(), IptKeyStrMgr._.FetchByKeyPress((int)c).Key());}
|
||||
} void tst_FetchByKeyPress(char c, IptKey expd) {Tfds.Eq(expd.Key(), IptKeyStrMgr.Instance.FetchByKeyPress((int)c).Key());}
|
||||
void tst_XtoUiStr(IptKey key, String expd) {Tfds.Eq(expd, key.XtoUiStr());}
|
||||
void tst_XtoUiStrShifted(IptKey key, String expdNormal, String expdShifted) {
|
||||
Tfds.Eq(expdNormal, key.XtoUiStr());
|
||||
|
||||
@@ -33,7 +33,7 @@ public class IptKey_ {
|
||||
}
|
||||
public static IptKey api_(int val) {
|
||||
IptKey rv = (IptKey)enm_mgr.Get(val);
|
||||
return (rv == null) ? new_(val, "key_" + Int_.Xto_str(val)) : rv;
|
||||
return (rv == null) ? new_(val, "key_" + Int_.To_str(val)) : rv;
|
||||
}
|
||||
public static IptKey parse(String raw) {return get_or_new_(enm_mgr.GetVal(raw));}
|
||||
public static IptKey rdr_or_(DataRdr rdr, String key, IptKey or) {
|
||||
@@ -44,7 +44,7 @@ public class IptKey_ {
|
||||
List_adp list = List_adp_.new_();
|
||||
for (IptKey key : add)
|
||||
list.Add(key);
|
||||
IptKeyStrMgr._.XtoIptKeyAry(list);
|
||||
IptKeyStrMgr.Instance.XtoIptKeyAry(list);
|
||||
for (IptKey key : del)
|
||||
list.Del(key);
|
||||
return list;
|
||||
@@ -53,7 +53,7 @@ public class IptKey_ {
|
||||
List_adp list = List_adp_.new_();
|
||||
for (IptKey key : add)
|
||||
list.Add(key);
|
||||
IptKeyStrMgr._.XtoIptKeyAry(list);
|
||||
IptKeyStrMgr.Instance.XtoIptKeyAry(list);
|
||||
for (IptKey key : del)
|
||||
list.Del(key);
|
||||
return (IptKey[])list.To_ary(IptKey.class);
|
||||
@@ -105,7 +105,7 @@ public class IptKey_ {
|
||||
private static Ordered_hash ui_str_hash;
|
||||
public static Ordered_hash Ui_str_hash() {
|
||||
if (ui_str_hash == null) {
|
||||
ui_str_hash = Ordered_hash_.new_();
|
||||
ui_str_hash = Ordered_hash_.New();
|
||||
All_add(ui_str_hash
|
||||
, IptKey_.Back, IptKey_.Tab, IptKey_.Clear, IptKey_.Enter
|
||||
, IptKey_.Pause, IptKey_.CapsLock, IptKey_.Escape, IptKey_.Space
|
||||
@@ -147,7 +147,7 @@ public class IptKey_ {
|
||||
rv += "+";
|
||||
}
|
||||
IptKey key = (IptKey)IptKey_.Ui_str_hash().Get_by(Int_obj_ref.new_(val));
|
||||
String key_str = key == null ? "key.#" + Int_.Xto_str(val) : key.Key();
|
||||
String key_str = key == null ? "key.#" + Int_.To_str(val) : key.Key();
|
||||
return rv + key_str;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user