aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2013-08-26 10:22:09 +0200
committerSebastian Geerken <devnull@localhost>2013-08-26 10:22:09 +0200
commit16fd6283d93b8f468074358a488a6acc076d852d (patch)
treeda32739c4ca5a0ed4954f3219fad97bb217ad497
parent6585f6117436d57ca2981ca7552b09565abe0178 (diff)
Some refactoring.
-rw-r--r--dw/outofflowmgr.cc58
-rw-r--r--dw/outofflowmgr.hh2
2 files changed, 33 insertions, 27 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc
index 99c56930..dc92574d 100644
--- a/dw/outofflowmgr.cc
+++ b/dw/outofflowmgr.cc
@@ -1204,33 +1204,7 @@ void OutOfFlowMgr::accumExtremes (SortedFloatsVector *list, int *oofMinWidth,
for (int i = 0; i < list->size(); i++) {
Float *vloat = list->get(i);
- // Difference between generating block and to containing block,
- // sum on both sides. Greater or equal than 0, so dealing with 0
- // when it cannot yet be calculated is safe. (No distiction
- // whether it is defined or not is necessary.)
- int borderDiff;
-
- if (vloat->generatingBlock == containingBlock)
- // Simplest case: the generator is the container.
- borderDiff = 0;
- else {
- if (wasAllocated (containingBlock)) {
- if (wasAllocated (vloat->generatingBlock))
- // Simple case: both containing block and generating
- // block are defined.
- borderDiff = getAllocation(containingBlock)->width -
- getAllocation(vloat->generatingBlock)->width;
- else
- // Generating block not yet allocation; the next
- // allocation will, when necessary, trigger
- // getExtremes. (TODO: Is this really the case?)
- borderDiff = 0;
- } else
- // Nothing can be done now, but the next allocation will
- // trigger getExtremes. (TODO: Is this really the case?)
- borderDiff = 0;
- }
-
+ int borderDiff = getBorderDiff (vloat);
Extremes extr;
vloat->widget->getExtremes (&extr);
@@ -1239,6 +1213,36 @@ void OutOfFlowMgr::accumExtremes (SortedFloatsVector *list, int *oofMinWidth,
}
}
+/**
+ * Difference between generating block and to containing block, sum on
+ * both sides. Greater or equal than 0, so dealing with 0 when it
+ * cannot yet be calculated is safe. (No distiction whether it is
+ * defined or not is necessary.)
+ */
+int OutOfFlowMgr::getBorderDiff (Float *vloat)
+{
+ if (vloat->generatingBlock == containingBlock)
+ // Simplest case: the generator is the container.
+ return 0;
+ else {
+ if (wasAllocated (containingBlock)) {
+ if (wasAllocated (vloat->generatingBlock))
+ // Simple case: both containing block and generating block
+ // are defined.
+ return getAllocation(containingBlock)->width -
+ getAllocation(vloat->generatingBlock)->width;
+ else
+ // Generating block not yet allocation; the next
+ // allocation will, when necessary, trigger
+ // getExtremes. (TODO: Is this really the case?)
+ return 0;
+ } else
+ // Nothing can be done now, but the next allocation will
+ // trigger getExtremes. (TODO: Is this really the case?)
+ return 0;
+ }
+}
+
OutOfFlowMgr::TBInfo *OutOfFlowMgr::getTextblock (Textblock *textblock)
{
TypedPointer<Textblock> key (textblock);
diff --git a/dw/outofflowmgr.hh b/dw/outofflowmgr.hh
index 69f39471..31d783c5 100644
--- a/dw/outofflowmgr.hh
+++ b/dw/outofflowmgr.hh
@@ -227,6 +227,8 @@ private:
int getFloatsSize (SortedFloatsVector *list);
void accumExtremes (SortedFloatsVector *list, int *oofMinWidth,
int *oofMaxWidth);
+ int getBorderDiff (Float *vloat);
+
TBInfo *getTextblock (Textblock *textblock);
int getBorder (Textblock *textblock, Side side, int y, int h,
Textblock *lastGB, int lastExtIndex);