@@ -30,6 +30,19 @@ const int DEFAULT_TASK_OPACITY10=85; // 85%
3030
3131// /////////////////////////////////////////////////////////////////////////////
3232
33+ CString RgbToBgr (const wchar_t * str)
34+ {
35+ CString retval;
36+ retval.Format (L" %06X" , RgbToBgr (ParseColor (str)));
37+
38+ return retval;
39+ }
40+
41+ CString BgrToRgb (const wchar_t * str)
42+ {
43+ return RgbToBgr (str);
44+ }
45+
3346class CSkinSettingsDlg : public CResizeableDlg <CSkinSettingsDlg>
3447{
3548public:
@@ -422,7 +435,7 @@ void CSkinSettingsDlg::UpdateSkinSettings( void )
422435 if (!option.bEnabled || bLocked)
423436 image|=SETTING_STATE_DISABLED;
424437 if (option.bValue && option.type >SKIN_OPTION_BOOL)
425- Sprintf (text,_countof (text),L" %s: %s" ,option.label ,option.sValue );
438+ Sprintf (text,_countof (text),L" %s: %s" ,option.label ,(option. type ==SKIN_OPTION_COLOR)? BgrToRgb (option. sValue ): option.sValue );
426439 else
427440 Sprintf (text,_countof (text),L" %s" ,option.label );
428441
@@ -482,9 +495,7 @@ LRESULT CSkinSettingsDlg::OnCustomDraw( int idCtrl, LPNMHDR pnmh, BOOL& bHandled
482495 if (TreeView_GetItemRect (m_Tree,(HTREEITEM)pDraw->nmcd .dwItemSpec ,&rc,TRUE ))
483496 {
484497 const wchar_t *str=m_CurrentSkin.Options [pDraw->nmcd .lItemlParam ].sValue ;
485- wchar_t *end;
486- COLORREF color=wcstoul (str,&end,16 );
487- SetDCBrushColor (pDraw->nmcd .hdc ,color&0xFFFFFF );
498+ SetDCBrushColor (pDraw->nmcd .hdc ,ParseColor (str));
488499 SelectObject (pDraw->nmcd .hdc ,GetStockObject (DC_BRUSH));
489500 SelectObject (pDraw->nmcd .hdc ,GetStockObject (BLACK_PEN));
490501 Rectangle (pDraw->nmcd .hdc ,rc.right ,rc.top ,rc.right +rc.bottom -rc.top ,rc.bottom -1 );
@@ -690,15 +701,14 @@ LRESULT CSkinSettingsDlg::OnBrowse( WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
690701 CString str;
691702 m_EditBox.GetWindowText (str);
692703 str.TrimLeft (); str.TrimRight ();
693- wchar_t *end;
694- COLORREF val=wcstol (str,&end,16 )&0xFFFFFF ;
704+ COLORREF val=RgbToBgr (ParseColor (str));
695705 static COLORREF customColors[16 ];
696706 CHOOSECOLOR choose={sizeof (choose),m_hWnd,NULL ,val,customColors};
697707 choose.Flags =CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT;
698708 if (ChooseColor (&choose))
699709 {
700710 wchar_t text[100 ];
701- Sprintf (text,_countof (text),L" %06X" ,choose.rgbResult );
711+ Sprintf (text,_countof (text),L" %06X" ,BgrToRgb ( choose.rgbResult ) );
702712 m_EditBox.SetWindowText (text);
703713 ApplyEditBox ();
704714 m_Tree.Invalidate ();
@@ -717,7 +727,11 @@ void CSkinSettingsDlg::ApplyEditBox( void )
717727 CString str;
718728 m_EditBox.GetWindowText (str);
719729 str.TrimLeft (); str.TrimRight ();
720- m_CurrentSkin.Options [m_EditItemIndex].sValue =str;
730+ auto & option=m_CurrentSkin.Options [m_EditItemIndex];
731+ if (option.type ==SKIN_OPTION_COLOR)
732+ option.sValue =RgbToBgr (str);
733+ else
734+ option.sValue =str;
721735 StoreSkinOptions ();
722736 }
723737}
@@ -730,7 +744,7 @@ void CSkinSettingsDlg::ItemSelected( HTREEITEM hItem, int index, bool bEnabled )
730744 const MenuSkin::Option &option=m_CurrentSkin.Options [m_EditItemIndex];
731745 wchar_t text[256 ];
732746 if (option.bValue && option.type >SKIN_OPTION_BOOL)
733- Sprintf (text,_countof (text),L" %s: %s" ,option.label ,option.sValue );
747+ Sprintf (text,_countof (text),L" %s: %s" ,option.label ,(option. type ==SKIN_OPTION_COLOR)? BgrToRgb (option. sValue ): option.sValue );
734748 else
735749 Sprintf (text,_countof (text),L" %s" ,option.label );
736750 TVITEM item={TVIF_TEXT,m_EditItem,0 ,0 ,text};
@@ -745,7 +759,10 @@ void CSkinSettingsDlg::ItemSelected( HTREEITEM hItem, int index, bool bEnabled )
745759 const MenuSkin::Option &option=m_CurrentSkin.Options [index];
746760 if (option.type >SKIN_OPTION_BOOL)
747761 mode=option.type ;
748- text=option.sValue ;
762+ if (option.type ==SKIN_OPTION_COLOR)
763+ text=BgrToRgb (option.sValue );
764+ else
765+ text=option.sValue ;
749766 }
750767
751768 RECT rc;
@@ -4946,7 +4963,7 @@ void UpdateSettings( void )
49464963 if (GetWinVersion ()>WIN_VER_WIN7)
49474964 {
49484965 int color=GetSystemGlassColor8 ();
4949- UpdateSetting (L" TaskbarColor" ,CComVariant ((( color& 0xFF )<< 16 )|(color& 0xFF00 )|((color>> 16 )& 0xFF )),false );
4966+ UpdateSetting (L" TaskbarColor" ,CComVariant (RgbToBgr ( color)),false );
49504967 }
49514968
49524969 if (GetWinVersion ()<=WIN_VER_WIN7)
0 commit comments