CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2020 开发者帮助

MDI API 迁移

2024-5-18 18:27| 发布者: admin| 查看: 100| 评论: 0|原作者: admin|来自: AutoCAD

MDI API 迁移

即使AutoCAD在没有光纤的情况下运行,“应用程序上下文”和“文档上下文”之间的区别仍然存在,如返回值所示,但应用程序上下文现在通过“返回”文档上下文逻辑来“切换”。AcApDocManager::isApplicationContext

对于AutoCAD用户和您的应用程序来说,这意味着无法再使用活动命令和/或LISP表达式切换活动文档,并切换回并恢复这些命令。

只有在上一个文档中的所有命令和 LISP 表达式都结束之后,才会完成无光纤文档切换。调用旨在导致文档切换的函数后,应用程序必须返回,AutoCAD 将完成文档切换。文档切换请求包括关闭活动文档或打开/创建新文档。发出此类请求后,输入喉咙将被禁用,直到 AutoCAD 完成文档切换。这可能会导致与文档删除相关的某些反应堆回调的时间存在差异。

定义命令时,设置标志仍表示该命令应在应用程序上下文中运行,这仍会影响某些 API 函数的行为方式。如果 LISP 或其他命令处于活动状态,则与光纤化操作相比,此类命令的执行在内部会延迟,因此某些反应堆回调可能不正常。当没有其他命令或 LISP 处于活动状态时,执行时间的差异应该可以忽略不计。ACRX_CMD_SESSION

鉴于此 MDI API 更改摘要,以下是对以下特定 MDI API 函数的影响,这些函数都在类中定义。为简洁起见,每个函数前面的注释中列出了行为差异,并描述了运行无光纤 AutoCAD 时将看到的不同行为。AcApDocManager

class ADESK_NO_VTABLE AcApDocManager : public AcRxObject
{
public:

    // Still has meaning in fiberless operations, but the timing of when
    // the system is in application context differs in two significant ways:
    // 1. when running fiberless, CLI prompts issued in active commands never
    // leave document context.   In fiberized operations, all prompts
    // enter and leave application context on every event.
    // 2. See executeInApplicationContext function, it literally forces
    // this function to return true, even with active document-related
    // logic on the stack.  This usually works to everyone’s advangate,
    // but active document switch requests are deferred until all command
    // and LISP expressions, and it allows one to use appContextCloseDocument,
    // but in this context, active command logic will likely crash
    // AutoCAD if the closed document is active.
    virtual bool isApplicationContext() const = 0;

    // If activate is true, the actual activation will not occur until after
    // all commands and LISP are ended, and keyboard/mouse/script input is disabled.
    virtual Acad::ErrorStatus setCurDocument(AcApDocument* pDoc,
                                             AcAp::DocLockMode = AcAp::kNone,
                                             bool activate = false) = 0;

    // Actual activation will not occur until after all commands and LISP are ended
    // After calling activateDocument, all keyboard and mouse input is disabled
    // until after the document switch finally occurs.
    virtual Acad::ErrorStatus activateDocument(AcApDocument* pAcTargetDocument,
                                               bool bPassScript = false) = 0;

    // If activate is true, the actual activation will not occur until after
    // all commands and LISP are ended, and keyboard/mouse/script input is disabled.
    virtual Acad::ErrorStatus sendStringToExecute(AcApDocument* pAcTargetDocument,
                                                  const ACHAR * pszExecute,
                                                  bool bActivate = true,
                                                  bool bWrapUpInactiveDoc = false,
                                                  bool bEchoString = true) = 0;

    // During document creation, the new document is no longer activated until
    // its initialization is complete. In fiberized operations, the new
    // document is activated very early in initialization.
    virtual Acad::ErrorStatus appContextNewDocument(const ACHAR *pszTemplateName) = 0;
    virtual Acad::ErrorStatus appContextOpenDocument(const ACHAR *pszDrawingName) = 0;
    ACCORE_PORT Acad::ErrorStatus appContextPromptNewDocument();
    ACCORE_PORT Acad::ErrorStatus appContextPromptOpenDocument();
    virtual Acad::ErrorStatus newDocument() = 0;
    virtual Acad::ErrorStatus openDocument() = 0;

    //
    // Caution:  This function immediately destroys the active document and
    // a lot of related data when called from application context, even if it
    // is artificially set by using executeInApplicationContext.
    // Use closeDocument whenever it will work for you, it queues up a request
    // to appContextCloseDocument to be performed at a safer point of execution.
    ACCORE_PORT Acad::ErrorStatus appContextCloseDocument(AcApDocument* pDoc);

    virtual Acad::ErrorStatus closeDocument(AcApDocument* pAcTargetDocument) = 0;


    // Essentially forces the system to behave as if in the application context, even
    // if a document has active commands. See the note on appContextCloseDocument,
    // which is especially dangerous when invoked from logic invoked through this
    // function.
    virtual void executeInApplicationContext(void (*procAddr)(void *), void *pData ) const = 0;
};

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1   苏公网安备32011402011833)

GMT+8, 2025-1-19 07:33

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部