IDE: disable "Add Editor File to Project" when the file belongs to current project already

git-svn-id: trunk@30371 -
This commit is contained in:
juha 2011-04-18 11:56:23 +00:00
parent a592146c7c
commit 16f0a62783
3 changed files with 17 additions and 2 deletions

View File

@ -2772,7 +2772,7 @@ begin
AddDefault(C, 'Save project as', lisKMSaveProjectAs, ecSaveProjectAs); AddDefault(C, 'Save project as', lisKMSaveProjectAs, ecSaveProjectAs);
AddDefault(C, 'Publish project', lisKMPublishProject, ecPublishProject); AddDefault(C, 'Publish project', lisKMPublishProject, ecPublishProject);
AddDefault(C, 'Project Inspector', lisMenuProjectInspector, ecProjectInspector); AddDefault(C, 'Project Inspector', lisMenuProjectInspector, ecProjectInspector);
AddDefault(C, 'Add active unit to project', lisKMAddActiveUnitToProject, ecAddCurUnitToProj); AddDefault(C, 'Add editor file to Project', lisMenuAddToProject, ecAddCurUnitToProj);
AddDefault(C, 'Remove active unit from project', lisKMRemoveActiveUnitFromProject, ecRemoveFromProj); AddDefault(C, 'Remove active unit from project', lisKMRemoveActiveUnitFromProject, ecRemoveFromProj);
AddDefault(C, 'View Units', lisHintViewUnits, ecViewProjectUnits); AddDefault(C, 'View Units', lisHintViewUnits, ecViewProjectUnits);
AddDefault(C, 'View Forms', lisHintViewForms, ecViewProjectForms); AddDefault(C, 'View Forms', lisHintViewForms, ecViewProjectForms);

View File

@ -322,7 +322,6 @@ resourcestring
lisMenuSaveProjectAs = 'Save Project As ...'; lisMenuSaveProjectAs = 'Save Project As ...';
lisMenuPublishProject = 'Publish Project ...'; lisMenuPublishProject = 'Publish Project ...';
lisMenuProjectInspector = 'Project Inspector'; lisMenuProjectInspector = 'Project Inspector';
lisKMAddActiveUnitToProject = 'Add active unit to project';
lisKMRemoveActiveUnitFromProject = 'Remove active unit from project'; lisKMRemoveActiveUnitFromProject = 'Remove active unit from project';
lisKMViewProjectSource = 'View project source'; lisKMViewProjectSource = 'View project source';
lisMenuAddToProject = 'Add editor file to Project'; lisMenuAddToProject = 'Add editor file to Project';

View File

@ -333,6 +333,9 @@ type
procedure mnuRunFileClicked(Sender: TObject); procedure mnuRunFileClicked(Sender: TObject);
procedure mnuConfigBuildFileClicked(Sender: TObject); procedure mnuConfigBuildFileClicked(Sender: TObject);
// project menu
procedure mnuProjectClicked(Sender: TObject);
// package menu // package menu
procedure mnuPackageClicked(Sender: TObject); procedure mnuPackageClicked(Sender: TObject);
// see pkgmanager.pas // see pkgmanager.pas
@ -2571,6 +2574,7 @@ end;
procedure TMainIDE.SetupProjectMenu; procedure TMainIDE.SetupProjectMenu;
begin begin
inherited SetupProjectMenu; inherited SetupProjectMenu;
mnuProject.OnClick:=@mnuProjectClicked;
with MainIDEBar do begin with MainIDEBar do begin
itmProjectNew.OnClick := @mnuNewProjectClicked; itmProjectNew.OnClick := @mnuNewProjectClicked;
itmProjectNewFromFile.OnClick := @mnuNewProjectFromFileClicked; itmProjectNewFromFile.OnClick := @mnuNewProjectFromFileClicked;
@ -3945,6 +3949,18 @@ begin
end; end;
end; end;
procedure TMainIDE.mnuProjectClicked(Sender: TObject);
var
ASrcEdit: TSourceEditor;
AnUnitInfo: TUnitInfo;
PartOfProj: Boolean;
begin
PartOfProj:=False;
if BeginCodeTool(ASrcEdit,AnUnitInfo,[]) then
PartOfProj:=AnUnitInfo.IsPartOfProject;
MainIDEBar.itmProjectAddTo.Enabled:=not PartOfProj;
end;
procedure TMainIDE.mnuPackageClicked(Sender: TObject); procedure TMainIDE.mnuPackageClicked(Sender: TObject);
var var
ASrcEdit: TSourceEditor; ASrcEdit: TSourceEditor;