- child->Layout(dc, availableSpace, style);
-
- // Layout must set the cached size
- availableSpace.y += child->GetCachedSize().y;
- maxWidth = wxMax(maxWidth, child->GetCachedSize().x);
+ // Layout must set the cached size
+ availableSpace.y += child->GetCachedSize().y;
+ maxWidth = wxMax(maxWidth, child->GetCachedSize().x);
+ }
+ else
+ {
+ // We're outside the immediately affected range, so now let's just
+ // move everything up or down. This assumes that all the children have previously
+ // been laid out and have wrapped line lists associated with them.
+ // TODO: check all paragraphs before the affected range.
+
+ int inc = availableSpace.y - child->GetPosition().y;
+
+ while (node)
+ {
+ wxRichTextParagraph* child = wxDynamicCast(node->GetData(), wxRichTextParagraph);
+ if (child)
+ {
+ if (child->GetLines().GetCount() == 0)
+ child->Layout(dc, availableSpace, affected, style);
+ else
+ child->SetPosition(wxPoint(child->GetPosition().x, child->GetPosition().y + inc));
+
+ availableSpace.y += child->GetCachedSize().y;
+ maxWidth = wxMax(maxWidth, child->GetCachedSize().x);
+ }
+
+ node = node->GetNext();
+ }
+ break;
+ }