You've already forked lazarus-ccr
RxFPC:RxToolpanel - fix AV on add separator
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6757 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -352,6 +352,7 @@ begin
|
|||||||
|
|
||||||
UpdateStates;
|
UpdateStates;
|
||||||
FToolPanel.ReAlign;
|
FToolPanel.ReAlign;
|
||||||
|
FToolPanel.ReAlign;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TToolPanelSetupForm.CreateSetupForm(AToolPanel: TToolPanel);
|
constructor TToolPanelSetupForm.CreateSetupForm(AToolPanel: TToolPanel);
|
||||||
|
@ -935,6 +935,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
S1:=S + sItem + IntToStr(i);
|
S1:=S + sItem + IntToStr(i);
|
||||||
FPropertyStorageLink.Storage.WriteString(S1+sOptions, GetEnumProp(IT, 'ButtonStyle'));
|
FPropertyStorageLink.Storage.WriteString(S1+sOptions, GetEnumProp(IT, 'ButtonStyle'));
|
||||||
|
FPropertyStorageLink.Storage.WriteInteger(S1+sIndex, IT.Index);
|
||||||
if Assigned(IT.Action) then
|
if Assigned(IT.Action) then
|
||||||
begin
|
begin
|
||||||
FPropertyStorageLink.Storage.WriteString(S1+sAction, IT.Action.Name);
|
FPropertyStorageLink.Storage.WriteString(S1+sAction, IT.Action.Name);
|
||||||
@ -1070,6 +1071,9 @@ begin
|
|||||||
St.AddObject('S', P);
|
St.AddObject('S', P);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if Assigned(P) then
|
||||||
|
P.Index:= FPropertyStorageLink.Storage.ReadInteger(S1+sIndex, I);
|
||||||
end;
|
end;
|
||||||
for i:=0 to St.Count-1 do
|
for i:=0 to St.Count-1 do
|
||||||
begin
|
begin
|
||||||
@ -1284,6 +1288,7 @@ function TToolPanel.DoAlignChildControls(TheAlign: TAlign; AControl: TControl;
|
|||||||
var
|
var
|
||||||
TI: TToolbarItem;
|
TI: TToolbarItem;
|
||||||
I, L: Integer;
|
I, L: Integer;
|
||||||
|
S: String;
|
||||||
begin
|
begin
|
||||||
if TheAlign = alCustom then
|
if TheAlign = alCustom then
|
||||||
begin
|
begin
|
||||||
@ -1295,6 +1300,7 @@ begin
|
|||||||
for i:=0 to FToolbarItems.Count-1 do
|
for i:=0 to FToolbarItems.Count-1 do
|
||||||
begin
|
begin
|
||||||
TI:=FToolbarItems[i];
|
TI:=FToolbarItems[i];
|
||||||
|
S:=TI.GetDisplayName;
|
||||||
if TI.Visible and Assigned(TI.FButton) then
|
if TI.Visible and Assigned(TI.FButton) then
|
||||||
begin
|
begin
|
||||||
TI.FButton.SetBounds(L, FInternalSpacing, TI.FIntWidth, TI.FIntHeight);
|
TI.FButton.SetBounds(L, FInternalSpacing, TI.FIntWidth, TI.FIntHeight);
|
||||||
@ -1400,7 +1406,7 @@ end;
|
|||||||
|
|
||||||
procedure TToolbarItem.SetAction(const AValue: TBasicAction);
|
procedure TToolbarItem.SetAction(const AValue: TBasicAction);
|
||||||
begin
|
begin
|
||||||
if FButton.Action<>AValue then
|
if Assigned(FButton) and (FButton.Action<>AValue) then
|
||||||
begin
|
begin
|
||||||
FButton.Action:=AValue;
|
FButton.Action:=AValue;
|
||||||
if not (csLoading in TToolbarItems(Collection).FToolPanel.ComponentState) then
|
if not (csLoading in TToolbarItems(Collection).FToolPanel.ComponentState) then
|
||||||
@ -1411,7 +1417,7 @@ end;
|
|||||||
|
|
||||||
procedure TToolbarItem.SetButtonStyle(const AValue: TToolbarButtonStyle);
|
procedure TToolbarItem.SetButtonStyle(const AValue: TToolbarButtonStyle);
|
||||||
begin
|
begin
|
||||||
if FButton.FToolbarButtonStyle<>AValue then
|
if Assigned(FButton) and (FButton.FToolbarButtonStyle<>AValue) then
|
||||||
begin
|
begin
|
||||||
FButton.FToolbarButtonStyle:=AValue;
|
FButton.FToolbarButtonStyle:=AValue;
|
||||||
TToolbarItems(Collection).FToolPanel.ReAlignToolBtn;
|
TToolbarItems(Collection).FToolPanel.ReAlignToolBtn;
|
||||||
@ -1420,7 +1426,7 @@ end;
|
|||||||
|
|
||||||
procedure TToolbarItem.SetDropDownMenu(const AValue: TPopupMenu);
|
procedure TToolbarItem.SetDropDownMenu(const AValue: TPopupMenu);
|
||||||
begin
|
begin
|
||||||
if FButton.FDropDownMenu<>AValue then
|
if Assigned(FButton) and (FButton.FDropDownMenu<>AValue) then
|
||||||
begin
|
begin
|
||||||
FButton.FDropDownMenu:=AValue;
|
FButton.FDropDownMenu:=AValue;
|
||||||
FButton.Invalidate;
|
FButton.Invalidate;
|
||||||
@ -1429,31 +1435,25 @@ end;
|
|||||||
|
|
||||||
procedure TToolbarItem.SetGroupIndex(const AValue: Integer);
|
procedure TToolbarItem.SetGroupIndex(const AValue: Integer);
|
||||||
begin
|
begin
|
||||||
FButton.GroupIndex:=AValue;
|
if Assigned(FButton) and (FButton.GroupIndex <> AValue) then
|
||||||
end;
|
|
||||||
(*
|
|
||||||
procedure TToolbarItem.SetHeight(const AValue: Integer);
|
|
||||||
begin
|
begin
|
||||||
FButton.Height:=AValue;
|
FButton.GroupIndex:=AValue;
|
||||||
|
FButton.Invalidate;
|
||||||
end;
|
end;
|
||||||
*)
|
end;
|
||||||
|
|
||||||
procedure TToolbarItem.SetLayout(const AValue: TButtonLayout);
|
procedure TToolbarItem.SetLayout(const AValue: TButtonLayout);
|
||||||
|
begin
|
||||||
|
if Assigned(FButton) and (FButton.Layout<>AValue) then
|
||||||
begin
|
begin
|
||||||
FButton.Layout:=AValue;
|
FButton.Layout:=AValue;
|
||||||
TToolbarItems(Collection).FToolPanel.ReAlignToolBtn;
|
TToolbarItems(Collection).FToolPanel.ReAlignToolBtn;
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
procedure TToolbarItem.SetLeft(const AValue: Integer);
|
|
||||||
begin
|
|
||||||
if csLoading in TToolbarItems(Collection).FToolPanel.ComponentState then
|
|
||||||
FSaveLeft:=AValue
|
|
||||||
else
|
|
||||||
FButton.Left:=AValue;
|
|
||||||
end;
|
end;
|
||||||
*)
|
|
||||||
procedure TToolbarItem.SetShowCaption(const AValue: boolean);
|
procedure TToolbarItem.SetShowCaption(const AValue: boolean);
|
||||||
begin
|
begin
|
||||||
if FButton.ShowCaption<>AValue then
|
if Assigned(FButton) and (FButton.ShowCaption<>AValue) then
|
||||||
begin
|
begin
|
||||||
FButton.ShowCaption:=AValue;
|
FButton.ShowCaption:=AValue;
|
||||||
if not (csLoading in TToolbarItems(Collection).FToolPanel.ComponentState) then
|
if not (csLoading in TToolbarItems(Collection).FToolPanel.ComponentState) then
|
||||||
@ -1463,89 +1463,83 @@ end;
|
|||||||
|
|
||||||
procedure TToolbarItem.SetTag(const AValue: Longint);
|
procedure TToolbarItem.SetTag(const AValue: Longint);
|
||||||
begin
|
begin
|
||||||
|
if Assigned(FButton) and (FButton.Tag<>AValue) then
|
||||||
FButton.Tag:=AValue;
|
FButton.Tag:=AValue;
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
procedure TToolbarItem.SetTop(const AValue: Integer);
|
|
||||||
begin
|
|
||||||
FButton.Top:=AValue;
|
|
||||||
end;
|
|
||||||
*)
|
|
||||||
function TToolbarItem.GetAction: TBasicAction;
|
function TToolbarItem.GetAction: TBasicAction;
|
||||||
begin
|
begin
|
||||||
Result:=FButton.Action;
|
if Assigned(FButton) then
|
||||||
|
Result:=FButton.Action
|
||||||
|
else
|
||||||
|
Result:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
|
||||||
function TToolbarItem.GetAutoSize: boolean;
|
|
||||||
begin
|
|
||||||
Result:=FButton.FAutoSize;
|
|
||||||
end;
|
|
||||||
}
|
|
||||||
function TToolbarItem.GetButtonStyle: TToolbarButtonStyle;
|
function TToolbarItem.GetButtonStyle: TToolbarButtonStyle;
|
||||||
begin
|
begin
|
||||||
Result:=FButton.FToolbarButtonStyle;
|
if Assigned(FButton) then
|
||||||
|
Result:=FButton.FToolbarButtonStyle
|
||||||
|
else
|
||||||
|
Result:=tbrButton;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TToolbarItem.GetDropDownMenu: TPopupMenu;
|
function TToolbarItem.GetDropDownMenu: TPopupMenu;
|
||||||
begin
|
begin
|
||||||
Result:=FButton.FDropDownMenu;
|
if Assigned(FButton) then
|
||||||
|
Result:=FButton.FDropDownMenu
|
||||||
|
else
|
||||||
|
Result:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TToolbarItem.GetGroupIndex: Integer;
|
function TToolbarItem.GetGroupIndex: Integer;
|
||||||
begin
|
begin
|
||||||
Result:=FButton.GroupIndex;
|
if Assigned(FButton) then
|
||||||
|
Result:=FButton.GroupIndex
|
||||||
|
else
|
||||||
|
Result:=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TToolbarItem.GetLayout: TButtonLayout;
|
function TToolbarItem.GetLayout: TButtonLayout;
|
||||||
begin
|
begin
|
||||||
Result:=FButton.Layout;
|
if Assigned(FButton) then
|
||||||
|
Result:=FButton.Layout
|
||||||
|
else
|
||||||
|
Result:=blGlyphLeft;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TToolbarItem.GetShowCaption: boolean;
|
function TToolbarItem.GetShowCaption: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=FButton.ShowCaption;
|
if Assigned(FButton) then
|
||||||
|
Result:=FButton.ShowCaption
|
||||||
|
else
|
||||||
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TToolbarItem.GetTag: Longint;
|
function TToolbarItem.GetTag: Longint;
|
||||||
begin
|
begin
|
||||||
Result:=FButton.Tag;
|
if Assigned(FButton) then
|
||||||
|
Result:=FButton.Tag
|
||||||
|
else
|
||||||
|
Result:=0;
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
function TToolbarItem.GetTop: Integer;
|
|
||||||
begin
|
|
||||||
Result:=FButton.Top;
|
|
||||||
end;
|
|
||||||
*)
|
|
||||||
function TToolbarItem.GetVisible: boolean;
|
function TToolbarItem.GetVisible: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=FButton.Visible;
|
if Assigned(FButton) then
|
||||||
|
Result:=FButton.Visible
|
||||||
|
else
|
||||||
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
function TToolbarItem.GetWidth: Integer;
|
|
||||||
begin
|
|
||||||
Result:=FButton.Width;
|
|
||||||
end;
|
|
||||||
*)
|
|
||||||
procedure TToolbarItem.SetVisible(const AValue: boolean);
|
procedure TToolbarItem.SetVisible(const AValue: boolean);
|
||||||
begin
|
begin
|
||||||
if FButton.Visible<>AValue then
|
if Assigned(FButton) and (FButton.Visible<>AValue) then
|
||||||
begin
|
begin
|
||||||
FButton.Visible:=AValue;
|
FButton.Visible:=AValue;
|
||||||
FButton.Invalidate;
|
FButton.Invalidate;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
procedure TToolbarItem.SetWidth(const AValue: Integer);
|
|
||||||
begin
|
|
||||||
FButton.Width:=AValue;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TToolbarItem.UpdateLeftAfterLoad;
|
|
||||||
begin
|
|
||||||
FButton.Left:=FSaveLeft;
|
|
||||||
end;
|
|
||||||
*)
|
|
||||||
|
|
||||||
procedure TToolbarItem.InternalCalcSize;
|
procedure TToolbarItem.InternalCalcSize;
|
||||||
begin
|
begin
|
||||||
@ -1603,6 +1597,7 @@ var
|
|||||||
TB:TToolPanel;
|
TB:TToolPanel;
|
||||||
begin
|
begin
|
||||||
inherited Create(ACollection);
|
inherited Create(ACollection);
|
||||||
|
|
||||||
TB:=TToolbarItems(ACollection).FToolPanel;
|
TB:=TToolbarItems(ACollection).FToolPanel;
|
||||||
|
|
||||||
TB.DisableAlign;
|
TB.DisableAlign;
|
||||||
@ -1616,6 +1611,7 @@ begin
|
|||||||
FButton.FOwnerItem:=Self;
|
FButton.FOwnerItem:=Self;
|
||||||
FButton.FFullPush:=true;
|
FButton.FFullPush:=true;
|
||||||
FButton.ParentColor:=true;
|
FButton.ParentColor:=true;
|
||||||
|
|
||||||
TB.EnableAlign;
|
TB.EnableAlign;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user