diff options
author | Sebastian Geerken <devnull@localhost> | 2013-01-13 15:21:46 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2013-01-13 15:21:46 +0100 |
commit | 5797bbb234071775fe6148a29c9224c04912c8c1 (patch) | |
tree | 4bd03596f875f886f7951e43526341b128c087c7 /dw | |
parent | 657daf90e9a24bfeb3c38aca2682b5f36d86dff3 (diff) | |
parent | 927887827f2a440f1f1b39e58d87b12154098d4a (diff) |
Update with main repo.
Diffstat (limited to 'dw')
-rw-r--r-- | dw/core.hh | 4 | ||||
-rw-r--r-- | dw/events.hh | 2 | ||||
-rw-r--r-- | dw/findtext.cc | 2 | ||||
-rw-r--r-- | dw/findtext.hh | 2 | ||||
-rw-r--r-- | dw/fltkcore.hh | 2 | ||||
-rw-r--r-- | dw/fltkimgbuf.cc | 2 | ||||
-rw-r--r-- | dw/fltkimgbuf.hh | 2 | ||||
-rw-r--r-- | dw/fltkviewport.cc | 15 | ||||
-rw-r--r-- | dw/imgbuf.hh | 2 | ||||
-rw-r--r-- | dw/iterator.cc | 2 | ||||
-rw-r--r-- | dw/iterator.hh | 2 | ||||
-rw-r--r-- | dw/layout.cc | 3 | ||||
-rw-r--r-- | dw/layout.hh | 2 | ||||
-rw-r--r-- | dw/platform.hh | 2 | ||||
-rw-r--r-- | dw/selection.cc | 2 | ||||
-rw-r--r-- | dw/selection.hh | 2 | ||||
-rw-r--r-- | dw/style.cc | 2 | ||||
-rw-r--r-- | dw/style.hh | 2 | ||||
-rw-r--r-- | dw/textblock.cc | 8 | ||||
-rw-r--r-- | dw/textblock.hh | 4 | ||||
-rw-r--r-- | dw/textblock_iterator.cc | 24 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 29 | ||||
-rw-r--r-- | dw/types.cc | 2 | ||||
-rw-r--r-- | dw/types.hh | 2 | ||||
-rw-r--r-- | dw/ui.cc | 2 | ||||
-rw-r--r-- | dw/view.hh | 2 | ||||
-rw-r--r-- | dw/widget.cc | 4 | ||||
-rw-r--r-- | dw/widget.hh | 2 |
28 files changed, 73 insertions, 58 deletions
@@ -31,10 +31,8 @@ namespace ui { class ResourceFactory; } // namespace ui - - -} // namespace dw } // namespace core +} // namespace dw #include "../lout/object.hh" #include "../lout/container.hh" diff --git a/dw/events.hh b/dw/events.hh index c29cb7f4..5309186e 100644 --- a/dw/events.hh +++ b/dw/events.hh @@ -77,7 +77,7 @@ public: Widget *lastWidget, *currentWidget; }; -} // namespace dw } // namespace core +} // namespace dw #endif // __DW_EVENTS_HH__ diff --git a/dw/findtext.cc b/dw/findtext.cc index 9e9076dc..19485078 100644 --- a/dw/findtext.cc +++ b/dw/findtext.cc @@ -288,5 +288,5 @@ bool FindtextState::search0 (bool backwards, bool firstTrial) return ret; } -} // namespace dw } // namespace core +} // namespace dw diff --git a/dw/findtext.hh b/dw/findtext.hh index 14789878..c6803485 100644 --- a/dw/findtext.hh +++ b/dw/findtext.hh @@ -78,7 +78,7 @@ public: void resetSearch (); }; -} // namespace dw } // namespace core +} // namespace dw #endif // __DW_FINDTEXT_STATE_H__ diff --git a/dw/fltkcore.hh b/dw/fltkcore.hh index 376f588e..2a20a610 100644 --- a/dw/fltkcore.hh +++ b/dw/fltkcore.hh @@ -11,7 +11,7 @@ class FltkResource; } // namespace ui } // namespace fltk -} // namespace core +} // namespace dw #include <FL/Fl_Widget.H> diff --git a/dw/fltkimgbuf.cc b/dw/fltkimgbuf.cc index 4ede6c5b..3c3c9236 100644 --- a/dw/fltkimgbuf.cc +++ b/dw/fltkimgbuf.cc @@ -326,5 +326,5 @@ void FltkImgbuf::draw (Fl_Widget *target, int xRoot, int yRoot, } -} // namespace dw } // namespace fltk +} // namespace dw diff --git a/dw/fltkimgbuf.hh b/dw/fltkimgbuf.hh index 30e0cc37..34c6bfd8 100644 --- a/dw/fltkimgbuf.hh +++ b/dw/fltkimgbuf.hh @@ -59,7 +59,7 @@ public: int x, int y, int width, int height); }; -} // namespace dw } // namespace fltk +} // namespace dw #endif // __DW_FLTK_IMGBUF_HH__ diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc index c062cf71..de4c8f94 100644 --- a/dw/fltkviewport.cc +++ b/dw/fltkviewport.cc @@ -208,19 +208,14 @@ void FltkViewport::draw () if (d) { draw_area(this, x(), y(), w () - hdiff, h () - vdiff); - if (d == FL_DAMAGE_CHILD) { - if (hscrollbar->damage ()) - draw_child (*hscrollbar); - if (vscrollbar->damage ()) - draw_child (*vscrollbar); - } else { + if (d == FL_DAMAGE_ALL || hscrollbar->damage ()) draw_child (*hscrollbar); + if (d == FL_DAMAGE_ALL || vscrollbar->damage ()) draw_child (*vscrollbar); - if (d == FL_DAMAGE_ALL && hdiff && vdiff) { - fl_color(FL_BACKGROUND_COLOR); - fl_rectf(x()+w()-hdiff, y()+h()-vdiff, hdiff, vdiff); - } + if (d == FL_DAMAGE_ALL && hdiff && vdiff) { + fl_color(FL_BACKGROUND_COLOR); + fl_rectf(x()+w()-hdiff, y()+h()-vdiff, hdiff, vdiff); } } diff --git a/dw/imgbuf.hh b/dw/imgbuf.hh index d6f41d21..02ba9087 100644 --- a/dw/imgbuf.hh +++ b/dw/imgbuf.hh @@ -202,7 +202,7 @@ public: virtual bool isReferred () = 0; }; -} // namespace dw } // namespace core +} // namespace dw #endif // __DW_IMGBUF_HH__ diff --git a/dw/iterator.cc b/dw/iterator.cc index 9ad4d5a9..ccfc068b 100644 --- a/dw/iterator.cc +++ b/dw/iterator.cc @@ -846,5 +846,5 @@ void CharIterator::unhighlight (CharIterator *it1, CharIterator *it2, } } -} // namespace dw } // namespace core +} // namespace dw diff --git a/dw/iterator.hh b/dw/iterator.hh index 9d284fed..a48356ef 100644 --- a/dw/iterator.hh +++ b/dw/iterator.hh @@ -258,7 +258,7 @@ public: hpos, vpos); } }; -} // namespace dw } // namespace core +} // namespace dw #endif // __ITERATOR_HH__ diff --git a/dw/layout.cc b/dw/layout.cc index 35279243..209decc8 100644 --- a/dw/layout.cc +++ b/dw/layout.cc @@ -1051,6 +1051,5 @@ void Layout::viewportSizeChanged (View *view, int width, int height) setSizeHints (); } -} // namespace dw } // namespace core - +} // namespace dw diff --git a/dw/layout.hh b/dw/layout.hh index 7f33594b..d3ace03a 100644 --- a/dw/layout.hh +++ b/dw/layout.hh @@ -389,8 +389,8 @@ public: inline style::Color* getBgColor () { return bgColor; } }; -} // namespace dw } // namespace core +} // namespace dw #endif // __DW_LAYOUT_HH__ diff --git a/dw/platform.hh b/dw/platform.hh index c7eb37ee..1e16dcfe 100644 --- a/dw/platform.hh +++ b/dw/platform.hh @@ -164,7 +164,7 @@ public: virtual ui::ResourceFactory *getResourceFactory () = 0; }; -} // namespace dw } // namespace core +} // namespace dw #endif // __DW_PLATFORM_HH__ diff --git a/dw/selection.cc b/dw/selection.cc index 64a0b526..8b4cf318 100644 --- a/dw/selection.cc +++ b/dw/selection.cc @@ -476,5 +476,5 @@ void SelectionState::copy() } } -} // namespace dw } // namespace core +} // namespace dw diff --git a/dw/selection.hh b/dw/selection.hh index 7f6b1a58..ef9df0e0 100644 --- a/dw/selection.hh +++ b/dw/selection.hh @@ -235,7 +235,7 @@ public: int linkNo, MousePositionEvent *event); }; -} // namespace dw } // namespace core +} // namespace dw #endif // __DW_SELECTION_H__ diff --git a/dw/style.cc b/dw/style.cc index 7083ef2a..2f64e468 100644 --- a/dw/style.cc +++ b/dw/style.cc @@ -966,5 +966,5 @@ void numtostr (int num, char *buf, int buflen, ListStyleType listStyleType) } } // namespace style -} // namespace dw } // namespace core +} // namespace dw diff --git a/dw/style.hh b/dw/style.hh index 0df5c5e0..41784c79 100644 --- a/dw/style.hh +++ b/dw/style.hh @@ -701,8 +701,8 @@ void drawBackground (View *view, Rectangle *area, void numtostr (int num, char *buf, int buflen, ListStyleType listStyleType); } // namespace style -} // namespace dw } // namespace core +} // namespace dw #endif // __DW_STYLE_HH__ diff --git a/dw/textblock.cc b/dw/textblock.cc index 79f801a9..fc298562 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -1462,8 +1462,7 @@ void Textblock::fillWord (Word *word, int width, int ascent, int descent, word->size.width = width; word->size.ascent = ascent; word->size.descent = descent; - word->origSpace = word->effSpace = word->stretchability = - word->shrinkability = 0; + word->origSpace = word->effSpace = 0; word->hyphenWidth = 0; word->badnessAndPenalty.setPenalty (PENALTY_PROHIBIT_BREAK); word->content.space = false; @@ -1974,11 +1973,6 @@ void Textblock::fillSpace (Word *word, core::style::Style *style) word->content.space = true; word->effSpace = word->origSpace = style->font->spaceWidth + style->wordSpacing; - word->stretchability = word->origSpace / 2; - if(style->textAlign == core::style::TEXT_ALIGN_JUSTIFY) - word->shrinkability = word->origSpace / 3; - else - word->shrinkability = 0; //DBG_OBJ_ARRSET_NUM (this, "words.%d.origSpace", wordIndex, // word->origSpace); diff --git a/dw/textblock.hh b/dw/textblock.hh index aefe63ef..e5423c98 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -322,7 +322,6 @@ protected: core::Requisition size; /* Space after the word, only if it's not a break: */ short origSpace; /* from font, set by addSpace */ - short stretchability, shrinkability; short effSpace; /* effective space, set by wordWrap, * used for drawing etc. */ short hyphenWidth; /* Additional width, when a word is part @@ -332,7 +331,6 @@ protected: * "hyphenWidth > 0" is also used to decide * whether to draw a hyphen. */ short flags; - short penaltyIndex; core::Content content; // accumulated values, relative to the beginning of the line @@ -628,6 +626,8 @@ protected: void handleWordExtremes (int wordIndex); void correctLastWordExtremes (); + static int getShrinkability(struct Word *word); + static int getStretchability(struct Word *word); int hyphenateWord (int wordIndex); void accumulateWordForLine (int lineIndex, int wordIndex); void accumulateWordData (int wordIndex); diff --git a/dw/textblock_iterator.cc b/dw/textblock_iterator.cc index cfb235ac..285921b2 100644 --- a/dw/textblock_iterator.cc +++ b/dw/textblock_iterator.cc @@ -198,6 +198,11 @@ void Textblock::TextblockIterator::highlight (int start, int end, if (!oofm) { Textblock *textblock = (Textblock*)getWidget(); int index1 = index, index2 = index; + + int oldStartIndex = textblock->hlStart[layer].index; + int oldStartChar = textblock->hlStart[layer].nChar; + int oldEndIndex = textblock->hlEnd[layer].index; + int oldEndChar = textblock->hlEnd[layer].nChar; if (textblock->hlStart[layer].index > textblock->hlEnd[layer].index) { /* nothing is highlighted */ @@ -216,8 +221,12 @@ void Textblock::TextblockIterator::highlight (int start, int end, textblock->hlEnd[layer].index = index; textblock->hlEnd[layer].nChar = end; } - - textblock->queueDrawRange (index1, index2); + + if (oldStartIndex != textblock->hlStart[layer].index || + oldStartChar != textblock->hlStart[layer].nChar || + oldEndIndex != textblock->hlEnd[layer].index || + oldEndChar != textblock->hlEnd[layer].nChar) + textblock->queueDrawRange (index1, index2); } // TODO What about OOF widgets? @@ -233,6 +242,11 @@ void Textblock::TextblockIterator::unhighlight (int direction, if (textblock->hlStart[layer].index > textblock->hlEnd[layer].index) return; + int oldStartIndex = textblock->hlStart[layer].index; + int oldStartChar = textblock->hlStart[layer].nChar; + int oldEndIndex = textblock->hlEnd[layer].index; + int oldEndChar = textblock->hlEnd[layer].nChar; + if (direction == 0) { index1 = textblock->hlStart[layer].index; index2 = textblock->hlEnd[layer].index; @@ -248,7 +262,11 @@ void Textblock::TextblockIterator::unhighlight (int direction, textblock->hlEnd[layer].nChar = INT_MAX; } - textblock->queueDrawRange (index1, index2); + if (oldStartIndex != textblock->hlStart[layer].index || + oldStartChar != textblock->hlStart[layer].nChar || + oldEndIndex != textblock->hlEnd[layer].index || + oldEndChar != textblock->hlEnd[layer].nChar) + textblock->queueDrawRange (index1, index2); } // TODO What about OOF widgets? diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index f6851530..e35744dd 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -236,8 +236,8 @@ void Textblock::printWord (Word *word) printWordWithFlags (word); printf (" [%d / %d + %d - %d => %d + %d - %d] => ", - word->size.width, word->origSpace, word->stretchability, - word->shrinkability, word->totalWidth, word->totalStretchability, + word->size.width, word->origSpace, getStretchability(word), + getShrinkability(word), word->totalWidth, word->totalStretchability, word->totalShrinkability); word->badnessAndPenalty.print (); } @@ -255,14 +255,14 @@ void Textblock::justifyLine (Line *line, int diff) if (diff > 0) { int stretchabilitySum = 0; for (int i = line->firstWord; i < line->lastWord; i++) - stretchabilitySum += words->getRef(i)->stretchability; + stretchabilitySum += getStretchability(words->getRef(i)); if (stretchabilitySum > 0) { int stretchabilityCum = 0; int spaceDiffCum = 0; for (int i = line->firstWord; i < line->lastWord; i++) { Word *word = words->getRef (i); - stretchabilityCum += word->stretchability; + stretchabilityCum += getStretchability(word); int spaceDiff = stretchabilityCum * diff / stretchabilitySum - spaceDiffCum; spaceDiffCum += spaceDiff; @@ -276,14 +276,14 @@ void Textblock::justifyLine (Line *line, int diff) } else if (diff < 0) { int shrinkabilitySum = 0; for (int i = line->firstWord; i < line->lastWord; i++) - shrinkabilitySum += words->getRef(i)->shrinkability; + shrinkabilitySum += getShrinkability(words->getRef(i)); if (shrinkabilitySum > 0) { int shrinkabilityCum = 0; int spaceDiffCum = 0; for (int i = line->firstWord; i < line->lastWord; i++) { Word *word = words->getRef (i); - shrinkabilityCum += word->shrinkability; + shrinkabilityCum += getShrinkability(word); int spaceDiff = shrinkabilityCum * diff / shrinkabilitySum - spaceDiffCum; spaceDiffCum += spaceDiff; @@ -1067,9 +1067,9 @@ void Textblock::accumulateWordData (int wordIndex) + prevWord->origSpace - prevWord->hyphenWidth + word->size.width + word->hyphenWidth; word->totalStretchability = - prevWord->totalStretchability + prevWord->stretchability; + prevWord->totalStretchability + getStretchability(prevWord); word->totalShrinkability = - prevWord->totalShrinkability + prevWord->shrinkability; + prevWord->totalShrinkability + getShrinkability(prevWord); } word->badnessAndPenalty.calcBadness (word->totalWidth, availWidth, @@ -1300,4 +1300,17 @@ void Textblock::removeTemporaryLines () lines->setSize (nonTemporaryLines); } +int Textblock::getShrinkability(struct Word *word) +{ + if (word->spaceStyle->textAlign == core::style::TEXT_ALIGN_JUSTIFY) + return word->origSpace / 3; + else + return 0; +} + +int Textblock::getStretchability(struct Word *word) +{ + return word->origSpace / 2; +} + } // namespace dw diff --git a/dw/types.cc b/dw/types.cc index 70433456..a2f0737e 100644 --- a/dw/types.cc +++ b/dw/types.cc @@ -321,5 +321,5 @@ void Content::printMask (Type mask) (mask & BREAK) ? "br" : "--"); } -} // namespace dw } // namespace core +} // namespace dw diff --git a/dw/types.hh b/dw/types.hh index e933a98c..0e664895 100644 --- a/dw/types.hh +++ b/dw/types.hh @@ -227,7 +227,7 @@ struct Content static void printMask (Type mask); }; -} // namespace dw } // namespace core +} // namespace dw #endif // __DW_TYPES_HH__ @@ -381,5 +381,5 @@ Iterator *RadioButtonResource::iterator (Content::Type mask, bool atEnd) } // namespace ui } // namespace core -} // namespace core +} // namespace dw @@ -205,7 +205,7 @@ public: virtual void mergeClippingView (View *clippingView) = 0; }; -} // namespace dw } // namespace core +} // namespace dw #endif // __DW_VIEW_HH__ diff --git a/dw/widget.cc b/dw/widget.cc index a4f62174..8f5bc5d5 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -642,7 +642,5 @@ void Widget::removeChild (Widget *child) misc::assertNotReached (); } - - -} // namespace dw } // namespace core +} // namespace dw diff --git a/dw/widget.hh b/dw/widget.hh index ff52e096..58306c92 100644 --- a/dw/widget.hh +++ b/dw/widget.hh @@ -321,7 +321,7 @@ public: virtual void removeChild (Widget *child); }; -} // namespace dw } // namespace core +} // namespace dw #endif // __DW_WIDGET_HH__ |