Page 1 of 1

IDE-Tool Addition: activate Long Line Edge

Posted: Fri Jan 12, 2024 1:56 pm
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 :) 

Re: IDE-Tool Addition: activate Long Line Edge

Posted: Sun Jan 14, 2024 9:10 pm
by highend
Very helpful, thanks for sharing!

Re: IDE-Tool Addition: activate Long Line Edge

Posted: Mon Feb 05, 2024 6:17 am
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 !

Re: IDE-Tool Addition: activate Long Line Edge

Posted: Mon Feb 05, 2024 11:04 am
by dige
What do you use the feature for?

Re: IDE-Tool Addition: activate Long Line Edge

Posted: Mon Feb 05, 2024 2:03 pm
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).

Re: IDE-Tool Addition: activate Long Line Edge

Posted: Mon Feb 05, 2024 2:16 pm
by Blue
dige wrote: Mon Feb 05, 2024 11:04 am What do you use the feature for?
I don’t know yet…