mirror of https://gitlab.com/basile.b/dexed.git
custom tools, add an option to pipe either the curr file, selection or line
+ deprecate the previous editorToInput option
This commit is contained in:
parent
06157547f2
commit
e658583587
|
|
@ -13,6 +13,8 @@ type
|
||||||
|
|
||||||
TCEToolItems = class;
|
TCEToolItems = class;
|
||||||
|
|
||||||
|
TPipeInputKind = (pikNone, pikEditor, pikSelection, pikLine);
|
||||||
|
|
||||||
TCEToolItem = class(TCollectionItem)
|
TCEToolItem = class(TCollectionItem)
|
||||||
private
|
private
|
||||||
fToolItems: TCEToolItems;
|
fToolItems: TCEToolItems;
|
||||||
|
|
@ -31,6 +33,7 @@ type
|
||||||
fShortcut: TShortcut;
|
fShortcut: TShortcut;
|
||||||
fMsgs: ICEMessagesDisplay;
|
fMsgs: ICEMessagesDisplay;
|
||||||
fSymStringExpander: ICESymStringExpander;
|
fSymStringExpander: ICESymStringExpander;
|
||||||
|
fPipeInputKind: TPipeInputKind;
|
||||||
procedure setParameters(value: TStringList);
|
procedure setParameters(value: TStringList);
|
||||||
procedure processOutput(sender: TObject);
|
procedure processOutput(sender: TObject);
|
||||||
procedure setToolAlias(value: string);
|
procedure setToolAlias(value: string);
|
||||||
|
|
@ -46,13 +49,15 @@ type
|
||||||
property showWindows: TShowWindowOptions read fShowWin write fShowWin;
|
property showWindows: TShowWindowOptions read fShowWin write fShowWin;
|
||||||
property queryParameters: boolean read fQueryParams write fQueryParams;
|
property queryParameters: boolean read fQueryParams write fQueryParams;
|
||||||
property clearMessages: boolean read fClearMessages write fClearMessages;
|
property clearMessages: boolean read fClearMessages write fClearMessages;
|
||||||
property editorToInput: boolean read fEditorToInput write fEditorToInput;
|
|
||||||
property shortcut: TShortcut read fShortcut write fShortcut;
|
property shortcut: TShortcut read fShortcut write fShortcut;
|
||||||
property nextToolAlias: string read fNextToolAlias write fNextToolAlias;
|
property nextToolAlias: string read fNextToolAlias write fNextToolAlias;
|
||||||
property outputToNext: boolean read fOutputToNext write fOutputToNext;
|
property outputToNext: boolean read fOutputToNext write fOutputToNext;
|
||||||
|
property pipeInputKind: TPipeInputKind read fPipeInputKind write fPipeInputKind;
|
||||||
//
|
//
|
||||||
property chainBefore: TStringList write setChainBefore stored false; deprecated;
|
property chainBefore: TStringList write setChainBefore stored false; deprecated;
|
||||||
property chainAfter: TStringList write setChainAfter stored false; deprecated;
|
property chainAfter: TStringList write setChainAfter stored false; deprecated;
|
||||||
|
// TODO-cmaintenance: remove this property from version 3 update 1
|
||||||
|
property editorToInput: boolean read fEditorToInput write fEditorToInput stored false;
|
||||||
public
|
public
|
||||||
constructor create(ACollection: TCollection); override;
|
constructor create(ACollection: TCollection); override;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
|
|
@ -169,6 +174,7 @@ begin
|
||||||
workingDirectory := tool.workingDirectory;
|
workingDirectory := tool.workingDirectory;
|
||||||
editorToInput := tool.editorToInput;
|
editorToInput := tool.editorToInput;
|
||||||
showWindows := tool.showWindows;
|
showWindows := tool.showWindows;
|
||||||
|
pipeInputKind := tool.pipeInputKind;
|
||||||
parameters.Assign(tool.parameters);
|
parameters.Assign(tool.parameters);
|
||||||
end
|
end
|
||||||
else inherited;
|
else inherited;
|
||||||
|
|
@ -431,10 +437,15 @@ begin
|
||||||
if aTool.isNil then exit;
|
if aTool.isNil then exit;
|
||||||
//
|
//
|
||||||
aTool.execute(nil);
|
aTool.execute(nil);
|
||||||
if aTool.editorToInput and fDoc.isNotNil and (poUsePipes in aTool.options)
|
if aTool.editorToInput then aTool.pipeInputKind:= pikEditor;
|
||||||
and aTool.fProcess.Input.isNotNil then
|
if (aTool.pipeInputKind <> pikNone) and fDoc.isNotNil
|
||||||
|
and (poUsePipes in aTool.options) and aTool.fProcess.Input.isNotNil then
|
||||||
begin
|
begin
|
||||||
txt := fDoc.Text;
|
case aTool.pipeInputKind of
|
||||||
|
pikEditor: txt := fDoc.Text;
|
||||||
|
pikLine: txt := fDoc.LineText;
|
||||||
|
pikSelection: txt := fDoc.SelText;
|
||||||
|
end;
|
||||||
aTool.fProcess.Input.Write(txt[1], txt.length);
|
aTool.fProcess.Input.Write(txt[1], txt.length);
|
||||||
aTool.fProcess.CloseInput;
|
aTool.fProcess.CloseInput;
|
||||||
end;
|
end;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue