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-08-24 00:32:13 -04:00
parent df10db140c
commit ed911e3de5
220 changed files with 2618 additions and 1569 deletions

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
public class GfuiBorderEdge {
public int Val() {return val;} int val;
public boolean Has(GfuiBorderEdge comp) {return Enm_.HasInt(val, comp.val);}
public boolean Has(GfuiBorderEdge comp) {return Enm_.Has_int(val, comp.val);}
public GfuiBorderEdge Add(GfuiBorderEdge comp) {
return new GfuiBorderEdge(comp.val + val);
}

View File

@@ -32,7 +32,7 @@ public class IptEventType_ {
if (ary.length == 0) return IptEventType_.None;
int newVal = ary[0].Val();
for (int i = 1; i < ary.length; i++)
newVal = Enm_.FlipInt(true, newVal, ary[i].Val());
newVal = Enm_.Flip_int(true, newVal, ary[i].Val());
return getOrNew_(newVal);
}
static IptEventType getOrNew_(int v) {
@@ -46,7 +46,7 @@ public class IptEventType_ {
}
@gplx.Internal protected static boolean Has(IptEventType val, IptEventType find) {
if (find == IptEventType_.None && val != IptEventType_.None) return false; // check .None manually b/c 0 is identity when BitShifting
return Enm_.HasInt(val.Val(), find.Val());
return Enm_.Has_int(val.Val(), find.Val());
}
public static IptEventType default_(IptArg[] args) {
IptEventType rv = IptEventType_.None;

View File

@@ -23,7 +23,7 @@ public class IptKey implements IptArg {
public boolean Eq(IptArg comp) {return String_.Eq(key, comp.Key());}
public String XtoUiStr() {return IptKeyStrMgr._.To_str(this);}
public IptKey Add(IptKey comp) {return IptKey_.add_(this, comp);}
public boolean Mod_shift() {return Enm_.HasInt(val, IptKey_.Shift.Val());}
public boolean Mod_ctrl() {return Enm_.HasInt(val, IptKey_.Ctrl.Val());}
public boolean Mod_alt() {return Enm_.HasInt(val, IptKey_.Alt.Val());}
public boolean Mod_shift() {return Enm_.Has_int(val, IptKey_.Shift.Val());}
public boolean Mod_ctrl() {return Enm_.Has_int(val, IptKey_.Ctrl.Val());}
public boolean Mod_alt() {return Enm_.Has_int(val, IptKey_.Alt.Val());}
}

View File

@@ -28,7 +28,7 @@ public class IptKey_ {
if (ary.length == 0) return IptKey_.None;
int newVal = ary[0].Val();
for (int i = 1; i < ary.length; i++)
newVal = Enm_.FlipInt(true, newVal, ary[i].Val());
newVal = Enm_.Flip_int(true, newVal, ary[i].Val());
return get_or_new_(newVal);
}
public static IptKey api_(int val) {
@@ -138,9 +138,9 @@ public class IptKey_ {
}
public static String To_str(int val) {
String mod_str = "", rv = "";
boolean mod_c = Enm_.HasInt(val, IptKey_.Ctrl.Val()); if (mod_c) {mod_str += "c"; val = Enm_.FlipInt(Bool_.N, val, IptKey_.Ctrl.Val());}
boolean mod_a = Enm_.HasInt(val, IptKey_.Alt.Val()); if (mod_a) {mod_str += "a"; val = Enm_.FlipInt(Bool_.N, val, IptKey_.Alt.Val());}
boolean mod_s = Enm_.HasInt(val, IptKey_.Shift.Val()); if (mod_s) {mod_str += "s"; val = Enm_.FlipInt(Bool_.N, val, IptKey_.Shift.Val());}
boolean mod_c = Enm_.Has_int(val, IptKey_.Ctrl.Val()); if (mod_c) {mod_str += "c"; val = Enm_.Flip_int(Bool_.N, val, IptKey_.Ctrl.Val());}
boolean mod_a = Enm_.Has_int(val, IptKey_.Alt.Val()); if (mod_a) {mod_str += "a"; val = Enm_.Flip_int(Bool_.N, val, IptKey_.Alt.Val());}
boolean mod_s = Enm_.Has_int(val, IptKey_.Shift.Val()); if (mod_s) {mod_str += "s"; val = Enm_.Flip_int(Bool_.N, val, IptKey_.Shift.Val());}
if (String_.Len_gt_0(mod_str)) {
rv = "mod." + mod_str;
if (val == 0) return rv; // handle modifiers only, like "mod.cs"; else will be "mod.cs+key.#0"

View File

@@ -30,7 +30,7 @@ class GfuiWinKeyCmdMgr implements GfuiWinOpenAble, GfoInvkAble, GfoEvObj {
int keyVal = iptData.Key().Val();
GfuiElem sender = GfuiElem_.as_(iptData.Sender());
if (GfuiTextBox_.as_(sender) != null // is sender textBox?
&& !Enm_.HasInt(keyVal, IptKey_.Alt.Val()) // does key not have alt
&& !Enm_.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++) {

View File

@@ -108,12 +108,12 @@ class Swt_lnr_key implements KeyListener {
case 327680: val = IptKey_.Insert.Val(); break;
}
if (Has_ctrl(ev.stateMask)) val |= IptKey_.KeyCode_Ctrl;
if (Enm_.HasInt(ev.stateMask, IptKey_.KeyCode_Shift)) val |= IptKey_.KeyCode_Alt;
if (Enm_.HasInt(ev.stateMask, IptKey_.KeyCode_Ctrl)) val |= IptKey_.KeyCode_Shift;
if (Enm_.Has_int(ev.stateMask, IptKey_.KeyCode_Shift)) val |= IptKey_.KeyCode_Alt;
if (Enm_.Has_int(ev.stateMask, IptKey_.KeyCode_Ctrl)) val |= IptKey_.KeyCode_Shift;
// Tfds.Write(String_.Format("val={4} keyCode={0} stateMask={1} keyLocation={2} character={3}", ev.keyCode, ev.stateMask, ev.keyLocation, ev.character, val));
return IptEvtDataKey.int_(val);
}
public static boolean Has_ctrl(int val) {return Enm_.HasInt(val, IptKey_.KeyCode_Alt);} // NOTE:SWT's ctrl constant is different from SWING's
public static boolean Has_ctrl(int val) {return Enm_.Has_int(val, IptKey_.KeyCode_Alt);} // NOTE:SWT's ctrl constant is different from SWING's
}
class Swt_lnr_mouse implements MouseListener {
public Swt_lnr_mouse(GxwElem elem) {this.elem = elem;} GxwElem elem;

View File

@@ -85,9 +85,9 @@ class Swt_html implements Gxw_html, Swt_control, FocusListener {
Object arg = args[i];
if (i != 0) bfr.Add_byte(Byte_ascii.Comma);
boolean quote_val = true;
if ( ClassAdp_.Eq_typeSafe(arg, Bool_.Cls_ref_type)
|| ClassAdp_.Eq_typeSafe(arg, Int_.Cls_ref_type)
|| ClassAdp_.Eq_typeSafe(arg, Long_.Cls_ref_type)
if ( Type_adp_.Eq_typeSafe(arg, Bool_.Cls_ref_type)
|| Type_adp_.Eq_typeSafe(arg, Int_.Cls_ref_type)
|| Type_adp_.Eq_typeSafe(arg, Long_.Cls_ref_type)
) {
quote_val = false;
}