diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d8d8f4d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +InputTipCursor +InputTipSymbol diff --git a/README.md b/README.md index 2d475b4..9724811 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ - 默认中文状态为 **红色**,英文状态为 **蓝色**,大写锁定为 **绿色** - 在 [更多已适配的鼠标样式](https://inputtip.pages.dev/download/extra) 中有提供它们的左手镜像版本 - 根据输入法状态在输入光标附近显示不同的 [符号](#关于符号) - - 默认使用 [白名单机制](https://inputtip.pages.dev/FAQ/about-white-list/) + - 默认使用 [白名单机制](https://inputtip.pages.dev/FAQ/white-list/) - 切换不同应用窗口时,自动切换指定的输入法状态(中文/英文/大写锁定) - 快捷键强制切换输入法状态 - 详尽的自定义配置菜单 @@ -321,12 +321,17 @@ - `【自定义】模式` - - 一个万能的模式,需要根据实际情况设置状态码和切换码 - - 详情参考: [关于【自定义】模式](https://inputtip.pages.dev/FAQ/about-input-mode-custom) - - `设置输入法模式` => `自定义` 进行配置: - - [小狼毫(rime)输入法](https://rime.im/download/): 勾选 `切换码规则` 中的 `使用偶数` - - [讯飞输入法](https://srf.xunfei.cn/): 勾选 `状态码规则` 中的 `使用奇数` - - [手心输入法](https://www.xinshuru.com/): 在 `切换码数字`的输入框中填入 `1` + - 一个万能的模式,需要根据实际情况设置状态码(规则)和切换码(规则) + - 详情参考: [关于【自定义】模式](https://inputtip.pages.dev/FAQ/custom-input-mode) + - 可以通过 `设置输入法模式` => `自定义` 使用以下已知可用的配置: + - [小鹤音形](https://flypy.com/download/) + - 经过测试,`v10.11.4` 版本中,在 `切换码数字`的输入框中填入 `257` 即可 + - [小狼毫(rime)输入法](https://rime.im/download/) + - 经过测试,`v0.16.1` 版本中,勾选 `切换码规则` 中的 `使用偶数` 即可 + - [讯飞输入法](https://srf.xunfei.cn/) + - 经过测试,`v3.0` 版本中,勾选 `状态码规则` 中的 `使用奇数` 即可 + - [手心输入法](https://www.xinshuru.com/) + - 经过测试,`v3.1` 版本中,在 `切换码数字`的输入框中填入 `1` 即可 - 兼容性一般,因为获取到的输入法状态可能有误,导致基于此的相关功能都可能有问题。 #### [应用窗口兼容情况](https://inputtip.pages.dev/FAQ/support-app-list) diff --git a/src/v2/CHANGELOG.md b/src/v2/CHANGELOG.md index 66b9dbf..397197d 100644 --- a/src/v2/CHANGELOG.md +++ b/src/v2/CHANGELOG.md @@ -8,13 +8,36 @@ > > 所有代码完成重构 -- 当鼠标悬浮在符号上时,符号立即隐藏 - - 此功能在 `2.28.0` 中由于存在问题被移除,现在重新添加 -- 将 `设置输入法模式` 中的 `讯飞输入法` 和 `手心输入法` 模式合并到 `自定义` 中 - - 现在只有两个模式: `通用` 和 `自定义` -- 在 `自定义` 中,添加了 `状态码规则` 和 `切换码规则` -- 文本符号中所有配置独立,不再依赖方块符号中的配置 - - `2.31.0` 之前的版本,文本符号的透明度、偏移量、边框样式、背景颜色由方块符号中的相同配置决定 +- 新增 + + 1. 当鼠标悬浮在符号上时,符号立即隐藏 + + - 此功能在 `2.28.0` 中由于存在问题被移除,现在重新添加 + + 2. 在 `设置输入法模式` 的 `自定义` 中,添加了 `状态码规则`、`切换码规则` 和 `以哪一种状态作为判断依据` + + 3. 为符号添加了不同状态下符号的独立配置 + +- 变动 + + 1. 将 `设置输入法模式` 中的 `讯飞输入法` 和 `手心输入法` 模式合并到 `自定义` 中 + + - 现在只有两种输入法模式: `通用` 和 `自定义` + + 2. 文本符号中所有配置独立,不再依赖方块符号中的配置 + + - `2.31.0` 之前的版本,文本符号的透明度、偏移量、边框样式、背景颜色由方块符号中的相同配置决定 + + 3. 统一配置项的值的计算,部分之前跟随 `DPI` 缩放的配置项不再跟随 `DPI` 缩放 + + - 这会导致从版本更改后符号可能会变小,你需要重新调整宽高大小 + + 4. 减少了对 powershell 的依赖 + - 现在,如果你不使用以下两个功能,就不会因为 powershell 的任何问题报错 + - `启用 JAB/JetBrains IDE 支持` + - `开机自启动` 中的 `任务计划程序` + - 但是这也导致了 `InputTip.exe` 变大了许多,不过也只有大约 6 MB 左右 + - 其他的修复和优化 ## 2.30.2 diff --git a/src/v2/InputTip.JAB.JetBrains.exe b/src/v2/InputTip.JAB.JetBrains.exe index c168de7..384f1d3 100644 Binary files a/src/v2/InputTip.JAB.JetBrains.exe and b/src/v2/InputTip.JAB.JetBrains.exe differ diff --git a/src/v2/InputTip.ahk b/src/v2/InputTip.ahk index 5c1c539..8b7bf3e 100644 --- a/src/v2/InputTip.ahk +++ b/src/v2/InputTip.ahk @@ -23,6 +23,7 @@ HKEY_startup := "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\Curre gc := { init: 0, timer: 0, + tab: 0, ; 记录所有的窗口 Gui,同一个 Gui 只允许存在一个 w: { ; 开机自启动 @@ -61,17 +62,22 @@ gc := { } if (A_IsCompiled) { + favicon := A_ScriptFullPath ; 生成特殊的快捷方式,它会通过任务计划程序启动 if (!FileExist(fileLnk)) { - FileCreateShortcut("C:\WINDOWS\system32\schtasks.exe", fileLnk, , "/run /tn `"abgox.InputTip.noUAC`"", , A_ScriptFullPath, , , 7) + FileCreateShortcut("C:\WINDOWS\system32\schtasks.exe", fileLnk, , "/run /tn `"abgox.InputTip.noUAC`"", , favicon, , , 7) } ; 生成任务计划程序 try { Run('powershell -NoProfile -Command $action = New-ScheduledTaskAction -Execute "`'\"' A_ScriptFullPath '\"`'";$principal = New-ScheduledTaskPrincipal -UserId "' A_UserName '" -LogonType ServiceAccount -RunLevel Highest;$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable -DontStopOnIdleEnd -ExecutionTimeLimit 10 -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1);$task = New-ScheduledTask -Action $action -Principal $principal -Settings $settings;Register-ScheduledTask -TaskName "abgox.InputTip.noUAC" -InputObject $task -Force', , "Hide") + powershell := 1 + } catch { + powershell := 0 } } else { - TraySetIcon("InputTipSymbol\default\favicon.png", , 1) + favicon := A_ScriptDir "\img\favicon.ico" + TraySetIcon(favicon, , 1) } checkIni() ; 检查配置文件 diff --git a/src/v2/InputTipCursor/default/CN/AppStarting.ani b/src/v2/InputTipCursor/default/CN/AppStarting.ani new file mode 100644 index 0000000..4886c74 Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/AppStarting.ani differ diff --git a/src/v2/InputTipCursor/default/CN/Arrow.cur b/src/v2/InputTipCursor/default/CN/Arrow.cur new file mode 100644 index 0000000..e5fa9c2 Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/Arrow.cur differ diff --git a/src/v2/InputTipCursor/default/CN/Cross.cur b/src/v2/InputTipCursor/default/CN/Cross.cur new file mode 100644 index 0000000..3e1a211 Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/Cross.cur differ diff --git a/src/v2/InputTipCursor/default/CN/Hand.cur b/src/v2/InputTipCursor/default/CN/Hand.cur new file mode 100644 index 0000000..0ba3a91 Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/Hand.cur differ diff --git a/src/v2/InputTipCursor/default/CN/Help.cur b/src/v2/InputTipCursor/default/CN/Help.cur new file mode 100644 index 0000000..6b45935 Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/Help.cur differ diff --git a/src/v2/InputTipCursor/default/CN/IBeam.cur b/src/v2/InputTipCursor/default/CN/IBeam.cur new file mode 100644 index 0000000..1d5a404 Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/IBeam.cur differ diff --git a/src/v2/InputTipCursor/default/CN/No.cur b/src/v2/InputTipCursor/default/CN/No.cur new file mode 100644 index 0000000..5d9e3dd Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/No.cur differ diff --git a/src/v2/InputTipCursor/default/CN/Pen.cur b/src/v2/InputTipCursor/default/CN/Pen.cur new file mode 100644 index 0000000..71dec4d Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/Pen.cur differ diff --git a/src/v2/InputTipCursor/default/CN/SizeAll.cur b/src/v2/InputTipCursor/default/CN/SizeAll.cur new file mode 100644 index 0000000..7faeec9 Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/SizeAll.cur differ diff --git a/src/v2/InputTipCursor/default/CN/SizeNESW.cur b/src/v2/InputTipCursor/default/CN/SizeNESW.cur new file mode 100644 index 0000000..ef7bc18 Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/SizeNESW.cur differ diff --git a/src/v2/InputTipCursor/default/CN/SizeNS.cur b/src/v2/InputTipCursor/default/CN/SizeNS.cur new file mode 100644 index 0000000..cbde32f Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/SizeNS.cur differ diff --git a/src/v2/InputTipCursor/default/CN/SizeNWSE.cur b/src/v2/InputTipCursor/default/CN/SizeNWSE.cur new file mode 100644 index 0000000..6f20888 Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/SizeNWSE.cur differ diff --git a/src/v2/InputTipCursor/default/CN/SizeWE.cur b/src/v2/InputTipCursor/default/CN/SizeWE.cur new file mode 100644 index 0000000..a9d8e56 Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/SizeWE.cur differ diff --git a/src/v2/InputTipCursor/default/CN/UpArrow.cur b/src/v2/InputTipCursor/default/CN/UpArrow.cur new file mode 100644 index 0000000..75fafb2 Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/UpArrow.cur differ diff --git a/src/v2/InputTipCursor/default/CN/Wait.ani b/src/v2/InputTipCursor/default/CN/Wait.ani new file mode 100644 index 0000000..b363a27 Binary files /dev/null and b/src/v2/InputTipCursor/default/CN/Wait.ani differ diff --git a/src/v2/InputTipCursor/default/Caps/AppStarting.ani b/src/v2/InputTipCursor/default/Caps/AppStarting.ani new file mode 100644 index 0000000..00248d6 Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/AppStarting.ani differ diff --git a/src/v2/InputTipCursor/default/Caps/Arrow.cur b/src/v2/InputTipCursor/default/Caps/Arrow.cur new file mode 100644 index 0000000..d77afd6 Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/Arrow.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/Cross.cur b/src/v2/InputTipCursor/default/Caps/Cross.cur new file mode 100644 index 0000000..195f4f9 Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/Cross.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/Hand.cur b/src/v2/InputTipCursor/default/Caps/Hand.cur new file mode 100644 index 0000000..965c070 Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/Hand.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/Help.cur b/src/v2/InputTipCursor/default/Caps/Help.cur new file mode 100644 index 0000000..a6a24c0 Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/Help.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/IBeam.cur b/src/v2/InputTipCursor/default/Caps/IBeam.cur new file mode 100644 index 0000000..dce9505 Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/IBeam.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/No.cur b/src/v2/InputTipCursor/default/Caps/No.cur new file mode 100644 index 0000000..5d9e3dd Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/No.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/Pen.cur b/src/v2/InputTipCursor/default/Caps/Pen.cur new file mode 100644 index 0000000..8ed875a Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/Pen.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/SizeAll.cur b/src/v2/InputTipCursor/default/Caps/SizeAll.cur new file mode 100644 index 0000000..c94460b Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/SizeAll.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/SizeNESW.cur b/src/v2/InputTipCursor/default/Caps/SizeNESW.cur new file mode 100644 index 0000000..4470e0c Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/SizeNESW.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/SizeNS.cur b/src/v2/InputTipCursor/default/Caps/SizeNS.cur new file mode 100644 index 0000000..cfbf90c Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/SizeNS.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/SizeNWSE.cur b/src/v2/InputTipCursor/default/Caps/SizeNWSE.cur new file mode 100644 index 0000000..3db6479 Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/SizeNWSE.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/SizeWE.cur b/src/v2/InputTipCursor/default/Caps/SizeWE.cur new file mode 100644 index 0000000..b13339d Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/SizeWE.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/UpArrow.cur b/src/v2/InputTipCursor/default/Caps/UpArrow.cur new file mode 100644 index 0000000..f36c24a Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/UpArrow.cur differ diff --git a/src/v2/InputTipCursor/default/Caps/Wait.ani b/src/v2/InputTipCursor/default/Caps/Wait.ani new file mode 100644 index 0000000..48e4417 Binary files /dev/null and b/src/v2/InputTipCursor/default/Caps/Wait.ani differ diff --git a/src/v2/InputTipCursor/default/EN/AppStarting.ani b/src/v2/InputTipCursor/default/EN/AppStarting.ani new file mode 100644 index 0000000..58e87d7 Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/AppStarting.ani differ diff --git a/src/v2/InputTipCursor/default/EN/Arrow.cur b/src/v2/InputTipCursor/default/EN/Arrow.cur new file mode 100644 index 0000000..6f679a6 Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/Arrow.cur differ diff --git a/src/v2/InputTipCursor/default/EN/Cross.cur b/src/v2/InputTipCursor/default/EN/Cross.cur new file mode 100644 index 0000000..af1c35a Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/Cross.cur differ diff --git a/src/v2/InputTipCursor/default/EN/Hand.cur b/src/v2/InputTipCursor/default/EN/Hand.cur new file mode 100644 index 0000000..afe5c64 Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/Hand.cur differ diff --git a/src/v2/InputTipCursor/default/EN/Help.cur b/src/v2/InputTipCursor/default/EN/Help.cur new file mode 100644 index 0000000..87ed553 Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/Help.cur differ diff --git a/src/v2/InputTipCursor/default/EN/IBeam.cur b/src/v2/InputTipCursor/default/EN/IBeam.cur new file mode 100644 index 0000000..a5768eb Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/IBeam.cur differ diff --git a/src/v2/InputTipCursor/default/EN/No.cur b/src/v2/InputTipCursor/default/EN/No.cur new file mode 100644 index 0000000..5d9e3dd Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/No.cur differ diff --git a/src/v2/InputTipCursor/default/EN/Pen.cur b/src/v2/InputTipCursor/default/EN/Pen.cur new file mode 100644 index 0000000..6758b57 Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/Pen.cur differ diff --git a/src/v2/InputTipCursor/default/EN/SizeAll.cur b/src/v2/InputTipCursor/default/EN/SizeAll.cur new file mode 100644 index 0000000..2bf91e0 Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/SizeAll.cur differ diff --git a/src/v2/InputTipCursor/default/EN/SizeNESW.cur b/src/v2/InputTipCursor/default/EN/SizeNESW.cur new file mode 100644 index 0000000..5d5b85c Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/SizeNESW.cur differ diff --git a/src/v2/InputTipCursor/default/EN/SizeNS.cur b/src/v2/InputTipCursor/default/EN/SizeNS.cur new file mode 100644 index 0000000..32f22f7 Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/SizeNS.cur differ diff --git a/src/v2/InputTipCursor/default/EN/SizeNWSE.cur b/src/v2/InputTipCursor/default/EN/SizeNWSE.cur new file mode 100644 index 0000000..c8762c2 Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/SizeNWSE.cur differ diff --git a/src/v2/InputTipCursor/default/EN/SizeWE.cur b/src/v2/InputTipCursor/default/EN/SizeWE.cur new file mode 100644 index 0000000..b9ba90b Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/SizeWE.cur differ diff --git a/src/v2/InputTipCursor/default/EN/UpArrow.cur b/src/v2/InputTipCursor/default/EN/UpArrow.cur new file mode 100644 index 0000000..30b84e6 Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/UpArrow.cur differ diff --git a/src/v2/InputTipCursor/default/EN/wait.ani b/src/v2/InputTipCursor/default/EN/wait.ani new file mode 100644 index 0000000..0994a58 Binary files /dev/null and b/src/v2/InputTipCursor/default/EN/wait.ani differ diff --git a/src/v2/menu/JAB.ahk b/src/v2/menu/JAB.ahk index 8f1e501..9c764c8 100644 --- a/src/v2/menu/JAB.ahk +++ b/src/v2/menu/JAB.ahk @@ -1,11 +1,11 @@ fn_JAB(item, *) { - global enableJetBrainsSupport := !enableJetBrainsSupport - writeIni("enableJetBrainsSupport", enableJetBrainsSupport) + global enableJABSupport := !enableJABSupport + writeIni("enableJABSupport", enableJABSupport) A_TrayMenu.ToggleCheck(item) - if (enableJetBrainsSupport) { - FileInstall("InputTip.JAB.JetBrains.exe", "InputTip.JAB.JetBrains.exe", 1) - waitFileInstall("InputTip.JAB.JetBrains.exe", 0) - + if (enableJABSupport) { + if (runJAB()) { + return + } createGui(JABGui).Show() JABGui(info) { g := createGuiOpt("InputTip - 启用 JAB/JetBrains IDE 支持") @@ -30,7 +30,6 @@ fn_JAB(item, *) { gc.w.enableJABGui := g return g } - runJetBrains() } else { if (gc.w.enableJABGui) { gc.w.enableJABGui.Destroy() @@ -42,6 +41,8 @@ fn_JAB(item, *) { RunWait('taskkill /f /t /im InputTip.JAB.JetBrains.exe', , "Hide") if (A_IsAdmin) { Run('schtasks /delete /tn "abgox.InputTip.JAB.JetBrains" /f', , "Hide") + } + if (A_IsCompiled) { try { FileDelete("InputTip.JAB.JetBrains.exe") } diff --git a/src/v2/menu/app-offset.ahk b/src/v2/menu/app-offset.ahk index 75dc239..9fdf52c 100644 --- a/src/v2/menu/app-offset.ahk +++ b/src/v2/menu/app-offset.ahk @@ -22,7 +22,7 @@ fn_app_offset(*) { gc.appOffsetGui_LV_rm_title.Text := "特殊偏移量列表 ( " gc.appOffsetGui_LV_rm.GetCount() " 个 )" writeIni("app_offset", "") global app_offset := {} - restartJetBrains() + restartJAB() } addClickFn(LV, RowNumber, tipList) { @@ -144,7 +144,7 @@ fn_app_offset(*) { _app_offset .= ":" SubStr(_info, 1, StrLen(_info) - 1) } writeIni("app_offset", SubStr(_app_offset, 2)) - restartJetBrains() + restartJAB() } global app_offset diff --git a/src/v2/menu/bw-list.ahk b/src/v2/menu/bw-list.ahk index 790fa6c..2366996 100644 --- a/src/v2/menu/bw-list.ahk +++ b/src/v2/menu/bw-list.ahk @@ -55,7 +55,7 @@ fn_bw_list(*) { value := item.value - 1 writeIni("useWhiteList", value) global useWhiteList := value - restartJetBrains() + restartJAB() } } g.AddEdit("xs Disabled", "如果使用「黑」名单,你需要承担未知的可能存在的窗口兼容性代价") @@ -90,7 +90,7 @@ fn_bw_list(*) { fn(value) { global app_hide_state := ":" value ":" gc.blackListGui_LV_rm_title.Text := "符号显示黑名单 ( " gc.blackListGui_LV_rm.GetCount() " 个 )" - restartJetBrains() + restartJAB() } } gc.w.bwListGui := g diff --git a/src/v2/menu/config.ahk b/src/v2/menu/config.ahk index 28f998e..c423e8c 100644 --- a/src/v2/menu/config.ahk +++ b/src/v2/menu/config.ahk @@ -7,16 +7,26 @@ fn_config(*) { gc.w.subGui := "" } } + if (gc.tab) { + getDirTimer() + } else { + SetTimer(getDirTimer, -1) + } line := "-------------------------------------------------------------------------------------------------------------" createGui(changeConfigGui).Show() changeConfigGui(info) { g := createGuiOpt("InputTip - 更改配置") ; tab := g.AddTab3("-Wrap 0x100", ["显示形式", "鼠标样式", "图片符号", "方块符号", "文本符号"]) tab := g.AddTab3("-Wrap", ["显示形式", "鼠标样式", "图片符号", "方块符号", "文本符号", "其他杂项"]) + tab.OnEvent("Change", e_tab) + e_tab(item, *) { + gc.tab := item.Value + } + if (gc.tab) { + tab.Value := gc.tab + } tab.UseTab(1) - g.AddLink("Section cRed", '你首先应该查看相关的说明文档: 官网 Github Gitee 一些常见的使用问题') - g.AddText("xs", line) - g.AddText("xs cGray", "所有的配置项修改会实时生效,可以立即看到最新效果,但是更改时不要太快`n比如需要输入值的配置项,输入过快可能因为响应稍慢导致最新修改丢失,需要放缓输入速度`n") + g.AddLink("Section cRed", '你首先应该查看相关的说明文档: 官网 Github Gitee 一些常见的使用问题 ') if (info.i) { return g @@ -24,6 +34,8 @@ fn_config(*) { w := info.w bw := w - g.MarginX * 2 + g.AddText("xs", line) + g.AddText("xs cGray", "所有的配置项修改会实时生效,可以立即看到最新效果,但是更改时速度不要太快`n比如需要输入值的配置项,输入过快可能因为响应稍慢导致最新修改丢失,需要放缓输入速度`n") g.AddText("xs", "1. 要不要同步修改鼠标样式: ") _ := g.AddDropDownList("w" bw / 2 " yp AltSubmit Choose" changeCursor + 1, ["【否】不要修改鼠标样式,保持原本的鼠标样式", "【是】需要修改鼠标样式,随输入法状态而变化"]) g.AddText("xs cGray", "推荐设置为【是】,它与符号一起配合使用才是最完美的输入法状态提示方案") @@ -75,7 +87,7 @@ fn_config(*) { global changeCursor := 1 reloadCursor() } - restartJetBrains() + restartJAB() } g.addText("xs", "2. 在输入光标附近显示什么类型的符号: ") @@ -84,6 +96,7 @@ fn_config(*) { writeIni("symbolType", item.value - 1) global symbolType := item.value - 1 updateSymbol() + reloadSymbol() if (symbolType) { gc._focusSymbol.Focus() } @@ -113,7 +126,7 @@ fn_config(*) { writeIni("HideSymbolDelay", value) global HideSymbolDelay := value updateDelay() - restartJetBrains() + restartJAB() } g.AddEdit("xs ReadOnly cGray -VScroll w" bw, "单位: 毫秒,默认为 0 毫秒,表示不隐藏符号。`n当不为 0 时,此值不能小于 150,若小于 150,则使用 150。建议 500 以上。`n符号隐藏后,下次键盘操作或点击鼠标左键会再次显示符号") g.AddText("xs", "4. 每多少") @@ -133,7 +146,7 @@ fn_config(*) { } writeIni("delay", value) global delay := value - restartJetBrains() + restartJAB() } ; g.AddUpDown("Range1-500", delay) @@ -145,12 +158,15 @@ fn_config(*) { g.AddLink("yp", '的相关说明: 官网 Github Gitee') g.AddText("xs", line) g.AddText("xs Section cGray", "可以点击「下载鼠标样式扩展包」去下载已经适配的鼠标样式") - g.AddText("cRed", "如果列表中显示的鼠标样式文件夹路径不是最新的,请重新打开这个配置界面") + g.AddText("xs cGray", "如果要自定义鼠标样式文件夹,请先查看相关链接,然后模仿默认的鼠标样式文件夹去尝试自定义") + g.AddText("xs", line) + g.AddText("cRed", "如果列表中显示的鼠标样式文件夹路径不是最新的,请点击左下角的「刷新此界面」") + g.AddText("xs cGray", "InputTip 会使用下方选择的鼠标样式文件夹中的鼠标样式文件,根据不同输入法状态加载对应的鼠标样式") + g.AddText("Section", "选择鼠标样式文件夹路径:") dirList := StrSplit(cursorDir, ":") if (dirList.Length = 0) { dirList := getCursorDir() } - g.AddText("Section", "选择鼠标样式文件夹路径,InputTip 会使用其中的鼠标样式文件,根据不同输入法状态加载对应的鼠标样式") for i, v in ["CN", "EN", "Caps"] { g.AddText("xs", i ".") g.AddText("yp cRed", stateMap.%v%) @@ -168,7 +184,8 @@ fn_config(*) { updateCursor() reloadCursor() } - g.AddButton("xs w" bw, "下载鼠标样式扩展包").OnEvent("Click", e_cursor_package) + g.AddButton("xs w" bw / 2, "刷新此界面").OnEvent("Click", fn_config) + g.AddButton("yp w" bw / 2, "下载鼠标样式扩展包").OnEvent("Click", e_cursor_package) e_cursor_package(*) { if (gc.w.subGui) { gc.w.subGui.Destroy() @@ -176,10 +193,11 @@ fn_config(*) { } g := createGuiOpt("下载鼠标样式扩展包") g.AddText("Center h30", "从以下任意可用地址中下载鼠标样式扩展包:") - g.AddLink("xs", 'https://inputtip.pages.dev/download/extra') - g.AddLink("xs", 'https://github.com/abgox/InputTip/releases/tag/extra') - g.AddLink("xs", 'https://gitee.com/abgox/InputTip/releases/tag/extra') + g.AddLink("xs", '官网: https://inputtip.pages.dev/download/extra') + g.AddLink("xs", 'Github: https://github.com/abgox/InputTip/releases/tag/extra') + g.AddLink("xs", 'Gitee: https://gitee.com/abgox/InputTip/releases/tag/extra') g.AddText(, "其中的鼠标样式已经完成适配,解压到 InputTipCursor 目录中即可使用") + g.AddText() g.Show() gc.w.subGui := g } @@ -220,12 +238,14 @@ fn_config(*) { e_pic_config(item, *) { writeIni(item._config, returnNumber(item.value)) updateSymbol() - restartJetBrains() + reloadSymbol() + restartJAB() } fn_setIsolateConfig(item, *) { writeIni(item._config, item.value - 1) updateSymbol() + reloadSymbol() } fn_writeIsolateConfig(item, *) { if (InStr(item._config, "color")) { @@ -235,7 +255,8 @@ fn_config(*) { } if (item._update) { updateSymbol() - restartJetBrains() + reloadSymbol() + restartJAB() } } @@ -305,12 +326,12 @@ fn_config(*) { } } + g.AddText("xs Section cRed", "如果列表中显示的图片符号路径不是最新的,请点击左下角的「刷新此界面」") + g.AddText(, "选择图片符号的文件路径: ") dirList := StrSplit(picDir, ":") if (dirList.Length = 0) { dirList := getPicDir() } - g.AddText("xs Section cRed", "如果列表中显示的图片符号路径不是最新的,请重新打开这个配置界面") - g.AddText(, "选择图片符号的文件路径: ") for i, v in ["CN", "EN", "Caps"] { __ := g.AddText("xs", i ".") _ := g.AddText("yp cRed", stateMap.%v%) @@ -329,6 +350,7 @@ fn_config(*) { e_pic_path(item, *) { writeIni(item._config, item.Text) updateSymbol() + reloadSymbol() if (symbolType = 1) { gc._focusSymbolPic.Focus() } @@ -340,7 +362,8 @@ fn_config(*) { _.Text := "" } } - g.AddButton("xs w" bw, "下载图片符号扩展包").OnEvent("Click", e_pic_package) + g.AddButton("xs w" bw / 2, "刷新此界面").OnEvent("Click", fn_config) + g.AddButton("yp w" bw / 2, "下载图片符号扩展包").OnEvent("Click", e_pic_package) e_pic_package(*) { if (gc.w.subGui) { gc.w.subGui.Destroy() @@ -348,10 +371,11 @@ fn_config(*) { } g := createGuiOpt("下载图片符号扩展包") g.AddText("Center h30", "从以下任意可用地址中下载图片符号扩展包:") - g.AddLink("xs", 'https://inputtip.pages.dev/download/extra') - g.AddLink("xs", 'https://github.com/abgox/InputTip/releases/tag/extra') - g.AddLink("xs", 'https://gitee.com/abgox/InputTip/releases/tag/extra') - g.AddText(, "将其中的图片解压到 InputTipSymbol 目录中即可使用") + g.AddLink("xs", '官网: https://inputtip.pages.dev/download/extra') + g.AddLink("xs", 'Github: https://github.com/abgox/InputTip/releases/tag/extra') + g.AddLink("xs", 'Gitee: https://gitee.com/abgox/InputTip/releases/tag/extra') + g.AddText(, "只要将其中的图片放到 InputTipSymbol 这个目录下就可以使用了") + g.AddText() g.Show() gc.w.subGui := g } @@ -409,6 +433,7 @@ fn_config(*) { e_color_config(item, *) { writeIni(item._config, item.Text) updateSymbol() + reloadSymbol() } for v in symbolBlockConfig { g.AddText("xs", v.tip ": ") @@ -429,11 +454,13 @@ fn_config(*) { } writeIni(item._config, returnNumber(value)) updateSymbol() + reloadSymbol() } fn_border_config(item, *) { writeIni(item._config, item.value - 1) updateSymbol() + reloadSymbol() if (symbolType) { item._focus.Focus() } @@ -622,6 +649,7 @@ fn_config(*) { } writeIni(item._config, value) updateSymbol() + reloadSymbol() } g.AddText("xs", "文本符号的边框样式: ") @@ -634,7 +662,6 @@ fn_config(*) { _._focus.OnEvent("Focus", fn_clear) _._focus.OnEvent("LoseFocus", fn_clear) - g.AddText() g.AddText("xs", "是否启用") g.AddText("yp cRed", "文本符号") g.AddText("yp", "的独立配置: ") @@ -797,6 +824,7 @@ fn_config(*) { g.OnEvent("Close", e_close) e_close(*) { g.Destroy() + gc.tab := 0 gc.timer := 0 try { gc.w.subGui.Destroy() @@ -806,5 +834,4 @@ fn_config(*) { gc.w.configGui := g return g } - SetTimer(getDirTimer, -1) } diff --git a/src/v2/menu/cursor-mode.ahk b/src/v2/menu/cursor-mode.ahk index 188e2b5..e5995c4 100644 --- a/src/v2/menu/cursor-mode.ahk +++ b/src/v2/menu/cursor-mode.ahk @@ -199,7 +199,7 @@ fn_cursor_mode(*) { } } - g.AddButton("xs w" w / 3, "刷新应用进程列表").OnEvent("Click", e_refresh) + g.AddButton("xs w" w / 3, "刷新此界面").OnEvent("Click", e_refresh) e_refresh(*) { fn_close() showGui(deep) diff --git a/src/v2/menu/input-mode.ahk b/src/v2/menu/input-mode.ahk index 97db6f1..a8a3a21 100644 --- a/src/v2/menu/input-mode.ahk +++ b/src/v2/menu/input-mode.ahk @@ -13,18 +13,17 @@ fn_input_mode(*) { } createGui(inputModeGui).Show() inputModeGui(info) { - global statusModeEN, conversionModeEN, mode + global statusMode, conversionMode, mode - statusModeEN := readIni("statusModeEN", "", "InputMethod") - conversionModeEN := readIni("conversionModeEN", "", "InputMethod") + statusMode := readIni("statusMode", "", "InputMethod") + conversionMode := readIni("conversionMode", "", "InputMethod") mode := readIni("mode", 1, "InputMethod") g := createGuiOpt("InputTip - 设置输入法模式") gc.modeList := ["【自定义】", "【通用】"] tab := g.AddTab3("-Wrap", ["基础配置", "自定义", "关于自定义"]) tab.UseTab(1) - g.AddText("Section cRed", "如果【通用】模式不可用,需要前往「自定义」标签页去配置【自定义】模式") - g.AddText(, "1. 当前使用的输入法模式:") + g.AddText("Section cRed", "如果【通用】模式不可用,需要前往「自定义」标签页去配置【自定义】模式 ") if (info.i) { return g @@ -32,8 +31,10 @@ fn_input_mode(*) { w := info.w bw := w - g.MarginX * 2 + g.AddText(, "1. 当前使用的输入法模式:") gc.mode := g.AddText("yp cRed w" w / 2) gc.mode.Value := gc.modeList[mode + 1] + g.AddEdit("xs ReadOnly cGray", "输入法模式只有【通用】和【自定义】,这里显示的值会根据配置情况自动变化") g.AddText("xs", "2. 设置获取输入法状态的超时时间: ") timeout := g.AddEdit("yp Number Limit5") timeout.Focus() @@ -45,7 +46,7 @@ fn_input_mode(*) { } writeIni("checkTimeout", value, "InputMethod") global checkTimeout := value - restartJetBrains() + restartJAB() } timeout.Value := checkTimeout g.AddEdit("xs ReadOnly cGray -VScroll w" w, "单位:毫秒,默认 500 毫秒。`n每次切换输入法状态,InputTip 会从系统获取新的输入法状态。`n如果超过了这个时间,则认为获取失败,直接显示英文状态。`n它可能是有时识别不到输入法状态的原因,遇到问题可以尝试调节它。") @@ -63,8 +64,8 @@ fn_input_mode(*) { gc.useShift.Value := useShift + 1 g := createGuiOpt() - g.AddText("cRed", "确定要使用【否】吗?") - g.AddText("cRed", "除非你的输入法自定义了切换状态的按键,且禁用了 Shift 切换,才需要选择【否】。`n如果选择【否】,在美式键盘或部分特殊输入法中,可能会导致状态提示间歇性错误。") + g.AddText(, "确定要使用【否】吗?") + g.AddText("cRed", "除非你的输入法自定义了切换状态的按键,且禁用了 Shift 切换,才需要选择【否】。`n如果选择【否】,在美式键盘(ENG)或部分特殊输入法中,可能会导致状态提示间歇性错误。") g.AddText("cRed", "建议不要使用【否】,而是启用 Shift 切换状态,这也是几乎所有输入法的默认设置。") if (info.i) { @@ -74,7 +75,7 @@ fn_input_mode(*) { bw := w - g.MarginX * 2 g.AddButton("w" bw, "我确定要使用【否】").OnEvent("Click", e_yes) - g.AddButton("w" bw, "不,我只是误点了").OnEvent("Click", e_no) + g.AddButton("w" bw, "我只是不小心点错了").OnEvent("Click", e_no) e_yes(*) { g.Destroy() gc.useShift.Value := 1 @@ -91,39 +92,49 @@ fn_input_mode(*) { value := item.value - 1 writeIni("useShift", value) global useShift := value - restartJetBrains() + restartJAB() } } - g.AddEdit("xs ReadOnly cGray -VScroll w" w, "除非你的输入法自定义了切换状态的按键,且禁用了 Shift 切换,才需要选择【否】。`n如果选择【否】,在美式键盘或部分特殊输入法中,可能会导致状态提示间歇性错误。") + g.AddEdit("xs ReadOnly cGray -VScroll w" w, "除非你的输入法自定义了切换状态的按键,且禁用了 Shift 切换,才需要选择【否】。`n如果选择【否】,在美式键盘(ENG)或部分特殊输入法中,可能会导致状态提示间歇性错误。") tab.UseTab(2) g.AddText("Section ReadOnly cRed -VScroll w" w, "首先需要点击上方的「关于自定义」标签页,查看帮助说明,了解如何设置") g.AddText("Section", "优先级顺序: 切换码规则(4) > 切换码数字(3) > 状态码规则(2) > 状态码数字(1)") g.AddText("xs cGray", "输入框中有值的或规则有勾选的,取其中优先级最高的生效`n如果都没有设置或勾选,则自动变回【通用】模式,反之变为【自定义】模式") - g.AddText("Section", "1.") - g.AddText("yp cRed", "英文状态") + g.AddText("Section", "以哪一种状态作为判断依据: ") + g.AddDropDownList("yp Choose" baseStatus + 1, ["英文状态", "中文状态"]).OnEvent("Change", e_changeBaseStatus) + e_changeBaseStatus(item, *) { + value := item.Value - 1 + writeIni("baseStatus", value, "InputMethod") + global baseStatus := value + for v in gc.statusText { + v.value := item.text + } + } + gc.statusText := [] + g.AddText("xs", "1.") + gc.statusText.push(g.AddText("yp cRed", stateMap.%baseStatus%)) g.AddText("yp", "的状态码数字: ") - gc.statusModeEN := g.AddEdit("yp", "") - gc.statusModeEN.Value := Trim(StrReplace(statusModeEN, ":", " ")) - gc.statusModeEN.OnEvent("Change", e_statusModeEN) - e_statusModeEN(item, *) { + gc.statusMode := g.AddEdit("yp", "") + gc.statusMode.Value := Trim(StrReplace(statusMode, ":", " ")) + gc.statusMode.OnEvent("Change", e_statusMode) + e_statusMode(item, *) { if (Trim(item.value) = "") { - writeIni("statusModeEN", "", "InputMethod") - statusModeEN := "" + writeIni("statusMode", "", "InputMethod") + statusMode := "" } else { value := ":" for v in StrSplit(item.value, " ") { value .= v ":" } - writeIni("statusModeEN", value, "InputMethod") - statusModeEN := value + writeIni("statusMode", value, "InputMethod") + statusMode := value } checkModeChange() - restartJetBrains() } checkModeChange() { - if (gc.statusModeEN.Value = "" && gc.conversionModeEN.Value = "" && evenStatusModeEN = "" && evenConversionModeEN = "") { + if (gc.statusMode.Value = "" && gc.conversionMode.Value = "" && evenStatusMode = "" && evenConversionMode = "") { gc.mode.Value := gc.modeList[2] if (mode != 1) { writeIni("mode", 1, "InputMethod") @@ -136,6 +147,7 @@ fn_input_mode(*) { global mode := 0 } } + restartJAB() } handle_mode(value, config, checkbox, default) { @@ -147,72 +159,70 @@ fn_input_mode(*) { writeIni(config, "", "InputMethod") } } - global evenStatusModeEN := readIni("evenStatusModeEN", "", "InputMethod") - global evenConversionModeEN := readIni("evenConversionModeEN", "", "InputMethod") + global evenStatusMode := readIni("evenStatusMode", "", "InputMethod") + global evenConversionMode := readIni("evenConversionMode", "", "InputMethod") checkModeChange() - restartJetBrains() } g.AddText("xs", "2.") - g.AddText("yp cRed", "英文状态") + gc.statusText.push(g.AddText("yp cRed", stateMap.%baseStatus%)) g.AddText("yp", "的状态码规则: ") gc.oddStatusMode := g.AddCheckbox("yp", "使用奇数") - if (evenStatusModeEN != "") { - gc.oddStatusMode.Value := !evenStatusModeEN + if (evenStatusMode != "") { + gc.oddStatusMode.Value := !evenStatusMode } gc.oddStatusMode.OnEvent("Click", e_oddStatusMode) e_oddStatusMode(item, *) { - handle_mode(item.value, "evenStatusModeEN", "evenStatusMode", 0) + handle_mode(item.value, "evenStatusMode", "evenStatusMode", 0) } gc.evenStatusMode := g.AddCheckbox("yp", "使用偶数") - if (evenStatusModeEN != "") { - gc.evenStatusMode.Value := evenStatusModeEN + if (evenStatusMode != "") { + gc.evenStatusMode.Value := evenStatusMode } gc.evenStatusMode.OnEvent("Click", e_evenStatusMode) e_evenStatusMode(item, *) { - handle_mode(item.value, "evenStatusModeEN", "oddStatusMode", 1) + handle_mode(item.value, "evenStatusMode", "oddStatusMode", 1) } g.AddText("xs", "3.") - g.AddText("yp cRed", "英文状态") + gc.statusText.push(g.AddText("yp cRed", stateMap.%baseStatus%)) g.AddText("yp", "的切换码数字: ") - gc.conversionModeEN := g.AddEdit("yp") - gc.conversionModeEN.Value := Trim(StrReplace(conversionModeEN, ":", " ")) - gc.conversionModeEN.OnEvent("Change", e_conversionModeEN) - e_conversionModeEN(item, *) { + gc.conversionMode := g.AddEdit("yp") + gc.conversionMode.Value := Trim(StrReplace(conversionMode, ":", " ")) + gc.conversionMode.OnEvent("Change", e_conversionMode) + e_conversionMode(item, *) { if (Trim(item.value) = "") { - writeIni("conversionModeEN", "", "InputMethod") - conversionModeEN := "" + writeIni("conversionMode", "", "InputMethod") + conversionMode := "" } else { value := ":" for v in StrSplit(item.value, " ") { value .= v ":" } - writeIni("conversionModeEN", value, "InputMethod") - conversionModeEN := value + writeIni("conversionMode", value, "InputMethod") + conversionMode := value } checkModeChange() - restartJetBrains() } g.AddText("xs", "4.") - g.AddText("yp cRed", "英文状态") + gc.statusText.push(g.AddText("yp cRed", stateMap.%baseStatus%)) g.AddText("yp", "的切换码规则: ") gc.oddConversionMode := g.AddCheckbox("yp", "使用奇数") - if (evenConversionModeEN != "") { - gc.oddConversionMode.Value := !evenConversionModeEN + if (evenConversionMode != "") { + gc.oddConversionMode.Value := !evenConversionMode } gc.oddConversionMode.OnEvent("Click", e_oddConversionMode) e_oddConversionMode(item, *) { - handle_mode(item.value, "evenConversionModeEN", "evenConversionMode", 0) + handle_mode(item.value, "evenConversionMode", "evenConversionMode", 0) } gc.evenConversionMode := g.AddCheckbox("yp", "使用偶数") - if (evenConversionModeEN != "") { - gc.evenConversionMode.Value := evenConversionModeEN + if (evenConversionMode != "") { + gc.evenConversionMode.Value := evenConversionMode } gc.evenConversionMode.OnEvent("Click", e_evenConversionMode) e_evenConversionMode(item, *) { - handle_mode(item.value, "evenConversionModeEN", "oddConversionMode", 1) + handle_mode(item.value, "evenConversionMode", "oddConversionMode", 1) } gc.status_btn := g.AddButton("xs w" w, "【显示】实时的状态码和切换码") @@ -241,7 +251,7 @@ fn_input_mode(*) { } tab.UseTab(3) - g.AddEdit("Section r12 ReadOnly w" w, "如何配置【自定义】模式?以讯飞输入法为例:`n1. 点击按钮「显示实时的状态码和切换码」,它会在光标处显示状态码和切换码。`n2. 来回切换输入法的中英文状态观察它们的变化。`n3. 会发现切换码始终为 1,而状态码在英文时为 1,中文时为 2。`n4. 于是,在状态码数字的输入框中填入 1,就会发现已经生效了。`n5. 这里更推荐勾选状态码规则中的「使用奇数」,它包含 1,且范围更大。`n6. 再比如小狼毫(rime)输入法,按照同样的操作流程,你会发现很大的不同。`n7. 它的状态码始终为 1,而切换码在英文时是随机的偶数,中文时是随机的奇数。`n8. 于是,勾选切换码规则中的「使用偶数」后,就会发现已经生效了。`n9. 当然,不要盲目的使用规则扩大范围,比如手心输入法就不能这样做。`n10. 当使用手心输入法按照同样的流程操作时,你会发现又有不同。`n11. 手心输入法的状态码始终为 1,而切换码在英文时为 1,中文时为 1025。`n12. 于是,在状态码数字的输入框中填入 1,就会发现已经生效了。`n13. 但是,这里就不能勾选「使用奇数」,因为中文时的 1025 也是奇数。`n14. 【自定义】模式是靠唯一的值去区分状态,勾选「使用奇数」就无法区分了。`n`n什么是优先级顺序?`n1. 优先级顺序: 切换码规则(4) > 切换码数字(3) > 状态码规则(2) > 状态码数字(1)`n2. 对于【自定义】模式来说,生效的是优先级最高的配置项。`n3. 比如: 你使用了切换码规则,则切换码数字/状态码规则/状态码数字即使有值,也无效。`n`n在数字输入框中,是可以填入许多个的:`n1. 有可能你会遇到这样的情况。`n2. 你发现状态码在英文时不唯一,有时为 0,有时为 3,在中文时为 1。`n3. 这种情况,一个奇数,一个偶数,也无法使用规则。`n4. 你可以直接在状态码数字的输入框中填入它们,以空格分割即可。") + g.AddEdit("Section r14 ReadOnly w" w, "1. 如何配置【自定义】模式?(以讯飞输入法为例,选择英文状态作为判断依据)`n - 点击按钮「显示实时的状态码和切换码」,它会在光标处显示状态码和切换码`n - 来回切换输入法的中英文状态观察它们的变化`n - 会发现切换码始终为 1,而状态码在英文时为 1,中文时为 2`n - 于是,在状态码数字的输入框中填入 1,就会发现已经生效了`n - 这里更推荐勾选状态码规则中的「使用奇数」,它包含 1,且范围更大`n - 再比如小狼毫(rime)输入法,按照同样的操作流程,你会发现很大的不同`n - 它的状态码始终为 1,而切换码在英文时是随机的偶数,中文时是随机的奇数`n - 于是,勾选切换码规则中的「使用偶数」后,就会发现已经生效了`n - 当然,不要盲目的使用规则扩大范围,比如手心输入法就不能这样做`n - 当使用手心输入法按照同样的流程操作时,你会发现又有不同`n - 手心输入法的状态码始终为 1,而切换码在英文时为 1,中文时为 1025`n - 于是,在状态码数字的输入框中填入 1,就会发现已经生效了`n - 但是,这里就不能勾选「使用奇数」,因为中文时的 1025 也是奇数`n - 【自定义】模式是靠唯一的值去区分状态,勾选「使用奇数」就无法区分了`n`n2. 关于配置项「以哪一种状态作为判断依据」`n - 需要根据实际情况选择合适的值`n - 上方的这几个例子,是围绕英文状态来设置的`n - 如果你需要围绕中文状态来设置,你就需要选择中文状态`n - 以小鹤音形输入法为例`n - 它的状态码始终为 1,而切换码在英文时为 257,中文时为 1025`n - 因此,将 257 填入切换码即可`n - 但是如果你同时使用多个输入法,比如它和美式键盘(ENG)`n - 而美式键盘(ENG)的切换码为 1,这就没有办法兼顾这两个输入法`n - 但是换个思路,选择以中文状态为判断依据`n - 将 1025 填入切换码后,小鹤音形能正常识别,而切换到美式键盘(ENG)时`n - 由于切换码不等于1025,自然而然的识别成了英文状态`n`n3. 什么是优先级顺序?`n - 优先级顺序: 切换码规则(4) > 切换码数字(3) > 状态码规则(2) > 状态码数字(1)`n - 假如你使用了切换码规则,勾选了「使用偶数」`n - 那么切换码数字,状态码规则,状态码数字即使有勾选或填入了值,也不会生效`n - 因为切换码规则优先级更高,InputTip 就直接使用它去判断了`n`n4. 关于「状态码数字」和「切换码数字」`n - 在它们的输入框中,可以填入许多个数字,如果遇到以下情况就可以这样做`n - 假如你发现状态码都是 1,区分不了状态,无法使用`n - 而切换码在英文时不唯一,有时为 0,有时为 3,但中文时没有 0 或 3`n - 这种情况下,有奇数也有偶数,使用规则也无法区分`n - 就可以直接在切换码数字的输入框中填入它们,以空格分割它们即可") g.AddLink(, '相关链接: 自定义模式') g.OnEvent("Close", e_close) e_close(*) { diff --git a/src/v2/menu/startup.ahk b/src/v2/menu/startup.ahk index 4b37b93..f6b7930 100644 --- a/src/v2/menu/startup.ahk +++ b/src/v2/menu/startup.ahk @@ -64,12 +64,18 @@ fn_startup(item, *) { btnOpt := ' Disabled ' tip := ' (以管理员模式运行时可用)' } - btn := g.AddButton("w" w btnOpt, "使用「任务计划程序」" tip) + + if (!btnOpt && !powershell) { + btn := g.AddButton("Disabled w" w btnOpt, "使用「任务计划程序」 (无法调用 powershell)") + } else { + btn := g.AddButton("w" w btnOpt, "使用「任务计划程序」" tip) + } + btn.Focus() btn.OnEvent("Click", e_useTask) e_useTask(*) { isStartUp := 1 - FileCreateShortcut("C:\WINDOWS\system32\schtasks.exe", A_Startup "\" fileLnk, , "/run /tn `"abgox.InputTip.noUAC`"", , A_ScriptFullPath, , , 7) + FileCreateShortcut("C:\WINDOWS\system32\schtasks.exe", A_Startup "\" fileLnk, , "/run /tn `"abgox.InputTip.noUAC`"", , favicon, , , 7) fn_handle() } btn := g.AddButton("w" w, "使用应用快捷方式") @@ -79,7 +85,7 @@ fn_startup(item, *) { btn.OnEvent("Click", e_useLnk) e_useLnk(*) { isStartUp := 2 - FileCreateShortcut(A_ScriptFullPath, A_Startup "\" fileLnk, , , , A_ScriptFullPath, , , 7) + FileCreateShortcut(A_ScriptFullPath, A_Startup "\" fileLnk, , , , favicon, , , 7) fn_handle() } g.AddButton("w" w btnOpt, "使用「注册表」" tip).OnEvent("Click", e_useReg) diff --git a/src/v2/menu/switch-window.ahk b/src/v2/menu/switch-window.ahk index 49008c8..18a574b 100644 --- a/src/v2/menu/switch-window.ahk +++ b/src/v2/menu/switch-window.ahk @@ -249,7 +249,7 @@ fn_switch_window(*) { } } - g.AddButton("xs w" bw / 3, "刷新应用进程列表").OnEvent("Click", e_refresh) + g.AddButton("xs w" bw / 3, "刷新此界面").OnEvent("Click", e_refresh) e_refresh(*) { fn_close() showGui(deep) diff --git a/src/v2/menu/tray-menu.ahk b/src/v2/menu/tray-menu.ahk index 1fdfd49..576e15c 100644 --- a/src/v2/menu/tray-menu.ahk +++ b/src/v2/menu/tray-menu.ahk @@ -39,9 +39,9 @@ makeTrayMenu() { A_TrayMenu.Add() A_TrayMenu.Add("启用 JAB/JetBrains IDE 支持", fn_JAB) - if (enableJetBrainsSupport) { + if (enableJABSupport) { A_TrayMenu.Check("启用 JAB/JetBrains IDE 支持") - runJetBrains() + runJAB() } A_TrayMenu.Add() A_TrayMenu.Add("关于", fn_about) @@ -56,7 +56,7 @@ fn_exit(*) { ExitApp() } fn_restart(flag := 0, *) { - if (flag || enableJetBrainsSupport) { + if (flag || enableJABSupport) { RunWait('taskkill /f /t /im InputTip.JAB.JetBrains.exe', , "Hide") } Run(A_ScriptFullPath) @@ -235,7 +235,7 @@ fn_common(tipList, handleFn, addClickFn := "", rmClickFn := "", addFn := "") { return g } } - g.AddButton("Section yp w" w / 2, "刷新应用进程列表").OnEvent("Click", e_refresh) + g.AddButton("Section yp w" w / 2, "刷新此界面").OnEvent("Click", e_refresh) e_refresh(*) { fn_close() showGui(deep) @@ -450,7 +450,7 @@ fn_white_list(*) { fn(value) { global app_show_state := ":" value ":" gc.whiteListGui_LV_rm_title.Text := "符号显示白名单 ( " gc.whiteListGui_LV_rm.GetCount() " 个 )" - restartJetBrains() + restartJAB() } } @@ -506,13 +506,53 @@ getPicDir() { picList.InsertAt(1, '') return picList } - /** - * @param runOrStop 1: Run; 0:Stop + * 启动 JAB 进程 + * @returns {Integer} 1/0: 是否存在错误 */ -runJetBrains() { - SetTimer(runAppTimer, -10) +runJAB() { + if (!powershell && enableJABSupport) { + writeIni("enableJABSupport", "0") + global enableJABSupport := 0 + A_TrayMenu.Uncheck("启用 JAB/JetBrains IDE 支持") + if (A_IsCompiled) { + try { + FileDelete("InputTip.JAB.JetBrains.exe") + } + } + + + if (gc.w.subGui) { + gc.w.subGui.Destroy() + gc.w.subGui := "" + } + createGui(errGui).Show() + errGui(info) { + g := createGuiOpt("InputTip - powershell 调用失败!") + g.AddText("cRed", "- 在当前系统环境中,尝试调用 powershell 失败了`n-「启用 JAB/JetBrains IDE 支持」这个功能将会被自动禁用") + g.AddText("cRed", "- 如果你想继续使用它,你需要解决 cmd 调用 powershell 失败的问题") + + if (info.i) { + return g + } + w := info.w + + g.AddButton("w" w, "我知道了").OnEvent("Click", e_close) + e_close(*) { + g.Destroy() + } + gc.w.subGui := g + return g + } + return 1 + } + FileInstall("InputTip.JAB.JetBrains.exe", "InputTip.JAB.JetBrains.exe", 1) + SetTimer(runAppTimer, 50) runAppTimer() { + if (WinExist("ahk_exe InputTip.JAB.JetBrains.exe")) { + SetTimer(, 0) + return + } if (A_IsAdmin) { try { RunWait('powershell -NoProfile -Command $action = New-ScheduledTaskAction -Execute "`'\"' A_ScriptDir '\InputTip.JAB.JetBrains.exe\"`'";$principal = New-ScheduledTaskPrincipal -UserId "' A_UserName '" -LogonType ServiceAccount -RunLevel Limited;$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable -DontStopOnIdleEnd -ExecutionTimeLimit 10 -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1);$task = New-ScheduledTask -Action $action -Principal $principal -Settings $settings;Register-ScheduledTask -TaskName "abgox.InputTip.JAB.JetBrains" -InputObject $task -Force', , "Hide") @@ -522,4 +562,5 @@ runJetBrains() { Run(A_ScriptDir "\InputTip.JAB.JetBrains.exe", , "Hide") } } + return 0 } diff --git a/src/v2/utils/IME.ahk b/src/v2/utils/IME.ahk index e3cdb02..a3e8bd6 100644 --- a/src/v2/utils/IME.ahk +++ b/src/v2/utils/IME.ahk @@ -1,18 +1,19 @@ /** * @link https://github.com/Tebayaki/AutoHotkeyScripts/blob/main/lib/IME.ahk - * @Tip 有所修改,外部必须提供变量 checkTimeout,statusModeEN,conversionModeEN,evenStatusModeEN,evenConversionModeEN + * @Tip 有所修改,外部必须提供变量 checkTimeout,baseStatus,statusMode,conversionMode,evenStatusMode,evenConversionMode * @example - * statusModeEN := 0 ; 英文状态时的状态码 - * conversionModeEN := 0 ; 英文状态时的转换码 - * evenStatusModeEN := "" - * evenConversionModeEN := "" - * checkTimeout := 1000 ; 超时时间 单位:毫秒 + * checkTimeout := 1000 ; 超时时间(单位:毫秒) + * baseStatus := 0 ; 以英文状态作为判断依据 + * statusMode := 0 ; 状态码 + * conversionMode := 0 ; 转换码 + * evenStatusMode := "" ; 状态码规则 + * evenConversionMode := "" ; 转换码规则 * IME.GetInputMode() ; 获取当前输入法输入模式 * IME.SetInputMode(!IME.GetInputMode()) ; 切换当前输入法输入模式 */ class IME { static GetInputMode(hwnd := this.GetFocusedWindow()) { - if (statusModeEN = "" && evenStatusModeEN = "" && conversionModeEN = "" && evenConversionModeEN = "") { + if (statusMode = "" && evenStatusMode = "" && conversionMode = "" && evenConversionMode = "") { if (!this.GetOpenStatus(hwnd)) { return { code: 0, @@ -30,32 +31,64 @@ class IME { ; 切换码 v := this.GetConversionMode(hwnd) flag := v & 1 - if (evenConversionModeEN != "") { - return { - code: v, - isCN: evenConversionModeEN ? flag : !flag + + if (baseStatus) { + if (evenConversionMode != "") { + return { + code: v, + isCN: evenConversionMode ? !flag : flag + } } - } - if (conversionModeEN != "") { - return { - code: v, - isCN: !(InStr(conversionModeEN, ":" v ":")) + if (conversionMode != "") { + return { + code: v, + isCN: InStr(conversionMode, ":" v ":") + } + } + } else { + if (evenConversionMode != "") { + return { + code: v, + isCN: evenConversionMode ? flag : !flag + } + } + if (conversionMode != "") { + return { + code: v, + isCN: !(InStr(conversionMode, ":" v ":")) + } } } ; 状态码 v := this.GetOpenStatus(hwnd) flag := v & 1 - if (evenStatusModeEN != "") { - return { - code: v, - isCN: evenStatusModeEN ? flag : !flag + + if (baseStatus) { + if (evenStatusMode != "") { + return { + code: v, + isCN: evenStatusMode ? !flag : flag + } } - } - if (statusModeEN != "") { - return { - code: 0, - isCN: !(InStr(statusModeEN, ":" v ":")) + if (statusMode != "") { + return { + code: 0, + isCN: InStr(statusMode, ":" v ":") + } + } + } else { + if (evenStatusMode != "") { + return { + code: v, + isCN: evenStatusMode ? flag : !flag + } + } + if (statusMode != "") { + return { + code: 0, + isCN: !(InStr(statusMode, ":" v ":")) + } } } } diff --git a/src/v2/utils/check-version.ahk b/src/v2/utils/check-version.ahk index bc687c3..0e0c3c7 100644 --- a/src/v2/utils/check-version.ahk +++ b/src/v2/utils/check-version.ahk @@ -141,7 +141,7 @@ checkUpdate(init := 0, once := false) { } } if (done) { - if (enableJetBrainsSupport) { + if (enableJABSupport) { try { RunWait('taskkill /f /t /im InputTip.JAB.JetBrains.exe', , "Hide") FileDelete("InputTip.JAB.JetBrains.exe") @@ -203,7 +203,7 @@ checkUpdate(init := 0, once := false) { g.AddText("yp", "已忽略") g.AddText("xs", "修改方式:「托盘菜单」=>「设置更新检查」") - g.AddText("cGray", "如果你在使用过程中有任何问题,先检查版本是否为最新版本`n如果更新到最新版本,问题依然存在,请前往 Github 发起一个 issue`nGithub 和其他相关地址可以在软件托盘菜单的「关于」中找到") + g.AddText("cGray", "如果你在使用过程中有任何问题,先检查版本是否为最新版本`n如果更新到最新版本,问题依然存在,请前往 Github 新建一个 issue`nGithub 和其他相关地址可以在软件托盘菜单的「关于」中找到") if (info.i) { return g @@ -273,7 +273,7 @@ checkUpdate(init := 0, once := false) { g.AddText("yp", "已忽略") g.AddText("xs", "修改方式:「托盘菜单」=>「设置更新检查」") - g.AddText("cGray", "如果你在使用过程中有任何问题,先检查版本是否为最新版本`n如果更新到最新版本,问题依然存在,请前往 Github 发起一个 issue`nGithub 和其他相关地址可以在软件托盘菜单的「关于」中找到") + g.AddText("cGray", "如果你在使用过程中有任何问题,先检查版本是否为最新版本`n如果更新到最新版本,问题依然存在,请前往 Github 新建一个 issue`nGithub 和其他相关地址可以在软件托盘菜单的「关于」中找到") if (info.i) { return g @@ -300,22 +300,32 @@ checkUpdate(init := 0, once := false) { checkUpdateDone() { if (FileExist(A_AppData "\.abgox-InputTip-update-version.txt")) { try { - JetBrains_list := IniRead("InputTip.ini", "Config-v2", "JetBrains_list") - writeIni("cursor_mode_JAB", JetBrains_list) + _ := IniRead("InputTip.ini", "Config-v2", "JetBrains_list") + writeIni("cursor_mode_JAB", _) IniDelete("InputTip.ini", "Config-v2", "JetBrains_list") } + try { + _ := IniRead("InputTip.ini", "Config-v2", "enableJetBrainsSupport") + writeIni("enableJABSupport", _) + IniDelete("InputTip.ini", "Config-v2", "enableJetBrainsSupport") + } try { ignoreUpdate := IniRead("InputTip.ini", "Config-v2", "ignoreUpdate") - if (ignoreUpdate) { - checkUpdateDelay := readIni("checkUpdateDelay", 0) - } else { - checkUpdateDelay := readIni("checkUpdateDelay", 1440) - } + _ := ignoreUpdate ? 0 : 1440 + writeIni("checkUpdateDelay", _) IniDelete("InputTip.ini", "Config-v2", "ignoreUpdate") } try { - IniRead("InputTip.ini", "InputMethod", "statusModeEN") + _ := IniRead("InputTip.ini", "InputMethod", "statusModeEN") + writeIni("statusMode", _, "InputMethod") + writeIni("conversionMode", readIni("conversionModeEN", "", "InputMethod"), "InputMethod") + writeIni("evenStatusMode", readIni("evenStatusModeEN", "", "InputMethod"), "InputMethod") + writeIni("evenConversionMode", readIni("evenConversionModeEN", "", "InputMethod"), "InputMethod") + IniDelete("InputTip.ini", "InputMethod", "statusModeEN") + IniDelete("InputTip.ini", "InputMethod", "conversionModeEN") + IniDelete("InputTip.ini", "InputMethod", "evenStatusModeEN") + IniDelete("InputTip.ini", "InputMethod", "evenConversionModeEN") } catch { mode := readIni("mode", 1, "InputMethod") switch mode { @@ -326,13 +336,13 @@ checkUpdateDone() { case 3: { ; 讯飞输入法 - writeIni("evenStatusModeEN", "0", "InputMethod") + writeIni("evenStatusMode", "0", "InputMethod") writeIni("mode", 0, "InputMethod") } case 4: { ; 手心输入法 - writeIni("conversionModeEN", ":1:", "InputMethod") + writeIni("conversionMode", ":1:", "InputMethod") writeIni("mode", 0, "InputMethod") } } diff --git a/src/v2/utils/options.ahk b/src/v2/utils/options.ahk index 7bfc508..5d90fe8 100644 --- a/src/v2/utils/options.ahk +++ b/src/v2/utils/options.ahk @@ -12,5 +12,5 @@ InstallKeybdHook CoordMode 'Mouse', 'Screen' SetStoreCapsLockMode 0 -;@AHK2Exe-SetVersion 2.30.2 -currentVersion := "2.30.2" +;@AHK2Exe-SetVersion 2.31.0 +currentVersion := "2.31.0" diff --git a/src/v2/utils/show.ahk b/src/v2/utils/show.ahk index b787567..e89d806 100644 --- a/src/v2/utils/show.ahk +++ b/src/v2/utils/show.ahk @@ -130,69 +130,3 @@ updateDelay() { } } } -loadCursor(state, change := 0) { - global lastCursor - if (changeCursor) { - if (state != lastCursor || change) { - for v in cursorInfo { - if (v.%state%) { - DllCall("SetSystemCursor", "Ptr", DllCall("LoadCursorFromFile", "Str", v.%state%, "Ptr"), "Int", v.value) - } - } - lastCursor := state - } - } -} -loadSymbol(state, left, top) { - global lastSymbol, isOverSymbol - static old_left := 0, old_top := 0 - if (left = old_left && top = old_top) { - if (state = lastSymbol || (isOverSymbol && A_TimeIdleKeyboard > leaveDelay)) { - return - } - } else { - isOverSymbol := 0 - } - - hideSymbol() - if (!symbolType || !canShowSymbol) { - return - } - showConfig := "NA " - if (symbolType = 1) { - _ := symbolConfig.enableIsolateConfigPic - x := _ ? symbolConfig.%"pic_offset_x" state% : symbolConfig.pic_offset_x - y := _ ? symbolConfig.%"pic_offset_y" state% : symbolConfig.pic_offset_y - - showConfig .= "x" left + x "y" top + y - } else if (symbolType = 2) { - _ := symbolConfig.enableIsolateConfigBlock - w := _ ? symbolConfig.%"symbol_width" state% : symbolConfig.symbol_width - h := _ ? symbolConfig.%"symbol_height" state% : symbolConfig.symbol_height - x := _ ? symbolConfig.%"offset_x" state% : symbolConfig.offset_x - y := _ ? symbolConfig.%"offset_y" state% : symbolConfig.offset_y - - showConfig .= "w" w "h" h "x" left + x "y" top + y - } else if (symbolType = 3) { - _ := symbolConfig.enableIsolateConfigText - x := _ ? symbolConfig.%"textSymbol_offset_x" state% : symbolConfig.textSymbol_offset_x - y := _ ? symbolConfig.%"textSymbol_offset_y" state% : symbolConfig.textSymbol_offset_y - - showConfig .= "x" left + x "y" top + y - } - if (symbolGui.%state%) { - symbolGui.%state%.Show(showConfig) - } - - lastSymbol := state - old_top := top - old_left := left -} -hideSymbol() { - for state in ["CN", "EN", "Caps"] { - try { - symbolGui.%state%.Hide() - } - } - global lastSymbol := "" -} diff --git a/src/v2/utils/var.ahk b/src/v2/utils/var.ahk index e827221..7d2f0f1 100644 --- a/src/v2/utils/var.ahk +++ b/src/v2/utils/var.ahk @@ -4,14 +4,16 @@ fontOpt := ["s" readIni("gui_font_size", "12"), "微软雅黑"] ; 输入法模式 mode := readIni("mode", 1, "InputMethod") -; 指定的英文状态码 -statusModeEN := readIni("statusModeEN", "", "InputMethod") -; 指定的英文切换码 -conversionModeEN := readIni("conversionModeEN", "", "InputMethod") +; 以哪一种状态作为判断依据 +baseStatus := readIni("baseStatus", 0, "InputMethod") +; 指定的状态码 +statusMode := readIni("statusMode", "", "InputMethod") +; 指定的切换码 +conversionMode := readIni("conversionMode", "", "InputMethod") ; 是否使用偶数 -evenStatusModeEN := readIni("evenStatusModeEN", "", "InputMethod") -evenConversionModeEN := readIni("evenConversionModeEN", "", "InputMethod") +evenStatusMode := readIni("evenStatusMode", "", "InputMethod") +evenConversionMode := readIni("evenConversionMode", "", "InputMethod") checkTimeout := readIni("checkTimeout", 500, "InputMethod") @@ -41,7 +43,28 @@ delay := readIni("delay", 50) isStartUp := readIni("isStartUp", 0) ; 启用 JAB/JetBrains 支持 -enableJetBrainsSupport := readIni("enableJetBrainsSupport", 0) +enableJABSupport := readIni("enableJABSupport", 0) + +stateMap := { + CN: "中文状态", + 1: "中文状态", + EN: "英文状态", + 0: "英文状态", + Caps: "大写锁定" +} + +left := 0, top := 0 +lastWindow := "", lastSymbol := "", lastCursor := "" + +needHide := 0 +exe_name := "" +exe_str := "::" + +leaveDelay := delay + 500 + +isWait := 0 + +canShowSymbol := 0 updateList(1) @@ -120,32 +143,13 @@ for v in cursorInfo { } } -stateMap := { - CN: "中文状态", - EN: "英文状态", - Caps: "大写锁定" -} - -left := 0, top := 0 -lastWindow := "", lastSymbol := "", lastCursor := "" - -needHide := 0 -exe_name := "" -exe_str := "::" - -leaveDelay := delay + 500 - -isWait := 0 - -canShowSymbol := 0 - updateSymbol(1) updateCursor(init := 0) { global CN_cursor, EN_cursor, Caps_cursor, cursorInfo if (!init) { - restartJetBrains() + restartJAB() } CN_cursor := readIni("CN_cursor", "InputTipCursor\default\CN") @@ -169,6 +173,32 @@ updateCursor(init := 0) { } } } +loadCursor(state, change := 0) { + global lastCursor + if (changeCursor) { + if (state != lastCursor || change) { + for v in cursorInfo { + if (v.%state%) { + DllCall("SetSystemCursor", "Ptr", DllCall("LoadCursorFromFile", "Str", v.%state%, "Ptr"), "Int", v.value) + } + } + lastCursor := state + } + } +} +reloadCursor() { + if (changeCursor) { + if (GetKeyState("CapsLock", "T")) { + loadCursor("Caps", 1) + } else { + if (isCN()) { + loadCursor("CN", 1) + } else { + loadCursor("EN", 1) + } + } + } +} updateSymbol(init := 0) { global symbolGui, symbolConfig @@ -176,7 +206,7 @@ updateSymbol(init := 0) { hideSymbol() if (!init) { - restartJetBrains() + restartJAB() } ; 存放不同状态下的符号 symbolGui := { @@ -364,24 +394,52 @@ updateSymbol(init := 0) { } } } - - reloadSymbol() } - -reloadCursor() { - if (changeCursor) { - if (GetKeyState("CapsLock", "T")) { - loadCursor("Caps", 1) - } else { - if (isCN()) { - loadCursor("CN", 1) - } else { - loadCursor("EN", 1) - } +loadSymbol(state, left, top) { + global lastSymbol, isOverSymbol + static old_left := 0, old_top := 0 + if (left = old_left && top = old_top) { + if (state = lastSymbol || (isOverSymbol && A_TimeIdleKeyboard > leaveDelay)) { + return } + } else { + isOverSymbol := 0 } -} + hideSymbol() + if (!symbolType || !canShowSymbol) { + return + } + showConfig := "NA " + if (symbolType = 1) { + _ := symbolConfig.enableIsolateConfigPic + x := _ ? symbolConfig.%"pic_offset_x" state% : symbolConfig.pic_offset_x + y := _ ? symbolConfig.%"pic_offset_y" state% : symbolConfig.pic_offset_y + + showConfig .= "x" left + x "y" top + y + } else if (symbolType = 2) { + _ := symbolConfig.enableIsolateConfigBlock + w := _ ? symbolConfig.%"symbol_width" state% : symbolConfig.symbol_width + h := _ ? symbolConfig.%"symbol_height" state% : symbolConfig.symbol_height + x := _ ? symbolConfig.%"offset_x" state% : symbolConfig.offset_x + y := _ ? symbolConfig.%"offset_y" state% : symbolConfig.offset_y + + showConfig .= "w" w "h" h "x" left + x "y" top + y + } else if (symbolType = 3) { + _ := symbolConfig.enableIsolateConfigText + x := _ ? symbolConfig.%"textSymbol_offset_x" state% : symbolConfig.textSymbol_offset_x + y := _ ? symbolConfig.%"textSymbol_offset_y" state% : symbolConfig.textSymbol_offset_y + + showConfig .= "x" left + x "y" top + y + } + if (symbolGui.%state%) { + symbolGui.%state%.Show(showConfig) + } + + lastSymbol := state + old_top := top + old_left := left +} reloadSymbol() { if (symbolType) { canShowSymbol := returnCanShowSymbol(&left, &top) @@ -399,6 +457,14 @@ reloadSymbol() { } } } +hideSymbol() { + for state in ["CN", "EN", "Caps"] { + try { + symbolGui.%state%.Hide() + } + } + global lastSymbol := "" +} pauseApp(*) { if (A_IsPaused) { @@ -406,28 +472,30 @@ pauseApp(*) { TraySetIcon("InputTipSymbol/default/favicon.png", , 1) A_IconTip := "当前状态: 【运行中】`nInputTip - 一个输入法状态提示工具" reloadSymbol() - if (enableJetBrainsSupport) { - runJetBrains() + if (enableJABSupport) { + runJAB() } } else { A_TrayMenu.Check("暂停/运行") TraySetIcon("InputTipSymbol/default/favicon-pause.png", , 1) A_IconTip := "当前状态: 【已暂停】`nInputTip - 一个输入法状态提示工具" hideSymbol() - if (enableJetBrainsSupport) { + if (enableJABSupport) { RunWait('taskkill /f /t /im InputTip.JAB.JetBrains.exe', , "Hide") } } Pause(-1) } - -restartJetBrains() { +restartJAB() { static done := 1 - if (done && enableJetBrainsSupport) { + if (done && enableJABSupport) { SetTimer(restartAppTimer, -10) restartAppTimer() { done := 0 RunWait('taskkill /f /t /im InputTip.JAB.JetBrains.exe', , "Hide") + if (!powershell) { + return + } if (A_IsAdmin) { try { RunWait('powershell -NoProfile -Command $action = New-ScheduledTaskAction -Execute "`'\"' A_ScriptDir '\InputTip.JAB.JetBrains.exe\"`'";$principal = New-ScheduledTaskPrincipal -UserId "' A_UserName '" -LogonType ServiceAccount -RunLevel Limited;$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable -DontStopOnIdleEnd -ExecutionTimeLimit 10 -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1);$task = New-ScheduledTask -Action $action -Principal $principal -Settings $settings;Register-ScheduledTask -TaskName "abgox.InputTip.JAB.JetBrains" -InputObject $task -Force', , "Hide") @@ -445,7 +513,7 @@ updateList(init := 0) { global if (!init) { - restartJetBrains() + restartJAB() } ; 应用列表: 符号显示黑名单 app_hide_state := ":" readIni('app_hide_state', '') ":" @@ -460,10 +528,26 @@ updateList(init := 0) { ; 应用列表: 自动切换到大写锁定 app_Caps := ":" readIni('app_Caps', '') ":" } +updateWhiteList(app) { + if (!useWhiteList) { + return + } + global app_show_state + _app_show_state := readIni("app_show_state", "") + if (!InStr(app_show_state, ":" app ":")) { + if (_app_show_state) { + _app_show_state .= ":" app + } else { + _app_show_state := app + } + app_show_state := ":" _app_show_state ":" + writeIni("app_show_state", _app_show_state) + } +} updateAppOffset(init := 0) { global app_offset := {} if (!init) { - restartJetBrains() + restartJAB() } for i, v in StrSplit(readIni("app_offset", ""), ":") { part := StrSplit(v, "|") @@ -479,7 +563,7 @@ updateAppOffset(init := 0) { updateCursorMode(init := 0) { global modeList if (!init) { - restartJetBrains() + restartJAB() } modeList := { HOOK: ":" arrJoin(defaultModeList.HOOK, ":") ":", @@ -511,20 +595,3 @@ updateCursorMode(init := 0) { modeList.%item% .= %item% ":" } } - -updateWhiteList(app) { - if (!useWhiteList) { - return - } - global app_show_state - _app_show_state := readIni("app_show_state", "") - if (!InStr(app_show_state, ":" app ":")) { - if (_app_show_state) { - _app_show_state .= ":" app - } else { - _app_show_state := app - } - app_show_state := ":" _app_show_state ":" - writeIni("app_show_state", _app_show_state) - } -} diff --git a/src/v2/utils/verify-file.ahk b/src/v2/utils/verify-file.ahk index 348b249..3b72457 100644 --- a/src/v2/utils/verify-file.ahk +++ b/src/v2/utils/verify-file.ahk @@ -1,4 +1,4 @@ -dirList := ["InputTipSymbol", "InputTipSymbol\default"] +dirList := ["InputTipSymbol", "InputTipSymbol\default", "InputTipCursor", "InputTipCursor\default", "InputTipCursor\default\CN", "InputTipCursor\default\EN", "InputTipCursor\default\Caps"] for d in dirList { if (!DirExist(d)) { @@ -25,35 +25,143 @@ if (!FileExist("InputTipSymbol\default\favicon-pause.png")) { FileInstall("img\favicon-pause.png", "InputTipSymbol\default\favicon-pause.png", 1) } -cursor_temp_zip := A_Temp "\abgox-InputTipCursor-temp.zip" -if (!DirExist("InputTipCursor") || !DirExist("InputTipCursor\default")) { - FileInstall("InputTipCursor.zip", cursor_temp_zip, 1) - waitFileInstall(cursor_temp_zip) - try { - RunWait("powershell -NoProfile -Command Expand-Archive -Path '" cursor_temp_zip "' -DestinationPath '" A_ScriptDir "'", , "Hide") - } catch { - MsgBox("软件相关文件释放失败!", , "0x1000 0x10") - ExitApp() - } - try { - FileDelete(cursor_temp_zip) - } + +if (!FileExist("InputTipCursor\default\CN\AppStarting.ani")) { + FileInstall("InputTipCursor\default\CN\AppStarting.ani", "InputTipCursor\default\CN\AppStarting.ani", 1) +} +if (!FileExist("InputTipCursor\default\CN\Arrow.cur")) { + FileInstall("InputTipCursor\default\CN\Arrow.cur", "InputTipCursor\default\CN\Arrow.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\Cross.cur")) { + FileInstall("InputTipCursor\default\CN\Cross.cur", "InputTipCursor\default\CN\Cross.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\Hand.cur")) { + FileInstall("InputTipCursor\default\CN\Hand.cur", "InputTipCursor\default\CN\Hand.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\Help.cur")) { + FileInstall("InputTipCursor\default\CN\Help.cur", "InputTipCursor\default\CN\Help.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\IBeam.cur")) { + FileInstall("InputTipCursor\default\CN\IBeam.cur", "InputTipCursor\default\CN\IBeam.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\No.cur")) { + FileInstall("InputTipCursor\default\CN\No.cur", "InputTipCursor\default\CN\No.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\Pen.cur")) { + FileInstall("InputTipCursor\default\CN\Pen.cur", "InputTipCursor\default\CN\Pen.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\SizeAll.cur")) { + FileInstall("InputTipCursor\default\CN\SizeAll.cur", "InputTipCursor\default\CN\SizeAll.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\SizeNESW.cur")) { + FileInstall("InputTipCursor\default\CN\SizeNESW.cur", "InputTipCursor\default\CN\SizeNESW.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\SizeNS.cur")) { + FileInstall("InputTipCursor\default\CN\SizeNS.cur", "InputTipCursor\default\CN\SizeNS.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\SizeNWSE.cur")) { + FileInstall("InputTipCursor\default\CN\SizeNWSE.cur", "InputTipCursor\default\CN\SizeNWSE.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\SizeWE.cur")) { + FileInstall("InputTipCursor\default\CN\SizeWE.cur", "InputTipCursor\default\CN\SizeWE.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\UpArrow.cur")) { + FileInstall("InputTipCursor\default\CN\UpArrow.cur", "InputTipCursor\default\CN\UpArrow.cur", 1) +} +if (!FileExist("InputTipCursor\default\CN\Wait.ani")) { + FileInstall("InputTipCursor\default\CN\Wait.ani", "InputTipCursor\default\CN\Wait.ani", 1) } -waitFileInstall(path, isExit := 1) { - t := 0 - while (!FileExist(path)) { - if (t > 30) { - MsgBox("软件相关文件释放失败!", , "0x1000 0x10") - if (isExit) { - ExitApp() - } else { - break - } - } - t++ - Sleep(1000) - } +if (!FileExist("InputTipCursor\default\EN\AppStarting.ani")) { + FileInstall("InputTipCursor\default\EN\AppStarting.ani", "InputTipCursor\default\EN\AppStarting.ani", 1) +} +if (!FileExist("InputTipCursor\default\EN\Arrow.cur")) { + FileInstall("InputTipCursor\default\EN\Arrow.cur", "InputTipCursor\default\EN\Arrow.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\Cross.cur")) { + FileInstall("InputTipCursor\default\EN\Cross.cur", "InputTipCursor\default\EN\Cross.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\Hand.cur")) { + FileInstall("InputTipCursor\default\EN\Hand.cur", "InputTipCursor\default\EN\Hand.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\Help.cur")) { + FileInstall("InputTipCursor\default\EN\Help.cur", "InputTipCursor\default\EN\Help.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\IBeam.cur")) { + FileInstall("InputTipCursor\default\EN\IBeam.cur", "InputTipCursor\default\EN\IBeam.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\No.cur")) { + FileInstall("InputTipCursor\default\EN\No.cur", "InputTipCursor\default\EN\No.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\Pen.cur")) { + FileInstall("InputTipCursor\default\EN\Pen.cur", "InputTipCursor\default\EN\Pen.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\SizeAll.cur")) { + FileInstall("InputTipCursor\default\EN\SizeAll.cur", "InputTipCursor\default\EN\SizeAll.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\SizeNESW.cur")) { + FileInstall("InputTipCursor\default\EN\SizeNESW.cur", "InputTipCursor\default\EN\SizeNESW.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\SizeNS.cur")) { + FileInstall("InputTipCursor\default\EN\SizeNS.cur", "InputTipCursor\default\EN\SizeNS.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\SizeNWSE.cur")) { + FileInstall("InputTipCursor\default\EN\SizeNWSE.cur", "InputTipCursor\default\EN\SizeNWSE.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\SizeWE.cur")) { + FileInstall("InputTipCursor\default\EN\SizeWE.cur", "InputTipCursor\default\EN\SizeWE.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\UpArrow.cur")) { + FileInstall("InputTipCursor\default\EN\UpArrow.cur", "InputTipCursor\default\EN\UpArrow.cur", 1) +} +if (!FileExist("InputTipCursor\default\EN\Wait.ani")) { + FileInstall("InputTipCursor\default\EN\Wait.ani", "InputTipCursor\default\EN\Wait.ani", 1) +} + +if (!FileExist("InputTipCursor\default\Caps\AppStarting.ani")) { + FileInstall("InputTipCursor\default\Caps\AppStarting.ani", "InputTipCursor\default\Caps\AppStarting.ani", 1) +} +if (!FileExist("InputTipCursor\default\Caps\Arrow.cur")) { + FileInstall("InputTipCursor\default\Caps\Arrow.cur", "InputTipCursor\default\Caps\Arrow.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\Cross.cur")) { + FileInstall("InputTipCursor\default\Caps\Cross.cur", "InputTipCursor\default\Caps\Cross.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\Hand.cur")) { + FileInstall("InputTipCursor\default\Caps\Hand.cur", "InputTipCursor\default\Caps\Hand.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\Help.cur")) { + FileInstall("InputTipCursor\default\Caps\Help.cur", "InputTipCursor\default\Caps\Help.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\IBeam.cur")) { + FileInstall("InputTipCursor\default\Caps\IBeam.cur", "InputTipCursor\default\Caps\IBeam.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\No.cur")) { + FileInstall("InputTipCursor\default\Caps\No.cur", "InputTipCursor\default\Caps\No.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\Pen.cur")) { + FileInstall("InputTipCursor\default\Caps\Pen.cur", "InputTipCursor\default\Caps\Pen.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\SizeAll.cur")) { + FileInstall("InputTipCursor\default\Caps\SizeAll.cur", "InputTipCursor\default\Caps\SizeAll.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\SizeNESW.cur")) { + FileInstall("InputTipCursor\default\Caps\SizeNESW.cur", "InputTipCursor\default\Caps\SizeNESW.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\SizeNS.cur")) { + FileInstall("InputTipCursor\default\Caps\SizeNS.cur", "InputTipCursor\default\Caps\SizeNS.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\SizeNWSE.cur")) { + FileInstall("InputTipCursor\default\Caps\SizeNWSE.cur", "InputTipCursor\default\Caps\SizeNWSE.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\SizeWE.cur")) { + FileInstall("InputTipCursor\default\Caps\SizeWE.cur", "InputTipCursor\default\Caps\SizeWE.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\UpArrow.cur")) { + FileInstall("InputTipCursor\default\Caps\UpArrow.cur", "InputTipCursor\default\Caps\UpArrow.cur", 1) +} +if (!FileExist("InputTipCursor\default\Caps\Wait.ani")) { + FileInstall("InputTipCursor\default\Caps\Wait.ani", "InputTipCursor\default\Caps\Wait.ani", 1) } /**