CodeEditor = {} CodeEditor.title = 'Sandcat Editor' function CodeEditor:scan() local ui = self.ui if SyhuntCode ~= nil then SyhuntCode:ScanFile(ui.scriptfile.value) else app.showmessage('Syhunt Code not installed.') end end function CodeEditor:drop() local ui = self.ui local slp = scl.listparser:new() slp:load(tab.codeedit.droplist) if slp.count == 1 then ui.scriptfile.value = tab.codeedit.droplist else while slp:parsing() do self:openinnewtab(slp.current) end end slp:release() end function CodeEditor:new() local ui = self.ui tab.title = self.title ui.scriptfile.value = '' tab.codeedit.text = '' end function CodeEditor:openinnewtab(f) local ui = self.ui self:newtab() ui.scriptfile.value = f scop.utils.delay(100) end function CodeEditor:open(f) local ui = self.ui if f == undefined then f = ui.scriptfile.value end if scop.file.exists(f) then tab.codeedit:sethighlighter(scop.file.getext(f)) tab.codeedit.text = scop.file.getcontents(f) --app.showmessage(tab.codeedit.text) tab.title = scop.file.getname(f) end if f == '' then tab.codeedit.text = '' tab.title = self.title end end function CodeEditor:save() local ui = self.ui local f = ui.scriptfile.value local ext = scop.file.getext(f) local sl = scl.stringlist:new() sl.text = tab.codeedit.text if scop.file.exists(f) then sl:savetofile(f) ui.scriptfile.value = f else f = app.savefile('All files (*.*)|*.*',ext,'Untitled.'..ext) if f ~= '' then sl:savetofile(f) ui.scriptfile.value = f end end sl:release() end function CodeEditor:newtab() local j = {} j.icon = 'url(Syhunt.scx#Images\\icon_codeedit.png)' j.title = self.title j.toolbar = 'Syhunt.scx#Scripts\\CodeEditor.html' j.table = 'CodeEditor.ui' if browser.newtabx(j) ~= 0 then local filter = Syhunt:getfile('Scripts/CodeEditor.flt') local html = Syhunt:getfile('Scripts/CodeEditor.html') tab:showcodeedit('','.html') tab.codeedit.acceptdrop = true tab.codeedit.dropend = 'CodeEditor:drop()' self.ui.scriptfile:setattrib('filter',stringop.replace(filter,string.char(13)..string.char(10),'')) end end