From 4b62ecbb31e7a60918909ec1046a72df07c62bd8 Mon Sep 17 00:00:00 2001 From: anders_k Date: Thu, 20 Sep 2012 18:42:21 +0000 Subject: [PATCH] Added ManifestDPIAware attribute git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6266 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/attributes.but | 9 +++++++++ Source/build.cpp | 3 ++- Source/build.h | 1 + Source/manifest.cpp | 9 ++++++++- Source/manifest.h | 9 ++++++++- Source/script.cpp | 11 +++++++++++ Source/tokens.cpp | 1 + Source/tokens.h | 1 + 8 files changed, 41 insertions(+), 3 deletions(-) diff --git a/Docs/src/attributes.but b/Docs/src/attributes.but index d828381f..9682cefe 100644 --- a/Docs/src/attributes.but +++ b/Docs/src/attributes.but @@ -280,6 +280,15 @@ The default string will be used if a string is empty (""). Accepts variables. If variables are used, they must be initialized before the license page is created. + +\S2{amanifestdpiaware} ManifestDPIAware + +\c \\notset\\|true|false + +Declare that the installer is DPI-aware. A DPI-aware application is not scaled by the DWM (DPI virtualization) so the text is never blurry. NSIS does not scale the bitmap used by the tree control on the component page and some plugins might have compatibility issues so make sure that you test your installer at different DPI settings if you select \e{true}. + +See \W{http://msdn.microsoft.com/en-us/library/dd464660}{MSDN} for more information about DPI-aware applications. + \S2{amanifestsupportedos} ManifestSupportedOS \c none|all|WinVista|\\Win7|Win8\\|{GUID} [...] diff --git a/Source/build.cpp b/Source/build.cpp index 5e4b78a4..d20cb4cc 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -278,6 +278,7 @@ CEXEBuild::CEXEBuild() : manifest_comctl = manifest::comctl_old; manifest_exec_level = manifest::exec_level_none; + manifest_dpiaware = manifest::dpiaware_notset; manifest_sosl.setdefault(); enable_last_page_cancel=0; @@ -2341,7 +2342,7 @@ int CEXEBuild::SetManifest() try { init_res_editor(); // This should stay ANSI - string manifest = manifest::generate(manifest_comctl, manifest_exec_level, manifest_sosl); + string manifest = manifest::generate(manifest_comctl, manifest_exec_level, manifest_dpiaware, manifest_sosl); if (manifest == "") return PS_OK; diff --git a/Source/build.h b/Source/build.h index b432514c..fef38c4e 100644 --- a/Source/build.h +++ b/Source/build.h @@ -507,6 +507,7 @@ class CEXEBuild { manifest::comctl manifest_comctl; manifest::exec_level manifest_exec_level; + manifest::dpiaware manifest_dpiaware; manifest::SupportedOSList manifest_sosl; CResourceEditor *res_editor; diff --git a/Source/manifest.cpp b/Source/manifest.cpp index 904caa03..454fa1f8 100644 --- a/Source/manifest.cpp +++ b/Source/manifest.cpp @@ -67,7 +67,7 @@ bool SupportedOSList::append(const TCHAR* osid) } -string generate(comctl comctl_selection, exec_level exec_level_selection, SupportedOSList& sosl) +string generate(comctl comctl_selection, exec_level exec_level_selection, dpiaware dpia, SupportedOSList& sosl) { if (comctl_selection == comctl_old && exec_level_selection == exec_level_none) return ""; @@ -118,6 +118,13 @@ string generate(comctl comctl_selection, exec_level exec_level_selection, Suppor xml += ""; } + if (dpiaware_notset != dpia) + { + xml += ""; + xml += dpiaware_false != dpia ? "true" : "false"; + xml += ""; + } + xml += ""; return xml; diff --git a/Source/manifest.h b/Source/manifest.h index dd8efd21..0562549f 100644 --- a/Source/manifest.h +++ b/Source/manifest.h @@ -38,6 +38,13 @@ namespace manifest exec_level_admin }; + enum dpiaware + { + dpiaware_notset, + dpiaware_false, + dpiaware_true, + }; + class SupportedOSList { StringList m_list; @@ -74,7 +81,7 @@ namespace manifest } }; - std::string generate(comctl, exec_level, SupportedOSList&); + std::string generate(comctl, exec_level, dpiaware, SupportedOSList&); }; diff --git a/Source/script.cpp b/Source/script.cpp index 87ac2d24..5deae910 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -2862,6 +2862,17 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } return PS_OK; + case TOK_MANIFEST_DPIAWARE: + switch(line.gettoken_enum(1,_T("none\0notset\0true\0false\0"))) + { + case 0: // A lot of attributes use "none" so we support that along with the documented value + case 1: manifest_dpiaware = manifest::dpiaware_notset; break; + case 2: manifest_dpiaware = manifest::dpiaware_true; break; + case 3: manifest_dpiaware = manifest::dpiaware_false; break; + default: PRINTHELP(); + } + return PS_OK; + case TOK_MANIFEST_SUPPORTEDOS: { manifest_sosl.deleteall(); diff --git a/Source/tokens.cpp b/Source/tokens.cpp index 8d8a52f4..400d4d8a 100644 --- a/Source/tokens.cpp +++ b/Source/tokens.cpp @@ -240,6 +240,7 @@ static tokenType tokenlist[TOK__LAST] = {TOK_WRITEUNINSTALLER,_T("WriteUninstaller"),1,0,_T("uninstall_exe_name"),TP_CODE}, {TOK_XPSTYLE, _T("XPStyle"),1,0,_T("(on|off)"),TP_GLOBAL}, {TOK_REQEXECLEVEL, _T("RequestExecutionLevel"),1,0,_T("none|user|highest|admin"),TP_GLOBAL}, +{TOK_MANIFEST_DPIAWARE,_T("ManifestDPIAware"),1,0,_T("notset|true|false"),TP_GLOBAL}, {TOK_MANIFEST_SUPPORTEDOS,_T("ManifestSupportedOS"),1,-1,_T("none|all|WinVista|Win7|Win8|{GUID} [...]"),TP_GLOBAL}, {TOK_P_PACKEXEHEADER,_T("!packhdr"),2,0,_T("temp_file_name command_line_to_compress_that_temp_file"),TP_ALL}, {TOK_P_FINALIZE,_T("!finalize"),1,0,_T("command_with_%1"),TP_ALL}, diff --git a/Source/tokens.h b/Source/tokens.h index 116f95b8..03275765 100644 --- a/Source/tokens.h +++ b/Source/tokens.h @@ -61,6 +61,7 @@ enum TOK_INSTPROGRESSFLAGS, TOK_XPSTYLE, TOK_REQEXECLEVEL, + TOK_MANIFEST_DPIAWARE, TOK_MANIFEST_SUPPORTEDOS, TOK_CHANGEUI, TOK_ADDBRANDINGIMAGE,