Page 6 of 7

Re: PBEdit - a Canvas-based Texteditor

Posted: Wed May 11, 2022 1:33 pm
by Danilo
Mr.L wrote: Wed May 11, 2022 12:20 pm What PB-Version are you using?
PB 5.73 LTS (x64) on macOS.

EDIT: Tested also PB 6.00 beta7 (x64), same problems
Mr.L wrote: Wed May 11, 2022 12:20 pm Have you set "Threadsafe" on?
Yes.
Mr.L wrote: Wed May 11, 2022 12:20 pm What happens if you compile in debug mode?
It outputs 2 numbers ("Debug *view" inside View_Delete()) and then crashes, the app stops responding. I have to kill the app.

Re: PBEdit - a Canvas-based Texteditor

Posted: Sun Jan 01, 2023 9:35 pm
by Kapslok
Hi PBEdit folks!

I was levitating for a while when I saw this wonderful gadget. Thank you, Mr L!
Very beautiful code. Even I could follow & learn from it.

I've been modifying one PBEdit version for a special use. This covers retro-computing
and cross-developing for the Amiga (OCS/AGA) computers (most likely from Linux and
Raspberry devices). Scintilla gadget was good, but this is even better for the purpose.

I'll be in contact when the release is ready. I've spent some 3 years now to develop a new
language (similarities to PureBasic (and BlitzBasic) are inevitable ;).

Thank you!

Re: PBEdit - a Canvas-based Texteditor

Posted: Mon Jan 02, 2023 3:37 pm
by ShadowStorm
Kapslok wrote: Sun Jan 01, 2023 9:35 pm I'll be in contact when the release is ready. I've spent some 3 years now to develop a new
language (similarities to PureBasic (and BlitzBasic) are inevitable ;).

Thank you!
Hello, Well I'd be curious to see that! :)

Re: PBEdit - a Canvas-based Texteditor

Posted: Mon Jan 02, 2023 4:17 pm
by RNBW
Unfortunately, I get an error "Line 11372 ToolBarStandardButton() is not a function, array, list, map or macro".

I am using Purebasic 6.00 LTS(x64) and Windows 11.

Re: PBEdit - a Canvas-based Texteditor

Posted: Mon Jan 02, 2023 5:13 pm
by ChrisR
ToolBarStandardButton() is obsolete now since v6.0, the toolbar was ugly in high resolution after adding DPI support.
Replace them by using ToolBarImageButton()
However, ToolBarStandardButton() is still in the help without any explanation.

Personally I use version 1.10 and I like it. I have some issues with latest version 1.11 that I did not have with the previous version 1.10

Re: PBEdit - a Canvas-based Texteditor

Posted: Mon Jan 02, 2023 6:16 pm
by RNBW
ChrisR wrote: Mon Jan 02, 2023 5:13 pm ToolBarStandardButton() is obsolete now since v6.0, the toolbar was ugly in high resolution after adding DPI support.
Replace them by using ToolBarImageButton()
However, ToolBarStandardButton() is still in the help without any explanation.

Personally I use version 1.10 and I like it. I have some issues with latest version 1.11 that I did not have with the previous version 1.10
Thanks for the info. I'll look up ToolBarImageButton() and replace it in the code. I'll also see if I can download version 1.10 and give that a try also.

Re: PBEdit - a Canvas-based Texteditor

Posted: Mon Jan 02, 2023 6:28 pm
by ChrisR
Temporarily, version 1.10 is available here

I don't remember the troubles I had with latest version but probably better to try with it and report any bugs found.
For Mr.L, to continue to improve this wonderful tool 8)

Re: PBEdit - a Canvas-based Texteditor

Posted: Mon Jan 02, 2023 6:43 pm
by RNBW
ChrisR wrote: Mon Jan 02, 2023 6:28 pm Temporarily, version 1.10 is available here

I don't remember the troubles I had with latest version but probably better to try with it and report any bugs found.
For Mr.L, to continue to improve this wonderful tool 8)
You have just read my mind and I was going to ask for a link. I have downloaded the zip file.

However, with version 1.11, I changed to ToolbarImage(), but it came up with error that the second parameter couldn't be found.

And the same problem has arisen with version 1.10.

Re: PBEdit - a Canvas-based Texteditor

Posted: Mon Jan 02, 2023 6:58 pm
by ChrisR
There is a bit more to do for ToolBarImageButton(), you can do it with something like this:

Code: Select all

UsePNGImageDecoder()

Define Image = CatchImage(#PB_Any, ?ToolBarIcon_Redo)
ToolBarImageButton(#tlb_redo, ImageID(Image))
FreeImage(Image)
Image = CatchImage(#PB_Any, ?ToolBarIcon_Undo)
ToolBarImageButton(#tlb_undo, ImageID(Image))
FreeImage(Image)

DataSection
ToolBarIcon_Redo: : IncludeBinary #PB_Compiler_Home + "examples/sources/Data/ToolBar/Redo.png"
ToolBarIcon_Undo: : IncludeBinary #PB_Compiler_Home + "examples/sources/Data/ToolBar/Undo.png"
EndDataSection

Or you can use mk-soft's ToolBarStandardButton for all OS Module

Re: PBEdit - a Canvas-based Texteditor

Posted: Tue Jan 03, 2023 2:03 pm
by RNBW
ChrisR
Thank you for your help. I've tried both methods, placing the code at the head of the program, but I couldn't get either to work.

I guess I'll stick with either your designer or the Purebasic editor for the present.

Re: PBEdit - a Canvas-based Texteditor

Posted: Tue Jan 03, 2023 11:56 pm
by ChrisR
RNBW wrote: Tue Jan 03, 2023 2:03 pm I guess I'll stick with either your designer or the Purebasic editor for the present.
It's a good idea, you're welcome :)

Otherwise, temporarily, here are the 2 versions with ToolBarStandardButton() changed to ToolBarImageButton() to be compatible with version 6.0:
PBEdit_1_10.zip
PBEdit_1_11.zip

Re: PBEdit - a Canvas-based Texteditor

Posted: Wed Jan 04, 2023 11:34 am
by Mesa
Some files updates:

Lang:
PBEdit_FR.cfg

Code: Select all

[FindReplace]
wnd_findReplace = Chercher/Remplacer
txt_search = Rechercher
chk_replace = Remplacer avec
chk_caseSensitive = Respecter la casse
chk_wholeWords = Mot entier seulement
chk_insideSelection = Chercher dans la sélection
chk_noComments = Ignorer les commentaires
chk_noStrings = Ignorer les chaînes
chk_regEx = Expression régulière
btn_findNext = Suivant
btn_findPrevious = Précédent
btn_replace = Remplacer
btn_replaceAll = Remplacer tout
btn_close = Fermer

[PopupMenu]
Cut = Couper\t\t\t\t\tCtrl+X
Copy = Copier\t\t\t\t\tCtrl+C
Paste = Coller\t\t\t\t\tCtrl+V
InsertComments = Insérer commentaire\t\t\t\t\tCtrl+B
RemoveComments = Supprimer les commentaires\t\t\t\t\tCtrl+Shift+B
FormatIndentation = Format indentation\t\t\t\t\tCtrl+I
ToggleFold = Changer le pliage courant\t\t\t\t\tF4
ToggleAllFolds = Plier/déplier tout\t\t\t\t\tCtrl+F4
SplitView = Vue partagée
Horizontal = Horizontal
Vertical = Vertical
UnsplitView = Vue non partagée
Beautify = Surligner\t\t\t\t\tCtrl+Alt+B
Select All = Sélectionner tout\t\t\t\t\tCtrl+A

[Messages]
WarningTitle = Avertissement
WarningLongText = Texte très long (%N1 caractères) à %N2 emplacements.\nInsérer quand même ?

ErrorTitle = Erreur
ErrorRegEx = Erreur dans une expression régulière
ErrorNotFound = %N1\nnon trouvé

GotoTitle = Aller à...
GotoMessage = Numéro de ligne

MessageTitleFindReplace = Chercher/Remplacer
MessageNoMoreMatches = Pas d'autres résultats trouvés.
MessageNoMoreMatchesEnd = Aucun autre résultat trouvé. Voulez-vous effectuer une recherche à partir de la fin du fichier ?
MessageNoMoreMatchesStart = Plus de résultats trouvés. Voulez-vous effectuer une recherche depuis le début du fichier ?
MessageReplaceComplete = Rechercher/Remplacer terminé.\n%N1 résultats trouvés.
PBEdit_FR2.cfg

Code: Select all

[FindReplace]
wnd_findReplace = Rechercher/Remplacer
txt_search = Rechercher
chk_replace = Remplacer par
chk_caseSensitive = Respecter la casse
chk_wholeWords = Tous les mots
chk_insideSelection = Sélection
chk_noComments = Hors commentaires
chk_noStrings = Hors chaînes de caractères
chk_regEx = Expression régulière 
btn_findNext = Suivant
btn_findPrevious = Précédent
btn_replace = Remplacer
btn_replaceAll = Remplacer tout
btn_close = Fermer

[PopupMenu]
Cut = Couper\tCtrl+X
Copy = Copier\tCtrl+C
Paste = Coller\tCtrl+V
InsertComments = Insérer un commentaire\tCtrl+B
RemoveComments = Supprimer un commentaire\tCtrl+MAj+B
FormatIndentation = Indentation\tCtrl+I
ToggleFold = Changer le pliage courant\tF4
ToggleAllFolds = Changer tous les pliages\tCtrl+F4
SplitView = Vue partagée
Horizontal = Partage horizontal
Vertical = Partage vertical
UnsplitView = Vue non partagée
Beautify = Surligner\tCtrl+Alt+B
Select All = Sélectionner tout\tCtrl+A

[Messages]
WarningTitle = Attention
WarningLongText = Texte très long (%N1 caractères) à %N2 endroits.\nInsérer ?

ErrorTitle = Erreur
ErrorRegEx = Erreur dans l'expression régulière
ErrorNotFound = %N1\nnon trouvé

GotoTitle = Aller à...
GotoMessage = Numéro de ligne

MessageTitleFindReplace = Chercher/Remplacer
MessageNoMoreMatches = Pas d'autres résultats trouvés.
MessageNoMoreMatchesEnd = Aucun autre résultat trouvé. Voulez-vous effectuer une recherche à partir de la fin du fichier ?
MessageNoMoreMatchesStart = Plus de résultats trouvés. Voulez-vous effectuer une recherche depuis le début du fichier ?
MessageReplaceComplete = Rechercher/Remplacer terminé.\n%N1 résultats trouvés.

Style PureBasic original (background yellow, etc.)
PBEdit_PureBasicOriginal.settings

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<PBEditSettings>
	<Settings>
		<Setting name="enableStyling" value="1"/>
		<Setting name="enableScrollBarHorizontal" value="1"/>
		<Setting name="enableScrollBarVertical" value="1"/>
		<Setting name="enableZooming" value="1"/>
		<Setting name="enableLineNumbers" value="1"/>
		<Setting name="enableShowCurrentLine" value="1"/>
		<Setting name="enableFolding" value="1"/>
		<Setting name="enableIndentation" value="1"/>
		<Setting name="enableCaseCorrection" value="1"/>
		<Setting name="enableShowWhiteSpace" value="0"/>
		<Setting name="enableIndentationLines" value="1"/>
		<Setting name="enableHorizontalFoldLines" value="1"/>
		<Setting name="enableAutoComplete" value="1"/>
		<Setting name="enableAutoClosingBracket" value="1"/>
		<Setting name="enableAutoClosingKeyword" value="1"/>
		<Setting name="enableDictionary" value="1"/>
		<Setting name="enableSyntaxHighlight" value="1"/>
		<Setting name="enableBeautify" value="1"/>
		<Setting name="enableMultiCursor" value="1"/>
		<Setting name="enableSplitScreen" value="1"/>
		<Setting name="enableRepeatedSelection" value="1"/>
		<Setting name="enableSelectPastedText" value="0"/>
		<Setting name="enableWordWrap" value="0"/>
		<Setting name="enableReadOnly" value="0"/>
		<Setting name="wordWrapMode" value="None"/>
		<Setting name="wordWrapSize" value="0"/>
		<Setting name="indentationMode" value="Auto"/>
		<Setting name="useRealTab" value="1"/>
		<Setting name="tabSize" value="4"/>
		<Setting name="fontName" value="Consolas"/>
		<Setting name="lineHeight" value="11"/>
		<Setting name="scrollbarWidth" value="15"/>
		<Setting name="topBorderSize" value="5"/>
		<Setting name="leftBorderSize" value="15"/>
		<Setting name="newLineChar" value="10"/>
		<Setting name="foldChar" value="1"/>
		<Setting name="cursorBlinkDelay" value="500"/>
		<Setting name="cursorClickSpeed" value="500"/>
		<Setting name="cursorCompareMode" value="NoCase"/>
		<Setting name="autoCompleteMaxRows" value="10"/>
		<Setting name="autoCompleteMinCharacterCount" value="2"/>
		<Setting name="autoCompleteMode" value="FindAtBegin"/>
		<Setting name="repeatedSelectionMinCharacterCount" value="0"/>
		<Setting name="repeatedselectionmode" value="NoCase|WholeWord"/>
	</Settings>
	
	<Colors>
		<Color name="defaultText" value="0,0,0"/>
		<Color name="selectedText" value="255,255,255"/>
		<Color name="cursor" value="0,0,0"/>
		<Color name="inactiveBackground" value="255,255,255"/>
		<Color name="currentBackground" value="255,255,223"/>
		<Color name="selectionBackground" value="0,0,128"/>
		<Color name="currentLine" value="255,255,223"/>
		<Color name="currentLineBackground" value="255,255,223"/>
		<Color name="currentLineBorder" value="255,255,223"/>
		<Color name="inactiveLineBackground" value="255,255,223"/>
		<Color name="indentationGuides" value="255,255,223"/>
		<Color name="horizontalFoldLines" value="255,255,223"/>
		<Color name="lineNr" value="128,128,128"/>
		<Color name="currentLineNr" value="128,128,128"/>
		<Color name="lineNrBackground" value="255,255,223"/>
		<Color name="foldIcon" value="128,128,128"/>
		<Color name="foldIconBorder" value="128,128,128"/>
		<Color name="foldIconBackground" value="255,255,223"/>
	</Colors>
</PBEditSettings>

PBEdit_PureBasicOriginal.style

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<PBEditStyle>
	<Styling>
		<Style name="NONE" fontNr="0" foreColor="0,0,0" underlineColor=""/>
		<Style name="KEYWORD" fontNr="1" foreColor="0,102,102"/>
		<Style name="FUNCTION" fontNr="0" foreColor="0,102,102"/>
		<Style name="STRUCTURE" fontNr="0" foreColor="0,0,0"/>
		<Style name="TEXT" fontNr="0" foreColor="0,0,0"/>
		<Style name="QUOTE" fontNr="0" foreColor="0,128,255"/>
		<Style name="STRING" fontNr="0" foreColor="0,128,255"/>
		<Style name="COMMENT" fontNr="0" foreColor="0,170,170"/>
		<Style name="NUMBER" fontNr="0" foreColor="0,0,0"/>
		<Style name="POINTER" fontNr="0" foreColor="0,0,0"/>
		<Style name="CONSTANT" fontNr="0" foreColor="146,75,114"/>
		<Style name="OPERATOR" fontNr="0" foreColor="0,0,0"/>
		<Style name="BACKSLASH" fontNr="0" foreColor="0,0,0"/>
		<Style name="COMMA" fontNr="0" foreColor="0,0,0"/>
		<Style name="BRACKET" fontNr="0" foreColor="0,0,0"/>
		<Style name="LABEL" fontNr="0" foreColor="0,0,0"/>
		<Style name="REPEATEDSELECTION" fontNr="" foreColor="" backColor="0,0,128"/>
		<Style name="CODEMATCH" fontNr="1" foreColor="0,0,0" backColor="255,255,223" underlineColor="TextColor"/>
		<Style name="CODEMISMATCH" fontNr="" foreColor="255,128,128" backColor="255,255,223" underlineColor = "TextColor"/>
		<Style name="BRACKETMATCH" fontNr="0" foreColor="0,0,0" backColor="255,255,223"/>
		<Style name="BRACKETMISMATCH" fontNr="0" foreColor="255,0,0" backColor="255,255,223"/>
	</Styling>

	<Keywords>
		<keyword name=";{" style="KEYWORD" fold="1"/>
		<keyword name=";}" style="KEYWORD" fold="-1"/>
		<keyword name="CompilerIf,DeclareModule,Macro,Module" style="KEYWORD" fold="1" indent="0,1"/>
		<keyword name="CompilerEndIf,EndDeclareModule,EndMacro,EndModule" style="KEYWORD" fold="-1" indent="-1,0"/>
		<keyword name="Enumeration,EnumerationBinary,Structure,StructureUnion" style="KEYWORD" indent="0,1"/>
		<keyword name="EndEnumeration,EndStructure,EndStructureUnion" style="KEYWORD" indent="-1,0"/>
        <keyword name="Procedure,ProcedureC,ProcedureCDLL,ProcedureDLL" style="KEYWORD" fold="1" indent="0,1"/>
		<keyword name="EndProcedure" style="KEYWORD" fold="-1" indent="-1,0"/>
		<keyword name="Case,CompilerCase,CompilerDefault,CompilerElse,CompilerElseIf,Default,Else,ElseIf" style="KEYWORD" indent="-1,1"/>
		<keyword name="CompilerEndSelect,EndSelect" style="KEYWORD" indent="-2,0"/>
		<keyword name="CompilerSelect,Select" style="KEYWORD" indent="0,2"/>
		<keyword name="DataSection,For,ForEach,If,Import,ImportC,Interface,Repeat,While,With" style="KEYWORD" indent="0,1"/>
		<keyword name="EndDataSection,EndIf,EndImport,EndInterface,EndWith,ForEver,Next,Until,Wend" style="KEYWORD" indent="-1,0"/>
		<keyword name="Align,And,Array,As,Break,CallDebugger,CompilerError,CompilerWarning,Continue,
		Data,Debug,DebugLevel,Declare,DeclareC,DeclareCDLL,DeclareDLL,Define,Dim,DisableASM,
		DisableDebugger,DisableExplicit,EnableASM,EnableDebugger,EnableExplicit,End,Extends,FakeReturn,
		Global,Gosub,Goto,IncludeBinary,IncludeFile,IncludePath,List,MacroExpandedCount,Map,NewList,
		NewMap,Not,Or,ProcedureReturn,Protected,Prototype,PrototypeC,ReDim,Read,Restore,
		Return,Runtime,Shared,Static,Step,Swap,To,UndefineMacro,UnuseModule,UseModule,XIncludeFile,Xor" style="KEYWORD"/>
	</Keywords>

	<Syntax>
		<SyntaxString name="CompilerIf'CompilerElseIf,CompilerElse,CompilerEndIf'|CompilerElseIf'CompilerElseIf,CompilerElse,CompilerEndIf'|CompilerElse'CompilerEndIf'" flags="COMPILER"/>
		<SyntaxString name="CompilerSelect'CompilerCase,CompilerDefault,CompilerEndSelect'|CompilerCase'CompilerCase,CompilerDefault,CompilerEndSelect'|CompilerDefault'CompilerEndSelect'" flags="COMPILER"/>
		<SyntaxString name="DeclareModule'EndDeclareModule'"/>
		<SyntaxString name="Module'EndModule'" flags="CONTAINER"/>
		<SyntaxString name="Procedure'EndProcedure'" flags="CONTAINER,PROCEDURE"/>
		<SyntaxString name="ProcedureDLL'EndProcedure'" flags="CONTAINER,PROCEDURE"/>
		<SyntaxString name="ProcedureC'EndProcedure'" flags="CONTAINER,PROCEDURE"/>
		<SyntaxString name="ProcedureCDLL'EndProcedure'" flags="CONTAINER,PROCEDURE"/>
		<SyntaxString name="ProcedureReturn" flags="RETURN"/>
		<SyntaxString name="For'To,Step,Next'|To'Step,Next'|Step'Next'" flags="LOOP"/>
		<SyntaxString name="ForEach'Next'" flags="LOOP"/>
		<SyntaxString name="Repeat'Until,Forever'" flags="LOOP"/>
		<SyntaxString name="While'Wend'" flags="LOOP"/>
		<SyntaxString name="Break" flags="BREAK"/>
		<SyntaxString name="Continue" flags="CONTINUE"/>
		<SyntaxString name="EnableASM'DisableASM'"/>
		<SyntaxString name="Macro'EndMacro'" flags="MACRO"/>
		<SyntaxString name="DataSection'Data,EndDataSection'|Data'Data,EndDataSection'"/>
		<SyntaxString name="Enumeration'Step,EndEnumeration'|Step'EndEnumeration'"/>
		<SyntaxString name="EnumerationBinary'Step,EndEnumeration'|Step'EndEnumeration'"/>
		<SyntaxString name="Interface'EndInterface'"/>
		<SyntaxString name="Structure'Extends,EndStructure'|Extends'EndStructure'"/>
		<SyntaxString name="StructureUnion'EndStructureUnion'"/>	
		<SyntaxString name="If'ElseIf,Else,EndIf'|ElseIf'ElseIf,Else,EndIf'|Else'EndIf'"/>
		<SyntaxString name="Select'Case,Default,EndSelect'|Case'Case,To,Default,EndSelect'|To'To,Case,Default,EndSelect'|Default'EndSelect'"/>
		<SyntaxString name="With'EndWith'"/>
		<SyntaxString name="Import'EndImport'"/>
		<SyntaxString name="ImportC'EndImport'"/>
		<SyntaxString name="(')'"/>
		<SyntaxString name="[']'"/>
		<SyntaxString name="{'}'"/>
	</Syntax>
  
	<LineContinuation>
		<Keyword name="+ , | and or xor"/>
	</LineContinuation>

	<Comments>
		<Keyword comment=";"/>
		<Keyword uncomment=""/>
	</Comments>
</PBEditStyle>

Mesa.

Re: PBEdit - a Canvas-based Texteditor

Posted: Wed Jan 04, 2023 7:10 pm
by ChrisR
Thanks Mesa :)

Re: PBEdit - a Canvas-based Texteditor

Posted: Sat Jan 21, 2023 5:05 pm
by Mr.L
Kapslok wrote: Sun Jan 01, 2023 9:35 pm I was levitating for a while when I saw this wonderful gadget. Thank you, Mr L!
Very beautiful code. Even I could follow & learn from it.
Thank you very much! I'm happy you like it :D

Meanwhile I have uploaded v1.12 to GitHub. Hopefully the crashes that Danilo experienced are fixed now...

Here is the link:
https://github.com/zzippyy/PBEdit

Re: PBEdit - a Canvas-based Texteditor

Posted: Sat Jan 21, 2023 5:05 pm
by Mr.L
Kapslok wrote: Sun Jan 01, 2023 9:35 pm I was levitating for a while when I saw this wonderful gadget. Thank you, Mr L!
Very beautiful code. Even I could follow & learn from it.
Thank you very much! I'm happy you like it :D

Meanwhile I have uploaded v1.12 to GitHub. Hopefully the crashes that Danilo experienced are fixed now...

Here is the link:
https://github.com/zzippyy/PBEdit