mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.8.3.1
This commit is contained in:
@@ -30,7 +30,7 @@ public class GfuiBorderEdge {
|
||||
public static final GfuiBorderEdge All = new GfuiBorderEdge(15);
|
||||
}
|
||||
class GfuiBorderEdge_ {
|
||||
public static String XtoStr(GfuiBorderEdge edge) {
|
||||
public static String To_str(GfuiBorderEdge edge) {
|
||||
int val = edge.Val();
|
||||
if (val == GfuiBorderEdge.Left.Val()) return Left_raw;
|
||||
else if (val == GfuiBorderEdge.Right.Val()) return Right_raw;
|
||||
|
||||
@@ -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 PointAdp implements XtoStrAble {
|
||||
public class PointAdp implements To_str_able {
|
||||
public int X() {return x;} final int x;
|
||||
public int Y() {return y;} final int y;
|
||||
public PointAdp Op_add(PointAdp val) {return new PointAdp(x + val.x, y + val.y);}
|
||||
@@ -27,8 +27,8 @@ public class PointAdp implements XtoStrAble {
|
||||
PointAdp comp = PointAdp_.as_(compObj); if (comp == null) return false;
|
||||
return x == comp.x && y == comp.y;
|
||||
}
|
||||
public String XtoStr() {return String_.Concat_any(x, ",", y);}
|
||||
@Override public String toString() {return XtoStr();}
|
||||
public String To_str() {return String_.Concat_any(x, ",", y);}
|
||||
@Override public String toString() {return To_str();}
|
||||
@Override public boolean equals(Object obj) {return Eq(obj);}
|
||||
@Override public int hashCode() {return super.hashCode();}
|
||||
@gplx.Internal protected PointAdp(int x, int y) {this.x = x; this.y = y;}
|
||||
|
||||
@@ -24,12 +24,12 @@ public class SizeAdp {
|
||||
@gplx.Internal protected SizeAdp Op_add(SizeAdp s) {return SizeAdp_.new_(width + s.width, height + s.height);}
|
||||
@gplx.Internal protected SizeAdp Op_subtract(int val) {return SizeAdp_.new_(width - val, height - val);}
|
||||
@gplx.Internal protected SizeAdp Op_subtract(int w, int h) {return SizeAdp_.new_(width - w, height - h);}
|
||||
public String XtoStr() {return String_.Concat_any(width, ",", height);}
|
||||
public String To_str() {return String_.Concat_any(width, ",", height);}
|
||||
public boolean Eq(Object o) {
|
||||
SizeAdp comp = (SizeAdp)o; if (comp == null) return false;
|
||||
return width == comp.width && height == comp.height;
|
||||
}
|
||||
@Override public String toString() {return XtoStr();}
|
||||
@Override public String toString() {return To_str();}
|
||||
@Override public boolean equals(Object obj) {return Eq(obj);}
|
||||
@Override public int hashCode() {return super.hashCode();}
|
||||
@gplx.Internal protected SizeAdp(int width, int height) {this.width = width; this.height = height;}
|
||||
|
||||
@@ -26,11 +26,11 @@ public class ColorAdp {
|
||||
public String XtoHexStr() {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
sb.Add("#");
|
||||
sb.Add(HexDecUtl.XtoStr(Alpha(), 2));
|
||||
sb.Add(HexDecUtl.XtoStr(Red(), 2));
|
||||
sb.Add(HexDecUtl.XtoStr(Green(), 2));
|
||||
sb.Add(HexDecUtl.XtoStr(Blue(), 2));
|
||||
return sb.XtoStr();
|
||||
sb.Add(HexDecUtl.To_str(Alpha(), 2));
|
||||
sb.Add(HexDecUtl.To_str(Red(), 2));
|
||||
sb.Add(HexDecUtl.To_str(Green(), 2));
|
||||
sb.Add(HexDecUtl.To_str(Blue(), 2));
|
||||
return sb.To_str();
|
||||
}
|
||||
public boolean Eq(Object obj) {
|
||||
ColorAdp comp = ColorAdp_.as_(obj); if (comp == null) return false;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class FontAdp implements GfoInvkAble {
|
||||
}
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
} static final String Invk_name_ = "name_", Invk_size_ = "size_", Invk_style_ = "style_";
|
||||
@Override public String toString() {return String_bldr_.new_().Add_kv("name", name).Add_kv_obj("size", size).Add_kv_obj("style", style).XtoStr();}
|
||||
@Override public String toString() {return String_bldr_.new_().Add_kv("name", name).Add_kv_obj("size", size).Add_kv_obj("style", style).To_str();}
|
||||
|
||||
public static final FontAdp NullPtr = null;
|
||||
public static FontAdp as_(Object obj) {return obj instanceof FontAdp ? (FontAdp)obj : null;}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class PenAdp implements GfoInvkAble {
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
} static final String Invk_Width_ = "Width_", Invk_Color_ = "Color_";
|
||||
@Override public String toString() {return String_bldr_.new_().Add_kv_obj("width", width).Add_kv("color", color.XtoHexStr()).XtoStr();}
|
||||
@Override public String toString() {return String_bldr_.new_().Add_kv_obj("width", width).Add_kv("color", color.XtoHexStr()).To_str();}
|
||||
@Override public int hashCode() {return color.Value() ^ (int)width;}
|
||||
@Override public boolean equals(Object obj) { // cannot use Eq b/c of difficulty in comparing null instances
|
||||
PenAdp comp = PenAdp_.as_(obj); if (comp == null) return false;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class GfuiBorderMgr {
|
||||
all = null;
|
||||
}
|
||||
}
|
||||
public String XtoStr() {return String_bldr_.new_().Add_kv_obj("all", all).Add_kv_obj("left", left).Add_kv_obj("right", right).Add_kv_obj("top", top).Add_kv_obj("bot", bot).XtoStr();}
|
||||
@Override public String toString() {return XtoStr();}
|
||||
public String To_str() {return String_bldr_.new_().Add_kv_obj("all", all).Add_kv_obj("left", left).Add_kv_obj("right", right).Add_kv_obj("top", top).Add_kv_obj("bot", bot).To_str();}
|
||||
@Override public String toString() {return To_str();}
|
||||
public static GfuiBorderMgr new_() {return new GfuiBorderMgr();} GfuiBorderMgr() {}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class IptKeyChain implements IptArg {
|
||||
IptArg itm = ary[i];
|
||||
sb.Add_spr_unless_first(itm.Key(), ",", i);
|
||||
}
|
||||
key = sb.XtoStr();
|
||||
key = sb.To_str();
|
||||
}
|
||||
public static IptKeyChain parse_(String raw) {
|
||||
String[] itms = String_.Split(raw, ",");
|
||||
|
||||
@@ -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_.XtoStr(bnd)).Add("exc", Err_.Message_lang(exc)));
|
||||
UsrDlg_._.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;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class IptBndMgr_tst {
|
||||
IptEventData evData = IptEventData.new_(null, IptArg_.EventType_default(arg), arg, null, null);
|
||||
under.Process(evData);
|
||||
}
|
||||
Tfds.Eq(expd, output.XtoStr());
|
||||
Tfds.Eq(expd, output.To_str());
|
||||
return this;
|
||||
}
|
||||
String_bldr output = String_bldr_.new_();
|
||||
|
||||
@@ -38,7 +38,7 @@ public class IptBnd_ {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
for (int i = 0; i < ary.Count(); i++)
|
||||
sb.Add_spr_unless_first(((IptArg)ary.Get_at(i)).Key(), "|", i);
|
||||
return sb.XtoStr();
|
||||
return sb.To_str();
|
||||
}
|
||||
}
|
||||
class IptBnd_invk implements IptBnd {
|
||||
|
||||
@@ -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._.XtoStr(this);}
|
||||
public String XtoUiStr() {return IptKeyStrMgr._.To_str(this);}
|
||||
public IptKey Add(IptKey comp) {return IptKey_.add_(this, comp);}
|
||||
public boolean Mod_shift() {return Enm_.HasInt(val, IptKey_.Shift.Val());}
|
||||
public boolean Mod_ctrl() {return Enm_.HasInt(val, IptKey_.Ctrl.Val());}
|
||||
|
||||
@@ -22,7 +22,7 @@ class IptKeyStrMgr {
|
||||
IptKey rv = charKeys[charVal];
|
||||
return (rv == null) ? IptKey_.None : rv;
|
||||
}
|
||||
public String XtoStr(IptKey key) {
|
||||
public String To_str(IptKey key) {
|
||||
if (literals == null) Init();
|
||||
Object rv = literals.Get_by(key.Val());
|
||||
return rv == null ? String_.Empty : (String)rv;
|
||||
@@ -62,7 +62,7 @@ class IptKeyStrMgr {
|
||||
Reg(lowerKey, lowerChr);
|
||||
Reg(upperKey, upperChr);
|
||||
}
|
||||
void Reg(IptKey k, char c) {Reg(k, Char_.XtoStr(c), (int)c);}
|
||||
void Reg(IptKey k, char c) {Reg(k, Char_.To_str(c), (int)c);}
|
||||
void Reg(IptKey k, String s, int charVal) {
|
||||
int v = k.Val();
|
||||
literals.Add(v, s);
|
||||
|
||||
@@ -167,7 +167,7 @@ class GxwTextHtml_editor extends JEditorPane implements GxwTextHtml {
|
||||
KeyVal atr = atrs[i];
|
||||
sb.Add(atr.Key() + "=").Add(atr.Val_to_str_or_null()).Add_char_crlf();
|
||||
}
|
||||
return sb.XtoStr();
|
||||
return sb.To_str();
|
||||
}
|
||||
Element Html_sel_elm() {
|
||||
HTMLDocument doc = (HTMLDocument)this.getDocument();
|
||||
|
||||
@@ -64,10 +64,10 @@ public class GfoConsoleWin implements GfoInvkAble, UsrMsgWkr {
|
||||
}
|
||||
public void ExecUsrMsg(int type, UsrMsg umsg) {
|
||||
if (win == null) this.Init();
|
||||
String s = umsg.XtoStr();
|
||||
String s = umsg.To_str();
|
||||
if (type == UsrMsgWkr_.Type_Warn) {
|
||||
if (!win.Pin()) win.Pin_();
|
||||
s = "!!warn!! " + umsg.XtoStr();
|
||||
s = "!!warn!! " + umsg.To_str();
|
||||
if (logger == null) return;
|
||||
logger.Write(s);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,6 @@ class GfuiWinKeyCmdMgr implements GfuiWinOpenAble, GfoInvkAble, GfoEvObj {
|
||||
}
|
||||
public static IptKey ExtractKeyFromText(String raw) {
|
||||
int pos = ExtractPosFromText(raw); if (pos == String_.Find_none) return IptKey_.None;
|
||||
return IptKey_.parse_("key." + String_.Lower(Char_.XtoStr(String_.CharAt(raw, pos + 1)))); // pos=& pos; + 1 to get next letter
|
||||
return IptKey_.parse_("key." + String_.Lower(Char_.To_str(String_.CharAt(raw, pos + 1)))); // pos=& pos; + 1 to get next letter
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ public class GfuiElemBase implements GfuiElem {
|
||||
GfuiElem subE = (GfuiElem)this.SubElems().Get_at(i);
|
||||
sb.Add_str_w_crlf(subE.Key_of_GfuiElem());
|
||||
}
|
||||
return sb.XtoStr();
|
||||
return sb.To_str();
|
||||
}
|
||||
else {
|
||||
Object rv = this.InvkMgr().Invk(ctx, ikey, k, m, this);
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.gfui; import gplx.*;
|
||||
public class GfuiBnd_box_status implements GfoInvkAble, UsrMsgWkr {
|
||||
public GfuiElem Box() {return box;} GfuiElem box;
|
||||
public void ExecUsrMsg(int type, UsrMsg umsg) {
|
||||
box.Invoke(GfoInvkAbleCmd.arg_(this, WriteText_cmd, umsg.XtoStr()));
|
||||
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
|
||||
|
||||
@@ -29,7 +29,7 @@ public class GfuiStatusBox extends GfuiTextBox implements UsrMsgWkr { public Gf
|
||||
) return;
|
||||
this.CreateControlIfNeeded(); // WORKAROUND.WINFORMS: else will sometimes throw: Cannot call Invoke or InvokeAsync on a control until the window handle has been created
|
||||
this.VisibilityDuration_(umsg.VisibilityDuration());
|
||||
String text = String_.Replace(umsg.XtoStr(), Op_sys.Cur().Nl_str(), " "); // replace NewLine with " " since TextBox cannot show NewLine
|
||||
String text = String_.Replace(umsg.To_str(), Op_sys.Cur().Nl_str(), " "); // replace NewLine with " " since TextBox cannot show NewLine
|
||||
Invoke(GfoInvkAbleCmd.arg_(this, Invk_WriteText, text));
|
||||
}
|
||||
public void WriteText(String text) {
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ClipboardAdp_ {
|
||||
}
|
||||
remake.Add(c);
|
||||
}
|
||||
rv = remake.XtoStr();
|
||||
rv = remake.To_str();
|
||||
// rv = String_.Replace(rv, "\n", Env_.NewLine);
|
||||
}
|
||||
return rv;
|
||||
|
||||
@@ -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.XtoStr());}
|
||||
void SaveAs(Io_url url, String ext) {Io_mgr.I.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));}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class GfuiEnv_ {
|
||||
public static final String Err_GfuiException = "gplx.dbs.GfuiException"; // TODO: used in JAVA. move
|
||||
}
|
||||
class GfuiInterruptLnr implements UsrMsgWkr {
|
||||
public void ExecUsrMsg(int type, UsrMsg umsg) {GfuiEnv_.ShowMsg(umsg.XtoStr());}
|
||||
public void ExecUsrMsg(int type, UsrMsg umsg) {GfuiEnv_.ShowMsg(umsg.To_str());}
|
||||
public static GfuiInterruptLnr new_() {return new GfuiInterruptLnr();} GfuiInterruptLnr() {}
|
||||
}
|
||||
class GfuiFormRunner implements Runnable {
|
||||
|
||||
@@ -334,7 +334,7 @@ class Swt_msg_wkr_stop implements UsrMsgWkr {
|
||||
private final Swt_kit kit; private final Gfo_usr_dlg gui_wtr;
|
||||
public Swt_msg_wkr_stop(Swt_kit kit, Gfo_usr_dlg gui_wtr) {this.kit = kit; this.gui_wtr = gui_wtr;}
|
||||
public void ExecUsrMsg(int type, UsrMsg umsg) {
|
||||
String msg = umsg.XtoStr();
|
||||
String msg = umsg.To_str();
|
||||
kit.Ask_ok("xowa.gui", "stop", msg);
|
||||
gui_wtr.Log_many("", "", msg);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import gplx.core.strings.*;
|
||||
public abstract class GfxItm_base implements GfxItm {
|
||||
public PointAdp Pos() {return pos;} PointAdp pos = PointAdp_.Zero;
|
||||
public SizeAdp Size() {return size;} SizeAdp size = SizeAdp_.Zero;
|
||||
@Override public String toString() {return String_bldr_.new_().Add_kv_obj("pos", pos).Add_kv_obj("size", size).XtoStr();}
|
||||
@Override public String toString() {return String_bldr_.new_().Add_kv_obj("pos", pos).Add_kv_obj("size", size).To_str();}
|
||||
@Override public int hashCode() {return this.toString().hashCode();}
|
||||
@Override public boolean equals(Object obj) {
|
||||
GfxItm_base comp = GfxItm_base.as_(obj); if (comp == null) return false;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class GfxLineItm implements GfxItm {
|
||||
public float Width() {return width;} float width;
|
||||
public ColorAdp Color() {return color;} ColorAdp color;
|
||||
|
||||
@Override public String toString() {return String_bldr_.new_().Add_kv_obj("src", src).Add_kv_obj("trg", trg).Add_kv_obj("width", width).Add_kv_obj("color", color.XtoHexStr()).XtoStr();}
|
||||
@Override public String toString() {return String_bldr_.new_().Add_kv_obj("src", src).Add_kv_obj("trg", trg).Add_kv_obj("width", width).Add_kv_obj("color", color.XtoHexStr()).To_str();}
|
||||
@Override public int hashCode() {return this.toString().hashCode();}
|
||||
@Override public boolean equals(Object obj) {
|
||||
GfxLineItm comp = GfxLineItm.as_(obj); if (comp == null) return false;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class GfxRectItm extends GfxItm_base {
|
||||
public float Width() {return width;} float width;
|
||||
public ColorAdp Color() {return color;} ColorAdp color;
|
||||
|
||||
@Override public String toString() {return String_.Concat(super.toString(), String_bldr_.new_().Add_kv_obj("width", width).Add_kv("color", color.XtoHexStr()).XtoStr());}
|
||||
@Override public String toString() {return String_.Concat(super.toString(), String_bldr_.new_().Add_kv_obj("width", width).Add_kv("color", color.XtoHexStr()).To_str());}
|
||||
@Override public int hashCode() {return this.toString().hashCode();}
|
||||
@Override public boolean equals(Object obj) {
|
||||
GfxRectItm comp = GfxRectItm.as_(obj); if (comp == null) return false;
|
||||
|
||||
Reference in New Issue
Block a user