List of IDE Tools

Working on new editor enhancements?
Nituvious
Addict
Addict
Posts: 998
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

List of IDE Tools

Post by Nituvious »

Hi everyone, thought maybe it would be useful to start an IDE tool list.
If you have any tools you would like to share, please follow this standard:
Name:
Known Supported OS:
PB Version:
Description:
Setup:
<code>source or link</code>
If someones tool works on other operating systems than they have listed as known, please let them know! It's useful information. :)

Here are a couple of my own tools.
Name: date2src
Known Supported OS: Windows 7
PB Version: 5.00 x86
Description: Adds the date of the last save to your source file. It can overwrite existing dates, if found. It can also backup a source file, if set to do so. This is an updated version of an old tool I made, but I can't find the topic anymore.
Setup: Go to Tools > Configure Tools. Set commandline to location of date2src binary, and arguments to %FILE. Set 'Event to trigger the tool' to Sourcecode saved. You may also want to go to File > Preferences > Editor and turn off 'Monitor open files for changes on disk', otherwise the popups will get annoying. You'll need to configure it a small bit. GetDate() takes an argument to set the clock to 12 or 24 hours. You can also configure AddDateToSource() it to create a copy of the source by setting the second argument to 1.

date2src.pb link - kind of long, didn't want to clutter up first post.
Name: Open source location
Known Supported OS: Windows 7
PB Version: 5.00 x86
Description: Opens the source file's location. ie, if you're editing 'C:\code\project\stuff.pb' this tool will open it's containing folder, 'C:\code\project\'.
Setup: Go to Tools > Configure Tools. Set commandline to location of the tools binary file. Set arguments to %PATH. Set 'Event to trigger the tool' to 'Menu or Shortcut'. I personally have the shortcut key set to CTRL+ALT+O.

Code: Select all

path.s = ProgramParameter(0)
If path.s <> ""
	RunProgram(path.s)	
EndIf
▓▓▓▓▓▒▒▒▒▒░░░░░
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 794
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: List of IDE Tools

Post by Zebuddi123 »

Cool its something i had posted and asked the mods to do end of last year, to have all the useful IDE tools in one place. Which this should be a sticky on the main forum page especially for new PB users, else it takes some trawling of the forums to find them. :lol:


Zebuddi. :D
malleo, caput, bang. Ego, comprehendunt in tempore
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: List of IDE Tools

Post by STARGÅTE »

in the german forum we have already this list:
Sammelliste für PureBasic Werkzeuge (list for PureBasic tools)
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Nituvious
Addict
Addict
Posts: 998
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

Re: List of IDE Tools

Post by Nituvious »

STARGÅTE wrote:in the german forum we have already this list:
Sammelliste für PureBasic Werkzeuge (list for PureBasic tools)
That's pretty cool, unfortunately I don't speak german so I don't cruise the german forums. :oops:
▓▓▓▓▓▒▒▒▒▒░░░░░
jassing
Addict
Addict
Posts: 1745
Joined: Wed Feb 17, 2010 12:00 am

Re: List of IDE Tools

Post by jassing »

Nituvious wrote:
STARGÅTE wrote:in the german forum we have already this list:
Sammelliste für PureBasic Werkzeuge (list for PureBasic tools)
That's pretty cool, unfortunately I don't speak german so I don't cruise the german forums. :oops:
Using chrome, it can automatically translate web pages for you -- it does a pretty good job, but it screws up formatting between the code-tags; unfortunately, straight google searches don't search the translated page; so search the german forums can be hard... however, if you get an idea, use google translate. just a thought.
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: List of IDE Tools

Post by Michael Vogel »

Name: Auto Indent
Known Supported OS:
PB Version: 4.x, 5.x
Description: adds/removes tabs to indent the active source code into a structured form.
Setup: see below

Code: Select all

;{ AutoIndent by Michael Vogel V2.o2}

	; INSTALLATION:
	; copy compiled exe into the directory "...\Purbasic\Catalogs"
	; install the tool using the parameter "%TEMPFILE" %SELECTION
	; use the PureBasic as the working directory (or adapt the OpenPreferences path below)
	; Select 'Wait until tool quits' And 'Reload source after tool has quit'
	
	;	%COMPILEFILE\..\Catalogs\Tool AutoIndent.exe
	;	"%TEMPFILE" %SELECTION
	;	%COMPILEFILE\..
	;	Auto &Indent
	;	Menu Or Shortcut

	; 	× Wait until tool quits
	; 	× Reload Source after tool has quit
	; 	× into the current source
	
	
	; DESCRIPTION:
	; With pressed shift key:		eliminates tabs and spaces
	; without shift key:			indents source code
	; no selection:					complete source code is affected
	; selection of lines:			only selected lines are changed
	
	
	; HISTORY & ISSUES:
	; known problems:			when cursor is in line 1, the Procedure folds up (editor bug?)
	;								":" in remark, like in "Until x>1;   x : 0...5"
	; solved:						"Else" was seen twice: because of "Else" and "ElseIf"

;}

; Define

	Global LeftC.l
	Global LeftD.l
	Global RightC.l
	Global RightD.l
	Global RightP.l

	#Words=51

	Global Dim Word.s(#Words)
	Global Dim Exception.s(4)
	Global exceptions.l=0
	Global Dim Border(3)

	z.l=0
	i.l=0
	While i<#Words
		i+1
		Read.s Word(i)
		If Asc(word(i))=254	; "þ"
			exceptions+1
			exception(exceptions)=Mid(word(i),2,Len(word(i))-1)
		EndIf
		If Word(i)="!"
			i-1
			Border(z)=i
			;Debug Str(z)+": "+Str(i-1)+" = "+word(border(z))
			z+1
		EndIf
	Wend

	DataSection
		Data.s "þ Define"
		Data.s "þ{"
		Data.s "Procedure "
		Data.s "Procedure."
		Data.s "ProcedureC"
		Data.s "ProcedureDLL"
		Data.s "DataSection"
		Data.s "Macro "
		Data.s "If "
		Data.s "With "
		Data.s "Select "
		Data.s "While "
		Data.s "For "
		Data.s "ForEach "
		Data.s "Repeat"
		Data.s "Structure "
		Data.s "StructureUnion"
		Data.s "Interface "
		Data.s "Enumeration"
		Data.s "CompilerIf "
		Data.s "CompilerSelect "
		Data.s "ImportC "
		Data.s "Import "
		Data.s "!"							; border(0)

		; kurzzeitig ''ausrücken''
		Data.s "Case "
		Data.s "Else:"				
		Data.s "Else "				
		Data.s "ElseIf "
		Data.s "Default "			
		Data.s "Default:"
		Data.s "CompilerElse"
		Data.s "CompilerCase"
		Data.s "CompilerDefault"
		Data.s "!"							; border(1)

		Data.s "þ EndDefine"
		Data.s "þ}"
		Data.s "EndProcedure"
		Data.s "EndDataSection"
		Data.s "EndMacro"
		Data.s "EndIf"
		Data.s "EndWith"
		Data.s "EndSelect"
		Data.s "Wend"
		Data.s "ForEver"
		Data.s "EndStructure"
		Data.s "EndStructureUnion"
		Data.s "EndInterface"
		Data.s "EndEnumeration"
		;Data.s "CompilerEndIf"
		;Data.s "CompilerEndSelect"
		Data.s "EndImport"
		Data.s "!"						; border(2)

		Data.s "Next "			
		Data.s "Next:"			
		Data.s "Until "			
		Data.s "!",""					; border(3)

	EndDataSection
; EndDefine

Procedure.s RightTrim(s.s)
	l.l=Len(s)
	While l
		l-1
		b.l=PeekB(@s+l)
		If b<>9 And b<>32
			Break
		EndIf
	Wend
	ProcedureReturn Left(s,l+1)
EndProcedure
Procedure.s LeftTrim(s.s)
	l.l=Len(s)
	c.l=0
	While c<l
		b.l=PeekB(@s+c)
		If b<>9 And b<>32 ; Space & Tab
			Break
		EndIf
		c+1
	Wend
	ProcedureReturn Mid(s,c+1,l-c)
EndProcedure
Procedure FindCommas(s.s)
	LeftC=0
	LeftD=0
	RightC=0
	RightD=0
	RightP=0
	l.l=Len(s)
	c.l=0
	While c<l
		b.l=PeekB(@s+c)
		c+1
		Select b
		Case 59		; Semicolon
			RightC=c
			If LeftC=0 : LeftC=c : EndIf
		Case 34		; DoubleQuote
			RightD=c
			If LeftD=0 : LeftD=c : EndIf
		Case 58		; Colon
			RightP=c
		Case 9,32
			If c=RightP+1 : RightP+1 : EndIf
		EndSelect

	Wend
EndProcedure
Procedure.s RightCut(s.s,x.l)
	ProcedureReturn RTrim(Left(s,x-1))
EndProcedure
Procedure.s StringS(n, chars.s)
	Protected s.s=""
	While n>0
		s+chars
		n-1
	Wend
	ProcedureReturn s
EndProcedure

Procedure Init()

	; Dateinamen holen...
	CompilerIf 1
		If CountProgramParameters()<>2
			MessageBox_(0,"'AutoIndent' benötigt Parameter!"+#CR$+"(%TEMPFILE und %SELECTION)","Fehler",#MB_ICONERROR| #MB_OK)
			End
		EndIf
		Global OutputFile.s=ProgramParameter()
	CompilerElse
		Global OutputFile.s="Test.pb"
	CompilerEndIf

	Global InputFile.s=OutputFile+"~"
	DeleteFile(InputFile)
	If RenameFile(OutputFile,InputFile)=0
		MessageBox_(0,"'AutoIndent' konnte keine Temporärdatei erstellen","Fehler",#MB_ICONERROR| #MB_OK)
		End
	EndIf

	; Selektion abfragen...
	Global zeile.l=0
	selektion.s=ProgramParameter()
	Global Startzeile.l=Val(StringField(selektion, 1, "x"))
	Global Endzeile.l=Val(StringField(selektion, 3, "x"))

	;CreateFile(3,"c:\debug.log")
	;WriteStringN(3,Str(Startzeile))
	;WriteStringN(3,Str(Endzeile))
	;CloseFile(3)

	If Startzeile>=Endzeile
		Startzeile=1
		Endzeile=#MAXSHORT
	EndIf

	OpenPreferences(GetPathPart(ProgramFilename())+"..\PureBasic.prefs"); ok

	PreferenceGroup("Global")
	If Val(ReadPreferenceString("RealTab","0")) Or (GetKeyState_(#VK_CONTROL)&$80)
		Global indtxt.s=#TAB$
	Else
		Global indtxt.s=Space(Val(ReadPreferenceString("TabLength", "2")))
	EndIf
	ClosePreferences()

EndProcedure
Procedure Doit(mode.l)

	; Doit(0)	auto indent the source code
	; Doit(1)	trims source code from space And tab characters

	;CreateFile(3,"c:\debug.log")
	;WriteStringN(3,"s "+FormatDate("%hh:%ii:%ss", Date())+#TAB$+Str(GetTickCount_()))

	init()

	ReadFile(1,InputFile)
	CreateFile(2,OutputFile)

	indent.l=0


	While Not(Eof(1))
		z.s=ReadString(1)
		zeile.l+1

		z=righttrim(z)		; rechts kann man immer säubern

		If zeile>=Startzeile And zeile<=Endzeile

			z=lefttrim(z)		; links nur, wenn gewünscht...

			afterburner.l=0

			If (mode=0) And (Len(z)>0)

				If Asc(z)=';'; ";"
					If Left(z,25)="; IDE Options = PureBasic"
						indent=0
					Else
						For i=1 To exceptions
							If Mid(z,2,Len(exception(i)))=exception(i)
								PokeB(@z,254) ; "þ"
								Break
							EndIf
						Next i
					EndIf
				EndIf

				s.s=z

				FindCommas(s)
				; [1]	If a=0		; remark
				; [2]	If a=''x''	; remark
				; [3]	If a=0		; ''remark''
				; [x]	If a=''x''	; ''remark''
				If LeftC
					If LeftD=0 Or LeftC<LeftD	; [1], [3]
						s=RightCut(s,LeftC)
					ElseIf RightC>RightD		; [2]
						s=RightCut(s,RightC)
					EndIf
				EndIf

				For i=1 To #Words
					l.l=Len(word(i))
					Select i
					Case 1 To border(1)
						p.l=1
					Case 1 To border(2)
						p.l=Len(s)-l+1
					Case 1 To border(3)
						p.l=RightP+1
					EndSelect

					If Mid(s+":",p,l)=word(i)

						Select i
						Case 1 To border(0)
							afterburner.l+1

						Case 1 To border(1)
							indent-1
							afterburner.l+1

						Case 1 To border(3)
							If afterburner
								afterburner-1
							Else
								indent-1
							EndIf

						EndSelect
					EndIf

				Next i

				If Asc(z)=254 ; "þ"
					PokeB(@z,';') ; ";"
				EndIf

				z=strings(indent,indtxt)+z
				;WriteStringN(3,s)

			EndIf ; mode

		EndIf ; Zeilenselektion

		WriteStringN(2,z)
		indent+afterburner
	Wend
	CloseFile(1)
	CloseFile(2)

	;WriteStringN(3,"e "+FormatDate("%hh:%ii:%ss", Date())+#TAB$+Str(GetTickCount_()))
	;CloseFile(3)

EndProcedure

Doit((GetKeyState_(#VK_SHIFT)&$80))
Name: Resource File Path
Known Supported OS:
PB Version: 4.x, 5.x
Description: allows to compile your PB sources from memory sticks, even when resource files (icons etc.) are used.
Setup: see below

Code: Select all

;{ Resource File by Michael Vogel V1.oo}

	; DESCRIPTION:
	; Adjusts drive letters for resource files added in the compiler options. This is useful, if you have your source files
	; on a memory stick or USB drive, where the drive letter may change.
	
	; INSTALLATION:
	; copy the tool into the directory "...\Purbasic\Catalogs" to use the following settings:
	
	;	%COMPILEFILE\..\Catalogs\Tool ResourceFile.exe
	;	"%FILE"
	;	%COMPILEFILE\..
	;	Ressource File Path Corrector
	;	Menu Or Shortcut
	;	<your shortcut>

	; 	[_]	 Wait until tool quits
	; 	[_]	 Run hidden
	; 	[_]	 Hide Editor
	; 	[_]	 Reload Source after tool has quit
	; 		(•)	 into new source
	; 		(_)	 into current source
	; 	[_]	 Hide Tool from Main menu
	; 	[_]	 Enable Tool on a per-source basis
	
;}

"%FILE"

Source.s=ProgramParameter();	"I:\Forerunner\Forerunner.pb"

Drive.s=UCase(Left(Source,3))
Resource.s
Backup.s


If Mid(Drive,2,2)=":\"

	If ReadFile(#True,Source)

		While Eof(#True)=#False
			Line.s=ReadString(#True)
			If PeekA(@Line)=';'
				If Left(Line,15)="; AddResource ="
					Resource=Trim(Mid(Line,16))
				EndIf
			EndIf
		Wend
		CloseFile(#True)

		If Resource

			If Left(Resource,1)="\" Or Mid(Resource,2,1)=":"
				Debug resource
				MessageRequester("Panik","Illegal resource file definition."+#CR$+"Please use relative path for your resource file definitions.")
			Else
				Resource=GetPathPart(Source)+Resource
				Backup=GetExtensionPart(Resource)
				Backup=Left(Resource,Len(Resource)-Len(GetExtensionPart(Resource)))+"bak"
				DeleteFile(Backup)
				If FileSize(Resource)>#True
					If RenameFile(Resource,Backup)
						If CreateFile(#True,Resource) And ReadFile(#False,Backup)
							While Eof(#False)=#False
								Line.s=ReadString(#False)
								n=FindString(Line," ICON ")
								If n
									n+5
									If PeekA(@Line+n)='"'
										n+1
									EndIf
									If PeekA(@Line+n+1)=':'
										PokeA(@Line+n,PeekA(@Drive))
									EndIf
								EndIf
								Debug Line
								WriteStringN(#True,Line)
							Wend
							CloseFile(#False)
							CloseFile(#True)
							MessageRequester("Ok","Modified resource file.",#MB_ICONINFORMATION|#MB_OK)
						Else
							MessageRequester("Panik","Could not write a new resource file"+#CR$+"'"+Resource+"'.")
						EndIf
					Else
						MessageRequester("Panik","Could not create a backup for the resource file"+#CR$+"'"+Resource+"'.")
					EndIf
				Else
					MessageRequester("Panik","Could not locate the resource file"+#CR$+"'"+Resource+"'.")
				EndIf
			EndIf

		Else
			MessageRequester("Panik","No resource file defined."+#CR$+"Compiler options / Resources")
		EndIf

	EndIf

Else
	MessageRequester("Panik","Wrong tool configuration."+#CR$+"Please use ''%FILE'' as start parameter.",#MB_ICONERROR|#MB_OK)
	
EndIf
Name: Show Procedure Information
Known Supported OS:
PB Version: 4.x, 5.x
Description: simply pops up the name of the actual procedure
Setup: see below

Code: Select all

;{ ShowInformation by Michael Vogel Vo.o1}

	; INSTALLATION:
	;
	; •	copy the compiled exe file into the directory "...\Purbasic\Catalogs"
	; •	set up the tool using "Configure Tools..." with the following parameters (from top to bottom):
	;
	;	%COMPILEFILE\..\Catalogs\Tool ShowInfo.exe
	;	"%TEMPFILE" %CURSOR
	;	%COMPILEFILE\..
	;	Show I&nformation
	;	Menu Or Shortcut
	;	Alt+N
	;
	; 	[_]	Wait until tool quits
	; 	[_]	Reload Source after tool has quit
	; 	[_]	into the current source

;}
; Define

	#Programtitle="Show Information"

	Enumeration
		#CopyNothing
		#CopyProcedureLine
		#CopyCursorText
		;
		#Source
		#Window
		#Info
	EndEnumeration

	#CopyMode=#CopyProcedureLine;	GetKeyState_(#VK_MENU)&128

	If CountProgramParameters()<>2
		MessageBox_(0,"'Show Information' needs two parameters!"+#CR$+"(''%TEMPFILE'' %CURSOR)","Error",#MB_ICONERROR|#MB_OK)
		End
	EndIf

	Global SourceFile.s=ProgramParameter()
	Global Zeile.s=ProgramParameter()
	Global Info.s
	Global Cursor.i=Val(StringField(Zeile,1,"x"))
	Global Count.i
	Global n

	; MessageBox_(0,"Filename: "+SourceFile+#CR$+"Cursor-Position: "+Str(Cursor),"Ok",#MB_ICONINFORMATION|#MB_OK)

	If OpenFile(#Source,SourceFile)

		While Eof(#Source)=#Null And Cursor
			Count+1
			Zeile=Trim(ReadString(#Source))
			If LCase(Left(Zeile,9))="procedure"
				Info=StringField(Zeile,2," ")
				n=Count
			EndIf
			Cursor-1
		Wend
		CloseFile(#Source)

		CompilerSelect #CopyMode
		CompilerCase #CopyProcedureLine
			SetClipboardText(Str(n))
		CompilerCase #CopyCursorText
			SetClipboardText(Zeile)
		CompilerEndSelect

		n=Len(Info)
		If n
			n*6+10
			GetCursorPos_(Mouse.POINT)
			OpenWindow(#Window,Mouse\x+10,Mouse\y-15,n,18,#Programtitle,#PB_Window_BorderLess|#PB_Window_Invisible)
			SetWindowColor(#Window,#Black)
			StickyWindow(#Window,#True)
			TextGadget(#Info,1,1,n-2,16," "+Info,#SS_NOPREFIX|#SS_LEFTNOWORDWRAP)
			SetGadgetColor(#Info,#PB_Gadget_BackColor,#Yellow)
			SetGadgetColor(#Info,#PB_Gadget_FrontColor,#Black)
			HideWindow(#Window,#Null)
			AddWindowTimer(#Window,#Null,250)

			n=ElapsedMilliseconds()+1500
			Repeat
				WaitWindowEvent()
			Until ElapsedMilliseconds()>n
			End

		EndIf

	Else
		MessageBox_(0,"The source code file '"+GetFilePart(SourceFile)+"' is locked!"+#CR$,"Error",#MB_ICONERROR|#MB_OK)
		End
	EndIf

; EndDefine

Nituvious
Addict
Addict
Posts: 998
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

Re: List of IDE Tools

Post by Nituvious »

Michael Vogel wrote:
Name: Show Procedure Information
Known Supported OS:
PB Version: 4.x, 5.x
Description: simply pops up the name of the actual procedure
Setup: see below

Code: Select all

*snip*
That's really cool, thanks for sharing! Works here on Windows 7 x64
▓▓▓▓▓▒▒▒▒▒░░░░░
jassing
Addict
Addict
Posts: 1745
Joined: Wed Feb 17, 2010 12:00 am

Re: List of IDE Tools

Post by jassing »

Michael Vogel wrote:

Code: Select all

;{ Resource File by Michael Vogel V1.oo}

<snip header comments >

	; 	[_]	 Enable Tool on a per-source basis
	
;}

"%FILE"

Source.s=ProgramParameter();	"I:\Forerunner\Forerunner.pb"
"%FILE" ? ?
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: List of IDE Tools

Post by Michael Vogel »

jassing wrote:"%FILE" ? ?
Not sure, what you are asking for - I have entered the characters " % F I L E " into the arguments field in the tool settings dialog.
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 794
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: List of IDE Tools

Post by Zebuddi123 »

Name: Auto Backup PureBasic Preference Files on IDE closing
Known Supported OS: Windows
PB Version: 5.x
Description: Automatically copies the \AppData\Roaming\PureBasic\ Preference files to a dated zip file. Set Destination string to place of your choice
REQUIRES: Gnozals PureZip lib http://gnozal.ucoz.com/
Setup: ConfigTools
CommandLine [Path to This tool]
Name [name of this tool]
Event to trigger this tool [Editor Closing]
Hide tool from the menu [if desired]

Code: Select all

source$="C:\Users\"+UserName()+"\AppData\Roaming\PureBasic\*.*"
destination$="C:\Users\"+UserName()+"\Documents\"  ; Your Storage Destination
ziphandle$=destination$+"PBPrefsBKUP__"+FormatDate("%dd-%mm-%yyyy-[@ %hh_%ii]",Date())+".zip"

ProcedureDLL.s __GetLastErrorAsText(LastError.l) ; Used to get Last Win32 API Error
    If LastError 
    *ErrorBuffer = AllocateMemory(1024) 
    FormatMessage_(#FORMAT_MESSAGE_FROM_SYSTEM, 0, LastError, 0, *ErrorBuffer, 1024, 0) 
    message.s=PeekS(*ErrorBuffer) 
    FreeMemory(*ErrorBuffer) 
  EndIf 
  ProcedureReturn message
EndProcedure

ProcedureDLL __GetLastError() ; Return the last Win32 API error as a string
  ; Error 1309 or 0 = No error 
  LastError=GetLastError_()
  If LastError=1309 : LastError=0 : EndIf
  ProcedureReturn LastError
EndProcedure


If MakeSureDirectoryPathExists_(destination$)
	If Not PureZIP_AddFiles(ziphandle$, source$, #PureZIP_StorePathAbsolute, #PureZIP_Recursive)
		MessageRequester("File Error", "Error Creating "+source$+Chr(10)+__GetLastErrorAsText(__GetLastError()))
	EndIf
Else
	If CreateDirectory(destination$)
		If Not PureZIP_AddFiles(ziphandle$, source$, #PureZIP_StorePathAbsolute, #PureZIP_Recursive)
			MessageRequester("File Error", "Error Creating "+source$+Chr(10)+__GetLastErrorAsText(__GetLastError()))
		EndIf
	Else
		MessageRequester("Directory Error", "Error Creating "+destination$+Chr(10)+__GetLastErrorAsText(__GetLastError()))
	EndIf
EndIf
End
malleo, caput, bang. Ego, comprehendunt in tempore
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: List of IDE Tools

Post by kenmo »

This is a good idea, I don't think IDE tools are used as often as they should be!

Last year I started working on an tool/userlib manager (which itself was an IDE tool) by looking at how PB tool settings are stored. My goal was to make it as simple as possible to install/configure user-made tools... basically you would distribute your executable with a descriptor file (probably XML) that would include the name, version, author, recommended triggers and arguments, etc. The manager would read this, copy the executable to a PB tools subdirectory, rewrite tools.prefs and restart the IDE. I also planned to host a small database online so you could search for available tools/userlibs... this is all very far from finished though :? Maybe I'll work on it this spring?

Anyway, here is a tool I use that adds a couple extra features to the editor. Feel free to modify.
Name: ScintillaMod
Known Supported OS: Windows (not sure what to use instead of SendMessage_() on Mac/Linux)
PB Version: 5.00+ (probably earlier versions too)
Description: Adds extra Scintilla features to the editor (Ctrl+Shift+Up/Down hotkey to move lines up/down) (vertical line marker at a specified column)
Setup: Compile and add twice to your tools list (New source trigger + Load source trigger), use "movelines" and "edge(n)" arguments to enable the features

Code: Select all

; ScintillaMod IDE Tool by kenmo

; OS-specific Send() macro
CompilerSelect (#PB_Compiler_OS)
  CompilerCase (#PB_OS_Windows)
    Macro Send(Message, wParam = #Null, lParam = #Null)
      SendMessage_(PB_TOOL_Scintilla, Message, wParam, lParam)
    EndMacro
  CompilerDefault
    Macro Send(Message, wParam = #Null, lParam = #Null)
      ;? feel free to implement other OS versions!
    EndMacro
CompilerEndSelect

; Get the handle of the IDE Scintilla editor
PB_TOOL_Scintilla.i = Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
If (PB_TOOL_Scintilla)
  n = CountProgramParameters()
  For i = 0 To n - 1
    Param.s = ProgramParameter(i)
    
    ; movelines
    ; Add Notepad++ style "move selected lines up/down" hotkeys
    If (LCase(Param) = "movelines")
      Mod = (#SCMOD_CTRL|#SCMOD_SHIFT)<<16
      Send(#SCI_ASSIGNCMDKEY, #SCK_UP   + Mod, #SCI_MOVESELECTEDLINESUP  )
      Send(#SCI_ASSIGNCMDKEY, #SCK_DOWN + Mod, #SCI_MOVESELECTEDLINESDOWN)
    EndIf
    
    ; edge(n)
    ; Add a vertical line at the column specified by (n)
    If (LCase(Left(Param, 5)) = "edge(")
      Param      = RTrim(Mid(Param, 6), ")")
      Column     = Val(Param)
      Background = Send(#SCI_STYLEGETBACK, #STYLE_DEFAULT)
      R = Red(Background)
      G = Green(Background)
      B = Blue(Background)
      If (R + G + B > 3 * 128)
        Background = RGB(R*3/4, G*3/4, B*3/4)
      Else
        Background = RGB(R+(255-R)/4, G+(255-G)/4, B+(255-B)/4)
      EndIf
      Send(#SCI_SETEDGEMODE,   #EDGE_LINE )
      Send(#SCI_SETEDGECOLUMN,  Column    )
      Send(#SCI_SETEDGECOLOUR,  Background)
    EndIf
    
  Next i
EndIf
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: List of IDE Tools

Post by yrreti »

This topic is a nice cool idea! :D :D :D
We all can really appreciate the different additions and ideas added.
I'd like to also add something here to this list that I started, and some have added ideas too, that I use a lot.
But as it already has it's topic. It is better to just put a link here to it, then to re paste all the code here again.
Topic: Create Comments Editor - Updated
http://www.purebasic.fr/english/viewtop ... 14&t=51548

yrreti
Last edited by yrreti on Wed Feb 13, 2013 1:20 pm, edited 1 time in total.
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: List of IDE Tools

Post by kenmo »

Here's another one I just put online:
Name: PureHTML
Known Supported OS: Windows (source included for porting)
PB Version: 5.00+
Description: Converts one or more PB source files into nicely formatted web-friendly HTML pages
Recommended Setup: Copy somewhere into your PB directory, and add a "PureHTML" entry to your Tools menu
Link: http://www.purebasic.fr/english/viewtop ... 14&t=53437
User avatar
Bisonte
Addict
Addict
Posts: 1226
Joined: Tue Oct 09, 2007 2:15 am

Re: List of IDE Tools

Post by Bisonte »

Name: Assign
Supported OS: min. Windows XP/Windows Server 2003 (source included for porting)
Description: Assign a drive to a path
Setup : see source

Code: Select all

; _____________________________________________________________________________
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; »»» Project  : IDE-Tool - Assign
; »»» Author   : George Bisonte
; »»» Version  : 1.0
; »»» Compiler : PureBasic 5.10 (Windows - x86)
; »»» created  : 27.02.2013 - 04:23
; »»» Flags    : [ ]ASM       [ ]Unicode  [ ]Thread  [ ]XP-Skin
; »»»            [ ]AdminMode [ ]Usermode [ ]OnError [ ]Purifier
; _____________________________________________________________________________
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; Configure as
;
; Commandline: Driveletter "PathToDirectory" Messages
; Example : P "C:\PureBasic\Includes\" 1 -> Assign P:\ to C:\PureBasic\Includes\ and Display Error Messages if an error...
;
; Trigger: "Editor Start"
; [x] Hide tool from the Main menu
;
EnableExplicit

Define.s DriveLetter, Path
Define   Messages, Directory, Result

DriveLetter = ProgramParameter(0)
Path        = ProgramParameter(1)
Messages    = Val(ProgramParameter(2))

Directory = ExamineDirectory(#PB_Any, DriveLetter + ":\", "")

If Directory 
  FinishDirectory(Directory)
  Result = 3
Else
  If FileSize(Path) = -2
    DefineDosDevice_(0,DriveLetter + ":",Path)
    Result = 2
  Else
    Result = 1
  EndIf
EndIf

If Messages
  Select Result
    Case 1
      MessageRequester("Error","Could not assign "+DriveLetter+": to "+Path)
    Case 2
      ; All Ok
    Case 3
      MessageRequester("Error","Already assigned "+DriveLetter+": to "+Path)
  EndSelect
EndIf

End
PureBasic 6.04 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
User avatar
skywalk
Addict
Addict
Posts: 3972
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: List of IDE Tools

Post by skywalk »

Does anyone have a tool that deletes trailing spaces and empty lines from IDE source code?
Checking before recreating existing code...
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply