mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Refactor: Clean up Int_ classes
This commit is contained in:
@@ -25,12 +25,12 @@ public class Rect_ref {
|
||||
public gplx.gfui.RectAdp XtoRectAdp() {return gplx.gfui.RectAdp_.new_(x, y, w, h);}
|
||||
public gplx.gfui.RectAdp XtoRectAdp_add(Rect_ref v) {return gplx.gfui.RectAdp_.new_(x + v.x, y + v.y, w + v.w, h + v.h);}
|
||||
@Override public String toString() {return String_.Format("{0},{1},{2},{3}", x, y, w, h);}
|
||||
public static final Rect_ref Zero = new Rect_ref(0, 0, 0, 0);
|
||||
public static final Rect_ref Zero = new Rect_ref(0, 0, 0, 0);
|
||||
public static Rect_ref rectAdp_(gplx.gfui.RectAdp v) {return new Rect_ref(v.X(), v.Y(), v.Width(), v.Height());}
|
||||
public static Rect_ref parse(String raw) {
|
||||
try {
|
||||
String[] ary = String_.Split(raw, ",");
|
||||
return new Rect_ref(Int_.parse(ary[0]), Int_.parse(ary[1]), Int_.parse(ary[2]), Int_.parse(ary[3]));
|
||||
return new Rect_ref(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, Rect_ref.class, raw);}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,12 +52,12 @@ public class Xog_layout_box implements Gfo_invk {
|
||||
else if (ctx.Match(k, Invk_y_rel_)) y_rel = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_w_rel_)) w_rel = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_h_rel_)) h_rel = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_size_abs_)) {int[] ary = Int_.Ary_parse(m.ReadStr("v"), 2, null); if (ary != null) {w_abs = ary[0]; h_abs = ary[1];}}
|
||||
else if (ctx.Match(k, Invk_size_rel_)) {int[] ary = Int_.Ary_parse(m.ReadStr("v"), 2, null); if (ary != null) {w_rel = ary[0]; h_rel = ary[1];}}
|
||||
else if (ctx.Match(k, Invk_pos_abs_)) {int[] ary = Int_.Ary_parse(m.ReadStr("v"), 2, null); if (ary != null) {x_abs = ary[0]; y_abs = ary[1];}}
|
||||
else if (ctx.Match(k, Invk_pos_rel_)) {int[] ary = Int_.Ary_parse(m.ReadStr("v"), 2, null); if (ary != null) {x_rel = ary[0]; y_rel = ary[1];}}
|
||||
else if (ctx.Match(k, Invk_rect_abs_)) {int[] ary = Int_.Ary_parse(m.ReadStr("v"), 4, null); if (ary != null) {w_abs = ary[0]; h_abs = ary[1]; x_abs = ary[2]; y_abs = ary[3];}}
|
||||
else if (ctx.Match(k, Invk_rect_rel_)) {int[] ary = Int_.Ary_parse(m.ReadStr("v"), 4, null); if (ary != null) {w_rel = ary[0]; h_rel = ary[1]; x_rel = ary[2]; y_rel = ary[3];}}
|
||||
else if (ctx.Match(k, Invk_size_abs_)) {int[] ary = Int_ary_.Parse(m.ReadStr("v"), 2, null); if (ary != null) {w_abs = ary[0]; h_abs = ary[1];}}
|
||||
else if (ctx.Match(k, Invk_size_rel_)) {int[] ary = Int_ary_.Parse(m.ReadStr("v"), 2, null); if (ary != null) {w_rel = ary[0]; h_rel = ary[1];}}
|
||||
else if (ctx.Match(k, Invk_pos_abs_)) {int[] ary = Int_ary_.Parse(m.ReadStr("v"), 2, null); if (ary != null) {x_abs = ary[0]; y_abs = ary[1];}}
|
||||
else if (ctx.Match(k, Invk_pos_rel_)) {int[] ary = Int_ary_.Parse(m.ReadStr("v"), 2, null); if (ary != null) {x_rel = ary[0]; y_rel = ary[1];}}
|
||||
else if (ctx.Match(k, Invk_rect_abs_)) {int[] ary = Int_ary_.Parse(m.ReadStr("v"), 4, null); if (ary != null) {w_abs = ary[0]; h_abs = ary[1]; x_abs = ary[2]; y_abs = ary[3];}}
|
||||
else if (ctx.Match(k, Invk_rect_rel_)) {int[] ary = Int_ary_.Parse(m.ReadStr("v"), 4, null); if (ary != null) {w_rel = ary[0]; h_rel = ary[1]; x_rel = ary[2]; y_rel = ary[3];}}
|
||||
else if (ctx.Match(k, Invk_text_)) text = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk_font_name_)) font_name = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk_font_size_)) font_size = m.ReadFloat("v");
|
||||
|
||||
Reference in New Issue
Block a user