Amazing work guys. :yes:yes
I noticed that autocomplete pops up even when typing comments. Also typing the letters "so", even in a comment crashes it.
I notice there is a dialog that flashes for a second when it loads and again when you close it. I hadn't seen that before.
Announcement
Collapse
No announcement yet.
Let's Build An Action Plugin Compiler Together
Collapse
X
-
hmm i have a previus version of other fucs and now works, please let me do the xml for the action editor, tomorrow i will post it
thanks
Leave a comment:
-
That example crashes on Windows 7 x64.Originally posted by RizlaUK View Postdid you replace the Scintilla.lua in the scripts dir with the one i posted above ?
anyway, heres the APZ, i made some changes to AMSWaves function names (that might have caused your crash, dunno) all SCI function are now dot noated except SCI_SendMessage
I type "Dialog." then the program crashes.
Leave a comment:
-
did you replace the Scintilla.lua in the scripts dir with the one i posted above ?
anyway, heres the APZ, i made some changes to AMSWaves function names (that might have caused your crash, dunno) all SCI function are now dot noated except SCI_SendMessageLast edited by RizlaUK; 02-16-2010, 06:01 AM.
Leave a comment:
-
Hmmm the app crashes just when I make a keystroke, could you post an apz with API?
This is my callback, i think that all is corrects, and all functions are included
PHP Code:function Callback(lpnmhdr)
if lpnmhdr.code == SCN_MARGINCLICK then
margin = lpnmhdr.margin
position = lpnmhdr.position
linenumber = SCI_SendMessage(pointer, SCI_LINEFROMPOSITION, position)
if margin == 2 then
nFoldLevel=SCI_SendMessage(pointer, SCI_GETFOLDLEVEL, linenumber)
if nFoldLevel > 9200 then
SCI_SendMessage(pointer, SCI_TOGGLEFOLD, linenumber)
end
end
elseif lpnmhdr.code == SCN_CHARADDED then
-- process autocompleat
local nPos=SCI.GetCurrentPos(pointer)
local sWord=GetWordInPos(pointer,nPos)
if sWord ~= "" then
ShowAutoC(pointer,sWord,String.Length(sWord))
end
if lpnmhdr.ch == 13 then -- enter key
-- Automatic Indentation
-- set undo start point
SCI.BeginUndoAction(pointer)
-- get current position
local nPos=SCI.GetCurrentPos(pointer)
-- get current line
local nLine=SCI.LineFromPosition(pointer,nPos)-1
-- get line indention
local nLineIndentation = SCI.GetLineIndentation(pointer,nLine)
-- if this line is indented
if nLineIndentation > 0 then
-- set new line indendion
SCI.SetLineIndentation(pointer,nLine+1,nLineIndentation)
-- get the position of new line indendion
local nNewPos=SCI.GetLineIndentPosition(pointer,nLine+1)
-- now goto new position
SCI.GotoPos(pointer,nNewPos)
end
-- set undo end point
SCI.EndUndoAction(pointer)
elseif lpnmhdr.ch == 40 then -- "(" calltip
local nPos=SCI.GetCurrentPos(pointer)
local sWord = GetWordInPos(pointer,nPos-1)
sFunction = GetCallTipText(sWord)
if sFunction ~= "" then
local Buffer=Memory.Allocate(String.Length(sFunction));
Memory.PutString(Buffer,sFunction,String.Length(sFunction), "Ascii")
SCI.CallTipShow(pointer, nPos + 1, Buffer)
Memory.Free(Buffer)
end
elseif lpnmhdr.ch == 41 then -- ")" calltip
SCI.CallTipCancel(pointer)
end
end
end
Leave a comment:
-
use the above if you want this right now, if the above confuses any of you then wait for the full example, scintilla is tricky to use at first so i would suggest that AMS novices wait till we have wrapped all this up properly and have a stable system with error reporting
just a FYI
Leave a comment:
-
that is a absolute must for this framework, i wrapped the functions but inserted no error checking, when there's a error the editor just bombs out with no warning, its only cleaver me knowing where to look, lol, but it needs error checking for sure, passing a nil value to a scintilla function really messes things up, lol(and implement irPluginHelper to test num and type of vars and return error codes)
the action file editor, sure it will help, but it still takes lots of time to do, and theres many functions to cover, i just do not have the time
but if you are willing to help out wrapping the functions properly with error checking then i will also work on it, just say what function groups you will do, i will do the rest ... anyone else willing to pitch in ?
first you will need the functions ....How I can implemenbt this on my editor, i tryed to call function and this havent effect on editor...
this is the part of the callback that controls the AC/CallTip systems, add it to your callback under the SCN_CHARADDED event
Code:elseif lpnmhdr.code == SCN_CHARADDED then -- process autocompleat local nPos=SCI.GetCurrentPos(pointer) local sWord=GetWordInPos(pointer,nPos) if sWord ~= "" then ShowAutoC(pointer,sWord,String.Length(sWord)) end if lpnmhdr.ch == 13 then -- enter key -- Automatic Indentation -- set undo start point SCI.BeginUndoAction(pointer) -- get current position local nPos=SCI.GetCurrentPos(pointer) -- get current line local nLine=SCI.LineFromPosition(pointer,nPos)-1 -- get line indention local nLineIndentation = SCI.GetLineIndentation(pointer,nLine) -- if this line is indented if nLineIndentation > 0 then -- set new line indendion SCI.SetLineIndentation(pointer,nLine+1,nLineIndentation) -- get the position of new line indendion local nNewPos=SCI.GetLineIndentPosition(pointer,nLine+1) -- now goto new position SCI.GotoPos(pointer,nNewPos) end -- set undo end point SCI.EndUndoAction(pointer) elseif lpnmhdr.ch == 40 then -- "(" calltip local nPos=SCI.GetCurrentPos(pointer) local sWord = GetWordInPos(pointer,nPos-1) sFunction = GetCallTipText(sWord) if sFunction ~= "" then local Buffer=Memory.Allocate(String.Length(sFunction)); Memory.PutString(Buffer,sFunction,String.Length(sFunction), "Ascii") SCI.CallTipShow(pointer, nPos + 1, Buffer) Memory.Free(Buffer) end elseif lpnmhdr.ch == 41 then -- ")" calltip SCI.CallTipCancel(pointer) end
add the below few functions to the global area of your editor
and use this edited API file with spaces removed in API.zip (dofile() from global) , also, the scintilla.zip contains my function wrapper (added to AMSWaves scintilla flag file)Code:-- gets the text for a functions calltip function GetCallTipText(sWord) local ret="" local nSize = Table.Count(tbAMSAPI) if nSize > 0 then nWordLen=String.Length(sWord) for i=1, nSize do local APIWord=tbAMSAPI[i].Func if APIWord == sWord then sFunc=tbAMSAPI[i].Func sArgs=tbAMSAPI[i].Args.."\r\n" sDesc=tbAMSAPI[i].Desc ret = sFunc..sArgs..sDesc break end end end return ret end -- builds the autocompleat string for scintilla function GetACList(CText,ACWordLen) local ret="" local nSize = Table.Count(tbAMSAPI) if nSize > 0 then for i=1, nSize do local CWord=String.Mid(tbAMSAPI[i].Func,1,ACWordLen) if String.Lower(CWord) == String.Lower(CText) then local sFunc=tbAMSAPI[i].Func if sFunc ~= "" then ret=ret..sFunc.." " end end end end ret=String.TrimRight(ret)-- remove the last (blank) item return ret end -- shows the autocompleat window function ShowAutoC(nObject,ACWord,ACWordLen) if ACWord ~= "" then local AutoText = GetACList(ACWord,ACWordLen) if AutoText ~= "" then if SCI.AutoCActive(nObject) then SCI.AutoCCancel(nObject) end SCI.AutoCSetIgnoreCase(nObject,1) local Buffer=Memory.Allocate(String.Length(AutoText)); Memory.PutString(Buffer,AutoText,String.Length(AutoText), "Ascii") SCI.AutoCShow(nObject, ACWordLen, Buffer) Memory.Free(Buffer) else if SCI.AutoCActive(nObject) then SCI.AutoCCancel(nObject) end end end end -- gets the word at position 'nPos' function GetWordInPos(nObject,nPos) local ret = "" local nStartPos=SCI.WordStartPosition(nObject,nPos,1) local nEndPos =SCI.WordEndPosition(nObject,nPos,1) local a=SCI.GetTextRange(nObject,nStartPos,nEndPos) -- app closes on this line local b=SCI.GetTextRange(nObject,nStartPos - 1,nStartPos) if b == "." then local nStartPos=SCI.WordStartPosition(nObject,nPos-String.Length(a)-1,1) local nEndPos =SCI.WordEndPosition (nObject,nPos-String.Length(a)-1,1) local c=SCI.GetTextRange(nObject,nStartPos,nEndPos) ret = c .. "." .. a else ret = a end return ret end
now your editor has full auto-compleat and calltip systems :yes
EDIT: also you will need the 'SCI.GetTextRange' function from AMSWavesLast edited by RizlaUK; 02-16-2010, 06:01 AM.
Leave a comment:
-
How I can implemenbt this on my editor, i tryed to call function and this havent effect on editor...
You created http://www.indigorose.com/forums/showthread.php?t=25343 i thuink that this is very useful for us, for create the xml ans blank lua file (and implement irPluginHelper to test num and type of vars and return error codes)Code:now just the xml for the action editor, anyone ... ?
I think that it can be included 2 typedefs to define error numbers of plugin and include in scintilla, and some definitions customizables to the action plugin
Leave a comment:
-
thanks, saves me a job
i dident think of using those files, forgot they were even there
now just the xml for the action editor, anyone ... ?
EDIT, almost perfect, lots of spaces in the function name param messed up the system (scintilla seperates the AC string with a space), but its fixed now (god i love search and replace, lol)Last edited by RizlaUK; 02-16-2010, 06:01 AM.
Leave a comment:
-
Great work, I make this for you, i think that this help you
I think that there are any function with extra arguments, because I replace () but let me check and I upload a best version
There are all definitions of AMS 7.5 API with extra plugins, Global vars and the Lua api, i catch original files of AMS Script editorAttached FilesLast edited by pabloko; 10-03-2009, 09:26 AM.
Leave a comment:
-
for those of you that dont know what im talking about .....
the first image is the auto-compleat window, this helps loads when writing code
the second image is the calltip, this gives some TIPs on how to CALL the function, hence the name ....Last edited by RizlaUK; 02-16-2010, 06:01 AM.
Leave a comment:
-
ok, im appealing for some help here, this task is immense, iv got the autocompleat system in and working, now i need the entire AMS function list added to the API, my system uses the below function to add the items to the api list and further functions to break it down for the AC window and calltip popup ....
and add items to the API by calling with, arg1 = function name, arg2= function arguments "()" for no arguments, arg3= short function descriptionCode:function ADD_TO_API(sFunc,sArgs,sDesc) if not sFunc then Application.ExitScript() end if not sArgs then sArgs="" end if not sDesc then sDesc="" end if not tbAMSAPI then tbAMSAPI={} end local nNext=Table.Count(tbAMSAPI)+1 Table.Insert(tbAMSAPI,nNext,{}) tbAMSAPI[nNext].Func=sFunc tbAMSAPI[nNext].Args=sArgs tbAMSAPI[nNext].Desc=sDesc end
and variables can be added to the API system only by calling with 1 argument.Code:ADD_TO_API("Window.SetSize","(nHwnd, nWidth, nHeight)","Sets a windows size.")
any one want to wrap this up for me while i work on trickier things like brace-highlighting and bad string detection ?Code:ADD_TO_API("_SourceFolder")
Leave a comment:
-
ok, heres a vital function for using scintilla with dot notation keywords (table.function) that uses SCI.GetTextRange
the function will return the complete word at the specified position, whether a single word (word) or a dot notated word (word.word), this function is vital for the autocompleat/calltip system as well many other things and its also using the wrapper i attached a few posts back (i might write the xml for that today, unless someone else wants to do it ... ?)
once iv linked the AC system in i will post what i have so farCode:function GetWordInPos(nObject,nPos) local ret = "" local nStartPos=SCI.WordStartPosition(nObject,nPos,1) local nEndPos =SCI.WordEndPosition(nObject,nPos,1) local a=SCI.GetTextRange(nObject,nStartPos,nEndPos) local b=SCI.GetTextRange(nObject,nStartPos - 1,nStartPos) if b == "." then local nStartPos=SCI.WordStartPosition(nObject,nPos-String.Length(a)-1,1) local nEndPos =SCI.WordEndPosition (nObject,nPos-String.Length(a)-1,1) local c=SCI.GetTextRange(nObject,nStartPos,nEndPos) ret = c .. "." .. a else ret = a end return ret end
Leave a comment:
-
I am having a really bady time sleeping or even resting over all the sht that as happned my end so i will run a test later RizlaUK and get you the error sorry forOriginally posted by RizlaUK View Postjust as i was about to give up i noticed i missed a prefix off one of my var's further down the script, now it works, strange though because it traced back to that function
the late reply lefts just say all this sht hit me little harder then i thouhgt.
Leave a comment:
-
just as i was about to give up i noticed i missed a prefix off one of my var's further down the script, now it works, strange though because it traced back to that function
Leave a comment:
Leave a comment: