1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2015-05-24 22:43:55 -04:00
parent 6eec99a713
commit 51e6188c1e
1577 changed files with 11555 additions and 10080 deletions

View File

@@ -23,7 +23,7 @@ public class GftBand {
public GftBand Len1_pct_(float val) {return Len1_(new GftSizeCalc_pct(val));}
public GftBand Len1_abs_(int v) {return Len1_(new GftSizeCalc_abs(v));}
public GftCell Cell_dfl() {return cell_dfl;} GftCell cell_dfl = new GftCell();
public ListAdp Cells() {return cells;} ListAdp cells = ListAdp_.new_();
public List_adp Cells() {return cells;} List_adp cells = List_adp_.new_();
public GftBand Cells_var_(int count) {
for (int i = 0; i < count; i++)
cells.Add(new GftCell().Len0_(new GftSizeCalc_var(count)));
@@ -37,28 +37,28 @@ public class GftBand {
cells.Add(new GftCell().Len0_(new GftSizeCalc_num(num)));
return this;
}
public ListAdp Items() {return items;} ListAdp items = ListAdp_.new_();
public List_adp Items() {return items;} List_adp items = List_adp_.new_();
public void Items_add(GftItem item) {items.Add(item);}
public void Calc(GftItem owner, int y, int h) {
int x = 0;
y = grid.Bands_dir().GetValByDir(y - h, y);
int availX = owner.Gft_w();
for (int i = 0; i < cells.Count(); i++) {
GftCell cell = (GftCell)cells.FetchAt(i);
GftCell cell = (GftCell)cells.Get_at(i);
if (cell.Len0().Key() == GftSizeCalc_abs.KEY) {
GftSizeCalc_abs calc = (GftSizeCalc_abs)cell.Len0();
availX -= calc.Val();
}
else if (cell.Len0().Key() == GftSizeCalc_var.KEY) {
if (i >= items.Count()) continue;
GftItem item = (GftItem)items.FetchAt(i);
GftItem item = (GftItem)items.Get_at(i);
GfuiElem elem = GfuiElem_.as_(item);
availX -= elem == null ? item.Gft_w() : elem.Width();
}
}
for (int i = 0; i < items.Count(); i++) {
GftItem item = (GftItem)items.FetchAt(i);
GftCell cell = i >= cells.Count() ? cell_dfl : (GftCell)cells.FetchAt(i);
GftItem item = (GftItem)items.Get_at(i);
GftCell cell = i >= cells.Count() ? cell_dfl : (GftCell)cells.Get_at(i);
int w = cell.Len0().Calc(grid, this, owner, item, availX);
item.Gft_rect_(RectAdp_.new_(x, y, w, h));
// Tfds.Write(item.Key_of_GfuiElem(), w, h, x, y);
@@ -71,7 +71,7 @@ public class GftBand {
rv.grid = grid;
rv.key = key; rv.idx = idx; rv.cell_dfl = cell_dfl.Clone(); rv.len1 = this.len1.Clone();
for (int i = 0; i < cells.Count(); i++) {
GftCell cell = (GftCell)cells.FetchAt(i);
GftCell cell = (GftCell)cells.Get_at(i);
rv.cells.Add(cell.Clone());
}
return rv;

View File

@@ -18,20 +18,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
public class GftGrid {
public String Key() {return key;} public GftGrid Key_(String v) {key = v; return this;} private String key;
public ListAdp Bands() {return bands;} ListAdp bands = ListAdp_.new_();
public ListAdp SubLyts() {return subLyts;} ListAdp subLyts = ListAdp_.new_();
public List_adp Bands() {return bands;} List_adp bands = List_adp_.new_();
public List_adp SubLyts() {return subLyts;} List_adp subLyts = List_adp_.new_();
public void Clear() {bands.Clear(); subLyts.Clear(); bandDir = DirInt.Fwd;}
public DirInt Bands_dir() {return bandDir;} public GftGrid Bands_dir_(DirInt v) {bandDir = v; return this;} DirInt bandDir = DirInt.Fwd;
public GftGrid SubLyts_get(String key) {
for (int i = 0; i < subLyts.Count(); i++) {
GftGrid grid = (GftGrid)subLyts.FetchAt(i);
GftGrid grid = (GftGrid)subLyts.Get_at(i);
if (String_.Eq(key, grid.Key())) return grid;
}
return null;
}
public GftBand Bands_get(String key) {
for (int i = 0; i < bands.Count(); i++) {
GftBand band = (GftBand)bands.FetchAt(i);
GftBand band = (GftBand)bands.Get_at(i);
if (String_.Eq(key, band.Key())) return band;
}
return null;
@@ -47,16 +47,16 @@ public class GftGrid {
}
return this;
}
@gplx.Internal protected void Bands_delAt(int i) {bands.DelAt(i);}
@gplx.Internal protected boolean Bands_has(String key) {return Bands_indexOf(key) != ListAdp_.NotFound;}
@gplx.Internal protected void Bands_delAt(int i) {bands.Del_at(i);}
@gplx.Internal protected boolean Bands_has(String key) {return Bands_indexOf(key) != List_adp_.NotFound;}
@gplx.Internal protected void Bands_del(String key) {
int idx = Bands_indexOf(key);
if (idx != ListAdp_.NotFound) bands.DelAt(idx);
if (idx != List_adp_.NotFound) bands.Del_at(idx);
}
int Bands_indexOf(String key) {
int curIdx = ListAdp_.NotFound;
int curIdx = List_adp_.NotFound;
for (int i = 0; i < bands.Count(); i++) {
GftBand band = (GftBand)bands.FetchAt(i);
GftBand band = (GftBand)bands.Get_at(i);
if (String_.Eq(key, band.Key())) {
curIdx = i;
break;
@@ -80,7 +80,7 @@ public class GftGrid {
void ExecLyts(GftItem owner, GftItem[] ary) {
int idx = 0;
for (int i = 0; i < subLyts.Count(); i++) {
GftGrid subGrid = (GftGrid)subLyts.FetchAt(i);
GftGrid subGrid = (GftGrid)subLyts.Get_at(i);
GftItem[] subAry = new GftItem[subGrid.Bands_cellCount()];
for (int j = 0; j < subAry.length; j++) {
subAry[j] = ary[idx++];
@@ -92,17 +92,17 @@ public class GftGrid {
if (bands.Count() == 0) return;
int availY = owner.Gft_h();
GftBand band = null;
int bgn = bandDir.GetValByDir(bands.LastIndex(), 0);
int bgn = bandDir.GetValByDir(bands.Idx_last(), 0);
int end = bandDir.GetValByDir(-1, bands.Count());
for (int i = bgn; i != end; i += bandDir.Val()) {
band = (GftBand)bands.FetchAt(i);
band = (GftBand)bands.Get_at(i);
if (band.Len1().Key() == GftSizeCalc_abs.KEY) {
GftSizeCalc_abs calc = (GftSizeCalc_abs)band.Len1();
availY -= calc.Val();
}
}
int bandIdx = 0;
band = (GftBand)bands.FetchAt(bandIdx);
band = (GftBand)bands.Get_at(bandIdx);
band.Items().Clear();
int y = bandDir.GetValByDir(owner.Gft_h(), 0);
for (int itmIdx = 0; itmIdx < ary.length; itmIdx++) {
@@ -112,7 +112,7 @@ public class GftGrid {
band.Calc(owner, y, h);
y += h * bandDir.Val();
if (bandIdx + 1 >= bands.Count()) throw Err_.new_("error retrieving band").Add("owner", owner.Key_of_GfuiElem()).Add("item", itm.Key_of_GfuiElem()).Add("bandIdx", bandIdx + 1).Add("count", bands.Count());
band = (GftBand)bands.FetchAt(++bandIdx);
band = (GftBand)bands.Get_at(++bandIdx);
band.Items().Clear();
}
band.Items_add(itm);
@@ -122,7 +122,7 @@ public class GftGrid {
int Bands_cellCount() {
int rv = 0;
for (int i = 0; i < bands.Count(); i++) {
GftBand band = (GftBand)bands.FetchAt(i);
GftBand band = (GftBand)bands.Get_at(i);
rv += band.Cells().Count();
}
return rv;
@@ -131,7 +131,7 @@ public class GftGrid {
public static void LytExecRecur(GfuiElemBase owner) {
if (owner.Lyt() != null) owner.Lyt_exec();
for (int i = 0; i < owner.SubElems().Count(); i++) {
GfuiElemBase sub = (GfuiElemBase)owner.SubElems().FetchAt(i);
GfuiElemBase sub = (GfuiElemBase)owner.SubElems().Get_at(i);
LytExecRecur(sub);
}
}

View File

@@ -31,7 +31,7 @@ class GftGrid_fx {
return this;
}
public GftGrid_fx ini_ItmWidth(int i, int width) {
GftItem itm = (GftItem)itms.FetchAt(i);
GftItem itm = (GftItem)itms.Get_at(i);
itm.Gft_w_(width);
return this;
}
@@ -43,7 +43,7 @@ class GftGrid_fx {
return this;
}
public GftGrid_fx ini_Lyt(int num) {
curGrid = (GftGrid)grid.SubLyts().FetchAt(num);
curGrid = (GftGrid)grid.SubLyts().Get_at(num);
return this;
}
public GftGrid_fx ini_BandDir(DirInt dir) {curGrid.Bands_dir_(dir); return this;}
@@ -51,7 +51,7 @@ class GftGrid_fx {
public GftGrid_fx ini_Set(int idx, GftBand orig) {return ini_Set(idx, idx, orig);}
public GftGrid_fx ini_Set(int bgn, int end, GftBand orig) {curGrid.Bands_set(bgn, end, orig); return this;}
public GftGrid_fx run() {
GftItem[] ary = (GftItem[])itms.Xto_ary(GftItem.class);
GftItem[] ary = (GftItem[])itms.To_ary(GftItem.class);
grid.Exec(owner, ary);
return this;
}
@@ -70,7 +70,7 @@ class GftGrid_fx {
int len = end - bgn + 1;
int[] actl = new int[len];
for (int i = 0; i < len; i++) {
GftItem itm = (GftItem)itms.FetchAt(i + bgn);
GftItem itm = (GftItem)itms.Get_at(i + bgn);
actl[i] = GetVal(itm, name);
}
Tfds.Eq_ary(expd, actl, name);
@@ -89,5 +89,5 @@ class GftGrid_fx {
return rv;
}
GftGrid grid = GftGrid.new_(), curGrid;
ListAdp itms = ListAdp_.new_();
List_adp itms = List_adp_.new_();
}