• Welcome to PlanetSquires Forums.
 

Colors & Fonts - Color items background colors display differently than selected

Started by Bruce Huber, December 04, 2017, 05:30:39 PM

Previous topic - Next topic

Bruce Huber

WinFBE (ver. 1.5.6 64-bit)
Windows 10 64-bit
Tried to modify the Visual Studio Code (Dark) theme colors...

In Colors & Fonts I've set the Window background to 0,34,64 and then I set the background of most of the items with background colors to the same value and all of the values look good in the dialog when I go back in to it.  But all of those items display with a 0,34,0 background color instead.

I've created a new theme "Bruce (Dark)" with the same color parameters - but it displays the same problem.

Could someone point me to where the theme record's color layout and format is in the code - (or where it's documented)?

I thought I would try to manually change it in the WinFBE.ini file and see if that would stick, but it is not obvious where (and what) the color settings are in the theme record.

Thanks,
Bruce

Paul Squires

Hi Bruce, if the code is broken then I'll certainly fix it. Here is how colors are saved... WinFBE saves the collection of colors as a "Theme". The theme is saved to the WinFBI.ini file in the section called "[Themes]". The code that saves the data to disk is found in clsConfig.inc in the SaveToFile function (around line 450).

   Print #f, ""
   print #f, "[Themes]"
   print #f, "SelectedTheme="; this.SelectedTheme
   for i as long = lbound(this.Themes) to ubound(this.Themes)
      print #f, "THEME_"; Right("00" & Str(i), 2); "=";
      print #f, this.Themes(i).id; ",";
      print #f, AfxStrReplaceAny(this.Themes(i).wszDescription, ",|", "_");
      for ii as long = CLR_CARET to CLR_WINDOW
         print #f, "|"; this.Themes(i).colors(ii).nFg; ","; _
                        this.Themes(i).colors(ii).nBg; ","; _
                        this.Themes(i).colors(ii).bUseDefaultBg; ","; _
                        this.Themes(i).colors(ii).bFontBold; ","; _
                        this.Themes(i).colors(ii).bFontItalic; ","; _
                        this.Themes(i).colors(ii).bFontUnderline;
      NEXT
      print #f, ""
   NEXT


I have bUseDefaultBg (Boolean) defined for each color but it currently has no effect.

Here is the sequence of colors:

' Colors
enum
   ' Start the enum at 2 because when theme is saved to file the first parse is the
   ' theme id and theme description. The colors start at parse 2.
   CLR_CARET = 2         
   CLR_COMMENTS
   CLR_HIGHLIGHTED     
   CLR_KEYWORD         
   CLR_FOLDMARGIN
   CLR_FOLDSYMBOL     
   CLR_LINENUMBERS     
   CLR_BOOKMARKS       
   CLR_OPERATORS       
   CLR_INDENTGUIDES   
   CLR_PREPROCESSOR   
   CLR_SELECTION       
   CLR_STRINGS         
   CLR_TEXT           
   CLR_WINAPI         
   CLR_WINDOW
end enum


Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Bruce Huber

Nothing looked really off to me, between code and themes in the INI... so, I started from scratch with the Default theme - created "Bruce (Default-based)" - and everything worked fine.

So, I'm good - but if it needs troubleshooting...

It is only when I try modifying the "Visual Studio (Dark)" theme - into "Bruce (Dark)" - that I run into the problem.

See if anything looks odd to you here...
Note: I don't see any embedded nulls anywhere.

The four themes from my INI file:
[Themes]
SelectedTheme={9AB98F76-4CAB-4DD0-B0D6-B9091F6B4CE4}
THEME_00={D0BE71A4-A835-4E64-AA5C-E9CEA5511A8F},Default Theme|0,4294967295, 0, 0, 0, 0|32768,16777215, 0, 0, 0, 0|65535,4294967295, 0, 0, 0, 0|16711680,16777215, 0, 0, 0, 0|15461613,4294967295, 0, 0, 0, 0|16777215,0, 0, 0, 0, 0|0,13421772, 0, 0, 0, 0|0,16711680, 0, 0, 0, 0|196,16777215, 0, 0, 0, 0|16777215,0, 0, 0, 0, 0|196,16777215, 0, 0, 0, 0|16777215,7884582, 0, 0, 0, 0|11337901,16777215, 0, 0, 0, 0|0,16777215, 0, 0, 0, 0|16711680,16777215, 0, 0, 0, 0|16777215,4294967295, 0, 0, 0, 0
THEME_01={C8DC7927-89E0-48D8-A35A-F11CEE5BAE23},Visual Studio Code (Dark)|13421772,4294967295, 0, 0, 0, 0|8421504,4282393088, 0, 0, 0, 0|0,4294967295, 0, 0, 0, 0|15780500,4282393088, 0, 0, 0, 0|1973790,4294967295, 0, 0, 0, 0|1973790,4282393088, 0, 0, 0, 0|5921370,0, 0, 0, 0, 0|5921370,4282393088, 0, 0, 0, 0|196,4282393088, 0, 1, 0, 0|1973790,13421772, 0, 0, 0, 0|11896485,4282393088, 0, 0, 0, 0|13421772,7884582, 0, 0, 0, 0|5278147,4203008, 0, 0, 0, 0|13421772,4282393088, 0, 0, 0, 0|13421772,4282393088, 0, 0, 0, 0|4203008,4294967295, 0, 0, 0, 0
THEME_02={1B50F380-B8DA-4334-8E8B-5E1421925CA6},Bruce (Dark)|13421772,4294967295, 0, 0, 0, 0|8421504,4282393088, 0, 0, 0, 0|0,4294967295, 0, 0, 0, 0|15780500,4282393088, 0, 0, 0, 0|1973790,4294967295, 0, 0, 0, 0|1973790,4282393088, 0, 0, 0, 0|5921370,0, 0, 0, 0, 0|5921370,4282393088, 0, 0, 0, 0|196,4282393088, 0, 1, 0, 0|1973790,13421772, 0, 0, 0, 0|11896485,4282393088, 0, 0, 0, 0|13421772,7884582, 0, 0, 0, 0|5278147,4203008, 0, 0, 0, 0|13421772,4282393088, 0, 0, 0, 0|13421772,4282393088, 0, 0, 0, 0|4203008,4294967295, 0, 0, 0, 0
THEME_03={9AB98F76-4CAB-4DD0-B0D6-B9091F6B4CE4},Bruce (Default-based)|16776960,4294967295, 0, 0, 0, 0|8421504,4203008, 0, 0, 0, 0|0,4294967295, 0, 0, 0, 0|52479,4203008, 0, 0, 0, 0|4203008,4294967295, 0, 0, 0, 0|8421504,4282393088, 0, 0, 0, 0|8421504,0, 0, 0, 0, 0|16777215,0, 0, 0, 0, 0|255,4203008, 0, 1, 0, 0|4203008,0, 0, 0, 0, 0|8978431,4203008, 0, 0, 0, 0|16777215,7884582, 0, 0, 0, 0|65280,4203008, 0, 0, 0, 0|15461613,4203008, 0, 0, 0, 0|16776960,4203008, 0, 0, 0, 0|4203008,4294967295, 0, 0, 0, 0


And the same themes rolled out in a CSV file for easy, comparative viewing in something like the NirSoft CSV Viewer, or Excel. (column headers included):
THEME,CARET-FG,BG,dfltBg,bold,ital,uline,COMMENTS-FG,BG,dfltBg,bold,ital,uline,HIGHLITE-FG,BG,dfltBg,bold,ital,uline,KEYWORD-FG,BG,dfltBg,bold,ital,uline,FOLDMARG-FG,BG,dfltBg,bold,ital,uline,FOLDSYM-FG,BG,dfltBg,bold,ital,uline,LINENUM-FG,BG,dfltBg,bold,ital,uline,BOOKMARK-FG,BG,dfltBg,bold,ital,uline,OPERATOR-FG,BG,dfltBg,bold,ital,uline,INDENT-FG,BG,dfltBg,bold,ital,uline,PREPROC-FG,BG,dfltBg,bold,ital,uline,SELECT-FG,BG,dfltBg,bold,ital,uline,STRINGS-FG,BG,dfltBg,bold,ital,uline,TEXT-FG,BG,dfltBg,bold,ital,uline,WINAPI-FG,BG,dfltBg,bold,ital,uline,WINDOW-FG,BG,dfltBg,bold,ital,uline
Default,0,4294967295, 0, 0, 0, 0,32768,16777215, 0, 0, 0, 0,65535,4294967295, 0, 0, 0, 0,16711680,16777215, 0, 0, 0, 0,15461613,4294967295, 0, 0, 0, 0,16777215,0, 0, 0, 0, 0,0,13421772, 0, 0, 0, 0,0,16711680, 0, 0, 0, 0,196,16777215, 0, 0, 0, 0,16777215,0, 0, 0, 0, 0,196,16777215, 0, 0, 0, 0,16777215,7884582, 0, 0, 0, 0,11337901,16777215, 0, 0, 0, 0,0,16777215, 0, 0, 0, 0,16711680,16777215, 0, 0, 0, 0,16777215,4294967295, 0, 0, 0, 0
VS(Dark),13421772,4294967295, 0, 0, 0, 0,8421504,4282393088, 0, 0, 0, 0,0,4294967295, 0, 0, 0, 0,15780500,4282393088, 0, 0, 0, 0,1973790,4294967295, 0, 0, 0, 0,1973790,4282393088, 0, 0, 0, 0,5921370,0, 0, 0, 0, 0,5921370,4282393088, 0, 0, 0, 0,196,4282393088, 0, 1, 0, 0,1973790,13421772, 0, 0, 0, 0,11896485,4282393088, 0, 0, 0, 0,13421772,7884582, 0, 0, 0, 0,5278147,4203008, 0, 0, 0, 0,13421772,4282393088, 0, 0, 0, 0,13421772,4282393088, 0, 0, 0, 0,4203008,4294967295, 0, 0, 0, 0
Bruce(Dark),13421772,4294967295, 0, 0, 0, 0,8421504,4282393088, 0, 0, 0, 0,0,4294967295, 0, 0, 0, 0,15780500,4282393088, 0, 0, 0, 0,1973790,4294967295, 0, 0, 0, 0,1973790,4282393088, 0, 0, 0, 0,5921370,0, 0, 0, 0, 0,5921370,4282393088, 0, 0, 0, 0,196,4282393088, 0, 1, 0, 0,1973790,13421772, 0, 0, 0, 0,11896485,4282393088, 0, 0, 0, 0,13421772,7884582, 0, 0, 0, 0,5278147,4203008, 0, 0, 0, 0,13421772,4282393088, 0, 0, 0, 0,13421772,4282393088, 0, 0, 0, 0,4203008,4294967295, 0, 0, 0, 0
Bruce(Default),16776960,4294967295, 0, 0, 0, 0,8421504,4203008, 0, 0, 0, 0,0,4294967295, 0, 0, 0, 0,52479,4203008, 0, 0, 0, 0,4203008,4294967295, 0, 0, 0, 0,8421504,4282393088, 0, 0, 0, 0,8421504,0, 0, 0, 0, 0,16777215,0, 0, 0, 0, 0,255,4203008, 0, 1, 0, 0,4203008,0, 0, 0, 0, 0,8978431,4203008, 0, 0, 0, 0,16777215,7884582, 0, 0, 0, 0,65280,4203008, 0, 0, 0, 0,15461613,4203008, 0, 0, 0, 0,16776960,4203008, 0, 0, 0, 0,4203008,4294967295, 0, 0, 0, 0


CURIOUS... What numeric format are the color values themselves?  Some of the decimal numeric values are obvious.  But some of those background colors are really big numbers... They don't appear to be a decimal format of an RGB value.

Paul Squires

Quote from: Bruce Huber on December 04, 2017, 10:06:57 PM
CURIOUS... What numeric format are the color values themselves?  Some of the decimal numeric values are obvious.  But some of those background colors are really big numbers... They don't appear to be a decimal format of an RGB value.

The color values are returned from Jose's wrapper AfxChooseColorDialog (AfxWin.inc line 896), which is a wrapper around the WinAPI function ChooseColor. https://msdn.microsoft.com/en-us/library/windows/desktop/ms646912(v=vs.85).aspx
It is essentially a LONG value (COLORREF which is a define for DWORD). To create the value you can use FB's BGR function.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Bruce Huber

Update on the theme color problem:

There must have been a control character in the Visual Studio (Dark) theme record in the WinFBE.ini file.
(I had only looked for null chars before).

I was having strange problems - like WinFBE hanging on the WinFBE.ini file (via Process Monitor) during an exit, instead of closing down.  So I went in and deleted the VS theme and my attempted clone of it - leaving just the Default theme and my new clone of that.  Now WinFBE is working fine again.