예제 #1
0
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;
}
예제 #2
0
///////////////////////////////////////////////////////////////////////////////
/// \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;
}
예제 #3
0
///////////////////////////////////////////////////////////////////////////////
/// \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;
}
예제 #4
0
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Enumerate all the parent Map Definition resources of the specified
/// resources.
///
MgSerializableCollection* MgProxyResourceService::EnumerateParentMapDefinitions(
    MgSerializableCollection* resources)
{
    MgCommand cmd;

    MG_TRY()

    assert(m_connProp != NULL);

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

    SetWarning(cmd.GetWarningObject());

    MG_CATCH_AND_THROW(L"MgProxyResourceService.EnumerateParentMapDefinitions")

    return (MgSerializableCollection*)cmd.GetReturnValue().val.m_obj;
}
예제 #5
0
void CDrawShapeView::OnDynDraw(GiGraphics* gs)
{
    MgCommand* cmd = mgGetCommandManager()->getCommand();
    if (cmd) {
        cmd->draw(&m_proxy->motion, gs);
    }
}
예제 #6
0
void CDrawShapeView::OnMouseMove(UINT nFlags, CPoint point)
{
    CBaseView::OnMouseMove(nFlags, point);

    MgCommand* cmd = mgGetCommandManager()->getCommand();

    m_proxy->motion.dragging = (!m_delayUp && (nFlags & MK_LBUTTON)
        && (m_downFlags & MK_LBUTTON));
    if (m_proxy->motion.dragging)
    {
        m_proxy->motion.point = Point2d((float)point.x, (float)point.y);
        m_proxy->motion.pointM = m_proxy->motion.point * m_graph->xf.displayToModel();

        if (!m_moved && mgHypot(m_proxy->motion.point.x - m_proxy->motion.startPoint.x,
            m_proxy->motion.point.y - m_proxy->motion.startPoint.y) > 5)
        {
            m_moved = TRUE;
            if (cmd) cmd->touchBegan(&m_proxy->motion);
        }
        else if (m_moved)
        {
            if (cmd) cmd->touchMoved(&m_proxy->motion);
        }

        m_proxy->motion.lastPoint = m_proxy->motion.point;
        m_proxy->motion.lastPointM = m_proxy->motion.pointM;
    }
    else if (cmd && !(nFlags & MK_LBUTTON))
    {
        cmd->mouseHover(&m_proxy->motion);
    }
}
예제 #7
0
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;
}
예제 #8
0
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Gets the contents of the specified resources.
///
MgStringCollection* MgProxyResourceService::GetResourceContents(MgStringCollection* resources,
        MgStringCollection* preProcessTags)
{
    Ptr<MgStringCollection> resourceContents;

    MG_TRY()

    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,                      // Connection
                       MgCommand::knObject,                            // Return type expected
                       MgResourceService::opIdGetResourceContents,     // Command Code
                       2,                                              // Count of arguments
                       Resource_Service,                               // Service Id
                       BUILD_VERSION(2,2,0),                           // Operation version
                       MgCommand::knObject, resources,                 // Argument#1
                       MgCommand::knObject, preProcessTags,            // Argument#2
                       MgCommand::knNone);                             // End of argument

    SetWarning(cmd.GetWarningObject());

    resourceContents = (MgStringCollection*)cmd.GetReturnValue().val.m_obj;

    // Decrypt the document if Substitution pre-processing is required.
    if(preProcessTags != NULL && resourceContents != NULL && preProcessTags->GetCount() == resourceContents->GetCount())
    {
        for(INT32 i = 0; i < resourceContents->GetCount(); i ++)
        {
            STRING tag = preProcessTags->GetItem(i);

            if (MgResourcePreProcessingType::Substitution == tag)
            {
                STRING cipherContent = resourceContents->GetItem(i);

                string cipherText, plainText;
                MgUtil::WideCharToMultiByte(cipherContent, cipherText);

                MG_CRYPTOGRAPHY_TRY()

                MgCryptographyUtil cryptoUtil;

                cryptoUtil.DecryptString(cipherText, plainText);

                MG_CRYPTOGRAPHY_CATCH_AND_THROW(L"MgProxyResourceService.GetResourceContents")

                STRING decryptedContent;
                MgUtil::MultiByteToWideChar(plainText, decryptedContent);
                resourceContents->SetItem(i, decryptedContent);
            }
        }
    }

    MG_CATCH_AND_THROW(L"MgProxyResourceService.GetResourceContents")

    return resourceContents.Detach();
}
예제 #9
0
void CDrawShapeView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
    CBaseView::OnLButtonDblClk(nFlags, point);

    m_delayUp = FALSE;
    m_downFlags = 0;

    MgCommand* cmd = mgGetCommandManager()->getCommand();
    if (cmd) cmd->doubleClick(&m_proxy->motion);
}
예제 #10
0
///////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Returns tagged data for the specified resource.
/// </summary>
/// <param name="resource">
/// Resource identifier describing the resource.
/// </param>
/// <param name="dataName">
/// Name for data.  Either a resource-unique stream name for streams or a
/// resource-unique file name for file data.
/// </param>
/// <param name="preProcessTags">
/// Pre-processing to apply to resource data before returning.  An empty
/// string indicate no pre-processing. See MgResourcePreProcessingType for
/// a list of supported pre-processing tags.
/// </param>
/// <returns>
/// MgByteReader containing the previously updated or added tagged data.
/// </returns>
/// EXCEPTIONS:
/// MgRepositoryNotOpenException
///
/// MgResourceDataNotFoundException
/// MgInvalidResourceTypeException
///
MgByteReader* MgProxyResourceService::GetResourceData(
    MgResourceIdentifier* resource, CREFSTRING dataName,
    CREFSTRING preProcessTags)
{
    Ptr<MgByteReader> byteReader;

    MG_TRY()

    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,
                       MgCommand::knObject,
                       MgResourceService::opIdGetResourceData,
                       3,
                       Resource_Service,
                       BUILD_VERSION(1,0,0),
                       MgCommand::knObject, resource,
                       MgCommand::knString, &dataName,
                       MgCommand::knString, &preProcessTags,
                       MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    byteReader = (MgByteReader*)cmd.GetReturnValue().val.m_obj;

    // Decrypt the document if Substitution pre-processing is required.

    if (MgResourcePreProcessingType::Substitution == preProcessTags
            && byteReader != NULL)
    {
        STRING mimeType = byteReader->GetByteSource()->GetMimeType();
        string cipherText, plainText;

        byteReader->ToStringUtf8(cipherText);

        MG_CRYPTOGRAPHY_TRY()

        MgCryptographyUtil cryptoUtil;

        cryptoUtil.DecryptString(cipherText, plainText);

        MG_CRYPTOGRAPHY_CATCH_AND_THROW(L"MgProxyResourceService.GetResourceData")

        Ptr<MgByteSource> byteSource = new MgByteSource(
            (BYTE_ARRAY_IN)plainText.c_str(), (INT32)plainText.length());

        byteSource->SetMimeType(mimeType);
        byteReader = byteSource->GetReader();
    }

    MG_CATCH_AND_THROW(L"MgProxyResourceService.GetResourceData")

    return byteReader.Detach();
}
예제 #11
0
파일: ServerAdmin.cpp 프로젝트: asir6/Colt
///////////////////////////////////////////////////////////////////////////////////
/// <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);
}
예제 #12
0
파일: ServerAdmin.cpp 프로젝트: asir6/Colt
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Prevents the server from processing client operations.  When offline, the
/// adminstrator can access the server via "Admin" operations without worrying
/// about Mg clients using the server.
/// </summary>
/// <returns>
/// Nothing
/// </returns>
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
void MgServerAdmin::TakeOffline()
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                              // Connection
                        MgCommand::knVoid,                      // Return type expected
                        MgServerAdminServiceOpId::TakeOffline,  // Command Code
                        0,                                      // No of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());
}
예제 #13
0
//////////////////////////////////////////////////////////////////
/// <summary>
/// Delete a repository with the given name and type.
///
/// This method only works on "Library" and "Session" repositories.
/// If you specify a repository that is not supported this method
/// will throw an InvalidRepositoryType exception.
/// </summary>
/// <param name="resource">
/// Resource identifier describing the repository to delete
/// The following repositories are supported:
///     1) Library
///     2) Session
/// </param>
/// <returns>
/// Nothing
/// </returns>
/// EXCEPTIONS:
///   MgOutOfMemoryException
///   MgInvalidRepositoryTypeException
void MgProxyResourceService::DeleteRepository(MgResourceIdentifier* resource)
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,
                       MgCommand::knVoid,
                       MgResourceService::opIdDeleteRepository,
                       1,
                       Resource_Service,
                       BUILD_VERSION(1,0,0),
                       MgCommand::knObject, resource,
                       MgCommand::knNone);
}
예제 #14
0
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;
}
예제 #15
0
파일: ServerAdmin.cpp 프로젝트: asir6/Colt
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Specifies the maximum size in kilobytes for the log files.  When the maximum
/// size is exceeded, the current log will be archived, and a new log will be created.
///
/// </summary>
/// <returns>
/// Nothing
/// </returns>
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
void MgServerAdmin::SetMaximumLogSize(INT32 size)
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                            // Connection
                        MgCommand::knVoid,                    // Return type expected
                        MgServerAdminServiceOpId::SetMaximumLogSize,       // Command Code
                        1,                                      // No of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knInt32, size,              // Argument#1
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());
}
예제 #16
0
파일: ServerAdmin.cpp 프로젝트: asir6/Colt
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Delete the specified package, if able.
/// </summary>
///
/// <param name="packageName">
/// The name of the package to be deleted.  Available packages can be found by
/// using EnumeratePackages().
/// </param>
///
/// <returns>
/// Nothing.
/// </returns>
///
/// EXCEPTIONS:
/// MgInvalidArgumentException
/// MgFileIoException
/// MgFileNotFoundException
void MgServerAdmin::DeletePackage(CREFSTRING packageName)
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                              // Connection
                        MgCommand::knVoid,                      // Return type expected
                        MgServerAdminServiceOpId::DeletePackage,// Command Code
                        1,                                      // No of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knString, &packageName,      // Argument #1
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());
}
예제 #17
0
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();
}
예제 #18
0
파일: ServerAdmin.cpp 프로젝트: asir6/Colt
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Enumerates the packages available in the package directory.
/// </summary>
///
/// <returns>
/// An MgStringCollection containing a list of packages in the packages directory
/// </returns>
///
/// EXCEPTIONS:
/// MgOutOfMemoryException
/// MgFileNotFoundException
/// MgFileIoException
MgStringCollection* MgServerAdmin::EnumeratePackages()
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                              // Connection
                        MgCommand::knObject,                    // Return type expected
                        MgServerAdminServiceOpId::EnumeratePackages, // Command Code
                        0,                                      // No of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (MgStringCollection*)cmd.GetReturnValue().val.m_obj;
}
예제 #19
0
파일: ServerAdmin.cpp 프로젝트: asir6/Colt
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the online status of the server.
/// </summary>
/// <returns>
/// True for online, False for offline.
/// </returns>
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
bool MgServerAdmin::IsOnline()
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                            // Connection
                        MgCommand::knInt8,                      // Return type expected
                        MgServerAdminServiceOpId::IsOnline,     // Command Code
                        0,                                      // No of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (bool)cmd.GetReturnValue().val.m_i8;
}
예제 #20
0
파일: ServerAdmin.cpp 프로젝트: asir6/Colt
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Removes the configuration properties for the specified property section.
/// If the properties are not specified, then the entire section will be removed.
/// </summary>
/// <param name="propertySection">
/// The property section to set.
/// </param>
/// <param name="properties">
/// The collection of configuration properties associated with the specified property section that you want to remove.
/// </param>
/// <returns>
/// Nothing
/// </returns>
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
/// MgInvalidPropertySectionException
/// MgPropertySectionNotAvailableException
/// MgPropertySectionReadOnlyException
/// MgInvalidPropertyException
void MgServerAdmin::RemoveConfigurationProperties(CREFSTRING propertySection, MgPropertyCollection* properties)
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                            // Connection
                        MgCommand::knVoid,                      // Return type expected
                        MgServerAdminServiceOpId::RemoveConfigurationProperties, // Command Code
                        2,                                      // No of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knString, &propertySection,  // Argument#1
                        MgCommand::knObject, properties,        // Argument#2
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());
}
예제 #21
0
파일: ServerAdmin.cpp 프로젝트: asir6/Colt
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Sets the contents of the specified document.
/// </summary>
/// <param name="identifier">
/// The document to set.
/// </param>
/// <param name="data">
/// The data to set the document contents to.
/// </param>
/// <returns>
/// Nothing
/// </returns>
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
/// MgInvalidArgumentException
/// MgNullReferenceException
/// MgOutOfMemoryException
void MgServerAdmin::SetDocument(CREFSTRING identifier, MgByteReader* data)
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                             // Connection
                       MgCommand::knVoid,                      // Return type expected
                       MgServerAdminServiceOpId::SetDocument,  // Command Code
                       2,                                      // No of arguments
                       ServerAdmin_Service,                    // Service Id
                       BUILD_VERSION(1,0,0),                   // Operation version
                       MgCommand::knString, &identifier,       // Argument#1
                       MgCommand::knObject, data,              // Argument#2
                       MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());
}
예제 #22
0
//////////////////////////////////////////////////////////////////
/// <summary>
/// Gets a list of entries for the specified repository type. The
/// following lists will be returned for the specified repository
/// type:
///     1) Session - A list of session IDs is returned.
///
/// This method only works on "Session" repositories.
/// If you specify a repository that is not supported this method
/// will throw an MgInvalidRepositoryTypeException exception.
/// </summary>
/// <param name="repositoryType">
/// The type of repository you want to list the entries for.
/// The following repositories are supported:
///     1) Session
/// </param>
/// <returns>
/// MgByteReader object representing the list of entries for the
/// repository type specified.
/// </returns>
/// EXCEPTIONS:
///   MgOutOfMemoryException
///   MgInvalidRepositoryTypeException
MgByteReader* MgProxyResourceService::EnumerateRepositories(CREFSTRING repositoryType)
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,
                       MgCommand::knObject,
                       MgResourceService::opIdEnumerateRepositories,
                       1,
                       Resource_Service,
                       BUILD_VERSION(1,0,0),
                       MgCommand::knString, &repositoryType,
                       MgCommand::knNone);

    return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
예제 #23
0
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;
}
예제 #24
0
파일: ServerAdmin.cpp 프로젝트: asir6/Colt
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Gets current log of the specified package
/// </summary>
///
/// <param name="packageName">
/// The name of the package to get the status for.  Available packages can be
/// found by using EnumeratePackages().
/// </param>
///
/// <returns>
/// An MgByteReader containing the contents of the package's log.
/// </returns>
///
/// EXCEPTIONS:
/// MgFileNotFoundException
/// MgFileIoException
/// MgInvalidArgumentException
/// MgOutOfMemoryException
MgByteReader* MgServerAdmin::GetPackageLog(CREFSTRING packageName)
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                                  // Connection
                        MgCommand::knObject,                        // Return type expected
                        MgServerAdminServiceOpId::GetPackageLog,    // Command Code
                        1,                                          // No of arguments
                        ServerAdmin_Service,                        // Service Id
                        BUILD_VERSION(1,0,0),                       // Operation version
                        MgCommand::knString, &packageName,          // Argument #1
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
예제 #25
0
void MgProxyResourceService::InheritPermissionsFrom(
    MgResourceIdentifier* resource)
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,
                       MgCommand::knVoid,
                       MgResourceService::opIdInheritPermissionsFrom,
                       1,
                       Resource_Service,
                       BUILD_VERSION(1,0,0),
                       MgCommand::knObject, resource,
                       MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());
}
예제 #26
0
//////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the header associated with the specified resource.
/// </summary>
/// <param name="resource">
/// Resource identifier for desired resource
/// </param>
/// <returns>
/// MgByteReader object representing the XML resource header.
/// </returns>
/// EXCEPTIONS:
/// MgRepositoryNotOpenException
///
/// MgInvalidResourceTypeException
MgByteReader* MgProxyResourceService::GetResourceHeader(MgResourceIdentifier* resource)
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,
                       MgCommand::knObject,
                       MgResourceService::opIdGetResourceHeader,
                       1,
                       Resource_Service,
                       BUILD_VERSION(1,0,0),
                       MgCommand::knObject, resource,
                       MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());
    return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
예제 #27
0
파일: ServerAdmin.cpp 프로젝트: asir6/Colt
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Clears the specified log.
/// </summary>
/// <param name="log">
/// The log to be cleared. (AccessLog, AdminLog, AuthenticationLog, ErrorLog,
/// SessionLog, TraceLog)
/// </param>
/// <returns>
/// True if the log was successfully cleared, false otherwise.
/// </returns>
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
/// MgInvalidArgumentException
/// MgNullReferenceException
bool MgServerAdmin::ClearLog(CREFSTRING log)
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                            // Connection
                        MgCommand::knInt8,                      // Return type expected
                        MgServerAdminServiceOpId::ClearLog,     // Command Code
                        1,                                      // No of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knString, &log,              // Argument#1
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (bool)cmd.GetReturnValue().val.m_i8;
}
예제 #28
0
//////////////////////////////////////////////////////////////////
/// <summary>
/// Deletes tagged data from the specified resource
/// </summary>
/// <param name="resource">
/// Resource identifier describing the resource
/// </param>
/// <param name="dataName">
/// Tag name for the data
/// </param>
/// <returns>
/// Nothing
/// </returns>
/// EXCEPTIONS:
/// MgInvalidResourceTypeException
void MgProxyResourceService::DeleteResourceData(MgResourceIdentifier* resource, CREFSTRING dataName)
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,
                       MgCommand::knVoid,
                       MgResourceService::opIdDeleteResourceData,
                       2,
                       Resource_Service,
                       BUILD_VERSION(1,0,0),
                       MgCommand::knObject, resource,
                       MgCommand::knString, &dataName,
                       MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());
}
예제 #29
0
bool GiCoreViewImpl::drawCommand(GcBaseView* view, const MgMotion& motion, GiGraphics& gs)
{
    bool ret = false;

    if (view == curview) {
        MgDynShapeLock locker(false, this);
        MgCommand* cmd = _cmds->getCommand();

        ret = cmd && cmd->draw(&motion, &gs);
        if (ret && cmd->isDrawingCommand()) {
            getCmdSubject()->drawInShapeCommand(&motion, cmd, &gs);
        }
    }

    return ret;
}
예제 #30
0
bool TransformCmd::touchMoved(const MgMotion* sender)
{
    if (_ptIndex >= 0) {
        setPointW(_ptIndex, sender);
    }
    return _ptIndex >= 0 || (_lastCmd && _lastCmd->touchMoved(sender));
}