Integrated 'Multicolored Procedure List' in IDE

Working on new editor enhancements?
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Integrated 'Multicolored Procedure List' in IDE

Post by AZJIO »

While we haven't gone far we can do it

Code: Select all

0 =-1,8454143, ●

Code: Select all

pos = FindString(PreferenceKeyValue(), ",")
If pos
	pos2 = FindString(PreferenceKeyValue(), ",", pos + 1)
	If pos2
		\FrontColor = Mid(PreferenceKeyValue(), 1, pos - 1)
		 \BackColor = Mid(PreferenceKeyValue(), pos + 1, pos2 - pos - 1)
		\Text$ = Mid(PreferenceKeyValue(), pos2 + 1)
; 		If we don't find two commas, then we don't add it. That is, we also check the validity of the data
	EndIf
EndIf
test

Code: Select all

str$ = "-1,8454143, ●"
pos = FindString(str$, ",")
If pos
	pos2 = FindString(str$, ",", pos + 1)
	If pos2
		Debug  "pos = " + Str(pos) + "," + Str(pos2)
		Debug Mid(str$, 1, pos - 1)
		Debug Mid(str$, pos + 1, pos2 - pos - 1)
		Debug Mid(str$, pos2 + 1)
		; If we don't find two commas, then we don't add it. That is, we also check the validity of the data
	EndIf
EndIf
PeDe
Enthusiast
Enthusiast
Posts: 278
Joined: Sun Nov 26, 2017 3:13 pm

Re: Integrated 'Multicolored Procedure List' in IDE

Post by PeDe »

Hello ChrisR,
ChrisR wrote: Mon Sep 30, 2024 7:53 am The cursor position in the source is thus always synchronized with the highlighted line in the procedures.
I don't understand why it would be made only for procedures, as RSBasic did.
My opinion.
Thanks for the feedback.

Everything in the procedure list is now highlighted or selected that is available.

If you change the cursor in the code within a procedure or macro, the next marker or issue above is selected, or if not available, the procedure or macro itself.

If you change the cursor in the code outside a procedure or macro, the next marker or issue above that is outside a procedure or macro is selected, or the next procedure or macro.

Peter
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Integrated 'Multicolored Procedure List' in IDE

Post by ChrisR »

I understand your concerns about these cases.
PeDe wrote: Mon Sep 30, 2024 11:40 am If you change the cursor in the code within a procedure or macro, the next marker or issue above is selected, or if not available, the procedure or macro itself.
Looks good
PeDe wrote: Mon Sep 30, 2024 11:40 am If you change the cursor in the code outside a procedure or macro, the next marker or issue above that is outside a procedure or macro is selected, or the next procedure or macro.
Not sure, I would say, to always select (higtlight) the previous entry regardless of Type, even if you're below a macro or procedure.
So the highlighted entry in the Procedures panel is as close as possible to the cursor position.
PeDe
Enthusiast
Enthusiast
Posts: 278
Joined: Sun Nov 26, 2017 3:13 pm

Re: Integrated 'Multicolored Procedure List' in IDE

Post by PeDe »

The ZIP archives in the first post have been updated.

The colors are now saved in a different format. The preferences file should be adjusted manually before starting the new version if the colors are important.

Number = frontcolor,backcolor,text

Code: Select all

[ProcedureBrowser_ItemColor]
1 = -1,8454143,TextX
2 = -1,16777088,TextY
3 = 8421440,16777088,TextZ

In the procedure list, each entry can be selected or is highlighted.

Macros can also be colored. I see no reason why this should not be possible.

I have also corrected some small errors.
For example, the selection color in the list was not updated when it was changed in the settings.
When changing tabs, sometimes something was selected incorrectly in the list, e.g. if the cursor was at the very beginning of the file.

For the language translations and any icons, I first have to look at how this should be done.

@ChrisR
ChrisR wrote: Mon Sep 30, 2024 1:38 pm Not sure, I would say, to always select (higtlight) the previous entry regardless of Type, even if you're below a macro or procedure.
So the highlighted entry in the Procedures panel is as close as possible to the cursor position.
I have left the highlighting as it is when the cursor is outside of procedures or macros.
The reason are folded procedures, I think it is better to highlight only procedures or macros and not entries that are not visible in the code.
But that can be changed if it turns out to be unsuitable.

Peter
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Integrated 'Multicolored Procedure List' in IDE

Post by ChrisR »

With the latest windows x64 version, the procedure panel (ListIconGadget), is all black except for the highlighted line.
I wanted to inform you by PM but it seems to be disabled!
PeDe
Enthusiast
Enthusiast
Posts: 278
Joined: Sun Nov 26, 2017 3:13 pm

Re: Integrated 'Multicolored Procedure List' in IDE

Post by PeDe »

Hello ChrisR,

this has to do with the new color format. Either adjust the settings file or delete the colors in it.
I have already adjusted the code and updated the code ZIP archive, but not the IDEs.

Peter
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Integrated 'Multicolored Procedure List' in IDE

Post by ChrisR »

I recompiled it with the latest source, it's all good now for colors.
I added macros and markers inside a procedure and outside on top and bottom. I moved my cursor everywhere and It seems all good for the selected and highlighted item, great 8)

Edit: Each time the IDE is restarted, the" Form" tab is selected, not the last one used "Procedures"
PeDe
Enthusiast
Enthusiast
Posts: 278
Joined: Sun Nov 26, 2017 3:13 pm

Re: Integrated 'Multicolored Procedure List' in IDE

Post by PeDe »

ChrisR wrote: Mon Sep 30, 2024 5:45 pm IEdit: Each time the IDE is restarted, the" Form" tab is selected, not the last one used "Procedures"
I can't see any difference to the official IDE.
The tab that is at the top of the tools in the settings is activated.

Peter
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Integrated 'Multicolored Procedure List' in IDE

Post by AZJIO »

I remember this problem and disabled the forms tab
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Integrated 'Multicolored Procedure List' in IDE

Post by ChrisR »

The tab order comes from PureBasic.prefs, I didn't go further to find out why it is initialized in this order!

Code: Select all

[ToolsPanel] 
Tool_1 = Form
Tool_2 = Explorer
Tool_3 = ProjectPanel
Tool_4 = ProcedureBrowser
Which should be with: Tool_1 = ProcedureBrowser

Code: Select all

[ToolsPanel]
Tool_1 = ProcedureBrowser
Tool_2 = ProjectPanel
Tool_3 = Explorer
Tool_4 = Form

Edit: on 1st initialization, without PureBasic.prefs,
AddElement(AvailablePanelTools()) is done in 1st for Form in FormManagement.pb and done last for Procedures in ProcedureBrowser.pb
To get the procedures in 1st position, adding ResetList in ProcedureBrowser.pb seems to do the trick

Code: Select all

ResetList(AvailablePanelTools())
AddElement(AvailablePanelTools())
Edit2: Or add a field (ex: ToolOrder) to the Structure ToolsPanelEntry
With AvailablePanelTools()\ToolOrder = 0,1,...,9 after each AddElement(AvailablePanelTools())
And then sort AvailablePanelTools() list on ToolOrder in Preferences.pb before "If ActiveToolsCount = -1"
PeDe
Enthusiast
Enthusiast
Posts: 278
Joined: Sun Nov 26, 2017 3:13 pm

Re: Integrated 'Multicolored Procedure List' in IDE

Post by PeDe »

Hello ChrisR,
ChrisR wrote: Mon Sep 30, 2024 11:12 pm The tab order comes from PureBasic.prefs, I didn't go further to find out why it is initialized in this order!
I cannot recreate the behavior. I have also tested it with the French language. The specified sequence is always saved in the settings file.


I have collected the languages. I have translated Italian and Spanish with DeepL.

Peter

Code: Select all

English
\purebasic-devel-v612\Documentation\Catalogs\Editor.catalog
189
FilterClear           = Removes the filter
HideModuleNames       = Hide module names
HighlightProcedure    = Automatically determine and highlight the current procedure
ScrollProcedure       = Automatically scroll to current procedure
DisableUnfolding      = Disable automatic unfolding of the procedure after the click
FrontColor            = Changing the font color of an entry
BackColor             = Changing the background color of an entry
RestoreColor          = Restore color settings of an entry
CopyClipboard         = Copies the procedure names to the clipboard.  Options: Ctrl = All, Shift = Arguments
SwitchButtons         = Switches the functions
475
ProcedureMulticolor          = Multicolored Procedure List

German
\purebasic-devel-v612\Documentation\Catalogs\Deutsch\Editor.catalog
189
FilterClear           = Filter löschen
HideModuleNames       = Modulnamen ausblenden
HighlightProcedure    = Aktuelle Prozedur automatisch ermitteln und hervorheben
ScrollProcedure       = Zur aktuellen Prozedur automatisch scrollen
DisableUnfolding      = Automatisches Ausklappen der Prozedur nach dem Klick deaktivieren
FrontColor            = Schriftfarbe eines Eintrages ändern
BackColor             = Hintergrundfarbe eines Eintrages ändern
RestoreColor          = Farbeinstellungen eines Eintrages wiederherstellen
CopyClipboard         = Kopiert die Prozedurliste in die Zwischenablage.  Optionen: Ctrl = Alles, Shift = Argumente
SwitchButtons         = Funktionen umschalten
475
ProcedureMulticolor          = Mehrfarbige Prozedurliste

Francais
\purebasic-devel-v612\Documentation\Catalogs\Francais\Editor.catalog
189
FilterClear           = Supprimer le filtre
HideModuleNames       = Masquer les noms de modules
HighlightProcedure    = Déterminer et mettre en évidence automatiquement la procédure en cours
ScrollProcedure       = Défilement automatique vers la procédure en cours
DisableUnfolding      = Désactiver le déploiement automatique de la procédure après le clic
FrontColor            = Changer la couleur de la police d'une entrée
BackColor             = Modifier la couleur d'arrière-plan d'une entrée
RestoreColor          = Restaurer les couleurs d'une entrée
CopyClipboard         = Copier les noms des procédures dans le presse-papiers.  Options : Ctrl = Tous, Shift = Arguments
SwitchButtons         = Changer les fonctions
475
ProcedureMulticolor  = Liste de procédures multicolores

Italian
\purebasic-devel-v612\Documentation\Catalogs\Italian\Editor.Catalog
172
FilterClear           = Rimuove il filtro
HideModuleNames       = Nascondere i nomi dei moduli
HighlightProcedure    = Determina ed evidenzia automaticamente la procedura corrente
ScrollProcedure       = Scorrimento automatico alla procedura corrente
DisableUnfolding      = Disabilita lo svolgimento automatico della procedura dopo il clic
FrontColor            = Modifica del colore del carattere di una voce
BackColor             = Modifica del colore di sfondo di una voce
RestoreColor          = Ripristino delle impostazioni di colore di una voce
CopyClipboard         = Copia i nomi delle procedure negli appunti.  Opzioni: Ctrl = Tutti, Maiusc = Argomenti
SwitchButtons         = SCommuta le funzioni
451
ProcedureMulticolor = Elenco di procedure multicolore

Spanish
\purebasic-devel-v612\Documentation\Catalogs\Spanish\Editor.catalog
168
FilterClear           = Elimina el filtro
HideModuleNames       = Ocultar los nombres de los módulos
HighlightProcedure    = Determinar y resaltar automáticamente el procedimiento actual
ScrollProcedure       = Desplazarse automáticamente al procedimiento actual
DisableUnfolding      = Desactivar el despliegue automático del procedimiento tras el clic
FrontColor            = Cambiar el color de fuente de una entrada
BackColor             = Cambiar el color de fondo de una entrada
RestoreColor          = Restaurar los ajustes de color de una entrada
CopyClipboard         = Copia los nombres de los procedimientos en el portapapeles.  Opciones: Ctrl = Todos, Mayús = Argumentos
SwitchButtons         = Cambia las funciones
428
ProcedureMulticolor  = Lista de procedimientos multicolor

Russian
AZJIO: https://www.purebasic.fr/english/viewtopic.php?p=628525#p628525
xx
FilterClear           = Очистить фильтр
HideModuleNames       = Не отображать имя модуля перед функцией
HighlightProcedure    = Автоматически подсвечивать текущую процедуру
DisableUnfolding      = Отключить автоматическое раскрытие свёрнутой процедуры
FrontColor            = Изменить цвет пункта
BackColor             = Изменить фон пункта
RestoreColor          = Сбросить цвет выбранного пункта
ScrollProcedure       = Автоматически прокручивать список к текущей процедуре
CopyClipboard         = Копирует список процедур в буфер обмена. Удерживание +Ctrl = Все, +Shift = с параметрами.
SwitchButtons         = Переключить на другие функциональные кнопки
xx
ProcedureMulticolor  = Цветной список процедур
PeDe
Enthusiast
Enthusiast
Posts: 278
Joined: Sun Nov 26, 2017 3:13 pm

Re: Integrated 'Multicolored Procedure List' in IDE

Post by PeDe »

For the new icons, I thought about drawing all the icons in the IDE as vectors. In my programs I create the icons with the VectorDrawing library. They are drawn in CorelDraw 12 and converted into the PureBasic commands using a VBA macro. You can then use them in any size, drawing is very fast. You can also save the icons as a bitmap. But since I don't have a HiRes monitor or use DPI scaling, I don't know if this works well. You can use my current program for a test. The graphic in the About dialog is also created in the same way:

Code: Select all

https://www.dreisiebner.at/messinstrumente-skript/
Otherwise I would make icons with letters only, so that the buttons have the right size, now they are a bit too small.

Peter
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Integrated 'Multicolored Procedure List' in IDE

Post by AZJIO »

Code: Select all

BackColor = Val(Mid(PreferenceKeyValue(), Pos1+1, Pos2))
This works because Val() trims the excess and won't read the comma as a number.
should be:

Code: Select all

BackColor = Val(Mid(PreferenceKeyValue(), Pos1+1, Pos2 - Pos1 - 1))
The third parameter is length, not position. By the way, I also corrected it several times.

Code: Select all

If Len(Text$)
replace with

Code: Select all

If Asc(Text$)
This is a small thing, but Len() is slower because it checks the string by running to the end of the line. In turn, Asc() only checks the first character that it is not equal to 00 as for the empty string. The result is the same, if there is at least one symbol, then #True, but the speed is different.

Code: Select all

Protected Pos1, Pos2, FrontColor, BackColor, Text$
;...
While NextPreferenceKey()
	With ProcedureBrowserItemColorList()
		Pos1 = FindString(PreferenceKeyValue(), ",")
		If Pos1
			Pos2 = FindString(PreferenceKeyValue(), ",", Pos1+1)
			If Pos2
				FrontColor = Val(Mid(PreferenceKeyValue(), 1, Pos1))
				BackColor = Val(Mid(PreferenceKeyValue(), Pos1+1, Pos2 - Pos1 - 1))
				Text$ = Mid(PreferenceKeyValue(), Pos2+1)
				If Asc(Text$) ; Text$ will only receive data inside this condition, so there's no point in making it outside.
					AddElement(ProcedureBrowserItemColorList())
					\FrontColor = FrontColor
					\BackColor = BackColor
					\Text$ = Text$
				EndIf
			EndIf
		EndIf
	EndWith
Wend
Is the condition checked when adding a new color? For example FrontColor <> BackColor, since in this case the text will be invisible having the same color as the background. Although someone will decide to use the empty background of the item as a label

Code: Select all

6 = 0,0,empty
PeDe
Enthusiast
Enthusiast
Posts: 278
Joined: Sun Nov 26, 2017 3:13 pm

Re: Integrated 'Multicolored Procedure List' in IDE

Post by PeDe »

Hello AZJIO,

thanks, I have corrected the error.

No, it does not check for an empty marker, good point, I will correct it.

Peter
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Integrated 'Multicolored Procedure List' in IDE

Post by AZJIO »

does not create intermediate variables

Code: Select all

While NextPreferenceKey()
	With ProcedureBrowserItemColorList()
		Pos1 = FindString(PreferenceKeyValue(), ",")
		If Pos1
			Pos2 = FindString(PreferenceKeyValue(), ",", Pos1+1)
			If Pos2
				Text$ = Mid(PreferenceKeyValue(), Pos2+1)
				If Asc(Text$)
					AddElement(ProcedureBrowserItemColorList())
					\FrontColor = Val(Mid(PreferenceKeyValue(), 1, Pos1))
					\BackColor = Val(Mid(PreferenceKeyValue(), Pos1+1, Pos2 - Pos1 - 1))
					\Text$ = Text$
				EndIf
			EndIf
		EndIf
	EndWith
Wend
Post Reply