mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 16:39:15 +02:00
IDE: multi paste: added history
git-svn-id: trunk@53066 -
This commit is contained in:
parent
81e059a3aa
commit
0ec085ca5b
@ -1,84 +1,88 @@
|
|||||||
object MultiPasteDialog: TMultiPasteDialog
|
object MultiPasteDialog: TMultiPasteDialog
|
||||||
Left = 245
|
Left = 245
|
||||||
Height = 500
|
Height = 504
|
||||||
Top = 137
|
Top = 137
|
||||||
Width = 460
|
Width = 466
|
||||||
BorderStyle = bsDialog
|
BorderStyle = bsDialog
|
||||||
Caption = 'MultiPaste'
|
Caption = 'MultiPaste'
|
||||||
ClientHeight = 500
|
ClientHeight = 504
|
||||||
ClientWidth = 460
|
ClientWidth = 466
|
||||||
|
OnCreate = FormCreate
|
||||||
|
OnDestroy = FormDestroy
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '1.7'
|
LCLVersion = '1.7'
|
||||||
object PasteOptsGroupBox: TGroupBox
|
object PasteOptsGroupBox: TGroupBox
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 216
|
Height = 210
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 448
|
Width = 454
|
||||||
Align = alTop
|
Align = alTop
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
Caption = 'Paste &options'
|
Caption = 'Paste &options'
|
||||||
ClientHeight = 197
|
ClientHeight = 195
|
||||||
ClientWidth = 444
|
ClientWidth = 450
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object TxtBeforeLinesLabel: TLabel
|
object TxtBeforeLinesLabel: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 17
|
Height = 13
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 432
|
Width = 438
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
Caption = 'Text &before each line'
|
Caption = 'Text &before each line'
|
||||||
FocusControl = TxtBeforeLinesEdit
|
FocusControl = TxtBeforeLinesComboBox
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object TxtBeforeLinesEdit: TEdit
|
object TxtBeforeLinesComboBox: TComboBox
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 27
|
Height = 27
|
||||||
Top = 26
|
Top = 22
|
||||||
Width = 432
|
Width = 438
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 3
|
BorderSpacing.Top = 3
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
|
ItemHeight = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object TxtAfterLinesLabel: TLabel
|
object TxtAfterLinesLabel: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 17
|
Height = 13
|
||||||
Top = 59
|
Top = 55
|
||||||
Width = 432
|
Width = 438
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
Caption = 'Text &after each line'
|
Caption = 'Text &after each line'
|
||||||
FocusControl = TxtAfterLinesEdit
|
FocusControl = TxtAfterLinesComboBox
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object TxtAfterLinesEdit: TEdit
|
object TxtAfterLinesComboBox: TComboBox
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 27
|
Height = 27
|
||||||
Top = 79
|
Top = 71
|
||||||
Width = 432
|
Width = 438
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 3
|
BorderSpacing.Top = 3
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
|
ItemHeight = 0
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object EscQuotesCheckBox: TCheckBox
|
object EscQuotesCheckBox: TCheckBox
|
||||||
AnchorSideLeft.Control = TxtAfterLinesEdit
|
AnchorSideLeft.Control = TxtAfterLinesComboBox
|
||||||
AnchorSideTop.Control = TxtAfterLinesEdit
|
AnchorSideTop.Control = TxtAfterLinesComboBox
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 21
|
Height = 24
|
||||||
Top = 112
|
Top = 104
|
||||||
Width = 104
|
Width = 105
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
Caption = 'Escape "es'
|
Caption = 'Escape "es'
|
||||||
@ -92,7 +96,7 @@ object MultiPasteDialog: TMultiPasteDialog
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 26
|
Left = 26
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 139
|
Top = 134
|
||||||
Width = 180
|
Width = 180
|
||||||
BorderSpacing.Left = 20
|
BorderSpacing.Left = 20
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
@ -111,9 +115,9 @@ object MultiPasteDialog: TMultiPasteDialog
|
|||||||
AnchorSideTop.Control = EscQuotesStyleComboBox
|
AnchorSideTop.Control = EscQuotesStyleComboBox
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 21
|
Height = 24
|
||||||
Top = 170
|
Top = 165
|
||||||
Width = 155
|
Width = 157
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Bottom = 6
|
BorderSpacing.Bottom = 6
|
||||||
Caption = '&Trim clipboard contents'
|
Caption = '&Trim clipboard contents'
|
||||||
@ -124,20 +128,20 @@ object MultiPasteDialog: TMultiPasteDialog
|
|||||||
end
|
end
|
||||||
object PreviewGroupBox: TGroupBox
|
object PreviewGroupBox: TGroupBox
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 225
|
Height = 234
|
||||||
Top = 228
|
Top = 222
|
||||||
Width = 448
|
Width = 454
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = '&Preview'
|
Caption = '&Preview'
|
||||||
ClientHeight = 206
|
ClientHeight = 219
|
||||||
ClientWidth = 444
|
ClientWidth = 450
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
inline PreviewSynEdit: TSynEdit
|
inline PreviewSynEdit: TSynEdit
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 194
|
Height = 207
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 432
|
Width = 438
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Font.Height = 13
|
Font.Height = 13
|
||||||
@ -636,9 +640,9 @@ object MultiPasteDialog: TMultiPasteDialog
|
|||||||
end
|
end
|
||||||
object BottomButtonPanel: TButtonPanel
|
object BottomButtonPanel: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 35
|
Height = 36
|
||||||
Top = 459
|
Top = 462
|
||||||
Width = 448
|
Width = 454
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
BorderSpacing.Bottom = 6
|
BorderSpacing.Bottom = 6
|
||||||
|
@ -39,21 +39,31 @@ unit MultiPasteDlg;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils, Classes, StdCtrls, ButtonPanel, Forms, Clipbrd, IDEHelpIntf, SynEdit;
|
SysUtils, Classes, StdCtrls, ButtonPanel, Forms, Clipbrd, SynEdit,
|
||||||
|
IDEHelpIntf, InputHistory, IDEProcs;
|
||||||
|
|
||||||
|
const
|
||||||
|
hlFormatPasteTxtBefore = 'FormatPasteTxtBefore';
|
||||||
|
hlFormatPasteTxtAfter = 'FormatPasteTxtAfter';
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
{ TMultiPasteDialog }
|
||||||
|
|
||||||
TMultiPasteDialog = class(TForm)
|
TMultiPasteDialog = class(TForm)
|
||||||
BottomButtonPanel: TButtonPanel;
|
BottomButtonPanel: TButtonPanel;
|
||||||
PreviewSynEdit: TSynEdit;
|
PreviewSynEdit: TSynEdit;
|
||||||
TrimClipbrdContentsCheckBox: TCheckBox;
|
TrimClipbrdContentsCheckBox: TCheckBox;
|
||||||
EscQuotesCheckBox: TCheckBox;
|
EscQuotesCheckBox: TCheckBox;
|
||||||
EscQuotesStyleComboBox: TComboBox;
|
EscQuotesStyleComboBox: TComboBox;
|
||||||
TxtBeforeLinesEdit: TEdit;
|
TxtAfterLinesComboBox: TComboBox;
|
||||||
TxtAfterLinesEdit: TEdit;
|
TxtBeforeLinesComboBox: TComboBox;
|
||||||
TxtBeforeLinesLabel: TLabel;
|
TxtBeforeLinesLabel: TLabel;
|
||||||
TxtAfterLinesLabel: TLabel;
|
TxtAfterLinesLabel: TLabel;
|
||||||
PasteOptsGroupBox: TGroupBox;
|
PasteOptsGroupBox: TGroupBox;
|
||||||
PreviewGroupBox: TGroupBox;
|
PreviewGroupBox: TGroupBox;
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure FormDestroy(Sender: TObject);
|
||||||
private
|
private
|
||||||
FContent: TStringList;
|
FContent: TStringList;
|
||||||
protected
|
protected
|
||||||
@ -63,8 +73,6 @@ type
|
|||||||
procedure DoEscQuotesCheckBoxChange(Sender: TObject); virtual;
|
procedure DoEscQuotesCheckBoxChange(Sender: TObject); virtual;
|
||||||
procedure DoHelpButtonClick(Sender: TObject); virtual;
|
procedure DoHelpButtonClick(Sender: TObject); virtual;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
|
||||||
destructor Destroy; override;
|
|
||||||
property Content: TStringList read FContent;
|
property Content: TStringList read FContent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -72,24 +80,42 @@ implementation
|
|||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
constructor TMultiPasteDialog.Create(AOwner: TComponent);
|
procedure TMultiPasteDialog.FormCreate(Sender: TObject);
|
||||||
|
var
|
||||||
|
List: THistoryList;
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
|
||||||
FContent := TStringList.Create;
|
FContent := TStringList.Create;
|
||||||
OnShow := @DoWatch;
|
OnShow := @DoWatch;
|
||||||
OnActivate := @DoWatch;
|
OnActivate := @DoWatch;
|
||||||
TxtBeforeLinesEdit.OnChange := @DoWatch;
|
TxtBeforeLinesComboBox.OnChange := @DoWatch;
|
||||||
TxtAfterLinesEdit.OnChange := @DoWatch;
|
TxtAfterLinesComboBox.OnChange := @DoWatch;
|
||||||
EscQuotesCheckBox.OnChange := @DoEscQuotesCheckBoxChange;
|
EscQuotesCheckBox.OnChange := @DoEscQuotesCheckBoxChange;
|
||||||
EscQuotesStyleComboBox.OnChange := @DoWatch;
|
EscQuotesStyleComboBox.OnChange := @DoWatch;
|
||||||
TrimClipbrdContentsCheckBox.OnChange := @DoWatch;
|
TrimClipbrdContentsCheckBox.OnChange := @DoWatch;
|
||||||
BottomButtonPanel.HelpButton.OnClick := @DoHelpButtonClick;
|
BottomButtonPanel.HelpButton.OnClick := @DoHelpButtonClick;
|
||||||
|
|
||||||
|
List:=InputHistories.HistoryLists.GetList(hlFormatPasteTxtBefore,true,rltCaseSensitive);
|
||||||
|
List.AppendEntry('Add(''');
|
||||||
|
TxtBeforeLinesComboBox.Items.Assign(List);
|
||||||
|
TxtBeforeLinesComboBox.Text:=List[0];
|
||||||
|
|
||||||
|
List:=InputHistories.HistoryLists.GetList(hlFormatPasteTxtAfter,true,rltCaseSensitive);
|
||||||
|
List.AppendEntry(''');');
|
||||||
|
TxtAfterLinesComboBox.Items.Assign(List);
|
||||||
|
TxtAfterLinesComboBox.Text:=List[0];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TMultiPasteDialog.Destroy;
|
procedure TMultiPasteDialog.FormDestroy(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
TxtBeforeLinesComboBox.AddHistoryItem(TxtBeforeLinesComboBox.Text,20,true,false);
|
||||||
|
InputHistories.HistoryLists.GetList(hlFormatPasteTxtBefore,true,rltCaseSensitive)
|
||||||
|
.Assign(TxtBeforeLinesComboBox.Items);
|
||||||
|
|
||||||
|
TxtAfterLinesComboBox.AddHistoryItem(TxtAfterLinesComboBox.Text,20,true,false);
|
||||||
|
InputHistories.HistoryLists.GetList(hlFormatPasteTxtAfter,true,rltCaseSensitive)
|
||||||
|
.Assign(TxtAfterLinesComboBox.Items);
|
||||||
|
|
||||||
FreeAndNil(FContent);
|
FreeAndNil(FContent);
|
||||||
inherited Destroy;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiPasteDialog.DoWatch(Sender: TObject);
|
procedure TMultiPasteDialog.DoWatch(Sender: TObject);
|
||||||
@ -121,7 +147,7 @@ begin
|
|||||||
0: S := StringReplace(S, '''', '''''', [rfReplaceAll]);
|
0: S := StringReplace(S, '''', '''''', [rfReplaceAll]);
|
||||||
1: S := StringReplace(S, '"', '\"', [rfReplaceAll]);
|
1: S := StringReplace(S, '"', '\"', [rfReplaceAll]);
|
||||||
end;
|
end;
|
||||||
FContent[I] := Concat(TxtBeforeLinesEdit.Text, S, TxtAfterLinesEdit.Text);
|
FContent[I] := Concat(TxtBeforeLinesComboBox.Text, S, TxtAfterLinesComboBox.Text);
|
||||||
end;
|
end;
|
||||||
Result := FContent.Text;
|
Result := FContent.Text;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user