mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 09:09:32 +02:00
added TLazIDEInterface.DoOpenProject
git-svn-id: trunk@7214 -
This commit is contained in:
parent
e87eaba40e
commit
e91d514ec5
41
ide/main.pp
41
ide/main.pp
@ -588,12 +588,13 @@ type
|
||||
procedure DoShowCodeExplorer;
|
||||
|
||||
// project(s)
|
||||
function DoNewProject(ProjectDesc: TProjectDescriptor): TModalResult;
|
||||
function DoSaveProject(Flags: TSaveFlags): TModalResult;
|
||||
function DoCloseProject: TModalResult;
|
||||
function DoOpenProjectFile(AFileName: string; Flags: TOpenFlags): TModalResult;
|
||||
function DoNewProject(ProjectDesc: TProjectDescriptor): TModalResult; override;
|
||||
function DoSaveProject(Flags: TSaveFlags): TModalResult; override;
|
||||
function DoCloseProject: TModalResult; override;
|
||||
function DoOpenProjectFile(AFileName: string;
|
||||
Flags: TOpenFlags): TModalResult; override;
|
||||
function DoPublishProject(Flags: TSaveFlags;
|
||||
ShowDialog: boolean): TModalResult;
|
||||
ShowDialog: boolean): TModalResult; override;
|
||||
function DoImExportCompilerOptions(Sender: TObject): TModalResult; override;
|
||||
function DoShowProjectInspector: TModalResult; override;
|
||||
function DoAddActiveUnitToProject: TModalResult;
|
||||
@ -3998,6 +3999,8 @@ end;
|
||||
|
||||
function TMainIDE.DoOpenNotExistingFile(const AFileName: string;
|
||||
Flags: TOpenFlags): TModalResult;
|
||||
var
|
||||
NewFlags: TNewFlags;
|
||||
begin
|
||||
if ofProjectLoading in Flags then begin
|
||||
// this is a file, that was loaded last time, but was removed from disk
|
||||
@ -4026,12 +4029,13 @@ begin
|
||||
,mtInformation,[mbYes,mbNo],0)=mrYes then
|
||||
begin
|
||||
// create new file
|
||||
NewFlags:=[nfOpenInEditor,nfCreateDefaultSrc];
|
||||
if ofAddToProject in Flags then
|
||||
Include(NewFlags,nfIsPartOfProject);
|
||||
if FilenameIsPascalSource(AFilename) then
|
||||
Result:=DoNewEditorFile(FileDescriptorUnit,AFilename,'',
|
||||
[nfOpenInEditor,nfCreateDefaultSrc])
|
||||
Result:=DoNewEditorFile(FileDescriptorUnit,AFilename,'',NewFlags)
|
||||
else
|
||||
Result:=DoNewEditorFile(FileDescriptorText,AFilename,'',
|
||||
[nfOpenInEditor,nfCreateDefaultSrc]);
|
||||
Result:=DoNewEditorFile(FileDescriptorText,AFilename,'',NewFlags);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -4099,6 +4103,12 @@ begin
|
||||
if FilenameIsPascalSource(NewUnitInfo.Filename) then
|
||||
NewUnitInfo.ReadUnitNameFromSource(true);
|
||||
Project1.AddFile(NewUnitInfo,false);
|
||||
if (ofAddToProject in Flags) and (not NewUnitInfo.IsPartOfProject) then
|
||||
begin
|
||||
NewUnitInfo.IsPartOfProject:=true;
|
||||
Project1.Modified:=true;
|
||||
end;
|
||||
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
@ -5190,6 +5200,11 @@ begin
|
||||
end;
|
||||
if ReOpen then begin
|
||||
NewUnitInfo:=Project1.Units[UnitIndex];
|
||||
if (ofAddToProject in Flags) and (not NewUnitInfo.IsPartOfProject) then
|
||||
begin
|
||||
NewUnitInfo.IsPartOfProject:=true;
|
||||
Project1.Modified:=true;
|
||||
end;
|
||||
if (not (ofProjectLoading in Flags)) and NewUnitInfo.Loaded then begin
|
||||
// file already open -> change source notebook page
|
||||
SourceNoteBook.NoteBook.PageIndex:=NewUnitInfo.EditorIndex;
|
||||
@ -5212,6 +5227,11 @@ begin
|
||||
exit;
|
||||
end;
|
||||
ReOpen:=true;
|
||||
if (ofAddToProject in Flags) and (not NewUnitInfo.IsPartOfProject) then
|
||||
begin
|
||||
NewUnitInfo.IsPartOfProject:=true;
|
||||
Project1.Modified:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
// check if file exists
|
||||
@ -11673,6 +11693,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.871 2005/05/31 21:26:10 mattias
|
||||
added TLazIDEInterface.DoOpenProject
|
||||
|
||||
Revision 1.870 2005/05/28 23:16:21 mattias
|
||||
added TProjectFileDescriptor.GetResourceSource to create custom forms with custom .lfm sources
|
||||
|
||||
|
@ -100,15 +100,6 @@ type
|
||||
dsInspector2 // focussing object inspector after form
|
||||
);
|
||||
|
||||
// save file flags
|
||||
TSaveFlag = (
|
||||
sfSaveAs,
|
||||
sfSaveToTestDir,
|
||||
sfProjectSaving,
|
||||
sfCheckAmbiguousFiles
|
||||
);
|
||||
TSaveFlags = set of TSaveFlag;
|
||||
|
||||
// revert file flags
|
||||
TRevertFlag = (
|
||||
rfQuiet
|
||||
@ -253,7 +244,8 @@ const
|
||||
'ofConvertMacros',
|
||||
'ofUseCache',
|
||||
'ofMultiOpen',
|
||||
'ofDoNotLoadResource'
|
||||
'ofDoNotLoadResource',
|
||||
'ofAddToProject'
|
||||
);
|
||||
|
||||
SaveFlagNames: array[TSaveFlag] of string = (
|
||||
|
@ -37,7 +37,8 @@ type
|
||||
ofConvertMacros, // replace macros in filename
|
||||
ofUseCache, // do not update file from disk
|
||||
ofMultiOpen, // set during loading multiple files
|
||||
ofDoNotLoadResource// do not open form, datamodule, ...
|
||||
ofDoNotLoadResource,// do not open form, datamodule, ...
|
||||
ofAddToProject // add file to project (if exists)
|
||||
);
|
||||
TOpenFlags = set of TOpenFlag;
|
||||
|
||||
@ -56,6 +57,15 @@ type
|
||||
);
|
||||
TNewFlags = set of TNewFlag;
|
||||
|
||||
// save file flags
|
||||
TSaveFlag = (
|
||||
sfSaveAs,
|
||||
sfSaveToTestDir,
|
||||
sfProjectSaving,
|
||||
sfCheckAmbiguousFiles
|
||||
);
|
||||
TSaveFlags = set of TSaveFlag;
|
||||
|
||||
|
||||
{ TLazIDEInterface }
|
||||
|
||||
@ -73,6 +83,15 @@ type
|
||||
Flags: TOpenFlags): TModalResult; virtual; abstract;
|
||||
function DoOpenFileAndJumpToIdentifier(const AFilename, AnIdentifier: string;
|
||||
PageIndex: integer; Flags: TOpenFlags): TModalResult; virtual; abstract;
|
||||
|
||||
function DoNewProject(ProjectDesc: TProjectDescriptor): TModalResult; virtual; abstract;
|
||||
function DoSaveProject(Flags: TSaveFlags): TModalResult; virtual; abstract;
|
||||
function DoCloseProject: TModalResult; virtual; abstract;
|
||||
function DoOpenProjectFile(AFileName: string;
|
||||
Flags: TOpenFlags): TModalResult; virtual; abstract;
|
||||
function DoPublishProject(Flags: TSaveFlags;
|
||||
ShowDialog: boolean): TModalResult; virtual; abstract;
|
||||
|
||||
function GetPrimaryConfigPath: String; virtual; abstract;
|
||||
function GetSecondaryConfigPath: String; virtual; abstract;
|
||||
procedure CopySecondaryConfigFile(const AFilename: String); virtual; abstract;
|
||||
|
@ -7901,12 +7901,13 @@ end;
|
||||
LineLength : Longint; lbearing, rbearing, width, ascent, descent : Pgint);
|
||||
|
||||
Gets text extent of a string, ignoring escaped Ampersands.
|
||||
That means, ampersands are not counted.
|
||||
-------------------------------------------------------------------------------}
|
||||
{$Ifdef GTK2}
|
||||
Procedure GetTextExtentIgnoringAmpersands(FontDesc : PPangoFontDescription; Str : PChar;
|
||||
LineLength : Longint; lbearing, rbearing, width, ascent, descent : Pgint);
|
||||
{$Else}
|
||||
Procedure GetTextExtentIgnoringAmpersands(Font : PGDKFont; Str : PChar;
|
||||
Procedure GetTextExtentIgnoringAmpersands(FontDesc : PGDKFont; Str : PChar;
|
||||
LineLength : Longint; lbearing, rbearing, width, ascent, descent : Pgint);
|
||||
{$EndIf}
|
||||
var
|
||||
@ -7923,13 +7924,8 @@ begin
|
||||
LineLength:=StrLen(NewStr);
|
||||
end;
|
||||
end;
|
||||
{$Ifdef GTK2}
|
||||
gdk_text_extents(FontDesc, NewStr, LineLength,
|
||||
lbearing, rBearing, width, ascent, descent);
|
||||
{$Else}
|
||||
gdk_text_extents(Font, NewStr, LineLength,
|
||||
lbearing, rBearing, width, ascent, descent);
|
||||
{$EndIf}
|
||||
if NewStr<>Str then
|
||||
StrDispose(NewStr);
|
||||
end;
|
||||
@ -8204,6 +8200,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.360 2005/05/31 21:26:10 mattias
|
||||
added TLazIDEInterface.DoOpenProject
|
||||
|
||||
Revision 1.359 2005/05/28 00:41:15 mattias
|
||||
removed verbosity
|
||||
|
||||
|
@ -349,12 +349,54 @@ begin
|
||||
end;
|
||||
|
||||
procedure TPkgManager.MainIDEitmPkgEditInstallPkgsClick(Sender: TObject);
|
||||
|
||||
function CreateChangeReport(OldDependencyList,
|
||||
NewDependencyList: TPkgDependency): string;
|
||||
var
|
||||
CurDependency: TPkgDependency;
|
||||
OldDependency: TPkgDependency;
|
||||
NewDependency: TPkgDependency;
|
||||
begin
|
||||
Result:='';
|
||||
|
||||
// list all packages, that will be installed
|
||||
CurDependency:=NewDependencyList;
|
||||
while CurDependency<>nil do begin
|
||||
Result:=Result+CurDependency.AsString;
|
||||
OldDependency:=FindDependencyByNameInList(OldDependencyList,pdlRequires,
|
||||
CurDependency.PackageName);
|
||||
if OldDependency<>nil then begin
|
||||
// stay installed
|
||||
if CurDependency.AsString<>OldDependency.AsString then
|
||||
Result:=Result+' (old: '+OldDependency.AsString+')';
|
||||
end else begin
|
||||
// newly installed
|
||||
Result:=Result+' (new)';
|
||||
end;
|
||||
Result:=Result+#13;
|
||||
CurDependency:=CurDependency.NextRequiresDependency;
|
||||
end;
|
||||
|
||||
// list all packages, that will be removed
|
||||
CurDependency:=OldDependencyList;
|
||||
while CurDependency<>nil do begin
|
||||
NewDependency:=FindDependencyByNameInList(NewDependencyList,pdlRequires,
|
||||
CurDependency.PackageName);
|
||||
if NewDependency=nil then begin
|
||||
// this package will be removed
|
||||
Result:=Result+CurDependency.AsString+' (remove)'#13;
|
||||
end;
|
||||
CurDependency:=CurDependency.NextRequiresDependency;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
RebuildIDE: Boolean;
|
||||
PkgIDList: TList;
|
||||
NewFirstAutoInstallDependency: TPkgDependency;
|
||||
BuildIDEFlags: TBuildLazarusFlags;
|
||||
ok: boolean;
|
||||
Report: String;
|
||||
begin
|
||||
RebuildIDE:=false;
|
||||
PkgIDList:=nil;
|
||||
@ -371,7 +413,21 @@ begin
|
||||
ListPkgIDToDependencyList(PkgIDList,NewFirstAutoInstallDependency,
|
||||
pdlRequires,Self,true);
|
||||
|
||||
PackageGraph.SortDependencyListTopologically(NewFirstAutoInstallDependency,
|
||||
false);
|
||||
|
||||
// tell the user, which packages will stay, which will be removed and
|
||||
// which will be newly installed
|
||||
Report:=CreateChangeReport(FirstAutoInstallDependency,
|
||||
NewFirstAutoInstallDependency);
|
||||
if MessageDlg('Confirm new package set for the IDE',
|
||||
'This will happen:'#13#13
|
||||
+Report+#13'Continue?',mtConfirmation,[mbYes,mbNo],0)<>mrYes then exit;
|
||||
|
||||
// replace install list
|
||||
// TODO
|
||||
exit;
|
||||
|
||||
FreeDependencyList(FirstAutoInstallDependency,pdlRequires);
|
||||
FirstAutoInstallDependency:=NewFirstAutoInstallDependency;
|
||||
NewFirstAutoInstallDependency:=nil;
|
||||
|
Loading…
Reference in New Issue
Block a user