neovars: BST-layouts can highlight tools

At the on-screen board,
- layouts can highlight keys that invoke tools
  (helps to distinguish them from printed characters)
- the "Wie mit Neo?" tool key is displayed with symbol "UW"
This commit is contained in:
ferdinym 2020-10-09 02:13:21 +02:00
parent a8632fce82
commit b530868980
2 changed files with 55 additions and 34 deletions

View File

@ -24,8 +24,9 @@ BSTlayout_0_height := 199
BSTlayout_0_hasVar1 := 0 ; has visuals for Mod3aufAe?
BSTlayout_0_img0 := "ebene0.png" ; layout graphics
BSTlayout_0_var_0_levelImgs := BSTlayout_0_img0 ; graphics organized by level and variant
BSTlayout_0_compFirstFontOpts := BSTfontOpts ; font options for keys initiating a compose sequence (exact copy of BSTfontOpts or ..compMoreFontOpts enhances performance)
BSTlayout_0_compMoreFontOpts := BSTfontOpts ; font options for keys joining a compose sequence (exact copy of BSTfontOpts or ..compFirstFontOpts enhances performance)
BSTlayout_0_toolFontOpts := BSTfontOpts ; font options for keys invoking a tool (exact copy of BSTfontOpts or one of the other fonts enhances performance)
BSTlayout_0_compFirstFontOpts := BSTfontOpts ; font options for keys initiating a compose sequence (exact copy of BSTfontOpts or one of the other fonts enhances performance)
BSTlayout_0_compMoreFontOpts := BSTfontOpts ; font options for keys joining a compose sequence (exact copy of BSTfontOpts or one of the other fonts enhances performance)
BSTlayout_0_compMoreText := "U00002AU00002A" ; display-text for keys joining a compose sequence (unicode points e.g. "U00002AU00002A" for "**"; empty string for keys' original characters)
; ergodox layout
@ -34,6 +35,7 @@ BSTlayout_1_height := 300
BSTlayout_1_hasVar1 := 0
BSTlayout_1_img0 := "ergodox.png"
BSTlayout_1_var_0_levelImgs := BSTlayout_1_img0
BSTlayout_1_toolFontOpts := BSTfontOpts
BSTlayout_1_compFirstFontOpts := BSTfontOpts
BSTlayout_1_compMoreFontOpts := BSTfontOpts
BSTlayout_1_compMoreText := "U00002AU00002A"
@ -54,8 +56,9 @@ BSTlayout_2_img8 := "iso_ebene5_var0.png"
BSTlayout_2_img9 := "iso_ebene5_var1.png"
BSTlayout_2_var_0_levelImgs := BSTlayout_2_img0 . "," . BSTlayout_2_img2 . "," . BSTlayout_2_img3 . "," . BSTlayout_2_img5 . "," . BSTlayout_2_img6 . "," . BSTlayout_2_img8
BSTlayout_2_var_1_levelImgs := BSTlayout_2_img1 . "," . BSTlayout_2_img2 . "," . BSTlayout_2_img4 . "," . BSTlayout_2_img5 . "," . BSTlayout_2_img7 . "," . BSTlayout_2_img9
BSTlayout_2_compFirstFontOpts := "c686868" ; "c0065E5" (blue option)
BSTlayout_2_compMoreFontOpts := "c686868" ; "c0065E5" (blue option)
BSTlayout_2_toolFontOpts := "c0065E5"
BSTlayout_2_compFirstFontOpts := "c686868"
BSTlayout_2_compMoreFontOpts := "c686868"
BSTlayout_2_compMoreText := ""
; ISO TKL layout
@ -74,8 +77,9 @@ BSTlayout_3_img8 := "isoTKL_ebene5_var0.png"
BSTlayout_3_img9 := "isoTKL_ebene5_var1.png"
BSTlayout_3_var_0_levelImgs := BSTlayout_3_img0 . "," . BSTlayout_3_img2 . "," . BSTlayout_3_img3 . "," . BSTlayout_3_img5 . "," . BSTlayout_3_img6 . "," . BSTlayout_3_img8
BSTlayout_3_var_1_levelImgs := BSTlayout_3_img1 . "," . BSTlayout_3_img2 . "," . BSTlayout_3_img4 . "," . BSTlayout_3_img5 . "," . BSTlayout_3_img7 . "," . BSTlayout_3_img9
BSTlayout_3_compFirstFontOpts := "c686868"
BSTlayout_3_compMoreFontOpts := "c686868"
BSTlayout_3_toolFontOpts := "c3065B0"
BSTlayout_3_compFirstFontOpts := "c686868" ; blue option: "c0065E5"
BSTlayout_3_compMoreFontOpts := "c686868" ; blue option: "c0065E5"
BSTlayout_3_compMoreText := ""
Check_BSTUpdate() {
@ -107,10 +111,11 @@ BSTUpdate() {
global
static WM_SETTEXT := 0x0C
local guiFontOpts, guiFontOptsPrev := BSTfontOpts
local guiToolFontOpts := BSTlayout_%bstLayout%_toolFontOpts
local guiCompFirstFontOpts := BSTlayout_%bstLayout%_compFirstFontOpts
local guiCompMoreFontOpts := BSTlayout_%bstLayout%_compMoreFontOpts
local guiCompMoreText := BSTlayout_%bstLayout%_compMoreText
local guiCP, guiComp, guiText, guiPos, ptrU, processStandalone
local guiCP, guiComp, guiText, guiSym, guiPos, ptrU, processStandalone
VarSetCapacity(ptrU,20)
Loop, Parse, GuiKeyList, `,
{
@ -128,7 +133,6 @@ BSTUpdate() {
else
GuiVirtKey := GuiPhysKey
guiText := ""
guiFontOpts := BSTfontOpts
guiCP := CP%GuiEb%%GuiVirtKey%
guiComp := Comp . guiCP
@ -139,37 +143,51 @@ BSTUpdate() {
; Compose completes; lookup
if (CD%guiComp% != "") {
guiText := CD%guiComp%
}
; Compose-sequence expands
else if (CM%guiComp% == 1) {
} else if (CM%guiComp% == 1) {
guiFontOpts := guiCompMoreFontOpts
guiText := (guiCompMoreText != "" ? guiCompMoreText : guiCP)
guiFontOpts := guiCompMoreFontOpts
}
; Previous compose completes (delayed); lookup + standalone key
else if (CF%Comp% != "") {
} else if (CF%Comp% != "") {
if (SubStr(guiCP,1,1) != "P") ; not a modifier or tool
guiText := CF%Comp%
processStandalone := 1
}
; Compose fails; label only modifiers
else {
} else {
if (SubStr(guiCP,1,1) == "P") ; is modifier or tool
guiText := guiCP
}
; Replace symbols for screen view
guiSym := GSYM%guiText%
if (guiSym != "") {
guiText := SubStr(guiSym,2)
; Apply special symbol styles unless standalone follows
if (SubStr(guiSym,1,1) == "t" and processStandalone == 0)
guiFontOpts := guiToolFontOpts
}
} else {
guiText := ""
processStandalone := 1
}
guiText := (GSYM%guiText% == "" ? guiText : GSYM%guiText%)
; Label for standalone key (no active compose-sequence)
if (processStandalone) {
guiText .= (GSYM%guiCP% != "" ? GSYM%GuiCP% : guiCP)
; Start compose-sequence (non-delayed)
if (CM%guiCP% == 1 and CF%guiCP% == "")
guiFontOpts := guiCompFirstFontOpts
; Replace symbols for screen view
guiSym := GSYM%guiCP%
if (guiSym != "") {
guiText .= SubStr(guiSym,2)
; Apply special symbol styles
if (SubStr(guiSym,1,1) == "t")
guiFontOpts := guiToolFontOpts
} else {
guiText .= guiCP
}
}
; Encode label into string
; Encode label into windows-api string
guiPos := 0
While (guiText != "") {
if (SubStr(guiText,1,1)=="U") {
@ -191,15 +209,15 @@ BSTUpdate() {
; Apply label to GUI control
GuiControl, -Redraw, GuiKey%GuiPhysKey%
DllCall("SendMessageW", "UInt",GuiKey%GuiPhysKey%, "UInt",WM_SETTEXT, "UInt",0, "Uint",&ptrU)
if (guiFontOpts != guiFontOptsPrev) {
if (guiFontOpts != guiFontOptsPrev) {
Gui, Font, % guiFontOpts, % UniFontName
guiFontOptsPrev := guiFontOpts
}
GuiControl, Font, GuiKey%GuiPhysKey%
GuiControl, +Redraw, GuiKey%GuiPhysKey%
guiFontOptsPrev := guiFontOpts
}
GuiControl, Font, GuiKey%GuiPhysKey%
GuiControl, +Redraw, GuiKey%GuiPhysKey%
}
if (guiFontOptsPrev != BSTfontOpts)
Gui, Font, % BSTfontOpts, % UniFontName ; restore default font
Gui, Font, % BSTfontOpts, % UniFontName ; restore default font
; Update background graphics
local level := EbeneC
@ -847,9 +865,11 @@ CharProc__BSTK() {
BSTToggleKeyboardLayout()
}
GUISYM(sym,chars) {
; Replace 'chars' with 'sym' on screen.
; Set style="t" to highlight chars as a tool (typically starts on "P")
GUISYM(sym,chars,style:=" ") {
global
GSYM%sym% := EncodeUniComposeA(chars)
GSYM%sym% := style . EncodeUniCompose(chars)
}
BSTSymbols() {

View File

@ -17,10 +17,10 @@ CDS__CompU000052U00006F := "P__Rom4"
;CDS__CompU000072U000034 := "P__Rom4"
;CDS__CompU000052U000034 := "P__Rom4"
GUISYM("P__Rom1","")
GUISYM("P__Rom2","")
GUISYM("P__Rom3","vii")
GUISYM("P__Rom4","VII")
GUISYM("P__Rom1","","t")
GUISYM("P__Rom2","","t")
GUISYM("P__Rom3","vii","t")
GUISYM("P__Rom4","VII","t")
CharProc__Rom1() {
global
@ -181,8 +181,8 @@ CDS__CompU000064U000044 := "P__DUni"
CDS__CompU000044U000064 := "P__DUni"
CDS__CompU000044U000044 := "P__DUni"
GUISYM("P___Uni","UU")
GUISYM("P__DUni","DD")
GUISYM("P___Uni","UU","t")
GUISYM("P__DUni","DD","t")
CharProc___Uni() {
global
@ -310,8 +310,8 @@ SetFormat, Integer, hex
CDS__CompU000075U000063 := "P__Cal1"
CDS__CompU000055U000043 := "P__Cal2"
GUISYM("P__Cal1","uc")
GUISYM("P__Cal2","UC")
GUISYM("P__Cal1","uc","t")
GUISYM("P__Cal2","UC","t")
CharProc__Cal1() {
global
@ -503,6 +503,7 @@ PressHookCalc(PhysKey, ActKey, Char) {
CDS__CompU000055U000057 := "P___WMN"
CDS__CompU000075U000077 := "P___WMN"
GUISYM("P___WMN","UW","t")
CharProc___WMN() {
global