home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softwarová Záchrana 3
/
Softwarova-zachrana-3.bin
/
ArsClip
/
source.zip
/
UnitOtherQueue.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
2003-06-05
|
2KB
|
71 lines
unit UnitOtherQueue;
{
Purpose:
Create a queue of arbitrary clipboard types
Updates:
New TClipQueue heavily simplifies this queue
}
interface
uses Classes, Windows, Graphics, UnitClipQueue;
type TOtherQueue = class(TClipQueue)
private
qClipsizeLimit : cardinal;
public
procedure SetClipSizeLimit(size : cardinal);
procedure InsertAtStart(ci : TClipItem); overload;
procedure AddNoSizeCheck(s : string; ci : TClipItem); override;
end;
var OtherQueue : TOtherQueue;
implementation
uses clipbrd, unitfrmclipboardmanager, unitfrmmainpopup, sysutils,
forms {for application object}, Dialogs;
/////////////////////
// Public Interface
/////////////////////
procedure TOtherQueue.AddNoSizeCheck(s: string; ci: TClipItem);
begin
//inherited;
// TODO: Investigate method for detecting DUPs
sl.AddObject(s, ci);
end;
procedure TOtherQueue.InsertAtStart(ci: TClipItem);
begin
// TODO: ignore dupe items - CRC maybe?
{for i := 0 to self.GetQueueCount - 1 do begin
if (self.GetClipItem(i).GetHandle = ci.GetHandle) then begin
EXIT;
end;
end;
}
// enforce the max data size
// use the format name for the "text version" of the clip
if ci.GetDataSize <= self.qClipsizeLimit then begin
ci.OverrideTextVersionOfItem(ci.GetFormatName);
sl.InsertObject(0, ci.GetAsText, ci);
self.SetQueueSize(self.qSize);
end;
end;
procedure TOTherQueue.SetClipSizeLimit(size : cardinal);
begin
qClipsizeLimit := size;
end;
initialization
OtherQueue := TOtherQueue.Create;
end.