Strange behaviour of FsGetPreviewBitmap

Bug reports will be moved here when the described bug has been fixed

Moderators: Hacker, petermad, Stefan2, white

Post Reply
bookmist
Junior Member
Junior Member
Posts: 2
Joined: 2006-11-11, 20:17 UTC

Strange behaviour of FsGetPreviewBitmap

Post by *bookmist »

FsGetPreviewBitmap run only for folders. RemoteName is in UNICODE format.
When plugin implements FsGetPreviewBitmap, FsLinksToLocalFiles and FsGetLocalName, on long lists of files (and on short, but on long it's visible) thumbnails overlap(paints one on other). This happends only once per run(It's needed to restart Total Commander to look on this again), and after two repaints thumbnails look normal.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This function is untested so far. Do you have a sample plugin with which I can test it?
Author of Total Commander
https://www.ghisler.com
bookmist
Junior Member
Junior Member
Posts: 2
Joined: 2006-11-11, 20:17 UTC

Post by *bookmist »

library FSSample;
{$E wfx}
uses wfxhead,SysUtils,Windows;
const PlugName='SamplePlugin';
var
t:integer;

function inttostrl(i,slength:integer):string;
begin
result:=inttostr(i);
while length(result)<slength do result:='0'+result;
end;

function FsInit(PluginNr:integer;pProgressProc:tProgressProc;pLogProc:tLogProc;
pRequestProc:tRequestProc):integer; stdcall;
begin
result:=0;
end;

function FsFindFirst(path :pchar;var FindData:tWIN32FINDDATA):thandle; stdcall;
begin
FillChar(FindData,sizeof(FindData)-1,0);
RESULT:=1;
t:=0;
strlcopy(FindData.cFileName,pchar(inttostrl(t,8)+'.dat'),255);
end;

function FsFindNext(Hdl:thandle;var FindData:tWIN32FINDDATA):bool; stdcall;
var k:integer;
begin
FillChar(FindData,sizeof(FindData)-1,0);
if t>100 then result:=false else result:=true;
inc(t);
strlcopy(FindData.cFileName,pchar(inttostrl(t,8)+'.dat'),255);
end;

function FsFindClose(Hdl:thandle):integer; stdcall;
begin
t:=0;
result:=0;
end;

procedure FsGetDefRootName(DefRootName:pchar;maxlen:integer); stdcall;
begin
StrLCopy(DefRootName, PChar(PlugName), MaxLen);
end;

function FsGetPreviewBitmap(RemoteName:pchar;width,height:integer;
var ReturnedBitmap:hbitmap):integer; stdcall;
begin
width:=0;
height:=1 div width;///divizion by zero, but i don't see error message
result:=FS_BITMAP_NONE+height;
end;

//this two functions implemented only for delay
function FsLinksToLocalFiles:bool; stdcall;
var width,height:integer;
begin
FsLinksToLocalFiles:=true;
end;
function FsGetLocalName(RemoteName:pchar;maxlen:integer):bool; stdcall;
var k:integer;
begin
result:=false;
k:=0; while k<10000000 do inc(k);//delay
end;

exports
FsInit,
FsFindFirst,
FsFindNext,
FsFindClose,
FsGetPreviewBitmap,
FsLinksToLocalFiles,
FsGetLocalName;

end.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I will test it, thanks.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I have tested that - your function DOES get called, but the error is caught by Delphi's exception handling and not shown to the user.

What problems did you have?
Author of Total Commander
https://www.ghisler.com
ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

FsGetPreviewBitmap is not called for files

Post by *ricobautsch »

I want to grab this topic and bring it in mind again, because i can confirm the very first sentence of user bookmist.

The new FSPlugin function FsGetPreviewBitmap is called only for folders, not for files.

Is this intentional?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Ah, sorry, I missed that - I understood that it wasn't called at all...
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This should also be fixed now, please test it!
Author of Total Commander
https://www.ghisler.com
ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

Fixed

Post by *ricobautsch »

Works well now. Thanx.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks for testing!
Author of Total Commander
https://www.ghisler.com
User avatar
Hacker
Moderator
Moderator
Posts: 13141
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

[mod]New bugreport split to FsGetPreviewBitmap is not being called.

Hacker (Moderator)[/mod]
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Post Reply