Strange behaviour of FsGetPreviewBitmap
Moderators: Hacker, petermad, Stefan2, white
Strange behaviour of FsGetPreviewBitmap
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.
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.
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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
https://www.ghisler.com
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.
{$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.
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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?
What problems did you have?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
-
- Member
- Posts: 103
- Joined: 2005-06-21, 00:42 UTC
FsGetPreviewBitmap is not called for files
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?
The new FSPlugin function FsGetPreviewBitmap is called only for folders, not for files.
Is this intentional?
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Ah, sorry, I missed that - I understood that it wasn't called at all...
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact: