Menu

[327ada]: / Source / ToolEditFrm.pas  Maximize  Restore  History

Download this file

171 lines (142 with data), 5.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
{
This file is part of Dev-C++
Copyright (c) 2004 Bloodshed Software
Dev-C++ is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Dev-C++ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Dev-C++; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit ToolEditFrm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons, Macros, DataFrm;
type
TToolEditForm = class(TForm)
lblTitle: TLabel;
edTitle: TEdit;
lblProg: TLabel;
edProgram: TEdit;
lblWorkDir: TLabel;
edWorkDir: TEdit;
lblParam: TLabel;
edParams: TEdit;
btnCancel: TBitBtn;
btnOk: TBitBtn;
lblMacros: TLabel;
lstMacro: TListBox;
btnInsert: TBitBtn;
btnHelp: TBitBtn;
lblDesc: TMemo;
ParamText: TEdit;
btnProg: TSpeedButton;
btnWorkDir: TSpeedButton;
procedure btnCancelClick(Sender: TObject);
procedure HelpClick(Sender: TObject);
procedure btnInsertClick(Sender: TObject);
procedure lstMacroClick(Sender: TObject);
procedure btnProgClick(Sender: TObject);
procedure btnWorkDirClick(Sender: TObject);
procedure EditEnter(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure edProgramChange(Sender: TObject);
procedure edParamsChange(Sender: TObject);
private
fMacroTarget: TEdit;
procedure LoadText;
end;
implementation
uses
FileCtrl, MultiLangSupport, devcfg, utils, main;
{$R *.dfm}
procedure TToolEditForm.btnCancelClick(Sender: TObject);
begin
Close;
end;
procedure TToolEditForm.HelpClick(Sender: TObject);
begin
Application.MessageBox(
'You can use macros when calling a tool, how it can acts depending on what your doing' + #10#13 +
'in Embarcadero Dev-C++. For example, if you are willing to add a tool to Embarcadero Dev-C++' + #10#13 +
'that can compress executable files, you may need to know the filename of your project''s executable' + #10#13 +
'that when calling the tool it automatically compress the current project''s executable.' + #10#13 +
'You can use many different parameters macros for your tool, for more information on' + #10#13 +
'what they can do see the Macro lists on the previous dialog.'
, 'Quick help on macros',
MB_ICONINFORMATION);
end;
procedure TToolEditForm.btnInsertClick(Sender: TObject);
begin
if lstMacro.itemindex > -1 then
fMacroTarget.SelText := lstMacro.Items[lstMacro.itemindex];
end;
procedure TToolEditForm.lstMacroClick(Sender: TObject);
begin
lblDesc.Text := Lang[lstMacro.ItemIndex + ID_ET_MACROS];
end;
procedure TToolEditForm.btnProgClick(Sender: TObject);
begin
with TOpenDialog.Create(self) do try
Filter := 'Applications (*.exe;*.bat;*.com;)|*.exe;*.bat;*.com|All files (*.*)|*.*';
if Assigned(MainForm.Project) then
InitialDir := MainForm.Project.Directory;
if Execute then begin
edProgram.Text := FileName;
edWorkDir.Text := ExtractFilePath(FileName);
end;
finally
Free;
end;
end;
procedure TToolEditForm.btnWorkDirClick(Sender: TObject);
var
new: String;
begin
if (Trim(edWorkDir.Text) <> '') and SysUtils.DirectoryExists(Trim(edWorkDir.Text)) then
new := edWorkDir.Text
else
new := ExtractFilePath(edProgram.Text);
if NewSelectDirectory('Select Working Dir', '', new) then
edWorkDir.text := New;
end;
procedure TToolEditForm.EditEnter(Sender: TObject);
begin
fMacroTarget := Sender as TEdit;
end;
procedure TToolEditForm.FormCreate(Sender: TObject);
begin
fMacroTarget := edParams;
LoadText;
end;
procedure TToolEditForm.LoadText;
begin
// Set interface font
Font.Name := devData.InterfaceFont;
Font.Size := devData.InterfaceFontSize;
Caption := Lang[ID_TE];
lblTitle.Caption := Lang[ID_TE_TITLE];
lblProg.Caption := Lang[ID_TE_PROG];
lblWorkDir.Caption := Lang[ID_TE_WORK];
lblParam.Caption := Lang[ID_TE_PARAM];
lblMacros.Caption := Lang[ID_TE_AVAIL];
btnInsert.Caption := Lang[ID_TE_INSERT];
btnOk.Caption := Lang[ID_BTN_OK];
btnCancel.Caption := Lang[ID_BTN_CANCEL];
btnHelp.Caption := Lang[ID_BTN_HELP];
end;
procedure TToolEditForm.edProgramChange(Sender: TObject);
begin
ParamText.Text := ParseMacros(edProgram.Text + ' ' + edParams.Text);
end;
procedure TToolEditForm.edParamsChange(Sender: TObject);
begin
ParamText.Text := ParseMacros(edProgram.Text + ' ' + edParams.Text);
end;
end.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.