Esempio n. 1
0
Process::GraphicsViewLayerModelPanelProxy::~GraphicsViewLayerModelPanelProxy()
{
    if(m_processPresenter)
    {
        deleteGraphicsObject(m_layerView);
        delete m_processPresenter;
    }

    delete m_obj;
    delete m_widget;
}
Esempio n. 2
0
 virtual ~CurveProcessPresenter()
 {
     deleteGraphicsObject(m_view);
 }
Esempio n. 3
0
StatePresenter::~StatePresenter()
{
    deleteGraphicsObject(m_view);
}
Esempio n. 4
0
CommentBlockPresenter::~CommentBlockPresenter()
{
    deleteGraphicsObject(m_view);
}
Esempio n. 5
0
EventPresenter::~EventPresenter()
{
    deleteGraphicsObject(m_view);
}
Esempio n. 6
0
TimeNodePresenter::~TimeNodePresenter()
{
    deleteGraphicsObject(m_view);
}
Esempio n. 7
0
void Presenter::modelReset()
{
    // 1. We put our current elements in our pool.
    std::vector<PointView*> points(m_points.get().begin(), m_points.get().end());
    std::vector<SegmentView*> segments(m_segments.get().begin(), m_segments.get().end());

    std::vector<PointView*> newPoints;
    std::vector<SegmentView*> newSegments;

    // 2. We add / remove new elements if necessary
    {
        int diff_points = m_model.points().size() - points.size();
        if(diff_points > 0)
        {
            points.reserve(points.size() + diff_points);
            for(;diff_points --> 0;)
            {
                auto pt = new PointView{nullptr, m_style, m_view};
                points.push_back(pt);
                newPoints.push_back(pt);
            }
        }
        else if(diff_points < 0)
        {
            int inv_diff_points = -diff_points;
            for(;inv_diff_points --> 0;)
            {
                deleteGraphicsObject(points[points.size() - inv_diff_points - 1]);
            }
            points.resize(points.size() + diff_points);
        }
    }

    // Same for segments
    {
        int diff_segts = m_model.segments().size() - segments.size();
        if(diff_segts > 0)
        {
            segments.reserve(segments.size() + diff_segts);
            for(;diff_segts --> 0;)
            {
                auto seg = new SegmentView{nullptr, m_style, m_view};
                segments.push_back(seg);
                newSegments.push_back(seg);
            }
        }
        else if(diff_segts < 0)
        {
            int inv_diff_segts = -diff_segts;
            for(;inv_diff_segts --> 0;)
            {
                deleteGraphicsObject(segments[segments.size() - inv_diff_segts - 1]);
            }
            segments.resize(segments.size() + diff_segts);
        }
    }

    ISCORE_ASSERT(points.size() == m_model.points().size());
    ISCORE_ASSERT(segments.size() == m_model.segments().size());

    // 3. We set the data
    { // Points
        int i = 0;
        for(const auto& point : m_model.points())
        {
            points.at(i)->setModel(point);
            i++;
        }
    }
    { // Segments
        int i = 0;
        for(const auto& segment : m_model.segments())
        {
            segments[i]->setModel(&segment);
            i++;
        }
    }

    for(const auto& seg : newSegments)
        setupSegmentConnections(seg);
    for(const auto& pt: newPoints)
        setupPointConnections(pt);

    // Now the ones that have a new model
    // 4. We put them all back in our maps.
    m_points.clear();
    m_segments.clear();

    for(const auto& pt_view : points)
    {
        addPoint_impl(pt_view);
    }
    for(const auto& seg_view : segments)
    {
        addSegment_impl(seg_view);
    }
}