mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-19 14:17:41 +02:00
Comments and new variables in ToolDocking code. No change to function.
This commit is contained in:
parent
bdbdf68248
commit
2c5d9ef569
@ -283,6 +283,7 @@ int ToolDock::PositionBar( ToolBar *t, wxPoint & pos, wxRect & rect )
|
|||||||
// Set initial stack entry to maximum size
|
// Set initial stack entry to maximum size
|
||||||
stack[ 0 ].SetX( toolbarGap );
|
stack[ 0 ].SetX( toolbarGap );
|
||||||
stack[ 0 ].SetY( toolbarGap );
|
stack[ 0 ].SetY( toolbarGap );
|
||||||
|
// The stack width and height are the remaining width and height.
|
||||||
stack[ 0 ].SetWidth( width );
|
stack[ 0 ].SetWidth( width );
|
||||||
stack[ 0 ].SetHeight( height );
|
stack[ 0 ].SetHeight( height );
|
||||||
|
|
||||||
@ -341,9 +342,14 @@ int ToolDock::PositionBar( ToolBar *t, wxPoint & pos, wxRect & rect )
|
|||||||
int tw = sz.GetWidth() + toolbarGap;
|
int tw = sz.GetWidth() + toolbarGap;
|
||||||
int th = sz.GetHeight() + toolbarGap;
|
int th = sz.GetHeight() + toolbarGap;
|
||||||
|
|
||||||
// Will this one fit in remaining horizontal space?
|
|
||||||
if( ( tw > stack[ stkcnt ].GetWidth() ) ||
|
// Will this one fit in remaining space?
|
||||||
( th > stack[ stkcnt ].GetHeight() ) )
|
bool bTooWide = tw > stack[stkcnt].GetWidth();
|
||||||
|
// We'd like to be able to add a tall toolbar in at the start of a row,
|
||||||
|
// even if there isn't enough height for it.
|
||||||
|
// If so, we'd have to at least change how we calculate 'bTooHigh'.
|
||||||
|
bool bTooHigh = th > stack[stkcnt].GetHeight();
|
||||||
|
if( bTooWide || bTooHigh )
|
||||||
{
|
{
|
||||||
// Destack entries until one is found in which this bar
|
// Destack entries until one is found in which this bar
|
||||||
// will fit or until we run out of stacked entries
|
// will fit or until we run out of stacked entries
|
||||||
@ -351,9 +357,12 @@ int ToolDock::PositionBar( ToolBar *t, wxPoint & pos, wxRect & rect )
|
|||||||
{
|
{
|
||||||
stkcnt--;
|
stkcnt--;
|
||||||
|
|
||||||
|
|
||||||
// Get out if it will fit
|
// Get out if it will fit
|
||||||
if( ( tw <= stack[ stkcnt ].GetWidth() ) &&
|
bTooWide = tw > stack[stkcnt].GetWidth();
|
||||||
( th <= stack[ stkcnt ].GetHeight() ) )
|
bTooHigh = th > stack[stkcnt].GetHeight();
|
||||||
|
|
||||||
|
if( !bTooWide && !bTooHigh )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -367,7 +376,8 @@ int ToolDock::PositionBar( ToolBar *t, wxPoint & pos, wxRect & rect )
|
|||||||
// We'll be using at least a portion of this stack entry, so
|
// We'll be using at least a portion of this stack entry, so
|
||||||
// adjust the location and size. It is possible that these
|
// adjust the location and size. It is possible that these
|
||||||
// will become zero if this entry and the toolbar have the
|
// will become zero if this entry and the toolbar have the
|
||||||
// same height. This is what we want as it will be destacked
|
// same height, or negative if we've added a taller toolbar at the
|
||||||
|
// start of a row. This is (?) what we want as it will be destacked
|
||||||
// in the next iteration.
|
// in the next iteration.
|
||||||
stack[ stkcnt ].SetY( stack[ stkcnt ].GetY() + th );
|
stack[ stkcnt ].SetY( stack[ stkcnt ].GetY() + th );
|
||||||
stack[ stkcnt ].SetHeight( stack[ stkcnt ].GetHeight() - th );
|
stack[ stkcnt ].SetHeight( stack[ stkcnt ].GetHeight() - th );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user