Skip to content

Commit

Permalink
v1.4.0.1 fix --inFrame=on bug (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
torum committed Sep 12, 2024
1 parent e46023b commit 05ad0ab
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 46 deletions.
Binary file modified files/bin/executables/ImageViewer.exe
Binary file not shown.
6 changes: 3 additions & 3 deletions src/ImageViewer.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
<LongPathAware Value="True"/>
<TextName Value="Witha.ImageViewer.ImageViewer"/>
<TextDesc Value="Image Viewer/Slideshow"/>
</XPManifest>
Expand All @@ -26,9 +27,8 @@
<VersionInfo>
<UseVersionInfo Value="True"/>
<MajorVersionNr Value="1"/>
<MinorVersionNr Value="3"/>
<RevisionNr Value="9"/>
<BuildNr Value="3"/>
<MinorVersionNr Value="4"/>
<BuildNr Value="1"/>
<StringTable FileDescription="Image Viewer" InternalName="ImageViewer" LegalCopyright="torum" OriginalFilename="ImageViewer.exe" ProductName="Simple Image Viewer"/>
</VersionInfo>
<BuildModes Count="1">
Expand Down
Binary file modified src/ImageViewer.res
Binary file not shown.
2 changes: 1 addition & 1 deletion src/ufullscreen.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object frmFullscreen: TfrmFullscreen
OnShow = FormShow
PopupMenu = PopupMenu1
Position = poOwnerFormCenter
LCLVersion = '2.2.4.0'
LCLVersion = '3.4.0.0'
object Image1: TImage
Left = 0
Height = 241
Expand Down
13 changes: 9 additions & 4 deletions src/ufullscreen.pas
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,12 @@ procedure TfrmFullscreen.FormCreate(Sender: TObject);
MenuItemMoniters.Add(childItem);
end;

// disable StayOnToo menu because somehow setting it off causes app close when start inFrame mode from command-line.
if (not FisStartNormal) then
begin
MenuItemStayOnTop.Enabled:=false;
end;

self.Visible:=false; // Don't set to true.
self.ShowInTaskBar:=stNever;

Expand Down Expand Up @@ -428,7 +434,6 @@ procedure TfrmFullscreen.StartSlideshow(startIndex:integer);
Shuffle(FFileList);
TimerInterval.tag:= RandomRange(0,FFileList.Count-1);
end;

end else
begin
TimerInterval.tag:=0;
Expand Down Expand Up @@ -752,9 +757,6 @@ procedure TfrmFullscreen.ResizeImage();
curWidth := screen.Monitors[FOptIntMoniter].Width;
curHeight:= screen.Monitors[FOptIntMoniter].Height;
end;
{$ifdef Mydebug}
OutputDebugString(PChar(TrimRight( 'curWidth: ->' + intToStr(curWidth))));
{$endif}

if FStretch then begin
Image1.Stretch:=true;
Expand Down Expand Up @@ -956,6 +958,9 @@ procedure TfrmFullscreen.TimerFadeInTimer(Sender: TObject);
var
iNext:integer;
begin
{$ifdef Mydebug}
OutputDebugString(PChar(TrimRight( 'TimerFadeInTimer') ));
{$endif}
if FFileList.Count = 0 then
begin
TimerInterval.Enabled:=false;
Expand Down
66 changes: 28 additions & 38 deletions src/umain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* No extra components required.
### Compiled and tested on
Windows 11: Lazarus 2.2.2 FPC 3.2.2 x86_64-win64-win32/win64
Windows 11: Lazarus 3.4 FPC 3.2.2 x86_64-win64-win32/win64
Windows 10: Lazarus 1.8.0 r56594 FPC 3.0.4 x86_64-win64-win32/win64
Ubuntu 22.04.1 LTS: Lazarus 2.2.0 FPC 3.2.2 x86_64-linux-gtk2
Ubuntu 17.10 (64bit): Lazarus 1.8.0 rc4+dfsg-1 FPC 3.0.2 x86_64-linux-gtk2
Expand All @@ -15,21 +15,21 @@
macOS 10.11.6 (64bit) El Capitan: Lazarus 1.9.0 carbon trunk, FPC 3.0.4
### Known issues and bugs:
On Windows, inFrame "window" does not have shaddow. < Fixed by EnableBlur.
On Windows, inFrame "window" does not have shaddow. < Fixed with EnableBlur.
On Windows, PNG (depth 24) antialising isn't working when stretch.
https://forum.lazarus.freepascal.org/index.php?topic=24408.0
http://forum.lazarus.freepascal.org/index.php?topic=19542.0
On Ubuntu, inFrame transit effect doesn't seem to be working..
On Ubuntu 24.04, BorderStyle:=bsSizeable has some issues.
On macOS, inFrame transit effect won't work?
On macOS El Capitan, the top bar won't hide. It's fine on High Sierra.
On macOS, trayicon won't show up correctly. Black filled.->disabled
On macOS, awaking from sleep >blank screen?
Cocoa based 64bit apps for macOS may not be ready some time soon...
### TODO:
* StayOnTop on/off when inFrame mode.
* Blur effect on/off option. Need to find a way to enable on fullscreen with a modal window first...
* WebP support.
* WebP support. Preferably without Dlls or external components.
* Better zooming.
### Backlog:
Expand Down Expand Up @@ -304,7 +304,7 @@ procedure TfrmMain.FormCreate(Sender: TObject);
i,f:integer;
configFile:string;
begin
FstrAppVer:='1.3.9.3';
FstrAppVer:='1.4.0.1';

// Init Main form properties.
self.Caption:=ReplaceStr(ExtractFileName(ParamStr(0)),ExtractFileExt(ParamStr(0)),'');
Expand Down Expand Up @@ -1682,8 +1682,6 @@ procedure TfrmMain.MenuItemSlideshowInFrameClick(Sender: TObject);
FOrigWndState:=WindowState;
FOrigBounds:= BoundsRect;

Hide;

// a little hack. to workaround some issue for inFrame start and image cripping.
if FisStartNormal then
begin
Expand All @@ -1699,8 +1697,6 @@ procedure TfrmMain.MenuItemSlideshowInFrameClick(Sender: TObject);
EnableBlur; // TODO: make this an option.
end;

Show;

if FisStartNormal then
begin
self.left := self.left + GetSystemMetrics(SM_CYFRAME);
Expand Down Expand Up @@ -1733,7 +1729,7 @@ procedure TfrmMain.MenuItemSlideshowInFrameClick(Sender: TObject);
self.Caption:='InFrame Slideshow';
frmFullscreen := TfrmFullscreen.create(self);
frmFullScreen.StartWith:=FiCurrentFileIndex;
frmFullscreen.Color := self.color; ;
frmFullscreen.Color := self.color;
frmFullscreen.Parent := self;
// Set main form popup.
self.PopupMenu:= frmFullscreen.PopupMenu;
Expand Down Expand Up @@ -1794,15 +1790,6 @@ procedure TfrmMain.DoneInFrame(strCurr :string);
// https://forum.lazarus.freepascal.org/index.php?topic=38675.0
Hide;
self.BorderStyle:=bsSizeable;

Form := TForm.Create(nil);
try
Parent := Form;
Parent := nil;
finally
Form.Free;
end;

Show;

//BoundsRect:= FOrigBounds;
Expand Down Expand Up @@ -1886,29 +1873,33 @@ procedure TfrmMain.SetStayOnTop(bln:Boolean);
{$ifdef windows}
if FisInFrame then
begin
// "FormStyle:=fsNormal" causes window pos to move to 0,0 so..
BeforeBounds:= BoundsRect;
if FisStartNormal then
begin
// "FormStyle:=fsNormal" causes window pos to move to 0,0 so..
BeforeBounds:= BoundsRect;

// This isn't working for windows... calling this(FormStyle:=fsNormal) twice seems to work but...
self.FormStyle:=fsNormal;
// This isn't working for windows... calling this(FormStyle:=fsNormal) twice seems to work but...
self.FormStyle:=fsNormal;

MenuItemStayOnTop.Checked:=false;
self.FoptStayOnTop:=false;
MenuItemStayOnTop.Checked:=false;
self.FoptStayOnTop:=false;

if FisStartNormal then
begin
self.BorderStyle:=bsNone; // Forgot what this was for. Why did I put this here?
end;
//self.BorderStyle:=bsNone; // Forgot what this is for. Why did I put this here?

// Needed to this HERE again.... I don't know why.
self.FormStyle:=fsNormal;
// Needed to this HERE again.... I don't know why.
self.FormStyle:=fsNormal;

// Blur again
DoubleBuffered := True;
EnableBlur;
// Blur again
DoubleBuffered := True;
EnableBlur;

// re-set position.
BoundsRect := BeforeBounds;
// re-set position.
BoundsRect := BeforeBounds;
end else
begin
// (FOptStartInFrame) somehow setting it off causes app to close.

end;
end else
begin
self.FormStyle:=fsNormal;
Expand All @@ -1925,8 +1916,7 @@ procedure TfrmMain.SetStayOnTop(bln:Boolean);
{$endif}
end;
end;
//self.FoptStayOnTop:=bln;
//MenuItemStayOnTop.Checked:=bln;

end;

procedure TfrmMain.ApplicationProperties1Exception(Sender: TObject; E: Exception);
Expand Down

0 comments on commit 05ad0ab

Please sign in to comment.