diff --git a/ide/frames/compiler_modematrix.lfm b/ide/frames/compiler_modematrix.lfm index 9afdddabca..733c5af806 100644 --- a/ide/frames/compiler_modematrix.lfm +++ b/ide/frames/compiler_modematrix.lfm @@ -27,7 +27,7 @@ object CompOptModeMatrixFrame: TCompOptModeMatrixFrame ShowHint = True end object BMMMoveDownButton: TToolButton - Left = 26 + Left = 24 Top = 0 Caption = 'Down' OnClick = BMMMoveDownButtonClick @@ -35,7 +35,7 @@ object CompOptModeMatrixFrame: TCompOptModeMatrixFrame ShowHint = True end object BMMUndoButton: TToolButton - Left = 78 + Left = 74 Top = 0 Caption = 'Undo' OnClick = BMMUndoButtonClick @@ -43,7 +43,7 @@ object CompOptModeMatrixFrame: TCompOptModeMatrixFrame ShowHint = True end object BMMRedoToolButton: TToolButton - Left = 119 + Left = 111 Top = 0 Caption = 'Redo' OnClick = BMMRedoToolButtonClick @@ -51,36 +51,36 @@ object CompOptModeMatrixFrame: TCompOptModeMatrixFrame ShowHint = True end object BMMDeleteButton: TToolButton - Left = 408 + Left = 385 Top = 0 Caption = 'Delete' OnClick = BMMDeleteButtonClick ParentShowHint = False ShowHint = True end - object ToolButton1: TToolButton - Left = 68 + object MoveSepToolButton: TToolButton + Left = 64 Top = 0 Width = 10 - Caption = 'ToolButton1' + Caption = 'MoveSepToolButton' Style = tbsSeparator end - object ToolButton2: TToolButton - Left = 158 + object DoSepToolButton: TToolButton + Left = 148 Top = 0 Width = 10 - Caption = 'ToolButton2' + Caption = 'DoSepToolButton' Style = tbsSeparator end - object ToolButton3: TToolButton - Left = 398 + object AddOtherSepToolButton: TToolButton + Left = 375 Top = 0 Width = 10 - Caption = 'ToolButton3' + Caption = 'AddOtherSepToolButton' Style = tbsSeparator end object BMMAddOtherButton: TToolButton - Left = 315 + Left = 297 Top = 0 Caption = 'Add Other' DropdownMenu = BMMAddOtherPopupMenu @@ -88,17 +88,17 @@ object CompOptModeMatrixFrame: TCompOptModeMatrixFrame Style = tbsDropDown end object BMMAddLclWidgetButton: TToolButton - Left = 168 + Left = 158 Top = 0 Caption = 'Add LCLWidgetType' OnClick = BMMAddLclWidgetButtonClick Style = tbsDropDown end - object ToolButton4: TToolButton - Left = 305 + object LCLMacroSepToolButton: TToolButton + Left = 287 Top = 0 Width = 10 - Caption = 'ToolButton4' + Caption = 'LCLMacroSepToolButton' Style = tbsSeparator end end diff --git a/ide/frames/compiler_modematrix.pas b/ide/frames/compiler_modematrix.pas index 0c30c87bc0..3b78867358 100644 --- a/ide/frames/compiler_modematrix.pas +++ b/ide/frames/compiler_modematrix.pas @@ -24,7 +24,6 @@ Options frame for build mode matrix options. ToDo: - - add checkbox "Show build modes" when there is only one build mode - editor for targets - show pick list icon for type column - undo: combine changes while editing a cell @@ -60,11 +59,11 @@ type BMMAddOtherButton: TToolButton; BMMNewIDEMacroMenuItem: TMenuItem; BMMNewOutDirMenuItem: TMenuItem; - ToolButton1: TToolButton; - ToolButton2: TToolButton; - ToolButton3: TToolButton; + MoveSepToolButton: TToolButton; + DoSepToolButton: TToolButton; + AddOtherSepToolButton: TToolButton; BMMAddLclWidgetButton: TToolButton; - ToolButton4: TToolButton; + LCLMacroSepToolButton: TToolButton; procedure BMMDeleteButtonClick(Sender: TObject); procedure BMMMoveDownButtonClick(Sender: TObject); procedure BMMMoveUpButtonClick(Sender: TObject); @@ -617,25 +616,31 @@ var List: TStringList; MenuIndex: Integer; MacroMenuItem: TMenuItem; + PkgList: TFPList; begin LCLWidgetTypeMacro:=Nil; + PkgList:=nil; List:=TStringList.Create; try // First collect all macros from all used packages to a sorted list. - for i:=0 to PackageGraph.Count-1 do begin - Pkg:=PackageGraph[i]; - Macros:=Pkg.CompilerOptions.BuildMacros; - for j:=0 to Macros.Count-1 do begin - Macro:=Macros[j]; - if Macro.Identifier = 'LCLWidgetType' then - LCLWidgetTypeMacro:=Macro - else if IsValidIdent(Macro.Identifier) then - List.AddObject(Macro.Identifier,Macro); + PackageGraph.GetAllRequiredPackages(nil,LazProject.FirstRequiredDependency,PkgList); + if PkgList<>nil then begin + for i:=0 to PkgList.Count-1 do begin + Pkg:=TLazPackage(PkgList[i]); + Macros:=Pkg.CompilerOptions.BuildMacros; + for j:=0 to Macros.Count-1 do begin + Macro:=Macros[j]; + if Macro.Identifier = 'LCLWidgetType' then + LCLWidgetTypeMacro:=Macro + else if IsValidIdent(Macro.Identifier) then + List.AddObject(Macro.Identifier,Macro); + end; end; end; List.Sort; // LCLWidgetType gets its own button. BMMAddLclWidgetButton.Visible:=Assigned(LCLWidgetTypeMacro); + LCLMacroSepToolButton.Visible:=BMMAddLclWidgetButton.Visible; if Assigned(LCLWidgetTypeMacro) then AddLCLWidgetTypeValues(BMMAddLclWidgetPopupMenu, LCLWidgetTypeMacro); // Place other macros to the popup menu opened from "Add" button. @@ -650,6 +655,7 @@ begin AddMacroValues(MacroMenuItem, Macro); end; finally + PkgList.Free; List.Free; end; end; @@ -743,7 +749,7 @@ begin try Grid.StoreUndo; MatRow:=Grid.Matrix[aRow-1]; - debugln(['TCompOptModeMatrix.CreateNewOption ',DbgSName(MatRow),' ',MatRow.AsString]); + //debugln(['TCompOptModeMatrix.CreateNewOption ',DbgSName(MatRow),' ',MatRow.AsString]); if MatRow is TGroupedMatrixGroup then begin Group:=TGroupedMatrixGroup(MatRow); if Group.Group=nil then begin @@ -1147,7 +1153,6 @@ begin BMMAddOtherButton.Caption:=lisAdd; UpdateButtons; - FillMenus; end; destructor TCompOptModeMatrixFrame.Destroy; @@ -1181,7 +1186,7 @@ begin //debugln(['TCompOptModeMatrix.ReadSettings ',DbgSName(AOptions)]); if not (AOptions is TProjectCompilerOptions) then exit; CompOptions:=TProjectCompilerOptions(AOptions); - if FProject=CompOptions.LazProject then begin + if LazProject=CompOptions.LazProject then begin // options already loaded, only active compiler options are reloaded UpdateActiveMode; exit; @@ -1190,6 +1195,7 @@ begin fProject:=CompOptions.LazProject; UpdateModes(false); + FillMenus; // read IDE options AssignBuildMatrixOptionsToGroup(EnvironmentOptions.BuildMatrixOptions,