0.1.11
This commit is contained in:
+256
-38
@@ -165,6 +165,30 @@ component EqBtn inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
component MenuRow inherits Rectangle {
|
||||
callback clicked();
|
||||
in property <string> label;
|
||||
in property <bool> active;
|
||||
height: 36px;
|
||||
background: root.active ? #2f3a42 : (touch.has-hover ? #323232 : transparent);
|
||||
|
||||
Text {
|
||||
text: root.label;
|
||||
color: root.active ? #60cdff : #e0e0e0;
|
||||
font-size: 14px;
|
||||
font-weight: root.active ? 700 : 500;
|
||||
vertical-alignment: center;
|
||||
horizontal-alignment: left;
|
||||
x: 14px;
|
||||
width: parent.width - 28px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
touch := TouchArea {
|
||||
clicked => { root.clicked(); }
|
||||
}
|
||||
}
|
||||
|
||||
component ModeTab inherits Rectangle {
|
||||
callback clicked();
|
||||
in property <string> label;
|
||||
@@ -303,8 +327,10 @@ export component AppWindow inherits Window {
|
||||
min-height: 520px;
|
||||
background: #202020;
|
||||
|
||||
// 0 = standard, 1 = programmer, 2 = convert, 3 = crc
|
||||
// 0=standard 1=engineering 2=programmer 3=convert 4=crc
|
||||
in-out property <int> mode: 0;
|
||||
in-out property <bool> menu-open: false;
|
||||
in property <string> mode-title: "Standard";
|
||||
|
||||
in property <string> display-text: "0";
|
||||
in property <string> expression-text: "";
|
||||
@@ -312,6 +338,10 @@ export component AppWindow inherits Window {
|
||||
// 0 = classic standard, 1 = formula
|
||||
in property <int> std-panel: 0;
|
||||
|
||||
// Engineering
|
||||
in property <string> eng-angle-label: "DEG";
|
||||
in property <bool> eng-second: false;
|
||||
|
||||
in property <string> hex-text: "0";
|
||||
in property <string> dec-text: "0";
|
||||
in property <string> oct-text: "0";
|
||||
@@ -367,44 +397,130 @@ export component AppWindow inherits Window {
|
||||
root.key-pressed(id);
|
||||
}
|
||||
|
||||
property <bool> hex-digits: root.mode == 1 && root.active-base == 0;
|
||||
property <bool> allow-2: root.mode == 0 || root.active-base <= 2;
|
||||
property <bool> allow-8: root.mode == 0 || root.active-base <= 1;
|
||||
property <bool> allow-a: root.mode == 1 && root.active-base == 0;
|
||||
property <bool> hex-digits: root.mode == 2 && root.active-base == 0;
|
||||
property <bool> allow-2: root.mode == 0 || root.mode == 1 || root.active-base <= 2;
|
||||
property <bool> allow-8: root.mode == 0 || root.mode == 1 || root.active-base <= 1;
|
||||
property <bool> allow-a: root.mode == 2 && root.active-base == 0;
|
||||
|
||||
VerticalLayout {
|
||||
padding: 12px;
|
||||
spacing: 6px;
|
||||
|
||||
HorizontalLayout {
|
||||
spacing: 6px;
|
||||
height: 30px;
|
||||
ModeTab {
|
||||
label: "Standard";
|
||||
active: root.mode == 0;
|
||||
clicked => { root.press("mode:std"); }
|
||||
spacing: 10px;
|
||||
height: 34px;
|
||||
|
||||
Rectangle {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: 4px;
|
||||
background: menu-touch.has-hover || root.menu-open ? #3b3b3b : transparent;
|
||||
|
||||
// Drawn icon — Unicode ☰ is missing in many Windows fonts.
|
||||
VerticalLayout {
|
||||
padding-top: 9px;
|
||||
padding-bottom: 9px;
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
spacing: 4px;
|
||||
|
||||
Rectangle { height: 2px; background: #e8e8e8; border-radius: 1px; }
|
||||
Rectangle { height: 2px; background: #e8e8e8; border-radius: 1px; }
|
||||
Rectangle { height: 2px; background: #e8e8e8; border-radius: 1px; }
|
||||
}
|
||||
|
||||
menu-touch := TouchArea {
|
||||
clicked => {
|
||||
root.menu-open = !root.menu-open;
|
||||
if (root.menu-open) {
|
||||
mode-menu.show();
|
||||
} else {
|
||||
mode-menu.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mode-menu := PopupWindow {
|
||||
x: 0;
|
||||
y: 38px;
|
||||
width: 210px;
|
||||
height: 220px;
|
||||
close-on-click: true;
|
||||
|
||||
Rectangle {
|
||||
background: #2a2a2a;
|
||||
border-radius: 6px;
|
||||
border-width: 1px;
|
||||
border-color: #404040;
|
||||
|
||||
VerticalLayout {
|
||||
padding: 6px;
|
||||
spacing: 2px;
|
||||
|
||||
MenuRow {
|
||||
label: "Standard";
|
||||
active: root.mode == 0;
|
||||
clicked => {
|
||||
root.press("mode:std");
|
||||
root.menu-open = false;
|
||||
mode-menu.close();
|
||||
}
|
||||
}
|
||||
MenuRow {
|
||||
label: "Engineering";
|
||||
active: root.mode == 1;
|
||||
clicked => {
|
||||
root.press("mode:eng");
|
||||
root.menu-open = false;
|
||||
mode-menu.close();
|
||||
}
|
||||
}
|
||||
MenuRow {
|
||||
label: "Programmer";
|
||||
active: root.mode == 2;
|
||||
clicked => {
|
||||
root.press("mode:prog");
|
||||
root.menu-open = false;
|
||||
mode-menu.close();
|
||||
}
|
||||
}
|
||||
MenuRow {
|
||||
label: "Convert";
|
||||
active: root.mode == 3;
|
||||
clicked => {
|
||||
root.press("mode:conv");
|
||||
root.menu-open = false;
|
||||
mode-menu.close();
|
||||
}
|
||||
}
|
||||
MenuRow {
|
||||
label: "CRC";
|
||||
active: root.mode == 4;
|
||||
clicked => {
|
||||
root.press("mode:crc");
|
||||
root.menu-open = false;
|
||||
mode-menu.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ModeTab {
|
||||
label: "Programmer";
|
||||
active: root.mode == 1;
|
||||
clicked => { root.press("mode:prog"); }
|
||||
}
|
||||
ModeTab {
|
||||
label: "Convert";
|
||||
active: root.mode == 2;
|
||||
clicked => { root.press("mode:conv"); }
|
||||
}
|
||||
ModeTab {
|
||||
label: "CRC";
|
||||
active: root.mode == 3;
|
||||
clicked => { root.press("mode:crc"); }
|
||||
|
||||
Text {
|
||||
text: root.mode-title;
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
vertical-alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
}
|
||||
|
||||
if root.mode == 0 || root.mode == 1: HorizontalLayout {
|
||||
if root.mode == 0 || root.mode == 1 || root.mode == 2: HorizontalLayout {
|
||||
height: 18px;
|
||||
Text {
|
||||
text: root.has-memory && root.mode == 0 ? "M" : "";
|
||||
text: root.has-memory && (root.mode == 0 || root.mode == 1) ? "M" : "";
|
||||
color: #b4b4b4;
|
||||
font-size: 12px;
|
||||
horizontal-alignment: left;
|
||||
@@ -412,7 +528,7 @@ export component AppWindow inherits Window {
|
||||
width: 16px;
|
||||
}
|
||||
Text {
|
||||
text: root.mode == 1 ? root.word-size-label : "";
|
||||
text: root.mode == 2 ? root.word-size-label : "";
|
||||
color: #60cdff;
|
||||
font-size: 11px;
|
||||
vertical-alignment: center;
|
||||
@@ -426,18 +542,18 @@ export component AppWindow inherits Window {
|
||||
}
|
||||
}
|
||||
|
||||
if root.mode == 0 || root.mode == 1: Text {
|
||||
if root.mode == 0 || root.mode == 1 || root.mode == 2: Text {
|
||||
text: root.display-text;
|
||||
color: white;
|
||||
font-size: root.mode == 1 ? 28px : 34px;
|
||||
font-size: root.mode == 2 ? 28px : 34px;
|
||||
font-weight: 700;
|
||||
horizontal-alignment: right;
|
||||
vertical-alignment: center;
|
||||
height: root.mode == 1 ? 40px : 48px;
|
||||
height: root.mode == 2 ? 40px : 48px;
|
||||
overflow: elide;
|
||||
}
|
||||
|
||||
if root.mode == 3: VerticalLayout {
|
||||
if root.mode == 4: VerticalLayout {
|
||||
spacing: 10px;
|
||||
|
||||
Text {
|
||||
@@ -594,7 +710,7 @@ export component AppWindow inherits Window {
|
||||
}
|
||||
}
|
||||
|
||||
if root.mode == 2: VerticalLayout {
|
||||
if root.mode == 3: VerticalLayout {
|
||||
spacing: 8px;
|
||||
|
||||
HorizontalLayout {
|
||||
@@ -956,7 +1072,7 @@ export component AppWindow inherits Window {
|
||||
}
|
||||
}
|
||||
|
||||
if root.mode == 1: VerticalLayout {
|
||||
if root.mode == 2: VerticalLayout {
|
||||
spacing: 2px;
|
||||
BaseRow {
|
||||
label: "HEX";
|
||||
@@ -984,7 +1100,7 @@ export component AppWindow inherits Window {
|
||||
}
|
||||
}
|
||||
|
||||
if root.mode == 1 && root.show-bits: VerticalLayout {
|
||||
if root.mode == 2 && root.show-bits: VerticalLayout {
|
||||
spacing: 2px;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
@@ -1007,6 +1123,108 @@ export component AppWindow inherits Window {
|
||||
}
|
||||
}
|
||||
|
||||
if root.mode == 1: HorizontalLayout {
|
||||
spacing: 6px;
|
||||
height: 32px;
|
||||
FuncBtn {
|
||||
label: root.eng-angle-label;
|
||||
clicked => { root.press("eng:angle"); }
|
||||
}
|
||||
MemBtn { label: "MC"; clicked => { root.press("MC"); } }
|
||||
MemBtn { label: "MR"; clicked => { root.press("MR"); } }
|
||||
MemBtn { label: "M+"; clicked => { root.press("M+"); } }
|
||||
MemBtn { label: "M-"; clicked => { root.press("M-"); } }
|
||||
MemBtn { label: "MS"; clicked => { root.press("MS"); } }
|
||||
}
|
||||
|
||||
if root.mode == 1: GridLayout {
|
||||
spacing: 4px;
|
||||
Row {
|
||||
FuncBtn {
|
||||
min-h: 32px;
|
||||
label: root.eng-second ? "2nd●" : "2nd";
|
||||
clicked => { root.press("eng:2nd"); }
|
||||
}
|
||||
FuncBtn { min-h: 32px; label: "π"; clicked => { root.press("eng:pi"); } }
|
||||
FuncBtn { min-h: 32px; label: "e"; clicked => { root.press("eng:e"); } }
|
||||
FuncBtn { min-h: 32px; label: "C"; clicked => { root.press("C"); } }
|
||||
FuncBtn { min-h: 32px; label: "⌫"; clicked => { root.press("BS"); } }
|
||||
}
|
||||
Row {
|
||||
FuncBtn {
|
||||
min-h: 32px;
|
||||
label: root.eng-second ? "sin⁻¹" : "sin";
|
||||
clicked => { root.press(root.eng-second ? "eng:asin" : "eng:sin"); }
|
||||
}
|
||||
FuncBtn {
|
||||
min-h: 32px;
|
||||
label: root.eng-second ? "cos⁻¹" : "cos";
|
||||
clicked => { root.press(root.eng-second ? "eng:acos" : "eng:cos"); }
|
||||
}
|
||||
FuncBtn {
|
||||
min-h: 32px;
|
||||
label: root.eng-second ? "tan⁻¹" : "tan";
|
||||
clicked => { root.press(root.eng-second ? "eng:atan" : "eng:tan"); }
|
||||
}
|
||||
FuncBtn {
|
||||
min-h: 32px;
|
||||
label: root.eng-second ? "³√x" : "√x";
|
||||
clicked => { root.press(root.eng-second ? "eng:cbrt" : "eng:sqrt"); }
|
||||
}
|
||||
FuncBtn { min-h: 32px; label: "÷"; clicked => { root.press("/"); } }
|
||||
}
|
||||
Row {
|
||||
FuncBtn {
|
||||
min-h: 32px;
|
||||
label: root.eng-second ? "x³" : "x²";
|
||||
clicked => { root.press(root.eng-second ? "eng:cube" : "eng:sq"); }
|
||||
}
|
||||
FuncBtn { min-h: 32px; label: "1/x"; clicked => { root.press("eng:inv"); } }
|
||||
FuncBtn { min-h: 32px; label: "|x|"; clicked => { root.press("eng:abs"); } }
|
||||
FuncBtn { min-h: 32px; label: "n!"; clicked => { root.press("eng:fact"); } }
|
||||
FuncBtn { min-h: 32px; label: "×"; clicked => { root.press("*"); } }
|
||||
}
|
||||
Row {
|
||||
FuncBtn { min-h: 32px; label: "x^y"; clicked => { root.press("^"); } }
|
||||
FuncBtn { min-h: 32px; label: "("; clicked => { root.press("("); } }
|
||||
FuncBtn { min-h: 32px; label: ")"; clicked => { root.press(")"); } }
|
||||
FuncBtn { min-h: 32px; label: "CE"; clicked => { root.press("CE"); } }
|
||||
FuncBtn { min-h: 32px; label: "−"; clicked => { root.press("-"); } }
|
||||
}
|
||||
Row {
|
||||
FuncBtn {
|
||||
min-h: 32px;
|
||||
label: root.eng-second ? "eˣ" : "10ˣ";
|
||||
clicked => { root.press(root.eng-second ? "eng:exp" : "eng:tenpow"); }
|
||||
}
|
||||
DigitBtn { min-h: 32px; label: "7"; clicked => { root.press("7"); } }
|
||||
DigitBtn { min-h: 32px; label: "8"; clicked => { root.press("8"); } }
|
||||
DigitBtn { min-h: 32px; label: "9"; clicked => { root.press("9"); } }
|
||||
FuncBtn { min-h: 32px; label: "+"; clicked => { root.press("+"); } }
|
||||
}
|
||||
Row {
|
||||
FuncBtn { min-h: 32px; label: "log"; clicked => { root.press("eng:log"); } }
|
||||
DigitBtn { min-h: 32px; label: "4"; clicked => { root.press("4"); } }
|
||||
DigitBtn { min-h: 32px; label: "5"; clicked => { root.press("5"); } }
|
||||
DigitBtn { min-h: 32px; label: "6"; clicked => { root.press("6"); } }
|
||||
DigitBtn { min-h: 32px; label: "±"; clicked => { root.press("neg"); } }
|
||||
}
|
||||
Row {
|
||||
FuncBtn { min-h: 32px; label: "ln"; clicked => { root.press("eng:ln"); } }
|
||||
DigitBtn { min-h: 32px; label: "1"; clicked => { root.press("1"); } }
|
||||
DigitBtn { min-h: 32px; label: "2"; clicked => { root.press("2"); } }
|
||||
DigitBtn { min-h: 32px; label: "3"; clicked => { root.press("3"); } }
|
||||
EqBtn { min-h: 32px; clicked => { root.press("="); } }
|
||||
}
|
||||
Row {
|
||||
DigitBtn { min-h: 32px; label: "0"; clicked => { root.press("0"); } }
|
||||
DigitBtn { min-h: 32px; label: "."; clicked => { root.press("."); } }
|
||||
FuncBtn { min-h: 32px; label: "exp"; clicked => { root.press("eng:exp"); } }
|
||||
Rectangle { min-height: 32px; background: transparent; }
|
||||
Rectangle { min-height: 32px; background: transparent; }
|
||||
}
|
||||
}
|
||||
|
||||
if root.mode == 0: HorizontalLayout {
|
||||
spacing: 6px;
|
||||
height: 30px;
|
||||
@@ -1074,7 +1292,7 @@ export component AppWindow inherits Window {
|
||||
}
|
||||
}
|
||||
|
||||
if root.mode == 1: GridLayout {
|
||||
if root.mode == 2: GridLayout {
|
||||
spacing: 4px;
|
||||
Row {
|
||||
FuncBtn { min-h: 34px; label: root.word-size-label; clicked => { root.press("word"); } }
|
||||
@@ -1140,7 +1358,7 @@ export component AppWindow inherits Window {
|
||||
forward-focus: key-handler;
|
||||
key-handler := FocusScope {
|
||||
key-pressed(event) => {
|
||||
if (root.mode == 3) {
|
||||
if (root.mode == 4) {
|
||||
return reject;
|
||||
}
|
||||
if (event.text == Key.Return) {
|
||||
@@ -1152,7 +1370,7 @@ export component AppWindow inherits Window {
|
||||
return accept;
|
||||
}
|
||||
if (event.text == Key.Escape) {
|
||||
root.press(root.mode == 0 ? "C" : "clear");
|
||||
root.press(root.mode == 0 || root.mode == 1 ? "C" : "clear");
|
||||
return accept;
|
||||
}
|
||||
if (event.text == Key.Delete) {
|
||||
|
||||
Reference in New Issue
Block a user