diff options
author | Sebastian Geerken <devnull@localhost> | 2013-05-01 22:45:32 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2013-05-01 22:45:32 +0200 |
commit | e2a2501c4d0c8a4ea9e89a223ec594dd8702863d (patch) | |
tree | 1acd84af6ab2150be23605dc970524433f81b9cc | |
parent | 19594f92fdbfe5d3f5a69e8e8e53c763fa7c5b8d (diff) |
Some cleanup.
-rw-r--r-- | dw/outofflowmgr.cc | 24 | ||||
-rw-r--r-- | dw/outofflowmgr.hh | 2 |
2 files changed, 19 insertions, 7 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index d75ba47c..991170a5 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -150,8 +150,7 @@ int OutOfFlowMgr::SortedFloatsVector::findFloatIndex (Textblock *lastGB, // oofm->containingBlock, lastGB, lastExtIndex); if (lastGB) { - TypedPointer<Textblock> key (lastGB); - TBInfo *tbInfo = oofm->tbInfosByTextblock->get (&key); + TBInfo *tbInfo = oofm->getTextblock (lastGB); if (tbInfo) { //printf (" generator %p, index = %d\n", // tbInfo->textblock, tbInfo->index); @@ -678,8 +677,7 @@ void OutOfFlowMgr::addWidget (Widget *widget, Textblock *generatingBlock, void OutOfFlowMgr::moveExternalIndices (Textblock *generatingBlock, int oldStartIndex, int diff) { - TypedPointer<Textblock> key (generatingBlock); - TBInfo *tbInfo = tbInfosByTextblock->get (&key); + TBInfo *tbInfo = getTextblock (generatingBlock); if (tbInfo) { moveExternalIndices (tbInfo->leftFloatsGB, oldStartIndex, diff); moveExternalIndices (tbInfo->rightFloatsGB, oldStartIndex, diff); @@ -1081,10 +1079,22 @@ void OutOfFlowMgr::accumExtremes (SortedFloatsVector *list, int *oofMinWidth, } } -OutOfFlowMgr::TBInfo *OutOfFlowMgr::registerTextblock (Textblock *textblock) +OutOfFlowMgr::TBInfo *OutOfFlowMgr::getTextblock (Textblock *textblock) { TypedPointer<Textblock> key (textblock); - TBInfo *tbInfo = tbInfosByTextblock->get (&key); + return tbInfosByTextblock->get (&key); +} + +OutOfFlowMgr::TBInfo *OutOfFlowMgr::getExistingTextblock (Textblock *textblock) +{ + TBInfo *tbInfo = getTextblock (textblock); + assert (tbInfo); + return tbInfo; +} + +OutOfFlowMgr::TBInfo *OutOfFlowMgr::registerTextblock (Textblock *textblock) +{ + TBInfo *tbInfo = getTextblock (textblock); if (tbInfo == NULL) { tbInfo = new TBInfo (this, textblock); tbInfo->wasAllocated = false; @@ -1096,7 +1106,7 @@ OutOfFlowMgr::TBInfo *OutOfFlowMgr::registerTextblock (Textblock *textblock) return tbInfo; } - + /** * Get the left border for the vertical position of *y*, for a height * of *h", based on floats; relative to the allocation of the calling diff --git a/dw/outofflowmgr.hh b/dw/outofflowmgr.hh index 13cdd9b1..984c2f21 100644 --- a/dw/outofflowmgr.hh +++ b/dw/outofflowmgr.hh @@ -190,6 +190,8 @@ private: int getFloatsSize (SortedFloatsVector *list); void accumExtremes (SortedFloatsVector *list, int *oofMinWidth, int *oofMaxWidth); + TBInfo *getTextblock (Textblock *textblock); + TBInfo *getExistingTextblock (Textblock *textblock); TBInfo *registerTextblock (Textblock *textblock); int getBorder (Textblock *textblock, Side side, int y, int h, Textblock *lastGB, int lastExtIndex); |