TToolBar: disabled using designtime resizes to set ButtonWidth/Height, it interferes with the autosizing

git-svn-id: trunk@9496 -
This commit is contained in:
mattias 2006-06-24 09:04:42 +00:00
parent c3cfa80cc0
commit ea9419ecb7
5 changed files with 33 additions and 65 deletions

View File

@ -216,7 +216,7 @@ msgstr ""
#: lazarusidestrconsts:dlgbaknosubdirectory
msgid "(no subdirectory)"
msgstr ""
msgstr "(ei alikansiota)"
#: lazarusidestrconsts:listmunknownmacro
msgid "(unknown macro: %s)"
@ -624,7 +624,7 @@ msgstr ""
#: lazarusidestrconsts:dlgautodel
msgid "Auto delete file"
msgstr ""
msgstr "Poista tiedosto automaattisesti"
#: lazarusidestrconsts:liscodetoolsdefsautogeneratednodescannotbeedited
msgid "Auto generated nodes can not be edited."
@ -1528,15 +1528,15 @@ msgstr "Muunna tiedosto: DFM -> LFM"
#: lazarusidestrconsts:lismenuconvertdelphipackage
msgid "Convert Delphi package to Lazarus package"
msgstr ""
msgstr "Muunna tiedosto: DPK -> LPK"
#: lazarusidestrconsts:lismenuconvertdelphiproject
msgid "Convert Delphi project to Lazarus project"
msgstr ""
msgstr "Muunna tiedosto: DPR -> LPR"
#: lazarusidestrconsts:lismenuconvertdelphiunit
msgid "Convert Delphi unit to Lazarus unit"
msgstr "Muunna: Delphi unit -> Lazarus unit"
msgstr "Muunna tiedosto: Delphi unit -> Lazarus unit"
#: lazarusidestrconsts:liscodetoolsdefsconvertnode
msgid "Convert node"
@ -4704,7 +4704,7 @@ msgstr ""
#: lazarusidestrconsts:dlgenvbackuphelpnote
msgid "Notes: Project files are all files in the project directory"
msgstr ""
msgstr "Huomaa: Projektin tiedostot ovat kaikki tiedostot projektikansiossa"
#: lazarusidestrconsts:liscodetoolsoptsnumber
msgid "Number"
@ -5524,7 +5524,7 @@ msgstr ""
#: lazarusidestrconsts:listodolistrefresh
msgid "Refresh todo items"
msgstr ""
msgstr "Päivitä tehtävälistaa (ToDo-list)"
#: lazarusidestrconsts:lispkgsysregisterprocedureisnil
msgid "Register procedure is nil"
@ -5868,7 +5868,7 @@ msgstr ""
#: lazarusidestrconsts:dlgbckupsubdir
msgid "Same name (in subdirectory)"
msgstr ""
msgstr "Sama nimi (mutta alikansiossa)"
#: lazarusidestrconsts:lismenusave
msgid "Save"
@ -5980,7 +5980,7 @@ msgstr ""
#: lazarusidestrconsts:fdmsaveformasxml
msgid "Save form as xml"
msgstr ""
msgstr "Tallenna lomake XML-tiedostona"
#: lazarusidestrconsts:lisposaveinlpifil
msgid "Save in .lpi file"
@ -6748,11 +6748,11 @@ msgstr ""
#: lazarusidestrconsts:dlgedbsubdir
msgid "Sub directory"
msgstr ""
msgstr "Alikansio"
#: lazarusidestrconsts:dlgsubpropkcolor
msgid "Subpropertes"
msgstr ""
msgstr "Aliominaisuudet"
#: lazarusidestrconsts:lisa2pswitchpaths
msgid "Switch Paths"
@ -8288,7 +8288,7 @@ msgstr "Näytä pääohjelma"
#: lazarusidestrconsts:lisviewsourcelfm
msgid "View Source (.lfm)"
msgstr ""
msgstr "Näytä lomakkeen koodi (.lfm)"
#: lazarusidestrconsts:srkmectogglesourceeditor
msgid "View Source Editor"

View File

@ -1270,7 +1270,6 @@ type
procedure SetParent(AParent: TWinControl); override;
procedure UpdateVisibleToolbar;
function GroupAllUpAllowed: boolean;
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
function DialogChar(var Message: TLMKey): boolean; override;
public
constructor Create(TheOwner: TComponent); override;

View File

@ -361,15 +361,18 @@ begin
CurControl:=Controls[i];
if (CurControl.Align<>alNone) then continue;
NewWidth:=CurControl.Width;
if CurControl.AutoSize then
NewHeight:=FButtonHeight;
if (CurControl is TToolButton) and (not CurControl.AutoSize) then begin
CurButton:=TToolButton(CurControl);
case CurButton.Style of
tbsButton,tbsCheck,tbsDropDown:
NewWidth:=FButtonWidth;
if CurButton.Style in [tbsButton,tbsCheck,tbsDropDown] then begin
CurControl.GetPreferredSize(NewWidth,NewHeight);
if NewWidth<FButtonWidth then
NewWidth:=FButtonWidth;
end;
end;
if CurControl.AutoSize then
NewHeight:=CurControl.Height
else
NewHeight:=FButtonHeight;
CurControl.SetBounds(CurControl.Left,CurControl.Top,
NewWidth,NewHeight);
end;
@ -493,10 +496,10 @@ begin
CalculatePosition;
//DebugLn('WrapButtons ',CurControl.Name,':',CurControl.ClassName,' ',x,',',y,',',CurControl.Width,',',CurControl.Height);
if CurControl.AutoSize then begin
// center vertically
CurControl.SetBounds(x,y,CurControl.Width,CurControl.Height);
// TODO: center vertically
CurControl.SetBoundsKeepBase(x,y,CurControl.Width,CurControl.Height);
end else
CurControl.SetBounds(x,y,NewControlWidth,ButtonHeight);
CurControl.SetBoundsKeepBase(x,y,NewControlWidth,ButtonHeight);
inc(x,CurControl.Width);
if (not Wrapable) and (CurControl is TToolButton)

View File

@ -712,40 +712,6 @@ begin
end;
end;
procedure TToolButton.DoSetBounds(ALeft, ATop, AWidth, AHeight: integer);
var
NewButtonWidth: Integer;
NewButtonHeight: Integer;
OldLeft: Integer;
OldTop: Integer;
OldWidth: Integer;
OldHeight: Integer;
begin
if ([csDesigning,csLoading,csDestroying]*ComponentState=[csDesigning])
and (FToolBar<>nil)
and (not (tbfPlacingControls in FToolBar.FToolBarFlags))
and (FToolBar.FUpdateCount=0)
and (AWidth>0) and (AHeight>0) then begin
if Style in [tbsButton,tbsDropDown,tbsCheck] then
NewButtonWidth:=AWidth
else
NewButtonWidth:=FToolBar.ButtonWidth;
NewButtonHeight:=AHeight;
//DebugLn('TToolButton.DoSetBounds NewButtonSize=',NewButtonWidth,',',NewButtonHeight);
OldLeft:=Left;
OldTop:=Top;
OldWidth:=Width;
OldHeight:=Height;
FToolBar.SetButtonSize(NewButtonWidth,NewButtonHeight);
if (OldLeft<>Left) or (OldTop<>Top)
or (OldWidth<>Width) or (OldHeight<>Height) then
// button was auto aligned -> ignore setbounds
exit;
end;
inherited DoSetBounds(ALeft, ATop, AWidth, AHeight);
end;
function TToolButton.DialogChar(var Message: TLMKey): boolean;
begin
if IsAccel(Message.CharCode, Caption) and CanFocus then

View File

@ -152,7 +152,7 @@ msgstr ""
#: lclstrconsts:rsbackward
msgid "Backward"
msgstr ""
msgstr "Taaksepäin"
#: lclstrconsts:rsbitmaps
msgid "Bitmaps"
@ -180,7 +180,7 @@ msgstr ""
#: lclstrconsts:rsmbcancel
msgid "Cancel"
msgstr "&Peru"
msgstr "Peru"
#: lclstrconsts:scannotfocus
msgid "Cannot focus a disabled or invisible window"
@ -196,7 +196,7 @@ msgstr ""
#: lclstrconsts:rscasesensitive
msgid "Case sensitive"
msgstr ""
msgstr "Sama kirjainkoko"
#: lclstrconsts:ifsvk_clear
msgid "Clear"
@ -228,7 +228,7 @@ msgstr ""
#: lclstrconsts:rsdirection
msgid "Direction"
msgstr ""
msgstr "Suunta"
#: lclstrconsts:rsfddirectorymustexist
msgid "Directory must exist"
@ -312,7 +312,7 @@ msgstr ""
#: lclstrconsts:rsfind
msgid "Find"
msgstr ""
msgstr "Etsi"
#: lclstrconsts:rsfindmore
msgid "Find more"
@ -332,7 +332,7 @@ msgstr ""
#: lclstrconsts:rsforward
msgid "Forward"
msgstr ""
msgstr "Eteenpäin"
#: lclstrconsts:rsgridfiledoesnotexists
msgid "Grid file doesn't exists"
@ -604,11 +604,11 @@ msgstr ""
#: lclstrconsts:rsreplace
msgid "Replace"
msgstr ""
msgstr "Etsi ja korvaa"
#: lclstrconsts:rsreplaceall
msgid "Replace all"
msgstr ""
msgstr "Korvaa kaikki"
#: lclstrconsts:lislclresourcesnotfound
msgid "Resource %s not found"
@ -676,7 +676,7 @@ msgstr ""
#: lclstrconsts:rstext
msgid "Text"
msgstr ""
msgstr "Teksti"
#: lclstrconsts:rsfddirectorynotexist
msgid "The directory \"%s\" does not exist."
@ -752,7 +752,7 @@ msgstr "Varoitus:"
#: lclstrconsts:rswholewordsonly
msgid "Whole words only"
msgstr ""
msgstr "Etsi vain kokonaisia sanoja"
#: lclstrconsts:rsmbyestoall
msgid "Yes to &All"