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:
BIN
150_gfui/lib/swt-gtk-3.8.jar
Normal file
BIN
150_gfui/lib/swt-gtk-3.8.jar
Normal file
Binary file not shown.
@@ -52,5 +52,5 @@ class ColorAdpCache {
|
||||
return (java.awt.Color)rv;
|
||||
}
|
||||
Hash_adp hash = Hash_adp_.new_();
|
||||
public static final ColorAdpCache _ = new ColorAdpCache(); ColorAdpCache() {}
|
||||
public static final ColorAdpCache Instance = new ColorAdpCache(); ColorAdpCache() {}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class FontAdp implements GfoInvkAble {
|
||||
@gplx.Internal protected Font UnderFont() {if (font == null) InitUnder(); return font;} Font font = null;
|
||||
void InitUnder() {
|
||||
if (Env_.Mode_testing()) return; // WORKAROUND/.NET: NUnit will randomlyly throw exceptions
|
||||
font = FontAdpCache._.GetNativeFont(this);
|
||||
font = FontAdpCache.Instance.GetNativeFont(this);
|
||||
if (ownerGxwCore != null) ownerGxwCore.TextFont_set(this);
|
||||
}
|
||||
@gplx.Internal protected FontAdp OwnerGxwCore_(GxwCore_base v) {ownerGxwCore = v; return this;} GxwCore_base ownerGxwCore;
|
||||
@@ -77,5 +77,5 @@ class FontAdpCache {
|
||||
public static int XtoOsDpi(float v) {return Math.round((v * 72) / screenResolutionInDpi);} // WORKAROUND/JAVA: Java needs 72 dpi screen resolution; wnt uses 96 or 120 dpi
|
||||
public static int XtoJavaDpi(float v) {return Math.round((v * screenResolutionInDpi) / 72);}
|
||||
static int screenResolutionInDpi = -1;
|
||||
public static final FontAdpCache _ = new FontAdpCache(); FontAdpCache() {}
|
||||
public static final FontAdpCache Instance = new FontAdpCache(); FontAdpCache() {}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class PenAdp implements GfoInvkAble {
|
||||
public float Width() {return width;} public void Width_set(float v) {width = v; InitUnder();} float width;
|
||||
public ColorAdp Color() {return color;} public void Color_set(ColorAdp v) {color = v; InitUnder();} ColorAdp color;
|
||||
public BasicStroke UnderStroke() {if (underStroke == null) InitUnder(); return underStroke;} BasicStroke underStroke;
|
||||
void InitUnder() {underStroke = PenAdpCache._.Fetch(width);}
|
||||
void InitUnder() {underStroke = PenAdpCache.Instance.Fetch(width);}
|
||||
public PenAdp Clone() {return PenAdp_.new_(color, width);}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_Width_)) Width_set(m.ReadFloat(Invk_Width_));
|
||||
@@ -49,5 +49,5 @@ class PenAdpCache {
|
||||
return (BasicStroke)rv;
|
||||
}
|
||||
Hash_adp hash = Hash_adp_.new_();
|
||||
public static final PenAdpCache _ = new PenAdpCache(); PenAdpCache() {}
|
||||
public static final PenAdpCache Instance = new PenAdpCache(); PenAdpCache() {}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class SolidBrushAdp_ {
|
||||
public static final SolidBrushAdp Black = new_(ColorAdp_.Black);
|
||||
public static final SolidBrushAdp White = new_(ColorAdp_.White);
|
||||
public static final SolidBrushAdp Null = new_(ColorAdp_.Null);
|
||||
public static SolidBrushAdp new_(ColorAdp color) {return SolidBrushAdpCache._.Get_by(color);}
|
||||
public static SolidBrushAdp new_(ColorAdp color) {return SolidBrushAdpCache.Instance.Get_by(color);}
|
||||
}
|
||||
class SolidBrushAdpCache {
|
||||
public SolidBrushAdp Get_by(ColorAdp color) {
|
||||
@@ -34,5 +34,5 @@ class SolidBrushAdpCache {
|
||||
return rv;
|
||||
}
|
||||
Hash_adp hash = Hash_adp_.new_();
|
||||
public static final SolidBrushAdpCache _ = new SolidBrushAdpCache(); SolidBrushAdpCache() {}
|
||||
public static final SolidBrushAdpCache Instance = new SolidBrushAdpCache(); SolidBrushAdpCache() {}
|
||||
}
|
||||
|
||||
@@ -24,23 +24,23 @@ import java.awt.geom.Rectangle2D;
|
||||
import javax.swing.JComponent;
|
||||
public class GfxAdpBase implements GfxAdp {
|
||||
public void DrawLine(PenAdp pen, PointAdp src, PointAdp trg) {
|
||||
gfx.setColor(ColorAdpCache._.GetNativeColor(pen.Color()));
|
||||
gfx.setColor(ColorAdpCache.Instance.GetNativeColor(pen.Color()));
|
||||
gfx.setStroke(pen.UnderStroke());
|
||||
gfx.drawLine(src.X(), src.Y(), trg.X(), trg.Y());
|
||||
}
|
||||
public void DrawRect(PenAdp pen, PointAdp pos, SizeAdp size) {this.DrawRect(pen, pos.X(), pos.Y(), size.Width(), size.Height());}
|
||||
public void DrawRect(PenAdp pen, RectAdp rect) {this.DrawRect(pen, rect.X(), rect.Y(), rect.Width(), rect.Height());}
|
||||
public void DrawRect(PenAdp pen, int x, int y, int width, int height) {
|
||||
gfx.setPaint(ColorAdpCache._.GetNativeColor(pen.Color()));
|
||||
gfx.setPaint(ColorAdpCache.Instance.GetNativeColor(pen.Color()));
|
||||
gfx.setStroke(pen.UnderStroke());
|
||||
gfx.drawRect(x, y, width, height);
|
||||
}
|
||||
public void FillRect(SolidBrushAdp brush, int x, int y, int width, int height) {
|
||||
gfx.setPaint(ColorAdpCache._.GetNativeColor(brush.Color()));
|
||||
gfx.setPaint(ColorAdpCache.Instance.GetNativeColor(brush.Color()));
|
||||
gfx.fillRect(x, y, width, height);
|
||||
}
|
||||
public void DrawStringXtn(String s, FontAdp font, SolidBrushAdp brush, float x, float y, float width, float height, GfxStringData sd) {
|
||||
gfx.setPaint(ColorAdpCache._.GetNativeColor(brush.Color()));
|
||||
gfx.setPaint(ColorAdpCache.Instance.GetNativeColor(brush.Color()));
|
||||
// height = y - ascent + descent -> rect.y - rect.height [assume ascent] + 2 [assume descent]
|
||||
gfx.setClip((int)x, (int)y - (int)height + 2, (int)width, (int)height);
|
||||
if (sd == null || sd.mnemonicString == null) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class GftGrid_fx {
|
||||
}
|
||||
public GftGrid_fx ini_AddItms(int num) {
|
||||
for (int i = 0; i < num; i++)
|
||||
itms.Add(new GftItem_mok());//.Key_("key" + Int_.Xto_str(i)));
|
||||
itms.Add(new GftItem_mok());//.Key_("key" + Int_.To_str(i)));
|
||||
return this;
|
||||
}
|
||||
public GftGrid_fx ini_ItmWidth(int i, int width) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.awt.KeyboardFocusManager;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
class GxwCbkHost_ {
|
||||
public class GxwCbkHost_ {
|
||||
public static final GxwCbkHost Null = new GfuiHost_cls_null();
|
||||
public static final boolean ExecKeyEvent(GxwCbkHost host, KeyEvent e) {
|
||||
boolean rv = true; int id = e.getID(), val = e.getKeyCode();
|
||||
|
||||
@@ -55,14 +55,14 @@ public class GxwCore_lang extends GxwCore_base {
|
||||
@Override public ColorAdp BackColor() {return XtoColorAdp(control.getBackground());}
|
||||
@Override public void BackColor_set(ColorAdp v) {
|
||||
if (control instanceof JComponent) {
|
||||
((JComponent)control).setBackground(ColorAdpCache._.GetNativeColor(v));
|
||||
((JComponent)control).setBackground(ColorAdpCache.Instance.GetNativeColor(v));
|
||||
}
|
||||
else if (control instanceof RootPaneContainer) {
|
||||
RootPaneContainer container = (RootPaneContainer)control;
|
||||
container.getContentPane().setBackground(ColorAdpCache._.GetNativeColor(v));
|
||||
container.getContentPane().setBackground(ColorAdpCache.Instance.GetNativeColor(v));
|
||||
}
|
||||
}
|
||||
@Override public ColorAdp ForeColor() {return XtoColorAdp(control.getForeground());} @Override public void ForeColor_set(ColorAdp v) {control.setForeground(ColorAdpCache._.GetNativeColor(v));}
|
||||
@Override public ColorAdp ForeColor() {return XtoColorAdp(control.getForeground());} @Override public void ForeColor_set(ColorAdp v) {control.setForeground(ColorAdpCache.Instance.GetNativeColor(v));}
|
||||
@Override public FontAdp TextFont() {
|
||||
if (prvFont != null) return prvFont;
|
||||
Font f = control.getFont();
|
||||
|
||||
@@ -31,9 +31,9 @@ public abstract class GxwElemFactory_base {
|
||||
// @gplx.Internal protected GxwElem spacer_() {return MockControl.new_();}
|
||||
}
|
||||
class GxwElemFactory_ {
|
||||
public static GxwElemFactory_base _ = new GxwElemFactory_cls_mock();
|
||||
public static void winForms_() {_ = new GxwElemFactory_cls_lang();}
|
||||
public static void swt_(org.eclipse.swt.widgets.Display display) {_ = new GxwElemFactory_swt(display);}
|
||||
public static GxwElemFactory_base Instance = new GxwElemFactory_cls_mock();
|
||||
public static void winForms_() {Instance = new GxwElemFactory_cls_lang();}
|
||||
public static void swt_(org.eclipse.swt.widgets.Display display) {Instance = new GxwElemFactory_swt(display);}
|
||||
}
|
||||
class GxwElemFactory_cls_lang extends GxwElemFactory_base {
|
||||
@gplx.Internal @Override protected GxwElem control_() {return new GxwElem_lang();}
|
||||
@@ -61,9 +61,9 @@ class GxwElemFactory_cls_lang extends GxwElemFactory_base {
|
||||
}
|
||||
class GxwElemFactory_cls_mock extends GxwElemFactory_base {
|
||||
@gplx.Internal @Override protected GxwElem control_() {return GxwElem_mock_base.new_();}
|
||||
@gplx.Internal @Override protected GxwWin win_app_() {return MockForm._;}
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(KeyValHash ctorArgs) {return MockForm._;}
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(KeyValHash ctorArgs) {return MockForm._;}
|
||||
@gplx.Internal @Override protected GxwWin win_app_() {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(KeyValHash ctorArgs) {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(KeyValHash ctorArgs) {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwElem lbl_() {return GxwElem_mock_base.new_();}
|
||||
@gplx.Internal @Override protected GxwTextFld text_fld_() {return new MockTextBox();}
|
||||
@gplx.Internal @Override protected GxwTextFld text_memo_() {return new MockTextBoxMulti();}
|
||||
|
||||
@@ -159,8 +159,8 @@ class GxwTextHtml_editor extends JEditorPane implements GxwTextHtml {
|
||||
}
|
||||
public String Html_print() {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
sb.Add("selBgn=").Add(Int_.Xto_str(Html_sel_bgn())).Add_char_crlf();
|
||||
sb.Add("selEnd=").Add(Int_.Xto_str(Html_sel_end())).Add_char_crlf();
|
||||
sb.Add("selBgn=").Add(Int_.To_str(Html_sel_bgn())).Add_char_crlf();
|
||||
sb.Add("selEnd=").Add(Int_.To_str(Html_sel_end())).Add_char_crlf();
|
||||
sb.Add("selTxt=").Add(Html_sel_text()).Add_char_crlf();
|
||||
KeyVal[] atrs = Html_sel_atrs();
|
||||
for (int i = 0; i < atrs.length; i++) {
|
||||
|
||||
@@ -27,5 +27,5 @@ public class MockForm extends GxwElem_mock_base implements GxwWin {
|
||||
public void OpenedCmd_set(GfoInvkAbleCmd v) {}
|
||||
public void TaskbarVisible_set(boolean val) {}
|
||||
public void TaskbarParkingWindowFix(GxwElem form) {}
|
||||
public static final MockForm _ = new MockForm(); MockForm() {}
|
||||
public static final MockForm Instance = new MockForm(); MockForm() {}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class GfoConsoleWin implements GfoInvkAble, UsrMsgWkr {
|
||||
IptBnd_.cmd_to_(IptCfg_.Null, consoleBox, cmds, GfoConsoleWinCmds.Invk_Clear, IptKey_.add_(IptKey_.Ctrl, IptKey_.Alt, IptKey_.C));
|
||||
logger = new GfuiTextBoxLogger(this).Init(statusBox);
|
||||
// gplx.ios.GfioApp.InitGfs();
|
||||
UsrDlg_._.Reg(UsrMsgWkr_.Type_Note, this);
|
||||
UsrDlg_.Instance.Reg(UsrMsgWkr_.Type_Note, this);
|
||||
|
||||
win.Lyt_activate();
|
||||
win.Lyt().Bands_add(GftBand.fillWidth_());
|
||||
@@ -82,7 +82,7 @@ public class GfoConsoleWin implements GfoInvkAble, UsrMsgWkr {
|
||||
return this;
|
||||
} public static final String Invk_Show = "Show"
|
||||
;
|
||||
public static final GfoConsoleWin _ = new GfoConsoleWin(); GfoConsoleWin() {}
|
||||
public static final GfoConsoleWin Instance = new GfoConsoleWin(); GfoConsoleWin() {}
|
||||
}
|
||||
class GfoConsoleWinCmds implements GfoInvkAble {
|
||||
GfuiWin win; GfuiTextBox consoleFilBox, consoleBox, statusBox, resultBox;
|
||||
@@ -92,8 +92,8 @@ class GfoConsoleWinCmds implements GfoInvkAble {
|
||||
consoleBox = (GfuiTextBox)win.SubElems().Get_by("consoleBox");
|
||||
resultBox = (GfuiTextBox)win.SubElems().Get_by("resultBox");
|
||||
statusBox = (GfuiTextBox)win.SubElems().Get_by("statusBox");
|
||||
GfsCore._.AddObj(this, "gfoConsoleWin");
|
||||
GfsCore._.ExecRegy("gplx.gfui.GfoConsoleWin.ini");
|
||||
GfsCore.Instance.AddObj(this, "gfoConsoleWin");
|
||||
GfsCore.Instance.ExecRegy("gplx.gfui.GfoConsoleWin.ini");
|
||||
}
|
||||
public void Results_add(String s) {
|
||||
if (!String_.Has_at_end(s, GfuiTextBox_.NewLine))
|
||||
@@ -106,9 +106,9 @@ class GfoConsoleWinCmds implements GfoInvkAble {
|
||||
String cmdText = consoleBox.SelLen() == 0 ? consoleBox.Text() : consoleBox.SelText();
|
||||
String cmd = FixNewLines(cmdText);
|
||||
GfoMsg runMsg = GfoMsg_.Null;
|
||||
try {runMsg = GfsCore._.MsgParser().ParseToMsg(cmd);} catch (Exception e) {statusBox.Text_("invalid gfml " + Err_.Message_gplx_full(e)); return;}
|
||||
try {runMsg = GfsCore.Instance.MsgParser().ParseToMsg(cmd);} catch (Exception e) {statusBox.Text_("invalid gfml " + Err_.Message_gplx_full(e)); return;}
|
||||
GfsCtx ctx = GfsCtx.new_();
|
||||
Object rv = GfsCore._.ExecMany(ctx, runMsg);
|
||||
Object rv = GfsCore.Instance.ExecMany(ctx, runMsg);
|
||||
resultBox.Text_(Object_.Xto_str_strict_or_empty(rv));
|
||||
}
|
||||
void Help() {
|
||||
@@ -120,9 +120,9 @@ class GfoConsoleWinCmds implements GfoInvkAble {
|
||||
try {runMsg = GfmlDataNde.XtoMsgNoRoot(cmd);} catch (Exception e) {statusBox.Text_("invalid gfml " + Err_.Message_gplx_full(e)); return;}
|
||||
GfsCtx ctx = GfsCtx.new_();
|
||||
try {
|
||||
Object rv = GfsCore._.ExecOne(ctx, runMsg);
|
||||
Object rv = GfsCore.Instance.ExecOne(ctx, runMsg);
|
||||
if (rv != GfoInvkAble_.Rv_handled && rv != GfoInvkAble_.Rv_unhandled) {
|
||||
UsrDlg_._.Note(Object_.Xto_str_strict_or_empty(rv));
|
||||
UsrDlg_.Instance.Note(Object_.Xto_str_strict_or_empty(rv));
|
||||
}
|
||||
// Results_add(FixNewLines(ctx.Results_XtoStr()));
|
||||
} catch (Exception e) {statusBox.Text_("help failed " + Err_.Message_gplx_full(e)); return;}
|
||||
@@ -137,7 +137,7 @@ class GfoConsoleWinCmds implements GfoInvkAble {
|
||||
}
|
||||
else
|
||||
url = Io_url_.new_any_(consoleFilStr);
|
||||
Io_mgr.I.SaveFilStr(url, consoleBox.Text());
|
||||
Io_mgr.Instance.SaveFilStr(url, consoleBox.Text());
|
||||
}
|
||||
void Load() {
|
||||
String consoleFilStr = consoleFilBox.Text();
|
||||
@@ -149,7 +149,7 @@ class GfoConsoleWinCmds implements GfoInvkAble {
|
||||
dir = dir.OwnerDir();
|
||||
}
|
||||
Io_url url = GfuiIoDialogUtl.SelectFile(dir); if (url == Io_url_.Empty) return;
|
||||
consoleBox.Text_(Io_mgr.I.LoadFilStr(url));
|
||||
consoleBox.Text_(Io_mgr.Instance.LoadFilStr(url));
|
||||
}
|
||||
String FixNewLines(String cmd) {
|
||||
cmd = String_.Replace(cmd, "\n", "\r\n");
|
||||
@@ -193,7 +193,7 @@ class GfoConsoleWinCmds implements GfoInvkAble {
|
||||
Io_url v = m.ReadIoUrl("v");
|
||||
if (ctx.Deny()) return this;
|
||||
consoleFilBox.Text_(v.Xto_api());
|
||||
consoleBox.Text_(Io_mgr.I.LoadFilStr(v));
|
||||
consoleBox.Text_(Io_mgr.Instance.LoadFilStr(v));
|
||||
}
|
||||
else return win.Invk(ctx, ikey, k, m);
|
||||
return this;
|
||||
|
||||
@@ -48,5 +48,5 @@ class GfuiFocusXferBnd implements InjectAble, GfoInvkAble {
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
} public static final String Invk_FocusNext = "FocusNext", Invk_FocusPrev = "FocusPrev";
|
||||
public static final GfuiFocusXferBnd _ = new GfuiFocusXferBnd(); GfuiFocusXferBnd() {}
|
||||
public static final GfuiFocusXferBnd Instance = new GfuiFocusXferBnd(); GfuiFocusXferBnd() {}
|
||||
}
|
||||
@@ -47,8 +47,8 @@ public class GfuiMenuBar implements GfoInvkAble {
|
||||
root.ForeColor_(ColorAdp_.Black).BackColor_(ColorAdp_.White);
|
||||
root.ExecProps();
|
||||
curOwnerItm = root;
|
||||
GfsCore._.AddObj(this, "GfuiMenuBar_");
|
||||
GfsCore._.ExecRegy("gplx.gfui.GfuiMenuBar.ini");
|
||||
GfsCore.Instance.AddObj(this, "GfuiMenuBar_");
|
||||
GfsCore.Instance.ExecRegy("gplx.gfui.GfuiMenuBar.ini");
|
||||
}
|
||||
catch (Exception e) {GfuiEnv_.ShowMsg(Err_.Message_gplx_full(e));}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class GfuiMenuBar implements GfoInvkAble {
|
||||
GfuiMenuBarItm itm = GfuiMenuBarItm.sub_(curOwnerItm);
|
||||
itm.Type_(GfuiMenuBarItmType.Spr);
|
||||
itm.Text_(text);
|
||||
itm.Key_(curOwnerItm.Key() + "." + text + Int_.Xto_str(separatorIdx++));
|
||||
itm.Key_(curOwnerItm.Key() + "." + text + Int_.To_str(separatorIdx++));
|
||||
itm.ExecProps();
|
||||
}
|
||||
else if (ctx.Match(k, Invk_RegCmd)) {
|
||||
@@ -197,8 +197,8 @@ class GfuiMenuBarItm {
|
||||
if (mnem != '\0') itm.setMnemonic(mnem);
|
||||
}
|
||||
void SetProps(JComponent itm) {
|
||||
if (backColor != null) itm.setBackground(ColorAdpCache._.GetNativeColor(backColor));
|
||||
if (foreColor != null) itm.setForeground(ColorAdpCache._.GetNativeColor(foreColor));
|
||||
if (backColor != null) itm.setBackground(ColorAdpCache.Instance.GetNativeColor(backColor));
|
||||
if (foreColor != null) itm.setForeground(ColorAdpCache.Instance.GetNativeColor(foreColor));
|
||||
itm.setFont(MakeFont(itm.getFont()));
|
||||
if (String_.Len(tipText) > 0) itm.setToolTipText(tipText);
|
||||
}
|
||||
@@ -258,7 +258,7 @@ class GxwBorderFactory {
|
||||
class GfuiMenuBarItmCmd implements ActionListener {
|
||||
public void actionPerformed(ActionEvent ev) {
|
||||
try {
|
||||
GfsCore._.ExecOne(GfsCtx._, GfuiMenuBarItm.CmdMsg(itm));
|
||||
GfsCore.Instance.ExecOne(GfsCtx.Instance, GfuiMenuBarItm.CmdMsg(itm));
|
||||
}
|
||||
catch (Exception e) {
|
||||
GfuiEnv_.ShowMsg(Err_.Message_gplx_full(e));
|
||||
|
||||
@@ -29,5 +29,5 @@ class GfuiTipTextMgr implements GfuiWinOpenAble {
|
||||
ToolTipManager.sharedInstance().setReshowDelay(0);
|
||||
jcomp.setToolTipText(sub.TipText());
|
||||
}
|
||||
public static final GfuiTipTextMgr _ = new GfuiTipTextMgr();
|
||||
public static final GfuiTipTextMgr Instance = new GfuiTipTextMgr();
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ public class GfuiWin extends GfuiElemBase {
|
||||
win.OpenedCmd_set(GfoInvkAbleCmd.new_(this, Evt_Opened));
|
||||
GfoEvMgr_.Sub(this, GfuiElemKeys.IptRcvd_evt, keyCmdMgr, GfuiWinKeyCmdMgr.CheckForHotKey_cmd);
|
||||
IptBnd_.cmd_(IptCfg_.Null, this, StopAppByAltF4_evt, IptKey_.Alt.Add(IptKey_.F4));
|
||||
// IptBnd_.cmd_to_(IptCfg_.Null, this, GfoConsoleWin._, GfoConsoleWin.Invk_Show, IptKey_.Ctrl.Add(IptKey_.Alt).Add(IptKey_.E));
|
||||
// IptBnd_.cmd_to_(IptCfg_.Null, this, GfoConsoleWin.Instance, GfoConsoleWin.Invk_Show, IptKey_.Ctrl.Add(IptKey_.Alt).Add(IptKey_.E));
|
||||
IptBnd_.cmd_(IptCfg_.Null, this, Invk_ShowFocusOwner, IptKey_.add_(IptKey_.Ctrl, IptKey_.Alt, IptKey_.F12));
|
||||
loadList.Add(keyCmdMgr); loadList.Add(GfuiTipTextMgr._);
|
||||
loadList.Add(keyCmdMgr); loadList.Add(GfuiTipTextMgr.Instance);
|
||||
focusMgr = GfuiWinFocusMgr.new_(this);
|
||||
}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@@ -56,16 +56,16 @@ public class GfuiWin extends GfuiElemBase {
|
||||
win.OpenedCmd_set(GfoInvkAbleCmd.new_(this, Evt_Opened));
|
||||
GfoEvMgr_.Sub(this, GfuiElemKeys.IptRcvd_evt, keyCmdMgr, GfuiWinKeyCmdMgr.CheckForHotKey_cmd);
|
||||
IptBnd_.cmd_(IptCfg_.Null, this, StopAppByAltF4_evt, IptKey_.Alt.Add(IptKey_.F4));
|
||||
IptBnd_.cmd_to_(IptCfg_.Null, this, GfoConsoleWin._, GfoConsoleWin.Invk_Show, IptKey_.Ctrl.Add(IptKey_.Alt).Add(IptKey_.E));
|
||||
IptBnd_.cmd_to_(IptCfg_.Null, this, GfoConsoleWin.Instance, GfoConsoleWin.Invk_Show, IptKey_.Ctrl.Add(IptKey_.Alt).Add(IptKey_.E));
|
||||
IptBnd_.cmd_(IptCfg_.Null, this, Invk_ShowFocusOwner, IptKey_.add_(IptKey_.Ctrl, IptKey_.Alt, IptKey_.F12));
|
||||
loadList.Add(keyCmdMgr); loadList.Add(GfuiTipTextMgr._);
|
||||
loadList.Add(keyCmdMgr); loadList.Add(GfuiTipTextMgr.Instance);
|
||||
focusMgr = GfuiWinFocusMgr.new_(this);
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {
|
||||
String type = (String)ctorArgs.FetchValOr(GfuiWin_.InitKey_winType, GfuiWin_.InitKey_winType_app);
|
||||
if (String_.Eq(type, GfuiWin_.InitKey_winType_tool)) return GxwElemFactory_._.win_tool_(ctorArgs);
|
||||
else if (String_.Eq(type, GfuiWin_.InitKey_winType_toaster)) return GxwElemFactory_._.win_toaster_(ctorArgs);
|
||||
else return GxwElemFactory_._.win_app_();
|
||||
if (String_.Eq(type, GfuiWin_.InitKey_winType_tool)) return GxwElemFactory_.Instance.win_tool_(ctorArgs);
|
||||
else if (String_.Eq(type, GfuiWin_.InitKey_winType_toaster)) return GxwElemFactory_.Instance.win_toaster_(ctorArgs);
|
||||
else return GxwElemFactory_.Instance.win_app_();
|
||||
}
|
||||
@Override public void Opened_cbk() {
|
||||
if (!smallOpenSize.Eq(SizeAdp_.Null)) super.Size_(smallOpenSize); // NOTE: call before opened = true, else Layout will happen again
|
||||
@@ -107,8 +107,8 @@ public class GfuiWin extends GfuiElemBase {
|
||||
else if (ctx.Match(k, Invk_Show)) Show();
|
||||
else if (ctx.Match(k, Evt_Opened)) Opened_cbk();
|
||||
else if (ctx.Match(k, StopAppByAltF4_evt)) StopAppByAltF4(IptEventData.ctx_(ctx, m));
|
||||
else if (ctx.Match(k, Invk_ShowFocusOwner)) GfuiEnv_.ShowMsg(GfuiFocusMgr._.FocusedElem().Key_of_GfuiElem());
|
||||
else if (ctx.Match(k, GfuiStatusBoxBnd.Invk_ShowTime)) {UsrDlg_._.Note(UsrMsg.new_(DateAdp_.Now().toString())); return this;}
|
||||
else if (ctx.Match(k, Invk_ShowFocusOwner)) GfuiEnv_.ShowMsg(GfuiFocusMgr.Instance.FocusedElem().Key_of_GfuiElem());
|
||||
else if (ctx.Match(k, GfuiStatusBoxBnd.Invk_ShowTime)) {UsrDlg_.Instance.Note(UsrMsg.new_(DateAdp_.Now().toString())); return this;}
|
||||
else if (ctx.MatchIn(k, Invk_Close, GfuiQuitMode.Destroy_cmd)) Close();
|
||||
else if (ctx.MatchIn(k, Invk_Hide, GfuiQuitMode.Suspend_cmd)) Hide();
|
||||
else {
|
||||
|
||||
@@ -60,9 +60,9 @@ public class GfuiWin_toaster extends GfuiWin { public void ShowPopup(GfuiWin own
|
||||
this.Pos_(screenX_max / 2 - this.Width()/2, PopupAnchorTop); //screenRect.Bottom - 1
|
||||
// gplx.gfui.npis.FormNpi.BringToFrontDoNotFocus(gplx.gfui.npis.ControlNpi.Hwnd(this.UnderElem()));
|
||||
if (!this.Visible()) {
|
||||
// GfuiElem last = GfuiFocusMgr._.FocusedElem();
|
||||
// GfuiElem last = GfuiFocusMgr.Instance.FocusedElem();
|
||||
this.Visible_on_();
|
||||
// GfuiFocusMgr._.FocusedElem_set(last);
|
||||
// GfuiFocusMgr.Instance.FocusedElem_set(last);
|
||||
}
|
||||
timer.Interval_(growingTimerInterval);
|
||||
popupState = PopupState.Growing;
|
||||
@@ -83,8 +83,8 @@ public class GfuiWin_toaster extends GfuiWin { public void ShowPopup(GfuiWin own
|
||||
timer.Enabled_on();
|
||||
}
|
||||
// public override boolean FocusGotCbk() {
|
||||
// GfuiElem last = GfuiFocusMgr._.FocusedElemPrev();
|
||||
// GfuiFocusMgr._.FocusedElem_set(last);
|
||||
// GfuiElem last = GfuiFocusMgr.Instance.FocusedElemPrev();
|
||||
// GfuiFocusMgr.Instance.FocusedElem_set(last);
|
||||
// last.Focus();
|
||||
// return false;
|
||||
// }
|
||||
@@ -124,7 +124,7 @@ public class GfuiWin_toaster extends GfuiWin { public void ShowPopup(GfuiWin own
|
||||
this.Pos_(this.X(), PopupAnchorTop); //this.Top - increment
|
||||
this.Size_(SizeAdp_.new_(this.Width(), this.Height() + increment));
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_._.win_toaster_(ctorArgs);}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.win_toaster_(ctorArgs);}
|
||||
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
|
||||
@@ -160,7 +160,7 @@ public class GfuiElemBase implements GfuiElem {
|
||||
@gplx.Virtual public boolean DisposeCbk() {return true;}
|
||||
@gplx.Virtual public boolean VisibleChangedCbk() {return true;}
|
||||
@gplx.Virtual public boolean FocusGotCbk() {
|
||||
GfuiFocusMgr._.FocusedElem_set(this);
|
||||
GfuiFocusMgr.Instance.FocusedElem_set(this);
|
||||
return true;
|
||||
}
|
||||
@gplx.Virtual public boolean FocusLostCbk() {return true;}
|
||||
@@ -262,7 +262,7 @@ public class GfuiElemBase implements GfuiElem {
|
||||
public Gfui_kit Kit() {return kit;} private Gfui_kit kit = Gfui_kit_.Mem();
|
||||
|
||||
@gplx.Virtual public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
this.kit = Swing_kit._; // NOTE: assume that callers want Swing; SWT / Mem should be calling ctor_kit_GfuiElemBase
|
||||
this.kit = Swing_kit.Instance; // NOTE: assume that callers want Swing; SWT / Mem should be calling ctor_kit_GfuiElemBase
|
||||
underElem = UnderElem_make(ctorArgs);
|
||||
underElem.Host_set(this);
|
||||
underMgr = underElem.Core();
|
||||
@@ -282,10 +282,10 @@ public class GfuiElemBase implements GfuiElem {
|
||||
this.Focus_able_(Bool_.cast(ctorArgs.FetchValOr(GfuiElem_.InitKey_focusAble, true)));
|
||||
// underMgr.Size_set(SizeAdp_.new_(20, 20)); // NOTE: CS inits to 20,20; JAVA inits to 0,0
|
||||
}
|
||||
@gplx.Virtual public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_._.control_();}
|
||||
@gplx.Virtual public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.control_();}
|
||||
public Object SubItms_getObj(String key) {return injected.Get_by(key);}
|
||||
public GfuiElemBase SubItms_add(String key, Object v) {injected.Add(key, v); return this;}
|
||||
public Ordered_hash XtnAtrs() {return xtnAtrs;} Ordered_hash xtnAtrs = Ordered_hash_.new_();
|
||||
public Ordered_hash XtnAtrs() {return xtnAtrs;} Ordered_hash xtnAtrs = Ordered_hash_.New();
|
||||
Hash_adp injected = Hash_adp_.new_();
|
||||
GxwCore_base underMgr;
|
||||
@gplx.Internal protected static boolean SizeChanged_ignore = false;
|
||||
@@ -300,5 +300,5 @@ class GfuiFocusMgr implements GfoEvMgrOwner {
|
||||
this.focusedElem = focused;
|
||||
GfoEvMgr_.PubVal(this, FocusChanged_evt, focused);
|
||||
}
|
||||
public static final GfuiFocusMgr _ = new GfuiFocusMgr(); GfuiFocusMgr() {}
|
||||
public static final GfuiFocusMgr Instance = new GfuiFocusMgr(); GfuiFocusMgr() {}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class GfuiElemList {
|
||||
owner.IptBnds().Cfgs_delAll();
|
||||
box.Dispose();
|
||||
}
|
||||
GfuiElem owner; Ordered_hash hash = Ordered_hash_.new_();
|
||||
GfuiElem owner; Ordered_hash hash = Ordered_hash_.New();
|
||||
public static GfuiElemList new_(GfuiElem owner) {
|
||||
GfuiElemList rv = new GfuiElemList();
|
||||
rv.owner = owner;
|
||||
|
||||
@@ -34,23 +34,23 @@ public class GfuiBtn extends GfuiElemBase {
|
||||
Object o = GfoInvkAble_.InvkCmd(UnderElem(), Invk_btn_img);
|
||||
return o == UnderElem() ? null : (ImageAdp)o; // NOTE: lgc guard
|
||||
} public GfuiBtn Btn_img_(ImageAdp v) {GfoInvkAble_.InvkCmd_val(UnderElem(), Invk_btn_img_, v); return this;}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_._.control_();}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.control_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
focusBorder = GfuiBorderMgr.new_().All_(PenAdp_.new_(ColorAdp_.Gray, 1));
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.TextMgr().AlignH_(GfuiAlign_.Mid);
|
||||
this.Border().All_(PenAdp_.black_()); this.Border().Bounds_sync(RectAdp_.size_(this.Size().Op_subtract(1)));
|
||||
GfuiBtn_.FocusBorderRect_set(focusBorder, this);
|
||||
Inject_(GfuiBtnClickBnd._);
|
||||
Inject_(GfuiFocusXferBnd._);
|
||||
Inject_(GfuiBtnClickBnd.Instance);
|
||||
Inject_(GfuiFocusXferBnd.Instance);
|
||||
this.CustomDraw_set(true);
|
||||
}
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
this.kit = kit;
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
focusBorder = GfuiBorderMgr.new_().All_(PenAdp_.new_(ColorAdp_.Gray, 1));
|
||||
Inject_(GfuiBtnClickBnd._);
|
||||
Inject_(GfuiFocusXferBnd._);
|
||||
Inject_(GfuiBtnClickBnd.Instance);
|
||||
Inject_(GfuiFocusXferBnd.Instance);
|
||||
} Gfui_kit kit;
|
||||
@gplx.Internal protected static void DoThis(GfuiElem click, GfoMsg clickMsg, GfoInvkAbleCmd clickInvkCmd) {
|
||||
try {
|
||||
@@ -61,9 +61,9 @@ public class GfuiBtn extends GfuiElemBase {
|
||||
else if (clickMsg != null && clickMsg != GfoMsg_.Null) {
|
||||
GfsCtx ctx = GfsCtx.new_().MsgSrc_(click);
|
||||
if (String_.Eq(clickMsg.Key(), "."))
|
||||
GfsCore._.ExecOne_to(ctx, click, clickMsg.Subs_getAt(0));
|
||||
GfsCore.Instance.ExecOne_to(ctx, click, clickMsg.Subs_getAt(0));
|
||||
else
|
||||
GfsCore._.ExecOne(ctx, clickMsg);
|
||||
GfsCore.Instance.ExecOne(ctx, clickMsg);
|
||||
}
|
||||
} catch (Exception e) {GfuiEnv_.ShowMsg(Err_.Message_gplx_full(e));}
|
||||
}
|
||||
|
||||
@@ -36,5 +36,5 @@ class GfuiBtnClickBnd implements InjectAble, GfoInvkAble {
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
} static final String ExecMouseUp_cmd = "ExecMouseUp";
|
||||
public static final GfuiBtnClickBnd _ = new GfuiBtnClickBnd(); GfuiBtnClickBnd() {}
|
||||
public static final GfuiBtnClickBnd Instance = new GfuiBtnClickBnd(); GfuiBtnClickBnd() {}
|
||||
}
|
||||
|
||||
@@ -51,11 +51,11 @@ public class GfuiChkBox extends GfuiElemBase {
|
||||
}
|
||||
@Override public boolean FocusGotCbk() {super.FocusGotCbk(); this.Redraw(); return true;} // Redraw for focusBorder
|
||||
@Override public boolean FocusLostCbk() {super.FocusLostCbk(); this.Redraw(); return true;} // Redraw for focusBorder
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_._.lbl_();}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
focusBorder.All_(PenAdp_.new_(ColorAdp_.Gray, 1));
|
||||
Inject_(GfuiFocusXferBnd._).Inject_(GfuiBtnClickBnd._);
|
||||
Inject_(GfuiFocusXferBnd.Instance).Inject_(GfuiBtnClickBnd.Instance);
|
||||
this.CustomDraw_set(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class GfuiComboBox extends GfuiElemBase {
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_._.comboBox_();} GxwComboBox comboBox;
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.comboBox_();} GxwComboBox comboBox;
|
||||
public Object SelectedItm() {return comboBox.SelectedItm();} public void SelectedItm_set(Object v) {comboBox.SelectedItm_set(v);}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
|
||||
@@ -35,5 +35,5 @@ public class GfuiLbl extends GfuiElemBase { // standard label does not support t
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
this.CustomDraw_set(true);
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_._.lbl_();}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
import gplx.lists.*; /*EnumerAble*/
|
||||
public class GfuiListBox extends GfuiElemBase {
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_._.listBox_();}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.listBox_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.listBox = (GxwListBox)UnderElem();
|
||||
|
||||
@@ -54,7 +54,7 @@ public class GfuiTextBox extends GfuiElemBase {
|
||||
|
||||
@gplx.Internal protected void SetTextBox(GxwTextFld textBox) {this.textBox = textBox;}
|
||||
@gplx.Internal protected void CreateControlIfNeeded() {textBox.CreateControlIfNeeded();}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_._.text_fld_();}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.text_fld_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
textBox = (GxwTextFld)this.UnderElem();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class GfuiTextMemo extends GfuiTextBox { public int LinesPerScreen() {re
|
||||
public void SelectionStart_toFirstChar() {textBox.SelectionStart_toFirstChar(); GfoEvMgr_.Pub(this, SelectionStartChanged_evt);}
|
||||
public void ScrollTillSelectionStartIsFirstLine() {textBox.ScrollTillSelectionStartIsFirstLine();}
|
||||
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_._.text_memo_();}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.text_memo_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
textBox = (GxwTextMemo)UnderElem();
|
||||
|
||||
@@ -53,7 +53,7 @@ public class Gfui_html extends GfuiElemBase {
|
||||
String proc = (String)args[0];
|
||||
GfoMsg rv = GfoMsg_.new_parse_(proc);
|
||||
for (int i = 1; i < args.length; i++)
|
||||
rv.Add(Int_.Xto_str(i), args[i]); // NOTE: args[i] can be either String or String[]
|
||||
rv.Add(Int_.To_str(i), args[i]); // NOTE: args[i] can be either String or String[]
|
||||
return rv;
|
||||
}
|
||||
public static final String Atr_href = "href", Atr_title = "title", Atr_value = "value", Atr_innerHTML = "innerHTML", Atr_src = "src";
|
||||
|
||||
@@ -35,9 +35,9 @@ public class DataBndr_whenEvt_execCmd implements InjectAble, GfoInvkAble, GfoEvO
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, whenEvt)) {
|
||||
Object evtVal = m.CastObjOr(whenArg, "");
|
||||
Object getVal = getInvk.Invk(GfsCtx._, 0, getCmd, GfoMsg_.new_cast_(getCmd).Add("v", evtVal));
|
||||
Object getVal = getInvk.Invk(GfsCtx.Instance, 0, getCmd, GfoMsg_.new_cast_(getCmd).Add("v", evtVal));
|
||||
GfoMsg setMsg = GfoMsg_.new_cast_(setCmd).Add("v", Object_.Xto_str_strict_or_empty(getVal));
|
||||
setInvk.Invk(GfsCtx._, 0, setCmd, setMsg);
|
||||
setInvk.Invk(GfsCtx.Instance, 0, setCmd, setMsg);
|
||||
return GfoInvkAble_.Rv_handled;
|
||||
}
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class GfuiBnd_box_status implements GfoInvkAble, UsrMsgWkr {
|
||||
box.Invoke(GfoInvkAbleCmd.arg_(this, WriteText_cmd, umsg.To_str()));
|
||||
}
|
||||
public void WriteText(String text) {
|
||||
GfuiElem lastFocus = GfuiFocusMgr._.FocusedElem(); // HACK:WINFORMS:.Visible=true will automatically transfer focus to textBox; force Focus back to original
|
||||
GfuiElem lastFocus = GfuiFocusMgr.Instance.FocusedElem(); // HACK:WINFORMS:.Visible=true will automatically transfer focus to textBox; force Focus back to original
|
||||
box.Text_(text);
|
||||
GfuiWin ownerWin = box.OwnerWin();
|
||||
if (ownerWin != null && !ownerWin.Visible()) {
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.gfui; import gplx.*;
|
||||
public class GfuiMoveElemBtn extends GfuiBtn { @Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_._.lbl_();}
|
||||
public class GfuiMoveElemBtn extends GfuiBtn { @Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.Text_("*");
|
||||
|
||||
@@ -20,7 +20,7 @@ public class GfuiStatusBox extends GfuiTextBox implements UsrMsgWkr { public Gf
|
||||
public GfuiStatusBox VisibilityDuration_(int v) {timer.Interval_(v); visibilityDuration = v; return this;} int visibilityDuration;
|
||||
@Override public void Opened_cbk() {
|
||||
super.Opened_cbk();
|
||||
UsrDlg_._.Reg(UsrMsgWkr_.Type_Note, this);
|
||||
UsrDlg_.Instance.Reg(UsrMsgWkr_.Type_Note, this);
|
||||
}
|
||||
public void ExecUsrMsg(int type, UsrMsg umsg) {
|
||||
if ( !active
|
||||
@@ -49,7 +49,7 @@ public class GfuiStatusBox extends GfuiTextBox implements UsrMsgWkr { public Gf
|
||||
@Override public boolean DisposeCbk() {
|
||||
super.DisposeCbk();
|
||||
timer.Rls();
|
||||
UsrDlg_._.RegOff(UsrMsgWkr_.Type_Note, this);
|
||||
UsrDlg_.Instance.RegOff(UsrMsgWkr_.Type_Note, this);
|
||||
if (timerCmd != null) timerCmd.Rls();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class TabBox extends GfuiElemBase {
|
||||
if (ctx.Match(k, TabBoxEvt_tabSelectByBtn.Key)) TabBoxEvt_tabSelectByBtn.Rcvd(ctx.MsgSrc(), this);
|
||||
else if (ctx.Match(k, TabBoxEvt_tabSelect.Key)) TabBoxEvt_tabSelect.Select(this, ctx, m);
|
||||
else if (ctx.Match(k, TabBoxEvt_nameChange.Key)) TabBoxEvt_nameChange.Rcvd(this, ctx, m);
|
||||
else return super.Invk(GfsCtx._, 0, k, m);
|
||||
else return super.Invk(GfsCtx.Instance, 0, k, m);
|
||||
return this;
|
||||
}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
|
||||
@@ -52,6 +52,6 @@ public class TabBoxMgr implements GfoEvMgrOwner {
|
||||
curTab = newTab;
|
||||
TabBoxEvt_tabSelect.Send(this, oldTab, newTab);
|
||||
}
|
||||
Ordered_hash itms = Ordered_hash_.new_();
|
||||
Ordered_hash itms = Ordered_hash_.New();
|
||||
@gplx.Internal protected static TabBoxMgr new_() {return new TabBoxMgr();} TabBoxMgr() {}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,11 @@ public class IconAdp {
|
||||
rv.url = url;
|
||||
return rv;
|
||||
}
|
||||
public static void regy_loadDir_(Io_url imgDir) {GfoRegy._.RegDir(imgDir, "*.png", true, "_", ".");}
|
||||
public static void regy_loadDir_shallow(Io_url imgDir) {GfoRegy._.RegDir(imgDir, "*.png", false, "_", ".");}
|
||||
public static void regy_loadDir_(Io_url imgDir) {GfoRegy.Instance.RegDir(imgDir, "*.png", true, "_", ".");}
|
||||
public static void regy_loadDir_shallow(Io_url imgDir) {GfoRegy.Instance.RegDir(imgDir, "*.png", false, "_", ".");}
|
||||
public static IconAdp regy_(String key) {
|
||||
GfoRegyItm itm = GfoRegy._.FetchOrNull(key);
|
||||
if (itm == null) {UsrDlg_._.Warn("missing icon; key={0}", key); return null;}
|
||||
GfoRegyItm itm = GfoRegy.Instance.FetchOrNull(key);
|
||||
if (itm == null) {UsrDlg_.Instance.Warn("missing icon; key={0}", key); return null;}
|
||||
if (itm.ValType() != GfoRegyItm.ValType_Url) throw Err_.new_wo_type("regyItm should be of type url", "key", key);
|
||||
return IconAdp.file_(itm.Url());
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface ImageAdp extends RlsAble {
|
||||
ImageAdp Extract_image(int src_x, int src_y, int src_w, int src_h, int trg_w, int trg_h);
|
||||
}
|
||||
class ImageAdp_txt implements ImageAdp {
|
||||
public Gfui_kit Kit() {return Swing_kit._;}
|
||||
public Gfui_kit Kit() {return Swing_kit.Instance;}
|
||||
public SizeAdp Size() {return size;} SizeAdp size;
|
||||
public int Width() {return size.Width();}
|
||||
public int Height() {return size.Height();}
|
||||
@@ -42,7 +42,7 @@ class ImageAdp_txt implements ImageAdp {
|
||||
public void Rls() {disposed = true;}
|
||||
public void SaveAsBmp(Io_url url) {SaveAs(url, ".bmp");}
|
||||
public void SaveAsPng(Io_url url) {SaveAs(url, ".png");}
|
||||
void SaveAs(Io_url url, String ext) {Io_mgr.I.SaveFilStr(url.GenNewExt(ext), size.To_str());}
|
||||
void SaveAs(Io_url url, String ext) {Io_mgr.Instance.SaveFilStr(url.GenNewExt(ext), size.To_str());}
|
||||
public ImageAdp Extract_image(RectAdp src_rect, SizeAdp trg_size) {return Extract_image(src_rect.X(), src_rect.Y(), src_rect.Width(), src_rect.Height(), trg_size.Width(), trg_size.Height());}
|
||||
public ImageAdp Extract_image(int src_x, int src_y, int src_w, int src_h, int trg_w, int trg_h) {return ImageAdp_.txt_mem_(Io_url_.Empty, SizeAdp_.new_(trg_w, trg_h));}
|
||||
public ImageAdp Resize(int width, int height) {return ImageAdp_.txt_mem_(Io_url_.Empty, SizeAdp_.new_(width, height));}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ImageAdp_ {
|
||||
}
|
||||
public static ImageAdp txt_mem_(Io_url url, SizeAdp size) {return new ImageAdp_txt(url, size);}
|
||||
public static ImageAdp txt_fil_(Io_url url) {
|
||||
String raw = Io_mgr.I.LoadFilStr(url);
|
||||
String raw = Io_mgr.Instance.LoadFilStr(url);
|
||||
SizeAdp size = null;
|
||||
if (String_.Eq(raw, "")) size = SizeAdp_.Zero;
|
||||
else if (String_.Eq(url.Ext(), ".svg")) size = SizeOf_svg(url);
|
||||
@@ -51,7 +51,7 @@ public class ImageAdp_ {
|
||||
public static ImageAdp file_(Io_url url) {
|
||||
if (url.EqNull()) throw Err_.new_wo_type("cannot load image from null url");
|
||||
if (String_.Eq(url.Info().Key(), IoUrlInfo_.Mem.Key())) return txt_fil_(url);
|
||||
if (!Io_mgr.I.ExistsFil(url)) return Null;
|
||||
if (!Io_mgr.Instance.ExistsFil(url)) return Null;
|
||||
|
||||
BufferedImage img = null;
|
||||
try {
|
||||
@@ -97,14 +97,14 @@ public class ImageAdp_ {
|
||||
else if (imageType == BufferedImage.TYPE_USHORT_555_RGB) return 16; //?
|
||||
else if (imageType == BufferedImage.TYPE_USHORT_565_RGB) return 16; //?
|
||||
else if (imageType == BufferedImage.TYPE_USHORT_GRAY) return 16; //?
|
||||
else {UsrDlg_._.Warn("unknown bits per pixel", "imageType", imageType, "url", url.Xto_api()); return 8;}
|
||||
else {UsrDlg_.Instance.Warn("unknown bits per pixel", "imageType", imageType, "url", url.Xto_api()); return 8;}
|
||||
}
|
||||
}
|
||||
class Gfui_svg_util {
|
||||
public static SizeAdp QuerySize(Io_url url) {
|
||||
try {
|
||||
// NOTE: not using XmlDoc b/c invalid doctypes can cause xml to hang; <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"><!-- Created with Inkscape (http://www.inkscape.org/) --> <svg xmlns="http://www.w3.org/2000/svg"
|
||||
String xml = Io_mgr.I.LoadFilStr(url);
|
||||
String xml = Io_mgr.Instance.LoadFilStr(url);
|
||||
int pos = String_.FindFwd(xml, "<svg", 0); if (pos == -1) return null;
|
||||
Int_obj_ref pos_ref = Int_obj_ref.new_(pos);
|
||||
double w = ParseAtr(xml, pos_ref, "width");
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ImageAdp_base implements ImageAdp, RlsAble {
|
||||
public void SaveAsBmp(Io_url url) {SaveAs(url, "bmp");}
|
||||
public void SaveAsPng(Io_url url) {SaveAs(url, "png");}
|
||||
void SaveAs(Io_url url, String fmtStr) {
|
||||
Io_mgr.I.CreateDirIfAbsent(url.OwnerDir());
|
||||
Io_mgr.Instance.CreateDirIfAbsent(url.OwnerDir());
|
||||
File fil = new File(url.Xto_api());
|
||||
// String[] formatNames = ImageIO.getWriterFormatNames();
|
||||
// for (String s : formatNames)
|
||||
|
||||
@@ -30,5 +30,5 @@ public class ImageAdp_null implements ImageAdp {
|
||||
public ImageAdp Extract_image(RectAdp src_rect, SizeAdp trg_size) {return Extract_image(src_rect.X(), src_rect.Y(), src_rect.Width(), src_rect.Height(), trg_size.Width(), trg_size.Height());}
|
||||
public ImageAdp Extract_image(int src_x, int src_y, int src_w, int src_h, int trg_w, int trg_h) {return this;}
|
||||
public ImageAdp Resize(int width, int height) {return this;}
|
||||
public static final ImageAdp_null _ = new ImageAdp_null(); ImageAdp_null() {}
|
||||
public static final ImageAdp_null Instance = new ImageAdp_null(); ImageAdp_null() {}
|
||||
}
|
||||
|
||||
@@ -35,5 +35,5 @@ public class GfoFactory_gfui {
|
||||
public static void Btn_QuitWin2(GfuiElem owner, GfoMsg quitMsg) {
|
||||
GfuiBtn_.msg_("quitWin", owner, quitMsg).Text_("X").TipText_("quit win").Width_(20);
|
||||
}
|
||||
public static final GfoFactory_gfui _ = new GfoFactory_gfui(); GfoFactory_gfui() {}
|
||||
public static final GfoFactory_gfui Instance = new GfoFactory_gfui(); GfoFactory_gfui() {}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class GfsLibIni_gfui implements GfsLibIni {
|
||||
public void Ini(GfsCore core) {
|
||||
core.AddCmd(IptCfgRegy._, "IptBndMgr_");
|
||||
core.AddCmd(IptCfgRegy.Instance, "IptBndMgr_");
|
||||
}
|
||||
public static final GfsLibIni_gfui _ = new GfsLibIni_gfui(); GfsLibIni_gfui() {}
|
||||
public static final GfsLibIni_gfui Instance = new GfsLibIni_gfui(); GfsLibIni_gfui() {}
|
||||
}
|
||||
|
||||
@@ -55,27 +55,27 @@ public class GfuiEnv_ {
|
||||
|
||||
// reg interruptLnr
|
||||
if (swingHack) { // TODO: move to kit dependent functionality; WHEN: swing kit
|
||||
UsrDlg_._.Reg(UsrMsgWkr_.Type_Warn, GfoConsoleWin._);
|
||||
UsrDlg_._.Reg(UsrMsgWkr_.Type_Stop, GfuiInterruptLnr.new_());
|
||||
UsrDlg_.Instance.Reg(UsrMsgWkr_.Type_Warn, GfoConsoleWin.Instance);
|
||||
UsrDlg_.Instance.Reg(UsrMsgWkr_.Type_Stop, GfuiInterruptLnr.new_());
|
||||
}
|
||||
IptBndMgr_win = IptCfg_.new_("gplx.gfui.GfuiWin");
|
||||
|
||||
// alias default dirs
|
||||
Io_mgr.I.AliasDir_sysEngine("app:\\", Env_.AppUrl().OwnerDir().Raw());
|
||||
Io_mgr.Instance.AliasDir_sysEngine("app:\\", Env_.AppUrl().OwnerDir().Raw());
|
||||
|
||||
GfsCore._.MsgParser_(GfoMsgParser_gfml._);
|
||||
GfsCore._.AddLib(GfsLibIni_core._);
|
||||
GfsCore._.AddLib(GfsLibIni_gfui._);
|
||||
GfsCore.Instance.MsgParser_(GfoMsgParser_gfml.Instance);
|
||||
GfsCore.Instance.AddLib(GfsLibIni_core.Instance);
|
||||
GfsCore.Instance.AddLib(GfsLibIni_gfui.Instance);
|
||||
Io_url iniFile = Env_.AppUrl().GenSubFil(".gfs");
|
||||
if (Io_mgr.I.ExistsFil(iniFile))
|
||||
GfsCore._.ExecFile(iniFile);
|
||||
if (Io_mgr.Instance.ExistsFil(iniFile))
|
||||
GfsCore.Instance.ExecFile(iniFile);
|
||||
}
|
||||
public static void Init_swt(String[] args, Class<?> type) {
|
||||
Env_.Init_swt(args, type);
|
||||
if (!Op_sys.Cur().Tid_is_drd()) GxwElemFactory_.winForms_();
|
||||
GfsCore._.MsgParser_(GfoMsgParser_gfml._);
|
||||
GfsCore.Instance.MsgParser_(GfoMsgParser_gfml.Instance);
|
||||
}
|
||||
public static void Gfs_init() {GfsCore._.MsgParser_(GfoMsgParser_gfml._);}
|
||||
public static void Gfs_init() {GfsCore.Instance.MsgParser_(GfoMsgParser_gfml.Instance);}
|
||||
public static IptCfg IptBndMgr_win;
|
||||
public static void DoEvents() {;}
|
||||
public static void ShowMsg(String message) {javax.swing.JOptionPane.showMessageDialog(null, message, "", javax.swing.JOptionPane.INFORMATION_MESSAGE, null);}
|
||||
|
||||
@@ -23,5 +23,4 @@ class Gfui_clipboard_null implements Gfui_clipboard {
|
||||
public void Copy(String s) {}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {return this;}
|
||||
public void Rls() {}
|
||||
public static final Gfui_clipboard_null Null = new Gfui_clipboard_null(); Gfui_clipboard_null() {}
|
||||
}
|
||||
|
||||
@@ -17,5 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class Gfui_clipboard_ {
|
||||
public static final Gfui_clipboard Null = new Gfui_clipboard_null();
|
||||
public static final String Invk_copy = "copy", Invk_select_all = "select_all";
|
||||
}
|
||||
|
||||
@@ -23,11 +23,3 @@ public interface Gfui_dlg_file {
|
||||
Gfui_dlg_file Init_exts_(String... v);
|
||||
String Ask();
|
||||
}
|
||||
class Gfui_dlg_file_null implements Gfui_dlg_file {
|
||||
public Gfui_dlg_file Init_msg_(String v) {return this;}
|
||||
public Gfui_dlg_file Init_file_(String v) {return this;}
|
||||
public Gfui_dlg_file Init_dir_(Io_url v) {return this;}
|
||||
public Gfui_dlg_file Init_exts_(String... v) {return this;}
|
||||
public String Ask() {return "";}
|
||||
public static final Gfui_dlg_file_null _ = new Gfui_dlg_file_null(); Gfui_dlg_file_null() {}
|
||||
}
|
||||
|
||||
28
150_gfui/src_700_env/gplx/gfui/Gfui_dlg_file_.java
Normal file
28
150_gfui/src_700_env/gplx/gfui/Gfui_dlg_file_.java
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
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.gfui; import gplx.*;
|
||||
public class Gfui_dlg_file_ {
|
||||
public static final Gfui_dlg_file Noop = new Gfui_dlg_file_noop();
|
||||
}
|
||||
class Gfui_dlg_file_noop implements Gfui_dlg_file {
|
||||
public Gfui_dlg_file Init_msg_(String v) {return this;}
|
||||
public Gfui_dlg_file Init_file_(String v) {return this;}
|
||||
public Gfui_dlg_file Init_dir_(Io_url v) {return this;}
|
||||
public Gfui_dlg_file Init_exts_(String... v) {return this;}
|
||||
public String Ask() {return "";}
|
||||
}
|
||||
@@ -23,11 +23,3 @@ public interface Gfui_dlg_msg {
|
||||
int Ask();
|
||||
boolean Ask(int expd);
|
||||
}
|
||||
class Gfui_dlg_msg_null implements Gfui_dlg_msg {
|
||||
public Gfui_dlg_msg Init_msg_(String v) {return this;}
|
||||
public Gfui_dlg_msg Init_ico_(int v) {return this;}
|
||||
public Gfui_dlg_msg Init_btns_(int... ary) {return this;}
|
||||
public boolean Ask(int expd) {return false;}
|
||||
public int Ask() {return Int_.Min_value;}
|
||||
public static final Gfui_dlg_msg_null _ = new Gfui_dlg_msg_null(); Gfui_dlg_msg_null() {}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class Gfui_dlg_msg_ {
|
||||
public static final Gfui_dlg_msg Noop = new Gfui_dlg_msg_noop();
|
||||
public static final int Ico_error = 0, Ico_information = 1, Ico_question = 2, Ico_warning = 3, Ico_working = 4;
|
||||
public static final int Btn_ok = 0, Btn_cancel = 1, Btn_yes = 2, Btn_no = 3, Retry = 4, Btn_abort = 5, Btn_ignore = 6;
|
||||
}
|
||||
class Gfui_dlg_msg_noop implements Gfui_dlg_msg {
|
||||
public Gfui_dlg_msg Init_msg_(String v) {return this;}
|
||||
public Gfui_dlg_msg Init_ico_(int v) {return this;}
|
||||
public Gfui_dlg_msg Init_btns_(int... ary) {return this;}
|
||||
public boolean Ask(int expd) {return false;}
|
||||
public int Ask() {return Int_.Min_value;}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class Gfui_kit_ {
|
||||
public static final byte Mem_tid = 0, Swing_tid = 1, Swt_tid = 2, Android_tid = 3;
|
||||
public static Gfui_kit Mem() {return mem_kit;} private static final Gfui_kit mem_kit = Mem_kit._;
|
||||
public static Gfui_kit Swt() {if (swt_kit == null) swt_kit = Swt_kit._; return swt_kit;} private static Gfui_kit swt_kit; // NOTE: late-binding else swing apps will fail (since swt jar is not deployed)
|
||||
public static Gfui_kit Swing() {if (swing_kit == null) swing_kit = Swing_kit._; return swing_kit;} private static Gfui_kit swing_kit;
|
||||
public static Gfui_kit Mem() {return mem_kit;} private static final Gfui_kit mem_kit = Mem_kit.Instance;
|
||||
public static Gfui_kit Swt() {if (swt_kit == null) swt_kit = Swt_kit.Instance; return swt_kit;} private static Gfui_kit swt_kit; // NOTE: late-binding else swing apps will fail (since swt jar is not deployed)
|
||||
public static Gfui_kit Swing() {if (swing_kit == null) swing_kit = Swing_kit.Instance; return swing_kit;} private static Gfui_kit swing_kit;
|
||||
public static Gfui_kit Get_by_key(String key) {
|
||||
if (String_.Eq(key, Mem().Key())) return Mem();
|
||||
else if (String_.Eq(key, Swt().Key())) return Swt();
|
||||
|
||||
@@ -22,7 +22,7 @@ public abstract class Gfui_kit_base implements Gfui_kit {
|
||||
public abstract String Key();
|
||||
public abstract GxwElemFactory_base Factory();
|
||||
public GfuiWin Main_win() {return main_win;} public Gfui_kit Main_win_(GfuiWin v) {main_win = v; return this;} private GfuiWin main_win;
|
||||
public Gfui_clipboard Clipboard() {return Gfui_clipboard_null.Null;}
|
||||
public Gfui_clipboard Clipboard() {return Gfui_clipboard_.Null;}
|
||||
public GfoInvkAbleCmd Kit_term_cbk() {return kit_term_cbk;} public void Kit_term_cbk_(GfoInvkAbleCmd v) {kit_term_cbk = v;} private GfoInvkAbleCmd kit_term_cbk;
|
||||
public void Cfg_set(String type, String key, Object val) {}
|
||||
public boolean Kit_mode__ready() {return true;}
|
||||
@@ -82,10 +82,10 @@ public abstract class Gfui_kit_base implements Gfui_kit {
|
||||
protected abstract Gxw_tab_mgr New_tab_mgr_impl();
|
||||
protected abstract Gxw_tab_itm New_tab_itm_impl();
|
||||
protected abstract GxwElem New_btn_impl();
|
||||
@gplx.Virtual public Gfui_dlg_file New_dlg_file(byte type, String msg) {return Gfui_dlg_file_null._;}
|
||||
@gplx.Virtual public Gfui_dlg_msg New_dlg_msg(String msg) {return Gfui_dlg_msg_null._;}
|
||||
@gplx.Virtual public Gfui_mnu_grp New_mnu_popup(String key, GfuiElem owner) {return Gfui_mnu_grp_null.Null;}
|
||||
@gplx.Virtual public Gfui_mnu_grp New_mnu_bar(String key, GfuiWin owner) {return Gfui_mnu_grp_null.Null;}
|
||||
@gplx.Virtual public Gfui_dlg_file New_dlg_file(byte type, String msg) {return Gfui_dlg_file_.Noop;}
|
||||
@gplx.Virtual public Gfui_dlg_msg New_dlg_msg(String msg) {return Gfui_dlg_msg_.Noop;}
|
||||
@gplx.Virtual public Gfui_mnu_grp New_mnu_popup(String key, GfuiElem owner) {return Gfui_mnu_grp_.Noop;}
|
||||
@gplx.Virtual public Gfui_mnu_grp New_mnu_bar(String key, GfuiWin owner) {return Gfui_mnu_grp_.Noop;}
|
||||
public abstract ImageAdp New_img_load(Io_url url);
|
||||
public Object New_color(int a, int r, int g, int b) {return null;}
|
||||
public float Calc_font_height(GfuiElem elem, String s) {return 13;}
|
||||
|
||||
@@ -27,22 +27,3 @@ public interface Gfui_mnu_grp extends Gfui_mnu_itm {
|
||||
Gfui_mnu_grp Itms_add_grp (String txt, ImageAdp img);
|
||||
Gfui_mnu_itm Itms_add_separator();
|
||||
}
|
||||
class Gfui_mnu_grp_null implements Gfui_mnu_grp {
|
||||
public String Uid() {return "";}
|
||||
public int Tid() {return Gfui_mnu_itm_.Tid_grp;}
|
||||
public boolean Enabled() {return true;} public void Enabled_(boolean v) {}
|
||||
public boolean Disposed() {return false;}
|
||||
public String Text() {return null;} public void Text_(String v) {}
|
||||
public ImageAdp Img() {return null;} public void Img_(ImageAdp v) {}
|
||||
public boolean Selected() {return true;} public void Selected_(boolean v) {}
|
||||
public String Root_key() {return "null";}
|
||||
public Object Under() {return null;}
|
||||
public void Itms_clear() {}
|
||||
public Gfui_mnu_itm Itms_add_btn_cmd (String txt, ImageAdp img, GfoInvkAble invk, String invk_cmd) {return Gfui_mnu_itm_null.Null;}
|
||||
public Gfui_mnu_itm Itms_add_btn_msg (String txt, ImageAdp img, GfoInvkAble invk, GfoInvkRootWkr root_wkr, GfoMsg invk_msg) {return Gfui_mnu_itm_null.Null;}
|
||||
public Gfui_mnu_itm Itms_add_chk_msg (String txt, ImageAdp img, GfoInvkAble invk, GfoInvkRootWkr root_wkr, GfoMsg msg_n, GfoMsg msg_y) {return Gfui_mnu_itm_null.Null;}
|
||||
public Gfui_mnu_itm Itms_add_rdo_msg (String txt, ImageAdp img, GfoInvkAble invk, GfoInvkRootWkr root_wkr, GfoMsg msg) {return Gfui_mnu_itm_null.Null;}
|
||||
public Gfui_mnu_grp Itms_add_grp(String txt, ImageAdp img) {return Gfui_mnu_grp_null.Null;}
|
||||
public Gfui_mnu_itm Itms_add_separator() {return Gfui_mnu_itm_null.Null;}
|
||||
public static final Gfui_mnu_grp_null Null = new Gfui_mnu_grp_null(); Gfui_mnu_grp_null() {}
|
||||
}
|
||||
|
||||
39
150_gfui/src_700_env/gplx/gfui/Gfui_mnu_grp_.java
Normal file
39
150_gfui/src_700_env/gplx/gfui/Gfui_mnu_grp_.java
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
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.gfui; import gplx.*;
|
||||
public class Gfui_mnu_grp_ {
|
||||
public static final Gfui_mnu_grp Noop = new Gfui_mnu_grp_noop();
|
||||
}
|
||||
class Gfui_mnu_grp_noop implements Gfui_mnu_grp {
|
||||
public String Uid() {return "";}
|
||||
public int Tid() {return Gfui_mnu_itm_.Tid_grp;}
|
||||
public boolean Enabled() {return true;} public void Enabled_(boolean v) {}
|
||||
public boolean Disposed() {return false;}
|
||||
public String Text() {return null;} public void Text_(String v) {}
|
||||
public ImageAdp Img() {return null;} public void Img_(ImageAdp v) {}
|
||||
public boolean Selected() {return true;} public void Selected_(boolean v) {}
|
||||
public String Root_key() {return "null";}
|
||||
public Object Under() {return null;}
|
||||
public void Itms_clear() {}
|
||||
public Gfui_mnu_itm Itms_add_btn_cmd (String txt, ImageAdp img, GfoInvkAble invk, String invk_cmd) {return Gfui_mnu_itm_null.Null;}
|
||||
public Gfui_mnu_itm Itms_add_btn_msg (String txt, ImageAdp img, GfoInvkAble invk, GfoInvkRootWkr root_wkr, GfoMsg invk_msg) {return Gfui_mnu_itm_null.Null;}
|
||||
public Gfui_mnu_itm Itms_add_chk_msg (String txt, ImageAdp img, GfoInvkAble invk, GfoInvkRootWkr root_wkr, GfoMsg msg_n, GfoMsg msg_y) {return Gfui_mnu_itm_null.Null;}
|
||||
public Gfui_mnu_itm Itms_add_rdo_msg (String txt, ImageAdp img, GfoInvkAble invk, GfoInvkRootWkr root_wkr, GfoMsg msg) {return Gfui_mnu_itm_null.Null;}
|
||||
public Gfui_mnu_grp Itms_add_grp(String txt, ImageAdp img) {return Gfui_mnu_grp_.Noop;}
|
||||
public Gfui_mnu_itm Itms_add_separator() {return Gfui_mnu_itm_null.Null;}
|
||||
}
|
||||
@@ -17,6 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class Gfui_mnu_itm_ {
|
||||
public static String Gen_uid() {return "mnu_" + Int_.Xto_str(++uid_next);} private static int uid_next = 0;
|
||||
public static String Gen_uid() {return "mnu_" + Int_.To_str(++uid_next);} private static int uid_next = 0;
|
||||
public static final int Tid_nil = 0, Tid_grp = 1, Tid_spr = 2, Tid_btn = 3, Tid_chk = 4, Tid_rdo = 5;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ public class Mem_kit extends Gfui_kit_base {
|
||||
@Override protected Gxw_tab_mgr New_tab_mgr_impl() {return new Mem_tab_mgr();}
|
||||
@Override protected Gxw_tab_itm New_tab_itm_impl() {return new Mem_tab_itm();}
|
||||
@Override protected GxwElem New_btn_impl() {return factory.control_();}
|
||||
@Override public ImageAdp New_img_load(Io_url url) {return ImageAdp_null._;}
|
||||
public static final Mem_kit _ = new Mem_kit(); Mem_kit() {}
|
||||
@Override public ImageAdp New_img_load(Io_url url) {return ImageAdp_null.Instance;}
|
||||
public static final Mem_kit Instance = new Mem_kit(); Mem_kit() {}
|
||||
}
|
||||
|
||||
@@ -29,5 +29,5 @@ public class Swing_kit extends Gfui_kit_base {
|
||||
@Override protected Gxw_tab_mgr New_tab_mgr_impl() {return new Mem_tab_mgr();}
|
||||
@Override protected Gxw_tab_itm New_tab_itm_impl() {return new Mem_tab_itm();}
|
||||
@Override protected GxwElem New_btn_impl() {return factory.control_();}
|
||||
public static final Swing_kit _ = new Swing_kit(); Swing_kit() {}
|
||||
public static final Swing_kit Instance = new Swing_kit(); Swing_kit() {}
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ public class Swt_kit implements Gfui_kit {
|
||||
this.msg_wkr_stop = new Swt_msg_wkr_stop(this, gui_wtr);
|
||||
this.display = new Display();
|
||||
this.clipboard = new Swt_clipboard(display);
|
||||
UsrDlg_._.Reg(UsrMsgWkr_.Type_Warn, GfoConsoleWin._);
|
||||
UsrDlg_._.Reg(UsrMsgWkr_.Type_Stop, msg_wkr_stop);
|
||||
UsrDlg_.Instance.Reg(UsrMsgWkr_.Type_Warn, GfoConsoleWin.Instance);
|
||||
UsrDlg_.Instance.Reg(UsrMsgWkr_.Type_Stop, msg_wkr_stop);
|
||||
if (xul_runner_path != null) System.setProperty("org.eclipse.swt.browser.XULRunnerPath", xul_runner_path);
|
||||
this.Kit_mode_(Swt_kit_mode.Tid_ready);
|
||||
gui_wtr.Log_many("", "", "swt.kit.init.done");
|
||||
@@ -207,7 +207,7 @@ public class Swt_kit implements Gfui_kit {
|
||||
return rv;
|
||||
}
|
||||
catch (Exception e) {
|
||||
Gfo_usr_dlg_.I.Warn_many("", "", "error while calculating font height; err=~{0}", Err_.Message_gplx_full(e));
|
||||
Gfo_usr_dlg_.Instance.Warn_many("", "", "error while calculating font height; err=~{0}", Err_.Message_gplx_full(e));
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
@@ -235,7 +235,7 @@ public class Swt_kit implements Gfui_kit {
|
||||
}
|
||||
public static final String Invk_Cfg_add = "Cfg_add", Invk_ask_file = "ask_file"; // private or public?
|
||||
public static final String Invk_shell_close = "shell_close"; // public
|
||||
public static final Swt_kit _ = new Swt_kit(); private Swt_kit() {} // singleton b/c of following line "In particular, some platforms which SWT supports will not allow more than one active display" (http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html)
|
||||
public static final Swt_kit Instance = new Swt_kit(); private Swt_kit() {} // singleton b/c of following line "In particular, some platforms which SWT supports will not allow more than one active display" (http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html)
|
||||
public static final String Cfg_Html_BrowserType = "BrowserType";
|
||||
public static int Cfg_Html_BrowserType_parse(String v) {
|
||||
if (String_.Eq(v, "mozilla")) return Swt_html.Browser_tid_mozilla;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class GfuiFocusOrderer_tst {
|
||||
GfuiElem sub_(GfuiElem owner, int i) {return owner.SubElems().Get_at(i);}
|
||||
void ini_Subs(GfuiElem owner, List_adp list, PointAdp... points) {
|
||||
for (int i = 0; i < points.length; i++) {
|
||||
GfuiElem sub = GfuiElem_.sub_(Int_.Xto_str(i), owner);
|
||||
GfuiElem sub = GfuiElem_.sub_(Int_.To_str(i), owner);
|
||||
sub.Pos_(points[i]);
|
||||
sub.UnderElem().Core().Focus_index_set(i);
|
||||
list.Add(sub);
|
||||
|
||||
@@ -34,13 +34,13 @@ public class ImageAdp_tst {
|
||||
@Test public void SaveAsBmp() {
|
||||
img = ImageAdp_.file_(load);
|
||||
Io_url save = load.GenNewNameOnly("strawberry_temp");
|
||||
DateAdp beforeModifiedTime = Io_mgr.I.QueryFil(save).ModifiedTime();
|
||||
DateAdp beforeModifiedTime = Io_mgr.Instance.QueryFil(save).ModifiedTime();
|
||||
img.SaveAsBmp(save);
|
||||
DateAdp afterModifiedTime = Io_mgr.I.QueryFil(save).ModifiedTime();
|
||||
DateAdp afterModifiedTime = Io_mgr.Instance.QueryFil(save).ModifiedTime();
|
||||
Tfds.Eq_true(CompareAble_.Is_more(afterModifiedTime, beforeModifiedTime));
|
||||
|
||||
String loadHash = HashAlgo_.Md5.CalcHash(Console_adp_.Noop, Io_mgr.I.OpenStreamRead(load));
|
||||
String saveHash = HashAlgo_.Md5.CalcHash(Console_adp_.Noop, Io_mgr.I.OpenStreamRead(save));
|
||||
String loadHash = HashAlgo_.Md5.CalcHash(Console_adp_.Noop, Io_mgr.Instance.OpenStreamRead(load));
|
||||
String saveHash = HashAlgo_.Md5.CalcHash(Console_adp_.Noop, Io_mgr.Instance.OpenStreamRead(save));
|
||||
Tfds.Eq(loadHash, saveHash);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ class TabBoxFxt implements GfoInvkAble {
|
||||
for (int i = 0; i < tabBox.Tabs_Count(); i++)
|
||||
tabBox.Tabs_DelAt(0);
|
||||
for (int i = 0; i < count; i++)
|
||||
tabBox.Tabs_Add(Int_.Xto_str(i), Int_.Xto_str(i));
|
||||
tabBox.Tabs_Add(Int_.To_str(i), Int_.To_str(i));
|
||||
return this;
|
||||
}
|
||||
@gplx.Internal protected TabBoxFxt Del_at(int index) {tabBox.Tabs_DelAt(index); return this;}
|
||||
@@ -102,7 +102,7 @@ class TabBoxFxt implements GfoInvkAble {
|
||||
// @gplx.Internal protected TabBoxFxt tst_Raised(boolean expd) {Tfds.Eq(expd, received != null); return this;}
|
||||
// @gplx.Internal protected TabBoxFxt Reorder(int i, int delta) {
|
||||
// tabBox.Width_(240); // needed for lytMgr
|
||||
// TabBnd_reorderTab reorderBnd = TabBnd_reorderTab._;
|
||||
// TabBnd_reorderTab reorderBnd = TabBnd_reorderTab.Instance;
|
||||
// received = null;
|
||||
// TabPnl pnl = tabBox.Tabs_FetchAt(i);
|
||||
// reorderBnd.MoveTab(pnl.SubTabBtn(), delta);
|
||||
|
||||
@@ -67,7 +67,7 @@ class Swt_html implements Gxw_html, Swt_control, FocusListener {
|
||||
public void Html_doc_html_load_by_url(Io_url path, String html) {
|
||||
this.html_doc_html_load_tid = Gxw_html_load_tid_.Tid_url;
|
||||
this.load_by_url_path = path.To_http_file_str();
|
||||
Io_mgr.I.SaveFilStr(path, html);
|
||||
Io_mgr.Instance.SaveFilStr(path, html);
|
||||
browser.setUrl(path.Xto_api());
|
||||
}
|
||||
public byte Html_doc_html_load_tid() {return html_doc_html_load_tid;} private byte html_doc_html_load_tid;
|
||||
@@ -99,7 +99,7 @@ class Swt_html implements Gxw_html, Swt_control, FocusListener {
|
||||
if (quote_val) bfr.Add_byte(Byte_ascii.Apos);
|
||||
}
|
||||
bfr.Add_byte(Byte_ascii.Paren_end).Add_byte(Byte_ascii.Semic);
|
||||
return Eval_script(bfr.Xto_str_and_clear());
|
||||
return Eval_script(bfr.To_str_and_clear());
|
||||
}
|
||||
private static String Escape_quote(String v) {
|
||||
String rv = v;
|
||||
@@ -149,12 +149,6 @@ class Swt_core_cmds_html extends Swt_core_cmds {
|
||||
this.Focus();
|
||||
}
|
||||
}
|
||||
class Swt_html_eval_rslt {
|
||||
public void Clear() {error = null; result = null;}
|
||||
public boolean Result_pass() {return error == null;}
|
||||
public Object Result() {return result;} public void Result_set(Object v) {result = v; error = null;} private Object result;
|
||||
public String Error () {return error;} public void Error_set(String v) {error = v; result = null;} private String error;
|
||||
}
|
||||
class Swt_html_lnr_traverse implements TraverseListener {
|
||||
public Swt_html_lnr_traverse(Swt_html html_box) {}
|
||||
@Override public void keyTraversed(TraverseEvent arg0) {}
|
||||
@@ -163,7 +157,7 @@ class Swt_html_lnr_title implements TitleListener {
|
||||
private Swt_html html_box;
|
||||
public Swt_html_lnr_title(Swt_html html_box) {this.html_box = html_box;}
|
||||
@Override public void changed(TitleEvent ev) {
|
||||
try {UsrDlg_._.Note(ev.title);}
|
||||
try {UsrDlg_.Instance.Note(ev.title);}
|
||||
catch (Exception e) {html_box.Kit().Ask_ok("xowa.swt.html_box", "title.fail", Err_.Message_gplx_full(e));} // NOTE: must catch error or will cause app to lock; currently called inside displaySync
|
||||
}
|
||||
}
|
||||
|
||||
25
150_gfui/xtn/gplx/gfui/Swt_html_eval_rslt.java
Normal file
25
150_gfui/xtn/gplx/gfui/Swt_html_eval_rslt.java
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
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.gfui;
|
||||
|
||||
public class Swt_html_eval_rslt {
|
||||
public void Clear() {error = null; result = null;}
|
||||
public boolean Result_pass() {return error == null;}
|
||||
public Object Result() {return result;} public void Result_set(Object v) {result = v; error = null;} private Object result;
|
||||
public String Error () {return error;} public void Error_set(String v) {error = v; result = null;} private String error;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ class Swt_lnr__menu_btn_cmd implements Listener {
|
||||
public Swt_lnr__menu_btn_cmd(GfoInvkAble invk, String cmd) {this.invk = invk; this.cmd = cmd;} GfoInvkAble invk; String cmd;
|
||||
public void handleEvent(Event ev) {
|
||||
try {GfoInvkAble_.InvkCmd(invk, cmd);}
|
||||
catch (Exception e) {Swt_kit._.Ask_ok("", "", "error while invoking command: cmd=~{0} err=~{1}", cmd, Err_.Message_gplx_full(e));}
|
||||
catch (Exception e) {Swt_kit.Instance.Ask_ok("", "", "error while invoking command: cmd=~{0} err=~{1}", cmd, Err_.Message_gplx_full(e));}
|
||||
}
|
||||
}
|
||||
class Swt_lnr__menu_btn_msg implements Listener {
|
||||
@@ -203,7 +203,7 @@ class Swt_lnr__menu_btn_msg implements Listener {
|
||||
msg.Args_reset();
|
||||
root_wkr.Run_str_for(invk, msg);
|
||||
}
|
||||
catch (Exception e) {Swt_kit._.Ask_ok("", "", "error while invoking command: cmd=~{0} err=~{1}", msg.Key(), Err_.Message_gplx_full(e));}
|
||||
catch (Exception e) {Swt_kit.Instance.Ask_ok("", "", "error while invoking command: cmd=~{0} err=~{1}", msg.Key(), Err_.Message_gplx_full(e));}
|
||||
}
|
||||
}
|
||||
class Swt_lnr__menu_chk_msg implements Listener {
|
||||
@@ -219,6 +219,6 @@ class Swt_lnr__menu_chk_msg implements Listener {
|
||||
msg.Args_reset();
|
||||
root_wkr.Run_str_for(invk, msg);
|
||||
}
|
||||
catch (Exception e) {Swt_kit._.Ask_ok("", "", "error while invoking command: cmd=~{0} err=~{1}", msg.Key(), Err_.Message_gplx_full(e));}
|
||||
catch (Exception e) {Swt_kit.Instance.Ask_ok("", "", "error while invoking command: cmd=~{0} err=~{1}", msg.Key(), Err_.Message_gplx_full(e));}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class Swt_tab_mgr implements Gxw_tab_mgr, Swt_control, FocusListener, Gfo
|
||||
if (i == Gfui_tab_itm_data.Idx_null) return; // 0 tabs; return;
|
||||
msg_tabs_select_by_idx_swt.Clear();
|
||||
msg_tabs_select_by_idx_swt.Add("v", i);
|
||||
cmd_sync.Invk(GfsCtx._, 0, Invk_tabs_select_by_idx_swt, msg_tabs_select_by_idx_swt);
|
||||
cmd_sync.Invk(GfsCtx.Instance, 0, Invk_tabs_select_by_idx_swt, msg_tabs_select_by_idx_swt);
|
||||
} private GfoMsg msg_tabs_select_by_idx_swt = GfoMsg_.new_cast_(Invk_tabs_select_by_idx_swt);
|
||||
@Override public void Tabs_switch(int src, int trg) {Tabs_switch(tab_folder.getItem(src), tab_folder.getItem(trg));}
|
||||
public boolean Tabs_switch(CTabItem src_tab_itm, CTabItem trg_tab_itm) {
|
||||
@@ -120,7 +120,7 @@ public class Swt_tab_mgr implements Gxw_tab_mgr, Swt_control, FocusListener, Gfo
|
||||
if (itm == null) return; // 0 tabs; return;
|
||||
msg_tabs_select_by_itm_swt.Clear();
|
||||
msg_tabs_select_by_itm_swt.Add("v", itm);
|
||||
cmd_sync.Invk(GfsCtx._, 0, Invk_tabs_select_by_itm_swt, msg_tabs_select_by_itm_swt);
|
||||
cmd_sync.Invk(GfsCtx.Instance, 0, Invk_tabs_select_by_itm_swt, msg_tabs_select_by_itm_swt);
|
||||
} private GfoMsg msg_tabs_select_by_itm_swt = GfoMsg_.new_cast_(Invk_tabs_select_by_itm_swt);
|
||||
private void Tabs_select_by_idx_swt(int idx) {
|
||||
tab_folder.setSelection(idx);
|
||||
|
||||
Reference in New Issue
Block a user