From ba46161970ef1bc494b504e9ff5e2a38085d62a3 Mon Sep 17 00:00:00 2001 From: mösi Date: Sat, 1 Nov 2008 06:21:03 +0000 Subject: caps/nocaps umgesetzt. Dazu gibt es einen Wechsel zwischen EbeneC und Ebene, wenn für eine Taste nocaps (NOC%PhysKey%) definiert ist. Die Behandlung von PR%PhysKey% hat so nicht immer richtig funktioniert (z.B. Mod4+F=SLeft, Mod4 loslassen). Jetzt wird die Taste losgelassen, bevor durch das Loslassen eines Modifiers ein neues Zeichen geschickt wird. in EbeneAktualisieren() wird die Ebene jetzt zwei mal berechnet: Einmal für die Zeichen, die CapsLock verwenden und dann noch einmal für die, die es ignorieren. Außerdem wird (hoffentlich) zur Performance-Optimierung auf die Funktionen GetKeyState() verzichtet, stattdessen wird das Drücken und Loslassen der Modifier selbst abgefragt und über deren Zustand Buch geführt. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.neo-layout.org@1074 b9310e46-f624-0410-8ea1-cfbb3a30dc96 --- windows/neo-vars/neo20-vars.ahk | 74 ++++++----- windows/neo-vars/recycle.ahk | 268 +++++++++++++++++++++++++++------------- 2 files changed, 224 insertions(+), 118 deletions(-) (limited to 'windows/neo-vars') diff --git a/windows/neo-vars/neo20-vars.ahk b/windows/neo-vars/neo20-vars.ahk index d5f9532..568bebd 100644 --- a/windows/neo-vars/neo20-vars.ahk +++ b/windows/neo-vars/neo20-vars.ahk @@ -33,6 +33,11 @@ AllStar(This_HotKey) { } else IsDown := 1 ActKey := PhysKey ; das könnte später für eine Transformation benutzt werden + if (NOC%ActKey% == 1) { + Ebene := EbeneC + Ebene7 := Ebene7C + Ebene8 := Ebene8C + } if (Ebene7 and (CP7%ActKey% != "")) Char := CP7%ActKey% else if (Ebene8 and (CP8%ActKey% != "")) @@ -58,7 +63,6 @@ CharStarDown(PhysKey, ActKey, char) { tosend := "" PP%PhysKey% := "" - PR%PhysKey% := "" if (CD%Comp% != "") { tosend := CD%Comp% @@ -73,7 +77,10 @@ CharStarDown(PhysKey, ActKey, char) { } if (strlen(tosend) > 5) { ; multiple chars - PP%PhysKey% := "" + if (PR%PhysKey% != "") + CharOutUp(PR%PhysKey%) + PR%PhysKey% := "" + loop { if (tosend == "") break ; erledigt @@ -86,12 +93,21 @@ CharStarDown(PhysKey, ActKey, char) { } } else if (tosend != "") if (SubStr(tosend,1,1)=="P") { - PP%PhysKey% := "" + if (PR%PhysKey% != "") + CharOutUp(PR%PhysKey%) + PR%PhysKey% := "" CharProc(SubStr(tosend,2)) } else { + if ((PR%PhysKey% != "") and (PR%PhysKey% != tosend)) + CharOutUp(PR%PhysKey%) PR%PhysKey% := tosend CharOutDown(tosend) } + else { + if (PR%PhysKey% != "") + CharOutUp(PR%PhysKey%) + PR%PhysKey% := "" + } } CharStarUp(PhysKey) { @@ -181,12 +197,12 @@ CharProc(subroutine) { else CharProc("LnS0") } else if (subroutine == "LnS1") { - ED("VKBASC01A","U0073","U1E9E","U00DF","" ,"U03C2","U2218") ; ß - ED("VK48SC023","U017F","U0053","U003F","U00BF","U03C3","U03A3","U0073") ; s + ED("VKBASC01A",1,"U0073","U1E9E","U00DF","" ,"U03C2","U2218") ; ß + ED("VK48SC023",1,"U017F","U0053","U003F","U00BF","U03C3","U03A3","U0073") ; s KeyboardLED(2,"on") } else if (subroutine == "LnS0") { - ED("VKBASC01A","U00DF","U1E9E","U017F","" ,"U03C2","U2218") ; ß - ED("VK48SC023","U0073","U0053","U003F","U00BF","U03C3","U03A3","U017F") ; s + ED("VKBASC01A",1,"U00DF","U1E9E","U017F","" ,"U03C2","U2218") ; ß + ED("VK48SC023",1,"U0073","U0053","U003F","U00BF","U03C3","U03A3","U017F") ; s KeyboardLED(2,"off") } else if (subroutine == "_VMt") { ; Belegungsvariante VM @@ -196,29 +212,29 @@ CharProc(subroutine) { else CharProc("_VM0") } else if (subroutine == "_VM1") { - ED("VK51SC010","U0079","U0059","U2026","U22EE","U03C5","U2207") ; y - ED("VK57SC011","U006F","U004F","U005F","U0008","U03BF","U2208") ; o - ED("VK45SC012","U0061","U0041","U005B","S__Up","U03B1","U2200") ; a - ED("VK52SC013","U0070","U0050","U005D","S_Del","U03C0","U03A0") ; p - ED("VK41SC01E","U0069","U0049","U005C","SHome","U03B9","U222B") ; i - ED("VK53SC01F","U0075","U0055","U002F","SLeft","P_Uni","U222E") ; u - ED("VK44SC020","U0065","U0045","U007B","SDown","U03B5","U2203") ; e - ED("VK46SC021","U0063","U0043","U007D","SRght","U03C7","U2102") ; c - ED("VK47SC022","U006C","U004C","U002A","S_End","U03BB","U039B") ; l - ED("VKDESC028","U0078","U0058","U0040","U002E","U03BE","U039E") ; x - ED("VK56SC02F","U0076","U0056","U007E","U000D","" ,"U2259") ; v + ED("VK51SC010",1,"U0079","U0059","U2026","U22EE","U03C5","U2207") ; y + ED("VK57SC011",1,"U006F","U004F","U005F","U0008","U03BF","U2208") ; o + ED("VK45SC012",1,"U0061","U0041","U005B","S__Up","U03B1","U2200") ; a + ED("VK52SC013",1,"U0070","U0050","U005D","S_Del","U03C0","U03A0") ; p + ED("VK41SC01E",1,"U0069","U0049","U005C","SHome","U03B9","U222B") ; i + ED("VK53SC01F",1,"U0075","U0055","U002F","SLeft","P_Uni","U222E") ; u + ED("VK44SC020",1,"U0065","U0045","U007B","SDown","U03B5","U2203") ; e + ED("VK46SC021",1,"U0063","U0043","U007D","SRght","U03C7","U2102") ; c + ED("VK47SC022",1,"U006C","U004C","U002A","S_End","U03BB","U039B") ; l + ED("VKDESC028",1,"U0078","U0058","U0040","U002E","U03BE","U039E") ; x + ED("VK56SC02F",1,"U0076","U0056","U007E","U000D","" ,"U2259") ; v } else if (subroutine == "_VM0") { - ED("VK51SC010","U0078","U0058","U2026","U22EE","U03BE","U039E") ; x - ED("VK57SC011","U0076","U0056","U005F","U0008","" ,"U2259") ; v - ED("VK45SC012","U006C","U004C","U005B","S__Up","U03BB","U039B") ; l - ED("VK52SC013","U0063","U0043","U005D","S_Del","U03C7","U2102") ; c - ED("VK41SC01E","U0075","U0055","U005C","SHome","P_Uni","U222E") ; u - ED("VK53SC01F","U0069","U0049","U002F","SLeft","U03B9","U222B") ; i - ED("VK44SC020","U0061","U0041","U007B","SDown","U03B1","U2200") ; a - ED("VK46SC021","U0065","U0045","U007D","SRght","U03B5","U2203") ; e - ED("VK47SC022","U006F","U004F","U002A","S_End","U03BF","U2208") ; o - ED("VKDESC028","U0079","U0059","U0040","U002E","U03C5","U2207") ; y - ED("VK56SC02F","U0070","U0050","U007E","U000D","U03C0","U03A0") ; p + ED("VK51SC010",1,"U0078","U0058","U2026","U22EE","U03BE","U039E") ; x + ED("VK57SC011",1,"U0076","U0056","U005F","U0008","" ,"U2259") ; v + ED("VK45SC012",1,"U006C","U004C","U005B","S__Up","U03BB","U039B") ; l + ED("VK52SC013",1,"U0063","U0043","U005D","S_Del","U03C7","U2102") ; c + ED("VK41SC01E",1,"U0075","U0055","U005C","SHome","P_Uni","U222E") ; u + ED("VK53SC01F",1,"U0069","U0049","U002F","SLeft","U03B9","U222B") ; i + ED("VK44SC020",1,"U0061","U0041","U007B","SDown","U03B1","U2200") ; a + ED("VK46SC021",1,"U0065","U0045","U007D","SRght","U03B5","U2203") ; e + ED("VK47SC022",1,"U006F","U004F","U002A","S_End","U03BF","U2208") ; o + ED("VKDESC028",1,"U0079","U0059","U0040","U002E","U03C5","U2207") ; y + ED("VK56SC02F",1,"U0070","U0050","U007E","U000D","U03C0","U03A0") ; p } } diff --git a/windows/neo-vars/recycle.ahk b/windows/neo-vars/recycle.ahk index 2a46b1a..e35ac23 100644 --- a/windows/neo-vars/recycle.ahk +++ b/windows/neo-vars/recycle.ahk @@ -157,8 +157,17 @@ Sonstige Variablen */ guiErstellt := 0 alwaysOnTop := 1 -IsMod4Locked := 0 +isShiftRPressed := 0 +isShiftLPressed := 0 +isShiftPressed := 0 isMod2Locked := 0 +IsMod3RPressed := 0 +IsMod3LPressed := 0 +IsMod3Pressed := 0 +IsMod4RPressed := 0 +IsMod4LPressed := 0 +IsMod4Pressed := 0 +IsMod4Locked := 0 ; die Nachfolgenden sind nützlich um sich die Qwertz-Tasten abzugewöhnen, da alle auf der 4. Ebene vorhanden. lernModus_std_Return := 0 lernModus_std_Backspace := 0 @@ -184,68 +193,85 @@ lernModus_neo_Entf := 1 EbeneAktualisieren() { global - Modstate := IsMod4Pressed() . IsMod3Pressed() . IsShiftPressed() + Modstate := IsMod4Active() . IsMod3Active() . IsShiftActive() Ebene7 := 0 Ebene8 := 0 - if (Modstate = "000") ; Ebene 1: Ohne Mod - Ebene = 1 - else if (Modstate = "001") ; Ebene 2: Shift - Ebene = 2 - else if (Modstate = "010") ; Ebene 3: Mod3 - Ebene = 3 - else if (Modstate = "100") ; Ebene 4: Mod4 - Ebene = 4 - else if (Modstate = "011") ; Ebene 5: Shift+Mod3 - Ebene = 5 - else if (Modstate = "110") ; Ebene 6: Mod3+Mod4 - Ebene = 6 - else if (Modstate = "101") ; Ebene 7: Shift+Mod4 impliziert Ebene 4 - { - Ebene = 4 - Ebene7 = 1 + if (Modstate = "000") ; Ebene 1: Ohne Mod + Ebene := 1 + else if (Modstate = "001") ; Ebene 2: Shift + Ebene := 2 + else if (Modstate = "010") ; Ebene 3: Mod3 + Ebene := 3 + else if (Modstate = "100") ; Ebene 4: Mod4 + Ebene := 4 + else if (Modstate = "011") ; Ebene 5: Shift+Mod3 + Ebene := 5 + else if (Modstate = "110") ; Ebene 6: Mod3+Mod4 + Ebene := 6 + else if (Modstate = "101") { ; Ebene 7: Shift+Mod4 impliziert Ebene 4 + Ebene := 4 + Ebene7 := 1 + } else if (Modstate = "111") { ; Ebene 8: Shift+Mod3+Mod4 impliziert Ebene 6 + Ebene := 6 + Ebene8 := 1 } - else if (Modstate = "111") ; Ebene 8: Shift+Mod3+Mod4 impliziert Ebene 6 - { - Ebene = 6 - Ebene8 = 1 + + ; jetzt für Tasten, die Mod2Locked ignorieren + Modstate := IsMod4Active() . IsMod3Active() . IsShiftPressed + Ebene7C := 0 + Ebene8C := 0 + if (Modstate = "000") ; Ebene 1: Ohne Mod + EbeneC := 1 + else if (Modstate = "001") ; Ebene 2: Shift + EbeneC := 2 + else if (Modstate = "010") ; Ebene 3: Mod3 + EbeneC := 3 + else if (Modstate = "100") ; Ebene 4: Mod4 + EbeneC := 4 + else if (Modstate = "011") ; Ebene 5: Shift+Mod3 + EbeneC := 5 + else if (Modstate = "110") ; Ebene 6: Mod3+Mod4 + EbeneC := 6 + else if (Modstate = "101") { ; Ebene 7: Shift+Mod4 impliziert Ebene 4 + EbeneC := 4 + Ebene7C := 1 + } else if (Modstate = "111") { ; Ebene 8: Shift+Mod3+Mod4 impliziert Ebene 6 + EbeneC := 6 + Ebene8C := 1 } } -IsShiftPressed() -{ +IsShiftActive() { global - if GetKeyState("Shift","P") - if isMod2Locked and !noCaps + if (isMod2Locked) + if (isShiftPressed) return 0 else return 1 else - if isMod2Locked and !noCaps + if (isShiftPressed) return 1 else return 0 - noCaps = 0 } -IsMod3Pressed() -{ +IsMod3Active() { global - return ((GetKeyState("CapsLock","P")) or (GetKeyState("#","P"))) + return isMod3Pressed } -IsMod4Pressed() -{ - global - if( not(einHandNeo) or not(spacepressed)) - if IsMod4Locked - return (not ( GetKeyState("<","P") or GetKeyState("SC138","P"))) - else - return ( GetKeyState("<","P") or GetKeyState("SC138","P")) - else - if IsMod4Lock - return (not ( GetKeyState("<","P") or GetKeyState("SC138","P") or GetKeyState("ä","P"))) - else - return ( GetKeyState("<","P") or GetKeyState("SC138","P") or GetKeyState("ä","P")) +IsMod4Active() { + global + if (isMod4Locked) + if (isMod4Pressed) + return 0 + else + return 1 + else + if (isMod4Pressed) + return 1 + else + return 0 } /* @@ -514,28 +540,71 @@ return ; KeyboardLED(4,"switch") hatte ich zuerst genommen, aber ; das schaltet, oh Wunder, die LED nicht wieder aus. -VKA1SC136 & VKA0SC02A:: ; RShift, dann LShift -VKA0SC02A & VKA1SC136:: ; LShift, dann RShift - if (GetKeyState("VKA1SC136", "P") and GetKeyState("VKA0SC02A", "P")) +~*VKA1SC136:: + if (isShiftLPressed and !isShiftRPressed) + ToggleMod2Lock() + isShiftRPressed := 1 + isShiftPressed := 1 +return + +~*VKA1SC136 up:: + isShiftRPressed := 0 + isShiftPressed := isShiftLPressed +return + +~*VKA0SC02A:: + if (isShiftRPressed and !isShiftLPressed) + ToggleMod2Lock() + isShiftLPressed := 1 + isShiftPressed := 1 +return + +~*VKA0SC02A up:: + isShiftLPressed := 0 + isShiftPressed := isShiftRPressed +return + +ToggleMod2Lock() { + global + if (isMod2Locked) { - if isMod2Locked - { - isMod2Locked = 0 - KeyboardLED(4,"off") - } - else - { - isMod2Locked = 1 - KeyBoardLED(4,"on") - } + isMod2Locked := 0 + KeyboardLED(4,"off") + } + else + { + isMod2Locked := 1 + KeyBoardLED(4,"on") } +} + + +*VKBFSC02B:: + if (isMod3LPressed and !isMod3RPressed) + CharStarDown("MOD3", "MOD3", "SComp") + isMod3RPressed := 1 + isMod3Pressed := 1 return -;Mod3-Tasten (Wichtig, sie werden sonst nicht verarbeitet!) -*VKBFSC02B:: ; # -*VK14SC03A:: ; CapsLock - if GetKeyState("VKBFSC02B", "P") and GetKeyState("VK14SC03A", "P") - CharStarDown("", "", "SComp") +*VKBFSC02B up:: + if (isMod3LPressed) + CharStarUp("MOD3") + isMod3RPressed := 0 + isMod3Pressed := isMod3LPressed +return + +*VK14SC03A:: + if (isMod3RPressed and !isMod3LPressed) + CharStarDown("MOD3", "MOD3", "SComp") + isMod3LPressed := 1 + isMod3Pressed := 1 +return + +*VK14SC03A up:: + if (isMod3RPressed) + CharStarUp("MOD3") + isMod3LPressed := 0 + isMod3Pressed := isMod3RPressed return ;Mod4+Mod4 == Mod4-Lock @@ -545,27 +614,48 @@ return ; angezeigt. *VKA5SC138:: + wasMod4RPressed := isMod4RPressed + isMod4RPressed := 1 + isMod4Pressed := 1 + if (isMod4LPressed and !wasMod4RPressed) + ToggleMod4Lock() +return + +*VKA5SC138 up:: + isMod4RPressed := 0 + isMod4Pressed := isMod4LPressed +return + *VKE2SC056:: - if (GetKeyState("VKA5SC138", "P") and GetKeyState("VKE2SC056", "P")) - { - if IsMod4Locked - { - if zeigeLockBox - MsgBox Mod4-Feststellung aufgebehoben! - IsMod4Locked = 0 - if UseMod4Light - KeyboardLED(1,"off") - } - else - { - if zeigeLockBox - MsgBox Mod4 festgestellt: Um Mod4 wieder zu lösen, drücke beide Mod4-Tasten gleichzeitig! - IsMod4Locked = 1 - if UseMod4Light - KeyboardLED(1,"on") - } - } + wasMod4LPressed := isMod4LPressed + isMod4LPressed := 1 + isMod4Pressed := 1 + if (isMod4RPressed and !wasMod4LPressed) + ToggleMod4Lock() return + +*VKE2SC056 up:: + isMod4LPressed := 0 + isMod4Pressed := isMod4RPressed +return + +ToggleMod4Lock() { + global + if (IsMod4Locked) { + IsMod4Locked := 0 + if (UseMod4Light) + KeyboardLED(1,"off") + if (zeigeLockBox) + MsgBox Mod4-Feststellung aufgehoben! + } else { + IsMod4Locked := 1 + if (UseMod4Light) + KeyboardLED(1,"on") + if (zeigeLockBox) + MsgBox Mod4 festgestellt: Um Mod4 wieder zu lösen, drücke beide Mod4-Tasten gleichzeitig! + } +} + /* ------------------------------------------------------ BildschirmTastatur @@ -573,49 +663,49 @@ return */ F1:: - if(isMod4Pressed()&&zeigeBildschirmTastatur) + if(isMod4Active() && zeigeBildschirmTastatur) goto Switch1 else send {blind}{F1} return F2:: - if(isMod4Pressed()&&zeigeBildschirmTastatur) + if(isMod4Active() && zeigeBildschirmTastatur) goto Switch2 else send {blind}{F2} return F3:: - if(isMod4Pressed()&&zeigeBildschirmTastatur) + if(isMod4Active() && zeigeBildschirmTastatur) goto Switch3 else send {blind}{F3} return F4:: - if(isMod4Pressed()&&zeigeBildschirmTastatur) + if(isMod4Active() && zeigeBildschirmTastatur) goto Switch4 else send {blind}{F4} return F5:: - if(isMod4Pressed()&&zeigeBildschirmTastatur) + if(isMod4Active() && zeigeBildschirmTastatur) goto Switch5 else send {blind}{F5} return F6:: - if(isMod4Pressed()&&zeigeBildschirmTastatur) + if(isMod4Active() && zeigeBildschirmTastatur) goto Switch6 else send {blind}{F6} return F7:: - if(isMod4Pressed()&&zeigeBildschirmTastatur) + if(isMod4Active() && zeigeBildschirmTastatur) goto Show else send {blind}{F7} return F8:: - if(isMod4Pressed()&&zeigeBildschirmTastatur) + if(isMod4Active() && zeigeBildschirmTastatur) goto ToggleAlwaysOnTop else send {blind}{F8} return -- cgit v1.2.3