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
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 #include "camtypes.h"
00140 #include "zordops.h"
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150 #include "layer.h"
00151
00152 #include "bubbleid.h"
00153
00154
00155
00156
00157 #include "sprdmsg.h"
00158 #include "layermsg.h"
00159
00160
00161 #include "slicehelper.h"
00162 #include "ophist.h"
00163
00164 DECLARE_SOURCE("$Revision: 1282 $");
00165
00166 CC_IMPLEMENT_DYNCREATE(OpBringToFront, SelOperation)
00167 CC_IMPLEMENT_DYNCREATE(OpPutToBack, SelOperation)
00168 CC_IMPLEMENT_DYNCREATE(OpMoveForwards, SelOperation)
00169 CC_IMPLEMENT_DYNCREATE(OpMoveBackwards, SelOperation)
00170 CC_IMPLEMENT_DYNCREATE(OpMoveToLyrInFront, SelOperation)
00171 CC_IMPLEMENT_DYNCREATE(OpMoveToLyrBehind, SelOperation)
00172 CC_IMPLEMENT_DYNAMIC(FrameInFrontOpDescriptor, OpDescriptor)
00173 CC_IMPLEMENT_DYNAMIC(FrameBehindOpDescriptor, OpDescriptor)
00174
00175
00176
00177 #define new CAM_DEBUG_NEW
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193 #ifdef WEBSTER
00194
00195
00196
00197
00198
00199
00200
00201 static Node* FindLastObject(Layer* pLayer)
00202 {
00203 if (pLayer == NULL)
00204 return NULL;
00205
00206 if (pLayer->IsLocked() || pLayer->IsGuide())
00207 return NULL;
00208
00209 return pLayer->FindLastChild(CC_RUNTIME_CLASS(NodeRenderableInk));
00210 }
00211
00212
00213
00214
00215
00216 static Node* FindFirstObject(Layer* pLayer)
00217 {
00218 if (pLayer == NULL)
00219 return NULL;
00220
00221 if (pLayer->IsLocked() || pLayer->IsGuide())
00222 return NULL;
00223
00224 return pLayer->FindFirstChild(CC_RUNTIME_CLASS(NodeRenderableInk));
00225 }
00226 #endif // WEBSTER
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247 OpBringToFront::OpBringToFront(): SelOperation()
00248 {
00249 }
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269 BOOL OpBringToFront::Init()
00270 {
00271 return (RegisterOpDescriptor(0,
00272 _R(IDS_BRINGTOFRONTOP),
00273 CC_RUNTIME_CLASS(OpBringToFront),
00274 OPTOKEN_BRINGTOFRONT,
00275 OpBringToFront::GetState,
00276 0,
00277 _R(IDBBL_BRINGTOFRONTOP),
00278 0,
00279 0,
00280 SYSTEMBAR_ILLEGAL,
00281 TRUE,
00282 FALSE,
00283 FALSE,
00284 0,
00285 (GREY_WHEN_NO_CURRENT_DOC | GREY_WHEN_NO_SELECTION)
00286
00287 ));
00288
00289 }
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308 OpState OpBringToFront::GetState(String_256* UIDescription, OpDescriptor*)
00309 {
00310 #ifdef WEBSTER
00311 OpState OpSt;
00312 String_256 DisableReason;
00313
00314
00315
00316 SelRange Sel(*( GetApplication()->FindSelection());
00317 RangeControl rg = Sel.GetRangeControlFlags();
00318 rg.PromoteToParent = TRUE;
00319 Sel.Range::SetRangeControl(rg);
00320
00321 Node* pSelNode = Sel.FindFirst();
00322 while (pSelNode != NULL)
00323 {
00324 Node* pNode = pSelNode;
00325 while (pNode != NULL)
00326 {
00327 Node* pOldNode = pNode;
00328
00329 if (pNode != NULL)
00330 pNode = pNode->FindNext();
00331
00332
00333 if (pNode != NULL && pNode->IsAnObject() && !pNode->IsSelected())
00334 goto End;
00335
00336 if (pNode == NULL)
00337 {
00338
00339 Layer* pLayer = (Layer*)pOldNode->FindParent(CC_RUNTIME_CLASS(Layer));
00340
00341
00342 do
00343 {
00344 pLayer = pLayer->FindNextLayer(TRUE);
00345 pNode = FindFirstObject(pLayer);
00346
00347 } while (pLayer != NULL && pNode == NULL);
00348
00349
00350 if (pNode != NULL && pNode->IsAnObject() && !pNode->IsSelected())
00351 goto End;
00352 }
00353 }
00354
00355
00356 pSelNode = Sel.FindNext(pSelNode);
00357 }
00358
00359 OpSt.Greyed = TRUE;
00360
00361
00362 if (Sel.Count() > 1)
00363 {
00364 DisableReason = String_256(_R(IDS_ALREADY_AT_FRONTP));
00365 }
00366 else
00367 {
00368 DisableReason = String_256(_R(IDS_ALREADY_AT_FRONTS));
00369 }
00370 *UIDescription = DisableReason;
00371
00372 End:
00373 return(OpSt);
00374
00375 #else
00376
00377
00378
00379 OpState OpSt;
00380 String_256 DisableReason;
00381
00382
00383 SelRange Sel (*(GetApplication()->FindSelection()));
00384 RangeControl rg = Sel.GetRangeControlFlags();
00385 rg.PromoteToParent = TRUE;
00386 Sel.Range::SetRangeControl(rg);
00387
00388
00389
00390 Node* Current = Sel.FindFirst();
00391 Node* LastCurrent;
00392 MODE PresentMode = FRAME;
00393
00394
00395 if(Current)
00396 {
00397 Layer* CurrentLayer = (Layer*) (Current->FindParent(CC_RUNTIME_CLASS(Layer)));
00398 ERROR2IF(CurrentLayer == NULL, OpSt, "Cannot find layer of first selected object");
00399
00400
00401 PresentMode = (MODE)CurrentLayer->IsFrame();
00402 }
00403
00404 BOOL bSelected = FALSE;
00405
00406 while(Current != NULL)
00407 {
00408
00409
00410 do
00411 {
00412
00413 if (Current->ShouldITransformWithChildren())
00414 {
00415
00416 RangeControl rg(TRUE, FALSE);
00417 Range rng(Current, Current, rg);
00418
00419 if (rng.IsEmpty())
00420 {
00421 bSelected = FALSE;
00422 }
00423 else
00424 {
00425 bSelected = TRUE;
00426 }
00427 }
00428 else
00429 {
00430 bSelected = Current->IsSelected();
00431 }
00432
00433 if ((Current->IsAnObject()) && (!(bSelected)))
00434 {
00435 goto End;
00436 }
00437 LastCurrent = Current;
00438 Current = Current->FindNext();
00439 } while (Current != NULL);
00440
00441 Current = Sel.FindNext(LastCurrent);
00442 }
00443
00444 OpSt.Greyed = TRUE;
00445
00446 if(PresentMode == FRAME)
00447 {
00448
00449 if (Sel.Count() > 1)
00450 {
00451 DisableReason = String_256(_R(IDS_ALREADY_AT_FRONTP_FRAME));
00452 }
00453 else
00454 {
00455 DisableReason = String_256(_R(IDS_ALREADY_AT_FRONTS_FRAME));
00456 }
00457 }
00458 else if (PresentMode == LAYER)
00459 {
00460
00461 if (Sel.Count() > 1)
00462 {
00463 DisableReason = String_256(_R(IDS_ALREADY_AT_FRONTP));
00464 }
00465 else
00466 {
00467 DisableReason = String_256(_R(IDS_ALREADY_AT_FRONTS));
00468 }
00469 }
00470 else
00471 ERROR3("OpBringToFront::GetState - Bad mode!");
00472
00473 *UIDescription = DisableReason;
00474 End:
00475 return(OpSt);
00476
00477 #endif // WEBSTER
00478 }
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498 void OpBringToFront::Do(OpDescriptor*)
00499 {
00500 #ifdef WEBSTER
00501 OpState OpSt;
00502 String_256 DisableReason;
00503
00504 SelRange Sel (*( GetApplication()->FindSelection());
00505 RangeControl rg = Sel.GetRangeControlFlags();
00506 rg.PromoteToParent = TRUE;
00507 Sel.Range::SetRangeControl(rg);
00508
00509 Node* pSelNode = Sel.FindLast();
00510
00511
00512 if (pSelNode != NULL)
00513 {
00514
00515
00516 if (!DoStartSelOp(FALSE,FALSE))
00517 goto EndOperation;
00518
00519
00520 if (!DoInvalidateNodesRegions(*Sel, TRUE))
00521 goto EndOperation;
00522 }
00523
00524 while (pSelNode != NULL)
00525 {
00526 Node* pContextNode = NULL;
00527
00528 Node* pNode = pSelNode;
00529 while (pNode != NULL)
00530 {
00531 Node* pOldNode = pNode;
00532
00533 if (pNode != NULL)
00534 pNode = pNode->FindNext();
00535
00536
00537 if (pNode != NULL && pNode->IsAnObject() && !pNode->IsSelected())
00538 pContextNode = pNode;
00539
00540 if (pNode == NULL)
00541 {
00542
00543 Layer* pLayer = (Layer*)pOldNode->FindParent(CC_RUNTIME_CLASS(Layer));
00544
00545
00546 do
00547 {
00548 pLayer = pLayer->FindNextLayer(TRUE);
00549 pNode = FindFirstObject(pLayer);
00550
00551 } while (pLayer != NULL && pNode == NULL);
00552
00553
00554 if (pNode != NULL && pNode->IsAnObject() && !pNode->IsSelected())
00555 pContextNode = pNode;
00556 }
00557 }
00558
00559 pNode = pSelNode;
00560
00561 pSelNode = Sel.FindPrev(pSelNode);
00562
00563 if (pContextNode != NULL)
00564 {
00565 if (!DoMoveNode(pNode, pContextNode, NEXT))
00566 goto EndOperation;
00567
00568 pNode->SetSelected(TRUE);
00569 }
00570 }
00571
00572 EndOperation:
00573 End();
00574
00575 #else
00576
00577
00578
00579
00580
00581
00582 Range Sel(*(GetApplication()->FindSelection()));
00583 RangeControl rg = Sel.GetRangeControlFlags();
00584 rg.PromoteToParent = TRUE;
00585 Sel.Range::SetRangeControl(rg);
00586
00587
00588
00589 Node* FirstSelectedNode = Sel.FindFirst();
00590
00591
00592
00593 ENSURE(FirstSelectedNode != NULL,
00594 "The OpBringToFront's GetState fn has not done a very good job");
00595
00596
00597 if (FirstSelectedNode != NULL)
00598 {
00599 if (!DoStartSelOp(FALSE,FALSE))
00600 {
00601 goto EndOperation;
00602 }
00603
00604
00605 if (!DoInvalidateNodesRegions(Sel, TRUE, FALSE, FALSE, FALSE))
00606 {
00607 goto EndOperation;
00608 }
00609
00610 Spread* pSpread;
00611 Node* Tail;
00612 Node* NextSelNode;
00613
00614
00615
00616
00617 Range LayerRange;
00618
00619
00620 pSpread = FirstSelectedNode->FindParentSpread();
00621
00622 Node* CurrentNode = FirstSelectedNode;
00623 Node* LastNodeOnLayer;
00624
00625
00626 while(CurrentNode != NULL)
00627 {
00628
00629
00630 Range temp(CurrentNode,
00631 NULL,
00632 RangeControl(TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE) );
00633 LayerRange = temp;
00634
00635
00636
00637
00638 FirstSelectedNode = CurrentNode;
00639
00640
00641 LastNodeOnLayer = CurrentNode->FindParent(CC_RUNTIME_CLASS(Layer))->FindLastChild();
00642 if (LastNodeOnLayer->IsAnObject())
00643 {
00644 Tail = LastNodeOnLayer;
00645 }
00646 else
00647 {
00648 Tail = LastNodeOnLayer->FindPrevious(CC_RUNTIME_CLASS(NodeRenderableInk));
00649 }
00650
00651
00652
00653
00654 if (FirstSelectedNode != Tail)
00655 {
00656 do
00657 {
00658 ENSURE (CurrentNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableBounded)),
00659 "Selected node not a NodeRenderableBounded");
00660
00661
00662 NextSelNode = LayerRange.FindNext(CurrentNode);
00663
00664 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
00665 if (!DoMoveNode(CurrentNode, Tail, NEXT))
00666 {
00667 goto EndOperation;
00668 }
00669
00670 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
00671 CurrentNode->SetSelected(TRUE);
00672
00673 Tail = CurrentNode;
00674 CurrentNode = NextSelNode;
00675
00676
00677
00678
00679 } while ((CurrentNode != FirstSelectedNode) && (CurrentNode != NULL));
00680
00681 }
00682
00683 CurrentNode = Sel.FindNext(Tail);
00684 ENSURE(LayerRange.FindNext(Tail) == NULL,
00685 "Current Node is not the last selected node on the layer");
00686 }
00687
00688 if (!DoInvalidateNodesRegions(*(GetApplication()->FindSelection()), TRUE, FALSE, FALSE, FALSE))
00689 {
00690 goto EndOperation;
00691 }
00692 }
00693
00694 EndOperation:
00695 GetApplication()->UpdateSelection();
00696
00697 End();
00698
00699 #endif // WEBSTER
00700 }
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721 OpPutToBack::OpPutToBack(): SelOperation()
00722 {
00723 }
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742 OpState OpPutToBack::GetState(String_256* UIDescription, OpDescriptor*)
00743 {
00744 #ifdef WEBSTER
00745
00746 OpState OpSt;
00747 String_256 DisableReason;
00748
00749 SelRange Sel(*( GetApplication()->FindSelection()));
00750
00751 Node* pSelNode = Sel.FindFirst();
00752 while (pSelNode != NULL)
00753 {
00754 Node* pNode = pSelNode;
00755 while (pNode != NULL)
00756 {
00757 Node* pOldNode = pNode;
00758
00759 if (pNode != NULL)
00760 pNode = pNode->FindPrevious();
00761
00762
00763 if (pNode != NULL && pNode->IsAnObject() && !pNode->IsSelected())
00764 goto End;
00765
00766 if (pNode == NULL)
00767 {
00768
00769 Layer* pLayer = (Layer*)pOldNode->FindParent(CC_RUNTIME_CLASS(Layer));
00770
00771
00772 do
00773 {
00774 pLayer = pLayer->FindPrevLayer(TRUE);
00775 pNode = FindLastObject(pLayer);
00776
00777 } while (pLayer != NULL && pNode == NULL);
00778
00779
00780 if (pNode != NULL && pNode->IsAnObject() && !pNode->IsSelected())
00781 goto End;
00782 }
00783 }
00784
00785
00786 pSelNode = Sel.FindNext(pSelNode);
00787 }
00788
00789 OpSt.Greyed = TRUE;
00790
00791
00792 if (Sel.Count() > 1)
00793 {
00794 DisableReason = String_256(_R(IDS_ALREADY_AT_BACKP));
00795 }
00796 else
00797 {
00798 DisableReason = String_256(_R(IDS_ALREADY_AT_BACKS));
00799 }
00800 *UIDescription = DisableReason;
00801
00802 End:
00803 return(OpSt);
00804
00805 #else
00806
00807
00808
00809
00810 OpState OpSt;
00811 String_256 DisableReason;
00812
00813
00814 Range Sel(*(GetApplication()->FindSelection()));
00815 RangeControl rg = Sel.GetRangeControlFlags();
00816 rg.PromoteToParent = TRUE;
00817 Sel.Range::SetRangeControl(rg);
00818
00819
00820 Node* FirstSelectedNode = Sel.FindFirst();
00821
00822
00823
00824 Node* Current = FirstSelectedNode;
00825 MODE PresentMode = LAYER;
00826
00827 Spread* pSpread = (Spread*) (Current->FindParent (CC_RUNTIME_CLASS (Spread)));
00828
00829
00830 if (Current && pSpread)
00831 {
00832 Layer* CurrentLayer = (Layer*) (Current->FindParent(CC_RUNTIME_CLASS(Layer)));
00833 ERROR2IF(CurrentLayer == NULL, OpSt, "Cannot find layer of first selected object");
00834
00835
00836 PresentMode = (MODE)CurrentLayer->IsFrame();
00837 }
00838
00839
00840
00841 BOOL allowed = FALSE;
00842
00843 Layer* pNode = (Layer*) SliceHelper::FindNextOfClass(pSpread, pSpread, CC_RUNTIME_CLASS (Layer));
00844
00845
00846
00847
00848 while (pNode)
00849 {
00850 Node* lastSelected = NULL;
00851 BOOL currentLayerAllow = FALSE;
00852
00853
00854 if (Current->FindParent (CC_RUNTIME_CLASS (Layer)) == Sel.FindLast ()->FindParent (CC_RUNTIME_CLASS (Layer)))
00855 {
00856 lastSelected = Sel.FindLast ();
00857 }
00858 else
00859 {
00860
00861
00862 Node* Scan = pNode->FindLastChild ();
00863
00864 while (Scan != NULL)
00865 {
00866 if (Scan->IsAnObject() && Scan->IsSelected())
00867 {
00868 lastSelected = Scan;
00869 break;
00870
00871 }
00872 Scan = Scan->FindPrevious();
00873 }
00874 }
00875
00876
00877
00878
00879
00880 Node* Current = lastSelected;
00881
00882 if (Current)
00883 {
00884 do
00885 {
00886
00887 BOOL bSelected = FALSE;
00888 if (Current->ShouldITransformWithChildren())
00889 {
00890
00891 RangeControl rg(TRUE, FALSE);
00892 Range rng(Current, Current, rg);
00893
00894 if (rng.IsEmpty())
00895 {
00896 bSelected = FALSE;
00897 }
00898 else
00899 {
00900 bSelected = TRUE;
00901 }
00902 }
00903 else
00904 {
00905 bSelected = Current->IsSelected();
00906 }
00907
00908 if ((Current->IsAnObject()) && (!(bSelected)))
00909 {
00910 currentLayerAllow = TRUE;
00911 allowed = TRUE;
00912 }
00913
00914 Current = Current->FindPrevious();
00915 } while (Current != NULL);
00916 }
00917 else
00918 {
00919 currentLayerAllow = TRUE;
00920 }
00921
00922
00923
00924 if (allowed && !currentLayerAllow)
00925 {
00926 goto Disable;
00927 }
00928
00929 pNode = (Layer*) SliceHelper::FindNextOfClass(pNode, pSpread, CC_RUNTIME_CLASS (Layer));
00930 }
00931
00932 if (allowed)
00933 {
00934 goto End;
00935 }
00936
00937 Disable:
00938
00939 OpSt.Greyed = TRUE;
00940
00941 if(PresentMode == LAYER)
00942 {
00943
00944 if (Sel.Count() > 1)
00945 {
00946 DisableReason = String_256(_R(IDS_ALREADY_AT_BACKP));
00947 }
00948 else
00949 {
00950 DisableReason = String_256(_R(IDS_ALREADY_AT_BACKS));
00951 }
00952 }
00953 else if(PresentMode == FRAME)
00954 {
00955
00956 if (Sel.Count() > 1)
00957 {
00958 DisableReason = String_256(_R(IDS_ALREADY_AT_BACKP_FRAME));
00959 }
00960 else
00961 {
00962 DisableReason = String_256(_R(IDS_ALREADY_AT_BACKS_FRAME));
00963 }
00964 }
00965 else
00966 ERROR3("OpBringToFront::GetState - Bad mode!");
00967
00968 *UIDescription = DisableReason;
00969
00970 End:
00971 return(OpSt);
00972
00973 #endif // WEBSTER
00974 }
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994 BOOL OpPutToBack::Init()
00995 {
00996 return (RegisterOpDescriptor(0,
00997 _R(IDS_PUTTOBACKOP),
00998 CC_RUNTIME_CLASS(OpPutToBack),
00999 OPTOKEN_PUTTOBACK,
01000 OpPutToBack::GetState,
01001 0,
01002 _R(IDBBL_PUTTOBACKOP),
01003 0,
01004 0,
01005 SYSTEMBAR_ILLEGAL,
01006 TRUE,
01007 FALSE,
01008 FALSE,
01009 0,
01010 (GREY_WHEN_NO_CURRENT_DOC | GREY_WHEN_NO_SELECTION)
01011
01012 ));
01013 }
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034 void OpPutToBack::Do(OpDescriptor*)
01035 {
01036 #ifdef WEBSTER
01037
01038 SelRange* Sel = GetApplication()->FindSelection();
01039
01040 Node* pSelNode = Sel->FindFirst();
01041
01042
01043 if (pSelNode != NULL)
01044 {
01045
01046
01047 if (!DoStartSelOp(FALSE,FALSE))
01048 goto EndOperation;
01049
01050
01051 if (!DoInvalidateNodesRegions(*Sel, TRUE))
01052 goto EndOperation;
01053 }
01054
01055 while (pSelNode != NULL)
01056 {
01057 Node* pContextNode = NULL;
01058
01059 Node* pNode = pSelNode;
01060 while (pNode != NULL)
01061 {
01062 Node* pOldNode = pNode;
01063
01064 if (pNode != NULL)
01065 pNode = pNode->FindPrevious();
01066
01067
01068 if (pNode != NULL && pNode->IsAnObject() && !pNode->IsSelected())
01069 pContextNode = pNode;
01070
01071 if (pNode == NULL)
01072 {
01073
01074 Layer* pLayer = (Layer*)pOldNode->FindParent(CC_RUNTIME_CLASS(Layer));
01075
01076
01077 do
01078 {
01079 pLayer = pLayer->FindPrevLayer(TRUE);
01080 pNode = FindLastObject(pLayer);
01081
01082 } while (pLayer != NULL && pNode == NULL);
01083
01084
01085 if (pNode != NULL && pNode->IsAnObject() && !pNode->IsSelected())
01086 pContextNode = pNode;
01087 }
01088 }
01089
01090 pNode = pSelNode;
01091
01092 pSelNode = Sel->FindNext(pSelNode);
01093
01094 if (pContextNode != NULL)
01095 {
01096 if (!DoMoveNode(pNode, pContextNode, PREV))
01097 goto EndOperation;
01098
01099 pNode->SetSelected(TRUE);
01100 }
01101 }
01102
01103 EndOperation:
01104 End();
01105
01106 #else
01107
01108
01109
01110
01111
01112 Range Sel(*(GetApplication()->FindSelection()));
01113 RangeControl rg = Sel.GetRangeControlFlags();
01114 rg.PromoteToParent = TRUE;
01115 Sel.Range::SetRangeControl(rg);
01116
01117
01118 Node* FirstSelectedNode = Sel.FindFirst();
01119
01120
01121 ENSURE(FirstSelectedNode != NULL,
01122 "The OpPutToBack's GetState fn has not done a very good job");
01123
01124 if (FirstSelectedNode != NULL)
01125 {
01126 if (!DoStartSelOp(FALSE,FALSE))
01127
01128
01129 {
01130 goto EndOperation;
01131 }
01132
01133
01134 if (!DoInvalidateNodesRegions(Sel, TRUE, FALSE, FALSE, FALSE))
01135 {
01136 goto EndOperation;
01137 }
01138
01139
01140
01141
01142
01143 Range LayerRange;
01144
01145 Node* FirstSelectedNextLayer;
01146
01147
01148 while (FirstSelectedNode != NULL)
01149 {
01150 Range temp(FirstSelectedNode,
01151 NULL,
01152 RangeControl(TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE) );
01153 LayerRange = temp;
01154
01155
01156
01157
01158
01159 Node* LastSelectedNode=NULL;
01160 Node* Scout = FirstSelectedNode;
01161
01162
01163 while (Scout != NULL)
01164 {
01165 LastSelectedNode = Scout;
01166 Scout = LayerRange.FindNext(Scout);
01167 }
01168
01169 Node* CurrentNode = LastSelectedNode;
01170
01171
01172 FirstSelectedNextLayer = Sel.FindNext(CurrentNode);
01173
01174
01175 Node* Head = FirstSelectedNode->FindParent()->FindFirstChild(CC_RUNTIME_CLASS(NodeRenderableInk));
01176
01177
01178
01179
01180 if (LastSelectedNode != Head)
01181 {
01182 Node* PrevSelNode;
01183 do
01184 {
01185 ENSURE (CurrentNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableBounded)),
01186 "Selected node not a NodeRenderableBounded");
01187
01188
01189
01190
01191
01192
01193
01194 PrevSelNode = LayerRange.FindPrev (CurrentNode, FALSE);
01195
01196 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01197 if (!DoMoveNode(CurrentNode, Head, PREV))
01198 {
01199 goto EndOperation;
01200 }
01201
01202
01203
01204
01205
01206 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01207 CurrentNode->SetSelected(TRUE);
01208
01209 Head = CurrentNode;
01210 CurrentNode = PrevSelNode;
01211
01212
01213
01214
01215 } while ((CurrentNode != LastSelectedNode) && (CurrentNode != NULL));
01216
01217
01218 if (!DoInvalidateNodesRegions(*(GetApplication()->FindSelection()), TRUE, FALSE, FALSE, FALSE))
01219 {
01220 goto EndOperation;
01221 }
01222 }
01223
01224
01225
01226
01227
01228
01229 FirstSelectedNode = FirstSelectedNextLayer;
01230 }
01231 }
01232 EndOperation:
01233 GetApplication()->UpdateSelection();
01234
01235 End();
01236
01237 #endif // WEBSTER
01238 }
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259 OpMoveForwards::OpMoveForwards(): SelOperation()
01260 {
01261 }
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281 BOOL OpMoveForwards::Init()
01282 {
01283 return(RegisterOpDescriptor(
01284 0,
01285 _R(IDS_MOVEFORWARDSOP),
01286 CC_RUNTIME_CLASS(OpMoveForwards),
01287 OPTOKEN_MOVEFORWARDS,
01288 OpBringToFront::GetState,
01289
01290 0,
01291 _R(IDBBL_MOVEFORWARDSOP),
01292 0,
01293 0,
01294 SYSTEMBAR_ILLEGAL,
01295 TRUE,
01296 FALSE,
01297 FALSE,
01298 0,
01299 (GREY_WHEN_NO_CURRENT_DOC | GREY_WHEN_NO_SELECTION)
01300
01301 ));
01302
01303 }
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322 void OpMoveForwards::Do(OpDescriptor*)
01323 {
01324 #ifdef WEBSTER
01325
01326 OpState OpSt;
01327 String_256 DisableReason;
01328
01329 SelRange* Sel = GetApplication()->FindSelection();
01330
01331 Node* pSelNode = Sel->FindLast();
01332
01333
01334 if (pSelNode != NULL)
01335 {
01336
01337
01338 if (!DoStartSelOp(FALSE,FALSE))
01339 goto EndOperation;
01340
01341
01342 if (!DoInvalidateNodesRegions(*Sel, TRUE))
01343 goto EndOperation;
01344 }
01345
01346 while (pSelNode != NULL)
01347 {
01348 Node* pContextNode = NULL;
01349 BOOL SelNodeFound = FALSE;
01350
01351 Node* pNode = pSelNode;
01352 while (pNode != NULL && pContextNode == NULL && !SelNodeFound)
01353 {
01354 Node* pOldNode = pNode;
01355
01356 if (pNode != NULL)
01357 pNode = pNode->FindNext();
01358
01359
01360 if (pNode != NULL && pNode->IsAnObject() && !pNode->IsSelected())
01361 pContextNode = pNode;
01362
01363 SelNodeFound = (pNode != NULL && pNode->IsAnObject() && pNode->IsSelected());
01364
01365 if (pNode == NULL)
01366 {
01367
01368 Layer* pLayer = (Layer*)pOldNode->FindParent(CC_RUNTIME_CLASS(Layer));
01369
01370
01371 do
01372 {
01373 pLayer = pLayer->FindNextLayer(TRUE);
01374 pNode = FindFirstObject(pLayer);
01375
01376 } while (pLayer != NULL && pNode == NULL);
01377
01378
01379 if (pNode != NULL && pNode->IsAnObject() && !pNode->IsSelected())
01380 pContextNode = pNode;
01381 }
01382 }
01383
01384 pNode = pSelNode;
01385
01386 pSelNode = Sel->FindPrev(pSelNode);
01387
01388 if (pContextNode != NULL && !SelNodeFound)
01389 {
01390 if (!DoMoveNode(pNode, pContextNode, NEXT))
01391 goto EndOperation;
01392
01393 pNode->SetSelected(TRUE);
01394 }
01395 }
01396
01397 EndOperation:
01398 End();
01399
01400 #else
01401
01402
01403
01404
01405
01406 Range Sel(*(GetApplication()->FindSelection()));
01407 RangeControl rg = Sel.GetRangeControlFlags();
01408 rg.PromoteToParent = TRUE;
01409 Sel.Range::SetRangeControl(rg);
01410
01411
01412
01413 Node* FirstSelectedNode = Sel.FindFirst();
01414
01415
01416 ENSURE(FirstSelectedNode != NULL,
01417 "The OpPutToBack's GetState fn has not done a very good job");
01418
01419
01420 ENSURE (FirstSelectedNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableBounded)),
01421 "Selected node not a NodeRenderableBounded");
01422
01423
01424 if (FirstSelectedNode != NULL)
01425 {
01426 if (!DoStartSelOp(FALSE,FALSE))
01427
01428
01429 {
01430 goto EndOperation;
01431 }
01432
01433
01434 if (!DoInvalidateNodesRegions(Sel, TRUE, FALSE, FALSE, FALSE))
01435 {
01436 goto EndOperation;
01437 }
01438
01439
01440
01441
01442
01443 Range LayerRange;
01444
01445 Node* NextLayerFirstSelectedNode;
01446
01447
01448
01449
01450 while (FirstSelectedNode != NULL)
01451 {
01452
01453 Range temp(FirstSelectedNode,
01454 NULL,
01455 RangeControl(TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE) );
01456 LayerRange = temp;
01457
01458
01459
01460
01461
01462 Node* TempSelNode = FirstSelectedNode;
01463 Node* LastSelectedNode = NULL;
01464 while (TempSelNode != NULL)
01465 {
01466 LastSelectedNode = TempSelNode;
01467
01468 TempSelNode = LayerRange.FindNext(TempSelNode);
01469 }
01470
01471
01472
01473 NextLayerFirstSelectedNode = Sel.FindNext(LastSelectedNode);
01474
01475
01476
01477 Node* CurrentNode = LastSelectedNode;
01478
01479 Node* PrevSelNode = NULL;
01480
01481
01482
01483 Node* NextSelNode;
01484
01485 Node* SrchNode;
01486
01487 BOOL Intersects;
01488
01489 BOOL PassedPrevSel;
01490
01491
01492
01493 while (CurrentNode != NULL)
01494 {
01495
01496 ENSURE (CurrentNode->IsAnObject(),
01497 "Selected node not a NodeRenderableInk");
01498
01499
01500
01501
01502 NextSelNode = LayerRange.FindPrev (CurrentNode, FALSE);
01503
01504
01505
01506
01507
01508
01509
01510 Intersects = FALSE;
01511 PassedPrevSel = FALSE;
01512
01513 SrchNode = CurrentNode->FindNext();
01514 DocRect CurrentBounds = ((NodeRenderableBounded*)CurrentNode)->GetBoundingRect();
01515 while (SrchNode != NULL)
01516 {
01517 if (SrchNode->IsAnObject())
01518 {
01519 if (SrchNode == PrevSelNode)
01520 {
01521 PassedPrevSel = TRUE;
01522
01523 }
01524 if (((NodeRenderableBounded*)SrchNode)->GetBoundingRect().IsIntersectedWith
01525 (CurrentBounds))
01526 {
01527 Intersects = TRUE;
01528 break;
01529 }
01530 }
01531 SrchNode = SrchNode->FindNext();
01532 }
01533
01534
01535
01536
01537
01538
01539 if (Intersects)
01540 {
01541 if (PassedPrevSel)
01542
01543
01544 {
01545 if (PrevSelNode->FindPrevious(CC_RUNTIME_CLASS(NodeRenderableInk)) != CurrentNode)
01546 {
01547
01548 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01549 if (!DoMoveNode(CurrentNode, PrevSelNode, PREV))
01550 goto EndOperation;
01551
01552 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01553 CurrentNode->SetSelected(TRUE);
01554 }
01555
01556
01557 }
01558 else
01559 {
01560
01561 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01562 if (!DoMoveNode(CurrentNode, SrchNode, NEXT))
01563 goto EndOperation;
01564
01565 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01566 CurrentNode->SetSelected(TRUE);
01567 }
01568 }
01569 else
01570 {
01571
01572
01573
01574
01575 Node* NextObjAfterCurrent = CurrentNode->FindNext(CC_RUNTIME_CLASS(NodeRenderableInk));
01576
01577 if (NextObjAfterCurrent != PrevSelNode)
01578 {
01579 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01580 if (!DoMoveNode(CurrentNode,NextObjAfterCurrent, NEXT))
01581 goto EndOperation;
01582
01583 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01584 CurrentNode->SetSelected(TRUE);
01585 }
01586
01587
01588
01589 }
01590
01591 PrevSelNode = CurrentNode;
01592 CurrentNode = NextSelNode;
01593
01594 }
01595
01596 FirstSelectedNode = NextLayerFirstSelectedNode;
01597 }
01598
01599 if (!DoInvalidateNodesRegions(*(GetApplication()->FindSelection()), TRUE, FALSE, FALSE, FALSE))
01600 {
01601 goto EndOperation;
01602 }
01603 }
01604 EndOperation:
01605 GetApplication()->UpdateSelection();
01606
01607 End();
01608
01609 #endif // WEBSTER
01610 }
01611
01612
01613
01614
01615
01616
01617
01618
01619
01620
01621
01622
01623
01624
01625
01626
01627
01628
01629
01630 OpMoveBackwards::OpMoveBackwards(): SelOperation()
01631 {
01632 }
01633
01634
01635
01636
01637
01638
01639
01640
01641
01642
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652 BOOL OpMoveBackwards::Init()
01653 {
01654 return (RegisterOpDescriptor(0,
01655 _R(IDS_MOVEBACKWARDSOP),
01656 CC_RUNTIME_CLASS(OpMoveBackwards),
01657 OPTOKEN_MOVEBACKWARDS,
01658 OpPutToBack::GetState,
01659 0,
01660 _R(IDBBL_MOVEBACKWARDSOP),
01661 0,
01662 0,
01663 SYSTEMBAR_ILLEGAL,
01664 TRUE,
01665 FALSE,
01666 FALSE,
01667 0,
01668 (GREY_WHEN_NO_CURRENT_DOC | GREY_WHEN_NO_SELECTION)
01669
01670 ));
01671 }
01672
01673
01674
01675
01676
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686
01687
01688
01689
01690
01691 void OpMoveBackwards::Do(OpDescriptor*)
01692 {
01693 #ifdef WEBSTER
01694
01695 SelRange* Sel = GetApplication()->FindSelection();
01696
01697 Node* pSelNode = Sel->FindFirst();
01698
01699
01700 if (pSelNode != NULL)
01701 {
01702
01703
01704 if (!DoStartSelOp(FALSE,FALSE))
01705 goto EndOperation;
01706
01707
01708 if (!DoInvalidateNodesRegions(*Sel, TRUE))
01709 goto EndOperation;
01710 }
01711
01712 while (pSelNode != NULL)
01713 {
01714 Node* pContextNode = NULL;
01715 BOOL SelNodeFound = FALSE;
01716
01717 Node* pNode = pSelNode;
01718 while (pNode != NULL && pContextNode == NULL && !SelNodeFound)
01719 {
01720 Node* pOldNode = pNode;
01721
01722 if (pNode != NULL)
01723 pNode = pNode->FindPrevious();
01724
01725
01726 if (pNode != NULL && pNode->IsAnObject() && !pNode->IsSelected())
01727 pContextNode = pNode;
01728
01729 SelNodeFound = (pNode != NULL && pNode->IsAnObject() && pNode->IsSelected());
01730
01731 if (pNode == NULL)
01732 {
01733
01734 Layer* pLayer = (Layer*)pOldNode->FindParent(CC_RUNTIME_CLASS(Layer));
01735
01736
01737 do
01738 {
01739 pLayer = pLayer->FindPrevLayer(TRUE);
01740 pNode = FindLastObject(pLayer);
01741
01742 } while (pLayer != NULL && pNode == NULL);
01743
01744
01745 if (pNode != NULL && pNode->IsAnObject() && !pNode->IsSelected())
01746 pContextNode = pNode;
01747 }
01748 }
01749
01750 pNode = pSelNode;
01751
01752 pSelNode = Sel->FindNext(pSelNode);
01753
01754 if (pContextNode != NULL && !SelNodeFound)
01755 {
01756 if (!DoMoveNode(pNode, pContextNode, PREV))
01757 goto EndOperation;
01758
01759 pNode->SetSelected(TRUE);
01760 }
01761 }
01762
01763 EndOperation:
01764 End();
01765
01766 #else
01767
01768
01769
01770
01771
01772 Range Sel(*(GetApplication()->FindSelection()));
01773
01774
01775 RangeControl rg = Sel.GetRangeControlFlags();
01776 rg.PromoteToParent = TRUE;
01777 Sel.Range::SetRangeControl(rg);
01778
01779
01780 Node* FirstSelectedNode = Sel.FindFirst();
01781
01782
01783 ENSURE(FirstSelectedNode != NULL,
01784 "The OpPutToBack's GetState fn has not done a very good job");
01785
01786
01787 ENSURE (FirstSelectedNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableBounded)),
01788 "Selected node not a NodeRenderableBounded");
01789
01790
01791 if (FirstSelectedNode != NULL)
01792 {
01793 if (!DoStartSelOp(FALSE,FALSE))
01794
01795
01796 {
01797 goto EndOperation;
01798 }
01799
01800
01801 if (!DoInvalidateNodesRegions(Sel, TRUE, FALSE, FALSE, FALSE))
01802 {
01803 goto EndOperation;
01804 }
01805
01806 Node* CurrentNode;
01807 CurrentNode = FirstSelectedNode;
01808
01809
01810
01811
01812
01813
01814 Range LayerRange;
01815
01816 Node* PrevSelNode;
01817
01818 Node* NextSelNode;
01819
01820 Node* SrchNode;
01821
01822 BOOL Intersects;
01823
01824 BOOL PassedPrevSel;
01825
01826 Node* LastSelectedOnLayer=NULL;
01827
01828
01829 while (CurrentNode != NULL)
01830 {
01831
01832
01833 Range temp(CurrentNode,
01834 NULL,
01835 RangeControl(TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE) );
01836 LayerRange = temp;
01837
01838
01839
01840
01841
01842 PrevSelNode = NULL;
01843
01844
01845
01846
01847 while (CurrentNode != NULL)
01848 {
01849
01850 ENSURE (CurrentNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableBounded)),
01851 "Selected node not a NodeRenderableBounded");
01852
01853
01854
01855
01856 NextSelNode = LayerRange.FindNext(CurrentNode);
01857
01858
01859
01860
01861
01862
01863
01864 Intersects = FALSE;
01865 PassedPrevSel = FALSE;
01866
01867 DocRect CurrentsBounds = ((NodeRenderableBounded*)CurrentNode)->GetBoundingRect();
01868
01869 SrchNode = CurrentNode->FindPrevious();
01870 while (SrchNode != NULL)
01871 {
01872 if (SrchNode->IsAnObject())
01873 {
01874 if (SrchNode == PrevSelNode)
01875 {
01876 PassedPrevSel = TRUE;
01877
01878 }
01879 if (((NodeRenderableBounded*)SrchNode)->GetBoundingRect().IsIntersectedWith
01880 (CurrentsBounds))
01881 {
01882 Intersects = TRUE;
01883 break;
01884 }
01885 }
01886 SrchNode = SrchNode->FindPrevious();
01887 }
01888
01889
01890
01891
01892
01893
01894
01895 Node* ObjPrevCurrent = CurrentNode->FindPrevious(CC_RUNTIME_CLASS(NodeRenderableInk));
01896 if (Intersects)
01897 {
01898 if (PassedPrevSel)
01899
01900
01901 {
01902 if (PrevSelNode != ObjPrevCurrent)
01903 {
01904
01905 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01906 if (!DoMoveNode((NodeRenderableBounded*)CurrentNode, PrevSelNode, NEXT))
01907 goto EndOperation;
01908
01909 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01910 CurrentNode->SetSelected(TRUE);
01911 }
01912
01913
01914 }
01915 else
01916 {
01917
01918 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01919 if (!DoMoveNode((NodeRenderableBounded*)CurrentNode, SrchNode, PREV))
01920 goto EndOperation;
01921
01922 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01923 CurrentNode->SetSelected(TRUE);
01924
01925 }
01926 }
01927 else
01928 {
01929
01930
01931
01932
01933 if (PrevSelNode != ObjPrevCurrent)
01934 {
01935 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01936 if (!DoMoveNode((NodeRenderableBounded*)CurrentNode, ObjPrevCurrent, PREV))
01937 goto EndOperation;
01938
01939 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
01940 CurrentNode->SetSelected(TRUE);
01941 }
01942
01943
01944
01945 }
01946 PrevSelNode = CurrentNode;
01947 LastSelectedOnLayer = CurrentNode;
01948 CurrentNode = NextSelNode;
01949 }
01950
01951
01952 ENSURE(LayerRange.FindNext(LastSelectedOnLayer) == NULL,
01953 "Current should be the last selected node on the layer");
01954
01955 CurrentNode = Sel.FindNext(LastSelectedOnLayer);
01956 }
01957
01958
01959 if (!DoInvalidateNodesRegions(*(GetApplication()->FindSelection()), TRUE, FALSE, FALSE, FALSE))
01960 {
01961 goto EndOperation;
01962 }
01963
01964 }
01965 EndOperation:
01966 GetApplication()->UpdateSelection();
01967
01968 End();
01969
01970 #endif // WEBSTER
01971 }
01972
01973
01974
01975
01976
01977
01978
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992
01993
01994 OpMoveToLyrInFront::OpMoveToLyrInFront(): SelOperation()
01995 {
01996 }
01997
01998
01999
02000
02001
02002
02003
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014
02015
02016 BOOL OpMoveToLyrInFront::Init()
02017 {
02018
02019
02020
02021
02022
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039 FrameInFrontOpDescriptor* pOpDesc = new FrameInFrontOpDescriptor(OPTOKEN_MOVELAYERINFRONT,
02040 CC_RUNTIME_CLASS(OpMoveToLyrInFront),
02041 OpMoveToLyrInFront::GetState);
02042 if(pOpDesc)
02043 return TRUE;
02044
02045 return FALSE;
02046 }
02047
02048
02049
02050
02051
02052
02053
02054
02055
02056
02057
02058
02059
02060
02061
02062
02063 OpState OpMoveToLyrInFront::GetState(String_256* UIDescription, OpDescriptor*)
02064 {
02065 OpState OpSt;
02066
02067 String_256 DisableReason;
02068
02069 SelRange Sel(*( GetApplication()->FindSelection()));
02070 RangeControl rg = Sel.GetRangeControlFlags();
02071 rg.PromoteToParent = TRUE;
02072 Sel.Range::SetRangeControl(rg);
02073
02074
02075 Node* pNode = Sel.FindFirst();
02076
02077 while (pNode != NULL)
02078 {
02079 Node* pLayer = pNode->FindParent(CC_RUNTIME_CLASS(Layer));
02080 if (pLayer != NULL && ((Layer*)pLayer)->IsGuide())
02081 {
02082 *UIDescription = String_256(_R(IDS_CANT_MOVE_OFF_GUIDE_LAYER));
02083 OpSt.Greyed = TRUE;
02084 return OpSt;
02085 }
02086
02087 pNode = Sel.FindNext(pNode);
02088 }
02089
02090
02091 Node* FirstSelectedNode = Sel.FindFirst();
02092
02093
02094
02095 BOOL HighestVisible = TRUE;
02096 Layer* CurrentLayer = (Layer*) (FirstSelectedNode->FindParent(CC_RUNTIME_CLASS(Layer)));
02097 ERROR2IF(CurrentLayer == NULL, OpSt, "Cannot find layer of first selected object");
02098
02099
02100
02101
02102
02103 #ifdef WEBSTER
02104
02105 do
02106 {
02107 CurrentLayer = CurrentLayer->FindNextFrameLayer();
02108 if (CurrentLayer != NULL)
02109 {
02110
02111 if (!CurrentLayer->IsGuide() && !CurrentLayer->IsPageBackground())
02112 {
02113 HighestVisible = FALSE;
02114
02115 break;
02116 }
02117 }
02118 } while (CurrentLayer != NULL);
02119
02120 #else
02121
02122 MODE PresentMode = (MODE)CurrentLayer->IsFrame();
02123
02124 if (PresentMode == FRAME)
02125 {
02126 do
02127 {
02128 CurrentLayer = CurrentLayer->FindNextFrameLayer();
02129 if (CurrentLayer != NULL)
02130 {
02131
02132 if (!CurrentLayer->IsGuide() && !CurrentLayer->IsPageBackground())
02133 {
02134 HighestVisible = FALSE;
02135
02136 break;
02137 }
02138 }
02139 } while (CurrentLayer != NULL);
02140 }
02141 else if (PresentMode == LAYER)
02142 {
02143 do
02144 {
02145 CurrentLayer = CurrentLayer->FindNextLayer();
02146 if (CurrentLayer != NULL)
02147 {
02148
02149 if (CurrentLayer->IsVisible() && !CurrentLayer->IsLocked() && !CurrentLayer->IsGuide())
02150 {
02151 HighestVisible = FALSE;
02152
02153 break;
02154 }
02155 }
02156 } while (CurrentLayer != NULL);
02157 }
02158 else
02159 ERROR3("OpMoveToLyrInFront::GetState - Bad mode!");
02160
02161 #endif // WEBSTER
02162
02163 if (HighestVisible)
02164 {
02165
02166 OpSt.Greyed = TRUE;
02167
02168 #ifdef WEBSTER
02169
02170 if (Sel.FindNext(FirstSelectedNode) == NULL)
02171 {
02172
02173 DisableReason = String_256(_R(IDS_ALREADY_ON_TOP_FRMS));
02174 }
02175 else
02176 {
02177
02178 DisableReason = String_256(_R(IDS_ALREADY_ON_TOP_FRM));
02179 }
02180 #else
02181 if(PresentMode == LAYER)
02182 {
02183 if (Sel.FindNext(FirstSelectedNode) == NULL)
02184 {
02185
02186 DisableReason = String_256(_R(IDS_ALREADY_ON_TOP_LYRS));
02187 }
02188 else
02189 {
02190
02191 DisableReason = String_256(_R(IDS_ALREADY_ON_TOP_LYRP));
02192 }
02193 }
02194 else if(PresentMode == FRAME)
02195 {
02196 if (Sel.FindNext(FirstSelectedNode) == NULL)
02197 {
02198
02199 DisableReason = String_256(_R(IDS_ALREADY_ON_TOP_FRMS));
02200 }
02201 else
02202 {
02203
02204 DisableReason = String_256(_R(IDS_ALREADY_ON_TOP_FRM));
02205 }
02206 }
02207 else
02208 ERROR3("OpMoveToLyrInFront::Do - Bad mode!");
02209 #endif
02210 }
02211
02212 *UIDescription = DisableReason;
02213
02214 return(OpSt);
02215 }
02216
02217
02218
02219
02220
02221
02222
02223
02224
02225
02226
02227
02228
02229
02230
02231
02232
02233
02234 void OpMoveToLyrInFront::Do(OpDescriptor*)
02235 {
02236
02237 Range Sel(*(GetApplication()->FindSelection()));
02238 RangeControl rg = Sel.GetRangeControlFlags();
02239 rg.PromoteToParent = TRUE;
02240 Sel.Range::SetRangeControl(rg);
02241
02242
02243 Node* FirstSelectedNode = Sel.FindFirst();
02244
02245
02246 ENSURE(FirstSelectedNode != NULL, "The OpMoveToLyrInFront's GetState fn has not done a very good job");
02247
02248 if (FirstSelectedNode != NULL)
02249 {
02250 if (!DoStartSelOp(FALSE,FALSE))
02251
02252 {
02253 goto EndOperation;
02254 }
02255
02256
02257 if (!DoInvalidateNodesRegions(Sel, TRUE, FALSE, FALSE, FALSE))
02258 {
02259 goto EndOperation;
02260 }
02261
02262 Node* CurrentNode = FirstSelectedNode;
02263
02264
02265 Range LayerRange;
02266 Layer* NxtLyr = NULL;
02267 Node* NextNode = NULL;
02268 Node* ThisLayer = NULL;
02269 Node* FirstSelectedNxtLyr = NULL;
02270 Node* LastObjectMoved = NULL;
02271
02272 BOOL OldVisible = FALSE;
02273 BOOL OldLocked = FALSE;
02274
02275 #ifndef WEBSTER
02276 MODE PresentMode = LAYER;
02277 #endif
02278
02279
02280 while (CurrentNode != NULL)
02281 {
02282 ENSURE(CurrentNode->IsAnObject(), "Non ink node in OpMoveToLyrInFront");
02283
02284 ThisLayer = CurrentNode->FindParent(CC_RUNTIME_CLASS(Layer));
02285
02286 if (ThisLayer != NULL)
02287 ((Layer*)ThisLayer)->InvalidateBoundingRect();
02288
02289
02290
02291
02292
02293
02294 #ifdef WEBSTER
02295
02296
02297 NxtLyr = (Layer*)ThisLayer;
02298 do
02299 {
02300 NxtLyr = NxtLyr->FindNextFrameLayer();
02301 if (NxtLyr != NULL)
02302 {
02303
02304 if (!NxtLyr->IsGuide() && !NxtLyr->IsPageBackground())
02305 {
02306
02307 break;
02308 }
02309 }
02310
02311 } while (NxtLyr != NULL);
02312
02313 if (NxtLyr != NULL)
02314 {
02315
02316
02317 OldVisible = NxtLyr->IsVisible();
02318 OldLocked = NxtLyr->IsLocked();
02319 NxtLyr->SetVisible(TRUE);
02320 NxtLyr->SetLocked(FALSE);
02321 }
02322
02323 #else
02324
02325
02326
02327 NxtLyr = (Layer*)ThisLayer;
02328 PresentMode = (MODE)NxtLyr->IsFrame();
02329
02330 if(PresentMode == LAYER)
02331 {
02332 do
02333 {
02334 NxtLyr = NxtLyr->FindNextLayer();
02335 if (NxtLyr != NULL)
02336 {
02337 if (NxtLyr->IsVisible() && !NxtLyr->IsLocked() && !NxtLyr->IsGuide())
02338 {
02339
02340 break;
02341 }
02342 }
02343
02344 } while (NxtLyr != NULL);
02345
02346 if (NxtLyr != NULL)
02347 {
02348
02349
02350 OldVisible = NxtLyr->IsVisible();
02351 OldLocked = NxtLyr->IsLocked();
02352 NxtLyr->SetVisible(TRUE);
02353 NxtLyr->SetLocked(FALSE);
02354 }
02355 }
02356 else if (PresentMode == FRAME)
02357 {
02358
02359 do
02360 {
02361 NxtLyr = NxtLyr->FindNextFrameLayer();
02362 if (NxtLyr != NULL)
02363 {
02364
02365 if (!NxtLyr->IsGuide() && !NxtLyr->IsPageBackground())
02366 {
02367
02368 break;
02369 }
02370 }
02371
02372 } while (NxtLyr != NULL);
02373
02374 if (NxtLyr != NULL)
02375 {
02376
02377
02378 OldVisible = NxtLyr->IsVisible();
02379 OldLocked = NxtLyr->IsLocked();
02380 NxtLyr->SetVisible(TRUE);
02381 NxtLyr->SetLocked(FALSE);
02382 }
02383 }
02384 else
02385 ERROR3("OpMoveToLyrInFront::Do - Bad mode!");
02386 #endif
02387
02388 if (NxtLyr == NULL)
02389 {
02390 ENSURE(CurrentNode != FirstSelectedNode, "OpMoveToLyrInFront called with nothing to do");
02391
02392
02393 goto EndOperation;
02394 }
02395
02396 NxtLyr->InvalidateBoundingRect();
02397
02398
02399
02400 Range temp(CurrentNode,
02401 NULL,
02402 RangeControl(TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE) );
02403 LayerRange = temp;
02404
02405
02406
02407
02408
02409
02410
02411 FirstSelectedNxtLyr = CurrentNode;
02412
02413 do
02414 {
02415 if (FirstSelectedNxtLyr->FindParent(CC_RUNTIME_CLASS(Layer)) != ThisLayer)
02416 {
02417 break;
02418 }
02419 FirstSelectedNxtLyr = Sel.FindNext(FirstSelectedNxtLyr);
02420
02421 } while (FirstSelectedNxtLyr != NULL);
02422
02423
02424 LastObjectMoved = NULL;
02425
02426
02427
02428 do
02429 {
02430 NextNode = LayerRange.FindNext(CurrentNode);
02431
02432 if (LastObjectMoved == NULL)
02433 {
02434
02435
02436 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
02437 if (!DoMoveNode(CurrentNode, NxtLyr, FIRSTCHILD))
02438 {
02439 goto EndOperation;
02440 }
02441
02442 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
02443 CurrentNode->SetSelected(TRUE);
02444 }
02445 else
02446 {
02447
02448 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
02449 if (!DoMoveNode(CurrentNode, LastObjectMoved, NEXT))
02450 {
02451 goto EndOperation;
02452 }
02453
02454 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
02455 CurrentNode->SetSelected(TRUE);
02456 }
02457
02458 LastObjectMoved = CurrentNode;
02459 CurrentNode = NextNode;
02460
02461 } while (NextNode != NULL);
02462
02463
02464 #ifdef WEBSTER
02465 if (NxtLyr != NULL)
02466 #else
02467 if (NxtLyr != NULL && PresentMode == FRAME)
02468 #endif
02469 {
02470
02471 NxtLyr->SetVisible(OldVisible);
02472
02473 }
02474
02475
02476 CurrentNode = FirstSelectedNxtLyr;
02477 }
02478
02479
02480
02481
02482
02483
02484 #ifdef WEBSTER
02485 if (NxtLyr != NULL)
02486 #else
02487 if (NxtLyr != NULL && PresentMode == FRAME)
02488 #endif
02489 {
02490 PORTNOTETRACE("gallery", "Removed used of FrameSGallery from OpMoveToLyrInFront");
02491 #if !defined(EXCLUDE_FROM_XARALX)
02492 FrameSGallery::MakeActiveLayer(NxtLyr);
02493 BROADCAST_TO_ALL(LayerMsg(NxtLyr,LayerMsg::UPDATE_ACTIVE_LAYER));
02494 #endif
02495 }
02496
02497
02498
02499
02500 if (!DoInvalidateNodesRegions(*(GetApplication()->FindSelection()), TRUE, FALSE, FALSE, FALSE))
02501 {
02502 goto EndOperation;
02503 }
02504
02505
02506 if (FirstSelectedNode->IsBounded())
02507 {
02508 NodeRenderableBounded* pNodeRB = (NodeRenderableBounded*)FirstSelectedNode;
02509 pNodeRB->InvalidateBoundingRect();
02510 }
02511 }
02512
02513 EndOperation:
02514
02515 End();
02516 }
02517
02518
02519
02520
02521
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531
02532
02533
02534
02535
02536
02537
02538
02539 OpMoveToLyrBehind::OpMoveToLyrBehind(): SelOperation()
02540 {
02541 }
02542
02543
02544
02545
02546
02547
02548
02549
02550
02551
02552
02553
02554
02555
02556
02557
02558
02559
02560
02561 BOOL OpMoveToLyrBehind::Init()
02562 {
02563
02564
02565
02566
02567
02568
02569
02570
02571
02572
02573
02574
02575
02576
02577
02578
02579
02580
02581
02582
02583 FrameBehindOpDescriptor* pOpDesc = new FrameBehindOpDescriptor(OPTOKEN_MOVELAYERBEHIND,
02584 CC_RUNTIME_CLASS(OpMoveToLyrBehind),
02585 OpMoveToLyrBehind::GetState);
02586
02587 if(pOpDesc)
02588 return TRUE;
02589
02590 return FALSE;
02591 }
02592
02593
02594
02595
02596
02597
02598
02599
02600
02601
02602
02603
02604
02605
02606
02607
02608 OpState OpMoveToLyrBehind::GetState(String_256* UIDescription, OpDescriptor*)
02609 {
02610 OpState OpSt;
02611
02612
02613
02614
02615 String_256 DisableReason;
02616
02617 SelRange Sel(*(GetApplication()->FindSelection()));
02618 RangeControl rg = Sel.GetRangeControlFlags();
02619 rg.PromoteToParent = TRUE;
02620 Sel.Range::SetRangeControl(rg);
02621
02622 Node* pNode = Sel.FindFirst();
02623 while (pNode != NULL)
02624 {
02625 Node* pLayer = pNode->FindParent(CC_RUNTIME_CLASS(Layer));
02626 if (pLayer != NULL && ((Layer*)pLayer)->IsGuide())
02627 {
02628 *UIDescription = String_256(_R(IDS_CANT_MOVE_OFF_GUIDE_LAYER));
02629 OpSt.Greyed = TRUE;
02630 return OpSt;
02631 }
02632
02633 pNode = Sel.FindNext(pNode);
02634 }
02635
02636
02637
02638
02639
02640 #ifdef WEBSTER
02641
02642
02643
02644
02645
02646
02647 Node* pLastSelectedNode = Sel.FindLast();
02648
02649
02650
02651 BOOL LowestVisible = TRUE;
02652 Layer* pCurrentLayer = (Layer*) (pLastSelectedNode->FindParent(CC_RUNTIME_CLASS(Layer)));
02653 ERROR2IF(pCurrentLayer == NULL, OpSt, "Cannot find layer of first selected object");
02654 do
02655 {
02656 pCurrentLayer = pCurrentLayer->FindPrevFrameLayer();
02657 if (pCurrentLayer != NULL)
02658 {
02659
02660 if (!pCurrentLayer->IsGuide() && !pCurrentLayer->IsPageBackground())
02661 {
02662 LowestVisible = FALSE;
02663
02664 break;
02665 }
02666 }
02667 } while (pCurrentLayer != NULL);
02668
02669 #else
02670
02671
02672 Node* pLastSelectedNode = Sel.FindLast();
02673
02674
02675 if (pLastSelectedNode == NULL)
02676 {
02677
02678 ERROR3("OpMoveToLyrBehind::GetState; NULL returned as last node in Selection!");
02679 return OpSt;
02680 }
02681
02682
02683
02684 BOOL LowestVisible = TRUE;
02685 Layer* pCurrentLayer = (Layer*) (pLastSelectedNode->FindParent(CC_RUNTIME_CLASS(Layer)));
02686 ERROR2IF(pCurrentLayer == NULL, OpSt, "Cannot find layer of first selected object");
02687
02688
02689 MODE PresentMode = (MODE)pCurrentLayer->IsFrame();
02690 if (PresentMode == LAYER)
02691 {
02692 do
02693 {
02694 pCurrentLayer = pCurrentLayer->FindPrevLayer();
02695 if (pCurrentLayer != NULL)
02696 {
02697
02698 if (pCurrentLayer->IsVisible() && !pCurrentLayer->IsLocked() && !pCurrentLayer->IsGuide())
02699 {
02700 LowestVisible = FALSE;
02701
02702 break;
02703 }
02704 }
02705 } while (pCurrentLayer != NULL);
02706 }
02707 else if (PresentMode == FRAME)
02708 {
02709 do
02710 {
02711 pCurrentLayer = pCurrentLayer->FindPrevFrameLayer();
02712 if (pCurrentLayer != NULL)
02713 {
02714
02715 if (!pCurrentLayer->IsGuide() && !pCurrentLayer->IsPageBackground())
02716 {
02717 LowestVisible = FALSE;
02718
02719 break;
02720 }
02721 }
02722 } while (pCurrentLayer != NULL);
02723 }
02724 else
02725 ERROR3("OpMoveToLyrInFront::GetState - Bad mode!");
02726 #endif // WEBSTER
02727
02728 if (LowestVisible)
02729 {
02730
02731 OpSt.Greyed = TRUE;
02732
02733
02734 if (Sel.FindFirst() == pLastSelectedNode)
02735 {
02736 #ifdef WEBSTER
02737
02738 DisableReason = String_256(_R(IDS_ALREADY_ON_BOTTOM_FRMS));
02739 #else
02740 if(PresentMode == FRAME)
02741 DisableReason = String_256(_R(IDS_ALREADY_ON_BOTTOM_FRMS));
02742 else if(PresentMode == LAYER)
02743 DisableReason = String_256(_R(IDS_ALREADY_ON_BOTTOM_LYRS));
02744 else
02745 ERROR3("OpMoveToLyrInBehind::GetState - Bad mode!");
02746 #endif
02747 }
02748 else
02749 {
02750 #ifdef WEBSTER
02751
02752 DisableReason = String_256(_R(IDS_ALREADY_ON_BOTTOM_FRM));
02753 #else
02754 if(PresentMode == FRAME)
02755 {
02756
02757 DisableReason = String_256(_R(IDS_ALREADY_ON_BOTTOM_FRM));
02758 }
02759 else if (PresentMode == LAYER)
02760 {
02761
02762 DisableReason = String_256(_R(IDS_ALREADY_ON_BOTTOM_LYRP));
02763 }
02764 else
02765 ERROR3("OpMoveToLyrInFront::GetState - Bad mode!");
02766 #endif
02767 }
02768 }
02769
02770 *UIDescription = DisableReason;
02771
02772 return(OpSt);
02773 }
02774
02775
02776
02777
02778
02779
02780
02781
02782
02783
02784
02785
02786
02787
02788
02789
02790
02791
02792
02793
02794 void OpMoveToLyrBehind::Do(OpDescriptor*)
02795 {
02796
02797 Range Sel(*(GetApplication()->FindSelection()));
02798 RangeControl rg = Sel.GetRangeControlFlags();
02799 rg.PromoteToParent = TRUE;
02800 Sel.Range::SetRangeControl(rg);
02801
02802
02803
02804 Node* FirstSelectedNode = Sel.FindFirst();
02805
02806
02807 ENSURE(FirstSelectedNode != NULL,
02808 "The OpMoveToLyrInFront's GetState fn has not done a very good job");
02809
02810 if (FirstSelectedNode != NULL)
02811 {
02812 if (!DoStartSelOp(FALSE,FALSE))
02813
02814 {
02815 goto EndOperation;
02816 }
02817
02818
02819 if (!DoInvalidateNodesRegions(Sel, TRUE, FALSE, FALSE, FALSE))
02820 {
02821 goto EndOperation;
02822 }
02823
02824 Node* CurrentNode = FirstSelectedNode;
02825
02826
02827 Range LayerRange;
02828
02829 Node* Destination = NULL;
02830
02831 Node* ThisLayer = NULL;
02832 Layer* PrevLayer = NULL;
02833 Node* LastSelectedThisLayer = NULL;
02834 Node* NextNode = NULL;
02835
02836 BOOL OldVisible = FALSE;
02837 BOOL OldLocked = FALSE;
02838
02839 #ifndef WEBSTER
02840 MODE PresentMode = LAYER;
02841 #endif
02842
02843 while (CurrentNode != NULL)
02844 {
02845 ENSURE(CurrentNode->IsAnObject(), "Non ink node in OpMoveToLyrBehind");
02846
02847
02848 Range temp(CurrentNode,
02849 NULL,
02850 RangeControl(TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE) );
02851 LayerRange = temp;
02852
02853
02854
02855
02856
02857
02858
02859
02860
02861 Destination = NULL;
02862
02863 ThisLayer = CurrentNode->FindParent(CC_RUNTIME_CLASS(Layer));
02864
02865 if (ThisLayer != NULL)
02866 ((Layer*)ThisLayer)->InvalidateBoundingRect();
02867
02868
02869
02870
02871
02872
02873 #ifdef WEBSTER
02874
02875
02876 PrevLayer = (Layer*)ThisLayer;
02877 do
02878 {
02879 PrevLayer = PrevLayer->FindPrevFrameLayer();
02880 if (PrevLayer != NULL)
02881 {
02882
02883 if (!PrevLayer->IsGuide() && !PrevLayer->IsPageBackground())
02884 {
02885
02886 break;
02887 }
02888 }
02889
02890 } while (PrevLayer != NULL);
02891
02892 if (PrevLayer != NULL)
02893 {
02894
02895
02896 OldVisible = PrevLayer->IsVisible();
02897 OldLocked = PrevLayer->IsLocked();
02898 PrevLayer->SetVisible(TRUE);
02899 PrevLayer->SetLocked(FALSE);
02900 }
02901
02902 #else
02903
02904
02905
02906 PrevLayer = (Layer*)ThisLayer;
02907 PresentMode = (MODE)PrevLayer->IsFrame();
02908
02909 if(PresentMode == LAYER)
02910 {
02911 do
02912 {
02913 PrevLayer = (Layer*)(PrevLayer->FindPrevious(CC_RUNTIME_CLASS(Layer)));
02914 if (PrevLayer != NULL)
02915 {
02916 if (PrevLayer->IsVisible() && !PrevLayer->IsLocked() && !PrevLayer->IsGuide())
02917 {
02918
02919 break;
02920 }
02921 }
02922
02923 } while (PrevLayer != NULL);
02924
02925 if (PrevLayer != NULL)
02926 {
02927
02928
02929 OldVisible = PrevLayer->IsVisible();
02930 OldLocked = PrevLayer->IsLocked();
02931 PrevLayer->SetVisible(TRUE);
02932 PrevLayer->SetLocked(FALSE);
02933 }
02934 }
02935 else if (PresentMode == FRAME)
02936 {
02937
02938 do
02939 {
02940 PrevLayer = PrevLayer->FindPrevFrameLayer();
02941 if (PrevLayer != NULL)
02942 {
02943
02944 if (!PrevLayer->IsGuide() && !PrevLayer->IsPageBackground())
02945 {
02946
02947 break;
02948 }
02949 }
02950
02951 } while (PrevLayer != NULL);
02952
02953 if (PrevLayer != NULL)
02954 {
02955
02956
02957 OldVisible = PrevLayer->IsVisible();
02958 OldLocked = PrevLayer->IsLocked();
02959 PrevLayer->SetVisible(TRUE);
02960 PrevLayer->SetLocked(FALSE);
02961 }
02962 }
02963 else
02964 ERROR3("OpMoveToLyrBehind::Do - Bad mode");
02965 #endif
02966 if (PrevLayer != NULL)
02967 {
02968 PrevLayer->InvalidateBoundingRect();
02969
02970 Destination = PrevLayer->FindLastChild();
02971
02972 if (Destination != NULL)
02973
02974 {
02975
02976
02977 if (!(Destination->IsAnObject()))
02978 {
02979 Destination = Destination->FindPrevious(CC_RUNTIME_CLASS(NodeRenderableInk));
02980 }
02981
02982 }
02983 }
02984
02985
02986
02987 do
02988 {
02989 NextNode = LayerRange.FindNext(CurrentNode);
02990
02991 if (PrevLayer != NULL)
02992 {
02993 if (Destination == NULL)
02994 {
02995
02996
02997 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
02998 if (!DoMoveNode(CurrentNode, PrevLayer, FIRSTCHILD))
02999 {
03000 goto EndOperation;
03001 }
03002
03003 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
03004 CurrentNode->SetSelected(TRUE);
03005 }
03006 else
03007 {
03008 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
03009 if (!DoMoveNode(CurrentNode, Destination, NEXT))
03010 {
03011 goto EndOperation;
03012 }
03013
03014 ((NodeRenderableBounded*)CurrentNode)->ReleaseCached(TRUE, FALSE, FALSE, TRUE);
03015 CurrentNode->SetSelected(TRUE);
03016 }
03017 Destination = CurrentNode;
03018 }
03019
03020
03021 LastSelectedThisLayer = CurrentNode;
03022
03023
03024 CurrentNode = NextNode;
03025
03026 } while (CurrentNode != NULL);
03027
03028
03029 #ifdef WEBSTER
03030 if (PrevLayer != NULL)
03031 #else
03032 if (PrevLayer != NULL && PresentMode == FRAME)
03033 #endif
03034 {
03035
03036 PrevLayer->SetVisible(OldVisible);
03037
03038 }
03039
03040
03041
03042 CurrentNode = Sel.FindNext(LastSelectedThisLayer);
03043 }
03044
03045
03046
03047
03048
03049
03050 #ifdef WEBSTER // Include in Camelot2 for Frame/Layer integration - RanbirR 03/11/97
03051 if (PrevLayer != NULL)
03052 #else
03053 if (PrevLayer != NULL && PresentMode == FRAME)
03054 #endif
03055 {
03056 PORTNOTETRACE("gallery", "Removed used of FrameSGallery from OpMoveToLyrBehind");
03057 #if !defined(EXCLUDE_FROM_XARALX)
03058 FrameSGallery::MakeActiveLayer(PrevLayer);
03059 BROADCAST_TO_ALL(LayerMsg(PrevLayer,LayerMsg::UPDATE_ACTIVE_LAYER));
03060 #endif
03061 }
03062
03063
03064
03065
03066 if (!DoInvalidateNodesRegions(*(GetApplication()->FindSelection()), TRUE))
03067 {
03068 goto EndOperation;
03069 }
03070
03071
03072
03073 if (FirstSelectedNode->IsBounded())
03074 {
03075 NodeRenderableBounded* pNodeRB = (NodeRenderableBounded*)FirstSelectedNode;
03076 pNodeRB->InvalidateBoundingRect();
03077 }
03078 }
03079
03080 EndOperation:
03081 GetApplication()->UpdateSelection();
03082
03083 End();
03084
03085 }
03086
03087
03089
03090
03091
03092
03093
03094
03095
03096
03097
03098
03099
03100
03101
03102
03103
03104
03105
03106
03107
03108
03109
03110
03111
03112
03113
03114
03115
03116
03117
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127
03128
03129
03130
03131
03132
03133
03134
03135
03136
03137
03138
03139
03140
03141
03142
03143
03144
03145
03146
03147
03148
03149
03150
03151
03152
03153
03154
03155
03156
03157
03158
03159
03160
03161
03162
03163
03164
03165
03166
03167
03168
03169
03170
03171
03172
03173
03174
03175
03176
03177
03178
03179
03180
03181
03182
03183
03184
03185
03186
03187
03188
03189
03190
03191
03192
03193
03194
03195
03196
03197
03198
03199
03200
03201
03202
03203
03204
03205
03206
03207
03208
03209
03210
03211
03212
03213
03214
03215
03216
03217
03218
03219
03220
03221
03222
03223
03224
03225
03226
03227
03228
03229
03230
03231
03232
03233
03234
03235
03236
03237
03238
03239
03240
03241
03242
03243
03244
03245
03246
03247
03248
03249
03250
03251
03252
03253
03254
03255
03256
03257
03258
03259
03260
03261
03262
03263
03264
03265
03266
03267
03268
03269
03270
03271
03272
03273
03274
03275
03276
03277
03278
03279
03280
03281
03282
03283
03284
03285
03286
03287
03288
03289
03290
03291
03292
03293
03294
03295
03296
03297
03298
03299
03300
03301
03302
03303
03304
03305
03306
03307
03308
03309
03310
03311
03312
03313
03314 FrameInFrontOpDescriptor::FrameInFrontOpDescriptor( const TCHAR* pcszToken,
03315 CCRuntimeClass* pClass, pfnGetState gs)
03316 : OpDescriptor( 0,
03317 _R(IDS_MOVELAYERINFRONT),
03318 pClass,
03319 (TCHAR*) pcszToken,
03320 gs,
03321 0,
03322 _R(IDBBL_MOVELAYERINFRONT),
03323 _R(IDD_ANIMATIONBAR),
03324 _R(IDC_FRAME_MOVEUPAFRAME),
03325 TRUE,
03326 FALSE,
03327 TRUE,
03328 0,
03329 (GREY_WHEN_NO_CURRENT_DOC | GREY_WHEN_NO_SELECTION)
03330 )
03331 {}
03332
03333
03334
03335
03336
03337
03338
03339
03340
03341
03342
03343
03344
03345
03346
03347
03348
03349
03350
03351 OpState FrameInFrontOpDescriptor::GetState(String_256*, OpDescriptor* pOpDesc)
03352 {
03353
03354 OpState OpSt;
03355 return OpSt;
03356 }
03357
03358
03359
03360
03361
03362
03363
03364
03365
03366
03367
03368
03369
03370
03371
03372
03373
03374
03375
03376 BOOL FrameInFrontOpDescriptor::GetText(String_256* Description, OpTextFlags WhichText)
03377 {
03378
03379 BOOL LayerMode = TRUE;
03380 TCHAR* ok;
03381
03382
03383 Document* pDoc = Document::GetSelected();
03384
03385
03386 if(pDoc)
03387 {
03388
03389 Spread* pSpread = pDoc->GetSelectedSpread();
03390
03391
03392 if(pSpread)
03393 {
03394
03395
03396 Layer* pFrameLayer = pSpread->FindFirstFrameLayer();
03397
03398
03399 if (pFrameLayer)
03400 LayerMode = FALSE;
03401 }
03402 }
03403
03404 if(LayerMode)
03405 {
03406
03407 String_256 ResourceText( _R(IDS_MOVELAYERINFRONT), ModuleID );
03408
03409
03410 ok = GetDescription((TCHAR*) ResourceText, WhichText);
03411 }
03412 else
03413 {
03414
03415 String_256 ResourceText( _R(IDS_MOVEFRAMERINFRONT), ModuleID );
03416
03417
03418 ok = GetDescription((TCHAR*) ResourceText, WhichText);
03419 }
03420
03421
03422 if (ok)
03423 {
03424 *Description = String_256(ok);
03425 return TRUE;
03426 }
03427 else
03428 return FALSE;
03429
03430 }
03431
03432
03433
03434
03435
03436
03437
03438
03439
03440
03441
03442
03443
03444
03445
03446
03447
03448
03449
03450
03451
03452 FrameBehindOpDescriptor::FrameBehindOpDescriptor( const TCHAR* pcszToken,
03453 CCRuntimeClass* pClass, pfnGetState gs)
03454 : OpDescriptor( 0,
03455 _R(IDS_MOVELAYERBEHIND),
03456 pClass,
03457 (TCHAR*) pcszToken,
03458 gs,
03459 0,
03460 _R(IDBBL_MOVELAYERBEHIND),
03461 _R(IDD_ANIMATIONBAR),
03462 _R(IDC_FRAME_MOVEDOWNAFRAME),
03463 TRUE,
03464 FALSE,
03465 TRUE,
03466 0,
03467 (GREY_WHEN_NO_SELECTION | GREY_WHEN_NO_CURRENT_DOC)
03468 )
03469 {}
03470
03471
03472
03473
03474
03475
03476
03477
03478
03479
03480
03481
03482
03483
03484
03485
03486
03487
03488 OpState FrameBehindOpDescriptor::GetState(String_256*, OpDescriptor* pOpDesc)
03489 {
03490
03491 OpState OpSt;
03492 return OpSt;
03493 }
03494
03495
03496
03497
03498
03499
03500
03501
03502
03503
03504
03505
03506
03507
03508
03509
03510
03511
03512 BOOL FrameBehindOpDescriptor::GetText(String_256* Description, OpTextFlags WhichText)
03513 {
03514
03515 BOOL LayerMode = TRUE;
03516 TCHAR* ok;
03517
03518
03519 Document* pDoc = Document::GetSelected();
03520
03521
03522 if(pDoc)
03523 {
03524
03525 Spread* pSpread = pDoc->GetSelectedSpread();
03526
03527
03528 if(pSpread)
03529 {
03530
03531 Layer* pFrameLayer = pSpread->FindFirstFrameLayer();
03532
03533
03534 if (pFrameLayer)
03535 LayerMode = FALSE;
03536 }
03537 }
03538
03539 if(LayerMode)
03540 {
03541
03542 String_256 ResourceText( _R(IDS_MOVELAYERBEHIND), ModuleID );
03543
03544
03545 ok = GetDescription((TCHAR*) ResourceText, WhichText);
03546 }
03547 else
03548 {
03549
03550 String_256 ResourceText( _R(IDS_MOVERFAMEBEHIND), ModuleID );
03551
03552
03553 ok = GetDescription((TCHAR*) ResourceText, WhichText);
03554 }
03555
03556
03557 if (ok)
03558 {
03559 *Description = String_256(ok);
03560 return TRUE;
03561 }
03562 else
03563 return FALSE;
03564
03565 }