mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.8.5.1
This commit is contained in:
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class GfuiAlign_ implements ParseAble {
|
||||
public static GfuiAlign as_(Object obj) {return obj instanceof GfuiAlign ? (GfuiAlign)obj : null;}
|
||||
public static GfuiAlign cast_(Object obj) {try {return (GfuiAlign)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfuiAlign.class, obj);}}
|
||||
public static GfuiAlign cast(Object obj) {try {return (GfuiAlign)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfuiAlign.class, obj);}}
|
||||
public static final GfuiAlign
|
||||
Null = new_(0, "nil")
|
||||
, Lo = new_(1, "lo")
|
||||
@@ -31,14 +31,14 @@ public class GfuiAlign_ implements ParseAble {
|
||||
, Right = Hi;
|
||||
static GfuiAlign new_(int v, String s) {return new GfuiAlign(v, s);}
|
||||
public static final GfuiAlign_ Parser = new GfuiAlign_();
|
||||
public Object ParseAsObj(String raw) {return parse_(raw);}
|
||||
public Object ParseAsObj(String raw) {return parse(raw);}
|
||||
public static GfuiAlign val_(int v) {
|
||||
if (v == Lo.Val()) return Lo;
|
||||
else if (v == Mid.Val()) return Mid;
|
||||
else if (v == Hi.Val()) return Hi;
|
||||
else return Null;
|
||||
}
|
||||
public static GfuiAlign parse_(String raw) {
|
||||
public static GfuiAlign parse(String raw) {
|
||||
if (String_.Eq(raw, "bot")) return Bot;
|
||||
else if (String_.Eq(raw, "mid")) return Mid;
|
||||
else if (String_.Eq(raw, "top")) return Top;
|
||||
@@ -51,7 +51,7 @@ public class GfuiAlign_ implements ParseAble {
|
||||
}
|
||||
public static int CalcInsideOfAxis(int posEnm, int innerSize, int outerSize) {
|
||||
int rv = 0;
|
||||
if (posEnm == GfuiAlign_.Null.Val()) rv = Int_.MinValue;
|
||||
if (posEnm == GfuiAlign_.Null.Val()) rv = Int_.Min_value;
|
||||
else if (posEnm == GfuiAlign_.Lo.Val()) rv = 0;
|
||||
else if (posEnm == GfuiAlign_.Mid.Val()) rv = (outerSize - innerSize) / 2;
|
||||
else if (posEnm == GfuiAlign_.Hi.Val()) rv = outerSize - innerSize;
|
||||
|
||||
@@ -39,7 +39,7 @@ class GfuiBorderEdge_ {
|
||||
else if (val == GfuiBorderEdge.All.Val()) return All_raw;
|
||||
else throw Err_.new_unhandled(edge);
|
||||
}
|
||||
public static GfuiBorderEdge parse_(String raw) {
|
||||
public static GfuiBorderEdge parse(String raw) {
|
||||
if (String_.Eq(raw, Left_raw)) return GfuiBorderEdge.Left;
|
||||
else if (String_.Eq(raw, Right_raw)) return GfuiBorderEdge.Right;
|
||||
else if (String_.Eq(raw, Top_raw)) return GfuiBorderEdge.Top;
|
||||
|
||||
@@ -17,16 +17,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class PointAdp_ {
|
||||
public static final PointAdp Null = new PointAdp(Int_.MinValue, Int_.MinValue);
|
||||
public static final PointAdp Null = new PointAdp(Int_.Min_value, Int_.Min_value);
|
||||
public static final PointAdp Zero = new PointAdp(0, 0);
|
||||
public static PointAdp as_(Object obj) {return obj instanceof PointAdp ? (PointAdp)obj : null;}
|
||||
public static PointAdp cast_(Object obj) {try {return (PointAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, PointAdp.class, obj);}}
|
||||
public static PointAdp cast(Object obj) {try {return (PointAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, PointAdp.class, obj);}}
|
||||
public static PointAdp new_(int x, int y) {return new PointAdp(x, y);}
|
||||
public static PointAdp coerce_(Object o) {PointAdp rv = PointAdp_.as_(o); return (rv == null) ? parse_((String)o) : rv;}
|
||||
public static PointAdp parse_(String raw) {
|
||||
public static PointAdp coerce_(Object o) {PointAdp rv = PointAdp_.as_(o); return (rv == null) ? parse((String)o) : rv;}
|
||||
public static PointAdp parse(String raw) {
|
||||
try {
|
||||
String[] ary = String_.Split(raw, ",");
|
||||
return new PointAdp(Int_.parse_(ary[0]), Int_.parse_(ary[1]));
|
||||
return new PointAdp(Int_.parse(ary[0]), Int_.parse(ary[1]));
|
||||
} catch (Exception exc) {throw Err_.new_parse_exc(exc, PointAdp.class, raw);}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class RectAdpF { //_20101206 // supports Graphics.MeasureString
|
||||
return comp.x == x && comp.y == y && comp.width == width && comp.height == height;
|
||||
}
|
||||
|
||||
public static final RectAdpF Null = new_(Int_.MinValue, Int_.MinValue, Int_.MinValue, Int_.MinValue);
|
||||
public static final RectAdpF Null = new_(Int_.Min_value, Int_.Min_value, Int_.Min_value, Int_.Min_value);
|
||||
public static RectAdpF new_(float x, float y, float width, float height) {
|
||||
RectAdpF rv = new RectAdpF();
|
||||
rv.x = x; rv.y = y; rv.width = width; rv.height = height;
|
||||
|
||||
@@ -23,11 +23,11 @@ public class RectAdp_ {
|
||||
public static RectAdp vector_(PointAdp pos, SizeAdp size) {return new RectAdp(pos, size);}
|
||||
public static RectAdp size_(int w, int h) {return new_(0, 0, w, h);}
|
||||
public static RectAdp size_(SizeAdp size) {return new RectAdp(PointAdp_.Zero, size);}
|
||||
public static RectAdp parse_ws_(String raw) {return parse_(String_.Replace(raw, " ", ""));}
|
||||
public static RectAdp parse_(String raw) {
|
||||
public static RectAdp parse_ws_(String raw) {return parse(String_.Replace(raw, " ", ""));}
|
||||
public static RectAdp parse(String raw) {
|
||||
try {
|
||||
String[] ary = String_.Split(raw, ",");
|
||||
return RectAdp_.new_(Int_.parse_(ary[0]), Int_.parse_(ary[1]), Int_.parse_(ary[2]), Int_.parse_(ary[3]));
|
||||
return RectAdp_.new_(Int_.parse(ary[0]), Int_.parse(ary[1]), Int_.parse(ary[2]), Int_.parse(ary[3]));
|
||||
} catch(Exception exc) {throw Err_.new_parse_exc(exc, RectAdp.class, raw);}
|
||||
}
|
||||
public static String Xto_str(RectAdp rect) {return String_.Format("{0},{1},{2},{3}", rect.X(), rect.Y(), rect.Width(), rect.Height());}
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.gfui; import gplx.*;
|
||||
public class SizeAdpF implements ParseAble {
|
||||
public float Width() {return width;} float width;
|
||||
public float Height() {return height;} float height;
|
||||
public Object ParseAsObj(String raw) {return SizeAdp_.parse_(raw);}
|
||||
public Object ParseAsObj(String raw) {return SizeAdp_.parse(raw);}
|
||||
@Override public String toString() {return String_.Concat_any(width, ":", height);}
|
||||
@gplx.Internal protected SizeAdpF(float width, float height) {this.width = width; this.height = height;}
|
||||
}
|
||||
|
||||
@@ -17,17 +17,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class SizeAdpF_ {
|
||||
public static final SizeAdpF Null = new_(Int_.MinValue, Int_.MinValue);
|
||||
public static final SizeAdpF Null = new_(Int_.Min_value, Int_.Min_value);
|
||||
public static final SizeAdpF Zero = new_(0, 0);
|
||||
public static final SizeAdpF Parser = new SizeAdpF(0, 0);
|
||||
public static SizeAdpF as_(Object obj) {return obj instanceof SizeAdpF ? (SizeAdpF)obj : null;}
|
||||
public static SizeAdpF new_(float width, float height) {return new SizeAdpF(width, height);}
|
||||
public static SizeAdpF coerce_(Object obj) {SizeAdpF rv = as_(obj); return rv == null ? parse_((String)obj) : rv;}
|
||||
public static SizeAdpF parse_(String s) {
|
||||
public static SizeAdpF coerce_(Object obj) {SizeAdpF rv = as_(obj); return rv == null ? parse((String)obj) : rv;}
|
||||
public static SizeAdpF parse(String s) {
|
||||
try {
|
||||
String[] ary = String_.Split(s, ","); if (ary.length != 2) throw Err_.new_wo_type("SizeAdf should only have 2 numbers separated by 1 comma");
|
||||
float val1 = Float_.parse_(ary[0]);
|
||||
float val2 = Float_.parse_(ary[1]);
|
||||
float val1 = Float_.parse(ary[0]);
|
||||
float val2 = Float_.parse(ary[1]);
|
||||
return new_(val1, val2);
|
||||
} catch (Exception e) {throw Err_.new_parse_exc(e, SizeAdpF.class, s);}
|
||||
}
|
||||
|
||||
@@ -17,16 +17,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class SizeAdp_ {
|
||||
public static final SizeAdp Null = new SizeAdp(Int_.MinValue, Int_.MinValue);
|
||||
public static final SizeAdp Null = new SizeAdp(Int_.Min_value, Int_.Min_value);
|
||||
public static final SizeAdp Zero = new SizeAdp(0, 0);
|
||||
public static final SizeAdp[] Ary_empty = new SizeAdp[0];
|
||||
public static SizeAdp cast_(Object obj) {try {return (SizeAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, SizeAdp.class, obj);}}
|
||||
public static SizeAdp cast(Object obj) {try {return (SizeAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, SizeAdp.class, obj);}}
|
||||
public static SizeAdp new_(int width, int height) {return new SizeAdp(width, height);}
|
||||
public static SizeAdp parse_(String raw) {return parse_or_(raw, SizeAdp_.Null);}
|
||||
public static SizeAdp parse_or_(String raw, SizeAdp or) {
|
||||
public static SizeAdp parse(String raw) {return parse_or(raw, SizeAdp_.Null);}
|
||||
public static SizeAdp parse_or(String raw, SizeAdp or) {
|
||||
String[] ary = String_.Split(raw, ","); if (ary.length != 2) return or;
|
||||
int w = Int_.parse_or_(ary[0], Int_.MinValue); if (w == Int_.MinValue) return or;
|
||||
int h = Int_.parse_or_(ary[1], Int_.MinValue); if (h == Int_.MinValue) return or;
|
||||
int w = Int_.parse_or(ary[0], Int_.Min_value); if (w == Int_.Min_value) return or;
|
||||
int h = Int_.parse_or(ary[1], Int_.Min_value); if (h == Int_.Min_value) return or;
|
||||
return new SizeAdp(w, h);
|
||||
}
|
||||
public static SizeAdp corners_(PointAdp topLeft, PointAdp bottomRight) {
|
||||
|
||||
Reference in New Issue
Block a user