abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/KeyboardData.java
diff options
context:
space:
mode:
authorJules Aguillon2022-10-24 00:27:49 +0200
committerJules Aguillon2022-10-24 00:27:49 +0200
commit2e598a4d476fde86484cb551c4be77dc5298e7b0 (patch)
tree4248338974ad49650abf63e6845779141f4ed79b /srcs/juloo.keyboard2/KeyboardData.java
parente01a2733b14e6c19cad3b5048a0b43f0563d7d51 (diff)
downloadunexpected-keyboard-2e598a4d476fde86484cb551c4be77dc5298e7b0.tar.gz
unexpected-keyboard-2e598a4d476fde86484cb551c4be77dc5298e7b0.zip
Draw letter indication on the pin layout
There is no way to type letters on the pin layout, the indication are decoration only. Use the E.161 standard.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyboardData.java')
-rw-r--r--srcs/juloo.keyboard2/KeyboardData.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java
index 0d0a85b..eaaf702 100644
--- a/srcs/juloo.keyboard2/KeyboardData.java
+++ b/srcs/juloo.keyboard2/KeyboardData.java
@@ -249,8 +249,9 @@ class KeyboardData
public final float shift;
/** Put keys 1 to 4 on the edges instead of the corners. */
public final boolean edgekeys;
+ public final String indication;
- protected Key(Corner k0, Corner k1, Corner k2, Corner k3, Corner k4, float w, float s, boolean e)
+ protected Key(Corner k0, Corner k1, Corner k2, Corner k3, Corner k4, float w, float s, boolean e, String i)
{
key0 = k0;
key1 = k1;
@@ -260,6 +261,7 @@ class KeyboardData
width = w;
shift = s;
edgekeys = e;
+ indication = i;
}
public static Key parse(XmlResourceParser parser) throws Exception
@@ -272,15 +274,17 @@ class KeyboardData
float width = parser.getAttributeFloatValue(null, "width", 1f);
float shift = parser.getAttributeFloatValue(null, "shift", 0.f);
boolean edgekeys = parser.getAttributeBooleanValue(null, "edgekeys", false);
+ String indication = parser.getAttributeValue(null, "indication");
while (parser.next() != XmlResourceParser.END_TAG)
continue ;
- return new Key(k0, k1, k2, k3, k4, width, shift, edgekeys);
+ return new Key(k0, k1, k2, k3, k4, width, shift, edgekeys, indication);
}
/** New key with the width multiplied by 's'. */
public Key scaleWidth(float s)
{
- return new Key(key0, key1, key2, key3, key4, width * s, shift, edgekeys);
+ return new Key(key0, key1, key2, key3, key4, width * s, shift, edgekeys,
+ indication);
}
public KeyValue getKeyValue(int i)
@@ -310,12 +314,12 @@ class KeyboardData
case 3: k3 = k; break;
case 4: k4 = k; break;
}
- return new Key(k0, k1, k2, k3, k4, width, shift, edgekeys);
+ return new Key(k0, k1, k2, k3, k4, width, shift, edgekeys, indication);
}
public Key withShift(float s)
{
- return new Key(key0, key1, key2, key3, key4, width, s, edgekeys);
+ return new Key(key0, key1, key2, key3, key4, width, s, edgekeys, indication);
}
/**
@@ -423,7 +427,8 @@ class KeyboardData
public Key apply(Key k)
{
return new Key(apply(k.key0), apply(k.key1), apply(k.key2),
- apply(k.key3), apply(k.key4), k.width, k.shift, k.edgekeys);
+ apply(k.key3), apply(k.key4), k.width, k.shift, k.edgekeys,
+ k.indication);
}
private Corner apply(Corner c)