From d8fe9b7b32644d110a09206100d66213b7caa6ab Mon Sep 17 00:00:00 2001 From: mösi Date: Wed, 8 Jul 2009 20:49:29 +0000 Subject: Jetzt mal eine Variante der LED-Umschaltung, die auch mit der Lang-Å¿-Tastatur richtig laufen sollte. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.neo-layout.org@1917 b9310e46-f624-0410-8ea1-cfbb3a30dc96 --- windows/neo-vars/src/source/initialize.ahk | 49 +++++++++++++------------- windows/neo-vars/src/source/keyboardleds.ahk | 17 +++++++++ windows/neo-vars/src/source/langstastatur.ahk | 4 +-- windows/neo-vars/src/source/levelfunctions.ahk | 18 ++++++---- windows/neo-vars/src/source/tray.ahk | 6 ++-- 5 files changed, 58 insertions(+), 36 deletions(-) (limited to 'windows') diff --git a/windows/neo-vars/src/source/initialize.ahk b/windows/neo-vars/src/source/initialize.ahk index 6e233bb..94a340e 100644 --- a/windows/neo-vars/src/source/initialize.ahk +++ b/windows/neo-vars/src/source/initialize.ahk @@ -33,10 +33,10 @@ enable=Aktiviere %name% disable=Deaktiviere %name% #LTrim ; Quelltext kann eingerückt werden -SetCapsLockState Off -SetScrollLockState Off -NEONumLockLEDState := "Off" -SetNEONumLockState() +NEONumLockLEDState := "Off" +NEOCapsLockLEDState := "Off" +NEOScrollLockLEDState := "Off" +SetNEOLockStates() OnExit, exitprogram EnvGet, WindowsEnvAppDataFolder, APPDATA @@ -92,31 +92,30 @@ IsMod4Pressed := 0 IsMod4Locked := 0 EbeneAktualisieren := "NEOEbeneAktualisieren" -SaveNumLockState() { +SetNEOLockStates() { global - if GetKeyState("NumLock","T") - SavedNumLockState:="On" - else - SavedNumLockState:="Off" + SavedNumLockState := GetKeyState("NumLock","T") + SavedScrollLockState := GetKeyState("ScrollLock","T") + SavedCapsLockState := GetKeyState("CapsLock","T") + SwitchIs0 := "Off" + SwitchIs1 := "On" + SavedNumLockState := SwitchIs%SavedNumLockState% + SavedScrollLockState := SwitchIs%SavedScrollLockState% + SavedCapsLockState := SwitchIs%SavedCapsLockState% + SetNumLockState, On + SetScrollLockState, Off + SetCapsLockState, Off + Sleep,1 + UpdateNEOLEDS() } -SetNEONumLockState() { +SetOldLockStates() { global - SaveNumLockState() - if (SavedNumLockState == "Off") { - SetNumLockState, On - Sleep, 1 ; damit sich das Aktivieren von NumLock nicht mit dem Deaktivieren der LED prügeln muss - } - KeyboardLED(2,NEONumLockLEDState) ; NumLock-LED richtig stellen -} - -SetOldNumLockState() { - global - if (SavedNumLockState == "Off") { - SetNumLockState, Off ; deaktiviert auch die eventuell eingeschaltete NumLockLED - Sleep, 1 - } else if (NEONumLockLEDState == "Off") - KeyboardLED(2,"on") + UpdateOldLEDS() + Sleep,1 + SetNumLockState,% SavedNumLockState + SetScrollLockState,% SavedScrollLockState + SetCapsLockState,% SavedCapsLockState } %EbeneAktualisieren%() diff --git a/windows/neo-vars/src/source/keyboardleds.ahk b/windows/neo-vars/src/source/keyboardleds.ahk index 662d4c2..ccd7e96 100644 --- a/windows/neo-vars/src/source/keyboardleds.ahk +++ b/windows/neo-vars/src/source/keyboardleds.ahk @@ -1,3 +1,20 @@ +UpdateOldLEDS() { + global + SwitchIsOn := 1 + SwitchIsOff := 0 + Num := SwitchIs%SavedScrollLockState% + 2*SwitchIs%SavedNumLockState% + 4*SwitchIs%SavedCapsLockState% + KeyboardLED(Num,"switch") +} + +UpdateNEOLEDS() { + global + SwitchIsOn := 1 + SwitchIsOff := 0 + Num := SwitchIs%NEOScrollLockLEDState% + 2*SwitchIs%NEONumLockLEDState% + 4*SwitchIs%NEOCapsLockLEDState% + KeyboardLED(Num,"switch") +} + + ;ScrollLock=1, NumLock=2, CapsLock=4, bzw. eine beliebige Summe dieser Werte KeyboardLED(LEDvalue, Cmd){ ; LEDvalue: ScrollLock=1, NumLock=2, CapsLock=4 ; Cmd = on/off/switch Static h_device diff --git a/windows/neo-vars/src/source/langstastatur.ahk b/windows/neo-vars/src/source/langstastatur.ahk index 4a141cc..c116128 100644 --- a/windows/neo-vars/src/source/langstastatur.ahk +++ b/windows/neo-vars/src/source/langstastatur.ahk @@ -24,8 +24,8 @@ CharProc__LnS1() { ; Lange-s-Tastatur aktivieren ED("VKBASC01A",1,"U000073","U001E9E","U0000DF","" ,"U0003C2","U002218") ; ß ED("VK48SC023",1,"U00017F","U000053","U00003F","U0000BF","U0003C3","U0003A3") ; s - KeyboardLED(2,"on") NEONumLockLEDState := "On" + UpdateNEOLEDS() } CharProc__LnS0() { @@ -33,8 +33,8 @@ CharProc__LnS0() { ; Lange-s-Tastatur deaktivieren ED("VKBASC01A",1,"U0000DF","U001E9E","U00017F","" ,"U0003C2","U002218") ; ß ED("VK48SC023",1,"U000073","U000053","U00003F","U0000BF","U0003C3","U0003A3") ; s - KeyboardLED(2,"off") NEONumLockLEDState := "Off" + UpdateNEOLEDS() if (zeigeModusBox) TrayTip,Lange-s-Tastatur,Die Lange-s-Belegungsvariante wurde aktiviert. Zum Deaktivieren`, Mod3+F11 drücken.,10,1 } diff --git a/windows/neo-vars/src/source/levelfunctions.ahk b/windows/neo-vars/src/source/levelfunctions.ahk index 5d5eff2..c0a4ec1 100644 --- a/windows/neo-vars/src/source/levelfunctions.ahk +++ b/windows/neo-vars/src/source/levelfunctions.ahk @@ -68,12 +68,14 @@ ToggleMod2Lock() { if (isMod2Locked) { isMod2Locked := 0 - KeyboardLED(4,"off") + NEOCapsLockLEDState := "Off" + UpdateNEOLEDS() } else { isMod2Locked := 1 - KeyBoardLED(4,"on") + NEOCapsLockLEDState := "On" + UpdateNEOLEDS() } } @@ -82,14 +84,18 @@ ToggleMod4Lock() { global if (IsMod4Locked) { IsMod4Locked := 0 - if (UseMod4Light) - KeyboardLED(1,"off") + if (UseMod4Light) { + NEOScrollLockLEDState := "Off" + UpdateNEOLEDS() + } if (zeigeLockBox) TrayTip,Mod4-Feststellung,Die Feststellung wurde aufgehoben.,3,1 } else { IsMod4Locked := 1 - if (UseMod4Light) - KeyboardLED(1,"on") + if (UseMod4Light) { + NEOScrollLockLEDState := "On" + UpdateNEOLEDS() + } if (zeigeLockBox) TrayTip,Mod4-Feststellung,Um Mod4 wieder zu lösen`, drücke beide Mod4-Tasten gleichzeitig!,3,1 } diff --git a/windows/neo-vars/src/source/tray.ahk b/windows/neo-vars/src/source/tray.ahk index ffef082..d2aed3b 100644 --- a/windows/neo-vars/src/source/tray.ahk +++ b/windows/neo-vars/src/source/tray.ahk @@ -59,7 +59,7 @@ hide: return exitprogram: - SetOldNumLockState() + SetOldLockStates() exitapp return @@ -71,13 +71,13 @@ Traytogglesuspend() { menu, tray, rename, %enable%, %disable% menu, tray, tip, %name% menu, tray, icon, %ResourceFolder%\neo_enabled.ico,,1 - SetNEONumLockState() + SetNEOLockStates() suspend, off ; Schaltet Suspend aus -> NEO } else { menu, tray, rename, %disable%, %enable% menu, tray, tip, %name% : Deaktiviert menu, tray, icon, %ResourceFolder%\neo_disabled.ico,,1 - SetOldNumLockState() + SetOldLockStates() suspend, on ; Schaltet Suspend ein -> QWERTZ } } -- cgit v1.2.3