1616 macOS 10.11.6 (64bit) El Capitan: Lazarus 1.9.0 carbon trunk, FPC 3.0.4
1717
1818TODO:
19+ preLoading image for slideshow.
1920 load playlist.
2021 more Command line options.
2122 file drop handling(win).
22- preLoading image for slideshow.
2323 OS's power-save event aware.
2424 Modal dialog with options and playlist edit tab (drag & drop files).
2525
@@ -41,7 +41,7 @@ interface
4141uses
4242 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
4343 LclType, LclProc, LclIntf, Menus, StdCtrls, ExtDlgs,
44- strutils, Types, XMLConf{ $ifdef windows} , Windows{ $endif} ;
44+ strutils, Types, XMLConf{ $ifdef windows} , windirs, Windows{ $endif} ;
4545
4646type
4747
@@ -145,6 +145,7 @@ TfrmMain = class(TForm)
145145 FiCurrentFileIndex:integer;
146146 FstrAppVer:string;
147147 FstrInitialSelectedImageFile:string;
148+ FstrInitialDir:string;
148149 procedure ShowFullScreen (blnOn: boolean);
149150 procedure SetFullScreen_Universal (blnOn: boolean);
150151 procedure SetFullScreen_Win32 (blnOn: boolean);
@@ -245,7 +246,7 @@ procedure TfrmMain.FormCreate(Sender: TObject);
245246 folderfiles:TStringlist;
246247 fileSearchMask,fileFolder:string;
247248begin
248- FstrAppVer:=' 1.2.10 ' ;
249+ FstrAppVer:=' 1.2.12 ' ;
249250
250251 // Init Main form properties.
251252 self.Caption:=ReplaceStr(ExtractFileName(ParamStr(0 )),ExtractFileExt(ParamStr(0 )),' ' );
@@ -269,7 +270,7 @@ procedure TfrmMain.FormCreate(Sender: TObject);
269270 FOptIntervalIntSeconds:=4 ;
270271 FOptRandom:=true;
271272 FOptRepeat:=true;
272- FOptFileExts:=' .jpg;.jpeg;.png;.gif' ; // '.jpg;.jpeg;.jpe;.png;.gif';
273+ FOptFileExts:=' .jpg;.jpeg;.jpe;. png;.gif' ; // '.jpg;.jpeg;.jpe;.png;.gif';
273274 FOptPlaylistExts:=' .m3u;.xspf' ;
274275 FOptIncludeSubFolders:=true;
275276 // Be carefull when settings this. If the size is too large, the list will be empty.
@@ -294,6 +295,13 @@ procedure TfrmMain.FormCreate(Sender: TObject);
294295
295296 FstrInitialSelectedImageFile :=' ' ;
296297
298+ { $ifdef windows}
299+ FstrInitialDir := GetWindowsSpecialDir(CSIDL_MYPICTURES);
300+ { $else}
301+ // TODO:
302+ FstrInitialDir := ' ' ;
303+ { $endif}
304+
297305 // i18n
298306 MenuItemNext.Caption := resstrPlaybackNext;
299307 MenuItemBack.Caption := resstrPlaybackPrevious;
@@ -314,7 +322,6 @@ procedure TfrmMain.FormCreate(Sender: TObject);
314322 MenuItemBackgroundBlack.Caption:=resstrBackgroundBlack;
315323 MenuItemBackgroundWhite.Caption:=resstrBackgroundWhite;
316324
317-
318325 // Load settings
319326 if ForceDirectories(GetAppConfigDir(false)) then
320327 begin
@@ -348,6 +355,8 @@ procedure TfrmMain.FormCreate(Sender: TObject);
348355 FOptPlaylistExts := string(XMLConfig.GetValue(' /Opts/PlaylistExts' ,widestring(FOptPlaylistExts)));
349356 FOptIntervalIntSeconds := XMLConfig.GetValue(' /Opts/IntervalSeconds' ,FOptIntervalIntSeconds);
350357
358+ FstrInitialDir := string(XMLConfig.GetValue(' /InitDir/Path' ,widestring(FstrInitialDir)));
359+
351360 // Command line parameters
352361 if Application.HasOption(' h' , ' help' ) then
353362 begin
@@ -551,7 +560,7 @@ procedure TfrmMain.FormCreate(Sender: TObject);
551560 begin
552561 f:= FileSize(ParamStr(I));
553562 // Check file size.
554- if f >= (FOptMinimulFileSizeKiloByte * 1024 ) then
563+ if f >= (FOptMinimulFileSizeKiloByte) then
555564 begin
556565 FstFileList.Add(ParamStr(I));
557566 //
@@ -603,7 +612,7 @@ procedure TfrmMain.FormCreate(Sender: TObject);
603612 begin
604613 f:= FileSize(folderfiles[j]);
605614 // Check file size.
606- if f >= (FOptMinimulFileSizeKiloByte * 1024 ) then
615+ if f >= (FOptMinimulFileSizeKiloByte) then
607616 begin
608617 FstFileList.Add(folderfiles[j]);
609618 end ;
@@ -623,7 +632,12 @@ procedure TfrmMain.FormCreate(Sender: TObject);
623632 if ((FstFileList.Count < 1 ) and (FstrInitialSelectedImageFile = ' ' )) then
624633 begin
625634 // No files are provided in the parameter string, so open "file open" dialog.
635+
636+ // Sets default dir
637+ OpenPictureDialog1.InitialDir:=FstrInitialDir;
638+ // Sets title
626639 OpenPictureDialog1.Title:=ReplaceStr(ExtractFileName(ParamStr(0 )),ExtractFileExt(ParamStr(0 )),' ' )+' - ' + resstrOpenPictures;
640+ // Open dialog
627641 if OpenPictureDialog1.Execute then
628642 begin
629643 for i:=0 to OpenPictureDialog1.Files.Count -1 do
@@ -635,12 +649,14 @@ procedure TfrmMain.FormCreate(Sender: TObject);
635649 begin
636650 f:= FileSize(OpenPictureDialog1.Files[i]);
637651 // Check file size.
638- if f >= (FOptMinimulFileSizeKiloByte * 1024 ) then
652+ if f >= (FOptMinimulFileSizeKiloByte) then
639653 begin
640654 // FstFileList.Add(OpenPictureDialog1.Files[i]);
641655 if (i=0 ) then
642656 begin
643657 FstrInitialSelectedImageFile:=OpenPictureDialog1.Files[i];
658+ // sets init dir for next time.
659+ FstrInitialDir := ExtractFilePath(OpenPictureDialog1.Files[i]);
644660 end ;
645661 FstFileList.Add(OpenPictureDialog1.Files[i]);
646662 end ;
@@ -665,6 +681,10 @@ procedure TfrmMain.FormCreate(Sender: TObject);
665681 begin
666682 fileFolder:=ReplaceStr(FstFileList[0 ],ExtractFileName(FstFileList[0 ]),' ' );
667683 // fileFolder:=ReplaceStr(FstrInitialSelectedImageFile,ExtractFileName(FstrInitialSelectedImageFile),'');
684+
685+ // sets init dir for next time.
686+ FstrInitialDir := ExtractFilePath(FstFileList[0 ]);
687+
668688 // Create search mask
669689 fileSearchMask:=' ' ;
670690 for i:=0 to FstFileExtList.Count-1 do
@@ -688,7 +708,7 @@ procedure TfrmMain.FormCreate(Sender: TObject);
688708 begin
689709 f:= FileSize(folderfiles[j]);
690710 // Check file size.
691- if f >= (FOptMinimulFileSizeKiloByte * 1024 ) then
711+ if f >= (FOptMinimulFileSizeKiloByte) then
692712 begin
693713 FstFileList.Add(folderfiles[j]);
694714 end ;
@@ -902,6 +922,9 @@ procedure TfrmMain.FormCloseQuery(Sender: TObject; var CanClose: boolean);
902922 XMLConfig.SetValue(' /Opts/FileExts' ,widestring(FOptFileExts));
903923 XMLConfig.SetValue(' /Opts/PlaylistExts' ,widestring(FOptPlaylistExts));
904924 XMLConfig.SetValue(' /Opts/IntervalSeconds' ,FOptIntervalIntSeconds);
925+
926+ XMLConfig.SetValue(' /InitDir/Path' ,widestring(FstrInitialDir));
927+
905928 end ;
906929end ;
907930
@@ -1288,7 +1311,7 @@ procedure TfrmMain.MenuItemSlideshowInFrameClick(Sender: TObject);
12881311 FOrigBounds:= BoundsRect;
12891312 self.BorderStyle:=bsNone;
12901313 BoundsRect := FOrigBounds;
1291- titlebarheight:=GetSystemMetrics(SM_CYCAPTION);
1314+ titlebarheight:=GetSystemMetrics(SM_CYCAPTION) + 9 ;
12921315 self.height := self.height + titlebarheight;
12931316 { $else}
12941317 // https://forum.lazarus.freepascal.org/index.php?topic=38675.0
0 commit comments