diff --git a/components/gtk/gtkglarea/gtkopengl.lpk b/components/gtk/gtkglarea/gtkopengl.lpk
index 2b1f647856..76eab51637 100644
--- a/components/gtk/gtkglarea/gtkopengl.lpk
+++ b/components/gtk/gtkglarea/gtkopengl.lpk
@@ -3,6 +3,15 @@
+
+
+
+
+
+
+
+
+
@@ -50,13 +59,4 @@ Please make sure that you link to the right libgtkgl. If you accidently link to
-
-
-
-
-
-
-
-
-
diff --git a/ide/imexportcompileropts.pas b/ide/imexportcompileropts.pas
index f29c1ad349..e827f24869 100644
--- a/ide/imexportcompileropts.pas
+++ b/ide/imexportcompileropts.pas
@@ -83,6 +83,7 @@ function DoImportComilerOptions(CompOptsDialog: TfrmCompilerOptions;
CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
function DoExportComilerOptions(CompOptsDialog: TfrmCompilerOptions;
CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
+function GetXMLPathForCompilerOptionsInFile(const Filename: string): string;
implementation
@@ -106,6 +107,7 @@ function DoImportComilerOptions(CompOptsDialog: TfrmCompilerOptions;
var
XMLConfig: TXMLConfig;
FreeCompilerOpts: Boolean;
+ Path: String;
begin
Result:=mrCancel;
try
@@ -123,7 +125,8 @@ begin
CompilerOpts:=TBaseCompilerOptions.Create(nil);
FreeCompilerOpts:=true;
end;
- CompilerOpts.LoadFromXMLConfig(XMLConfig,'CompilerOptions/');
+ Path:=GetXMLPathForCompilerOptionsInFile(Filename);
+ CompilerOpts.LoadFromXMLConfig(XMLConfig,Path+'CompilerOptions/');
if CompOptsDialog<>nil then
CompOptsDialog.GetCompilerOptions(CompilerOpts);
finally
@@ -138,6 +141,7 @@ function DoExportComilerOptions(CompOptsDialog: TfrmCompilerOptions;
var
XMLConfig: TXMLConfig;
FreeCompilerOpts: Boolean;
+ Path: String;
begin
FreeCompilerOpts:=false;
if (CompOptsDialog<>nil) then begin
@@ -150,7 +154,8 @@ begin
try
XMLConfig:=TXMLConfig.Create(Filename);
try
- CompilerOpts.SaveToXMLConfig(XMLConfig,'CompilerOptions/');
+ Path:=GetXMLPathForCompilerOptionsInFile(Filename);
+ CompilerOpts.SaveToXMLConfig(XMLConfig,Path+'CompilerOptions/');
XMLConfig.Flush;
finally
XMLConfig.Free;
@@ -168,6 +173,33 @@ begin
end;
end;
+function ReadIntFromXMLConfig(const Filename, Path: string;
+ DefaultValue, ValueForReadError: integer): integer;
+var
+ XMLConfig: TXMLConfig;
+begin
+ Result:=ValueForReadError;
+ if FileExists(Filename) then
+ try
+ XMLConfig:=TXMLConfig.Create(Filename);
+ Result:=XMLConfig.GetValue(Path,DefaultValue);
+ except
+ Result:=ValueForReadError;
+ end;
+end;
+
+function GetXMLPathForCompilerOptionsInFile(const Filename: string): string;
+var
+ FileVersion: Integer;
+begin
+ Result:='';
+ if CompareFileExt(Filename,'.lpk',false)=0 then begin
+ FileVersion:=ReadIntFromXMLConfig(Filename,'Package/Version',0,2);
+ if FileVersion>=2 then
+ Result:='Package/';
+ end;
+end;
+
{ TImExportCompOptsDlg }
procedure TImExportCompOptsDlg.ImExportCompOptsDlgCREATE(Sender: TObject);
diff --git a/ide/main.pp b/ide/main.pp
index a585733153..1a0bd819d9 100644
--- a/ide/main.pp
+++ b/ide/main.pp
@@ -500,6 +500,7 @@ type
function DoOpenProjectFile(AFileName: string; Flags: TOpenFlags): TModalResult;
function DoPublishProject(Flags: TSaveFlags;
ShowDialog: boolean): TModalResult;
+ function DoImExportCompilerOptions(Sender: TObject): TModalResult; override;
function DoShowProjectInspector: TModalResult; override;
function DoAddActiveUnitToProject: TModalResult;
function DoRemoveFromProjectDialog: TModalResult;
@@ -5329,6 +5330,27 @@ begin
GetProjPublishDir);
end;
+function TMainIDE.DoImExportCompilerOptions(Sender: TObject): TModalResult;
+var
+ CompOptsDialog: TfrmCompilerOptions;
+ ImExportResult: TImExportCompOptsResult;
+ Filename: string;
+begin
+ Result:=mrOk;
+ if not (Sender is TfrmCompilerOptions) then
+ RaiseException('TMainIDE.OnCompilerOptionsImExport');
+ CompOptsDialog:=TfrmCompilerOptions(Sender);
+ ImExportResult:=ShowImExportCompilerOptionsDialog(
+ CompOptsDialog.CompilerOpts,Filename);
+ if (ImExportResult=iecorCancel) or (Filename='') then exit;
+ if ImExportResult=iecorImport then
+ Result:=DoImportComilerOptions(CompOptsDialog,CompOptsDialog.CompilerOpts,
+ Filename)
+ else if ImExportResult=iecorExport then
+ Result:=DoExportComilerOptions(CompOptsDialog,CompOptsDialog.CompilerOpts,
+ Filename);
+end;
+
function TMainIDE.DoShowProjectInspector: TModalResult;
begin
if ProjInspector=nil then begin
@@ -9215,20 +9237,8 @@ begin
end;
procedure TMainIDE.OnCompilerOptionsImExport(Sender: TObject);
-var
- CompOptsDialog: TfrmCompilerOptions;
- ImExportResult: TImExportCompOptsResult;
- Filename: string;
begin
- if not (Sender is TfrmCompilerOptions) then exit;
- CompOptsDialog:=TfrmCompilerOptions(Sender);
- ImExportResult:=ShowImExportCompilerOptionsDialog(
- CompOptsDialog.CompilerOpts,Filename);
- if (ImExportResult=iecorCancel) or (Filename='') then exit;
- if ImExportResult=iecorImport then
- DoImportComilerOptions(CompOptsDialog,CompOptsDialog.CompilerOpts,Filename)
- else if ImExportResult=iecorExport then
- DoExportComilerOptions(CompOptsDialog,CompOptsDialog.CompilerOpts,Filename);
+ DoImExportCompilerOptions(Sender);
end;
procedure TMainIDE.ProjInspectorOpen(Sender: TObject);
@@ -9782,6 +9792,9 @@ end.
{ =============================================================================
$Log$
+ Revision 1.647 2003/09/15 15:03:05 mattias
+ Import and Export of package compiler options
+
Revision 1.646 2003/09/10 12:13:48 mattias
implemented Import and Export of compiler options
diff --git a/ide/mainbar.pas b/ide/mainbar.pas
index 3ab8425917..8494c14b92 100644
--- a/ide/mainbar.pas
+++ b/ide/mainbar.pas
@@ -409,6 +409,7 @@ type
const AFilename: string): TModalResult; virtual;
function DoShowProjectInspector: TModalResult; virtual; abstract;
+ function DoImExportCompilerOptions(Sender: TObject): TModalResult; virtual; abstract;
function PrepareForCompile: TModalResult; virtual; abstract;
function DoBuildLazarus(Flags: TBuildLazarusFlags): TModalResult; virtual; abstract;
diff --git a/packager/packagedefs.pas b/packager/packagedefs.pas
index 4388336ee9..b4e0797291 100644
--- a/packager/packagedefs.pas
+++ b/packager/packagedefs.pas
@@ -684,7 +684,7 @@ type
const
- LazPkgXMLFileVersion = 1;
+ LazPkgXMLFileVersion = 2;
PkgFileTypeNames: array[TPkgFileType] of string = (
'pftUnit', 'pftVirtualUnit', 'pftLFM', 'pftLRS', 'pftInclude', 'pftText',
@@ -2068,7 +2068,6 @@ var
begin
Flags:=Flags+[lpfLoading];
FileVersion:=XMLConfig.GetValue(Path+'Version',0);
- if FileVersion=1 then ;
OldFilename:=Filename;
BeginUpdate;
Clear;
@@ -2076,10 +2075,11 @@ begin
LockModified;
PathDelimChanged:=XMLConfig.GetValue(Path+'PathDelim/Value','/')<>'/';
Name:=XMLConfig.GetValue(Path+'Name/Value','');
+ FPackageType:=LazPackageTypeIdentToType(XMLConfig.GetValue(Path+'Type/Value',
+ LazPackageTypeIdents[lptRunTime]));
FAuthor:=XMLConfig.GetValue(Path+'Author/Value','');
FAutoUpdate:=NameToAutoUpdatePolicy(
XMLConfig.GetValue(Path+'AutoUpdate/Value',''));
- FCompilerOptions.LoadFromXMLConfig(XMLConfig,Path+'CompilerOptions/');
FDescription:=XMLConfig.GetValue(Path+'Description/Value','');
FLicense:=XMLConfig.GetValue(Path+'License/Value','');
FVersion.LoadFromXMLConfig(XMLConfig,Path+'Version/',FileVersion);
@@ -2088,13 +2088,15 @@ begin
OutputStateFile:=SwitchPathDelims(
XMLConfig.GetValue(Path+'OutputStateFile/Value',''),
PathDelimChanged);
- FPackageType:=LazPackageTypeIdentToType(XMLConfig.GetValue(Path+'Type/Value',
- LazPackageTypeIdents[lptRunTime]));
LoadFiles(Path+'Files/',FFiles);
UpdateSourceDirectories;
LoadFlags(Path);
LoadPkgDependencyList(XMLConfig,Path+'RequiredPkgs/',
FFirstRequiredDependency,pdlRequires,Self,false);
+ if FileVersion<2 then
+ FCompilerOptions.LoadFromXMLConfig(XMLConfig,'CompilerOptions/')
+ else
+ FCompilerOptions.LoadFromXMLConfig(XMLConfig,Path+'CompilerOptions/');
FUsageOptions.LoadFromXMLConfig(XMLConfig,Path+'UsageOptions/',
PathDelimChanged);
fPublishOptions.LoadFromXMLConfig(XMLConfig,Path+'PublishOptions/',
@@ -2127,6 +2129,7 @@ procedure TLazPackage.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string
end;
begin
+ XMLConfig.SetValue(Path+'Version',LazPkgXMLFileVersion);
XMLConfig.SetDeleteValue(Path+'PathDelim/Value',PathDelim,'/');
XMLConfig.SetDeleteValue(Path+'Name/Value',FName,'');
XMLConfig.SetDeleteValue(Path+'Author/Value',FAuthor,'');
diff --git a/packager/packageeditor.pas b/packager/packageeditor.pas
index a007eac441..dc6f0fdf55 100644
--- a/packager/packageeditor.pas
+++ b/packager/packageeditor.pas
@@ -198,6 +198,7 @@ type
FOnFreeEditor: TOnFreePkgEditor;
FOnGetIDEFileInfo: TGetIDEFileStateEvent;
FOnGetUnitRegisterInfo: TOnGetUnitRegisterInfo;
+ FOnImExportCompilerOptions: TNotifyEvent;
FOnInstallPackage: TOnInstallPackage;
FOnOpenFile: TOnOpenFile;
FOnOpenPackage: TOnOpenPackage;
@@ -262,6 +263,8 @@ type
write FOnUninstallPackage;
property OnDeleteAmbigiousFiles: TOnDeleteAmbigiousFiles
read FOnDeleteAmbigiousFiles write FOnDeleteAmbigiousFiles;
+ property OnImExportCompilerOptions: TNotifyEvent
+ read FOnImExportCompilerOptions write FOnImExportCompilerOptions;
end;
var
@@ -1033,6 +1036,8 @@ var
begin
CompilerOptsDlg:=TfrmCompilerOptions.Create(Self);
CompilerOptsDlg.CompilerOpts:=LazPackage.CompilerOptions;
+ CompilerOptsDlg.OnImExportCompilerOptions:=
+ PackageEditors.OnImExportCompilerOptions;
with CompilerOptsDlg do begin
GetCompilerOptions;
Caption:=Format(lisPckEditCompilerOptionsForPackage, [LazPackage.IDAsString]
diff --git a/packager/pkgmanager.pas b/packager/pkgmanager.pas
index a734d22225..b80d228afc 100644
--- a/packager/pkgmanager.pas
+++ b/packager/pkgmanager.pas
@@ -82,6 +82,7 @@ type
procedure OnPackageEditorGetUnitRegisterInfo(Sender: TObject;
const AFilename: string; var TheUnitName: string;
var HasRegisterProc: boolean);
+ procedure OnPackageEditorImExportCompilerOptions(Sender: TObject);
// package graph
function PackageGraphExplorerOpenPackage(Sender: TObject;
APackage: TLazPackage): TModalResult;
@@ -401,6 +402,11 @@ begin
DoGetUnitRegisterInfo(AFilename,TheUnitName,HasRegisterProc,true);
end;
+procedure TPkgManager.OnPackageEditorImExportCompilerOptions(Sender: TObject);
+begin
+ MainIDE.DoImExportCompilerOptions(Sender);
+end;
+
function TPkgManager.OnPackageEditorOpenPackage(Sender: TObject;
APackage: TLazPackage): TModalResult;
begin
@@ -1369,6 +1375,7 @@ begin
PackageEditors.OnInstallPackage:=@OnPackageEditorInstallPackage;
PackageEditors.OnUninstallPackage:=@OnPackageEditorUninstallPackage;
PackageEditors.OnDeleteAmbigiousFiles:=@OnPackageEditorDeleteAmbigiousFiles;
+ PackageEditors.OnImExportCompilerOptions:=@OnPackageEditorImExportCompilerOptions;
// package macros
CodeToolBoss.DefineTree.MacroFunctions.AddExtended(