mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-04 04:00:44 +01:00
IDE, SynEdit: ecPasteAsColums, paste clipboard - forcing column mode
git-svn-id: trunk@63118 -
This commit is contained in:
parent
6dd8905c57
commit
42226b563a
@ -926,7 +926,7 @@ type
|
||||
procedure SetSelStart(const Value: integer);
|
||||
property TextView : TSynEditFoldedView read FFoldedLinesView;
|
||||
property TopView: Integer read GetTopView write SetTopView; // TopLine converted into Visible(View) lines
|
||||
function PasteFromClipboardEx(ClipHelper: TSynClipboardStream): Boolean;
|
||||
function PasteFromClipboardEx(ClipHelper: TSynClipboardStream; AForceColumnMode: Boolean = False): Boolean;
|
||||
function FindNextUnfoldedLine(iLine: integer; Down: boolean): Integer;
|
||||
// Todo: Reduce the argument list of Creategutter
|
||||
function CreateGutter(AOwner : TSynEditBase; ASide: TSynGutterSide;
|
||||
@ -1015,7 +1015,7 @@ type
|
||||
// Clipboard
|
||||
procedure CopyToClipboard;
|
||||
procedure CutToClipboard;
|
||||
procedure PasteFromClipboard;
|
||||
procedure PasteFromClipboard(AForceColumnMode: Boolean = False);
|
||||
procedure DoCopyToClipboard(SText: string; FoldInfo: String = '');
|
||||
property CanPaste: Boolean read GetCanPaste;
|
||||
|
||||
@ -4363,20 +4363,21 @@ begin
|
||||
FOverrideCursor := c;
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.PasteFromClipboard;
|
||||
procedure TCustomSynEdit.PasteFromClipboard(AForceColumnMode: Boolean);
|
||||
var
|
||||
ClipHelper: TSynClipboardStream;
|
||||
begin
|
||||
ClipHelper := TSynClipboardStream.Create;
|
||||
try
|
||||
ClipHelper.ReadFromClipboard(Clipboard);
|
||||
PasteFromClipboardEx(ClipHelper);
|
||||
PasteFromClipboardEx(ClipHelper, AForceColumnMode);
|
||||
finally
|
||||
ClipHelper.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCustomSynEdit.PasteFromClipboardEx(ClipHelper: TSynClipboardStream) : Boolean;
|
||||
function TCustomSynEdit.PasteFromClipboardEx(ClipHelper: TSynClipboardStream;
|
||||
AForceColumnMode: Boolean): Boolean;
|
||||
var
|
||||
PTxt: PChar;
|
||||
PStr: String;
|
||||
@ -4388,7 +4389,10 @@ begin
|
||||
InternalBeginUndoBlock;
|
||||
try
|
||||
PTxt := ClipHelper.TextP;
|
||||
PMode := ClipHelper.SelectionMode;
|
||||
if AForceColumnMode then
|
||||
PMode := smColumn
|
||||
else
|
||||
PMode := ClipHelper.SelectionMode;
|
||||
PasteAction := scaContinue;
|
||||
if assigned(FOnPaste) then begin
|
||||
if ClipHelper.IsPlainText then PasteAction := scaPlainText;
|
||||
@ -7128,9 +7132,9 @@ begin
|
||||
begin
|
||||
CopyToClipboard;
|
||||
end;
|
||||
ecPaste:
|
||||
ecPaste, ecPasteAsColumns:
|
||||
begin
|
||||
if not ReadOnly then PasteFromClipboard;
|
||||
if not ReadOnly then PasteFromClipboard(Command = ecPasteAsColumns);
|
||||
end;
|
||||
ecCopyAdd, ecCutAdd:
|
||||
if SelAvail then begin
|
||||
|
||||
@ -265,6 +265,8 @@ const
|
||||
ecCutCurrentLine = 609; //
|
||||
ecCutAddCurrentLine = 610; //
|
||||
|
||||
ecPasteAsColumns = 611; // Paste clipboard to current position as if it was column mode
|
||||
|
||||
ecBlockIndent = 615; // Indent selection
|
||||
ecBlockUnindent = 616; // Unindent selection
|
||||
ecTab = 617; // Tab key
|
||||
|
||||
@ -2700,6 +2700,7 @@ begin
|
||||
AddDefault(C, 'Copy selection to clipboard', srkmecCopy, ecCopy);
|
||||
AddDefault(C, 'Cut selection to clipboard', srkmecCut, ecCut);
|
||||
AddDefault(C, 'Paste clipboard to current position', srkmecPaste, ecPaste);
|
||||
AddDefault(C, 'Paste clipboard (as columns) to current position', srkmecPasteAsColumns, ecPasteAsColumns);
|
||||
AddDefault(C, 'Copy - Add to Clipboard', srkmecCopyAdd, ecCopyAdd);
|
||||
AddDefault(C, 'Cut - Add to Clipboard', srkmecCutAdd, ecCutAdd);
|
||||
AddDefault(C, 'Copy current line', srkmecCopyCurrentLine, ecCopyCurrentLine);
|
||||
|
||||
@ -3121,6 +3121,7 @@ resourcestring
|
||||
srkmecCut = 'Cut';
|
||||
srkmecCopy = 'Copy';
|
||||
srkmecPaste = 'Paste';
|
||||
srkmecPasteAsColumns = 'Paste (as Columns)';
|
||||
srkmecCopyAdd = 'Copy (Add to Clipboard)';
|
||||
srkmecCutAdd = 'Cut (Add to Clipboard)';
|
||||
srkmecCopyCurrentLine = 'Copy current line';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user