forked from pkulchenko/ZeroBranePackage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
overtype.lua
28 lines (26 loc) · 952 Bytes
/
overtype.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
local id = ID("overtype.overtype")
return {
name = "Overtype on/off",
description = "Allows to switch overtyping on/off on systems that don't provide shortcut for that.",
author = "Paul Kulchenko",
version = 0.31,
dependencies = "1.0",
onRegister = function(self)
local menu = ide:FindTopMenu("&Edit")
local pos = self:GetConfig().insertat and
self:GetConfig().insertat-1 or menu:GetMenuItemCount()
menu:InsertCheckItem(pos, id, "Overtype"..KSC(id, "Alt-Shift-I"))
ide:GetMainFrame():Connect(id, wx.wxEVT_COMMAND_MENU_SELECTED, function(event)
local ed = ide:GetEditor()
if ed then ed:SetOvertype(event:IsChecked()) end
end)
ide:GetMainFrame():Connect(id, wx.wxEVT_UPDATE_UI, function(event)
local ed = ide:GetEditor()
event:Check(ed and ed:GetOvertype())
event:Enable(ed ~= nil)
end)
end,
onUnRegister = function(self)
ide:RemoveMenuItem(id)
end,
}