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 »

Hello ChrisR,

Thanks for the code. I have updated the ZIP archives in the first post, only the Windows versions are available.

There are no colors for the macros in the settings, only for procedures. I would not color them separately.

I have added the idea from AZJIO. The comparison of list entry and text for coloring is now compared with the beginning.
So you can create a line of code, e.g.: ';- Event', select it and color it, then delete it again. All entries with the text 'Event' at the beginning are then colored. You can also use it to color issues, e.g. with ';- TODO'.
To delete the colors, you have to create the line again and delete the colors. Or you can edit the preference file if there are any ambiguities.

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

[ProcedureBrowser_ItemColor]
"●" = 12304896,-1
"┌" = 8421631,-1
"└" = 8421631,-1
"├" = 16750848,-1
"#" = 14588378,-1
screenshot

It works great.
1. I had a small problem: when I select create ├ my ┌ automatically disappeared, and vice versa, when I create ┌ then my ├ disappears and in the end I just copied the lines from the configuration file to paste them manually. This is not critical, the main thing is that I can configure it.
2. I'm used to working with web colors like FF8080 and I have to use "Debug $8080FF" to get the color. I don't know if it's worth changing the style of the settings file, since other colors are specified as a decimal number. It would be possible to add "Color selection method" = 0/1 with the ability to issue an InputRequester() for FF8080 input instead of a color palette.

Code: Select all

[ProcedureBrowser]
ColorSelMethod = 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 AZJIO,

Thank you for testing.

I can't reproduce your coloring error with your characters. Maybe it has to do with the language settings of the system. Or with the format of the file UTF8 or ASCII?

I would not change the format for saving the colors. Maybe there will be a new ColorRequester() in PB with a better color selection.

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

Procedure RGBtoBGR(c)
; 	ProcedureReturn RGB(Blue(c), Green(c), Red(c))
	ProcedureReturn ((c & $00FF00) | ((c & $0000FF) << 16) | ((c & $FF0000) >> 16))
EndProcedure

; def если пустая строка или больше 6 или 5 или 4
; def в BGR, не RGB, то есть готовое для применения
; Color$ это RGB прочитанный из ini с последующим преобразованием в BGR
Procedure ColorValidate(Color$, def = 0)
	Protected tmp$, tmp2$, i
; 	Debug Color$
	i = Len(Color$)
; 	If i <= 6 And IsHex(@Color$) ; https://www.purebasic.fr/english/viewtopic.php?t=79007
		Select i
			Case 6
; 				def = Val("$" + Color$)
; 				RGBtoBGR2(@def)
				def = RGBtoBGR(Val("$" + Color$))
			Case 1
				def = Val("$" + LSet(Color$, 6, Color$))
			Case 2
				def = Val("$" + Color$ + Color$ + Color$)
			Case 3
; 				сразу переворачиваем в BGR
				For i = 3 To 1 Step -1
					tmp$ = Mid(Color$, i, 1)
					tmp2$ + tmp$ + tmp$
				Next
				def = Val("$" + tmp2$)
		EndSelect
; 	EndIf
; 	Debug Hex(def)
	ProcedureReturn def
EndProcedure

PBprefs_ColorSelMethod = 1

If PBprefs_ColorSelMethod
	tmp$ = InputRequester("Set color", "RRGGBB", "")
	If Asc(tmp$)
		Debug ColorValidate(tmp$)
	EndIf
Else
	ColorRequester()
EndIf

; Debug  ColorValidate("FF0000")
; Debug  ColorValidate("F00")
; Debug  ColorValidate("0000FF")
; Debug  ColorValidate("00F")
; Debug  ColorValidate("00FF00")
; Debug  ColorValidate("0F0")
; Debug  ColorValidate("333333")
; Debug  ColorValidate("333")
; Debug  ColorValidate("3")
; Debug  ColorValidate("3F3F3F")
; Debug  ColorValidate("3F")
Last edited by AZJIO on Fri Sep 27, 2024 9:25 am, edited 1 time in total.
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,

but you can enter the HEX values in the preference file, e.g.: "x" = $8080FF,-1
The decimal values are only saved again when the IDE is saved or closed.

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: Fri Sep 27, 2024 9:24 am but you can enter the HEX values in the preference file, e.g.: "x" = $8080FF,-1
This already makes it easier to experiment with color. Then you can leave it as is.
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: Fri Sep 27, 2024 9:09 am I can't reproduce your coloring error with your characters.
https://www.upload.ee/files/17168825/Mu ... t.mp4.html

I can assume that a Unicode character is 2 bytes wide, and Scintilla uses UTF-8 data access, which causes a data shift when trying to count by the number of characters, and not by the number of bytes.
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 can now reproduce the error. At first I would say this is a PureBasic error.

Peter
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 don't see any error in the code for saving the settings:

Code: Select all

  PreferenceComment("") ; PeDre
  PreferenceGroup("ProcedureBrowser_ItemColor") ; PeDre
  With ProcedureBrowserItemColorList() ; PeDre With to EndWith
    ForEach ProcedureBrowserItemColorList()
      WritePreferenceString(#DOUBLEQUOTE$ + \Text$ + #DOUBLEQUOTE$, "" + \FrontColor + "," + \BackColor)
      DebugView::MInfo("sText = " + \Text$ + " - iFrontColor = " + \FrontColor + " - iBackColor = " + \BackColor)
    Next
  EndWith ; PeDre

Here is the debug output:

Code: Select all

12:31:02.837  00207:In : . >ProcedureBrowser_PreferenceSave[-1]
12:31:02.839  00208:Inf: . . ProcedureBrowser_PreferenceSave[-1]: sText = ● - iFrontColor = 255 - iBackColor = -1
12:31:02.841  00209:Inf: . . ProcedureBrowser_PreferenceSave[-1]: sText = ┌ - iFrontColor = 8421376 - iBackColor = -1
12:31:02.842  00210:Inf: . . ProcedureBrowser_PreferenceSave[-1]: sText = └ - iFrontColor = 16744576 - iBackColor = -1
12:31:02.844  00211:Inf: . . ProcedureBrowser_PreferenceSave[-1]: sText = ├ - iFrontColor = 8388863 - iBackColor = -1
12:31:02.846  00212:Out: . <ProcedureBrowser_PreferenceSave[-1]

And here are the broken saved settings from the preference file:

Code: Select all

[ProcedureBrowser_ItemColor]
"●" = 255,-1
"├" = 8388863,-1
; 
"└" = 16744576,-1
[VariableViewer]

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 archive with the IDEs, now again with the Debian 12 x64 and Raspberry Pi OS 12 x64 version.
In the Linux versions, I have disabled the Ctrl and Shift key option for the copy button.

The error with the preferences does not occur under Debian 12 and PB v6.12, probably a Windows problem.

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

Re: Integrated 'Multicolored Procedure List' in IDE

Post by AZJIO »

And why the window when closing the IDE? Maybe it's worth allowing it using a flag.
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 archive with the IDEs has been updated. The nag screen on exit has been removed.

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

Re: Integrated 'Multicolored Procedure List' in IDE

Post by AZJIO »

Can you make a filter? Input field, enter text and any label that contains text is displayed, the rest are not.
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,

filtering would be relatively easy. You would only have to insert a procedure call into the original code to filter the completed internal procedure list.

There is also an error in the code that I have just noticed. Markers and issues within macros still need to be taken into account.

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

Re: Integrated 'Multicolored Procedure List' in IDE

Post by AZJIO »

1. Screenshot
2. The panel is too wide, the buttons do not fit. Is it possible to make one menu button so that this menu contains menu items that are rarely used.

I tried adding icons, but it didn't work yet

Code: Select all

DataSection
	copyZZZ:
	IncludeBinary "data\Multicolored\copy.png"
EndDataSection
copyidZZZ = CatchImage(#PB_Any, ?copyZZZ)
;...
ButtonImageGadget(#GADGET_ProcedureBrowser_CopyClipboard, 0, 0, 0, 0, ImageID(copyidZZZ))
Built-in turned on

Code: Select all

ButtonImageGadget(#GADGET_ProcedureBrowser_CopyClipboard, 0, 0, 0, 0, ImageID(#IMAGE_Option_CopyTarget))
I haven't found the place where they are placed.
Post Reply