NX二次开发UF_UNDO_register_misc_cb 函数介绍

142 阅读4分钟

UF_UNDO_register_misc_cb

Defined in: uf_undo.h 
int UF_UNDO_register_misc_cb(UF_UNDO_misc_cb_t cb_type, UF_UNDO_mark_id_t mark_id, UF_UNDO_user_visibility_t visibility, UF_UNDO_misc_cb_f_t func, void * closure, UF_UNDO_misc_cb_id_t * id )

overview 概述

This function allows the Open API programmer to register a callback to be executed before or after the setting/undoing of a mark.


这个函数允许 Open API 程序员在设置/撤销标记之前或之后注册要执行的回调。

UFUN例子

获取源码例子请搜索 里海NX二次开发3000例专栏

parameters 参数

UF_UNDO_misc_cb_tcb_typeInputCall back types: UF_UNDO_misc_cb_set_pre to call the function just before a mark is set. The function will always be passed a mark_id of -2. UF_UNDO_misc_cb_set_post to call the function just after any mark is set but before UF_UNDO returns back to the application that set the mark. The passed mark_id is the mark id of the mark just set. UF_UNDO_misc_cb_undo_pre to call the function just before UF_UNDO performs an undo to mark. The passed mark_id is the mark id of the mark we are about to undo to. UF_UNDO_misc_cb_undo_post to call the function just after UF_UNDO performs an undo to mark but before UF_UNDO returns to the application that requested the undo. The passed mark_id is the mark id of the mark we just undid to. UF_UNDO_misc_cb_chg_vis to call the function just after a mark has its visibility changed. The passed mark_id is the mark id of the mark whose visibility just changed.
回调类型: UF _ UNDO _ misc _ cb _ set _ pre 在设置标记之前调用函数。函数的 mark _ id 总是为 -2。UF _ UNDO _ misc _ cb _ set _ post 在设置任何标记之后但在 UF _ UNDO 返回到设置标记的应用程序之前调用该函数。传递的 mark _ id 是刚刚设置的 mark 的 mark id。UF _ UNDO _ misc _ cb _ undo _ pre 在 UF _ UNDO 执行撤消标记之前调用该函数。传递的 mark _ id 是要撤消到的标记的 mark id。在 UF _ UNDO 执行撤消标记之后,但在 UF _ UNDO 返回到请求撤消的应用程序之前,UF _ UNDO 调用函数。传递的 mark _ id 是我们刚刚撤销的标记的 mark id。UF _ UNDO _ misc _ cb _ chg _ vis 在标记的可见性改变之后调用函数。传递的 mark _ id 是其可见性刚刚改变的标记的 mark id。
UF_UNDO_mark_id_tmark_idInputIf registering a function that should only be called if processing a particular mark then enter that mark_id here. If its a SET_PRE or SET_POST then this argument is ignored. If you want a function called whenever any mark is processed then enter UF_UNDO_MISC_CB_ANY_MARK here. If you enter a mark here and UF_UNDO is requested to undo over that mark then the callback is not called. It is only called if the given mark_id is the one undone to.
如果注册了一个只有在处理特定标记时才应该调用的函数,那么在这里输入 mark _ id。如果是 SET _ PRE 或 SET _ POST,则忽略此参数。如果希望在处理任何标记时调用函数,那么在这里输入 UF _ UNDO _ MISC _ CB _ any _ MARK。如果在这里输入一个标记,并请求 UF _ UNDO 撤消该标记,则不调用回调。只有当给定的 mark _ id 被撤消为。
UF_UNDO_user_visibility_tvisibilityInputTake action based on the specific visibility: UF_UNDO_visible Only execute the given function if the mark being set or undone to is user visible or a mark was just made visible. UF_UNDO_invisible Only execute the given function if the mark being set or undone to is user invisible or a mark was just made invisible. UF_UNDO_any_vis to execute the function regardless of the mark's visibility.
根据特定的可见性采取行动: UF _ UNDO _ visible 只有当被设置或撤消的标记是用户可见的或者标记刚刚变得可见时才执行给定的函数。只有当被设置或撤消的标记是用户不可见的或者标记刚刚被设置为不可见的时候才执行给定的函数。UF _ UNDO _ any _ vis 执行函数,而不管标记的可见性如何。
UF_UNDO_misc_cb_f_tfuncInputThe function to call. When this function is executed, the UF text mode will be set to whatever the mode is when the function is registered. If your SET_PRE or UNDO_PRE callback returns UF_UNDO_misc_cb_stop when called then no further callbacks are called and the setting or undoing of the mark is not done. If other callbacks return UF_UNDO_misc_cb_stop when called then the operation will be partly complete and an error will be returned. This action is not recommended.
要调用的函数。执行此函数时,UF 文本模式将被设置为注册函数时的任何模式。如果您的 SET _ PRE 或 UNDO _ PRE 回调函数在调用时返回 UF _ UNDO _ misc _ cb _ stop,则不会调用进一步的回调函数,标记的设置或撤消也不会完成。如果其他回调函数在调用时返回 UF _ UNDO _ misc _ cb _ stop,则操作将部分完成,并返回错误。不建议使用此操作。
void *closureInputThe argument to pass to the function when the function is called.
调用函数时要传递给函数的参数。
UF_UNDO_misc_cb_id_t *idOutputThe identifier assigned to this registration. This identifier can be used to remove this registration via UF_UNDO_unregister_misc_cb().
分配给这个注册的标识符。这个标识符可以用来通过 UF _ UNDO _ unregister _ misc _ cb ()删除这个注册。