From aca342c8fad95980c69b3ee2589ed015e682fd74 Mon Sep 17 00:00:00 2001 From: rcmdnk Date: Sun, 29 Sep 2024 01:46:24 +0900 Subject: [PATCH] refactor: update OpenHomepage method to accept Btn and Info parameters refactor: reorder TwoLetterNormalMapsEnabled method and update parameter refactor: update CheckMenu method to accept ItemName, ItemPos, and MyMenu parameters refactor: simplify supported window message in CheckMenu method refactor: update ShowGui method to use additional parameters fix: missing closing parentheses in OK method of VimGui class refactor: update OK method to accept Btn and Info parameters in VimSetting refactor: update Cancel and Reset methods to accept Btn and Info parameters refactor: simplify verbose status display message in VimState class refactor: update FullStatus method to use additional parameters --- lib/vim_about.ahk | 2 +- lib/vim_ahk.ahk | 10 +++++----- lib/vim_check.ahk | 18 +++--------------- lib/vim_gui.ahk | 4 ++-- lib/vim_setting.ahk | 6 +++--- lib/vim_state.ahk | 10 ++-------- 6 files changed, 16 insertions(+), 34 deletions(-) diff --git a/lib/vim_about.ahk b/lib/vim_about.ahk index f7be583..d91b837 100644 --- a/lib/vim_about.ahk +++ b/lib/vim_about.ahk @@ -30,7 +30,7 @@ class VimAbout Extends VimGui{ this.HwndAll.Push(this.Hwnd["VimAboutOK"]) } - OpenHomepage(*){ + OpenHomepage(Btn, Info){ this.Vim.VimToolTip.RemoveToolTip() Run(this.Homepage) } diff --git a/lib/vim_ahk.ahk b/lib/vim_ahk.ahk index bb21a49..ef688f5 100644 --- a/lib/vim_ahk.ahk +++ b/lib/vim_ahk.ahk @@ -215,15 +215,15 @@ class VimAhk{ HotIf() } - SendSame(HotkeyName){ - SendInput(HotkeyName) + TwoLetterNormalMapsEnabled(HotkeyName){ + Return this.IsVimGroup() && (this.State.StrIsInCurrentVimMode("Insert")) && this.TwoLetterNormalIsSet } - TwoLetterNormalMapsEnabled(*){ - Return this.IsVimGroup() && (this.State.StrIsInCurrentVimMode("Insert")) && this.TwoLetterNormalIsSet + SendSame(HotkeyName){ + SendInput(HotkeyName) } - TwoLetterEnterNormal(*){ + TwoLetterEnterNormal(HotkeyName){ this.State.SetNormal() } diff --git a/lib/vim_check.ahk b/lib/vim_check.ahk index 9a84b10..790c568 100644 --- a/lib/vim_check.ahk +++ b/lib/vim_check.ahk @@ -3,7 +3,7 @@ this.Vim := Vim } - CheckMenu(*) { + CheckMenu(ItemName, ItemPos, MyMenu) { ; Additional message is necessary before checking current window. ; Otherwise process name cannot be retrieved...? MsgBox("Checking current window...", "Vim Ahk") @@ -12,21 +12,9 @@ win_class := WinGetClass("ahk_pid " process) title := WinGetTitle("ahk_pid " process) if(this.Vim.IsVimGroup()){ - MsgBox(" - ( - Supported - Process name: %name% - Class : %win_class% - Title : %title% - )", "Vim Ahk", "Iconi") + MsgBox("Supported`nProcess name: " name "`nClass : " win_class "`nTitle : " title, "Vim Ahk", "Iconi") }else{ - MsgBox(" - ( - Not supported - Process name: %name% - Class : %win_class% - Title : %title% - )", "Vim Ahk", "Iconx") + MsgBox("Not supported`nProcess name: " name "`nClass : " win_class "`nTitle : " title, "Vim Ahk", "Iconx") } } } diff --git a/lib/vim_gui.ahk b/lib/vim_gui.ahk index 83df447..ac3c1dd 100644 --- a/lib/vim_gui.ahk +++ b/lib/vim_gui.ahk @@ -7,7 +7,7 @@ class VimGui{ this.OKObj := ObjBindMethod(this, "OK") } - ShowGui(*){ + ShowGui(ItemName, ItemPos, MyMenu){ if(this.Hwnd == 0){ this.Hwnd := Gui("", this.Title) this.HwndAll.Push(this.Hwnd) @@ -33,7 +33,7 @@ class VimGui{ this.Hwnd.Hide() } - OK(*){ + OK(Btn, Info){ this.Hide() } diff --git a/lib/vim_setting.ahk b/lib/vim_setting.ahk index ae86b04..b211165 100644 --- a/lib/vim_setting.ahk +++ b/lib/vim_setting.ahk @@ -187,7 +187,7 @@ class VimSetting Extends VimGui{ return this.GetConf(Name, "description") } - OK(*){ + OK(Btn, Info){ this.Hwnd.Submit() this.VimV2Conf() this.Vim.Setup() @@ -195,11 +195,11 @@ class VimSetting Extends VimGui{ this.Hide() } - Cancel(*){ + Cancel(Btn, Info){ this.Hide() } - Reset(*){ + Reset(Btn, Info){ this.VimDefault2V() this.UpdateGuiValue() } diff --git a/lib/vim_state.ahk b/lib/vim_state.ahk index cc0cbc1..c7297b9 100644 --- a/lib/vim_state.ahk +++ b/lib/vim_state.ahk @@ -32,13 +32,7 @@ this.SetTooltip(this.Mode "`r`ng=" this.g "`r`nn=" this.n "`r`nLineCopy=" this.LineCopy, 4) } if(Verbose >= 4){ - MsgBox(" - ( - Mode : %this.Mode% - Vim_g : %this.g% - Vim_n : %this.n% - VimLineCopy : %this.LineCopy% - )", "Vim Ahk") + MsgBox("Mode : " this.Mode "`nVim_g : " this.g "`nVim_n : " this.n "`nVimLineCopy : " this.LineCopy, "Vim Ahk") } } @@ -48,7 +42,7 @@ this.Vim.VimToolTip.SetRemoveToolTip(1000) } - FullStatus(*){ + FullStatus(ItemName, ItemPos, MyMenu){ this.CheckMode(4, , , , 1) }