diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-07-30 11:39:22 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-08-09 10:27:40 -0600 |
commit | 89042ffee375d4e36521045405271f849ae8e951 (patch) | |
tree | 4e5cdb24dc916ef9f32246e10c79dc763b3c55b2 | |
parent | e3940e85379b44ab8f68d01cbb6b11db8b0bad77 (diff) | |
download | wix-89042ffee375d4e36521045405271f849ae8e951.tar.gz wix-89042ffee375d4e36521045405271f849ae8e951.tar.bz2 wix-89042ffee375d4e36521045405271f849ae8e951.zip |
WIXFEAT:4863 In thmutil editboxes, save the value as a literal string and format the variable when populating it.
-rw-r--r-- | src/dutil/inc/thmutil.h | 1 | ||||
-rw-r--r-- | src/dutil/thmutil.cpp | 26 |
2 files changed, 13 insertions, 14 deletions
diff --git a/src/dutil/inc/thmutil.h b/src/dutil/inc/thmutil.h index 00fa1381..11eac9c2 100644 --- a/src/dutil/inc/thmutil.h +++ b/src/dutil/inc/thmutil.h | |||
@@ -36,6 +36,7 @@ typedef HRESULT(CALLBACK *PFNTHM_GET_VARIABLE_STRING)( | |||
36 | typedef HRESULT(CALLBACK *PFNTHM_SET_VARIABLE_STRING)( | 36 | typedef HRESULT(CALLBACK *PFNTHM_SET_VARIABLE_STRING)( |
37 | __in_z LPCWSTR wzVariable, | 37 | __in_z LPCWSTR wzVariable, |
38 | __in_z_opt LPCWSTR wzValue, | 38 | __in_z_opt LPCWSTR wzValue, |
39 | __in BOOL fFormatted, | ||
39 | __in_opt LPVOID pvContext | 40 | __in_opt LPVOID pvContext |
40 | ); | 41 | ); |
41 | 42 | ||
diff --git a/src/dutil/thmutil.cpp b/src/dutil/thmutil.cpp index 6025749e..046bdc32 100644 --- a/src/dutil/thmutil.cpp +++ b/src/dutil/thmutil.cpp | |||
@@ -1020,7 +1020,7 @@ DAPI_(HRESULT) ThemeShowPageEx( | |||
1020 | pSavedVariable = pPage->rgSavedVariables + v; | 1020 | pSavedVariable = pPage->rgSavedVariables + v; |
1021 | if (pSavedVariable->wzName) | 1021 | if (pSavedVariable->wzName) |
1022 | { | 1022 | { |
1023 | pTheme->pfnSetStringVariable(pSavedVariable->wzName, pSavedVariable->sczValue, pTheme->pvVariableContext); | 1023 | pTheme->pfnSetStringVariable(pSavedVariable->wzName, pSavedVariable->sczValue, FALSE, pTheme->pvVariableContext); |
1024 | } | 1024 | } |
1025 | } | 1025 | } |
1026 | } | 1026 | } |
@@ -4128,7 +4128,7 @@ static void OnBrowseDirectory( | |||
4128 | } | 4128 | } |
4129 | else if (pTheme->pfnSetStringVariable) | 4129 | else if (pTheme->pfnSetStringVariable) |
4130 | { | 4130 | { |
4131 | hr = pTheme->pfnSetStringVariable(pAction->BrowseDirectory.sczVariableName, wzPath, pTheme->pvVariableContext); | 4131 | hr = pTheme->pfnSetStringVariable(pAction->BrowseDirectory.sczVariableName, wzPath, FALSE, pTheme->pvVariableContext); |
4132 | ThmExitOnFailure(hr, "Failed to set variable: %ls", pAction->BrowseDirectory.sczVariableName); | 4132 | ThmExitOnFailure(hr, "Failed to set variable: %ls", pAction->BrowseDirectory.sczVariableName); |
4133 | } | 4133 | } |
4134 | else if (pTargetControl) | 4134 | else if (pTargetControl) |
@@ -4233,7 +4233,7 @@ static BOOL OnButtonClicked( | |||
4233 | case THEME_CONTROL_TYPE_RADIOBUTTON: | 4233 | case THEME_CONTROL_TYPE_RADIOBUTTON: |
4234 | if (pTheme->pfnSetStringVariable && pControl->sczVariable && *pControl->sczVariable && ThemeIsControlChecked(pTheme, pControl->wId)) | 4234 | if (pTheme->pfnSetStringVariable && pControl->sczVariable && *pControl->sczVariable && ThemeIsControlChecked(pTheme, pControl->wId)) |
4235 | { | 4235 | { |
4236 | pTheme->pfnSetStringVariable(pControl->sczVariable, pControl->sczValue, pTheme->pvVariableContext); | 4236 | pTheme->pfnSetStringVariable(pControl->sczVariable, pControl->sczValue, FALSE, pTheme->pvVariableContext); |
4237 | fRefresh = TRUE; | 4237 | fRefresh = TRUE; |
4238 | } | 4238 | } |
4239 | break; | 4239 | break; |
@@ -4459,6 +4459,7 @@ static HRESULT ShowControl( | |||
4459 | HRESULT hr = S_OK; | 4459 | HRESULT hr = S_OK; |
4460 | DWORD iPageControl = 0; | 4460 | DWORD iPageControl = 0; |
4461 | HWND hwndFocus = NULL; | 4461 | HWND hwndFocus = NULL; |
4462 | LPWSTR sczFormatString = NULL; | ||
4462 | LPWSTR sczText = NULL; | 4463 | LPWSTR sczText = NULL; |
4463 | THEME_SAVEDVARIABLE* pSavedVariable = NULL; | 4464 | THEME_SAVEDVARIABLE* pSavedVariable = NULL; |
4464 | BOOL fHide = SW_HIDE == nCmdShow; | 4465 | BOOL fHide = SW_HIDE == nCmdShow; |
@@ -4471,7 +4472,7 @@ static HRESULT ShowControl( | |||
4471 | hr = ThemeGetTextControl(pTheme, pControl->wId, &sczText); | 4472 | hr = ThemeGetTextControl(pTheme, pControl->wId, &sczText); |
4472 | ThmExitOnFailure(hr, "Failed to get the text for control: %ls", pControl->sczName); | 4473 | ThmExitOnFailure(hr, "Failed to get the text for control: %ls", pControl->sczName); |
4473 | 4474 | ||
4474 | hr = pTheme->pfnSetStringVariable(pControl->sczName, sczText, pTheme->pvVariableContext); | 4475 | hr = pTheme->pfnSetStringVariable(pControl->sczName, sczText, FALSE, pTheme->pvVariableContext); |
4475 | ThmExitOnFailure(hr, "Failed to set the variable '%ls' to '%ls'", pControl->sczName, sczText); | 4476 | ThmExitOnFailure(hr, "Failed to set the variable '%ls' to '%ls'", pControl->sczName, sczText); |
4476 | } | 4477 | } |
4477 | 4478 | ||
@@ -4621,17 +4622,13 @@ static HRESULT ShowControl( | |||
4621 | 4622 | ||
4622 | // If this is an editbox control, | 4623 | // If this is an editbox control, |
4623 | // try to set its default state to the state of a matching named variable. | 4624 | // try to set its default state to the state of a matching named variable. |
4624 | if (pTheme->pfnGetStringVariable && THEME_CONTROL_TYPE_EDITBOX == pControl->type) | 4625 | if (pTheme->pfnFormatString && THEME_CONTROL_TYPE_EDITBOX == pControl->type) |
4625 | { | 4626 | { |
4626 | hr = pTheme->pfnGetStringVariable(pControl->sczName, &sczText, pTheme->pvVariableContext); | 4627 | hr = StrAllocFormatted(&sczFormatString, L"[%ls]", pControl->sczName); |
4627 | if (E_NOTFOUND == hr) | 4628 | ThmExitOnFailure(hr, "Failed to create format string: '%ls'", pControl->sczName); |
4628 | { | 4629 | |
4629 | ReleaseNullStr(sczText); | 4630 | hr = pTheme->pfnFormatString(sczFormatString, &sczText, pTheme->pvVariableContext); |
4630 | } | 4631 | ThmExitOnFailure(hr, "Failed to format string: '%ls'", sczFormatString); |
4631 | else | ||
4632 | { | ||
4633 | ThmExitOnFailure(hr, "Failed to get string variable: %ls", pControl->sczName); | ||
4634 | } | ||
4635 | 4632 | ||
4636 | if (THEME_SHOW_PAGE_REASON_REFRESH != reason && pPage && pControl->wPageId) | 4633 | if (THEME_SHOW_PAGE_REASON_REFRESH != reason && pPage && pControl->wPageId) |
4637 | { | 4634 | { |
@@ -4722,6 +4719,7 @@ static HRESULT ShowControl( | |||
4722 | } | 4719 | } |
4723 | 4720 | ||
4724 | LExit: | 4721 | LExit: |
4722 | ReleaseStr(sczFormatString); | ||
4725 | ReleaseStr(sczText); | 4723 | ReleaseStr(sczText); |
4726 | 4724 | ||
4727 | return hr; | 4725 | return hr; |