Skip to content

Commit

Permalink
Merge branch 'ui-log-textdrawable'
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jun 10, 2014
2 parents 45f13bd + 739216e commit 0fd62ce
Show file tree
Hide file tree
Showing 9 changed files with 268 additions and 253 deletions.
1 change: 1 addition & 0 deletions doomsday/libappfw/include/de/framework/textdrawable.h
Expand Up @@ -96,6 +96,7 @@ class LIBAPPFW_PUBLIC TextDrawable : public GLTextComposer
String text() const;
String plainText() const;
bool isBeingWrapped() const;
Font const &font() const;

private:
DENG2_PRIVATE(d)
Expand Down
3 changes: 0 additions & 3 deletions doomsday/libappfw/include/de/widgets/logwidget.h
Expand Up @@ -69,9 +69,6 @@ class LIBAPPFW_PUBLIC LogWidget : public ScrollAreaWidget
void drawContent();
bool handleEvent(Event const &event);

protected slots:
void pruneExcessEntries();

signals:
//void scrollPositionChanged(int pos);
//void scrollMaxChanged(int maximum);
Expand Down
27 changes: 21 additions & 6 deletions doomsday/libappfw/src/gltextcomposer.cpp
Expand Up @@ -83,22 +83,28 @@ DENG2_PIMPL(GLTextComposer)
{
if(!isLineVisible(i))
{
releaseLine(i);
releaseLine(i, ReleaseButKeepSegs);
}
}
}

void releaseLine(int index)
enum ReleaseBehavior { ReleaseFully, ReleaseButKeepSegs };

void releaseLine(int index, ReleaseBehavior behavior = ReleaseFully)
{
Line &ln = lines[index];
for(int i = 0; i < ln.segs.size(); ++i)
{
if(!ln.segs[i].id.isNone())
{
atlas->release(ln.segs[i].id);
ln.segs[i].id = Id::None;
}
}
ln.segs.clear();
if(behavior == ReleaseFully)
{
ln.segs.clear();
}
}

bool isLineVisible(int line) const
Expand Down Expand Up @@ -154,7 +160,7 @@ DENG2_PIMPL(GLTextComposer)
if(i < lines.size())
{
// Is the rasterized copy up to date?
if(!isLineVisible(i) || matchingSegments(i, info))
if(/*!isLineVisible(i) ||*/ matchingSegments(i, info))
{
// This line can be kept as is.
continue;
Expand Down Expand Up @@ -201,6 +207,8 @@ DENG2_PIMPL(GLTextComposer)
}
line.segs << seg;
}

DENG2_ASSERT(line.segs.size() == info.segs.size());
}

// Remove the excess lines.
Expand Down Expand Up @@ -286,7 +294,8 @@ DENG2_PIMPL(GLTextComposer)
// Set segment X coordinates by stacking them left-to-right on each line.
for(int i = lineRange.start; i < rangeEnd; ++i)
{
if(lines[i].segs.isEmpty()) continue;
if(lines[i].segs.isEmpty() || i >= visibleLineRange.end)
continue;

lines[i].segs[0].x = wraps->lineInfo(i).indent;

Expand All @@ -305,7 +314,11 @@ DENG2_PIMPL(GLTextComposer)
// Find the maximum right edge for this spot.
for(int i = lineRange.start; i < rangeEnd; ++i)
{
FontLineWrapping::LineInfo const &info = wraps->lineInfo(i);
if(i >= visibleLineRange.end) break;

FontLineWrapping::LineInfo const &info = wraps->lineInfo(i);

DENG2_ASSERT(info.segs.size() == lines[i].segs.size());
for(int k = 0; k < info.segs.size(); ++k)
{
Instance::Line::Segment &seg = lines[i].segs[k];
Expand All @@ -319,6 +332,8 @@ DENG2_PIMPL(GLTextComposer)
// Move the segments to this position.
for(int i = lineRange.start; i < rangeEnd; ++i)
{
if(i >= visibleLineRange.end) break;

int localRight = maxRight;

FontLineWrapping::LineInfo const &info = wraps->lineInfo(i);
Expand Down
5 changes: 5 additions & 0 deletions doomsday/libappfw/src/textdrawable.cpp
Expand Up @@ -290,4 +290,9 @@ bool TextDrawable::isBeingWrapped() const
return !d->tasks.isDone();
}

Font const &TextDrawable::font() const
{
return d->backWrap->font();
}

} // namespace de
4 changes: 2 additions & 2 deletions doomsday/libappfw/src/widgets/foldpanelwidget.cpp
Expand Up @@ -85,8 +85,8 @@ DENG2_PIMPL_NOREF(FoldPanelWidget)
ColorBank::Colorf const &textColor = fold.title().textColorf();

// Frame.
verts.makeFlexibleFrame(rect.toRectanglei(), 5, textColor,
atlas.imageRectf(root.roundCorners()));
/*verts.makeFlexibleFrame(rect.toRectanglei(), 5, textColor,
atlas.imageRectf(root.roundCorners()));*/

Rectanglef uv = atlas.imageRectf(root.styleTexture("fold"));
Matrix4f const turn = Matrix4f::rotateAround(rect.middle(), angle);
Expand Down

0 comments on commit 0fd62ce

Please sign in to comment.