It is currently Wed Jun 19, 2013 6:39 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 273 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 19  Next
Author Message
 Post subject: Re: GoScintilla (PB 4.4 only)
PostPosted: Fri Nov 27, 2009 3:40 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9859
Location: Beyond the pale...
Version 1.0 beta 2 - 27th November 2009

Having just integrated GoScintilla into an existing project, I found myself making the following changes ;

  • Fixed a bug with GOSCI_Create() (it wasn't returning any value!)

  • Added function : GOSCI_ReplaceSelectedText(id, text$, blnScrollCaretIntoView=#False).

  • Modified the GOSCI_SetText() function by the addition of an optional parameter; clearUndoStack (default #False).
    Set to non-zero to have the undo stack cleared so that this operation cannot be undone.

  • Added a new get/set attribute : #GOSCI_WRAPLINES. Turn wrapping lines on/off.

  • Added a new get/set attribute : #GOSCI_WRAPLINESVISUALMARKER. Give wrapped lines a visual marker.

  • By default, all delimiter characters are also regarded as separators. This can now be over-ruled when adding delimiter keywords by using the new #GOSCI_NONSEPARATINGDELIMITER flag.

    This was added to allow one type of delimiter to be styled as part of another delimiter.

    E.g. imagine the situation with Purebasic syntax in which we may opt to declare both the # and $ symbols as delimiters in order to style constants and string variables appropriately.

    What happens then with the symbol #StringConstant$ ?

    The first version of GoScintilla would apply one style to #StringConstant and another style to $ !

    By making the $ symbol a non-separating delimiter, however, #StringConstant$ would now be styled correctly as befitting a constant.


Please see the nxSoftware site for the download.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)
PostPosted: Sat Nov 28, 2009 2:23 pm 
Offline
Addict
Addict
User avatar

Joined: Mon May 26, 2003 3:07 pm
Posts: 1146
Location: Nantes
nice job
Your lib makes Scintilla really simple to code.


here is my first contribution (an minor addon for your PB lexer example)
Code:
   ;Additional lexer options for pointer.
   ;=====================================
   Enumeration #PB_Compiler_EnumerationValue
      #STYLES_POINTER
   EndEnumeration
   ;Set individual styles for pointers.
   GOSCI_SetStyleColors(1, #STYLES_POINTER, #Cyan)  ;We have omitted the optional back color.   
   ;Now set up a * symbol to denote a pointer. Note the use of #GOSCI_LEFTDELIMITWITHOUTWHITESPACE.
   GOSCI_AddKeywords(1, "*", #STYLES_POINTER, #GOSCI_LEFTDELIMITWITHOUTWHITESPACE)
   ;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.

_________________
Image
XP x86 4.40b3 » ToolbarPlus | SplitterGadgetPlus | Requester Position | CustomTooltip


Last edited by eddy on Sat Nov 28, 2009 6:06 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)
PostPosted: Sat Nov 28, 2009 3:33 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jun 30, 2006 4:30 pm
Posts: 567
Location: NDIA Project
Thanks srod!

_________________

[Registered PB User since 2006]
[PureBasic 4.51 Final] [Win 7 32bit]
[Intel Core 2 Duo 1.6 Ghz] [2GB DDR2] [8400]


Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)
PostPosted: Sat Nov 28, 2009 3:54 pm 
Offline
Addict
Addict
User avatar

Joined: Mon May 26, 2003 3:07 pm
Posts: 1146
Location: Nantes
Second contribution ;)
- append / prepend text mode for GOSCI_SetText()

Code:
   ;General function options.
   ;Use with GOSCI_SetText()
   Enumeration 0
      #GOSCI_TEXT_RELOAD ; Replace the current text
      #GOSCI_TEXT_RELOAD_CLEARUNDOSTACK ; Replace the current text and clear undo stack
      #GOSCI_TEXT_APPEND ; Add text at the end of current text
      #GOSCI_TEXT_PREPEND ; Insert text before the beginning of current text
   EndEnumeration
   
   ;/////////////////////////////////////////////////////////////////////////////////
   ;The following function sets the text for the entire control.
   ;No return value.
   Procedure GOSCI_SetText(id, text$, mode=#GOSCI_TEXT_RELOAD)
      Protected utf8Buffer
      If IsGadget(id) And GadgetType(id)=#PB_GadgetType_Scintilla
         ;Need to convert to utf-8 first.
         utf8Buffer=AllocateMemory(StringByteLength(text$, #PB_UTF8)+1)
         If utf8Buffer
            PokeS(utf8Buffer, text$, -1, #PB_UTF8)
            Select mode
               Case #GOSCI_TEXT_APPEND
                  ScintillaSendMessage(id, #SCI_APPENDTEXT, MemorySize(utf8Buffer)-1, utf8Buffer)
               Case #GOSCI_TEXT_PREPEND
                  ScintillaSendMessage(id, #SCI_INSERTTEXT, 0, utf8Buffer)
               Case #GOSCI_TEXT_RELOAD, #GOSCI_TEXT_RELOAD_CLEARUNDOSTACK
                  ScintillaSendMessage(id, #SCI_SETTEXT, 0, utf8Buffer)
                  If #GOSCI_TEXT_RELOAD_CLEARUNDOSTACK
                     ScintillaSendMessage(id, #SCI_EMPTYUNDOBUFFER)
                  EndIf
            EndSelect
            FreeMemory(utf8Buffer)
         EndIf
      EndIf
   EndProcedure
   ;/////////////////////////////////////////////////////////////////////////////////


Here is a code sample :
Code:
   ;you have to active 'CREATE UNICODE EXECUTABLE' options
   CompilerIf #PB_Compiler_Unicode
      GOSCI_SetText(1, "ă prepended text", #GOSCI_TEXT_PREPEND)
      GOSCI_SetText(1, "ă appended text", #GOSCI_TEXT_APPEND)
   CompilerEndIf

_________________
Image
XP x86 4.40b3 » ToolbarPlus | SplitterGadgetPlus | Requester Position | CustomTooltip


Last edited by eddy on Sat Nov 28, 2009 7:15 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)
PostPosted: Sat Nov 28, 2009 4:07 pm 
Offline
Addict
Addict
User avatar

Joined: Mon May 26, 2003 3:07 pm
Posts: 1146
Location: Nantes
I didn't found this new function : GOSCI_ReplaceSelectedText() and the new flag of GOSCI_SetText().
The download link is not up-to-date :roll:

Where can we download the beta 2 ?

_________________
Image
XP x86 4.40b3 » ToolbarPlus | SplitterGadgetPlus | Requester Position | CustomTooltip


Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)
PostPosted: Sun Nov 29, 2009 12:06 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9859
Location: Beyond the pale...
Sorry, I uploaded beta 2 with the wrong filename which is why you could not access it.

I have uploaded beta 3 now which has a couple of extra functions thrown in : GOSCI_GetLexerState() and GOSCI_SetLexerState(). Please see the manual for details.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)
PostPosted: Sun Nov 29, 2009 5:22 am 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 2704
Wewt! With source code to boot. Thanks for this, srod. :D

_________________
Image


Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)
PostPosted: Sun Nov 29, 2009 7:05 am 
Offline
Addict
Addict
User avatar

Joined: Tue Apr 29, 2003 9:18 pm
Posts: 1115
Location: North by Northwest
How can folding keywords be done when the "open folding" keyword is also part of the "close folding" keyword like:

Code:
Function
...
End Function


As you can see there is a white space between the 2 "close folding" keywords...


Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)
PostPosted: Sun Nov 29, 2009 12:43 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9859
Location: Beyond the pale...
You can't. GoScintilla's Lexer will of course not suit every need. When dealing with code-folding it is primed only to recognise single word keywords and so it will not recognise End Function as being a close-fold terminal symbol.

You will have to utilise a user-defined line-styling function for this; although the truth is that I haven't really made GoScintilla's code-folding logic available to such functions (just the syntax styling parts). I'll have to give this some thought when I have a spare moment or two.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)
PostPosted: Mon Nov 30, 2009 7:55 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4740
Location: Berlin - Germany
My wish for christmas:
1. autocomplete feature
2. case correction

greetings
Thomas


Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)
PostPosted: Mon Nov 30, 2009 10:18 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9859
Location: Beyond the pale...
ts-soft wrote:
My wish for christmas:
1. autocomplete feature
2. case correction

greetings
Thomas


New features will be added Thomas only as I require them. I shall add the functionality requested by fsw later today. As for the rest, well, I shall eventually be using GoSctintilla as part of an IDE and that will probably require me to add all kinds of things. :)

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)
PostPosted: Mon Nov 30, 2009 12:20 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 2704
If you an figure out how to incorporate C/C++ and Java code completion I will gladly pay for it. Though it might be a bit over your head. It's well over mine.

_________________
Image


Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)
PostPosted: Mon Nov 30, 2009 6:38 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9859
Location: Beyond the pale...
At five feet four inches, most things are over my head! :wink:

Code completion is not something that interests me at this time.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)
PostPosted: Mon Nov 30, 2009 8:44 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9859
Location: Beyond the pale...
Version 1.0 beta 4 - 30th November 2009

This update has been motivated by a desire to allow for automatic code folding of multi-word keywords such as "Function" and "End Function" etc.
GoScintilla's lexer will only work with single word keywords and thus cannot natively support combinations such as "End Function" as representing a close-fold terminal.

Extending GoScintilla's lexer to allow this is not an option as it will slow things down (in my judgement) too much. Instead, we can make use of a user-defined line styling function to supplement the lexer's capabilities.

  • Added functions : GOSCI_DecFoldLevel(id) and GOSCI_IncFoldLevel(id) to be used within a user-defined line styling function only.
  • Added an additional demo program "Multiword" to demonstrate how to use a very simple user-defined line styling function together with the new functions to implement code folding on the aforementioned "Function" and "End Function" etc.

Please see the nxSoftware site for the download.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject: Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)
PostPosted: Tue Dec 01, 2009 4:04 am 
Offline
Addict
Addict
User avatar

Joined: Tue Apr 29, 2003 9:18 pm
Posts: 1115
Location: North by Northwest
srod wrote:
I shall add the functionality requested by fsw later today.

Thank you srod, works fine for the intended purpose :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 273 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 19  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye