jaPBe 3.13.4 [IDE for PB 4 and PB 5]

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: jaPBe 3.11.12 [IDE for PB 4.xx]

Post by gnozal »

moob wrote:In preferences the option associate PB... with jaPBe don't work.

show the message it's associate but don't associates.

I use windows 7 x64 pro
Probable causes :
- user rights issue (admin rights necessary ?)
- x64 issue (jaPBe is a x86 executable)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
moob
User
User
Posts: 68
Joined: Mon Aug 01, 2011 6:16 pm

Re: jaPBe 3.11.12 [IDE for PB 4.xx]

Post by moob »

gnozal wrote:
moob wrote:In preferences the option associate PB... with jaPBe don't work.

show the message it's associate but don't associates.

I use windows 7 x64 pro
Probable causes :
- user rights issue (admin rights necessary ?)
- x64 issue (jaPBe is a x86 executable)
thanks for answer gnozal.

I have admin rights...

and i use purebasic x86 with jaPBe installed in "C:\Program Files (x86)" directory
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: jaPBe 3.11.12 [IDE for PB 4.xx]

Post by gnozal »

Le Soldat Inconnu wrote:Sorry, in french for Gnozal to write more fast and be more comprehensible.
To explain fast, i delete japbe parameter, select my options and try again. Same problem.
Should be fixed in build 864.
The issue was the 'UseRealTabs = 1' setting in preferences.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Re: jaPBe 3.11.12 [IDE for PB 4.xx]

Post by Le Soldat Inconnu »

Perfect :)
LSI
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: jaPBe 3.11.12 [IDE for PB 4.xx]

Post by gnozal »

Update

Changes :
- fixed : function "find procedure declaration" was broken
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Re: jaPBe 3.11.12 [IDE for PB 4.xx]

Post by Le Soldat Inconnu »

Thanks

An idea :
Can be great if the exe file can be saved as relative directory dependant of the *.pb directory

I'm not sure my english is good, so an example :

jaPBe save exe path like this :
; Executable=E:\PureBasic\Développements\Test.exe

but if *.pb file is in directory "E:\PureBasic\Développements\"
why don't save
; Executable=Test.exe

So like this, if i moved the folder "E:\PureBasic\Développements\" in "F:\" (USB key for example), when I compile, i have the good directory opened to save my exe, and it's don't save in last directory.
How many time I don't understand why my exe don't do the same as compilation with debugger because it was not saved in good place and I don't see.

Thanks in advance if you can add this.
LSI
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: jaPBe 3.12.2 [IDE for PB 4.xx]

Post by gnozal »

Update

Changes :
- modified : executable path is saved as relative path (relative to source file)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: jaPBe 3.12.2 [IDE for PB 4.xx]

Post by dige »

jaPBe faces every procedure name with > (inside the book panel) like
> Procedure1 (a, b)
> Procedure2 (a, b)

If jaPBe creates the declare files, there are also the char '>' in front
of every procedure name and the declare is invalid...
"Daddy, I'll run faster, then it is not so far..."
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: jaPBe 3.12.2 [IDE for PB 4.xx]

Post by gnozal »

dige wrote:If jaPBe creates the declare files, there are also the char '>' in front
of every procedure name and the declare is invalid...
Should be fixed in build 867.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Color requester plugin

Post by Le Soldat Inconnu »

Hi,

I do plugin for jaPBe (or normal program for PB editor but i use jaPBe) to select color.

it's look like this

Image

So, i search people to try it.

Program is here :
http://www.lsi-dev.com/index.php?mod=do ... erid&id=88

And for source code, you can visit french forum :mrgreen: :
http://www.purebasic.fr/french/viewtopi ... 12#p139612
LSI
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Color requester plugin

Post by Demivec »

Very nice! Thank you. :)
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Re: jaPBe 3.12.2 [IDE for PB 4.xx]

Post by Le Soldat Inconnu »

Gnozal, Demivec, Do you test my plugin ?
What do you think about it ? No problem ? (my english translation is correct ? Plugin change language between english or french, it's depend jaPBe language)

And i have to explain some point :
if you select color in hexa like $FF6080 and launch my color requester, the result will be directly in hexa.
And the same if you select color in RGB( or in RGBA(
LSI
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Re: jaPBe 3.12.2 [IDE for PB 4.xx]

Post by Le Soldat Inconnu »

I update my plugin, I find a bug :)
LSI
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Re: jaPBe 3.12.2 [IDE for PB 4.xx]

Post by Le Soldat Inconnu »

Gnozal :
I propose this code for example do to jaPBe plugin, is for PB 4.00 or more and i had auto installation in jaPBe Plugin folder if plugin is running without jaPBe.

Code: Select all

;- Global
Global jaPBe_Handle
Global jaPBe_Version

Global jaPBe_CompilerMsg.s
Global jaPBe_CompilerType
Global jaPBe_FileName.s
Global jaPBe_Selection
Global jaPBe_CurrentWord
Global jaPBe_CompleteText
Global jaPBe_CurrentLine
Global jaPBe_IncludePath.s
Global jaPBe_jaPBeEXE.s
Global jaPBe_PBPath.s

#timeout = 5000

;- Window-Message
#mywm_Plugin_GetCurrentFileName = #WM_USER + 12
#mywm_Plugin_GetSelection = #WM_USER + 13
#mywm_Plugin_GetCurrentWord = #WM_USER + 14
#mywm_plugin_GetCompleteText = #WM_USER + 15
#mywm_plugin_GetCurrentLine = #WM_USER + 16
#mywm_plugin_GetCurrentPosition = #WM_USER + 17
#mywm_Plugin_Cancel = #WM_USER + 18
#mywm_plugin_DisablejaPBe = #WM_USER + 19
#mywm_plugin_EnablejaPBe = #WM_USER + 20
#mywm_Plugin_CompileRun = #WM_USER + 21
#mywm_plugin_Run = #WM_USER + 22
#mywm_plugin_CreateExecutable = #WM_USER + 23
#mywm_plugin_GetCompileThis = #WM_USER + 24
#mywm_Plugin_GetIncludePackPath = #WM_USER + 25
#mywm_Plugin_IncreaseBuild = #WM_USER + 26
#mywm_plugin_SaveAll = #WM_USER + 27
#mywm_plugin_Save = #WM_USER + 28
#mywm_Plugin_jaPBePath = #WM_USER + 29
#mywm_Plugin_PureBasicPath = #WM_USER + 30
#mywm_Plugin_CompileDebug = #WM_USER + 31
#mywm_Plugin_RestartCompiler = #WM_USER + 32 ; gnozal
#mywm_Plugin_DeleteCurrentTab = #WM_USER + 33 ; gnozal
#mywm_Plugin_LockCurrentTab = #WM_USER + 34 ; gnozal
;- Window-CopyData
#WMCD_OpenFile = 1
#WMCD_InsertText = 2
#wmCD_ReplaceCompleteText = 3
#wmcd_ReplaceCurrentLine = 4
#wmcd_NewText = 5
#wmcd_Fatal_Error = 6
#wmcd_Assembler_Error = 7
#wmcd_Linker_Error = 8
#wmcd_Syntax_Error = 9
#wmcd_Compilation_Finished = 10

#comp_Fatal_Error = 6
#comp_Assembler_Error = 7
#comp_Linker_Error = 8
#comp_Syntax_Error = 9
#comp_Compilation_Finished = 10

Procedure SendDataS(ziel, Type, Message$)
	cd.COPYDATASTRUCT
	cd\dwData = Type
	cd\cbData = Len(Message$) + 1
	cd\lpData = @Message$
	ProcedureReturn SendMessage_(ziel, #WM_COPYDATA, WindowID(1), cd)
EndProcedure
Procedure SendData(ziel, Type, adr, len)
	cd.COPYDATASTRUCT
	cd\dwData = Type
	cd\cbData = len + 1
	cd\lpData = adr
	ProcedureReturn SendMessage_(ziel, #WM_COPYDATA, WindowID(1), cd)
EndProcedure

Procedure Callback(WindowId, message, wParam, lParam)
	Result = #PB_ProcessPureBasicEvents
	If message = #WM_COPYDATA
		*cd.COPYDATASTRUCT = lParam
		Result = #False
		If wParam = jaPBe_Handle
			Select *cd\dwData
				Case #mywm_Plugin_jaPBePath
					jaPBe_jaPBeEXE = PeekS(*cd\lpData)
					Result = #True
				Case #mywm_Plugin_PureBasicPath
					jaPBe_PBPath = PeekS(*cd\lpData)
					Result = #True
				Case #mywm_Plugin_GetIncludePackPath
					jaPBe_IncludePath = PeekS(*cd\lpData)
					Result = #True
				Case #mywm_plugin_GetCompileThis
					jaPBe_FileName = PeekS(*cd\lpData)
					Result = #True
				Case #mywm_Plugin_GetCurrentFileName
					jaPBe_FileName = PeekS(*cd\lpData)
					Result = #True
				Case #mywm_Plugin_GetSelection
					jaPBe_Selection = GlobalAlloc_(#GMEM_FIXED, *cd\cbData)
					If jaPBe_Selection
						CopyMemory(*cd\lpData, jaPBe_Selection, *cd\cbData)
						Result = #True
					EndIf
				Case #mywm_Plugin_GetCurrentWord
					jaPBe_CurrentWord = GlobalAlloc_(#GMEM_FIXED, *cd\cbData)
					If jaPBe_CurrentWord
						CopyMemory(*cd\lpData, jaPBe_CurrentWord, *cd\cbData)
						Result = #True
					EndIf
				Case #mywm_plugin_GetCompleteText
					jaPBe_CompleteText = GlobalAlloc_(#GMEM_FIXED, *cd\cbData)
					If jaPBe_CompleteText
						CopyMemory(*cd\lpData, jaPBe_CompleteText, *cd\cbData)
						Result = #True
					EndIf
				Case #mywm_plugin_GetCurrentLine
					jaPBe_CurrentLine = GlobalAlloc_(#GMEM_FIXED, *cd\cbData)
					If jaPBe_CurrentLine
						CopyMemory(*cd\lpData, jaPBe_CurrentLine, *cd\cbData)
						Result = #True
					EndIf
				Default
					If *cd\dwData >= #wmcd_Fatal_Error And *cd\dwData <= #wmcd_Compilation_Finished
						jaPBe_CompilerMsg = PeekS(*cd\lpData, *cd\cbData)
						If jaPBe_CompilerMsg = Chr(255)
							jaPBe_CompilerMsg = ""
						EndIf
						jaPBe_CompilerType = *cd\dwData
						Result = #True
					EndIf
			EndSelect
		Else
			MessageRequester("jaPBe-Plugin", "I got a message NOT from jaPBe!")
		EndIf
	EndIf
	
	ProcedureReturn Result
EndProcedure
;- Send
Procedure jaPBe_LockCurrentTab(Locked.l) ; gnozal : Lock current source tab
	ProcedureReturn SendMessage_(jaPBe_Handle, #mywm_Plugin_LockCurrentTab, Locked, 0)
EndProcedure
Procedure jaPBe_DeleteCurrentTab() ; gnozal : Delete current source tab
	ProcedureReturn SendMessage_(jaPBe_Handle, #mywm_Plugin_DeleteCurrentTab, 0, 0)
EndProcedure
Procedure jaPBe_RestartCompiler() ; gnozal : Restart compiler [use before exiting pluging]
	ProcedureReturn SendMessage_(jaPBe_Handle, #mywm_Plugin_RestartCompiler, 0, WindowID(1))
EndProcedure
Procedure jaPBe_OpenFile(File$) ; Open the given File in jaPBe
	SendDataS(jaPBe_Handle, #WMCD_OpenFile, File$)
EndProcedure
Procedure jaPBe_InsertTextS(Text$) ; Insert the Text in the current Source Code
	SendDataS(jaPBe_Handle, #WMCD_InsertText, Text$)
EndProcedure
Procedure jaPBe_InsertText(adr, len) ; Insert the Text in the current Source Code
	SendData(jaPBe_Handle, #WMCD_InsertText, adr, len)
EndProcedure
Procedure jaPBe_ReplaceTextS(Text$) ; Replace the complete Text in the current Source Code
	SendDataS(jaPBe_Handle, #wmCD_ReplaceCompleteText, Text$)
EndProcedure
Procedure jaPBe_ReplaceText(adr, len) ; Replace the complete Text in the current Source Code
	SendData(jaPBe_Handle, #wmCD_ReplaceCompleteText, adr, len)
EndProcedure
Procedure jaPBe_ReplaceCurrentLineS(Text$) ; Replace the current Line in the current Source Code
	SendDataS(jaPBe_Handle, #wmcd_ReplaceCurrentLine, Text$)
EndProcedure
Procedure jaPBe_ReplaceCurrentLine(adr, len) ; Replace the current Line in the current Source Code
	SendData(jaPBe_Handle, #wmcd_ReplaceCurrentLine, adr, len)
EndProcedure
Procedure jaPBe_NewTextS(Text$) ; Open in jaPBe a new text and fill it with the text
	SendDataS(jaPBe_Handle, #wmcd_NewText, Text$)
EndProcedure
Procedure jaPBe_NewText(adr, len) ; Open in jaPBe a new text and fill it with the text
	SendData(jaPBe_Handle, #wmcd_NewText, adr, len)
EndProcedure
Procedure jaPBe_EnablejaPBe() ; Enable that the user can control jaPBe
	ProcedureReturn PostMessage_(jaPBe_Handle, #mywm_plugin_EnablejaPBe, 0, WindowID(1))
EndProcedure
Procedure jaPBe_DisablejaPBe() ; Disable any User-control over jaPBe
	ProcedureReturn PostMessage_(jaPBe_Handle, #mywm_plugin_DisablejaPBe, 0, WindowID(1))
EndProcedure
Procedure jaPBe_SaveAll() ; Save all open Source
	ProcedureReturn SendMessage_(jaPBe_Handle, #mywm_plugin_SaveAll, 0, WindowID(1))
EndProcedure
Procedure jaPBe_Save() ; Save Current File
	ProcedureReturn SendMessage_(jaPBe_Handle, #mywm_plugin_Save, 0, WindowID(1))
EndProcedure
;- Get
; Waring: This routines use windowevent(), so maybe you lost messages
Procedure.s jaPBe_GetIncludePackPath() ; Returns the path to the Include-Pack
	jaPBe_IncludePath = ""
	If SendMessage_(jaPBe_Handle, #mywm_Plugin_GetIncludePackPath, 0, WindowID(1))
		timeout = ElapsedMilliseconds() + #timeout ; maximal 5 sekunden warten
		Repeat
			WindowEvent()
			Delay(1)
		Until jaPBe_IncludePath <> "" Or ElapsedMilliseconds() > timeout
	EndIf
	ProcedureReturn jaPBe_IncludePath
EndProcedure
Procedure.s jaPBe_GetjaPBeExeName() ; Returns the path to jaPBe
	jaPBe_jaPBeEXE = ""
	If SendMessage_(jaPBe_Handle, #mywm_Plugin_jaPBePath, 0, WindowID(1))
		timeout = ElapsedMilliseconds() + #timeout ; maximal 5 sekunden warten
		Repeat
			WindowEvent()
			Delay(1)
		Until jaPBe_jaPBeEXE <> "" Or ElapsedMilliseconds() > timeout
	EndIf
	ProcedureReturn jaPBe_jaPBeEXE
EndProcedure
Procedure.s jaPBe_GetPBPath() ; Returns the path to PureBasic
	jaPBe_PBPath = ""
	If SendMessage_(jaPBe_Handle, #mywm_Plugin_PureBasicPath, 0, WindowID(1))
		timeout = ElapsedMilliseconds() + #timeout ; maximal 5 sekunden warten
		Repeat
			WindowEvent()
			Delay(1)
		Until jaPBe_PBPath <> "" Or ElapsedMilliseconds() > timeout
	EndIf
	ProcedureReturn jaPBe_PBPath
EndProcedure
Procedure.s jaPBe_GetCurrentFileName() ; Returns the Current file name (String)
	jaPBe_FileName = ""
	If SendMessage_(jaPBe_Handle, #mywm_Plugin_GetCurrentFileName, 0, WindowID(1))
		timeout = ElapsedMilliseconds() + #timeout ; maximal 5 sekunden warten
		Repeat
			WindowEvent()
			Delay(1)
		Until jaPBe_FileName <> "" Or ElapsedMilliseconds() > timeout
	EndIf
	ProcedureReturn jaPBe_FileName
EndProcedure
Procedure.s jaPBe_GetCompileThis() ; Returns the CompileThis file or "" (String)
	jaPBe_FileName = ""
	If SendMessage_(jaPBe_Handle, #mywm_plugin_GetCompileThis, 0, WindowID(1))
		timeout = ElapsedMilliseconds() + #timeout ; maximal 5 sekunden warten
		Repeat
			WindowEvent()
			Delay(1)
		Until jaPBe_FileName <> "" Or ElapsedMilliseconds() > timeout
	EndIf
	ProcedureReturn jaPBe_FileName
EndProcedure
Procedure jaPBe_GetSelection() ; Returns a address with the selected Text or 0, if no Text selected
	If jaPBe_Selection
		GlobalFree_(jaPBe_Selection)
		jaPBe_Selection = 0
	EndIf
	If SendMessage_(jaPBe_Handle, #mywm_Plugin_GetSelection, 0, WindowID(1))
		timeout = ElapsedMilliseconds() + #timeout ; maximal 5 sekunden warten
		Repeat
			WindowEvent()
			Delay(1)
		Until jaPBe_Selection Or ElapsedMilliseconds() > timeout
	EndIf
	ProcedureReturn jaPBe_Selection
EndProcedure
Procedure.s jaPBe_GetSelectionS() ; Returns a String with the selected Text
	Result = jaPBe_GetSelection()
	If Result
		ProcedureReturn PeekS(Result)
	Else
		ProcedureReturn ""
	EndIf
EndProcedure
Procedure jaPBe_GetCurrentWord() ; Returns a address with the Word under the cursor or 0 if no word under the cursor
	If jaPBe_CurrentWord
		GlobalFree_(jaPBe_CurrentWord)
		jaPBe_Selection = 0
	EndIf
	If SendMessage_(jaPBe_Handle, #mywm_Plugin_GetCurrentWord, 0, WindowID(1))
		timeout = ElapsedMilliseconds() + #timeout ; maximal 5 sekunden warten
		Repeat
			WindowEvent()
			Delay(1)
		Until jaPBe_CurrentWord Or ElapsedMilliseconds() > timeout
	EndIf
	ProcedureReturn jaPBe_CurrentWord
EndProcedure
Procedure.s jaPBe_GetCurrentWordS() ; Returns a String with the Word under the cursor or 0 if no word under the cursor
	Result = jaPBe_GetCurrentWord()
	If Result
		ProcedureReturn PeekS(Result)
	Else
		ProcedureReturn ""
	EndIf
EndProcedure
Procedure jaPBe_GetCompleteText() ; Returns a address with the complete text or 0 if no text
	If jaPBe_CompleteText
		GlobalFree_(jaPBe_CompleteText)
		jaPBe_CompleteText = 0
	EndIf
	If SendMessage_(jaPBe_Handle, #mywm_plugin_GetCompleteText, 0, WindowID(1))
		timeout = ElapsedMilliseconds() + #timeout ; maximal 5 sekunden warten
		Repeat
			WindowEvent()
			Delay(1)
		Until jaPBe_CompleteText Or ElapsedMilliseconds() > timeout
	EndIf
	ProcedureReturn jaPBe_CompleteText
EndProcedure
Procedure.s jaPBe_GetCompleteTextS() ; Returns a String with the complete text
	Result = jaPBe_GetCompleteText()
	If Result
		ProcedureReturn PeekS(Result)
	Else
		ProcedureReturn ""
	EndIf
EndProcedure
Procedure jaPBe_GetCurrentLine() ; Returns a address with the current line or 0, if the line is empty
	If jaPBe_CurrentLine
		GlobalFree_(jaPBe_CurrentLine)
		jaPBe_CurrentLine = 0
	EndIf
	If SendMessage_(jaPBe_Handle, #mywm_plugin_GetCurrentLine, 0, WindowID(1))
		timeout = ElapsedMilliseconds() + #timeout ; maximal 5 sekunden warten
		Repeat
			WindowEvent()
			Delay(1)
		Until jaPBe_CurrentLine Or ElapsedMilliseconds() > timeout
	EndIf
	ProcedureReturn jaPBe_CurrentLine
EndProcedure
Procedure.s jaPBe_GetCurrentLineS() ; Returns a String with the current line
	Result = jaPBe_GetCurrentLine()
	If Result
		ProcedureReturn PeekS(Result)
	Else
		ProcedureReturn ""
	EndIf
EndProcedure
Procedure WaitForCompilerMsg_()
	Repeat
		WindowEvent() : Delay(100)
	Until jaPBe_CompilerType
EndProcedure
Procedure jaPBe_CompileRun() ; Compile and Run the current SourceCode 0=Error, returns #comp_...; jaPBe_CompilerMsg contains message
	jaPBe_CompilerType = 0
	If SendMessage_(jaPBe_Handle, #mywm_Plugin_CompileRun, 0, WindowID(1))
		WaitForCompilerMsg_()
	EndIf
	ProcedureReturn jaPBe_CompilerType
EndProcedure
Procedure jaPBe_CompileDebug() ; Compile and Run the current SourceCode 0=Error, returns #comp_...; jaPBe_CompilerMsg contains message
	jaPBe_CompilerType = 0
	If SendMessage_(jaPBe_Handle, #mywm_Plugin_CompileDebug, 0, WindowID(1))
		WaitForCompilerMsg_()
	EndIf
	ProcedureReturn jaPBe_CompilerType
EndProcedure
Procedure jaPBe_Run() ; Run the last compiled SourceCode 0=Error
	ProcedureReturn SendMessage_(jaPBe_Handle, #mywm_plugin_Run, 0, WindowID(1))
EndProcedure
Procedure jaPBe_CreateExecutable() ; Create a Executable 0=Error, returns #comp_; jaPBe_CompilerMsg contains message
	jaPBe_CompilerType = 0
	If SendMessage_(jaPBe_Handle, #mywm_plugin_CreateExecutable, 0, WindowID(1))
		WaitForCompilerMsg_()
	EndIf
	ProcedureReturn jaPBe_CompilerType
EndProcedure
Procedure jaPBe_IncreaseBuild() ; Increase the build-counter of the current-main-file
	ProcedureReturn SendMessage_(jaPBe_Handle, #mywm_Plugin_IncreaseBuild, 0, WindowID(1))
EndProcedure
; get without windowevent
Procedure jaPBe_GetCurrentPos()
	ProcedureReturn SendMessage_(jaPBe_Handle, #mywm_plugin_GetCurrentPosition, 0, WindowID(1))
EndProcedure
Procedure jaPBe_Active()
	GetWindowThreadProcessId_(jaPBe_Handle, @EditorProcessID)
	ProcessHandle = OpenProcess_(#PROCESS_QUERY_INFORMATION, 0, EditorProcessID)
	a = GetExitCodeProcess_(ProcessHandle, @b)
	If b <> $103 Or a = 0 ; still_active
		Result = #False
	Else
		Result = #True
	EndIf
	CloseHandle_(ProcessHandle)
	ProcedureReturn Result
EndProcedure

If OpenWindow(1, 0, 200, 200, 200, "jaPBe-Plugin", #PB_Window_Invisible)
	SetWindowCallback(@Callback())
	a$ = ProgramParameter()
	If a$ = "jaPBe"
		jaPBe_Handle = Val(ProgramParameter())
		jaPBe_Version$ = ProgramParameter()
		
		;- here is space for your plugin
		; by default, the japbe-editor is disabled while the plugin runs.
		; when you want, that the editor should work, call
		; jaPBe_EnablejaPBe()
		
		
		
		; Important: Never delete the follow line!
		PostMessage_(jaPBe_Handle, #mywm_Plugin_Cancel, 0, WindowID(1))
	Else
		MessageRequester("jaPBe Plugin", "This is a jaPBe-Plugin" + Chr(10) + "You can't run it without jaPBe" + Chr(10) + Chr(10) + "To install Plugin automatically, select 'jaPBe.exe' in next requester.", 0)
		jaPBe_Path.s = OpenFileRequester("Select jaPBe to install plugin automatically", "", "jaPBe.exe|jaPBe.exe", 0)
		If jaPBe_Path And LCase(GetFilePart(jaPBe_Path)) = "japbe.exe"
			If CopyFile(ProgramFilename(), GetPathPart(jaPBe_Path) + "Plugin\" + GetFilePart(ProgramFilename()))
				MessageRequester("jaPBe Plugin", "Your plugin is installed, you will find it in menu 'Tools' of jaPBe." + Chr(10) + "(If jaPBe is open, restart it)")
			Else
				MessageRequester("jaPBe Plugin error", "Can't install plugin !")
			EndIf
		EndIf
	EndIf
	CloseWindow(1)
Else
	MessageRequester("jaPBe Plugin", "Can't open a window!", 0)
EndIf

; Free some stuff
If jaPBe_Selection
	GlobalFree_(jaPBe_Selection)
EndIf
If jaPBe_CurrentWord
	GlobalFree_(jaPBe_CurrentWord)
EndIf
If jaPBe_CompleteText
	GlobalFree_(jaPBe_CompleteText)
EndIf
If jaPBe_CurrentLine
	GlobalFree_(jaPBe_CurrentLine)
EndIf

End
LSI
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: jaPBe 3.12.2 [IDE for PB 4.xx]

Post by gnozal »

Le Soldat Inconnu wrote:I propose this code for example do to jaPBe plugin, is for PB 4.00 or more and i had auto installation in jaPBe Plugin folder if plugin is running without jaPBe.
Thanks, I will add it to the jaPBe installer.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply