diff options
Diffstat (limited to 'dw')
-rw-r--r-- | dw/fltkviewbase.cc | 9 | ||||
-rw-r--r-- | dw/fltkviewbase.hh | 2 | ||||
-rw-r--r-- | dw/oofawarewidget.hh | 52 | ||||
-rw-r--r-- | dw/textblock.cc | 4 | ||||
-rw-r--r-- | dw/textblock.hh | 6 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 21 | ||||
-rw-r--r-- | dw/widget.cc | 6 |
7 files changed, 67 insertions, 33 deletions
diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc index f7e331fc..68218800 100644 --- a/dw/fltkviewbase.cc +++ b/dw/fltkviewbase.cc @@ -69,7 +69,7 @@ FltkViewBase::FltkViewBase (int x, int y, int w, int h, const char *label): canvasHeight = 1; bgColor = FL_WHITE; mouse_x = mouse_y = 0; - // focused_child = NULL; + focused_child = NULL; exposeArea = NULL; if (backBuffer == NULL) { backBuffer = new BackBuffer (); @@ -355,8 +355,6 @@ int FltkViewBase::handle (int event) case FL_LEAVE: theLayout->leaveNotify (this, getDwButtonState ()); break; -#if 0 - // BUG: starting with fltk-1.3.3, we can't use fl_oldfocus. case FL_FOCUS: if (focused_child && find(focused_child) < children()) { /* strangely, find() == children() if the child is not found */ @@ -364,9 +362,10 @@ int FltkViewBase::handle (int event) } return 1; case FL_UNFOCUS: - focused_child = fl_oldfocus; + // FLTK delivers UNFOCUS to the previously focused widget + if (find(Fl::focus()) < children()) + focused_child = Fl::focus(); // remember the focused child! return 0; -#endif case FL_KEYBOARD: if (Fl::event_key() == FL_Tab) return manageTabToFocus(); diff --git a/dw/fltkviewbase.hh b/dw/fltkviewbase.hh index 88fd9041..eb4ec322 100644 --- a/dw/fltkviewbase.hh +++ b/dw/fltkviewbase.hh @@ -56,7 +56,7 @@ protected: core::Layout *theLayout; int canvasWidth, canvasHeight; int mouse_x, mouse_y; - // Fl_Widget *focused_child; + Fl_Widget *focused_child; virtual int translateViewXToCanvasX (int x) = 0; virtual int translateViewYToCanvasY (int y) = 0; diff --git a/dw/oofawarewidget.hh b/dw/oofawarewidget.hh index 95af54a0..8fb32716 100644 --- a/dw/oofawarewidget.hh +++ b/dw/oofawarewidget.hh @@ -144,23 +144,6 @@ protected: { return oofContainer[oofmIndex] ? oofContainer[oofmIndex]->outOfFlowMgr[oofmIndex] : NULL; } - static inline bool testWidgetFloat (Widget *widget) - { return widget->getStyle()->vloat != core::style::FLOAT_NONE; } - static inline bool testWidgetAbsolutelyPositioned (Widget *widget) - { return widget->getStyle()->position == core::style::POSITION_ABSOLUTE; } - static inline bool testWidgetFixedlyPositioned (Widget *widget) - { return widget->getStyle()->position == core::style::POSITION_FIXED; } - static inline bool testWidgetPositioned (Widget *widget) - { return testWidgetAbsolutelyPositioned (widget) || - testWidgetRelativelyPositioned (widget) || - testWidgetFixedlyPositioned (widget); } - static inline bool testWidgetOutOfFlow (Widget *widget) - { return testWidgetFloat (widget) || testWidgetAbsolutelyPositioned (widget) - || testWidgetFixedlyPositioned (widget); } - - static inline bool testWidgetRelativelyPositioned (Widget *widget) - { return widget->getStyle()->position == core::style::POSITION_RELATIVE; } - static bool getOOFMIndex (Widget *widget); void initOutOfFlowMgrs (); @@ -232,6 +215,41 @@ public: OOFAwareWidget (); ~OOFAwareWidget (); + static inline bool testStyleFloat (core::style::Style *style) + { return style->vloat != core::style::FLOAT_NONE; } + + static inline bool testStyleAbsolutelyPositioned (core::style::Style *style) + { return style->position == core::style::POSITION_ABSOLUTE; } + static inline bool testStyleFixedlyPositioned (core::style::Style *style) + { return style->position == core::style::POSITION_FIXED; } + static inline bool testStyleRelativelyPositioned (core::style::Style *style) + { return style->position == core::style::POSITION_RELATIVE; } + + static inline bool testStylePositioned (core::style::Style *style) + { return testStyleAbsolutelyPositioned (style) || + testStyleRelativelyPositioned (style) || + testStyleFixedlyPositioned (style); } + + static inline bool testStyleOutOfFlow (core::style::Style *style) + { return testStyleFloat (style) || testStyleAbsolutelyPositioned (style) + || testStyleFixedlyPositioned (style); } + + static inline bool testWidgetFloat (Widget *widget) + { return testStyleFloat (widget->getStyle ()); } + + static inline bool testWidgetAbsolutelyPositioned (Widget *widget) + { return testStyleAbsolutelyPositioned (widget->getStyle ()); } + static inline bool testWidgetFixedlyPositioned (Widget *widget) + { return testStyleFixedlyPositioned (widget->getStyle ()); } + static inline bool testWidgetRelativelyPositioned (Widget *widget) + { return testStyleRelativelyPositioned (widget->getStyle ()); } + + static inline bool testWidgetPositioned (Widget *widget) + { return testStylePositioned (widget->getStyle ()); } + + static inline bool testWidgetOutOfFlow (Widget *widget) + { return testStyleOutOfFlow (widget->getStyle ()); } + bool doesWidgetOOFInterruptDrawing (Widget *widget); void draw (core::View *view, core::Rectangle *area, diff --git a/dw/textblock.cc b/dw/textblock.cc index c9709f4d..20c114fa 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -2539,7 +2539,7 @@ void Textblock::fillSpace (int wordNo, core::style::Style *style) setBreakOption (word, style, 0, 0, false); word->content.space = true; - word->effSpace = word->origSpace = + word->origSpace = word->effSpace = style->font->spaceWidth + style->wordSpacing; removeSpaceImgRenderer (wordNo); @@ -3156,8 +3156,6 @@ Textblock *Textblock::getTextblockForLine (int firstWord, int lastWord) Textblock *textblock = NULL; if (firstWord < words->size ()) { - DBG_MSG_WORD ("resize", 1, "<i>first word:</i> ", firstWord, ""); - // A textblock is always between two line breaks, and so the // first word of the line. Word *word = words->getRef (firstWord); diff --git a/dw/textblock.hh b/dw/textblock.hh index aaab0e1a..c4f2c66d 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -607,7 +607,7 @@ protected: lout::misc::NotSoSimpleVector <Word> *words; lout::misc::SimpleVector <Anchor> *anchors; - struct {int index, nChar;} + struct { int index, nChar; } hlStart[core::HIGHLIGHT_NUM_LAYERS], hlEnd[core::HIGHLIGHT_NUM_LAYERS]; int hoverLink; /* The link under the mouse pointer */ @@ -884,9 +884,7 @@ public: void addText (const char *text, size_t len, core::style::Style *style); inline void addText (const char *text, core::style::Style *style) - { - addText (text, strlen(text), style); - } + { addText (text, strlen(text), style); } void addWidget (core::Widget *widget, core::style::Style *style); bool addAnchor (const char *name, core::style::Style *style); void addSpace (core::style::Style *style); diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index cdd99197..5cc6ad65 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -1735,7 +1735,7 @@ void Textblock::alignLine (int lineIndex) this->lineBreakWidth - (line->leftOffset + line->rightOffset); for (int i = line->firstWord; i < line->lastWord; i++) - words->getRef(i)->origSpace = words->getRef(i)->effSpace; + words->getRef(i)->effSpace = words->getRef(i)->origSpace; if (firstWord->content.type != core::Content::BREAK) { switch (firstWord->style->textAlign) { @@ -2130,8 +2130,23 @@ void Textblock::showMissingLines () void Textblock::removeTemporaryLines () { - lines->setSize (nonTemporaryLines); - DBG_OBJ_SET_NUM ("lines.size", lines->size ()); + DBG_OBJ_ENTER0 ("construct.line", 0, "removeTemporaryLines"); + + if (nonTemporaryLines < lines->size ()) { + lines->setSize (nonTemporaryLines); + DBG_OBJ_SET_NUM ("lines.size", lines->size ()); + + // For words which will be added, the values calculated before in + // accumulateWordData() are wrong, so it is called again. (Actually, the + // words from the first temporary line are correct, but for simplicity, + // we re-calculate all.) + int firstWord = + lines->size () > 0 ? lines->getLastRef()->lastWord + 1 : 0; + for (int i = firstWord; i < words->size (); i++) + accumulateWordData (i); + } + + DBG_OBJ_LEAVE (); } int Textblock::getSpaceShrinkability(struct Word *word) diff --git a/dw/widget.cc b/dw/widget.cc index 8840fc3a..c02b007f 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -1358,6 +1358,12 @@ void Widget::setStyle (style::Style *style) DBG_OBJ_SET_NUM ("style.height (raw)", style->height); DBG_OBJ_SET_NUM ("style.min-height (raw)", style->minHeight); DBG_OBJ_SET_NUM ("style.max-height (raw)", style->maxHeight); + + if (style->backgroundColor) + DBG_OBJ_SET_COL ("style.background-color", + style->backgroundColor->getColor ()); + else + DBG_OBJ_SET_SYM ("style.background-color", "transparent"); } /** |