IDE-Tool Addition: activate Long Line Edge

Working on new editor enhancements?
Axolotl
Addict
Addict
Posts: 837
Joined: Wed Dec 31, 2008 3:36 pm

IDE-Tool Addition: activate Long Line Edge

Post by Axolotl »

I like the Long Line Edge feature in NotepadX, Notepad++.
So I added this three lines to a small program (IDE-Tool)
BTW: I skipped the supporting lines in my counting.

Code: Select all

;|  Trigger: 
;|  · Sourcecode loaded
;|  · New Sourcecode created 
;|  
;|  Suggested Options: 
;|  · Wait until tool quits 
;|  · Run Hidden 
;|  · Hide Tool from the Main menu 

Define hScintilla = Val(GetEnvironmentVariable("PB_TOOL_Scintilla")) 
If Not hScintilla  ; if not running by IDE 
    MessageRequester("Fatal Error", "Failed to retrieve PB_TOOL_Scintilla", #PB_MessageRequester_Error) 
    End ; bye bye 
EndIf 

Macro SciCall(Message, wParam=0, lParam=0) 
  SendMessage_(hScintilla, Message, wParam, lParam) 
EndMacro 

SciCall(#SCI_SETEDGEMODE, #EDGE_LINE)           ; activate the edge mode 
SciCall(#SCI_SETEDGECOLUMN, 120 - 1)                ; edge is at Column 120 ### You should change this to your liking 
SciCall(#SCI_SETEDGECOLOUR, $00D7FF)          ; use color == #PB_Color_Gold ($00D7FF) constant not defined :) 
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
highend
Enthusiast
Enthusiast
Posts: 169
Joined: Tue Jun 17, 2014 4:49 pm

Re: IDE-Tool Addition: activate Long Line Edge

Post by highend »

Very helpful, thanks for sharing!
User avatar
Blue
Addict
Addict
Posts: 966
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: IDE-Tool Addition: activate Long Line Edge

Post by Blue »

Thank you, Axolotl, for the idea and the code.

I modified the code a bit by adding a few lines that make it possible for the user to change the position of the line by simply placing the cursor on the column where he'd like the line to be drawn and then calling on the tool.

Here is the modified code :

Code: Select all

;|  Trigger: 
;|  · Sourcecode loaded
;|  · New Sourcecode created 
;|  
;|  Suggested Options: 
;|  · Wait until tool quits 
;|  · Run Hidden 
;|  · Hide Tool from the Main menu 

Define hScintilla = Val(GetEnvironmentVariable("PB_TOOL_Scintilla")) 
If Not hScintilla  ; if not running by IDE 
    MessageRequester("Fatal Error", "Failed to retrieve PB_TOOL_Scintilla", #PB_MessageRequester_Error) 
    End ; bye bye 
EndIf 

Macro SciCall(Message, wParam=0, lParam=0) 
  SendMessage_(hScintilla, Message, wParam, lParam) 
EndMacro

;-
;| added by Blue
;|  • Arguments: %CURSOR
  Define column, cursorPosition.s
  cursorPosition = ProgramParameter()
  If cursorPosition 
    column = FindString(cursorPosition,"x")
    If column
      column = Val(Right(cursorPosition,Len(cursorPosition)-column))
    EndIf
  EndIf

  If column < 8 
    column = 88   ; <<< change this to your liking
  EndIf
;-

SciCall(#SCI_SETEDGEMODE, #EDGE_LINE)      ; activate the edge mode 
SciCall(#SCI_SETEDGECOLUMN, column - 1)    ; edge is at Column 120 ### You should change this to your liking 
SciCall(#SCI_SETEDGECOLOUR, #red)          ; use color == #PB_Color_Gold ($00D7FF) constant not defined :) 
And a QUESTION :
How do you get your post to identify itself as "Purebasic" and to display with syntaxic coloring ?
That's a major improvement over what I manage to post !
Forget the question : I Got it !
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
dige
Addict
Addict
Posts: 1405
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: IDE-Tool Addition: activate Long Line Edge

Post by dige »

What do you use the feature for?
"Daddy, I'll run faster, then it is not so far..."
Axolotl
Addict
Addict
Posts: 837
Joined: Wed Dec 31, 2008 3:36 pm

Re: IDE-Tool Addition: activate Long Line Edge

Post by Axolotl »

To be honest, it's a personal quirk. Because I switch this on in all editors (ie. Notepad2 and Notepad++), I wanted to have it in PB too.
I use the line as a kind of visible "border" beyond which the individual lines should not go (exceptions prove this rule).
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
User avatar
Blue
Addict
Addict
Posts: 966
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: IDE-Tool Addition: activate Long Line Edge

Post by Blue »

dige wrote: Mon Feb 05, 2024 11:04 am What do you use the feature for?
I don’t know yet…
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
Post Reply