mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 14:00:18 +02:00
implemented ProjectOpt: AutoCreateNewForms, added designer Show Options
git-svn-id: trunk@2889 -
This commit is contained in:
parent
5388e06e85
commit
30c1bb77b8
68
ide/main.pp
68
ide/main.pp
@ -258,6 +258,7 @@ type
|
|||||||
procedure OnDesignerUnselectComponentClass(Sender: TObject);
|
procedure OnDesignerUnselectComponentClass(Sender: TObject);
|
||||||
procedure OnDesignerSetDesigning(Sender: TObject; Component: TComponent;
|
procedure OnDesignerSetDesigning(Sender: TObject; Component: TComponent;
|
||||||
Value: boolean);
|
Value: boolean);
|
||||||
|
procedure OnDesignerShowOptions(Sender: TObject);
|
||||||
procedure OnDesignerPropertiesChanged(Sender: TObject);
|
procedure OnDesignerPropertiesChanged(Sender: TObject);
|
||||||
procedure OnDesignerComponentAdded(Sender: TObject; AComponent: TComponent;
|
procedure OnDesignerComponentAdded(Sender: TObject; AComponent: TComponent;
|
||||||
AComponentClass: TRegisteredComponent);
|
AComponentClass: TRegisteredComponent);
|
||||||
@ -1963,18 +1964,19 @@ Begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
with TDesigner(aForm.Designer) do begin
|
with TDesigner(aForm.Designer) do begin
|
||||||
TheFormEditor := FormEditor1;
|
TheFormEditor := FormEditor1;
|
||||||
OnGetSelectedComponentClass:=@OnDesignerGetSelectedComponentClass;
|
OnActivated:=@OnDesignerActivated;
|
||||||
OnUnselectComponentClass:=@OnDesignerUnselectComponentClass;
|
|
||||||
OnSetDesigning:=@OnDesignerSetDesigning;
|
|
||||||
OnPropertiesChanged:=@OnDesignerPropertiesChanged;
|
|
||||||
OnComponentAdded:=@OnDesignerComponentAdded;
|
OnComponentAdded:=@OnDesignerComponentAdded;
|
||||||
OnComponentDeleted:=@OnDesignerComponentDeleted;
|
OnComponentDeleted:=@OnDesignerComponentDeleted;
|
||||||
OnRemoveComponent:=@OnDesignerRemoveComponent;
|
|
||||||
OnGetNonVisualCompIconCanvas:=@IDECompList.OnGetNonVisualCompIconCanvas;
|
OnGetNonVisualCompIconCanvas:=@IDECompList.OnGetNonVisualCompIconCanvas;
|
||||||
|
OnGetSelectedComponentClass:=@OnDesignerGetSelectedComponentClass;
|
||||||
OnModified:=@OnDesignerModified;
|
OnModified:=@OnDesignerModified;
|
||||||
OnActivated:=@OnDesignerActivated;
|
|
||||||
OnRenameComponent:=@OnDesignerRenameComponent;
|
|
||||||
OnProcessCommand:=@OnProcessIDECommand;
|
OnProcessCommand:=@OnProcessIDECommand;
|
||||||
|
OnPropertiesChanged:=@OnDesignerPropertiesChanged;
|
||||||
|
OnRemoveComponent:=@OnDesignerRemoveComponent;
|
||||||
|
OnRenameComponent:=@OnDesignerRenameComponent;
|
||||||
|
OnSetDesigning:=@OnDesignerSetDesigning;
|
||||||
|
OnShowOptions:=@OnDesignerShowOptions;
|
||||||
|
OnUnselectComponentClass:=@OnDesignerUnselectComponentClass;
|
||||||
ShowEditorHints:=EnvironmentOptions.ShowEditorHints;
|
ShowEditorHints:=EnvironmentOptions.ShowEditorHints;
|
||||||
ShowComponentCaptionHints:=EnvironmentOptions.ShowComponentCaptions;
|
ShowComponentCaptionHints:=EnvironmentOptions.ShowComponentCaptions;
|
||||||
end;
|
end;
|
||||||
@ -2634,7 +2636,7 @@ begin
|
|||||||
|
|
||||||
NewUnitInfo.FormName:=NewForm.Name;
|
NewUnitInfo.FormName:=NewForm.Name;
|
||||||
NewUnitInfo.FormResourceName:=NewUnitInfo.FormName;
|
NewUnitInfo.FormResourceName:=NewUnitInfo.FormName;
|
||||||
if NewUnitInfo.IsPartOfProject then
|
if NewUnitInfo.IsPartOfProject and Project1.AutoCreateForms then
|
||||||
Project1.AddCreateFormToProjectFile(NewForm.ClassName,NewForm.Name);
|
Project1.AddCreateFormToProjectFile(NewForm.ClassName,NewForm.Name);
|
||||||
|
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
@ -3359,7 +3361,7 @@ procedure TMainIDE.GetMainUnit(var MainUnitInfo: TUnitInfo;
|
|||||||
var MainUnitSrcEdit: TSourceEditor; UpdateModified: boolean);
|
var MainUnitSrcEdit: TSourceEditor; UpdateModified: boolean);
|
||||||
begin
|
begin
|
||||||
MainUnitSrcEdit:=nil;
|
MainUnitSrcEdit:=nil;
|
||||||
if Project1.MainUnit>=0 then begin
|
if Project1.MainUnitID>=0 then begin
|
||||||
MainUnitInfo:=Project1.MainUnitInfo;
|
MainUnitInfo:=Project1.MainUnitInfo;
|
||||||
if MainUnitInfo.Loaded then begin
|
if MainUnitInfo.Loaded then begin
|
||||||
MainUnitSrcEdit:=SourceNoteBook.FindSourceEditorWithPageIndex(
|
MainUnitSrcEdit:=SourceNoteBook.FindSourceEditorWithPageIndex(
|
||||||
@ -3426,7 +3428,7 @@ begin
|
|||||||
|
|
||||||
// build a nice project info filename suggestion
|
// build a nice project info filename suggestion
|
||||||
NewFilename:='';
|
NewFilename:='';
|
||||||
if (Project1.MainUnit>=0) then
|
if (Project1.MainUnitID>=0) then
|
||||||
NewFileName:=Project1.MainUnitInfo.UnitName;
|
NewFileName:=Project1.MainUnitInfo.UnitName;
|
||||||
if NewFilename='' then
|
if NewFilename='' then
|
||||||
NewFilename:=ExtractFileName(Project1.ProjectInfoFile);
|
NewFilename:=ExtractFileName(Project1.ProjectInfoFile);
|
||||||
@ -3488,7 +3490,7 @@ begin
|
|||||||
NewFileName:=ExtractFilePath(NewFilename)
|
NewFileName:=ExtractFilePath(NewFilename)
|
||||||
+lowercase(ExtractFileName(NewFilename));
|
+lowercase(ExtractFileName(NewFilename));
|
||||||
|
|
||||||
if Project1.MainUnit>=0 then begin
|
if Project1.MainUnitID>=0 then begin
|
||||||
// check mainunit filename
|
// check mainunit filename
|
||||||
Ext:=ExtractFileExt(Project1.MainUnitInfo.Filename);
|
Ext:=ExtractFileExt(Project1.MainUnitInfo.Filename);
|
||||||
if Ext='' then Ext:=ProjectDefaultExt[Project1.ProjectType];
|
if Ext='' then Ext:=ProjectDefaultExt[Project1.ProjectType];
|
||||||
@ -3554,7 +3556,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// change main source
|
// change main source
|
||||||
if (Project1.MainUnit>=0) then begin
|
if (Project1.MainUnitID>=0) then begin
|
||||||
GetMainUnit(MainUnitInfo,MainUnitSrcEdit,true);
|
GetMainUnit(MainUnitInfo,MainUnitSrcEdit,true);
|
||||||
|
|
||||||
// switch MainUnitInfo.Source to new code
|
// switch MainUnitInfo.Source to new code
|
||||||
@ -3950,7 +3952,7 @@ begin
|
|||||||
Project1.CloseEditorIndex(ActiveUnitInfo.EditorIndex);
|
Project1.CloseEditorIndex(ActiveUnitInfo.EditorIndex);
|
||||||
ActiveUnitInfo.Loaded:=false;
|
ActiveUnitInfo.Loaded:=false;
|
||||||
i:=Project1.IndexOf(ActiveUnitInfo);
|
i:=Project1.IndexOf(ActiveUnitInfo);
|
||||||
if (i<>Project1.MainUnit) and (ActiveUnitInfo.IsVirtual) then begin
|
if (i<>Project1.MainUnitID) and (ActiveUnitInfo.IsVirtual) then begin
|
||||||
Project1.RemoveUnit(i);
|
Project1.RemoveUnit(i);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4087,7 +4089,9 @@ begin
|
|||||||
|
|
||||||
// read form data
|
// read form data
|
||||||
if FilenameIsPascalUnit(AFilename) then begin
|
if FilenameIsPascalUnit(AFilename) then begin
|
||||||
// this could be a unit -> try to load the lfm file
|
// this could be a unit with a form
|
||||||
|
//if (Project1.AutoCreateForms)
|
||||||
|
// -> try to load the lfm file
|
||||||
Result:=DoLoadLFM(NewUnitInfo,Flags);
|
Result:=DoLoadLFM(NewUnitInfo,Flags);
|
||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
end else if NewUnitInfo.Form<>nil then begin
|
end else if NewUnitInfo.Form<>nil then begin
|
||||||
@ -4106,7 +4110,7 @@ var MainUnitInfo: TUnitInfo;
|
|||||||
begin
|
begin
|
||||||
writeln('[TMainIDE.DoOpenMainUnit] A');
|
writeln('[TMainIDE.DoOpenMainUnit] A');
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
if Project1.MainUnit<0 then exit;
|
if Project1.MainUnitID<0 then exit;
|
||||||
MainUnitInfo:=Project1.MainUnitInfo;
|
MainUnitInfo:=Project1.MainUnitInfo;
|
||||||
|
|
||||||
// check if main unit is already loaded in source editor
|
// check if main unit is already loaded in source editor
|
||||||
@ -4133,7 +4137,7 @@ end;
|
|||||||
function TMainIDE.DoRevertMainUnit: TModalResult;
|
function TMainIDE.DoRevertMainUnit: TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
if Project1.MainUnit<0 then exit;
|
if Project1.MainUnitID<0 then exit;
|
||||||
if Project1.MainUnitInfo.EditorIndex>=0 then
|
if Project1.MainUnitInfo.EditorIndex>=0 then
|
||||||
// main unit is loaded, so we can just revert
|
// main unit is loaded, so we can just revert
|
||||||
Result:=DoOpenEditorFile('',Project1.MainUnitInfo.EditorIndex,[ofRevert])
|
Result:=DoOpenEditorFile('',Project1.MainUnitInfo.EditorIndex,[ofRevert])
|
||||||
@ -4169,7 +4173,7 @@ Begin
|
|||||||
if (Project1.Units[i].UnitName<>'') then begin
|
if (Project1.Units[i].UnitName<>'') then begin
|
||||||
UnitList.Add(TViewUnitsEntry.Create(
|
UnitList.Add(TViewUnitsEntry.Create(
|
||||||
Project1.Units[i].UnitName,i,Project1.Units[i]=ActiveUnitInfo));
|
Project1.Units[i].UnitName,i,Project1.Units[i]=ActiveUnitInfo));
|
||||||
end else if Project1.MainUnit=i then begin
|
end else if Project1.MainUnitID=i then begin
|
||||||
MainUnitInfo:=Project1.MainUnitInfo;
|
MainUnitInfo:=Project1.MainUnitInfo;
|
||||||
if Project1.ProjectType in [ptProgram,ptApplication,ptCustomProgram]
|
if Project1.ProjectType in [ptProgram,ptApplication,ptCustomProgram]
|
||||||
then begin
|
then begin
|
||||||
@ -4234,7 +4238,7 @@ begin
|
|||||||
WasVisible:=UnitDependenciesView.Visible;
|
WasVisible:=UnitDependenciesView.Visible;
|
||||||
|
|
||||||
if not UnitDependenciesView.RootValid then begin
|
if not UnitDependenciesView.RootValid then begin
|
||||||
if Project1.MainUnit>=0 then begin
|
if Project1.MainUnitID>=0 then begin
|
||||||
UnitDependenciesView.RootFilename:=Project1.MainUnitInfo.Filename;
|
UnitDependenciesView.RootFilename:=Project1.MainUnitInfo.Filename;
|
||||||
UnitDependenciesView.RootShortFilename:=
|
UnitDependenciesView.RootShortFilename:=
|
||||||
ExtractFilename(Project1.MainUnitInfo.Filename);
|
ExtractFilename(Project1.MainUnitInfo.Filename);
|
||||||
@ -4496,7 +4500,7 @@ begin
|
|||||||
// (this can alter the mainunit: e.g. used unit names)
|
// (this can alter the mainunit: e.g. used unit names)
|
||||||
for i:=0 to Project1.UnitCount-1 do begin
|
for i:=0 to Project1.UnitCount-1 do begin
|
||||||
if (Project1.Units[i].Loaded) and (Project1.Units[i].IsVirtual)
|
if (Project1.Units[i].Loaded) and (Project1.Units[i].IsVirtual)
|
||||||
and (Project1.MainUnit<>i) then begin
|
and (Project1.MainUnitID<>i) then begin
|
||||||
Result:=DoSaveEditorFile(Project1.Units[i].EditorIndex,
|
Result:=DoSaveEditorFile(Project1.Units[i].EditorIndex,
|
||||||
[sfSaveAs,sfProjectSaving]
|
[sfSaveAs,sfProjectSaving]
|
||||||
+[sfSaveToTestDir,sfCheckAmbigiousFiles]*Flags);
|
+[sfSaveToTestDir,sfCheckAmbigiousFiles]*Flags);
|
||||||
@ -4568,7 +4572,7 @@ begin
|
|||||||
if (SourceNoteBook.Notebook<>nil) and (not (sfSaveToTestDir in Flags)) then
|
if (SourceNoteBook.Notebook<>nil) and (not (sfSaveToTestDir in Flags)) then
|
||||||
begin
|
begin
|
||||||
for i:=0 to SourceNoteBook.Notebook.PageCount-1 do begin
|
for i:=0 to SourceNoteBook.Notebook.PageCount-1 do begin
|
||||||
if (Project1.MainUnit<0)
|
if (Project1.MainUnitID<0)
|
||||||
or (Project1.MainUnitInfo.EditorIndex<>i) then begin
|
or (Project1.MainUnitInfo.EditorIndex<>i) then begin
|
||||||
Result:=DoSaveEditorFile(i,[sfProjectSaving]
|
Result:=DoSaveEditorFile(i,[sfProjectSaving]
|
||||||
+[sfSaveToTestDir,sfCheckAmbigiousFiles]*Flags);
|
+[sfSaveToTestDir,sfCheckAmbigiousFiles]*Flags);
|
||||||
@ -4678,7 +4682,7 @@ begin
|
|||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoOpenProjectFile B5');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoOpenProjectFile B5');{$ENDIF}
|
||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
|
|
||||||
if Project1.MainUnit>=0 then begin
|
if Project1.MainUnitID>=0 then begin
|
||||||
// read MainUnit Source
|
// read MainUnit Source
|
||||||
Result:=DoLoadCodeBuffer(NewBuf,Project1.MainFilename,
|
Result:=DoLoadCodeBuffer(NewBuf,Project1.MainFilename,
|
||||||
[lbfUpdateFromDisk,lbfRevert,lbfCheckIfText]);
|
[lbfUpdateFromDisk,lbfRevert,lbfCheckIfText]);
|
||||||
@ -5007,7 +5011,7 @@ Begin
|
|||||||
try
|
try
|
||||||
for i:=0 to Project1.UnitCount-1 do begin
|
for i:=0 to Project1.UnitCount-1 do begin
|
||||||
AnUnitInfo:=Project1.Units[i];
|
AnUnitInfo:=Project1.Units[i];
|
||||||
if (AnUnitInfo.IsPartOfProject) and (i<>Project1.MainUnit) then begin
|
if (AnUnitInfo.IsPartOfProject) and (i<>Project1.MainUnitID) then begin
|
||||||
AName:=Project1.RemoveProjectPathFromFilename(AnUnitInfo.FileName);
|
AName:=Project1.RemoveProjectPathFromFilename(AnUnitInfo.FileName);
|
||||||
UnitList.Add(TViewUnitsEntry.Create(AName,i,false));
|
UnitList.Add(TViewUnitsEntry.Create(AName,i,false));
|
||||||
end;
|
end;
|
||||||
@ -5017,7 +5021,7 @@ Begin
|
|||||||
if TViewUnitsEntry(UnitList[i]).Selected then begin
|
if TViewUnitsEntry(UnitList[i]).Selected then begin
|
||||||
AnUnitInfo:=Project1.Units[TViewUnitsEntry(UnitList[i]).ID];
|
AnUnitInfo:=Project1.Units[TViewUnitsEntry(UnitList[i]).ID];
|
||||||
AnUnitInfo.IsPartOfProject:=false;
|
AnUnitInfo.IsPartOfProject:=false;
|
||||||
if (Project1.MainUnit>=0)
|
if (Project1.MainUnitID>=0)
|
||||||
and (Project1.ProjectType in [ptProgram, ptApplication]) then begin
|
and (Project1.ProjectType in [ptProgram, ptApplication]) then begin
|
||||||
if (AnUnitInfo.UnitName<>'') then
|
if (AnUnitInfo.UnitName<>'') then
|
||||||
CodeToolBoss.RemoveUnitFromAllUsesSections(
|
CodeToolBoss.RemoveUnitFromAllUsesSections(
|
||||||
@ -5148,7 +5152,7 @@ begin
|
|||||||
|
|
||||||
// Check if we can run this project
|
// Check if we can run this project
|
||||||
if not (Project1.ProjectType in [ptProgram, ptApplication, ptCustomProgram])
|
if not (Project1.ProjectType in [ptProgram, ptApplication, ptCustomProgram])
|
||||||
or (Project1.MainUnit < 0)
|
or (Project1.MainUnitID < 0)
|
||||||
or (ToolStatus <> itNone)
|
or (ToolStatus <> itNone)
|
||||||
then Exit;
|
then Exit;
|
||||||
|
|
||||||
@ -6048,7 +6052,7 @@ begin
|
|||||||
if Project1.IsVirtual then
|
if Project1.IsVirtual then
|
||||||
Result:=GetTestProjectFilename
|
Result:=GetTestProjectFilename
|
||||||
else begin
|
else begin
|
||||||
if Project1.MainUnit>=0 then begin
|
if Project1.MainUnitID>=0 then begin
|
||||||
Result:=
|
Result:=
|
||||||
Project1.CompilerOptions.CreateTargetFilename(Project1.MainFilename)
|
Project1.CompilerOptions.CreateTargetFilename(Project1.MainFilename)
|
||||||
end;
|
end;
|
||||||
@ -6059,7 +6063,7 @@ end;
|
|||||||
function TMainIDE.GetTestProjectFilename: string;
|
function TMainIDE.GetTestProjectFilename: string;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
if (Project1.MainUnit<0) then exit;
|
if (Project1.MainUnitID<0) then exit;
|
||||||
Result:=GetTestUnitFilename(Project1.MainUnitInfo);
|
Result:=GetTestUnitFilename(Project1.MainUnitInfo);
|
||||||
if Result='' then exit;
|
if Result='' then exit;
|
||||||
Result:=Project1.CompilerOptions.CreateTargetFilename(Result);
|
Result:=Project1.CompilerOptions.CreateTargetFilename(Result);
|
||||||
@ -6160,6 +6164,11 @@ begin
|
|||||||
SetDesigning(Component,Value);
|
SetDesigning(Component,Value);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.OnDesignerShowOptions(Sender: TObject);
|
||||||
|
begin
|
||||||
|
DoShowEnvGeneralOptions(eodpFormEditor);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.OnDesignerPropertiesChanged(Sender: TObject);
|
procedure TMainIDE.OnDesignerPropertiesChanged(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ObjectInspector1.RefreshPropertyValues;
|
ObjectInspector1.RefreshPropertyValues;
|
||||||
@ -6300,7 +6309,7 @@ end;
|
|||||||
function TMainIDE.UnitDependenciesViewGetProjectMainFilename(Sender: TObject
|
function TMainIDE.UnitDependenciesViewGetProjectMainFilename(Sender: TObject
|
||||||
): string;
|
): string;
|
||||||
begin
|
begin
|
||||||
if Project1.MainUnit>=0 then
|
if Project1.MainUnitID>=0 then
|
||||||
Result:=Project1.MainUnitInfo.Filename;
|
Result:=Project1.MainUnitInfo.Filename;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -7178,7 +7187,7 @@ begin
|
|||||||
FormEditor1.JITFormList.RenameFormClass(TForm(AComponent),NewClassName);
|
FormEditor1.JITFormList.RenameFormClass(TForm(AComponent),NewClassName);
|
||||||
|
|
||||||
// change createform statement
|
// change createform statement
|
||||||
if ActiveUnitInfo.IsPartOfProject and (Project1.MainUnit>=0)
|
if ActiveUnitInfo.IsPartOfProject and (Project1.MainUnitID>=0)
|
||||||
then begin
|
then begin
|
||||||
BossResult:=CodeToolBoss.ChangeCreateFormStatement(
|
BossResult:=CodeToolBoss.ChangeCreateFormStatement(
|
||||||
Project1.MainUnitInfo.Source,
|
Project1.MainUnitInfo.Source,
|
||||||
@ -7861,6 +7870,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.480 2003/03/11 09:57:51 mattias
|
||||||
|
implemented ProjectOpt: AutoCreateNewForms, added designer Show Options
|
||||||
|
|
||||||
Revision 1.479 2003/03/09 21:13:32 mattias
|
Revision 1.479 2003/03/09 21:13:32 mattias
|
||||||
localized gtk interface
|
localized gtk interface
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user