Commit 2e509663 authored by Antoine Cellerier's avatar Antoine Cellerier

Win32 specific changes: Add --started-from-file option to tell VLC that it was...

Win32 specific changes: Add --started-from-file option to tell VLC that it was started by clicking on a file (or disc). Add --one-instance-when-started-from-file option to tell VLC to use one instance mode when --started-from-file is used. See replies to r15125 for an explanation.

parent 35e982dd
...@@ -831,6 +831,15 @@ static char *ppsz_clock_descriptions[] = ...@@ -831,6 +831,15 @@ static char *ppsz_clock_descriptions[] =
"double-click on a file in the explorer. This option will allow you " \ "double-click on a file in the explorer. This option will allow you " \
"to play the file with the already running instance or enqueue it.") "to play the file with the already running instance or enqueue it.")
#define STARTEDFROMFILE_TEXT N_("VLC is started from file association")
#define STARTEDFROMFILE_LONGTEXT N_( \
"Tell VLC that it is being launched due to a file association in the OS" )
#define ONEINSTANCEWHENSTARTEDFROMFILE_TEXT N_( \
"Allow only on running instance when started from file")
#define ONEINSTANCEWHENSTARTEDFROMFILE_LONGTEXT N_( \
"Allow only on running instance when started from file")
#define HPRIORITY_TEXT N_("Increase the priority of the process") #define HPRIORITY_TEXT N_("Increase the priority of the process")
#define HPRIORITY_LONGTEXT N_( \ #define HPRIORITY_LONGTEXT N_( \
"Increasing the priority of the process will very likely improve your " \ "Increasing the priority of the process will very likely improve your " \
...@@ -1464,6 +1473,11 @@ vlc_module_begin(); ...@@ -1464,6 +1473,11 @@ vlc_module_begin();
#if defined(WIN32) #if defined(WIN32)
add_bool( "one-instance", 0, NULL, ONEINSTANCE_TEXT, add_bool( "one-instance", 0, NULL, ONEINSTANCE_TEXT,
ONEINSTANCE_LONGTEXT, VLC_TRUE ); ONEINSTANCE_LONGTEXT, VLC_TRUE );
add_bool( "started-from-file", 0, NULL, STARTEDFROMFILE_TEXT,
STARTEDFROMFILE_LONGTEXT, VLC_TRUE );
add_bool( "one-instance-when-started-from-file", 1, NULL,
ONEINSTANCEWHENSTARTEDFROMFILE_TEXT,
ONEINSTANCEWHENSTARTEDFROMFILE_LONGTEXT, VLC_TRUE );
add_bool( "playlist-enqueue", 0, NULL, PLAYLISTENQUEUE_TEXT, add_bool( "playlist-enqueue", 0, NULL, PLAYLISTENQUEUE_TEXT,
PLAYLISTENQUEUE_LONGTEXT, VLC_TRUE ); PLAYLISTENQUEUE_LONGTEXT, VLC_TRUE );
add_bool( "high-priority", 0, NULL, HPRIORITY_TEXT, add_bool( "high-priority", 0, NULL, HPRIORITY_TEXT,
......
...@@ -149,7 +149,9 @@ void system_Configure( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] ) ...@@ -149,7 +149,9 @@ void system_Configure( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] )
} }
} }
if( config_GetInt( p_this, "one-instance" ) ) if( config_GetInt( p_this, "one-instance" )
|| ( config_GetInt( p_this, "one-instance-when-started-from-file" )
&& config_GetInt( p_this, "started-from-file" ) ) )
{ {
HANDLE hmutex; HANDLE hmutex;
......
...@@ -173,7 +173,7 @@ NoBackup: ...@@ -173,7 +173,7 @@ NoBackup:
ReadRegStr $0 HKCR "VLC$R0" "" ReadRegStr $0 HKCR "VLC$R0" ""
WriteRegStr HKCR "VLC$R0" "" "VLC media file" WriteRegStr HKCR "VLC$R0" "" "VLC media file"
WriteRegStr HKCR "VLC$R0\shell" "" "Play" WriteRegStr HKCR "VLC$R0\shell" "" "Play"
WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" "%1"' WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" --one-instance-when-started-from-file "%1"'
WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0' WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
FunctionEnd FunctionEnd
...@@ -219,10 +219,10 @@ FunctionEnd ...@@ -219,10 +219,10 @@ FunctionEnd
!macro AddContextMenu EXT !macro AddContextMenu EXT
WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" "Play with VLC media player" WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" "Play with VLC media player"
WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '$INSTDIR\vlc.exe --no-playlist-enqueue "%1"' WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '$INSTDIR\vlc.exe --one-instance-when-started-from-file --no-playlist-enqueue "%1"'
WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" "Add to VLC media player's Playlist" WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" "Add to VLC media player's Playlist"
WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '$INSTDIR\vlc.exe --one-instance --playlist-enqueue "%1"' WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '$INSTDIR\vlc.exe --one-instance-when-started-from-file --playlist-enqueue "%1"'
!macroend !macroend
!macro DeleteContextMenu EXT !macro DeleteContextMenu EXT
...@@ -278,15 +278,15 @@ Section "Media player (required)" SEC01 ...@@ -278,15 +278,15 @@ Section "Media player (required)" SEC01
WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player" WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
WriteRegStr HKCR Applications\vlc.exe\shell\Play "" "Play with VLC" WriteRegStr HKCR Applications\vlc.exe\shell\Play "" "Play with VLC"
WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \ WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \
'$INSTDIR\vlc.exe "%1"' '$INSTDIR\vlc.exe --one-instance-when-started-from-file "%1"'
!insertmacro MacroAllExtensions WriteRegStrSupportedTypes !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player" WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player"
WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \ WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
"$INSTDIR\vlc.exe cdda:%1" "$INSTDIR\vlc.exe --one-instance-when-started-from-file cdda:%1"
WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player" WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player"
WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \ WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
"$INSTDIR\vlc.exe dvd:%1" "$INSTDIR\vlc.exe --one-instance-when-started-from-file dvd:%1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" "" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "Play DVD movie" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "Play DVD movie"
...@@ -297,19 +297,19 @@ Section "Media player (required)" SEC01 ...@@ -297,19 +297,19 @@ Section "Media player (required)" SEC01
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" "" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "Play CD audio" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "Play CD audio"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe --one-instance-when-started-from-file",0'
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie" WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play" WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play"
WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \ WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \
'$INSTDIR\vlc.exe dvd:%1' '$INSTDIR\vlc.exe --one-instance-when-started-from-file dvd:%1'
WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0' WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio" WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play" WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play"
WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \ WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \
'$INSTDIR\vlc.exe cdda:%1' '$INSTDIR\vlc.exe --one-instance-when-started-from-file cdda:%1'
WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0' WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
SectionEnd SectionEnd
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment