GoScintilla - 2.7 (Purebasic 4.5 onwards)

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: GoScintilla - 2.2 (Purebasic 4.5 only)

Post 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
;/////////////////////////////////////////////////////////////////////////////////
User avatar
dobro
Enthusiast
Enthusiast
Posts: 766
Joined: Sun Oct 31, 2004 10:54 am
Location: France
Contact:

Re: GoScintilla - 2.2 (Purebasic 4.5 only)

Post by dobro »

Thanks :)

Turbo for my EPB editor :D
Image
Windows 98/7/10 - PB 5.42
■ sites : http://michel.dobro.free.fr/
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: GoScintilla - 2.2 (Purebasic 4.5 only)

Post 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.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: GoScintilla - 2.2 (Purebasic 4.5 only)

Post 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.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: GoScintilla - 2.4 (Purebasic 4.5 onwards)

Post 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.
I may look like a mule, but I'm not a complete ass.
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

Re: GoScintilla - 2.4 (Purebasic 4.5 onwards)

Post 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
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: GoScintilla - 2.4 (Purebasic 4.5 onwards)

Post by srod »

Nope.

:)

Works fine here on Windows.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Post 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.
I may look like a mule, but I'm not a complete ass.
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Post 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
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Post 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.
I may look like a mule, but I'm not a complete ass.
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Post 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
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Post 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 :-|
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Post 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.
I may look like a mule, but I'm not a complete ass.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Post 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.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: GoScintilla - 2.5 (Purebasic 4.5 onwards)

Post 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?
Post Reply