Of better make it optional, because I like it the way it is.PB wrote:A suggestion for GPI: Perhaps save the Version info for a source in a different
file than the source? I opened one of my apps in the PureBasic editor and
after saving it, all my Version info was gone.
jaPBe 2.5.2.6 - beta-release
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
- Le Soldat Inconnu
- Enthusiast
- Posts: 306
- Joined: Wed Jul 09, 2003 11:33 am
- Location: France
-
- Enthusiast
- Posts: 613
- Joined: Tue May 06, 2003 2:50 pm
- Location: Germany
- Contact:
It's a little bit more typing, but tryLe Soldat Inconnu wrote: It's very useful if we can add news terms for indentation rules
Code: Select all
CompilerIf a=b ;>
doSomethingHere()
CompilerElse ;=
doSomethingElse()
CompilerEndif ;<
<°)))o><²³
- Le Soldat Inconnu
- Enthusiast
- Posts: 306
- Joined: Wed Jul 09, 2003 11:33 am
- Location: France
Hello
I do the modification
i used the same way as my program PBSyntax (this program make indentation)
So you can add term for indentation or remove term.
Change :
I create a preference file file where are save indentation word
Name : "Indentation.txt"
You must create this file in the same folder of jabpe
This file contains :
You can placed this procedure after "Procedure LoadList_Skin()"
and add this line "LoadList_Indentation() ; LSI" here
In the "Common.pbi"
You must change the structure FIC_Information by this
You must add a new structure
You must create a new list
In the file Editor-Core.pbi
You must replace the procedure "FindIndentationChange" by this
And replace the procedure "ChangeIndentation" by this
And compile
Now, you can edit the file Indentation.txt to add or remove indentation word
You can download this to test my modification : (autocompletion don't work with this change)
http://perso.wanadoo.fr/lesoldatinconnu ... /jaPBe.zip (250ko)
What do you thinks about this ?
I do the modification

i used the same way as my program PBSyntax (this program make indentation)
So you can add term for indentation or remove term.
Change :
I create a preference file file where are save indentation word
Name : "Indentation.txt"
You must create this file in the same folder of jabpe
This file contains :
In the file jaPBe.pb, I add the procedure which load indentation word; Word In Out
select 2 0
case 1 1
default 1 1
endselect 0 2
for 1 0
foreach 1 0
next 0 1
if 1 0
else 1 1
elseif 1 1
endif 0 1
opensubmenu 1 0
closesubmenu 0 1
procedure 1 0
proceduredll 1 0
procedurecdll 1 0
endprocedure 0 1
repeat 1 0
until 0 1
forever 0 1
structure 1 0
endstructure 0 1
while 1 0
wend 0 1
datasection 1 0
enddatasection 0 1
enumeration 1 0
endenumeration 0 1
interface 1 0
endinterface 0 1
startdrawing 1 0
stopdrawing 0 1
containergadget 1 0
panelgadget 1 0
scrollareagadget 1 0
opengadgetlist 1 0
closegadgetlist 0 1
start3d 1 0
stop3d 0 1
compilerif 1 0
compilerelse 1 1
compilerelseif 1 1
compilerendif 0 1
Code: Select all
Procedure LoadList_Indentation() ; Load indentation word : LSI
Protected Txt.s
If OpenFile(0, "Indentation.txt")
Repeat
Txt.s = Trim(ReadString())
If Txt And Left(Txt, 1) <> ";"
AddElement(IndentationWord())
IndentationWord()\_Word = Trim(StringField(Txt, 1, Chr(9)))
IndentationWord()\_Len = Len(IndentationWord()\_Word)
IndentationWord()\_In = Val(Trim(StringField(Txt, 2, Chr(9))))
IndentationWord()\_Out = Val(Trim(StringField(Txt, 3, Chr(9))))
EndIf
Until Eof(0)
CloseFile(0)
EndIf
EndProcedure
and add this line "LoadList_Indentation() ; LSI" here
Code: Select all
;-Start of editor
LoadList_IncludePack()
LoadList_Definitions()
LoadList_Styles()
LoadList_Language()
LoadList_Skin()
LoadList_Indentation() ; LSI
preference_load()
CreateCustomButtons()
In the "Common.pbi"
You must change the structure FIC_Information by this
Code: Select all
Structure FIC_Information; Indentation : LSI
_In.l ; LSI
_Out.l ; LSI
; _if.l
; _else.l
; _endif.l
; _elseif.l
; _Select.l
; _case.l
; _endselect.l
; _wend.l
; _while.l
; _until.l
; _repeat.l
; _procedure.l
; _endprocedure.l
; _for.l
; _next.l
; _structure.l
; _endstructure.l
; _enumeration.l
; _endenumeration.l
; _interface.l
; _endinterface.l
; _structureunion.l
; _endstructureunion.l
; _manualIn.l
; _manualOut.l
; _manualSame.l
EmptyLine.l
EndStructure
Code: Select all
Structure IndentationWord_Information ; Definition of indentation words : LSI
_Len.l
_Word.s
_In.l
_Out.l
EndStructure
Code: Select all
NewList IndentationWord.IndentationWord_Information() ; List contained word use in indentation : LSI
In the file Editor-Core.pbi
You must replace the procedure "FindIndentationChange" by this
Code: Select all
Procedure FindIndentationChange(line,*Result.FIC_Information)
*Result\EmptyLine=0
*Result\_In=0 ; LSI
*Result\_Out=0 ; LSI
; *Result\_manualIn=0
; *Result\_manualOut=0
; *Result\_manualSame=0
; *Result\_if=0
; *Result\_else=0
; *Result\_endif=0
; *Result\_elseif=0
; *Result\_Select=0
; *Result\_case=0
; *Result\_endselect=0
; *Result\_wend=0
; *Result\_while=0
; *Result\_until=0
; *Result\_repeat=0
; *Result\_procedure=0
; *Result\_endprocedure=0
; *Result\_for=0
; *Result\_next=0
; *Result\_structure=0
; *Result\_endstructure=0
; *Result\_structureunion=0
; *Result\_endstructureunion=0
; *Result\_enumeration=0
; *Result\_endenumeration=0
; *Result\_interface=0
; *Result\_endinterface=0
length=SCI_LineLength(line)
memhandle=AllocateMemory(length+10)
adr=memhandle+5
If adr
If SCI_GetLine(line,adr)
*buf.BYTE=adr
While *buf\b=13 Or *buf\b=10 Or *buf\b=' ' Or *buf\b=8
*buf+1
Wend
If *buf\b=';' Or *buf\b=0
*Result\EmptyLine=#True
Else
*buf.BYTE=adr
Repeat
While AllowedChars(*buf\b&$FF)=#False And *buf\b<>0
Select *buf\b&$FF
Case '#'
*buf+1
While AllowedChars(*buf\b&$FF)
*buf+1
Wend
Case 39
*buf+1
While *buf\b&$FF<>39 And *buf\b<>0
*buf+1
Wend
If *buf\b=39
*buf+1
EndIf
Case '"'
*buf+1
While *buf\b&$FF<>'"' And *buf\b<>0
*buf+1
Wend
If *buf\b='"'
*buf+1
EndIf
Case ';'
Select PeekB(*buf+1)&$FF
; Case '>':*Result\_manualIn+1
; Case '=':*Result\_manualSame+1
; Case '<':*Result\_manualOut+1
Case '>' : *Result\_In + 1 ; manual indentation : LSI
Case '=' : *Result\_In + 1 : *Result\_Out + 1
Case '<' : *Result\_Out + 1
EndSelect
*buf\b=0
Default
*buf+1
EndSelect
Wend
*WordStart.BYTE=*buf
While AllowedChars(*buf\b&$FF)
*buf+1
Wend
LenWord.l = *buf-*WordStart ; Search indentation word : LSI
ForEach IndentationWord()
If LenWord = IndentationWord()\_Len
If CompareMemoryString(*WordStart, @IndentationWord()\_Word, 1, LenWord)=0
*Result\_In + IndentationWord()\_In
*Result\_Out + IndentationWord()\_Out
EndIf
EndIf
Next
; Select *buf-*WordStart
; Case 2
; If CompareMemoryString(*WordStart,@"If",1,2)=0
; *Result\_if+1
; EndIf
; Case 3
; If CompareMemoryString(*WordStart,@"For",1,3)=0
; *Result\_for+1
; EndIf
; Case 4
; If CompareMemoryString(*WordStart,@"Else",1,4)=0
; If *Result\_if=0
; *Result\_else+1
; EndIf
; ElseIf CompareMemoryString(*WordStart,@"Case",1,4)=0
; If *Result\_Select=0
; *Result\_case=1
; EndIf
; ElseIf CompareMemoryString(*WordStart,@"Wend",1,4)=0
; If *Result\_while
; *Result\_while-1
; Else
; *Result\_wend+1
; EndIf
; ElseIf CompareMemoryString(*WordStart,@"Next",1,4)=0
; If *Result\_for
; *Result\_for-1
; Else
; *Result\_next+1
; EndIf
; EndIf
; Case 5
; If CompareMemoryString(*WordStart,@"EndIf",1,5)=0
; If *Result\_if
; *Result\_if-1
; Else
; *Result\_endif+1
; EndIf
; ElseIf CompareMemoryString(*WordStart,@"While",1,5)=0
; *Result\_while+1
; ElseIf CompareMemoryString(*WordStart,@"Until",1,5)=0
; If *Result\_repeat
; *Result\_repeat-1
; Else
; *Result\_until+1
; EndIf
; EndIf
; Case 6
; If CompareMemoryString(*WordStart,@"Repeat",1,6)=0
; *Result\_repeat+1
; ElseIf CompareMemoryString(*WordStart,@"Select",1,6)=0
; *Result\_Select+1
; ElseIf CompareMemoryString(*WordStart,@"ElseIf",1,6)=0
; If *Result\_if=0
; *Result\_elseif+1
; EndIf
; EndIf
; Case 7
; If CompareMemoryString(*WordStart,@"Default",1,7)=0
; If *Result\_Select=0
; *Result\_case+1
; EndIf
; ElseIf CompareMemoryString(*WordStart,@"ForEver",1,7)=0
; If *Result\_repeat
; *Result\_repeat-1
; Else
; *Result\_until+1
; EndIf
; ElseIf CompareMemoryString(*WordStart,@"ForEach",1,7)=0
; *Result\_for+1
; EndIf
; Case 9
; If CompareMemoryString(*WordStart,@"EndSelect",1,9)=0
; If *Result\_Select
; *Result\_Select-1
; Else
; *Result\_endselect+1
; EndIf
; ElseIf CompareMemoryString(*WordStart,@"Procedure",1,9)=0
; *Result\_procedure+1
; ElseIf CompareMemoryString(*WordStart,@"Structure",1,9)=0
; *Result\_structure+1
; ElseIf CompareMemoryString(*WordStart,@"Interface",1,9)=0
; *Result\_interface+1
; EndIf
; Case 11
; If CompareMemoryString(*WordStart,@"Enumeration",1,11)=0
; *Result\_enumeration+1
; EndIf
; Case 12
; If CompareMemoryString(*WordStart,@"EndProcedure",1,12)=0
; If *Result\_procedure
; *Result\_procedure-1
; Else
; *Result\_endprocedure+1
; EndIf
; ElseIf CompareMemoryString(*WordStart,@"ProcedureDLL",1,12)=0
; *Result\_procedure+1
; ElseIf CompareMemoryString(*WordStart,@"EndStructure",1,12)=0
; If *Result\_structure
; *Result\_structure-1
; Else
; *Result\_endstructure+1
; EndIf
; ElseIf CompareMemoryString(*WordStart,@"EndInterface",1,12)=0
; If *Result\_interface
; *Result\_interface-1
; Else
; *Result\_endinterface+1
; EndIf
; EndIf
; Case 13
; If CompareMemoryString(*WordStart,@"ProcedureCDLL",1,12)=0
; *Result\_procedure+1
; EndIf
; Case 14
; If CompareMemoryString(*WordStart,@"StructureUnion",1,14)=0
; *Result\_structureunion+1
; ElseIf CompareMemoryString(*WordStart,@"EndEnumeration",1,14)=0
; If *Result\_enumeration
; *Result\_enumeration-1
; Else
; *Result\_endenumeration+1
; EndIf
; EndIf
; Case 17
; If CompareMemoryString(*WordStart,@"EndStructureUnion",1,17)=0
; If *Result\_structureunion
; *Result\_structureunion-1
; Else
; *Result\_endstructureunion+1
; EndIf
; EndIf
; EndSelect
Until *buf\b=0
EndIf
EndIf
FreeMemory(memhandle)
EndIf
EndProcedure
Code: Select all
Procedure ChangeIndentation(line,ChangePos)
If Sources()\SourceType<>#SourceType_PureBasic
ProcedureReturn #False
EndIf
If line>=SCI_GetLineCount()
ProcedureReturn 0
EndIf
If line>-1
change=0:offset=0:dochange=0
If AutoInsert
FindIndentationChange(line,LineFlag.FIC_Information)
offset+(Tab*LineFlag\_In) ; LSI
; offset+(Tab*LineFlag\_manualIn)
; offset+(Tab*LineFlag\_manualSame)
; offset+(Tab*LineFlag\_if)
; offset+(Tab*LineFlag\_elseif)
; offset+(Tab*LineFlag\_else)
; offset+(Tab*LineFlag\_Select)
; offset+(Tab*LineFlag\_case)
; offset+(Tab*LineFlag\_while)
; offset+(Tab*LineFlag\_repeat)
; offset+(Tab*LineFlag\_procedure)
; offset+(Tab*LineFlag\_structure)
; offset+(Tab*LineFlag\_structureunion)
; offset+(Tab*LineFlag\_interface)
; offset+(Tab*LineFlag\_enumeration)
; offset+(Tab*LineFlag\_for)
If line>0
xLine=line
BeforeFlag.FIC_Information
BeforeFlag\EmptyLine=#True
Repeat
If BeforeFlag\EmptyLine=#True
xLine-1
EndIf
FindIndentationChange(xLine,BeforeFlag.FIC_Information)
Until xLine<=0 Or BeforeFlag\EmptyLine=0
change+(Tab*BeforeFlag\_In) : dochange+BeforeFlag\_In ; LSI
; change+(Tab*BeforeFlag\_manualIn) :dochange+BeforeFlag\_manualIn
; change+(Tab*BeforeFlag\_manualSame):dochange+BeforeFlag\_manualSame
; change+(Tab*BeforeFlag\_if) :dochange+BeforeFlag\_if
; change+(Tab*BeforeFlag\_elseif) :dochange+BeforeFlag\_elseif
; change+(Tab*BeforeFlag\_else) :dochange+BeforeFlag\_else
; change+(Tab*BeforeFlag\_Select) :dochange+BeforeFlag\_Select
; change+(Tab*BeforeFlag\_case) :dochange+BeforeFlag\_case
; change+(Tab*BeforeFlag\_while) :dochange+BeforeFlag\_while
; change+(Tab*BeforeFlag\_repeat) :dochange+BeforeFlag\_repeat
; change+(Tab*BeforeFlag\_procedure):dochange+BeforeFlag\_procedure
; change+(Tab*BeforeFlag\_structure):dochange+BeforeFlag\_structure
; change+(Tab*BeforeFlag\_structureunion):dochange+BeforeFlag\_structureunion
; change+(Tab*BeforeFlag\_interface):dochange+BeforeFlag\_interface
; change+(Tab*BeforeFlag\_enumeration):dochange+BeforeFlag\_enumeration
; change+(Tab*BeforeFlag\_for) :dochange+BeforeFlag\_for
Else
BeforeFlag.FIC_Information
EndIf
change-(Tab*LineFlag\_Out) : dochange + LineFlag\_Out ; LSI
; While LineFlag\_manualOut
; dochange=#True
; LineFlag\_manualOut-1
; change-Tab
; Wend
; While LineFlag\_manualSame
; LineFlag\_manualSame-1
; change-Tab:dochange=#True
; ;offset+Tab
; Wend
; While LineFlag\_endif
; dochange=#True
; LineFlag\_endif-1
; change-Tab
; Wend
; While LineFlag\_elseif
; LineFlag\_elseif-1
; change-Tab:dochange=#True
; Wend
; While LineFlag\_else
; LineFlag\_else-1
; change-Tab:dochange=#True
; ;offset+Tab
; Wend
; While LineFlag\_case
; LineFlag\_case-1
; If BeforeFlag\_case Or BeforeFlag\_Select=0
; change-Tab:dochange=#True
; EndIf
; Wend
; While LineFlag\_endselect
; LineFlag\_endselect-1
; If BeforeFlag\_Select=0
; change-(Tab+Tab):dochange=#True
; Else
; BeforeFlag\_Select-1
; change-Tab:dochange=#True
; EndIf
; Wend
; change-(Tab*LineFlag\_wend): dochange+LineFlag\_wend
; change-(Tab*LineFlag\_until): dochange+LineFlag\_until
; change-(Tab*LineFlag\_endprocedure): dochange+LineFlag\_endprocedure
; change-(Tab*LineFlag\_endstructure): dochange+LineFlag\_endstructure
; change-(Tab*LineFlag\_endstructureunion): dochange+LineFlag\_endstructureunion
; change-(Tab*LineFlag\_endenumeration): dochange+LineFlag\_endenumeration
; change-(Tab*LineFlag\_endinterface): dochange+LineFlag\_endinterface
; change-(Tab*LineFlag\_next): dochange+LineFlag\_next
ok=#True
If xLine>=0
len=SCI_GetLineIndentation(xLine)
If dochange Or SCI_GetLineIndentation(line)<>len
len+change
;Debug " Offset:"+Str(SCI_GetLineIndentation(xLine))+" "+Str(change)
len=(len/Tab)*Tab
If LineFlag\EmptyLine=0
SCI_SetLineIndentation(line,len)
EndIf
ok=#False
EndIf
EndIf
If ok
len=SCI_GetLineIndentation(line)
len=(len/Tab)*Tab
EndIf
len+offset
If len>0
If ChangePos
SCI_SetLineIndentation(line+1,len)
EndIf
If ChangePos=2
Pos=SCI_PositionFromLine(line+1)
SCI_GotoPos(Pos+len)
EndIf
SpaceAdded=#True
Else
SpaceAdded=#False
EndIf
EndIf
EndIf
EndProcedure
And compile

Now, you can edit the file Indentation.txt to add or remove indentation word

You can download this to test my modification : (autocompletion don't work with this change)
http://perso.wanadoo.fr/lesoldatinconnu ... /jaPBe.zip (250ko)
What do you thinks about this ?
LSI
- Le Soldat Inconnu
- Enthusiast
- Posts: 306
- Joined: Wed Jul 09, 2003 11:33 am
- Location: France
My modification works now with autocompletion
Autocompletion word is in the file "indentation.txt".
For example, if i write StartDrawing(...) , autocompletion write StopDrawing().
if you edit the "indentation.txt" file, you can add or remove word use by autocompletion.
And I add modified files in the zip (see my previous message to download it)
To find modification, search "LSI" in the file

Autocompletion word is in the file "indentation.txt".
For example, if i write StartDrawing(...) , autocompletion write StopDrawing().
if you edit the "indentation.txt" file, you can add or remove word use by autocompletion.
And I add modified files in the zip (see my previous message to download it)
To find modification, search "LSI" in the file

LSI
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
I agree.good, it is what was missing to jaPBe.
@GPI : it would be nice to see this feature in the next 'official' jaPBe releases.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
- Le Soldat Inconnu
- Enthusiast
- Posts: 306
- Joined: Wed Jul 09, 2003 11:33 am
- Location: France
- Le Soldat Inconnu
- Enthusiast
- Posts: 306
- Joined: Wed Jul 09, 2003 11:33 am
- Location: France
I finish
http://perso.wanadoo.fr/lesoldatinconnu ... /jaPBe.zip (340ko)
Source files are included in the zip, search "LSI" to find my modification.
See jaPBe preference to edit indentation and autocompletation keywords
What do you think about that ?
GPI, tell me your opinion about my idea and about my modification, thanks

http://perso.wanadoo.fr/lesoldatinconnu ... /jaPBe.zip (340ko)
Source files are included in the zip, search "LSI" to find my modification.
See jaPBe preference to edit indentation and autocompletation keywords

What do you think about that ?
GPI, tell me your opinion about my idea and about my modification, thanks

LSI
- Le Soldat Inconnu
- Enthusiast
- Posts: 306
- Joined: Wed Jul 09, 2003 11:33 am
- Location: France
I correct an error with DataSection and EndDataSection case
and i correct an other error when you change the language
Edit : An other error, i write twice ProcedureDLL in indentation keywords.
So you can delete a ProcedureDLL keywords in preferences to correct this problem if you are already download my modification
and i correct an other error when you change the language
Edit : An other error, i write twice ProcedureDLL in indentation keywords.
So you can delete a ProcedureDLL keywords in preferences to correct this problem if you are already download my modification

LSI