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
00107 #include "csrstack.h"
00108
00109
00110 #include "nodepath.h"
00111 #include "progress.h"
00112 #include "nodeblnd.h"
00113 #include "nodebldr.h"
00114
00115 #include "blobs.h"
00116
00117
00118 #include "objchge.h"
00119
00120
00121 #include "filltool.h"
00122 #include "bubbleid.h"
00123
00124 #include "attrmap.h"
00125 #include "ndbldpth.h"
00126 #include "pathedit.h"
00127 #include "keypress.h"
00128 #include "vkextra.h"
00129
00130 #include "blndtool.h"
00131
00132 #include "opbevel.h"
00133
00134
00135 #include "biasgdgt.h"
00136 #include "opcntr.h"
00137
00138 #include "shapeops.h"
00139 #include "biasdlg.h"
00140
00141
00142
00143
00144
00145 #include "nbevcont.h"
00146 #include "nodecont.h"
00147
00148 #include "nodecntr.h"
00149 #include "ncntrcnt.h"
00150 #include "opbevel.h"
00151 #include "layer.h"
00152 #include "ophist.h"
00153
00154 DECLARE_SOURCE( "$Revision: 1401 $" );
00155
00156 CC_IMPLEMENT_MEMDUMP(BlendTool,Tool_v1)
00157 CC_IMPLEMENT_DYNCREATE(BlendInfoBarOp,InformationBarOp)
00158 CC_IMPLEMENT_MEMDUMP(BlendToolRef,CC_CLASS_MEMDUMP)
00159 CC_IMPLEMENT_DYNCREATE(OpBlendNodes,SelOperation)
00160 CC_IMPLEMENT_DYNCREATE(OpRemoveBlend,SelOperation)
00161 CC_IMPLEMENT_DYNCREATE(OpAddBlendPath,SelOperation)
00162 CC_IMPLEMENT_DYNCREATE(OpDetachBlendPath,SelOperation)
00163 CC_IMPLEMENT_DYNCREATE(OpChangeBlend,SelOperation)
00164 CC_IMPLEMENT_DYNCREATE(OpBlendOneToOne,OpChangeBlend)
00165 CC_IMPLEMENT_DYNCREATE(OpBlendAntialias,OpChangeBlend)
00166 CC_IMPLEMENT_DYNCREATE(OpBlendTangential,OpChangeBlend)
00167 CC_IMPLEMENT_DYNCREATE(OpChangeBlendSteps,SelOperation)
00168 CC_IMPLEMENT_DYNCREATE(ChangeBlendAction,Action)
00169 CC_IMPLEMENT_DYNCREATE(ChangeBlenderAction,Action)
00170 CC_IMPLEMENT_DYNCREATE(ChangeBlendStepsAction,Action)
00171 CC_IMPLEMENT_DYNCREATE(RemapBlendAction,Action)
00172 CC_IMPLEMENT_DYNCREATE(InitBlendersAction,Action)
00173 CC_IMPLEMENT_MEMDUMP(ChangeBlendOpParam,OpParam)
00174 CC_IMPLEMENT_MEMDUMP(ChangeBlenderOpParam,OpParam)
00175 CC_IMPLEMENT_DYNCREATE(InvalidateBoundsAction,Action)
00176 CC_IMPLEMENT_DYNCREATE(OpChangeBlendDistance, SelOperation)
00177 CC_IMPLEMENT_DYNCREATE(OpEditBlendEndObject, SelOperation)
00178 CC_IMPLEMENT_MEMDUMP(BlenderInfoItem,ListItem);
00179
00180
00181
00182
00183 #define new CAM_DEBUG_NEW
00184
00185
00186 TCHAR* BlendTool::FamilyName = _T("Blend Tools");
00187 TCHAR* BlendTool::ToolName = _T("Blend Tool");
00188 TCHAR* BlendTool::Purpose = _T("Blend manipulation");
00189 TCHAR* BlendTool::Author = _T("Mark Neves");
00190
00191
00192 BlendInfoBarOp* BlendTool::pBlendInfoBarOp = NULL;
00193 BlendToolRef* BlendTool::pRefStart = NULL;
00194 BlendToolRef* BlendTool::pRefEnd = NULL;
00195 Cursor* BlendTool::pcNormalCursor = NULL;
00196 Cursor* BlendTool::pcBlendableCursor = NULL;
00197 Cursor* BlendTool::pcBlendableBlobCursor = NULL;
00198 Cursor* BlendTool::pcBlendableRemapCursor = NULL;
00199 Cursor* BlendTool::pcCurrentCursor = NULL;
00200 INT32 BlendTool::CurrentCursorID = 0;
00201 UINT32 BlendTool::StatusID = _R(IDS_BLENDSTATUS_FINDSTART);
00202
00203
00204
00205 #define SWAP(type,a,b) { type x=a; a=b; b=x; }
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 BlendTool::BlendTool()
00220 {
00221 pcCurrentCursor = NULL;
00222 }
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234 BlendTool::~BlendTool()
00235 {
00236 if (pRefStart != NULL)
00237 {
00238 delete pRefStart;
00239 pRefStart = NULL;
00240 }
00241
00242 if (pRefEnd != NULL)
00243 {
00244 delete pRefEnd;
00245 pRefEnd = NULL;
00246 }
00247 }
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262 BOOL BlendTool::Init()
00263 {
00264
00265
00266 BOOL ok = ( OpBlendNodes::Declare() &&
00267 OpRemoveBlend::Declare() &&
00268 OpAddBlendPath::Declare() &&
00269 OpDetachBlendPath::Declare() &&
00270 OpChangeBlend::Declare() &&
00271 OpBlendOneToOne::Declare() &&
00272 OpBlendAntialias::Declare() &&
00273 OpChangeBlendSteps::Declare());
00274
00275 if (!ok) return FALSE;
00276
00277
00278 BlendTool::pRefStart = new BlendToolRef;
00279 BlendTool::pRefEnd = new BlendToolRef;
00280
00281 ok = (BlendTool::pRefStart != NULL && BlendTool::pRefEnd != NULL);
00282
00283
00284
00285
00286 if (ok)
00287 {
00288 pBlendInfoBarOp = new BlendInfoBarOp();
00289 ok = (pBlendInfoBarOp != NULL);
00290 #if 0
00291 CCResTextFile file;
00292 BlendInfoBarOpCreate BarCreate;
00293
00294 ok = file.open(_R(IDM_BLEND_BAR), _R(IDT_INFO_BAR_RES));
00295 if (ok) ok = DialogBarOp::ReadBarsFromFile(file,BarCreate);
00296 if (ok) file.close();
00297
00298 ENSURE(ok,"Unable to load blendbar.ini from resource\n");
00299
00300 if (ok)
00301 {
00302
00303 String_32 str = String_32(_R(IDS_BLNDTOOL_INFOBARNAME));
00304 DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str);
00305
00306 ok = (pDialogBarOp != NULL);
00307 if (ok) ok = pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(BlendInfoBarOp));
00308 if (ok) pBlendInfoBarOp = (BlendInfoBarOp*)pDialogBarOp;
00309
00310 ENSURE(ok,"Error finding the blend tool info bar");
00311 }
00312 #endif
00313 }
00314
00315 return (ok);
00316 }
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335 void BlendTool::Describe(void *InfoPtr)
00336 {
00337
00338 ToolInfo_v1 *Info = (ToolInfo_v1 *) InfoPtr;
00339
00340 Info->InfoVersion = 1;
00341
00342 Info->InterfaceVersion = GetToolInterfaceVersion();
00343
00344
00345 Info->Version = 1;
00346 Info->ID = GetID();
00347 Info->TextID = _R(IDS_BLEND_TOOL);
00348
00349 Info->Family = FamilyName;
00350 Info->Name = ToolName;
00351 Info->Purpose = Purpose;
00352 Info->Author = Author;
00353
00354 Info->BubbleID = _R(IDBBL_BLEND_TOOLBOX);
00355 }
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373 void BlendTool::SelectChange(BOOL isSelected)
00374 {
00375 if (isSelected)
00376 {
00377 if (!CreateCursors()) return;
00378 CurrentCursorID = CursorStack::GPush(pcNormalCursor, FALSE);
00379 pcCurrentCursor = pcNormalCursor;
00380
00381
00382 pBlendInfoBarOp->Create();
00383 m_EditEndObject = FALSE;
00384
00385 BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00386 if (BlobMgr != NULL)
00387 {
00388
00389 BlobStyle MyBlobs;
00390
00391 MyBlobs.Object = TRUE;
00392 MyBlobs.Tiny = FALSE;
00393
00394 BlobMgr->ToolInterest(MyBlobs);
00395 }
00396
00397 Document* pDoc = Document::GetCurrent();
00398 if (pDoc != NULL)
00399 BlobMgr->RenderToolBlobsOn(this, pDoc->GetSelectedSpread(),NULL);
00400 }
00401 else
00402 {
00403
00404 if (pcCurrentCursor != NULL)
00405 {
00406 CursorStack::GPop(CurrentCursorID);
00407 pcCurrentCursor = NULL;
00408 CurrentCursorID = 0;
00409 }
00410 DestroyCursors();
00411
00412
00413 pBlendInfoBarOp->CloseProfileDialog (pBlendInfoBarOp->m_BiasGainGadgetPosition);
00414 pBlendInfoBarOp->CloseProfileDialog (pBlendInfoBarOp->m_BiasGainGadgetAttribute);
00415
00416
00417
00418
00419
00420 BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00421 if (BlobMgr != NULL)
00422 {
00423 BlobStyle bsRemoves;
00424 bsRemoves.ToolObject = TRUE;
00425 BlobMgr->RemoveInterest(bsRemoves);
00426 }
00427
00428
00429 pBlendInfoBarOp->Delete();
00430
00431 Document* pDoc = Document::GetCurrent();
00432 if (pDoc != NULL)
00433 BlobMgr->RenderToolBlobsOff(this, pDoc->GetSelectedSpread(),NULL);
00434 }
00435 }
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451 BOOL BlendTool::CreateCursors()
00452 {
00453
00454 pcNormalCursor = new Cursor(this, _R(IDC_BLENDNORMALCURSOR));
00455 pcBlendableCursor = new Cursor(this, _R(IDC_BLENDABLECURSOR));
00456 pcBlendableBlobCursor = new Cursor(this, _R(IDC_BLENDABLEBLOBCURSOR));
00457 pcBlendableRemapCursor = new Cursor(this, _R(IDC_BLENDABLEREMAPCURSOR));
00458
00459 if ( pcNormalCursor ==NULL || !pcNormalCursor->IsValid() ||
00460 pcBlendableCursor ==NULL || !pcBlendableCursor->IsValid() ||
00461 pcBlendableBlobCursor ==NULL || !pcBlendableBlobCursor->IsValid() ||
00462 pcBlendableRemapCursor ==NULL || !pcBlendableRemapCursor->IsValid()
00463 )
00464 {
00465 DestroyCursors();
00466 return FALSE;
00467 }
00468 else
00469 return TRUE;
00470 }
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486 void BlendTool::DestroyCursors()
00487 {
00488 if (pcNormalCursor != NULL) delete pcNormalCursor;
00489 if (pcBlendableCursor != NULL) delete pcBlendableCursor;
00490 if (pcBlendableBlobCursor != NULL) delete pcBlendableBlobCursor;
00491 if (pcBlendableRemapCursor != NULL) delete pcBlendableRemapCursor;
00492 }
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506 BOOL BlendTool::OnKeyPress(KeyPress* pKeyPress)
00507 {
00508 #if defined(_DEBUG) && 0
00509 if (pKeyPress == NULL)
00510 return FALSE;
00511
00512 if (pKeyPress->IsRepeat())
00513 return FALSE;
00514
00515 if (pKeyPress->IsRelease())
00516 return FALSE;
00517
00518 AFp BiasDelta = 0.0;
00519 AFp GainDelta = 0.0;
00520 BOOL Reset = FALSE;
00521 if (*pKeyPress == KeyPress(CAMKEY(Z))) { BiasDelta = -0.1; TRACEUSER( "Markn", _T("Decrease Bias by 0.1\n"));}
00522 if (*pKeyPress == KeyPress(CAMKEY(X))) { BiasDelta = 0.1; TRACEUSER( "Markn", _T("Increase Bias by 0.1\n"));}
00523 if (*pKeyPress == KeyPress(CAMKEY(N))) { GainDelta = -0.1; TRACEUSER( "Markn", _T("Decrease Gain by 0.1\n"));}
00524 if (*pKeyPress == KeyPress(CAMKEY(M))) { GainDelta = 0.1; TRACEUSER( "Markn", _T("Increase Gain by 0.1\n"));}
00525
00526 if (*pKeyPress == KeyPress(CAMKEY(R))) { Reset = TRUE; TRACEUSER( "Markn", _T("Resetting Bias and Gain\n"));}
00527
00528 SelRange* pSelRange = GetApplication()->FindSelection();
00529 Node* pNode = pSelRange->FindFirst();
00530 while (pNode)
00531 {
00532 if (IS_A(pNode,NodeBlend))
00533 {
00534 NodeBlend* pNodeBlend = (NodeBlend*)pNode;
00535
00536
00537 CProfileBiasGain* pProfile = pNodeBlend->GetAttrProfile();
00538 if (pProfile)
00539 {
00540 AFp Bias = pProfile->GetBias() + BiasDelta;
00541 AFp Gain = pProfile->GetGain() + GainDelta;
00542 if (Reset)
00543 Bias = Gain = 0.0;
00544
00545 if (Bias < -0.9) Bias = -0.9;
00546 if (Bias > 0.9) Bias = 0.9;
00547 if (Gain < -0.9) Gain = -0.9;
00548 if (Gain > 0.9) Gain = 0.9;
00549
00550 pProfile->SetBiasGain(Bias,Gain);
00551 }
00552 }
00553
00554 pNode = pSelRange->FindNext(pNode);
00555 }
00556 #endif // _DEBUG
00557
00558 return FALSE;
00559 }
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581 void BlendTool::OnClick( DocCoord PointerPos, ClickType Click, ClickModifiers ClickMods,
00582 Spread* pSpread )
00583 {
00584 if (ClickMods.Menu) return;
00585
00586 ERROR3IF_PF(pSpread==NULL,("pSpread is NULL"));
00587
00588 if (Click == CLICKTYPE_DRAG)
00589 {
00590
00591 BOOL MoveEndObject = EditBlendEnd(pSpread, PointerPos);
00592
00593
00594 if (!MoveEndObject)
00595 {
00596 UpdateRef(pRefStart,pSpread,PointerPos);
00597 UpdateRef(pRefEnd ,pSpread,PointerPos);
00598 CheckNodeRemapping(pRefStart,pRefEnd);
00599 UpdateCursorAndStatus();
00600
00601 if (pRefStart->pNode != NULL)
00602 {
00603
00604 OpBlendNodes* pOpBlendNodes = new OpBlendNodes;
00605 if (pOpBlendNodes != NULL)
00606 {
00607
00608 if (!pOpBlendNodes->DoDrag(this))
00609 delete pOpBlendNodes;
00610 }
00611 }
00612 }
00613 else
00614 {
00615 OpEditBlendEndObject* pEditEnd = new OpEditBlendEndObject(this);
00616
00617 if (pEditEnd != NULL)
00618 {
00619 StatusID = _R(IDS_BLENDSTATUS_MOVEEND);
00620 DisplayStatusBarHelp(StatusID);
00621 pEditEnd->DoDrag(PointerPos, pSpread);
00622 }
00623 }
00624 }
00625
00626
00627
00628 DragTool::OnClick (PointerPos, Click, ClickMods, pSpread);
00629 }
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645 void BlendTool::OnMouseMove(DocCoord PointerPos,Spread* pSpread,ClickModifiers ClickMods)
00646 {
00647 ERROR3IF_PF(pSpread==NULL,("pSpread is NULL"));
00648
00649 pRefEnd->Reset();
00650 UpdateRef(pRefStart,pSpread,PointerPos,FALSE);
00651
00652 m_EditEndObject = EditBlendEndAndUpdateCursor(pSpread, PointerPos);
00653
00654 if (m_EditEndObject == FALSE)
00655 UpdateCursorAndStatus();
00656 }
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675 BOOL BlendTool::EditBlendEndAndUpdateCursor(Spread* pSpread, DocCoord PointerPos)
00676 {
00677 Cursor* pcNewCursor = pcNormalCursor;
00678
00679 List BlendList;
00680
00681 BOOL ok = BevelTools::BuildListOfSelectedNodes(&BlendList, CC_RUNTIME_CLASS(NodeBlend), FALSE);
00682 if (ok)
00683 {
00684 ok = FALSE;
00685 NodeListItem* pListItem = (NodeListItem*)BlendList.GetHead();
00686 while (pListItem != NULL)
00687 {
00688
00689 NodeBlend* pNodeBlend = (NodeBlend*)pListItem->pNode;
00690 Node* pNode = NULL;
00691
00692 ok = pNodeBlend->HitOnEndDragBlob(PointerPos, &pNode);
00693 if (ok)
00694 {
00695 pcNewCursor = pcBlendableBlobCursor;
00696 StatusID = _R(IDS_BLENDSTATUS_EDITENDS);
00697 break;
00698 }
00699 pListItem = (NodeListItem*)BlendList.GetNext(pListItem);
00700 }
00701 }
00702 BlendList.DeleteAll();
00703
00704 if (pcCurrentCursor != pcNewCursor)
00705 {
00706
00707 CursorStack::GSetTop(pcNewCursor, CurrentCursorID);
00708 pcCurrentCursor = pcNewCursor;
00709 }
00710
00711 return ok;
00712 }
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731 BOOL BlendTool::EditBlendEnd(Spread* pSpread, DocCoord PointerPos)
00732 {
00733 List BlendList;
00734
00735 BOOL ok = BevelTools::BuildListOfSelectedNodes(&BlendList, CC_RUNTIME_CLASS(NodeBlend), FALSE);
00736 if (ok)
00737 {
00738 ok = FALSE;
00739 NodeListItem* pListItem = (NodeListItem*)BlendList.GetHead();
00740 while (pListItem != NULL)
00741 {
00742
00743 NodeBlend* pNodeBlend = (NodeBlend*)pListItem->pNode;
00744 Node* pNode = NULL;
00745
00746 ok = pNodeBlend->HitOnEndDragBlob(PointerPos, &pNode);
00747 if (ok)
00748 break;
00749 pListItem = (NodeListItem*)BlendList.GetNext(pListItem);
00750 }
00751 }
00752 BlendList.DeleteAll();
00753
00754 return ok;
00755 }
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780 void BlendTool::UpdateRef(BlendToolRef* pRef,Spread* pSpread, DocCoord PointerPos,BOOL CheckNodeUnderPoint)
00781 {
00782 ERROR3IF_PF(pRef ==NULL,("pRef is NULL"));
00783 ERROR3IF_PF(pSpread==NULL,("pSpread is NULL"));
00784
00785
00786 pRef->Reset();
00787
00788
00789
00790 if (!IsPointOverPathBlob(&PointerPos,pRef))
00791 {
00792
00793 pRef->Reset();
00794
00795
00796
00797 if (!IsPointOverBlendBlob(&PointerPos,pRef))
00798 {
00799
00800 pRef->Reset();
00801
00802 if (CheckNodeUnderPoint)
00803 {
00804
00805 NodeRenderableInk* pNodeUnderPoint = FindObject(pSpread,PointerPos);
00806
00807 if (pNodeUnderPoint != NULL)
00808 {
00809 BecomeA TestBecomeA(BECOMEA_TEST, CC_RUNTIME_CLASS(NodePath));
00810
00811 if (pNodeUnderPoint->CanBecomeA(&TestBecomeA))
00812 {
00813
00814 pRef->pNode = pNodeUnderPoint;
00815 }
00816 }
00817 }
00818 }
00819 }
00820
00821
00822 pRef->pSpread = pSpread;
00823 pRef->PointerPos = PointerPos;
00824 }
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849 void BlendTool::UpdateCursorAndStatus()
00850 {
00851 ERROR3IF_PF(pRefStart==NULL,("pRefStart is NULL"));
00852 ERROR3IF_PF(pRefEnd ==NULL,("pRefEnd is NULL"));
00853
00854
00855 Cursor* pcNewCursor = pcNormalCursor;
00856 StatusID = _R(IDS_BLENDSTATUS_FINDSTART);
00857
00858 if (pRefStart->RemapRef > 0)
00859 {
00860
00861 pcNewCursor = pcBlendableBlobCursor;
00862 StatusID = _R(IDS_BLENDSTATUS_REMAPSTART);
00863
00864 if (pRefStart->RemapRef == pRefEnd->RemapRef && pRefStart->AStartNode != pRefEnd->AStartNode)
00865 {
00866
00867 StatusID = _R(IDS_BLENDSTATUS_REMAPEND);
00868 pcNewCursor = pcBlendableRemapCursor;
00869 }
00870 }
00871 else if (pRefStart->pNode != NULL)
00872 {
00873 if (pRefEnd->pSpread == NULL)
00874 {
00875 if (pRefStart->Index >= 0)
00876 {
00877
00878 pcNewCursor = pcBlendableBlobCursor;
00879 StatusID = _R(IDS_BLENDSTATUS_OVERBLOB);
00880 }
00881 else
00882 {
00883
00884 pcNewCursor = pcBlendableCursor;
00885 StatusID = _R(IDS_BLENDSTATUS_FINDEND);
00886 }
00887 }
00888 else if (pRefStart->pSpread == pRefEnd->pSpread)
00889 {
00890
00891 if (pRefStart->pNode != pRefEnd->pNode && pRefEnd->pNode != NULL)
00892 {
00893 StatusID = _R(IDS_BLENDSTATUS_OVEREND);
00894
00895 if (pRefEnd->Index >= 0 && pRefStart->Index >= 0)
00896
00897
00898 pcNewCursor = pcBlendableRemapCursor;
00899 else
00900
00901 pcNewCursor = pcBlendableCursor;
00902 }
00903 else
00904 StatusID = _R(IDS_BLENDSTATUS_FINDEND);
00905 }
00906 }
00907
00908 if (pcCurrentCursor != pcNewCursor)
00909 {
00910
00911 CursorStack::GSetTop(pcNewCursor, CurrentCursorID);
00912 pcCurrentCursor = pcNewCursor;
00913 }
00914
00915
00916 DisplayStatusBarHelp(StatusID);
00917 }
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937 BOOL BlendTool::GetStatusLineText(String_256* pStr,Spread* pSpread,DocCoord DocPos,ClickModifiers ClickMods)
00938 {
00939 *pStr = String_256(StatusID);
00940 return TRUE;
00941 }
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958 void BlendTool::UpdateInfobar()
00959 {
00960 pBlendInfoBarOp->UpdateInfoBarState();
00961 }
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984 BOOL BlendTool::IsPointOverPathBlob(DocCoord* pPointerPos,BlendToolRef* pRef)
00985 {
00986 if (pRef == NULL) return FALSE;
00987
00988
00989 SelRange* pSelRange = GetApplication()->FindSelection();
00990 Node* pNode = pSelRange->FindFirst();
00991
00992 BOOL BlobFound = FALSE;
00993
00994
00995 while (!BlobFound && pNode != NULL && pNode->FindParent() != NULL)
00996 {
00997
00998 if (IS_A(pNode,NodePath) && IS_A(pNode->FindParent(),Layer))
00999 {
01000 NodePath* pNodePath = (NodePath*)pNode;
01001
01002 if (pNodePath->GetUnionBlobBoundingRect().ContainsCoord(*pPointerPos))
01003 {
01004
01005 Path* pPath = &(pNodePath->InkPath);
01006
01007
01008 BlobFound = pPath->FindNearestPoint(*pPointerPos,POINTFLAG_ENDPOINTS,&(pRef->Index));
01009
01010
01011 if (BlobFound)
01012 {
01013 pRef->pNode = pNodePath;
01014 pPath->SetPathPosition(pRef->Index);
01015 *pPointerPos = pPath->GetCoord();
01016 }
01017 }
01018 }
01019
01020
01021 pNode = pSelRange->FindNext(pNode);
01022 }
01023
01024 return BlobFound;
01025 }
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045 BOOL BlendTool::IsPointOverBlendBlob(DocCoord* pPointerPos,BlendToolRef* pRef)
01046 {
01047 if (pRef == NULL) return FALSE;
01048
01049
01050 SelRange* pSelRange = GetApplication()->FindSelection();
01051 Node* pNode = pSelRange->FindFirst();
01052
01053 BOOL BlobFound = FALSE;
01054
01055
01056 while (pNode != NULL && !BlobFound)
01057 {
01058 if (pNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeBlend))
01059 {
01060 NodeBlend* pNodeBlend = (NodeBlend*)pNode;
01061
01062 if (pNodeBlend->GetUnionBlobBoundingRect().ContainsCoord(*pPointerPos))
01063 {
01064 BlobFound = pNodeBlend->IsPointOverBlob(pPointerPos,
01065 &(pRef->pBlendPath),
01066 &(pRef->Index),
01067 &(pRef->AStartNode),
01068 &(pRef->RemapRef));
01069
01070 if (BlobFound)
01071 {
01072 pRef->pNode = pNodeBlend;
01073 pRef->pNodeBlend = pNodeBlend;
01074
01075 }
01076 }
01077 }
01078
01079
01080 pNode = pSelRange->FindNext(pNode);
01081 }
01082
01083 return BlobFound;
01084 }
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105 void BlendTool::CheckNodeRemapping(BlendToolRef* pRefStart, BlendToolRef* pRefEnd)
01106 {
01107 ERROR3IF(pRefStart == NULL,"pRefStart == NULL");
01108 ERROR3IF(pRefEnd == NULL,"pRefEnd == NULL");
01109 if (pRefStart == NULL || pRefEnd == NULL)
01110 return;
01111
01112 NodeBlend* pNodeBlend = pRefStart->pNodeBlend;
01113
01114 if (pNodeBlend == NULL || pNodeBlend != pRefEnd->pNodeBlend)
01115 return;
01116
01117 Node* pNode = pNodeBlend->FindFirstChild();
01118 while (pNode != NULL)
01119 {
01120 if (IS_A(pNode,NodeBlender))
01121 {
01122 NodeBlender* pNodeBlender = (NodeBlender*)pNode;
01123
01124 BOOL StartFound = pNodeBlender->IsPointOverBlob(&(pRefStart->PointerPos),
01125 &(pRefStart->pBlendPath),
01126 &(pRefStart->Index),
01127 &(pRefStart->AStartNode));
01128
01129 BOOL EndFound = pNodeBlender->IsPointOverBlob(&(pRefEnd ->PointerPos),
01130 &(pRefEnd ->pBlendPath),
01131 &(pRefEnd ->Index),
01132 &(pRefEnd ->AStartNode));
01133
01134 if (StartFound && EndFound && (pRefStart->AStartNode != pRefEnd->AStartNode))
01135 {
01136 pRefStart->RemapRef = pNodeBlender->GetTag();
01137 pRefEnd ->RemapRef = pNodeBlender->GetTag();
01138 return;
01139 }
01140 }
01141 pNode