mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Refactor: Refactor Dbmeta classes; Rename methods of list and hash classes
This commit is contained in:
@@ -73,7 +73,7 @@ public class GfuiMoveElemBnd implements IptBnd, Gfo_invk, InjectAble {
|
||||
}
|
||||
void ExecKeyDown(IptEventData msg) {
|
||||
PointAdp current = targetElem.Pos();
|
||||
PointAdp offset = PointAdp_.cast(hash.Get_by(msg.EventArg()));
|
||||
PointAdp offset = PointAdp_.cast(hash.GetByOrNull(msg.EventArg()));
|
||||
targetElem.Pos_(current.Op_add(offset));
|
||||
}
|
||||
@gplx.Internal protected void Key_set(String key) {this.key = key;} private String key;
|
||||
@@ -83,7 +83,7 @@ public class GfuiMoveElemBnd implements IptBnd, Gfo_invk, InjectAble {
|
||||
PointAdp anchor = PointAdp_.Zero; Hash_adp hash = Hash_adp_.New();
|
||||
public static GfuiMoveElemBnd new_() {return new GfuiMoveElemBnd();}
|
||||
GfuiMoveElemBnd() {
|
||||
args.Add_many(IptMouseBtn_.Left, IptMouseMove.AnyDirection);
|
||||
args.AddMany(IptMouseBtn_.Left, IptMouseMove.AnyDirection);
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Up), PointAdp_.new_(0, -10));
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Down), PointAdp_.new_(0, 10));
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Left), PointAdp_.new_(-10, 0));
|
||||
|
||||
@@ -83,7 +83,7 @@ class GfuiResizeFormBnd implements IptBnd {
|
||||
active = false;
|
||||
}
|
||||
void ExecKeyDown(IptEventData iptData) {
|
||||
SizeAdp deltaSize = (SizeAdp)hash.Get_by(iptData.EventArg());
|
||||
SizeAdp deltaSize = (SizeAdp)hash.GetByOrNull(iptData.EventArg());
|
||||
ResizeForm(iptData.Sender(), deltaSize);
|
||||
}
|
||||
void ResizeForm(GfuiElem elem, SizeAdp deltaSize) {
|
||||
@@ -100,7 +100,7 @@ class GfuiResizeFormBnd implements IptBnd {
|
||||
boolean active = false; PointAdp lastPos = PointAdp_.Zero; Hash_adp hash = Hash_adp_.New();
|
||||
public static GfuiResizeFormBnd new_() {return new GfuiResizeFormBnd();}
|
||||
GfuiResizeFormBnd() {
|
||||
args.Add_many(IptMouseBtn_.Right, IptMouseMove.AnyDirection);
|
||||
args.AddMany(IptMouseBtn_.Right, IptMouseMove.AnyDirection);
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Shift).Add(IptKey_.Up), SizeAdp_.new_(0, -10));
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Shift).Add(IptKey_.Down), SizeAdp_.new_(0, 10));
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Shift).Add(IptKey_.Left), SizeAdp_.new_(-10, 0));
|
||||
|
||||
@@ -303,7 +303,7 @@ public class GfuiElemBase implements GfuiElem {
|
||||
Object rv = this.InvkMgr().Invk(ctx, ikey, k, m, this);
|
||||
if (rv != Gfo_invk_.Rv_unhandled) return rv;
|
||||
|
||||
Object findObj = injected.Get_by(k);
|
||||
Object findObj = injected.GetByOrNull(k);
|
||||
if (findObj == null) findObj = this.subElems.Get_by(k);
|
||||
if (findObj == null) return Gfo_invk_.Rv_unhandled;
|
||||
return findObj; // necessary for gplx.images
|
||||
@@ -339,7 +339,7 @@ public class GfuiElemBase implements GfuiElem {
|
||||
// underMgr.Size_set(SizeAdp_.new_(20, 20)); // NOTE: CS inits to 20,20; JAVA inits to 0,0
|
||||
}
|
||||
public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.control_();}
|
||||
public Object SubItms_getObj(String key) {return injected.Get_by(key);}
|
||||
public Object SubItms_getObj(String key) {return injected.GetByOrNull(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();
|
||||
Hash_adp injected = Hash_adp_.New();
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.elems; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
public class GfuiElemList {
|
||||
public int Count() {return hash.Count();}
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.elems; import gplx.*;
|
||||
public class GfuiElemList {
|
||||
public int Count() {return hash.Len();}
|
||||
public GfuiElem Get_at(int idx) {return (GfuiElem)hash.Get_at(idx);}
|
||||
public GfuiElem Get_by(String key) {return (GfuiElem)hash.Get_by(key);}
|
||||
public GfuiElem Get_by(String key) {return (GfuiElem)hash.GetByOrNull(key);}
|
||||
public void Add(GfuiElem box) {Add_exec(box);}
|
||||
public void DelOrFail(GfuiElem box) {Del_exec(box);}
|
||||
public void Del_at(int idx) {Del_exec(Get_at(idx));}
|
||||
|
||||
@@ -183,7 +183,7 @@ class GxwTextFld_cls_lang extends JTextField implements GxwTextFld {
|
||||
class GxwTextBox_overrideKeyCmd extends AbstractAction {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (focus) {
|
||||
int z = owner.OwnerWin().FocusMgr().SubElems().Idx_of(owner);
|
||||
int z = owner.OwnerWin().FocusMgr().SubElems().IdxOf(owner);
|
||||
owner.OwnerWin().FocusMgr().Focus(focusDir, z);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,64 +1,38 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*;
|
||||
import gplx.core.strings.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.text.AbstractDocument;
|
||||
import javax.swing.text.AttributeSet;
|
||||
import javax.swing.text.BoxView;
|
||||
import javax.swing.text.ComponentView;
|
||||
import javax.swing.text.DefaultEditorKit;
|
||||
import javax.swing.text.DefaultStyledDocument;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.EditorKit;
|
||||
import javax.swing.text.Element;
|
||||
import javax.swing.text.IconView;
|
||||
import javax.swing.text.LabelView;
|
||||
import javax.swing.text.MutableAttributeSet;
|
||||
import javax.swing.text.ParagraphView;
|
||||
import javax.swing.text.PlainDocument;
|
||||
import javax.swing.text.Segment;
|
||||
import javax.swing.text.SimpleAttributeSet;
|
||||
import javax.swing.text.StyleConstants;
|
||||
import javax.swing.text.StyledDocument;
|
||||
import javax.swing.text.StyledEditorKit;
|
||||
import javax.swing.text.View;
|
||||
import javax.swing.text.ViewFactory;
|
||||
import javax.swing.text.html.HTML;
|
||||
import javax.swing.text.html.HTMLDocument;
|
||||
import javax.swing.text.html.HTMLEditorKit;
|
||||
import javax.swing.text.html.HTMLEditorKit.HTMLFactory;
|
||||
import javax.swing.text.html.InlineView;
|
||||
import javax.swing.text.html.StyleSheet;
|
||||
import gplx.gfui.draws.*;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.gfxs.*;
|
||||
@@ -218,7 +192,7 @@ class GxwTextHtml_editor extends JEditorPane implements GxwTextHtml {
|
||||
Element elm = Html_sel_elm(); if (elm == null) return Keyval_.Ary_empty;
|
||||
List_adp sel_atrs_list = List_adp_.New();
|
||||
Html_sel_atrs(elm.getAttributes(), sel_atrs_list, null, ".");
|
||||
return (Keyval[])sel_atrs_list.To_ary(Keyval.class);
|
||||
return (Keyval[])sel_atrs_list.ToAry(Keyval.class);
|
||||
}
|
||||
|
||||
@Override public void processKeyEvent(KeyEvent e) {
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs; import gplx.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.layouts.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
|
||||
public class TabBox extends GfuiElemBase {
|
||||
public int Tabs_Count() {return mgr.Count();}
|
||||
@@ -129,7 +129,7 @@ class TabPnlAreaMgr {
|
||||
}
|
||||
public static void Del(TabBox tabBox, TabPnlItm itm) {
|
||||
tabBox.PnlBox().SubElems().Del_at(itm.Idx());
|
||||
((GfuiElemBase)tabBox.PnlBox()).Lyt().SubLyts().Del_at(itm.Idx());
|
||||
((GfuiElemBase)tabBox.PnlBox()).Lyt().SubLyts().DelAt(itm.Idx());
|
||||
}
|
||||
public static void Select(TabBox tabBox, TabPnlItm curTabItm, TabPnlItm newTabItm) {
|
||||
if (curTabItm != null) {
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs; import gplx.*;
|
||||
public class TabBoxMgr implements Gfo_evt_mgr_owner {
|
||||
public Gfo_evt_mgr Evt_mgr() {if (evt_mgr == null) evt_mgr = new Gfo_evt_mgr(this); return evt_mgr;} Gfo_evt_mgr evt_mgr;
|
||||
public int Count() {return itms.Count();}
|
||||
public TabPnlItm Get_by(String k) {return (TabPnlItm)itms.Get_by(k);}
|
||||
public int Count() {return itms.Len();}
|
||||
public TabPnlItm Get_by(String k) {return (TabPnlItm)itms.GetByOrNull(k);}
|
||||
public TabPnlItm Get_at(int i) {return (TabPnlItm)itms.Get_at(i);}
|
||||
public TabPnlItm CurTab() {return curTab;} TabPnlItm curTab;
|
||||
public TabPnlItm Add(String key, String name) {
|
||||
TabPnlItm itm = TabPnlItm.new_(this, key).Name_(name).Idx_(itms.Count());
|
||||
TabPnlItm itm = TabPnlItm.new_(this, key).Name_(name).Idx_(itms.Len());
|
||||
itms.Add(itm.Key(), itm);
|
||||
return itm;
|
||||
}
|
||||
public void Del_at(int i) {
|
||||
boolean isCur = i == curTab.Idx(), isLast = i == itms.Count() - 1;
|
||||
boolean isCur = i == curTab.Idx(), isLast = i == itms.Len() - 1;
|
||||
TabPnlItm itm = this.Get_at(i);
|
||||
itms.Del(itm.Key());
|
||||
this.Reorder(i);
|
||||
@@ -40,7 +40,7 @@ public class TabBoxMgr implements Gfo_evt_mgr_owner {
|
||||
public void Select(int i) {Select((TabPnlItm)itms.Get_at(i));}
|
||||
@gplx.Internal protected void Move_to(int src, int trg) {itms.Move_to(src, trg);}
|
||||
@gplx.Internal protected void Reorder(int bgn) {
|
||||
for (int i = bgn; i < itms.Count(); i++) {
|
||||
for (int i = bgn; i < itms.Len(); i++) {
|
||||
TabPnlItm itm = (TabPnlItm)itms.Get_at(i);
|
||||
itm.Idx_(i);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.windows; import gplx.*;
|
||||
import gplx.core.lists.*; /*ComparerAble*/
|
||||
import gplx.gfui.controls.elems.*;
|
||||
public class GfuiFocusOrderer {
|
||||
@@ -26,7 +26,7 @@ public class GfuiFocusOrderer {
|
||||
if (sub.Focus_idx() != NullVal) continue;
|
||||
list.Add(sub);
|
||||
}
|
||||
list.Sort_by(comparer);
|
||||
list.SortBy(comparer);
|
||||
|
||||
for (Object subObj : list) {
|
||||
GfuiElem sub = (GfuiElem)subObj;
|
||||
|
||||
@@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*;
|
||||
import org.junit.*; import gplx.gfui.controls.elems.*;
|
||||
public class GfuiFocusOrderer_tst {
|
||||
@Before public void setup() {
|
||||
@@ -74,7 +74,7 @@ public class GfuiFocusOrderer_tst {
|
||||
}
|
||||
}
|
||||
void tst_FocusIndxs(GfuiElem owner, List_adp list, int... expd) {
|
||||
int[] actl = new int[list.Count()];
|
||||
int[] actl = new int[list.Len()];
|
||||
for (int i = 0; i < actl.length; i++) {
|
||||
GfuiElem sub = (GfuiElem)list.Get_at(i);
|
||||
actl[i] = sub.UnderElem().Core().Focus_index();
|
||||
|
||||
@@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.windows; import gplx.*;
|
||||
import gplx.core.interfaces.*;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.tabs.*;
|
||||
public class GfuiFocusXferBnd implements InjectAble, Gfo_invk {
|
||||
@@ -24,10 +24,10 @@ public class GfuiFocusXferBnd implements InjectAble, Gfo_invk {
|
||||
}
|
||||
@gplx.Internal protected void Focus(GfuiElem cur, boolean fwd) {
|
||||
List_adp allElemsInOwnerWin = List_adp_.New(); AddSubs(cur.OwnerWin(), allElemsInOwnerWin);
|
||||
int curIdx = allElemsInOwnerWin.Idx_of(cur);
|
||||
int curIdx = allElemsInOwnerWin.IdxOf(cur);
|
||||
GfuiElem target = cur;
|
||||
while (true) { // find next visible elem
|
||||
int cycle = TabBox_.Cycle(fwd, curIdx, allElemsInOwnerWin.Count());
|
||||
int cycle = TabBox_.Cycle(fwd, curIdx, allElemsInOwnerWin.Len());
|
||||
target = GfuiElem_.cast(allElemsInOwnerWin.Get_at(cycle));
|
||||
if (target.Visible()) break;
|
||||
if (cycle == curIdx) break; // either (a) one elem in allElemsInOwnerWin or (b) n elems, and cycled back to start; break, else infinite loop
|
||||
|
||||
@@ -252,7 +252,7 @@ class GfuiMenuBarItmType {
|
||||
public String Name() {return name;} private String name;
|
||||
GfuiMenuBarItmType(int v, String n) {val = v; name = n; regy.Add(n, this);}
|
||||
public static GfuiMenuBarItmType parse(String raw) {
|
||||
try {return (GfuiMenuBarItmType)regy.Get_by(raw);}
|
||||
try {return (GfuiMenuBarItmType)regy.GetByOrNull(raw);}
|
||||
catch (Exception e) {Err_.Noop(e); throw Err_.new_parse("GfuiMenuBarItmType", raw);}
|
||||
}
|
||||
static Hash_adp regy = Hash_adp_.New();
|
||||
|
||||
@@ -42,8 +42,8 @@ public class GfuiWinFocusMgr {
|
||||
}
|
||||
public GfuiElem Focus(boolean fwd, int cur) {
|
||||
int nxt = fwd
|
||||
? cur == subElems.Idx_last() ? 0 : ++cur
|
||||
: cur == 0 ? subElems.Idx_last() : --cur;
|
||||
? cur == subElems.IdxLast() ? 0 : ++cur
|
||||
: cur == 0 ? subElems.IdxLast() : --cur;
|
||||
GfuiElem elm = (GfuiElem)subElems.Get_at(nxt);
|
||||
elm.Focus();
|
||||
return elm;
|
||||
@@ -61,7 +61,7 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
|
||||
this.elems = formFocusMgr.subElems;
|
||||
this.formFocusMgr = formFocusMgr;
|
||||
}
|
||||
boolean elems_empty() {return elems.Count() == 0;}
|
||||
boolean elems_empty() {return elems.Len() == 0;}
|
||||
public Component getComponentAfter(Container focusCycleRoot, Component c) {
|
||||
formFocusMgr.InitForm();
|
||||
if (elems_empty()) return c;
|
||||
@@ -70,7 +70,7 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
|
||||
int idx = orig;
|
||||
while (true) {
|
||||
idx++;
|
||||
if (idx == elems.Count())
|
||||
if (idx == elems.Len())
|
||||
idx = 0;
|
||||
GfuiElem elem = null;
|
||||
try {elem = (GfuiElem)elems.Get_at(idx);}
|
||||
@@ -100,7 +100,7 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
|
||||
while (true) {
|
||||
idx--;
|
||||
if (idx == -1)
|
||||
idx = elems.Count() - List_adp_.Base1;
|
||||
idx = elems.Len() - List_adp_.Base1;
|
||||
GfuiElem elem = null;
|
||||
try {
|
||||
elem = (GfuiElem)elems.Get_at(idx);
|
||||
@@ -129,7 +129,7 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
|
||||
}
|
||||
public Component getDefaultComponent(Container focusCycleRoot) {return getFirstComponent(focusCycleRoot);}
|
||||
public Component getFirstComponent(Container focusCycleRoot) {return elems_empty() ? focusCycleRoot : (Component)FetchAt(0).UnderElem();}
|
||||
public Component getLastComponent(Container focusCycleRoot) {return elems_empty() ? focusCycleRoot : (Component)FetchAt(elems.Count() - 1).UnderElem();}
|
||||
public Component getLastComponent(Container focusCycleRoot) {return elems_empty() ? focusCycleRoot : (Component)FetchAt(elems.Len() - 1).UnderElem();}
|
||||
GfuiElem FetchAt(int idx) {return (GfuiElem)elems.Get_at(idx);}
|
||||
GxwElem GxwElemOf(Component c) {
|
||||
if (GxwElem.class.isAssignableFrom(c.getClass())) return (GxwElem)c;
|
||||
|
||||
@@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.windows; import gplx.*;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
|
||||
import gplx.core.lists.*; import gplx.core.bits.*;
|
||||
public class GfuiWinKeyCmdMgr implements GfuiWinOpenAble, Gfo_invk, Gfo_evt_itm {
|
||||
@@ -31,8 +31,8 @@ public class GfuiWinKeyCmdMgr implements GfuiWinOpenAble, Gfo_invk, Gfo_evt_itm
|
||||
if (GfuiTextBox_.as_(sender) != null // is sender textBox?
|
||||
&& !Bitmask_.Has_int(keyVal, IptKey_.Alt.Val()) // does key not have alt
|
||||
) return false; // ignore keys from textbox if they do not have alt
|
||||
List_adp elemList = (List_adp)listHash.Get_by(keyVal); if (elemList == null) return false;
|
||||
for (int i = 0; i < elemList.Count(); i++) {
|
||||
List_adp elemList = (List_adp)listHash.GetByOrNull(keyVal); if (elemList == null) return false;
|
||||
for (int i = 0; i < elemList.Len(); i++) {
|
||||
GfuiElem elem = (GfuiElem)elemList.Get_at(i);
|
||||
if (elem.Visible())
|
||||
elem.Click();
|
||||
|
||||
@@ -1,180 +1,198 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.core.envs.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.envs.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*; import gplx.gfui.controls.windows.*;
|
||||
public class GfuiWin_toaster extends GfuiWin { public void ShowPopup(GfuiWin owner, String text, int interval) {
|
||||
this.TaskbarParkingWindowFix(owner);
|
||||
ShowPopup(text, interval);
|
||||
}
|
||||
void ShowPopup(String text, int interval) {
|
||||
if (Env_.Mode_testing()) return;
|
||||
messageLabel.Text_(text);
|
||||
messageLabel.SelBgn_set(0);
|
||||
InitVariables(500, interval * 1000, 500);
|
||||
BeginPoppingUp();
|
||||
}
|
||||
void InitVariables(int growingArg, int fullyGrownArg, int timeForHidingArg) {
|
||||
popupState = PopupState.FullyShrunk;
|
||||
fullyGrownTimerInterval = fullyGrownArg;
|
||||
int timerEvents = 0;
|
||||
if (growingArg > 10) {
|
||||
timerEvents = Math_.Min((growingArg / 10), fullyGrown.Height());
|
||||
growingTimerInterval = growingArg / timerEvents;
|
||||
growingIncrement = fullyGrown.Height() / timerEvents;
|
||||
}
|
||||
else {
|
||||
growingTimerInterval = 10;
|
||||
growingIncrement = fullyGrown.Height();
|
||||
}
|
||||
|
||||
if( timeForHidingArg > 10) {
|
||||
timerEvents = Math_.Min((timeForHidingArg / 10), fullyGrown.Height());
|
||||
shrinkingTimerInterval = timeForHidingArg / timerEvents;
|
||||
shrinkingIncrement = fullyGrown.Height() / timerEvents;
|
||||
}
|
||||
else {
|
||||
shrinkingTimerInterval = 10;
|
||||
shrinkingIncrement = fullyGrown.Height();
|
||||
}
|
||||
}
|
||||
void BeginPoppingUp() {
|
||||
RectAdp screenRect = ScreenAdp_.Primary.Rect();//WorkingArea
|
||||
int screenX_max = screenRect.X() + screenRect.Width();
|
||||
int val = popupState.Val();
|
||||
if (val == PopupState.FullyShrunk.Val()) {
|
||||
this.Size_(SizeAdp_.new_(this.Width(), 0));
|
||||
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.Instance.FocusedElem();
|
||||
this.Visible_on_();
|
||||
// GfuiFocusMgr.Instance.FocusedElem_set(last);
|
||||
}
|
||||
timer.Interval_(growingTimerInterval);
|
||||
popupState = PopupState.Growing;
|
||||
}
|
||||
else if (val == PopupState.Growing.Val()) {
|
||||
this.Redraw();
|
||||
}
|
||||
else if (val == PopupState.FullyGrown.Val()) {
|
||||
timer.Interval_(fullyGrownTimerInterval);
|
||||
this.Redraw();
|
||||
}
|
||||
else if (val == PopupState.Shrinking.Val()) {
|
||||
this.Size_(SizeAdp_.new_(this.Width(), 0));
|
||||
this.Pos_(screenX_max / 2 - this.Width()/2, PopupAnchorTop); //screenRect.Bottom - 1
|
||||
timer.Interval_(fullyGrownTimerInterval);
|
||||
popupState = PopupState.FullyGrown;
|
||||
}
|
||||
timer.Enabled_on();
|
||||
}
|
||||
// public override boolean FocusGotCbk() {
|
||||
// GfuiElem last = GfuiFocusMgr.Instance.FocusedElemPrev();
|
||||
// GfuiFocusMgr.Instance.FocusedElem_set(last);
|
||||
// last.Focus();
|
||||
// return false;
|
||||
// }
|
||||
|
||||
void WhenTick() {
|
||||
int fullHeight = fullyGrown.Height();
|
||||
int val = popupState.Val();
|
||||
if (val == PopupState.Growing.Val()) {
|
||||
if (this.Height() < fullHeight)
|
||||
ChangeBounds(true, growingIncrement);
|
||||
else {
|
||||
this.Height_(fullHeight);
|
||||
timer.Interval_(fullyGrownTimerInterval);
|
||||
popupState = PopupState.FullyGrown;
|
||||
}
|
||||
}
|
||||
else if (val == PopupState.FullyGrown.Val()) {
|
||||
timer.Interval_(shrinkingTimerInterval);
|
||||
// if ((bKeepVisibleOnMouseOver && !bIsMouseOverPopup ) || (!bKeepVisibleOnMouseOver)) {
|
||||
popupState = PopupState.Shrinking;
|
||||
}
|
||||
else if (val == PopupState.Shrinking.Val()) {
|
||||
// if (bReShowOnMouseOver && bIsMouseOverPopup) {popupState = PopupState.Growing; break;}
|
||||
if (this.Height() > 2) // NOTE.Val()) { does not shrink less than 2 //this.Top > screenRect.Bottom
|
||||
ChangeBounds(false, shrinkingIncrement);
|
||||
else {
|
||||
// this.Pos_(-500, -500); // WORKAROUND:JAVA: cannot do this.Hide() b/c it will focus ownerForm; EX: typing in textApp when musicApp moves forward
|
||||
this.Visible_off_();
|
||||
popupState = PopupState.FullyShrunk;
|
||||
timer.Enabled_off();
|
||||
}
|
||||
}
|
||||
}
|
||||
static final int PopupAnchorTop = -1; // HACK: wxp1 showed obvious flickering with top edge
|
||||
void ChangeBounds(boolean isGrowing, int increment) {
|
||||
increment = isGrowing ? increment : -increment;
|
||||
this.Pos_(this.X(), PopupAnchorTop); //this.Top - increment
|
||||
this.Size_(SizeAdp_.new_(this.Width(), this.Height() + increment));
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.win_toaster_(ctorArgs);}
|
||||
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.fullyGrown = SizeAdp_.new_(600, 96);
|
||||
this.Pos_(-100, -100); this.Size_(fullyGrown); super.Show(); super.Hide();// was 20,20; set to fullyGrown b/c of java
|
||||
messageLabel = GfuiTextBox_.multi_("messageLabel", this);
|
||||
messageLabel.Size_(fullyGrown.Width(), fullyGrown.Height()).ForeColor_(ColorAdp_.Green);
|
||||
messageLabel.TextMgr().Font_(FontAdp.new_("Arial", 8, FontStyleAdp_.Bold));
|
||||
messageLabel.Border_on_(true);
|
||||
messageLabel.Focus_able_(false);
|
||||
// this.Focus_able_(false);
|
||||
// this.UnderElem().Core().Focus_able_force_(false);
|
||||
timer = TimerAdp.new_(this, Tmr_cmd, 3000, false);
|
||||
|
||||
GxwWin formRef = (GxwWin)this.UnderElem();
|
||||
if (formRef != null) { // FIXME: nullCheck, needed for MediaPlaylistMgr_tst
|
||||
formRef.Pin_set(true);
|
||||
formRef.TaskbarVisible_set(false);
|
||||
}
|
||||
}
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Tmr_cmd)) WhenTick();
|
||||
else super.Invk(ctx, ikey, k, m);
|
||||
return this;
|
||||
} public static final String Tmr_cmd = "Tmr";
|
||||
GfuiTextMemo messageLabel;
|
||||
TimerAdp timer;
|
||||
SizeAdp fullyGrown = SizeAdp_.Zero;
|
||||
int growingIncrement, shrinkingIncrement;
|
||||
int growingTimerInterval, shrinkingTimerInterval, fullyGrownTimerInterval;
|
||||
PopupState popupState = PopupState.FullyShrunk;
|
||||
public static GfuiWin_toaster new_(GfuiWin owner) {
|
||||
GfuiWin_toaster rv = new GfuiWin_toaster();
|
||||
// rv.Icon_(IconAdp.cfg_("popup"));
|
||||
rv.ctor_GfuiBox_base
|
||||
(new Keyval_hash()
|
||||
.Add(GfuiElem_.InitKey_focusAble, false)
|
||||
.Add(GfuiElem_.InitKey_ownerWin, owner)
|
||||
.Add(GfuiWin_.InitKey_winType, GfuiWin_.InitKey_winType_toaster)
|
||||
);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
class PopupState {
|
||||
public int Val() {return val;} int val;
|
||||
public PopupState(int v) {this.val = v;}
|
||||
public static final PopupState
|
||||
FullyShrunk = new PopupState(1)
|
||||
, Growing = new PopupState(2)
|
||||
, FullyGrown = new PopupState(3)
|
||||
, Shrinking = new PopupState(4)
|
||||
;
|
||||
}
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2021 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows;
|
||||
import gplx.GfoMsg;
|
||||
import gplx.GfsCtx;
|
||||
import gplx.Keyval_hash;
|
||||
import gplx.Math_;
|
||||
import gplx.core.envs.Env_;
|
||||
import gplx.gfui.RectAdp;
|
||||
import gplx.gfui.SizeAdp;
|
||||
import gplx.gfui.SizeAdp_;
|
||||
import gplx.gfui.controls.elems.GfuiElem_;
|
||||
import gplx.gfui.controls.gxws.GxwElem;
|
||||
import gplx.gfui.controls.gxws.GxwElemFactory_;
|
||||
import gplx.gfui.controls.gxws.GxwWin;
|
||||
import gplx.gfui.controls.standards.GfuiTextBox_;
|
||||
import gplx.gfui.controls.standards.GfuiTextMemo;
|
||||
import gplx.gfui.draws.ColorAdp_;
|
||||
import gplx.gfui.draws.FontAdp;
|
||||
import gplx.gfui.draws.FontStyleAdp_;
|
||||
import gplx.gfui.envs.ScreenAdp_;
|
||||
import gplx.gfui.envs.TimerAdp;
|
||||
public class GfuiWin_toaster extends GfuiWin {
|
||||
public void ShowPopup(GfuiWin owner, String text, int interval) {
|
||||
this.TaskbarParkingWindowFix(owner);
|
||||
ShowPopup(text, interval);
|
||||
}
|
||||
void ShowPopup(String text, int interval) {
|
||||
if (Env_.Mode_testing()) return;
|
||||
messageLabel.Text_(text);
|
||||
messageLabel.SelBgn_set(0);
|
||||
InitVariables(500, interval * 1000, 500);
|
||||
BeginPoppingUp();
|
||||
}
|
||||
void InitVariables(int growingArg, int fullyGrownArg, int timeForHidingArg) {
|
||||
popupState = PopupState.FullyShrunk;
|
||||
fullyGrownTimerInterval = fullyGrownArg;
|
||||
int timerEvents = 0;
|
||||
if (growingArg > 10) {
|
||||
timerEvents = Math_.Min((growingArg / 10), fullyGrown.Height());
|
||||
growingTimerInterval = growingArg / timerEvents;
|
||||
growingIncrement = fullyGrown.Height() / timerEvents;
|
||||
}
|
||||
else {
|
||||
growingTimerInterval = 10;
|
||||
growingIncrement = fullyGrown.Height();
|
||||
}
|
||||
|
||||
if( timeForHidingArg > 10) {
|
||||
timerEvents = Math_.Min((timeForHidingArg / 10), fullyGrown.Height());
|
||||
shrinkingTimerInterval = timeForHidingArg / timerEvents;
|
||||
shrinkingIncrement = fullyGrown.Height() / timerEvents;
|
||||
}
|
||||
else {
|
||||
shrinkingTimerInterval = 10;
|
||||
shrinkingIncrement = fullyGrown.Height();
|
||||
}
|
||||
}
|
||||
void BeginPoppingUp() {
|
||||
RectAdp screenRect = ScreenAdp_.Primary.Rect();//WorkingArea
|
||||
int screenX_max = screenRect.X() + screenRect.Width();
|
||||
int val = popupState.Val();
|
||||
if (val == PopupState.FullyShrunk.Val()) {
|
||||
this.Size_(SizeAdp_.new_(this.Width(), 0));
|
||||
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.Instance.FocusedElem();
|
||||
this.Visible_on_();
|
||||
// GfuiFocusMgr.Instance.FocusedElem_set(last);
|
||||
}
|
||||
timer.Interval_(growingTimerInterval);
|
||||
popupState = PopupState.Growing;
|
||||
}
|
||||
else if (val == PopupState.Growing.Val()) {
|
||||
this.Redraw();
|
||||
}
|
||||
else if (val == PopupState.FullyGrown.Val()) {
|
||||
timer.Interval_(fullyGrownTimerInterval);
|
||||
this.Redraw();
|
||||
}
|
||||
else if (val == PopupState.Shrinking.Val()) {
|
||||
this.Size_(SizeAdp_.new_(this.Width(), 0));
|
||||
this.Pos_(screenX_max / 2 - this.Width()/2, PopupAnchorTop); //screenRect.Bottom - 1
|
||||
timer.Interval_(fullyGrownTimerInterval);
|
||||
popupState = PopupState.FullyGrown;
|
||||
}
|
||||
timer.Enabled_on();
|
||||
}
|
||||
// public override boolean FocusGotCbk() {
|
||||
// GfuiElem last = GfuiFocusMgr.Instance.FocusedElemPrev();
|
||||
// GfuiFocusMgr.Instance.FocusedElem_set(last);
|
||||
// last.Focus();
|
||||
// return false;
|
||||
// }
|
||||
|
||||
void WhenTick() {
|
||||
int fullHeight = fullyGrown.Height();
|
||||
int val = popupState.Val();
|
||||
if (val == PopupState.Growing.Val()) {
|
||||
if (this.Height() < fullHeight)
|
||||
ChangeBounds(true, growingIncrement);
|
||||
else {
|
||||
this.Height_(fullHeight);
|
||||
timer.Interval_(fullyGrownTimerInterval);
|
||||
popupState = PopupState.FullyGrown;
|
||||
}
|
||||
}
|
||||
else if (val == PopupState.FullyGrown.Val()) {
|
||||
timer.Interval_(shrinkingTimerInterval);
|
||||
// if ((bKeepVisibleOnMouseOver && !bIsMouseOverPopup ) || (!bKeepVisibleOnMouseOver)) {
|
||||
popupState = PopupState.Shrinking;
|
||||
}
|
||||
else if (val == PopupState.Shrinking.Val()) {
|
||||
// if (bReShowOnMouseOver && bIsMouseOverPopup) {popupState = PopupState.Growing; break;}
|
||||
if (this.Height() > 2) // NOTE.Val()) { does not shrink less than 2 //this.Top > screenRect.Bottom
|
||||
ChangeBounds(false, shrinkingIncrement);
|
||||
else {
|
||||
// this.Pos_(-500, -500); // WORKAROUND:JAVA: cannot do this.Hide() b/c it will focus ownerForm; EX: typing in textApp when musicApp moves forward
|
||||
this.Visible_off_();
|
||||
popupState = PopupState.FullyShrunk;
|
||||
timer.Enabled_off();
|
||||
}
|
||||
}
|
||||
}
|
||||
static final int PopupAnchorTop = -1; // HACK: wxp1 showed obvious flickering with top edge
|
||||
void ChangeBounds(boolean isGrowing, int increment) {
|
||||
increment = isGrowing ? increment : -increment;
|
||||
this.Pos_(this.X(), PopupAnchorTop); //this.Top - increment
|
||||
this.Size_(SizeAdp_.new_(this.Width(), this.Height() + increment));
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.win_toaster_(ctorArgs);}
|
||||
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.fullyGrown = SizeAdp_.new_(600, 96);
|
||||
this.Pos_(-100, -100); this.Size_(fullyGrown); super.Show(); super.Hide();// was 20,20; set to fullyGrown b/c of java
|
||||
messageLabel = GfuiTextBox_.multi_("messageLabel", this);
|
||||
messageLabel.Size_(fullyGrown.Width(), fullyGrown.Height()).ForeColor_(ColorAdp_.Green);
|
||||
messageLabel.TextMgr().Font_(FontAdp.new_("Arial", 8, FontStyleAdp_.Bold));
|
||||
messageLabel.Border_on_(true);
|
||||
messageLabel.Focus_able_(false);
|
||||
// this.Focus_able_(false);
|
||||
// this.UnderElem().Core().Focus_able_force_(false);
|
||||
timer = TimerAdp.new_(this, Tmr_cmd, 3000, false);
|
||||
|
||||
GxwWin formRef = (GxwWin)this.UnderElem();
|
||||
if (formRef != null) { // FIXME: nullCheck, needed for MediaPlaylistMgr_tst
|
||||
formRef.Pin_set(true);
|
||||
formRef.TaskbarVisible_set(false);
|
||||
}
|
||||
}
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Tmr_cmd)) WhenTick();
|
||||
else super.Invk(ctx, ikey, k, m);
|
||||
return this;
|
||||
} public static final String Tmr_cmd = "Tmr";
|
||||
GfuiTextMemo messageLabel;
|
||||
TimerAdp timer;
|
||||
SizeAdp fullyGrown = SizeAdp_.Zero;
|
||||
int growingIncrement, shrinkingIncrement;
|
||||
int growingTimerInterval, shrinkingTimerInterval, fullyGrownTimerInterval;
|
||||
PopupState popupState = PopupState.FullyShrunk;
|
||||
public static GfuiWin_toaster new_(GfuiWin owner) {
|
||||
GfuiWin_toaster rv = new GfuiWin_toaster();
|
||||
// rv.Icon_(IconAdp.cfg_("popup"));
|
||||
rv.ctor_GfuiBox_base
|
||||
(new Keyval_hash()
|
||||
.Add(GfuiElem_.InitKey_focusAble, false)
|
||||
.Add(GfuiElem_.InitKey_ownerWin, owner)
|
||||
.Add(GfuiWin_.InitKey_winType, GfuiWin_.InitKey_winType_toaster)
|
||||
);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
class PopupState {
|
||||
public int Val() {return val;} int val;
|
||||
public PopupState(int v) {this.val = v;}
|
||||
public static final PopupState
|
||||
FullyShrunk = new PopupState(1)
|
||||
, Growing = new PopupState(2)
|
||||
, FullyGrown = new PopupState(3)
|
||||
, Shrinking = new PopupState(4)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.draws; import gplx.*; import gplx.gfui.*;
|
||||
package gplx.gfui.draws; import gplx.*;
|
||||
public class ColorAdpCache {
|
||||
public java.awt.Color GetNativeColor(ColorAdp color) {
|
||||
Object rv = hash.Get_by(color.Value()); if (rv != null) return (java.awt.Color)rv;
|
||||
Object rv = hash.GetByOrNull(color.Value()); if (rv != null) return (java.awt.Color)rv;
|
||||
rv = new java.awt.Color(color.Red(), color.Green(), color.Blue(), color.Alpha());
|
||||
hash.Add(color.Value(), rv);
|
||||
return (java.awt.Color)rv;
|
||||
|
||||
@@ -13,13 +13,13 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.draws; import gplx.*; import gplx.gfui.*;
|
||||
package gplx.gfui.draws; import gplx.*;
|
||||
import java.awt.Font;
|
||||
import java.awt.Toolkit;
|
||||
public class FontAdpCache {
|
||||
public Font GetNativeFont(FontAdp fontAdp) {
|
||||
String key = fontAdp.toString();
|
||||
Font rv = (Font)hash.Get_by(key); if (rv != null) return rv;
|
||||
Font rv = (Font)hash.GetByOrNull(key); if (rv != null) return rv;
|
||||
if (screenResolutionInDpi == -1) ScreenResolution_set();
|
||||
int fontSize = XtoJavaDpi(fontAdp.Size());
|
||||
rv = new Font(fontAdp.Name(), fontAdp.Style().Val(), fontSize);
|
||||
|
||||
@@ -13,9 +13,8 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.draws; import gplx.*; import gplx.gfui.*;
|
||||
package gplx.gfui.draws; import gplx.*;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Stroke;
|
||||
import gplx.core.strings.*;
|
||||
public class PenAdp implements Gfo_invk {
|
||||
public float Width() {return width;} public void Width_set(float v) {width = v; InitUnder();} float width;
|
||||
@@ -39,7 +38,7 @@ public class PenAdp implements Gfo_invk {
|
||||
}
|
||||
class PenAdpCache {
|
||||
public BasicStroke Fetch(float width) {
|
||||
Object rv = hash.Get_by(width);
|
||||
Object rv = hash.GetByOrNull(width);
|
||||
if (rv == null) {
|
||||
rv = new BasicStroke(width);
|
||||
hash.Add(width, rv);
|
||||
|
||||
@@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.draws; import gplx.*; import gplx.gfui.*;
|
||||
package gplx.gfui.draws; import gplx.*;
|
||||
public class SolidBrushAdp_ {
|
||||
public static SolidBrushAdp as_(Object obj) {return obj instanceof SolidBrushAdp ? (SolidBrushAdp)obj : null;}
|
||||
public static SolidBrushAdp cast(Object obj) {try {return (SolidBrushAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, SolidBrushAdp.class, obj);}}
|
||||
@@ -24,7 +24,7 @@ public class SolidBrushAdp_ {
|
||||
}
|
||||
class SolidBrushAdpCache {
|
||||
public SolidBrushAdp Get_by(ColorAdp color) {
|
||||
SolidBrushAdp rv = (SolidBrushAdp)hash.Get_by(color.Value());
|
||||
SolidBrushAdp rv = (SolidBrushAdp)hash.GetByOrNull(color.Value());
|
||||
if (rv == null) {
|
||||
rv = SolidBrushAdp.new_(color);
|
||||
hash.Add(color.Value(), rv);
|
||||
|
||||
@@ -13,16 +13,16 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.gfxs; import gplx.*; import gplx.gfui.*;
|
||||
public class GfxItmList extends List_adp_base {
|
||||
@gplx.New public GfxItm Get_at(int i) {return (GfxItm)Get_at_base(i);}
|
||||
public void Add(GfxItm gfxItm) {Add_base(gfxItm);}
|
||||
}
|
||||
class GfxItmListFxt {
|
||||
public void tst_SubItm_count(GfxAdpMok gfx, int expd) {Tfds.Eq(expd, gfx.SubItms().Count());}
|
||||
public void tst_SubItm(GfxAdpMok gfx, int i, GfxItm expd) {
|
||||
GfxItm actl = gfx.SubItms().Get_at(i);
|
||||
Tfds.Eq(expd, actl);
|
||||
}
|
||||
public static GfxItmListFxt new_() {return new GfxItmListFxt();} GfxItmListFxt() {}
|
||||
}
|
||||
package gplx.gfui.gfxs; import gplx.*;
|
||||
public class GfxItmList extends List_adp_base {
|
||||
@gplx.New public GfxItm Get_at(int i) {return (GfxItm)Get_at_base(i);}
|
||||
public void Add(GfxItm gfxItm) {Add_base(gfxItm);}
|
||||
}
|
||||
class GfxItmListFxt {
|
||||
public void tst_SubItm_count(GfxAdpMok gfx, int expd) {Tfds.Eq(expd, gfx.SubItms().Len());}
|
||||
public void tst_SubItm(GfxAdpMok gfx, int i, GfxItm expd) {
|
||||
GfxItm actl = gfx.SubItms().Get_at(i);
|
||||
Tfds.Eq(expd, actl);
|
||||
}
|
||||
public static GfxItmListFxt new_() {return new GfxItmListFxt();} GfxItmListFxt() {}
|
||||
}
|
||||
|
||||
@@ -84,12 +84,12 @@ public class IptArg_ {
|
||||
class IptMacro {
|
||||
public void Reg(String prefix, String alias, IptArg arg) {
|
||||
if (regy == null) Init();
|
||||
Ordered_hash list = (Ordered_hash)regy.Get_by(prefix);
|
||||
Ordered_hash list = (Ordered_hash)regy.GetByOrNull(prefix);
|
||||
if (list == null) {
|
||||
list = Ordered_hash_.New();
|
||||
regy.Add(prefix, list);
|
||||
}
|
||||
list.Add_if_dupe_use_nth(alias, arg);
|
||||
list.AddIfDupeUseNth(alias, arg);
|
||||
}
|
||||
void Init() {
|
||||
regy = Ordered_hash_.New();
|
||||
@@ -107,9 +107,9 @@ class IptMacro {
|
||||
String[] plusAry = String_.Split(raw, "+");
|
||||
String[] dotAry = String_.Split(plusAry[0], ".");
|
||||
String bgn = dotAry[0], end = dotAry[1];
|
||||
Ordered_hash list = (Ordered_hash)regy.Get_by(bgn);
|
||||
Ordered_hash list = (Ordered_hash)regy.GetByOrNull(bgn);
|
||||
if (list == null) throw parse_err(raw, "list not found").Args_add("list", bgn);
|
||||
IptKey rv = (IptKey)list.Get_by(end);
|
||||
IptKey rv = (IptKey)list.GetByOrNull(end);
|
||||
if (rv == null) throw parse_err(raw, "arg not found").Args_add("arg", end);
|
||||
for (int i = 1; i < plusAry.length; i++) {
|
||||
rv = rv.Add((IptKey)IptKey_.parse(plusAry[i]));
|
||||
|
||||
@@ -37,7 +37,7 @@ public class IptBndMgr implements SrlAble {
|
||||
for (IptBndHash list : regy)
|
||||
if (IptEventType_.Has(bnd.EventTypes(), list.EventType()))
|
||||
list.Add(bnd);
|
||||
for (int i = 0; i < bnd.Ipts().Count(); i++) {
|
||||
for (int i = 0; i < bnd.Ipts().Len(); i++) {
|
||||
IptArg arg = (IptArg)bnd.Ipts().Get_at(i);
|
||||
chainMgr.Add(arg);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class IptBndMgr implements SrlAble {
|
||||
public List_adp Cfgs() {return cfgs;} List_adp cfgs = List_adp_.New();
|
||||
public void Cfgs_delAll() {
|
||||
List_adp del = List_adp_.New();
|
||||
for (int i = 0; i < cfgs.Count(); i++) {
|
||||
for (int i = 0; i < cfgs.Len(); i++) {
|
||||
IptCfgPtr ptr = (IptCfgPtr)cfgs.Get_at(i);
|
||||
IptCfg cfg = IptCfgRegy.Instance.GetOrNew(ptr.CfgKey());
|
||||
cfg.Owners_del(ptr.CfgKey());
|
||||
@@ -62,7 +62,7 @@ public class IptBndMgr implements SrlAble {
|
||||
}
|
||||
del.Add(cfg);
|
||||
}
|
||||
for (int i = 0; i < del.Count(); i++) {
|
||||
for (int i = 0; i < del.Len(); i++) {
|
||||
IptCfg cfg = (IptCfg)del.Get_at(i);
|
||||
cfgs.Del(cfg);
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public class IptBndMgr implements SrlAble {
|
||||
this.Del(old);
|
||||
old.Ipts().Clear();
|
||||
if (ary == IptArg_.Ary_empty) return; // "unbind"; exit after deleting; DATE:2014-05-13
|
||||
old.Ipts().Add_many((Object[])ary);
|
||||
old.Ipts().AddMany((Object[])ary);
|
||||
this.Add(old);
|
||||
}
|
||||
public void Del_by_key(String key) {Del_by(true, key);}
|
||||
@@ -110,7 +110,7 @@ public class IptBndMgr implements SrlAble {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (itm_bnd.Ipts().Count() != 1) continue; // only delete if bnd has 1 ipt; should only be called by xowa which does 1 bnd per ipt
|
||||
if (itm_bnd.Ipts().Len() != 1) continue; // only delete if bnd has 1 ipt; should only be called by xowa which does 1 bnd per ipt
|
||||
IptArg itm_ipt = (IptArg)itm_bnd.Ipts().Get_at(0);
|
||||
if (String_.Eq(del_key, itm_ipt.Key()))
|
||||
deleted.Add(itm_bnd);
|
||||
@@ -118,7 +118,7 @@ public class IptBndMgr implements SrlAble {
|
||||
}
|
||||
}
|
||||
}
|
||||
int deleted_len = deleted.Count();
|
||||
int deleted_len = deleted.Len();
|
||||
for (int i = 0; i < deleted_len; i++) {
|
||||
IptBnd bnd = (IptBnd)deleted.Get_at(i);
|
||||
this.Del(bnd);
|
||||
@@ -131,7 +131,7 @@ public class IptBndMgr implements SrlAble {
|
||||
list.Del(bnd);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < bnd.Ipts().Count(); i++) {
|
||||
for (int i = 0; i < bnd.Ipts().Len(); i++) {
|
||||
IptArg arg = (IptArg)bnd.Ipts().Get_at(i);
|
||||
chainMgr.Del(arg);
|
||||
}
|
||||
@@ -154,7 +154,7 @@ public class IptBndMgr implements SrlAble {
|
||||
}
|
||||
public Object Srl(GfoMsg owner) {
|
||||
GfoMsg m = GfoMsg_.srl_(owner, "mgr");
|
||||
for (int i = 0; i < hash.Count(); i++)
|
||||
for (int i = 0; i < hash.Len(); i++)
|
||||
((IptBnd)hash.Get_at(i)).Srl(m);
|
||||
return this;
|
||||
}
|
||||
@@ -183,11 +183,11 @@ public class IptBndMgr implements SrlAble {
|
||||
class IptBndHash implements SrlAble {
|
||||
private IptBndListItm wildcard_list;
|
||||
public IptEventType EventType() {return eventType;} IptEventType eventType;
|
||||
public int Count() {return hash.Count();}
|
||||
public IptBndListItm Get_by(String key) {return wildcard_list == null ? (IptBndListItm)hash.Get_by(key) : wildcard_list;}
|
||||
public int Count() {return hash.Len();}
|
||||
public IptBndListItm Get_by(String key) {return wildcard_list == null ? (IptBndListItm)hash.GetByOrNull(key) : wildcard_list;}
|
||||
public IptBndListItm Get_at(int i) {return (IptBndListItm)hash.Get_at(i);}
|
||||
public void Add(IptBnd bnd) {
|
||||
for (int i = 0; i < bnd.Ipts().Count(); i++) {
|
||||
for (int i = 0; i < bnd.Ipts().Len(); i++) {
|
||||
IptArg arg = (IptArg)bnd.Ipts().Get_at(i);
|
||||
if (!IptArg_.EventType_match(arg, eventType)) continue; // bnd may have multiple ipts of different evTypes; only add bnd if evType matches
|
||||
if (String_.Eq(arg.Key(), IptArg_.Wildcard_key)) {
|
||||
@@ -195,7 +195,7 @@ class IptBndHash implements SrlAble {
|
||||
wildcard_list.Add(bnd);
|
||||
}
|
||||
else {
|
||||
IptBndListItm itm = (IptBndListItm)hash.Get_by(arg.Key());
|
||||
IptBndListItm itm = (IptBndListItm)hash.GetByOrNull(arg.Key());
|
||||
if (itm == null) {
|
||||
itm = new IptBndListItm(arg.Key());
|
||||
hash.Add(arg.Key(), itm);
|
||||
@@ -205,7 +205,7 @@ class IptBndHash implements SrlAble {
|
||||
}
|
||||
}
|
||||
public void Del(IptBnd bnd) {
|
||||
for (int i = 0; i < bnd.Ipts().Count(); i++) {
|
||||
for (int i = 0; i < bnd.Ipts().Len(); i++) {
|
||||
IptArg arg = (IptArg)bnd.Ipts().Get_at(i);
|
||||
if (!IptArg_.EventType_match(arg, eventType)) continue; // bnd may have multiple ipts of different evTypes; only add bnd if evType matches
|
||||
hash.Del(arg.Key());
|
||||
@@ -213,7 +213,7 @@ class IptBndHash implements SrlAble {
|
||||
}
|
||||
public Object Srl(GfoMsg owner) {
|
||||
GfoMsg m = GfoMsg_.srl_(owner, "list").Add("eventType", eventType.Name());
|
||||
for (int i = 0; i < hash.Count(); i++)
|
||||
for (int i = 0; i < hash.Len(); i++)
|
||||
((IptBndListItm)hash.Get_at(i)).Srl(m);
|
||||
return this;
|
||||
}
|
||||
@@ -222,11 +222,11 @@ class IptBndHash implements SrlAble {
|
||||
}
|
||||
class IptBndListItm implements SrlAble {
|
||||
public String IptKey() {return iptKey;} private String iptKey;
|
||||
public int Count() {return list.Count();}
|
||||
public int Count() {return list.Len();}
|
||||
public IptBnd Get_at(int i) {return (IptBnd)list.Get_at(i);}
|
||||
public void Add(IptBnd bnd) {list.Add_at(0, bnd);}
|
||||
public void Add(IptBnd bnd) {list.AddAt(0, bnd);}
|
||||
public boolean Exec(IptEventData evData) {
|
||||
for (int i = 0; i < list.Count(); i++) {
|
||||
for (int i = 0; i < list.Len(); i++) {
|
||||
IptBnd bnd = (IptBnd)list.Get_at(i);
|
||||
try {bnd.Exec(evData);}
|
||||
catch (Exception exc) {
|
||||
@@ -239,7 +239,7 @@ class IptBndListItm implements SrlAble {
|
||||
}
|
||||
public Object Srl(GfoMsg owner) {
|
||||
GfoMsg m = GfoMsg_.srl_(owner, "itm").Add("iptKey", iptKey);
|
||||
for (int i = 0; i < list.Count(); i++)
|
||||
for (int i = 0; i < list.Len(); i++)
|
||||
((IptBnd)list.Get_at(i)).Srl(m);
|
||||
return this;
|
||||
}
|
||||
@@ -250,7 +250,7 @@ class IptArgChainMgr {
|
||||
public void Clear() {regy.Clear();}
|
||||
public String Process(IptArg arg) {
|
||||
// if (String_.Eq(arg.Key(), "key_7")) return "";
|
||||
Hash_adp hash = (Hash_adp)active.Get_by(arg.Key());
|
||||
Hash_adp hash = (Hash_adp)active.GetByOrNull(arg.Key());
|
||||
if (hash == null) {
|
||||
active = regy;
|
||||
String r = activeKey;
|
||||
@@ -279,7 +279,7 @@ class IptArgChainMgr {
|
||||
void Add_recur(Hash_adp cur, IptArg[] ary, int i) {
|
||||
if (i == ary.length - 1) return; // -1 b/c last should not be registered; ex: key.a,key.b should register key.a only
|
||||
IptArg ipt = ary[i];
|
||||
Hash_adp next = (Hash_adp)cur.Get_by(ipt.Key());
|
||||
Hash_adp next = (Hash_adp)cur.GetByOrNull(ipt.Key());
|
||||
if (next == null) {
|
||||
next = Hash_adp_.New();
|
||||
cur.Add(ipt.Key(), next);
|
||||
@@ -292,12 +292,12 @@ class IptArgChainMgr {
|
||||
cur.Del(ipt.Key());
|
||||
return; // -1 b/c last should not be registered; ex: key.a,key.b should register key.a only
|
||||
}
|
||||
Hash_adp next = (Hash_adp)cur.Get_by(ipt.Key());
|
||||
Hash_adp next = (Hash_adp)cur.GetByOrNull(ipt.Key());
|
||||
if (next == null) {
|
||||
return;
|
||||
}
|
||||
Del_recur(next, ary, i + 1);
|
||||
if (cur.Count() == 1)
|
||||
if (cur.Len() == 1)
|
||||
cur.Clear();
|
||||
}
|
||||
Hash_adp regy = Hash_adp_.New();
|
||||
|
||||
@@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
|
||||
package gplx.gfui.ipts; import gplx.*;
|
||||
import gplx.core.strings.*;
|
||||
public class IptBnd_ {
|
||||
public static void msg_(IptCfg cfg, IptBndsOwner box, String bndKey, GfoMsg m, IptArg... ipt) {bld_(cfg, box, (Gfo_invk)box, bndKey, m, ipt);}
|
||||
@@ -34,7 +34,7 @@ public class IptBnd_ {
|
||||
public static Object Srl(GfoMsg owner, IptBnd bnd) {GfoMsg_.srl_(owner, "bnd").Add("key", bnd.Key()).Add("ipt", AryXtoStr(bnd.Ipts())); return bnd;}
|
||||
static String AryXtoStr(List_adp ary) {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
for (int i = 0; i < ary.Count(); i++)
|
||||
for (int i = 0; i < ary.Len(); i++)
|
||||
sb.Add_spr_unless_first(((IptArg)ary.Get_at(i)).Key(), "|", i);
|
||||
return sb.To_str();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
|
||||
package gplx.gfui.ipts; import gplx.*;
|
||||
public interface IptCfg extends Gfo_invk {
|
||||
String CfgKey();
|
||||
Object NewByKey(Object o);
|
||||
@@ -24,7 +24,7 @@ public interface IptCfg extends Gfo_invk {
|
||||
class IptCfg_base implements IptCfg {
|
||||
public String CfgKey() {return cfgKey;} private String cfgKey;
|
||||
public IptCfgItm GetOrDefaultArgs(String bndKey, GfoMsg defaultMsg, IptArg[] defaultArgs) {
|
||||
IptCfgItm rv = (IptCfgItm)hash.Get_by(bndKey);
|
||||
IptCfgItm rv = (IptCfgItm)hash.GetByOrNull(bndKey);
|
||||
if (rv == null) { // no cfg
|
||||
rv = IptCfgItm.new_().Key_(bndKey).Ipt_(List_adp_.New_by_many((Object[])defaultArgs)).Msg_(defaultMsg);
|
||||
hash.Add(bndKey, rv);
|
||||
@@ -44,7 +44,7 @@ class IptCfg_base implements IptCfg {
|
||||
return rv;
|
||||
}
|
||||
boolean Dif(List_adp lhs, IptArg[] rhs) {
|
||||
if (lhs.Count() != rhs.length) return true;
|
||||
if (lhs.Len() != rhs.length) return true;
|
||||
for (int i = 0; i < rhs.length; i++) {
|
||||
IptArg lhsArg = (IptArg)lhs.Get_at(i);
|
||||
IptArg rhsArg = rhs[i];
|
||||
@@ -53,16 +53,16 @@ class IptCfg_base implements IptCfg {
|
||||
return false;
|
||||
}
|
||||
void Change(String bndKey, IptArg[] ary) {
|
||||
List_adp list = (List_adp)owners.Get_by(bndKey);
|
||||
List_adp list = (List_adp)owners.GetByOrNull(bndKey);
|
||||
if (list == null) return;
|
||||
for (int i = 0; i < list.Count(); i++) {
|
||||
for (int i = 0; i < list.Len(); i++) {
|
||||
IptBndsOwner owner = (IptBndsOwner)list.Get_at(i);
|
||||
owner.IptBnds().Change(bndKey, ary);
|
||||
}
|
||||
}
|
||||
public void Owners_del(String bndKey) {owners.Del(bndKey);}
|
||||
public void Owners_add(String bndKey, IptBndsOwner owner) {
|
||||
List_adp list = (List_adp)owners.Get_by(bndKey);
|
||||
List_adp list = (List_adp)owners.GetByOrNull(bndKey);
|
||||
if (list == null) {
|
||||
list = List_adp_.New();
|
||||
owners.Add(bndKey, list);
|
||||
|
||||
@@ -13,11 +13,11 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
|
||||
package gplx.gfui.ipts; import gplx.*;
|
||||
public class IptCfgRegy implements Gfo_invk {
|
||||
public void Clear() {hash.Clear();}
|
||||
public IptCfg GetOrNew(String k) {
|
||||
IptCfg rv = (IptCfg)hash.Get_by(k);
|
||||
IptCfg rv = (IptCfg)hash.GetByOrNull(k);
|
||||
if (rv == null) {
|
||||
rv = (IptCfg)IptCfg_base.HashProto.NewByKey(k);
|
||||
hash.Add(k, rv);
|
||||
|
||||
@@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
|
||||
package gplx.gfui.ipts; import gplx.*;
|
||||
class IptKeyStrMgr {
|
||||
public IptKey FetchByKeyPress(int charVal) {
|
||||
if (literals == null) Init();
|
||||
@@ -22,12 +22,12 @@ class IptKeyStrMgr {
|
||||
}
|
||||
public String To_str(IptKey key) {
|
||||
if (literals == null) Init();
|
||||
Object rv = literals.Get_by(key.Val());
|
||||
Object rv = literals.GetByOrNull(key.Val());
|
||||
return rv == null ? String_.Empty : (String)rv;
|
||||
}
|
||||
public void XtoIptKeyAry(List_adp list) {
|
||||
if (literals == null) Init();
|
||||
for (int i = 0; i < keys.Count(); i++)
|
||||
for (int i = 0; i < keys.Len(); i++)
|
||||
list.Add((IptKey)keys.Get_at(i));
|
||||
}
|
||||
void Init() {// default to US style keyboard
|
||||
|
||||
@@ -57,8 +57,8 @@ public class IptKey_ {
|
||||
list.Add(key);
|
||||
|
||||
// add keypad numbers
|
||||
list.Add_many(IptKey_.Numpad_0, IptKey_.Numpad_1, IptKey_.Numpad_2, IptKey_.Numpad_3, IptKey_.Numpad_4);
|
||||
list.Add_many(IptKey_.Numpad_5, IptKey_.Numpad_6, IptKey_.Numpad_7, IptKey_.Numpad_8, IptKey_.Numpad_9);
|
||||
list.AddMany(IptKey_.Numpad_0, IptKey_.Numpad_1, IptKey_.Numpad_2, IptKey_.Numpad_3, IptKey_.Numpad_4);
|
||||
list.AddMany(IptKey_.Numpad_5, IptKey_.Numpad_6, IptKey_.Numpad_7, IptKey_.Numpad_8, IptKey_.Numpad_9);
|
||||
|
||||
IptKeyStrMgr.Instance.XtoIptKeyAry(list);
|
||||
for (IptKey key : del)
|
||||
@@ -69,15 +69,15 @@ public class IptKey_ {
|
||||
List_adp list = List_adp_.New();
|
||||
|
||||
// add keypad numbers
|
||||
list.Add_many(IptKey_.Numpad_0, IptKey_.Numpad_1, IptKey_.Numpad_2, IptKey_.Numpad_3, IptKey_.Numpad_4);
|
||||
list.Add_many(IptKey_.Numpad_5, IptKey_.Numpad_6, IptKey_.Numpad_7, IptKey_.Numpad_8, IptKey_.Numpad_9);
|
||||
list.AddMany(IptKey_.Numpad_0, IptKey_.Numpad_1, IptKey_.Numpad_2, IptKey_.Numpad_3, IptKey_.Numpad_4);
|
||||
list.AddMany(IptKey_.Numpad_5, IptKey_.Numpad_6, IptKey_.Numpad_7, IptKey_.Numpad_8, IptKey_.Numpad_9);
|
||||
|
||||
for (IptKey key : add)
|
||||
list.Add(key);
|
||||
IptKeyStrMgr.Instance.XtoIptKeyAry(list);
|
||||
for (IptKey key : del)
|
||||
list.Del(key);
|
||||
return (IptKey[])list.To_ary(IptKey.class);
|
||||
return (IptKey[])list.ToAry(IptKey.class);
|
||||
}
|
||||
private static IptKey get_or_new_(int val) {
|
||||
IptKey rv = (IptKey)enm_mgr.Get(val);
|
||||
@@ -235,7 +235,7 @@ public class IptKey_ {
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
IptKey key = ary[i];
|
||||
hash.Add_if_dupe_use_nth(Int_obj_ref.New(key.Val()), key);
|
||||
hash.AddIfDupeUseNth(Int_obj_ref.New(key.Val()), key);
|
||||
}
|
||||
}
|
||||
public static String To_str(int orig_val) {
|
||||
@@ -251,7 +251,7 @@ public class IptKey_ {
|
||||
if (temp_val == 0) return rv;
|
||||
rv += "+";
|
||||
}
|
||||
IptKey key = (IptKey)IptKey_.Ui_str_hash().Get_by(Int_obj_ref.New(temp_val));
|
||||
IptKey key = (IptKey)IptKey_.Ui_str_hash().GetByOrNull(Int_obj_ref.New(temp_val));
|
||||
String key_str = key == null ? "key.#" + Int_.To_str(temp_val) : key.Key();
|
||||
// Tfds.Write(rv + key_str, orig_val, temp_val, mod_c, mod_a, mod_s);
|
||||
return rv + key_str;
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.kits.core; import gplx.*; import gplx.gfui.*; import gplx.gfui.kits.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.kits.core; import gplx.*;
|
||||
import gplx.core.brys.fmtrs.*;
|
||||
import gplx.gfui.imgs.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*; import gplx.gfui.controls.customs.*; import gplx.gfui.controls.windows.*;
|
||||
import gplx.gfui.imgs.*;
|
||||
import gplx.gfui.controls.standards.*;
|
||||
import gplx.gfui.kits.swts.*;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
@@ -23,38 +24,19 @@ import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.FileDialog;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
import org.eclipse.swt.browser.Browser;
|
||||
import org.eclipse.swt.dnd.Clipboard;
|
||||
import org.eclipse.swt.dnd.TextTransfer;
|
||||
import org.eclipse.swt.dnd.Transfer;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.FontData;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
|
||||
import gplx.core.threads.*;
|
||||
import gplx.gfui.controls.customs.GfuiStatusBox;
|
||||
import gplx.gfui.controls.customs.GfuiStatusBox_;
|
||||
import gplx.gfui.controls.elems.GfuiElem;
|
||||
import gplx.gfui.controls.gxws.GxwCore_base;
|
||||
import gplx.gfui.controls.gxws.GxwTextFld;
|
||||
import gplx.gfui.controls.standards.*;
|
||||
import gplx.gfui.controls.windows.GfoConsoleWin;
|
||||
import gplx.gfui.controls.windows.GfuiWin;
|
||||
import gplx.gfui.controls.windows.GfuiWin_;
|
||||
import gplx.gfui.draws.*;
|
||||
import gplx.gfui.imgs.*;
|
||||
public class Swt_kit implements Gfui_kit {
|
||||
private final Keyval_hash ctor_args = new Keyval_hash(); private final Keyval_hash ctor_args_null = new Keyval_hash();
|
||||
private final Hash_adp kit_args = Hash_adp_.New(); private Swt_msg_wkr_stop msg_wkr_stop;
|
||||
@@ -71,7 +53,7 @@ public class Swt_kit implements Gfui_kit {
|
||||
public void Kit_mode_(int v) {synchronized (thread_lock) {mode = v;}}
|
||||
public boolean Kit_mode__ready() {return Kit_mode() == Swt_kit_mode.Tid_ready;}
|
||||
public boolean Kit_mode__term() {return Kit_mode() == Swt_kit_mode.Tid_term;}
|
||||
public boolean Kit_sync_cmd_exists() {synchronized (thread_lock) {return sync_cmd_list.Count() != 0;}} private final List_adp sync_cmd_list = List_adp_.New();
|
||||
public boolean Kit_sync_cmd_exists() {synchronized (thread_lock) {return sync_cmd_list.Len() != 0;}} private final List_adp sync_cmd_list = List_adp_.New();
|
||||
public void Kit_sync_cmd_add(Swt_gui_cmd cmd) {synchronized (thread_lock) {sync_cmd_list.Add(cmd);}}
|
||||
public void Kit_sync_cmd_del(Swt_gui_cmd cmd) {synchronized (thread_lock) {sync_cmd_list.Del(cmd);}}
|
||||
public Gfo_invk_cmd Kit_term_cbk() {return term_cbk;} public void Kit_term_cbk_(Gfo_invk_cmd v) {this.term_cbk = v;} private Gfo_invk_cmd term_cbk = Gfo_invk_cmd.Noop;
|
||||
@@ -117,7 +99,7 @@ public class Swt_kit implements Gfui_kit {
|
||||
return;
|
||||
}
|
||||
// add kv to widget_cfg_hash; new controls will get properties from cfg_hash
|
||||
Keyval_hash widget_cfg_hash = (Keyval_hash)kit_args.Get_by(type);
|
||||
Keyval_hash widget_cfg_hash = (Keyval_hash)kit_args.GetByOrNull(type);
|
||||
if (widget_cfg_hash == null) {
|
||||
widget_cfg_hash = new Keyval_hash();
|
||||
kit_args.Add(type, widget_cfg_hash);
|
||||
@@ -169,7 +151,7 @@ public class Swt_kit implements Gfui_kit {
|
||||
public Gfui_html New_html(String key, GfuiElem owner, Keyval... args) {
|
||||
ctor_args.Clear();
|
||||
// check cfg for browser type
|
||||
Keyval_hash html_cfg_args = (Keyval_hash)kit_args.Get_by(Gfui_kit_.Cfg_HtmlBox);
|
||||
Keyval_hash html_cfg_args = (Keyval_hash)kit_args.GetByOrNull(Gfui_kit_.Cfg_HtmlBox);
|
||||
if (html_cfg_args != null) {
|
||||
Keyval browser_type = html_cfg_args.Get_kvp_or_null(Cfg_Html_BrowserType);
|
||||
if (browser_type != null) ctor_args.Add(browser_type);
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.layouts; import gplx.*; import gplx.gfui.*;
|
||||
import gplx.gfui.controls.elems.*;
|
||||
public class GftBand {
|
||||
@@ -42,22 +42,22 @@ public class GftBand {
|
||||
int x = 0;
|
||||
y = grid.Bands_dir().GetValByDir(y - h, y);
|
||||
int availX = owner.Gft_w();
|
||||
for (int i = 0; i < cells.Count(); i++) {
|
||||
for (int i = 0; i < cells.Len(); 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;
|
||||
if (i >= items.Len()) continue;
|
||||
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++) {
|
||||
for (int i = 0; i < items.Len(); i++) {
|
||||
GftItem item = (GftItem)items.Get_at(i);
|
||||
GftCell cell = i >= cells.Count() ? cell_dfl : (GftCell)cells.Get_at(i);
|
||||
GftCell cell = i >= cells.Len() ? 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);
|
||||
@@ -69,7 +69,7 @@ public class GftBand {
|
||||
GftBand rv = new 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++) {
|
||||
for (int i = 0; i < cells.Len(); i++) {
|
||||
GftCell cell = (GftCell)cells.Get_at(i);
|
||||
rv.cells.Add(cell.Clone());
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.layouts; import gplx.*; import gplx.gfui.*;
|
||||
import gplx.gfui.controls.elems.*;
|
||||
public class GftGrid {
|
||||
@@ -22,39 +22,39 @@ public class GftGrid {
|
||||
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++) {
|
||||
for (int i = 0; i < subLyts.Len(); 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++) {
|
||||
for (int i = 0; i < bands.Len(); i++) {
|
||||
GftBand band = (GftBand)bands.Get_at(i);
|
||||
if (String_.Eq(key, band.Key())) return band;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public GftGrid Bands_add(GftBand band) {
|
||||
bands.Add(band.Clone(this, bands.Count()));
|
||||
bands.Add(band.Clone(this, bands.Len()));
|
||||
return this;
|
||||
}
|
||||
public GftGrid Bands_add(int count, GftBand band) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
GftBand copy = band.Clone(this, bands.Count() + i);
|
||||
GftBand copy = band.Clone(this, bands.Len() + i);
|
||||
bands.Add(copy);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@gplx.Internal protected void Bands_delAt(int i) {bands.Del_at(i);}
|
||||
@gplx.Internal protected void Bands_delAt(int i) {bands.DelAt(i);}
|
||||
public boolean Bands_has(String key) {return Bands_indexOf(key) != List_adp_.Not_found;}
|
||||
public void Bands_del(String key) {
|
||||
int idx = Bands_indexOf(key);
|
||||
if (idx != List_adp_.Not_found) bands.Del_at(idx);
|
||||
if (idx != List_adp_.Not_found) bands.DelAt(idx);
|
||||
}
|
||||
int Bands_indexOf(String key) {
|
||||
int curIdx = List_adp_.Not_found;
|
||||
for (int i = 0; i < bands.Count(); i++) {
|
||||
for (int i = 0; i < bands.Len(); i++) {
|
||||
GftBand band = (GftBand)bands.Get_at(i);
|
||||
if (String_.Eq(key, band.Key())) {
|
||||
curIdx = i;
|
||||
@@ -78,7 +78,7 @@ public class GftGrid {
|
||||
}
|
||||
void ExecLyts(GftItem owner, GftItem[] ary) {
|
||||
int idx = 0;
|
||||
for (int i = 0; i < subLyts.Count(); i++) {
|
||||
for (int i = 0; i < subLyts.Len(); i++) {
|
||||
GftGrid subGrid = (GftGrid)subLyts.Get_at(i);
|
||||
GftItem[] subAry = new GftItem[subGrid.Bands_cellCount()];
|
||||
for (int j = 0; j < subAry.length; j++) {
|
||||
@@ -88,11 +88,11 @@ public class GftGrid {
|
||||
}
|
||||
}
|
||||
void ExecBands(GftItem owner, GftItem[] ary) {
|
||||
if (bands.Count() == 0) return;
|
||||
if (bands.Len() == 0) return;
|
||||
int availY = owner.Gft_h();
|
||||
GftBand band = null;
|
||||
int bgn = bandDir.GetValByDir(bands.Idx_last(), 0);
|
||||
int end = bandDir.GetValByDir(-1, bands.Count());
|
||||
int bgn = bandDir.GetValByDir(bands.IdxLast(), 0);
|
||||
int end = bandDir.GetValByDir(-1, bands.Len());
|
||||
for (int i = bgn; i != end; i += bandDir.Val()) {
|
||||
band = (GftBand)bands.Get_at(i);
|
||||
if (band.Len1().Key() == GftSizeCalc_abs.KEY) {
|
||||
@@ -106,11 +106,11 @@ public class GftGrid {
|
||||
int y = bandDir.GetValByDir(owner.Gft_h(), 0);
|
||||
for (int itmIdx = 0; itmIdx < ary.length; itmIdx++) {
|
||||
GftItem itm = ary[itmIdx];
|
||||
if (band.Items().Count() >= band.Cells().Count()) {
|
||||
if (band.Items().Len() >= band.Cells().Len()) {
|
||||
int h = band.Len1().Calc(this, band, owner, itm, availY);
|
||||
band.Calc(owner, y, h);
|
||||
y += h * bandDir.Val();
|
||||
if (bandIdx + 1 >= bands.Count()) throw Err_.new_wo_type("error retrieving band", "owner", owner.Key_of_GfuiElem(), "item", itm.Key_of_GfuiElem(), "bandIdx", bandIdx + 1, "count", bands.Count());
|
||||
if (bandIdx + 1 >= bands.Len()) throw Err_.new_wo_type("error retrieving band", "owner", owner.Key_of_GfuiElem(), "item", itm.Key_of_GfuiElem(), "bandIdx", bandIdx + 1, "count", bands.Len());
|
||||
band = (GftBand)bands.Get_at(++bandIdx);
|
||||
band.Items().Clear();
|
||||
}
|
||||
@@ -120,9 +120,9 @@ public class GftGrid {
|
||||
}
|
||||
int Bands_cellCount() {
|
||||
int rv = 0;
|
||||
for (int i = 0; i < bands.Count(); i++) {
|
||||
for (int i = 0; i < bands.Len(); i++) {
|
||||
GftBand band = (GftBand)bands.Get_at(i);
|
||||
rv += band.Cells().Count();
|
||||
rv += band.Cells().Len();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.layouts; import gplx.*; import gplx.gfui.*;
|
||||
class GftGrid_fx {
|
||||
public GftItem Owner() {return owner;} GftItem owner;
|
||||
@@ -49,7 +49,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.To_ary(GftItem.class);
|
||||
GftItem[] ary = (GftItem[])itms.ToAry(GftItem.class);
|
||||
grid.Exec(owner, ary);
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user