23#include "../lout/debug.hh"
72 sb->
append (
"{ widget = ");
83 sb->
append (
", sideSpanningIndex = ");
85 sb->
append (
", generator = ");
91 sb->
append (
", size = { ");
97 sb->
append (
" }, dirty = ");
99 sb->
append (
", sizeChangedSinceLastAllocation = ");
109 "%d, %d [vloat: %p]", y, h,
getWidget ());
111 getOOFFloatsMgr()->ensureFloatSize (
this);
112 bool b = yReal + size.ascent + size.descent > y && yReal < y + h;
120 return ((
Float*)o1)->yReal - ((
Float*)o2)->yReal;
126 return ((
Float*)o1)->sideSpanningIndex - ((
Float*)o2)->sideSpanningIndex;
135 "#%d -> %p/%d, #%d -> %p/#%d",
137 f2->index, f2->generator, f2->externalIndex);
142 "(a) generating blocks equal => %d - %d = %d",
146 *t2 = oofm->getOOFAwareWidget (f2->generator);
150 if (t->parent == t2) {
152 r = t->parentExtIndex - f2->externalIndex;
154 "(b) %p is an achestor of %p; direct child is "
155 "%p (%d) => %d - %d = %d\n",
157 t->getOOFAwareWidget (), t->parentExtIndex,
158 t->parentExtIndex, f2->externalIndex, r);
162 if (t->parent == t1) {
166 "(c) %p is an achestor of %p; direct child is %p "
167 "(%d) => %d - %d = %d\n",
169 t->getOOFAwareWidget (), t->parentExtIndex,
174 r = t1->
index - t2->index;
176 t1->
index, t2->index, r);
188 lastGB, lastExtIndex);
190 Float key (oofm, NULL, lastGB, lastExtIndex);
193 int i = bsearch (&key,
false, &comparator);
203 if (comparator.
compare (f, &key) == 0)
231 DBG_OBJ_ENTER_O (
"border", 0, oofm,
"find",
"%d, %d, %d", y, start, end);
233 Float key (oofm, NULL, NULL, 0);
236 int result = bsearch (&key,
false, start, end, &comparator);
248 y, h, lastGB, lastExtIndex);
250 int last = findFloatIndex (lastGB, lastExtIndex);
252 assert (last < size());
258 int i = find (y, 0, last), result;
267 if (i > 0 && get(i - 1)->covers (y, h))
269 else if (i <= last && get(i)->covers (y, h))
279 (
int sideSpanningIndex)
282 Float key (NULL, NULL, NULL, 0);
284 return bsearch (&key,
false, &comparator) - 1;
290 vloat->
index = size() - 1;
298 int y2 = tbInfo2->getOOFAwareWidget () == NULL ? tbInfo2->y :
299 tbInfo2->getOOFAwareWidget()->getGeneratorY (
oofmIndex);
304 TBInfo *parent,
int parentExtIndex) :
337 new HashTable <TypedPointer <OOFAwareWidget>,
TBInfo> (
true,
true);
370 "%p, (%d, %d, %d * (%d + %d))",
371 caller, allocation->
x, allocation->
y, allocation->
width,
382 DBG_OBJ_ENTER (
"resize.oofm", 0,
"sizeAllocateEnd",
"%p", caller);
409 side ==
LEFT ?
"LEFT" :
"RIGHT");
411 for (
int i = 0; i < list->
size (); i++) {
434 int x, effGeneratorWidth;
515 for (
int i = 0; i < list->
size(); i++) {
523 childWidget->
draw (view, &childArea, context);
535 new TBInfo (
this, textblock,
548 DBG_OBJ_ENTER (
"construct.oofm", 0,
"addWidgetOOF",
"%p, %p, %d",
549 widget, generatingBlock, externalIndex);
554 Float *vloat =
new Float (
this, widget, generatingBlock, externalIndex);
604 int oldStartIndex,
int diff)
616 for (
int i = 0; i < list->
size (); i++) {
628 TypedPointer <Widget> key (widget);
630 assert (vloat != NULL);
648 DBG_OBJ_ENTER (
"resize.oofm", 0,
"markSizeChange",
"%d", ref);
671 DBG_OBJ_ENTER (
"resize.oofm", 0,
"updateGenerators",
"#%d [%p]",
677 DBG_OBJ_MSGF (
"resize.oofm", 1,
"updating from %d", first);
683 tbInfos->get(first)->getOOFAwareWidget()
687 for (
int i = first + 1; i <
tbInfos->size(); i++)
688 tbInfos->get(i)->getOOFAwareWidget()->updateReference(0);
702 TBInfo key (
this, NULL, NULL, 0);
705 int index =
tbInfos->bsearch (&key,
false, &comparator);
709 int result = index > 0 ? index - 1 : index;
724 Widget *widgetAtPoint = NULL;
727 if (widgetAtPoint == NULL)
730 return widgetAtPoint;
739 Widget *widgetAtPoint = NULL;
741 for (
int i = list->
size() - 1; widgetAtPoint == NULL && i >= 0; i--) {
748 return widgetAtPoint;
753 DBG_OBJ_ENTER (
"resize.oofm", 0,
"tellPosition1",
"%p, %d, %d",
765 int oldYReal = vloat->
yReal;
779 if (vloat->
index >= 1 &&
781 vloat->
yReal = yRealNew;
815 for (
bool foundColl =
false;
816 !foundColl && oppFloatIndex >= 0 &&
817 collidesV (vloat, listOpp->
get (oppFloatIndex), &yRealNew);
822 vloat->
yReal = yRealNew;
828 DBG_OBJ_MSGF (
"resize.oofm", 1,
"vloat->yReq = %d, vloat->yReal = %d",
847 if (vloat->
yReal != oldYReal)
872 DBG_OBJ_ENTER (
"resize.oofm", 0,
"collidesV",
"#%d [%p], #%d [%p], ...",
883 DBG_OBJ_MSGF (
"resize.oofm", 1,
"otherBottomGB = %d + (%d + %d) = %d",
887 if (vloat->
yReal < otherBottomGB) {
888 *yReal = otherBottomGB;
934 if (side) *side =
LEFT;
940 if (side) *side =
RIGHT;
952 int oofWidthtLeft, oofWidthRight, oofHeightLeft, oofHeightRight;
969 "=> (l: %d, r: %d => %d) * (l: %d, r: %d => %d)",
970 oofWidthtLeft, oofWidthRight, *oofWidth, oofHeightLeft,
971 oofHeightRight, *oofHeight);
978 DBG_OBJ_ENTER (
"resize.oofm", 0,
"getFloatsSize",
"(%d * (%d + %d), %s, ...",
980 side ==
LEFT ?
"LEFT" :
"RIGHT");
984 *width = *height = 0;
986 DBG_OBJ_MSGF (
"resize.oofm", 1,
"%d floats on this side", list->size());
988 for (
int i = 0; i < list->size(); i++) {
989 Float *vloat = list->get(i);
992 "float %p has generator %p (container is %p)",
998 *height =
max (*height,
1013 DBG_OBJ_ENTER (
"resize.oofm", 0,
"getExtremes",
"(%d / %d), ...",
1016 int oofMinWidthtLeft, oofMinWidthRight, oofMaxWidthLeft, oofMaxWidthRight;
1020 *oofMinWidth =
max (oofMinWidthtLeft, oofMinWidthRight);
1021 *oofMaxWidth =
max (oofMaxWidthLeft, oofMaxWidthRight);
1024 "=> (l: %d, r: %d => %d) / (l: %d, r: %d => %d)",
1025 oofMinWidthtLeft, oofMinWidthRight, *oofMinWidth,
1026 oofMaxWidthLeft, oofMaxWidthRight, *oofMaxWidth);
1031 int *minWidth,
int *maxWidth)
1033 DBG_OBJ_ENTER (
"resize.oofm", 0,
"getFloatsExtremes",
"(%d / %d), %s, ...",
1035 side ==
LEFT ?
"LEFT" :
"RIGHT");
1037 *minWidth = *maxWidth = 0;
1042 for (
int i = 0; i < list->
size(); i++) {
1046 "float %p has generator %p (container is %p)",
1065 *maxWidth =
max (*maxWidth,
1082 DBG_OBJ_ENTER (
"oofm.common", 0,
"getOOFAwareWidgetWhenRegistered",
"%p",
1086 DBG_OBJ_MSGF (
"oofm.common", 1,
"found? %s", tbInfo ?
"yes" :
"no");
1093 DBG_OBJ_ENTER (
"oofm.common", 0,
"getOOFAwareWidget",
"%p", widget);
1104 DBG_OBJ_MSGF (
"border", 0,
"left border (%d, %d, %p, %d) => %d",
1105 y, h, lastGB, lastExtIndex, b);
1113 DBG_OBJ_MSGF (
"border", 0,
"right border (%d, %d, %p, %d) => %d",
1114 y, h, lastGB, lastExtIndex, b);
1121 DBG_OBJ_ENTER (
"border", 0,
"getBorder",
"%s, %d, %d, %p, %d",
1122 side ==
LEFT ?
"LEFT" :
"RIGHT", y, h, lastGB, lastExtIndex);
1126 int first = list->
findFirst (y, h, lastGB, lastExtIndex, &last);
1139 for (
int i = first; covers && i <= last; i++) {
1140 Float *vloat = list->get(i);
1141 covers = vloat->
covers (y, h);
1142 DBG_OBJ_MSGF (
"border", 1,
"float %d (%p) covers? %s.",
1143 i, vloat->
getWidget(), covers ?
"<b>yes</b>" :
"no");
1171 DBG_OBJ_MSGF (
"border", 1,
"thisBorder = %d + %d = %d",
1174 border =
max (border, thisBorder);
1187 DBG_OBJ_MSGF (
"border", 0,
"has float left (%d, %d, %p, %d) => %s",
1188 y, h, lastGB, lastExtIndex, b ?
"true" :
"false");
1196 DBG_OBJ_MSGF (
"border", 0,
"has float right (%d, %d, %p, %d) => %s",
1197 y, h, lastGB, lastExtIndex, b ?
"true" :
"false");
1204 DBG_OBJ_ENTER (
"border", 0,
"hasFloat",
"%s, %d, %d, %p, %d",
1205 side ==
LEFT ?
"LEFT" :
"RIGHT", y, h, lastGB, lastExtIndex);
1208 int first = list->
findFirst (y, h, lastGB, lastExtIndex, NULL);
1230 DBG_OBJ_ENTER (
"border", 0,
"getFloatHeight",
"%s, %d, %d, %p, %d",
1231 side ==
LEFT ?
"LEFT" :
"RIGHT", y, h, lastGB, lastExtIndex);
1234 int first = list->
findFirst (y, h, lastGB, lastExtIndex, NULL);
1235 assert (first != -1);
1238 Float *vloat = list->get (first);
1239 int yRelToFloat = y - vloat->
yReal;
1240 DBG_OBJ_MSGF (
"border", 1,
"caller is CB: yRelToFloat = %d - %d = %d",
1241 y, vloat->
yReal, yRelToFloat);
1254 DBG_OBJ_ENTER (
"resize.oofm", 0,
"getClearPosition",
"%p", widget);
1259 bool left =
false, right =
false;
1294 DBG_OBJ_ENTER (
"resize.oofm", 0,
"getClearPosition",
"%p, %s",
1295 widget, side ==
LEFT ?
"LEFT" :
"RIGHT");
1311 DBG_OBJ_MSGF (
"resize.oofm", 1,
"pos = max (%d + %d + %d - %d, 0)",
1331 DBG_OBJ_MSG (
"resize.oofm", 1,
"dirty: recalculation");
1334 vloat->
dirty =
false;
1337 DBG_OBJ_MSGF (
"resize.oofm", 1,
"size: %d * (%d + %d)",
1377 if (i < leftFloats->size())
Set at the top when drawing.
Set at the top when getting the widget at the point.
dw::core::Shape implemtation for simple rectangles.
static bool handledByStackingContextMgr(Widget *widget)
bool hasWidgetBeenProcessedAsInterruption(Widget *widget)
An interface to encapsulate platform dependent drawing.
int compare(Object *o1, Object *o2)
Compare two objects o1 and o2.
int compare(Object *o1, Object *o2)
Compare two objects o1 and o2.
int compare(Object *o1, Object *o2)
Compare two objects o1 and o2.
void intoStringBuffer(lout::misc::StringBuffer *sb)
Store a textual representation of the object in a misc::StringBuffer.
Float(OOFFloatsMgr *oofm, core::Widget *widget, OOFAwareWidget *generatingBlock, int externalIndex)
OOFAwareWidget * generator
bool covers(int y, int h)
y is given relative to the container.
This list is kept sorted.
int findFloatIndex(OOFAwareWidget *lastGB, int lastExtIndex)
int findLastBeforeSideSpanningIndex(int sideSpanningIndex)
int find(int y, int start, int end)
y is given relative to the container.
int findFirst(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex, int *lastReturn)
int compare(Object *o1, Object *o2)
Compare two objects o1 and o2.
TBInfo(OOFFloatsMgr *oofm, OOFAwareWidget *textblock, TBInfo *parent, int parentExtIndex)
lout::container::typed::Vector< Float > * rightFloats
OOFAwareWidget * getOOFAwareWidget()
lout::container::typed::Vector< Float > * leftFloats
OutOfFlowMgr implementation dealing with floats.
void getFloatsListsAndSide(Float *vloat, SortedFloatsVector **listSame, SortedFloatsVector **listOpp, Side *side)
core::Widget * getWidgetAtPoint(int x, int y, core::GettingWidgetAtPointContext *context)
bool hasFloat(Side side, int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
void moveExternalIndices(lout::container::typed::Vector< Float > *list, int oldStartIndex, int diff)
bool dealingWithSizeOfChild(core::Widget *child)
bool collidesV(Float *vloat, Float *other, int *yReal)
int getAvailHeightOfChild(core::Widget *child, bool forceValue)
static int getFloatIndexFromSubRef(int ref)
void getFloatsSize(core::Requisition *cbReq, Side side, int *width, int *height)
int getAvailWidthOfChild(core::Widget *child, bool forceValue)
int findTBInfo(int y)
y is given relative to the container.
core::Widget * getFloatWidgetAtPoint(SortedFloatsVector *list, int x, int y, core::GettingWidgetAtPointContext *context)
void tellIncompletePosition2(core::Widget *generator, core::Widget *widget, int x, int y)
int getRightFloatHeight(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
Assuming there is a float on the right side, return the rest height of it.
void ensureFloatSize(Float *vloat)
void updateGenerators(Float *vloat)
Update all generators which are affected by a given float.
OOFFloatsMgr(OOFAwareWidget *container, int oofmIndex)
int getLeftBorder(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
Get the left border for the vertical position of y, for a height of h", based on floats; relative to ...
bool collidesH(Float *vloat, Float *other)
void containerSizeChangedForChildren()
int getBorder(Side side, int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
core::Allocation containerAllocation
TBInfo * getOOFAwareWidget(OOFAwareWidget *widget)
lout::container::typed::Vector< TBInfo > * tbInfos
void tellPosition1(core::Widget *widget, int x, int y)
Called before tellPosition2, see there for more.
core::Widget * getWidget(int i)
bool containerMustAdjustExtraSpace()
bool hasFloatRight(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
Return whether there is a float on the right side.
void getExtremes(core::Extremes *cbExtr, int *oofMinWidth, int *oofMaxWidth)
bool affectsLeftBorder(core::Widget *widget)
static int createSubRefLeftFloat(int index)
void getFloatsExtremes(core::Extremes *cbExtr, Side side, int *minWidth, int *maxWidth)
void sizeAllocateEnd(OOFAwareWidget *caller)
void addWidgetInFlow(OOFAwareWidget *textblock, OOFAwareWidget *parentBlock, int externalIndex)
void calcWidgetRefSize(core::Widget *widget, core::Requisition *size)
static bool isSubRefLeftFloat(int ref)
void tellPosition2(core::Widget *widget, int x, int y)
Called after tellPosition1.
void draw(core::View *view, core::Rectangle *area, core::DrawingContext *context)
OOFAwareWidget * container
static int createSubRefRightFloat(int index)
lout::container::typed::HashTable< lout::object::TypedPointer< OOFAwareWidget >, TBInfo > * tbInfosByOOFAwareWidget
bool affectsRightBorder(core::Widget *widget)
void markSizeChange(int ref)
int calcFloatX(Float *vloat)
Return position of a float relative to the container.
int getRightBorder(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
Get the right border for the vertical position of y, for a height of h, based on floats; relative to ...
void sizeAllocateFloats(Side side)
int getLeftFloatHeight(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
Assuming there is a float on the left side, return the rest height of it.
Float * findFloatByWidget(core::Widget *widget)
int getClearPosition(OOFAwareWidget *widget, Side side)
lout::container::typed::HashTable< lout::object::TypedPointer< dw::core::Widget >, Float > * floatsByWidget
TBInfo * getOOFAwareWidgetWhenRegistered(OOFAwareWidget *widget)
bool hasFloatLeft(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
Return whether there is a float on the left side.
void markExtremesChange(int ref)
void getSize(core::Requisition *cbReq, int *oofWidth, int *oofHeight)
int getFloatHeight(Side side, int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
void tellIncompletePosition1(core::Widget *generator, core::Widget *widget, int x, int y)
int addWidgetOOF(core::Widget *widget, OOFAwareWidget *generatingBlock, int externalIndex)
void drawFloats(SortedFloatsVector *list, core::View *view, core::Rectangle *area, core::DrawingContext *context)
bool mayAffectBordersAtAll()
void sizeAllocateStart(OOFAwareWidget *caller, core::Allocation *allocation)
SortedFloatsVector * rightFloats
SortedFloatsVector * leftFloats
Typed version of container::untyped::Vector.
void put(T *newElement, int newPos=-1)
A class for fast concatenation of a large number of strings.
void appendPointer(void *p)
void append(const char *str)
Append a NUL-terminated string to the buffer, with copying.
This is the base class for many other classes, which defines very common virtual methods.
A typed version of object::Pointer.
#define DBG_OBJ_ENTER0(aspect, prio, funname)
#define DBG_OBJ_SET_BOOL_O(obj, var, val)
#define DBG_OBJ_CREATE(klass)
#define DBG_OBJ_SET_BOOL(var, val)
#define DBG_OBJ_MSGF(aspect, prio, fmt,...)
#define DBG_OBJ_SET_NUM(var, val)
#define DBG_OBJ_MSG(aspect, prio, msg)
#define DBG_OBJ_LEAVE_VAL_O(obj, fmt,...)
#define DBG_OBJ_MSGF_O(aspect, prio, obj, fmt,...)
#define DBG_OBJ_ENTER(aspect, prio, funname, fmt,...)
#define DBG_OBJ_SET_NUM_O(obj, var, val)
#define DBG_OBJ_LEAVE_VAL(fmt,...)
#define DBG_OBJ_SET_PTR_O(obj, var, val)
#define DBG_OBJ_ENTER_O(aspect, prio, obj, funname, fmt,...)
#define DBG_OBJ_ARRATTRSET_PTR(var, ind, attr, val)
Anything related to Dillo Widget styles is defined here.
The core of Dw is defined in this namespace.
Dw is in this namespace, or sub namespaces of this one.
This namespace provides thin wrappers, implemented as C++ templates, to gain type-safety.
Miscellaneous stuff, which does not fit anywhere else.
void notImplemented(const char *name)
Here, some common classes (or interfaces) are defined, to standardize the access to other classes.
Represents the allocation, i.e.