IDE: compiling a package now shows it in the MainBar caption, building the IDE does not save virtual projects

git-svn-id: trunk@10837 -
This commit is contained in:
mattias 2007-03-31 12:41:20 +00:00
parent 093bf3361f
commit 6b9944e3a0
8 changed files with 87 additions and 38 deletions

View File

@ -7182,20 +7182,23 @@ begin
if DoCheckFilesOnDisk(true) in [mrCancel,mrAbort] then exit;
// check that all new units are saved first to get valid filenames
// (this can alter the mainunit: e.g. used unit names)
for i:=0 to Project1.UnitCount-1 do begin
AnUnitInfo:=Project1.Units[i];
if (AnUnitInfo.Loaded) and (AnUnitInfo.IsVirtual)
and (Project1.MainUnitID<>i) then begin
SaveFileFlags:=[sfSaveAs,sfProjectSaving]
+[sfCheckAmbiguousFiles]*Flags;
if sfSaveToTestDir in Flags then begin
if AnUnitInfo.IsPartOfProject or AnUnitInfo.IsVirtual then
Include(SaveFileFlags,sfSaveToTestDir);
if (not Project1.IsVirtual) or (not (sfDoNotSaveVirtualFiles in Flags)) then
begin
// check that all new units are saved first to get valid filenames
// (this can alter the mainunit: e.g. used unit names)
for i:=0 to Project1.UnitCount-1 do begin
AnUnitInfo:=Project1.Units[i];
if (AnUnitInfo.Loaded) and (AnUnitInfo.IsVirtual)
and (Project1.MainUnitID<>i) then begin
SaveFileFlags:=[sfSaveAs,sfProjectSaving]
+[sfCheckAmbiguousFiles]*Flags;
if sfSaveToTestDir in Flags then begin
if AnUnitInfo.IsPartOfProject or AnUnitInfo.IsVirtual then
Include(SaveFileFlags,sfSaveToTestDir);
end;
Result:=DoSaveEditorFile(AnUnitInfo.EditorIndex,SaveFileFlags);
if (Result=mrAbort) or (Result=mrCancel) then exit;
end;
Result:=DoSaveEditorFile(AnUnitInfo.EditorIndex,SaveFileFlags);
if (Result=mrAbort) or (Result=mrCancel) then exit;
end;
end;
@ -7213,7 +7216,9 @@ begin
// save project specific settings of the source editor
SaveSourceEditorProjectSpecificSettings;
if Project1.IsVirtual then Include(Flags,sfSaveAs);
if Project1.IsVirtual
and (not (sfDoNotSaveVirtualFiles in Flags)) then
Include(Flags,sfSaveAs);
if ([sfSaveAs,sfSaveToTestDir]*Flags=[sfSaveAs]) then begin
// let user choose a filename
Result:=DoShowSaveProjectAsDialog;
@ -7224,7 +7229,8 @@ begin
DoUpdateProjectResourceInfo;
// save project info file
if not (sfSaveToTestDir in Flags) then begin
if (not (sfSaveToTestDir in Flags))
and (not Project1.IsVirtual) then begin
Result:=Project1.WriteProject([],'');
if Result=mrAbort then exit;
EnvironmentOptions.LastSavedProjectFile:=Project1.ProjectInfoFile;
@ -7236,7 +7242,7 @@ begin
end;
// save main source
if MainUnitInfo<>nil then begin
if (MainUnitInfo<>nil) and (not MainUnitInfo.IsVirtual) then begin
if MainUnitInfo.Loaded then begin
// loaded in source editor
Result:=DoSaveEditorFile(MainUnitInfo.EditorIndex,
@ -7271,10 +7277,12 @@ begin
or (Project1.MainUnitInfo.EditorIndex<>i) then begin
SaveFileFlags:=[sfProjectSaving]
+Flags*[sfCheckAmbiguousFiles];
if (sfSaveToTestDir in Flags) then begin
AnUnitInfo:=Project1.UnitWithEditorIndex(i);
if AnUnitInfo.IsVirtual then
Include(SaveFileFlags,sfSaveToTestDir);
AnUnitInfo:=Project1.UnitWithEditorIndex(i);
if AnUnitInfo.IsVirtual then begin
if (sfSaveToTestDir in Flags) then
Include(SaveFileFlags,sfSaveToTestDir)
else
continue;
end;
Result:=DoSaveEditorFile(i,SaveFileFlags);
if Result=mrAbort then exit;
@ -8085,8 +8093,8 @@ begin
and (not (pfAlwaysBuild in Project1.Flags))
then begin
Result:=DoCheckIfProjectNeedsCompilation(Project1,
CompilerFilename,CompilerParams,
SrcFilename);
CompilerFilename,CompilerParams,
SrcFilename);
if Result=mrNo then begin
Result:=mrOk;
exit;
@ -8446,7 +8454,7 @@ begin
exit;
end;
Result:=DoSaveAll([sfCheckAmbiguousFiles]);
Result:=DoSaveAll([sfDoNotSaveVirtualFiles]);
if Result<>mrOk then exit;
MessagesView.BeginBlock;
@ -9367,13 +9375,17 @@ var NewCaption: string;
begin
if MainIDEBar=nil then exit;
NewCaption := Format(lisLazarusEditorV, [GetLazarusVersionString]);
if Project1<>nil then begin
if Project1.Title<>'' then
NewCaption:=NewCaption +' - '+Project1.Title
else if Project1.ProjectInfoFile<>'' then
NewCaption:=NewCaption+' - '+ExtractFileName(Project1.ProjectInfoFile)
else
NewCaption:=Format(lisnewProject, [NewCaption])
if MainBarSubTitle<>'' then begin
NewCaption:=NewCaption+' - '+MainBarSubTitle;
end else begin
if Project1<>nil then begin
if Project1.Title<>'' then
NewCaption:=NewCaption +' - '+Project1.Title
else if Project1.ProjectInfoFile<>'' then
NewCaption:=NewCaption+' - '+ExtractFileName(Project1.ProjectInfoFile)
else
NewCaption:=Format(lisnewProject, [NewCaption])
end;
end;
case ToolStatus of
itBuilder: NewCaption:=Format(liscompiling, [NewCaption]);

View File

@ -79,6 +79,8 @@ type
protected
OwningComponent: TComponent;
function GetMainBar: TComponent; override;
function CreateMenuSeparator : TMenuItem;
procedure CreateMenuItem(Section: TIDEMenuSection;
var MenuItem: TIDEMenuCommand;
@ -249,6 +251,11 @@ begin
ActiveUnitInfo:=AnUnitInfo;
end;
function TMainIDEBase.GetMainBar: TComponent;
begin
Result:=MainIDEBar;
end;
function TMainIDEBase.CreateMenuSeparator : TMenuItem;
begin
Result := TMenuItem.Create(MainIDEBar);

View File

@ -126,6 +126,7 @@ type
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure SetMainBarSubTitle(const AValue: string); override;
procedure UpdateCaption; virtual; abstract;
procedure HideIDE; virtual; abstract;
procedure UnhideIDE; virtual; abstract;
@ -211,7 +212,8 @@ const
'sfSaveToTestDir',
'sfProjectSaving',
'sfCheckAmbiguousFiles',
'sfSaveNonProjectFiles'
'sfSaveNonProjectFiles',
'sfDoNotSaveVirtualFiles'
);
function OpenFlagsToString(Flags: TOpenFlags): string;
@ -316,6 +318,13 @@ begin
MainIDEInterface:=nil;
end;
procedure TMainIDEInterface.SetMainBarSubTitle(const AValue: string);
begin
if MainBarSubTitle=AValue then exit;
inherited SetMainBarSubTitle(AValue);
UpdateCaption;
end;
function TMainIDEInterface.GetPrimaryConfigPath: String;
begin
Result:=LazConf.GetPrimaryConfigPath;

View File

@ -66,7 +66,8 @@ type
sfSaveToTestDir,
sfProjectSaving,
sfCheckAmbiguousFiles,
sfSaveNonProjectFiles
sfSaveNonProjectFiles,
sfDoNotSaveVirtualFiles
);
TSaveFlags = set of TSaveFlag;
@ -125,6 +126,7 @@ type
TLazIDEInterface = class(TComponent)
private
FLazarusIDEHandlers: array[TLazarusIDEHandlerType] of TMethodList;
FMainBarSubTitle: string;
procedure AddHandler(HandlerType: TLazarusIDEHandlerType;
const AMethod: TMethod; AsLast: boolean = false);
procedure RemoveHandler(HandlerType: TLazarusIDEHandlerType;
@ -134,10 +136,15 @@ type
procedure DoCallNotifyHandler(HandlerType: TLazarusIDEHandlerType);
function DoCallModalFunctionHandler(HandlerType: TLazarusIDEHandlerType
): TModalResult;
procedure SetMainBarSubTitle(const AValue: string); virtual;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
// the main window with the IDE menu
function GetMainBar: TComponent; virtual; abstract;
property MainBarSubTitle: string read FMainBarSubTitle write SetMainBarSubTitle;
// find file
function FindUnitFile(const AFilename: string): string; virtual; abstract;
function FindSourceFile(const AFilename, BaseDirectory: string;
@ -237,6 +244,12 @@ begin
FLazarusIDEHandlers[HandlerType].Remove(AMethod);
end;
procedure TLazIDEInterface.SetMainBarSubTitle(const AValue: string);
begin
if FMainBarSubTitle=AValue then exit;
FMainBarSubTitle:=AValue;
end;
procedure TLazIDEInterface.DoCallNotifyHandler(
HandlerType: TLazarusIDEHandlerType);
begin

View File

@ -555,6 +555,7 @@ type
TCustomFormClass = class of TCustomForm;
{ TForm }
TForm = class(TCustomForm)

View File

@ -414,7 +414,8 @@ begin
if Message.Status = 0 then
begin
if Message.Show then begin
if FActiveControl = nil then begin
if (FActiveControl = nil) and (Parent=nil) then begin
// automatically choose a control to focus
FActiveControl := FindFirstControl;
{$IFDEF VerboseFocus}
DebugLn('TCustomForm.WMShowWindow Set FActiveControl := FindFirstControl = ',DbgSName(FActiveControl));
@ -1754,7 +1755,7 @@ begin
inherited Loaded;
if FMenu<>nil then
FMenu.HandleNeeded;
if ActiveControl <> nil then
if (ActiveControl <> nil) and (Parent=nil) then
begin
Control := ActiveControl;
{$IFDEF VerboseFocus}

View File

@ -1639,7 +1639,7 @@ var
begin
if wcfAligningControls in FWinControlFlags then exit;
Include(FWinControlFlags,wcfAligningControls);
// debugln('TWinControl.AlignControls ',DbgSName(Self));
//debugln('TWinControl.AlignControls ',DbgSName(Self));
// unset all align needed flags
Exclude(FWinControlFlags,wcfReAlignNeeded);

View File

@ -52,6 +52,8 @@ uses
CodeToolManager,
// IDEIntf,
SrcEditorIntf, IDEExternToolIntf, IDEDialogs, IDEMsgIntf, PackageIntf,
LazIDEIntf,
// package registration
LazarusPackageIntf,
// IDE
LazarusIDEStrConsts, IDEProcs, LazConf, TransferMacros, DialogProcs,
@ -2508,13 +2510,15 @@ begin
end;
end;
// auto increase version
// ToDo
BlockBegan:=IDEMessagesWindow<>nil;
if BlockBegan then
IDEMessagesWindow.BeginBlock;
try
if (LazarusIDE<>nil) then
LazarusIDE.MainBarSubTitle:=APackage.Name;
// auto increase version
// ToDo
Result:=PreparePackageOutputDirectory(APackage,pcfCleanCompile in Flags);
if Result<>mrOk then begin
DebugLn('TLazPackageGraph.CompilePackage PreparePackageOutputDirectory failed: ',APackage.IDAsString);
@ -2634,6 +2638,8 @@ begin
end;
end;
finally
if (LazarusIDE<>nil) then
LazarusIDE.MainBarSubTitle:='';
if BlockBegan and (IDEMessagesWindow<>nil) then
IDEMessagesWindow.EndBlock;
if Result<>mrOk then begin