diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-11-08 15:24:46 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-11-10 17:33:25 -0600 |
commit | 9d3af7547bb790d39157dd36dfa862a1abf47beb (patch) | |
tree | 410e6e46daf244dd4e087c658b827fea6231119a /src/libs | |
parent | b49ab4e082127e450b266c25218905c94495892e (diff) | |
download | wix-9d3af7547bb790d39157dd36dfa862a1abf47beb.tar.gz wix-9d3af7547bb790d39157dd36dfa862a1abf47beb.tar.bz2 wix-9d3af7547bb790d39157dd36dfa862a1abf47beb.zip |
Go back to thmutil not interfering with wixstdba controls.
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/thmutil.h | 5 | ||||
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/thmutil.cpp | 38 |
2 files changed, 22 insertions, 21 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/thmutil.h b/src/libs/dutil/WixToolset.DUtil/inc/thmutil.h index 2f0bfeac..8cf7dc92 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/thmutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/thmutil.h | |||
@@ -196,6 +196,7 @@ struct THEME_ASSIGN_CONTROL_ID | |||
196 | WORD wId; // id to apply to control | 196 | WORD wId; // id to apply to control |
197 | LPCWSTR wzName; // name of control to match | 197 | LPCWSTR wzName; // name of control to match |
198 | const THEME_CONTROL** ppControl; | 198 | const THEME_CONTROL** ppControl; |
199 | BOOL fDisableAutomaticFunctionality; // prevent declarative functionality from interfering with the application's imperative code | ||
199 | }; | 200 | }; |
200 | 201 | ||
201 | const WORD THEME_FIRST_ASSIGN_CONTROL_ID = 0x4000; // Recommended first control id to be assigned. | 202 | const WORD THEME_FIRST_ASSIGN_CONTROL_ID = 0x4000; // Recommended first control id to be assigned. |
@@ -223,7 +224,7 @@ typedef struct _THEME_CONTROL | |||
223 | 224 | ||
224 | LPWSTR sczEnableCondition; | 225 | LPWSTR sczEnableCondition; |
225 | LPWSTR sczVisibleCondition; | 226 | LPWSTR sczVisibleCondition; |
226 | BOOL fDisableVariableFunctionality; | 227 | BOOL fDisableAutomaticFunctionality; |
227 | 228 | ||
228 | union | 229 | union |
229 | { | 230 | { |
@@ -470,6 +471,8 @@ typedef struct _THEME_LOADINGCONTROL_RESULTS | |||
470 | // The values [100, THEME_FIRST_ASSIGN_CONTROL_ID) are reserved for thmutil. | 471 | // The values [100, THEME_FIRST_ASSIGN_CONTROL_ID) are reserved for thmutil. |
471 | // Due to this value being packed into 16 bits for many system window messages, this is restricted to a WORD. | 472 | // Due to this value being packed into 16 bits for many system window messages, this is restricted to a WORD. |
472 | WORD wId; | 473 | WORD wId; |
474 | // Used to prevent declarative functionality from interfering with the application's imperative code. | ||
475 | BOOL fDisableAutomaticFunctionality; | ||
473 | } THEME_LOADINGCONTROL_RESULTS; | 476 | } THEME_LOADINGCONTROL_RESULTS; |
474 | 477 | ||
475 | 478 | ||
diff --git a/src/libs/dutil/WixToolset.DUtil/thmutil.cpp b/src/libs/dutil/WixToolset.DUtil/thmutil.cpp index 74c1a8b0..b76d6483 100644 --- a/src/libs/dutil/WixToolset.DUtil/thmutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/thmutil.cpp | |||
@@ -295,7 +295,8 @@ static void UnloadThemeControls( | |||
295 | static HRESULT OnLoadingControl( | 295 | static HRESULT OnLoadingControl( |
296 | __in THEME* pTheme, | 296 | __in THEME* pTheme, |
297 | __in const THEME_CONTROL* pControl, | 297 | __in const THEME_CONTROL* pControl, |
298 | __inout WORD* pwId | 298 | __inout WORD* pwId, |
299 | __inout BOOL* pfDisableAutomaticFunctionality | ||
299 | ); | 300 | ); |
300 | static HRESULT LoadControls( | 301 | static HRESULT LoadControls( |
301 | __in THEME* pTheme, | 302 | __in THEME* pTheme, |
@@ -3432,9 +3433,6 @@ static HRESULT ParseControl( | |||
3432 | pControl->dwInternalStyle |= INTERNAL_CONTROL_STYLE_HIDE_WHEN_DISABLED; | 3433 | pControl->dwInternalStyle |= INTERNAL_CONTROL_STYLE_HIDE_WHEN_DISABLED; |
3433 | } | 3434 | } |
3434 | 3435 | ||
3435 | hr = XmlGetYesNoAttribute(pixn, L"DisableAutomaticBehavior", &pControl->fDisableVariableFunctionality); | ||
3436 | ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control DisableAutomaticBehavior attribute."); | ||
3437 | |||
3438 | hr = ParseActions(pixn, pControl); | 3436 | hr = ParseActions(pixn, pControl); |
3439 | ThmExitOnFailure(hr, "Failed to parse action nodes of the control."); | 3437 | ThmExitOnFailure(hr, "Failed to parse action nodes of the control."); |
3440 | 3438 | ||
@@ -5002,6 +5000,7 @@ static void OnBrowseDirectory( | |||
5002 | { | 5000 | { |
5003 | // Since editbox changes aren't immediately saved off, we have to treat them differently. | 5001 | // Since editbox changes aren't immediately saved off, we have to treat them differently. |
5004 | THEME_CONTROL* pTargetControl = NULL; | 5002 | THEME_CONTROL* pTargetControl = NULL; |
5003 | BOOL fSetVariable = NULL != pTheme->pfnSetStringVariable; | ||
5005 | 5004 | ||
5006 | for (DWORD i = 0; i < pTheme->cControls; ++i) | 5005 | for (DWORD i = 0; i < pTheme->cControls; ++i) |
5007 | { | 5006 | { |
@@ -5015,21 +5014,18 @@ static void OnBrowseDirectory( | |||
5015 | } | 5014 | } |
5016 | } | 5015 | } |
5017 | 5016 | ||
5018 | if (pTargetControl && THEME_CONTROL_TYPE_EDITBOX == pTargetControl->type && !pTargetControl->fDisableVariableFunctionality) | 5017 | if (pTargetControl && !pTargetControl->fDisableAutomaticFunctionality && (!fSetVariable || THEME_CONTROL_TYPE_EDITBOX == pTargetControl->type)) |
5019 | { | 5018 | { |
5019 | fSetVariable = FALSE; | ||
5020 | hr = ThemeSetTextControl(pTargetControl, wzPath); | 5020 | hr = ThemeSetTextControl(pTargetControl, wzPath); |
5021 | ThmExitOnFailure(hr, "Failed to set text on editbox: %ls", pTargetControl->sczName); | 5021 | ThmExitOnFailure(hr, "Failed to set text on control: %ls", pTargetControl->sczName); |
5022 | } | 5022 | } |
5023 | else if (pTheme->pfnSetStringVariable) | 5023 | |
5024 | if (fSetVariable) | ||
5024 | { | 5025 | { |
5025 | hr = pTheme->pfnSetStringVariable(pAction->BrowseDirectory.sczVariableName, wzPath, FALSE, pTheme->pvVariableContext); | 5026 | hr = pTheme->pfnSetStringVariable(pAction->BrowseDirectory.sczVariableName, wzPath, FALSE, pTheme->pvVariableContext); |
5026 | ThmExitOnFailure(hr, "Failed to set variable: %ls", pAction->BrowseDirectory.sczVariableName); | 5027 | ThmExitOnFailure(hr, "Failed to set variable: %ls", pAction->BrowseDirectory.sczVariableName); |
5027 | } | 5028 | } |
5028 | else if (pTargetControl) | ||
5029 | { | ||
5030 | hr = ThemeSetTextControl(pTargetControl, wzPath); | ||
5031 | ThmExitOnFailure(hr, "Failed to set text on control: %ls", pTargetControl->sczName); | ||
5032 | } | ||
5033 | 5029 | ||
5034 | ThemeShowPageEx(pTheme, pTheme->dwCurrentPageId, SW_SHOW, THEME_SHOW_PAGE_REASON_REFRESH); | 5030 | ThemeShowPageEx(pTheme, pTheme->dwCurrentPageId, SW_SHOW, THEME_SHOW_PAGE_REASON_REFRESH); |
5035 | } | 5031 | } |
@@ -5051,7 +5047,7 @@ static BOOL OnButtonClicked( | |||
5051 | 5047 | ||
5052 | if (THEME_CONTROL_TYPE_BUTTON == pControl->type || THEME_CONTROL_TYPE_COMMANDLINK == pControl->type) | 5048 | if (THEME_CONTROL_TYPE_BUTTON == pControl->type || THEME_CONTROL_TYPE_COMMANDLINK == pControl->type) |
5053 | { | 5049 | { |
5054 | if (pControl->cActions) | 5050 | if (!pControl->fDisableAutomaticFunctionality && pControl->cActions) |
5055 | { | 5051 | { |
5056 | fHandled = TRUE; | 5052 | fHandled = TRUE; |
5057 | THEME_ACTION* pChosenAction = pControl->pDefaultAction; | 5053 | THEME_ACTION* pChosenAction = pControl->pDefaultAction; |
@@ -5109,7 +5105,7 @@ static BOOL OnButtonClicked( | |||
5109 | } | 5105 | } |
5110 | } | 5106 | } |
5111 | } | 5107 | } |
5112 | else if (!pControl->fDisableVariableFunctionality && (pTheme->pfnSetNumericVariable || pTheme->pfnSetStringVariable)) | 5108 | else if (!pControl->fDisableAutomaticFunctionality && (pTheme->pfnSetNumericVariable || pTheme->pfnSetStringVariable)) |
5113 | { | 5109 | { |
5114 | BOOL fRefresh = FALSE; | 5110 | BOOL fRefresh = FALSE; |
5115 | 5111 | ||
@@ -5564,7 +5560,7 @@ static HRESULT ShowControl( | |||
5564 | THEME_PAGE* pPage = ThemeGetPage(pTheme, dwPageId); | 5560 | THEME_PAGE* pPage = ThemeGetPage(pTheme, dwPageId); |
5565 | 5561 | ||
5566 | // Save the editbox value if necessary (other control types save their values immediately). | 5562 | // Save the editbox value if necessary (other control types save their values immediately). |
5567 | if (pTheme->pfnSetStringVariable && !pControl->fDisableVariableFunctionality && | 5563 | if (pTheme->pfnSetStringVariable && !pControl->fDisableAutomaticFunctionality && |
5568 | fSaveEditboxes && THEME_CONTROL_TYPE_EDITBOX == pControl->type && pControl->sczName && *pControl->sczName) | 5564 | fSaveEditboxes && THEME_CONTROL_TYPE_EDITBOX == pControl->type && pControl->sczName && *pControl->sczName) |
5569 | { | 5565 | { |
5570 | hr = ThemeGetTextControl(pControl, &sczText); | 5566 | hr = ThemeGetTextControl(pControl, &sczText); |
@@ -5591,7 +5587,7 @@ static HRESULT ShowControl( | |||
5591 | BOOL fEnabled = !(pControl->dwInternalStyle & INTERNAL_CONTROL_STYLE_DISABLED); | 5587 | BOOL fEnabled = !(pControl->dwInternalStyle & INTERNAL_CONTROL_STYLE_DISABLED); |
5592 | BOOL fVisible = !(pControl->dwInternalStyle & INTERNAL_CONTROL_STYLE_HIDDEN); | 5588 | BOOL fVisible = !(pControl->dwInternalStyle & INTERNAL_CONTROL_STYLE_HIDDEN); |
5593 | 5589 | ||
5594 | if (!pControl->fDisableVariableFunctionality) | 5590 | if (!pControl->fDisableAutomaticFunctionality) |
5595 | { | 5591 | { |
5596 | if (pTheme->pfnEvaluateCondition) | 5592 | if (pTheme->pfnEvaluateCondition) |
5597 | { | 5593 | { |
@@ -6017,7 +6013,8 @@ static LRESULT CALLBACK StaticOwnerDrawWndProc( | |||
6017 | static HRESULT OnLoadingControl( | 6013 | static HRESULT OnLoadingControl( |
6018 | __in THEME* pTheme, | 6014 | __in THEME* pTheme, |
6019 | __in const THEME_CONTROL* pControl, | 6015 | __in const THEME_CONTROL* pControl, |
6020 | __inout WORD* pwId | 6016 | __inout WORD* pwId, |
6017 | __inout BOOL* pfDisableAutomaticFunctionality | ||
6021 | ) | 6018 | ) |
6022 | { | 6019 | { |
6023 | HRESULT hr = S_OK; | 6020 | HRESULT hr = S_OK; |
@@ -6037,6 +6034,7 @@ static HRESULT OnLoadingControl( | |||
6037 | if (SUCCEEDED(hr)) | 6034 | if (SUCCEEDED(hr)) |
6038 | { | 6035 | { |
6039 | *pwId = loadingControlResults.wId; | 6036 | *pwId = loadingControlResults.wId; |
6037 | *pfDisableAutomaticFunctionality = loadingControlResults.fDisableAutomaticFunctionality; | ||
6040 | } | 6038 | } |
6041 | } | 6039 | } |
6042 | 6040 | ||
@@ -6238,7 +6236,7 @@ static HRESULT LoadControls( | |||
6238 | 6236 | ||
6239 | // Default control ids to the next id, unless there is a specific id to assign to a control. | 6237 | // Default control ids to the next id, unless there is a specific id to assign to a control. |
6240 | WORD wControlId = THEME_FIRST_AUTO_ASSIGN_CONTROL_ID; | 6238 | WORD wControlId = THEME_FIRST_AUTO_ASSIGN_CONTROL_ID; |
6241 | hr = OnLoadingControl(pTheme, pControl, &wControlId); | 6239 | hr = OnLoadingControl(pTheme, pControl, &wControlId, &pControl->fDisableAutomaticFunctionality); |
6242 | ThmExitOnFailure(hr, "ThmLoadingControl failed."); | 6240 | ThmExitOnFailure(hr, "ThmLoadingControl failed."); |
6243 | 6241 | ||
6244 | // This range is reserved for thmutil. The process will run out of available window handles before reaching the end of the range. | 6242 | // This range is reserved for thmutil. The process will run out of available window handles before reaching the end of the range. |
@@ -6256,7 +6254,7 @@ static HRESULT LoadControls( | |||
6256 | BOOL fDisabled = pControl->dwStyle & WS_DISABLED; | 6254 | BOOL fDisabled = pControl->dwStyle & WS_DISABLED; |
6257 | 6255 | ||
6258 | // If the control is supposed to be initially visible and it has a VisibleCondition, check if it's true. | 6256 | // If the control is supposed to be initially visible and it has a VisibleCondition, check if it's true. |
6259 | if (fVisible && pControl->sczVisibleCondition && pTheme->pfnEvaluateCondition && !pControl->fDisableVariableFunctionality) | 6257 | if (fVisible && pControl->sczVisibleCondition && pTheme->pfnEvaluateCondition && !pControl->fDisableAutomaticFunctionality) |
6260 | { | 6258 | { |
6261 | hr = pTheme->pfnEvaluateCondition(pControl->sczVisibleCondition, &fVisible, pTheme->pvVariableContext); | 6259 | hr = pTheme->pfnEvaluateCondition(pControl->sczVisibleCondition, &fVisible, pTheme->pvVariableContext); |
6262 | ThmExitOnFailure(hr, "Failed to evaluate VisibleCondition: %ls", pControl->sczVisibleCondition); | 6260 | ThmExitOnFailure(hr, "Failed to evaluate VisibleCondition: %ls", pControl->sczVisibleCondition); |
@@ -6275,7 +6273,7 @@ static HRESULT LoadControls( | |||
6275 | } | 6273 | } |
6276 | 6274 | ||
6277 | // If the control is supposed to be initially enabled and it has an EnableCondition, check if it's true. | 6275 | // If the control is supposed to be initially enabled and it has an EnableCondition, check if it's true. |
6278 | if (!fDisabled && pControl->sczEnableCondition && pTheme->pfnEvaluateCondition && !pControl->fDisableVariableFunctionality) | 6276 | if (!fDisabled && pControl->sczEnableCondition && pTheme->pfnEvaluateCondition && !pControl->fDisableAutomaticFunctionality) |
6279 | { | 6277 | { |
6280 | BOOL fEnable = TRUE; | 6278 | BOOL fEnable = TRUE; |
6281 | 6279 | ||