IDE: new project dialog: store project desc in listbox

git-svn-id: trunk@31741 -
This commit is contained in:
mattias 2011-07-18 20:17:25 +00:00
parent b518b70fa5
commit 15084b31ef

View File

@ -50,11 +50,12 @@ type
procedure ListBoxDblClick(Sender: TObject);
procedure ListBoxSelectionChange(Sender: TObject; User: boolean);
private
FProjectDescriptor: TProjectDescriptor;
procedure FillHelpLabel;
procedure SetupComponents;
public
constructor Create(AOwner: TComponent); override;
function GetProjectDescriptor: TProjectDescriptor;
property ProjectDescriptor: TProjectDescriptor read FProjectDescriptor;
end;
function ChooseNewProject(var ProjectDesc: TProjectDescriptor): TModalResult;
@ -72,7 +73,7 @@ begin
try
Result:=NewProjectDialog.ShowModal;
if Result=mrOk then
ProjectDesc:=NewProjectDialog.GetProjectDescriptor;
ProjectDesc:=NewProjectDialog.ProjectDescriptor;
finally
NewProjectDialog.Free;
end;
@ -88,23 +89,10 @@ begin
FillHelpLabel;
end;
function TNewProjectDialog.GetProjectDescriptor: TProjectDescriptor;
var
i: LongInt;
s: string;
begin
Result:=ProjectDescriptorApplication;
i:=ListBox.ItemIndex;
if (i<0) then exit;
s:=ListBox.Items[i];
for i:=0 to ProjectDescriptors.Count-1 do
if ProjectDescriptors[i].GetLocalizedName=s then
exit(ProjectDescriptors[i]);
end;
procedure TNewProjectDialog.FillHelpLabel;
begin
HelpLabel.Caption:=GetProjectDescriptor.GetLocalizedDescription;
FProjectDescriptor := TProjectDescriptor(ListBox.Items.Objects[ListBox.ItemIndex]);
HelpLabel.Caption:=FProjectDescriptor.GetLocalizedDescription;
HelpLabel.Width:=Self.ClientWidth-HelpLabel.Left-10;
end;
@ -117,7 +105,7 @@ begin
BeginUpdate;
for i:=0 to ProjectDescriptors.Count-1 do begin
if ProjectDescriptors[i].VisibleInNewDialog then
Add(ProjectDescriptors[i].GetLocalizedName);
AddObject(ProjectDescriptors[i].GetLocalizedName, ProjectDescriptors[i]);
end;
EndUpdate;
end;