Viewport: Render all types of RowItem
authorJoel Holdsworth <joel@airwebreathe.org.uk>
Tue, 1 Sep 2015 01:52:33 +0000 (19:52 -0600)
committerJoel Holdsworth <joel@airwebreathe.org.uk>
Sun, 18 Oct 2015 21:32:29 +0000 (15:32 -0600)
pv/view/viewport.cpp

index c55e76a2d301d0ce1b9e362a33194dbbe0909848..91b27d3ffb02ab383c3d2c801507191610a072e6 100644 (file)
@@ -96,10 +96,9 @@ void Viewport::drag_release()
 vector< shared_ptr<ViewItem> > Viewport::items()
 {
        vector< shared_ptr<ViewItem> > items;
-       const vector< shared_ptr<TraceTreeItem> > trace_tree_items(
-               view_.list_by_type<TraceTreeItem>());
-       copy(trace_tree_items.begin(), trace_tree_items.end(),
-               back_inserter(items));
+       const std::vector< shared_ptr<ViewItem> > view_items(
+               view_.list_by_type<ViewItem>());
+       copy(view_items.begin(), view_items.end(), back_inserter(items));
        const vector< shared_ptr<TimeItem> > time_items(view_.time_items());
        copy(time_items.begin(), time_items.end(), back_inserter(items));
        return items;
@@ -152,14 +151,13 @@ bool Viewport::touch_event(QTouchEvent *event)
 
 void Viewport::paintEvent(QPaintEvent*)
 {
-       vector< shared_ptr<TraceTreeItem> > trace_tree_items(
-               view_.list_by_type<TraceTreeItem>());
-       assert(none_of(trace_tree_items.begin(), trace_tree_items.end(),
-               [](const shared_ptr<TraceTreeItem> &r) { return !r; }));
+       vector< shared_ptr<RowItem> > row_items(view_.list_by_type<RowItem>());
+       assert(none_of(row_items.begin(), row_items.end(),
+               [](const shared_ptr<RowItem> &r) { return !r; }));
 
-       stable_sort(trace_tree_items.begin(), trace_tree_items.end(),
-               [](const shared_ptr<TraceTreeItem> &a, const shared_ptr<TraceTreeItem> &b) {
-                       return a->visual_v_offset() < b->visual_v_offset(); });
+       stable_sort(row_items.begin(), row_items.end(),
+               [](const shared_ptr<RowItem> &a, const shared_ptr<RowItem> &b) {
+                       return a->point(QRect()).y() < b->point(QRect()).y(); });
 
        const vector< shared_ptr<TimeItem> > time_items(view_.time_items());
        assert(none_of(time_items.begin(), time_items.end(),
@@ -172,17 +170,17 @@ void Viewport::paintEvent(QPaintEvent*)
 
        for (const shared_ptr<TimeItem> t : time_items)
                t->paint_back(p, pp);
-       for (const shared_ptr<TraceTreeItem> r : trace_tree_items)
+       for (const shared_ptr<RowItem> r : row_items)
                r->paint_back(p, pp);
 
        for (const shared_ptr<TimeItem> t : time_items)
                t->paint_mid(p, pp);
-       for (const shared_ptr<TraceTreeItem> r : trace_tree_items)
+       for (const shared_ptr<RowItem> r : row_items)
                r->paint_mid(p, pp);
 
        p.setRenderHint(QPainter::Antialiasing, false);
 
-       for (const shared_ptr<TraceTreeItem> r : trace_tree_items)
+       for (const shared_ptr<RowItem> r : row_items)
                r->paint_fore(p, pp);
        for (const shared_ptr<TimeItem> t : time_items)
                t->paint_fore(p, pp);