#include <opdesc.h>
Inheritance diagram for OpDescriptor:
Public Member Functions | |
virtual OpState | GetOpsState (String_256 *, OpParam *pOpParam=NULL) |
This function will get called to determine the greyed/ticked state of the operation. It tests various conditions (based on the AutoStateFlgs) and then if the op survives this, calls the GetState fn which was registered with the operation. | |
void | Invoke (OpParam *pOpParam=NULL, BOOL fWithUndo=TRUE) |
This Function uses the Operation runtime class to create an instance of the operation object and call its DO function. | |
OpDescriptor (UINT32 toolID, UINT32 txID, CCRuntimeClass *Op, TCHAR *tok, pfnGetState gs, UINT32 helpId=0, UINT32 bubbleID=0, UINT32 resourceID=0, UINT32 controlID=0, BOOL ReceiveMessages=FALSE, BOOL Smart=FALSE, BOOL Clean=TRUE, UINT32 OneOpenInstID=0, UINT32 AutoStateFlags=0, BOOL fCheckable=FALSE) | |
Construct a new OpDescriptor object and link it into the list of all OpDescriptors Both the resource and control IDs may be zero (the default case) in which case the OpDescriptor is not connected to any form of control. If the resource ID alone is supplied it is taken to refer to a bitmap and the Opdescriptor will be connected to a bitmap button. If both resource and control IDs are supplied then they refer to an arbitrary control. | |
~OpDescriptor () | |
Standard destructor. | |
OpFlgs | GetOpFlags () |
To obtain the OpFlags describing the type of the operation. | |
void | SetBarControlInfo (BarControlInfo ThisInfo) |
void | AliasOperation (CCRuntimeClass *AliasOp, pfnGetState AliasGetState, UINT32 AliasAutoStateFlags=0, UINT32 AliasTextID=0, UINT32 AliasBubbleID=0) |
Allows you to alias an op descriptor, i.e. provide an alternative operation and GetState function for a registered op descriptor. This mechanism allows a standard operation, or user action, to have a different internal action or implementation. | |
void | RemoveAlias () |
Removes the alias for this operation. | |
BOOL | IsAliased () |
Tells you whether the OpDesc is aliased or not. | |
BOOL | IsHotKeyEnabled () const |
Determines whether or not the hot key associated with this op should be shown to the user via HotKey::FindHotKey() Notes: Presently used to disable Ctrl-S when save op is used for update. See Also: DisableHotKey(), EnableHotKey(). | |
void | DisableHotKey () |
Disables the hot key associated with this op See Also: IsHotKeyEnabled(), EnableHotKey(). | |
void | EnableHotKey () |
Enables the hot key associated with this op See Also: DisableHotKey(), IsHotKeyEnabled(). | |
virtual BOOL | GetText (String_256 *Description, OpTextFlags WhichText) |
This function will use the TextID and ModuleID values to obtain a String resource describing an operation. String resources may have one or more text descriptions in them, therefore, a TextFlag can be used to identify the the appropriate text required. | |
virtual MsgResult | Message (Msg *Msg) |
The default OpDescriptor message handler. | |
BOOL | BuildGadgetList (List *pOutputList) |
Builds a list of GadgetListItems, each item holding a DialogBarOp* and a CGadgetID for a control associated with this OpDescriptor. This allows the caller to manipulate the controls even if there isn't a message from them needing processing. NB. the caller is responsible for allocating and deallocating this list! | |
virtual void | OnControlCreate (OpDescControlCreateMsg *CreateMsg) |
The OnControlCreate method is called by the OpDescriptor's default Message handler when a new control has just been created. You should override this method to perform gadget initialisation. | |
virtual void | OnSelectionChange (OpDescControlMsg *SelChangedMsg, List *GadgetList) |
The OnSelectionChange method is called whenever the user selects a new value from the gadget .. (blah blah. | |
virtual void | OnSliderChanging (OpDescControlMsg *SliderChangingMsg) |
Called when the sliders position is being changed (if its associated with this opdescriptor). | |
virtual void | OnSliderSet (OpDescControlMsg *SelChangedMsg) |
Called when the sliders position changes (if its associated with this opdescriptor). | |
virtual void | OnSliderCancelled (OpDescControlMsg *SelChangedMsg) |
Called when the sliders position is being cancelled (if its associated with this opdescriptor). | |
TCHAR * | ReadString (TCHAR *pDesc) |
Reads the string until delimeter or end of string. | |
TCHAR * | GetMenuNameString (TCHAR *pDesc) |
Reads the menu text in position one and removes any ampersands denoting an accelerator. | |
void | SetStringPos (TCHAR **pDesc, OpTextFlags WhichText) |
Scans through a string and sets the pDesc pointer to the appropriate text in the string resource. The text position is determined by the ordinal value of the WhichText value. | |
UINT32 | GetHelpId () |
returns the Help Id | |
UINT32 | GetToolID () |
Returns the Tool ID. | |
UINT32 | GetBubbleId () |
returns the string resource ID of the "bubble-help" text. | |
const BarControlInfo * | GetBarControlInfo () |
Returns the bar control info of the OpDescriptor. This is a platform-indy representation of the control which can be placed on toolbars to invoke this Operation. | |
Static Public Member Functions | |
static OpDescriptor * | FindOpDescriptor (TCHAR *Token) |
To search the OpDescriptor list and find the OpDescriptor described by Token. | |
static OpDescriptor * | FindOpDescriptor (CCRuntimeClass *Op) |
To search the OpDescriptot list and find the OpDescriptor described by Token. | |
static OpDescriptor * | FindOpDescriptor (ResourceID res) |
To search the OpDescriptor list and find an entry with the given resource ID. Note it is compared against the 'control' entry. | |
static void | DestroyAll () |
Since the OpDescriptor maintains its own static list of all the OpDescriptors created in the program, and since none of them are actually destroyed with a call to a destructor, we have to do it ourselves by a call to this function in the DeInit kernel type of function. Basically it walks through the list of OpDescriptors and destroys them all. | |
static void | RemoveAllAliases () |
Goes through the list of op descriptors, removing all aliases. | |
static OpListItem * | GetFirstDescriptor () |
returns the first OpListItem in the list | |
static OpListItem * | GetNextDescriptor (OpListItem *CurrOp) |
returns the next OpListItem in the list | |
static void | LinkDescriptor (OpDescriptor *ThisOp) |
Add the OpDescriptor to the list of all OpDescriptors. | |
static BOOL | DelinkDescriptor (OpDescriptor *pThisOp) |
Delete the OpDescriptor from the list of all OpDescriptors. | |
Public Attributes | |
String | Token |
Protected Member Functions | |
TCHAR * | GetDescription (TCHAR *pDesc, OpTextFlags WhichText) |
Scans through a string and retrieves the text associated with the text flag passed in as a parameter. | |
Protected Attributes | |
DWORD | ModuleID |
UINT32 | TextID |
UINT32 | HelpID |
UINT32 | BubbleID |
BarControlInfo | BarCtrlInfo |
CCRuntimeClass * | OpClass |
OpFlgs | Flags |
BOOL | m_bHotKeyEnabled |
BOOL | Aliased |
CCRuntimeClass * | AliasOpClass |
pfnGetState | OldGetState |
UINT32 | OldAutoStateFlags |
UINT32 | OldTextID |
UINT32 | OldBubbleID |
UINT32 | OneInstID |
UINT32 | AutoStateFlgs |
pfnGetParamState | GetParamState |
Private Attributes | |
pfnGetState | GetState |
Static Private Attributes | |
static List | OpList |
Definition at line 455 of file opdesc.h.
|
Construct a new OpDescriptor object and link it into the list of all OpDescriptors Both the resource and control IDs may be zero (the default case) in which case the OpDescriptor is not connected to any form of control. If the resource ID alone is supplied it is taken to refer to a bitmap and the Opdescriptor will be connected to a bitmap button. If both resource and control IDs are supplied then they refer to an arbitrary control. );
ReceiveMessages - should the OpDescriptor receive system messages Smart - Smart Duplicate Clean - does the operation change the document helpId - Help Identifier that acts as an index into a help file bubbleID - string resource for "bubble help" text. resourceID - resource identifier of the resource containing the control. controlID - control identifier within that resource. OneOpenInstID - When non 0 only one live instance of the operation is permitted, and OneOpenInstID is the string resource ID describing why.This is useful for 1 open instance dialogs. AutoStateFlags - These flags are used to specify when the Operation should automatically be greyed, ticked etc. they cut down the number of tests that need to be made in the GetState fn. See the top of OpDesc.h for an uptodate list of these. The flags should be or'd eg. GREY_WHEN_NO_CURRENT_DOC | GREY_WHEN_NO_SELECTION
Definition at line 271 of file opdesc.cpp. 00288 : MessageHandler(CC_RUNTIME_CLASS(OpDescriptor), ReceiveMessages), 00289 ModuleID(Tool::GetModuleID(toolID)), 00290 TextID(txID), 00291 HelpID(helpID), 00292 BubbleID(bubbleID), 00293 BarCtrlInfo(resourceID,controlID,toolID), 00294 OpClass(Op), 00295 OneInstID(OneOpenInstID), 00296 AutoStateFlgs(AutoStateFlags), 00297 GetState(gs), 00298 Token(tok) 00299 { 00300 Flags.Smart = Smart; 00301 Flags.Clean = Clean; 00302 Flags.fCheckable = fCheckable; 00303 00304 Aliased = FALSE; 00305 m_bHotKeyEnabled = TRUE; 00306 00307 GetParamState = NULL; 00308 00309 ENSURE( tok /*&& gs*/, "OpDescriptor: new OpDescriptor called with a NULL parameter" ); 00310 00311 LinkDescriptor(this); 00312 00313 }
|
|
Standard destructor.
Definition at line 326 of file opdesc.cpp.
|
|
Allows you to alias an op descriptor, i.e. provide an alternative operation and GetState function for a registered op descriptor. This mechanism allows a standard operation, or user action, to have a different internal action or implementation.
AliasOperation(NULL,MyGetState,MyAutoStateFlags) means you are quite happy with the standard op but you want to replace the way the state of the OpDesc is determined. The registered auto state flags are replaced with MyAutoStateFlags AliasOperation(MyOp,NULL,MyAutoStateFlags) means you want to change the internal implementation but the state function is OK and does the job. The registered auto state flags is retained. I.e. MyAutoStateFlags param IS IGNORED!!!!! AliasOperation(NULL,NULL) causes an error in debug builds - i.e. what is the point? IMPORTANT: When aliasing an OpDesc it is very important that the high level functionality of the op remains the same. E.g. Aliasing the "Cut" op should not suddenly create a flower in the current layer. It should "Cut" something in a way that is consistant with the user's perception of the op. E.g. "Delete" has a menu item and button. When in the selector tool, he'd expect Delete to delete the selected objects. When in the grid tool, he'd expect Delete to delete the selected grids. However, the mechanisms of the two tools are very different. So the grid tool needs to alias the Delete op descriptor, so an alternative operation is invoked when the "Delete" menu item or button (or keypress!) is activated by the user. The grid tool may do something like this when it becomes active: Find the pre-registered OpDesc that we're interested in OpDescriptor* pOpDesc = FindOpDescriptor(OPTOKEN_DELETE); Alias it with an alternative op and GetState pOpDesc->AliasOperation(CC_RUNTIME_CLASS(GridDeleteOp),GridDeleteOpGetState,0); NOTE: At the time of writing this mechanism, it was asumed only tools would be allowed to alias OpDescs. To aid this, a call to RemoveAllAliases() has been placed in the tool mechanism at the point where the tool is deselected.
Definition at line 674 of file opdesc.cpp. 00675 { 00676 ENSURE(Aliased == FALSE,"This OpDesc is already aliased"); 00677 if (Aliased) return; 00678 00679 ENSURE((AliasOp != NULL) || (AliasGetState != NULL),"What is the point of aliasing an OpDesc when both params are NULL?"); 00680 if ((AliasOp == NULL) && (AliasGetState == NULL)) return; 00681 00682 // Note the alias op class 00683 AliasOpClass = AliasOp; 00684 00685 // Save the old state 00686 OldGetState = GetState; 00687 OldAutoStateFlags = AutoStateFlgs; 00688 OldTextID = TextID; 00689 OldBubbleID = BubbleID; 00690 00691 // Have we an alternative GetState func? 00692 if (AliasGetState != NULL) 00693 { 00694 // Only replace the GetState and AutoStateFlags if an alternative has been provided 00695 GetState = AliasGetState; 00696 AutoStateFlgs = AliasAutoStateFlags; 00697 } 00698 00699 // Only replace the text & bubble help IDs if they have been provided 00700 if (AliasTextID > 0) 00701 TextID = AliasTextID; 00702 00703 if (AliasBubbleID > 0) 00704 BubbleID = AliasBubbleID; 00705 00706 Aliased = TRUE; 00707 }
|
|
Builds a list of GadgetListItems, each item holding a DialogBarOp* and a CGadgetID for a control associated with this OpDescriptor. This allows the caller to manipulate the controls even if there isn't a message from them needing processing. NB. the caller is responsible for allocating and deallocating this list!
Definition at line 1058 of file opdesc.cpp. 01059 { 01060 #if !defined(EXCLUDE_FROM_RALPH) 01061 return ControlList::Get()->BuildGadgetList(pOutputList, this); 01062 #else 01063 return FALSE; 01064 #endif 01065 01066 01067 // Old code 01068 #if 0 01069 ENSURE(pOutputList != NULL, "Null output list in OpDescriptor::BuildGadgetList"); 01070 01071 PORTNOTETRACE("other","OpDescriptor::BuildGadgetList - do nothing"); 01072 // Get a pointer to the list of DialogBarOps, if there is one. 01073 List* pDialogBarOpList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogBarOp)); 01074 if (pDialogBarOpList == NULL) return FALSE; 01075 01076 // Get the first item on the DialogBarOp list. 01077 DialogBarOp* pDialogBarOp = (DialogBarOp*) pDialogBarOpList->GetHead(); 01078 while (pDialogBarOp != NULL) 01079 { 01080 if (pDialogBarOp->WindowID != 0) 01081 { 01082 BarItem* pBarItem = pDialogBarOp->GetPtrBarHead(); 01083 while (pBarItem != NULL) 01084 { 01085 if (pBarItem->IsKindOf(CC_RUNTIME_CLASS(BarControl))) 01086 { 01087 BarControl* pBarControl = (BarControl*) pBarItem; 01088 BOOL bIsHorizontal = pDialogBarOp->IsHorizontal(); 01089 if (pBarControl->GetOpDescriptor(bIsHorizontal) == this) 01090 { 01091 // Found a control associated with this OpDescriptor, so add it 01092 // to our list of gadgets. 01093 CGadgetID gid = pBarControl->GetUniqueGadgetID(); 01094 GadgetListItem* pgListItem = new GadgetListItem(pDialogBarOp, gid); 01095 if (pgListItem == NULL) 01096 { 01097 pOutputList->DeleteAll(); 01098 return FALSE; 01099 } 01100 01101 pOutputList->AddHead(pgListItem); 01102 } 01103 } 01104 pBarItem = pDialogBarOp->GetPtrBarNext(pBarItem); 01105 } 01106 } 01107 pDialogBarOp = (DialogBarOp*) pDialogBarOpList->GetNext(pDialogBarOp); 01108 } 01109 01110 // Return TRUE/FALSE depending on if there are any entries on the list. 01111 return !pOutputList->IsEmpty(); 01112 #endif 01113 }
|
|
Delete the OpDescriptor from the list of all OpDescriptors.
Definition at line 372 of file opdesc.cpp. 00373 { 00374 // Search the list of ops and remove this item from the list 00375 OpListItem* pOpListItem = OpDescriptor::GetFirstDescriptor(); 00376 while (pOpListItem) 00377 { 00378 if (pThisOp == pOpListItem->pOpDesc) 00379 { 00380 // remove this item from the list 00381 OpList.RemoveItem(pOpListItem); 00382 delete pOpListItem; 00383 return TRUE; 00384 } 00385 00386 pOpListItem = OpDescriptor::GetNextDescriptor(pOpListItem); 00387 } 00388 00389 // Didn't find anything or do anything 00390 return FALSE; 00391 }
|
|
Since the OpDescriptor maintains its own static list of all the OpDescriptors created in the program, and since none of them are actually destroyed with a call to a destructor, we have to do it ourselves by a call to this function in the DeInit kernel type of function. Basically it walks through the list of OpDescriptors and destroys them all.
Definition at line 843 of file opdesc.cpp. 00844 { 00845 ListItem* Item; 00846 00847 while( (Item = OpList.RemoveHead()) != NULL ) 00848 { 00849 delete ((OpListItem*)Item)->pOpDesc; 00850 delete Item; 00851 } 00852 }
|
|
Disables the hot key associated with this op See Also: IsHotKeyEnabled(), EnableHotKey().
Definition at line 807 of file opdesc.cpp. 00808 { 00809 m_bHotKeyEnabled = FALSE; 00810 }
|
|
Enables the hot key associated with this op See Also: DisableHotKey(), IsHotKeyEnabled().
Definition at line 823 of file opdesc.cpp. 00824 { 00825 m_bHotKeyEnabled = TRUE; 00826 }
|
|
To search the OpDescriptor list and find an entry with the given resource ID. Note it is compared against the 'control' entry.
Definition at line 589 of file opdesc.cpp. 00590 { 00591 OpListItem* CurrentItem = GetFirstDescriptor(); 00592 00593 while (CurrentItem != NULL) 00594 { 00595 // if we have found a match, return a pointer to it 00596 if ( CurrentItem -> pOpDesc -> BarCtrlInfo.ControlID == res ) 00597 return CurrentItem -> pOpDesc; 00598 00599 CurrentItem = GetNextDescriptor( CurrentItem ); // next item in the list 00600 } 00601 00602 return NULL; // failed to find a match, so return null 00603 }
|
|
To search the OpDescriptot list and find the OpDescriptor described by Token.
Definition at line 559 of file opdesc.cpp. 00560 { 00561 OpListItem* CurrentItem = GetFirstDescriptor(); 00562 00563 while (CurrentItem != NULL) 00564 { 00565 // if we have found a match, return a pointer to it 00566 if ( CurrentItem -> pOpDesc -> OpClass == Op ) 00567 return CurrentItem -> pOpDesc; 00568 00569 CurrentItem = GetNextDescriptor( CurrentItem ); // next item in the list 00570 } 00571 00572 return NULL; // failed to find a match, so return null 00573 }
|
|
To search the OpDescriptor list and find the OpDescriptor described by Token.
Definition at line 529 of file opdesc.cpp. 00530 { 00531 OpListItem* CurrentItem = GetFirstDescriptor(); 00532 00533 while (CurrentItem != NULL) 00534 { 00535 // if we have found a match, return a pointer to it 00536 if (camStrcmp( CurrentItem -> pOpDesc -> Token, Token ) == 0) 00537 return CurrentItem->pOpDesc; 00538 00539 CurrentItem = GetNextDescriptor( CurrentItem ); // next item in the list 00540 } 00541 00542 return NULL; // failed to find a match, so return null 00543 }
|
|
Returns the bar control info of the OpDescriptor. This is a platform-indy representation of the control which can be placed on toolbars to invoke this Operation.
Definition at line 946 of file opdesc.cpp. 00947 { 00948 return (&BarCtrlInfo); 00949 }
|
|
returns the string resource ID of the "bubble-help" text.
Definition at line 930 of file opdesc.cpp. 00931 { 00932 return BubbleID; 00933 }
|
|
Scans through a string and retrieves the text associated with the text flag passed in as a parameter.
Has this man never heard of the switch statement ??? Definition at line 1373 of file opdesc.cpp. 01374 { 01375 /**** Has this man never heard of the switch statement ??? ****/ 01376 01377 // if Menu Text is required then return text string. 01378 if (WhichText == OP_MENU_TEXT) 01379 return ReadString(pDesc); 01380 else 01381 01382 // if Help Description is required then return text string 01383 if (WhichText == OP_DESC_TEXT) 01384 { 01385 SetStringPos(&pDesc, WhichText); 01386 return ReadString(pDesc); 01387 } 01388 else 01389 01390 // if Undo Text is required then return text string. 01391 if (WhichText == OP_UNDO_TEXT) 01392 { 01393 SetStringPos(&pDesc, WhichText); 01394 return ReadString(pDesc); 01395 } 01396 01397 // if Menu Name is required then return text string. 01398 if (WhichText == OP_MENU_NAME) 01399 { 01400 return GetMenuNameString(pDesc); 01401 } 01402 01403 // Add next string type here!!! 01404 else 01405 return NULL; 01406 }
|
|
returns the first OpListItem in the list
Definition at line 650 of file opdesc.h. 00651 { 00652 return ((OpListItem*)(OpList.GetHead())); 00653 }
|
|
returns the Help Id
Definition at line 902 of file opdesc.cpp. 00903 { 00904 return HelpID; 00905 }
|
|
Reads the menu text in position one and removes any ampersands denoting an accelerator.
Definition at line 1490 of file opdesc.cpp. 01491 { 01492 const TCHAR ACCELERATOR_LETTER = '&'; 01493 01494 static TCHAR pText[MAX_TEXT_SIZE]; 01495 UINT32 pos = 0; 01496 01497 // Get Text String 01498 while ( (*pDesc != END_OF_STRING) && 01499 (*pDesc != STRING_DELIMETER) && 01500 (pos <= (MAX_TEXT_SIZE - 1))) 01501 { 01502 if (*pDesc != ACCELERATOR_LETTER) 01503 pText[pos++] = *pDesc; 01504 pDesc++; 01505 } 01506 01507 // Set end of string 01508 pText[pos] = END_OF_STRING; 01509 01510 return pText; 01511 }
|
|
returns the next OpListItem in the list
Definition at line 668 of file opdesc.h. 00669 { 00670 return ((OpListItem*)OpList.GetNext(CurrOp)); 00671 }
|
|
To obtain the OpFlags describing the type of the operation.
Definition at line 195 of file opdesc.cpp. 00196 { 00197 return Flags; 00198 }
|
|
This function will get called to determine the greyed/ticked state of the operation. It tests various conditions (based on the AutoStateFlgs) and then if the op survives this, calls the GetState fn which was registered with the operation.
Definition at line 1134 of file opdesc.cpp. 01135 { 01136 OpState OpSt; 01137 String_256 DisableReason; 01138 01139 // Test the AutoStateFlgs to determine if any automatic checks are required for this 01140 // OpDescriptor. 01141 01142 if (AutoStateFlgs & GREY_WHEN_NO_CURRENT_DOC) 01143 { 01144 // Check if there is a selected (user) document 01145 if (Document::GetSelected() == NULL) 01146 { 01147 // There is no current document 01148 OpSt.Greyed = TRUE; 01149 01150 // Load reason why operation is disabled 01151 DisableReason = String_256(_R(IDS_NO_DOC)); 01152 *Desc = DisableReason; 01153 goto End; 01154 } 01155 01156 } 01157 01158 if (AutoStateFlgs & GREY_WHEN_NO_SELECTION) 01159 { 01160 // Find the first node which is selected 01161 Node* FirstSelectedNode = GetApplication()->FindSelection()->FindFirst(); 01162 01163 if (FirstSelectedNode == NULL) 01164 { 01165 // No nodes are selected 01166 OpSt.Greyed = TRUE; 01167 // Load reason why operation is disabled 01168 DisableReason = String_256(_R(IDS_NO_OBJECTS_SELECTED)); 01169 *Desc = DisableReason; 01170 goto End; 01171 } 01172 } 01173 01174 // Changed 10/1/95 by MarkN & Phil 01175 // 01176 // The new 'if' statement is a temp fix until we are in a position to put correct logic in and 01177 // change all the ops to cope with the change. 01178 // 01179 // This fix allows ops that have "grey when no current doc" and/or "grey when no selection" to 01180 // still work when select-inside is present. 01181 // 01182 // if (AutoStateFlgs & ~DONT_GREY_WHEN_SELECT_INSIDE) 01183 if (!(AutoStateFlgs & DONT_GREY_WHEN_SELECT_INSIDE) 01184 && ((AutoStateFlgs & GREY_WHEN_NO_CURRENT_DOC) 01185 || (AutoStateFlgs & GREY_WHEN_NO_SELECTION) 01186 ) 01187 ) 01188 { 01189 // Find the selection range 01190 Range Sel(*(GetApplication()->FindSelection())); 01191 RangeControl rg = Sel.GetRangeControlFlags(); 01192 rg.PromoteToParent = TRUE; 01193 Sel.Range::SetRangeControl(rg); 01194 01195 if ( Sel.ContainsSelectInside() ) 01196 { 01197 // The selection contains selection inside 01198 OpSt.Greyed = TRUE; 01199 // Load reason why operation is disabled 01200 DisableReason = String_256(_R(IDS_GREY_WHEN_SELECT_INSIDE)); 01201 *Desc = DisableReason; 01202 goto End; 01203 } 01204 } 01205 01206 if (OneInstID != 0) 01207 { 01208 // Only one live instance of the operation is allowed. It's probably a dialog 01209 if (MessageHandler::MessageHandlerExists(OpClass)) 01210 { 01211 OpSt.Greyed = TRUE; 01212 *Desc = String_256(OneInstID); 01213 goto End; 01214 } 01215 } 01216 01217 // The operation survived all auto tests, so call the GetState fn 01218 // First, try to newer, parameterised way fo getting state info 01219 if (GetParamState != NULL && pOpParam!=NULL) 01220 { 01221 return (GetParamState(Desc, this, pOpParam)); 01222 } 01223 01224 // If that didn't do anything fall back to the older way of doing things 01225 if (GetState != NULL) 01226 { 01227 return (GetState(Desc, this)); 01228 } 01229 01230 End: // We jump here when we know the correct state, if there are ever any 01231 // auto tick test's things will be a bit different cos an op could be 01232 // ticked and greyed (well its possible, but not very likely) 01233 01234 return OpSt; 01235 }
|
|
This function will use the TextID and ModuleID values to obtain a String resource describing an operation. String resources may have one or more text descriptions in them, therefore, a TextFlag can be used to identify the the appropriate text required.
Reimplemented in ParamOpDescriptor, PlugInOpDescriptor, FrameInFrontOpDescriptor, and FrameBehindOpDescriptor. Definition at line 875 of file opdesc.cpp. 00876 { 00877 String_256 ResourceText( TextID, ModuleID ); 00878 TCHAR* ok; 00879 00880 // Explicitly cast return value from GetDescription from a TCHAR* to a String_256 00881 ok = GetDescription((TCHAR*) ResourceText, WhichText); 00882 00883 // if description is found then return true else return false 00884 if (ok) 00885 { 00886 *Description = String_256(ok); 00887 return TRUE; 00888 } 00889 else 00890 return FALSE; 00891 }
|
|
Returns the Tool ID.
Definition at line 916 of file opdesc.cpp. 00917 { 00918 return BarCtrlInfo.ToolID; 00919 }
|
|
This Function uses the Operation runtime class to create an instance of the operation object and call its DO function.
In a retail build DialogBarOp::UpdateStateOfAllBars is called and the operation is not executed.
Definition at line 428 of file opdesc.cpp. 00429 { 00430 // Before we invoke the operation we call the operation's GetState fn to make sure 00431 // that it is executable. 00432 String_256 Dummy; 00433 OpState State = GetOpsState(&Dummy); 00434 if (!State.Greyed) 00435 { 00436 00437 Operation* Op; 00438 CCRuntimeClass* TheOpClass; 00439 00440 // Find out which operation this OpDesc should invoke, i.e. has it been aliased 00441 if (Aliased) 00442 { 00443 if (AliasOpClass != NULL) 00444 TheOpClass = AliasOpClass; 00445 else 00446 TheOpClass = OpClass; 00447 } 00448 else 00449 TheOpClass = OpClass; 00450 00451 // Use the TheOpClass pointer to a runtime class in order to generate an instance of 00452 // the appropriate operation object 00453 Op = (Operation*) TheOpClass->CreateObject(); 00454 00455 if (Op) 00456 { 00457 #if !defined(EXCLUDE_FROM_RALPH) 00458 // Update the state of the bars 00459 DialogBarOp::SetSystemStateChanged(TRUE); 00460 00461 // If the op has not got its own way of showing the progress 00462 BOOL ShowProgressIndicator = !(Op->GetOpFlgs().HasOwnTimeIndicator); 00463 if (ShowProgressIndicator) 00464 { 00465 // Bring up the progress indicator (This has been made re-enterant) 00466 BeginSlowJob(); 00467 } 00468 #endif 00469 // On all but OpExit, send around an OpMsg::START. 00470 if (!IS_A(Op, OpExit)) BROADCAST_TO_ALL(OpMsg(Op, OpMsg::BEGIN)); 00471 00472 // Discard undo information if appropriate. 00473 if (!fWithUndo) Op->SucceedAndDiscard(); 00474 00475 // Call either parameterised or default Do function. 00476 if (pOpParam == 0) 00477 Op->Do(this); 00478 else 00479 Op->DoWithParam(this, pOpParam); 00480 00481 #if !defined(EXCLUDE_FROM_RALPH) 00482 if (ShowProgressIndicator) 00483 { 00484 EndSlowJob(); 00485 } 00486 #endif 00487 } 00488 } 00489 else 00490 { 00491 #if !defined(EXCLUDE_FROM_RALPH) 00492 // The operation is disabled. This means that DialogBarOp::UpdateStateOfAllBars 00493 // was not called after a change in the state of the system. 00494 00495 // If ShouldUpdateBarState returns TRUE then the operation was probably invoked before 00496 // the Idle event had a chance to update it. 00497 00498 // If this ENSURE goes bang it indicates that SetSystemStateChanged was not called when it 00499 // should have been. 00500 ENSURE(DialogBarOp::ShouldUpdateBarState(), "Trying to execute operation which should be disabled"); 00501 00502 // This ENSURE does not indicate a real error but I think its worth keeping it in as it indicates 00503 // that the idle update processing may not be frequent enough. 00504 //ENSURE(FALSE, "Trying to execute Operation before we have had a chance to disable it"); 00505 00506 // Update the bar state and leave 00507 DialogBarOp::SetSystemStateChanged(); 00508 DialogBarOp::UpdateStateOfAllBars(); 00509 // Beep(); // Just to annoy him ! 00510 #endif 00511 } 00512 }
|
|
Tells you whether the OpDesc is aliased or not.
Definition at line 748 of file opdesc.cpp. 00749 { 00750 return (Aliased); 00751 }
|
|
Determines whether or not the hot key associated with this op should be shown to the user via HotKey::FindHotKey() Notes: Presently used to disable Ctrl-S when save op is used for update. See Also: DisableHotKey(), EnableHotKey().
Definition at line 791 of file opdesc.cpp. 00792 { 00793 return m_bHotKeyEnabled; 00794 }
|
|
Add the OpDescriptor to the list of all OpDescriptors.
Definition at line 348 of file opdesc.cpp. 00349 { 00350 OpListItem* OpItem = new OpListItem; // A bit naughty I know but its got to be called from 00351 // the constructor (during initialisation) 00352 OpItem->pOpDesc = ThisOp; 00353 OpList.AddTail(OpItem); 00354 }
|
|
The default OpDescriptor message handler.
Reimplemented from MessageHandler. Reimplemented in ChangeFeatherSizeSliderOpDesc, ChangeFeatherProfileOpDesc, OpZoomDescriptor, and OpZoomComboDescriptor. Definition at line 966 of file opdesc.cpp. 00967 { 00968 // Is this a message for the OpDescriptor ?? 00969 if (MESSAGE_IS_A(Msg,OpDescMsg)) 00970 { 00971 if ( ((OpDescMsg*)Msg)->OpDesc == this) 00972 { 00973 00974 if (MESSAGE_IS_A(Msg,OpDescControlCreateMsg)) 00975 { 00976 // The control associated with the OpDescriptor is being created 00977 // call the virtual OnControlCreate method to allow the control 00978 // to be initialised. 00979 OnControlCreate((OpDescControlCreateMsg*)Msg); 00980 } 00981 00982 if (MESSAGE_IS_A(Msg,OpDescControlMsg)) 00983 { 00984 OpDescControlMsg* CtlMsg = (OpDescControlMsg*)Msg; 00985 switch((CtlMsg)->DlgMsg) 00986 { 00987 case DIM_LFT_BN_CLICKED: 00988 { 00989 // Invoke the Operation 00990 Invoke(); 00991 break; 00992 } 00993 00994 case DIM_SELECTION_CHANGED: 00995 //case DIM_SELECTION_CHANGED_COMMIT: Removed by Simon cos Jason changed the 00996 // semantics of DIM_SELECTION_CHANGED_COMMIT for combos 00997 { 00998 // Combo and slider messages handled here 00999 OnSelectionChange(CtlMsg, NULL); 01000 break; 01001 } 01002 01003 case DIM_COMMIT: 01004 { 01005 // profile dialog message boxes handled here 01006 OnSelectionChange(CtlMsg, NULL); 01007 } 01008 break; 01009 01010 case DIM_SLIDER_POS_CHANGING: 01011 { 01012 OnSliderChanging(CtlMsg); 01013 break; 01014 } 01015 01016 case DIM_SLIDER_POS_SET: 01017 { 01018 OnSliderSet(CtlMsg); 01019 break; 01020 } 01021 01022 case DIM_SLIDER_POS_CANCELLED: 01023 { 01024 OnSliderCancelled(CtlMsg); 01025 break; 01026 } 01027 01028 default: 01029 break; 01030 } 01031 } 01032 return EAT_MSG; 01033 } 01034 } 01035 return (MessageHandler::Message(Msg)); 01036 }
|
|
The OnControlCreate method is called by the OpDescriptor's default Message handler when a new control has just been created. You should override this method to perform gadget initialisation.
Reimplemented in OpChangeLineAttribOpDesc, OpChangeLineWidthOpDesc, OpNameGalleryPropIndexDesc, ChangeFeatherSizeSliderOpDesc, ChangeFeatherProfileOpDesc, QualitySliderDescriptor, and OpLibGalClipTheme. Definition at line 1257 of file opdesc.cpp. 01258 { 01259 // Override this fn is a derived class to initialise a control which has just been created 01260 // - Most useful for combo/listbox/edit controls. 01261 }
|
|
The OnSelectionChange method is called whenever the user selects a new value from the gadget .. (blah blah.
Because there can be more than one control associated with an OpDescriptor When the user makes a selection all gadgets need to be updated. The GadgetList parameter allows this ........ (Incomplete fn header)
Reimplemented in OpChangeLineAttribOpDesc, OpChangeLineWidthOpDesc, OpNameGalleryPropIndexDesc, ChangeFeatherSizeSliderOpDesc, OpLibGalClipTheme, and OpZoomComboDescriptor. Definition at line 1289 of file opdesc.cpp.
|
|
Called when the sliders position is being cancelled (if its associated with this opdescriptor).
Reimplemented in ChangeFeatherSizeSliderOpDesc. Definition at line 1343 of file opdesc.cpp.
|
|
Called when the sliders position is being changed (if its associated with this opdescriptor).
Reimplemented in ChangeFeatherSizeSliderOpDesc. Definition at line 1325 of file opdesc.cpp.
|
|
Called when the sliders position changes (if its associated with this opdescriptor).
Reimplemented in ChangeFeatherSizeSliderOpDesc, and QualitySliderDescriptor. Definition at line 1307 of file opdesc.cpp.
|
|
Reads the string until delimeter or end of string.
Definition at line 1458 of file opdesc.cpp. 01459 { 01460 static TCHAR pText[MAX_TEXT_SIZE]; 01461 UINT32 pos = 0; 01462 01463 // Get Text String 01464 while ( (*pDesc != END_OF_STRING) && 01465 (*pDesc != STRING_DELIMETER) && 01466 (pos <= (MAX_TEXT_SIZE - 1))) 01467 { 01468 pText[pos++] = *pDesc; 01469 pDesc++; 01470 } 01471 01472 // Set end of string 01473 pText[pos] = END_OF_STRING; 01474 01475 return pText; 01476 }
|
|
Removes the alias for this operation.
Definition at line 723 of file opdesc.cpp. 00724 { 00725 ENSURE(Aliased,"This OpDesc is NOT aliased"); 00726 if (!Aliased) return; 00727 00728 GetState = OldGetState; 00729 AutoStateFlgs = OldAutoStateFlags; 00730 TextID = OldTextID; 00731 BubbleID = OldBubbleID; 00732 00733 Aliased = FALSE; 00734 }
|
|
Goes through the list of op descriptors, removing all aliases.
Definition at line 765 of file opdesc.cpp. 00766 { 00767 ListItem* Item = OpList.GetHead(); 00768 00769 while (Item != NULL) 00770 { 00771 OpDescriptor* pOpDesc =((OpListItem*)Item)->pOpDesc; 00772 00773 if (pOpDesc->IsAliased()) pOpDesc->RemoveAlias(); 00774 00775 Item = OpList.GetNext(Item); 00776 } 00777 }
|
|
Definition at line 551 of file opdesc.h. 00551 { BarCtrlInfo = ThisInfo;};
|
|
Scans through a string and sets the pDesc pointer to the appropriate text in the string resource. The text position is determined by the ordinal value of the WhichText value.
Definition at line 1423 of file opdesc.cpp. 01424 { 01425 UINT32 StringPos = 0; 01426 01427 while ( (StringPos < (UINT32) WhichText) && 01428 (**pDesc != END_OF_STRING)) 01429 01430 { 01431 // Read until next string delimeter is reached 01432 while ( (**pDesc != END_OF_STRING) && 01433 (**pDesc != STRING_DELIMETER)) 01434 { 01435 (*pDesc)++; 01436 } 01437 01438 if (**pDesc != END_OF_STRING) 01439 // Move pointer to beginning of next string 01440 (*pDesc)++; 01441 01442 //Increment String position by 1 01443 StringPos++; 01444 } 01445 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|