diff --git a/designer/menueditor.pp b/designer/menueditor.pp index 7f16dd538e..fac61f7d38 100644 --- a/designer/menueditor.pp +++ b/designer/menueditor.pp @@ -297,8 +297,7 @@ var procedure ShowMenuEditor(aMenu: TMenu); begin - if (aMenu = nil) then - RaiseGDBException(lisMenuEditorShowMenuEditorTMenuParameterIsNil); + Assert(Assigned(aMenu), 'ShowMenuEditor: aMenu parameter is nil'); MenuDesigner.FGui.SetMenu(aMenu, nil); SetPopupModeParentForPropertyEditor(MenuDesigner.FGui); MenuDesigner.FGui.ShowOnTop; @@ -811,31 +810,24 @@ end; procedure TShadowMenu.RecursiveCreateShadows(aParentBox: TShadowBox; aMI: TMenuItem); var - j: integer; + i: integer; sb: TShadowBox; begin TShadowItem.CreateWithBoxAndItem(Self, aParentBox, aMI); - if (aMI.Count > 0) then - begin - sb:=TShadowBox.CreateWithParentBox(Self, aParentBox, aMI); - for j:=0 to aMI.Count-1 do - RecursiveCreateShadows(sb, aMI.Items[j]); - end; + if aMI.Count = 0 then Exit; + sb:=TShadowBox.CreateWithParentBox(Self, aParentBox, aMI); + for i:=0 to aMI.Count-1 do + RecursiveCreateShadows(sb, aMI.Items[i]); end; procedure TShadowMenu.CreateShadowBoxesAndItems; var i: integer; begin - if (FMenu.Items.Count > 0) then - begin - FRootBox:=TShadowBox.CreateWithParentBox(Self, nil, FMenu.Items); - for i:=0 to FMenu.Items.Count-1 do begin - if IsMainMenu and FMenu.Items[i].IsLine then - RaiseGDBException(lisMenuEditorSomeWidgetsetsDoNotAllowSeparatorsInTheMainMenubar); - RecursiveCreateShadows(FRootBox, FMenu.Items[i]); - end; - end; + if FMenu.Items.Count = 0 then Exit; + FRootBox:=TShadowBox.CreateWithParentBox(Self, nil, FMenu.Items); + for i:=0 to FMenu.Items.Count-1 do + RecursiveCreateShadows(FRootBox, FMenu.Items[i]); end; procedure TShadowMenu.DeleteChildlessShadowAndItem(anExistingSI: TShadowItem); diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index fd9ebe5774..1095bd5331 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -4870,14 +4870,11 @@ resourcestring lisMenuEditorShortcutsDAndAcceleratorKeysD = 'Shortcuts (%d) and Accelerator keys (%d)'; lisMenuEditorShortcutsUsedInS = 'Shortcuts used in %s'; lisMenuEditorShortcutsUsedInSD = 'Shortcuts used in %s (%d)'; - lisMenuEditorShowMenuEditorTMenuParameterIsNil = 'ShowMenuEditor: TMenu parameter is nil'; lisMenuEditorSInS = '"%s" in %s'; lisMenuEditorSIsAlreadyInUse = '"%s" is ' +'already in use in %s as a shortcut.' + sLineBreak + 'Try a different shortcut.'; lisMenuEditorSIsNotASufficientDescriptionPleaseExpand = 'Please expand: "%s" is not a ' +'sufficient Description'; - lisMenuEditorSomeWidgetsetsDoNotAllowSeparatorsInTheMainMenubar = 'Some ' - +'widgetsets do not allow separators in the main menubar'; lisMenuEditorSShortcuts = '%s: Shortcuts'; lisMenuEditorSShortcutsAndAcceleratorKeys = '%s: Shortcuts and accelerator keys'; lisMenuEditorSSSOnClickS = '%s.%s.%s - OnClick: %s';