Page 16 of 20

Re: GoScintilla - 2.2 (Purebasic 4.5 only)

Posted: Mon Apr 09, 2012 3:44 pm
by Tenaja
I made this slight change to AddKeywords to speed it up when changing styling. It could probably be applied to all procs that call RestyleLines. It is backwards compatible.
(See the argument restyle.i = #True and the test for it when calling RestyleLinesXXX).

Code: Select all

;/////////////////////////////////////////////////////////////////////////////////
;The following function records a list of keywords to use the style specified. 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.
;Set keywordFlags to one (or more) of the keyword flags #GOSCI_OPENFOLDKEYWORD, #GOSCI_CLOSEFOLDKEYWORD or GOSCI_ADDTOCODECOMPLETION ... etc.
Procedure GOSCI_AddKeywords(id, keyWords$, styleIndex=#STYLE_DEFAULT, keywordflags=0, blnSortKeywords=#False, restyle.i = #True)
  Protected *this._GoScintilla, t1
  If GOSCI_AddKeywordsXXX(id, keyWords$, styleIndex, keywordFlags)
    *this = GetGadgetData(id)
    If *this
      If blnSortKeywords
        If *this\flags & #GOSCI_KEYWORDSCASESENSITIVE = 0
          t1 = #PB_Sort_NoCase 
        EndIf
        SortStructuredList(*this\Keywords(), #PB_Sort_Ascending|t1, OffsetOf(GoScintillaKeyword\keyWord$), #PB_Sort_String)
      EndIf
    EndIf
  	If restyle = #True
  		GOSCI_RestyleLinesXXX(ID, 0, -1)
  	EndIf
  EndIf
EndProcedure
;/////////////////////////////////////////////////////////////////////////////////

Re: GoScintilla - 2.2 (Purebasic 4.5 only)

Posted: Mon Apr 09, 2012 5:59 pm
by dobro
Thanks :)

Turbo for my EPB editor :D

Re: GoScintilla - 2.2 (Purebasic 4.5 only)

Posted: Fri Apr 20, 2012 6:33 pm
by srod
User-defined line styling function! :wink:

One of the advanced demos should get you started.

Afraid I've no time to hack up some code for you right now.

Re: GoScintilla - 2.2 (Purebasic 4.5 only)

Posted: Fri Apr 20, 2012 8:23 pm
by srod
Ah, I would guess that JaPBe uses a marker for this (you can use markers to change the back color of individual lines). It is quite easy to do, but you will need to dip into the Scintilla API to define the marker and then add the marker to and remove the marker from lines as and when required.

Re: GoScintilla - 2.4 (Purebasic 4.5 onwards)

Posted: Thu May 03, 2012 7:05 pm
by srod
GoScintilla 2.4 - 3rd May 2012

GoScintilla 2.4 fixes a massive bug with code folding.

Please see the nxSoftware site for the download.

Re: GoScintilla - 2.4 (Purebasic 4.5 onwards)

Posted: Sat May 05, 2012 9:48 am
by uwekel
Hi,

i just tried out this library and it works fine, except of that i am not able to change the style font. When i do this

Code: Select all

GOSCI_SetFont(1, "Monospace", 11)
all text is italic, but the font face has not changed. I am on Fedora 16 64-bit. Any ideas?

Uwe

Re: GoScintilla - 2.4 (Purebasic 4.5 onwards)

Posted: Sat May 05, 2012 10:11 am
by srod
Nope.

:)

Works fine here on Windows.

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Posted: Sat May 05, 2012 10:50 am
by srod
GoScintilla 2.5 - 5th May 2012

GoScintilla 2.5 adds an optional parameter (restyle = #True) to certain functions which can be used to stop GoScintilla redrawing a control's contents whilst we set/reset individual style parameters. Useful if you are altering styles after loading text into a control, otherwise every single alteration will result in the entire document being restyled which can result in some serious delays if there is a lot of text loaded into the control.

You can of course use the GOSCI_SetState() function to restyle the entire document when you are done making alterations.

No existing code will be broken by these changes.

The help manual has been updated.

Thanks to Tenaja.

Please see the nxSoftware site for the download.

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Posted: Sun May 06, 2012 7:22 pm
by uwekel
Hi,

in your example codes you use the line

Code: Select all

IncludePath "..\..\"
which is not compatible with Linux. If you use the normal slash, the code works with Linux and Windows as well!

Code: Select all

IncludePath "../../"
Best regards
Uwe

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Posted: Sun May 06, 2012 7:26 pm
by srod
Yes good point. I have been endeavoring to do just that with my latest work; have overlooked GoScintilla it would seem. :)

Thanks. I will change that.

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Posted: Wed May 09, 2012 9:18 pm
by uwekel
Hi,
is there a way to auto-correct capitalisation of registered keywords,. e.g. if they were typed in lower case only?
Best regards
Uwe

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Posted: Wed May 09, 2012 9:25 pm
by uwekel
Hi again, just forgot to say: Your example codes are better for Linux users if you do something like this:

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  GOSCI_SetFont(1, "Courier New", 10)
CompilerElse
  GOSCI_SetFont(1, "!Monospace", 10)
CompilerEndIf
Otherwise all fonts are styled italic. This is the behavior if a fontname is not known :-|

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Posted: Wed May 09, 2012 10:10 pm
by srod
uwekel wrote:Hi,
is there a way to auto-correct capitalisation of registered keywords,. e.g. if they were typed in lower case only?
Best regards
Uwe
Not easily no. It would need a bit of work before GoScintilla could be made to support that feature.

It might well be something I could use myself however and so may well get around to adding that.

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Posted: Wed Jun 13, 2012 1:44 am
by Tenaja
I am using GoScintilla for some custom lexering ( :D ) and I thought it would be nice to be able to add the ability to also edit "other" files, since Scintilla has so many lexers built in.

I have successfully gotten the other lexers to work on their own. I pasted that code into my large editor file, and the text just goes plain, with no colors at all. I am wondering what is missing? Do I need to remove the Gosci callback?

Has anybody gotten Scintilla to work, switching back/forth from Gosci to Scintilla's lexers?

Thanks.

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Posted: Wed Jun 13, 2012 5:27 pm
by Tenaja
Tenaja wrote:I am using GoScintilla for some custom lexering ( :D ) and I thought it would be nice to be able to add the ability to also edit "other" files, since Scintilla has so many lexers built in.

I have successfully gotten the other lexers to work on their own. I pasted that code into my large editor file, and the text just goes plain, with no colors at all. I am wondering what is missing? Do I need to remove the Gosci callback?

Has anybody gotten Scintilla to work, switching back/forth from Gosci to Scintilla's lexers?
I have it isolated to the SetLexer command failing. In the simple sample, I use this, and see the debug values change as expected (0, then 3):

Code: Select all

;lex setup
Debug ScintillaSendMessage(#Scintilla, #SCI_GETLEXER)
ScintillaSendMessage(#Scintilla, #SCI_SETLEXER, #SCLEX_CPP, 0)
Debug ScintillaSendMessage(#Scintilla, #SCI_GETLEXER)
However, in the program that uses Gosci, both of those debug statements result in 0. Why would the Scintilla gadget fail to assign the lexer using the same code, after using Gosci?