mirror of
https://github.com/OrbTools/OrbBind
synced 2024-10-31 03:20:26 +00:00
Merge branch 'main' of github.com:OrbTools/OrbBind
This commit is contained in:
commit
fe6765e81d
11
.github/FUNDING.yml
vendored
11
.github/FUNDING.yml
vendored
@ -1,12 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: minizbot # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
github: [minizbot2012]
|
||||
|
18
go.mod
18
go.mod
@ -3,16 +3,18 @@ module github.com/OrbTools/OrbBind
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
fyne.io/fyne v1.4.3
|
||||
github.com/OrbTools/OrbCommon v0.0.0-20210210190718-26987f35f7fe
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20201108214237-06ea97f0c265 // indirect
|
||||
fyne.io/fyne/v2 v2.0.3
|
||||
github.com/OrbTools/OrbCommon v0.0.0-20210604213605-2c1ec68f6f91
|
||||
github.com/fyne-io/mobile v0.1.3-0.20210524083716-78f416561547 // indirect
|
||||
github.com/go-gl/gl v0.0.0-20210501111010-69f74958bac0 // indirect
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210715014612-ab6297867137 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/srwiley/oksvg v0.0.0-20210209000435-a757b9cbd472 // indirect
|
||||
github.com/srwiley/oksvg v0.0.0-20210519022825-9fc0c575d5fe // indirect
|
||||
github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780 // indirect
|
||||
github.com/stretchr/testify v1.7.0 // indirect
|
||||
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb // indirect
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
|
||||
golang.org/x/sys v0.0.0-20210301091718-77cc2087c03b // indirect
|
||||
golang.org/x/text v0.3.5 // indirect
|
||||
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d // indirect
|
||||
golang.org/x/net v0.0.0-20210716203947-853a461950ff // indirect
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
)
|
||||
|
54
go.sum
54
go.sum
@ -1,24 +1,28 @@
|
||||
fyne.io/fyne v1.4.3 h1:356CnXCiYrrfaLGsB7qLK3c6ktzyh8WR05v/2RBu51I=
|
||||
fyne.io/fyne v1.4.3/go.mod h1:8kiPBNSDmuplxs9WnKCkaWYqbcXFy0DeAzwa6PBO9Z8=
|
||||
fyne.io/fyne/v2 v2.0.3 h1:qzd2uLLrAVrNeqnLY44QZCsMxZwjoo1my+lMzHicMXY=
|
||||
fyne.io/fyne/v2 v2.0.3/go.mod h1:nNpgL7sZkDVLraGtQII2ArNRnnl6kHup/KfQRxIhbvs=
|
||||
github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9/go.mod h1:7uhhqiBaR4CpN0k9rMjOtjpcfGd6DG2m04zQxKnWQ0I=
|
||||
github.com/OrbTools/OrbCommon v0.0.0-20210210190718-26987f35f7fe h1:hypW2DMdummU8SiitR67h2pUwVpcOSfEKU8E0KZCCys=
|
||||
github.com/OrbTools/OrbCommon v0.0.0-20210210190718-26987f35f7fe/go.mod h1:ErdpS2Y/8Ik89IDNsH+yaOWo/XcKzf4riEBfPG3xK+o=
|
||||
github.com/OrbTools/OrbCommon v0.0.0-20210604213605-2c1ec68f6f91 h1:zsCP3Xou+cciiCjs/hTT5Ecr9WT1X0mIsfX4MR0nYW8=
|
||||
github.com/OrbTools/OrbCommon v0.0.0-20210604213605-2c1ec68f6f91/go.mod h1:8HEhD7wF9Fqritt/jYxDmjbxEScWhFfVajdYdPO5Y14=
|
||||
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3 h1:FDqhDm7pcsLhhWl1QtD8vlzI4mm59llRvNzrFg6/LAA=
|
||||
github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3/go.mod h1:CzM2G82Q9BDUvMTGHnXf/6OExw/Dz2ivDj48nVg7Lg8=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/fyne-io/mobile v0.1.2 h1:0HaXDtOOwyOTn3Umi0uKVCOgJtfX73c6unC4U8i5VZU=
|
||||
github.com/fyne-io/mobile v0.1.2/go.mod h1:/kOrWrZB6sasLbEy2JIvr4arEzQTXBTZGb3Y96yWbHY=
|
||||
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 h1:SCYMcCJ89LjRGwEa0tRluNRiMjZHalQZrVrvTbPh+qw=
|
||||
github.com/fyne-io/mobile v0.1.3-0.20210412090810-650a3139866a/go.mod h1:/kOrWrZB6sasLbEy2JIvr4arEzQTXBTZGb3Y96yWbHY=
|
||||
github.com/fyne-io/mobile v0.1.3-0.20210524083716-78f416561547 h1:q3mR3AT73LxwifSK+gNEQFweMiKLXt3p373X5xbIK+4=
|
||||
github.com/fyne-io/mobile v0.1.3-0.20210524083716-78f416561547/go.mod h1:/kOrWrZB6sasLbEy2JIvr4arEzQTXBTZGb3Y96yWbHY=
|
||||
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200625191551-73d3c3675aa3/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20201108214237-06ea97f0c265 h1:BcbKYUZo/TKPsiSh7LymK3p+TNAJJW3OfGO/21sBbiA=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20201108214237-06ea97f0c265/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME=
|
||||
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/go-gl/gl v0.0.0-20210501111010-69f74958bac0 h1:7xNa69TzlTrKtlBtE4yyNRFP9oqAneXAs9oKJkVOECs=
|
||||
github.com/go-gl/gl v0.0.0-20210501111010-69f74958bac0/go.mod h1:wjpnOv6ONl2SuJSxqCPVaPZibGFdSci9HFocT9qtVYM=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210715014612-ab6297867137 h1:nkvwT/9HzcHRekrCaLk/a4At+RNwr6lu6rl28kBDQ+Q=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210715014612-ab6297867137/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff h1:W71vTCKoxtdXgnm1ECDFkfQnpdqAO00zzGXLA5yaEX8=
|
||||
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff/go.mod h1:wfqRWLHRBsRgkp5dmbG56SA0DmVtwrF5N3oPdI8t+Aw=
|
||||
github.com/jackmordaunt/icns v0.0.0-20181231085925-4f16af745526/go.mod h1:UQkeMHVoNcyXYq9otUupF7/h/2tmHlhrS2zw7ZVvUqc=
|
||||
@ -39,11 +43,13 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564/go.mod h1:afMbS0qvv1m5tfENCwnOdZGOF8RGR/FsZ7bvBxQGZG4=
|
||||
github.com/srwiley/oksvg v0.0.0-20210209000435-a757b9cbd472 h1:wjPUVI4pltNGVSisFNXN4LNjAnkFlT8c6f1sZPPOCLg=
|
||||
github.com/srwiley/oksvg v0.0.0-20210209000435-a757b9cbd472/go.mod h1:afMbS0qvv1m5tfENCwnOdZGOF8RGR/FsZ7bvBxQGZG4=
|
||||
github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9 h1:m59mIOBO4kfcNCEzJNy71UkeF4XIx2EVmL9KLwDQdmM=
|
||||
github.com/srwiley/oksvg v0.0.0-20210519022825-9fc0c575d5fe h1:J5Ga/gb+4/WgJBupg9Fp8F6JQnUT3UF+asoTweLi9Jc=
|
||||
github.com/srwiley/oksvg v0.0.0-20210519022825-9fc0c575d5fe/go.mod h1:afMbS0qvv1m5tfENCwnOdZGOF8RGR/FsZ7bvBxQGZG4=
|
||||
github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9/go.mod h1:mvWM0+15UqyrFKqdRjY6LuAVJR0HOVhJlEgZ5JWtSWU=
|
||||
github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780 h1:oDMiXaTMyBEuZMU53atpxqYsSB3U1CHkeAu2zr6wTeY=
|
||||
github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780/go.mod h1:mvWM0+15UqyrFKqdRjY6LuAVJR0HOVhJlEgZ5JWtSWU=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
@ -52,15 +58,15 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb h1:fqpd0EBDzlHRCjiphRR5Zo/RSWWQlWv34418dnEixWk=
|
||||
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d h1:RNPAfi2nHY7C2srAV8A49jpsYr0ADedCk1wq6fTMTvs=
|
||||
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210716203947-853a461950ff h1:j2EK/QoxYNBsXI4R7fQkkRUk8y6wnOBI+6hgPdP/6Ds=
|
||||
golang.org/x/net v0.0.0-20210716203947-853a461950ff/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@ -69,14 +75,14 @@ golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200720211630-cb9d2d5c5666/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210301091718-77cc2087c03b h1:kHlr0tATeLRMEiZJu5CknOw/E8V6h69sXXQFGoPtjcc=
|
||||
golang.org/x/sys v0.0.0-20210301091718-77cc2087c03b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
|
||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190808195139-e713427fea3f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
|
131
keys/cki2.go
131
keys/cki2.go
@ -1,131 +0,0 @@
|
||||
package keys
|
||||
|
||||
// Common Interface 2, natified go
|
||||
import (
|
||||
"fyne.io/fyne"
|
||||
"fyne.io/fyne/driver/desktop"
|
||||
)
|
||||
|
||||
//ASCIIToKC -- ASCII Value to a KBD Scancode
|
||||
var ASCIIToKC = map[rune]Code{
|
||||
'a': CodeA,
|
||||
'b': CodeB,
|
||||
'c': CodeC,
|
||||
'd': CodeD,
|
||||
'e': CodeE,
|
||||
'f': CodeF,
|
||||
'g': CodeG,
|
||||
'h': CodeH,
|
||||
'i': CodeI,
|
||||
'k': CodeK,
|
||||
'l': CodeL,
|
||||
'm': CodeM,
|
||||
'n': CodeN,
|
||||
'o': CodeO,
|
||||
'p': CodeP,
|
||||
'q': CodeQ,
|
||||
'r': CodeR,
|
||||
's': CodeS,
|
||||
't': CodeT,
|
||||
'u': CodeU,
|
||||
'v': CodeV,
|
||||
'w': CodeW,
|
||||
'x': CodeX,
|
||||
'y': CodeY,
|
||||
'z': CodeZ,
|
||||
'0': Code0,
|
||||
'1': Code1,
|
||||
'2': Code2,
|
||||
'3': Code3,
|
||||
'4': Code4,
|
||||
'5': Code5,
|
||||
'6': Code6,
|
||||
'7': Code7,
|
||||
'8': Code8,
|
||||
'9': Code9,
|
||||
' ': CodeSpace,
|
||||
'-': CodeMinus,
|
||||
'=': CodeEqual,
|
||||
'[': CodeLeftBrack,
|
||||
']': CodeRightBrace,
|
||||
'\\': CodeBackslash,
|
||||
';': CodeSemicolon,
|
||||
'\'': CodeApostrophe,
|
||||
'`': CodeGrave,
|
||||
',': CodeComma,
|
||||
'.': CodeDot,
|
||||
'/': CodeSlash,
|
||||
}
|
||||
|
||||
//FyneToKC - conversion between fyne to ode
|
||||
var FyneToKC = map[fyne.KeyName]Code{
|
||||
fyne.Key0: Code0,
|
||||
fyne.Key1: Code1,
|
||||
fyne.Key2: Code2,
|
||||
fyne.Key3: Code3,
|
||||
fyne.Key4: Code4,
|
||||
fyne.Key5: Code5,
|
||||
fyne.Key6: Code6,
|
||||
fyne.Key7: Code7,
|
||||
fyne.Key8: Code8,
|
||||
fyne.Key9: Code9,
|
||||
fyne.KeyA: CodeA,
|
||||
fyne.KeyB: CodeB,
|
||||
fyne.KeyC: CodeC,
|
||||
fyne.KeyD: CodeD,
|
||||
fyne.KeyE: CodeE,
|
||||
fyne.KeyF: CodeF,
|
||||
fyne.KeyG: CodeG,
|
||||
fyne.KeyH: CodeH,
|
||||
fyne.KeyI: CodeI,
|
||||
fyne.KeyJ: CodeJ,
|
||||
fyne.KeyK: CodeK,
|
||||
fyne.KeyL: CodeL,
|
||||
fyne.KeyM: CodeM,
|
||||
fyne.KeyN: CodeN,
|
||||
fyne.KeyO: CodeO,
|
||||
fyne.KeyP: CodeP,
|
||||
fyne.KeyQ: CodeQ,
|
||||
fyne.KeyR: CodeR,
|
||||
fyne.KeyS: CodeS,
|
||||
fyne.KeyT: CodeT,
|
||||
fyne.KeyU: CodeU,
|
||||
fyne.KeyV: CodeV,
|
||||
fyne.KeyW: CodeW,
|
||||
fyne.KeyX: CodeX,
|
||||
fyne.KeyY: CodeY,
|
||||
fyne.KeyZ: CodeZ,
|
||||
fyne.KeyUp: CodeUpArrow,
|
||||
fyne.KeyDown: CodeDownArrow,
|
||||
fyne.KeyRight: CodeRightArrow,
|
||||
fyne.KeyLeft: CodeLeftArrow,
|
||||
fyne.KeyEnd: CodeEnd,
|
||||
fyne.KeyHome: CodeHome,
|
||||
fyne.KeyInsert: CodeInsert,
|
||||
fyne.KeyDelete: CodeDelete,
|
||||
fyne.KeyEnter: CodeEnter,
|
||||
fyne.KeyTab: CodeTab,
|
||||
fyne.KeyEscape: CodeESC,
|
||||
fyne.KeyF1: CodeF1,
|
||||
fyne.KeyF2: CodeF2,
|
||||
fyne.KeyF3: CodeF3,
|
||||
fyne.KeyF4: CodeF4,
|
||||
fyne.KeyF5: CodeF5,
|
||||
fyne.KeyF6: CodeF6,
|
||||
fyne.KeyF7: CodeF7,
|
||||
fyne.KeyF8: CodeF8,
|
||||
fyne.KeyF9: CodeF9,
|
||||
fyne.KeyF10: CodeF10,
|
||||
fyne.KeyF11: CodeF11,
|
||||
fyne.KeyF12: CodeF12,
|
||||
fyne.KeyPageDown: CodePageDown,
|
||||
fyne.KeyPageUp: CodePageUp,
|
||||
fyne.KeySpace: CodeSpace,
|
||||
fyne.KeyBackTick: CodeGrave,
|
||||
desktop.KeyAltLeft: CodeLeftAlt,
|
||||
desktop.KeyAltRight: CodeRightAlt,
|
||||
desktop.KeyControlLeft: CodeLeftCntl,
|
||||
desktop.KeyControlRight: CodeRightControl,
|
||||
desktop.KeyShiftLeft: CodeLeftShift,
|
||||
desktop.KeyShiftRight: CodeRightShift,
|
||||
}
|
@ -1,146 +0,0 @@
|
||||
// Code generated by "stringer --type Code"; DO NOT EDIT.
|
||||
|
||||
package keys
|
||||
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[CodeNone-0]
|
||||
_ = x[CodeESC-1]
|
||||
_ = x[Code1-2]
|
||||
_ = x[Code2-3]
|
||||
_ = x[Code3-4]
|
||||
_ = x[Code4-5]
|
||||
_ = x[Code5-6]
|
||||
_ = x[Code6-7]
|
||||
_ = x[Code7-8]
|
||||
_ = x[Code8-9]
|
||||
_ = x[Code9-10]
|
||||
_ = x[Code0-11]
|
||||
_ = x[CodeMinus-12]
|
||||
_ = x[CodeEqual-13]
|
||||
_ = x[CodeBackspace-14]
|
||||
_ = x[CodeTab-15]
|
||||
_ = x[CodeQ-16]
|
||||
_ = x[CodeW-17]
|
||||
_ = x[CodeE-18]
|
||||
_ = x[CodeR-19]
|
||||
_ = x[CodeT-20]
|
||||
_ = x[CodeY-21]
|
||||
_ = x[CodeU-22]
|
||||
_ = x[CodeI-23]
|
||||
_ = x[CodeO-24]
|
||||
_ = x[CodeP-25]
|
||||
_ = x[CodeLeftBrack-26]
|
||||
_ = x[CodeRightBrace-27]
|
||||
_ = x[CodeEnter-28]
|
||||
_ = x[CodeLeftCntl-29]
|
||||
_ = x[CodeA-30]
|
||||
_ = x[CodeS-31]
|
||||
_ = x[CodeD-32]
|
||||
_ = x[CodeF-33]
|
||||
_ = x[CodeG-34]
|
||||
_ = x[CodeH-35]
|
||||
_ = x[CodeJ-36]
|
||||
_ = x[CodeK-37]
|
||||
_ = x[CodeL-38]
|
||||
_ = x[CodeSemicolon-39]
|
||||
_ = x[CodeApostrophe-40]
|
||||
_ = x[CodeGrave-41]
|
||||
_ = x[CodeLeftShift-42]
|
||||
_ = x[CodeBackslash-43]
|
||||
_ = x[CodeZ-44]
|
||||
_ = x[CodeX-45]
|
||||
_ = x[CodeC-46]
|
||||
_ = x[CodeV-47]
|
||||
_ = x[CodeB-48]
|
||||
_ = x[CodeN-49]
|
||||
_ = x[CodeM-50]
|
||||
_ = x[CodeComma-51]
|
||||
_ = x[CodeDot-52]
|
||||
_ = x[CodeSlash-53]
|
||||
_ = x[CodeRightShift-54]
|
||||
_ = x[CodeKPAsterisk-55]
|
||||
_ = x[CodeLeftAlt-56]
|
||||
_ = x[CodeSpace-57]
|
||||
_ = x[CodeCapsLock-58]
|
||||
_ = x[CodeF1-59]
|
||||
_ = x[CodeF2-60]
|
||||
_ = x[CodeF3-61]
|
||||
_ = x[CodeF4-62]
|
||||
_ = x[CodeF5-63]
|
||||
_ = x[CodeF6-64]
|
||||
_ = x[CodeF7-65]
|
||||
_ = x[CodeF8-66]
|
||||
_ = x[CodeF9-67]
|
||||
_ = x[CodeF10-68]
|
||||
_ = x[CodeNumlock-69]
|
||||
_ = x[CodeScrollLock-70]
|
||||
_ = x[CodeKP7-71]
|
||||
_ = x[CodeKP8-72]
|
||||
_ = x[CodeKP9-73]
|
||||
_ = x[CodeKPMinus-74]
|
||||
_ = x[CodeKP4-75]
|
||||
_ = x[CodeKP5-76]
|
||||
_ = x[CodeKP6-77]
|
||||
_ = x[CodeKPPlus-78]
|
||||
_ = x[CodeKP1-79]
|
||||
_ = x[CodeKP2-80]
|
||||
_ = x[CodeKP3-81]
|
||||
_ = x[CodeKP0-82]
|
||||
_ = x[CodeKPDot-83]
|
||||
_ = x[CodeF11-87]
|
||||
_ = x[CodeF12-88]
|
||||
_ = x[CodeKPEnter-96]
|
||||
_ = x[CodeRightControl-97]
|
||||
_ = x[CodeKPSlash-98]
|
||||
_ = x[CodeRightAlt-100]
|
||||
_ = x[CodeHome-102]
|
||||
_ = x[CodeUpArrow-103]
|
||||
_ = x[CodePageUp-104]
|
||||
_ = x[CodeLeftArrow-105]
|
||||
_ = x[CodeRightArrow-106]
|
||||
_ = x[CodeEnd-107]
|
||||
_ = x[CodeDownArrow-108]
|
||||
_ = x[CodePageDown-109]
|
||||
_ = x[CodeInsert-110]
|
||||
_ = x[CodeDelete-111]
|
||||
}
|
||||
|
||||
const (
|
||||
_Code_name_0 = "CodeNoneCodeESCCode1Code2Code3Code4Code5Code6Code7Code8Code9Code0CodeMinusCodeEqualCodeBackspaceCodeTabCodeQCodeWCodeECodeRCodeTCodeYCodeUCodeICodeOCodePCodeLeftBrackCodeRightBraceCodeEnterCodeLeftCntlCodeACodeSCodeDCodeFCodeGCodeHCodeJCodeKCodeLCodeSemicolonCodeApostropheCodeGraveCodeLeftShiftCodeBackslashCodeZCodeXCodeCCodeVCodeBCodeNCodeMCodeCommaCodeDotCodeSlashCodeRightShiftCodeKPAsteriskCodeLeftAltCodeSpaceCodeCapsLockCodeF1CodeF2CodeF3CodeF4CodeF5CodeF6CodeF7CodeF8CodeF9CodeF10CodeNumlockCodeScrollLockCodeKP7CodeKP8CodeKP9CodeKPMinusCodeKP4CodeKP5CodeKP6CodeKPPlusCodeKP1CodeKP2CodeKP3CodeKP0CodeKPDot"
|
||||
_Code_name_1 = "CodeF11CodeF12"
|
||||
_Code_name_2 = "CodeKPEnterCodeRightControlCodeKPSlash"
|
||||
_Code_name_3 = "CodeRightAlt"
|
||||
_Code_name_4 = "CodeHomeCodeUpArrowCodePageUpCodeLeftArrowCodeRightArrowCodeEndCodeDownArrowCodePageDownCodeInsertCodeDelete"
|
||||
)
|
||||
|
||||
var (
|
||||
_Code_index_0 = [...]uint16{0, 8, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 74, 83, 96, 103, 108, 113, 118, 123, 128, 133, 138, 143, 148, 153, 166, 180, 189, 201, 206, 211, 216, 221, 226, 231, 236, 241, 246, 259, 273, 282, 295, 308, 313, 318, 323, 328, 333, 338, 343, 352, 359, 368, 382, 396, 407, 416, 428, 434, 440, 446, 452, 458, 464, 470, 476, 482, 489, 500, 514, 521, 528, 535, 546, 553, 560, 567, 577, 584, 591, 598, 605, 614}
|
||||
_Code_index_1 = [...]uint8{0, 7, 14}
|
||||
_Code_index_2 = [...]uint8{0, 11, 27, 38}
|
||||
_Code_index_4 = [...]uint8{0, 8, 19, 29, 42, 56, 63, 76, 88, 98, 108}
|
||||
)
|
||||
|
||||
func (i Code) String() string {
|
||||
switch {
|
||||
case i <= 83:
|
||||
return _Code_name_0[_Code_index_0[i]:_Code_index_0[i+1]]
|
||||
case 87 <= i && i <= 88:
|
||||
i -= 87
|
||||
return _Code_name_1[_Code_index_1[i]:_Code_index_1[i+1]]
|
||||
case 96 <= i && i <= 98:
|
||||
i -= 96
|
||||
return _Code_name_2[_Code_index_2[i]:_Code_index_2[i+1]]
|
||||
case i == 100:
|
||||
return _Code_name_3
|
||||
case 102 <= i && i <= 111:
|
||||
i -= 102
|
||||
return _Code_name_4[_Code_index_4[i]:_Code_index_4[i+1]]
|
||||
default:
|
||||
return "Code(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
}
|
82
keys/keys.go
82
keys/keys.go
@ -1,45 +1,55 @@
|
||||
package keys
|
||||
|
||||
import (
|
||||
"fyne.io/fyne"
|
||||
"strings"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/driver/desktop"
|
||||
"github.com/OrbTools/OrbCommon/hid"
|
||||
)
|
||||
|
||||
var (
|
||||
//KCToASCII keycode to ascii table
|
||||
KCToASCII map[Code]rune
|
||||
)
|
||||
|
||||
//GetASCIIForSC Returns Ascii for Scancode
|
||||
func GetASCIIForSC(r uint16) uint16 {
|
||||
return uint16(KCToASCII[Code(r)])
|
||||
}
|
||||
|
||||
//GetSCForASCII Returns scancode For Ascii
|
||||
func GetSCForASCII(r uint16) uint16 {
|
||||
return uint16(ASCIIToKC[rune(r)])
|
||||
}
|
||||
|
||||
func init() {
|
||||
KCToASCII = make(map[Code]rune)
|
||||
for x, y := range ASCIIToKC {
|
||||
KCToASCII[y] = x
|
||||
func FyneToKeymap(e *fyne.KeyEvent) hid.Key {
|
||||
switch e.Name {
|
||||
case fyne.Key0, fyne.Key1, fyne.Key2, fyne.Key3, fyne.Key4, fyne.Key5, fyne.Key6, fyne.Key7, fyne.Key8, fyne.Key9:
|
||||
return hid.GetMappingFromName("DIGIT" + string(e.Name))
|
||||
case fyne.KeyF1, fyne.KeyF2, fyne.KeyF3, fyne.KeyF4, fyne.KeyF5, fyne.KeyF6, fyne.KeyF7, fyne.KeyF8, fyne.KeyF9, fyne.KeyF10, fyne.KeyF11, fyne.KeyF12:
|
||||
return hid.GetMappingFromName(string(e.Name))
|
||||
case fyne.KeyLeft, fyne.KeyRight, fyne.KeyUp, fyne.KeyDown:
|
||||
return hid.GetMappingFromName("ARROW_" + strings.ToUpper(string(e.Name)))
|
||||
case fyne.KeyBackspace, fyne.KeyEscape, fyne.KeySpace:
|
||||
return hid.GetMappingFromName(strings.ToUpper(string(e.Name)))
|
||||
case fyne.KeyBackslash:
|
||||
return hid.GetMappingFromName("BACKSLASH")
|
||||
case fyne.KeyBackTick:
|
||||
return hid.GetMappingFromName("BACKQUOTE")
|
||||
case fyne.KeyMinus:
|
||||
return hid.GetMappingFromName("MINUS")
|
||||
case fyne.KeyEqual:
|
||||
return hid.GetMappingFromName("EQUAL")
|
||||
case fyne.KeySemicolon:
|
||||
return hid.GetMappingFromName("SEMICOLON")
|
||||
case fyne.KeyReturn:
|
||||
return hid.GetMappingFromName("ENTER")
|
||||
case desktop.KeyAltLeft:
|
||||
return hid.GetMappingFromName("ALT_LEFT")
|
||||
case desktop.KeyAltRight:
|
||||
return hid.GetMappingFromName("ALT_RIGHT")
|
||||
case desktop.KeyControlLeft:
|
||||
return hid.GetMappingFromName("CONTROL_LEFT")
|
||||
case desktop.KeyControlRight:
|
||||
return hid.GetMappingFromName("CONTROL_RIGHT")
|
||||
case desktop.KeyShiftLeft:
|
||||
return hid.GetMappingFromName("SHIFT_LEFT")
|
||||
case desktop.KeyShiftRight:
|
||||
return hid.GetMappingFromName("SHIFT_RIGHT")
|
||||
case fyne.KeyTab:
|
||||
return hid.GetMappingFromName("TAB")
|
||||
default:
|
||||
return hid.GetMappingFromName("US_" + strings.ToUpper(string(e.Name)))
|
||||
}
|
||||
//return hid.GetMappingFromName("USB_RESERVED")
|
||||
}
|
||||
|
||||
//CKIFyneKeyMap Control Keys interop
|
||||
func CKIFyneKeyMap(e fyne.KeyName) uint16 {
|
||||
if val, ok := FyneToKC[e]; ok {
|
||||
return uint16(val)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
//CKIKeyNameFromKC Key Name from Keycode
|
||||
func CKIKeyNameFromKC(r uint16) string {
|
||||
return Code(r).String()[4:]
|
||||
}
|
||||
|
||||
//CKIKeyNameFromASCII key name from ascii code
|
||||
func CKIKeyNameFromASCII(r uint16) string {
|
||||
return ASCIIToKC[rune(r)].String()[4:]
|
||||
func KeyFromEvdev(b uint16) hid.Key {
|
||||
return hid.GetMappingFromLinux(b)
|
||||
}
|
||||
|
109
keys/scans.go
109
keys/scans.go
@ -1,109 +0,0 @@
|
||||
//go:generate stringer --type Code
|
||||
//Package keys provides back end keymapping
|
||||
package keys
|
||||
|
||||
//Code ScanCode object
|
||||
type Code uint16
|
||||
|
||||
const (
|
||||
CodeNone Code = 0
|
||||
CodeESC Code = 1
|
||||
Code1 Code = 2
|
||||
Code2 Code = 3
|
||||
Code3 Code = 4
|
||||
Code4 Code = 5
|
||||
Code5 Code = 6
|
||||
Code6 Code = 7
|
||||
Code7 Code = 8
|
||||
Code8 Code = 9
|
||||
Code9 Code = 10
|
||||
Code0 Code = 11
|
||||
CodeMinus Code = 12
|
||||
CodeEqual Code = 13
|
||||
CodeBackspace Code = 14
|
||||
CodeTab Code = 15
|
||||
CodeQ Code = 16
|
||||
CodeW Code = 17
|
||||
CodeE Code = 18
|
||||
CodeR Code = 19
|
||||
CodeT Code = 20
|
||||
CodeY Code = 21
|
||||
CodeU Code = 22
|
||||
CodeI Code = 23
|
||||
CodeO Code = 24
|
||||
CodeP Code = 25
|
||||
CodeLeftBrack Code = 26
|
||||
CodeRightBrace Code = 27
|
||||
CodeEnter Code = 28
|
||||
CodeLeftCntl Code = 29
|
||||
CodeA Code = 30
|
||||
CodeS Code = 31
|
||||
CodeD Code = 32
|
||||
CodeF Code = 33
|
||||
CodeG Code = 34
|
||||
CodeH Code = 35
|
||||
CodeJ Code = 36
|
||||
CodeK Code = 37
|
||||
CodeL Code = 38
|
||||
CodeSemicolon Code = 39
|
||||
CodeApostrophe Code = 40
|
||||
CodeGrave Code = 41
|
||||
CodeLeftShift Code = 42
|
||||
CodeBackslash Code = 43
|
||||
CodeZ Code = 44
|
||||
CodeX Code = 45
|
||||
CodeC Code = 46
|
||||
CodeV Code = 47
|
||||
CodeB Code = 48
|
||||
CodeN Code = 49
|
||||
CodeM Code = 50
|
||||
CodeComma Code = 51
|
||||
CodeDot Code = 52
|
||||
CodeSlash Code = 53
|
||||
CodeRightShift Code = 54
|
||||
CodeKPAsterisk Code = 55
|
||||
CodeLeftAlt Code = 56
|
||||
CodeSpace Code = 57
|
||||
CodeCapsLock Code = 58
|
||||
CodeF1 Code = 59
|
||||
CodeF2 Code = 60
|
||||
CodeF3 Code = 61
|
||||
CodeF4 Code = 62
|
||||
CodeF5 Code = 63
|
||||
CodeF6 Code = 64
|
||||
CodeF7 Code = 65
|
||||
CodeF8 Code = 66
|
||||
CodeF9 Code = 67
|
||||
CodeF10 Code = 68
|
||||
CodeNumlock Code = 69
|
||||
CodeScrollLock Code = 70
|
||||
CodeKP7 Code = 71
|
||||
CodeKP8 Code = 72
|
||||
CodeKP9 Code = 73
|
||||
CodeKPMinus Code = 74
|
||||
CodeKP4 Code = 75
|
||||
CodeKP5 Code = 76
|
||||
CodeKP6 Code = 77
|
||||
CodeKPPlus Code = 78
|
||||
CodeKP1 Code = 79
|
||||
CodeKP2 Code = 80
|
||||
CodeKP3 Code = 81
|
||||
CodeKP0 Code = 82
|
||||
CodeKPDot Code = 83
|
||||
CodeF11 Code = 87
|
||||
CodeF12 Code = 88
|
||||
CodeKPEnter Code = 96
|
||||
CodeRightControl Code = 97
|
||||
CodeKPSlash Code = 98
|
||||
CodeRightAlt Code = 100
|
||||
CodeHome Code = 102
|
||||
CodeUpArrow Code = 103
|
||||
CodePageUp Code = 104
|
||||
CodeLeftArrow Code = 105
|
||||
CodeRightArrow Code = 106
|
||||
CodeEnd Code = 107
|
||||
CodeDownArrow Code = 108
|
||||
CodePageDown Code = 109
|
||||
CodeInsert Code = 110
|
||||
CodeDelete Code = 111
|
||||
)
|
12
orbbind.go
12
orbbind.go
@ -3,9 +3,9 @@ package main
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"fyne.io/fyne"
|
||||
"fyne.io/fyne/app"
|
||||
"fyne.io/fyne/dialog"
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/app"
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
"github.com/OrbTools/OrbBind/ui/mui"
|
||||
"github.com/OrbTools/OrbCommon/devices/orbweaver"
|
||||
)
|
||||
@ -19,7 +19,7 @@ func main() {
|
||||
//pages := make(map[string]baseui.PageWithBindings)
|
||||
//pages["main"] = mainpage.NewMainPage(window, omap)
|
||||
//pages["side"] = sidepage.NewSidePage(window, omap)
|
||||
tabs, setter := mui.Generate(orbweaver.GUI, window, reflect.ValueOf(omap))
|
||||
tabs, setter, getter := mui.Generate(orbweaver.GUI, window, reflect.ValueOf(omap))
|
||||
//tabs := widget.NewTabContainer(pages["main"].Create(), pages["side"].Create())
|
||||
tabs.Resize(fyne.NewSize(640, 480))
|
||||
main := tabs
|
||||
@ -31,7 +31,7 @@ func main() {
|
||||
return
|
||||
}
|
||||
if writer != nil {
|
||||
orbweaver.SavePKMKeymap(omap, writer)
|
||||
orbweaver.SavePKMKeymap(getter().Interface(), writer)
|
||||
}
|
||||
}, window)
|
||||
}), fyne.NewMenuItem("Load", func() {
|
||||
@ -43,8 +43,6 @@ func main() {
|
||||
if reader != nil {
|
||||
omap := orbweaver.LoadPKMKeymap(reader)
|
||||
setter(reflect.ValueOf(omap))
|
||||
// pages["main"].SetBindings(omap)
|
||||
// pages["side"].SetBindings(omap)
|
||||
}
|
||||
}, window)
|
||||
})))
|
||||
|
@ -1,10 +1,10 @@
|
||||
package bind
|
||||
|
||||
import (
|
||||
"fyne.io/fyne"
|
||||
"fyne.io/fyne/driver/desktop"
|
||||
"fyne.io/fyne/layout"
|
||||
"fyne.io/fyne/widget"
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/OrbTools/OrbBind/keys"
|
||||
)
|
||||
|
||||
@ -23,34 +23,28 @@ type Page struct {
|
||||
|
||||
//TypeKey event on key
|
||||
func (bp *Page) TypeKey(e *fyne.KeyEvent) {
|
||||
bp.Bind.Bound = keys.CKIFyneKeyMap(e.Name)
|
||||
kp := keys.CKIKeyNameFromKC(bp.Bind.Bound)
|
||||
bp.dev["BL"].(*widget.Label).SetText(kp)
|
||||
kp := keys.FyneToKeymap(e)
|
||||
bp.Bind.Bound = kp.Evdev
|
||||
bp.dev["BL"].(*widget.Label).SetText(kp.Code)
|
||||
}
|
||||
|
||||
func (bp *Page) createGrid() *fyne.Container {
|
||||
cont := fyne.NewContainerWithLayout(layout.NewGridLayoutWithColumns(4))
|
||||
cont.AddObject(widget.NewButton("Clear", func() {
|
||||
cont := container.New(layout.NewGridLayoutWithColumns(4))
|
||||
cont.Add(widget.NewButton("Clear", func() {
|
||||
bp.Bind.Bound = 0x0
|
||||
bp.dev["BL"].(*widget.Label).SetText(keys.CKIKeyNameFromKC(bp.Bind.Bound))
|
||||
bp.dev["BL"].(*widget.Label).SetText(keys.KeyFromEvdev(bp.Bind.Bound).Code)
|
||||
}))
|
||||
cont.Add(widget.NewButton("TAB", func() {
|
||||
bp.TypeKey(&fyne.KeyEvent{Name: fyne.KeyTab})
|
||||
}))
|
||||
k1 := widget.NewButton("Tab", func() { bp.TypeKey(&fyne.KeyEvent{Name: fyne.KeyTab}) })
|
||||
k3 := widget.NewButton("Left Alt", func() { bp.TypeKey(&fyne.KeyEvent{Name: desktop.KeyAltLeft}) })
|
||||
k5 := widget.NewButton("Left Control", func() { bp.TypeKey(&fyne.KeyEvent{Name: desktop.KeyControlLeft}) })
|
||||
k7 := widget.NewButton("Left Shift", func() { bp.TypeKey(&fyne.KeyEvent{Name: desktop.KeyShiftLeft}) })
|
||||
//k8 := widget.NewButton("Grave (`)", func() { bp.TypeKey(&fyne.KeyEvent{Name: fyne.KeyBackTick}) })
|
||||
cont.AddObject(k1)
|
||||
cont.AddObject(k3)
|
||||
cont.AddObject(k5)
|
||||
cont.AddObject(k7)
|
||||
return cont
|
||||
}
|
||||
|
||||
//Create the binding page popup
|
||||
func (bp *Page) Create(bid string) fyne.CanvasObject {
|
||||
bp.dev = make(map[string]fyne.CanvasObject)
|
||||
bp.dev["BL"] = widget.NewLabel(keys.CKIKeyNameFromKC(bp.Bind.Bound))
|
||||
pop := widget.NewVBox(bp.dev["BL"], bp.createGrid())
|
||||
bp.dev["BL"] = widget.NewLabel(keys.KeyFromEvdev(bp.Bind.Bound).Code)
|
||||
pop := container.NewVBox(bp.dev["BL"], bp.createGrid())
|
||||
bp.window.Canvas().SetOnTypedKey(bp.TypeKey)
|
||||
return pop
|
||||
}
|
||||
|
@ -4,31 +4,30 @@ import (
|
||||
"math"
|
||||
"reflect"
|
||||
|
||||
"fyne.io/fyne"
|
||||
"fyne.io/fyne/dialog"
|
||||
"fyne.io/fyne/layout"
|
||||
"fyne.io/fyne/widget"
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/OrbTools/OrbBind/ui/bind"
|
||||
"github.com/OrbTools/OrbCommon/gui"
|
||||
)
|
||||
|
||||
//Generate creates a GUI from definition
|
||||
func Generate(ui *gui.GUI, window fyne.Window, KBS reflect.Value) (*widget.TabContainer, func(reflect.Value)) {
|
||||
func Generate(ui *gui.GUI, window fyne.Window, KBS reflect.Value) (*container.AppTabs, func(reflect.Value), func() reflect.Value) {
|
||||
keybind := KBS
|
||||
tui := widget.NewTabContainer()
|
||||
tui := container.NewAppTabs()
|
||||
for _, page := range ui.Pages[:] {
|
||||
var cont *fyne.Container
|
||||
pg := page
|
||||
switch page.Type {
|
||||
case gui.PGrid:
|
||||
{
|
||||
cont = fyne.NewContainer()
|
||||
cont.Layout = layout.NewGridLayout(int(math.Ceil(math.Sqrt(float64(len(page.Keys))))))
|
||||
cont = container.New(layout.NewGridLayout(int(math.Ceil(math.Sqrt(float64(len(page.Keys)))))))
|
||||
}
|
||||
default:
|
||||
{
|
||||
cont = fyne.NewContainer()
|
||||
cont.Layout = layout.NewGridLayout(int(math.Ceil(math.Sqrt(float64(len(page.Keys))))))
|
||||
cont = container.New(layout.NewGridLayout(int(math.Ceil(math.Sqrt(float64(len(page.Keys)))))))
|
||||
}
|
||||
}
|
||||
for _, key := range page.Keys[:] {
|
||||
@ -47,10 +46,10 @@ func Generate(ui *gui.GUI, window fyne.Window, KBS reflect.Value) (*widget.TabCo
|
||||
}
|
||||
dialog.ShowCustomConfirm("Bind", "Save", "Cancel", cont, ok, window)
|
||||
})
|
||||
cont.AddObject(btn)
|
||||
cont.Add(btn)
|
||||
}
|
||||
ti := widget.NewTabItem(page.Name, cont)
|
||||
ti := container.NewTabItem(page.Name, cont)
|
||||
tui.Append(ti)
|
||||
}
|
||||
return tui, func(v reflect.Value) { keybind = v }
|
||||
return tui, func(v reflect.Value) { keybind = v }, func() reflect.Value { return keybind }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user