IDE: build modes: path button

git-svn-id: trunk@23197 -
This commit is contained in:
mattias 2009-12-19 20:57:55 +00:00
parent ddd8c3ab11
commit 8bebf8b3cb

View File

@ -28,7 +28,8 @@ uses
Classes, SysUtils, LCLProc, Controls, FileUtil, LResources, Forms, Grids, Classes, SysUtils, LCLProc, Controls, FileUtil, LResources, Forms, Grids,
Menus, ComCtrls, Dialogs, AvgLvlTree, DefineTemplates, Menus, ComCtrls, Dialogs, AvgLvlTree, DefineTemplates,
ProjectIntf, IDEImagesIntf, ProjectIntf, IDEImagesIntf,
Project, PackageSystem, LazarusIDEStrConsts, CompilerOptions, IDEProcs; PathEditorDlg, Project, PackageSystem, LazarusIDEStrConsts, CompilerOptions,
IDEProcs;
type type
@ -71,6 +72,7 @@ type
procedure FindBuildVariable(const Identifier: string; procedure FindBuildVariable(const Identifier: string;
out Vars: TLazBuildVariables; out aVariable: TLazBuildVariable); out Vars: TLazBuildVariables; out aVariable: TLazBuildVariable);
function SelectCell(aCol, aRow: Integer): boolean; override; function SelectCell(aCol, aRow: Integer): boolean; override;
procedure BuildModesGridEditButtonClick(Sender: TObject);
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -122,7 +124,7 @@ begin
case f of case f of
bmftAddUnitPath: Result:='+UnitPath'; bmftAddUnitPath: Result:='+UnitPath';
bmftAddIncludePath: Result:='+IncludePath'; bmftAddIncludePath: Result:='+IncludePath';
bmftAddLinkerPath: Result:='+linkerPath'; bmftAddLinkerPath: Result:='+LinkerPath';
bmftAddObjectPath: Result:='+ObjectPath'; bmftAddObjectPath: Result:='+ObjectPath';
bmftAddLinkerOption: Result:='+LinkerOptions'; bmftAddLinkerOption: Result:='+LinkerOptions';
bmftAddCustomOption: Result:='+CustomOptions'; bmftAddCustomOption: Result:='+CustomOptions';
@ -386,7 +388,9 @@ begin
if aVariable<>nil then if aVariable<>nil then
sl.Assign(aVariable.Values); sl.Assign(aVariable.Values);
end; end;
end; Columns[ValueCol].ButtonStyle:=cbsPickList;
end else if CurModeRow.Flag.FlagType in BuildModeFlagPaths then
Columns[ValueCol].ButtonStyle:=cbsEllipsis;
end; end;
sl.Sort; sl.Sort;
Columns[ValueCol].PickList:=sl; Columns[ValueCol].PickList:=sl;
@ -444,6 +448,32 @@ begin
Result:=FModeRows.Count; Result:=FModeRows.Count;
end; end;
procedure TBuildModesGrid.BuildModesGridEditButtonClick(Sender: TObject);
var
CurModeRow: TBuildModeGridRow;
CurPathEditor: TPathEditorDialog;
ValueCol: Integer;
begin
CurModeRow:=SelectedModeRow;
if CurModeRow=nil then exit;
if CurModeRow.Flag=nil then exit;
ValueCol:=GroupModeCount+2;
if CurModeRow.Flag.FlagType in BuildModeFlagPaths then begin
CurPathEditor:=TPathEditorDialog.Create(nil);
try
CurPathEditor.BaseDirectory:=Project1.ProjectDirectory;
CurPathEditor.Path:=CurModeRow.Flag.Value;
CurPathEditor.Templates:='';
if CurPathEditor.ShowModal=mrOk then begin
CurModeRow.Flag.Value:=CurPathEditor.Path;
Cells[ValueCol,Row]:=CurModeRow.Flag.Value;
end;
finally
CurPathEditor.Free;
end;
end;
end;
function TBuildModesGrid.GetSelectedModeRow: TBuildModeGridRow; function TBuildModesGrid.GetSelectedModeRow: TBuildModeGridRow;
begin begin
if (Row<1) or (Row>ModeRowCount) then if (Row<1) or (Row>ModeRowCount) then
@ -458,6 +488,7 @@ begin
fGraph:=TBuildModeGraph.Create; fGraph:=TBuildModeGraph.Create;
FModeRows:=TFPList.Create; FModeRows:=TFPList.Create;
Options:=Options+[goEditing]; Options:=Options+[goEditing];
OnEditButtonClick:=@BuildModesGridEditButtonClick;
end; end;
destructor TBuildModesGrid.Destroy; destructor TBuildModesGrid.Destroy;