home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / ArsClip / source.zip / UnitOtherQueue.pas < prev    next >
Pascal/Delphi Source File  |  2003-06-05  |  2KB  |  71 lines

  1. unit UnitOtherQueue;
  2.  
  3. {
  4.     Purpose:
  5.         Create a queue of arbitrary clipboard types
  6.  
  7.     Updates:
  8.         New TClipQueue heavily simplifies this queue
  9. }
  10. interface
  11.  
  12. uses Classes, Windows, Graphics, UnitClipQueue;
  13.  
  14. type TOtherQueue = class(TClipQueue)
  15.     private
  16.         qClipsizeLimit : cardinal;
  17.     public
  18.         procedure SetClipSizeLimit(size : cardinal);
  19.         procedure InsertAtStart(ci : TClipItem); overload;
  20.         procedure AddNoSizeCheck(s : string; ci : TClipItem); override;
  21. end;
  22.  
  23. var OtherQueue  : TOtherQueue;
  24.  
  25. implementation
  26.  
  27. uses clipbrd, unitfrmclipboardmanager, unitfrmmainpopup,  sysutils,
  28. forms {for application object}, Dialogs;
  29.  
  30.  
  31. /////////////////////
  32. // Public Interface
  33. /////////////////////
  34.  
  35.  
  36. procedure TOtherQueue.AddNoSizeCheck(s: string; ci: TClipItem);
  37. begin
  38.     //inherited;
  39.  
  40.     // TODO: Investigate method for detecting DUPs
  41.     sl.AddObject(s, ci);
  42. end;
  43.  
  44. procedure TOtherQueue.InsertAtStart(ci: TClipItem);
  45. begin
  46.     // TODO: ignore dupe items - CRC maybe?
  47.     {for i := 0 to self.GetQueueCount - 1 do begin
  48.         if (self.GetClipItem(i).GetHandle = ci.GetHandle) then begin
  49.             EXIT;
  50.         end;
  51.     end;
  52.     }
  53.     // enforce the max data size
  54.     // use the format name for the "text version" of the clip
  55.     if ci.GetDataSize <= self.qClipsizeLimit then begin
  56.         ci.OverrideTextVersionOfItem(ci.GetFormatName);
  57.  
  58.         sl.InsertObject(0, ci.GetAsText, ci);
  59.         self.SetQueueSize(self.qSize);
  60.     end;
  61. end;
  62.  
  63. procedure TOTherQueue.SetClipSizeLimit(size : cardinal);
  64. begin
  65.     qClipsizeLimit := size;
  66. end;
  67.  
  68. initialization
  69.     OtherQueue := TOtherQueue.Create;
  70. end.                
  71.