[IDE Tool] ChangeTheme color switcher

Working on new editor enhancements?
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: [IDE Tool] ChangeTheme color switcher

Post by Michael Vogel »

I've enabled the "bolding" option in the preferences, so keywords like procedure, if, for, next, etc. are shown bold. As soon I attach the new theme colors (just using the -a option), no words are shown bold anymore.
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: [IDE Tool] ChangeTheme color switcher

Post by kenmo »

Fixed, please download and try again!
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: [IDE Tool] ChangeTheme color switcher

Post by Michael Vogel »

kenmo wrote:Fixed, please download and try again!
Thanks again, looks even better...
...the only thing which is a bit weird that some tabs in the IDE are changed as wanted but others only change the theme for the cursor line only. The update is only done after resizing the purebasic window.

I've added a RedrawWindow_(*Window,#Null,#Null,#RDW_ERASE|#RDW_INVALIDATE) now at the end which seems to work.

Here's the switcher tool for the solarized themes only:

Code: Select all

; Define

	#UseControlKeys=	0
	#MaxThemes=		1
	#DataSize=			SizeOf(Integer)

	DataSection
		Themes:
		Data.i ?SolarizedDark
		Data.i ?SolarizedLight

		SolarizedDark:
		Data.i 60
		Data.i 2052,$20,$362B00; 	BackgroundColor
		Data.i 2050,0,0;
		Data.i 2051,1,$969483; 	NormalTextColor
		Data.i 2052,1,$362B00; 	BackgroundColor
		Data.i 2051,2,$89B5; 	BasicKeywordColor
		Data.i 2052,2,$362B00; 	BackgroundColor
		Data.i 2051,3,$756E58; 	CommentColor
		Data.i 2052,3,$362B00; 	BackgroundColor
		Data.i 2051,4,$164BCB; 	ConstantColor
		Data.i 2052,4,$362B00; 	BackgroundColor
		Data.i 2051,5,$98A12A; 	StringColor
		Data.i 2052,5,$362B00; 	BackgroundColor
		Data.i 2051,6,$D28B26; 	PureKeywordColor
		Data.i 2052,6,$362B00; 	BackgroundColor
		Data.i 2051,7,$C4716C; 	ASMKeywordColor
		Data.i 2052,7,$362B00; 	BackgroundColor
		Data.i 2051,8,$969483; 	OperatorColor
		Data.i 2052,8,$362B00; 	BackgroundColor
		Data.i 2051,9,$969483; 	StructureColor
		Data.i 2052,9,$362B00; 	BackgroundColor
		Data.i 2051,$A,$98A12A; 	NumberColor
		Data.i 2052,$A,$362B00; 	BackgroundColor
		Data.i 2051,$B,$A1A193; 	PointerColor
		Data.i 2052,$B,$362B00; 	BackgroundColor
		Data.i 2051,$C,$969483; 	SeparatorColor
		Data.i 2052,$C,$362B00; 	BackgroundColor
		Data.i 2051,$D,$8236D3; 	LabelColor
		Data.i 2052,$D,$362B00; 	BackgroundColor
		Data.i 2051,$E,$969483; 	CustomKeywordColor
		Data.i 2052,$E,$362B00; 	BackgroundColor
		Data.i 2051,$F,$164BCB; 	ModuleColor
		Data.i 2052,$F,$362B00; 	BackgroundColor
		Data.i 2051,$10,$2F32DC; 	BadBraceColor
		Data.i 2052,$10,$362B00; 	BackgroundColor
		Data.i 2051,$21,$969483; 	LineNumberColor
		Data.i 2052,$21,$423607; 	LineNumberBackColor
		Data.i 2051,$22,$A1A193; 	GoodBraceColor
		Data.i 2052,$22,$423607; 	CurrentLineColor
		Data.i 2051,$23,$2F32DC; 	BadBraceColor
		Data.i 2052,$23,$423607; 	CurrentLineColor
		Data.i 2051,$23,$2F32DC; 	BadBraceColor
		Data.i 2052,$23,$423607; 	CurrentLineColor
		Data.i 2051,$25,$2F32DC; 	IndentColor
		Data.i 2052,$25,$362B00; 	BackgroundColor
		Data.i 2098,$423607,0; 	CurrentLineColor
		Data.i 2068,1,$E3F6FD; 	SelectionColor
		Data.i 2067,1,$756E58; 	SelectionFrontColor
		Data.i 2082,2,$423607; 	SelectionRepeatColor
		Data.i 2069,$969483,0; 	CursorColor
		Data.i 2290,1,$423607; 	LineNumberBackColor
		Data.i 2291,1,$423607; 	LineNumberBackColor
		Data.i 2041,$19,$423607;
		Data.i 2041,$1A,$423607;
		Data.i 2041,$1B,$423607;
		Data.i 2041,$1C,$423607;
		Data.i 2041,$1D,$423607;
		Data.i 2041,$1E,$423607;
		Data.i 2041,$1F,$423607;
		Data.i 2053,2,1; 	Bolding
		Data.i 2053,$E,1; 	Bolding

		SolarizedLight:
		Data.i 60
		Data.i 2052,$20,$E3F6FD; 	BackgroundColor
		Data.i 2050,0,0;
		Data.i 2051,1,$837B65; 	NormalTextColor
		Data.i 2052,1,$E3F6FD; 	BackgroundColor
		Data.i 2051,2,$89B5; 	BasicKeywordColor
		Data.i 2052,2,$E3F6FD; 	BackgroundColor
		Data.i 2051,3,$A1A193; 	CommentColor
		Data.i 2052,3,$E3F6FD; 	BackgroundColor
		Data.i 2051,4,$164BCB; 	ConstantColor
		Data.i 2052,4,$E3F6FD; 	BackgroundColor
		Data.i 2051,5,$98A12A; 	StringColor
		Data.i 2052,5,$E3F6FD; 	BackgroundColor
		Data.i 2051,6,$D28B26; 	PureKeywordColor
		Data.i 2052,6,$E3F6FD; 	BackgroundColor
		Data.i 2051,7,$C4716C; 	ASMKeywordColor
		Data.i 2052,7,$E3F6FD; 	BackgroundColor
		Data.i 2051,8,$837B65; 	OperatorColor
		Data.i 2052,8,$E3F6FD; 	BackgroundColor
		Data.i 2051,9,$837B65; 	StructureColor
		Data.i 2052,9,$E3F6FD; 	BackgroundColor
		Data.i 2051,$A,$98A12A; 	NumberColor
		Data.i 2052,$A,$E3F6FD; 	BackgroundColor
		Data.i 2051,$B,$756E58; 	PointerColor
		Data.i 2052,$B,$E3F6FD; 	BackgroundColor
		Data.i 2051,$C,$837B65; 	SeparatorColor
		Data.i 2052,$C,$E3F6FD; 	BackgroundColor
		Data.i 2051,$D,$8236D3; 	LabelColor
		Data.i 2052,$D,$E3F6FD; 	BackgroundColor
		Data.i 2051,$E,$837B65; 	CustomKeywordColor
		Data.i 2052,$E,$E3F6FD; 	BackgroundColor
		Data.i 2051,$F,$164BCB; 	ModuleColor
		Data.i 2052,$F,$E3F6FD; 	BackgroundColor
		Data.i 2051,$10,$2F32DC; 	BadBraceColor
		Data.i 2052,$10,$E3F6FD; 	BackgroundColor
		Data.i 2051,$21,$837B65; 	LineNumberColor
		Data.i 2052,$21,$D5E8EE; 	LineNumberBackColor
		Data.i 2051,$22,$756E58; 	GoodBraceColor
		Data.i 2052,$22,$D5E8EE; 	CurrentLineColor
		Data.i 2051,$23,$2F32DC; 	BadBraceColor
		Data.i 2052,$23,$D5E8EE; 	CurrentLineColor
		Data.i 2051,$23,$2F32DC; 	BadBraceColor
		Data.i 2052,$23,$D5E8EE; 	CurrentLineColor
		Data.i 2051,$25,$2F32DC; 	IndentColor
		Data.i 2052,$25,$E3F6FD; 	BackgroundColor
		Data.i 2098,$D5E8EE,0; 	CurrentLineColor
		Data.i 2068,1,$362B00; 	SelectionColor
		Data.i 2067,1,$A1A193; 	SelectionFrontColor
		Data.i 2082,2,$D5E8EE; 	SelectionRepeatColor
		Data.i 2069,$837B65,0; 	CursorColor
		Data.i 2290,1,$D5E8EE; 	LineNumberBackColor
		Data.i 2291,1,$D5E8EE; 	LineNumberBackColor
		Data.i 2041,$19,$D5E8EE;
		Data.i 2041,$1A,$D5E8EE;
		Data.i 2041,$1B,$D5E8EE;
		Data.i 2041,$1C,$D5E8EE;
		Data.i 2041,$1D,$D5E8EE;
		Data.i 2041,$1E,$D5E8EE;
		Data.i 2041,$1F,$D5E8EE;
		Data.i 2053,2,1; 	Bolding
		Data.i 2053,$E,1; 	Bolding
	EndDataSection

; EndDefine

CompilerIf #UseControlKeys
	n=((GetKeyState_(#VK_SHIFT)&128)>>7)
CompilerElse
	n=Val(ProgramParameter(0))
CompilerEndIf

If n<0 Or n>#MaxThemes
	n=#MaxThemes
EndIf
*Ptr=PeekI(?Themes+n*#DataSize)

*Scintilla=Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
If (*Scintilla)

	*Window=Val(GetEnvironmentVariable("PB_TOOL_MainWindow"))
	SendMessage_(*Window,#WM_SETREDRAW,#False,#Null)

	n=PeekI(*Ptr)
	*ptr+#DataSize
	For i=1 To n
		SendMessage_(*Scintilla,PeekI(*Ptr),PeekI(*Ptr+#DataSize),PeekI(*Ptr+#DataSize<<1))
		*Ptr+#DataSize*3
	Next i

	RedrawWindow_(*Window,#Null,#Null,#RDW_ERASE|#RDW_INVALIDATE)
	SendMessage_(*Window,#WM_SETREDRAW,#True,#Null)
	InvalidateRect_(*Window,#Null,#True)

EndIf
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: [IDE Tool] ChangeTheme color switcher

Post by kenmo »

Michael Vogel wrote:...the only thing which is a bit weird that some tabs in the IDE are changed as wanted but others only change the theme for the cursor line only. The update is only done after resizing the purebasic window.

I've added a RedrawWindow_(*Window,#Null,#Null,#RDW_ERASE|#RDW_INVALIDATE) now at the end which seems to work.
You're right, I've updated my source and exe. Thanks!

Brushing up on my Win API, RedrawWindow() can actually force an immediate redraw whereas InvalidateRect() really just flags the area for a future redraw.
On my main computer the IDE seems to update immediately either way, but that seems unreliable on others.
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: [IDE Tool] ChangeTheme color switcher

Post by Michael Vogel »

Actually, I've modified the code to do theses steps after another...

Code: Select all

:
SendMessage_(*Window,#WM_SETREDRAW,#True,#Null)
RedrawWindow_(*Window,#Null,#Null,#RDW_ALLCHILDREN|#RDW_INVALIDATE)
; InvalidateRect_(*Window,#Null,#True)
:
Post Reply