Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
69ebe6bfb5
|
|||
|
63d14bd2d9
|
|||
|
377626013d
|
|||
|
bf5eefd190
|
|||
|
c941fd3a2a
|
|||
|
b71f0f5ba4
|
|||
|
b81a244bb9
|
|||
|
351379b5b3
|
|||
|
eba1406cbb
|
@@ -36,6 +36,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Set up Android SDK
|
- name: Set up Android SDK
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
|
with:
|
||||||
|
packages: ''
|
||||||
|
|
||||||
- name: Make scripts executable
|
- name: Make scripts executable
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Set up Android SDK
|
- name: Set up Android SDK
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
|
with:
|
||||||
|
packages: ''
|
||||||
|
|
||||||
- name: Make scripts executable
|
- name: Make scripts executable
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -10,3 +10,4 @@ captures/
|
|||||||
*.jar
|
*.jar
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
*.txt
|
*.txt
|
||||||
|
*.log*
|
||||||
|
|||||||
@@ -0,0 +1,146 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="124 738 320 320"
|
||||||
|
width="320"
|
||||||
|
height="320"
|
||||||
|
xml:space="preserve"
|
||||||
|
id="svg_a3270_icon"
|
||||||
|
version="1.1">
|
||||||
|
<metadata id="metadata8">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<!-- Pure black background (#000000) for classic 3270 CRT terminal look -->
|
||||||
|
<rect x="124" y="738" width="320" height="320" fill="#000000" />
|
||||||
|
<g transform="matrix(1.3333333,0,0,-1.3333333,0,1122.6667)" id="g10">
|
||||||
|
<g transform="scale(0.1)" id="g12">
|
||||||
|
<g id="g14">
|
||||||
|
<!-- Green Terminal Screen Frame -->
|
||||||
|
<path
|
||||||
|
id="path28"
|
||||||
|
style="fill:none;stroke:#00ff00;stroke-width:3.75079012;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="M 1177.27,2220.71 V 1142.45 H 3084.31 V 2220.71 H 1177.27" />
|
||||||
|
<!-- Blue Wave / Exponential Curve -->
|
||||||
|
<path
|
||||||
|
id="path30"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1172.41,1137.58 79.1,-1.22 -0.21,-0.38 c 1.08,0 2.18,0 3.27,0 762.95,0 1464.86,417.88 1829.53,1089.21" />
|
||||||
|
<!-- Red Circular Arc -->
|
||||||
|
<path
|
||||||
|
id="path32"
|
||||||
|
style="fill:none;stroke:#ff0000;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2593.86,1620.73 -1.22,-28 -0.08,-0.08 c 0.43,-250.15 202.81,-452.72 452.3,-452.72 0.14,0 0.28,0 0.42,0 l 43.9,2.52" />
|
||||||
|
<!-- Yellow Smiley Head -->
|
||||||
|
<path
|
||||||
|
id="path34"
|
||||||
|
style="fill:none;stroke:#ffff00;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2976,1363.94 v 0.08 c 44.73,34.29 71.21,87.25 71.8,143.61 l 0.01,-0.15 c -0.06,97.48 -79.11,176.47 -176.59,176.47 -0.36,0 -0.73,0 -1.09,0 l -0.07,0.03 c -0.25,0 -0.51,0 -0.75,0 -37.38,0 -73.79,-11.94 -103.92,-34.08 l 0.02,-0.03 c -44.38,-34.04 -70.82,-86.47 -71.8,-142.39 l 0.06,0.04 c 0.54,-97.43 79.04,-176.47 176.46,-177.69 l 0.08,0.02 c 0.64,-0.01 1.29,-0.01 1.92,-0.01 37.4,0 73.82,11.94 103.96,34.08" />
|
||||||
|
<!-- 'l' -->
|
||||||
|
<path
|
||||||
|
id="path36"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1502.21,1785.02 h 23.13 v 32.86 h -23.13 l -4.87,8.52 v 154.56 h -18.25 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52" />
|
||||||
|
<path
|
||||||
|
id="path38"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1502.21,1785.02 h 23.13 v 32.86 h -23.13 l -4.87,8.52 v 154.56 h -18.25 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52" />
|
||||||
|
<!-- 'i' -->
|
||||||
|
<path
|
||||||
|
id="path40"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1566.71,1785.02 h 13.39 v 32.86 h -13.39 l -4.86,8.52 v 105.88 h -18.26 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52 m -4.86,163.08 v 32.86 h -18.26 v -32.86 h 18.26" />
|
||||||
|
<path
|
||||||
|
id="path42"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1566.71,1785.02 h 13.39 v 32.86 h -13.39 l -4.86,8.52 v 105.88 h -18.26 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52 m -4.86,163.08 v 32.86 h -18.26 v -32.86 h 18.26" />
|
||||||
|
<!-- 'b' -->
|
||||||
|
<path
|
||||||
|
id="path44"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1598.36,1785.02 v 195.94 h 18.25 v -48.68 h 41.38 l 13.39,-8.52 4.87,-8.52 4.86,-24.34 v -64.5 l -4.86,-25.56 -4.87,-7.3 -13.39,-8.52 h -59.63 m 18.25,32.86 h 41.38 l 4.87,8.52 v 64.5 l -4.87,8.52 h -41.38 v -81.54" />
|
||||||
|
<path
|
||||||
|
id="path46"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1598.36,1785.02 v 195.94 h 18.25 v -48.68 h 41.38 l 13.39,-8.52 4.87,-8.52 4.86,-24.34 v -64.5 l -4.86,-25.56 -4.87,-7.3 -13.39,-8.52 h -59.63 m 18.25,32.86 h 41.38 l 4.87,8.52 v 64.5 l -4.87,8.52 h -41.38 v -81.54" />
|
||||||
|
<!-- '3' -->
|
||||||
|
<path
|
||||||
|
id="path48"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1722.49,1817.88 h -23.12 v -32.86 h 69.36 l 13.4,8.52 4.86,7.3 3.65,25.56 v 40.16 l -8.51,15.82 8.51,17.04 v 40.16 l -3.65,24.34 -4.86,8.52 -13.4,8.52 h -69.36 v -32.86 h 69.36 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24 v -32.86 h 46.24 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24" />
|
||||||
|
<path
|
||||||
|
id="path50"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1722.49,1817.88 h -23.12 v -32.86 h 69.36 l 13.4,8.52 4.86,7.3 3.65,25.56 v 40.16 l -8.51,15.82 8.51,17.04 v 40.16 l -3.65,24.34 -4.86,8.52 -13.4,8.52 h -69.36 v -32.86 h 69.36 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24 v -32.86 h 46.24 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24" />
|
||||||
|
<!-- '2' -->
|
||||||
|
<path
|
||||||
|
id="path52"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1808.9,1785.02 h 92.49 v 32.86 h -73.02 v 32.86 l 3.65,7.3 h 46.25 l 13.38,8.52 4.87,8.52 4.87,24.34 v 40.16 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -46.25 l -13.39,-8.52 -4.86,-8.52 -4.87,-24.34 v -24.34 h 19.47 v 24.34 l 3.65,8.52 h 46.25 l 4.86,-8.52 v -40.16 l -4.86,-8.52 h -46.25 l -13.39,-8.52 -4.86,-7.3 -4.87,-24.34 v -65.72" />
|
||||||
|
<path
|
||||||
|
id="path54"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1808.9,1785.02 h 92.49 v 32.86 h -73.02 v 32.86 l 3.65,7.3 h 46.25 l 13.38,8.52 4.87,8.52 4.87,24.34 v 40.16 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -46.25 l -13.39,-8.52 -4.86,-8.52 -4.87,-24.34 v -24.34 h 19.47 v 24.34 l 3.65,8.52 h 46.25 l 4.86,-8.52 v -40.16 l -4.86,-8.52 h -46.25 l -13.39,-8.52 -4.86,-7.3 -4.87,-24.34 v -65.72" />
|
||||||
|
<!-- '7' -->
|
||||||
|
<path
|
||||||
|
id="path56"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1919.64,1980.96 h 91.28 v -65.72 l -49.9,-130.22 h -23.12 l 54.76,138.74 v 24.34 h -73.02 v 32.86" />
|
||||||
|
<path
|
||||||
|
id="path58"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1919.64,1980.96 h 91.28 v -65.72 l -49.9,-130.22 h -23.12 l 54.76,138.74 v 24.34 h -73.02 v 32.86" />
|
||||||
|
<!-- '0' -->
|
||||||
|
<path
|
||||||
|
id="path60"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 2047.43,1972.44 -4.87,-8.52 -3.65,-24.34 V 1826.4 l 3.65,-25.56 4.87,-7.3 14.61,-8.52 h 31.64 l 13.38,8.52 4.87,7.3 4.87,25.56 v 113.18 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -31.64 l -14.61,-8.52 m 14.61,-24.34 h 31.64 l 4.86,-8.52 V 1826.4 l -4.86,-8.52 h -31.64 l -4.88,8.52 v 113.18 l 4.88,8.52" />
|
||||||
|
<path
|
||||||
|
id="path62"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2047.43,1972.44 -4.87,-8.52 -3.65,-24.34 V 1826.4 l 3.65,-25.56 4.87,-7.3 14.61,-8.52 h 31.64 l 13.38,8.52 4.87,7.3 4.87,25.56 v 113.18 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -31.64 l -14.61,-8.52 m 14.61,-24.34 h 31.64 l 4.86,-8.52 V 1826.4 l -4.86,-8.52 h -31.64 l -4.88,8.52 v 113.18 l 4.88,8.52" />
|
||||||
|
<!-- 'j' -->
|
||||||
|
<path
|
||||||
|
id="path64"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 2176.43,1948.1 v 32.86 h -18.25 v -32.86 h 18.25 m 0,-15.82 V 1769.2 l -4.87,-25.56 -4.86,-7.3 -13.39,-8.52 h -18.26 v 32.86 h 18.26 l 4.87,8.52 v 163.08 h 18.25" />
|
||||||
|
<path
|
||||||
|
id="path66"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2176.43,1948.1 v 32.86 h -18.25 v -32.86 h 18.25 m 0,-15.82 V 1769.2 l -4.87,-25.56 -4.86,-7.3 -13.39,-8.52 h -18.26 v 32.86 h 18.26 l 4.87,8.52 v 163.08 h 18.25" />
|
||||||
|
<!-- Smile -->
|
||||||
|
<path
|
||||||
|
id="path68"
|
||||||
|
style="fill:none;stroke:#ffff00;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2778.85,1478.34 0.04,-0.02 c 21.03,-31.91 56.69,-51.12 94.91,-51.12 0.41,0 0.83,0 1.24,0.01 l -0.02,0.07 c 43.88,0.19 84.11,24.51 104.66,63.28" />
|
||||||
|
<!-- Left Eye (cyan) -->
|
||||||
|
<path
|
||||||
|
id="path70"
|
||||||
|
style="fill:none;stroke:#00ffff;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2820.22,1595.17 0.01,0.01 c -14.62,-1.91 -25.56,-14.37 -25.56,-29.11 0,-0.03 0,-0.07 0,-0.1 l -0.02,-0.01 c 0,-0.03 0,-0.07 0,-0.1 0,-16.09 13.04,-29.14 29.13,-29.14 0.43,0 0.87,0.01 1.29,0.03 h 3.67 0.01 c 14.61,1.91 25.55,14.37 25.55,29.11 0,0.03 0,0.07 0,0.1 l 0.02,0.01 c 0,0.04 0,0.08 0,0.12 0,16.07 -13.03,29.09 -29.09,29.09 -0.03,0 -0.08,0 -0.12,0 l -4.89,-0.01" />
|
||||||
|
<!-- Right Eye (cyan) -->
|
||||||
|
<path
|
||||||
|
id="path72"
|
||||||
|
style="fill:none;stroke:#00ffff;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2921.23,1569.61 v -3.65 l -0.01,-0.01 c 0,-0.27 -0.01,-0.54 -0.01,-0.81 0,-18.22 14.66,-33.05 32.87,-33.26 l 0.03,0.01 c 0.28,0 0.57,-0.01 0.84,-0.01 17.29,0 31.72,13.22 33.24,30.44 l -0.02,3.64 0.02,0.02 c 0,0.27 0.01,0.54 0.01,0.81 0,18.37 -14.9,33.28 -33.28,33.28 -0.26,0 -0.54,-0.01 -0.81,-0.02 l -0.02,-0.03 c -17.14,-0.18 -31.36,-13.34 -32.86,-30.42" />
|
||||||
|
<!-- Nose -->
|
||||||
|
<path
|
||||||
|
id="path74"
|
||||||
|
style="fill:none;stroke:#ffff00;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2892.03,1528.23 -29.21,-20.68" />
|
||||||
|
<path
|
||||||
|
id="path76"
|
||||||
|
style="fill:none;stroke:#ffff00;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2862.82,1507.55 h 32.86" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,146 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="144 814 280 169"
|
||||||
|
width="280"
|
||||||
|
height="169"
|
||||||
|
xml:space="preserve"
|
||||||
|
id="svg_lib3270j_cropped"
|
||||||
|
version="1.1">
|
||||||
|
<metadata id="metadata8">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<!-- Pure black background (#000000) for classic 3270 CRT terminal look -->
|
||||||
|
<rect x="144" y="814" width="280" height="169" fill="#000000" />
|
||||||
|
<g transform="matrix(1.3333333,0,0,-1.3333333,0,1122.6667)" id="g10">
|
||||||
|
<g transform="scale(0.1)" id="g12">
|
||||||
|
<g id="g14">
|
||||||
|
<!-- Green Terminal Screen Frame -->
|
||||||
|
<path
|
||||||
|
id="path28"
|
||||||
|
style="fill:none;stroke:#00ff00;stroke-width:3.75079012;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="M 1177.27,2220.71 V 1142.45 H 3084.31 V 2220.71 H 1177.27" />
|
||||||
|
<!-- Blue Wave / Exponential Curve -->
|
||||||
|
<path
|
||||||
|
id="path30"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1172.41,1137.58 79.1,-1.22 -0.21,-0.38 c 1.08,0 2.18,0 3.27,0 762.95,0 1464.86,417.88 1829.53,1089.21" />
|
||||||
|
<!-- Red Circular Arc -->
|
||||||
|
<path
|
||||||
|
id="path32"
|
||||||
|
style="fill:none;stroke:#ff0000;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2593.86,1620.73 -1.22,-28 -0.08,-0.08 c 0.43,-250.15 202.81,-452.72 452.3,-452.72 0.14,0 0.28,0 0.42,0 l 43.9,2.52" />
|
||||||
|
<!-- Yellow Smiley Head -->
|
||||||
|
<path
|
||||||
|
id="path34"
|
||||||
|
style="fill:none;stroke:#ffff00;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2976,1363.94 v 0.08 c 44.73,34.29 71.21,87.25 71.8,143.61 l 0.01,-0.15 c -0.06,97.48 -79.11,176.47 -176.59,176.47 -0.36,0 -0.73,0 -1.09,0 l -0.07,0.03 c -0.25,0 -0.51,0 -0.75,0 -37.38,0 -73.79,-11.94 -103.92,-34.08 l 0.02,-0.03 c -44.38,-34.04 -70.82,-86.47 -71.8,-142.39 l 0.06,0.04 c 0.54,-97.43 79.04,-176.47 176.46,-177.69 l 0.08,0.02 c 0.64,-0.01 1.29,-0.01 1.92,-0.01 37.4,0 73.82,11.94 103.96,34.08" />
|
||||||
|
<!-- 'l' -->
|
||||||
|
<path
|
||||||
|
id="path36"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1502.21,1785.02 h 23.13 v 32.86 h -23.13 l -4.87,8.52 v 154.56 h -18.25 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52" />
|
||||||
|
<path
|
||||||
|
id="path38"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1502.21,1785.02 h 23.13 v 32.86 h -23.13 l -4.87,8.52 v 154.56 h -18.25 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52" />
|
||||||
|
<!-- 'i' -->
|
||||||
|
<path
|
||||||
|
id="path40"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1566.71,1785.02 h 13.39 v 32.86 h -13.39 l -4.86,8.52 v 105.88 h -18.26 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52 m -4.86,163.08 v 32.86 h -18.26 v -32.86 h 18.26" />
|
||||||
|
<path
|
||||||
|
id="path42"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1566.71,1785.02 h 13.39 v 32.86 h -13.39 l -4.86,8.52 v 105.88 h -18.26 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52 m -4.86,163.08 v 32.86 h -18.26 v -32.86 h 18.26" />
|
||||||
|
<!-- 'b' -->
|
||||||
|
<path
|
||||||
|
id="path44"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1598.36,1785.02 v 195.94 h 18.25 v -48.68 h 41.38 l 13.39,-8.52 4.87,-8.52 4.86,-24.34 v -64.5 l -4.86,-25.56 -4.87,-7.3 -13.39,-8.52 h -59.63 m 18.25,32.86 h 41.38 l 4.87,8.52 v 64.5 l -4.87,8.52 h -41.38 v -81.54" />
|
||||||
|
<path
|
||||||
|
id="path46"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1598.36,1785.02 v 195.94 h 18.25 v -48.68 h 41.38 l 13.39,-8.52 4.87,-8.52 4.86,-24.34 v -64.5 l -4.86,-25.56 -4.87,-7.3 -13.39,-8.52 h -59.63 m 18.25,32.86 h 41.38 l 4.87,8.52 v 64.5 l -4.87,8.52 h -41.38 v -81.54" />
|
||||||
|
<!-- '3' -->
|
||||||
|
<path
|
||||||
|
id="path48"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1722.49,1817.88 h -23.12 v -32.86 h 69.36 l 13.4,8.52 4.86,7.3 3.65,25.56 v 40.16 l -8.51,15.82 8.51,17.04 v 40.16 l -3.65,24.34 -4.86,8.52 -13.4,8.52 h -69.36 v -32.86 h 69.36 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24 v -32.86 h 46.24 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24" />
|
||||||
|
<path
|
||||||
|
id="path50"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1722.49,1817.88 h -23.12 v -32.86 h 69.36 l 13.4,8.52 4.86,7.3 3.65,25.56 v 40.16 l -8.51,15.82 8.51,17.04 v 40.16 l -3.65,24.34 -4.86,8.52 -13.4,8.52 h -69.36 v -32.86 h 69.36 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24 v -32.86 h 46.24 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24" />
|
||||||
|
<!-- '2' -->
|
||||||
|
<path
|
||||||
|
id="path52"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1808.9,1785.02 h 92.49 v 32.86 h -73.02 v 32.86 l 3.65,7.3 h 46.25 l 13.38,8.52 4.87,8.52 4.87,24.34 v 40.16 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -46.25 l -13.39,-8.52 -4.86,-8.52 -4.87,-24.34 v -24.34 h 19.47 v 24.34 l 3.65,8.52 h 46.25 l 4.86,-8.52 v -40.16 l -4.86,-8.52 h -46.25 l -13.39,-8.52 -4.86,-7.3 -4.87,-24.34 v -65.72" />
|
||||||
|
<path
|
||||||
|
id="path54"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1808.9,1785.02 h 92.49 v 32.86 h -73.02 v 32.86 l 3.65,7.3 h 46.25 l 13.38,8.52 4.87,8.52 4.87,24.34 v 40.16 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -46.25 l -13.39,-8.52 -4.86,-8.52 -4.87,-24.34 v -24.34 h 19.47 v 24.34 l 3.65,8.52 h 46.25 l 4.86,-8.52 v -40.16 l -4.86,-8.52 h -46.25 l -13.39,-8.52 -4.86,-7.3 -4.87,-24.34 v -65.72" />
|
||||||
|
<!-- '7' -->
|
||||||
|
<path
|
||||||
|
id="path56"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1919.64,1980.96 h 91.28 v -65.72 l -49.9,-130.22 h -23.12 l 54.76,138.74 v 24.34 h -73.02 v 32.86" />
|
||||||
|
<path
|
||||||
|
id="path58"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1919.64,1980.96 h 91.28 v -65.72 l -49.9,-130.22 h -23.12 l 54.76,138.74 v 24.34 h -73.02 v 32.86" />
|
||||||
|
<!-- '0' -->
|
||||||
|
<path
|
||||||
|
id="path60"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 2047.43,1972.44 -4.87,-8.52 -3.65,-24.34 V 1826.4 l 3.65,-25.56 4.87,-7.3 14.61,-8.52 h 31.64 l 13.38,8.52 4.87,7.3 4.87,25.56 v 113.18 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -31.64 l -14.61,-8.52 m 14.61,-24.34 h 31.64 l 4.86,-8.52 V 1826.4 l -4.86,-8.52 h -31.64 l -4.88,8.52 v 113.18 l 4.88,8.52" />
|
||||||
|
<path
|
||||||
|
id="path62"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2047.43,1972.44 -4.87,-8.52 -3.65,-24.34 V 1826.4 l 3.65,-25.56 4.87,-7.3 14.61,-8.52 h 31.64 l 13.38,8.52 4.87,7.3 4.87,25.56 v 113.18 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -31.64 l -14.61,-8.52 m 14.61,-24.34 h 31.64 l 4.86,-8.52 V 1826.4 l -4.86,-8.52 h -31.64 l -4.88,8.52 v 113.18 l 4.88,8.52" />
|
||||||
|
<!-- 'j' -->
|
||||||
|
<path
|
||||||
|
id="path64"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 2176.43,1948.1 v 32.86 h -18.25 v -32.86 h 18.25 m 0,-15.82 V 1769.2 l -4.87,-25.56 -4.86,-7.3 -13.39,-8.52 h -18.26 v 32.86 h 18.26 l 4.87,8.52 v 163.08 h 18.25" />
|
||||||
|
<path
|
||||||
|
id="path66"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2176.43,1948.1 v 32.86 h -18.25 v -32.86 h 18.25 m 0,-15.82 V 1769.2 l -4.87,-25.56 -4.86,-7.3 -13.39,-8.52 h -18.26 v 32.86 h 18.26 l 4.87,8.52 v 163.08 h 18.25" />
|
||||||
|
<!-- Smile -->
|
||||||
|
<path
|
||||||
|
id="path68"
|
||||||
|
style="fill:none;stroke:#ffff00;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2778.85,1478.34 0.04,-0.02 c 21.03,-31.91 56.69,-51.12 94.91,-51.12 0.41,0 0.83,0 1.24,0.01 l -0.02,0.07 c 43.88,0.19 84.11,24.51 104.66,63.28" />
|
||||||
|
<!-- Left Eye (cyan) -->
|
||||||
|
<path
|
||||||
|
id="path70"
|
||||||
|
style="fill:none;stroke:#00ffff;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2820.22,1595.17 0.01,0.01 c -14.62,-1.91 -25.56,-14.37 -25.56,-29.11 0,-0.03 0,-0.07 0,-0.1 l -0.02,-0.01 c 0,-0.03 0,-0.07 0,-0.1 0,-16.09 13.04,-29.14 29.13,-29.14 0.43,0 0.87,0.01 1.29,0.03 h 3.67 0.01 c 14.61,1.91 25.55,14.37 25.55,29.11 0,0.03 0,0.07 0,0.1 l 0.02,0.01 c 0,0.04 0,0.08 0,0.12 0,16.07 -13.03,29.09 -29.09,29.09 -0.03,0 -0.08,0 -0.12,0 l -4.89,-0.01" />
|
||||||
|
<!-- Right Eye (cyan) -->
|
||||||
|
<path
|
||||||
|
id="path72"
|
||||||
|
style="fill:none;stroke:#00ffff;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2921.23,1569.61 v -3.65 l -0.01,-0.01 c 0,-0.27 -0.01,-0.54 -0.01,-0.81 0,-18.22 14.66,-33.05 32.87,-33.26 l 0.03,0.01 c 0.28,0 0.57,-0.01 0.84,-0.01 17.29,0 31.72,13.22 33.24,30.44 l -0.02,3.64 0.02,0.02 c 0,0.27 0.01,0.54 0.01,0.81 0,18.37 -14.9,33.28 -33.28,33.28 -0.26,0 -0.54,-0.01 -0.81,-0.02 l -0.02,-0.03 c -17.14,-0.18 -31.36,-13.34 -32.86,-30.42" />
|
||||||
|
<!-- Nose -->
|
||||||
|
<path
|
||||||
|
id="path74"
|
||||||
|
style="fill:none;stroke:#ffff00;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2892.03,1528.23 -29.21,-20.68" />
|
||||||
|
<path
|
||||||
|
id="path76"
|
||||||
|
style="fill:none;stroke:#ffff00;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2862.82,1507.55 h 32.86" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 11 KiB |
+2
-2
@@ -11,8 +11,8 @@ android {
|
|||||||
applicationId "haus.nightmare.a3270"
|
applicationId "haus.nightmare.a3270"
|
||||||
minSdk 24
|
minSdk 24
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode 6
|
versionCode 7
|
||||||
versionName "1.0.1"
|
versionName "1.2.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -45,14 +45,19 @@ if [ ! -d "$J3270_PATH/lib3270j" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Building debug APK..."
|
if [ $# -gt 0 ]; then
|
||||||
./gradlew assembleDebug --no-daemon
|
echo "Running: ./gradlew $@"
|
||||||
|
./gradlew "$@"
|
||||||
|
else
|
||||||
|
echo "Building debug APK..."
|
||||||
|
./gradlew assembleDebug --no-daemon
|
||||||
|
|
||||||
APK_PATH="$SCRIPT_DIR/build/outputs/apk/debug/a3270-debug.apk"
|
APK_PATH="$SCRIPT_DIR/build/outputs/apk/debug/a3270-debug.apk"
|
||||||
if [ -f "$APK_PATH" ]; then
|
if [ -f "$APK_PATH" ]; then
|
||||||
echo "=== Build Complete ==="
|
echo "=== Build Complete ==="
|
||||||
echo "APK created at: $APK_PATH"
|
echo "APK created at: $APK_PATH"
|
||||||
ls -lh "$APK_PATH"
|
ls -lh "$APK_PATH"
|
||||||
else
|
else
|
||||||
echo "Build completed, but APK not found at $APK_PATH"
|
echo "Build completed, but APK not found at $APK_PATH"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -115,6 +115,26 @@ esac
|
|||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Prefer compatible JDK (JDK 17 or 21) if active Java is incompatible (Java 22+)
|
||||||
|
if [ -d "/Users/rudi/.sdkman/candidates/java/21.0.6-sem" ]; then
|
||||||
|
export JAVA_HOME="/Users/rudi/.sdkman/candidates/java/21.0.6-sem"
|
||||||
|
elif [ -d "$HOME/.sdkman/candidates/java/21.0.2-open" ]; then
|
||||||
|
CURRENT_JAVA_CMD="${JAVA_HOME:+$JAVA_HOME/bin/java}"
|
||||||
|
CURRENT_JAVA_CMD="${CURRENT_JAVA_CMD:-java}"
|
||||||
|
CURRENT_VER=$("$CURRENT_JAVA_CMD" -version 2>&1 | awk -F '"' '/version/ {print $2}' | cut -d'.' -f1)
|
||||||
|
if [ -z "$JAVA_HOME" ] || [ "$CURRENT_VER" -gt 21 ] 2>/dev/null; then
|
||||||
|
export JAVA_HOME="$HOME/.sdkman/candidates/java/21.0.2-open"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$ANDROID_HOME" ]; then
|
||||||
|
if [ -d "$HOME/Library/Android/sdk" ]; then
|
||||||
|
export ANDROID_HOME="$HOME/Library/Android/sdk"
|
||||||
|
elif [ -d "$HOME/Android/Sdk" ]; then
|
||||||
|
export ANDROID_HOME="$HOME/Android/Sdk"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:versionCode="7"
|
||||||
|
android:versionName="1.2.2">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
@@ -9,6 +11,8 @@
|
|||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:label="a3270"
|
android:label="a3270"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||||
|
|||||||
@@ -0,0 +1,146 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="124 738 320 320"
|
||||||
|
width="320"
|
||||||
|
height="320"
|
||||||
|
xml:space="preserve"
|
||||||
|
id="svg_a3270_icon"
|
||||||
|
version="1.1">
|
||||||
|
<metadata id="metadata8">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<!-- Pure black background (#000000) for classic 3270 CRT terminal look -->
|
||||||
|
<rect x="124" y="738" width="320" height="320" fill="#000000" />
|
||||||
|
<g transform="matrix(1.3333333,0,0,-1.3333333,0,1122.6667)" id="g10">
|
||||||
|
<g transform="scale(0.1)" id="g12">
|
||||||
|
<g id="g14">
|
||||||
|
<!-- Green Terminal Screen Frame -->
|
||||||
|
<path
|
||||||
|
id="path28"
|
||||||
|
style="fill:none;stroke:#00ff00;stroke-width:3.75079012;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="M 1177.27,2220.71 V 1142.45 H 3084.31 V 2220.71 H 1177.27" />
|
||||||
|
<!-- Blue Wave / Exponential Curve -->
|
||||||
|
<path
|
||||||
|
id="path30"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1172.41,1137.58 79.1,-1.22 -0.21,-0.38 c 1.08,0 2.18,0 3.27,0 762.95,0 1464.86,417.88 1829.53,1089.21" />
|
||||||
|
<!-- Red Circular Arc -->
|
||||||
|
<path
|
||||||
|
id="path32"
|
||||||
|
style="fill:none;stroke:#ff0000;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2593.86,1620.73 -1.22,-28 -0.08,-0.08 c 0.43,-250.15 202.81,-452.72 452.3,-452.72 0.14,0 0.28,0 0.42,0 l 43.9,2.52" />
|
||||||
|
<!-- Yellow Smiley Head -->
|
||||||
|
<path
|
||||||
|
id="path34"
|
||||||
|
style="fill:none;stroke:#ffff00;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2976,1363.94 v 0.08 c 44.73,34.29 71.21,87.25 71.8,143.61 l 0.01,-0.15 c -0.06,97.48 -79.11,176.47 -176.59,176.47 -0.36,0 -0.73,0 -1.09,0 l -0.07,0.03 c -0.25,0 -0.51,0 -0.75,0 -37.38,0 -73.79,-11.94 -103.92,-34.08 l 0.02,-0.03 c -44.38,-34.04 -70.82,-86.47 -71.8,-142.39 l 0.06,0.04 c 0.54,-97.43 79.04,-176.47 176.46,-177.69 l 0.08,0.02 c 0.64,-0.01 1.29,-0.01 1.92,-0.01 37.4,0 73.82,11.94 103.96,34.08" />
|
||||||
|
<!-- 'l' -->
|
||||||
|
<path
|
||||||
|
id="path36"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1502.21,1785.02 h 23.13 v 32.86 h -23.13 l -4.87,8.52 v 154.56 h -18.25 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52" />
|
||||||
|
<path
|
||||||
|
id="path38"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1502.21,1785.02 h 23.13 v 32.86 h -23.13 l -4.87,8.52 v 154.56 h -18.25 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52" />
|
||||||
|
<!-- 'i' -->
|
||||||
|
<path
|
||||||
|
id="path40"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1566.71,1785.02 h 13.39 v 32.86 h -13.39 l -4.86,8.52 v 105.88 h -18.26 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52 m -4.86,163.08 v 32.86 h -18.26 v -32.86 h 18.26" />
|
||||||
|
<path
|
||||||
|
id="path42"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1566.71,1785.02 h 13.39 v 32.86 h -13.39 l -4.86,8.52 v 105.88 h -18.26 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52 m -4.86,163.08 v 32.86 h -18.26 v -32.86 h 18.26" />
|
||||||
|
<!-- 'b' -->
|
||||||
|
<path
|
||||||
|
id="path44"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1598.36,1785.02 v 195.94 h 18.25 v -48.68 h 41.38 l 13.39,-8.52 4.87,-8.52 4.86,-24.34 v -64.5 l -4.86,-25.56 -4.87,-7.3 -13.39,-8.52 h -59.63 m 18.25,32.86 h 41.38 l 4.87,8.52 v 64.5 l -4.87,8.52 h -41.38 v -81.54" />
|
||||||
|
<path
|
||||||
|
id="path46"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1598.36,1785.02 v 195.94 h 18.25 v -48.68 h 41.38 l 13.39,-8.52 4.87,-8.52 4.86,-24.34 v -64.5 l -4.86,-25.56 -4.87,-7.3 -13.39,-8.52 h -59.63 m 18.25,32.86 h 41.38 l 4.87,8.52 v 64.5 l -4.87,8.52 h -41.38 v -81.54" />
|
||||||
|
<!-- '3' -->
|
||||||
|
<path
|
||||||
|
id="path48"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1722.49,1817.88 h -23.12 v -32.86 h 69.36 l 13.4,8.52 4.86,7.3 3.65,25.56 v 40.16 l -8.51,15.82 8.51,17.04 v 40.16 l -3.65,24.34 -4.86,8.52 -13.4,8.52 h -69.36 v -32.86 h 69.36 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24 v -32.86 h 46.24 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24" />
|
||||||
|
<path
|
||||||
|
id="path50"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1722.49,1817.88 h -23.12 v -32.86 h 69.36 l 13.4,8.52 4.86,7.3 3.65,25.56 v 40.16 l -8.51,15.82 8.51,17.04 v 40.16 l -3.65,24.34 -4.86,8.52 -13.4,8.52 h -69.36 v -32.86 h 69.36 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24 v -32.86 h 46.24 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24" />
|
||||||
|
<!-- '2' -->
|
||||||
|
<path
|
||||||
|
id="path52"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1808.9,1785.02 h 92.49 v 32.86 h -73.02 v 32.86 l 3.65,7.3 h 46.25 l 13.38,8.52 4.87,8.52 4.87,24.34 v 40.16 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -46.25 l -13.39,-8.52 -4.86,-8.52 -4.87,-24.34 v -24.34 h 19.47 v 24.34 l 3.65,8.52 h 46.25 l 4.86,-8.52 v -40.16 l -4.86,-8.52 h -46.25 l -13.39,-8.52 -4.86,-7.3 -4.87,-24.34 v -65.72" />
|
||||||
|
<path
|
||||||
|
id="path54"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1808.9,1785.02 h 92.49 v 32.86 h -73.02 v 32.86 l 3.65,7.3 h 46.25 l 13.38,8.52 4.87,8.52 4.87,24.34 v 40.16 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -46.25 l -13.39,-8.52 -4.86,-8.52 -4.87,-24.34 v -24.34 h 19.47 v 24.34 l 3.65,8.52 h 46.25 l 4.86,-8.52 v -40.16 l -4.86,-8.52 h -46.25 l -13.39,-8.52 -4.86,-7.3 -4.87,-24.34 v -65.72" />
|
||||||
|
<!-- '7' -->
|
||||||
|
<path
|
||||||
|
id="path56"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 1919.64,1980.96 h 91.28 v -65.72 l -49.9,-130.22 h -23.12 l 54.76,138.74 v 24.34 h -73.02 v 32.86" />
|
||||||
|
<path
|
||||||
|
id="path58"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 1919.64,1980.96 h 91.28 v -65.72 l -49.9,-130.22 h -23.12 l 54.76,138.74 v 24.34 h -73.02 v 32.86" />
|
||||||
|
<!-- '0' -->
|
||||||
|
<path
|
||||||
|
id="path60"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 2047.43,1972.44 -4.87,-8.52 -3.65,-24.34 V 1826.4 l 3.65,-25.56 4.87,-7.3 14.61,-8.52 h 31.64 l 13.38,8.52 4.87,7.3 4.87,25.56 v 113.18 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -31.64 l -14.61,-8.52 m 14.61,-24.34 h 31.64 l 4.86,-8.52 V 1826.4 l -4.86,-8.52 h -31.64 l -4.88,8.52 v 113.18 l 4.88,8.52" />
|
||||||
|
<path
|
||||||
|
id="path62"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2047.43,1972.44 -4.87,-8.52 -3.65,-24.34 V 1826.4 l 3.65,-25.56 4.87,-7.3 14.61,-8.52 h 31.64 l 13.38,8.52 4.87,7.3 4.87,25.56 v 113.18 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -31.64 l -14.61,-8.52 m 14.61,-24.34 h 31.64 l 4.86,-8.52 V 1826.4 l -4.86,-8.52 h -31.64 l -4.88,8.52 v 113.18 l 4.88,8.52" />
|
||||||
|
<!-- 'j' -->
|
||||||
|
<path
|
||||||
|
id="path64"
|
||||||
|
style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="m 2176.43,1948.1 v 32.86 h -18.25 v -32.86 h 18.25 m 0,-15.82 V 1769.2 l -4.87,-25.56 -4.86,-7.3 -13.39,-8.52 h -18.26 v 32.86 h 18.26 l 4.87,8.52 v 163.08 h 18.25" />
|
||||||
|
<path
|
||||||
|
id="path66"
|
||||||
|
style="fill:none;stroke:#ff00ff;stroke-width:1.21700001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2176.43,1948.1 v 32.86 h -18.25 v -32.86 h 18.25 m 0,-15.82 V 1769.2 l -4.87,-25.56 -4.86,-7.3 -13.39,-8.52 h -18.26 v 32.86 h 18.26 l 4.87,8.52 v 163.08 h 18.25" />
|
||||||
|
<!-- Smile -->
|
||||||
|
<path
|
||||||
|
id="path68"
|
||||||
|
style="fill:none;stroke:#ffff00;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2778.85,1478.34 0.04,-0.02 c 21.03,-31.91 56.69,-51.12 94.91,-51.12 0.41,0 0.83,0 1.24,0.01 l -0.02,0.07 c 43.88,0.19 84.11,24.51 104.66,63.28" />
|
||||||
|
<!-- Left Eye (cyan) -->
|
||||||
|
<path
|
||||||
|
id="path70"
|
||||||
|
style="fill:none;stroke:#00ffff;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2820.22,1595.17 0.01,0.01 c -14.62,-1.91 -25.56,-14.37 -25.56,-29.11 0,-0.03 0,-0.07 0,-0.1 l -0.02,-0.01 c 0,-0.03 0,-0.07 0,-0.1 0,-16.09 13.04,-29.14 29.13,-29.14 0.43,0 0.87,0.01 1.29,0.03 h 3.67 0.01 c 14.61,1.91 25.55,14.37 25.55,29.11 0,0.03 0,0.07 0,0.1 l 0.02,0.01 c 0,0.04 0,0.08 0,0.12 0,16.07 -13.03,29.09 -29.09,29.09 -0.03,0 -0.08,0 -0.12,0 l -4.89,-0.01" />
|
||||||
|
<!-- Right Eye (cyan) -->
|
||||||
|
<path
|
||||||
|
id="path72"
|
||||||
|
style="fill:none;stroke:#00ffff;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2921.23,1569.61 v -3.65 l -0.01,-0.01 c 0,-0.27 -0.01,-0.54 -0.01,-0.81 0,-18.22 14.66,-33.05 32.87,-33.26 l 0.03,0.01 c 0.28,0 0.57,-0.01 0.84,-0.01 17.29,0 31.72,13.22 33.24,30.44 l -0.02,3.64 0.02,0.02 c 0,0.27 0.01,0.54 0.01,0.81 0,18.37 -14.9,33.28 -33.28,33.28 -0.26,0 -0.54,-0.01 -0.81,-0.02 l -0.02,-0.03 c -17.14,-0.18 -31.36,-13.34 -32.86,-30.42" />
|
||||||
|
<!-- Nose -->
|
||||||
|
<path
|
||||||
|
id="path74"
|
||||||
|
style="fill:none;stroke:#ffff00;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2892.03,1528.23 -29.21,-20.68" />
|
||||||
|
<path
|
||||||
|
id="path76"
|
||||||
|
style="fill:none;stroke:#ffff00;stroke-width:7.50158978;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 2862.82,1507.55 h 32.86" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 11 KiB |
@@ -22,6 +22,8 @@ import androidx.core.view.WindowCompat
|
|||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.LifecycleEventObserver
|
import androidx.lifecycle.LifecycleEventObserver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
import android.view.KeyCharacterMap
|
import android.view.KeyCharacterMap
|
||||||
import haus.nightmare.lib3270j.protocol.DS3270Constants.*
|
import haus.nightmare.lib3270j.protocol.DS3270Constants.*
|
||||||
import haus.nightmare.a3270.service.TerminalService
|
import haus.nightmare.a3270.service.TerminalService
|
||||||
@@ -39,7 +41,8 @@ import haus.nightmare.a3270.ui.FindDialog
|
|||||||
import haus.nightmare.a3270.ui.ScreenExporterDialog
|
import haus.nightmare.a3270.ui.ScreenExporterDialog
|
||||||
import haus.nightmare.a3270.ui.ScriptDialog
|
import haus.nightmare.a3270.ui.ScriptDialog
|
||||||
import haus.nightmare.a3270.ui.PrinterSessionDialog
|
import haus.nightmare.a3270.ui.PrinterSessionDialog
|
||||||
|
import haus.nightmare.a3270.ui.ScreenHistoryDialog
|
||||||
|
import haus.nightmare.a3270.ui.MacroDialog
|
||||||
import haus.nightmare.a3270.ui.UntrustedCertificateDialog
|
import haus.nightmare.a3270.ui.UntrustedCertificateDialog
|
||||||
|
|
||||||
class MainActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
@@ -528,12 +531,20 @@ fun MainScreen(
|
|||||||
val isCrosshairRuler by viewModel.isCrosshairRuler.collectAsState()
|
val isCrosshairRuler by viewModel.isCrosshairRuler.collectAsState()
|
||||||
val cursorStyle by viewModel.cursorStyle.collectAsState()
|
val cursorStyle by viewModel.cursorStyle.collectAsState()
|
||||||
val blockSelectMode by viewModel.blockSelectMode.collectAsState()
|
val blockSelectMode by viewModel.blockSelectMode.collectAsState()
|
||||||
|
val blockPaste by viewModel.blockPaste.collectAsState()
|
||||||
val uiTheme by viewModel.uiTheme.collectAsState()
|
val uiTheme by viewModel.uiTheme.collectAsState()
|
||||||
val isInsertMode by viewModel.isInsertMode.collectAsState()
|
val isInsertMode by viewModel.isInsertMode.collectAsState()
|
||||||
val isDocMode by viewModel.isDocMode.collectAsState()
|
val isDocMode by viewModel.isDocMode.collectAsState()
|
||||||
val isWordWrap by viewModel.isWordWrap.collectAsState()
|
val isWordWrap by viewModel.isWordWrap.collectAsState()
|
||||||
val isAplMode by viewModel.isAplMode.collectAsState()
|
val isAplMode by viewModel.isAplMode.collectAsState()
|
||||||
val fourColorOverride by viewModel.fourColorOverride.collectAsState()
|
val fourColorOverride by viewModel.fourColorOverride.collectAsState()
|
||||||
|
val trimRectSizingHandles by viewModel.trimRectSizingHandles.collectAsState()
|
||||||
|
val trimRectRemainAfterEdit by viewModel.trimRectRemainAfterEdit.collectAsState()
|
||||||
|
val pasteWordBreak by viewModel.pasteWordBreak.collectAsState()
|
||||||
|
val hotspotsEnabled by viewModel.hotspotsEnabled.collectAsState()
|
||||||
|
val hotspotsUrlEnabled by viewModel.hotspotsUrlEnabled.collectAsState()
|
||||||
|
val hotspotsPfEnabled by viewModel.hotspotsPfEnabled.collectAsState()
|
||||||
|
val hotspotsMenuChoicesEnabled by viewModel.hotspotsMenuChoicesEnabled.collectAsState()
|
||||||
|
|
||||||
val isNumericField = remember(screenBuffer, cursorAddr, screenVersion) {
|
val isNumericField = remember(screenBuffer, cursorAddr, screenVersion) {
|
||||||
if (screenBuffer != null && screenBuffer?.isFormatted == true) {
|
if (screenBuffer != null && screenBuffer?.isFormatted == true) {
|
||||||
@@ -550,6 +561,8 @@ fun MainScreen(
|
|||||||
var showScreenExportDialog by remember { mutableStateOf(false) }
|
var showScreenExportDialog by remember { mutableStateOf(false) }
|
||||||
var showScriptDialog by remember { mutableStateOf(false) }
|
var showScriptDialog by remember { mutableStateOf(false) }
|
||||||
var showPrinterSessionDialog by remember { mutableStateOf(false) }
|
var showPrinterSessionDialog by remember { mutableStateOf(false) }
|
||||||
|
var showScreenHistoryDialog by remember { mutableStateOf(false) }
|
||||||
|
var showMacroDialog by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
var terminalInputViewRef by remember { mutableStateOf<TerminalInputView?>(null) }
|
var terminalInputViewRef by remember { mutableStateOf<TerminalInputView?>(null) }
|
||||||
|
|
||||||
@@ -660,6 +673,25 @@ fun MainScreen(
|
|||||||
cursorStyle = cursorStyle,
|
cursorStyle = cursorStyle,
|
||||||
isInsertMode = isInsertMode,
|
isInsertMode = isInsertMode,
|
||||||
blockSelectMode = blockSelectMode,
|
blockSelectMode = blockSelectMode,
|
||||||
|
blockPaste = blockPaste,
|
||||||
|
onToggleBlockSelectMode = { viewModel.setBlockSelectMode(!blockSelectMode) },
|
||||||
|
onToggleBlockPaste = { viewModel.setBlockPaste(!blockPaste) },
|
||||||
|
trimRectSizingHandles = trimRectSizingHandles,
|
||||||
|
trimRectRemainAfterEdit = trimRectRemainAfterEdit,
|
||||||
|
hotspotsEnabled = hotspotsEnabled,
|
||||||
|
hotspotEngine = viewModel.hotspotEngine,
|
||||||
|
onSendHotspotAction = { action -> viewModel.sendKeys(action) },
|
||||||
|
onOpenUrl = { url ->
|
||||||
|
try {
|
||||||
|
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply {
|
||||||
|
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
|
}
|
||||||
|
context.startActivity(intent)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Toast.makeText(context, "Cannot open URL: ${e.message}", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onToggleHotspots = { viewModel.toggleHotspots() },
|
||||||
fourColorOverride = fourColorOverride,
|
fourColorOverride = fourColorOverride,
|
||||||
onPasteLineWrap = { text, wrapCol, wordWrap ->
|
onPasteLineWrap = { text, wrapCol, wordWrap ->
|
||||||
viewModel.pasteLineWrap(text, wrapCol, wordWrap)
|
viewModel.pasteLineWrap(text, wrapCol, wordWrap)
|
||||||
@@ -744,10 +776,18 @@ fun MainScreen(
|
|||||||
terminalInputViewRef?.hideSoftKeyboard()
|
terminalInputViewRef?.hideSoftKeyboard()
|
||||||
showScreenExportDialog = true
|
showScreenExportDialog = true
|
||||||
},
|
},
|
||||||
|
onScreenHistoryClick = {
|
||||||
|
terminalInputViewRef?.hideSoftKeyboard()
|
||||||
|
showScreenHistoryDialog = true
|
||||||
|
},
|
||||||
onScriptClick = {
|
onScriptClick = {
|
||||||
terminalInputViewRef?.hideSoftKeyboard()
|
terminalInputViewRef?.hideSoftKeyboard()
|
||||||
showScriptDialog = true
|
showScriptDialog = true
|
||||||
},
|
},
|
||||||
|
onMacroRuntimeClick = {
|
||||||
|
terminalInputViewRef?.hideSoftKeyboard()
|
||||||
|
showMacroDialog = true
|
||||||
|
},
|
||||||
onPrinterSessionClick = {
|
onPrinterSessionClick = {
|
||||||
terminalInputViewRef?.hideSoftKeyboard()
|
terminalInputViewRef?.hideSoftKeyboard()
|
||||||
showPrinterSessionDialog = true
|
showPrinterSessionDialog = true
|
||||||
@@ -897,6 +937,14 @@ fun MainScreen(
|
|||||||
initialCrosshairRuler = isCrosshairRuler,
|
initialCrosshairRuler = isCrosshairRuler,
|
||||||
initialCursorStyle = cursorStyle,
|
initialCursorStyle = cursorStyle,
|
||||||
initialBlockSelectMode = blockSelectMode,
|
initialBlockSelectMode = blockSelectMode,
|
||||||
|
initialBlockPaste = blockPaste,
|
||||||
|
initialTrimRectSizingHandles = trimRectSizingHandles,
|
||||||
|
initialTrimRectRemainAfterEdit = trimRectRemainAfterEdit,
|
||||||
|
initialPasteWordBreak = pasteWordBreak,
|
||||||
|
initialHotspotsEnabled = hotspotsEnabled,
|
||||||
|
initialHotspotsUrlEnabled = hotspotsUrlEnabled,
|
||||||
|
initialHotspotsPfEnabled = hotspotsPfEnabled,
|
||||||
|
initialHotspotsMenuChoicesEnabled = hotspotsMenuChoicesEnabled,
|
||||||
initialStartupBehavior = AppSettings.getStartupBehavior(context).name,
|
initialStartupBehavior = AppSettings.getStartupBehavior(context).name,
|
||||||
initialDynamicRows = AppSettings.getDynamicRows(context),
|
initialDynamicRows = AppSettings.getDynamicRows(context),
|
||||||
initialDynamicCols = AppSettings.getDynamicCols(context),
|
initialDynamicCols = AppSettings.getDynamicCols(context),
|
||||||
@@ -915,14 +963,23 @@ fun MainScreen(
|
|||||||
showSettingsDialog = false
|
showSettingsDialog = false
|
||||||
terminalInputViewRef?.showSoftKeyboard()
|
terminalInputViewRef?.showSoftKeyboard()
|
||||||
},
|
},
|
||||||
onSave = { mask, blink, haptic, verify, gfx, defaultCp, theme, crosshair, style, blockSel, startup, dynRows, dynCols,
|
onSave = { mask, blink, haptic, verify, gfx, defaultCp, theme, crosshair, style, blockSel, blockPst,
|
||||||
doc, wrap, startCol, endCol, bell, bellCol, tabs, resetIns, fourCol, numLk, autoSk ->
|
sizingHandles, remainAfterEdit, wordBreak, hsEnabled, hsUrl, hsPf, hsChoices,
|
||||||
|
startup, dynRows, dynCols, doc, wrap, startCol, endCol, bell, bellCol, tabs, resetIns, fourCol, numLk, autoSk ->
|
||||||
showSettingsDialog = false
|
showSettingsDialog = false
|
||||||
viewModel.updateSettings(mask, blink, haptic, verify, gfx, defaultCp)
|
viewModel.updateSettings(mask, blink, haptic, verify, gfx, defaultCp)
|
||||||
viewModel.setUiTheme(theme)
|
viewModel.setUiTheme(theme)
|
||||||
viewModel.setCrosshairRuler(crosshair)
|
viewModel.setCrosshairRuler(crosshair)
|
||||||
viewModel.setCursorStyle(style)
|
viewModel.setCursorStyle(style)
|
||||||
viewModel.setBlockSelectMode(blockSel)
|
viewModel.setBlockSelectMode(blockSel)
|
||||||
|
viewModel.setBlockPaste(blockPst)
|
||||||
|
viewModel.setTrimRectSizingHandles(sizingHandles)
|
||||||
|
viewModel.setTrimRectRemainAfterEdit(remainAfterEdit)
|
||||||
|
viewModel.setPasteWordBreak(wordBreak)
|
||||||
|
viewModel.setHotspotsEnabled(hsEnabled)
|
||||||
|
viewModel.setHotspotsUrlEnabled(hsUrl)
|
||||||
|
viewModel.setHotspotsPfEnabled(hsPf)
|
||||||
|
viewModel.setHotspotsMenuChoicesEnabled(hsChoices)
|
||||||
AppSettings.setStartupBehavior(context, AppSettings.StartupBehavior.valueOf(startup))
|
AppSettings.setStartupBehavior(context, AppSettings.StartupBehavior.valueOf(startup))
|
||||||
AppSettings.setDynamicRows(context, dynRows)
|
AppSettings.setDynamicRows(context, dynRows)
|
||||||
AppSettings.setDynamicCols(context, dynCols)
|
AppSettings.setDynamicCols(context, dynCols)
|
||||||
@@ -1014,6 +1071,26 @@ fun MainScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (showScreenHistoryDialog) {
|
||||||
|
ScreenHistoryDialog(
|
||||||
|
historyBuffer = viewModel.getScreenHistoryBuffer(),
|
||||||
|
onDismiss = {
|
||||||
|
showScreenHistoryDialog = false
|
||||||
|
terminalInputViewRef?.showSoftKeyboard()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showMacroDialog) {
|
||||||
|
MacroDialog(
|
||||||
|
client = viewModel.getClient(),
|
||||||
|
onDismiss = {
|
||||||
|
showMacroDialog = false
|
||||||
|
terminalInputViewRef?.showSoftKeyboard()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
val prompt = untrustedCertPrompt
|
val prompt = untrustedCertPrompt
|
||||||
if (prompt != null) {
|
if (prompt != null) {
|
||||||
UntrustedCertificateDialog(
|
UntrustedCertificateDialog(
|
||||||
|
|||||||
@@ -20,9 +20,11 @@ import haus.nightmare.lib3270j.listener.ConnectionListener
|
|||||||
import haus.nightmare.lib3270j.listener.ScreenUpdateListener
|
import haus.nightmare.lib3270j.listener.ScreenUpdateListener
|
||||||
import haus.nightmare.lib3270j.protocol.DS3270Constants.*
|
import haus.nightmare.lib3270j.protocol.DS3270Constants.*
|
||||||
import haus.nightmare.lib3270j.screen.ScreenBuffer
|
import haus.nightmare.lib3270j.screen.ScreenBuffer
|
||||||
|
import haus.nightmare.lib3270j.screen.ScreenHistoryBuffer
|
||||||
import haus.nightmare.a3270.ft.FileTransfer
|
import haus.nightmare.a3270.ft.FileTransfer
|
||||||
import haus.nightmare.a3270.service.TerminalService
|
import haus.nightmare.a3270.service.TerminalService
|
||||||
import haus.nightmare.a3270.storage.AppSettings
|
import haus.nightmare.a3270.storage.AppSettings
|
||||||
|
import haus.nightmare.a3270.ui.HotspotEngine
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
@@ -61,6 +63,8 @@ sealed interface TerminalInputAction {
|
|||||||
data class SetAplMode(val enabled: Boolean) : TerminalInputAction
|
data class SetAplMode(val enabled: Boolean) : TerminalInputAction
|
||||||
data class SetCursor(val baddr: Int) : TerminalInputAction
|
data class SetCursor(val baddr: Int) : TerminalInputAction
|
||||||
data class LightPenSelect(val baddr: Int) : TerminalInputAction
|
data class LightPenSelect(val baddr: Int) : TerminalInputAction
|
||||||
|
data class PasteText(val text: String) : TerminalInputAction
|
||||||
|
data class SendKeysAction(val keys: String) : TerminalInputAction
|
||||||
}
|
}
|
||||||
|
|
||||||
data class UntrustedCertPromptState(
|
data class UntrustedCertPromptState(
|
||||||
@@ -161,6 +165,9 @@ class TerminalViewModel(application: Application) : AndroidViewModel(application
|
|||||||
private val _blockSelectMode = MutableStateFlow(AppSettings.isBlockSelectModeEnabled(application))
|
private val _blockSelectMode = MutableStateFlow(AppSettings.isBlockSelectModeEnabled(application))
|
||||||
val blockSelectMode: StateFlow<Boolean> = _blockSelectMode.asStateFlow()
|
val blockSelectMode: StateFlow<Boolean> = _blockSelectMode.asStateFlow()
|
||||||
|
|
||||||
|
private val _blockPaste = MutableStateFlow(AppSettings.isBlockPasteEnabled(application))
|
||||||
|
val blockPaste: StateFlow<Boolean> = _blockPaste.asStateFlow()
|
||||||
|
|
||||||
private val _uiTheme = MutableStateFlow(AppSettings.getUiTheme(application))
|
private val _uiTheme = MutableStateFlow(AppSettings.getUiTheme(application))
|
||||||
val uiTheme: StateFlow<String> = _uiTheme.asStateFlow()
|
val uiTheme: StateFlow<String> = _uiTheme.asStateFlow()
|
||||||
|
|
||||||
@@ -179,6 +186,80 @@ class TerminalViewModel(application: Application) : AndroidViewModel(application
|
|||||||
private val _fourColorOverride = MutableStateFlow(AppSettings.getFourColorOverride(application))
|
private val _fourColorOverride = MutableStateFlow(AppSettings.getFourColorOverride(application))
|
||||||
val fourColorOverride: StateFlow<Boolean> = _fourColorOverride.asStateFlow()
|
val fourColorOverride: StateFlow<Boolean> = _fourColorOverride.asStateFlow()
|
||||||
|
|
||||||
|
private val _hotspotsEnabled = MutableStateFlow(AppSettings.isHotspotsEnabled(application))
|
||||||
|
val hotspotsEnabled: StateFlow<Boolean> = _hotspotsEnabled.asStateFlow()
|
||||||
|
|
||||||
|
private val _hotspotsUrlEnabled = MutableStateFlow(AppSettings.isHotspotsUrlEnabled(application))
|
||||||
|
val hotspotsUrlEnabled: StateFlow<Boolean> = _hotspotsUrlEnabled.asStateFlow()
|
||||||
|
|
||||||
|
private val _hotspotsPfEnabled = MutableStateFlow(AppSettings.isHotspotsPfEnabled(application))
|
||||||
|
val hotspotsPfEnabled: StateFlow<Boolean> = _hotspotsPfEnabled.asStateFlow()
|
||||||
|
|
||||||
|
private val _hotspotsMenuChoicesEnabled = MutableStateFlow(AppSettings.isHotspotsMenuChoicesEnabled(application))
|
||||||
|
val hotspotsMenuChoicesEnabled: StateFlow<Boolean> = _hotspotsMenuChoicesEnabled.asStateFlow()
|
||||||
|
|
||||||
|
private val _trimRectSizingHandles = MutableStateFlow(AppSettings.isTrimRectSizingHandlesEnabled(application))
|
||||||
|
val trimRectSizingHandles: StateFlow<Boolean> = _trimRectSizingHandles.asStateFlow()
|
||||||
|
|
||||||
|
private val _trimRectRemainAfterEdit = MutableStateFlow(AppSettings.isTrimRectRemainAfterEditEnabled(application))
|
||||||
|
val trimRectRemainAfterEdit: StateFlow<Boolean> = _trimRectRemainAfterEdit.asStateFlow()
|
||||||
|
|
||||||
|
private val _pasteWordBreak = MutableStateFlow(AppSettings.isPasteWordBreakEnabled(application))
|
||||||
|
val pasteWordBreak: StateFlow<Boolean> = _pasteWordBreak.asStateFlow()
|
||||||
|
|
||||||
|
val hotspotEngine = HotspotEngine().apply {
|
||||||
|
urlEnabled = _hotspotsUrlEnabled.value
|
||||||
|
pfKeysEnabled = _hotspotsPfEnabled.value
|
||||||
|
menuChoicesEnabled = _hotspotsMenuChoicesEnabled.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setHotspotsEnabled(enabled: Boolean) {
|
||||||
|
AppSettings.setHotspotsEnabled(getApplication(), enabled)
|
||||||
|
_hotspotsEnabled.value = enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
fun toggleHotspots() {
|
||||||
|
setHotspotsEnabled(!_hotspotsEnabled.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setHotspotsUrlEnabled(enabled: Boolean) {
|
||||||
|
AppSettings.setHotspotsUrlEnabled(getApplication(), enabled)
|
||||||
|
_hotspotsUrlEnabled.value = enabled
|
||||||
|
hotspotEngine.urlEnabled = enabled
|
||||||
|
hotspotEngine.invalidateCache()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setHotspotsPfEnabled(enabled: Boolean) {
|
||||||
|
AppSettings.setHotspotsPfEnabled(getApplication(), enabled)
|
||||||
|
_hotspotsPfEnabled.value = enabled
|
||||||
|
hotspotEngine.pfKeysEnabled = enabled
|
||||||
|
hotspotEngine.invalidateCache()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setHotspotsMenuChoicesEnabled(enabled: Boolean) {
|
||||||
|
AppSettings.setHotspotsMenuChoicesEnabled(getApplication(), enabled)
|
||||||
|
_hotspotsMenuChoicesEnabled.value = enabled
|
||||||
|
hotspotEngine.menuChoicesEnabled = enabled
|
||||||
|
hotspotEngine.invalidateCache()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setTrimRectSizingHandles(enabled: Boolean) {
|
||||||
|
AppSettings.setTrimRectSizingHandlesEnabled(getApplication(), enabled)
|
||||||
|
_trimRectSizingHandles.value = enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setTrimRectRemainAfterEdit(enabled: Boolean) {
|
||||||
|
AppSettings.setTrimRectRemainAfterEditEnabled(getApplication(), enabled)
|
||||||
|
_trimRectRemainAfterEdit.value = enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setPasteWordBreak(enabled: Boolean) {
|
||||||
|
val app = getApplication<Application>()
|
||||||
|
AppSettings.setPasteWordBreakEnabled(app, enabled)
|
||||||
|
_pasteWordBreak.value = enabled
|
||||||
|
applyModeSettings()
|
||||||
|
}
|
||||||
|
|
||||||
fun toggleLightPen() {
|
fun toggleLightPen() {
|
||||||
_isLightPenMode.value = !_isLightPenMode.value
|
_isLightPenMode.value = !_isLightPenMode.value
|
||||||
}
|
}
|
||||||
@@ -206,6 +287,17 @@ class TerminalViewModel(application: Application) : AndroidViewModel(application
|
|||||||
_blockSelectMode.value = enabled
|
_blockSelectMode.value = enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setBlockPaste(enabled: Boolean) {
|
||||||
|
val app = getApplication<Application>()
|
||||||
|
AppSettings.setBlockPasteEnabled(app, enabled)
|
||||||
|
_blockPaste.value = enabled
|
||||||
|
applyModeSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun toggleBlockPaste() {
|
||||||
|
setBlockPaste(!_blockPaste.value)
|
||||||
|
}
|
||||||
|
|
||||||
fun setUiTheme(theme: String) {
|
fun setUiTheme(theme: String) {
|
||||||
AppSettings.setUiTheme(getApplication(), theme)
|
AppSettings.setUiTheme(getApplication(), theme)
|
||||||
_uiTheme.value = theme
|
_uiTheme.value = theme
|
||||||
@@ -270,7 +362,12 @@ class TerminalViewModel(application: Application) : AndroidViewModel(application
|
|||||||
ip.isInsertOffOnAid = AppSettings.getInsertOffOnAid(app)
|
ip.isInsertOffOnAid = AppSettings.getInsertOffOnAid(app)
|
||||||
ip.isNumericFieldLock = AppSettings.getNumericFieldLock(app)
|
ip.isNumericFieldLock = AppSettings.getNumericFieldLock(app)
|
||||||
ip.isAutoSkipEnabled = AppSettings.getAutoSkipEnabled(app)
|
ip.isAutoSkipEnabled = AppSettings.getAutoSkipEnabled(app)
|
||||||
|
ip.isBlockPaste = AppSettings.isBlockPasteEnabled(app)
|
||||||
|
ip.isPasteWordBreak = AppSettings.isPasteWordBreakEnabled(app)
|
||||||
}
|
}
|
||||||
|
c.ps?.isBlockPaste = AppSettings.isBlockPasteEnabled(app)
|
||||||
|
c.ps?.isPasteWordBreak = AppSettings.isPasteWordBreakEnabled(app)
|
||||||
|
c.isPasteWordBreak = AppSettings.isPasteWordBreakEnabled(app)
|
||||||
_fourColorOverride.value = AppSettings.getFourColorOverride(app)
|
_fourColorOverride.value = AppSettings.getFourColorOverride(app)
|
||||||
_isDocMode.value = c.isDocMode
|
_isDocMode.value = c.isDocMode
|
||||||
_isWordWrap.value = c.isWordWrap
|
_isWordWrap.value = c.isWordWrap
|
||||||
@@ -290,8 +387,20 @@ class TerminalViewModel(application: Application) : AndroidViewModel(application
|
|||||||
_isCrosshairRuler.value = AppSettings.isCrosshairRulerEnabled(app)
|
_isCrosshairRuler.value = AppSettings.isCrosshairRulerEnabled(app)
|
||||||
_cursorStyle.value = AppSettings.getCursorStyle(app)
|
_cursorStyle.value = AppSettings.getCursorStyle(app)
|
||||||
_blockSelectMode.value = AppSettings.isBlockSelectModeEnabled(app)
|
_blockSelectMode.value = AppSettings.isBlockSelectModeEnabled(app)
|
||||||
|
_blockPaste.value = AppSettings.isBlockPasteEnabled(app)
|
||||||
_uiTheme.value = AppSettings.getUiTheme(app)
|
_uiTheme.value = AppSettings.getUiTheme(app)
|
||||||
_fourColorOverride.value = AppSettings.getFourColorOverride(app)
|
_fourColorOverride.value = AppSettings.getFourColorOverride(app)
|
||||||
|
_hotspotsEnabled.value = AppSettings.isHotspotsEnabled(app)
|
||||||
|
_hotspotsUrlEnabled.value = AppSettings.isHotspotsUrlEnabled(app)
|
||||||
|
_hotspotsPfEnabled.value = AppSettings.isHotspotsPfEnabled(app)
|
||||||
|
_hotspotsMenuChoicesEnabled.value = AppSettings.isHotspotsMenuChoicesEnabled(app)
|
||||||
|
hotspotEngine.urlEnabled = _hotspotsUrlEnabled.value
|
||||||
|
hotspotEngine.pfKeysEnabled = _hotspotsPfEnabled.value
|
||||||
|
hotspotEngine.menuChoicesEnabled = _hotspotsMenuChoicesEnabled.value
|
||||||
|
hotspotEngine.invalidateCache()
|
||||||
|
_trimRectSizingHandles.value = AppSettings.isTrimRectSizingHandlesEnabled(app)
|
||||||
|
_trimRectRemainAfterEdit.value = AppSettings.isTrimRectRemainAfterEditEnabled(app)
|
||||||
|
_pasteWordBreak.value = AppSettings.isPasteWordBreakEnabled(app)
|
||||||
applyModeSettings()
|
applyModeSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,6 +447,12 @@ class TerminalViewModel(application: Application) : AndroidViewModel(application
|
|||||||
|
|
||||||
fun getClient(): Telnet3270Client? = client
|
fun getClient(): Telnet3270Client? = client
|
||||||
|
|
||||||
|
fun getScreenHistoryBuffer(): ScreenHistoryBuffer? = client?.screenBuffer?.historyBuffer
|
||||||
|
|
||||||
|
fun sendKeys(keys: String) {
|
||||||
|
inputChannel.trySend(TerminalInputAction.SendKeysAction(keys))
|
||||||
|
}
|
||||||
|
|
||||||
private var lastScreenContentHash: Int = 0
|
private var lastScreenContentHash: Int = 0
|
||||||
private var hasInitialScreenLoaded: Boolean = false
|
private var hasInitialScreenLoaded: Boolean = false
|
||||||
|
|
||||||
@@ -391,6 +506,31 @@ class TerminalViewModel(application: Application) : AndroidViewModel(application
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
is TerminalInputAction.PasteText -> {
|
||||||
|
log.info("PasteText: len=${action.text.length}, curAddr=${buf.cursorAddress}, formatted=${buf.isFormatted}, isNvt=$isNvt")
|
||||||
|
ip.isKeyboardLocked = false
|
||||||
|
if (isNvt) {
|
||||||
|
for (ch in action.text) {
|
||||||
|
if (ch == '\n' || ch == '\r') {
|
||||||
|
c.sendNVTString("\r\n")
|
||||||
|
} else {
|
||||||
|
c.sendNVTChar(ch)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val app = getApplication<Application>()
|
||||||
|
val blockPaste = AppSettings.isBlockPasteEnabled(app)
|
||||||
|
val pasteWordBreak = AppSettings.isPasteWordBreakEnabled(app)
|
||||||
|
ip.pasteText(action.text, true, false, blockPaste, pasteWordBreak)
|
||||||
|
_screenVersion.value = System.currentTimeMillis()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is TerminalInputAction.SendKeysAction -> {
|
||||||
|
log.info("SendKeysAction: keys='${action.keys}', curAddr=${buf.cursorAddress}, formatted=${buf.isFormatted}, isNvt=$isNvt")
|
||||||
|
ip.isKeyboardLocked = false
|
||||||
|
c.ps?.SendKeys(action.keys)
|
||||||
|
_screenVersion.value = System.currentTimeMillis()
|
||||||
|
}
|
||||||
is TerminalInputAction.SendAid -> {
|
is TerminalInputAction.SendAid -> {
|
||||||
if (isNvt) {
|
if (isNvt) {
|
||||||
if (action.aidCode == AID_ENTER) {
|
if (action.aidCode == AID_ENTER) {
|
||||||
@@ -789,21 +929,26 @@ class TerminalViewModel(application: Application) : AndroidViewModel(application
|
|||||||
val globalVerify = AppSettings.isVerifyCertsEnabled(getApplication())
|
val globalVerify = AppSettings.isVerifyCertsEnabled(getApplication())
|
||||||
val effectiveVerify = tlsVerifyCert && globalVerify
|
val effectiveVerify = tlsVerifyCert && globalVerify
|
||||||
val gMode = haus.nightmare.lib3270j.graphics.GraphicsMode.fromString(graphicsModeStr)
|
val gMode = haus.nightmare.lib3270j.graphics.GraphicsMode.fromString(graphicsModeStr)
|
||||||
|
val effectiveLu = if (luName.isNotBlank()) luName.trim() else (parsedConfig.luName ?: "").trim()
|
||||||
|
|
||||||
_isTlsActive.value = effectiveTls
|
_isTlsActive.value = effectiveTls
|
||||||
_isTlsVerified.value = effectiveVerify
|
_isTlsVerified.value = effectiveVerify
|
||||||
_oiaText.value = "Connecting to $effectiveHost:$effectivePort" + (if (effectiveTls) " [TLS]" else "") + "..."
|
_oiaText.value = "Connecting to " +
|
||||||
|
(if (effectiveLu.isNotBlank()) "$effectiveLu@" else "") +
|
||||||
|
"$effectiveHost:$effectivePort" +
|
||||||
|
(if (effectiveTls) " [TLS]" else "") + "..."
|
||||||
|
|
||||||
val config = ConnectionConfig(effectiveHost, effectivePort, model).apply {
|
val config = ConnectionConfig(effectiveHost, effectivePort, model).apply {
|
||||||
if (model == TerminalModel.IBM_DYNAMIC) {
|
if (model == TerminalModel.IBM_DYNAMIC) {
|
||||||
setDynamicDimensions(dynamicRows, dynamicCols)
|
setDynamicDimensions(dynamicRows, dynamicCols)
|
||||||
}
|
}
|
||||||
if (luName.isNotBlank()) {
|
if (effectiveLu.isNotBlank()) {
|
||||||
setLuName(luName)
|
setLuName(effectiveLu)
|
||||||
}
|
}
|
||||||
isUseTls = effectiveTls
|
isUseTls = effectiveTls
|
||||||
isTlsVerifyCert = effectiveVerify
|
isTlsVerifyCert = effectiveVerify
|
||||||
isTn3270eEnabled = effectiveTn3270e
|
isTn3270eEnabled = effectiveTn3270e
|
||||||
|
isAutoSysUnlock = true
|
||||||
graphicsMode = gMode
|
graphicsMode = gMode
|
||||||
codePage = codePageStr
|
codePage = codePageStr
|
||||||
|
|
||||||
@@ -1098,7 +1243,7 @@ class TerminalViewModel(application: Application) : AndroidViewModel(application
|
|||||||
|
|
||||||
fun pasteString(text: String) {
|
fun pasteString(text: String) {
|
||||||
if (text.isNotEmpty()) {
|
if (text.isNotEmpty()) {
|
||||||
inputChannel.trySend(TerminalInputAction.TypeText(text))
|
inputChannel.trySend(TerminalInputAction.PasteText(text))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ object AppSettings {
|
|||||||
private const val KEY_CROSSHAIR_RULER = "crosshair_ruler"
|
private const val KEY_CROSSHAIR_RULER = "crosshair_ruler"
|
||||||
private const val KEY_CURSOR_STYLE = "cursor_style"
|
private const val KEY_CURSOR_STYLE = "cursor_style"
|
||||||
private const val KEY_BLOCK_SELECT_MODE = "block_select_mode"
|
private const val KEY_BLOCK_SELECT_MODE = "block_select_mode"
|
||||||
|
private const val KEY_BLOCK_PASTE = "block_paste"
|
||||||
private const val KEY_STARTUP_BEHAVIOR = "startup_behavior"
|
private const val KEY_STARTUP_BEHAVIOR = "startup_behavior"
|
||||||
private const val KEY_DYNAMIC_ROWS = "dynamic_rows"
|
private const val KEY_DYNAMIC_ROWS = "dynamic_rows"
|
||||||
private const val KEY_DYNAMIC_COLS = "dynamic_cols"
|
private const val KEY_DYNAMIC_COLS = "dynamic_cols"
|
||||||
@@ -42,6 +43,17 @@ object AppSettings {
|
|||||||
private const val KEY_NUMERIC_FIELD_LOCK = "numeric_field_lock"
|
private const val KEY_NUMERIC_FIELD_LOCK = "numeric_field_lock"
|
||||||
private const val KEY_AUTO_SKIP_ENABLED = "auto_skip_enabled"
|
private const val KEY_AUTO_SKIP_ENABLED = "auto_skip_enabled"
|
||||||
|
|
||||||
|
// Hotspots aligned with j3270 v1.2.2
|
||||||
|
private const val KEY_HOTSPOTS_ENABLED = "hotspots_enabled"
|
||||||
|
private const val KEY_HOTSPOTS_URL_ENABLED = "hotspots_url_enabled"
|
||||||
|
private const val KEY_HOTSPOTS_PF_ENABLED = "hotspots_pf_enabled"
|
||||||
|
private const val KEY_HOTSPOTS_MENU_CHOICES_ENABLED = "hotspots_menu_choices_enabled"
|
||||||
|
|
||||||
|
// Selection & Trim aligned with j3270 v1.2.2
|
||||||
|
private const val KEY_TRIM_RECT_SIZING_HANDLES = "trim_rect_sizing_handles"
|
||||||
|
private const val KEY_TRIM_RECT_REMAIN_AFTER_EDIT = "trim_rect_remain_after_edit"
|
||||||
|
private const val KEY_PASTE_WORD_BREAK = "paste_word_break"
|
||||||
|
|
||||||
enum class StartupBehavior {
|
enum class StartupBehavior {
|
||||||
SHOW_CONNECT,
|
SHOW_CONNECT,
|
||||||
DO_NOTHING,
|
DO_NOTHING,
|
||||||
@@ -137,6 +149,15 @@ object AppSettings {
|
|||||||
getPrefs(context).edit().putBoolean(KEY_BLOCK_SELECT_MODE, enabled).apply()
|
getPrefs(context).edit().putBoolean(KEY_BLOCK_SELECT_MODE, enabled).apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ========== Block Paste Mode ==========
|
||||||
|
fun isBlockPasteEnabled(context: Context): Boolean {
|
||||||
|
return getPrefs(context).getBoolean(KEY_BLOCK_PASTE, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setBlockPasteEnabled(context: Context, enabled: Boolean) {
|
||||||
|
getPrefs(context).edit().putBoolean(KEY_BLOCK_PASTE, enabled).apply()
|
||||||
|
}
|
||||||
|
|
||||||
// ========== Startup Behavior ==========
|
// ========== Startup Behavior ==========
|
||||||
fun getStartupBehavior(context: Context): StartupBehavior {
|
fun getStartupBehavior(context: Context): StartupBehavior {
|
||||||
val s = getPrefs(context).getString(KEY_STARTUP_BEHAVIOR, StartupBehavior.SHOW_CONNECT.name)
|
val s = getPrefs(context).getString(KEY_STARTUP_BEHAVIOR, StartupBehavior.SHOW_CONNECT.name)
|
||||||
@@ -273,6 +294,64 @@ object AppSettings {
|
|||||||
getPrefs(context).edit().putBoolean(KEY_AUTO_SKIP_ENABLED, enabled).apply()
|
getPrefs(context).edit().putBoolean(KEY_AUTO_SKIP_ENABLED, enabled).apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ========== Hotspots (Default DISABLED for touch screens) ==========
|
||||||
|
fun isHotspotsEnabled(context: Context): Boolean {
|
||||||
|
return getPrefs(context).getBoolean(KEY_HOTSPOTS_ENABLED, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setHotspotsEnabled(context: Context, enabled: Boolean) {
|
||||||
|
getPrefs(context).edit().putBoolean(KEY_HOTSPOTS_ENABLED, enabled).apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isHotspotsUrlEnabled(context: Context): Boolean {
|
||||||
|
return getPrefs(context).getBoolean(KEY_HOTSPOTS_URL_ENABLED, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setHotspotsUrlEnabled(context: Context, enabled: Boolean) {
|
||||||
|
getPrefs(context).edit().putBoolean(KEY_HOTSPOTS_URL_ENABLED, enabled).apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isHotspotsPfEnabled(context: Context): Boolean {
|
||||||
|
return getPrefs(context).getBoolean(KEY_HOTSPOTS_PF_ENABLED, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setHotspotsPfEnabled(context: Context, enabled: Boolean) {
|
||||||
|
getPrefs(context).edit().putBoolean(KEY_HOTSPOTS_PF_ENABLED, enabled).apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isHotspotsMenuChoicesEnabled(context: Context): Boolean {
|
||||||
|
return getPrefs(context).getBoolean(KEY_HOTSPOTS_MENU_CHOICES_ENABLED, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setHotspotsMenuChoicesEnabled(context: Context, enabled: Boolean) {
|
||||||
|
getPrefs(context).edit().putBoolean(KEY_HOTSPOTS_MENU_CHOICES_ENABLED, enabled).apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== Selection Handles & Trim ==========
|
||||||
|
fun isTrimRectSizingHandlesEnabled(context: Context): Boolean {
|
||||||
|
return getPrefs(context).getBoolean(KEY_TRIM_RECT_SIZING_HANDLES, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setTrimRectSizingHandlesEnabled(context: Context, enabled: Boolean) {
|
||||||
|
getPrefs(context).edit().putBoolean(KEY_TRIM_RECT_SIZING_HANDLES, enabled).apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isTrimRectRemainAfterEditEnabled(context: Context): Boolean {
|
||||||
|
return getPrefs(context).getBoolean(KEY_TRIM_RECT_REMAIN_AFTER_EDIT, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setTrimRectRemainAfterEditEnabled(context: Context, enabled: Boolean) {
|
||||||
|
getPrefs(context).edit().putBoolean(KEY_TRIM_RECT_REMAIN_AFTER_EDIT, enabled).apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isPasteWordBreakEnabled(context: Context): Boolean {
|
||||||
|
return getPrefs(context).getBoolean(KEY_PASTE_WORD_BREAK, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setPasteWordBreakEnabled(context: Context, enabled: Boolean) {
|
||||||
|
getPrefs(context).edit().putBoolean(KEY_PASTE_WORD_BREAK, enabled).apply()
|
||||||
|
}
|
||||||
|
|
||||||
// ========== INI Config Export / Import ==========
|
// ========== INI Config Export / Import ==========
|
||||||
|
|
||||||
fun exportToIni(context: Context, writer: Writer) {
|
fun exportToIni(context: Context, writer: Writer) {
|
||||||
@@ -302,6 +381,17 @@ object AppSettings {
|
|||||||
p.println("dynamicRows = ${getDynamicRows(context)}")
|
p.println("dynamicRows = ${getDynamicRows(context)}")
|
||||||
p.println("dynamicCols = ${getDynamicCols(context)}")
|
p.println("dynamicCols = ${getDynamicCols(context)}")
|
||||||
p.println("blockSelectMode = ${isBlockSelectModeEnabled(context)}")
|
p.println("blockSelectMode = ${isBlockSelectModeEnabled(context)}")
|
||||||
|
p.println("blockPaste = ${isBlockPasteEnabled(context)}")
|
||||||
|
p.println("trimRectSizingHandles = ${isTrimRectSizingHandlesEnabled(context)}")
|
||||||
|
p.println("trimRectRemainAfterEdit = ${isTrimRectRemainAfterEditEnabled(context)}")
|
||||||
|
p.println("pasteWordBreak = ${isPasteWordBreakEnabled(context)}")
|
||||||
|
p.println()
|
||||||
|
|
||||||
|
p.println("[hotspots]")
|
||||||
|
p.println("hotspotsEnabled = ${isHotspotsEnabled(context)}")
|
||||||
|
p.println("hotspotsUrlEnabled = ${isHotspotsUrlEnabled(context)}")
|
||||||
|
p.println("hotspotsPfEnabled = ${isHotspotsPfEnabled(context)}")
|
||||||
|
p.println("hotspotsMenuChoicesEnabled = ${isHotspotsMenuChoicesEnabled(context)}")
|
||||||
p.println()
|
p.println()
|
||||||
|
|
||||||
p.println("[entryassist]")
|
p.println("[entryassist]")
|
||||||
@@ -328,7 +418,7 @@ object AppSettings {
|
|||||||
p.flush()
|
p.flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadFromIni(context: Context, reader: Reader) {
|
fun parseIni(reader: Reader, callback: (section: String, key: String, value: String) -> Unit) {
|
||||||
val bufferedReader = BufferedReader(reader)
|
val bufferedReader = BufferedReader(reader)
|
||||||
var currentSection = ""
|
var currentSection = ""
|
||||||
|
|
||||||
@@ -342,13 +432,19 @@ object AppSettings {
|
|||||||
if (eq >= 0) {
|
if (eq >= 0) {
|
||||||
val key = line.substring(0, eq).trim()
|
val key = line.substring(0, eq).trim()
|
||||||
val value = line.substring(eq + 1).trim()
|
val value = line.substring(eq + 1).trim()
|
||||||
applyConfigEntry(context, currentSection, key, value)
|
callback(currentSection, key, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun loadFromIni(context: Context, reader: Reader) {
|
||||||
|
parseIni(reader) { section, key, value ->
|
||||||
|
applyConfigEntry(context, section, key, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun applyConfigEntry(context: Context, section: String, key: String, value: String) {
|
private fun applyConfigEntry(context: Context, section: String, key: String, value: String) {
|
||||||
when (section) {
|
when (section) {
|
||||||
"appearance" -> {
|
"appearance" -> {
|
||||||
@@ -369,6 +465,27 @@ object AppSettings {
|
|||||||
"dynamicrows", "dynamic_rows" -> value.toIntOrNull()?.let { setDynamicRows(context, it) }
|
"dynamicrows", "dynamic_rows" -> value.toIntOrNull()?.let { setDynamicRows(context, it) }
|
||||||
"dynamiccols", "dynamic_cols" -> value.toIntOrNull()?.let { setDynamicCols(context, it) }
|
"dynamiccols", "dynamic_cols" -> value.toIntOrNull()?.let { setDynamicCols(context, it) }
|
||||||
"blockselectmode" -> setBlockSelectModeEnabled(context, value.toBoolean())
|
"blockselectmode" -> setBlockSelectModeEnabled(context, value.toBoolean())
|
||||||
|
"blockpaste", "blockpastemode" -> setBlockPasteEnabled(context, value.toBoolean())
|
||||||
|
"trimrectsizinghandles", "sizinghandles" -> setTrimRectSizingHandlesEnabled(context, value.toBoolean())
|
||||||
|
"trimrectremainafteredit", "remainafteredit" -> setTrimRectRemainAfterEditEnabled(context, value.toBoolean())
|
||||||
|
"pastewordbreak", "wordbreak" -> setPasteWordBreakEnabled(context, value.toBoolean())
|
||||||
|
"hotspotsenabled" -> setHotspotsEnabled(context, value.toBoolean())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"clipboard" -> {
|
||||||
|
when (key.lowercase(Locale.US)) {
|
||||||
|
"blockpaste", "blockpastemode" -> setBlockPasteEnabled(context, value.toBoolean())
|
||||||
|
"trimrectsizinghandles", "sizinghandles" -> setTrimRectSizingHandlesEnabled(context, value.toBoolean())
|
||||||
|
"trimrectremainafteredit", "remainafteredit" -> setTrimRectRemainAfterEditEnabled(context, value.toBoolean())
|
||||||
|
"pastewordbreak", "wordbreak" -> setPasteWordBreakEnabled(context, value.toBoolean())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"hotspots" -> {
|
||||||
|
when (key.lowercase(Locale.US)) {
|
||||||
|
"hotspotsenabled", "enabled" -> setHotspotsEnabled(context, value.toBoolean())
|
||||||
|
"hotspotsurlenabled", "urlenabled", "url" -> setHotspotsUrlEnabled(context, value.toBoolean())
|
||||||
|
"hotspotspfenabled", "pfenabled", "pf" -> setHotspotsPfEnabled(context, value.toBoolean())
|
||||||
|
"hotspotsmenuchoicesenabled", "menuchoicesenabled", "menuchoices", "menu" -> setHotspotsMenuChoicesEnabled(context, value.toBoolean())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"entryassist" -> {
|
"entryassist" -> {
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ fun TwoRowKeyBar(
|
|||||||
onFieldInspectorClick: () -> Unit = {},
|
onFieldInspectorClick: () -> Unit = {},
|
||||||
onFindClick: () -> Unit = {},
|
onFindClick: () -> Unit = {},
|
||||||
onScreenExportClick: () -> Unit = {},
|
onScreenExportClick: () -> Unit = {},
|
||||||
|
onScreenHistoryClick: () -> Unit = {},
|
||||||
onScriptClick: () -> Unit = {},
|
onScriptClick: () -> Unit = {},
|
||||||
|
onMacroRuntimeClick: () -> Unit = {},
|
||||||
onPrinterSessionClick: () -> Unit = {},
|
onPrinterSessionClick: () -> Unit = {},
|
||||||
onToggleLightPen: () -> Unit = {},
|
onToggleLightPen: () -> Unit = {},
|
||||||
onToggleInsert: () -> Unit = {},
|
onToggleInsert: () -> Unit = {},
|
||||||
@@ -162,6 +164,13 @@ fun TwoRowKeyBar(
|
|||||||
onScreenExportClick()
|
onScreenExportClick()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
DropdownMenuItem(
|
||||||
|
text = { Text("Screen History", color = Color.White) },
|
||||||
|
onClick = {
|
||||||
|
menuExpanded = false
|
||||||
|
onScreenHistoryClick()
|
||||||
|
}
|
||||||
|
)
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text("Run Keystroke Script", color = Color.White) },
|
text = { Text("Run Keystroke Script", color = Color.White) },
|
||||||
onClick = {
|
onClick = {
|
||||||
@@ -169,6 +178,13 @@ fun TwoRowKeyBar(
|
|||||||
onScriptClick()
|
onScriptClick()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
DropdownMenuItem(
|
||||||
|
text = { Text("Macro Runtime (<HASCRIPT>)", color = Color.White) },
|
||||||
|
onClick = {
|
||||||
|
menuExpanded = false
|
||||||
|
onMacroRuntimeClick()
|
||||||
|
}
|
||||||
|
)
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text("3287 Printer Session", color = Color.White) },
|
text = { Text("3287 Printer Session", color = Color.White) },
|
||||||
onClick = {
|
onClick = {
|
||||||
|
|||||||
@@ -0,0 +1,351 @@
|
|||||||
|
package haus.nightmare.a3270.ui
|
||||||
|
|
||||||
|
import haus.nightmare.lib3270j.screen.ExtendedAttribute
|
||||||
|
import haus.nightmare.lib3270j.screen.ScreenBuffer
|
||||||
|
import java.util.Collections
|
||||||
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Real-time hotspot and URL auto-detection engine matching IBM Host On-Demand
|
||||||
|
* ShowURLOptions and ScreenText parity.
|
||||||
|
*
|
||||||
|
* Scans screen text using regular expressions for:
|
||||||
|
* 1. URLs (http://, https://, ftp://, file://, mailto:, www.)
|
||||||
|
* 2. Function keys (PF1..PF24, F1..F24, PA1..PA3, [ENTER], ENTER)
|
||||||
|
* 3. Menu choices ("1.", "2.", "===> 3", "=> 4")
|
||||||
|
*
|
||||||
|
* Provides hit-testing for touch/mouse taps and generates keystroke actions.
|
||||||
|
*/
|
||||||
|
class HotspotEngine {
|
||||||
|
|
||||||
|
enum class HotspotType {
|
||||||
|
URL,
|
||||||
|
PF_KEY,
|
||||||
|
ENTER,
|
||||||
|
MENU_CHOICE
|
||||||
|
}
|
||||||
|
|
||||||
|
data class Hotspot(
|
||||||
|
val type: HotspotType,
|
||||||
|
val startRow: Int,
|
||||||
|
val startCol: Int,
|
||||||
|
val endRow: Int,
|
||||||
|
val endCol: Int,
|
||||||
|
val displayText: String,
|
||||||
|
val action: String,
|
||||||
|
val tooltip: String
|
||||||
|
) {
|
||||||
|
val text: String get() = displayText
|
||||||
|
/**
|
||||||
|
* Test whether the given row/col coordinate falls within this hotspot.
|
||||||
|
*/
|
||||||
|
fun contains(row: Int, col: Int): Boolean {
|
||||||
|
if (row < startRow || row > endRow) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (startRow == endRow) {
|
||||||
|
return col in startCol..endCol
|
||||||
|
}
|
||||||
|
if (row == startRow) {
|
||||||
|
return col >= startCol
|
||||||
|
}
|
||||||
|
if (row == endRow) {
|
||||||
|
return col <= endCol
|
||||||
|
}
|
||||||
|
return true // Intermediate rows
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var urlEnabled: Boolean = true
|
||||||
|
set(value) {
|
||||||
|
field = value
|
||||||
|
invalidateCache()
|
||||||
|
}
|
||||||
|
|
||||||
|
var pfKeysEnabled: Boolean = true
|
||||||
|
set(value) {
|
||||||
|
field = value
|
||||||
|
invalidateCache()
|
||||||
|
}
|
||||||
|
|
||||||
|
var menuChoicesEnabled: Boolean = true
|
||||||
|
set(value) {
|
||||||
|
field = value
|
||||||
|
invalidateCache()
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val URL_PATTERN = Pattern.compile(
|
||||||
|
"(?:https?|ftp|file)://[\\w\\-._~:/?#\\[\\]@!$&'*+,;=%]+|www\\.[\\w\\-._~:/?#\\[\\]@!$&'*+,;=%]+|mailto:[\\w\\-._~:/?#\\[\\]@!$&'*+,;=%]+",
|
||||||
|
Pattern.CASE_INSENSITIVE
|
||||||
|
)
|
||||||
|
|
||||||
|
private val PF_KEY_PATTERN = Pattern.compile(
|
||||||
|
"(?:(?<=\\W)|^)(PF(?:[1-9]|1[0-9]|2[0-4])|F(?:[1-9]|1[0-9]|2[0-4])|PA[1-3]|\\[ENTER\\]|ENTER)(?:(?=\\W)|$)",
|
||||||
|
Pattern.CASE_INSENSITIVE
|
||||||
|
)
|
||||||
|
|
||||||
|
private val MENU_NUMBER_PATTERN = Pattern.compile(
|
||||||
|
"(?:(?<=\\s)|^)(\\d{1,2})\\.(?:(?=\\s)|$)"
|
||||||
|
)
|
||||||
|
|
||||||
|
private val MENU_PROMPT_PATTERN = Pattern.compile(
|
||||||
|
"(?:===>|=>|-->)\\s*(\\d{1,2})(?:(?=\\s)|$)"
|
||||||
|
)
|
||||||
|
|
||||||
|
private fun markOccupied(arr: BooleanArray, start: Int, end: Int) {
|
||||||
|
val s = start.coerceAtLeast(0)
|
||||||
|
val e = end.coerceAtMost(arr.size)
|
||||||
|
for (i in s until e) {
|
||||||
|
arr[i] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isRangeOccupied(arr: BooleanArray, start: Int, end: Int): Boolean {
|
||||||
|
val s = start.coerceAtLeast(0)
|
||||||
|
val e = end.coerceAtMost(arr.size)
|
||||||
|
for (i in s until e) {
|
||||||
|
if (arr[i]) return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var cachedScreenText: String = ""
|
||||||
|
private var cachedRows: Int = 0
|
||||||
|
private var cachedCols: Int = 0
|
||||||
|
private var cachedHotspots: List<Hotspot> = emptyList()
|
||||||
|
|
||||||
|
fun invalidateCache() {
|
||||||
|
synchronized(this) {
|
||||||
|
cachedScreenText = ""
|
||||||
|
cachedHotspots = emptyList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scan the given ScreenBuffer for interactive hotspots.
|
||||||
|
*/
|
||||||
|
fun scan(sb: ScreenBuffer?): List<Hotspot> {
|
||||||
|
if (sb == null) return emptyList()
|
||||||
|
val rows = sb.displayRows
|
||||||
|
val cols = sb.displayCols
|
||||||
|
|
||||||
|
val fullText = StringBuilder(rows * (cols + 1))
|
||||||
|
for (r in 0 until rows) {
|
||||||
|
for (c in 0 until cols) {
|
||||||
|
val baddr = r * cols + c
|
||||||
|
val ea = sb.getDisplayCell(baddr)
|
||||||
|
val ch = ea?.ucs4 ?: ' '
|
||||||
|
if (ea == null || ea.isFieldAttribute || ch <= ' ' || ch == '\u00FF') {
|
||||||
|
fullText.append(' ')
|
||||||
|
} else {
|
||||||
|
fullText.append(ch)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (r < rows - 1) {
|
||||||
|
fullText.append('\n')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return scanText(fullText.toString(), rows, cols)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scan formatted screen text (lines separated by '\n') for hotspots.
|
||||||
|
*/
|
||||||
|
fun scanText(screenText: String?, rows: Int, cols: Int, enabled: Boolean = true): List<Hotspot> {
|
||||||
|
if (!enabled || screenText == null || rows <= 0 || cols <= 0) {
|
||||||
|
return emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized(this) {
|
||||||
|
if (screenText == cachedScreenText && rows == cachedRows && cols == cachedCols) {
|
||||||
|
return cachedHotspots
|
||||||
|
}
|
||||||
|
|
||||||
|
val hotspots = mutableListOf<Hotspot>()
|
||||||
|
val lines = screenText.split("\n")
|
||||||
|
val actualRows = minOf(rows, lines.size)
|
||||||
|
|
||||||
|
for (r in 0 until actualRows) {
|
||||||
|
val line = lines[r]
|
||||||
|
val occupied = BooleanArray(line.length + 1)
|
||||||
|
|
||||||
|
// 1. Scan URLs
|
||||||
|
if (urlEnabled) {
|
||||||
|
val mUrl = URL_PATTERN.matcher(line)
|
||||||
|
while (mUrl.find()) {
|
||||||
|
val startCol = mUrl.start()
|
||||||
|
var endCol = mUrl.end()
|
||||||
|
var match = mUrl.group()
|
||||||
|
|
||||||
|
while (match.length > 1) {
|
||||||
|
val last = match[match.length - 1]
|
||||||
|
if (last == '.' || last == ',' || last == ';' || last == ':' || last == ')' || last == ']' || last == '>') {
|
||||||
|
match = match.substring(0, match.length - 1)
|
||||||
|
endCol--
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match.isEmpty()) continue
|
||||||
|
|
||||||
|
var actionUrl = match
|
||||||
|
if (match.startsWith("www.", ignoreCase = true)) {
|
||||||
|
actionUrl = "http://$match"
|
||||||
|
}
|
||||||
|
|
||||||
|
val h = Hotspot(
|
||||||
|
type = HotspotType.URL,
|
||||||
|
startRow = r,
|
||||||
|
startCol = startCol,
|
||||||
|
endRow = r,
|
||||||
|
endCol = endCol - 1,
|
||||||
|
displayText = match,
|
||||||
|
action = actionUrl,
|
||||||
|
tooltip = "Open URL: $actionUrl"
|
||||||
|
)
|
||||||
|
hotspots.add(h)
|
||||||
|
markOccupied(occupied, startCol, endCol)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Scan PF / Function keys
|
||||||
|
if (pfKeysEnabled) {
|
||||||
|
val mPf = PF_KEY_PATTERN.matcher(line)
|
||||||
|
while (mPf.find()) {
|
||||||
|
val startCol = mPf.start(1)
|
||||||
|
val endCol = mPf.end(1)
|
||||||
|
if (isRangeOccupied(occupied, startCol, endCol)) continue
|
||||||
|
|
||||||
|
val matchStr = mPf.group(1) ?: continue
|
||||||
|
val keyText = matchStr.uppercase()
|
||||||
|
val action: String
|
||||||
|
val tooltip: String
|
||||||
|
|
||||||
|
if (keyText == "ENTER" || keyText == "[ENTER]") {
|
||||||
|
action = "[enter]"
|
||||||
|
tooltip = "Send [ENTER]"
|
||||||
|
} else if (keyText.startsWith("PF")) {
|
||||||
|
val numStr = keyText.substring(2)
|
||||||
|
action = "[pf$numStr]"
|
||||||
|
tooltip = "Send ${action.uppercase()}"
|
||||||
|
} else if (keyText.startsWith("F")) {
|
||||||
|
val numStr = keyText.substring(1)
|
||||||
|
action = "[pf$numStr]"
|
||||||
|
tooltip = "Send ${action.uppercase()}"
|
||||||
|
} else if (keyText.startsWith("PA")) {
|
||||||
|
val numStr = keyText.substring(2)
|
||||||
|
action = "[pa$numStr]"
|
||||||
|
tooltip = "Send ${action.uppercase()}"
|
||||||
|
} else {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
val h = Hotspot(
|
||||||
|
type = if (keyText.contains("ENTER")) HotspotType.ENTER else HotspotType.PF_KEY,
|
||||||
|
startRow = r,
|
||||||
|
startCol = startCol,
|
||||||
|
endRow = r,
|
||||||
|
endCol = endCol - 1,
|
||||||
|
displayText = matchStr,
|
||||||
|
action = action,
|
||||||
|
tooltip = tooltip
|
||||||
|
)
|
||||||
|
hotspots.add(h)
|
||||||
|
markOccupied(occupied, startCol, endCol)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Scan Menu choices ("1.", "2.", "===> 3", "=> 4")
|
||||||
|
if (menuChoicesEnabled) {
|
||||||
|
val mNum = MENU_NUMBER_PATTERN.matcher(line)
|
||||||
|
while (mNum.find()) {
|
||||||
|
val startCol = mNum.start(1)
|
||||||
|
val endCol = mNum.end()
|
||||||
|
if (isRangeOccupied(occupied, startCol, endCol)) continue
|
||||||
|
|
||||||
|
val choiceNum = mNum.group(1)
|
||||||
|
val action = "$choiceNum[enter]"
|
||||||
|
val tooltip = "Select option $choiceNum"
|
||||||
|
|
||||||
|
val h = Hotspot(
|
||||||
|
type = HotspotType.MENU_CHOICE,
|
||||||
|
startRow = r,
|
||||||
|
startCol = startCol,
|
||||||
|
endRow = r,
|
||||||
|
endCol = endCol - 1,
|
||||||
|
displayText = "$choiceNum.",
|
||||||
|
action = action,
|
||||||
|
tooltip = tooltip
|
||||||
|
)
|
||||||
|
hotspots.add(h)
|
||||||
|
markOccupied(occupied, startCol, endCol)
|
||||||
|
}
|
||||||
|
|
||||||
|
val mPrompt = MENU_PROMPT_PATTERN.matcher(line)
|
||||||
|
while (mPrompt.find()) {
|
||||||
|
val startCol = mPrompt.start()
|
||||||
|
val endCol = mPrompt.end()
|
||||||
|
if (isRangeOccupied(occupied, startCol, endCol)) continue
|
||||||
|
|
||||||
|
val choiceNum = mPrompt.group(1)
|
||||||
|
val action = "$choiceNum[enter]"
|
||||||
|
val tooltip = "Execute choice $choiceNum"
|
||||||
|
|
||||||
|
val h = Hotspot(
|
||||||
|
type = HotspotType.MENU_CHOICE,
|
||||||
|
startRow = r,
|
||||||
|
startCol = startCol,
|
||||||
|
endRow = r,
|
||||||
|
endCol = endCol - 1,
|
||||||
|
displayText = mPrompt.group(),
|
||||||
|
action = action,
|
||||||
|
tooltip = tooltip
|
||||||
|
)
|
||||||
|
hotspots.add(h)
|
||||||
|
markOccupied(occupied, startCol, endCol)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.cachedScreenText = screenText
|
||||||
|
this.cachedRows = rows
|
||||||
|
this.cachedCols = cols
|
||||||
|
this.cachedHotspots = Collections.unmodifiableList(hotspots)
|
||||||
|
|
||||||
|
return cachedHotspots
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hit-test for a hotspot at the specified terminal row and column.
|
||||||
|
*/
|
||||||
|
fun findHotspot(row: Int, col: Int): Hotspot? {
|
||||||
|
synchronized(this) {
|
||||||
|
for (h in cachedHotspots) {
|
||||||
|
if (h.contains(row, col)) {
|
||||||
|
return h
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getHotspots(): List<Hotspot> {
|
||||||
|
synchronized(this) {
|
||||||
|
return cachedHotspots
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun findHotspotAt(hotspots: List<Hotspot>, row: Int, col: Int): Hotspot? {
|
||||||
|
for (h in hotspots) {
|
||||||
|
if (h.contains(row, col)) {
|
||||||
|
return h
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,365 @@
|
|||||||
|
package haus.nightmare.a3270.ui
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.compose.ui.window.Dialog
|
||||||
|
import androidx.compose.ui.window.DialogProperties
|
||||||
|
import haus.nightmare.lib3270j.Telnet3270Client
|
||||||
|
import haus.nightmare.lib3270j.macro.Macro
|
||||||
|
import haus.nightmare.lib3270j.macro.MacroScreen
|
||||||
|
import haus.nightmare.lib3270j.macro.action.MacroAction
|
||||||
|
import haus.nightmare.lib3270j.macro.action.MacroActionPrompt
|
||||||
|
import kotlinx.coroutines.CompletableDeferred
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import java.util.concurrent.atomic.AtomicReference
|
||||||
|
|
||||||
|
private const val DEFAULT_MACRO_XML = """<HASCRIPT name="SampleLogon" timeout="15000" usevars="true">
|
||||||
|
<vars>
|
||||||
|
<create name="${'$'}userId" type="string" value="USER01" />
|
||||||
|
<create name="${'$'}count" type="integer" value="0" />
|
||||||
|
</vars>
|
||||||
|
|
||||||
|
<screen name="LogonScreen" entryscreen="true">
|
||||||
|
<description>
|
||||||
|
<oia status="NOTINHIBITED" />
|
||||||
|
</description>
|
||||||
|
<actions>
|
||||||
|
<input value="${'$'}userId + '[enter]'" movecursor="true" xlatehostkeys="true" />
|
||||||
|
</actions>
|
||||||
|
<nextscreens timeout="10000">
|
||||||
|
<nextscreen name="ReadyScreen" />
|
||||||
|
</nextscreens>
|
||||||
|
</screen>
|
||||||
|
|
||||||
|
<screen name="ReadyScreen" exitscreen="true">
|
||||||
|
<description>
|
||||||
|
<oia status="NOTINHIBITED" />
|
||||||
|
</description>
|
||||||
|
<actions>
|
||||||
|
<message title="Success" value="Logon macro completed successfully!" />
|
||||||
|
</actions>
|
||||||
|
</screen>
|
||||||
|
</HASCRIPT>"""
|
||||||
|
|
||||||
|
data class MacroPromptState(
|
||||||
|
val prompt: MacroActionPrompt,
|
||||||
|
val deferred: CompletableDeferred<String?>
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun MacroDialog(
|
||||||
|
client: Telnet3270Client?,
|
||||||
|
onDismiss: () -> Unit
|
||||||
|
) {
|
||||||
|
var macroXml by remember { mutableStateOf(DEFAULT_MACRO_XML) }
|
||||||
|
var executionLog by remember { mutableStateOf("") }
|
||||||
|
var statusText by remember { mutableStateOf("Status: Stopped") }
|
||||||
|
var isPlaying by remember { mutableStateOf(false) }
|
||||||
|
var isPaused by remember { mutableStateOf(false) }
|
||||||
|
var activePrompt by remember { mutableStateOf<MacroPromptState?>(null) }
|
||||||
|
|
||||||
|
val coroutineScope = rememberCoroutineScope()
|
||||||
|
val macroRef = remember { AtomicReference<Macro?>(null) }
|
||||||
|
|
||||||
|
fun appendLog(msg: String) {
|
||||||
|
val line = "[${java.text.SimpleDateFormat("HH:mm:ss", java.util.Locale.US).format(java.util.Date())}] $msg\n"
|
||||||
|
executionLog += line
|
||||||
|
}
|
||||||
|
|
||||||
|
DisposableEffect(client) {
|
||||||
|
val macro = if (client != null) Macro(client) else null
|
||||||
|
macroRef.set(macro)
|
||||||
|
|
||||||
|
if (macro != null) {
|
||||||
|
val listener = object : Macro.MacroListener {
|
||||||
|
override fun macroStateChanged(m: Macro, oldState: Int, newState: Int) {
|
||||||
|
when (newState) {
|
||||||
|
Macro.STATE_PLAYING -> {
|
||||||
|
isPlaying = true
|
||||||
|
isPaused = false
|
||||||
|
statusText = "Status: Playing"
|
||||||
|
appendLog("Macro playing...")
|
||||||
|
}
|
||||||
|
Macro.STATE_PAUSED -> {
|
||||||
|
isPaused = true
|
||||||
|
statusText = "Status: Paused"
|
||||||
|
appendLog("Macro paused.")
|
||||||
|
}
|
||||||
|
Macro.STATE_ERROR -> {
|
||||||
|
isPlaying = false
|
||||||
|
isPaused = false
|
||||||
|
statusText = "Status: Error"
|
||||||
|
appendLog("Macro error.")
|
||||||
|
}
|
||||||
|
Macro.STATE_STOPPED -> {
|
||||||
|
isPlaying = false
|
||||||
|
isPaused = false
|
||||||
|
statusText = "Status: Stopped"
|
||||||
|
appendLog("Macro stopped.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun macroScreenMatching(screen: MacroScreen) {
|
||||||
|
appendLog("Matched screen: [${screen.name}]")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun macroActionExecuting(action: MacroAction) {
|
||||||
|
appendLog(" -> Executing: ${action.javaClass.simpleName}")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun macroMessage(title: String, message: String) {
|
||||||
|
appendLog("MESSAGE [$title]: $message")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun macroError(error: String) {
|
||||||
|
isPlaying = false
|
||||||
|
isPaused = false
|
||||||
|
statusText = "Status: Error - $error"
|
||||||
|
appendLog("ERROR: $error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
macro.addMacroListener(listener)
|
||||||
|
macro.setPromptHandler { prompt ->
|
||||||
|
val deferred = CompletableDeferred<String?>()
|
||||||
|
activePrompt = MacroPromptState(prompt, deferred)
|
||||||
|
kotlinx.coroutines.runBlocking {
|
||||||
|
deferred.await() ?: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onDispose {
|
||||||
|
macro?.stop()
|
||||||
|
macroRef.set(null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Dialog(
|
||||||
|
onDismissRequest = {
|
||||||
|
if (!isPlaying) onDismiss()
|
||||||
|
},
|
||||||
|
properties = DialogProperties(usePlatformDefaultWidth = false)
|
||||||
|
) {
|
||||||
|
Card(
|
||||||
|
shape = RoundedCornerShape(16.dp),
|
||||||
|
colors = CardDefaults.cardColors(containerColor = Color(0xFF1E1E1E)),
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth(0.95f)
|
||||||
|
.fillMaxHeight(0.90f)
|
||||||
|
.padding(vertical = 10.dp)
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(14.dp),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
|
) {
|
||||||
|
// Header
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
"XML Macro Runtime (<HASCRIPT>)",
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
color = Color.White
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
statusText,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
color = if (isPlaying) Color(0xFF51CF66) else Color.LightGray
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalDivider(color = Color(0xFF2C2D30))
|
||||||
|
|
||||||
|
// Macro XML Editor Pane
|
||||||
|
Text("Macro Definition XML:", fontSize = 12.sp, color = Color.LightGray)
|
||||||
|
OutlinedTextField(
|
||||||
|
value = macroXml,
|
||||||
|
onValueChange = { macroXml = it },
|
||||||
|
textStyle = LocalTextStyle.current.copy(
|
||||||
|
fontFamily = FontFamily.Monospace,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
color = Color.White
|
||||||
|
),
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.weight(0.55f),
|
||||||
|
colors = OutlinedTextFieldDefaults.colors(
|
||||||
|
focusedBorderColor = Color(0xFF339AF0),
|
||||||
|
unfocusedBorderColor = Color(0xFF495057),
|
||||||
|
focusedContainerColor = Color(0xFF121212),
|
||||||
|
unfocusedContainerColor = Color(0xFF121212)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
// Execution Log Pane
|
||||||
|
Text("Execution Log:", fontSize = 12.sp, color = Color.LightGray)
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.weight(0.45f)
|
||||||
|
.background(Color(0xFF0F0F0F), RoundedCornerShape(6.dp))
|
||||||
|
.padding(8.dp)
|
||||||
|
) {
|
||||||
|
val logScroll = rememberScrollState()
|
||||||
|
Text(
|
||||||
|
text = executionLog.ifBlank { "Ready to execute macro..." },
|
||||||
|
fontFamily = FontFamily.Monospace,
|
||||||
|
fontSize = 10.sp,
|
||||||
|
color = if (executionLog.isBlank()) Color.Gray else Color(0xFF69DB7C),
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.verticalScroll(logScroll)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Control Buttons: Play, Pause, Stop, Close
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
val macro = macroRef.get()
|
||||||
|
if (macro != null) {
|
||||||
|
coroutineScope.launch(Dispatchers.IO) {
|
||||||
|
try {
|
||||||
|
val screens = haus.nightmare.lib3270j.macro.MacroXmlParser.parse(macroXml)
|
||||||
|
macro.setScreens(screens)
|
||||||
|
macro.setClient(client)
|
||||||
|
macro.play()
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
appendLog("Execution exception: ${ex.message}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
enabled = !isPlaying && client != null && client.connectionState?.isFullSession == true,
|
||||||
|
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFF2B8A3E)),
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
) {
|
||||||
|
Text("▶ Play", fontSize = 12.sp)
|
||||||
|
}
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
val macro = macroRef.get()
|
||||||
|
if (macro != null) {
|
||||||
|
if (macro.state == Macro.STATE_PLAYING) {
|
||||||
|
macro.pause()
|
||||||
|
} else if (macro.state == Macro.STATE_PAUSED) {
|
||||||
|
macro.resume()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
enabled = isPlaying,
|
||||||
|
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFFE67700)),
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
) {
|
||||||
|
Text(if (isPaused) "Resume" else "Pause", fontSize = 12.sp)
|
||||||
|
}
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
val macro = macroRef.get()
|
||||||
|
macro?.stop()
|
||||||
|
},
|
||||||
|
enabled = isPlaying,
|
||||||
|
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFFC92A2A)),
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
) {
|
||||||
|
Text("■ Stop", fontSize = 12.sp)
|
||||||
|
}
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
val macro = macroRef.get()
|
||||||
|
macro?.stop()
|
||||||
|
onDismiss()
|
||||||
|
},
|
||||||
|
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFF495057)),
|
||||||
|
modifier = Modifier.width(75.dp)
|
||||||
|
) {
|
||||||
|
Text("Close", fontSize = 12.sp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modal prompt dialog when macro requests <prompt> parameter input
|
||||||
|
val promptState = activePrompt
|
||||||
|
if (promptState != null) {
|
||||||
|
var inputValue by remember { mutableStateOf(promptState.prompt.defaultValue ?: "") }
|
||||||
|
|
||||||
|
AlertDialog(
|
||||||
|
onDismissRequest = {
|
||||||
|
promptState.deferred.complete(null)
|
||||||
|
activePrompt = null
|
||||||
|
},
|
||||||
|
title = {
|
||||||
|
Text(
|
||||||
|
text = promptState.prompt.title.ifBlank { "Macro Input Prompt" },
|
||||||
|
fontSize = 15.sp,
|
||||||
|
fontWeight = FontWeight.Bold
|
||||||
|
)
|
||||||
|
},
|
||||||
|
text = {
|
||||||
|
Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||||
|
Text(
|
||||||
|
text = promptState.prompt.description.ifBlank { "Enter parameter:" },
|
||||||
|
fontSize = 13.sp,
|
||||||
|
color = Color.LightGray
|
||||||
|
)
|
||||||
|
OutlinedTextField(
|
||||||
|
value = inputValue,
|
||||||
|
onValueChange = { inputValue = it },
|
||||||
|
singleLine = true,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
confirmButton = {
|
||||||
|
TextButton(
|
||||||
|
onClick = {
|
||||||
|
promptState.deferred.complete(inputValue)
|
||||||
|
activePrompt = null
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text("OK")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dismissButton = {
|
||||||
|
TextButton(
|
||||||
|
onClick = {
|
||||||
|
promptState.deferred.complete(null)
|
||||||
|
activePrompt = null
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text("Cancel")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,248 @@
|
|||||||
|
package haus.nightmare.a3270.ui
|
||||||
|
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.horizontalScroll
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.LocalClipboardManager
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.text.AnnotatedString
|
||||||
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.compose.ui.window.Dialog
|
||||||
|
import androidx.compose.ui.window.DialogProperties
|
||||||
|
import haus.nightmare.lib3270j.screen.ScreenHistoryBuffer
|
||||||
|
import haus.nightmare.lib3270j.screen.ScreenHistoryBuffer.ScreenSnapshot
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ScreenHistoryDialog(
|
||||||
|
historyBuffer: ScreenHistoryBuffer?,
|
||||||
|
onDismiss: () -> Unit
|
||||||
|
) {
|
||||||
|
val context = LocalContext.current
|
||||||
|
val clipboardManager = LocalClipboardManager.current
|
||||||
|
val dateFormat = remember { SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US) }
|
||||||
|
|
||||||
|
var historySize by remember { mutableIntStateOf(historyBuffer?.size() ?: 0) }
|
||||||
|
var selectedIndex by remember { mutableIntStateOf((historyBuffer?.size() ?: 1) - 1) }
|
||||||
|
|
||||||
|
// Listen for live updates if host writes new screens
|
||||||
|
DisposableEffect(historyBuffer) {
|
||||||
|
if (historyBuffer == null) return@DisposableEffect onDispose {}
|
||||||
|
|
||||||
|
val listener = ScreenHistoryBuffer.ScreenHistoryListener { buf, _ ->
|
||||||
|
val newSize = buf.size()
|
||||||
|
historySize = newSize
|
||||||
|
if (selectedIndex >= newSize - 2) {
|
||||||
|
selectedIndex = newSize - 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
historyBuffer.addListener(listener)
|
||||||
|
historySize = historyBuffer.size()
|
||||||
|
if (historySize > 0 && selectedIndex < 0) {
|
||||||
|
selectedIndex = historySize - 1
|
||||||
|
}
|
||||||
|
onDispose {
|
||||||
|
historyBuffer.removeListener(listener)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val currentSnapshot: ScreenSnapshot? = remember(historyBuffer, historySize, selectedIndex) {
|
||||||
|
if (historyBuffer != null && historySize > 0 && selectedIndex in 0 until historySize) {
|
||||||
|
try {
|
||||||
|
historyBuffer.get(selectedIndex)
|
||||||
|
} catch (_: Exception) {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Dialog(
|
||||||
|
onDismissRequest = onDismiss,
|
||||||
|
properties = DialogProperties(usePlatformDefaultWidth = false)
|
||||||
|
) {
|
||||||
|
Card(
|
||||||
|
shape = RoundedCornerShape(16.dp),
|
||||||
|
colors = CardDefaults.cardColors(containerColor = Color(0xFF1E1E1E)),
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth(0.95f)
|
||||||
|
.fillMaxHeight(0.85f)
|
||||||
|
.padding(vertical = 12.dp)
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(16.dp),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||||
|
) {
|
||||||
|
// Top Header: Title & Info
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
"Screen History Buffer",
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 17.sp,
|
||||||
|
color = Color.White
|
||||||
|
)
|
||||||
|
if (currentSnapshot != null) {
|
||||||
|
Text(
|
||||||
|
dateFormat.format(Date(currentSnapshot.timestamp)),
|
||||||
|
fontSize = 12.sp,
|
||||||
|
color = Color.LightGray
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalDivider(color = Color(0xFF2C2D30))
|
||||||
|
|
||||||
|
// Scrub navigation slider & buttons
|
||||||
|
if (historySize > 0 && currentSnapshot != null) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Button(
|
||||||
|
onClick = { if (selectedIndex > 0) selectedIndex-- },
|
||||||
|
enabled = selectedIndex > 0,
|
||||||
|
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFF343A40)),
|
||||||
|
contentPadding = PaddingValues(horizontal = 10.dp, vertical = 4.dp),
|
||||||
|
modifier = Modifier.height(36.dp)
|
||||||
|
) {
|
||||||
|
Text("◄ Prev", fontSize = 12.sp)
|
||||||
|
}
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
"Screen ${selectedIndex + 1} of $historySize",
|
||||||
|
fontSize = 12.sp,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
color = Color.White
|
||||||
|
)
|
||||||
|
if (historySize > 1) {
|
||||||
|
Slider(
|
||||||
|
value = (selectedIndex + 1).toFloat(),
|
||||||
|
onValueChange = { selectedIndex = (it.toInt() - 1).coerceIn(0, historySize - 1) },
|
||||||
|
valueRange = 1f..historySize.toFloat(),
|
||||||
|
steps = if (historySize > 2) historySize - 2 else 0,
|
||||||
|
modifier = Modifier.fillMaxWidth().height(24.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = { if (selectedIndex < historySize - 1) selectedIndex++ },
|
||||||
|
enabled = selectedIndex < historySize - 1,
|
||||||
|
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFF343A40)),
|
||||||
|
contentPadding = PaddingValues(horizontal = 10.dp, vertical = 4.dp),
|
||||||
|
modifier = Modifier.height(36.dp)
|
||||||
|
) {
|
||||||
|
Text("Next ►", fontSize = 12.sp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Terminal Preview Pane
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.fillMaxWidth()
|
||||||
|
.background(Color.Black, RoundedCornerShape(8.dp))
|
||||||
|
.padding(8.dp)
|
||||||
|
) {
|
||||||
|
if (currentSnapshot != null) {
|
||||||
|
val verticalScroll = rememberScrollState()
|
||||||
|
val horizontalScroll = rememberScrollState()
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = currentSnapshot.text,
|
||||||
|
fontFamily = FontFamily.Monospace,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
color = Color(0xFF00FF41), // Classic 3270 Green Phosphor
|
||||||
|
lineHeight = 14.sp,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.verticalScroll(verticalScroll)
|
||||||
|
.horizontalScroll(horizontalScroll)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
"No history frames captured yet.",
|
||||||
|
color = Color.Gray,
|
||||||
|
fontSize = 14.sp
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bottom Action Buttons
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
if (currentSnapshot != null) {
|
||||||
|
clipboardManager.setText(AnnotatedString(currentSnapshot.text))
|
||||||
|
Toast.makeText(context, "Full screen copied to clipboard", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
enabled = currentSnapshot != null,
|
||||||
|
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFF2C2D30)),
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
) {
|
||||||
|
Text("Copy Screen", fontSize = 12.sp)
|
||||||
|
}
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
if (currentSnapshot != null) {
|
||||||
|
clipboardManager.setText(AnnotatedString(currentSnapshot.formattedTable))
|
||||||
|
Toast.makeText(context, "Table text copied to clipboard", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
enabled = currentSnapshot != null,
|
||||||
|
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFF2C2D30)),
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
) {
|
||||||
|
Text("Copy Table", fontSize = 12.sp)
|
||||||
|
}
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = onDismiss,
|
||||||
|
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFF495057)),
|
||||||
|
modifier = Modifier.width(80.dp)
|
||||||
|
) {
|
||||||
|
Text("Close", fontSize = 12.sp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,6 +30,14 @@ fun SettingsDialog(
|
|||||||
initialCrosshairRuler: Boolean = false,
|
initialCrosshairRuler: Boolean = false,
|
||||||
initialCursorStyle: String = "BLOCK",
|
initialCursorStyle: String = "BLOCK",
|
||||||
initialBlockSelectMode: Boolean = false,
|
initialBlockSelectMode: Boolean = false,
|
||||||
|
initialBlockPaste: Boolean = true,
|
||||||
|
initialTrimRectSizingHandles: Boolean = false,
|
||||||
|
initialTrimRectRemainAfterEdit: Boolean = false,
|
||||||
|
initialPasteWordBreak: Boolean = true,
|
||||||
|
initialHotspotsEnabled: Boolean = false,
|
||||||
|
initialHotspotsUrlEnabled: Boolean = true,
|
||||||
|
initialHotspotsPfEnabled: Boolean = true,
|
||||||
|
initialHotspotsMenuChoicesEnabled: Boolean = true,
|
||||||
initialStartupBehavior: String = "SHOW_CONNECT",
|
initialStartupBehavior: String = "SHOW_CONNECT",
|
||||||
initialDynamicRows: Int = 62,
|
initialDynamicRows: Int = 62,
|
||||||
initialDynamicCols: Int = 160,
|
initialDynamicCols: Int = 160,
|
||||||
@@ -56,6 +64,14 @@ fun SettingsDialog(
|
|||||||
crosshairRuler: Boolean,
|
crosshairRuler: Boolean,
|
||||||
cursorStyle: String,
|
cursorStyle: String,
|
||||||
blockSelectMode: Boolean,
|
blockSelectMode: Boolean,
|
||||||
|
blockPaste: Boolean,
|
||||||
|
trimRectSizingHandles: Boolean,
|
||||||
|
trimRectRemainAfterEdit: Boolean,
|
||||||
|
pasteWordBreak: Boolean,
|
||||||
|
hotspotsEnabled: Boolean,
|
||||||
|
hotspotsUrlEnabled: Boolean,
|
||||||
|
hotspotsPfEnabled: Boolean,
|
||||||
|
hotspotsMenuChoicesEnabled: Boolean,
|
||||||
startupBehavior: String,
|
startupBehavior: String,
|
||||||
dynamicRows: Int,
|
dynamicRows: Int,
|
||||||
dynamicCols: Int,
|
dynamicCols: Int,
|
||||||
@@ -86,6 +102,14 @@ fun SettingsDialog(
|
|||||||
var crosshairRuler by remember { mutableStateOf(initialCrosshairRuler) }
|
var crosshairRuler by remember { mutableStateOf(initialCrosshairRuler) }
|
||||||
var cursorStyle by remember { mutableStateOf(initialCursorStyle) }
|
var cursorStyle by remember { mutableStateOf(initialCursorStyle) }
|
||||||
var blockSelectMode by remember { mutableStateOf(initialBlockSelectMode) }
|
var blockSelectMode by remember { mutableStateOf(initialBlockSelectMode) }
|
||||||
|
var blockPaste by remember { mutableStateOf(initialBlockPaste) }
|
||||||
|
var trimRectSizingHandles by remember { mutableStateOf(initialTrimRectSizingHandles) }
|
||||||
|
var trimRectRemainAfterEdit by remember { mutableStateOf(initialTrimRectRemainAfterEdit) }
|
||||||
|
var pasteWordBreak by remember { mutableStateOf(initialPasteWordBreak) }
|
||||||
|
var hotspotsEnabled by remember { mutableStateOf(initialHotspotsEnabled) }
|
||||||
|
var hotspotsUrlEnabled by remember { mutableStateOf(initialHotspotsUrlEnabled) }
|
||||||
|
var hotspotsPfEnabled by remember { mutableStateOf(initialHotspotsPfEnabled) }
|
||||||
|
var hotspotsMenuChoicesEnabled by remember { mutableStateOf(initialHotspotsMenuChoicesEnabled) }
|
||||||
var startupBehavior by remember { mutableStateOf(initialStartupBehavior) }
|
var startupBehavior by remember { mutableStateOf(initialStartupBehavior) }
|
||||||
var dynamicRowsStr by remember { mutableStateOf(initialDynamicRows.toString()) }
|
var dynamicRowsStr by remember { mutableStateOf(initialDynamicRows.toString()) }
|
||||||
var dynamicColsStr by remember { mutableStateOf(initialDynamicCols.toString()) }
|
var dynamicColsStr by remember { mutableStateOf(initialDynamicCols.toString()) }
|
||||||
@@ -262,6 +286,166 @@ fun SettingsDialog(
|
|||||||
|
|
||||||
Spacer(modifier = Modifier.height(10.dp))
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
|
||||||
|
// Block Paste Mode
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.weight(1f).padding(end = 12.dp)) {
|
||||||
|
Text("Block Paste Mode", fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = Color.White)
|
||||||
|
Text("Align multi-line clipboard pastes with cursor start column.", fontSize = 12.sp, color = Color.LightGray)
|
||||||
|
}
|
||||||
|
Switch(
|
||||||
|
checked = blockPaste,
|
||||||
|
onCheckedChange = { blockPaste = it },
|
||||||
|
colors = SwitchDefaults.colors(checkedThumbColor = Color.White, checkedTrackColor = Color(0xFF2B8A3E))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
|
||||||
|
// Trim Rectangle Sizing Handles
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.weight(1f).padding(end = 12.dp)) {
|
||||||
|
Text("Trim Rectangle Sizing Handles", fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = Color.White)
|
||||||
|
Text("Show interactive drag handles around block selection.", fontSize = 12.sp, color = Color.LightGray)
|
||||||
|
}
|
||||||
|
Switch(
|
||||||
|
checked = trimRectSizingHandles,
|
||||||
|
onCheckedChange = { trimRectSizingHandles = it },
|
||||||
|
colors = SwitchDefaults.colors(checkedThumbColor = Color.White, checkedTrackColor = Color(0xFF2B8A3E))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
|
||||||
|
// Trim Rectangle Remains After Edit
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.weight(1f).padding(end = 12.dp)) {
|
||||||
|
Text("Keep Selection After Edit", fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = Color.White)
|
||||||
|
Text("Trim rectangle remains after cut/copy/paste.", fontSize = 12.sp, color = Color.LightGray)
|
||||||
|
}
|
||||||
|
Switch(
|
||||||
|
checked = trimRectRemainAfterEdit,
|
||||||
|
onCheckedChange = { trimRectRemainAfterEdit = it },
|
||||||
|
colors = SwitchDefaults.colors(checkedThumbColor = Color.White, checkedTrackColor = Color(0xFF2B8A3E))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
|
||||||
|
// Paste Word-Break
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.weight(1f).padding(end = 12.dp)) {
|
||||||
|
Text("Paste Without Splitting Words", fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = Color.White)
|
||||||
|
Text("Avoid splitting words across fields when pasting.", fontSize = 12.sp, color = Color.LightGray)
|
||||||
|
}
|
||||||
|
Switch(
|
||||||
|
checked = pasteWordBreak,
|
||||||
|
onCheckedChange = { pasteWordBreak = it },
|
||||||
|
colors = SwitchDefaults.colors(checkedThumbColor = Color.White, checkedTrackColor = Color(0xFF2B8A3E))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
HorizontalDivider(color = Color(0xFF2C2D30))
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
// SECTION: INTERACTIVE HOTSPOTS
|
||||||
|
Text("Interactive Hotspots", fontSize = 13.sp, fontWeight = FontWeight.Bold, color = Color(0xFF339AF0))
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
// Master Hotspots Switch (Default DISABLED)
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.weight(1f).padding(end = 12.dp)) {
|
||||||
|
Text("Enable Interactive Hotspots", fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = Color.White)
|
||||||
|
Text("Tappable URLs, function keys, and menu choices (disabled by default for touch screens).", fontSize = 12.sp, color = Color.LightGray)
|
||||||
|
}
|
||||||
|
Switch(
|
||||||
|
checked = hotspotsEnabled,
|
||||||
|
onCheckedChange = { hotspotsEnabled = it },
|
||||||
|
colors = SwitchDefaults.colors(checkedThumbColor = Color.White, checkedTrackColor = Color(0xFF2B8A3E))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hotspotsEnabled) {
|
||||||
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
|
||||||
|
// Hotspots: URL Detection
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth().padding(start = 12.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.weight(1f).padding(end = 12.dp)) {
|
||||||
|
Text("Auto-Detect URLs", fontSize = 13.sp, fontWeight = FontWeight.Medium, color = Color.White)
|
||||||
|
Text("http://, https://, ftp://, www., mailto:", fontSize = 11.sp, color = Color.LightGray)
|
||||||
|
}
|
||||||
|
Switch(
|
||||||
|
checked = hotspotsUrlEnabled,
|
||||||
|
onCheckedChange = { hotspotsUrlEnabled = it },
|
||||||
|
colors = SwitchDefaults.colors(checkedThumbColor = Color.White, checkedTrackColor = Color(0xFF2B8A3E))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
// Hotspots: Function Key Detection
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth().padding(start = 12.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.weight(1f).padding(end = 12.dp)) {
|
||||||
|
Text("Auto-Detect Function Keys", fontSize = 13.sp, fontWeight = FontWeight.Medium, color = Color.White)
|
||||||
|
Text("PF1..PF24, F1..F24, PA1..PA3, [ENTER]", fontSize = 11.sp, color = Color.LightGray)
|
||||||
|
}
|
||||||
|
Switch(
|
||||||
|
checked = hotspotsPfEnabled,
|
||||||
|
onCheckedChange = { hotspotsPfEnabled = it },
|
||||||
|
colors = SwitchDefaults.colors(checkedThumbColor = Color.White, checkedTrackColor = Color(0xFF2B8A3E))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
// Hotspots: Menu Choice Detection
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth().padding(start = 12.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.weight(1f).padding(end = 12.dp)) {
|
||||||
|
Text("Auto-Detect Menu Choices", fontSize = 13.sp, fontWeight = FontWeight.Medium, color = Color.White)
|
||||||
|
Text("\"1.\", \"2.\", \"===> 3\", \"=> 4\"", fontSize = 11.sp, color = Color.LightGray)
|
||||||
|
}
|
||||||
|
Switch(
|
||||||
|
checked = hotspotsMenuChoicesEnabled,
|
||||||
|
onCheckedChange = { hotspotsMenuChoicesEnabled = it },
|
||||||
|
colors = SwitchDefaults.colors(checkedThumbColor = Color.White, checkedTrackColor = Color(0xFF2B8A3E))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
|
||||||
// Haptic Feedback
|
// Haptic Feedback
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
@@ -707,6 +891,14 @@ fun SettingsDialog(
|
|||||||
crosshairRuler,
|
crosshairRuler,
|
||||||
cursorStyle,
|
cursorStyle,
|
||||||
blockSelectMode,
|
blockSelectMode,
|
||||||
|
blockPaste,
|
||||||
|
trimRectSizingHandles,
|
||||||
|
trimRectRemainAfterEdit,
|
||||||
|
pasteWordBreak,
|
||||||
|
hotspotsEnabled,
|
||||||
|
hotspotsUrlEnabled,
|
||||||
|
hotspotsPfEnabled,
|
||||||
|
hotspotsMenuChoicesEnabled,
|
||||||
startupBehavior,
|
startupBehavior,
|
||||||
dRows,
|
dRows,
|
||||||
dCols,
|
dCols,
|
||||||
@@ -760,6 +952,14 @@ fun SettingsDialog(
|
|||||||
crosshairRuler = haus.nightmare.a3270.storage.AppSettings.isCrosshairRulerEnabled(context)
|
crosshairRuler = haus.nightmare.a3270.storage.AppSettings.isCrosshairRulerEnabled(context)
|
||||||
cursorStyle = haus.nightmare.a3270.storage.AppSettings.getCursorStyle(context)
|
cursorStyle = haus.nightmare.a3270.storage.AppSettings.getCursorStyle(context)
|
||||||
blockSelectMode = haus.nightmare.a3270.storage.AppSettings.isBlockSelectModeEnabled(context)
|
blockSelectMode = haus.nightmare.a3270.storage.AppSettings.isBlockSelectModeEnabled(context)
|
||||||
|
blockPaste = haus.nightmare.a3270.storage.AppSettings.isBlockPasteEnabled(context)
|
||||||
|
trimRectSizingHandles = haus.nightmare.a3270.storage.AppSettings.isTrimRectSizingHandlesEnabled(context)
|
||||||
|
trimRectRemainAfterEdit = haus.nightmare.a3270.storage.AppSettings.isTrimRectRemainAfterEditEnabled(context)
|
||||||
|
pasteWordBreak = haus.nightmare.a3270.storage.AppSettings.isPasteWordBreakEnabled(context)
|
||||||
|
hotspotsEnabled = haus.nightmare.a3270.storage.AppSettings.isHotspotsEnabled(context)
|
||||||
|
hotspotsUrlEnabled = haus.nightmare.a3270.storage.AppSettings.isHotspotsUrlEnabled(context)
|
||||||
|
hotspotsPfEnabled = haus.nightmare.a3270.storage.AppSettings.isHotspotsPfEnabled(context)
|
||||||
|
hotspotsMenuChoicesEnabled = haus.nightmare.a3270.storage.AppSettings.isHotspotsMenuChoicesEnabled(context)
|
||||||
startupBehavior = haus.nightmare.a3270.storage.AppSettings.getStartupBehavior(context).name
|
startupBehavior = haus.nightmare.a3270.storage.AppSettings.getStartupBehavior(context).name
|
||||||
dynamicRowsStr = haus.nightmare.a3270.storage.AppSettings.getDynamicRows(context).toString()
|
dynamicRowsStr = haus.nightmare.a3270.storage.AppSettings.getDynamicRows(context).toString()
|
||||||
dynamicColsStr = haus.nightmare.a3270.storage.AppSettings.getDynamicCols(context).toString()
|
dynamicColsStr = haus.nightmare.a3270.storage.AppSettings.getDynamicCols(context).toString()
|
||||||
|
|||||||
@@ -70,14 +70,24 @@ fun TerminalView(
|
|||||||
cursorStyle: String = "BLOCK",
|
cursorStyle: String = "BLOCK",
|
||||||
isInsertMode: Boolean = false,
|
isInsertMode: Boolean = false,
|
||||||
blockSelectMode: Boolean = false,
|
blockSelectMode: Boolean = false,
|
||||||
|
blockPaste: Boolean = true,
|
||||||
|
trimRectSizingHandles: Boolean = false,
|
||||||
|
trimRectRemainAfterEdit: Boolean = false,
|
||||||
|
hotspotsEnabled: Boolean = false,
|
||||||
|
hotspotEngine: HotspotEngine? = null,
|
||||||
fourColorOverride: Boolean = false,
|
fourColorOverride: Boolean = false,
|
||||||
searchHighlightAddr: Int = -1,
|
searchHighlightAddr: Int = -1,
|
||||||
searchHighlightLen: Int = 0,
|
searchHighlightLen: Int = 0,
|
||||||
onTapAddress: (Int) -> Unit,
|
onTapAddress: (Int) -> Unit,
|
||||||
onLightPenSelect: ((Int) -> Unit)? = null,
|
onLightPenSelect: ((Int) -> Unit)? = null,
|
||||||
|
onSendHotspotAction: ((String) -> Unit)? = null,
|
||||||
|
onOpenUrl: ((String) -> Unit)? = null,
|
||||||
onGraphicTouch: ((Int, Int, Int) -> Unit)? = null,
|
onGraphicTouch: ((Int, Int, Int) -> Unit)? = null,
|
||||||
onPasteText: (String) -> Unit = {},
|
onPasteText: (String) -> Unit = {},
|
||||||
onPasteLineWrap: ((String, Int, Boolean) -> Unit)? = null,
|
onPasteLineWrap: ((String, Int, Boolean) -> Unit)? = null,
|
||||||
|
onToggleBlockSelectMode: (() -> Unit)? = null,
|
||||||
|
onToggleBlockPaste: (() -> Unit)? = null,
|
||||||
|
onToggleHotspots: (() -> Unit)? = null,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
@@ -165,8 +175,10 @@ fun TerminalView(
|
|||||||
} else if (totalDistance <= slop) {
|
} else if (totalDistance <= slop) {
|
||||||
// Short Tap
|
// Short Tap
|
||||||
showContextMenu = false
|
showContextMenu = false
|
||||||
|
if (!trimRectRemainAfterEdit) {
|
||||||
selectionStart = null
|
selectionStart = null
|
||||||
selectionEnd = null
|
selectionEnd = null
|
||||||
|
}
|
||||||
val metrics = calculateGridMetrics(size.width.toFloat(), size.height.toFloat(), cols, rows)
|
val metrics = calculateGridMetrics(size.width.toFloat(), size.height.toFloat(), cols, rows)
|
||||||
if (metrics.cellWidth > 0 && metrics.cellHeight > 0) {
|
if (metrics.cellWidth > 0 && metrics.cellHeight > 0) {
|
||||||
val col = ((startPos.x - metrics.offsetX) / metrics.cellWidth).toInt().coerceIn(0, cols - 1)
|
val col = ((startPos.x - metrics.offsetX) / metrics.cellWidth).toInt().coerceIn(0, cols - 1)
|
||||||
@@ -185,8 +197,39 @@ fun TerminalView(
|
|||||||
} else if (isLightPenMode) {
|
} else if (isLightPenMode) {
|
||||||
onLightPenSelect?.invoke(clickAddr)
|
onLightPenSelect?.invoke(clickAddr)
|
||||||
} else {
|
} else {
|
||||||
var addr = clickAddr
|
// 1. Hotspot tap check when enabled
|
||||||
|
var handledHotspot = false
|
||||||
|
if (hotspotsEnabled && hotspotEngine != null) {
|
||||||
|
val h = hotspotEngine.findHotspot(row, col)
|
||||||
|
if (h != null) {
|
||||||
|
if (h.type == HotspotEngine.HotspotType.URL) {
|
||||||
|
onOpenUrl?.invoke(h.action)
|
||||||
|
handledHotspot = true
|
||||||
|
} else {
|
||||||
|
onSendHotspotAction?.invoke(h.action)
|
||||||
|
handledHotspot = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!handledHotspot) {
|
||||||
|
// 2. Detectable field check (HoD parity)
|
||||||
val buf = screenBuffer
|
val buf = screenBuffer
|
||||||
|
var isDetectable = false
|
||||||
|
if (buf != null && buf.isFormatted) {
|
||||||
|
val faPos = buf.findFieldAttribute(clickAddr)
|
||||||
|
if (faPos >= 0) {
|
||||||
|
val fa = buf.getCell(faPos).fa.toInt() and 0xFF
|
||||||
|
if (faIsSelectable(fa) && !faIsZero(fa)) {
|
||||||
|
onLightPenSelect?.invoke(clickAddr)
|
||||||
|
isDetectable = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Normal tap cursor positioning
|
||||||
|
if (!isDetectable) {
|
||||||
|
var addr = clickAddr
|
||||||
if (buf != null && buf.isFormatted) {
|
if (buf != null && buf.isFormatted) {
|
||||||
val faVal = buf.getFieldAttributeAt(addr)
|
val faVal = buf.getFieldAttributeAt(addr)
|
||||||
if (faIsProtected(faVal.toInt() and 0xFF) || buf.getCell(addr).isFieldAttribute) {
|
if (faIsProtected(faVal.toInt() and 0xFF) || buf.getCell(addr).isFieldAttribute) {
|
||||||
@@ -200,6 +243,8 @@ fun TerminalView(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
val version = currentScreenVersion
|
val version = currentScreenVersion
|
||||||
val activeCursorAddr = currentCursorAddr
|
val activeCursorAddr = currentCursorAddr
|
||||||
@@ -466,6 +511,102 @@ fun TerminalView(
|
|||||||
strokeWidth = 2f
|
strokeWidth = 2f
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Field Outlining (0xC2 / TY_FOUTLINE)
|
||||||
|
val cellEa = if (buf != null) buf.getCell(addr) else null
|
||||||
|
var outline = if (cellEa != null) cellEa.ol.toInt() and 0xFF else 0
|
||||||
|
val fEa = currentFieldEa
|
||||||
|
val olUnderline = ExtendedAttribute.OL_UNDERLINE.toInt() and 0xFF
|
||||||
|
val olOverline = ExtendedAttribute.OL_OVERLINE.toInt() and 0xFF
|
||||||
|
val olLeft = ExtendedAttribute.OL_LEFT.toInt() and 0xFF
|
||||||
|
val olRight = ExtendedAttribute.OL_RIGHT.toInt() and 0xFF
|
||||||
|
|
||||||
|
if (outline == 0 && fEa != null && fEa.ol != 0.toByte()) {
|
||||||
|
val fol = fEa.ol.toInt() and 0xFF
|
||||||
|
if ((fol and olUnderline) != 0) outline = outline or olUnderline
|
||||||
|
if ((fol and olOverline) != 0) outline = outline or olOverline
|
||||||
|
|
||||||
|
val size = totalCells
|
||||||
|
val prevAddr = (addr - 1 + size) % size
|
||||||
|
if (buf != null && (buf.getDisplayCell(prevAddr)?.isFieldAttribute == true || c == 0)) {
|
||||||
|
if ((fol and olLeft) != 0) outline = outline or olLeft
|
||||||
|
}
|
||||||
|
val nextAddr = (addr + 1) % size
|
||||||
|
if (buf != null && (buf.getDisplayCell(nextAddr)?.isFieldAttribute == true || c == cols - 1)) {
|
||||||
|
if ((fol and olRight) != 0) outline = outline or olRight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outline != 0) {
|
||||||
|
if ((outline and olUnderline) != 0) {
|
||||||
|
drawLine(fgColor, Offset(left, top + cellHeight - 1f), Offset(left + cellWidth, top + cellHeight - 1f), strokeWidth = 1.5f)
|
||||||
|
}
|
||||||
|
if ((outline and olRight) != 0) {
|
||||||
|
drawLine(fgColor, Offset(left + cellWidth - 1f, top), Offset(left + cellWidth - 1f, top + cellHeight), strokeWidth = 1.5f)
|
||||||
|
}
|
||||||
|
if ((outline and olOverline) != 0) {
|
||||||
|
drawLine(fgColor, Offset(left, top), Offset(left + cellWidth, top), strokeWidth = 1.5f)
|
||||||
|
}
|
||||||
|
if ((outline and olLeft) != 0) {
|
||||||
|
drawLine(fgColor, Offset(left, top), Offset(left, top + cellHeight), strokeWidth = 1.5f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rectangular Block Selection Sizing Handles & Box Outline
|
||||||
|
if (trimRectSizingHandles && selMinRow != -1 && selMinCol != -1) {
|
||||||
|
val x1 = offsetX + selMinCol * cellWidth
|
||||||
|
val y1 = offsetY + selMinRow * cellHeight
|
||||||
|
val x2 = offsetX + (selMaxCol + 1) * cellWidth
|
||||||
|
val y2 = offsetY + (selMaxRow + 1) * cellHeight
|
||||||
|
val w = x2 - x1
|
||||||
|
val h = y2 - y1
|
||||||
|
val xm = (x1 + x2) / 2f
|
||||||
|
val ym = (y1 + y2) / 2f
|
||||||
|
|
||||||
|
drawRect(
|
||||||
|
color = Color.Yellow,
|
||||||
|
topLeft = Offset(x1, y1),
|
||||||
|
size = Size(w, h),
|
||||||
|
style = androidx.compose.ui.graphics.drawscope.Stroke(width = 2f)
|
||||||
|
)
|
||||||
|
|
||||||
|
val handleSize = 8f
|
||||||
|
val handleHalf = handleSize / 2f
|
||||||
|
val handles = listOf(
|
||||||
|
Offset(x1, y1), Offset(xm, y1), Offset(x2, y1),
|
||||||
|
Offset(x2, ym), Offset(x2, y2), Offset(xm, y2),
|
||||||
|
Offset(x1, y2), Offset(x1, ym)
|
||||||
|
)
|
||||||
|
for (pt in handles) {
|
||||||
|
drawRect(
|
||||||
|
color = Color.Yellow,
|
||||||
|
topLeft = Offset(pt.x - handleHalf, pt.y - handleHalf),
|
||||||
|
size = Size(handleSize, handleSize)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interactive Hotspot Underline Rendering
|
||||||
|
if (hotspotsEnabled && hotspotEngine != null && buf != null) {
|
||||||
|
val activeHotspots = hotspotEngine.scan(buf)
|
||||||
|
for (h in activeHotspots) {
|
||||||
|
val hr0 = h.startRow
|
||||||
|
val hr1 = h.endRow
|
||||||
|
for (r in hr0..hr1) {
|
||||||
|
val c0 = if (r == hr0) h.startCol else 0
|
||||||
|
val c1 = if (r == hr1) h.endCol else cols - 1
|
||||||
|
val x1 = offsetX + c0 * cellWidth
|
||||||
|
val x2 = offsetX + (c1 + 1) * cellWidth
|
||||||
|
val y = offsetY + (r + 1) * cellHeight - 2f
|
||||||
|
drawLine(
|
||||||
|
color = Color(0xFF00DCFF),
|
||||||
|
start = Offset(x1, y),
|
||||||
|
end = Offset(x2, y),
|
||||||
|
strokeWidth = 2f
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,6 +710,36 @@ fun TerminalView(
|
|||||||
showPasteWrapDialog = true
|
showPasteWrapDialog = true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (onToggleBlockSelectMode != null) {
|
||||||
|
DropdownMenuItem(
|
||||||
|
text = { Text(if (blockSelectMode) "✓ Block Select Mode" else " Block Select Mode") },
|
||||||
|
onClick = {
|
||||||
|
showContextMenu = false
|
||||||
|
onToggleBlockSelectMode()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onToggleBlockPaste != null) {
|
||||||
|
DropdownMenuItem(
|
||||||
|
text = { Text(if (blockPaste) "✓ Block Paste" else " Block Paste") },
|
||||||
|
onClick = {
|
||||||
|
showContextMenu = false
|
||||||
|
onToggleBlockPaste()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onToggleHotspots != null) {
|
||||||
|
DropdownMenuItem(
|
||||||
|
text = { Text(if (hotspotsEnabled) "✓ Interactive Hotspots" else " Interactive Hotspots") },
|
||||||
|
onClick = {
|
||||||
|
showContextMenu = false
|
||||||
|
onToggleHotspots()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showPasteWrapDialog) {
|
if (showPasteWrapDialog) {
|
||||||
@@ -728,7 +899,7 @@ private fun copySelection(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getFgColorForAttribute(
|
internal fun getFgColorForAttribute(
|
||||||
ea: ExtendedAttribute,
|
ea: ExtendedAttribute,
|
||||||
currentFieldEa: ExtendedAttribute?,
|
currentFieldEa: ExtendedAttribute?,
|
||||||
currentFA: Byte,
|
currentFA: Byte,
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:pathData="M0,0h108v108h-108z"/>
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<group
|
||||||
|
android:scaleX="0.029365"
|
||||||
|
android:scaleY="-0.029365"
|
||||||
|
android:translateX="-8.57"
|
||||||
|
android:translateY="103.38">
|
||||||
|
<!-- Green Terminal Screen Frame -->
|
||||||
|
<path
|
||||||
|
android:strokeColor="#00FF00"
|
||||||
|
android:strokeWidth="40"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:pathData="M 1177.27,2220.71 V 1142.45 H 3084.31 V 2220.71 H 1177.27" />
|
||||||
|
|
||||||
|
<!-- Blue Wave / Exponential Curve -->
|
||||||
|
<path
|
||||||
|
android:strokeColor="#0000FF"
|
||||||
|
android:strokeWidth="60"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:pathData="m 1172.41,1137.58 79.1,-1.22 -0.21,-0.38 c 1.08,0 2.18,0 3.27,0 762.95,0 1464.86,417.88 1829.53,1089.21" />
|
||||||
|
|
||||||
|
<!-- Red Circular Arc -->
|
||||||
|
<path
|
||||||
|
android:strokeColor="#FF0000"
|
||||||
|
android:strokeWidth="60"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:pathData="m 2593.86,1620.73 -1.22,-28 -0.08,-0.08 c 0.43,-250.15 202.81,-452.72 452.3,-452.72 0.14,0 0.28,0 0.42,0 l 43.9,2.52" />
|
||||||
|
|
||||||
|
<!-- Yellow Smiley Head -->
|
||||||
|
<path
|
||||||
|
android:strokeColor="#FFFF00"
|
||||||
|
android:strokeWidth="50"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:pathData="m 2976,1363.94 v 0.08 c 44.73,34.29 71.21,87.25 71.8,143.61 l 0.01,-0.15 c -0.06,97.48 -79.11,176.47 -176.59,176.47 -0.36,0 -0.73,0 -1.09,0 l -0.07,0.03 c -0.25,0 -0.51,0 -0.75,0 -37.38,0 -73.79,-11.94 -103.92,-34.08 l 0.02,-0.03 c -44.38,-34.04 -70.82,-86.47 -71.8,-142.39 l 0.06,0.04 c 0.54,-97.43 79.04,-176.47 176.46,-177.69 l 0.08,0.02 c 0.64,-0.01 1.29,-0.01 1.92,-0.01 37.4,0 73.82,11.94 103.96,34.08" />
|
||||||
|
|
||||||
|
<!-- Magenta Typography: lib3270j -->
|
||||||
|
<!-- 'l' -->
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF00FF"
|
||||||
|
android:pathData="m 1502.21,1785.02 h 23.13 v 32.86 h -23.13 l -4.87,8.52 v 154.56 h -18.25 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52" />
|
||||||
|
<!-- 'i' -->
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF00FF"
|
||||||
|
android:pathData="m 1566.71,1785.02 h 13.39 v 32.86 h -13.39 l -4.86,8.52 v 105.88 h -18.26 V 1826.4 l 4.87,-25.56 4.87,-7.3 13.38,-8.52 m -4.86,163.08 v 32.86 h -18.26 v -32.86 h 18.26" />
|
||||||
|
<!-- 'b' -->
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF00FF"
|
||||||
|
android:pathData="m 1598.36,1785.02 v 195.94 h 18.25 v -48.68 h 41.38 l 13.39,-8.52 4.87,-8.52 4.86,-24.34 v -64.5 l -4.86,-25.56 -4.87,-7.3 -13.39,-8.52 h -59.63 m 18.25,32.86 h 41.38 l 4.87,8.52 v 64.5 l -4.87,8.52 h -41.38 v -81.54" />
|
||||||
|
<!-- '3' -->
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF00FF"
|
||||||
|
android:pathData="m 1722.49,1817.88 h -23.12 v -32.86 h 69.36 l 13.4,8.52 4.86,7.3 3.65,25.56 v 40.16 l -8.51,15.82 8.51,17.04 v 40.16 l -3.65,24.34 -4.86,8.52 -13.4,8.52 h -69.36 v -32.86 h 69.36 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24 v -32.86 h 46.24 l 3.66,-8.52 v -31.64 l -3.66,-8.52 h -46.24" />
|
||||||
|
<!-- '2' -->
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF00FF"
|
||||||
|
android:pathData="m 1808.9,1785.02 h 92.49 v 32.86 h -73.02 v 32.86 l 3.65,7.3 h 46.25 l 13.38,8.52 4.87,8.52 4.87,24.34 v 40.16 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -46.25 l -13.39,-8.52 -4.86,-8.52 -4.87,-24.34 v -24.34 h 19.47 v 24.34 l 3.65,8.52 h 46.25 l 4.86,-8.52 v -40.16 l -4.86,-8.52 h -46.25 l -13.39,-8.52 -4.86,-7.3 -4.87,-24.34 v -65.72" />
|
||||||
|
<!-- '7' -->
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF00FF"
|
||||||
|
android:pathData="m 1919.64,1980.96 h 91.28 v -65.72 l -49.9,-130.22 h -23.12 l 54.76,138.74 v 24.34 h -73.02 v 32.86" />
|
||||||
|
<!-- '0' -->
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF00FF"
|
||||||
|
android:pathData="m 2047.43,1972.44 -4.87,-8.52 -3.65,-24.34 V 1826.4 l 3.65,-25.56 4.87,-7.3 14.61,-8.52 h 31.64 l 13.38,8.52 4.87,7.3 4.87,25.56 v 113.18 l -4.87,24.34 -4.87,8.52 -13.38,8.52 h -31.64 l -14.61,-8.52 m 14.61,-24.34 h 31.64 l 4.86,-8.52 V 1826.4 l -4.86,-8.52 h -31.64 l -4.88,8.52 v 113.18 l 4.88,8.52" />
|
||||||
|
<!-- 'j' -->
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF00FF"
|
||||||
|
android:pathData="m 2176.43,1948.1 v 32.86 h -18.25 v -32.86 h 18.25 m 0,-15.82 V 1769.2 l -4.87,-25.56 -4.86,-7.3 -13.39,-8.52 h -18.26 v 32.86 h 18.26 l 4.87,8.52 v 163.08 h 18.25" />
|
||||||
|
|
||||||
|
<!-- Smiley Details -->
|
||||||
|
<!-- Mouth -->
|
||||||
|
<path
|
||||||
|
android:strokeColor="#FFFF00"
|
||||||
|
android:strokeWidth="50"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:pathData="m 2778.85,1478.34 0.04,-0.02 c 21.03,-31.91 56.69,-51.12 94.91,-51.12 0.41,0 0.83,0 1.24,0.01 l -0.02,0.07 c 43.88,0.19 84.11,24.51 104.66,63.28" />
|
||||||
|
<!-- Left Eye -->
|
||||||
|
<path
|
||||||
|
android:strokeColor="#00FFFF"
|
||||||
|
android:strokeWidth="50"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:pathData="m 2820.22,1595.17 0.01,0.01 c -14.62,-1.91 -25.56,-14.37 -25.56,-29.11 0,-0.03 0,-0.07 0,-0.1 l -0.02,-0.01 c 0,-0.03 0,-0.07 0,-0.1 0,-16.09 13.04,-29.14 29.13,-29.14 0.43,0 0.87,0.01 1.29,0.03 h 3.67 0.01 c 14.61,1.91 25.55,14.37 25.55,29.11 0,0.03 0,0.07 0,0.1 l 0.02,0.01 c 0,0.04 0,0.08 0,0.12 0,16.07 -13.03,29.09 -29.09,29.09 -0.03,0 -0.08,0 -0.12,0 l -4.89,-0.01" />
|
||||||
|
<!-- Right Eye -->
|
||||||
|
<path
|
||||||
|
android:strokeColor="#00FFFF"
|
||||||
|
android:strokeWidth="50"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:pathData="m 2921.23,1569.61 v -3.65 l -0.01,-0.01 c 0,-0.27 -0.01,-0.54 -0.01,-0.81 0,-18.22 14.66,-33.05 32.87,-33.26 l 0.03,0.01 c 0.28,0 0.57,-0.01 0.84,-0.01 17.29,0 31.72,13.22 33.24,30.44 l -0.02,3.64 0.02,0.02 c 0,0.27 0.01,0.54 0.01,0.81 0,18.37 -14.9,33.28 -33.28,33.28 -0.26,0 -0.54,-0.01 -0.81,-0.02 l -0.02,-0.03 c -17.14,-0.18 -31.36,-13.34 -32.86,-30.42" />
|
||||||
|
<!-- Nose -->
|
||||||
|
<path
|
||||||
|
android:strokeColor="#FFFF00"
|
||||||
|
android:strokeWidth="50"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:pathData="m 2892.03,1528.23 -29.21,-20.68" />
|
||||||
|
<path
|
||||||
|
android:strokeColor="#FFFF00"
|
||||||
|
android:strokeWidth="50"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:pathData="m 2862.82,1507.55 h 32.86" />
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@drawable/ic_launcher_background" />
|
||||||
|
<item android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</layer-list>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@drawable/ic_launcher_background" />
|
||||||
|
<item android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</layer-list>
|
||||||
@@ -1,12 +1,18 @@
|
|||||||
package haus.nightmare.a3270
|
package haus.nightmare.a3270
|
||||||
|
|
||||||
import haus.nightmare.a3270.storage.SavedHost
|
import haus.nightmare.a3270.storage.SavedHost
|
||||||
|
import haus.nightmare.a3270.ui.getFgColorForAttribute
|
||||||
import haus.nightmare.lib3270j.ConnectionConfig
|
import haus.nightmare.lib3270j.ConnectionConfig
|
||||||
import haus.nightmare.lib3270j.TerminalModel
|
import haus.nightmare.lib3270j.TerminalModel
|
||||||
|
import haus.nightmare.lib3270j.charset.EbcdicTranslator
|
||||||
|
import haus.nightmare.lib3270j.datastream.DataStreamProcessor
|
||||||
import haus.nightmare.lib3270j.protocol.DS3270Constants.*
|
import haus.nightmare.lib3270j.protocol.DS3270Constants.*
|
||||||
|
import haus.nightmare.lib3270j.screen.ExtendedAttribute
|
||||||
|
import haus.nightmare.lib3270j.screen.ScreenBuffer
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.Assert.*
|
import org.junit.Assert.*
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
class DynamicAndParityFeaturesTest {
|
class DynamicAndParityFeaturesTest {
|
||||||
@@ -101,4 +107,73 @@ class DynamicAndParityFeaturesTest {
|
|||||||
assertTrue((num and FA_NUMERIC) != 0)
|
assertTrue((num and FA_NUMERIC) != 0)
|
||||||
assertTrue((hi and FA_INT_HIGH_SEL) == FA_INT_HIGH_SEL)
|
assertTrue((hi and FA_INT_HIGH_SEL) == FA_INT_HIGH_SEL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testCharacterAttributesPersistAcrossFields() {
|
||||||
|
val model = TerminalModel.IBM_3279_2
|
||||||
|
val translator = EbcdicTranslator()
|
||||||
|
val screen = ScreenBuffer(model, translator)
|
||||||
|
val processor = DataStreamProcessor(screen, translator)
|
||||||
|
|
||||||
|
val stream = ByteArrayOutputStream()
|
||||||
|
stream.write(CMD_EW)
|
||||||
|
stream.write(0xC3) // WCC
|
||||||
|
|
||||||
|
// SF(prot, skip)
|
||||||
|
stream.write(ORDER_SF)
|
||||||
|
stream.write(FA_PRINTABLE or FA_PROTECT or FA_NUMERIC)
|
||||||
|
|
||||||
|
// SA(yellow): XA_FOREGROUND, COLOR_YELLOW (0xF6)
|
||||||
|
stream.write(ORDER_SA)
|
||||||
|
stream.write(XA_FOREGROUND)
|
||||||
|
stream.write(0xF6)
|
||||||
|
|
||||||
|
// Data: " 4 "
|
||||||
|
stream.write(translator.stringToEbcdic(" 4 "))
|
||||||
|
|
||||||
|
// Second SF(prot, skip)
|
||||||
|
stream.write(ORDER_SF)
|
||||||
|
stream.write(FA_PRINTABLE or FA_PROTECT or FA_NUMERIC)
|
||||||
|
|
||||||
|
// Data: "DISPLAY"
|
||||||
|
stream.write(translator.stringToEbcdic("DISPLAY"))
|
||||||
|
|
||||||
|
val record = stream.toByteArray()
|
||||||
|
processor.processRecord(record, 0, record.size, true)
|
||||||
|
|
||||||
|
// " 4 " cells (indices 1..5) should have yellow foreground (0xF6)
|
||||||
|
for (i in 1..5) {
|
||||||
|
assertEquals(0xF6.toByte(), screen.getCell(i).fg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Across second SF, "DISPLAY" cells (indices 7..13) must retain yellow foreground (0xF6) (commit c28c097e)
|
||||||
|
for (i in 7..13) {
|
||||||
|
assertEquals(0xF6.toByte(), screen.getCell(i).fg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testTerminalViewColorResolutionForProtectedField() {
|
||||||
|
val ea = ExtendedAttribute()
|
||||||
|
// Normal protected field attribute -> Turquoise / Cyan (0x00FFFF)
|
||||||
|
val protNormalColor = getFgColorForAttribute(ea, null, (FA_PRINTABLE or FA_PROTECT).toByte())
|
||||||
|
assertEquals(androidx.compose.ui.graphics.Color(0xFF00FFFF), protNormalColor)
|
||||||
|
|
||||||
|
// Intensified protected field attribute -> White (0xFFC0C0C0 per HOST_COLOR_WHITE / HoD palette)
|
||||||
|
val protHighColor = getFgColorForAttribute(ea, null, (FA_PRINTABLE or FA_PROTECT or FA_INT_HIGH_SEL).toByte())
|
||||||
|
assertEquals(androidx.compose.ui.graphics.Color(0xFFC0C0C0), protHighColor)
|
||||||
|
|
||||||
|
// Normal unprotected -> Green (0x00FF00)
|
||||||
|
val unprotNormalColor = getFgColorForAttribute(ea, null, FA_PRINTABLE.toByte())
|
||||||
|
assertEquals(androidx.compose.ui.graphics.Color(0xFF00FF00), unprotNormalColor)
|
||||||
|
|
||||||
|
// Intensified unprotected -> Red (0xFF0000)
|
||||||
|
val unprotHighColor = getFgColorForAttribute(ea, null, (FA_PRINTABLE or FA_INT_HIGH_SEL).toByte())
|
||||||
|
assertEquals(androidx.compose.ui.graphics.Color(0xFFFF0000), unprotHighColor)
|
||||||
|
|
||||||
|
// Character mode override (SA yellow = 0xF6)
|
||||||
|
ea.fg = 0xF6.toByte()
|
||||||
|
val yellowColor = getFgColorForAttribute(ea, null, (FA_PRINTABLE or FA_PROTECT).toByte())
|
||||||
|
assertEquals(androidx.compose.ui.graphics.Color(0xFFFFFF00), yellowColor)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import haus.nightmare.lib3270j.TerminalModel
|
|||||||
import haus.nightmare.lib3270j.charset.EbcdicTranslator
|
import haus.nightmare.lib3270j.charset.EbcdicTranslator
|
||||||
import haus.nightmare.lib3270j.ecl.ECLConstants
|
import haus.nightmare.lib3270j.ecl.ECLConstants
|
||||||
import haus.nightmare.lib3270j.ecl.ECLOIA
|
import haus.nightmare.lib3270j.ecl.ECLOIA
|
||||||
|
import haus.nightmare.lib3270j.ecl.ECLPS
|
||||||
import haus.nightmare.lib3270j.input.InputProcessor
|
import haus.nightmare.lib3270j.input.InputProcessor
|
||||||
import haus.nightmare.lib3270j.protocol.DS3270Constants.*
|
import haus.nightmare.lib3270j.protocol.DS3270Constants.*
|
||||||
import haus.nightmare.lib3270j.screen.ScreenBuffer
|
import haus.nightmare.lib3270j.screen.ScreenBuffer
|
||||||
@@ -191,6 +192,13 @@ class EntryAssistAndModesTest {
|
|||||||
@Test
|
@Test
|
||||||
fun testIniSectionSyntaxMatchingJ3270() {
|
fun testIniSectionSyntaxMatchingJ3270() {
|
||||||
val sampleIni = """
|
val sampleIni = """
|
||||||
|
[behavior]
|
||||||
|
blockSelectMode = false
|
||||||
|
blockPaste = true
|
||||||
|
|
||||||
|
[clipboard]
|
||||||
|
blockPasteMode = true
|
||||||
|
|
||||||
[entryassist]
|
[entryassist]
|
||||||
docMode = true
|
docMode = true
|
||||||
wordWrap = true
|
wordWrap = true
|
||||||
@@ -223,6 +231,10 @@ class EntryAssistAndModesTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assertEquals("false", parsed["behavior.blockselectmode"])
|
||||||
|
assertEquals("true", parsed["behavior.blockpaste"])
|
||||||
|
assertEquals("true", parsed["clipboard.blockpastemode"])
|
||||||
|
|
||||||
assertEquals("true", parsed["entryassist.docmode"])
|
assertEquals("true", parsed["entryassist.docmode"])
|
||||||
assertEquals("true", parsed["entryassist.wordwrap"])
|
assertEquals("true", parsed["entryassist.wordwrap"])
|
||||||
assertEquals("5", parsed["entryassist.startcol"])
|
assertEquals("5", parsed["entryassist.startcol"])
|
||||||
@@ -237,6 +249,57 @@ class EntryAssistAndModesTest {
|
|||||||
assertEquals("true", parsed["modes.autoskip"])
|
assertEquals("true", parsed["modes.autoskip"])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testBlockPasteMultiLineAlignment() {
|
||||||
|
val translator = EbcdicTranslator()
|
||||||
|
val screen = ScreenBuffer(TerminalModel.IBM_3278_2, translator)
|
||||||
|
val input = InputProcessor(screen, translator, null)
|
||||||
|
val ps = ECLPS(screen, input, translator)
|
||||||
|
|
||||||
|
// Verify default blockPaste is true
|
||||||
|
assertTrue(input.isBlockPaste)
|
||||||
|
assertTrue(ps.isBlockPaste)
|
||||||
|
|
||||||
|
// 1. Unformatted screen: verify start column 15 is preserved across newlines
|
||||||
|
screen.erase(false)
|
||||||
|
val startPos = screen.rowColToAddress(0, 15)
|
||||||
|
screen.cursorAddress = startPos
|
||||||
|
|
||||||
|
val multilineText = "FIRST\nSECOND\nTHIRD"
|
||||||
|
val pasted = input.pasteText(multilineText, true, false, true)
|
||||||
|
assertEquals(16, pasted)
|
||||||
|
|
||||||
|
assertEquals("FIRST", ps.getString(startPos, 5))
|
||||||
|
val row1Col15 = screen.rowColToAddress(1, 15)
|
||||||
|
assertEquals("SECOND", ps.getString(row1Col15, 6))
|
||||||
|
val row2Col15 = screen.rowColToAddress(2, 15)
|
||||||
|
assertEquals("THIRD", ps.getString(row2Col15, 5))
|
||||||
|
|
||||||
|
// 2. Formatted screen with blockPaste = true
|
||||||
|
screen.erase(false)
|
||||||
|
screen.setFieldAttribute(0, FA_PRINTABLE.toByte())
|
||||||
|
screen.setFieldAttribute(80, FA_PRINTABLE.toByte())
|
||||||
|
screen.setFieldAttribute(160, FA_PRINTABLE.toByte())
|
||||||
|
|
||||||
|
screen.cursorAddress = screen.rowColToAddress(0, 25)
|
||||||
|
val pastedFormatted = input.pasteText("ALPHA\r\nBETA\r\nGAMMA", true, false, true)
|
||||||
|
assertEquals(14, pastedFormatted)
|
||||||
|
|
||||||
|
assertEquals("ALPHA", ps.getString(screen.rowColToAddress(0, 25), 5))
|
||||||
|
assertEquals("BETA", ps.getString(screen.rowColToAddress(1, 25), 4))
|
||||||
|
assertEquals("GAMMA", ps.getString(screen.rowColToAddress(2, 25), 5))
|
||||||
|
|
||||||
|
// 3. Formatted screen with blockPaste = false: reverts to first unprotected field on next row (pos 81)
|
||||||
|
screen.erase(false)
|
||||||
|
screen.setFieldAttribute(0, FA_PRINTABLE.toByte())
|
||||||
|
screen.setFieldAttribute(80, FA_PRINTABLE.toByte())
|
||||||
|
screen.cursorAddress = screen.rowColToAddress(0, 25)
|
||||||
|
input.pasteText("LINE1\nLINE2", true, false, false)
|
||||||
|
|
||||||
|
assertEquals("LINE1", ps.getString(screen.rowColToAddress(0, 25), 5))
|
||||||
|
assertEquals("LINE2", ps.getString(81, 5))
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCmsFilenameFormatting() {
|
fun testCmsFilenameFormatting() {
|
||||||
// Upload (local -> host)
|
// Upload (local -> host)
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import haus.nightmare.lib3270j.datastream.DataStreamProcessor
|
|||||||
import haus.nightmare.lib3270j.graphics.GocaDecoder
|
import haus.nightmare.lib3270j.graphics.GocaDecoder
|
||||||
import haus.nightmare.lib3270j.graphics.GraphicsPlane
|
import haus.nightmare.lib3270j.graphics.GraphicsPlane
|
||||||
import haus.nightmare.lib3270j.input.InputProcessor
|
import haus.nightmare.lib3270j.input.InputProcessor
|
||||||
|
import haus.nightmare.lib3270j.graphics.GocaConstants
|
||||||
|
import haus.nightmare.a3270.ui.calculateGridMetrics
|
||||||
import haus.nightmare.lib3270j.protocol.DS3270Constants.*
|
import haus.nightmare.lib3270j.protocol.DS3270Constants.*
|
||||||
import haus.nightmare.lib3270j.protocol.TelnetConstants.*
|
import haus.nightmare.lib3270j.protocol.TelnetConstants.*
|
||||||
import haus.nightmare.lib3270j.protocol.TN3270EConstants.*
|
import haus.nightmare.lib3270j.protocol.TN3270EConstants.*
|
||||||
@@ -175,4 +177,120 @@ class GraphicsAndSysReqTest {
|
|||||||
inputProcessor.sendAid(AID_SYSREQ)
|
inputProcessor.sendAid(AID_SYSREQ)
|
||||||
assertEquals(ConnectionState.CONNECTED_TN3270E, fsm.connectionState)
|
assertEquals(ConnectionState.CONNECTED_TN3270E, fsm.connectionState)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testImonGddmImageRenderingAndCompatibility() {
|
||||||
|
val hasSetCharDimensions = try {
|
||||||
|
GraphicsPlane::class.java.getMethod("setCharDimensions", Int::class.javaPrimitiveType, Int::class.javaPrimitiveType)
|
||||||
|
true
|
||||||
|
} catch (_: NoSuchMethodException) {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasSetCharDimensions) {
|
||||||
|
// Commit c28c097e compatibility: standard 720x384 graphics plane verification
|
||||||
|
val plane = GraphicsPlane(720, 384)
|
||||||
|
plane.setScreenDimensions(80, 24)
|
||||||
|
val decoder = GocaDecoder(plane)
|
||||||
|
assertEquals(720, plane.totalWidth)
|
||||||
|
assertEquals(384, plane.totalHeight)
|
||||||
|
|
||||||
|
val out = ByteArrayOutputStream()
|
||||||
|
out.write(GocaConstants.G_GSCP)
|
||||||
|
out.write(0x04)
|
||||||
|
out.write(0x00); out.write(0x10) // X = 16
|
||||||
|
out.write(0x00); out.write(0x10) // Y = 16
|
||||||
|
out.write(GocaConstants.G_GSCOL)
|
||||||
|
out.write(0x01)
|
||||||
|
decoder.decodeStream(out.toByteArray(), 0, out.size())
|
||||||
|
val metrics = calculateGridMetrics(1080f, 1920f, 80, 24)
|
||||||
|
assertTrue(metrics.gridWidth > 0f)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit bdfe6eec: full IMON GDDM image rendering verification
|
||||||
|
val plane = GraphicsPlane(1040, 1118)
|
||||||
|
val setDims = GraphicsPlane::class.java.getMethod("setCharDimensions", Int::class.javaPrimitiveType, Int::class.javaPrimitiveType)
|
||||||
|
setDims.invoke(plane, 13, 26)
|
||||||
|
plane.setScreenDimensions(80, 43)
|
||||||
|
val decoder = GocaDecoder(plane)
|
||||||
|
|
||||||
|
assertEquals(1040, plane.totalWidth)
|
||||||
|
assertEquals(1118, plane.totalHeight)
|
||||||
|
assertEquals(520, plane.xMax)
|
||||||
|
assertEquals(558, plane.yMax)
|
||||||
|
|
||||||
|
val out = ByteArrayOutputStream()
|
||||||
|
// GSCP: Set Current Position (377, 494)
|
||||||
|
out.write(GocaConstants.G_GSCP)
|
||||||
|
out.write(0x04)
|
||||||
|
out.write(0x01); out.write(0x79) // X = 377
|
||||||
|
out.write(0x01); out.write(0xEE) // Y = 494
|
||||||
|
|
||||||
|
// GSCOL: Color 1 = Blue
|
||||||
|
out.write(GocaConstants.G_GSCOL)
|
||||||
|
out.write(0x01)
|
||||||
|
|
||||||
|
// G_GBIMGC (0x91): Begin Image Current Position: len=6, flags=0, w=80, h=80
|
||||||
|
out.write(GocaConstants.G_GBIMGC)
|
||||||
|
out.write(0x06)
|
||||||
|
out.write(0x00); out.write(0x00)
|
||||||
|
out.write(0x00); out.write(0x50) // w = 80
|
||||||
|
out.write(0x00); out.write(0x50) // h = 80
|
||||||
|
|
||||||
|
// G_GIMD (0x92): 10 bytes scanline
|
||||||
|
out.write(GocaConstants.G_GIMD)
|
||||||
|
out.write(0x0A)
|
||||||
|
out.write(byteArrayOf(0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte()))
|
||||||
|
|
||||||
|
// G_GEIMG (0x93): End Image with 2-byte operand
|
||||||
|
out.write(GocaConstants.G_GEIMG)
|
||||||
|
out.write(0x02)
|
||||||
|
out.write(0x00); out.write(0x00)
|
||||||
|
|
||||||
|
// Second image tile: Color 2 = Red
|
||||||
|
out.write(GocaConstants.G_GSCOL)
|
||||||
|
out.write(0x02)
|
||||||
|
|
||||||
|
out.write(GocaConstants.G_GBIMGC)
|
||||||
|
out.write(0x06)
|
||||||
|
out.write(0x00); out.write(0x00)
|
||||||
|
out.write(0x00); out.write(0x50)
|
||||||
|
out.write(0x00); out.write(0x50)
|
||||||
|
|
||||||
|
out.write(GocaConstants.G_GIMD)
|
||||||
|
out.write(0x0A)
|
||||||
|
out.write(byteArrayOf(0xAA.toByte(), 0xAA.toByte(), 0xAA.toByte(), 0xAA.toByte(), 0xAA.toByte(), 0xAA.toByte(), 0xAA.toByte(), 0xAA.toByte(), 0xAA.toByte(), 0xAA.toByte()))
|
||||||
|
|
||||||
|
out.write(GocaConstants.G_GEIMG)
|
||||||
|
out.write(0x02)
|
||||||
|
out.write(0x00); out.write(0x00)
|
||||||
|
|
||||||
|
val stream = out.toByteArray()
|
||||||
|
decoder.decodeStream(stream, 0, stream.size)
|
||||||
|
|
||||||
|
assertTrue(plane.hasContent())
|
||||||
|
val mappedX = plane.mapX(377)
|
||||||
|
val mappedY = plane.mapY(494)
|
||||||
|
assertEquals(897, mappedX)
|
||||||
|
assertEquals(64, mappedY)
|
||||||
|
|
||||||
|
val rgb = plane.rgbBuffer
|
||||||
|
assertNotNull(rgb)
|
||||||
|
val pixelAtImg = rgb[mappedY * 1040 + mappedX]
|
||||||
|
assertNotEquals(0, pixelAtImg)
|
||||||
|
|
||||||
|
// Verify grid metrics and UI scaling calculation against IMON canvas
|
||||||
|
val metrics = calculateGridMetrics(1080f, 1920f, 80, 43)
|
||||||
|
assertTrue(metrics.gridWidth > 0f)
|
||||||
|
assertTrue(metrics.gridHeight > 0f)
|
||||||
|
|
||||||
|
// Touch scaling test: touch in the middle of grid maps accurately to plane coordinates
|
||||||
|
val touchScreenX = metrics.offsetX + metrics.gridWidth / 2f
|
||||||
|
val touchScreenY = metrics.offsetY + metrics.gridHeight / 2f
|
||||||
|
val planeX = (((touchScreenX - metrics.offsetX) * plane.canvasWidth) / metrics.gridWidth).toInt()
|
||||||
|
val planeY = (((touchScreenY - metrics.offsetY) * plane.canvasHeight) / metrics.gridHeight).toInt()
|
||||||
|
assertEquals(plane.canvasWidth / 2, planeX)
|
||||||
|
assertEquals(plane.canvasHeight / 2, planeY)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,195 @@
|
|||||||
|
package haus.nightmare.a3270
|
||||||
|
|
||||||
|
import haus.nightmare.a3270.storage.AppSettings
|
||||||
|
import haus.nightmare.a3270.ui.HotspotEngine
|
||||||
|
import haus.nightmare.a3270.ui.HotspotEngine.HotspotType
|
||||||
|
import haus.nightmare.lib3270j.TerminalModel
|
||||||
|
import haus.nightmare.lib3270j.charset.EbcdicTranslator
|
||||||
|
import haus.nightmare.lib3270j.protocol.DS3270Constants.*
|
||||||
|
import haus.nightmare.lib3270j.screen.ExtendedAttribute
|
||||||
|
import haus.nightmare.lib3270j.screen.ScreenBuffer
|
||||||
|
import haus.nightmare.lib3270j.screen.ScreenHistoryBuffer
|
||||||
|
import org.junit.Assert.*
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
class HotspotAndHistoryFeaturesTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testHotspotUrlDetection() {
|
||||||
|
val engine = HotspotEngine()
|
||||||
|
val text = "Visit https://ibm.com/support or http://example.org:8080/test for help"
|
||||||
|
val hotspots = engine.scanText(text, rows = 1, cols = text.length)
|
||||||
|
|
||||||
|
val urls = hotspots.filter { it.type == HotspotType.URL }
|
||||||
|
assertEquals(2, urls.size)
|
||||||
|
assertEquals("https://ibm.com/support", urls[0].action)
|
||||||
|
assertEquals("http://example.org:8080/test", urls[1].action)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testHotspotPfAndPaKeyDetection() {
|
||||||
|
val engine = HotspotEngine()
|
||||||
|
val text = "Press PF3 to Exit, PF12 to Cancel, F1 for Help, and PA1 for Attention"
|
||||||
|
val hotspots = engine.scanText(text, rows = 1, cols = text.length)
|
||||||
|
|
||||||
|
val pfHotspots = hotspots.filter { it.type == HotspotType.PF_KEY }
|
||||||
|
assertTrue(pfHotspots.any { it.action == "[pf3]" && it.text.equals("PF3", ignoreCase = true) })
|
||||||
|
assertTrue(pfHotspots.any { it.action == "[pf12]" && it.text.equals("PF12", ignoreCase = true) })
|
||||||
|
assertTrue(pfHotspots.any { it.action == "[pf1]" && it.text.equals("F1", ignoreCase = true) })
|
||||||
|
assertTrue(pfHotspots.any { it.action == "[pa1]" && it.text.equals("PA1", ignoreCase = true) })
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testHotspotMenuChoiceAndEnterDetection() {
|
||||||
|
val engine = HotspotEngine()
|
||||||
|
val text = "1. Logon\n2. Logoff\n===> 3\n[Enter] to submit"
|
||||||
|
val hotspots = engine.scanText(text, rows = 4, cols = 30)
|
||||||
|
|
||||||
|
val menuChoices = hotspots.filter { it.type == HotspotType.MENU_CHOICE }
|
||||||
|
assertTrue(menuChoices.any { it.action == "1[enter]" })
|
||||||
|
assertTrue(menuChoices.any { it.action == "2[enter]" })
|
||||||
|
assertTrue(menuChoices.any { it.action == "3[enter]" })
|
||||||
|
|
||||||
|
val enterHotspots = hotspots.filter { it.type == HotspotType.ENTER }
|
||||||
|
assertTrue(enterHotspots.any { it.action == "[enter]" })
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testHotspotHitTesting() {
|
||||||
|
val engine = HotspotEngine()
|
||||||
|
val text = "Row 0: PF7 Backward PF8 Forward "
|
||||||
|
val hotspots = engine.scanText(text, rows = 1, cols = text.length)
|
||||||
|
|
||||||
|
val pf7 = hotspots.find { it.action == "[pf7]" }
|
||||||
|
assertNotNull(pf7)
|
||||||
|
val hit = engine.findHotspotAt(hotspots, 0, pf7!!.startCol + 1)
|
||||||
|
assertNotNull(hit)
|
||||||
|
assertEquals("[pf7]", hit?.action)
|
||||||
|
|
||||||
|
// Pointing outside any hotspot returns null
|
||||||
|
val miss = engine.findHotspotAt(hotspots, 0, 0)
|
||||||
|
assertNull(miss)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testHotspotCategoryDisabling() {
|
||||||
|
val engine = HotspotEngine()
|
||||||
|
val text = "Visit https://example.com or press PF3 or choose 1. Option"
|
||||||
|
|
||||||
|
// Master toggle disabled
|
||||||
|
val disabledScan = engine.scanText(text, rows = 1, cols = text.length, enabled = false)
|
||||||
|
assertTrue(disabledScan.isEmpty())
|
||||||
|
|
||||||
|
// Disable URLs only
|
||||||
|
engine.urlEnabled = false
|
||||||
|
engine.pfKeysEnabled = true
|
||||||
|
engine.menuChoicesEnabled = true
|
||||||
|
val noUrls = engine.scanText(text, rows = 1, cols = text.length, enabled = true)
|
||||||
|
assertTrue(noUrls.none { it.type == HotspotType.URL })
|
||||||
|
assertTrue(noUrls.any { it.type == HotspotType.PF_KEY })
|
||||||
|
|
||||||
|
// Disable PF keys only
|
||||||
|
engine.urlEnabled = true
|
||||||
|
engine.pfKeysEnabled = false
|
||||||
|
val noPfs = engine.scanText(text, rows = 1, cols = text.length, enabled = true)
|
||||||
|
assertTrue(noPfs.none { it.type == HotspotType.PF_KEY })
|
||||||
|
assertTrue(noPfs.any { it.type == HotspotType.URL })
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testScreenHistoryBufferCapturesSnapshots() {
|
||||||
|
val translator = EbcdicTranslator()
|
||||||
|
val screen = ScreenBuffer(TerminalModel.IBM_3279_2, translator)
|
||||||
|
val history = screen.historyBuffer
|
||||||
|
|
||||||
|
assertNotNull(history)
|
||||||
|
assertEquals(0, history.size())
|
||||||
|
|
||||||
|
// Write first screen
|
||||||
|
screen.setCursorPosition(0, 0)
|
||||||
|
screen.setChar(0, 0, 'A')
|
||||||
|
screen.setChar(0, 1, 'B')
|
||||||
|
screen.setChar(0, 2, 'C')
|
||||||
|
history.snapshot(screen)
|
||||||
|
|
||||||
|
assertEquals(1, history.size())
|
||||||
|
val snap0 = history.get(0)
|
||||||
|
assertNotNull(snap0)
|
||||||
|
assertEquals('A', snap0?.getChar(0, 0))
|
||||||
|
assertEquals('B', snap0?.getChar(0, 1))
|
||||||
|
assertEquals('C', snap0?.getChar(0, 2))
|
||||||
|
|
||||||
|
// Consecutive identical snapshot is suppressed
|
||||||
|
history.snapshot(screen)
|
||||||
|
assertEquals(1, history.size())
|
||||||
|
|
||||||
|
// Modify screen and take second snapshot
|
||||||
|
screen.setChar(0, 0, 'X')
|
||||||
|
history.snapshot(screen)
|
||||||
|
assertEquals(2, history.size())
|
||||||
|
assertEquals('X', history.get(1)?.getChar(0, 0))
|
||||||
|
|
||||||
|
// Verify table formatting
|
||||||
|
val formattedTable = snap0?.formattedTable
|
||||||
|
assertNotNull(formattedTable)
|
||||||
|
assertTrue(formattedTable!!.startsWith("ABC"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testFieldOutliningConstantsAndAttribute() {
|
||||||
|
assertEquals(0x01.toByte(), ExtendedAttribute.OL_UNDERLINE)
|
||||||
|
assertEquals(0x02.toByte(), ExtendedAttribute.OL_RIGHT)
|
||||||
|
assertEquals(0x04.toByte(), ExtendedAttribute.OL_OVERLINE)
|
||||||
|
assertEquals(0x08.toByte(), ExtendedAttribute.OL_LEFT)
|
||||||
|
assertEquals(0x0F.toByte(), ExtendedAttribute.OL_BOX)
|
||||||
|
|
||||||
|
val ea = ExtendedAttribute()
|
||||||
|
ea.ol = ExtendedAttribute.OL_BOX
|
||||||
|
assertEquals(ExtendedAttribute.OL_BOX, ea.ol)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testAppSettingsIniRoundtripWithHotspotsAndSelectionPreferences() {
|
||||||
|
// Check that default for hotspots is false (disabled for touch screens)
|
||||||
|
val testIni = """
|
||||||
|
[behavior]
|
||||||
|
hotspots_enabled=false
|
||||||
|
trim_rect_sizing_handles=true
|
||||||
|
trim_rect_remain_after_edit=true
|
||||||
|
paste_word_break=false
|
||||||
|
|
||||||
|
[hotspots]
|
||||||
|
url=true
|
||||||
|
pf_keys=true
|
||||||
|
menu_choices=false
|
||||||
|
""".trimIndent()
|
||||||
|
|
||||||
|
var hsEnabled: Boolean? = null
|
||||||
|
var trimHandles: Boolean? = null
|
||||||
|
var trimRemain: Boolean? = null
|
||||||
|
var wordBreak: Boolean? = null
|
||||||
|
var hsUrl: Boolean? = null
|
||||||
|
var hsPf: Boolean? = null
|
||||||
|
var hsChoices: Boolean? = null
|
||||||
|
|
||||||
|
AppSettings.parseIni(java.io.StringReader(testIni)) { _, k, v ->
|
||||||
|
when (k) {
|
||||||
|
"hotspots_enabled" -> hsEnabled = v.toBoolean()
|
||||||
|
"trim_rect_sizing_handles" -> trimHandles = v.toBoolean()
|
||||||
|
"trim_rect_remain_after_edit" -> trimRemain = v.toBoolean()
|
||||||
|
"paste_word_break" -> wordBreak = v.toBoolean()
|
||||||
|
"hotspots_url_enabled", "url" -> hsUrl = v.toBoolean()
|
||||||
|
"hotspots_pf_enabled", "pf_keys" -> hsPf = v.toBoolean()
|
||||||
|
"hotspots_menu_choices_enabled", "menu_choices" -> hsChoices = v.toBoolean()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assertEquals(false, hsEnabled)
|
||||||
|
assertEquals(true, trimHandles)
|
||||||
|
assertEquals(true, trimRemain)
|
||||||
|
assertEquals(false, wordBreak)
|
||||||
|
assertEquals(true, hsUrl)
|
||||||
|
assertEquals(true, hsPf)
|
||||||
|
assertEquals(false, hsChoices)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user