
How can i set Hexnumbers ($0F) and "= * + / -" to NumbersStyle/Color?
Code: Select all
GOSCI_AddKeywords(1, "+ - * /", #STYLES_NUMBERS)
GOSCI_AddKeywords(1, "$", #STYLES_NUMBERS, #GOSCI_LEFTDELIMITWITHOUTWHITESPACE)
Yes, configuring the GoScintilla lexer can be a little fiddly, more so than I had hoped when I wrote this little lib. There was a fine balance to be found between ease of use and flexibility/power and, as it turned out, I leaned towards giving the lexer the greatest power at some cost to the ease of use of this utility.ts-soft wrote:thx, i am slow coach but i understand more and more
Code: Select all
If ScintillaSendMessage(id, #SCI_GETFOLDLEVEL, lineIndex) & #SC_FOLDLEVELHEADERFLAG
Code: Select all
If ScintillaSendMessage(id, #SCI_GETFOLDEXPANDED, lineIndex)
Code: Select all
UpdateWindow_(GadgetID(1))
Yes but that will not help you identify those lines in the text which are folding header lines without performing some complex parsing and lexing. You are best off simply querying each line's fold-level using the appropriate Scintilla messages as shown above.Arent the "folding header lines" the lines created with:
Or do i miss something?Code: Select all
;Add some folding keywords. GOSCI_AddKeywords(1, "Procedure Macro", #STYLES_COMMANDS, #GOSCI_OPENFOLDKEYWORD|#GOSCI_DELIMITNONE) GOSCI_AddKeywords(1, "EndProcedure EndMacro", #STYLES_COMMANDS, #GOSCI_CLOSEFOLDKEYWORD|#GOSCI_DELIMITNONE)
Code: Select all
For I=0 To ScintillaSendMessage(1, #SCI_GETLINECOUNT)-1
If ScintillaSendMessage(1, #SCI_GETFOLDLEVEL, I) = #SC_FOLDLEVELBASE|#SC_FOLDLEVELHEADERFLAG
ScintillaSendMessage(1, #SCI_TOGGLEFOLD, I)
EndIf
Next
Code: Select all
IncludePath "..\..\"
XIncludeFile "GoScintilla.pbi"
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
InitScintilla()
CompilerEndIf
If OpenWindow(0, 100, 200, 600, 600, "GoScintilla demo!", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
RemoveKeyboardShortcut(0, #PB_Shortcut_Tab) ;Required for the tab key to function correctly when the Scintilla control has the focus.
GOSCI_Create(1, 10, 40, 580, 550, 0, #GOSCI_AUTOSIZELINENUMBERSMARGIN|#GOSCI_ALLOWCODEFOLDING)
ButtonGadget(10, 0, 10, 150, 20, "COLLAPSE ALL ITEMS!")
ButtonGadget(11, 180, 10, 150, 20, "EXPAND ALL ITEMS!")
GOSCI_SetAttribute(1, #GOSCI_LINENUMBERAUTOSIZEPADDING, 10)
GOSCI_SetMarginWidth(1, #GOSCI_MARGINFOLDINGSYMBOLS, 24)
GOSCI_SetColor(1, #GOSCI_CARETLINEBACKCOLOR, $B4FFFF)
GOSCI_SetFont(1, "Courier New", 10)
GOSCI_SetTabs(1, 2)
;Set styles for our syntax highlighting.
;=======================================
Enumeration
#STYLES_COMMANDS = 1
#STYLES_COMMENTS
#STYLES_LITERALSTRINGS
#STYLES_NUMBERS
#STYLES_CONSTANTS
#STYLES_FUNCTIONS
EndEnumeration
;Set individual styles for commands.
GOSCI_SetStyleFont(1, #STYLES_COMMANDS, "", -1, #PB_Font_Bold)
GOSCI_SetStyleColors(1, #STYLES_COMMANDS, $800000) ;We have omitted the optional back color.
;Set individual styles for comments.
GOSCI_SetStyleFont(1, #STYLES_COMMENTS, "", -1, #PB_Font_Italic)
GOSCI_SetStyleColors(1, #STYLES_COMMENTS, $006400) ;We have omitted the optional back color.
;Set individual styles for literal strings.
GOSCI_SetStyleColors(1, #STYLES_LITERALSTRINGS, #Gray) ;We have omitted the optional back color.
;Set individual styles for numbers.
GOSCI_SetStyleColors(1, #STYLES_NUMBERS, #Red) ;We have omitted the optional back color.
;Set individual styles for constants.
GOSCI_SetStyleColors(1, #STYLES_CONSTANTS, $2193DE) ;We have omitted the optional back color.
;Set individual styles for functions.
GOSCI_SetStyleColors(1, #STYLES_FUNCTIONS, #Blue) ;We have omitted the optional back color.
;Set keywords for our syntax highlighting.
;=========================================
GOSCI_AddKeywords(1, "Debug End If ElseIf Else EndIf For To Next Step Protected ProcedureReturn", #STYLES_COMMANDS)
GOSCI_AddKeywords(1, ";", #STYLES_COMMENTS, #GOSCI_DELIMITTOENDOFLINE)
GOSCI_AddKeywords(1, Chr(34) + Chr(34), #STYLES_LITERALSTRINGS, #GOSCI_DELIMITBETWEEN)
GOSCI_AddKeywords(1, "#", #STYLES_CONSTANTS, #GOSCI_LEFTDELIMITWITHOUTWHITESPACE)
GOSCI_AddKeywords(1, "(", #STYLES_FUNCTIONS, #GOSCI_RIGHTDELIMITWITHWHITESPACE)
GOSCI_AddKeywords(1, ")", #STYLES_FUNCTIONS)
;Add some folding keywords.
GOSCI_AddKeywords(1, "Procedure Macro", #STYLES_COMMANDS, #GOSCI_OPENFOLDKEYWORD|#GOSCI_DELIMITNONE)
GOSCI_AddKeywords(1, "EndProcedure EndMacro", #STYLES_COMMANDS, #GOSCI_CLOSEFOLDKEYWORD|#GOSCI_DELIMITNONE)
;Additional lexer options.
;=========================
GOSCI_SetLexerOption(1, #GOSCI_LEXEROPTION_SEPARATORSYMBOLS, @"=+-*/%()[],.") ;You would use GOSCI_AddKeywords() to set a style for some of these if required.
GOSCI_SetLexerOption(1, #GOSCI_LEXEROPTION_NUMBERSSTYLEINDEX, #STYLES_NUMBERS)
;Set some initial text.
;======================
text$ = "; GoScintilla." + #CRLF$
text$ + "; By Stephen Rodriguez." + #CRLF$ + #CRLF$
text$ + "#MyConstant$ = " + Chr(34) + "Version = 1.0" + Chr(34) + #CRLF$ + #CRLF$
text$ + "Procedure.i AddIntegers(a, b)" + #CRLF$
text$ + #TAB$ + "Protected result" + #CRLF$
text$ + #TAB$ + "result = a + b ; Calculate the sum of the 2 integers." + #CRLF$
text$ + #TAB$ + "ProcedureReturn result" + #CRLF$
text$ + "EndProcedure" + #CRLF$ + #CRLF$
text$ + "Debug " + Chr(34) + "The sum of 10 and 20 is " + Chr(34) + " + Str(AddIntegers(10, 20))" + #CRLF$ + #CRLF$
text$ + "End" + #CRLF$
GOSCI_SetText(1, text$)
Repeat
eventID = WaitWindowEvent()
Select eventID
Case #PB_Event_Gadget
Select EventGadget()
Case 10 ;Collapse all items.
For I=0 To ScintillaSendMessage(1, #SCI_GETLINECOUNT)-1
If ScintillaSendMessage(1, #SCI_GETFOLDLEVEL, I) & #SC_FOLDLEVELHEADERFLAG
If ScintillaSendMessage(1, #SCI_GETFOLDEXPANDED, I)
ScintillaSendMessage(1, #SCI_TOGGLEFOLD, I)
EndIf
EndIf
Next
Case 11 ;Expand all items.
For I=0 To ScintillaSendMessage(1, #SCI_GETLINECOUNT)-1
If ScintillaSendMessage(1, #SCI_GETFOLDLEVEL, I) & #SC_FOLDLEVELHEADERFLAG
If ScintillaSendMessage(1, #SCI_GETFOLDEXPANDED, I) = 0
ScintillaSendMessage(1, #SCI_TOGGLEFOLD, I)
EndIf
EndIf
Next
EndSelect
EndSelect
Until eventID = #PB_Event_CloseWindow
;Free the Scintilla gadget.
GOSCI_Free(1)
EndIf
Code: Select all
GOSCI_RestyleLinesXXX(1, 0, -1)
Feel free to add it and I'll take the credit for it of course!Peyman wrote:thnaks srod, very simple and good source.
this source dont have AutoComplete feature ? (autocomplete features is very good as you know)
Code: Select all
Structure GoScintillaApis
id.i ;Scintilla#
fname$ ;Name of function or variable or ...
args$ ;Arguments of function.
sDecs$ ;Description of function.
EndStructure
Code: Select all
Global NewMap gGOSCI_Apis.GoScintillaApis()
Code: Select all
ProcedureDLL GOSCI_ScintillaCallBackXXX(id, *scinotify.SCNotification)
Protected *this._GoScintilla, startLine, endLine, lineLength, utf8Buffer, i, level, newLevel, startPos
Protected nPos, txtr.TEXTRANGE, sWord.s, sFunc.s, sFunc2.s
*this = GetGadgetData(id)
Select *scinotify\nmhdr\code
Case #SCN_NEEDSHOWN
;Here we arrange for lines which may be collapsed to be expanded in the case that the folded section has been altered by the user.
startLine = ScintillaSendMessage(id, #SCI_LINEFROMPOSITION, *scinotify\position)
endLine = ScintillaSendMessage(id, #SCI_LINEFROMPOSITION, *scinotify\position + *scinotify\length)
For i = startLine To endLine
ScintillaSendMessage(id, #SCI_ENSUREVISIBLE, i)
Next
If ScintillaSendMessage(id, #SCI_GETFOLDLEVEL, endLine)&#SC_FOLDLEVELHEADERFLAG
level = ScintillaSendMessage(id, #SCI_GETFOLDLEVEL, endLine) & #SC_FOLDLEVELNUMBERMASK
newLevel = ScintillaSendMessage(id, #SCI_GETFOLDLEVEL, endLine+1) & #SC_FOLDLEVELNUMBERMASK
If newLevel > level
ScintillaSendMessage(id, #SCI_ENSUREVISIBLE, endLine+1)
EndIf
EndIf
Case #SCN_MARGINCLICK
Select *scinotify\margin
Case #GOSCI_MARGINFOLDINGSYMBOLS
startLine = ScintillaSendMessage(id, #SCI_LINEFROMPOSITION, *scinotify\position)
;Check it is a header line.
If ScintillaSendMessage(id, #SCI_GETFOLDLEVEL, startLine) & #SC_FOLDLEVELHEADERFLAG
ScintillaSendMessage(id, #SCI_TOGGLEFOLD, startLine)
EndIf
EndSelect
Case #SCN_MODIFIED
If *scinotify\linesAdded
GOSCI_AutosizeLineNumberMarginXXX(id)
EndIf
Case #SCN_STYLENEEDED
startLine = ScintillaSendMessage(id, #SCI_LINEFROMPOSITION, ScintillaSendMessage(id, #SCI_GETENDSTYLED))
startPos = ScintillaSendMessage(id, #SCI_POSITIONFROMLINE, startLine)
endLine = ScintillaSendMessage(id, #SCI_LINEFROMPOSITION, *scinotify\position)
endLine = ScintillaSendMessage(id, #SCI_VISIBLEFROMDOCLINE, endLine)
GOSCI_RestyleLinesXXX(id, startLine, endLine, *scinotify\position)
Case #SCN_CHARADDED
nPos = ScintillaSendMessage(id, #SCI_GETCURRENTPOS)
txtr\chrg\cpMin = ScintillaSendMessage(id, #SCI_WORDSTARTPOSITION, nPos, 1)
txtr\chrg\cpMax = ScintillaSendMessage(id, #SCI_WORDENDPOSITION, nPos, 1)
If (txtr\chrg\cpMax - txtr\chrg\cpMin) >= *this\autocchar
txtr\lpstrText = AllocateMemory(txtr\chrg\cpMax - txtr\chrg\cpMin + 1)
ScintillaSendMessage(id, #SCI_GETTEXTRANGE, #Null, txtr)
sWord = PeekS(txtr\lpstrText, -1, #PB_UTF8)
FreeMemory(txtr\lpstrText)
If sWord
ForEach gGOSCI_Apis()
If LCase(sWord) = LCase(Mid(gGOSCI_Apis()\fname$, 1, Len(sWord))) And gGOSCI_Apis()\id = id
sFunc = gGOSCI_Apis()\fname$
If sFunc
sFunc2 + sFunc + " "
EndIf
EndIf
Next
sFunc = RTrim(sFunc2)
If sFunc
If ScintillaSendMessage(id, #SCI_AUTOCACTIVE)
ScintillaSendMessage(id, #SCI_AUTOCCANCEL)
EndIf
ScintillaSendMessage(id, #SCI_AUTOCSETIGNORECASE, #True)
ScintillaSendMessage(id, #SCI_AUTOCSHOW, Len(sWord), @sFunc)
Else
If ScintillaSendMessage(id, #SCI_AUTOCACTIVE)
ScintillaSendMessage(id, #SCI_AUTOCCANCEL)
EndIf
EndIf
EndIf
EndIf
Select *scinotify\ch
Case 10 ; Enter for Automaticaly Indention
If *this\indention
ScintillaSendMessage(id, #SCI_BEGINUNDOACTION)
nPos = ScintillaSendMessage(id, #SCI_GETCURRENTPOS)
nLine = ScintillaSendMessage(id, #SCI_LINEFROMPOSITION, nPos) - 1
nLineIndentation = ScintillaSendMessage(id, #SCI_GETLINEINDENTATION, nLine)
If nLineIndentation
ScintillaSendMessage(id, #SCI_SETLINEINDENTATION, nLine + 1, nLineIndentation)
nNewPos = ScintillaSendMessage(id, #SCI_GETLINEINDENTPOSITION, nLine + 1)
ScintillaSendMessage(id, #SCI_GOTOPOS, nNewPos)
EndIf
ScintillaSendMessage(id, #SCI_ENDUNDOACTION)
EndIf
Case 40 ; "(" start comment calltip
nPos = ScintillaSendMessage(id, #SCI_GETCURRENTPOS) - 1
txtr\chrg\cpMin = ScintillaSendMessage(id, #SCI_WORDSTARTPOSITION, nPos, 1)
txtr\chrg\cpMax = ScintillaSendMessage(id, #SCI_WORDENDPOSITION, nPos, 1)
txtr\lpstrText = AllocateMemory(txtr\chrg\cpMax - txtr\chrg\cpMin + 1)
ScintillaSendMessage(id, #SCI_GETTEXTRANGE, #Null, txtr)
sWord = PeekS(txtr\lpstrText, -1, #PB_UTF8)
FreeMemory(txtr\lpstrText)
If FindMapElement(gGOSCI_Apis(), sWord) And gGOSCI_Apis()\id = id
sFunc = gGOSCI_Apis()\fname$ + gGOSCI_Apis()\args$ + #CRLF$ + gGOSCI_Apis()\sDecs$
ScintillaSendMessage(id, #SCI_CALLTIPSHOW, nPos + 1, @sFunc)
EndIf
Case 41 ; ")" end comment calltip
ScintillaSendMessage(id, #SCI_CALLTIPCANCEL)
EndSelect
EndSelect
;Call the user's Scintilla callback.
If *this And *this\callback
*this\callback(id, *scinotify)
EndIf
EndProcedure
Code: Select all
Structure _GoScintilla
;Creation fields.
id.i
callback.GOSCI_proto_Callback
flags.i
state.i
;Custom line styling function.
stylingFunction.GOSCI_proto_StyleLine
;Additional user-supplied data.
userData.i
lineNumberAutoSizePadding.i
lexerSeparators$
lexerNumbersStyleIndex.i
;Code folding.
blnLineCodeFoldOption.i ;0 = no code folding, 1 = open fold, 2 = close fold.
foldLevel.i
;Styling.
previouslyRecordedStyle.i ;Used for left delimiters (separators).
*bytePointer.i ;Used for left delimiters (separators).
;Miscellaneous.
blnEmptyLineAdded.i
;Indention
indention.b
;AutoC Character
autocchar.b
EndStructure
Code: Select all
;/////////////////////////////////////////////////////////////////////////////////
;The following function creates a Scintilla gadget within the current gadget list and initialises it as appropriate.
;Returns either a gadget# or hWnd as per usual.
Procedure GOSCI_Free(id)
Protected *this._GoScintilla
;Remove all appropriate elements from the global keyword map.
ForEach gGOSCI_Keywords()
If gGOSCI_Keywords()\id = id
DeleteMapElement(gGOSCI_Keywords())
EndIf
Next
ForEach gGOSCI_Apis()
If gGOSCI_Apis()\id = id
DeleteMapElement(gGOSCI_Apis())
EndIf
Next
If IsGadget(id) And GadgetType(id) = #PB_GadgetType_Scintilla
*this = GetGadgetData(id)
If *this
;Free structured strings.
GOSCI_FreeStructureStringXXX(@*this\lexerSeparators$)
FreeMemory(*this)
EndIf
FreeGadget(id)
EndIf
EndProcedure
;/////////////////////////////////////////////////////////////////////////////////
Code: Select all
;/////////////////////////////////////////////////////////////////////////////////
;The following function sets the the AutoIndention is true or false.
;No return value.
Procedure GOSCI_AutoIndention(id, value.b)
Protected *this._GoScintilla
If IsGadget(id) And GadgetType(id) = #PB_GadgetType_Scintilla
*this = GetGadgetData(id)
If *this
*this\indention = value
EndIf
EndIf
EndProcedure
;/////////////////////////////////////////////////////////////////////////////////
;/////////////////////////////////////////////////////////////////////////////////
;The following function set how character needed to show AutoC
;No return value.
Procedure GOSCI_AutoCCharacter(id, value.b)
Protected *this._GoScintilla
If IsGadget(id) And GadgetType(id) = #PB_GadgetType_Scintilla
*this = GetGadgetData(id)
If *this
*this\autocchar = value
EndIf
EndIf
EndProcedure
;/////////////////////////////////////////////////////////////////////////////////
;/////////////////////////////////////////////////////////////////////////////////
;The following function records a list of keywords to use with AutoC. The list of words are to be separated by space characters.
;Note that only Ascii characters must be used within each keyword.
;Duplicates are simply replaced.
;For adding command just seprate them with a space and leave to last parameter alone
;For adding procedures use sArgs for arguments of that procedure and sDecs for Description
Procedure GOSCI_AddAutoC(id, sFunc$, sArgs$ = "", sDesc$ = "")
Protected spacecount
If IsGadget(id) And GadgetType(id) = #PB_GadgetType_Scintilla
spacecount = CountString(sFunc$, " ")
If spacecount
For i = 1 To spacecount + 1
If AddMapElement(gGOSCI_Apis(), StringField(sFunc$, i, " "))
gGOSCI_Apis()\id = id
gGOSCI_Apis()\fname$ = StringField(sFunc$, i, " ")
gGOSCI_Apis()\args$ = sArgs$
gGOSCI_Apis()\sDecs$ = sDesc$
EndIf
Next
Else
If AddMapElement(gGOSCI_Apis(), sFunc$)
gGOSCI_Apis()\id = id
gGOSCI_Apis()\fname$ = sFunc$
gGOSCI_Apis()\args$ = sArgs$
gGOSCI_Apis()\sDecs$ = sDesc$
EndIf
EndIf
EndIf
EndProcedure
;/////////////////////////////////////////////////////////////////////////////////
Code: Select all
IncludePath "..\..\"
XIncludeFile "GoScintilla.pbi"
;Initialise the Scintilla library for Windows.
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
InitScintilla()
CompilerEndIf
If OpenWindow(0, 100, 200, 600, 600, "GoScintilla demo!(Edited By Peyman)", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
RemoveKeyboardShortcut(0, #PB_Shortcut_Tab) ;Required for the tab key to function correctly when the Scintilla control has the focus.
;Create our Scintilla control. Note that we do not specify a callback; this is optional for GoSctintilla.
GOSCI_Create(1, 10, 10, 580, 580, 0, #GOSCI_AUTOSIZELINENUMBERSMARGIN|#GOSCI_ALLOWCODEFOLDING)
;Set the padding added to the width of the line-number margin.
GOSCI_SetAttribute(1, #GOSCI_LINENUMBERAUTOSIZEPADDING, 10)
;Set folding symbols margin width.
GOSCI_SetMarginWidth(1, #GOSCI_MARGINFOLDINGSYMBOLS, 24)
;Set the back color of the line containing the caret.
GOSCI_SetColor(1, #GOSCI_CARETLINEBACKCOLOR, $B4FFFF)
;Set font.
GOSCI_SetFont(1, "Courier New", 10)
;Set tabs. Here we use a 'hard' tab in which a tab character is physically inserted. Set the 3rd (optional) parameter to 1 to use soft-tabs.
GOSCI_SetTabs(1, 2)
;Set styles for our syntax highlighting.
;=======================================
;First define some constants to identify our various styles.
;You can name these as we wish.
Enumeration
#STYLES_COMMANDS = 1
#STYLES_COMMENTS
#STYLES_LITERALSTRINGS
#STYLES_NUMBERS
#STYLES_CONSTANTS
#STYLES_FUNCTIONS
EndEnumeration
;Set individual styles for commands.
GOSCI_SetStyleFont(1, #STYLES_COMMANDS, "", -1, #PB_Font_Bold)
GOSCI_SetStyleColors(1, #STYLES_COMMANDS, $800000) ;We have omitted the optional back color.
;Set individual styles for comments.
GOSCI_SetStyleFont(1, #STYLES_COMMENTS, "", -1, #PB_Font_Italic)
GOSCI_SetStyleColors(1, #STYLES_COMMENTS, $006400) ;We have omitted the optional back color.
;Set individual styles for literal strings.
GOSCI_SetStyleColors(1, #STYLES_LITERALSTRINGS, #Gray) ;We have omitted the optional back color.
;Set individual styles for numbers.
GOSCI_SetStyleColors(1, #STYLES_NUMBERS, #Red) ;We have omitted the optional back color.
;Set individual styles for constants.
GOSCI_SetStyleColors(1, #STYLES_CONSTANTS, $2193DE) ;We have omitted the optional back color.
;Set individual styles for functions.
GOSCI_SetStyleColors(1, #STYLES_FUNCTIONS, #Blue) ;We have omitted the optional back color.
;Set keywords for our syntax highlighting.
;=========================================
;First some commands.
GOSCI_AddKeywords(1, "If End Endif While Wend Repeat Until For To Next ForEach ForEver Break Return Procedure ProcedureReturn Macro Debug", #STYLES_COMMANDS)
GOSCI_AddKeywords(1, "Protected Shared Global Goto NewMap NewList Dim List Map Array Static ProcedureC ProcedureCDLL ProcedureDLL EndMacro", #STYLES_COMMANDS)
;Now set up a ; symbol to denote a comment. Note the use of #GOSCI_DELIMITTOENDOFLINE.
;Note also that this symbol will act as an additional separator.
GOSCI_AddKeywords(1, ";", #STYLES_COMMENTS, #GOSCI_DELIMITTOENDOFLINE)
;Now set up quotes to denote literal strings.
;We do this by passing the beginning and end delimiting characters; in this case both are quotation marks. Note the use of #GOSCI_DELIMITBETWEEN.
;Note also that a quote will subsequently act as an additional separator.
GOSCI_AddKeywords(1, Chr(34) + Chr(34), #STYLES_LITERALSTRINGS, #GOSCI_DELIMITBETWEEN)
;Now set up a # symbol to denote a constant. Note the use of #GOSCI_LEFTDELIMITWITHOUTWHITESPACE.
GOSCI_AddKeywords(1, "#", #STYLES_CONSTANTS, #GOSCI_LEFTDELIMITWITHOUTWHITESPACE)
;Now set up a ( symbol to denote a function. Note the use of #GOSCI_RIGHTDELIMITWITHWHITESPACE.
GOSCI_AddKeywords(1, "(", #STYLES_FUNCTIONS, #GOSCI_RIGHTDELIMITWITHWHITESPACE)
;We arrange for a ) symbol to match the coloring of the ( symbol.
GOSCI_AddKeywords(1, ")", #STYLES_FUNCTIONS)
;Add some folding keywords.
GOSCI_AddKeywords(1, "Procedure Macro", #STYLES_COMMANDS, #GOSCI_OPENFOLDKEYWORD|#GOSCI_DELIMITNONE)
GOSCI_AddKeywords(1, "EndProcedure EndMacro", #STYLES_COMMANDS, #GOSCI_CLOSEFOLDKEYWORD|#GOSCI_DELIMITNONE)
;Register ProgramFilename and Str procedure with its details and parameters for AutoC
GOSCI_AddAutoC(1, "ProgramFilename", "()", "Get the full path and filename of executable of this program.")
GOSCI_AddAutoC(1, "Str", "(Value)", "Convert a signed integer number into a string.")
;Register all purebasic command for AutoC
GOSCI_AddAutoC(1, "If End Endif While Wend Repeat Until For To Next ForEach ForEver Break Return Procedure ProcedureReturn EndProcedure")
GOSCI_AddAutoC(1, "Protected Shared Global Goto NewMap NewList Dim List Map Array Static ProcedureC ProcedureCDLL ProcedureDLL")
;I want AutoIndention so set it true for better codin.
GOSCI_AutoIndention(1, #True)
;I want after 2 character AutoC show me suggestions
GOSCI_AutoCCharacter(1, 2)
;Additional lexer options.
;=========================
;The lexer needs to know what separator characters we are using.
GOSCI_SetLexerOption(1, #GOSCI_LEXEROPTION_SEPARATORSYMBOLS, @"=+-*/%()[],.") ;You would use GOSCI_AddKeywords() to set a style for some of these if required.
;We can also set a style for numbers.
GOSCI_SetLexerOption(1, #GOSCI_LEXEROPTION_NUMBERSSTYLEINDEX, #STYLES_NUMBERS)
;Set some initial text.
;======================
text$ = "; GoScintilla." + #CRLF$
text$ + "; By Stephen Rodriguez." + #CRLF$
text$ + "; AutoC & AutoIndention By Peyman." + #CRLF$ + #CRLF$
text$ + "; Please write this syntax to see AutoC : Str(50)" + #CRLF$ + #CRLF$
GOSCI_SetText(1, text$)
SetActiveGadget(1)
GOSCI_GotoLine(1, 7)
Repeat
eventID = WaitWindowEvent()
Select eventID
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
Until eventID = #PB_Event_CloseWindow
;Free the Scintilla gadget.
;This needs explicitly calling in order to free resources used by GoScintilla.
GOSCI_Free(1)
EndIf
Quote from the Scintilla documentation...Justin wrote:Hi srod, have you noticed that if you press ctrl+s, ctrl+f, ctrl+g strange symbols appear?
By default, Scintilla displays control characters (characters with codes less than 32) in a rounded rectangle as ASCII mnemonics: "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US". These mnemonics come from the early days of signaling, though some are still used (LF = Line Feed, BS = Back Space, CR = Carriage Return, for example).
Code: Select all
case #WM_CHAR
if wParam<32
procedurereturn 0
else
procedurereturn CallWindowProc_(oldProc, hwnd, msg, wParam, lParam)
endif