From a20471a4a6bc541a6473768db91c06ab8e55ed5e Mon Sep 17 00:00:00 2001 From: Daniel Marschall Date: Sun, 9 Jun 2024 21:51:49 +0000 Subject: [PATCH] Added "TabToSpace" function git-svn-id: https://svn.viathinksoft.com/svn/fastphp/trunk@119 4275edf5-accd-43b1-89a6-70d33797d1ed --- EditorMain.dfm | 24 ++++++++++++++++++++---- EditorMain.pas | 11 +++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/EditorMain.dfm b/EditorMain.dfm index 69701e0..2d1f207 100644 --- a/EditorMain.dfm +++ b/EditorMain.dfm @@ -1,7 +1,7 @@ object Form1: TForm1 Left = 0 Top = 0 - Caption = 'ViaThinkSoft FastPHP 0.9' + Caption = 'ViaThinkSoft FastPHP 0.10' ClientHeight = 661 ClientWidth = 1120 Color = clBtnFace @@ -705,7 +705,7 @@ object Form1: TForm1 Left = 733 Top = 0 Width = 75 - Height = 35 + Height = 17 Action = ActionSpaceToTab ParentShowHint = False ShowHint = True @@ -719,6 +719,16 @@ object Form1: TForm1 Action = ActionLint ParentShowHint = False ShowHint = True + TabOrder = 11 + end + object Button10: TButton + Left = 733 + Top = 18 + Width = 75 + Height = 17 + Action = ActionTabToSpace + ParentShowHint = False + ShowHint = True TabOrder = 10 end end @@ -844,6 +854,12 @@ object Form1: TForm1 ShortCut = 24660 OnExecute = ActionSpaceToTabExecute end + object ActionTabToSpace: TAction + Caption = 'TabToSpace' + Hint = 'Convert leading tabs to 4 spaces each' + ShortCut = 57428 + OnExecute = ActionTabToSpaceExecute + end object ActionLint: TAction Caption = 'Lint' Hint = 'Run PHP Lint (php -l) to check for syntax errors' @@ -854,8 +870,8 @@ object Form1: TForm1 object Timer1: TTimer Enabled = False OnTimer = Timer1Timer - Left = 776 - Top = 8 + Left = 864 + Top = 88 end object SynEditSearch1: TSynEditSearch Left = 788 diff --git a/EditorMain.pas b/EditorMain.pas index f1b39d0..c9a8561 100644 --- a/EditorMain.pas +++ b/EditorMain.pas @@ -129,6 +129,8 @@ TForm1 = class(TForm) FontSizeTimer: TTimer; ChooseanotherPHPinterpreter1: TMenuItem; ChooseanotherCHMhelpfile1: TMenuItem; + Button10: TButton; + ActionTabToSpace: TAction; procedure Run(Sender: TObject); procedure RunConsole(Sender: TObject); procedure FormShow(Sender: TObject); @@ -196,6 +198,7 @@ TForm1 = class(TForm) procedure SynEdit1StatusChange(Sender: TObject; Changes: TSynStatusChanges); procedure ChooseanotherPHPinterpreter1Click(Sender: TObject); procedure ChooseanotherCHMhelpfile1Click(Sender: TObject); + procedure ActionTabToSpaceExecute(Sender: TObject); private hMutex: THandle; CurSearchTerm: string; @@ -1781,4 +1784,12 @@ function TForm1.OutputNotifyCallback(const data: AnsiString): boolean; result := TreeView1.FillWithFastPHPData(string(data)); end; +procedure TForm1.ActionTabToSpaceExecute(Sender: TObject); +begin + // TODO: if something is selected, only process the selected part + // TODO: Only change tabs which are at line beginning. Not tabs in the middle of the code. + SynEdit1.Text := StringReplace(SynEdit1.Text, #9, ' ', [rfReplaceAll]); + +end; + end.