diff --git a/mediaPlayer.pas b/mediaPlayer.pas index e82e2d6..a973d52 100644 --- a/mediaPlayer.pas +++ b/mediaPlayer.pas @@ -413,7 +413,7 @@ procedure TMediaPlayer.onInitMPV(sender: TObject); setPropertyString('screenshot-png-compression', '0'); setPropertyString('screenshot-template', '%F %p %04n'); setPropertyString('sid', '1'); -// setPropertyDouble('image-display-duration', 100); + setPropertyString('image-display-duration', 'inf'); // SetPropertyDouble('sub-delay', -00.99); end; end; @@ -553,13 +553,16 @@ function TMediaPlayer.play(const aURL: string): boolean; FMediaType := MT.mediaType(lowerCase(extractFileExt(PL.currentItem))); // reset the window size for an audio file in case the previous file was a video, or the previous audio had an image but this one doesn't case UI.autoCentre OR (FMediaType = mtAudio) of TRUE: UI.setWindowSize(FMediaType, MI.hasCoverArt); end; - case UI.autoCentre AND (FMediaType <> mtImage) of TRUE: postMessage(GV.appWND, WM_CENTRE_CURSOR, 0, 0); end; + UI.centreCursor; openURL(aURL); mpv.volume := FVol; mpv.mute := FMuted; - FDontPlayNext := FMediaType = mtImage; + var vImageDisplayDuration: string; + mpv.getPropertyString('image-display-duration', vImageDisplayDuration, FALSE); + + FDontPlayNext := (FMediaType = mtImage) and (vImageDisplayDuration = 'inf'); case ST.showData of TRUE: MI.getData(ST.dataMemo); end; MC.caption := PL.formattedItem; @@ -571,7 +574,7 @@ function TMediaPlayer.play(const aURL: string): boolean; checkPot; case assigned(FOnPlayNew) of TRUE: FOnPlayNew(SELF); end; - case UI.autoCentre AND (FMediaType <> mtImage) of TRUE: postMessage(GV.appWND, WM_CENTRE_CURSOR, 0, 0); end; + UI.centreCursor; result := TRUE; end; @@ -773,6 +776,7 @@ function TMediaPlayer.tab(const aShiftState: TShiftState; const capsLock: boolea function TMediaPlayer.takeScreenshot: string; begin case mpv = NIL of TRUE: EXIT; end; + mpv.setPropertyString('screenshot-directory', PL.currentFolder); mpv.commandStr(CMD_SCREEN_SHOT); result := ''; end; diff --git a/playlist.pas b/playlist.pas index a744772..d072aaf 100644 --- a/playlist.pas +++ b/playlist.pas @@ -36,6 +36,7 @@ TPlaylist = class(TObject) function clear: boolean; function count: integer; function copyToClipboard: boolean; + function currentFolder: string; function currentItem: string; function currentIx: integer; function delete(const ix: integer = -1): boolean; @@ -106,6 +107,11 @@ constructor TPlaylist.create; FPLaylist.sort; end; +function TPlaylist.currentFolder: string; +begin + result := extractFilePath(currentItem); +end; + function TPlaylist.currentItem: string; begin result := ''; diff --git a/uiCtrls.pas b/uiCtrls.pas index c6deac2..68e6f22 100644 --- a/uiCtrls.pas +++ b/uiCtrls.pas @@ -57,6 +57,7 @@ TUI = class(TObject) function adjustAspectRatio(const aWnd: HWND; const X: int64; const Y: int64): boolean; function arrangeAll: boolean; function autoCentreWindow(const aWnd: HWND): boolean; + function centreCursor: boolean; function centreWindow(const aWnd: HWND): boolean; function checkScreenLimits(const aWnd: HWND; const aWidth: integer; const aHeight: integer): boolean; function deleteCurrentItem(const shift: TShiftState): boolean; @@ -76,7 +77,7 @@ TUI = class(TObject) function renameFile(const aFilePath: string): boolean; function resize(const aWnd: HWND; const pt: TPoint; const X: int64; const Y: int64): boolean; function showAboutBox: boolean; - function setWindowSize(const aMediaType: TMediaType; coverArt: boolean = FALSE): boolean; + function setWindowSize(const aMediaType: TMediaType; hasCoverArt: boolean = FALSE): boolean; function showWindow: boolean; function showXY: boolean; function shutTimeline: boolean; @@ -217,6 +218,11 @@ function TUI.autoCentreWindow(const aWnd: HWND): boolean; centreWindow(aWnd); end; +function TUI.centreCursor: boolean; +begin + case autoCentre AND (MP.MediaType <> mtImage) of TRUE: postMessage(GV.appWND, WM_CENTRE_CURSOR, 0, 0); end; +end; + function TUI.centreWindow(const aWnd: HWND): boolean; var vR: TRect; @@ -456,6 +462,8 @@ function TUI.keepFile(const aFilePath: string): boolean; function TUI.maximize: boolean; begin setWindowSize(mtVideo); + FAutoCentre := TRUE; + centreCursor; end; function TUI.minimizeWindow: boolean; @@ -551,12 +559,12 @@ procedure TUI.setWidth(const Value: integer); FMainForm.width := value; end; -function TUI.setWindowSize(const aMediaType: TMediaType; coverArt: boolean = FALSE): boolean; +function TUI.setWindowSize(const aMediaType: TMediaType; hasCoverArt: boolean = FALSE): boolean; begin - case aMediaType of mtAudio: begin case coverArt of TRUE: FMainForm.width := 600; - FALSE: FMainForm.width := 600; end; - case coverArt of FALSE: FMainForm.height := UI_DEFAULT_AUDIO_HEIGHT; - TRUE: FMainForm.height := 400; end;end; + case aMediaType of mtAudio: begin case hasCoverArt of TRUE: FMainForm.width := 600; + FALSE: FMainForm.width := 600; end; + case hasCoverArt of TRUE: FMainForm.height := 400; + FALSE: FMainForm.height := UI_DEFAULT_AUDIO_HEIGHT; end;end; mtVideo: begin var vWidth := trunc((CU.getScreenHeight - 50) / CU.getAspectRatio(MI.X, MI.Y)); var VHeight := CU.getScreenHeight - 50; SetWindowPos(FMainForm.Handle, HWND_TOP, (CU.getScreenWidth - vWidth) div 2, (CU.getScreenHeight - vHeight) div 2, vWidth, vHeight, SWP_NOSIZE); // center window