mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-21 22:59:27 +02:00
changed OI SHow Hints option to resource string, added TProjectDescriptor.DoInitDescriptor
git-svn-id: trunk@7203 -
This commit is contained in:
parent
73ca58ffc8
commit
31d368a4d8
@ -3938,14 +3938,13 @@ begin
|
||||
MaxValue:=100;
|
||||
end;
|
||||
|
||||
OIShowHintCheckBox :=TCheckBox.Create(Self);
|
||||
OIShowHintCheckBox:=TCheckBox.Create(Self);
|
||||
with OIShowHintCheckBox do begin
|
||||
Name := 'OIShowHintCheckBox';
|
||||
Parent := OIMiscGroupBox;
|
||||
Left := 6;
|
||||
Top := 33;
|
||||
Height := 25;
|
||||
Caption := 'Show hints';
|
||||
Caption := lisShowHintsInObjectInspector;
|
||||
end;
|
||||
|
||||
OIDefaultItemHeightLabel:=TLabel.Create(Self);
|
||||
|
@ -728,6 +728,7 @@ resourcestring
|
||||
|
||||
dlgOIMiscellaneous = 'Miscellaneous';
|
||||
dlgOIItemHeight = 'Item height';
|
||||
lisShowHintsInObjectInspector = 'Show hints in Object Inspector';
|
||||
dlgEnvColors = 'Colors';
|
||||
dlgEnvBackupHelpNote =
|
||||
'Notes: Project files are all files in the project directory';
|
||||
|
36
ide/main.pp
36
ide/main.pp
@ -523,7 +523,8 @@ type
|
||||
function CloseDesignerForm(AnUnitInfo: TUnitInfo): TModalResult;
|
||||
|
||||
// methods for creating a project
|
||||
function CreateProjectObject(ProjectDesc: TProjectDescriptor): TProject;
|
||||
function CreateProjectObject(ProjectDesc,
|
||||
FallbackProjectDesc: TProjectDescriptor): TProject;
|
||||
procedure OnLoadProjectInfoFromXMLConfig(TheProject: TProject;
|
||||
XMLConfig: TXMLConfig);
|
||||
procedure OnSaveProjectInfoToXMLConfig(TheProject: TProject;
|
||||
@ -4289,9 +4290,19 @@ begin
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
function TMainIDE.CreateProjectObject(ProjectDesc: TProjectDescriptor): TProject;
|
||||
function TMainIDE.CreateProjectObject(ProjectDesc,
|
||||
FallbackProjectDesc: TProjectDescriptor): TProject;
|
||||
begin
|
||||
Result:=TProject.Create(ProjectDesc);
|
||||
// custom initialization
|
||||
if ProjectDesc.InitProject(Result)<>mrOk then begin
|
||||
Result.Free;
|
||||
Result:=nil;
|
||||
if FallbackProjectDesc=nil then exit;
|
||||
Result:=TProject.Create(FallbackProjectDesc);
|
||||
FallbackProjectDesc.InitProject(Result);
|
||||
end;
|
||||
|
||||
Result.OnFileBackup:=@DoBackupFile;
|
||||
Result.OnLoadProjectInfo:=@OnLoadProjectInfoFromXMLConfig;
|
||||
Result.OnSaveProjectInfo:=@OnSaveProjectInfoToXMLConfig;
|
||||
@ -5620,7 +5631,10 @@ function TMainIDE.DoNewProject(ProjectDesc: TProjectDescriptor):TModalResult;
|
||||
var i:integer;
|
||||
Begin
|
||||
DebugLn('TMainIDE.DoNewProject A');
|
||||
Result:=mrCancel;
|
||||
|
||||
// init the descriptor (it can now ask the user for options)
|
||||
Result:=ProjectDesc.InitDescriptor;
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// invalidate cached substituted macros
|
||||
IncreaseCompilerParseStamp;
|
||||
@ -5649,7 +5663,7 @@ Begin
|
||||
|
||||
// create new project (TProject will automatically create the mainunit)
|
||||
|
||||
Project1:=CreateProjectObject(ProjectDesc);
|
||||
Project1:=CreateProjectObject(ProjectDesc,ProjectDescriptorProgram);
|
||||
Project1.BeginUpdate(true);
|
||||
try
|
||||
Project1.CompilerOptions.CompilerPath:='$(CompPath)';
|
||||
@ -5659,7 +5673,9 @@ Begin
|
||||
// add and load default required packages
|
||||
PkgBoss.AddDefaultDependencies(Project1);
|
||||
|
||||
ProjectDesc.CreateStartFiles(Project1);
|
||||
if ProjectDesc.CreateStartFiles(Project1)<>mrOk then begin
|
||||
debugln('TMainIDE.DoNewProject ProjectDesc.CreateStartFiles failed');
|
||||
end;
|
||||
|
||||
// rebuild codetools defines
|
||||
RescanCompilerDefines(true);
|
||||
@ -5896,7 +5912,8 @@ begin
|
||||
writeln('TMainIDE.DoOpenProjectFile B');
|
||||
{$ENDIF}
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoOpenProjectFile B');{$ENDIF}
|
||||
Project1:=CreateProjectObject(ProjectDescriptorProgram);
|
||||
Project1:=CreateProjectObject(ProjectDescriptorProgram,
|
||||
ProjectDescriptorProgram);
|
||||
Project1.BeginUpdate(true);
|
||||
try
|
||||
if ProjInspector<>nil then ProjInspector.LazProject:=Project1;
|
||||
@ -6106,7 +6123,7 @@ begin
|
||||
ExpandFilename(ExtractFilePath(ProgramBuf.Filename));
|
||||
|
||||
// create a new project
|
||||
Project1:=CreateProjectObject(NewProjectDesc);
|
||||
Project1:=CreateProjectObject(NewProjectDesc,ProjectDescriptorProgram);
|
||||
Project1.BeginUpdate(true);
|
||||
try
|
||||
if ProjInspector<>nil then ProjInspector.LazProject:=Project1;
|
||||
@ -7287,7 +7304,7 @@ begin
|
||||
// create a new project
|
||||
debugln('TMainIDE.DoConvertDelphiProject creating new project ...');
|
||||
NewProjectDesc:=TProjectEmptyProgramDescriptor.Create;
|
||||
Project1:=CreateProjectObject(NewProjectDesc);
|
||||
Project1:=CreateProjectObject(NewProjectDesc,ProjectDescriptorApplication);
|
||||
Project1.BeginUpdate(true);
|
||||
try
|
||||
if ProjInspector<>nil then ProjInspector.LazProject:=Project1;
|
||||
@ -11542,6 +11559,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.866 2005/05/26 15:54:02 mattias
|
||||
changed OI SHow Hints option to resource string, added TProjectDescriptor.DoInitDescriptor
|
||||
|
||||
Revision 1.865 2005/05/21 15:38:07 mattias
|
||||
fixed some typos
|
||||
|
||||
|
@ -308,8 +308,8 @@ type
|
||||
constructor Create; override;
|
||||
function GetLocalizedName: string; override;
|
||||
function GetLocalizedDescription: string; override;
|
||||
procedure InitProject(AProject: TLazProject); override;
|
||||
procedure CreateStartFiles(AProject: TLazProject); override;
|
||||
function InitProject(AProject: TLazProject): TModalResult; override;
|
||||
function CreateStartFiles(AProject: TLazProject): TModalResult; override;
|
||||
end;
|
||||
|
||||
{ TProjectProgramDescriptor }
|
||||
@ -319,8 +319,8 @@ type
|
||||
constructor Create; override;
|
||||
function GetLocalizedName: string; override;
|
||||
function GetLocalizedDescription: string; override;
|
||||
procedure InitProject(AProject: TLazProject); override;
|
||||
procedure CreateStartFiles(AProject: TLazProject); override;
|
||||
function InitProject(AProject: TLazProject): TModalResult; override;
|
||||
function CreateStartFiles(AProject: TLazProject): TModalResult; override;
|
||||
end;
|
||||
|
||||
{ TProjectManualProgramDescriptor }
|
||||
@ -332,8 +332,8 @@ type
|
||||
constructor Create; override;
|
||||
function GetLocalizedName: string; override;
|
||||
function GetLocalizedDescription: string; override;
|
||||
procedure InitProject(AProject: TLazProject); override;
|
||||
procedure CreateStartFiles(AProject: TLazProject); override;
|
||||
function InitProject(AProject: TLazProject): TModalResult; override;
|
||||
function CreateStartFiles(AProject: TLazProject): TModalResult; override;
|
||||
property AddMainSource: boolean read FAddMainSource write FAddMainSource;
|
||||
end;
|
||||
|
||||
@ -1210,9 +1210,6 @@ begin
|
||||
fTargetFileExt := GetDefaultExecutableExt;
|
||||
Title := '';
|
||||
fUnitList := TList.Create; // list of TUnitInfo
|
||||
|
||||
// custom initialization
|
||||
ProjectDescription.InitProject(Self);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -3001,13 +2998,14 @@ begin
|
||||
Result:=Format(lisProgramAFreepascalProgramTheProgramFileIsAutomatic, [#13]);
|
||||
end;
|
||||
|
||||
procedure TProjectProgramDescriptor.InitProject(AProject: TLazProject);
|
||||
function TProjectProgramDescriptor.InitProject(AProject: TLazProject
|
||||
): TModalResult;
|
||||
var
|
||||
le: String;
|
||||
NewSource: String;
|
||||
MainFile: TLazProjectFile;
|
||||
begin
|
||||
inherited InitProject(AProject);
|
||||
Result:=inherited InitProject(AProject);
|
||||
|
||||
MainFile:=AProject.CreateProjectFile('project1.lpr');
|
||||
MainFile.IsPartOfProject:=true;
|
||||
@ -3030,10 +3028,11 @@ begin
|
||||
AProject.MainFile.SetSourceText(NewSource);
|
||||
end;
|
||||
|
||||
procedure TProjectProgramDescriptor.CreateStartFiles(AProject: TLazProject);
|
||||
function TProjectProgramDescriptor.CreateStartFiles(AProject: TLazProject
|
||||
): TModalResult;
|
||||
begin
|
||||
LazarusIDE.DoOpenEditorFile(AProject.MainFile.Filename,-1,
|
||||
[ofProjectLoading,ofRegularFile]);
|
||||
Result:=LazarusIDE.DoOpenEditorFile(AProject.MainFile.Filename,-1,
|
||||
[ofProjectLoading,ofRegularFile]);
|
||||
end;
|
||||
|
||||
{ TProjectApplicationDescriptor }
|
||||
@ -3054,13 +3053,14 @@ begin
|
||||
Result:=Format(lisApplicationAGraphicalLclFreepascalProgramTheProgra, [#13]);
|
||||
end;
|
||||
|
||||
procedure TProjectApplicationDescriptor.InitProject(AProject: TLazProject);
|
||||
function TProjectApplicationDescriptor.InitProject(
|
||||
AProject: TLazProject): TModalResult;
|
||||
var
|
||||
le: string;
|
||||
NewSource: String;
|
||||
MainFile: TLazProjectFile;
|
||||
begin
|
||||
inherited InitProject(AProject);
|
||||
Result:=inherited InitProject(AProject);
|
||||
|
||||
MainFile:=AProject.CreateProjectFile('project1.lpr');
|
||||
MainFile.IsPartOfProject:=true;
|
||||
@ -3092,10 +3092,10 @@ begin
|
||||
AProject.LazCompilerOptions.Win32GraphicApp:=true;
|
||||
end;
|
||||
|
||||
procedure TProjectApplicationDescriptor.CreateStartFiles(AProject: TLazProject
|
||||
);
|
||||
function TProjectApplicationDescriptor.CreateStartFiles(AProject: TLazProject
|
||||
): TModalResult;
|
||||
begin
|
||||
LazarusIDE.DoNewEditorFile(FileDescriptorForm,'','',
|
||||
Result:=LazarusIDE.DoNewEditorFile(FileDescriptorForm,'','',
|
||||
[nfIsPartOfProject,nfOpenInEditor,nfCreateDefaultSrc]);
|
||||
end;
|
||||
|
||||
@ -3121,13 +3121,14 @@ begin
|
||||
Result:=Format(lisCustomProgramAFreepascalProgram, [#13])
|
||||
end;
|
||||
|
||||
procedure TProjectManualProgramDescriptor.InitProject(AProject: TLazProject);
|
||||
function TProjectManualProgramDescriptor.InitProject(AProject: TLazProject
|
||||
): TModalResult;
|
||||
var
|
||||
le: string;
|
||||
NewSource: String;
|
||||
MainFile: TLazProjectFile;
|
||||
begin
|
||||
inherited InitProject(AProject);
|
||||
Result:=inherited InitProject(AProject);
|
||||
|
||||
if AddMainSource then begin
|
||||
MainFile:=AProject.CreateProjectFile('project1.pas');
|
||||
@ -3152,11 +3153,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TProjectManualProgramDescriptor.CreateStartFiles(AProject: TLazProject
|
||||
);
|
||||
function TProjectManualProgramDescriptor.CreateStartFiles(AProject: TLazProject
|
||||
): TModalResult;
|
||||
begin
|
||||
LazarusIDE.DoOpenEditorFile(AProject.MainFile.Filename,-1,
|
||||
[ofProjectLoading,ofRegularFile]);
|
||||
Result:=LazarusIDE.DoOpenEditorFile(AProject.MainFile.Filename,-1,
|
||||
[ofProjectLoading,ofRegularFile]);
|
||||
end;
|
||||
|
||||
{ TProjectEmptyProgramDescriptor }
|
||||
@ -3171,6 +3172,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.183 2005/05/26 15:54:02 mattias
|
||||
changed OI SHow Hints option to resource string, added TProjectDescriptor.DoInitDescriptor
|
||||
|
||||
Revision 1.182 2005/03/23 10:45:05 mattias
|
||||
fixed ambigious with ambiguous
|
||||
|
||||
|
@ -22,7 +22,7 @@ unit ProjectIntf;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, FileUtil, NewItemIntf;
|
||||
Classes, SysUtils, LCLProc, FileUtil, Controls, Forms, NewItemIntf;
|
||||
|
||||
const
|
||||
FileDescGroupName = 'File';
|
||||
@ -420,29 +420,40 @@ type
|
||||
);
|
||||
TProjectFlags = set of TProjectFlag;
|
||||
|
||||
{ TProjectDescriptor
|
||||
- to show an option dialog to the user override the DoInitDescriptor
|
||||
- to initialize project compiler settings and paths override InitProject
|
||||
- to create files on creation override CreateStartFiles
|
||||
}
|
||||
|
||||
TProjectDescriptor = class(TPersistent)
|
||||
private
|
||||
FDefaultExt: string;
|
||||
FFlags: TProjectFlags;
|
||||
FInitialized: boolean;
|
||||
FName: string;
|
||||
FReferenceCount: integer;
|
||||
FVisibleInNewDialog: boolean;
|
||||
protected
|
||||
procedure SetName(const AValue: string); virtual;
|
||||
procedure SetFlags(const AValue: TProjectFlags); virtual;
|
||||
procedure SetInitialized;
|
||||
function DoInitDescriptor: TModalResult; virtual;// put here option dialogs
|
||||
public
|
||||
constructor Create; virtual;
|
||||
function GetLocalizedName: string; virtual;
|
||||
function GetLocalizedDescription: string; virtual;
|
||||
procedure Release;
|
||||
procedure Reference;
|
||||
procedure InitProject(AProject: TLazProject); virtual;
|
||||
procedure CreateStartFiles(AProject: TLazProject); virtual;
|
||||
function InitDescriptor: TModalResult;
|
||||
function InitProject(AProject: TLazProject): TModalResult; virtual;
|
||||
function CreateStartFiles(AProject: TLazProject): TModalResult; virtual;
|
||||
public
|
||||
property Name: string read FName write SetName;
|
||||
property VisibleInNewDialog: boolean read FVisibleInNewDialog write FVisibleInNewDialog;
|
||||
property Flags: TProjectFlags read FFlags write SetFlags;
|
||||
property DefaultExt: string read FDefaultExt write FDefaultExt;
|
||||
property Initialized: boolean read FInitialized;
|
||||
end;
|
||||
TProjectDescriptorClass = class of TProjectDescriptor;
|
||||
|
||||
@ -830,6 +841,16 @@ begin
|
||||
FFlags:=AValue;
|
||||
end;
|
||||
|
||||
procedure TProjectDescriptor.SetInitialized;
|
||||
begin
|
||||
FInitialized:=true;
|
||||
end;
|
||||
|
||||
function TProjectDescriptor.DoInitDescriptor: TModalResult;
|
||||
begin
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
procedure TProjectDescriptor.SetName(const AValue: string);
|
||||
begin
|
||||
if FName=AValue then exit;
|
||||
@ -868,15 +889,26 @@ begin
|
||||
inc(FReferenceCount);
|
||||
end;
|
||||
|
||||
procedure TProjectDescriptor.InitProject(AProject: TLazProject);
|
||||
function TProjectDescriptor.InitDescriptor: TModalResult;
|
||||
begin
|
||||
if not Initialized then begin
|
||||
Result:=DoInitDescriptor;
|
||||
SetInitialized;
|
||||
end else
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
function TProjectDescriptor.InitProject(AProject: TLazProject): TModalResult;
|
||||
begin
|
||||
AProject.Title:='project1';
|
||||
AProject.Flags:=Flags;
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
procedure TProjectDescriptor.CreateStartFiles(AProject: TLazProject);
|
||||
function TProjectDescriptor.CreateStartFiles(AProject: TLazProject
|
||||
): TModalResult;
|
||||
begin
|
||||
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
{ TLazProject }
|
||||
|
@ -476,7 +476,7 @@ begin
|
||||
descent^ := PANGO_DESCENT(extents) div PANGO_SCALE;
|
||||
end;
|
||||
|
||||
{$EndIf}
|
||||
{$EndIf Gtk2}
|
||||
|
||||
procedure BeginGDKErrorTrap;
|
||||
begin
|
||||
@ -8204,6 +8204,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.358 2005/05/26 15:54:02 mattias
|
||||
changed OI SHow Hints option to resource string, added TProjectDescriptor.DoInitDescriptor
|
||||
|
||||
Revision 1.357 2005/05/21 19:27:41 marc
|
||||
* fixed synedit navigation on OSX
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user