mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.9.4.1
This commit is contained in:
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class GfuiBorderEdge {
|
||||
public int Val() {return val;} int val;
|
||||
public boolean Has(GfuiBorderEdge comp) {return Enm_.Has_int(val, comp.val);}
|
||||
public boolean Has(GfuiBorderEdge comp) {return Bitmask_.Has_int(val, comp.val);}
|
||||
public GfuiBorderEdge Add(GfuiBorderEdge comp) {
|
||||
return new GfuiBorderEdge(comp.val + val);
|
||||
}
|
||||
|
||||
@@ -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_.Flip_int(true, newVal, ary[i].Val());
|
||||
newVal = Bitmask_.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_.Has_int(val.Val(), find.Val());
|
||||
return Bitmask_.Has_int(val.Val(), find.Val());
|
||||
}
|
||||
public static IptEventType default_(IptArg[] args) {
|
||||
IptEventType rv = IptEventType_.None;
|
||||
|
||||
@@ -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_.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());}
|
||||
public boolean Mod_shift() {return Bitmask_.Has_int(val, IptKey_.Shift.Val());}
|
||||
public boolean Mod_ctrl() {return Bitmask_.Has_int(val, IptKey_.Ctrl.Val());}
|
||||
public boolean Mod_alt() {return Bitmask_.Has_int(val, IptKey_.Alt.Val());}
|
||||
}
|
||||
|
||||
@@ -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_.Flip_int(true, newVal, ary[i].Val());
|
||||
newVal = Bitmask_.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_.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());}
|
||||
boolean mod_c = Bitmask_.Has_int(val, IptKey_.Ctrl.Val()); if (mod_c) {mod_str += "c"; val = Bitmask_.Flip_int(Bool_.N, val, IptKey_.Ctrl.Val());}
|
||||
boolean mod_a = Bitmask_.Has_int(val, IptKey_.Alt.Val()); if (mod_a) {mod_str += "a"; val = Bitmask_.Flip_int(Bool_.N, val, IptKey_.Alt.Val());}
|
||||
boolean mod_s = Bitmask_.Has_int(val, IptKey_.Shift.Val()); if (mod_s) {mod_str += "s"; val = Bitmask_.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"
|
||||
|
||||
@@ -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_.Has_int(keyVal, IptKey_.Alt.Val()) // does key not have alt
|
||||
&& !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++) {
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui;
|
||||
import gplx.Bitmask_;
|
||||
import gplx.Byte_ascii;
|
||||
import gplx.Enm_;
|
||||
import gplx.GfoEvMgr_;
|
||||
@@ -108,12 +109,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_.Has_int(ev.stateMask, IptKey_.KeyCode_Shift)) val |= IptKey_.KeyCode_Alt;
|
||||
if (Enm_.Has_int(ev.stateMask, IptKey_.KeyCode_Ctrl)) val |= IptKey_.KeyCode_Shift;
|
||||
if (Bitmask_.Has_int(ev.stateMask, IptKey_.KeyCode_Shift)) val |= IptKey_.KeyCode_Alt;
|
||||
if (Bitmask_.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_.Has_int(val, IptKey_.KeyCode_Alt);} // NOTE:SWT's ctrl constant is different from SWING's
|
||||
public static boolean Has_ctrl(int val) {return Bitmask_.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;
|
||||
|
||||
Reference in New Issue
Block a user