Added MUI_TEXTCOLOR setting. Check/Radio control themes are disabled when high contrast mode is on as a band-aid for SetCtlColors issues.

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7013 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2018-09-13 13:35:25 +00:00
parent 67b443ec18
commit a852d07897
14 changed files with 132 additions and 50 deletions

View file

@ -49,6 +49,7 @@ Var mui.Button.Back
!insertmacro MUI_DEFAULT MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!insertmacro MUI_DEFAULT MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
!insertmacro MUI_DEFAULT MUI_BGCOLOR "FFFFFF"
!insertmacro MUI_DEFAULT MUI_TEXTCOLOR "000000"
;Map *_NOSTRETCH legacy define to the correct *_STRETCH value
!verbose push 2
@ -241,11 +242,11 @@ Var mui.Button.Back
GetDlgItem $mui.Header.SubText $HWNDPARENT 1038
!ifndef MUI_HEADER_TRANSPARENT_TEXT
SetCtlColors $mui.Header.Text "" "${MUI_BGCOLOR}"
SetCtlColors $mui.Header.SubText "" "${MUI_BGCOLOR}"
SetCtlColors $mui.Header.Text "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
SetCtlColors $mui.Header.SubText "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
!else
SetCtlColors $mui.Header.Text "" "transparent"
SetCtlColors $mui.Header.SubText "" "transparent"
SetCtlColors $mui.Header.Text "${MUI_TEXTCOLOR}" "transparent"
SetCtlColors $mui.Header.SubText "${MUI_TEXTCOLOR}" "transparent"
!endif
;Header image

View file

@ -112,7 +112,8 @@ Directory page
GetDlgItem $mui.DirectoryPage.SpaceAvailable $mui.DirectoryPage 1024
!ifdef MUI_DIRECTORYPAGE_BGCOLOR
SetCtlColors $mui.DirectoryPage.Directory "" "${MUI_DIRECTORYPAGE_BGCOLOR}"
!insertmacro MUI_DEFAULT MUI_DIRECTORYPAGE_TEXTCOLOR ""
SetCtlColors $mui.DirectoryPage.Directory "${MUI_DIRECTORYPAGE_TEXTCOLOR}" "${MUI_DIRECTORYPAGE_BGCOLOR}"
!endif
!insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW

View file

@ -327,22 +327,22 @@ Finish page (implemented using nsDialogs)
;Title text
${NSD_CreateLabel} 120u 10u 195u ${MUI_FINISHPAGE_TITLE_HEIGHT}u "${MUI_FINISHPAGE_TITLE}"
Pop $mui.FinishPage.Title
SetCtlColors $mui.FinishPage.Title "" "${MUI_BGCOLOR}"
SetCtlColors $mui.FinishPage.Title "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
CreateFont $mui.FinishPage.Title.Font "$(^Font)" "12" "700"
SendMessage $mui.FinishPage.Title ${WM_SETFONT} $mui.FinishPage.Title.Font 0
;Finish text
${NSD_CreateLabel} 120u ${MUI_FINISHPAGE_TEXT_TOP}u 195u ${MUI_FINISHPAGE_TEXT_HEIGHT_BUTTONS}u "${MUI_FINISHPAGE_TEXT_REBOOT}"
Pop $mui.FinishPage.Text
SetCtlColors $mui.FinishPage.Text "" "${MUI_BGCOLOR}"
SetCtlColors $mui.FinishPage.Text "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
;Radio buttons for reboot page
${NSD_CreateRadioButton} 120u ${MUI_FINISHPAGE_REBOOTNOW_TOP}u 195u 10u "${MUI_FINISHPAGE_TEXT_REBOOTNOW}"
Pop $mui.FinishPage.RebootNow
SetCtlColors $mui.FinishPage.RebootNow "" "${MUI_BGCOLOR}"
SetCtlColors $mui.FinishPage.RebootNow "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
${NSD_CreateRadioButton} 120u ${MUI_FINISHPAGE_REBOOTLATER_TOP}u 195u 10u "${MUI_FINISHPAGE_TEXT_REBOOTLATER}"
Pop $mui.FinishPage.RebootLater
SetCtlColors $mui.FinishPage.RebootLater "" "${MUI_BGCOLOR}"
SetCtlColors $mui.FinishPage.RebootLater "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
!ifndef MUI_FINISHPAGE_REBOOTLATER_DEFAULT
SendMessage $mui.FinishPage.RebootNow ${BM_SETCHECK} ${BST_CHECKED} 0
!else
@ -357,7 +357,7 @@ Finish page (implemented using nsDialogs)
;Title text
${NSD_CreateLabel} 120u 10u 195u ${MUI_FINISHPAGE_TITLE_HEIGHT}u "${MUI_FINISHPAGE_TITLE}"
Pop $mui.FinishPage.Title
SetCtlColors $mui.FinishPage.Title "" "${MUI_BGCOLOR}"
SetCtlColors $mui.FinishPage.Title "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
CreateFont $mui.FinishPage.Title.Font "$(^Font)" "12" "700"
SendMessage $mui.FinishPage.Title ${WM_SETFONT} $mui.FinishPage.Title.Font 0
@ -368,13 +368,13 @@ Finish page (implemented using nsDialogs)
${NSD_CreateLabel} 120u ${MUI_FINISHPAGE_TEXT_TOP}u 195u ${MUI_FINISHPAGE_TEXT_HEIGHT_BUTTONS}u "${MUI_FINISHPAGE_TEXT}"
!endif
Pop $mui.FinishPage.Text
SetCtlColors $mui.FinishPage.Text "" "${MUI_BGCOLOR}"
SetCtlColors $mui.FinishPage.Text "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
;Checkboxes
!ifdef MUI_FINISHPAGE_RUN
${NSD_CreateCheckbox} 120u ${MUI_FINISHPAGE_RUN_TOP}u 195u 10u "${MUI_FINISHPAGE_RUN_TEXT}"
Pop $mui.FinishPage.Run
SetCtlColors $mui.FinishPage.Run "" "${MUI_BGCOLOR}"
SetCtlColors $mui.FinishPage.Run "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
!ifndef MUI_FINISHPAGE_RUN_NOTCHECKED
SendMessage $mui.FinishPage.Run ${BM_SETCHECK} ${BST_CHECKED} 0
!endif
@ -383,7 +383,7 @@ Finish page (implemented using nsDialogs)
!ifdef MUI_FINISHPAGE_SHOWREADME
${NSD_CreateCheckbox} 120u ${MUI_FINISHPAGE_SHOWREADME_TOP}u 195u 10u "${MUI_FINISHPAGE_SHOWREADME_TEXT}"
Pop $mui.FinishPage.ShowReadme
SetCtlColors $mui.FinishPage.ShowReadme "" "${MUI_BGCOLOR}"
SetCtlColors $mui.FinishPage.ShowReadme "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
!ifndef MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
SendMessage $mui.FinishPage.ShowReadme ${BM_SETCHECK} ${BST_CHECKED} 0
!endif
@ -408,6 +408,24 @@ Finish page (implemented using nsDialogs)
StrCpy $mui.FinishPage.DisableAbortWarning "1"
!endif
!ifndef MUI_FORCECLASSICCONTROLS
${If} ${IsHighContrastModeActive}
!endif
; SetCtlColors does not change the check/radio text color (bug #443)
!ifndef MUI_FINISHPAGE_NOREBOOTSUPPORT
System::Call 'UXTHEME::SetWindowTheme(p$mui.FinishPage.RebootNow,w" ",w" ")'
System::Call 'UXTHEME::SetWindowTheme(p$mui.FinishPage.RebootLater,w" ",w" ")'
!endif
!ifdef MUI_FINISHPAGE_RUN
System::Call 'UXTHEME::SetWindowTheme(p$mui.FinishPage.Run,w" ",w" ")'
!endif
!ifdef MUI_FINISHPAGE_SHOWREADME
System::Call 'UXTHEME::SetWindowTheme(p$mui.FinishPage.ShowReadme,w" ",w" ")'
!endif
!ifndef MUI_FORCECLASSICCONTROLS
${EndIf}
!endif
;Show page
Call ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}muiPageLoadFullWindow
!insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW

View file

@ -121,7 +121,7 @@ License page
Function "${SHOW}"
;Get conrol handles
;Get control handles
FindWindow $mui.LicensePage "#32770" "" $HWNDPARENT
GetDlgItem $mui.LicensePage.TopText $mui.LicensePage 1040
GetDlgItem $mui.LicensePage.Text $mui.LicensePage 1006

View file

@ -136,8 +136,9 @@ Start Menu folder page
GetDlgItem $mui.StartMenuPage.FolderList $mui.StartMenuPage 1004
!ifdef MUI_STARTMENUPAGE_BGCOLOR
SetCtlColors $mui.StartMenuPage.Location "" "${MUI_STARTMENUPAGE_BGCOLOR}"
SetCtlColors $mui.StartMenuMenu.FolderList "" "${MUI_STARTMENUPAGE_BGCOLOR}"
!insertmacro MUI_DEFAULT MUI_STARTMENUPAGE_TEXTCOLOR ""
SetCtlColors $mui.StartMenuPage.Location "${MUI_STARTMENUPAGE_TEXTCOLOR}" "${MUI_STARTMENUPAGE_BGCOLOR}"
SetCtlColors $mui.StartMenuMenu.FolderList "${MUI_STARTMENUPAGE_TEXTCOLOR}" "${MUI_STARTMENUPAGE_BGCOLOR}"
!endif
!insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW

View file

@ -147,14 +147,14 @@ Welcome page (implemented using nsDialogs)
;Title
${NSD_CreateLabel} 120u 10u 195u ${MUI_WELCOMEPAGE_TITLE_HEIGHT}u "${MUI_WELCOMEPAGE_TITLE}"
Pop $mui.WelcomePage.Title
SetCtlColors $mui.WelcomePage.Title "" "${MUI_BGCOLOR}"
SetCtlColors $mui.WelcomePage.Title "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
CreateFont $mui.WelcomePage.Title.Font "$(^Font)" "12" "700"
SendMessage $mui.WelcomePage.Title ${WM_SETFONT} $mui.WelcomePage.Title.Font 0
;Welcome text
${NSD_CreateLabel} 120u ${MUI_WELCOMEPAGE_TEXT_TOP}u 195u 130u "${MUI_WELCOMEPAGE_TEXT}"
Pop $mui.WelcomePage.Text
SetCtlColors $mui.WelcomePage.Text "" "${MUI_BGCOLOR}"
SetCtlColors $mui.WelcomePage.Text "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
;Show page
Call ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}muiPageLoadFullWindow

View file

@ -339,6 +339,10 @@
<strong>MUI_HEADER_TRANSPARENT_TEXT</strong><br />
Set a transparent background for the header's label controls. Useful for custom
user interfaces that set a bigger header image.</p>
<p>
<strong>MUI_TEXTCOLOR</strong> <span class="parameter">(color: RRGGBBR hexadecimal)</span><br />
Text color for the header, the Welcome page and the Finish page.<br />
<em>Default: 000000</em></p>
</div>
<h3>
<img class="trigger" alt="Open/Close section" id="trigger_inres" src="images/open.gif"