LCL: TButtonPanel: fixed updating size after changing bounds, small optimizations

git-svn-id: trunk@24572 -
This commit is contained in:
mattias 2010-04-11 08:58:36 +00:00
parent 21c09ad7e9
commit cbcaf635e4
3 changed files with 127 additions and 101 deletions

View File

@ -433,7 +433,6 @@ procedure TExternHelpOptions.UpdateHelpDB;
i: Integer;
HelpNode: THelpNode;
ItemFilename: String;
IsDirectory: Boolean;
SrcFilter: THelpDBISourceFile;
begin
if (Item.Filename<>'') and (Item.URL<>'') then begin
@ -441,9 +440,7 @@ procedure TExternHelpOptions.UpdateHelpDB;
// create a help node for this topic
HelpNode:=THelpNode.CreateURL(HelpDB,Item.Name,Item.URL);
// create a filter for the source file(s)
IsDirectory:=(ItemFilename[length(ItemFilename)]=PathDelim);
DebugLn(['RegisterItem ',IsDirectory,' ',ItemFilename]);
if IsDirectory then
if Item.IsDirectory then
SrcFilter:=THelpDBISourceDirectory.Create(HelpNode,
ItemFilename,'*.pp;*.pas',Item.WithSubDirectories)
else

View File

@ -1,27 +1,27 @@
inherited BreakPropertyDlg: TBreakPropertyDlg
Left = 586
Height = 383
Height = 447
Top = 151
Width = 414
Width = 443
HorzScrollBar.Page = 386
VertScrollBar.Page = 366
VertScrollBar.Range = 325
AutoScroll = False
ActiveControl = edtFilename
AutoSize = True
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = 'Breakpoint Properties'
ClientHeight = 383
ClientWidth = 414
ClientHeight = 447
ClientWidth = 443
Position = poScreenCenter
object lblFileName: TLabel[0]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = edtFilename
AnchorSideTop.Side = asrCenter
Left = 6
Height = 14
Height = 18
Top = 10
Width = 47
Width = 62
BorderSpacing.Around = 6
Caption = 'Filename:'
ParentColor = False
@ -31,9 +31,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = edtLine
AnchorSideTop.Side = asrCenter
Left = 6
Height = 14
Top = 39
Width = 24
Height = 18
Top = 43
Width = 31
BorderSpacing.Around = 6
Caption = 'Line:'
ParentColor = False
@ -43,9 +43,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = edtCondition
AnchorSideTop.Side = asrCenter
Left = 6
Height = 14
Top = 68
Width = 50
Height = 18
Top = 76
Width = 65
BorderSpacing.Around = 6
Caption = 'Condition:'
ParentColor = False
@ -55,9 +55,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = edtCounter
AnchorSideTop.Side = asrCenter
Left = 6
Height = 14
Top = 97
Width = 45
Height = 18
Top = 109
Width = 59
BorderSpacing.Around = 6
Caption = 'Hitcount:'
ParentColor = False
@ -67,9 +67,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = cmbGroup
AnchorSideTop.Side = asrCenter
Left = 6
Height = 14
Top = 154
Width = 34
Height = 18
Top = 176
Width = 44
BorderSpacing.Around = 6
Caption = 'Group:'
ParentColor = False
@ -79,9 +79,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = edtAutocontinueMS
AnchorSideTop.Side = asrCenter
Left = 6
Height = 14
Top = 126
Width = 95
Height = 18
Top = 142
Width = 124
BorderSpacing.Around = 6
Caption = 'Auto continue after'
ParentColor = False
@ -91,10 +91,10 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = lblAutoContinue
AnchorSideTop.Side = asrCenter
Left = 179
Height = 14
Top = 126
Width = 22
Left = 208
Height = 18
Top = 142
Width = 31
BorderSpacing.Left = 6
Caption = '(ms)'
ParentColor = False
@ -105,9 +105,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = edtCounter
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 113
Height = 23
Top = 122
Left = 142
Height = 27
Top = 138
Width = 60
BorderSpacing.Left = 6
BorderSpacing.Around = 6
@ -121,9 +121,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 113
Height = 23
Top = 93
Left = 142
Height = 27
Top = 105
Width = 295
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
@ -138,9 +138,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 113
Height = 23
Top = 64
Left = 142
Height = 27
Top = 72
Width = 295
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
@ -154,9 +154,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = edtFilename
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 113
Height = 23
Top = 35
Left = 142
Height = 27
Top = 39
Width = 60
BorderSpacing.Left = 6
BorderSpacing.Around = 6
@ -171,8 +171,8 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 113
Height = 23
Left = 142
Height = 27
Top = 6
Width = 295
Anchors = [akTop, akLeft, akRight]
@ -190,14 +190,14 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 113
Height = 21
Top = 151
Left = 142
Height = 29
Top = 171
Width = 295
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Around = 6
ItemHeight = 13
ItemHeight = 0
TabOrder = 5
Text = 'cmbGroup'
end
@ -208,23 +208,23 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 163
Top = 178
Width = 402
Height = 185
Top = 206
Width = 431
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Actions'
ClientHeight = 145
ClientWidth = 398
ClientHeight = 166
ClientWidth = 427
TabOrder = 6
object chkActionBreak: TCheckBox
AnchorSideLeft.Control = gbActions
AnchorSideTop.Control = gbActions
Left = 6
Height = 17
Height = 22
Top = 6
Width = 45
Width = 61
BorderSpacing.Around = 6
Caption = 'Break'
TabOrder = 0
@ -234,9 +234,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = edtEnableGroups
AnchorSideTop.Side = asrCenter
Left = 6
Height = 17
Top = 32
Width = 82
Height = 22
Top = 36
Width = 110
BorderSpacing.Around = 6
Caption = 'Enable goups'
TabOrder = 1
@ -246,9 +246,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = edtDisableGroups
AnchorSideTop.Side = asrCenter
Left = 6
Height = 17
Top = 61
Width = 88
Height = 22
Top = 69
Width = 119
BorderSpacing.Around = 6
Caption = 'Disable groups'
TabOrder = 2
@ -259,16 +259,18 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = chkActionBreak
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 131
Height = 23
Top = 29
Width = 238
Left = 147
Height = 27
Top = 34
Width = 251
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 80
BorderSpacing.Top = 6
BorderSpacing.Bottom = 6
ButtonWidth = 23
CharCase = ecNormal
Enabled = False
MaxLength = 0
NumGlyphs = 1
TabOrder = 5
end
@ -278,16 +280,18 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = edtEnableGroups
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 131
Height = 23
Top = 58
Width = 238
Left = 147
Height = 27
Top = 67
Width = 251
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 80
BorderSpacing.Top = 6
BorderSpacing.Bottom = 6
ButtonWidth = 23
CharCase = ecNormal
Enabled = False
MaxLength = 0
NumGlyphs = 1
TabOrder = 6
end
@ -296,9 +300,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = edtEvalExpression
AnchorSideTop.Side = asrCenter
Left = 6
Height = 17
Top = 90
Width = 93
Height = 22
Top = 102
Width = 123
BorderSpacing.Around = 6
Caption = 'Eval expression'
Enabled = False
@ -309,9 +313,9 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Control = edtLogMessage
AnchorSideTop.Side = asrCenter
Left = 6
Height = 17
Top = 119
Width = 80
Height = 22
Top = 135
Width = 110
BorderSpacing.Around = 6
Caption = 'Log message'
Enabled = False
@ -324,10 +328,10 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = gbActions
AnchorSideRight.Side = asrBottom
Left = 131
Height = 23
Top = 87
Width = 261
Left = 147
Height = 27
Top = 100
Width = 274
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 80
BorderSpacing.Top = 6
@ -343,10 +347,10 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = gbActions
AnchorSideRight.Side = asrBottom
Left = 131
Height = 23
Top = 116
Width = 261
Left = 147
Height = 27
Top = 133
Width = 274
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 80
BorderSpacing.Top = 6
@ -363,11 +367,12 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 30
Top = 347
Width = 402
Height = 50
Top = 397
Width = 431
Align = alNone
Anchors = [akTop, akLeft, akRight]
AutoSize = False
TabOrder = 7
ShowButtons = [pbOK, pbCancel, pbHelp]
ShowBevel = False

View File

@ -148,9 +148,6 @@ procedure Register;
implementation
type
TCustomButtonAccess = class(TCustomButton);
const
DEFAULT_BUTTONPANEL_BORDERSPACING: TControlBorderSpacingDefault = (
Left:0; Top:0; Right:0; Bottom:0; Around:6;
@ -197,7 +194,7 @@ begin
Exit;
FShowButtons := Value;
InvalidatePreferredSize;
DoShowButtons;
end;
@ -224,6 +221,7 @@ procedure TCustomButtonPanel.SetShowGlyphs(Value: TPanelButtons);
begin
if FShowGlyphs = Value then Exit;
FShowGlyphs := Value;
InvalidatePreferredSize;
DoShowGlyphs;
end;
@ -231,6 +229,7 @@ procedure TCustomButtonPanel.SetSpacing(AValue: TSpacingSize);
begin
if FSpacing = AValue then Exit;
FSpacing := AValue;
InvalidatePreferredSize;
ReAlign;
end;
@ -270,7 +269,7 @@ begin
for i := 0 to ControlCount - 1 do
begin
if not (Controls[i] is TCustomButton) then Continue;
TCustomButtonAccess(Controls[i]).CalculatePreferredSize(BtnWidth, BtnHeight, True);
Controls[i].GetPreferredSize(BtnWidth, BtnHeight, True);
if Align in [alTop, alBottom] then
Controls[i].Width := BtnWidth;
if Align in [alLeft, alRight] then
@ -285,8 +284,10 @@ end;
procedure TCustomButtonPanel.CalculatePreferredSize(var PreferredWidth,
PreferredHeight: integer; WithThemeSpace: Boolean);
begin
{$IFNDEF OldAutoSize}
if HandleAllocated then
begin
{$ENDIF}
UpdateSizes;
if Align in [alTop, alBottom] then
begin
@ -301,8 +302,10 @@ begin
if ShowBevel then
inc(PreferredWidth, Spacing + FBevel.Width);
end;
{$IFNDEF OldAutoSize}
ReAlign;
end;
{$ENDIF}
end;
procedure TCustomButtonPanel.UpdateButtonOrder;
@ -330,10 +333,21 @@ end;
procedure TCustomButtonPanel.SetAlign(Value: TAlign);
begin
inherited SetAlign(Value);
UpdateBevel;
UpdateSizes;
Realign;
{$IFNDEF OldAutoSize}
DisableAutoSizing;
{$ENDIF}
try
inherited SetAlign(Value);
UpdateBevel;
{$IFNDEF OldAutoSize}
UpdateSizes;
Realign;
{$ENDIF}
finally
{$IFNDEF OldAutoSize}
EnableAutoSizing;
{$ENDIF}
end;
end;
procedure TCustomButtonPanel.CMAppShowBtnGlyphChanged(var Message: TLMessage);
@ -380,19 +394,29 @@ begin
Exit;
end;
FBevel := TBevel.Create(Self);
FBevel.Parent := Self;
FBevel.Name := 'Bevel';
FBevel.Align := alCustom;
{$IFNDEF OldAutoSize}
DisableAutoSizing;
{$ENDIF}
try
FBevel := TBevel.Create(Self);
FBevel.Parent := Self;
FBevel.Name := 'Bevel';
FBevel.Align := alCustom;
UpdateBevel;
UpdateBevel;
finally
{$IFNDEF OldAutoSize}
EnableAutoSizing;
{$ENDIF}
end;
end;
procedure TCustomButtonPanel.Loaded;
begin
inherited Loaded;
{$IFDEF OldAutoSize}
Realign;
{$ENDIF}
end;
procedure TCustomButtonPanel.Notification(AComponent: TComponent;