当前位置: 首页>>代码示例>>C++>>正文


C++ MgCommand类代码示例

本文整理汇总了C++中MgCommand的典型用法代码示例。如果您正苦于以下问题:C++ MgCommand类的具体用法?C++ MgCommand怎么用?C++ MgCommand使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MgCommand类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

LRESULT CDrawShapeView::OnDelayLButtonUp(WPARAM wp, LPARAM lp)
{
    long downTime = wp;
    UINT downFlags = lp;

    if (downTime != m_downTime)
    {
        m_delayUp = FALSE;
    }
    else if (m_delayUp)
    {
        if (GetTickCount() - m_downTime < 100)
        {
            PostMessage(WM_DELAY_LBUTTONUP, downTime, downFlags);
        }
        else
        {
            MgCommand* cmd = mgGetCommandManager()->getCommand();
            if (cmd) cmd->click(&m_proxy->motion);

            m_delayUp = FALSE;
            m_downFlags = 0;
        }
    }

    return 0;
}
开发者ID:thinkfeed,项目名称:touchvg,代码行数:27,代码来源:Step3View.cpp

示例2: BUILD_VERSION

///////////////////////////////////////////////////////////////////////////////
/// \brief
/// Enumerates the resources in the specified repository.
/// Resources of all types can be enumerated all at once, or only
/// resources of a given type.
///
MgByteReader* MgProxyResourceService::EnumerateResources(
    MgResourceIdentifier* resource, INT32 depth, CREFSTRING type,
    INT32 properties, CREFSTRING fromDate, CREFSTRING toDate, bool computeChildren)
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,
                       MgCommand::knObject,
                       MgResourceService::opIdEnumerateResources,
                       7,
                       Resource_Service,
                       BUILD_VERSION(1,0,0),
                       MgCommand::knObject, resource,
                       MgCommand::knInt32, depth,
                       MgCommand::knString, &type,
                       MgCommand::knInt32, properties,
                       MgCommand::knString, &fromDate,
                       MgCommand::knString, &toDate,
                       MgCommand::knInt8, (int)computeChildren,
                       MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
开发者ID:kanbang,项目名称:Colt,代码行数:31,代码来源:ProxyResourceService.cpp

示例3: MG_TRY

///////////////////////////////////////////////////////////////////////////////
/// \brief
/// Enumerate the resource documents in the specified repository.
///
STRING MgProxyResourceService::EnumerateResourceDocuments(
    MgStringCollection* resources, CREFSTRING type, INT32 properties)
{
    STRING resourceList;
    MgCommand cmd;

    MG_TRY()

    cmd.ExecuteCommand(
        m_connProp,                                         // Connection
        MgCommand::knString,                                // Return type
        MgResourceService::opIdEnumerateResourceDocuments,  // Command code
        3,                                                  // Number of arguments
        Resource_Service,                                   // Service ID
        BUILD_VERSION(1,0,0),                               // Operation version
        MgCommand::knObject, resources,                     // Argument #1
        MgCommand::knString, &type,                         // Argument #2
        MgCommand::knInt32, properties,                     // Argument #3
        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    resourceList = *(cmd.GetReturnValue().val.m_str);
    delete cmd.GetReturnValue().val.m_str;

    MG_CATCH_AND_THROW(L"MgProxyResourceService.EnumerateResourceDocuments")

    return resourceList;
}
开发者ID:kanbang,项目名称:Colt,代码行数:33,代码来源:ProxyResourceService.cpp

示例4: mgGetCommandManager

void CDrawShapeView::OnDynDraw(GiGraphics* gs)
{
    MgCommand* cmd = mgGetCommandManager()->getCommand();
    if (cmd) {
        cmd->draw(&m_proxy->motion, gs);
    }
}
开发者ID:thinkfeed,项目名称:touchvg,代码行数:7,代码来源:Step3View.cpp

示例5: findCommand

bool MgCmdManagerImpl::setCommand(const MgMotion* sender,
                                  const char* name, MgStorage* s)
{
    if (strcmp(name, "@draw") == 0) {   // 将 @draw 换成上一次绘图命令名
        name = _drawcmd.empty() ? "splines" : _drawcmd.c_str();
    }

    MgCommand* cmd = findCommand(name);
    if (!cmd) {
        cmd = sender->view->getCmdSubject()->createCommand(sender, name);
        if (cmd) {
            _cmds[name] = cmd;
            LOGD("createCommand %d: %s", (int)_cmds.size(), name);
        }
    }
    
    if (strcmp(name, "erase") == 0 && _cmdname == "select") {   // 在选择命令中点橡皮擦
        MgSelection *sel = getSelection();
        if (sel && sel->deleteSelection(sender)) {      // 直接删除选中的图形
            return false;                               // 不切换到橡皮擦命令
        }
    }
    
    cancel(sender);
    
    bool ret = false;
    std::string oldname(_cmdname);
    
    if (cmd) {
        _cmdname = cmd->getName();
        
        ret = cmd->initialize(sender, s);
        if (!ret) {
            _cmdname = oldname;
        }
        else if (cmd->isDrawingCommand()) {
            _drawcmd = _cmdname;
        }
    }
    else {
        if (strcmp(name, "erasewnd") == 0) {
            eraseWnd(sender);
        }
        else {
            _cmdname = "select";
            cmd = findCommand(_cmdname.c_str());
            cmd->initialize(sender, s);
        }
    }
    
    if (MgBaseShape::minTol().equalPoint() < 1e-5) {
        MgBaseShape::minTol().setEqualPoint(sender->view->xform()->displayToModel(1.f, true));
    }
    if (oldname != _cmdname) {
        sender->view->commandChanged();
    }
    
    return ret;
}
开发者ID:arthur-zhang,项目名称:touchvg,代码行数:59,代码来源:mgcmdmgr_.cpp

示例6: BUILD_VERSION

///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Deletes the specified log if it exists.
/// </summary>
/// <param name="fileName'>
/// The name of the log to be deleted from the logs directory (does not include path)
/// </param>
/// <returns>
/// Nothing.
/// </returns>
///
/// EXCEPTIONS:
/// MgNullArgumentException
/// MgFileNotFoundException
/// MgFileIoException
void MgServerAdmin::DeleteLog(CREFSTRING fileName)
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                              // Connection
                        MgCommand::knVoid,                      // Return type expected
                        MgServerAdminServiceOpId::DeleteLog,    // Command Code
                        1,                                      // No. of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knString, &fileName,         // Argument #1
                        MgCommand::knNone);
}
开发者ID:asir6,项目名称:Colt,代码行数:27,代码来源:ServerAdmin.cpp

示例7: locker

bool GiCoreViewImpl::gestureToCommand(const MgMotion& motion)
{
    MgDynShapeLock locker(true, motion.view);
    MgCommand* cmd = _cmds->getCommand();
    bool ret = false;

    if (motion.gestureState == kMgGestureCancel || !cmd) {
        return cmd && cmd->cancel(&motion);
    }
    if (motion.gestureState == kMgGesturePossible
        && motion.gestureType != kGiTwoFingersMove) {
        return true;
    }

    switch (motion.gestureType)
    {
    case kGiTwoFingersMove:
        ret = cmd->twoFingersMove(&motion);
        break;
    case kGiGesturePan:
        switch (motion.gestureState)
        {
        case kMgGestureBegan:
            ret = cmd->touchBegan(&motion);
            break;
        case kMgGestureMoved:
            ret = cmd->touchMoved(&motion);
            break;
        case kMgGestureEnded:
        default:
            ret = cmd->touchEnded(&motion);
            break;
        }
        break;
    case kGiGestureTap:
        ret = cmd->click(&motion);
        break;
    case kGiGestureDblTap:
        ret = cmd->doubleClick(&motion);
        break;
    case kGiGesturePress:
        ret = cmd->longPress(&motion);
        break;
    }

    if (!ret) {
        LOGD("The current command (%s) don't support #%d gesture (state=%d)",
            cmd->getName(), motion.gestureType, motion.gestureState);
    }
    return ret;
}
开发者ID:arthur-zhang,项目名称:touchvg,代码行数:51,代码来源:gicoreview.cpp

示例8: getBoundingBox

void MgCmdManagerImpl::getBoundingBox(Box2d& box, const MgMotion* sender)
{
    MgCommand* cmd = sender->cmds()->getCommand();
    Box2d selbox;

    if (cmd && strcmp(cmd->getName(), MgCmdSelect::Name()) == 0) {
        MgCmdSelect* sel = (MgCmdSelect*)cmd;
        selbox = sel->getBoundingBox(sender);
    }

    box = selbox.isEmpty() ? Box2d(sender->pointM, 0, 0) : selbox;
    box *= sender->view->xform()->modelToDisplay();
    box.normalize();
}
开发者ID:rhcad,项目名称:touchvg-v0.6,代码行数:14,代码来源:mgcmdmgr2.cpp

示例9: draw

bool TransformCmd::draw(const MgMotion* sender, GiGraphics* gs)
{
    if (_lastCmd)
        _lastCmd->draw(sender, gs);
    
    char text[20];
    GiContext ctx(-10, GiColor(255, 0, 0, 128));
    gs->drawLine(&ctx, getPointM(0, sender), getPointM(1, sender));

    Point2d pt(getPointM(1, sender) * gs->xf().modelToDisplay());
#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC8
    sprintf_s(text, sizeof(text), "X %d %dd", 
#else
    sprintf(text, "X %d %dd", 
#endif
        mgRound(_axis[0].length()), mgRound(_axis[0].angle2() * _M_R2D));
    gs->rawTextCenter(text, pt.x, pt.y, 40);
    
    ctx.setLineColor(GiColor(0, 0, 255, 128));
    gs->drawLine(&ctx, getPointM(0, sender), getPointM(2, sender));
    pt = getPointM(2, sender) * gs->xf().modelToDisplay();
#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC8
    sprintf_s(text, sizeof(text), "Y %d %dd", 
#else
    sprintf(text, "Y %d %dd", 
#endif
        mgRound(_axis[1].length()), mgRound(_axis[1].angle2() * _M_R2D));
    gs->rawTextCenter(text, pt.x, pt.y, 40);
    
    return true;
}
开发者ID:thinkfeed,项目名称:touchvg,代码行数:31,代码来源:TransformCmd.cpp

示例10: touchMoved

bool TransformCmd::touchMoved(const MgMotion* sender)
{
    if (_ptIndex >= 0) {
        setPointW(_ptIndex, sender);
    }
    return _ptIndex >= 0 || (_lastCmd && _lastCmd->touchMoved(sender));
}
开发者ID:thinkfeed,项目名称:touchvg,代码行数:7,代码来源:TransformCmd.cpp


注:本文中的MgCommand类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。