@ -212,21 +212,25 @@ end
function GmEditorUi : insertNew ( typename )
local tp = typename
if typename == nil then
dialog.showInputPrompt ( " Class type " , " Input class type :" , COLOR_WHITE , " " , self : callback ( " insertNew " ) )
dialog.showInputPrompt ( " Class type " , " Input class type or leave empty for auto and '*' for new ptr type auto :" , COLOR_WHITE , " " , self : callback ( " insertNew " ) )
return
end
local trg = self : currentTarget ( )
if trg.target and trg.target . _kind and trg.target . _kind == " container " then
if tp == " " then
trg.target : resize ( # trg.target + 1 )
elseif tp == " * " then
trg.target : insert ( " # " , { new = true } )
else
local ntype = df [ tp ]
if ntype == nil then
dialog.showMessage ( " Error! " , " Type ' " .. tp .. " not found " , COLOR_LIGHTRED )
dialog.showMessage ( " Error! " , " Type ' " .. tp .. " not found " , COLOR_ RED)
return
end
local trg = self : currentTarget ( )
if trg.target and trg.target . _kind and trg.target . _kind == " container " then
local thing = ntype : new ( )
dfhack.call_with_finalizer ( 1 , false , df.delete , thing , function ( tscreen , target , to_insert )
target : insert ( " # " , to_insert ) ; tscreen : updateTarget ( true , true ) ; end , self , trg.target , thing )
trg.target : insert ( " # " , { new = ntype } )
end
self : updateTarget ( true , true )
end
end
function GmEditorUi : deleteSelected ( key )