diff options
author | Sebastian Geerken <devnull@localhost> | 2014-09-22 21:57:56 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-09-22 21:57:56 +0200 |
commit | afbbb4180fd2f4ab7bc534811ebfc0ede00d8a93 (patch) | |
tree | 1bf879bee5ec0f91c89312ae7d4175ca51ebdc14 | |
parent | 6d7df83ccc6d259dbdc2c35b99c9d9d5507fae68 (diff) |
Cleaned up: Style::box*() -> Widget::box*().
-rw-r--r-- | dw/image.cc | 31 | ||||
-rw-r--r-- | dw/ooffloatsmgr.cc | 29 | ||||
-rw-r--r-- | dw/ruler.cc | 9 | ||||
-rw-r--r-- | dw/table.cc | 13 | ||||
-rw-r--r-- | dw/textblock.cc | 22 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 7 | ||||
-rw-r--r-- | dw/widget.hh | 6 |
7 files changed, 53 insertions, 64 deletions
diff --git a/dw/image.cc b/dw/image.cc index 20460f33..8a4be32f 100644 --- a/dw/image.cc +++ b/dw/image.cc @@ -334,7 +334,7 @@ void Image::leaveNotifyImpl (core::EventCrossing *event) */ int Image::contentX (core::MousePositionEvent *event) { - int ret = event->xWidget - getStyle()->boxOffsetX(); + int ret = event->xWidget - boxOffsetX(); ret = misc::min(getContentWidth(), misc::max(ret, 0)); return ret; @@ -342,7 +342,7 @@ int Image::contentX (core::MousePositionEvent *event) int Image::contentY (core::MousePositionEvent *event) { - int ret = event->yWidget - getStyle()->boxOffsetY(); + int ret = event->yWidget - boxOffsetY(); ret = misc::min(getContentHeight(), misc::max(ret, 0)); return ret; @@ -412,8 +412,8 @@ void Image::draw (core::View *view, core::Rectangle *area) drawWidgetBox (view, area, false); if (buffer) { - dx = getStyle()->boxOffsetX (); - dy = getStyle()->boxOffsetY (); + dx = boxOffsetX (); + dy = boxOffsetY (); content.x = dx; content.y = dy; content.width = getContentWidth (); @@ -440,31 +440,29 @@ void Image::draw (core::View *view, core::Rectangle *area) (getContentHeight() < getStyle()->font->ascent + getStyle()->font->descent)) { clippingView = usedView = - view->getClippingView (allocation.x + getStyle()->boxOffsetX (), - allocation.y + getStyle()->boxOffsetY (), + view->getClippingView (allocation.x + boxOffsetX (), + allocation.y + boxOffsetY (), getContentWidth(), getContentHeight()); } usedView->drawSimpleWrappedText (getStyle()->font, getStyle()->color, core::style::Color::SHADING_NORMAL, - allocation.x + getStyle()->boxOffsetX (), - allocation.y + getStyle()->boxOffsetY (), + allocation.x + boxOffsetX (), + allocation.y + boxOffsetY (), getContentWidth(), getContentHeight(), altText); if (clippingView) view->mergeClippingView (clippingView); } if (mapKey) { - clippingView = view->getClippingView (allocation.x + - getStyle()->boxOffsetX (), - allocation.y + - getStyle()->boxOffsetY (), + clippingView = view->getClippingView (allocation.x + boxOffsetX (), + allocation.y + boxOffsetY (), getContentWidth(), getContentHeight()); mapList->drawMap(mapKey, clippingView, getStyle(), - allocation.x + getStyle()->boxOffsetX (), - allocation.y + getStyle()->boxOffsetY ()); + allocation.x + boxOffsetX (), + allocation.y + boxOffsetY ()); view->mergeClippingView (clippingView); } } @@ -515,9 +513,8 @@ void Image::drawRow (int row) buffer->getRowArea (row, &area); if (area.width && area.height) - queueDrawArea (area.x + getStyle()->boxOffsetX (), - area.y + getStyle()->boxOffsetY (), - area.width, area.height); + queueDrawArea (area.x + boxOffsetX (), area.y + boxOffsetY (), area.width, + area.height); } void Image::finish () diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc index 183bb46b..7850b18f 100644 --- a/dw/ooffloatsmgr.cc +++ b/dw/ooffloatsmgr.cc @@ -1220,9 +1220,9 @@ int OOFFloatsMgr::calcFloatX (Float *vloat, Side side, int gbX, int gbWidth, case LEFT: // Left floats are always aligned on the left side of the // generator (content, not allocation) ... - x = gbX + vloat->generatingBlock->getStyle()->boxOffsetX(); + x = gbX + vloat->generatingBlock->boxOffsetX(); DBG_OBJ_MSGF ("resize.oofm", 1, "left: x = %d + %d = %d", - gbX, vloat->generatingBlock->getStyle()->boxOffsetX(), x); + gbX, vloat->generatingBlock->boxOffsetX(), x); // ... but when the float exceeds the line break width of the // container, it is corrected (but not left of the container). // This way, we save space and, especially within tables, avoid @@ -1247,12 +1247,12 @@ int OOFFloatsMgr::calcFloatX (Float *vloat, Side side, int gbX, int gbWidth, // is often smaller that the line break.) x = max (gbX + gbLineBreakWidth - vloat->size.width - - vloat->generatingBlock->getStyle()->boxRestWidth(), + - vloat->generatingBlock->boxRestWidth(), // Do not exceed CB allocation: 0); DBG_OBJ_MSGF ("resize.common", 1, "x = max (%d + %d - %d - %d, 0) = %d", gbX, gbLineBreakWidth, vloat->size.width, - vloat->generatingBlock->getStyle()->boxRestWidth(), x); + vloat->generatingBlock->boxRestWidth(), x); break; default: @@ -1641,7 +1641,7 @@ bool OOFFloatsMgr::collidesH (Float *vloat, Float *other, SFVType type) if (vloat->generatingBlock == other->generatingBlock) collidesH = vloat->size.width + other->size.width - + vloat->generatingBlock->getStyle()->boxDiffWidth() + + vloat->generatingBlock->boxDiffWidth() > vloat->generatingBlock->getLineBreakWidth(); else { assert (wasAllocated (vloat->generatingBlock)); @@ -1863,8 +1863,8 @@ bool OOFFloatsMgr::getFloatDiffToCB (Float *vloat, int *leftDiff, bool result; if (vloat->generatingBlock == container) { - *leftDiff = vloat->generatingBlock->getStyle()->boxOffsetX(); - *rightDiff = vloat->generatingBlock->getStyle()->boxRestWidth(); + *leftDiff = vloat->generatingBlock->boxOffsetX(); + *rightDiff = vloat->generatingBlock->boxRestWidth(); result = true; DBG_OBJ_MSGF ("resize.oofm", 1, "GB == CB => leftDiff = %d, rightDiff = %d", @@ -1872,20 +1872,19 @@ bool OOFFloatsMgr::getFloatDiffToCB (Float *vloat, int *leftDiff, } else if (wasAllocated (vloat->generatingBlock)) { Allocation *gba = getAllocation(vloat->generatingBlock); *leftDiff = gba->x - containerAllocation.x - + vloat->generatingBlock->getStyle()->boxOffsetX(); + + vloat->generatingBlock->boxOffsetX(); *rightDiff = (containerAllocation.x + containerAllocation.width) - (gba->x + gba->width) - + vloat->generatingBlock->getStyle()->boxRestWidth(); + + vloat->generatingBlock->boxRestWidth(); result = true; DBG_OBJ_MSGF ("resize.oofm", 1, "GB != CB => leftDiff = %d - %d + %d = %d, " "rightDiff = (%d + %d) - (%d + %d) + %d = %d", gba->x, containerAllocation.x, - vloat->generatingBlock->getStyle()->boxOffsetX(), - *leftDiff, containerAllocation.x, - containerAllocation.width, gba->x, gba->width, - vloat->generatingBlock->getStyle()->boxRestWidth(), + vloat->generatingBlock->boxOffsetX(), *leftDiff, + containerAllocation.x, containerAllocation.width, + gba->x, gba->width, vloat->generatingBlock->boxRestWidth(), *rightDiff); } else { DBG_OBJ_MSG ("resize.oofm", 1, "GB != CB, and float not allocated"); @@ -1986,8 +1985,8 @@ int OOFFloatsMgr::getBorder (OOFAwareWidget *textblock, Side side, int y, int h, int thisBorder; if (vloat->generatingBlock == textblock) { int borderIn = side == LEFT ? - vloat->generatingBlock->getStyle()->boxOffsetX() : - vloat->generatingBlock->getStyle()->boxRestWidth(); + vloat->generatingBlock->boxOffsetX() : + vloat->generatingBlock->boxRestWidth(); thisBorder = vloat->size.width + borderIn; DBG_OBJ_MSGF ("border", 1, "GB: thisBorder = %d + %d = %d", vloat->size.width, borderIn, thisBorder); diff --git a/dw/ruler.cc b/dw/ruler.cc index 3fdbfb6d..fc2c5bca 100644 --- a/dw/ruler.cc +++ b/dw/ruler.cc @@ -32,15 +32,14 @@ Ruler::Ruler () void Ruler::sizeRequestImpl (core::Requisition *requisition) { - requisition->width = - lout::misc::max (getAvailWidth (true), getStyle()->boxDiffWidth ()); - requisition->ascent = getStyle()->boxOffsetY (); - requisition->descent = getStyle()->boxRestHeight (); + requisition->width = lout::misc::max (getAvailWidth (true), boxDiffWidth ()); + requisition->ascent = boxOffsetY (); + requisition->descent = boxRestHeight (); } void Ruler::getExtremesImpl (core::Extremes *extremes) { - extremes->minWidth = extremes->maxWidth = getStyle()->boxDiffWidth (); + extremes->minWidth = extremes->maxWidth = boxDiffWidth (); extremes->minWidthIntrinsic = extremes->minWidth; extremes->maxWidthIntrinsic = extremes->maxWidth; correctExtremes (extremes); diff --git a/dw/table.cc b/dw/table.cc index f7747cf4..d1154111 100644 --- a/dw/table.cc +++ b/dw/table.cc @@ -112,14 +112,13 @@ void Table::sizeRequestImpl (core::Requisition *requisition) /** * \bug Baselines are not regarded here. */ - requisition->width = getStyle()->boxDiffWidth () - + (numCols + 1) * getStyle()->hBorderSpacing; + requisition->width = + boxDiffWidth () + (numCols + 1) * getStyle()->hBorderSpacing; for (int col = 0; col < numCols; col++) requisition->width += colWidths->get (col); requisition->ascent = - getStyle()->boxDiffHeight () + cumHeight->get (numRows) - + getStyle()->vBorderSpacing; + boxDiffHeight () + cumHeight->get (numRows) + getStyle()->vBorderSpacing; requisition->descent = 0; correctRequisition (requisition, core::splitHeightPreserveDescent); @@ -175,10 +174,8 @@ void Table::sizeAllocateImpl (core::Allocation *allocation) * \bug Baselines are not regarded here. */ - int offy = - allocation->y + getStyle()->boxOffsetY () + getStyle()->vBorderSpacing; - int x = - allocation->x + getStyle()->boxOffsetX () + getStyle()->hBorderSpacing; + int offy = allocation->y + boxOffsetY () + getStyle()->vBorderSpacing; + int x = allocation->x + boxOffsetX () + getStyle()->hBorderSpacing; for (int col = 0; col < numCols; col++) { for (int row = 0; row < numRows; row++) { diff --git a/dw/textblock.cc b/dw/textblock.cc index f1598fec..efa21342 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -356,11 +356,11 @@ void Textblock::sizeRequestImpl (core::Requisition *requisition) } DBG_OBJ_MSGF ("resize", 1, "left inner padding = %d, boxDiffWidth = %d", - leftInnerPadding, getStyle()->boxDiffWidth ()); + leftInnerPadding, boxDiffWidth ()); - requisition->width += leftInnerPadding + getStyle()->boxDiffWidth (); - requisition->ascent += verticalOffset + getStyle()->boxOffsetY (); - requisition->descent += getStyle()->boxRestHeight (); + requisition->width += leftInnerPadding + boxDiffWidth (); + requisition->ascent += verticalOffset + boxOffsetY (); + requisition->descent += boxRestHeight (); if (mustBeWidenedToAvailWidth ()) { DBG_OBJ_MSGF ("resize", 1, @@ -455,7 +455,7 @@ void Textblock::getExtremesImpl (core::Extremes *extremes) extremes->minWidth, extremes->minWidthIntrinsic, extremes->maxWidth, extremes->maxWidthIntrinsic); - int diff = leftInnerPadding + getStyle()->boxDiffWidth (); + int diff = leftInnerPadding + boxDiffWidth (); extremes->minWidth += diff; extremes->minWidthIntrinsic += diff; extremes->maxWidth += diff; @@ -523,7 +523,7 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation) // Reconstruct the initial size; see // Textblock::sizeRequestImpl. (lines->size () > 0 ? lines->getRef(0)->boxAscent : 0) - + verticalOffset + getStyle()->boxOffsetY ()); + + verticalOffset + boxOffsetY ()); childBaseAllocation.descent = allocation->ascent + allocation->descent - childBaseAllocation.ascent; @@ -1500,7 +1500,7 @@ int Textblock::findLineIndexWhenNotAllocated (int y) else return findLineIndex (y, lines->getRef(0)->boxAscent + verticalOffset + - getStyle()->boxOffsetY()); + boxOffsetY()); } int Textblock::findLineIndexWhenAllocated (int y) @@ -3065,17 +3065,17 @@ int Textblock::yOffsetOfPossiblyMissingLine (int lineNo) int result; if (lineNo == 0) { - result = verticalOffset + getStyle()->boxOffsetY(); + result = verticalOffset + boxOffsetY(); DBG_OBJ_MSGF ("line.yoffset", 1, "first line: %d + %d = %d", - verticalOffset, getStyle()->boxOffsetY(), result); + verticalOffset, boxOffsetY(), result); } else { Line *prevLine = lines->getRef (lineNo - 1); - result = verticalOffset + getStyle()->boxOffsetY() + + result = verticalOffset + boxOffsetY() + prevLine->top + prevLine->boxAscent + prevLine->boxDescent + prevLine->breakSpace; DBG_OBJ_MSGF ("line.yoffset", 1, "other line: %d + %d + %d + (%d + %d) + %d = %d", - verticalOffset, getStyle()->boxOffsetY(), + verticalOffset, boxOffsetY(), prevLine->top, prevLine->boxAscent, prevLine->boxDescent, prevLine->breakSpace, result); } diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index acd122da..6066d246 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -1648,8 +1648,7 @@ int Textblock::calcLineBreakWidth (int lineIndex) if (limitTextWidth && layout->getUsesViewport () && // margin/border/padding will be subtracted later, via OOFM. - lineBreakWidth - getStyle()->boxDiffWidth() - > layout->getWidthViewport () - 10) + lineBreakWidth - boxDiffWidth() > layout->getWidthViewport () - 10) lineBreakWidth = layout->getWidthViewport () - 10; if (lineIndex == 0) lineBreakWidth -= line1OffsetEff; @@ -1661,8 +1660,8 @@ int Textblock::calcLineBreakWidth (int lineIndex) } else leftBorder = rightBorder = 0; - leftBorder = misc::max (leftBorder, getStyle()->boxOffsetX()); - rightBorder = misc::max (rightBorder, getStyle()->boxRestWidth()); + leftBorder = misc::max (leftBorder, boxOffsetX()); + rightBorder = misc::max (rightBorder, boxRestWidth()); lineBreakWidth -= (leftBorder + rightBorder); diff --git a/dw/widget.hh b/dw/widget.hh index fb3eebf2..46fdf856 100644 --- a/dw/widget.hh +++ b/dw/widget.hh @@ -180,10 +180,8 @@ protected: Allocation allocation; inline int getHeight () { return allocation.ascent + allocation.descent; } - inline int getContentWidth() { return allocation.width - - style->boxDiffWidth (); } - inline int getContentHeight() { return getHeight () - - style->boxDiffHeight (); } + inline int getContentWidth() { return allocation.width - boxDiffWidth (); } + inline int getContentHeight() { return getHeight () - boxDiffHeight (); } Layout *layout; |