1 { 2 /*************************************************************************** 3 ClipBoardHistory.pas 4 -------------------- 5 6 ***************************************************************************/ 7 8 *************************************************************************** 9 * * 10 * This source is free software; you can redistribute it and/or modify * 11 * it under the terms of the GNU General Public License as published by * 12 * the Free Software Foundation; either version 2 of the License, or * 13 * (at your option) any later version. * 14 * * 15 * This code is distributed in the hope that it will be useful, but * 16 * WITHOUT ANY WARRANTY; without even the implied warranty of * 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 18 * General Public License for more details. * 19 * * 20 * A copy of the GNU General Public License is available on the World * 21 * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also * 22 * obtain it by writing to the Free Software Foundation, * 23 * Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA. * 24 * * 25 *************************************************************************** 26 27 Author: Mattias Gaertner 28 29 Abstract: 30 The TClipBoardHistory form is a frontend for the clipboard history, which 31 stores the texts of the last "copy to clipboard" actions. 32 33 ToDo: 34 Everything. 35 } 36 unit ClipBoardHistory; 37 38 {$mode objfpc}{$H+} 39 40 interface 41 42 uses 43 Classes, SysUtils, Forms, Controls, Buttons, SynEdit, EditorOptions, StdCtrls, 44 IDEOptionDefs, Math, EnvironmentOpts, ClipBrd, LazarusIDEStrConsts; 45 46 type 47 TClipBoardHistory = class(TForm) 48 CopyToIDEBitBtn: TBitBtn; 49 ClearBitBtn: TBitBtn; 50 PasteFromClipboardBitBtn: TBitBtn; 51 ItemsListBox: TListBox; 52 PreviewSynEdit: TSynEdit; 53 procedure ClipBoardHistoryResize(Sender: TObject); 54 public 55 constructor Create(TheOwner: TComponent); override; 56 destructor Destroy; override; 57 end; 58 59 implementation 60 61 { TClipBoardHistory } 62 63 procedure TClipBoardHistory.ClipBoardHistoryResize(Sender: TObject); 64 begin 65 with CopyToIDEBitBtn do begin 66 Left:=0; 67 Top:=0; 68 end; 69 70 with ClearBitBtn do begin 71 Left:=CopyToIDEBitBtn.Left+CopyToIDEBitBtn.Width; 72 Top:=0; 73 end; 74 75 with PasteFromClipboardBitBtn do begin 76 Left:=ClearBitBtn.Left+ClearBitBtn.Width; 77 Top:=0; 78 end; 79 80 with ItemsListBox do begin 81 Left:=0; 82 Top:=CopyToIDEBitBtn.Top+CopyToIDEBitBtn.Height; 83 Width:=Self.ClientWidth; 84 Height:=Max(Self.ClientHeight-Top-100,30); 85 end; 86 87 with PreviewSynEdit do begin 88 Left:=0; 89 Top:=ItemsListBox.Top+ItemsListBox.Height; 90 Width:=Self.ClientWidth; 91 Height:=Self.ClientHeight-Top; 92 end; 93 end; 94 95 constructor TClipBoardHistory.Create(TheOwner: TComponent); 96 begin 97 inherited Create(TheOwner); 98 99 Name:=NonModalIDEWindowNames[nmiwClipbrdHistory]; 100 Caption := 'Clipboard History'; 101 102 CopyToIDEBitBtn:=TBitBtn.Create(Self); 103 with CopyToIDEBitBtn do begin 104 Name:='CopyToIDEBitBtn'; 105 Parent:=Self; 106 Left:=0; 107 Top:=0; 108 Caption:='Copy to IDE'; 109 end; 110 111 ClearBitBtn:=TBitBtn.Create(Self); 112 with ClearBitBtn do begin 113 Name:='ClearBitBtn'; 114 Parent:=Self; 115 Left:=CopyToIDEBitBtn.Left+CopyToIDEBitBtn.Width; 116 Top:=0; 117 Caption:='Clear all'; 118 end; 119 120 PasteFromClipboardBitBtn:=TBitBtn.Create(Self); 121 with PasteFromClipboardBitBtn do begin 122 Name:='PasteFromClipboardBitBtn'; 123 Parent:=Self; 124 Left:=ClearBitBtn.Left+ClearBitBtn.Width; 125 Top:=0; 126 Caption:='Paste from Clipboard'; 127 end; 128 129 ItemsListBox:=TListBox.Create(Self); 130 with ItemsListBox do begin 131 Name:='ItemsListBox'; 132 Parent:=Self; 133 Left:=0; 134 Top:=CopyToIDEBitBtn.Top+CopyToIDEBitBtn.Height; 135 Width:=Self.ClientWidth; 136 Height:=Max(Self.ClientHeight-Top-100,30); 137 end; 138 139 PreviewSynEdit:=TSynEdit.Create(Self); 140 with PreviewSynEdit do begin 141 Name:='PreviewSynEdit'; 142 Parent:=Self; 143 Left:=0; 144 Top:=ItemsListBox.Top+ItemsListBox.Height; 145 Width:=Self.ClientWidth; 146 Height:=Self.ClientHeight-Top; 147 end; 148 149 OnResize:=@ClipBoardHistoryResize; 150 end; 151 152 destructor TClipBoardHistory.Destroy; 153 begin 154 inherited Destroy; 155 end; 156 157 end. 158 159