diff --git a/cmake/nsis/FileAssociation.nsh b/cmake/nsis/FileAssociation.nsh new file mode 100644 index 000000000..71a9162ef --- /dev/null +++ b/cmake/nsis/FileAssociation.nsh @@ -0,0 +1,190 @@ +/* +_____________________________________________________________________________ + + File Association +_____________________________________________________________________________ + + Based on code taken from http://nsis.sourceforge.net/File_Association + + Usage in script: + 1. !include "FileAssociation.nsh" + 2. [Section|Function] + ${FileAssociationFunction} "Param1" "Param2" "..." $var + [SectionEnd|FunctionEnd] + + FileAssociationFunction=[RegisterExtension|UnRegisterExtension] + +_____________________________________________________________________________ + + ${RegisterExtension} "[executable]" "[extension]" "[description]" + +"[executable]" ; executable which opens the file format + ; +"[extension]" ; extension, which represents the file format to open + ; +"[description]" ; description for the extension. This will be display in Windows Explorer. + ; + + + ${UnRegisterExtension} "[extension]" "[description]" + +"[extension]" ; extension, which represents the file format to open + ; +"[description]" ; description for the extension. This will be display in Windows Explorer. + ; + +_____________________________________________________________________________ + + Macros +_____________________________________________________________________________ + + Change log window verbosity (default: 3=no script) + + Example: + !include "FileAssociation.nsh" + !insertmacro RegisterExtension + ${FileAssociation_VERBOSE} 4 # all verbosity + !insertmacro UnRegisterExtension + ${FileAssociation_VERBOSE} 3 # no script +*/ + + +!ifndef FileAssociation_INCLUDED +!define FileAssociation_INCLUDED + +!include Util.nsh + +!verbose push +!verbose 3 +!ifndef _FileAssociation_VERBOSE + !define _FileAssociation_VERBOSE 3 +!endif +!verbose ${_FileAssociation_VERBOSE} +!define FileAssociation_VERBOSE `!insertmacro FileAssociation_VERBOSE` +!verbose pop + +!macro FileAssociation_VERBOSE _VERBOSE + !verbose push + !verbose 3 + !undef _FileAssociation_VERBOSE + !define _FileAssociation_VERBOSE ${_VERBOSE} + !verbose pop +!macroend + + + +!macro RegisterExtensionCall _EXECUTABLE _EXTENSION _DESCRIPTION + !verbose push + !verbose ${_FileAssociation_VERBOSE} + Push `${_DESCRIPTION}` + Push `${_EXTENSION}` + Push `${_EXECUTABLE}` + ${CallArtificialFunction} RegisterExtension_ + !verbose pop +!macroend + +!macro UnRegisterExtensionCall _EXTENSION _DESCRIPTION + !verbose push + !verbose ${_FileAssociation_VERBOSE} + Push `${_EXTENSION}` + Push `${_DESCRIPTION}` + ${CallArtificialFunction} UnRegisterExtension_ + !verbose pop +!macroend + + + +!define RegisterExtension `!insertmacro RegisterExtensionCall` +!define un.RegisterExtension `!insertmacro RegisterExtensionCall` + +!macro RegisterExtension +!macroend + +!macro un.RegisterExtension +!macroend + +!macro RegisterExtension_ + !verbose push + !verbose ${_FileAssociation_VERBOSE} + + Exch $R2 ;exe + Exch + Exch $R1 ;ext + Exch + Exch 2 + Exch $R0 ;desc + Exch 2 + Push $0 + Push $1 + + ReadRegStr $1 HKCR $R1 "" ; read current file association + StrCmp "$1" "" NoBackup ; is it empty + StrCmp "$1" "$R0" NoBackup ; is it our own + WriteRegStr HKCR $R1 "backup_val" "$1" ; backup current value +NoBackup: + WriteRegStr HKCR $R1 "" "$R0" ; set our file association + + ReadRegStr $0 HKCR $R0 "" + StrCmp $0 "" 0 Skip + WriteRegStr HKCR "$R0" "" "$R0" + WriteRegStr HKCR "$R0\shell" "" "open" + WriteRegStr HKCR "$R0\DefaultIcon" "" "$R2,0" +Skip: + WriteRegStr HKCR "$R0\shell\open\command" "" '"$R2" "%1"' + WriteRegStr HKCR "$R0\shell\edit" "" "Edit $R0" + WriteRegStr HKCR "$R0\shell\edit\command" "" '"$R2" "%1"' + + Pop $1 + Pop $0 + Pop $R2 + Pop $R1 + Pop $R0 + + !verbose pop +!macroend + + + +!define UnRegisterExtension `!insertmacro UnRegisterExtensionCall` +!define un.UnRegisterExtension `!insertmacro UnRegisterExtensionCall` + +!macro UnRegisterExtension +!macroend + +!macro un.UnRegisterExtension +!macroend + +!macro UnRegisterExtension_ + !verbose push + !verbose ${_FileAssociation_VERBOSE} + + Exch $R1 ;desc + Exch + Exch $R0 ;ext + Exch + Push $0 + Push $1 + + ReadRegStr $1 HKCR $R0 "" + StrCmp $1 $R1 0 NoOwn ; only do this if we own it + ReadRegStr $1 HKCR $R0 "backup_val" + StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key + DeleteRegKey HKCR $R0 + Goto NoOwn + +Restore: + WriteRegStr HKCR $R0 "" $1 + DeleteRegValue HKCR $R0 "backup_val" + DeleteRegKey HKCR $R1 ;Delete key with association name settings + +NoOwn: + + Pop $1 + Pop $0 + Pop $R1 + Pop $R0 + + !verbose pop +!macroend + +!endif # !FileAssociation_INCLUDED diff --git a/cmake/nsis/NSISRegistry.cmake b/cmake/nsis/NSISRegistry.cmake index 7e237ecc7..31b4e0647 100644 --- a/cmake/nsis/NSISRegistry.cmake +++ b/cmake/nsis/NSISRegistry.cmake @@ -6,10 +6,6 @@ set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " - WriteRegStr HKCR 'mrv2' '' 'mrv2' - WriteRegStr HKCR 'mrv2\\\\DefaultIcon' '' '$INSTDIR\\\\bin\\\\mrv2.exe,O' - WriteRegStr HKCR 'mrv2\\\\shell' '' 'open' - WriteRegStr HKCR 'mrv2\\\\shell\\\\open\\\\command' '' '$INSTDIR\\\\bin\\\\mrv2.exe \\\"%1\\\"' SectionEnd !addincludedir ${PROJECT_SOURCE_DIR}/../cmake/nsis !include fileext.nsh @@ -19,7 +15,6 @@ set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " - DeleteRegKey HKCR 'mrv2' SectionEnd !addincludedir ${PROJECT_SOURCE_DIR}/../cmake/nsis !include fileext_uninstall.nsh diff --git a/cmake/nsis/fileext.nsh b/cmake/nsis/fileext.nsh index 7d1c7ee60..cfd06d51e 100644 --- a/cmake/nsis/fileext.nsh +++ b/cmake/nsis/fileext.nsh @@ -10,6 +10,8 @@ Var bCheckAll Var bUnCheckAll !include mrv2_translations.nsh +!include "FileAssociation.nsh" + Page Custom LVPageCreate LVPageLeave @@ -159,6 +161,7 @@ System::Free $9 !insertmacro AddCheckedListViewItemWith1SubItem $hListCtl ".mkv" "Matroska Video Format" 1 !insertmacro AddCheckedListViewItemWith1SubItem $hListCtl ".mov" "Apple's Quicktime Format" 1 !insertmacro AddCheckedListViewItemWith1SubItem $hListCtl ".mp4" "MPEG4 Format" 1 +!insertmacro AddCheckedListViewItemWith1SubItem $hListCtl ".mp4v" "MPEG4 Format" 1 !insertmacro AddCheckedListViewItemWith1SubItem $hListCtl ".mpg" "MPEG Format" 1 !insertmacro AddCheckedListViewItemWith1SubItem $hListCtl ".mpeg" "MPEG Format" 1 !insertmacro AddCheckedListViewItemWith1SubItem $hListCtl ".mpeg2" "MPEG2 Format" 1 @@ -210,8 +213,10 @@ ${DoWhile} $0 < $1 ${If} $2 <> 0 SendMessage $hListCtl ${LVM_GETITEMTEXT} $0 $9 $2 System::Call '*$8(&t${NSIS_MAX_STRLEN}.r7)' - DeleteRegKey HKCR '$7' - WriteRegStr HKCR '$7' '' 'mrv2' + + ${registerExtension} "$INSTDIR\bin\mrv2.exe" "$7" "$7 File" + # WriteRegStr HKCR '$7' '' 'mrv2' + WriteINIStr '$INSTDIR\\fileext.ini' ext '$7' 1 ${EndIf} IntOp $0 $0 + 1 diff --git a/cmake/nsis/fileext_uninstall.nsh b/cmake/nsis/fileext_uninstall.nsh index ac7a13c4c..4c0d130b8 100644 --- a/cmake/nsis/fileext_uninstall.nsh +++ b/cmake/nsis/fileext_uninstall.nsh @@ -1,12 +1,10 @@ !include LogicLib.nsh +!include "FileAssociation.nsh" Function un.BorrarKey -Pop $1 -ReadINIStr $0 '$INSTDIR\\fileext.ini' ext $1 -${If} $0 <> "" - DeleteRegKey HKCR $1 -${EndIf} +Pop $1 +${unregisterExtension} "$1" "$1 File" FunctionEnd @@ -78,6 +76,7 @@ Pop $0 !insertmacro BorrarKey '.mpeg3' !insertmacro BorrarKey '.mpeg4' !insertmacro BorrarKey '.mp4' +!insertmacro BorrarKey '.mp4v' !insertmacro BorrarKey '.mxf' !insertmacro BorrarKey '.qt' !insertmacro BorrarKey '.rm' @@ -94,7 +93,6 @@ Pop $0 -Delete $INSTDIR\fileext.ini SetOutPath $TEMP RMDir $INSTDIR diff --git a/mrv2/docs/HISTORY.md b/mrv2/docs/HISTORY.md index e71b4c9fe..d2fd84942 100644 --- a/mrv2/docs/HISTORY.md +++ b/mrv2/docs/HISTORY.md @@ -5,6 +5,9 @@ v1.1.0 - Made mrv2's custom file requester list presumed sequences of a single frame as a file instead of a custom sequence name display. - Matched NDI colors. +- Fixed file associations on Windows as mrv2 was using Windows Vista/7 registry + keys. +- Fixed slow playback of 4K movies. v1.0.9 ====== diff --git a/tlRender b/tlRender index b25327e1c..96e6dc50b 160000 --- a/tlRender +++ b/tlRender @@ -1 +1 @@ -Subproject commit b25327e1c383c23e47034c5dec6198cf15746eaa +Subproject commit 96e6dc50bb369c7277415ca729da8109ad899204