• R/O
  • SSH
  • HTTPS

delphitoolsmanager: Commit


Commit MetaInfo

Revision24 (tree)
Time2019-06-23 00:42:02
Authordummzeuch

Log Message

The Tool Properties dialog is now fully functional.

Change Summary

Incremental Difference

--- trunk/src/DelphiToolsManager.dpr (revision 23)
+++ trunk/src/DelphiToolsManager.dpr (revision 24)
@@ -4,7 +4,8 @@
44 Vcl.Forms,
55 w_DelphiToolsManager in 'w_DelphiToolsManager.pas' {f_DelphiToolsManager},
66 w_ToolProperties in 'w_ToolProperties.pas' {f_ToolProperties},
7- w_SelectDelphiVersion in 'w_SelectDelphiVersion.pas' {f_SelectDelphiVersion};
7+ w_SelectDelphiVersion in 'w_SelectDelphiVersion.pas' {f_SelectDelphiVersion},
8+ u_dzVclHelpers in '..\libs\dzlib\src\u_dzVclHelpers.pas';
89
910 {$R *_version.res}
1011 {$R *_icon.res}
--- trunk/src/DelphiToolsManager.dproj (revision 23)
+++ trunk/src/DelphiToolsManager.dproj (revision 24)
@@ -137,6 +137,7 @@
137137 <Form>f_SelectDelphiVersion</Form>
138138 <FormType>dfm</FormType>
139139 </DCCReference>
140+ <DCCReference Include="..\libs\dzlib\src\u_dzVclHelpers.pas"/>
140141 <BuildConfiguration Include="Base">
141142 <Key>Base</Key>
142143 </BuildConfiguration>
@@ -595,7 +596,7 @@
595596 <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
596597 <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
597598 <Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
598- <PropertyGroup Condition="'$(Config)'=='Debug' And '$(Platform)'=='Win64'">
599+ <PropertyGroup Condition="'$(Config)'=='Debug' And '$(Platform)'=='Win32'">
599600 <PostBuildEvent/>
600601 <PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode>
601602 <PreBuildEvent>call ..\buildtools\prebuild.cmd $(PROJECTPATH)</PreBuildEvent>
@@ -603,7 +604,7 @@
603604 <PreLinkEvent/>
604605 <PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode>
605606 </PropertyGroup>
606- <PropertyGroup Condition="'$(Config)'=='Debug' And '$(Platform)'=='Win32'">
607+ <PropertyGroup Condition="'$(Config)'=='Debug' And '$(Platform)'=='Win64'">
607608 <PostBuildEvent/>
608609 <PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode>
609610 <PreBuildEvent>call ..\buildtools\prebuild.cmd $(PROJECTPATH)</PreBuildEvent>
@@ -611,7 +612,7 @@
611612 <PreLinkEvent/>
612613 <PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode>
613614 </PropertyGroup>
614- <PropertyGroup Condition="'$(Config)'=='Release' And '$(Platform)'=='Win64'">
615+ <PropertyGroup Condition="'$(Config)'=='Release' And '$(Platform)'=='Win32'">
615616 <PostBuildEvent/>
616617 <PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode>
617618 <PreBuildEvent>call ..\buildtools\prebuild.cmd $(PROJECTPATH)</PreBuildEvent>
@@ -619,7 +620,7 @@
619620 <PreLinkEvent/>
620621 <PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode>
621622 </PropertyGroup>
622- <PropertyGroup Condition="'$(Config)'=='Release' And '$(Platform)'=='Win32'">
623+ <PropertyGroup Condition="'$(Config)'=='Release' And '$(Platform)'=='Win64'">
623624 <PostBuildEvent/>
624625 <PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode>
625626 <PreBuildEvent>call ..\buildtools\prebuild.cmd $(PROJECTPATH)</PreBuildEvent>
--- trunk/src/w_ToolProperties.pas (revision 23)
+++ trunk/src/w_ToolProperties.pas (revision 24)
@@ -13,7 +13,11 @@
1313 Vcl.Forms,
1414 Vcl.Dialogs,
1515 Vcl.StdCtrls,
16- Vcl.ComCtrls;
16+ Vcl.ComCtrls,
17+ Vcl.Grids,
18+ System.Actions,
19+ Vcl.ActnList,
20+ Vcl.Menus;
1721
1822 type
1923 Tf_ToolProperties = class(TForm)
@@ -32,17 +36,31 @@
3236 b_Cancel: TButton;
3337 TheStatusBar: TStatusBar;
3438 chk_WorkingDir: TCheckBox;
39+ sg_Macros: TStringGrid;
40+ pm_Grid: TPopupMenu;
41+ mi_InsertMacro: TMenuItem;
3542 procedure ed_TitleChange(Sender: TObject);
3643 procedure ed_ProgramChange(Sender: TObject);
3744 procedure ed_WorkingDirChange(Sender: TObject);
3845 procedure ed_ParametersChange(Sender: TObject);
3946 procedure chk_WorkingDirClick(Sender: TObject);
47+ procedure b_ProgramClick(Sender: TObject);
48+ procedure b_WorkingDirClick(Sender: TObject);
49+ procedure b_ParametersClick(Sender: TObject);
50+ procedure FormResize(Sender: TObject);
51+ procedure sg_MacrosDblClick(Sender: TObject);
52+ procedure sg_MacrosKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
53+ procedure ed_ParametersKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
54+ procedure mi_InsertMacroClick(Sender: TObject);
4055 private
56+ FOriginalHeight: Integer;
57+ FOriginalGridHeight: Integer;
4158 procedure HandleProgramDropped(_Sender: TObject; _Files: TStrings);
4259 procedure HandleWorkingDirDropped(_Sender: TObject; _Files: TStrings);
4360 procedure SetData(const _Title, _Path, _WorkingDir, _Parameters: string);
4461 procedure GetData(out _Title, _Path, _WorkingDir, _Parameters: string);
4562 procedure CheckInput;
63+ procedure InsertCurrentMacro;
4664 public
4765 class function Execute(_Owner: TWinControl; var _Title, _Path, _WorkingDir, _Params: string): Boolean;
4866 constructor Create(_Owner: TComponent); override;
@@ -57,7 +75,11 @@
5775 u_dzAutoCompleteFiles,
5876 u_dzAutoCompleteDirs,
5977 u_dzFileUtils,
60- u_dzInputValidator;
78+ u_dzInputValidator,
79+ u_dzDialogUtils,
80+ u_dzSelectDirectoryFix,
81+ Vcl.FileCtrl,
82+ u_dzVclHelpers;
6183
6284 { Tf_ToolProperties }
6385
@@ -67,6 +89,8 @@
6789 end;
6890
6991 constructor Tf_ToolProperties.Create(_Owner: TComponent);
92+var
93+ sgh: IStringGridHelper;
7094 begin
7195 inherited;
7296 TControl_SetConstraints(Self, [ccMinWidth, ccMinHeight, ccMaxHeight]);
@@ -74,8 +98,87 @@
7498 TEdit_ActivateAutoCompleteDirectories(ed_WorkingDir);
7599 TWinControl_ActivateDropFiles(ed_Program, HandleProgramDropped);
76100 TWinControl_ActivateDropFiles(ed_WorkingDir, HandleWorkingDirDropped);
101+
102+ sgh := GetControlHelper(sg_Macros);
103+ sgh.Clear;
104+ sgh.AppendRow(['$COL', 'Cursor column in topmost editor']);
105+ sgh.AppendRow(['$ROW', 'Cursor row in topmost editor']);
106+ sgh.AppendRow(['$CURTOKEN', 'Word at cursor in topmost editor']);
107+ sgh.AppendRow(['$PATH()', 'Directory portion of parameter']);
108+ sgh.AppendRow(['$NAME()', 'File name of parameter']);
109+ sgh.AppendRow(['$NAMEONLY()', 'File name of parameter without extension']);
110+
111+ sgh.AppendRow(['$EXT()', 'File extension of parameter']);
112+ sgh.AppendRow(['$EDNAME', 'Expanded file name of topmost editor file']);
113+ sgh.AppendRow(['$PROJECT', 'Current project name']);
114+ sgh.AppendRow(['$EXENAME', 'Expanded name of project target']);
115+ // this may have been clipped:
116+ sgh.AppendRow(['$HOSTNAME', 'Expanded name of executable run for project']);
117+ sgh.AppendRow(['$PARAMS', 'Command line parameter of program']);
118+
119+ sgh.AppendRow(['$PROMPT', 'Prompt for information']);
120+ sgh.AppendRow(['$SAVE', 'Save current editor module']);
121+ sgh.AppendRow(['$SAVEALL', 'Save all modified modules']);
122+ sgh.AppendRow(['$TDW', 'Turbo Debugger setup macro']);
123+
124+ sgh.Resize([roUseGridWidth, roUseAllRows, roReduceMinWidth]);
125+
126+ FOriginalHeight := Self.Height;
127+ FOriginalGridHeight := sg_Macros.Height;
128+
129+ CheckInput;
77130 end;
78131
132+procedure Tf_ToolProperties.b_ParametersClick(Sender: TObject);
133+var
134+ h: Integer;
135+ ButtonOffset: Integer;
136+begin
137+ if sg_Macros.Visible then begin
138+ sg_Macros.Visible := False;
139+ sg_Macros.Anchors := [akLeft, akTop];
140+ sg_Macros.Height := FOriginalGridHeight;
141+ Self.Constraints.MinHeight := FOriginalHeight;
142+ Self.Constraints.MaxHeight := FOriginalHeight;
143+ Self.Height := FOriginalHeight;
144+ b_Parameters.Caption := 'v';
145+ TWinControl_SetFocus(ed_Parameters);
146+ end else begin
147+ sg_Macros.Visible := True;
148+ sg_Macros.Left := ed_Parameters.Left;
149+ sg_Macros.Width := b_Parameters.Left + b_Parameters.Width - ed_Parameters.Left;
150+ h := Self.Height;
151+ ButtonOffset := h - b_Ok.Top;
152+ h := sg_Macros.Height + h;
153+ Self.Constraints.MaxHeight := 0;
154+ Self.Constraints.MinHeight := h;
155+ Self.Height := h;
156+ sg_Macros.Anchors := [akLeft, akTop, akRight, akBottom];
157+ b_Parameters.Caption := '^';
158+ TWinControl_SetFocus(sg_Macros);
159+ end;
160+end;
161+
162+procedure Tf_ToolProperties.b_ProgramClick(Sender: TObject);
163+var
164+ fn: string;
165+begin
166+ fn := ed_Program.Text;
167+ if not TOpenDialog_Execute(Self, 'Select executable', FileFilterBuilder.AddExe.Filter, fn) then
168+ Exit; //==>
169+ ed_Program.Text := fn;
170+end;
171+
172+procedure Tf_ToolProperties.b_WorkingDirClick(Sender: TObject);
173+var
174+ dir: string;
175+begin
176+ dir := ed_WorkingDir.Text;
177+ if not dzSelectDirectory('Select working directory', '', dir, [sdNewUI], Self) then
178+ Exit; //==>
179+ ed_WorkingDir.Text := dir;
180+end;
181+
79182 procedure Tf_ToolProperties.CheckInput;
80183 var
81184 iv: IdzInputValidator;
@@ -123,6 +226,36 @@
123226 CheckInput;
124227 end;
125228
229+procedure Tf_ToolProperties.ed_ParametersKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
230+begin
231+ if Shift = [ssAlt] then begin
232+ if Key = VK_DOWN then begin
233+ if not sg_Macros.Visible then begin
234+ Key := 0;
235+ b_Parameters.Click;
236+ end;
237+ end else if Key = VK_UP then begin
238+ if sg_Macros.Visible then begin
239+ Key := 0;
240+ b_Parameters.Click;
241+ end;
242+ end;
243+ end else if Shift = [] then begin
244+ if not sg_Macros.Visible then
245+ Exit; //==>
246+ if Key = VK_INSERT then begin
247+ Key := 0;
248+ InsertCurrentMacro;
249+ end else if Key = VK_UP then begin
250+ Key := 0;
251+ TGrid_SetNonfixedRow(sg_Macros, TGrid_GetNonfixedRow(sg_Macros) - 1);
252+ end else if Key = VK_DOWN then begin
253+ Key := 0;
254+ TGrid_SetNonfixedRow(sg_Macros, TGrid_GetNonfixedRow(sg_Macros) + 1);
255+ end;
256+ end;
257+end;
258+
126259 procedure Tf_ToolProperties.ed_ProgramChange(Sender: TObject);
127260 begin
128261 CheckInput;
@@ -155,6 +288,11 @@
155288 end;
156289 end;
157290
291+procedure Tf_ToolProperties.FormResize(Sender: TObject);
292+begin
293+ TGrid_Resize(sg_Macros, [roUseGridWidth, roUseAllRows, roReduceMinWidth]);
294+end;
295+
158296 procedure Tf_ToolProperties.GetData(out _Title, _Path, _WorkingDir, _Parameters: string);
159297 begin
160298 _Title := ed_Title.Text;
@@ -186,5 +324,37 @@
186324 ed_Parameters.Text := _Parameters;
187325 end;
188326
327+procedure Tf_ToolProperties.sg_MacrosDblClick(Sender: TObject);
328+begin
329+ InsertCurrentMacro;
330+end;
331+
332+procedure Tf_ToolProperties.sg_MacrosKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
333+begin
334+ if (Key = VK_INSERT) and (Shift = []) then begin
335+ Key := 0;
336+ InsertCurrentMacro;
337+ end else if (Key = VK_UP) and (Shift = [ssAlt]) then begin
338+ Key := 0;
339+ b_Parameters.Click;
340+ end;
341+end;
342+
343+procedure Tf_ToolProperties.mi_InsertMacroClick(Sender: TObject);
344+begin
345+ InsertCurrentMacro;
346+end;
347+
348+procedure Tf_ToolProperties.InsertCurrentMacro;
349+var
350+ sgh: IStringGridHelper;
351+ Row: Integer;
352+begin
353+ sgh := GetControlHelper(sg_Macros);
354+ Row := sgh.GetNonfixedRow;
355+ ed_Parameters.SelText := sg_Macros.Cells[0, Row];
356+ TWinControl_SetFocus(ed_Parameters);
357+end;
358+
189359 end.
190360
Show on old repository browser