00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 #include "camtypes.h"
00104
00105
00106 #include "ngcore.h"
00107 #include "ngdialog.h"
00108 #include "ngitem.h"
00109 #include "ngprop.h"
00110 #include "ngscan.h"
00111 #include "ngsentry.h"
00112 #include "ngsetop.h"
00113
00114 #include "comattrmsg.h"
00115
00116 #include "keypress.h"
00117 #include "sginit.h"
00118 #include "sgmenu.h"
00119
00120
00121
00122
00123 #include "helpuser.h"
00124
00125
00126
00127
00128
00129 #include "userattr.h"
00130 #include "tmpltatr.h"
00131 #include "layer.h"
00132
00133 #include "objchge.h"
00134 #include "zoomops.h"
00135 #include "transop.h"
00136
00137
00138
00139 #include "opscale.h"
00140 #include "opsquash.h"
00141 #include "attrappl.h"
00142 #include "ophist.h"
00143
00144 #ifdef _DEBUG
00145 #undef THIS_FILE
00146 static char BASED_CODE THIS_FILE[] = __FILE__;
00147 #endif
00148
00149 DECLARE_SOURCE("$Revision: 1282 $");
00150
00151
00152 CC_IMPLEMENT_DYNCREATE(NameGallery, SuperGallery);
00153
00154
00155 #define new CAM_DEBUG_NEW
00156
00157 #define TIMER_ELAPSE 150
00158
00159
00160 NameGallery* NameGallery::m_pInstance = 0;
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171 NameGallery::NameGallery()
00172 : m_pUsedNames(0),
00173 m_nPropertyIndex(NamedExportProp::nIndex),
00174 m_nRefresh(0),
00175 m_nHiddenUpdates(0),
00176 m_fMenusCreated(FALSE),
00177 m_fChildChanges(FALSE),
00178 m_Timer(this)
00179 {
00180 DlgResID = _R(IDD_NAMESGALLERY);
00181 ERROR3IF(m_pInstance != 0, "NameGallery::NameGallery: instance already exists");
00182 m_pInstance = this;
00183 m_BarToIgnoreTargetsOf = "";
00184 CreateDisplayTree();
00185 }
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 NameGallery::~NameGallery()
00198 {
00199 m_pInstance = 0;
00200 }
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212 NameGallery* NameGallery::Instance()
00213 {
00214
00215 return m_pInstance;
00216 }
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228 SGNameGroup* NameGallery::GetFirstGroup()
00229 {
00230 return (SGNameGroup*) (DisplayTree != 0 ? DisplayTree->GetChild() : 0);
00231 }
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 SGUsedNames* NameGallery::GetUsedNames()
00244 {
00245 if (DisplayTree == 0) m_pUsedNames = 0;
00246 return m_pUsedNames;
00247 }
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260 INT32 NameGallery::GetPropertyIndex() const
00261 {
00262 return m_nPropertyIndex;
00263 }
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278 INT32 NameGallery::SetPropertyIndex(INT32 nNewIndex)
00279 {
00280 ERROR3IF(0 > nNewIndex || nNewIndex >= SGNameProp::nPropertyCount,
00281 "NameGallery::GetPropertyIndex: index out of range");
00282 INT32 n = m_nPropertyIndex;
00283 m_nPropertyIndex = nNewIndex;
00284 DisplayDirty();
00285 return n;
00286 }
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303 void NameGallery::GetHighlightCount(INT32* pnTotalItems, INT32* pnJustNames)
00304 {
00305
00306 ERROR3IF(pnTotalItems == 0 && pnJustNames == 0,
00307 "NameGallery::GetHighlightCount: null arguments");
00308
00309
00310 if (pnTotalItems != 0)
00311 *pnTotalItems = GetSelectedItemCount();
00312
00313
00314 if (pnJustNames != 0)
00315 *pnJustNames = (GetUsedNames() != 0) ? GetUsedNames()->GetSelectedItemCount() : 0;
00316 }
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332 void NameGallery::ForceUpdate()
00333 {
00334 DisplayDirty();
00335
00336
00337 }
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357 BOOL NameGallery::PreTriggerEdit(UndoableOperation* pOp, ObjChangeParam* pParam, Range* pRange)
00358 {
00359
00360 m_fChildChanges = TRUE;
00361 m_LastOpUsed = pOp;
00362 m_TouchedBar = -1;
00363 return TRUE;
00364 }
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384 BOOL NameGallery::PreTriggerEdit(UndoableOperation* pOp, ObjChangeParam* pParam, Node* pNode)
00385 {
00386
00387 m_fChildChanges = TRUE;
00388 m_LastOpUsed = pOp;
00389 m_TouchedBar = -1;
00390 return TRUE;
00391 }
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412 BOOL NameGallery::PostTriggerEdit(UndoableOperation* pOp, ObjChangeParam* pParam)
00413 {
00414
00415 if (!m_fChildChanges || (!Document::GetCurrent()->GetSetSentinel()->TargetsExist() && m_TouchedBar == -1) )
00416 return TRUE;
00417
00418
00419
00420 BOOL ok = FastApplyStretchScan(*pParam);
00421
00422
00423
00424 m_fChildChanges = FALSE;
00425 m_BarToIgnoreTargetsOf = "";
00426
00427 return ok;
00428 }
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450 BOOL NameGallery::PreCreate()
00451 {
00452
00453 CreateDisplayTree();
00454 return CreateDisplayScan().Scan();
00455 }
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468 BOOL NameGallery::CreateDisplayTree()
00469 {
00470
00471 if (Document::GetSelected() == 0 && DisplayTree != 0)
00472 {
00473 DisplayTree->DestroySubtree();
00474 delete DisplayTree;
00475 DisplayTree = 0;
00476 m_pUsedNames = 0;
00477 }
00478
00479
00480 if (DisplayTree == 0)
00481 {
00482 DisplayTree = new SGDisplayRootScroll(this);
00483 ERRORIF(DisplayTree == 0, _R(IDE_NOMORE_MEMORY), FALSE);
00484
00485 m_pUsedNames = new SGUsedNames;
00486 ERRORIF(m_pUsedNames == 0, _R(IDE_NOMORE_MEMORY), FALSE);
00487 DisplayTree->AddItem(m_pUsedNames);
00488
00489 SGUsedFonts* pFonts = new SGUsedFonts;
00490 ERRORIF(pFonts == 0, _R(IDE_NOMORE_MEMORY), FALSE);
00491 DisplayTree->AddItem(pFonts);
00492
00493 SGUsedBitmaps* pBitmaps = new SGUsedBitmaps;
00494 ERRORIF(pBitmaps == 0, _R(IDE_NOMORE_MEMORY), FALSE);
00495 DisplayTree->AddItem(pBitmaps);
00496
00497 SGUsedColours* pColours = new SGUsedColours;
00498 ERRORIF(pColours == 0, _R(IDE_NOMORE_MEMORY), FALSE);
00499 DisplayTree->AddItem(pColours);
00500 }
00501
00502 return TRUE;
00503 }
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528 MsgResult NameGallery::Message(Msg* pMessage)
00529 {
00530
00531 if (IS_OUR_DIALOG_MSG(pMessage))
00532 {
00533 DialogMsg* pMsg = (DialogMsg*) pMessage;
00534 switch (pMsg->DlgMsg)
00535 {
00536 case DIM_CREATE:
00537 SGInit::UpdateGalleryButton( _R(OPTOKEN_DISPLAY_NAME_GALLERY), TRUE);
00538 break;
00539
00540 case DIM_CANCEL:
00541 SGInit::UpdateGalleryButton( _R(OPTOKEN_DISPLAY_NAME_GALLERY), FALSE);
00542 break;
00543
00544 case DIM_LFT_BN_CLICKED:
00545 if( _R(IDC_GALLERY_HELP) == pMsg->GadgetID )
00546 {
00547 HelpUserTopic(_R(IDS_HELPPATH_Gallery_Name)); break;
00548 }
00549 else
00550 if( _R(IDC_GALLERY_NEW) == pMsg->GadgetID ||
00551 _R(IDC_NAMEGAL_RENAME) == pMsg->GadgetID ||
00552 _R(IDC_NAMEGAL_SELECT) == pMsg->GadgetID ||
00553 _R(IDC_NAMEGAL_INTERSECT) == pMsg->GadgetID ||
00554 _R(IDC_GALLERY_DELETE) == pMsg->GadgetID ||
00555 _R(IDC_LIBGAL_REMOVE) == pMsg->GadgetID ||
00556 _R(IDC_NAMEGAL_EXPORT) == pMsg->GadgetID )
00557 {
00558
00559
00560
00561 return DialogOp::Message(pMessage);
00562 }
00563 if( _R(IDC_GALLERY_APPLY) == pMsg->GadgetID ||
00564 _R(IDC_GALLERY_REDEFINE) == pMsg->GadgetID )
00565 {
00566
00567
00568 MsgResult tempMsg = DialogOp::Message(pMessage);
00569
00570
00571
00572 NameGallery *pNameGallery = NameGallery::Instance();
00573 if (!pNameGallery) { return tempMsg; }
00574
00575 SGUsedNames *pNames = pNameGallery->GetUsedNames();
00576 if (!pNames) { return tempMsg; }
00577
00578 SGNameItem *pNameGalleryItem = (SGNameItem*) pNames->GetChild();
00579 while (pNameGalleryItem)
00580 {
00581 if ((SGDisplayNode *)((SGDisplayItem *)pNameGalleryItem)->Flags.Selected)
00582 {
00583 NodeSetProperty* pPropNode = pNameGalleryItem->GetPropertyNode();
00584 if (pPropNode)
00585 {
00586 NamedStretchProp* pProp = (NamedStretchProp*) pPropNode->GetProperty(NamedStretchProp::nIndex);
00587 if (pProp && pProp->GetState())
00588 {
00589
00590
00591
00592 if (!pProp->ValidateStretchingObjects(pNameGalleryItem))
00593 {
00594 InformWarning(_R(IDE_SGNODEREGULARSHAPESDETECTED));
00595 return tempMsg;
00596 }
00597 }
00598 }
00599
00600 }
00601
00602 pNameGalleryItem = (SGNameItem *) pNameGalleryItem->GetNext();
00603 }
00604
00605 return tempMsg;
00606 }
00607 break;
00608
00609 default:
00610 break;
00611 }
00612 }
00613
00614
00615 else if (MESSAGE_IS_A(pMessage, DocChangingMsg))
00616 {
00617 DocChangingMsg* pMsg = (DocChangingMsg*) pMessage;
00618 if (pMsg->State == DocChangingMsg::SELCHANGED)
00619 DisplayDirty();
00620 else if (pMsg->State == DocChangingMsg::BORN)
00621 {
00622
00623 if (DisplayTree != 0)
00624 {
00625 DisplayTree->DestroySubtree();
00626 delete DisplayTree;
00627 DisplayTree = 0;
00628 m_pUsedNames = 0;
00629 }
00630
00631 CreateDisplayTree();
00632 }
00633 }
00634
00635
00636
00637
00638 else if (MESSAGE_IS_A(pMessage, OpMsg))
00639 {
00640 OpMsg* pMsg = (OpMsg*) pMessage;
00641 switch (pMsg->MsgType)
00642 {
00643 case OpMsg::BEGIN:
00644
00645
00646 m_fChildChanges = FALSE;
00647 break;
00648
00649 case OpMsg::END:
00650 if (!pMsg->pOp->IS_KIND_OF(UndoableOperation)) break;
00651
00652
00653 case OpMsg::AFTER_UNDO:
00654 case OpMsg::AFTER_REDO:
00655 DisplayDirty();
00656 break;
00657
00658 default:
00659 break;
00660 }
00661 }
00662
00663
00664
00665 else if (MESSAGE_IS_A(pMessage, CommonAttrsChangedMsg))
00666 DisplayDirty();
00667
00668
00669 return SuperGallery::Message(pMessage);
00670 }
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689 BOOL NameGallery::OnTimerEvent()
00690 {
00691 if (m_nRefresh != 0)
00692 {
00693 GetApplication()->RegisterIdleProcessor(IDLEPRIORITY_LOW, this);
00694 m_Timer.Stop();
00695 }
00696
00697 return TRUE;
00698 }
00699
00700
00701
00702 void NameGallery::DisplayDirty()
00703 {
00704
00705
00706
00707 if (!IsVisible())
00708 {
00709
00710 m_nHiddenUpdates++;
00711 return;
00712 }
00713
00714
00715
00716
00717 if (m_nRefresh++ == 0)
00718 m_Timer.Start(TIMER_ELAPSE, TRUE);
00719 }
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738 BOOL NameGallery::OnIdleEvent()
00739 {
00740
00741 if (m_nRefresh != 0)
00742 {
00743
00744 PreCreate();
00745 if (IsVisible())
00746 ForceRedrawOfList();
00747
00748
00749 GetApplication()->RemoveIdleProcessor(IDLEPRIORITY_LOW, this);
00750 m_nRefresh = 0;
00751
00752
00753 if (DocView::GetCurrent() != 0)
00754 OpZoomComboDescriptor::Update(TRUE);
00755 }
00756
00757
00758 return FALSE;
00759 }
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785 OpState NameGallery::GetCommandState(StringBase* pstrCommandID, String_256* pstrShade)
00786 {
00787
00788 const TCHAR* pTok;
00789 if (*pstrCommandID == SGCmd_New) pTok = OPTOKEN_NAME_OBJECTS_DLG;
00790 else if (*pstrCommandID == SGCmd_Rename) pTok = OPTOKEN_RENAME_OBJECTS_DLG;
00791 else if (*pstrCommandID == SGCmd_Select) pTok = OPTOKEN_SELECT_UNION_SETS;
00792 else if (*pstrCommandID == SGCmd_Intersect) pTok = OPTOKEN_SELECT_INTERSECT_SETS;
00793 else if (*pstrCommandID == SGCmd_Apply) pTok = OPTOKEN_APPLY_NAMES_TO_SEL;
00794 else if (*pstrCommandID == SGCmd_RemoveNames) pTok = OPTOKEN_REMOVE_NAMES_FROM_SEL;
00795 else if (*pstrCommandID == SGCmd_Redefine) pTok = OPTOKEN_REDEFINE_NAMES_AS_SEL;
00796 else if (*pstrCommandID == SGCmd_Delete) pTok = OPTOKEN_DELETE_NAMES_FROM_ALL;
00797 else if (*pstrCommandID == SGCmd_Export) pTok = OPTOKEN_EXPORT_SETS;
00798 else
00799 return SuperGallery::GetCommandState(pstrCommandID, pstrShade);
00800
00801 OpDescriptor* pDesc = OpDescriptor::FindOpDescriptor((TCHAR*) pTok);
00802 ERROR3IF(pDesc == 0, "NameGallery::GetCommandState: can't find descriptor");
00803 return pDesc->GetOpsState(pstrShade);
00804 }
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818 void NameGallery::DoCommand(StringBase* pstrCommandID)
00819 {
00820
00821 const TCHAR* pTok;
00822 if (*pstrCommandID == SGCmd_New) pTok = OPTOKEN_NAME_OBJECTS_DLG;
00823 else if (*pstrCommandID == SGCmd_Rename) pTok = OPTOKEN_RENAME_OBJECTS_DLG;
00824 else if (*pstrCommandID == SGCmd_Select) pTok = OPTOKEN_SELECT_UNION_SETS;
00825 else if (*pstrCommandID == SGCmd_Intersect) pTok = OPTOKEN_SELECT_INTERSECT_SETS;
00826 else if (*pstrCommandID == SGCmd_Apply) pTok = OPTOKEN_APPLY_NAMES_TO_SEL;
00827 else if (*pstrCommandID == SGCmd_RemoveNames) pTok = OPTOKEN_REMOVE_NAMES_FROM_SEL;
00828 else if (*pstrCommandID == SGCmd_Redefine) pTok = OPTOKEN_REDEFINE_NAMES_AS_SEL;
00829 else if (*pstrCommandID == SGCmd_Delete) pTok = OPTOKEN_DELETE_NAMES_FROM_ALL;
00830 else if (*pstrCommandID == SGCmd_Export) pTok = OPTOKEN_EXPORT_SETS;
00831 else
00832 {
00833 SuperGallery::DoCommand(pstrCommandID);
00834 return;
00835 }
00836
00837 OpDescriptor* pDesc = OpDescriptor::FindOpDescriptor((TCHAR*) pTok);
00838 ERROR3IF(pDesc == 0, "NameGallery::DoCommand: can't find descriptor");
00839 pDesc->Invoke();
00840 }
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853 BOOL NameGallery::InitMenuCommands()
00854 {
00855
00856 if (m_fMenusCreated) return TRUE;
00857 return m_fMenusCreated =
00858 InitMenuCommand((StringBase*) &SGCmd_Find, _R(IDS_SGMENU_FIND))
00859 && InitMenuCommand((StringBase*) &SGCmd_Apply, _R(IDS_SGMENU_APPLY))
00860 && InitMenuCommand((StringBase*) &SGCmd_RemoveNames, _R(IDS_SGMENU_REMOVE_NAMES))
00861 && InitMenuCommand((StringBase*) &SGCmd_Redefine, _R(IDS_SGMENU_REDEFINE))
00862 && InitMenuCommand((StringBase*) &SGCmd_Select, _R(IDS_SGMENU_SELECT))
00863 && InitMenuCommand((StringBase*) &SGCmd_Intersect, _R(IDS_SGMENU_INTERSECT))
00864 && InitMenuCommand((StringBase*) &SGCmd_New, _R(IDS_SGMENU_NEW))
00865 && InitMenuCommand((StringBase*) &SGCmd_Rename, _R(IDS_SGMENU_RENAME))
00866 && InitMenuCommand((StringBase*) &SGCmd_Delete, _R(IDS_SGMENU_DELETE))
00867 && InitMenuCommand((StringBase*) &SGCmd_Export, _R(IDS_SGMENU_EXPORT))
00868 && InitMenuCommand((StringBase*) &SGCmd_FoldGroup, _R(IDS_SGMENU_FOLD))
00869 && InitMenuCommand((StringBase*) &SGCmd_UnfoldGroup, _R(IDS_SGMENU_UNFOLD))
00870 && InitMenuCommand((StringBase*) &SGCmd_PrevGroup, _R(IDS_SGMENU_PREVGROUP))
00871 && InitMenuCommand((StringBase*) &SGCmd_NextGroup, _R(IDS_SGMENU_NEXTGROUP));
00872 }
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887 BOOL NameGallery::BuildCommandMenu(GalleryContextMenu* pMenu, SGMenuID id)
00888 {
00889
00890 if (id == SGMENU_OVERITEM)
00891 {
00892 SGNameGroup* pGroup = (SGNameGroup*) FindCommandGroup();
00893 return AddCommand(pMenu, (StringBase*) &SGCmd_Find, TRUE)
00894 && AddCommand(pMenu, (StringBase*) &SGCmd_Apply)
00895 && AddCommand(pMenu, (StringBase*) &SGCmd_RemoveNames)
00896 && AddCommand(pMenu, (StringBase*) &SGCmd_Redefine, TRUE)
00897 && AddCommand(pMenu, (StringBase*) &SGCmd_Select)
00898 && AddCommand(pMenu, (StringBase*) &SGCmd_Intersect, TRUE)
00899 && AddCommand(pMenu, (StringBase*) &SGCmd_New)
00900 && AddCommand(pMenu, (StringBase*) &SGCmd_Rename)
00901 && AddCommand(pMenu, (StringBase*) &SGCmd_Delete, TRUE)
00902 && AddCommand(pMenu, (StringBase*) &SGCmd_Export, TRUE)
00903 && AddCommand(pMenu, (StringBase*) ((pGroup == 0 || !pGroup->Flags.Folded)
00904 ? &SGCmd_FoldGroup : &SGCmd_UnfoldGroup))
00905 && AddCommand(pMenu, (StringBase*) &SGCmd_PrevGroup)
00906 && AddCommand(pMenu, (StringBase*) &SGCmd_NextGroup);
00907 }
00908
00909
00910 return SuperGallery::BuildCommandMenu(pMenu, id);
00911 }
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929 BOOL NameGallery::ApplyAction(SGActionType nAction)
00930 {
00931 switch (nAction)
00932 {
00933 case SGACTION_APPLY:
00934 case SGACTION_APPLYADJUST:
00935 {
00936 OpDescriptor* pDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_APPLY_NAMES_TO_SEL);
00937 ERROR3IF(pDesc == 0, "NameGallery::ApplyAction: no descriptor");
00938 String_256 str;
00939 if (!pDesc->GetOpsState(&str).Greyed)
00940 pDesc->Invoke();
00941 }
00942 return TRUE;
00943
00944 default:
00945 break;
00946 }
00947
00948 return SuperGallery::ApplyAction(nAction);
00949 }
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961 void NameGallery::SelectionHasChanged()
00962 {
00963
00964
00965
00966
00967 DialogBarOp::SetSystemStateChanged(TRUE);
00968 }
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981 void NameGallery::SetVisibility(BOOL fOpen)
00982 {
00983 SuperGallery::SetVisibility(fOpen);
00984 if (fOpen && m_nHiddenUpdates != 0)
00985 {
00986 m_nHiddenUpdates = 0;
00987 DisplayDirty();
00988 }
00989 }
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002 BOOL NameGallery::FastUpdateNamedSetSizes(BOOL PropagateChanges)
01003 {
01004 TRACEUSER( "GerryX", _T("FastUpdateNamedSetSizes(%s)\n"), PropagateChanges ? _T("TRUE") : _T("FALSE") );
01005
01006
01007
01008 Spread * pSpread = Document::GetSelectedSpread();
01009 if (!pSpread)
01010 return FALSE;
01011
01012 Node *pParent = NULL;
01013 SGUsedNames* pNames = GetUsedNames();
01014 if (!pNames)
01015 return FALSE;
01016
01017 SGNameItem* pNameGalleryItem = NULL;
01018
01019
01020 pNameGalleryItem = (SGNameItem*) pNames->GetChild();
01021
01022 while (pNameGalleryItem)
01023 {
01024 pNameGalleryItem->Reset(PropagateChanges);
01025 pNameGalleryItem->m_BarNumber = -1;
01026 pNameGalleryItem = (SGNameItem *) pNameGalleryItem->GetNext();
01027 }
01028
01029 String_256 str;
01030 String_256 AttrStr;
01031 String_256 BarName;
01032
01033
01034 Node * pTop = pSpread;
01035 Node * pNode = NULL;
01036 BOOL CheckLastAgainQuickly = TRUE;
01037
01038 if (pTop)
01039 {
01040
01041 pNode = SliceHelper::FindNextNameNode(pTop, pTop);
01042
01043
01044 while (pNode)
01045 {
01046
01047 CheckLastAgainQuickly = TRUE;
01048 if (!pNameGalleryItem)
01049 {
01050 pNameGalleryItem = (SGNameItem*) pNames->GetChild();
01051 CheckLastAgainQuickly = FALSE;
01052 }
01053
01054 AttrStr = ((TemplateAttribute *)pNode)->GetParam();
01055 pParent = pNode->FindParent();
01056
01057
01058 while (pNameGalleryItem)
01059 {
01060 pNameGalleryItem->GetNameText(&str);
01061
01062 if (str.CompareTo(AttrStr) == 0)
01063 {
01064 pNameGalleryItem->Include(pParent);
01065 BarName = SliceHelper::GetBarName((TemplateAttribute *)pNode);
01066 if (BarName[0] && pNameGalleryItem->m_BarNumber == -1)
01067 {
01068 pNameGalleryItem->m_BarNumber = SliceHelper::GetBarNumberFromBarName(BarName);
01069
01070 }
01071 break;
01072 }
01073
01074
01075 if (CheckLastAgainQuickly)
01076 {
01077 CheckLastAgainQuickly = FALSE;
01078 pNameGalleryItem = (SGNameItem*) pNames->GetChild();
01079 }
01080 else
01081 pNameGalleryItem = (SGNameItem*) pNameGalleryItem->GetNext();
01082 }
01083
01084
01085 if (!pNameGalleryItem)
01086 {
01087 pNameGalleryItem = pNames->RegisterMember(pParent, AttrStr);
01088
01089
01090 if (pNameGalleryItem)
01091 {
01092 BarName = SliceHelper::GetBarName((TemplateAttribute *)pNode);
01093 if (BarName[0])
01094 pNameGalleryItem->m_BarNumber = SliceHelper::GetBarNumberFromBarName(BarName);
01095 else
01096 pNameGalleryItem->m_BarNumber = -1;
01097 }
01098 }
01099
01100 pNode = SliceHelper::FindNextNameNode(pNode, pTop);
01101 }
01102 }
01103
01104 TRACEUSER( "GerryX", _T("Named Sets\n"));
01105 pNameGalleryItem = (SGNameItem*) pNames->GetChild();
01106 while (pNameGalleryItem)
01107 {
01108 pNameGalleryItem->GetNameText(&str);
01109 TRACEUSER( "GerryX", _T("Item %s Bar = %d Nodes = %d\n"), (TCHAR*)str, pNameGalleryItem->m_BarNumber,
01110 pNameGalleryItem->GetObjectCount());
01111 DocRect Rect;
01112 Rect = pNameGalleryItem->GetSetBounds();
01113 TRACEUSER( "GerryX", _T("Bounds = (%d, %d) (%d, %d)\n"), Rect.lo.x, Rect.lo.y, Rect.hi.y, Rect.hi.y);
01114 Rect = pNameGalleryItem->GetOldSetBounds();
01115 TRACEUSER( "GerryX", _T("Old Bounds = (%d, %d) (%d, %d)\n"), Rect.lo.x, Rect.lo.y, Rect.hi.y, Rect.hi.y);
01116 pNameGalleryItem = (SGNameItem *) pNameGalleryItem->GetNext();
01117 }
01118
01119 return TRUE;
01120 }
01121
01122
01123 inline BOOL RectsAreTheSameSize(const DocRect & r1, const DocRect & r2)
01124 {
01125 return ((r1.hi.x - r1.lo.x == r2.hi.x - r2.lo.x) && (r1.hi.y - r1.lo.y == r2.hi.y - r2.lo.y));
01126 }
01127
01128
01129
01130 class NodeListItemWithIndex : public NodeListItem
01131 {
01132 public:
01133 NodeListItemWithIndex(Node* WhichNode, INT32 i) {pNode = WhichNode; Index = i;};
01134 INT32 Index;
01135 };
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152 BOOL NameGallery::FastApplyStretchScan(ObjChangeParam & ObjChange)
01153 {
01154 TRACEUSER( "GerryX", _T("FastApplyStretchScan\n"));
01155
01156 Spread * pSpread = Document::GetSelectedSpread();
01157 if (!pSpread || m_LastOpUsed == NULL)
01158 return FALSE;
01159
01160 SGUsedNames* pNames = GetUsedNames();
01161 if (!pNames)
01162 {
01163 PreCreate();
01164 pNames = GetUsedNames();
01165 if (!pNames)
01166 return FALSE;
01167 }
01168
01169 BOOL ExtendOk = TRUE;
01170 BOOL Recurse = FALSE;
01171
01172 m_bResetARelationship = FALSE;
01173
01174
01175 struct ExtendStructType
01176 {
01177 SGNameItem * pTriggerSet;
01178 SGNameItem * pTargetSet;
01179 NamedStretchProp * pTargetStretchProp;
01180 DocRect CleanTargetRect;
01181 DocRect CombinedTriggerRect;
01182 DocRect OldCombinedTriggerRect;
01183 BOOL PerformedExtendOK;
01184 DocRect TotalExtend;
01185 } ExtendStruct[MAX_SIM_EXTENDS];
01186
01187 Node * pNodeSetSentinel = Document::GetSelected()->GetSetSentinel();
01188 SGNameItem* pNameGalleryItem = NULL;
01189
01190 INT32 TimesInLoop = 0;
01191
01192
01193
01194
01195 m_LastOpUsed = ObjChange.GetOpPointer();
01196
01197
01198 BOOL IsPossiblePullApartOp = m_LastOpUsed->IS_KIND_OF(TransOperation) && !IS_A(m_LastOpUsed, OpScaleTrans) && !IS_A(m_LastOpUsed, OpSquashTrans);
01199 BOOL IsAChangePropertyOp = IS_A(m_LastOpUsed, OpChangeBarProperty);
01200 BOOL IsAButtonNoChangingOp =
01201 PORTNOTE("other", "Remove OpDuplicateBar and OpShortenBar")
01202 #ifndef EXCLUDE_FROM_XARALX
01203 IS_A(m_LastOpUsed, OpDuplicateBar) ||
01204 IS_A(m_LastOpUsed, OpShortenBar) ||
01205 #endif
01206 IS_A(m_LastOpUsed, OpRenameAll);
01207
01208
01209 Recurse = IsAButtonNoChangingOp;
01210
01211 ObjChange.GetSettableChangeFlags()->RegenerateNode = TRUE;
01212
01213
01214 TRACEUSER( "GerryX", _T("%s\n"), (LPCTSTR) m_LastOpUsed->GetRuntimeClass()->m_lpszClassName);
01215
01216 do
01217 {
01218 TimesInLoop++;
01219
01220
01221 if (!FastUpdateNamedSetSizes())
01222 return FALSE;
01223
01224 NodeSetProperty* pPropNode = NULL;
01225 NamedStretchProp* pProp = NULL;
01226 NodeBarProperty * pNodeBarProperty = (NodeBarProperty*) ((NodeSetSentinel *)pNodeSetSentinel)->FindBarProperty();
01227
01228
01229 memset (m_BarSize,0, sizeof(m_BarSize));
01230
01231 INT32 TriggeredBar = -1;
01232 if (m_TouchedBar >= 0)
01233 {
01234 if (!SetBSTData(m_TouchedBar, 0, 0, 1, 0))
01235 {
01236 ERROR3("Couldn't Set Triggered Bar -> Index may be out of range!");
01237 return FALSE;
01238 }
01239 TriggeredBar = m_TouchedBar;
01240
01241
01242
01243
01244 PORTNOTE("other", "Removed OpDuplicateBar");
01245 #ifndef EXCLUDE_FROM_XARALX
01246 if (IS_A(m_LastOpUsed, OpDuplicateBar) && pNodeBarProperty->Bar(TriggeredBar).IsLive)
01247 {
01248 INT32 barDirection = pNodeBarProperty->Bar(TriggeredBar).IsHorizontal ? 1 : 2;
01249 if (!pNodeBarProperty->Bar(TriggeredBar).RequiresShuffle)
01250 barDirection = 0;
01251
01252 ShuffleBar( TriggeredBar,
01253 pNodeBarProperty->Bar(TriggeredBar).Spacing,
01254 barDirection,
01255 pNames,
01256 pSpread,
01257 ObjChange);
01258
01259 FastUpdateNamedSetSizes();
01260 }
01261 #endif
01262 }
01263
01264
01265
01266
01267
01268
01269
01270 pNameGalleryItem = (SGNameItem*) pNames->GetChild();
01271 while (pNameGalleryItem)
01272 {
01273
01274 if (TimesInLoop == 1)
01275 {
01276 pNameGalleryItem->m_IsPartOfThisStretch = FALSE;
01277 pNameGalleryItem->ResetCachedPropertyNode();
01278 }
01279
01280 pPropNode = pNameGalleryItem->GetPropertyNode();
01281 if (pPropNode)
01282 pProp = (NamedStretchProp*) pPropNode->GetProperty(NamedStretchProp::nIndex);
01283
01284 if (pProp && pPropNode && (pNameGalleryItem->GetSetBounds() != pNameGalleryItem->GetOldSetBounds()
01285 || (TimesInLoop > 1 && pNameGalleryItem->m_IsPartOfThisStretch)
01286 ))
01287 {
01288
01289
01290
01291 pNameGalleryItem->m_SetIsAffectedTrigger = TRUE;
01292 }
01293 else
01294 pNameGalleryItem->m_SetIsAffectedTrigger = FALSE;
01295
01296 pNameGalleryItem->m_IsATrigger = FALSE;
01297
01298 pNameGalleryItem = (SGNameItem *) pNameGalleryItem->GetNext();
01299 }
01300
01301
01302
01303 DocRect TempTriggerRect;
01304 SGNameItem* pTempTriggerSet = NULL;
01305
01306
01307 pNameGalleryItem = (SGNameItem*) pNames->GetChild();
01308 while (pNameGalleryItem)
01309 {
01310 TempTriggerRect.MakeEmpty();
01311
01312
01313 pPropNode = pNameGalleryItem->GetPropertyNode();
01314 if (pPropNode)
01315 {
01316 pProp = (NamedStretchProp*) pPropNode->GetProperty(NamedStretchProp::nIndex);
01317
01318
01319 if (pProp && pProp->GetState() && !pProp->GetTriggers().empty())
01320 {
01321
01322 for (std::list<TriggerSet>::iterator pt = pProp->GetTriggers().begin();
01323 pt != pProp->GetTriggers().end();
01324 pt++)
01325 {
01326 pTempTriggerSet = SliceHelper::LookupNameGalleryItem(pt->m_strSet);
01327
01328 if (pTempTriggerSet)
01329 {
01330
01331 TempTriggerRect = TempTriggerRect.Union(pTempTriggerSet->GetSetBounds());
01332
01333
01334
01335 pTempTriggerSet->m_IsATrigger = TRUE;
01336
01337
01338 if (pTempTriggerSet->m_SetIsAffectedTrigger && pNameGalleryItem->m_BarNumber >= 0)
01339 {
01340 if (!SetBSTData(pNameGalleryItem->m_BarNumber, 0, 0, 1, 0))
01341 {
01342 ERROR3("Couldn't Set Triggered Bar -> Index may be out of range!");
01343 return FALSE;
01344 }
01345 TriggeredBar = pNameGalleryItem->m_BarNumber;
01346 }
01347 }
01348 }
01349 }
01350 }
01351
01352
01353
01354
01355
01356 if (pNameGalleryItem->m_BarNumber >= 0 && pNameGalleryItem->m_BarNumber < MAX_BARS && !pNameGalleryItem->IsABackBar())
01357 {
01358 if (!SetBSTData(pNameGalleryItem->m_BarNumber,
01359 max( DWORD(TempTriggerRect.Width()), m_BarSize[pNameGalleryItem->m_BarNumber].MaxWidth ),
01360 max( DWORD(TempTriggerRect.Height()), m_BarSize[pNameGalleryItem->m_BarNumber].MaxHeight ), 0, 0 ) )
01361 {
01362 ERROR3("Couldn't Set Triggered Bar -> Index may be out of range!");
01363 return FALSE;
01364 }
01365 }
01366
01367
01368 if (pNameGalleryItem->IsABackBar() && TimesInLoop == 1 && pNameGalleryItem->m_BarNumber >= 0)
01369 {
01370 if (!SetBSTData(pNameGalleryItem->m_BarNumber, 0, 0, 0, 1))
01371 {
01372 ERROR3("Couldn't Set Triggered Bar -> Index may be out of range!");
01373 return FALSE;
01374 }
01375 }
01376
01377 pNameGalleryItem = (SGNameItem *) pNameGalleryItem->GetNext();
01378 }
01379
01380
01381
01382 INT32 ExtendsFound = 0;
01383
01384
01385
01386 pNameGalleryItem = (SGNameItem*) pNames->GetChild();
01387 while (pNameGalleryItem)
01388 {
01389 pPropNode = pNameGalleryItem->GetPropertyNode();
01390 if (pPropNode && pNodeBarProperty->Bar(pNameGalleryItem->m_BarNumber).IsLive)
01391 {
01392
01393 pProp = (NamedStretchProp*) pPropNode->GetProperty(NamedStretchProp::nIndex);
01394
01395
01396 if (pProp && pProp->GetState() && !pProp->GetTriggers().empty())
01397 {
01398 ExtendStruct[ExtendsFound].CombinedTriggerRect.MakeEmpty();
01399 ExtendStruct[ExtendsFound].OldCombinedTriggerRect.MakeEmpty();
01400
01401
01402 for (std::list<TriggerSet>::iterator pt = pProp->GetTriggers().begin();
01403 pt != pProp->GetTriggers().end();
01404 pt++)
01405 {
01406 ExtendStruct[ExtendsFound].pTriggerSet = SliceHelper::LookupNameGalleryItem(pt->m_strSet);
01407
01408
01409 if (ExtendStruct[ExtendsFound].pTriggerSet)
01410 {
01411
01412 ExtendStruct[ExtendsFound].CombinedTriggerRect = ExtendStruct[ExtendsFound].CombinedTriggerRect.Union(ExtendStruct[ExtendsFound].pTriggerSet->GetSetBounds());
01413 ExtendStruct[ExtendsFound].OldCombinedTriggerRect = ExtendStruct[ExtendsFound].OldCombinedTriggerRect.Union(ExtendStruct[ExtendsFound].pTriggerSet->GetOldSetBounds());
01414
01415
01416 if (ExtendStruct[ExtendsFound].pTriggerSet->m_SetIsAffectedTrigger)
01417 {
01418
01419 ExtendStruct[ExtendsFound].pTriggerSet->m_IsPartOfThisStretch = TRUE;
01420 }
01421 }
01422 }
01423
01424
01425
01426
01427 if (pNameGalleryItem->m_BarNumber >= 0 &&
01428 GetBSTTriggeredBar(pNameGalleryItem->m_BarNumber) &&
01429 ExtendStruct[ExtendsFound].pTriggerSet &&
01430 !pNameGalleryItem->IsABackBar())
01431 {
01432 if (pNodeBarProperty->Bar(pNameGalleryItem->m_BarNumber).SameSize < 3
01433 && ( ExtendStruct[ExtendsFound].pTriggerSet->GetSetBounds().Height() != 0 || ExtendStruct[ExtendsFound].pTriggerSet->GetSetBounds().Width() != 0))
01434 {
01435
01436 ExpandVirtualTriggers( pNodeBarProperty->Bar(pNameGalleryItem->m_BarNumber).SameSize,
01437 pNameGalleryItem->m_BarNumber,
01438 ExtendStruct[ExtendsFound].CombinedTriggerRect);
01439 }
01440 }
01441
01442
01443
01444
01445
01446
01447 BOOL TriggerSameSize = RectsAreTheSameSize(ExtendStruct[ExtendsFound].OldCombinedTriggerRect, ExtendStruct[ExtendsFound].CombinedTriggerRect);
01448 BOOL TargetSameSize = RectsAreTheSameSize(pNameGalleryItem->GetSetBounds(), pNameGalleryItem->GetOldSetBounds());
01449
01450
01451
01452
01453 BOOL DoExtend = (!TriggerSameSize ||
01454 ( pNameGalleryItem->m_BarNumber >= 0 &&
01455 GetBSTTriggeredBar(pNameGalleryItem->m_BarNumber)));
01456
01457
01458 DoExtend = DoExtend && !(IsPossiblePullApartOp && pNameGalleryItem->GetSelectedCount() > 0);
01459
01460
01461 if (DoExtend && !TargetSameSize && pNameGalleryItem->GetSelectedCount() > 0 && ExtendStruct[ExtendsFound].pTriggerSet)
01462 {
01463 if (RectsAreTheSameSize(pNameGalleryItem->GetSetBounds(),
01464 SliceHelper::ScanForSetSizeExcluding(*(pNameGalleryItem->GetNameTextPtr()), *(ExtendStruct[ExtendsFound].pTriggerSet->GetNameTextPtr()))))
01465 DoExtend = FALSE;
01466 }
01467
01468 BOOL DoReset = ((pNameGalleryItem->GetSetBounds() != pNameGalleryItem->GetOldSetBounds() ||
01469 ExtendStruct[ExtendsFound].OldCombinedTriggerRect != ExtendStruct[ExtendsFound].CombinedTriggerRect));
01470
01471
01472
01473
01474
01475
01476 if (!DoExtend && DoReset && (ObjChange.GetOpPointer())->IsKindOf(CC_RUNTIME_CLASS(OpApplyAttribToSelected)))
01477 {
01478 DoExtend = TRUE;
01479 DoReset = FALSE;
01480 }
01481
01482 if (pNameGalleryItem->m_BarNumber != -1 &&
01483 IsAChangePropertyOp &&
01484 ((OpChangeBarProperty*)m_LastOpUsed)->m_MakingLive &&
01485 ((OpChangeBarProperty*)m_LastOpUsed)->m_BarIndex == pNameGalleryItem->m_BarNumber)
01486 {
01487
01488 DoExtend = FALSE;
01489 DoReset = TRUE;
01490 TRACEUSER( "GerryX", _T("Bar gone live\n"));
01491 }
01492
01493
01494 if (DoExtend)
01495 {
01496 #ifdef DEBUG
01497 String_256 debug = "";
01498 pNameGalleryItem->GetNameText(&debug);
01499 TRACEUSER( "GerryX", _T("%s : Extended\n"), (TCHAR*) (debug));
01500 #endif
01501
01502
01503 ExtendStruct[ExtendsFound].pTargetSet = pNameGalleryItem;
01504 ExtendStruct[ExtendsFound].pTargetStretchProp = pProp;
01505 ExtendStruct[ExtendsFound].CleanTargetRect.MakeEmpty();
01506 ExtendStruct[ExtendsFound].PerformedExtendOK = FALSE;
01507 ExtendStruct[ExtendsFound].TotalExtend.MakeEmpty();
01508
01509
01510 if (ExtendsFound < MAX_SIM_EXTENDS-1)
01511 ExtendsFound++;
01512
01513
01514 if (pNameGalleryItem->m_BarNumber != -1)
01515 {
01516 TriggeredBar = pNameGalleryItem->m_BarNumber;
01517 if (!SetBSTData(TriggeredBar, 0, 0, 1, 0))
01518 {
01519 ERROR3("Couldn't Set Triggered Bar -> Index may be out of range!");
01520 return FALSE;
01521 }
01522 }
01523
01524
01525 if (pNameGalleryItem->m_IsATrigger)
01526 {
01527 Recurse = TRUE;
01528 }
01529
01530 pNameGalleryItem->m_IsPartOfThisStretch = TRUE;
01531 }
01532
01533
01534 else if (DoReset)
01535 {
01536 if (m_LastOpUsed && m_LastOpUsed->OpStatus == DO)
01537 {
01538
01539 #ifdef DEBUG
01540 String_256 debug = "";
01541 pNameGalleryItem->GetNameText(&debug);
01542 TRACEUSER( "GerryX", _T("%s : Reset\n"), (TCHAR*) (debug));
01543 #endif
01544
01545 if (pNameGalleryItem->m_BarNumber >= 0 &&
01546 !GetBSTTriggeredBar(pNameGalleryItem->m_BarNumber) &&
01547 ExtendStruct[ExtendsFound].pTriggerSet &&
01548 !pNameGalleryItem->IsABackBar())
01549 {
01550 if (pNodeBarProperty->Bar(pNameGalleryItem->m_BarNumber).SameSize < 3
01551 && ( ExtendStruct[ExtendsFound].pTriggerSet->GetSetBounds().Height() != 0 || ExtendStruct[ExtendsFound].pTriggerSet->GetSetBounds().Width() != 0))
01552 {
01553
01554 ExpandVirtualTriggers( pNodeBarProperty->Bar(pNameGalleryItem->m_BarNumber).SameSize,
01555 pNameGalleryItem->m_BarNumber,
01556 ExtendStruct[ExtendsFound].CombinedTriggerRect);
01557 }
01558 }
01559
01560 ResetRelationshipRects(pNameGalleryItem,
01561 pProp,
01562 NULL,
01563 &(ExtendStruct[ExtendsFound].CombinedTriggerRect)
01564 );
01565 }
01566 else
01567 {
01568 #ifdef DEBUG
01569 String_256 debug = "";
01570 pNameGalleryItem->GetNameText(&debug);
01571 TRACEUSER( "GerryX", _T("%s : Op Invalid for Reset\n"), (TCHAR*) (debug));
01572 #endif
01573 }
01574
01575
01576 if (pNameGalleryItem->m_BarNumber != -1)
01577 {
01578 TriggeredBar = pNameGalleryItem->m_BarNumber;
01579 if (!SetBSTData(TriggeredBar, 0, 0, 1, 0))
01580 {
01581 ERROR3("Couldn't Set Triggered Bar -> Index may be out of range!");
01582 return FALSE;
01583 }
01584 }
01585 }
01586 else
01587 {
01588 #ifdef DEBUG
01589 String_256 debug = "";
01590 pNameGalleryItem->GetNameText(&debug);
01591 TRACEUSER( "GerryX", _T("%s : No action\n"), (TCHAR*) (debug));
01592 #endif
01593 }
01594 }
01595 }
01596
01597
01598 pNameGalleryItem = (SGNameItem *) pNameGalleryItem->GetNext();
01599 }
01600
01601
01602 if (TriggeredBar == -1)
01603 {
01604 PORTNOTE("other", "Removed OpBarCreation");
01605 #ifndef EXCLUDE_FROM_XARALX
01606 if (IS_A(m_LastOpUsed, OpBarCreation))
01607 {
01608 TriggeredBar = ((OpBarCreation *)m_LastOpUsed)->GetBarNumber();
01609 }
01610 #endif
01611 }
01612
01613
01614 if (ExtendsFound == 0 && !IsAButtonNoChangingOp)
01615 {
01616 if (m_TouchedBar != -1)
01617 TriggeredBar = m_TouchedBar;
01618
01619 if (TriggeredBar != -1)
01620 {
01621
01622
01623 FastUpdateNamedSetSizes();
01624
01625 if (!SetBSTData(TriggeredBar, 0, 0, 1, 0))
01626 {
01627 ERROR3("Couldn't Set Triggered Bar -> Index may be out of range!");
01628 return FALSE;
01629 }
01630
01631 for (INT32 i = 0; i < MAX_BARS; i++)
01632 {
01633 if (GetBSTTriggeredBar(i) == 1 && pNodeBarProperty->Bar(i).IsLive)
01634 {
01635
01636
01637 INT32 barDirection = pNodeBarProperty->Bar(i).IsHorizontal ? 1 : 2;
01638 if (!pNodeBarProperty->Bar(i).RequiresShuffle)
01639 barDirection = 0;
01640
01641 ShuffleBar( i,
01642 pNodeBarProperty->Bar(i).Spacing,
01643 barDirection,
01644 pNames,
01645 pSpread,
01646 ObjChange);
01647
01648
01649 if (GetBSTHasABackBar(i) == 1)
01650 Recurse = TRUE;
01651 }
01652 }
01653
01654 m_TouchedBar = -1;
01655 m_LastOpUsed->NoStretchUpdateChangedNodes(&ObjChange, Document::GetCurrent());
01656
01657
01658
01659
01660
01661
01662
01663
01664
01665
01666 FastUpdateNamedSetSizes();
01667 }
01668
01669 if (!Recurse)
01670 return FALSE;
01671 }
01672
01673
01674
01675
01676
01677 Node * pTop = pSpread->FindFirstLayer()->FindParent();
01678 Node * pNode = NULL;
01679 Node * pTempNode = NULL;
01680 Node * pParent = NULL;
01681
01682
01683 List ExtendNodeList;
01684
01685 INT32 i = 0;
01686 BOOL CleanTarget = TRUE;
01687 BOOL StretchAsSingularItem = FALSE;
01688
01689 if (pTop)
01690 {
01691
01692 pNode = SliceHelper::FindNextNameNode(pTop, pTop);
01693
01694
01695 while (pNode)
01696 {
01697 pNameGalleryItem = (SGNameItem*) pNames->GetChild();
01698
01699
01700 pParent = pNode->FindParent();
01701
01702 if (pParent == pNodeSetSentinel)
01703 break;
01704
01705
01706 if (pParent)
01707 {
01708 for (i = 0; i < ExtendsFound; i++)
01709 {
01710 if (ExtendStruct[i].pTargetSet->GetNameTextPtr()->
01711 CompareTo(((TemplateAttribute *)pNode)->GetParam()) == 0)
01712 {
01713 CleanTarget = TRUE;
01714 StretchAsSingularItem = FALSE;
01715
01716 pTempNode = pParent->FindFirstChild(CC_RUNTIME_CLASS(TemplateAttribute));
01717 while (pTempNode && CleanTarget)
01718 {
01719 if (ExtendStruct[i].pTriggerSet && ExtendStruct[i].pTriggerSet->GetNameTextPtr()->
01720 CompareTo(((TemplateAttribute *)pTempNode)->GetParam()) == 0)
01721 {
01722 CleanTarget = FALSE;
01723
01724
01725
01726
01727
01728 }
01729
01730 pTempNode = pTempNode->FindNext(CC_RUNTIME_CLASS(TemplateAttribute));
01731 }
01732
01733
01734 if (CleanTarget && (!m_BarToIgnoreTargetsOf[0] || m_BarToIgnoreTargetsOf.CompareTo(((TemplateAttribute *)pNode)->GetQuestion()) != 0))
01735 {
01736 if (!pParent->IsSelected() || !IsPossiblePullApartOp)
01737 {
01738
01739 NodeListItemWithIndex * pItem = new NodeListItemWithIndex(pParent, i);
01740 ExtendNodeList.AddTail(pItem);
01741 ExtendStruct[i].PerformedExtendOK = TRUE;
01742 }
01743
01744
01745 ExtendStruct[i].CleanTargetRect = ExtendStruct[i].CleanTargetRect.Union(SliceHelper::BoundingNodeSize(pParent));
01746 }
01747 }
01748 }
01749 }
01750
01751 pNode = SliceHelper::FindNextNameNode(pNode, pTop);
01752 }
01753 }
01754
01755
01756 ExtendOk = TRUE;
01757
01758 DocRect rDiff;
01759
01760
01761 rDiff.MakeEmpty();
01762
01763 NodeListItemWithIndex * pNodeListItem = (NodeListItemWithIndex *)ExtendNodeList.GetHead();
01764
01765
01766 while (pNodeListItem && ExtendOk)
01767 {
01768 if (pNodeBarProperty->Bar(ExtendStruct[pNodeListItem->Index].pTargetSet->m_BarNumber).GroupsStretch || !IS_A(pNodeListItem->pNode, NodeGroup))
01769 {
01770
01771 rDiff = Extender::CheckValidExtend((NodeRenderableInk*) (pNodeListItem->pNode),
01772 ExtendStruct[pNodeListItem->Index].pTargetStretchProp->GetStretchType(),
01773 ExtendStruct[pNodeListItem->Index].pTargetStretchProp->GetRefUnionTriggerBounds(),
01774 ExtendStruct[pNodeListItem->Index].pTargetStretchProp->GetRefTargetBounds(),
01775 ExtendStruct[pNodeListItem->Index].CombinedTriggerRect,
01776 ExtendStruct[pNodeListItem->Index].OldCombinedTriggerRect,
01777 ExtendStruct[pNodeListItem->Index].CleanTargetRect,
01778 &ExtendOk,
01779 ExtendStruct[pNodeListItem->Index].pTargetSet->m_BarNumber >= 0);
01780
01781 if (!ExtendOk)
01782 break;
01783
01784 if (ExtendStruct[pNodeListItem->Index].TotalExtend.IsEmpty())
01785 ExtendStruct[pNodeListItem->Index].TotalExtend=rDiff;
01786
01787
01788 if (ExtendStruct[pNodeListItem->Index].TotalExtend.lo.x > rDiff.lo.x) ExtendStruct[pNodeListItem->Index].TotalExtend.lo.x = rDiff.lo.x;
01789 if (ExtendStruct[pNodeListItem->Index].TotalExtend.lo.y > rDiff.lo.y) ExtendStruct[pNodeListItem->Index].TotalExtend.lo.y = rDiff.lo.y;
01790 if (ExtendStruct[pNodeListItem->Index].TotalExtend.hi.x > rDiff.hi.x) ExtendStruct[pNodeListItem->Index].TotalExtend.hi.x = rDiff.hi.x;
01791 if (ExtendStruct[pNodeListItem->Index].TotalExtend.hi.y > rDiff.hi.y) ExtendStruct[pNodeListItem->Index].TotalExtend.hi.y = rDiff.hi.y;
01792
01793
01794
01795
01796
01797
01798
01799
01800
01801 if (ExtendStruct[pNodeListItem->Index].TotalExtend.lo.x < ExtendStruct[pNodeListItem->Index].TotalExtend.hi.x)
01802 ExtendStruct[pNodeListItem->Index].TotalExtend.hi.x = ExtendStruct[pNodeListItem->Index].TotalExtend.lo.x;
01803 else
01804 ExtendStruct[pNodeListItem->Index].TotalExtend.lo.x = ExtendStruct[pNodeListItem->Index].TotalExtend.hi.x;
01805
01806 if (ExtendStruct[pNodeListItem->Index].TotalExtend.lo.y < ExtendStruct[pNodeListItem->Index].TotalExtend.hi.y)
01807 ExtendStruct[pNodeListItem->Index].TotalExtend.hi.y = ExtendStruct[pNodeListItem->Index].TotalExtend.lo.y;
01808 else
01809 ExtendStruct[pNodeListItem->Index].TotalExtend.lo.y = ExtendStruct[pNodeListItem->Index].TotalExtend.hi.y;
01810
01811
01812 ExtendOk = pNodeListItem->pNode->AllowOp(&ObjChange);
01813 }
01814
01815 pNodeListItem = (NodeListItemWithIndex *)ExtendNodeList.GetNext(pNodeListItem);
01816 }
01817
01818
01819 pNodeListItem = (NodeListItemWithIndex *)ExtendNodeList.GetHead();
01820 NodeListItemWithIndex * pNodeListItemToDel = NULL;
01821
01822 while (pNodeListItem)
01823 {
01824 if (ExtendOk && (pNodeBarProperty->Bar(ExtendStruct[pNodeListItem->Index].pTargetSet->m_BarNumber).GroupsStretch || !IS_A(pNodeListItem->pNode, NodeGroup)))
01825 {
01826 TRACEUSER( "GerryX", _T("Extending %s at 0x%08x\n"), pNodeListItem->pNode->GetRuntimeClass()->m_lpszClassName, pNodeListItem->pNode);
01827
01828
01829 Extender::Extend((NodeRenderableInk*) (pNodeListItem->pNode),
01830 ExtendStruct[pNodeListItem->Index].pTargetStretchProp->GetStretchType(),
01831 ExtendStruct[pNodeListItem->Index].pTargetStretchProp->GetRefUnionTriggerBounds(),
01832 ExtendStruct[pNodeListItem->Index].pTargetStretchProp->GetRefTargetBounds(),
01833 ExtendStruct[pNodeListItem->Index].CombinedTriggerRect,
01834 ExtendStruct[pNodeListItem->Index].OldCombinedTriggerRect,
01835 ExtendStruct[pNodeListItem->Index].CleanTargetRect,
01836 &(ExtendStruct[pNodeListItem->Index].TotalExtend),
01837 ExtendStruct[pNodeListItem->Index].pTargetSet->m_BarNumber >= 0,
01838 m_LastOpUsed
01839 );
01840 }
01841 else if (ExtendOk)
01842 {
01843 TRACEUSER( "GerryX", _T("Moving %s at 0x%08x\n"), pNodeListItem->pNode->GetRuntimeClass()->m_lpszClassName, pNodeListItem->pNode);
01844 ExtendParams EPS;
01845 EPS.pOp = m_LastOpUsed;
01846 Extender::CalculateExtendParams(&EPS,
01847 ExtendStruct[pNodeListItem->Index].pTargetStretchProp->GetStretchType(),
01848 ExtendStruct[pNodeListItem->Index].pTargetStretchProp->GetRefUnionTriggerBounds(),
01849 ExtendStruct[pNodeListItem->Index].pTargetStretchProp->GetRefTargetBounds(),
01850 ExtendStruct[pNodeListItem->Index].CombinedTriggerRect,
01851 ExtendStruct[pNodeListItem->Index].OldCombinedTriggerRect,
01852 ExtendStruct[pNodeListItem->Index].CleanTargetRect,
01853 &(ExtendStruct[pNodeListItem->Index].TotalExtend),
01854 ExtendStruct[pNodeListItem->Index].pTargetSet->m_BarNumber >= 0
01855 );
01856
01857 if (m_LastOpUsed)
01858 m_LastOpUsed->DoInvalidateNodeRegion((NodeRenderableBounded*) pNode, TRUE, FALSE);
01859 ((NodeRenderable*) (pNodeListItem->pNode))->NodeRenderable::TransformTranslateObject(EPS);
01860 ((NodeRenderable*) (pNodeListItem->pNode))->NodeRenderable::TransformStretchObject(EPS);
01861 if (m_LastOpUsed)
01862 m_LastOpUsed->DoInvalidateNodeRegion((NodeRenderableBounded*) pNode, TRUE, FALSE);
01863 }
01864
01865
01866 pNodeListItemToDel = pNodeListItem;
01867 pNodeListItem = (NodeListItemWithIndex*)ExtendNodeList.GetNext(pNodeListItem);
01868
01869 if (pNodeListItemToDel)
01870 {
01871 ExtendNodeList.RemoveItem((NodeListItemWithIndex*)pNodeListItemToDel);
01872 delete pNodeListItemToDel;
01873 }
01874 }
01875
01876
01877 if (TriggeredBar >= 0 && TimesInLoop == 1 && pNodeBarProperty->Bar(TriggeredBar).RequiresShuffle)
01878 {
01879
01880
01881 FastUpdateNamedSetSizes();
01882
01883 if (!SetBSTData(TriggeredBar, 0, 0, 1, 0))
01884 {
01885 ERROR3("Couldn't Set Triggered Bar -> Index may be out of range!");
01886 return FALSE;
01887 }
01888
01889 for (i = 0; i < MAX_BARS; i++)
01890 {
01891 if (GetBSTTriggeredBar(i) == 1 && pNodeBarProperty->Bar(i).IsLive)
01892
01893
01894 {
01895 INT32 barDirection = pNodeBarProperty->Bar(i).IsHorizontal ? 1 : 2;
01896 if (!pNodeBarProperty->Bar(i).RequiresShuffle)
01897 barDirection = 0;
01898
01899 ShuffleBar( i,
01900 pNodeBarProperty->Bar(i).Spacing,
01901 barDirection,
01902 pNames,
01903 pSpread,
01904 ObjChange);
01905
01906
01907 if (GetBSTHasABackBar(i) == 1)
01908 Recurse = TRUE;
01909 }
01910 }
01911 }
01912
01913
01914 m_TouchedBar = -1;
01915
01916 if (Recurse && (ExtendOk || IsAButtonNoChangingOp) && TimesInLoop < 2)
01917 TRACEUSER( "GerryX", _T("Looping\n"));
01918
01919 } while(Recurse && (ExtendOk || IsAButtonNoChangingOp) && TimesInLoop < 2);
01920
01921 TRACEUSER( "GerryX", _T("After Loop\n"));
01922
01923
01924
01925 if (m_LastOpUsed->OpStatus == DO && (
01926 PORTNOTE("other", "Removed OpShortenBar")
01927 #ifndef EXCLUDE_FROM_XARALX
01928 IS_A(m_LastOpUsed, OpShortenBar) ||
01929 #endif
01930 IS_A(m_LastOpUsed, OpDelete)))
01931 {
01932 pNameGalleryItem = (SGNameItem*) pNames->GetChild();
01933 while (pNameGalleryItem)
01934 {
01935
01936 if (pNameGalleryItem->IsEmpty())
01937 {
01938 String_256 TempSetName = "";
01939 pNameGalleryItem->GetNameText(&TempSetName);
01940
01941 SliceHelper::PurgeUseOfSetName(TempSetName, m_LastOpUsed);
01942
01943 Node * pNode = pNameGalleryItem->GetPropertyNode();
01944 if (pNode)
01945 m_LastOpUsed->DoHideNode(pNode, FALSE);
01946
01947
01948
01949 pNode = Document::GetSelected()->GetSetSentinel()->GetNameAttr(TempSetName);
01950 if (pNode)
01951 m_LastOpUsed->DoHideNode(pNode, FALSE);
01952 }
01953
01954 pNameGalleryItem = (SGNameItem*)pNameGalleryItem->GetNext();
01955 }
01956 }
01957
01958 m_LastOpUsed->NoStretchUpdateChangedNodes(&ObjChange, Document::GetCurrent());
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970
01971
01972
01973 FastUpdateNamedSetSizes();
01974
01975 m_TouchedBar = -1;
01976
01977 TRACEUSER( "GerryX", _T("FastApplyStretchScan returning %s\n"), ExtendOk ? _T("TRUE") : _T("FALSE") );
01978
01979 return ExtendOk;
01980 }
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992
01993 void NameGallery::ResetRelationshipRects(SGNameItem * pTarget, NamedStretchProp * pProp, DocRect * pCleanTargetRect, DocRect * pKnownTriggerRect)
01994 {
01995 String_256 debug = "";
01996 pTarget->GetNameText(&debug);
01997 TRACEUSER( "GerryX", _T("ResetRelationshipRects %s\n"), (TCHAR*) (debug));
01998
01999 if (pTarget->GetSetBounds().Height() != 0 && pTarget->GetSetBounds().Width() != 0
02000 && m_LastOpUsed && m_LastOpUsed->OpStatus == DO)
02001 {
02002 DocRect TempCombinedTriggerRect;
02003 DocRect TempCleanTargetRect;
02004
02005
02006 if (pCleanTargetRect && pCleanTargetRect->Height() > 0 && pCleanTargetRect->Width() > 0)
02007 TempCleanTargetRect = *pCleanTargetRect;
02008 else
02009 {
02010
02011
02012
02013 if (pProp && !pProp->GetTriggers().empty())
02014 TempCleanTargetRect = SliceHelper::ScanForSetSizeExcluding(*pTarget->GetNameTextPtr(), pProp->GetTriggers().front().m_strSet);
02015 else
02016 TempCleanTargetRect = pTarget->GetSetBounds();
02017 }
02018
02019
02020 if (pKnownTriggerRect)
02021 TempCombinedTriggerRect = *pKnownTriggerRect;
02022 else
02023 {
02024 TempCombinedTriggerRect.MakeEmpty();
02025 SGNameItem * pTempNameItem = NULL;
02026
02027
02028 for (std::list<TriggerSet>::iterator pt = pProp->GetTriggers().begin();
02029 pt != pProp->GetTriggers().end();
02030 pt++)
02031 {
02032 pTempNameItem = SliceHelper::LookupNameGalleryItem(pt->m_strSet);
02033
02034 if (pTempNameItem)
02035 TempCombinedTriggerRect = TempCombinedTriggerRect.Union(pTempNameItem->GetSetBounds());
02036 }
02037 }
02038
02039 BOOL ok = TempCombinedTriggerRect.IsValid();
02040
02041
02042 if (ok
02043 && (TempCleanTargetRect != pProp->GetRefTargetBounds() || TempCombinedTriggerRect != pProp->GetRefUnionTriggerBounds())
02044 )
02045 {
02046 #ifdef DEBUG
02047 String_256 debug = "";
02048 pTarget->GetNameText(&debug);
02049 TRACEUSER( "GerryX", _T("Reset %s\n"), (TCHAR*) (debug));
02050 #endif
02051
02052 NodeSetProperty* pCopy;
02053 ALLOC_WITH_FAIL(pCopy, ((NodeSetProperty*) pTarget->GetPropertyNode()->SimpleCopy()), m_LastOpUsed);
02054 if (pCopy)
02055 {
02056
02057 NamedStretchProp* pNewProp = (NamedStretchProp*) pCopy->GetProperty(NamedStretchProp::nIndex);
02058 pNewProp->SetRefTargetBounds(TempCleanTargetRect);
02059 pNewProp->SetRefUnionTriggerBounds(TempCombinedTriggerRect);
02060
02061 Node * pNodeSetSentinel = Document::GetSelected()->GetSetSentinel();
02062 pCopy->AttachNode(pNodeSetSentinel, LASTCHILD);
02063
02064 HideNodeAction* UndoHideNodeAction;
02065 HideNodeAction::Init(m_LastOpUsed,
02066 m_LastOpUsed->GetUndoActions(),
02067 pCopy,
02068 FALSE,
02069 ( Action**)(&UndoHideNodeAction));
02070
02071 m_LastOpUsed->DoHideNode(pTarget->GetPropertyNode(), FALSE);
02072 pTarget->ResetCachedPropertyNode();
02073
02074 m_bResetARelationship = TRUE;
02075 }
02076 }
02077 }
02078 }
02079
02080
02081
02082
02083
02084
02085
02086
02087
02088
02089
02090
02091
02092 void NameGallery::ShuffleBar(INT32 BarNumber, INT32 Spacing, INT32 BarDirection,
02093 SGUsedNames* pNames, Spread* pSpread, ObjChangeParam& ObjChange)
02094 {
02095 TRACEUSER( "GerryX", _T("ShuffleBar(%d)\n"), BarNumber);
02096
02097 DocCoord NextPos(0,0);
02098 DocCoord FirstButtonPos(0,0);
02099 DocCoord FirstButtonSubPixPos(0,0);
02100 DocRect rBounds;
02101
02102 SGNameItem * Order[MAX_BUTTONS_IN_A_BAR];
02103 INT32 num = 0;
02104
02105 if (BarDirection != 1 && BarDirection != 2)
02106 return;
02107
02108
02109 SGNameItem* pNameGalleryItem = (SGNameItem*) pNames->GetChild();
02110 while (pNameGalleryItem)
02111 {
02112 if (pNameGalleryItem->m_BarNumber == BarNumber)
02113 {
02114
02115 pNameGalleryItem->m_Translation.x = 0;
02116 pNameGalleryItem->m_Translation.y = 0;
02117
02118
02119 if (!pNameGalleryItem->IsABackBar())
02120 {
02121 Order[num] = pNameGalleryItem;
02122 num++;
02123 }
02124 }
02125
02126 pNameGalleryItem = (SGNameItem *) pNameGalleryItem->GetNext();
02127 }
02128
02129
02130
02131 INT32 i;
02132 INT32 j;
02133 if (BarDirection == 1)
02134 for (i = 0; i < num; i++)
02135 {
02136 for (j = i+1; j < num; j++)
02137 {
02138 if ((Order[j]->GetSetBounds().lo.x < Order[i]->GetSetBounds().lo.x)
02139 || (Order[j]->GetSetBounds().lo.x == Order[i]->GetSetBounds().lo.x && Order[j]->GetSetBounds().hi.y > Order[i]->GetSetBounds().hi.y) )
02140 {
02141 pNameGalleryItem = Order[j];
02142 Order[j] = Order[i];
02143 Order[i] = pNameGalleryItem;
02144 }
02145 }
02146 }
02147 else
02148 if (BarDirection == 2)
02149 for (i = 0; i < num; i++)
02150 {
02151 for (j = i+1; j < num; j++)
02152 {
02153 if ((Order[j]->GetSetBounds().hi.y > Order[i]->GetSetBounds().hi.y)
02154 || (Order[j]->GetSetBounds().hi.y == Order[i]->GetSetBounds().hi.y && Order[j]->GetSetBounds().lo.x < Order[i]->GetSetBounds().lo.x) )
02155 {
02156 pNameGalleryItem = Order[j];
02157 Order[j] = Order[i];
02158 Order[i] = pNameGalleryItem;
02159 }
02160 }
02161 }
02162
02163
02164 for (i = 0; i < num; i++)
02165 {
02166 rBounds = Order[i]->GetSetBounds();
02167
02168 if (i == 0)
02169 {
02170
02171
02172 if (BarDirection == 1 || BarDirection == 2)
02173 {
02174 Order[i]->m_Translation.x = Order[i]->GetOldSetBounds().lo.x - rBounds.lo.x;
02175 Order[i]->m_Translation.y = Order[i]->GetOldSetBounds().hi.y - rBounds.hi.y;
02176 }
02177 FirstButtonPos.x = rBounds.lo.x + Order[i]->m_Translation.x;
02178 FirstButtonPos.y = rBounds.hi.y + Order[i]->m_Translation.y;
02179 FirstButtonSubPixPos.x = - (FirstButtonPos.x % 750);
02180 FirstButtonSubPixPos.y = FirstButtonPos.y % 750;
02181 }
02182 else
02183 {
02184
02185 Order[i]->m_Translation.x = NextPos.x - rBounds.lo.x;
02186 Order[i]->m_Translation.y = NextPos.y - rBounds.hi.y;
02187
02188 if (BarDirection == 1)
02189 Order[i]->m_Translation.x += Spacing;
02190 else if (BarDirection == 2)
02191 Order[i]->m_Translation.y -= Spacing;
02192
02193 }
02194
02195 switch (BarDirection)
02196 {
02197 case 1:
02198 if (Spacing == 0 || Spacing >= 3750)
02199 NextPos.x = ((rBounds.hi.y + Order[i]->m_Translation.x)/750)*750 + FirstButtonSubPixPos.x;
02200 else
02201 NextPos.x = rBounds.hi.y + Order[i]->m_Translation.x;
02202 NextPos.y = FirstButtonPos.y;
02203 break;
02204
02205 case 2:
02206 NextPos.x = FirstButtonPos.x;
02207 if (Spacing == 0 || Spacing >= 3750)
02208 NextPos.y = ((rBounds.lo.y + Order[i]->m_Translation.y)/750 +1)*750 + FirstButtonSubPixPos.y;
02209 else
02210 NextPos.y = rBounds.lo.y + Order[i]->m_Translation.y;
02211 break;
02212 }
02213
02214 TRACEUSER( "GerryX", _T("Moved Bar %d, %d\n"), Order[i]->m_Translation.x, Order[i]->m_Translation.y);
02215 }
02216
02217
02218
02219
02220 Node * pTop = pSpread->FindFirstLayer()->FindParent();
02221 Node * pNode = NULL;
02222 Node * pParent = NULL;
02223 Node * pNodeSetSentinel = Document::GetSelected()->GetSetSentinel();
02224
02225 BOOL UpdateSelection = FALSE;
02226
02227 Trans2DMatrix Transformer;
02228
02229 if (pTop)
02230 {
02231
02232 pNode = SliceHelper::FindNextNameNode(pTop, pTop);
02233
02234
02235 while (pNode)
02236 {
02237 pNameGalleryItem = SliceHelper::LookupNameGalleryItem(((TemplateAttribute *)pNode)->GetParam());
02238
02239 if (pNameGalleryItem && pNameGalleryItem->m_BarNumber == BarNumber &&
02240 (pNameGalleryItem->m_Translation.x || pNameGalleryItem->m_Translation.y))
02241 {
02242
02243 pParent = pNode->FindParent();
02244
02245 if (pParent == pNodeSetSentinel)
02246 break;
02247
02248 if (pParent)
02249 {
02250 Transformer.SetTransform(pNameGalleryItem->m_Translation.x, pNameGalleryItem->m_Translation.y);
02251
02252 if (m_LastOpUsed) m_LastOpUsed->DoInvalidateNodeRegion((NodeRenderableBounded*) pParent, TRUE, FALSE);
02253 if (pParent->AllowOp(&ObjChange))
02254 {
02255 ((NodeRenderableBounded *)pParent)->Transform(Transformer);
02256 if (pParent->IsSelected())
02257 UpdateSelection = TRUE;
02258 }
02259 if (m_LastOpUsed) m_LastOpUsed->DoInvalidateNodeRegion((NodeRenderableBounded*) pParent, TRUE, FALSE);
02260 }
02261 }
02262
02263 pNode = SliceHelper::FindNextNameNode(pNode, pTop);
02264 }
02265 }
02266
02267 if (UpdateSelection)
02268 {
02269
02270 BROADCAST_TO_ALL(SelChangingMsg(SelChangingMsg::NONCOLOURATTCHANGED));
02271 GetApplication()->UpdateSelection();
02272 }
02273 }
02274
02275
02276
02277
02278
02279
02280
02281
02282
02283
02284
02285
02286 BOOL NameGallery::ExpandVirtualTriggers(INT32 ExpandType, INT32 BarNo, DocRect &r1)
02287 {
02288 DWORD bstMaxHeight = GetBSTMaxHeight(BarNo);
02289 DWORD bstMaxWidth = GetBSTMaxWidth(BarNo);
02290 if (!bstMaxHeight || !bstMaxWidth)
02291 {
02292 ERROR3("Problems getting the max height and width -> Index may be out of range");
02293 return FALSE;
02294 }
02295
02296 INT32 ysize = max( ( bstMaxHeight - r1.Height() ) / 2, unsigned(0) );
02297 INT32 xsize = max( ( bstMaxWidth - r1.Width() ), unsigned(0) );
02298
02299 switch (ExpandType)
02300 {
02301 case 1:
02302 r1.Inflate(0, ysize);
02303 r1.hi.y += xsize;
02304 return TRUE;
02305
02306 case 2:
02307 r1.Inflate(0, ysize);
02308 r1.lo.x -= xsize;
02309 return TRUE;
02310
02311 case 0:
02312 r1.Inflate(xsize/2, ysize);
02313 return TRUE;
02314 }
02315
02316 return FALSE;
02317 }
02318
02319
02320
02321
02322
02323
02324
02325
02326
02327
02328
02329
02330
02331
02332
02333
02334
02335
02336
02337 BOOL NameGallery::SetBSTData(INT32 Index, DWORD MaxWidth = NULL, DWORD MaxHeight = NULL, BYTE TriggeredBar = NULL, BYTE HasABackBar = NULL)
02338 {
02339 if (Index > MAX_BARS || (!MaxWidth && !MaxHeight && !TriggeredBar && !HasABackBar))
02340 {
02341 ERROR3("Problem calling SetBSTData()");
02342 return FALSE;
02343 }
02344
02345 if (MaxWidth) { m_BarSize[Index].MaxWidth = MaxWidth; }
02346 if (MaxHeight) { m_BarSize[Index].MaxHeight = MaxHeight; }
02347 if (TriggeredBar) { m_BarSize[Index].TriggeredBar = TriggeredBar; }
02348 if (HasABackBar) { m_BarSize[Index].HasABackBar = HasABackBar; }
02349
02350 return TRUE;
02351 }