diff --git a/ide/main.pp b/ide/main.pp index 8ec4e389ef..4bf2c10638 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -2762,7 +2762,7 @@ var Begin NewProjectDesc:=nil; if ChooseNewProject(NewProjectDesc)<>mrOk then exit; - debugln('TMainIDE.mnuNewProjectClicked ',dbgsName(NewProjectDesc)); + //debugln('TMainIDE.mnuNewProjectClicked ',dbgsName(NewProjectDesc)); DoNewProject(NewProjectDesc); end; @@ -4718,6 +4718,7 @@ begin FallbackProjectDesc.InitProject(Result); end; + Result.MainProject:=true; Result.OnFileBackup:=@DoBackupFile; Result.OnLoadProjectInfo:=@OnLoadProjectInfoFromXMLConfig; Result.OnSaveProjectInfo:=@OnSaveProjectInfoToXMLConfig; @@ -6222,6 +6223,7 @@ Begin // (i.e. remove old project specific things and create new) IncreaseCompilerParseStamp; Project1.DefineTemplates.AllChanged; + Project1.DefineTemplates.Active:=true; finally Project1.EndUpdate; end; @@ -6231,7 +6233,7 @@ Begin Project1.Units[i].Modified:=false; Project1.Modified:=false; - DebugLn('TMainIDE.DoNewProject end '); + //DebugLn('TMainIDE.DoNewProject end '); Result:=mrOk; end; diff --git a/ide/project.pp b/ide/project.pp index 1db528b559..9ada3ea3b4 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -430,6 +430,7 @@ type FJumpHistory: TProjectJumpHistory; fLastReadLPIFileDate: TDateTime; fLastReadLPIFilename: string; + FMainProject: boolean; fMainUnitID: Integer; FOnBeginUpdate: TNotifyEvent; FOnEndUpdate: TEndUpdateProjectEvent; @@ -464,10 +465,12 @@ type CheckIfAllowed: boolean; var Allowed: boolean); procedure SetAutoOpenDesignerFormsDisabled(const AValue: boolean); procedure SetCompilerOptions(const AValue: TProjectCompilerOptions); + procedure SetMainProject(const AValue: boolean); procedure SetTargetFilename(const NewTargetFilename: string); procedure SetMainUnitID(const AValue: Integer); procedure UpdateProjectDirectory; procedure UpdateSourceDirectories; + procedure ClearSourceDirectories; procedure SourceDirectoriesChanged(Sender: TObject); protected function GetMainFile: TLazProjectFile; override; @@ -625,6 +628,7 @@ type property MainFilename: String read GetMainFilename; property MainUnitID: Integer read FMainUnitID write SetMainUnitID; property MainUnitInfo: TUnitInfo read GetMainUnitInfo; + property MainProject: boolean read FMainProject write SetMainProject; property OnBeginUpdate: TNotifyEvent read FOnBeginUpdate write FOnBeginUpdate; property OnEndUpdate: TEndUpdateProjectEvent read FOnEndUpdate write FOnEndUpdate; property OnFileBackup: TOnFileBackup read fOnFileBackup write fOnFileBackup; @@ -1876,7 +1880,7 @@ begin Modified := false; SessionModified := false; fProjectInfoFile := ''; - FSourceDirectories.Clear; + ClearSourceDirectories; UpdateProjectDirectory; FPublishOptions.Clear; FTargetFileExt := GetDefaultExecutableExt; @@ -2761,6 +2765,16 @@ begin inherited SetLazCompilerOptions(AValue); end; +procedure TProject.SetMainProject(const AValue: boolean); +begin + if MainProject=AValue then exit; + FMainProject:=AValue; + if MainProject then + SourceDirectories.AddFilename(VirtualDirectory) + else + SourceDirectories.RemoveFilename(VirtualDirectory); +end; + function TProject.JumpHistoryCheckPosition( APosition: TProjectJumpHistoryPosition): boolean; var i: integer; @@ -3001,7 +3015,7 @@ begin AnUnitInfo:=Units[i]; AnUnitInfo.FSourceDirectoryReferenced:=false; end; - fSourceDirectories.Clear; + ClearSourceDirectories; for i:=0 to Cnt-1 do begin AnUnitInfo:=Units[i]; AnUnitInfo.AutoReferenceSourceDir:=true; @@ -3010,6 +3024,13 @@ begin //DebugLn('TProject.UpdateSourceDirectories B ',UnitCount,' "',fSourceDirectories.CreateSearchPathFromAllFiles,'"'); end; +procedure TProject.ClearSourceDirectories; +begin + FSourceDirectories.Clear; + if MainProject then + FSourceDirectories.AddFilename(VirtualDirectory); +end; + procedure TProject.SourceDirectoriesChanged(Sender: TObject); begin FDefineTemplates.SourceDirectoriesChanged; @@ -3351,6 +3372,7 @@ begin // quick check if something has changed IDHasChanged:=fLastSourceDirsIDAsString<>Project.IDAsString; + //DebugLn('TProjectDefineTemplates.UpdateDefinesForSourceDirectories A'); if (fLastSourceDirectories<>nil) and (fLastSourceDirStamp=Project.SourceDirectories.TimeStamp) and (not IDHasChanged) then @@ -3359,6 +3381,7 @@ begin fLastSourceDirsIDAsString:=Project.IDAsString; NewSourceDirs:=Project.SourceDirectories.CreateFileList; + //DebugLn('TProjectDefineTemplates.UpdateDefinesForSourceDirectories B "',NewSourceDirs.Text,'"'); try // real check if something has changed if (fLastSourceDirectories<>nil) diff --git a/lcl/ldockctrl.pas b/lcl/ldockctrl.pas index 81e5df7703..9365e2030a 100644 --- a/lcl/ldockctrl.pas +++ b/lcl/ldockctrl.pas @@ -41,9 +41,9 @@ type TCustomLazDockingManager = class(TComponent) private - FDockerCount: Integer; FDockers: TFPList; FManager: TAnchoredDockManager; + function GetDockerCount: Integer; function GetDockers(Index: Integer): TCustomLazControlDocker; protected procedure Remove(Docker: TCustomLazControlDocker); @@ -56,7 +56,7 @@ type function CreateUniqueName(const AName: string; Ignore: TCustomLazControlDocker): string; property Manager: TAnchoredDockManager read FManager; - property DockerCount: Integer read FDockerCount; + property DockerCount: Integer read GetDockerCount; property Dockers[Index: Integer]: TCustomLazControlDocker read GetDockers; default; end; @@ -123,6 +123,7 @@ procedure TCustomLazControlDocker.SetManager( const AValue: TCustomLazDockingManager); begin if FManager=AValue then exit; + //DebugLn('TCustomLazControlDocker.SetManager Old=',DbgSName(Manager),' New=',DbgSName(AValue)); if FManager<>nil then FManager.Remove(Self); FManager:=AValue; if FManager<>nil then FManager.Add(Self); @@ -180,10 +181,12 @@ begin // fill the list of controls this control can dock to Dlg.DockControlComboBox.Text:=''; Dlg.DockControlComboBox.Items.BeginUpdate; + //DebugLn('TCustomLazControlDocker.ShowDockingEditor Self=',DockerName,' Manager.DockerCount=',dbgs(Manager.DockerCount)); try Dlg.DockControlComboBox.Items.Clear; for i:=0 to Manager.DockerCount-1 do begin CurDocker:=Manager.Dockers[i]; + //DebugLn('TCustomLazControlDocker.ShowDockingEditor Self=',DockerName,' CurDocker=',CurDocker.DockerName); if CurDocker=Self then continue; if CurDocker.Control=nil then continue; Dlg.DockControlComboBox.Items.Add(CurDocker.GetLocalizedName); @@ -313,6 +316,11 @@ begin Result:=TCustomLazControlDocker(FDockers[Index]); end; +function TCustomLazDockingManager.GetDockerCount: Integer; +begin + Result:=FDockers.Count; +end; + constructor TCustomLazDockingManager.Create(TheOwner: TComponent); begin inherited Create(TheOwner); diff --git a/lcl/ldockctrledit.lfm b/lcl/ldockctrledit.lfm index 052a1217c9..9017aca78a 100644 --- a/lcl/ldockctrledit.lfm +++ b/lcl/ldockctrledit.lfm @@ -17,11 +17,11 @@ object LazDockControlEditorDlg: TLazDockControlEditorDlg Caption = 'UndockGroupBox' ChildSizing.LeftRightSpacing = 5 ChildSizing.TopBottomSpacing = 5 - ClientHeight = 34 + ClientHeight = 19 ClientWidth = 291 TabOrder = 0 Left = 8 - Height = 51 + Height = 36 Top = 8 Width = 295 object UndockButton: TButton @@ -49,7 +49,7 @@ object LazDockControlEditorDlg: TLazDockControlEditorDlg AnchorSideTop.Control = UndockGroupBox Left = 8 Height = 207 - Top = 65 + Top = 50 Width = 295 object DockControlLabel: TLabel BorderSpacing.Around = 2 @@ -156,11 +156,12 @@ object LazDockControlEditorDlg: TLazDockControlEditorDlg BorderSpacing.Top = 10 BorderSpacing.InnerBorder = 2 Caption = 'CancelButton' + ModalResult = 2 TabOrder = 2 AnchorSideTop.Control = DockGroupBox Left = 112 Height = 26 - Top = 282 + Top = 267 Width = 85 end end diff --git a/lcl/ldockctrledit.lrs b/lcl/ldockctrledit.lrs index 8c34d03321..e618f023eb 100644 --- a/lcl/ldockctrledit.lrs +++ b/lcl/ldockctrledit.lrs @@ -8,8 +8,8 @@ LazarusResources.Add('TLazDockControlEditorDlg','FORMDATA',[ +'Left'#3#30#1#6'Height'#3'H'#1#3'Top'#3#202#0#5'Width'#3'6'#1#0#9'TGroupBox' +#14'UndockGroupBox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize' +#9#7'Caption'#6#14'UndockGroupBox'#28'ChildSizing.LeftRightSpacing'#2#5#28'C' - +'hildSizing.TopBottomSpacing'#2#5#12'ClientHeight'#2'"'#11'ClientWidth'#3'#' - +#1#8'TabOrder'#2#0#4'Left'#2#8#6'Height'#2'3'#3'Top'#2#8#5'Width'#3''''#1#0#7 + +'hildSizing.TopBottomSpacing'#2#5#12'ClientHeight'#2#19#11'ClientWidth'#3'#' + +#1#8'TabOrder'#2#0#4'Left'#2#8#6'Height'#2'$'#3'Top'#2#8#5'Width'#3''''#1#0#7 +'TButton'#12'UndockButton'#8'AutoSize'#9#25'BorderSpacing.InnerBorder'#2#2#7 +'Caption'#6#12'UndockButton'#7'OnClick'#7#17'UndockButtonClick'#8'TabOrder'#2 +#0#4'Left'#2#6#6'Height'#2#26#3'Top'#2#5#5'Width'#2'W'#0#0#0#9'TGroupBox'#12 @@ -17,7 +17,7 @@ LazarusResources.Add('TLazDockControlEditorDlg','FORMDATA',[ +'BorderSpacing.Top'#2#6#7'Caption'#6#12'DockGroupBox'#28'ChildSizing.LeftRig' +'htSpacing'#2#5#28'ChildSizing.TopBottomSpacing'#2#5#12'ClientHeight'#3#190#0 +#11'ClientWidth'#3'#'#1#8'TabOrder'#2#1#21'AnchorSideTop.Control'#7#14'Undoc' - +'kGroupBox'#4'Left'#2#8#6'Height'#3#207#0#3'Top'#2'A'#5'Width'#3''''#1#0#6'T' + +'kGroupBox'#4'Left'#2#8#6'Height'#3#207#0#3'Top'#2'2'#5'Width'#3''''#1#0#6'T' +'Label'#16'DockControlLabel'#20'BorderSpacing.Around'#2#2#7'Caption'#6#16'Do' +'ckControlLabel'#5'Color'#7#6'clNone'#11'ParentColor'#8#21'AnchorSideTop.Con' +'trol'#7#19'DockControlComboBox'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Lef' @@ -52,7 +52,7 @@ LazarusResources.Add('TLazDockControlEditorDlg','FORMDATA',[ +'horSideLeft.Control'#7#16'DockControlLabel'#4'Left'#2's'#6'Height'#2#25#3'T' +'op'#2#5#5'Width'#3#171#0#0#0#0#7'TButton'#12'CancelButton'#7'Anchors'#11#5 +'akTop'#0#8'AutoSize'#9#17'BorderSpacing.Top'#2#10#25'BorderSpacing.InnerBor' - +'der'#2#2#7'Caption'#6#12'CancelButton'#8'TabOrder'#2#2#21'AnchorSideTop.Con' - +'trol'#7#12'DockGroupBox'#4'Left'#2'p'#6'Height'#2#26#3'Top'#3#26#1#5'Width' - +#2'U'#0#0#0 + +'der'#2#2#7'Caption'#6#12'CancelButton'#11'ModalResult'#2#2#8'TabOrder'#2#2 + +#21'AnchorSideTop.Control'#7#12'DockGroupBox'#4'Left'#2'p'#6'Height'#2#26#3 + +'Top'#3#11#1#5'Width'#2'U'#0#0#0 ]);