It is currently Thu Oct 29, 2020 11:09 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 290 posts ]  Go to page Previous  1 ... 15, 16, 17, 18, 19, 20  Next
Author Message
 Post subject: Re: GoScintilla - 2.6 (Purebasic 4.5 onwards)
PostPosted: Mon Jul 02, 2012 12:22 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5756
Location: Berlin - Germany
Here my simple search version without regex:
Code:
Procedure GoSCI_Search(id, search.s, direction, flags)
  Protected *mem, pos, result
  Protected selstart, selend

  If search
    *mem = AllocateMemory(StringByteLength(search, #PB_UTF8) + 1)
    If *mem
      PokeS(*mem, search, -1, #PB_UTF8)
     
      If direction = 0
        pos = ScintillaSendMessage(id, #SCI_GETSELECTIONSTART) - 1
      Else
        pos = ScintillaSendMessage(id, #SCI_GETSELECTIONEND) + 1
      EndIf
      ScintillaSendMessage(id, #SCI_SETSEL, pos, pos)
      ScintillaSendMessage(id, #SCI_SEARCHANCHOR)
      If direction
        result = ScintillaSendMessage(id, #SCI_SEARCHNEXT, flags, *mem)
      Else
        result = ScintillaSendMessage(id, #SCI_SEARCHPREV, flags, *mem)
      EndIf
      If result <> -1
        selstart = ScintillaSendMessage(id, #SCI_GETSELECTIONSTART)
        selend = ScintillaSendMessage(id, #SCI_GETSELECTIONEND)
        GOSCI_SetState(id, #GOSCI_CURRENTLINE, ScintillaSendMessage(id, #SCI_LINEFROMPOSITION, result))
        ScintillaSendMessage(id, #SCI_SETSELECTIONSTART, selstart)
        ScintillaSendMessage(id, #SCI_SETSELECTIONEND, selend)
        ScintillaSendMessage(id, #SCI_SCROLLCARET)
      EndIf
      FreeMemory(*mem)
    EndIf
   
    ProcedureReturn result
  EndIf

EndProcedure

_________________
PureBasic 5.71 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 19.3 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.6 (Purebasic 4.5 onwards)
PostPosted: Mon Jul 02, 2012 2:10 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10589
Location: Beyond the pale...
The problem with that method Thomas is that the control can be scrolled even when no match is found because you are using the #SCI_SETSEL message regardless.

You're best off, inmo, using a targeted search.

Here's my version which I will add to the next update of GoScintilla.

Code:
Procedure GOSCI_Search(id, search.s, direction=#GOSCI_SEARCHFORWARDS, flags=0)
  Protected result, *mem, pos, numBytes, byteLen
  Protected selstart, selend
  If IsGadget(id) And GadgetType(id) = #PB_GadgetType_Scintilla And search
    numBytes = ScintillaSendMessage(id, #SCI_GETLENGTH)
    If numBytes
      byteLen = StringByteLength(search, #PB_UTF8)
      *mem = AllocateMemory(byteLen+1)
      If *mem
        PokeS(*mem, search, -1, #PB_UTF8)
        ScintillaSendMessage(id, #SCI_SETSEARCHFLAGS, flags)
        If direction = #GOSCI_SEARCHBACKWARDS
          pos = ScintillaSendMessage(id, #SCI_GETSELECTIONSTART)
          ScintillaSendMessage(id, #SCI_SETTARGETSTART, pos)
          ScintillaSendMessage(id, #SCI_SETTARGETEND, 0)
          result = ScintillaSendMessage(id, #SCI_SEARCHINTARGET, byteLen, *mem)
          If result <> -1
            ScintillaSendMessage(id, #SCI_SETSEL, ScintillaSendMessage(id, #SCI_GETTARGETSTART), ScintillaSendMessage(id, #SCI_GETTARGETEND))
          EndIf
        Else
          pos = ScintillaSendMessage(id, #SCI_GETSELECTIONEND)
          ScintillaSendMessage(id, #SCI_SETTARGETSTART, pos)
          ScintillaSendMessage(id, #SCI_SETTARGETEND, numBytes)
          result = ScintillaSendMessage(id, #SCI_SEARCHINTARGET, byteLen, *mem)
          If result <> -1
            ScintillaSendMessage(id, #SCI_SETSEL, ScintillaSendMessage(id, #SCI_GETTARGETSTART), ScintillaSendMessage(id, #SCI_GETTARGETEND))
          EndIf
        EndIf
        FreeMemory(*mem)
      EndIf
    EndIf
    ProcedureReturn result
  EndIf
EndProcedure


You will need to add the following to the header file :

Code:
;Search direction.
  Enumeration
    #GOSCI_SEARCHBACKWARDS
    #GOSCI_SEARCHFORWARDS
  EndEnumeration

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


Last edited by srod on Mon Jul 02, 2012 2:31 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.6 (Purebasic 4.5 onwards)
PostPosted: Mon Jul 02, 2012 2:27 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5756
Location: Berlin - Germany
Hello Stephen,
byteLen doesn't include place for the stringterminator, i think it is better to add a byte for this.
Have you made a test with purifier?

_________________
PureBasic 5.71 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 19.3 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.6 (Purebasic 4.5 onwards)
PostPosted: Mon Jul 02, 2012 2:29 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10589
Location: Beyond the pale...
The null terminator is not required for the #SCI_SEARCHINTARGET message. :wink:

**EDIT : ah yes, for the PokeS()!

I shall edit the code. Thanks.

Why would I run the purifier?

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


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.6 (Purebasic 4.5 onwards)
PostPosted: Mon Jul 02, 2012 2:36 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5756
Location: Berlin - Germany
srod wrote:
Why would I run the purifier?

The should say you, there is to small memory allocation for PokeS :wink:
I have not tested your code with purifier, i am to lazy to write a example,
but i test most time my allocations with purifier!

_________________
PureBasic 5.71 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 19.3 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.6 (Purebasic 4.5 onwards)
PostPosted: Mon Jul 02, 2012 3:23 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10589
Location: Beyond the pale...
Not required as I see it. The memory allocation is now correct.

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


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.6 (Purebasic 4.5 onwards)
PostPosted: Sat Aug 11, 2012 1:02 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10589
Location: Beyond the pale...
GoScintilla 2.7 - 11th Aug 2012

GoScintilla 2.7 adds a targeted search facility as well as a facility for highlighting error lines (typically those which generate compiler errors etc).

The history.txt file lists the detailed changes as of course does the .chm help manual.

In terms of error markers; GoScintilla can highlight any lines deemed to contain errors in much the same way that the PB IDE highlights lines which generate compiler errors.

Please note that error markers are implemented by means of a suitable Scintilla marker and share the same margin as GoScintilla bookmarks. For this reason, it is very important that you read the relevant parts of the GoScintilla user manual if using both bookmarks and error markers with the same document etc.

There is a demo showing the error markers in use.

Please see the nxSoftware site for the download.

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


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.6 (Purebasic 4.5 onwards)
PostPosted: Sat Aug 11, 2012 1:08 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5756
Location: Berlin - Germany
Image for the update

_________________
PureBasic 5.71 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 19.3 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
PostPosted: Sat Feb 23, 2013 5:45 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jun 01, 2003 10:55 pm
Posts: 206
Location: Austria, Vienna
Update to 5.10 final made GoSci not working anymore because of "disallow native type for pointers"... (because beginners were "confused" by this). I'm confused by this.

_________________
My PC
Ryzen 7 1700, 16 GB RAM, nVidia 1050 GT, Win 10
Bulldozer FX 6100 3.3 GHz, 8 GB DDR3 1600 RAM, nVidia 960 GT, Win7 x64
Athlon 5770, 8 GB RAM, nVidia 750 GT
intel Core Quad, Q8300, 4 GB RAM, nVidia GT 1050


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
PostPosted: Sat Feb 23, 2013 5:52 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10589
Location: Beyond the pale...
Just remove the .i or .q etc. from which ever statements cause the compiler to fail.

On beta 4 (haven't upgraded to the final version yet) I only had to alter 1 such line.

Change
Code:
*bytePointer.i
to
Code:
*bytePointer

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


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
PostPosted: Sun Feb 24, 2013 1:10 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jun 01, 2003 10:55 pm
Posts: 206
Location: Austria, Vienna
srod wrote:
Just remove the .i or .q etc. from which ever statements cause the compiler to fail.

On beta 4 (haven't upgraded to the final version yet) I only had to alter 1 such line.

Change
Code:
*bytePointer.i
to
Code:
*bytePointer

Thanks, this works now...

_________________
My PC
Ryzen 7 1700, 16 GB RAM, nVidia 1050 GT, Win 10
Bulldozer FX 6100 3.3 GHz, 8 GB DDR3 1600 RAM, nVidia 960 GT, Win7 x64
Athlon 5770, 8 GB RAM, nVidia 750 GT
intel Core Quad, Q8300, 4 GB RAM, nVidia GT 1050


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
PostPosted: Tue Mar 12, 2013 12:08 pm 
Offline
User
User
User avatar

Joined: Mon Sep 14, 2009 5:30 pm
Posts: 10
Location: . <------ ici
Hello,

Thank you for this superb LIB. 8)
I do not speak much English, but can change the background color?
Sorry if the question was already asked. :?


EDIT :
I found my answer :wink:
Code:
GOSCI_SetColor(id, #GOSCI_BACKCOLOR, Color)










@++

_________________
Windows 10 x64, PureBasic 5.71 Beta 1 x86 & x64


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
PostPosted: Sun Mar 24, 2013 8:51 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Dec 03, 2011 5:54 pm
Posts: 736
Location: Oldenburg (Germany)
Hi,

i wasn't able to change the line number back and fore colors. I wanted to change them to black background and white text color.
Example:
Code:
GOSCI_SetColor(1, #GOSCI_LINENUMBERBACKCOLOR, $000000)
GOSCI_SetColor(1, #GOSCI_LINENUMBERFORECOLOR, $FFFFFF)

This has no effect :-(
Any ideas?

Btw, line 40 and 41 of the header file seems to have a bug, the letter "O" is missing:
Code:
      #GSCI_CALLTIPBACKCOLOR              ;Get/Set.
      #GSCI_CALLTIPFORECOLOR              ;Get/Set.

Best regards
Uwe

_________________
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
PostPosted: Sun Mar 24, 2013 9:11 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10589
Location: Beyond the pale...
GOSCI_SetFont() and GOSCI_SETCOLOR() with #GOSCI_BACKCOLOR or #GOSCI_FORECOLOR resets the various styles.

Hence, you should place all line-number color changes after any of these statements.

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


Top
 Profile  
Reply with quote  
 Post subject: Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
PostPosted: Sun Mar 24, 2013 10:09 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Dec 03, 2011 5:54 pm
Posts: 736
Location: Oldenburg (Germany)
srod wrote:
GOSCI_SetFont() ... resets the various styles.

That's it :-)
Thx a lot, srod!

_________________
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 290 posts ]  Go to page Previous  1 ... 15, 16, 17, 18, 19, 20  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 21 guests


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