ngsetop.cpp File Reference

(r1785/r1282)

#include "camtypes.h"
#include "ngcore.h"
#include "ngdialog.h"
#include "ngitem.h"
#include "ngprop.h"
#include "ngscan.h"
#include "ngsentry.h"
#include "ngsetop.h"
#include "keypress.h"
#include "userattr.h"
#include "tmpltatr.h"
#include "impexpop.h"
#include "bitfilt.h"
#include "ophist.h"

Go to the source code of this file.

Functions

 DECLARE_SOURCE ("$Revision: 1282 $")
 CC_IMPLEMENT_DYNCREATE (OpSelectSet, Operation)
 CC_IMPLEMENT_DYNCREATE (OpSelectUnionSets, Operation)
 CC_IMPLEMENT_DYNCREATE (OpSelectIntersectSets, Operation)
 CC_IMPLEMENT_DYNCREATE (OpApplyNamesToSel, SelOperation)
 CC_IMPLEMENT_DYNCREATE (OpApplyNamesToOne, UndoableOperation)
 CC_IMPLEMENT_DYNCREATE (OpApplyNameToNone, UndoableOperation)
 CC_IMPLEMENT_DYNCREATE (OpDeleteNamesFromAll, UndoableOperation)
 CC_IMPLEMENT_DYNCREATE (OpRenameAll, UndoableOperation)
 CC_IMPLEMENT_DYNCREATE (OpRemoveNamesFromSel, SelOperation)
 CC_IMPLEMENT_DYNCREATE (OpRedefineNamesAsSel, SelOperation)
 CC_IMPLEMENT_DYNCREATE (OpExportSets, Operation)
 CC_IMPLEMENT_DYNCREATE (OpChangeSetProperty, UndoableOperation)
 CC_IMPLEMENT_DYNCREATE (OpChangeBarProperty, UndoableOperation)
 CC_IMPLEMENT_DYNCREATE (OpChangeBarExtends, UndoableOperation)
void RenameSetInstance (const String_256 &str, const String_256 &NewStr, UndoableOperation *pOp, Spread *pSpread)
BOOL InitNamingSystem ()
 Initialises the various operations and other components of the Attribute gallery with the exception of the gallery and its embedded gagdets, which are initialised with the other galleries in sginit.cpp.

Variables

static char BASED_CODE THIS_FILE [] = __FILE__


Function Documentation

CC_IMPLEMENT_DYNCREATE OpChangeBarExtends  ,
UndoableOperation 
 

CC_IMPLEMENT_DYNCREATE OpChangeBarProperty  ,
UndoableOperation 
 

CC_IMPLEMENT_DYNCREATE OpChangeSetProperty  ,
UndoableOperation 
 

CC_IMPLEMENT_DYNCREATE OpExportSets  ,
Operation 
 

CC_IMPLEMENT_DYNCREATE OpRedefineNamesAsSel  ,
SelOperation 
 

CC_IMPLEMENT_DYNCREATE OpRemoveNamesFromSel  ,
SelOperation 
 

CC_IMPLEMENT_DYNCREATE OpRenameAll  ,
UndoableOperation 
 

CC_IMPLEMENT_DYNCREATE OpDeleteNamesFromAll  ,
UndoableOperation 
 

CC_IMPLEMENT_DYNCREATE OpApplyNameToNone  ,
UndoableOperation 
 

CC_IMPLEMENT_DYNCREATE OpApplyNamesToOne  ,
UndoableOperation 
 

CC_IMPLEMENT_DYNCREATE OpApplyNamesToSel  ,
SelOperation 
 

CC_IMPLEMENT_DYNCREATE OpSelectIntersectSets  ,
Operation 
 

CC_IMPLEMENT_DYNCREATE OpSelectUnionSets  ,
Operation 
 

CC_IMPLEMENT_DYNCREATE OpSelectSet  ,
Operation 
 

DECLARE_SOURCE "$Revision: 1282 $"   ) 
 

BOOL InitNamingSystem  ) 
 

Initialises the various operations and other components of the Attribute gallery with the exception of the gallery and its embedded gagdets, which are initialised with the other galleries in sginit.cpp.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/7/99
Returns:
TRUE if successful.

Definition at line 1161 of file ngsetop.cpp.

01162 {
01163 /*
01164     RegisterOpDescriptor's arguments:-
01165 
01166     toolID                              : Tool ID (from which the Module ID can be found)
01167     txID                                : String Resource ID
01168     RuntimeClass                        : The operation's runtime class
01169     tok,                                : pointer to the token string
01170     gs,                                 : pointer to the GetState function
01171     helpId = 0                          : help identifier 
01172     bubbleID = 0                        : string resource for bubble help
01173     resourceID = 0                      : resource ID
01174     controlID = 0                       : control ID within that resource within that tool
01175     GroupBarID = SYSTEMBAR_ILLEGAL      : The system bar group this op desc belongs to
01176     ReceiveMessages = FALSE *!!*        : Does this respond to system messages?
01177                                         : NOTE ** MUST be TRUE for ops connected to buttons?
01178     Smart = FALSE                       : A smart duplicate operation ?
01179     Clean = TRUE  *!!*                  : Does the operation change the document
01180     pVertOpDesc   *!!*                  : this op desc's vertical alter ego, if any
01181     OneOpenInstID = 0                   : When not 0 only one live instance
01182                                           of the operation is permitted, and
01183                                           OneOpenInstID is the string resource
01184                                           ID describing why.This will be useful
01185                                           for 1 open instance dialogs.
01186     AutoStateFlags = 0                  : Flags which indicate conditions when
01187                                           the operation should automatically be
01188                                           greyed/ticked, GREY_WHEN_NO_CURRENT_DOC and
01189                                           GREY_WHEN_NO_SELECTION, DONT_GREY_WHEN_SELECT_INSIDE
01190                                           This cuts down the number calls to GetState
01191 
01192     NB. The Clean argument defaults to FALSE for UndoableOperation::RegisterOpDescriptor.
01193     Also sote that UndoableOperation::RegisterOpdescriptor doesn't take the pVertOpDesc
01194     argument.  Oh sweet Camelot!
01195 */
01196     return OpSelectSet::RegisterOpDescriptor(
01197                 0,
01198                 _R(IDS_NAMEOP_SELECT_SET),
01199                 CC_RUNTIME_CLASS(OpSelectSet),
01200                 OPTOKEN_SELECT_SET,
01201                 0,
01202                 0,
01203                 _R(IDBBL_NAMEOP_SELECT_SET),
01204                 0,
01205                 0,
01206                 SYSTEMBAR_ILLEGAL,
01207                 FALSE,
01208                 FALSE,
01209                 TRUE,
01210                 0,
01211                 0,
01212                 GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE)
01213 
01214         && OpSelectUnionSets::RegisterOpDescriptor(
01215                 0,
01216                 _R(IDS_NAMEOP_SELECT_UNION_SETS),
01217                 CC_RUNTIME_CLASS(OpSelectUnionSets),
01218                 OPTOKEN_SELECT_UNION_SETS,
01219                 OpSelectUnionSets::GetState,
01220                 0,
01221                 _R(IDBBL_NAMEOP_SELECT_UNION_SETS))
01222         
01223         && OpSelectIntersectSets::RegisterOpDescriptor(
01224                 0,
01225                 _R(IDS_NAMEOP_SELECT_INTERSECT_SETS),
01226                 CC_RUNTIME_CLASS(OpSelectIntersectSets),
01227                 OPTOKEN_SELECT_INTERSECT_SETS,
01228                 OpSelectIntersectSets::GetState,
01229                 0,
01230                 _R(IDBBL_NAMEOP_SELECT_INTERSECT_SETS))
01231         
01232         && OpApplyNamesToSel::RegisterOpDescriptor(
01233                 0,
01234                 _R(IDS_NAMEOP_APPLY_NAMES_TO_SEL),
01235                 CC_RUNTIME_CLASS(OpApplyNamesToSel),
01236                 OPTOKEN_APPLY_NAMES_TO_SEL,
01237                 OpApplyNamesToSel::GetState,
01238                 0,
01239                 _R(IDBBL_NAMEOP_APPLY_NAMES_TO_SEL))
01240         
01241         && OpApplyNamesToSel::RegisterOpDescriptor(
01242                 0,
01243                 _R(IDS_NAMEOP_APPLY_NAME_TO_SEL),
01244                 CC_RUNTIME_CLASS(OpApplyNamesToSel),
01245                 OPTOKEN_APPLY_NAME_TO_SEL,
01246                 0,
01247                 _R(IDBBL_NAMEOP_APPLY_NAME_TO_SEL),
01248                 0,
01249                 0,
01250                 0,
01251                 SYSTEMBAR_ILLEGAL,
01252                 FALSE,
01253                 FALSE,
01254                 FALSE,
01255                 0,
01256                 GREY_WHEN_NO_SELECTION | DONT_GREY_WHEN_SELECT_INSIDE)
01257 
01258         && OpApplyNamesToOne::RegisterOpDescriptor(
01259                 0,
01260                 _R(IDS_NAMEOP_APPLY_NAMES_TO_ONE),
01261                 CC_RUNTIME_CLASS(OpApplyNamesToOne),
01262                 OPTOKEN_APPLY_NAMES_TO_ONE,
01263                 OpApplyNamesToOne::GetState,
01264                 0,
01265                 _R(IDBBL_NAMEOP_APPLY_NAMES_TO_ONE))
01266 
01267         && OpApplyNameToNone::RegisterOpDescriptor(
01268                 0,
01269                 _R(IDS_NAMEOP_APPLY_NAME_TO_NONE),
01270                 CC_RUNTIME_CLASS(OpApplyNameToNone),
01271                 OPTOKEN_APPLY_NAME_TO_NONE,
01272                 0,
01273                 _R(IDBBL_NAMEOP_APPLY_NAME_TO_NONE),
01274                 0,
01275                 0,
01276                 0,
01277                 SYSTEMBAR_ILLEGAL,
01278                 FALSE,
01279                 FALSE,
01280                 FALSE,
01281                 0,
01282                 GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE)
01283         
01284         && OpDeleteNamesFromAll::RegisterOpDescriptor(
01285                 0,
01286                 _R(IDS_NAMEOP_DELETE_NAMES_FROM_ALL),
01287                 CC_RUNTIME_CLASS(OpDeleteNamesFromAll),
01288                 OPTOKEN_DELETE_NAMES_FROM_ALL,
01289                 OpApplyNamesToOne::GetState,
01290                 0,
01291                 _R(IDBBL_NAMEOP_DELETE_NAMES_FROM_ALL))
01292 
01293         && OpRenameAll::RegisterOpDescriptor(
01294                 0,
01295                 _R(IDS_NAMEOP_RENAME_ALL),
01296                 CC_RUNTIME_CLASS(OpRenameAll),
01297                 OPTOKEN_RENAME_ALL,
01298                 OpApplyNamesToOne::GetState,
01299                 0,
01300                 _R(IDBBL_NAMEOP_RENAME_ALL))
01301 
01302         && OpRemoveNamesFromSel::RegisterOpDescriptor(
01303                 0,
01304                 _R(IDS_NAMEOP_REMOVE_NAMES_FROM_SEL),
01305                 CC_RUNTIME_CLASS(OpRemoveNamesFromSel),
01306                 OPTOKEN_REMOVE_NAMES_FROM_SEL,
01307                 OpApplyNamesToSel::GetState,
01308                 0,
01309                 _R(IDBBL_NAMEOP_REMOVE_NAMES_FROM_SEL))
01310 
01311         && OpRedefineNamesAsSel::RegisterOpDescriptor(
01312                 0,
01313                 _R(IDS_NAMEOP_REDEFINE_NAMES_AS_SEL),
01314                 CC_RUNTIME_CLASS(OpRedefineNamesAsSel),
01315                 OPTOKEN_REDEFINE_NAMES_AS_SEL,
01316                 OpApplyNamesToSel::GetState,
01317                 0,
01318                 _R(IDBBL_NAMEOP_REDEFINE_NAMES_AS_SEL))
01319         
01320         && OpExportSets::RegisterOpDescriptor(
01321                 0,
01322                 _R(IDS_NAMEOP_EXPORT_SETS),
01323                 CC_RUNTIME_CLASS(OpExportSets),
01324                 OPTOKEN_EXPORT_SETS,
01325                 OpExportSets::GetState,
01326                 0,
01327                 _R(IDBBL_NAMEOP_EXPORT_SETS))
01328 
01329         && OpChangeSetProperty::RegisterOpDescriptor(
01330                 0,
01331                 _R(IDS_NAMEOP_CHANGE_SET_PROPERTY),
01332                 CC_RUNTIME_CLASS(OpChangeSetProperty),
01333                 OPTOKEN_CHANGE_SET_PROPERTY,
01334                 0,
01335                 _R(IDBBL_NAMEOP_CHANGE_SET_PROPERTY),
01336                 0,
01337                 0,
01338                 0,
01339                 SYSTEMBAR_ILLEGAL,
01340                 FALSE,
01341                 FALSE,
01342                 FALSE,
01343                 0,
01344                 GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE)
01345         
01346         && OpChangeBarProperty::RegisterOpDescriptor(
01347                 0,
01348                 _R(IDS_NAMEOP_CHANGE_BAR_PROPERTY),
01349                 CC_RUNTIME_CLASS(OpChangeBarProperty),
01350                 OPTOKEN_CHANGE_BAR_PROPERTY,
01351                 0,
01352                 _R(IDBBL_NAMEOP_CHANGE_BAR_PROPERTY),
01353                 0,
01354                 0,
01355                 0,
01356                 SYSTEMBAR_ILLEGAL,
01357                 FALSE,
01358                 FALSE,
01359                 FALSE,
01360                 0,
01361                 GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE)
01362         
01363         && OpChangeBarExtends::RegisterOpDescriptor(
01364                 0,
01365                 _R(IDS_NAMEOP_CHANGE_BAR_EXTENDS),
01366                 CC_RUNTIME_CLASS(OpChangeBarExtends),
01367                 OPTOKEN_CHANGE_BAR_EXTENDS,
01368                 0,
01369                 _R(IDBBL_NAMEOP_CHANGE_BAR_EXTENDS),
01370                 0,
01371                 0,
01372                 0,
01373                 SYSTEMBAR_ILLEGAL,
01374                 FALSE,
01375                 FALSE,
01376                 FALSE,
01377                 0,
01378                 GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE)
01379         
01380         && NameObjectsDlg::Init()
01381 
01382         && NameObjectsDlg::RegisterOpDescriptor(
01383                 0,
01384                 _R(IDS_NAMEOP_NAME_OBJECTS_DLG),
01385                 CC_RUNTIME_CLASS(NameObjectsDlg),
01386                 OPTOKEN_NAME_OBJECTS_DLG,
01387                 0,
01388                 0,
01389                 _R(IDBBL_NAMEOP_NAME_OBJECTS_DLG),
01390                 0,
01391                 0,
01392                 SYSTEMBAR_ILLEGAL,
01393                 TRUE,                   // send kernel messages
01394                 FALSE,
01395                 TRUE,
01396                 0,
01397                 _R(IDS_NAMEDLG_ONE_INSTANCE),
01398                 GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE)
01399 
01400         && RenameObjectsDlg::RegisterOpDescriptor(
01401                 0,
01402                 _R(IDS_NAMEOP_RENAME_OBJECTS_DLG),
01403                 CC_RUNTIME_CLASS(RenameObjectsDlg),
01404                 OPTOKEN_RENAME_OBJECTS_DLG,
01405                 OpApplyNamesToOne::GetState,
01406                 0,
01407                 _R(IDBBL_NAMEOP_RENAME_OBJECTS_DLG));
01408 }

void RenameSetInstance const String_256 str,
const String_256 NewStr,
UndoableOperation pOp,
Spread pSpread
 

Definition at line 448 of file ngsetop.cpp.

00449 {
00450     // cant convert to the same thing its pointless
00451     if (str.CompareTo(NewStr) == 0)
00452         return;
00453 
00454     if (pOp == NULL || pSpread == NULL)
00455         return;
00456 
00457     SliceHelper::PurgeUseOfSetName(str, pOp, &NewStr);
00458     Node * pTop = (Node *) pSpread; // search from the spread first
00459     BOOL again = TRUE;
00460     Node * pNodeSetSentinel = pOp->GetWorkingDoc()->GetSetSentinel(); // the sentinel 
00461 
00462     // scan the tree to replace these nodes with the new node name
00463     Node * pNode = SliceHelper::FindNextNameNode(pTop, pTop);
00464     do
00465     {
00466         while (pNode)
00467         {
00468             if (str.CompareTo(((TemplateAttribute *)pNode)->GetParam()) == 0)
00469             {
00470                 // is the new attrib already on this parent?
00471                 // test siblings for the new attrib if it is already there don't add another
00472                 BOOL FoundLikeSibling = FALSE;
00473                 Node * pSib;
00474                 for (   pSib = pNode->FindParent()->FindFirstChild(CC_RUNTIME_CLASS(TemplateAttribute));
00475                         pSib != NULL;
00476                         pSib = pSib->FindNext(CC_RUNTIME_CLASS(TemplateAttribute)) )
00477                         {
00478                             if (NewStr.CompareTo(((TemplateAttribute *)pSib)->GetParam()) == 0)
00479                                 FoundLikeSibling = TRUE;
00480                         }
00481 
00482                 // add the new attrib where the old one was
00483                 TemplateAttribute* pta = NULL;
00484                 if (!FoundLikeSibling)
00485                 {
00486                     ALLOC_WITH_FAIL(pta, (new TemplateAttribute(TA_NAME, ((TemplateAttribute *)pNode)->GetQuestion(), NewStr)), pOp);
00487                     if (pta)
00488                     {
00489                         pta->AttachNode(pNode, PREV);
00490                         // Create an action to hide the new attribute when we Undo.
00491                         HideNodeAction* pHideAct;
00492                         if (AC_FAIL == HideNodeAction::Init(pOp, pOp->GetUndoActions(),
00493                                                             pta, TRUE, (Action**) &pHideAct))
00494                         {
00495                             delete pta;
00496                             pta = NULL;
00497                         }               
00498                     }
00499                 }
00500 
00501                 Node * pDelMe = pNode;
00502                 pNode = SliceHelper::FindNextNameNode(pNode, pTop);
00503 
00504                 // hide this node - the old attrib
00505                 pOp->DoHideNode(pDelMe, FALSE);
00506             }
00507             else
00508                 pNode = SliceHelper::FindNextNameNode(pNode, pTop);
00509         }
00510 
00511         again = pTop != pNodeSetSentinel;
00512         pTop = pNodeSetSentinel;
00513         pNode = SliceHelper::FindNextNameNode(pTop, pTop);
00514     } while (again);
00515 
00516 
00517 
00518     // Matt 18/12/2000
00519     // Nearly done renaming - don't forget that we need to hide the old NodeSetProperty !!!
00520     BOOL propertyrenamed = FALSE;
00521     NodeSetProperty * pNodeSetProperty = (NodeSetProperty *) pNodeSetSentinel->FindFirstChild(CC_RUNTIME_CLASS(NodeSetProperty));
00522     while (pNodeSetProperty && !propertyrenamed)
00523     {
00524         if ((pNodeSetProperty->GetName() == str) && (!pNodeSetProperty->IsNodeHidden()))
00525         {
00526             propertyrenamed = TRUE;
00527             pOp->DoHideNode(pNodeSetProperty, FALSE);
00528         }
00529         pNodeSetProperty = (NodeSetProperty *) pNodeSetProperty->FindNext(CC_RUNTIME_CLASS(NodeSetProperty));
00530     }
00531 }


Variable Documentation

char BASED_CODE THIS_FILE[] = __FILE__ [static]
 

Definition at line 133 of file ngsetop.cpp.


Generated on Sat Nov 10 03:49:16 2007 for Camelot by  doxygen 1.4.4