Integrated 'Multicolored Procedure List' in IDE

Working on new editor enhancements?
PeDe
Enthusiast
Enthusiast
Posts: 278
Joined: Sun Nov 26, 2017 3:13 pm

Re: Integrated 'Multicolored Procedure List' in IDE

Post by PeDe »

I have now considered the macros, and highlighting works the same as with the procedures.
The logic for this is now completely in 'ProcedureBrowser_HighlightTimer()', and no longer in 'ProcedureBrowser_ItemHighlight()'.
The ZIP archives have not been updated.

@AZJIO
I would make the input field and delete buttons for filtering above the list.

If there is not enough space for the buttons at the bottom, you could display only four buttons at a time and switch with another button.

The icons are loaded with 'Theme_LoadImage()' from the file 'ThemeManagement.pb', I assume.

Peter
PeDe
Enthusiast
Enthusiast
Posts: 278
Joined: Sun Nov 26, 2017 3:13 pm

Re: Integrated 'Multicolored Procedure List' in IDE

Post by PeDe »

I have updated the ZIP archives. For the IDEs, only the Windows versions.

The buttons are now switchable, only five are ever displayed.

The filter is available. Automatic highlighting is deactivated with filter.
I don't know how to query the enter key in the input field. As a temporary alternative, there is the 'E' button for input.

EDIT: There is still a bug with highlighting and clicking in the procedure list. It is not updated immediately.

EDIT2: I think it works correctly now. Markers or macros within a procedure are also selected in the list, and not just the associated procedure. But I am not sure if this is correct.

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

Re: Integrated 'Multicolored Procedure List' in IDE

Post by AZJIO »

#PB_EventType_Change ?
PeDe
Enthusiast
Enthusiast
Posts: 278
Joined: Sun Nov 26, 2017 3:13 pm

Re: Integrated 'Multicolored Procedure List' in IDE

Post by PeDe »

The filter had an error, not everything was filtered, this has been corrected. The ZIP archives have not yet been updated.

@AZJIO
There is no change event on the Enter key. I don't know if I can use AddKeyboardShortcut() in the IDE without interfering.

EDIT: I have found the processing of the Enter key. In UserInterface.pb and MainMenuEvent() #MENU_Scintilla_Enter is queried. This has already been added with AddKeyboardShortcut() for the Enter key.

Peter
PeDe
Enthusiast
Enthusiast
Posts: 278
Joined: Sun Nov 26, 2017 3:13 pm

Re: Integrated 'Multicolored Procedure List' in IDE

Post by PeDe »

I have updated the ZIP archives in the first post.
With the Linux versions, the Enter key does not work with the filter. I'll have to look into that first.

EDIT: The Enter key work now with the Linux versions, archives updated.

Peter
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Integrated 'Multicolored Procedure List' in IDE

Post by Fred »

Don't hesitate to do a PR if you feel like it could be integrated in the IDE
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

[ProcedureBrowser_ItemColor]
Does this persist every time you close it? It is not clear why the problem with the "├" ("┌", "L") symbol occurs every time, and not just when adding new symbols.

You can do this:

Code: Select all

12304896-1="●"
8421631/0="┌","└"
16750848|1="├"
14588378,1="#"
Where 0/1 is flag, 0=background, 1=foreground

Even then, are quotation marks necessary?

Code: Select all

"●" = 12304896,-1
any character before the "=" sign is a key

Code: Select all

● = 12304896,-1

Code: Select all

ProcedureBrowserHighlightTimer = ReadPreferenceLong("HighlightTimer", 1000) ; PeDre
Isn't it better to update the list by pressing Enter? While we are writing on one line or just looking at the code, there is no point in updating the list every second. You can also update the list based on the event of text insertion, which may contain new functions and labels.
SCN_MODIFIED + linesAdded

Code: Select all

Case #SCN_MODIFIED
	If \modificationType & #SC_MOD_DELETETEXT Or \modificationType & #SC_MOD_INSERTTEXT
		AddWindowTimer(#WINDOW_Main, #TIMER_ProcedureBrowser, ProcedureBrowserHighlightTimer)
	EndIf


If Event = #PB_Event_Timer And EventTimer() = #TIMER_ProcedureBrowser
	RemoveWindowTimer(#WINDOW_Main , #TIMER_ProcedureBrowser)
; 	...
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 AZJIO,
Does this persist every time you close it?
Yes, the settings are saved when the IDE is closed.
It is not clear why the problem with the "├" ("┌", "L") symbol occurs every time, and not just when adding new symbols.
I asked the question in the forum:
viewtopic.php?t=85442
You can do this:
Looks more complicated, I'll have to have a look.
Even then, are quotation marks necessary?
No, I thought spaces were possible at the end, but that doesn't seem to be the case. I can leave out the quotation marks.
Isn't it better to update the list by pressing Enter?
If automatic highlighting is activated, the timer checks whether the line number of the cursor has changed.
It then checks whether a new entry in the procedure list needs to be highlighted. This is done very quickly.
Your suggestion is far too risky. The input key for the editor alone is processed in separate places in the code for the different systems. It is very easy to interfere with this.
Edit: I do not access the Scintilla editor at all. I only use information or variables that are updated by the IDE.

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 »

Thanks for the improvements Peter with filters, ...

For Multilanguage support, Translations can be added in:
devel\Documentation\Catalogs\Francais\Editor.catalog
And, in the final versions it is in:
PureBasic_Windows_X64_LTS_6.12\Catalogs\Francais\Editor.catalog

Code: Select all

[ToolsPanel]
FilterClear           = Supprimer le filtre
HideModuleNames       = Masquer les noms de modules
HighlightProcedure    = Déterminer et mettre en évidence automatiquement 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
ScrollProcedure       = Défilement automatique vers la procédure en cours
CopyClipboard         = Copier les noms des procédures dans le presse-papiers.  Options : Ctrl = Tous, Shift = Arguments
SwitchButtons         = Changer les fonctions

[Preferences]
ProcedureMulticolor  = Liste de procédures multicolores
Here is the French Editor.catalog

Should also be done for Deutsch, Italian, Spanish
Fred wrote: Sun Sep 29, 2024 3:37 pm Don't hesitate to do a PR if you feel like it could be integrated in the IDE
Oh YES, It would be really nice, +1000 :)
Of course when you think it's mature Peter, if you're afraid of Git, maybe Fred can do it from your sources.
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Integrated 'Multicolored Procedure List' in IDE

Post by AZJIO »

PeDe wrote: Sun Sep 29, 2024 5:29 pm Hello AZJIO,
Does this persist every time you close it?
Yes, the settings are saved when the IDE is closed.
You can make a "SaveRequired" flag. Initially this flag is zero. If you press the "F" or "B" or "R" button, the flag changes to "1". Before closing and saving, you check the flag, if there has been a change, then only save it.

I didn’t immediately understand the purpose of the “S” button, so I made a translation into Russian with a slight semantic modification.

Code: Select all

[ToolsPanel]
FilterClear           =  Очистить фильтр
HideModuleNames       = Не отображать имя модуля перед функцией
HighlightProcedure    = Автоматически подсвечивать текущую процедуру
DisableUnfolding      = Отключить автоматическое раскрытие свёрнутой процедуры
FrontColor            = Изменить цвет пункта
BackColor             = Изменить фон пункта
RestoreColor          = Сбросить цвет выбранного пункта
ScrollProcedure       = Автоматически прокручивать список к текущей процедуре
CopyClipboard         = Копирует список процедур в буфер обмена. Удерживание +Ctrl = Все, +Shift = с параметрами.
SwitchButtons         = Переключить на другие функциональные кнопки

[Preferences]
ProcedureMulticolor  = Цветной список процедур
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,
You can make a "SaveRequired" flag. Initially this flag is zero. If you press the "F" or "B" or "R" button, the flag changes to "1". Before closing and saving, you check the flag, if there has been a change, then only save it.
This is not necessary. The settings file for the IDE is always saved completely.
If I do not save a setting that has not changed, it is no longer present in the settings file. The IDE determines when the settings are loaded and saved.

Peter
PeDe
Enthusiast
Enthusiast
Posts: 278
Joined: Sun Nov 26, 2017 3:13 pm

Re: Integrated 'Multicolored Procedure List' in IDE

Post by PeDe »

Thanks for the translations, I hope I can somehow get it all together.

My current question is whether highlighting a marker or macro in the list within a procedure is correct?
If you change the cursor in the code in the line, the corresponding procedure is highlighted in the list, which is a bit confusing.
Or should it be like in the original RSBasic tool, and only the corresponding procedure is highlighted? This is also irritating if you click on a marker within a procedure and something else is highlighted.
If you have many markers in a procedure, this is of course more noticeable.

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

Re: Integrated 'Multicolored Procedure List' in IDE

Post by AZJIO »

PeDe wrote: Mon Sep 30, 2024 5:11 am The settings file for the IDE is always saved completely.
But the [ProcedureBrowser_ItemColor] settings break only when this section is saved. If I don't make changes, I won't get into trouble. That is, once configured, it will always work for me. We don’t know when Fred will fix that problem, and we want to get a working version now, and not in half a year.

Code: Select all

  If SaveRequired
  	PreferenceComment("") ; PeDre
  	PreferenceGroup("ProcedureBrowser_ItemColor") ; PeDre
  	With ProcedureBrowserItemColorList()		  ; PeDre With to EndWith
  		ForEach ProcedureBrowserItemColorList()
  			WritePreferenceString(#DOUBLEQUOTE$ + \Text$ + #DOUBLEQUOTE$, "" + \FrontColor + "," + \BackColor)
  		Next
  	EndWith ; PeDre
  EndIf

Code: Select all

Case #GADGET_ProcedureBrowser_FrontColor
 SaveRequired = 1
; ...
 Case #GADGET_ProcedureBrowser_BackColor
 SaveRequired = 1
; ...
 Case #GADGET_ProcedureBrowser_RestoreColor
 SaveRequired = 1
; ...
If the label contains the "=" sign, it will break the reading of the data [ProcedureBrowser_ItemColor]

Code: Select all

        \Text$ = StringField(PreferenceKeyValue(), 1, "<|>")
       tmp$ = StringField(PreferenceKeyValue(), 2, "<|>")
        \FrontColor = Val(StringField(tmp$, 1, ","))
        \BackColor = Val(StringField(tmp$, 2, ","))
reading data as

Code: Select all

[ProcedureBrowser_ItemColor]
1=●<|>12304896,-1
2=┌<|>8421631,-1
3=└<|>8421631,-1
4=├<|>16750848,-1
5=#<|>14588378,-1
The separator must be one that is unlikely to appear in the generated label
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 »

Hi Peter,
PeDe wrote: Mon Sep 30, 2024 5:13 am My current question is whether highlighting a marker or macro in the list within a procedure is correct?
If you change the cursor in the code in the line, the corresponding procedure is highlighted in the list, which is a bit confusing.
Or should it be like in the original RSBasic tool, and only the corresponding procedure is highlighted? This is also irritating if you click on a marker within a procedure and something else is highlighted.
If you have many markers in a procedure, this is of course more noticeable.
For me, there's no doubt at all, it's fine the way it is, with the markers, macros or procedure highlighted.
And even, if there's markers or macros inside a procedure, the marker or macro should be highlighted (rather than the procedure), if the cursor is inside a macro or after a marker, something like this whatever the Type (without the need to use \LineEnd) :

Code: Select all

If \Line <= CurrentLine
  If \Line > AboveLine
    AboveLine = \Line
    Index = Counter
    Type = \Type
  EndIf
EndIf
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.
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,

I have changed the saving of the colors. There should now be no restrictions on the text.

Save:

Code: Select all

  PreferenceComment("") ; PeDre
  PreferenceGroup("ProcedureBrowser_ItemColor") ; PeDre
  With ProcedureBrowserItemColorList() ; PeDre With to EndWith
    Counter = 1
    ForEach ProcedureBrowserItemColorList()
      WritePreferenceString(Str(Counter), \Text$ + "," + \FrontColor + "," + \BackColor)
      Counter + 1
    Next
  EndWith ; PeDre

Loading:

Code: Select all

  PreferenceGroup("ProcedureBrowser_ItemColor") ; PeDre
  ClearList(ProcedureBrowserItemColorList()) ; PeDre
  If ExaminePreferenceKeys() ; PeDre - If to EndIf
    While NextPreferenceKey()
      AddElement(ProcedureBrowserItemColorList())
      With ProcedureBrowserItemColorList()
        ; entries: 1 = Text,-1,13684944
        Value$ = ReverseString(PreferenceKeyValue())
        Length = Len(StringField(Value$, 1, ",")) + 1
        \BackColor = Val(ReverseString(StringField(Value$, 1, ",")))
        Length + Len(StringField(Value$, 2, ",")) + 1
        \FrontColor = Val(ReverseString(StringField(Value$, 2, ",")))
        \Text$ = Left(ReverseString(Value$), Len(Value$) - Length)
      EndWith
    Wend
  EndIf ; PeDre

It's not elegant, but it works for the time being. Also for e.g: ├,"

Code: Select all

[ProcedureBrowser_ItemColor]
0 = ●,-1,8454143
1 = ┌,-1,8454016
2 = └,-1,16777088
3 = ├",,-1,12615935
;

Peter
Post Reply