X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=contrib%2Fpulseview_cross.nsi.in;h=8f0a6fe9bc936d7036f4b89d197446b69255f001;hb=ebe0a19686181a2ca873219fce38217856b5d82c;hp=0e6921970005e67cedd9d73036c0a4e243ee7da4;hpb=0ebddfac4ea08ec5adda0cba9bbf3522e26a354e;p=pulseview.git diff --git a/contrib/pulseview_cross.nsi.in b/contrib/pulseview_cross.nsi.in index 0e69219..8f0a6fe 100644 --- a/contrib/pulseview_cross.nsi.in +++ b/contrib/pulseview_cross.nsi.in @@ -30,6 +30,9 @@ # Include the "Modern UI" header, which gives us the usual Windows look-n-feel. !include "MUI2.nsh" +# Include the file association header so that we can register file extensions. +!include "FileAssociation.nsh" + # --- Global stuff ------------------------------------------------------------ @@ -73,6 +76,20 @@ RequestExecutionLevel admin # Change this to where-ever you installed libsigrok.a and so on. !define CROSS "@CMAKE_INSTALL_PREFIX@" +# Defines for WinAPI SHChangeNotify call. +!define SHCNE_ASSOCCHANGED 0x8000000 +!define SHCNF_IDLIST 0 + + +# --- Functions --------------------------------------------------------------- + +Function register_sr_files + ${registerExtension} "$INSTDIR\pulseview.exe" ".sr" "sigrok session file" + + # Force Windows to update the icon cache so that the icon for .sr files shows up. + System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)' +FunctionEnd + # --- MUI pages --------------------------------------------------------------- @@ -91,6 +108,14 @@ RequestExecutionLevel admin # Perform the actual installation, i.e. install the files. !insertmacro MUI_PAGE_INSTFILES +# Insert the "Show Readme" button in the finish dialog. We repurpose it for +# registering the .sr file extension. This way, we don't need to add in-depth +# modifications to the finish page. +!define MUI_FINISHPAGE_SHOWREADME "" +!define MUI_FINISHPAGE_SHOWREADME_CHECKED +!define MUI_FINISHPAGE_SHOWREADME_TEXT "Register .sr files with PulseView" +!define MUI_FINISHPAGE_SHOWREADME_FUNCTION register_sr_files + # Show a final "We're done, click Finish to close this wizard" message. !insertmacro MUI_PAGE_FINISH @@ -241,6 +266,11 @@ Section "Uninstall" # Delete the registry key(s). DeleteRegKey HKLM "${REGSTR}" + # Unregister any previously registered file extension(s). + ${unregisterExtension} ".sr" "sigrok session file" + + # Force Windows to update the icon cache so that the icon for .sr files is reset. + System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)' SectionEnd