simplified justification code; fixed incorrect positioning of first cell on line in justified paragraph
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28126 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -781,41 +781,38 @@ void wxHtmlContainerCell::Layout(int w)
|
|||||||
// first count the cells which will get extra space
|
// first count the cells which will get extra space
|
||||||
int total = 0;
|
int total = 0;
|
||||||
|
|
||||||
const wxHtmlCell *c,
|
const wxHtmlCell *c;
|
||||||
*prev = NULL,
|
if ( line != cell )
|
||||||
*next wxDUMMY_INITIALIZE(NULL);
|
|
||||||
for ( c = line; c != cell; prev = c, c = next )
|
|
||||||
{
|
{
|
||||||
next = c->GetNext();
|
for ( c = line->GetNext(); c != cell; c = c->GetNext() )
|
||||||
if ( c->IsLinebreakAllowed() &&
|
|
||||||
(next == cell || next->IsLinebreakAllowed()) &&
|
|
||||||
(!prev || prev->IsLinebreakAllowed()) )
|
|
||||||
{
|
{
|
||||||
total++;
|
if ( c->IsLinebreakAllowed() )
|
||||||
|
{
|
||||||
|
total++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// and now extra space to those cells which merit it
|
// and now extra space to those cells which merit it
|
||||||
if ( total )
|
if ( total )
|
||||||
{
|
{
|
||||||
prev =
|
// first cell on line is not moved:
|
||||||
next = NULL;
|
line->SetPos(line->GetPosX() + s_indent,
|
||||||
for ( int n = 0; line != cell; prev = line, line = line->GetNext() )
|
line->GetPosY() + ypos);
|
||||||
|
|
||||||
|
line = line->GetNext();
|
||||||
|
for ( int n = 0; line != cell; line = line->GetNext() )
|
||||||
{
|
{
|
||||||
line->SetPos(line->GetPosX() + s_indent +
|
if ( line->IsLinebreakAllowed() )
|
||||||
((n * step) / total),
|
|
||||||
line->GetPosY() + ypos);
|
|
||||||
|
|
||||||
next = line->GetNext();
|
|
||||||
if ( line->IsLinebreakAllowed() &&
|
|
||||||
(next == cell ||
|
|
||||||
next->IsLinebreakAllowed()) &&
|
|
||||||
(!prev || prev->IsLinebreakAllowed()) )
|
|
||||||
{
|
{
|
||||||
// offset the next cell relative to this one
|
// offset the next cell relative to this one
|
||||||
// thus increasing our size
|
// thus increasing our size
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
line->SetPos(line->GetPosX() + s_indent +
|
||||||
|
((n * step) / total),
|
||||||
|
line->GetPosY() + ypos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user