Skip to content

Commit

Permalink
Code tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
BazzaCuda committed Aug 2, 2023
1 parent e537b4a commit b19360e
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 29 deletions.
5 changes: 2 additions & 3 deletions MinimalistMediaPlayer.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
program MinimalistMediaPlayer;

{$R *.dres}


uses
Vcl.Forms,
Expand All @@ -39,7 +39,6 @@ uses
playlist in 'playlist.pas',
mediaPlayer in 'mediaPlayer.pas',
formSubtitles in 'formSubtitles.pas' {subtitlesForm},
types in 'types.pas',
tickTimer in 'tickTimer.pas',
mediaInfo in 'mediaInfo.pas',
MediaInfoDLL in 'MediaInfoDLL.pas',
Expand All @@ -63,7 +62,7 @@ uses
{$R *.res}

begin
ReportMemoryLeaksOnShutdown := TRUE;
// ReportMemoryLeaksOnShutdown := TRUE;
debugClear;

Application.Initialize;
Expand Down
12 changes: 0 additions & 12 deletions MinimalistMediaPlayer.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ $(PostBuildEvent)]]></PostBuildEvent>
<DCCReference Include="formSubtitles.pas">
<Form>subtitlesForm</Form>
</DCCReference>
<DCCReference Include="types.pas"/>
<DCCReference Include="tickTimer.pas"/>
<DCCReference Include="mediaInfo.pas"/>
<DCCReference Include="MediaInfoDLL.pas"/>
Expand All @@ -191,11 +190,6 @@ $(PostBuildEvent)]]></PostBuildEvent>
<Form>PlaylistForm</Form>
<FormType>dfm</FormType>
</DCCReference>
<RcItem Include="help.rtf">
<ContainerId>ResourceItem</ContainerId>
<ResourceType>RCDATA</ResourceType>
<ResourceId>Resource_HelpRTF</ResourceId>
</RcItem>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
Expand Down Expand Up @@ -234,12 +228,6 @@ $(PostBuildEvent)]]></PostBuildEvent>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="help.rtf" Configuration="Release" Class="ProjectFile">
<Platform Name="Win64">
<RemoteDir>.\</RemoteDir>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="AdditionalDebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
Expand Down
18 changes: 18 additions & 0 deletions bookmark.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
{ Minimalist Media Player
Copyright (C) 2021 Baz Cuda <[email protected]>
https://github.com/BazzaCuda/MinimalistMediaPlayer
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
}
unit bookmark;

interface
Expand Down
6 changes: 0 additions & 6 deletions commonUtils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,6 @@ function TCommonUtils.withinScreenLimits(const aWidth: integer; const aHeight: i
begin
var vR := screen.workAreaRect; // the screen minus the taskbar, which we assume is at the bottom of the desktop
result := (aWidth <= vR.right - vR.left) AND (aHeight <= vR.bottom - vR.top);
// debugInteger('screenWidth', vR.width);
// debugInteger('screenHeight', vR.height);
// debugInteger('newW', aWidth);
// debugInteger('newH', aHeight);
// debugBoolean('withinScreenLimits', result);
// debug('');
end;

initialization
Expand Down
18 changes: 18 additions & 0 deletions configFile.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
{ Minimalist Media Player
Copyright (C) 2021 Baz Cuda <[email protected]>
https://github.com/BazzaCuda/MinimalistMediaPlayer
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
}
unit configFile;

interface
Expand Down
2 changes: 0 additions & 2 deletions formCaption.pas
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ constructor TCaptionForm.create;
inherited create(NIL);
height := 80;
FCaption := TLabel.create(NIL);
// SELF.OnResize := formResize;


FOpInfoTimer := TTimer.create(NIL);
FOpInfoTimer.interval := 5000;
Expand Down
18 changes: 18 additions & 0 deletions globalVars.pas
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
}
{ Minimalist Media Player
Copyright (C) 2021 Baz Cuda <[email protected]>
https://github.com/BazzaCuda/MinimalistMediaPlayer
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
}
unit globalVars;

interface
Expand Down
4 changes: 2 additions & 2 deletions libMPVDelphi/MPVBasePlayer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1134,10 +1134,10 @@ function TMPVBasePlayer.InitPlayer(const sWinHandle, sScrShotDir, sConfigDir, sL
SetPropertyString('osc', 'no'); // On Screen Control
SetPropertyString('force-window', 'yes');
SetPropertyString('config-dir', sConfigDir); // mpv.conf location
SetPropertyString('config', 'yes'); // DISABLE USER ACCESS TO MPV.CONF - NO!
SetPropertyString('config', 'yes'); // DISABLE USER ACCESS TO MPV.CONF? - NO!
SetPropertyBool('keep-open', TRUE);
SetPropertyBool('keep-open-pause', False);
SetPropertyDouble('sub-delay', -10.0);
// SetPropertyDouble('sub-delay', -10.0);
// SetPropertyBool('idle-screen', FALSE);
// setPropertyString('osc-visibility', 'never');
// setPropertyString('audio-device', 'wasapi/{1881c69e-d424-40b8-bb62-9f2aa3f36e6a}');
Expand Down
19 changes: 18 additions & 1 deletion mediaInfo.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
{ Minimalist Media Player
Copyright (C) 2021 Baz Cuda <[email protected]>
https://github.com/BazzaCuda/MinimalistMediaPlayer
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
}
unit mediaInfo;

interface
Expand Down Expand Up @@ -124,7 +142,6 @@ function TMediaInfo.initMediaInfo(aURL: string): boolean;
FURL := aURL;
FOverallFrameRate := mediaInfo_Get(handle, Stream_General, 0, 'FrameRate', Info_Text, Info_Name);
case tryStrToInt(mediaInfo_Get(handle, Stream_General, 0, 'OverallBitRate', Info_Text, Info_Name), FOverallBitRate) of FALSE: FOverallBitRate := 0; end;
// case TryStrToInt64(mediaInfo_Get(handle, Stream_General, 0, 'FileSize', Info_Text, Info_Name), FFileSize) of FALSE: FFileSize := 0; end;
case tryStrToInt(mediaInfo_Get(handle, Stream_Audio, 0, 'BitRate', Info_Text, Info_Name), FAudioBitRate) of FALSE: FAudioBitRate := 0; end;
case tryStrToInt(mediaInfo_Get(handle, Stream_Video, 0, 'Width', Info_Text, Info_Name), FWidth) of FALSE: FWidth := 0; end;
case tryStrToInt(mediaInfo_Get(handle, Stream_Video, 0, 'Height', Info_Text, Info_Name), FHeight) of FALSE: FHeight := 0; end;
Expand Down
18 changes: 18 additions & 0 deletions mediaType.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
{ Minimalist Media Player
Copyright (C) 2021 Baz Cuda <[email protected]>
https://github.com/BazzaCuda/MinimalistMediaPlayer
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
}
unit mediaType;

interface
Expand Down
18 changes: 18 additions & 0 deletions params.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
{ Minimalist Media Player
Copyright (C) 2021 Baz Cuda <[email protected]>
https://github.com/BazzaCuda/MinimalistMediaPlayer
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
}
unit params;

interface
Expand Down
7 changes: 5 additions & 2 deletions sysCommands.pas
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ function sendSysCommandClose(aHWND: HWND): boolean;

implementation

uses
uiCtrls;

function doSysCommand(var Message: TWMSysCommand): boolean;
begin
case Message.CmdType of MENU_ABOUT_ID: showAboutBox(CU.getFileVersionFmt('', '%d.%d'), CU.getFileVersionFmt); end;
// case Message.CmdType of MENU_HELP_ID: showHelp(GV.MainTopRightPt); end;
case Message.CmdType of MENU_ABOUT_ID: UI.showAboutBox; end;
case Message.CmdType of MENU_HELP_ID: UI.toggleHelpWindow; end;
end;

function sendSysCommandClose(aHWND: HWND): boolean;
Expand Down
8 changes: 7 additions & 1 deletion uiCtrls.pas
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ TUI = class(TObject)
function movePlaylistWindow(const create: boolean = TRUE): boolean;
function openExternalApp(anApp: string; aParams: string): boolean;
function renameFile(aFilePath: string): boolean;
function showAboutBox: boolean;
function setWindowSize(const aMediaType: TMediaType): boolean;
function showWindow: boolean;
function smallerWindow(aWnd: HWND): boolean;
Expand All @@ -77,7 +78,7 @@ implementation

uses
formSubtitles, mediaInfo, mediaPlayer, commonUtils, progressBar, winApi.messages, playlist, system.sysUtils, formCaption, keyboard, sysCommands,
formHelp, formPlaylist, _debugWindow;
formHelp, formPlaylist, formAbout, _debugWindow;

var
gUI: TUI;
Expand Down Expand Up @@ -339,6 +340,11 @@ function TUI.setWindowStyle(aForm: TForm): boolean;
SetWindowLong(aForm.handle, GWL_STYLE, GetWindowLong(aForm.handle, GWL_STYLE) OR WS_CAPTION AND NOT WS_BORDER AND NOT WS_VISIBLE);
end;

function TUI.showAboutBox: boolean;
begin
formAbout.showAboutBox(CU.getFileVersionFmt('', '%d.%d'), CU.getFileVersionFmt);
end;

function TUI.showWindow: boolean;
begin
FMainForm.visible := TRUE;
Expand Down

0 comments on commit b19360e

Please sign in to comment.