diff --git a/Src/ClassicIE/ClassicIEDLL/ClassicIEDLL.rc b/Src/ClassicIE/ClassicIEDLL/ClassicIEDLL.rc index 9d163d852..cd2e5dfd0 100644 --- a/Src/ClassicIE/ClassicIEDLL/ClassicIEDLL.rc +++ b/Src/ClassicIE/ClassicIEDLL/ClassicIEDLL.rc @@ -135,17 +135,17 @@ BEGIN IDS_LANGUAGE_SETTINGS "Language" IDS_CAPTION_FONT "Caption font" IDS_CAPTION_FONT_TIP "Select the font and text size to use for the caption" - IDS_TEXT_COLOR "Text color" + IDS_TEXT_COLOR "Text color (RRGGBB)" IDS_TEXT_COLOR_TIP "Select the color for the caption text" - IDS_MAXTEXT_COLOR "Text color (maximized)" + IDS_MAXTEXT_COLOR "Text color (maximized) (RRGGBB)" IDS_MAXTEXT_COLOR_TIP "Select the color for the caption text when the window is maximized" - IDS_INTEXT_COLOR "Text color (inactive)" + IDS_INTEXT_COLOR "Text color (inactive) (RRGGBB)" IDS_INTEXT_COLOR_TIP "Select the color for the caption text when the window is inactive" - IDS_MAXINTEXT_COLOR "Text color (maximized, inactive)" + IDS_MAXINTEXT_COLOR "Text color (maximized, inactive) (RRGGBB)" IDS_MAXINTEXT_COLOR_TIP "Select the color for the caption text when the window is maximized and inactive" IDS_GLOW "Text glow" IDS_GLOW_TIP "When this is checked, the text will have a glow around it" - IDS_GLOW_COLOR "Glow color" + IDS_GLOW_COLOR "Glow color (RRGGBB)" IDS_GLOW_COLOR_TIP "Select the color for the caption glow" END @@ -153,7 +153,7 @@ STRINGTABLE BEGIN IDS_MAXGLOW "Text glow (maximized)" IDS_MAXGLOW_TIP "When this is checked, the text in the maximized window will have a glow around it" - IDS_MAXGLOW_COLOR "Glow color (maximized)" + IDS_MAXGLOW_COLOR "Glow color (maximized) (RRGGBB)" IDS_MAXGLOW_COLOR_TIP "Select the color for the caption glow when the window is maximized" IDS_STATUS_SETTINGS "Status Bar" IDS_SHOW_PROGRESS "Show progress" diff --git a/Src/Lib/SettingsUIHelper.cpp b/Src/Lib/SettingsUIHelper.cpp index a23d2b7cb..effb3f16a 100644 --- a/Src/Lib/SettingsUIHelper.cpp +++ b/Src/Lib/SettingsUIHelper.cpp @@ -2651,15 +2651,14 @@ LRESULT CTreeSettingsDlg::OnBrowse( WORD wNotifyCode, WORD wID, HWND hWndCtl, BO CString str; m_EditBox.GetWindowText(str); str.TrimLeft(); str.TrimRight(); - wchar_t *end; - COLORREF val=wcstol(str,&end,16)&0xFFFFFF; + COLORREF val=RgbToBgr(ParseColor(str)); static COLORREF customColors[16]; CHOOSECOLOR choose={sizeof(choose),m_hWnd,NULL,val,customColors}; choose.Flags=CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT; if (ChooseColor(&choose)) { wchar_t text[100]; - Sprintf(text,_countof(text),L"%06X",choose.rgbResult); + Sprintf(text,_countof(text),L"%06X",BgrToRgb(choose.rgbResult)); m_EditBox.SetWindowText(text); ApplyEditBox(); UpdateGroup(m_pEditSetting); @@ -3048,8 +3047,7 @@ void CTreeSettingsDlg::ApplyEditBox( void ) } else if (pSetting->type==CSetting::TYPE_COLOR) { - wchar_t *end; - int val=wcstol(str,&end,16)&0xFFFFFF; + int val=RgbToBgr(ParseColor(str)); if (pSetting->value.vt!=VT_I4 || pSetting->value.intVal!=val) { pSetting->value=CComVariant(val); @@ -3156,7 +3154,7 @@ void CTreeSettingsDlg::ItemSelected( HTREEITEM hItem, CSetting *pSetting, bool b mode=EDIT_COLOR; int val=0; if (valVar.vt==VT_I4) - val=valVar.intVal; + val=BgrToRgb(valVar.intVal); Sprintf(text,_countof(text),L"%06X",val); } } @@ -3462,7 +3460,7 @@ void CTreeSettingsDlg::UpdateGroup( const CSetting *pModified ) CString str=LoadStringEx(pSetting->nameID); int val=0; if (valVar.vt==VT_I4) - val=valVar.intVal; + val=BgrToRgb(valVar.intVal); Sprintf(text,_countof(text),L"%s: %06X",str,val); item.mask|=TVIF_TEXT; } @@ -3616,3 +3614,19 @@ bool CDefaultSettingsPanel::Validate( HWND parent ) s_Dialog.Validate(); return true; } + +DWORD RgbToBgr(DWORD val) +{ + return ((val & 0xFF) << 16) | (val & 0xFF00) | ((val >> 16) & 0xFF); +} + +DWORD BgrToRgb(DWORD val) +{ + return RgbToBgr(val); +} + +DWORD ParseColor(const wchar_t* str) +{ + wchar_t* end; + return wcstoul(str, &end, 16) & 0xFFFFFF; +} diff --git a/Src/Lib/SettingsUIHelper.h b/Src/Lib/SettingsUIHelper.h index 473dd953c..acdea3f63 100644 --- a/Src/Lib/SettingsUIHelper.h +++ b/Src/Lib/SettingsUIHelper.h @@ -387,3 +387,11 @@ extern const GUID FOLDERID_DesktopRoot; bool BrowseCommandHelper( HWND parent, wchar_t *text ); bool BrowseLinkHelper( HWND parent, wchar_t *text, bool bFoldersOnly ); bool BrowseIconHelper( HWND parent, wchar_t *text ); + +// convert color in RRGGBB format to BBGGRR +DWORD RgbToBgr(DWORD val); +// convert color in BBGGRR format to RRGGBB +DWORD BgrToRgb(DWORD val); + +// parse color from hexadecimal string +DWORD ParseColor(const wchar_t* str); diff --git a/Src/StartMenu/StartMenuDLL/SettingsUI.cpp b/Src/StartMenu/StartMenuDLL/SettingsUI.cpp index 5a406859e..d1107751f 100644 --- a/Src/StartMenu/StartMenuDLL/SettingsUI.cpp +++ b/Src/StartMenu/StartMenuDLL/SettingsUI.cpp @@ -30,6 +30,19 @@ const int DEFAULT_TASK_OPACITY10=85; // 85% /////////////////////////////////////////////////////////////////////////////// +CString RgbToBgr(const wchar_t* str) +{ + CString retval; + retval.Format(L"%06X", RgbToBgr(ParseColor(str))); + + return retval; +} + +CString BgrToRgb(const wchar_t* str) +{ + return RgbToBgr(str); +} + class CSkinSettingsDlg: public CResizeableDlg { public: @@ -422,7 +435,7 @@ void CSkinSettingsDlg::UpdateSkinSettings( void ) if (!option.bEnabled || bLocked) image|=SETTING_STATE_DISABLED; if (option.bValue && option.type>SKIN_OPTION_BOOL) - Sprintf(text,_countof(text),L"%s: %s",option.label,option.sValue); + Sprintf(text,_countof(text),L"%s: %s",option.label,(option.type==SKIN_OPTION_COLOR)?BgrToRgb(option.sValue):option.sValue); else Sprintf(text,_countof(text),L"%s",option.label); @@ -482,9 +495,7 @@ LRESULT CSkinSettingsDlg::OnCustomDraw( int idCtrl, LPNMHDR pnmh, BOOL& bHandled if (TreeView_GetItemRect(m_Tree,(HTREEITEM)pDraw->nmcd.dwItemSpec,&rc,TRUE)) { const wchar_t *str=m_CurrentSkin.Options[pDraw->nmcd.lItemlParam].sValue; - wchar_t *end; - COLORREF color=wcstoul(str,&end,16); - SetDCBrushColor(pDraw->nmcd.hdc,color&0xFFFFFF); + SetDCBrushColor(pDraw->nmcd.hdc,ParseColor(str)); SelectObject(pDraw->nmcd.hdc,GetStockObject(DC_BRUSH)); SelectObject(pDraw->nmcd.hdc,GetStockObject(BLACK_PEN)); 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 CString str; m_EditBox.GetWindowText(str); str.TrimLeft(); str.TrimRight(); - wchar_t *end; - COLORREF val=wcstol(str,&end,16)&0xFFFFFF; + COLORREF val=RgbToBgr(ParseColor(str)); static COLORREF customColors[16]; CHOOSECOLOR choose={sizeof(choose),m_hWnd,NULL,val,customColors}; choose.Flags=CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT; if (ChooseColor(&choose)) { wchar_t text[100]; - Sprintf(text,_countof(text),L"%06X",choose.rgbResult); + Sprintf(text,_countof(text),L"%06X",BgrToRgb(choose.rgbResult)); m_EditBox.SetWindowText(text); ApplyEditBox(); m_Tree.Invalidate(); @@ -717,7 +727,11 @@ void CSkinSettingsDlg::ApplyEditBox( void ) CString str; m_EditBox.GetWindowText(str); str.TrimLeft(); str.TrimRight(); - m_CurrentSkin.Options[m_EditItemIndex].sValue=str; + auto& option=m_CurrentSkin.Options[m_EditItemIndex]; + if (option.type==SKIN_OPTION_COLOR) + option.sValue=RgbToBgr(str); + else + option.sValue=str; StoreSkinOptions(); } } @@ -730,7 +744,7 @@ void CSkinSettingsDlg::ItemSelected( HTREEITEM hItem, int index, bool bEnabled ) const MenuSkin::Option &option=m_CurrentSkin.Options[m_EditItemIndex]; wchar_t text[256]; if (option.bValue && option.type>SKIN_OPTION_BOOL) - Sprintf(text,_countof(text),L"%s: %s",option.label,option.sValue); + Sprintf(text,_countof(text),L"%s: %s",option.label,(option.type==SKIN_OPTION_COLOR)?BgrToRgb(option.sValue):option.sValue); else Sprintf(text,_countof(text),L"%s",option.label); TVITEM item={TVIF_TEXT,m_EditItem,0,0,text}; @@ -745,7 +759,10 @@ void CSkinSettingsDlg::ItemSelected( HTREEITEM hItem, int index, bool bEnabled ) const MenuSkin::Option &option=m_CurrentSkin.Options[index]; if (option.type>SKIN_OPTION_BOOL) mode=option.type; - text=option.sValue; + if (option.type==SKIN_OPTION_COLOR) + text=BgrToRgb(option.sValue); + else + text=option.sValue; } RECT rc; @@ -4946,7 +4963,7 @@ void UpdateSettings( void ) if (GetWinVersion()>WIN_VER_WIN7) { int color=GetSystemGlassColor8(); - UpdateSetting(L"TaskbarColor",CComVariant(((color&0xFF)<<16)|(color&0xFF00)|((color>>16)&0xFF)),false); + UpdateSetting(L"TaskbarColor",CComVariant(RgbToBgr(color)),false); } if (GetWinVersion()<=WIN_VER_WIN7) diff --git a/Src/StartMenu/StartMenuDLL/StartMenuDLL.rc b/Src/StartMenu/StartMenuDLL/StartMenuDLL.rc index 416554e93..46634e16b 100644 --- a/Src/StartMenu/StartMenuDLL/StartMenuDLL.rc +++ b/Src/StartMenu/StartMenuDLL/StartMenuDLL.rc @@ -1082,7 +1082,7 @@ BEGIN IDS_MIN_HEIGHT_TIP "The main menu will be at least as tall as this many search results" IDS_GLASS_OVERRIDE "Override glass color" IDS_GLASS_OVERRIDE_TIP "Check this to override the system glass color to use in the menu" - IDS_GLASS_COLOR "Menu glass color" + IDS_GLASS_COLOR "Menu glass color (RRGGBB)" IDS_GLASS_COLOR_TIP "Select the glass color to use in the menu. How much this color affects the menu will depend on the selected skin" IDS_GLASS_INTENSITY "Menu glass intensity" IDS_GLASS_INTENSITY_TIP "Select the intensity (brightness) for the glass color in the menu (0 - dark, 100 - bright)" @@ -1144,17 +1144,17 @@ BEGIN IDS_STRING7024 "Shadows on glass#The text and the arrows in the second column of the main menu will have a drop shadow" IDS_STRING7025 "Opaque" IDS_STRING7026 "Main menu color" - IDS_STRING7027 "Custom color#Select custom color for the main menu" + IDS_STRING7027 "Custom color (RRGGBB)#Select custom color for the main menu" IDS_STRING7028 "Sub-menu color" - IDS_STRING7029 "Custom color#Select custom color for the sub-menus" + IDS_STRING7029 "Custom color (RRGGBB)#Select custom color for the sub-menus" IDS_STRING7030 "Silver" IDS_STRING7031 "Gold" IDS_STRING7032 "Steel" IDS_STRING7033 "Titanium" IDS_STRING7034 "Image for first column#Select custom image for the first column of the main menu" IDS_STRING7035 "Image for second column#Select custom image for the second column of the main menu" - IDS_STRING7036 "Text color for first column#Select custom color for the first column of the main menu text" - IDS_STRING7037 "Text color for second column#Select custom color for the second column of the main menu text" + IDS_STRING7036 "Text color for first column (RRGGBB)#Select custom color for the first column of the main menu text" + IDS_STRING7037 "Text color for second column (RRGGBB)#Select custom color for the second column of the main menu text" IDS_STRING7038 "Text size#Select custom size for the main menu text" END @@ -1249,7 +1249,7 @@ BEGIN IDS_TASK_AEROGLASS_TIP "The taskbar will have glass transparency that is compatible with the Aero Glass mod" IDS_TASK_OPACITY "Taskbar opacity" IDS_TASK_OPACITY_TIP "Set the opacity for the taskbar (0 - transparent, 100 - opaque)" - IDS_TASK_COLOR "Taskbar color" + IDS_TASK_COLOR "Taskbar color (RRGGBB)" IDS_TASK_COLOR_TIP "Set the color for the taskbar" IDS_PCSETTINGS "Settings" IDS_PCSETTINGS_TIP "Shows the modern Settings window" @@ -1288,7 +1288,7 @@ BEGIN IDS_TASK_BORDERS "Border sizes" IDS_TASK_BORDERS_TIP "Select how many pixel on each side of the texture to exclude from stretching" IDS_TASKBAR_SETTINGS "Taskbar" - IDS_TASK_TEXTCOLOR "Taskbar text color" + IDS_TASK_TEXTCOLOR "Taskbar text color (RRGGBB)" IDS_TASK_TEXTCOLOR_TIP "Select the color for the text on the taskbar" IDS_SELECT_LAST "Select the last item in shutdown menu" IDS_SELECT_LAST_TIP "When this is checked, the last item will be selected by default when the shutdown menu is opened with the keyboard"