MS CE, Update 15, Language: C++
This question concerns using of change tracking functions. Callback function is set as follows:
ChangeTrack::AddChangedFunction (myChangeTrackFunc)
Signature of myChangeTrackFunc is:
myChangeTrackFunc
void ChangeTrackFunc_Changed( MSElementDescrP newDescr, MSElementDescrP oldDescr, DgnPlatform::ChangeTrackInfo *info, bool *cantBeUndoneFlag)
Argument DgnPlatform::ChangeTrackInfo *info is declared as follows (in ITxnManager.h):
Argument DgnPlatform::ChangeTrackInfo *info
struct ChangeTrackInfo { ChangeTrackAction action; //!< type of action Int32 processNumber; //!< process active at time of entry Int16 funcname; //!< Number of RTYPE_CMDNAME resource. Int32 idNumber; //!< id for grouping undos };
My question relates to structure member funcname. It is described as: Number of RTYPE_CMDNAME resource.
funcname
What does that mean ??? Where do I get this requested command number from ???
Background:In my code I'm using several MicroStation commands to modify existing MicroStation elements (like : trim extend, trim tointersection, etc.)Each element modified by one of these MicroStation commands has to be processed by my callback function myChangeTrackFuncdepending on the MicroStation command which has modified the current element.
So my callback function would look as something like this:
void yourChangeTrackFunc (MSElementDescrP newDescr, MSElementDescrP oldDescr, DgnPlatform::ChangeTrackInfo *info, bool *cantBeUndoneFlag) { switch (info->action) { case ChangeTrackAction::Modify: { // Element modified switch info->funcname: { case <Number of RTYPE_CMDNAME resource MS Cmd: Trim Extend>: { ... } break; case <Number of RTYPE_CMDNAME resource MS Cmd: Trim ToIntersection>: { ... } break; ... more MS Commands } } break; } }
Any hints are appreciated. Thanks.
Martin Gitschel
Martin Gitschel said:My question relates to structure member funcname. It is described as: Number of RTYPE_CMDNAME resource.
Hi Martin,
just a guess. The Problem is, Command Numbers are now 6b Bit, But in RSC Files there are only 32Bit Values possible, That is why:
#if defined (resource) typedef struct __rscCommandEntry__ { UInt16 cmdNumber; // number is actually restricted to 8 bits by our algorith for generating CMD_XXX numbers. UInt16 subTable; UInt16 cmdClass; UInt16 options; char name []; UInt32 commandStringNum; UInt32 itemListRscId; UInt32 featureAspectId; } CommandTable [];
you could define a smaller 32Bit Number fitting to your 64Bit CommandNumber.
See:
#define CMD_WINDOW 0x0300000000000000UI64 /* VIEWING CmdString = 1 */ #define CMD_WINDOW_AREA 0x0301000000000000UI64 /* VIEWING CmdString = 1 */ #define CMD_WINDOW_CENTER 0x0302000000000000UI64 /* VIEWING CmdString = 204 */ #define CMD_WINDOW_ORIGIN 0x0303000000000000UI64 /* VIEWING CmdString = 207 */ #define CMD_WINDOW_VOLUME 0x0304000000000000UI64 /* VIEWING CmdString = 353 */ #define CMD_WINDOW_BACK 0x0305000000000000UI64 /* WINDOWMAN CmdString = 427 */
Mit freundlichen Grüßen / Best regards Volker Hüfner
| AB_DATE Engineering Software | ab-date.de |
Martin Gitschel said:It is described as: Number of RTYPE_CMDNAME resource
That macro is defined in header file rtypes.r.h...
rtypes.r.h
#define RTYPE_CMDNAME RTYPE( 'C','m','d','N' )
Martin Gitschel said:What does that mean? Where do I get this requested command number from?
Where is it used? I have no idea! The only time I see it referenced is in the ChangeTrackInfo struct. ChangeTrackInfo::funcname suggests that in some resource file there is a list of RTYPE_CMDNAME but, if so, where?
ChangeTrackInfo
ChangeTrackInfo::funcname
RTYPE_CMDNAME
Regards, Jon Summers LA Solutions
Hi Martin Gitschel,
There are a couple different API areas to review/evaluate to decide what may be best to implement based on your unique needs.
If your application has need to filter/prevent certain command(s), the input queue is best to implement filtering based on knowing: Task Name + CommandId criteria.
If your application has interest in the elements modified by a particular Task + CommandId; change tracking can be utilized. See Code Snippet: C++ ChangeTrackChanged that will help provide those missing details for *many* Command items not listed in: ..\Include\Mstn\cmdlist.r.h.
NOTE: Although there is mention to RTYPE_CMDNAME, it may be best to think of this as a "Tool Name" entry convention and the code snip above provides a shortcut on how to extract the tool name that can become more involved using the RTYPE_CMDNAME ID provided in ChangeTrackChanged event arg.
HTH,Bob
Thanks Robert, for your answer. I think, it willbwe helpful.