typedef OBJECT MARK,
*
P _MARK;typedef struct MARK_TOKEN {
CLASS classLevel;
U32 index;
II
which class level is the data atII
index to the data item U32 index2;II
secondary index if needed MARK_TOKEN,*
P _MARK_TOKEN;typedef struct MARK COMPONENT
UUID appUUlD;
UUlD compUUlD;
UlD compUlD;
MARK_COMPONENT,
*
P_MARK_COMPONENT;MARK_FLAGS
These flags are used when creating a mark. They indicate what kind of mark is to be created.
markDocRelative makes the mark save its component reference relative to OSThisApp. This means that if the mark is saved, and both the document that contains the mark and the document it refers to are copied in a single operation, the new set will refer to within itself correctly. This is what goto buttons do.
markForSelection automatically positions the mark at the selection, including finding out who the selection holding component is. If you set this, then you don't need to set any other fields in the new struct.
markAlwaysDelete once a mark has been saved, it remembers that it can never delete the token because it has no idea how many copies of the file it was saved in have been made. This flag forces marks to always delete the token no matter what. If you manage the reference of this mark and you can guarantee that what ever happens to the saved mark happens to the component it refers to, then set this flag.
markRelaxActivate this keeps a mark from activating the component on entering and exiting. If the component isn't active on entering, it will be skipped if possible or it will be referred to in its entirety. If the component is not active 'On exiting, then it will miss the delete token message. Note that this can cause resource leaks at the expense of keeping the VI snappy. This takes precedence over markAlwaysDelete.
typedef U32 MARK_FLAGS,
*
P_MARK_FLAGS;4tdefine markDocRelative 4tdefine markForSelection 4tdefine markAlwaysDelete 4tdefine markRelaxActivate typedef U16 MARK_MS G_F LAGS ,
flag1
II
if saved, document relative flag2II
make mark for the selection flag3II
if you manage the destination flag4II
don't always activate*
P_MARK_MSG_FLAGS;MARK.H '87 Common #defines and Types
These flags are only valid with msgMarkDeliverPos & msgMarkDeliverNext
*define markMsgNormal 0
II
standard message send*define markMsgTry 1
II
one in a sequence of possible messages*define markMsgLastTry 2
II
last in a sequence of messages*define markMsgMode 3
II
'&' with flags to extract flag field These flags are only valid with msgMarkDeliverNextflag8
*define markBackward
*define markEnterNone
*define markEnterAll
*define markEnterOpen
*define markEnterMode
flag10
*define markExitUp flag11
II
default flag settings:*define markDefaultMsgFlags
*define markDefaultPosMsgFlags
*define markDefaultNextMsgFlags (markMsgNormal I markEnterOpen
at end, move up to parents o
markMsgNormal
\
I markExitUp)
MARK_MSG_HEADER must be the start of the argument structure for any message delivered via
msgMarkDeliver, msgMarkDeliverPos, or msgMarkDeliverNext. It allows clsMark to insert the token information into the message arguments to indicate which part of the component is to be operated on.
typedef struct MARK_MSG_HEADER {
MARK TOKEN token;
II
Supplied by mark: the token MESSAGE msg;II
In: the message to sendSIZEOF lenArgs;
II
In: length of the whole structure MARK MSG FLAGS flags;II
In: flags as appropriateMARK _ MSG _HEADER,
*
P _MARK _ MSG _HEADER;typedef struct MARK_MESSAGE { MARK_MSG_HEADER header;
} MARK_MESSAGE,
*
P_MARK_MESSAGE;typedef U16 MARK_LOCATION;
*define markLocWhole 0
*define markLocBeginning 1
#define markLocEnd 2
The following location codes are only valid for msgMarkPositionAtGesture These may be or'd together and in with the above codes ...
*define markLocWholeWord flag4
#define markLocUseSelection flagS
II
use the whole word under the gestureII
use the selection if the gesture wasII
over itImportant: all message handlers for messages sent via msgMarkDeliver, msgMarkDeliverPos, or msgMarkDeliverNext, must have the following as its first statement. Replace "clsYourClassHere" with the uid of your class.
MarkHandlerForClass(clsYourClassHere);
#define MarkHandlerForClass(cls) \
if (WKNValue(((P_MARK_TOKEN)pArgs)->classLevel) != WKNValue(cls)) \ return ObjectCallAncestor(msg, self, pArgs, ctx);
188 PENPOINT API REFERENCE
Part 2 / Pen Point Application Framework
Messages
Arguments
M@$s©g@
Ar£jum@rtts
M@$s©ge Af9!Jmertts
msgNew
Creates a new mark, initialized to the given component (if any).
Takes P _MARK_NEW, returns STATUS. Category: class message.
typedef struct MARK_NEW_ONLY { MARK_FLAGS flags;
MARK_COMPONENT component;
U16 reserved[2];
MARK_NEW_ONLY,
*
P_MARK_NEW_ONLY;fdefine markNewFields \ objectNewFields \ MARK NEW ONLY mark;
typedef struct MARK_NEW { markNewFields
} MARK_NEW,
*
P_MARK_NEW;The fields you might typically set are pArgs->markflags: or in markForSelection to refer to the selection object, or in markDocRelative if you ever plan on saving the mark object
pArgs->markcomponent.compUID: the object to refer to (not needed if you set markForSelection above)
msgNewDefaults
Initializes the MARK_NEW structure to default values.
Takes P _MARK_NEW, returns STATUS. Category: class message.
typedef struct MARK_NEW { markNewFields
} MARK_NEW,
*
P_MARK_NEW;Zeroes out pNew->mark Specifically, this includes:
MakeNilUUID(pArgs->mark.component.appUUID);
MakeNilUUID(pArgs->mark.component.compUUID);
pArgs->mark.component.compUID = objNull;
msgMarkDeliver
Delivers a message to the target that does not move the token.
Takes P _MARK_MESSAGE, returns STATUS.
fdefine msgMarkDeliver MakeMsg(clsMark, 1) typedef struct MARK_MESSAGE
MARK_MSG_HEADER header;
} MARK_MESSAGE,
*
P_MARK_MESSAGE;The message in pArgs->header.msg is sent to the component after the mark fills in the token field. Note that the pArgs for the sent message are the same as the pArgs that are passed in to msgMarkDeliver.
Various messages that are sent to components have extra fields tacked on to this structure. Therefore, all messages delivered with msgMarkDeliver MUST have a pArgs structure that starts with same fields as MARK_DELIVER. Furthermore, the lenArgs field must be set to the size of the WHOLE structure.
M0S$~ge
Delivers a message to the target that moves the token but does not change the component.
Takes P _MARK_MESSAGE, returns STATUS.
#define msgMarkDeliverPos MakeMsg(clsMark, 2) typedef struct MARK_MESSAGE
MARK_MSG_HEADER header;
} MARK_MESSAGE,
*
P_MARK_MESSAGE;This is just like msgMarkDeliver, only it is used to deliver a message that will potentially reposition the mark elsewhere in the component. It is chiefly used with the msgMarkPosition ... messages.
The additional flags argument is used to determine how the holder wants to interpret the response from the client. Normally you use markMsgNormal, which automatically deals with certain client response codes that the holder doesn't need to be aware of.
For example, if a holder wants to use msgMarkPositionAtEdge the code would be:
MARK POSITION EDGE edgeArgs;
edgeArgs.msg = msgMarkPositionAtEdge;
edgeArgs.lenArgs = SizeOf(MARK_POSITION_EDGE);
edgeArgs.flags = markMsgNormal;
edgeArgs.location = markLocBeginning;
ObjCallRet(msgMarkDeliverPos, aMark, &edgeArgs);
However, if the holder wishes to try a different positioning message if the first one fails, then the holder must use the flag setting markMsgTry on all except the last message which uses markMsgLastTry.
Furthermore, these must be in a while loop and repeated if stsMarkRetry is ever returned.
For example, if a holder would like to use the (hypothetical) message msgPositionAtVowel, and if that fails use msgPositionAtLetter, and if that fails try msgPositionAtCharacter; then it the code would be:
p~s VOWEL
posVowel.msg
=
msgPositionAtVowel;posVowel.lenArgs = SizeOf(POS_VOWEL);
posVowel.flags = markMsgTry;
posVowel. ...
II
other argumentss
=
ObjectCall(msgMarkDeliverPos, aMark, &posVowel);if (s == stsMarkRetry) continue;
if (s != stsMsgNotUnderstood) break;
II
some error occurred posLetter.msg=
msgPositionAtLetter;posLetter.lenArgs = SizeOf(POS_LETTER);
posLetter.flags
=
markMsgTry;posLetter. '"
II
other arguments s=
ObjectCall(msgMarkDeliverPos, aMark, &posLetter);if (s == stsMarkRetry) continue;
if (s != stsMsgNotUnderstood) break;
II
some error occurred posChar.msg=
msgPositionAtCharacter;posChar.lenArgs
=
SizeOf(POS_CHAR);posChar.flags
=
markMsgLastTry;posChar. ...
II
other argumentss
=
ObjectCall(msgMarkDeliverPos, aMark, &posChar);if (s == stsMarkRetry) continue;
if (s != stsMsgNotUnderstood) break;