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