mirror of
https://github.com/OrbTools/OrbBind
synced 2024-10-31 03:20:26 +00:00
fyne v2 work, cki rework
This commit is contained in:
parent
c0be090594
commit
eb4af1af53
8
go.mod
8
go.mod
@ -4,14 +4,14 @@ go 1.16
|
||||
|
||||
require (
|
||||
fyne.io/fyne/v2 v2.0.3
|
||||
github.com/OrbTools/OrbCommon v0.0.0-20210501211141-b2f45ab995e6
|
||||
github.com/OrbTools/OrbCommon v0.0.0-20210512020311-0896f3a8de6f
|
||||
github.com/go-gl/gl v0.0.0-20210501111010-69f74958bac0 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/srwiley/oksvg v0.0.0-20210320200257-875f767ac39a // 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-20210503060351-7fd8e65b6420 // indirect
|
||||
golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6 // indirect
|
||||
golang.org/x/image v0.0.0-20210504121937-7319ad40d33e // indirect
|
||||
golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect
|
||||
golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
)
|
||||
|
16
go.sum
16
go.sum
@ -1,8 +1,8 @@
|
||||
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-20210501211141-b2f45ab995e6 h1:IjzpfwsNtjVhYJObK+7wEAsFqP7o+wAkWiUfIe+mRuc=
|
||||
github.com/OrbTools/OrbCommon v0.0.0-20210501211141-b2f45ab995e6/go.mod h1:8HEhD7wF9Fqritt/jYxDmjbxEScWhFfVajdYdPO5Y14=
|
||||
github.com/OrbTools/OrbCommon v0.0.0-20210512020311-0896f3a8de6f h1:26ndpRVB/Z+1tPGzYcRVwQ9m2V+d9K9o9y2ioNkJBdg=
|
||||
github.com/OrbTools/OrbCommon v0.0.0-20210512020311-0896f3a8de6f/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=
|
||||
@ -55,15 +55,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-20210504121937-7319ad40d33e h1:PzJMNfFQx+QO9hrC1GwZ4BoPGeNGhfeQEgcQFArEjPk=
|
||||
golang.org/x/image v0.0.0-20210504121937-7319ad40d33e/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
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-20210503060351-7fd8e65b6420 h1:a8jGStKg0XqKDlKqjLrXn0ioF5MH36pT7Z0BRTqLhbk=
|
||||
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20210510120150-4163338589ed h1:p9UgmWI9wKpfYmgaV/IZKGdXc5qEK45tDwwwDyjS26I=
|
||||
golang.org/x/net v0.0.0-20210510120150-4163338589ed/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=
|
||||
@ -73,8 +73,8 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
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-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6 h1:cdsMqa2nXzqlgs183pHxtvoVwU7CyzaCTAUOg94af4c=
|
||||
golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744 h1:yhBbb4IRs2HS9PPlAg6DMC6mUOKexJBNsLf4Z+6En1Q=
|
||||
golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744/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=
|
||||
|
131
keys/cki2.go
131
keys/cki2.go
@ -1,131 +0,0 @@
|
||||
package keys
|
||||
|
||||
// Common Interface 2, natified go
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/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) + ")"
|
||||
}
|
||||
}
|
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
|
||||
)
|
@ -2,10 +2,9 @@ package bind
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/driver/desktop"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"github.com/OrbTools/OrbBind/keys"
|
||||
)
|
||||
|
||||
@ -24,33 +23,24 @@ 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)
|
||||
}))
|
||||
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))
|
||||
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
|
||||
|
@ -23,13 +23,11 @@ func Generate(ui *gui.GUI, window fyne.Window, KBS reflect.Value) (*container.Ap
|
||||
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[:] {
|
||||
@ -48,7 +46,7 @@ func Generate(ui *gui.GUI, window fyne.Window, KBS reflect.Value) (*container.Ap
|
||||
}
|
||||
dialog.ShowCustomConfirm("Bind", "Save", "Cancel", cont, ok, window)
|
||||
})
|
||||
cont.AddObject(btn)
|
||||
cont.Add(btn)
|
||||
}
|
||||
ti := container.NewTabItem(page.Name, cont)
|
||||
tui.Append(ti)
|
||||
|
Loading…
Reference in New Issue
Block a user