You've already forked lazarus-ccr
clipanalizer: implemented delete format.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6272 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -2,10 +2,10 @@ object frmClipboardAnalizer: TfrmClipboardAnalizer
|
|||||||
Left = 175
|
Left = 175
|
||||||
Height = 517
|
Height = 517
|
||||||
Top = 185
|
Top = 185
|
||||||
Width = 771
|
Width = 858
|
||||||
Caption = 'Clipboard Analizer'
|
Caption = 'Clipboard Analizer'
|
||||||
ClientHeight = 517
|
ClientHeight = 517
|
||||||
ClientWidth = 771
|
ClientWidth = 858
|
||||||
LCLVersion = '1.9.0.0'
|
LCLVersion = '1.9.0.0'
|
||||||
object lstTypes: TListBox
|
object lstTypes: TListBox
|
||||||
Left = 0
|
Left = 0
|
||||||
@@ -22,20 +22,20 @@ object frmClipboardAnalizer: TfrmClipboardAnalizer
|
|||||||
Left = 277
|
Left = 277
|
||||||
Height = 517
|
Height = 517
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 494
|
Width = 581
|
||||||
Align = alClient
|
Align = alClient
|
||||||
Caption = 'Panel1'
|
Caption = 'Panel1'
|
||||||
ClientHeight = 517
|
ClientHeight = 517
|
||||||
ClientWidth = 494
|
ClientWidth = 581
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object Panel2: TPanel
|
object Panel2: TPanel
|
||||||
Left = 1
|
Left = 1
|
||||||
Height = 111
|
Height = 111
|
||||||
Top = 1
|
Top = 1
|
||||||
Width = 492
|
Width = 579
|
||||||
Align = alTop
|
Align = alTop
|
||||||
ClientHeight = 111
|
ClientHeight = 111
|
||||||
ClientWidth = 492
|
ClientWidth = 579
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object btnUpdate: TButton
|
object btnUpdate: TButton
|
||||||
Left = 8
|
Left = 8
|
||||||
@@ -113,7 +113,7 @@ object frmClipboardAnalizer: TfrmClipboardAnalizer
|
|||||||
Left = 112
|
Left = 112
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 5
|
Top = 5
|
||||||
Width = 375
|
Width = 462
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
@@ -128,7 +128,7 @@ object frmClipboardAnalizer: TfrmClipboardAnalizer
|
|||||||
TabOrder = 7
|
TabOrder = 7
|
||||||
end
|
end
|
||||||
object btnIsolate: TButton
|
object btnIsolate: TButton
|
||||||
Left = 272
|
Left = 368
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 40
|
Top = 40
|
||||||
Width = 91
|
Width = 91
|
||||||
@@ -137,7 +137,7 @@ object frmClipboardAnalizer: TfrmClipboardAnalizer
|
|||||||
TabOrder = 8
|
TabOrder = 8
|
||||||
end
|
end
|
||||||
object btnUpdateIsolate: TButton
|
object btnUpdateIsolate: TButton
|
||||||
Left = 368
|
Left = 464
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 40
|
Top = 40
|
||||||
Width = 107
|
Width = 107
|
||||||
@@ -163,12 +163,21 @@ object frmClipboardAnalizer: TfrmClipboardAnalizer
|
|||||||
OnClick = btnReOpenClick
|
OnClick = btnReOpenClick
|
||||||
TabOrder = 11
|
TabOrder = 11
|
||||||
end
|
end
|
||||||
|
object btnDeleteFormat: TButton
|
||||||
|
Left = 272
|
||||||
|
Height = 25
|
||||||
|
Top = 40
|
||||||
|
Width = 91
|
||||||
|
Caption = 'Delete Format'
|
||||||
|
OnClick = btnDeleteFormatClick
|
||||||
|
TabOrder = 12
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object memoDump: TMemo
|
object memoDump: TMemo
|
||||||
Left = 1
|
Left = 1
|
||||||
Height = 404
|
Height = 404
|
||||||
Top = 112
|
Top = 112
|
||||||
Width = 492
|
Width = 579
|
||||||
Align = alClient
|
Align = alClient
|
||||||
Font.Height = -11
|
Font.Height = -11
|
||||||
Font.Name = 'Courier New'
|
Font.Name = 'Courier New'
|
||||||
|
@@ -54,6 +54,7 @@ type
|
|||||||
btnIsolate: TButton;
|
btnIsolate: TButton;
|
||||||
btnUpdateIsolate: TButton;
|
btnUpdateIsolate: TButton;
|
||||||
btnOpen: TButton;
|
btnOpen: TButton;
|
||||||
|
btnDeleteFormat: TButton;
|
||||||
chkBinText: TCheckBox;
|
chkBinText: TCheckBox;
|
||||||
oDlg: TOpenDialog;
|
oDlg: TOpenDialog;
|
||||||
sDlg: TSaveDialog;
|
sDlg: TSaveDialog;
|
||||||
@@ -69,6 +70,7 @@ type
|
|||||||
radStream: TRadioButton;
|
radStream: TRadioButton;
|
||||||
radEncoding: TRadioButton;
|
radEncoding: TRadioButton;
|
||||||
Splitter1: TSplitter;
|
Splitter1: TSplitter;
|
||||||
|
procedure btnDeleteFormatClick(Sender: TObject);
|
||||||
procedure btnOpenClick(Sender: TObject);
|
procedure btnOpenClick(Sender: TObject);
|
||||||
procedure btnUpdateIsolateClick(Sender: TObject);
|
procedure btnUpdateIsolateClick(Sender: TObject);
|
||||||
procedure btnSaveClick(Sender: TObject);
|
procedure btnSaveClick(Sender: TObject);
|
||||||
@@ -80,7 +82,9 @@ type
|
|||||||
private
|
private
|
||||||
fFilename: string;
|
fFilename: string;
|
||||||
procedure DumpClipboard;
|
procedure DumpClipboard;
|
||||||
|
procedure IsolateFormat(updateWithContent: boolean);
|
||||||
procedure UpdateFormatList;
|
procedure UpdateFormatList;
|
||||||
|
procedure DeleteFormat;
|
||||||
public
|
public
|
||||||
|
|
||||||
end;
|
end;
|
||||||
@@ -239,31 +243,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmClipboardAnalizer.btnUpdateIsolateClick(Sender: TObject);
|
procedure TfrmClipboardAnalizer.btnUpdateIsolateClick(Sender: TObject);
|
||||||
var
|
|
||||||
aIndex: Integer;
|
|
||||||
formatID: TClipboardFormat;
|
|
||||||
stream: TMemoryStream;
|
|
||||||
begin
|
begin
|
||||||
aIndex := lstTypes.ItemIndex;
|
IsolateFormat(true);
|
||||||
if aIndex<0 then
|
|
||||||
exit;
|
|
||||||
|
|
||||||
formatID := TClipboardFormat(lstTypes.Items.Objects[aIndex]);
|
|
||||||
|
|
||||||
stream := TMemoryStream.Create;
|
|
||||||
try
|
|
||||||
memoDump.Lines.SaveToStream(stream);
|
|
||||||
stream.position := 0;
|
|
||||||
|
|
||||||
Clipboard.Open;
|
|
||||||
Clipboard.Clear;
|
|
||||||
Clipboard.AddFormat(formatID, stream);
|
|
||||||
Clipboard.Close;
|
|
||||||
|
|
||||||
UpdateFormatList;
|
|
||||||
finally
|
|
||||||
stream.free;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmClipboardAnalizer.btnOpenClick(Sender: TObject);
|
procedure TfrmClipboardAnalizer.btnOpenClick(Sender: TObject);
|
||||||
@@ -274,32 +255,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmClipboardAnalizer.btnIsolateClick(Sender: TObject);
|
procedure TfrmClipboardAnalizer.btnDeleteFormatClick(Sender: TObject);
|
||||||
var
|
|
||||||
aIndex: Integer;
|
|
||||||
formatID: TClipboardFormat;
|
|
||||||
stream: TMemoryStream;
|
|
||||||
begin
|
begin
|
||||||
aIndex := lstTypes.ItemIndex;
|
DeleteFormat;
|
||||||
if aIndex<0 then
|
end;
|
||||||
exit;
|
|
||||||
|
|
||||||
formatID := TClipboardFormat(lstTypes.Items.Objects[aIndex]);
|
procedure TfrmClipboardAnalizer.btnIsolateClick(Sender: TObject);
|
||||||
|
begin
|
||||||
stream := TMemoryStream.Create;
|
IsolateFormat(false);
|
||||||
try
|
|
||||||
ClipboardGetFormat(formatID, stream);
|
|
||||||
stream.position := 0;
|
|
||||||
|
|
||||||
Clipboard.Open;
|
|
||||||
Clipboard.Clear;
|
|
||||||
Clipboard.AddFormat(formatID, stream);
|
|
||||||
Clipboard.Close;
|
|
||||||
|
|
||||||
UpdateFormatList;
|
|
||||||
finally
|
|
||||||
stream.free;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmClipboardAnalizer.btnReOpenClick(Sender: TObject);
|
procedure TfrmClipboardAnalizer.btnReOpenClick(Sender: TObject);
|
||||||
@@ -389,6 +352,37 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmClipboardAnalizer.IsolateFormat(updateWithContent: boolean);
|
||||||
|
var
|
||||||
|
stream: TMemoryStream;
|
||||||
|
formatID: TClipboardFormat;
|
||||||
|
aIndex: Integer;
|
||||||
|
begin
|
||||||
|
aIndex := lstTypes.ItemIndex;
|
||||||
|
if aIndex<0 then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
formatID := TClipboardFormat(lstTypes.Items.Objects[aIndex]);
|
||||||
|
|
||||||
|
stream := TMemoryStream.Create;
|
||||||
|
try
|
||||||
|
if updateWithContent then
|
||||||
|
memoDump.Lines.SaveToStream(stream)
|
||||||
|
else
|
||||||
|
ClipboardGetFormat(formatID, stream);
|
||||||
|
stream.position := 0;
|
||||||
|
|
||||||
|
Clipboard.Open;
|
||||||
|
Clipboard.Clear;
|
||||||
|
Clipboard.AddFormat(formatID, stream);
|
||||||
|
Clipboard.Close;
|
||||||
|
|
||||||
|
UpdateFormatList;
|
||||||
|
finally
|
||||||
|
stream.free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmClipboardAnalizer.UpdateFormatList;
|
procedure TfrmClipboardAnalizer.UpdateFormatList;
|
||||||
var
|
var
|
||||||
L: TStringList;
|
L: TStringList;
|
||||||
@@ -413,5 +407,47 @@ begin
|
|||||||
L.Free;
|
L.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
type
|
||||||
|
TFormatItem = record
|
||||||
|
formatID: TClipboardFormat;
|
||||||
|
stream: TMemoryStream;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmClipboardAnalizer.DeleteFormat;
|
||||||
|
var
|
||||||
|
item: TFormatItem;
|
||||||
|
Lista: array of TFormatItem;
|
||||||
|
aIndex, n: Integer;
|
||||||
|
begin
|
||||||
|
|
||||||
|
for aIndex:=0 to lstTypes.Count-1 do begin
|
||||||
|
if lstTypes.ItemIndex=aIndex then
|
||||||
|
continue;
|
||||||
|
item.formatID := TClipboardFormat(lstTypes.Items.Objects[aIndex]);
|
||||||
|
item.stream := TMemoryStream.Create;
|
||||||
|
ClipboardGetFormat(item.formatID, item.stream);
|
||||||
|
item.stream.Position := 0;
|
||||||
|
n := Length(Lista);
|
||||||
|
SetLength(lista, n+1);
|
||||||
|
lista[n] := item;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if length(lista)=0 then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
try
|
||||||
|
Clipboard.Open;
|
||||||
|
Clipboard.Clear;
|
||||||
|
for aIndex := 0 to Length(Lista)-1 do begin
|
||||||
|
Clipboard.AddFormat(lista[aIndex].formatID, lista[aIndex].stream);
|
||||||
|
lista[aIndex].stream.free;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
Clipboard.Close;
|
||||||
|
UpdateFormatList;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user