コード例 #1
0
ファイル: mgcmderase.cpp プロジェクト: Vito2015/vgcore
bool MgCmdErase::touchEnded(const MgMotion* sender)
{
    MgShapes* s = sender->view->shapes();
    
    if (!m_delIds.empty()
        && sender->view->shapeWillDeleted(s->findShape(m_delIds.front()))) {
        int count = 0;
        std::vector<int>::iterator it = m_delIds.begin();
        
        for (; it != m_delIds.end(); ++it) {
            count += sender->view->removeShape(s->findShape(*it));
        }
        if (count > 0) {
            sender->view->regenAll(true);
            char buf[31];
            MgLocalized::formatString(buf, sizeof(buf), sender->view, "@shape_n_deleted", count);
            sender->view->showMessage(buf);
        }
    }
    
    m_delIds.clear();
    m_boxsel = false;
    sender->view->redraw();
    
    return true;
}
コード例 #2
0
ファイル: mgcmdmgr2.cpp プロジェクト: hantu123/touchvg
void MgCmdManagerImpl::eraseWnd(const MgMotion* sender)
{
    Box2d snap(sender->view->xform()->getWndRectM());
    std::vector<int> delIds;
    MgShapes* s = sender->view->shapes();
    MgShapeIterator it(s);
    
    while (MgShape* shape = it.getNext()) {
        if (shape->shape()->hitTestBox(snap)) {
            delIds.push_back(shape->getID());
        }
    }
    
    if (!delIds.empty()
        && sender->view->shapeWillDeleted(s->findShape(delIds.front()))) {
        MgShapesLock locker(MgShapesLock::Remove, sender->view);
        
        for (std::vector<int>::iterator i = delIds.begin(); i != delIds.end(); ++i) {
            MgShape* shape = s->findShape(*i);
            if (shape && sender->view->removeShape(shape)) {
                shape->release();
            }
        }
        sender->view->regenAll();
    }
}
コード例 #3
0
ファイル: mgcmderase.cpp プロジェクト: thinkfeed/touchvg
bool MgCmdErase::touchEnded(const MgMotion* sender)
{
    MgShapes* s = sender->view->shapes();
    
    if (!m_delIds.empty()
        && sender->view->shapeWillDeleted(s->findShape(m_delIds.front()))) {
        MgShapesLock locker(s, MgShapesLock::Remove);
        int count = 0;
        
        for (std::vector<int>::iterator it = m_delIds.begin(); it != m_delIds.end(); ++it) {
            MgShape* shape = s->findShape(*it);
            if (shape && sender->view->removeShape(shape)) {
                shape->release();
                count++;
            }
        }
        if (count > 0) {
            sender->view->regen();
        }
    }
    
    m_delIds.clear();
    m_boxsel = false;
    sender->view->redraw(false);
    
    return true;
}
コード例 #4
0
ファイル: gicorerecord.cpp プロジェクト: lileichuan/vgcore
MgShapes* GiPlaying::getBackShapes(bool needClear)
{
    if (needClear || !impl->back) {
        MgObject::release_pointer(impl->back);
        impl->back = MgShapes::create();
    } else {
        MgShapes* old = impl->back;
        impl->back = old->shallowCopy();
        MgObject::release_pointer(old);
    }
    return impl->back;
}