00001 // $Id: frameops.cpp 1282 2006-06-09 09:46:49Z alex $ 00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE 00003 ================================XARAHEADERSTART=========================== 00004 00005 Xara LX, a vector drawing and manipulation program. 00006 Copyright (C) 1993-2006 Xara Group Ltd. 00007 Copyright on certain contributions may be held in joint with their 00008 respective authors. See AUTHORS file for details. 00009 00010 LICENSE TO USE AND MODIFY SOFTWARE 00011 ---------------------------------- 00012 00013 This file is part of Xara LX. 00014 00015 Xara LX is free software; you can redistribute it and/or modify it 00016 under the terms of the GNU General Public License version 2 as published 00017 by the Free Software Foundation. 00018 00019 Xara LX and its component source files are distributed in the hope 00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the 00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00022 See the GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with Xara LX (see the file GPL in the root directory of the 00026 distribution); if not, write to the Free Software Foundation, Inc., 51 00027 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00028 00029 00030 ADDITIONAL RIGHTS 00031 ----------------- 00032 00033 Conditional upon your continuing compliance with the GNU General Public 00034 License described above, Xara Group Ltd grants to you certain additional 00035 rights. 00036 00037 The additional rights are to use, modify, and distribute the software 00038 together with the wxWidgets library, the wxXtra library, and the "CDraw" 00039 library and any other such library that any version of Xara LX relased 00040 by Xara Group Ltd requires in order to compile and execute, including 00041 the static linking of that library to XaraLX. In the case of the 00042 "CDraw" library, you may satisfy obligation under the GNU General Public 00043 License to provide source code by providing a binary copy of the library 00044 concerned and a copy of the license accompanying it. 00045 00046 Nothing in this section restricts any of the rights you have under 00047 the GNU General Public License. 00048 00049 00050 SCOPE OF LICENSE 00051 ---------------- 00052 00053 This license applies to this program (XaraLX) and its constituent source 00054 files only, and does not necessarily apply to other Xara products which may 00055 in part share the same code base, and are subject to their own licensing 00056 terms. 00057 00058 This license does not apply to files in the wxXtra directory, which 00059 are built into a separate library, and are subject to the wxWindows 00060 license contained within that directory in the file "WXXTRA-LICENSE". 00061 00062 This license does not apply to the binary libraries (if any) within 00063 the "libs" directory, which are subject to a separate license contained 00064 within that directory in the file "LIBS-LICENSE". 00065 00066 00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS 00068 ---------------------------------------------- 00069 00070 Subject to the terms of the GNU Public License (see above), you are 00071 free to do whatever you like with your modifications. However, you may 00072 (at your option) wish contribute them to Xara's source tree. You can 00073 find details of how to do this at: 00074 http://www.xaraxtreme.org/developers/ 00075 00076 Prior to contributing your modifications, you will need to complete our 00077 contributor agreement. This can be found at: 00078 http://www.xaraxtreme.org/developers/contribute/ 00079 00080 Please note that Xara will not accept modifications which modify any of 00081 the text between the start and end of this header (marked 00082 XARAHEADERSTART and XARAHEADEREND). 00083 00084 00085 MARKS 00086 ----- 00087 00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara 00089 designs are registered or unregistered trademarks, design-marks, and/or 00090 service marks of Xara Group Ltd. All rights in these marks are reserved. 00091 00092 00093 Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK. 00094 http://www.xara.com/ 00095 00096 =================================XARAHEADEREND============================ 00097 */ 00098 00099 // The Frame Operations source file 00100 00101 /* 00102 */ 00103 00104 #include "camtypes.h" 00105 #include "frameops.h" 00106 00107 //#include "prevwres.h" // _R(IDS_DISPLAY_FRAME_GALLERY) _R(IDD_ANIMATIONBAR) ... 00108 #include "sgframe.h" // FrameSGallery 00109 //#include "spread.h" // Spread - in camtypes.h [AUTOMATICALLY REMOVED] 00110 //#include "simon.h" // _R(IDS_NO_DOC) 00111 //#include "app.h" // GetApplication() - in camtypes.h [AUTOMATICALLY REMOVED] 00112 //#include "fixmem.h" // CCMalloc - in camtypes.h [AUTOMATICALLY REMOVED] 00113 #include "prevwdlg.h" // OPTOKEN_PREVIEWDIALOG 00114 #include "grndbmp.h" // GRenderBitmap 00115 #include "filedlgs.h" // ExportFileDialog 00116 //#include "tim.h" // _R(IDT_CANT_FIND_FILTER) 00117 //#include "oilfltrs.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00118 //#include "nev.h" // _R(IDN_USER_CANCELLED) 00119 #include "layermsg.h" // layer messages REDRAW_LAYER 00120 00121 //#include "accures.h" // _R(IDN_FILTEREXT_GIF) 00122 00123 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00124 00125 #include "nodebmp.h" // NodeBitmap 00126 #include "insertnd.h" // InsertionNode 00127 #include "aprps.h" 00128 00129 // browser preview 00130 #include "fileutil.h" // FileUtil::GetTemporaryPathName() 00131 #include "cbmpdata.h" // CBitmapData 00132 00133 #include "palman.h" // MakePaletteBrowserCompatible 00134 00135 //#include "xshelpid.h" //For the help ID 00136 00137 #include "gpalopt.h" // for the palette optimiser 00138 #include "mrhbits.h" 00139 #include "page.h" 00140 //#include "quality.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00141 00142 DECLARE_SOURCE("$Revision: 1282 $"); 00143 00144 CC_IMPLEMENT_DYNCREATE(OpSelectStartFrame, OpLayerGalChange); 00145 CC_IMPLEMENT_DYNCREATE(OpSelectEndFrame, OpLayerGalChange); 00146 CC_IMPLEMENT_DYNCREATE(OpSelectPrevFrame, OpLayerGalChange); 00147 CC_IMPLEMENT_DYNCREATE(OpSelectNextFrame, OpLayerGalChange); 00148 CC_IMPLEMENT_DYNCREATE(OpCreateNewFrame, OpLayerGalChange); 00149 CC_IMPLEMENT_DYNCREATE(OpCopyFrame, OpLayerGalChange); 00150 CC_IMPLEMENT_DYNCREATE(OpDeleteFrame, OpLayerGalChange); 00151 00152 CC_IMPLEMENT_DYNCREATE(OpFrameProperties, Operation); 00153 CC_IMPLEMENT_DYNCREATE(OpAnimationProperties, Operation); 00154 00155 00156 PORTNOTE("other", "Removed GrabFrameFilter, OpGrabFrame, OpGrabAllFrames") 00157 #ifndef EXCLUDE_FROM_XARALX 00158 CC_IMPLEMENT_DYNAMIC(GIFAnimationExportParam, BitmapExportParam); 00159 CC_IMPLEMENT_DYNCREATE(OpGrabFrame, Operation); 00160 CC_IMPLEMENT_DYNCREATE(OpGrabAllFrames, OpGrabFrame); 00161 CC_IMPLEMENT_DYNAMIC(GrabFrameFilter, MakeBitmapFilter); 00162 CC_IMPLEMENT_DYNCREATE(OpSaveAnimatedGIF, OpGrabAllFrames); 00163 CC_IMPLEMENT_DYNCREATE(OpBrowserPreview, OpSaveAnimatedGIF); 00164 00165 BOOL OpGrabAllFrames::ms_ForceRefreshOfAllFrames = FALSE; 00166 #endif 00167 00168 // This will get Camelot to display the filename and linenumber of any memory allocations 00169 // that are not released at program exit 00170 // This line mustn't go before any CC_IMPLEMENT_... macros 00171 #define new CAM_DEBUG_NEW 00172 00173 00174 //------------------------------------------------------------------------------------------ 00175 // Methods for the OpSelectStartFrame 00176 //------------------------------------------------------------------------------------------ 00177 00178 /******************************************************************************************** 00179 00180 > OpState OpSelectStartFrame::GetState(String_256*, OpDescriptor*) 00181 00182 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00183 Created: 21/4/97 00184 Inputs: Name of the OpDescriptor being queried 00185 Outputs: The string to show to the user 00186 Returns: The state of the OpSelectStartFrame operation 00187 Purpose: For finding the OpSelectStartFrame's state. 00188 Errors: - 00189 SeeAlso: - 00190 00191 ********************************************************************************************/ 00192 00193 OpState OpSelectStartFrame::GetState(String_256 * pUIDescription, OpDescriptor * pOpDesc) 00194 { 00195 OpState OpSt; 00196 00197 // Is there a selected spread? 00198 Spread * pSpread = Document::GetSelectedSpread(); 00199 if (pSpread) 00200 { 00201 // yes, so check if there is an active layer 00202 Layer * pLayer = pSpread->FindActiveLayer(); 00203 Layer * pPrevLayer = pLayer->FindPrevLayer(); 00204 // The previous layer should really be a frame layer but we cannot guarantee that but 00205 // it mustn't be a guide, a page background or a background layer. 00206 while ( pPrevLayer && !pPrevLayer->IsPseudoFrame()) 00207 { 00208 pPrevLayer = pPrevLayer->FindPrevLayer(); 00209 } 00210 00211 if (pLayer && pPrevLayer) 00212 { 00213 // Yes, so we are allowed to move to the next one 00214 OpSt.Greyed = FALSE; 00215 } 00216 else 00217 { 00218 // No, so we are greyed 00219 OpSt.Greyed = TRUE; 00220 } 00221 } 00222 else 00223 { 00224 // No selected spread, so we are greyed 00225 OpSt.Greyed = TRUE; 00226 } 00227 00228 return OpSt; 00229 } 00230 00231 /******************************************************************************************** 00232 00233 > void OpSelectStartFrame::Do(OpDescriptor * pOpDesc) 00234 00235 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00236 Created: 21/4/97 00237 Inputs: OpDescriptor (unused) 00238 Outputs: - 00239 Returns: - 00240 Purpose: Tries to select the bottom most animation frame (i.e. layer). 00241 Errors: - 00242 SeeAlso: - 00243 00244 ********************************************************************************************/ 00245 00246 void OpSelectStartFrame::Do( OpDescriptor * pOpDesc ) 00247 { 00248 // Just find the background layer and then ask our baseclass to delete it for us 00249 // Is there a selected spread? 00250 Spread * pSpread = Document::GetSelectedSpread(); 00251 if (pSpread) 00252 { 00253 PORTNOTE("other", "Disabled FrameSGallery") 00254 #ifndef EXCLUDE_FROM_XARALX 00255 // Check that all visible layers are actually frame layers 00256 FrameSGallery::EnsureFrameLayerIntegrity(pSpread); 00257 #endif 00258 // yes, so find the first layer and try to move to it 00259 Layer * pLayer = pSpread->FindFirstFrameLayer(); 00260 if (pLayer) 00261 { 00262 OpLayerGalParam Param(FRAME_SELECT, pSpread); 00263 Param.pLayer = pLayer; 00264 DoWithParam(pOpDesc, (OpParam*)&Param); 00265 } 00266 } 00267 00268 // End the operation, but we are calling DoWithParam() which we will assume does it for us. 00269 //End(); 00270 00271 return; 00272 } 00273 00274 /******************************************************************************************** 00275 // End of OpSelectStartFrame 00276 ********************************************************************************************/ 00277 00278 //------------------------------------------------------------------------------------------ 00279 // Methods for the OpSelectEndFrame 00280 //------------------------------------------------------------------------------------------ 00281 00282 /******************************************************************************************** 00283 00284 > OpState OpSelectEndFrame::GetState(String_256*, OpDescriptor*) 00285 00286 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00287 Created: 22/4/97 00288 Inputs: Name of the OpDescriptor being queried 00289 Outputs: The string to show to the user 00290 Returns: The state of the OpSelectEndFrame operation 00291 Purpose: For finding the OpSelectEndFrame's state. 00292 Errors: - 00293 SeeAlso: - 00294 00295 ********************************************************************************************/ 00296 00297 OpState OpSelectEndFrame::GetState(String_256 * pUIDescription, OpDescriptor * pOpDesc) 00298 { 00299 OpState OpSt; 00300 00301 // Is there a selected spread? 00302 Spread * pSpread = Document::GetSelectedSpread(); 00303 if (pSpread) 00304 { 00305 // yes, so check if there is an active layer 00306 Layer * pLayer = pSpread->FindActiveLayer(); 00307 // If there is an active layer and one following then we are not greyed 00308 Layer * pNextLayer = pLayer->FindNextLayer(); 00309 // The next layer should really be a frame layer but we cannot guarantee that but 00310 // it mustn't be a guide, a page background or a background layer. 00311 while ( pNextLayer && !pNextLayer->IsPseudoFrame()) 00312 { 00313 pNextLayer = pNextLayer->FindNextLayer(); 00314 } 00315 00316 if (pLayer && pNextLayer) 00317 { 00318 // Yes, so we are allowed to move to the previous one 00319 OpSt.Greyed = FALSE; 00320 } 00321 else 00322 { 00323 // No, so we are greyed 00324 OpSt.Greyed = TRUE; 00325 } 00326 } 00327 else 00328 { 00329 // No selected spread, so we are greyed 00330 OpSt.Greyed = TRUE; 00331 } 00332 00333 return OpSt; 00334 } 00335 00336 /******************************************************************************************** 00337 00338 > void OpSelectEndFrame::Do(OpDescriptor * pOpDesc) 00339 00340 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00341 Created: 22/4/97 00342 Inputs: OpDescriptor (unused) 00343 Outputs: - 00344 Returns: - 00345 Purpose: Tries to select the bottom most animation frame (i.e. layer). 00346 Errors: - 00347 SeeAlso: - 00348 00349 ********************************************************************************************/ 00350 00351 void OpSelectEndFrame::Do( OpDescriptor * pOpDesc ) 00352 { 00353 // Just find the background layer and then ask our baseclass to delete it for us 00354 // Is there a selected spread? 00355 Spread * pSpread = Document::GetSelectedSpread(); 00356 if (pSpread) 00357 { 00358 PORTNOTE("other", "Disabled FrameSGallery") 00359 #ifndef EXCLUDE_FROM_XARALX 00360 // Check that all visible layers are actually frame layers 00361 FrameSGallery::EnsureFrameLayerIntegrity(pSpread); 00362 #endif 00363 // yes, so find the last layer and try to move to it 00364 Layer * pLayer = pSpread->FindLastFrameLayer(); 00365 if (pLayer) 00366 { 00367 OpLayerGalParam Param(FRAME_SELECT, pSpread); 00368 Param.pLayer = pLayer; 00369 DoWithParam(pOpDesc, (OpParam*)&Param); 00370 } 00371 } 00372 00373 // End the operation, but we are calling DoWithParam() which we will assume does it for us. 00374 //End(); 00375 00376 return; 00377 } 00378 00379 /******************************************************************************************** 00380 // End of OpSelectEndFrame 00381 ********************************************************************************************/ 00382 00383 //------------------------------------------------------------------------------------------ 00384 // Methods for the OpSelectPrevFrame 00385 //------------------------------------------------------------------------------------------ 00386 00387 /******************************************************************************************** 00388 00389 > OpState OpSelectPrevFrame::GetState(String_256*, OpDescriptor*) 00390 00391 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00392 Created: 22/4/97 00393 Inputs: Name of the OpDescriptor being queried 00394 Outputs: The string to show to the user 00395 Returns: The state of the OpSelectPrevFrame operation 00396 Purpose: For finding the OpSelectPrevFrame's state. 00397 Errors: - 00398 SeeAlso: - 00399 00400 ********************************************************************************************/ 00401 00402 OpState OpSelectPrevFrame::GetState(String_256 * pUIDescription, OpDescriptor * pOpDesc) 00403 { 00404 //The frame movement controls on the GIF animation bar now work on frames only. 00405 OpState OpSt; 00406 00407 #ifdef WEBSTER 00408 00409 // Is there a selected spread? 00410 Spread * pSpread = Document::GetSelectedSpread(); 00411 if (pSpread) 00412 { 00413 // yes, so check if there is an active layer 00414 Layer * pLayer = pSpread->FindActiveLayer(); 00415 // If there is an active layer and one preceeding then we are not greyed 00416 Layer * pPrevLayer = pLayer->FindPrevLayer(); 00417 // The previous layer should really be a frame layer but we cannot guarantee that but 00418 // it mustn't be a guide, a page background or a background layer. 00419 while ( pPrevLayer && !pPrevLayer->IsPseudoFrame()) 00420 { 00421 pPrevLayer = pPrevLayer->FindPrevLayer(); 00422 } 00423 00424 if (pLayer && pPrevLayer) 00425 { 00426 // Yes, so we are allowed to move to the previous one 00427 OpSt.Greyed = FALSE; 00428 } 00429 else 00430 { 00431 // No, so we are greyed 00432 OpSt.Greyed = TRUE; 00433 } 00434 } 00435 else 00436 { 00437 // No selected spread, so we are greyed 00438 OpSt.Greyed = TRUE; 00439 } 00440 00441 #else 00442 // Are we in frame mode. 00443 BOOL FrameMode = IsFrameMode(); 00444 00445 if(FrameMode) 00446 { 00447 // Is there a selected spread? 00448 Spread * pSpread = Document::GetSelectedSpread(); 00449 if (pSpread) 00450 { 00451 // yes, so check if there is an active layer 00452 Layer * pLayer = pSpread->FindActiveLayer(); 00453 // If there is an active layer and one preceeding then we are not greyed 00454 Layer * pPrevLayer = pLayer->FindPrevLayer(); 00455 // The previous layer should really be a frame layer but we cannot guarantee that but 00456 // it mustn't be a guide, a page background or a background layer. 00457 while ( pPrevLayer && !pPrevLayer->IsPseudoFrame()) 00458 { 00459 pPrevLayer = pPrevLayer->FindPrevLayer(); 00460 } 00461 00462 if (pLayer && pPrevLayer) 00463 { 00464 // Yes, so we are allowed to move to the previous one 00465 OpSt.Greyed = FALSE; 00466 } 00467 else 00468 { 00469 // No, so we are greyed 00470 OpSt.Greyed = TRUE; 00471 } 00472 } 00473 else 00474 { 00475 // No selected spread, so we are greyed 00476 OpSt.Greyed = TRUE; 00477 } 00478 } 00479 else 00480 { 00481 // The document is layer based, so we are greyed. 00482 OpSt.Greyed = TRUE; 00483 } 00484 #endif 00485 00486 return OpSt; 00487 } 00488 00489 /******************************************************************************************** 00490 00491 > void OpSelectPrevFrame::Do(OpDescriptor * pOpDesc) 00492 00493 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00494 Created: 22/4/97 00495 Inputs: OpDescriptor (unused) 00496 Outputs: - 00497 Returns: - 00498 Purpose: Tries to select the previous animation frame (i.e. layer). 00499 Errors: - 00500 SeeAlso: - 00501 00502 ********************************************************************************************/ 00503 00504 void OpSelectPrevFrame::Do( OpDescriptor * pOpDesc ) 00505 { 00506 // Just find the background layer and then ask our baseclass to delete it for us 00507 // Is there a selected spread? 00508 Spread * pSpread = Document::GetSelectedSpread(); 00509 if (pSpread) 00510 { 00511 PORTNOTE("other", "Disabled FrameSGallery") 00512 #ifndef EXCLUDE_FROM_XARALX 00513 // Check that all visible layers are actually frame layers 00514 FrameSGallery::EnsureFrameLayerIntegrity(pSpread); 00515 #endif 00516 // yes, so find the last layer and try to move to it 00517 Layer * pLayer = pSpread->FindActiveLayer(); 00518 Layer * pPrevLayer = NULL; 00519 if (pLayer) 00520 pPrevLayer = pLayer->FindPrevFrameLayer(); 00521 if (pPrevLayer) 00522 { 00523 OpLayerGalParam Param(FRAME_SELECT, pSpread); 00524 Param.pLayer = pPrevLayer; 00525 DoWithParam(pOpDesc, (OpParam*)&Param); 00526 } 00527 } 00528 00529 // End the operation, but we are calling DoWithParam() which we will assume does it for us. 00530 //End(); 00531 00532 return; 00533 } 00534 00535 /******************************************************************************************** 00536 // End of OpSelectPrevFrame 00537 ********************************************************************************************/ 00538 00539 //------------------------------------------------------------------------------------------ 00540 // Methods for the OpSelectNextFrame 00541 //------------------------------------------------------------------------------------------ 00542 00543 /******************************************************************************************** 00544 00545 > OpState OpSelectNextFrame::GetState(String_256*, OpDescriptor*) 00546 00547 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00548 Created: 22/4/97 00549 Inputs: Name of the OpDescriptor being queried 00550 Outputs: The string to show to the user 00551 Returns: The state of the OpSelectNextFrame operation 00552 Purpose: For finding the OpSelectNextFrame's state. 00553 Errors: - 00554 SeeAlso: - 00555 00556 ********************************************************************************************/ 00557 00558 OpState OpSelectNextFrame::GetState(String_256 * pUIDescription, OpDescriptor * pOpDesc) 00559 { 00560 //The frame movement controls on the GIF animation bar now work on frames only. 00561 00562 OpState OpSt; 00563 00564 #ifdef WEBSTER 00565 00566 // Is there a selected spread? 00567 Spread * pSpread = Document::GetSelectedSpread(); 00568 if (pSpread) 00569 { 00570 // yes, so check if there is an active layer 00571 Layer * pLayer = pSpread->FindActiveLayer(); 00572 // If there is an active layer and one following then we are not greyed 00573 Layer * pNextLayer = pLayer->FindNextLayer(); 00574 // The next layer should really be a frame layer but we cannot guarantee that but 00575 // it mustn't be a guide, a page background or a background layer. 00576 while ( pNextLayer && !pNextLayer->IsPseudoFrame()) 00577 { 00578 pNextLayer = pNextLayer->FindNextLayer(); 00579 } 00580 00581 if (pLayer && pNextLayer) 00582 { 00583 // Yes, so we are allowed to move to the previous one 00584 OpSt.Greyed = FALSE; 00585 } 00586 else 00587 { 00588 // No, so we are greyed 00589 OpSt.Greyed = TRUE; 00590 } 00591 } 00592 else 00593 { 00594 // No selected spread, so we are greyed 00595 OpSt.Greyed = TRUE; 00596 } 00597 00598 #else 00599 // Are we in frame mode. 00600 BOOL FrameMode = IsFrameMode(); 00601 00602 if(FrameMode) 00603 { 00604 // Is there a selected spread? 00605 Spread * pSpread = Document::GetSelectedSpread(); 00606 if (pSpread) 00607 { 00608 // yes, so check if there is an active layer 00609 Layer * pLayer = pSpread->FindActiveLayer(); 00610 // If there is an active layer and one following then we are not greyed 00611 Layer * pNextLayer = pLayer->FindNextLayer(); 00612 // The next layer should really be a frame layer but we cannot guarantee that but 00613 // it mustn't be a guide, a page background or a background layer. 00614 while ( pNextLayer && !pNextLayer->IsPseudoFrame()) 00615 { 00616 pNextLayer = pNextLayer->FindNextLayer(); 00617 } 00618 00619 if (pLayer && pNextLayer) 00620 { 00621 // Yes, so we are allowed to move to the previous one 00622 OpSt.Greyed = FALSE; 00623 } 00624 else 00625 { 00626 // No, so we are greyed 00627 OpSt.Greyed = TRUE; 00628 } 00629 } 00630 else 00631 { 00632 // No selected spread, so we are greyed 00633 OpSt.Greyed = TRUE; 00634 } 00635 } 00636 else 00637 { 00638 // The document is layer based, so we are greyed. 00639 OpSt.Greyed = TRUE; 00640 } 00641 #endif 00642 00643 return OpSt; 00644 } 00645 00646 /******************************************************************************************** 00647 00648 > void OpSelectNextFrame::Do(OpDescriptor * pOpDesc) 00649 00650 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00651 Created: 22/4/97 00652 Inputs: OpDescriptor (unused) 00653 Outputs: - 00654 Returns: - 00655 Purpose: Tries to select the next animation frame (i.e. layer). 00656 Errors: - 00657 SeeAlso: - 00658 00659 ********************************************************************************************/ 00660 00661 void OpSelectNextFrame::Do( OpDescriptor * pOpDesc ) 00662 { 00663 // Just find the background layer and then ask our baseclass to delete it for us 00664 // Is there a selected spread? 00665 Spread * pSpread = Document::GetSelectedSpread(); 00666 if (pSpread) 00667 { 00668 PORTNOTE("other", "Disabled BrowserPreviewOptions") 00669 #ifndef EXCLUDE_FROM_XARALX 00670 // Check that all visible layers are actually frame layers 00671 FrameSGallery::EnsureFrameLayerIntegrity(pSpread); 00672 #endif 00673 // yes, so find the next layer and try to move to it 00674 Layer * pLayer = pSpread->FindActiveLayer(); 00675 Layer * pNextLayer = NULL; 00676 if (pLayer) 00677 pNextLayer = pLayer->FindNextFrameLayer(); 00678 if (pNextLayer) 00679 { 00680 OpLayerGalParam Param(FRAME_SELECT, pSpread); 00681 Param.pLayer = pNextLayer; 00682 DoWithParam(pOpDesc, (OpParam*)&Param); 00683 } 00684 } 00685 00686 // End the operation, but we are calling DoWithParam() which we will assume does it for us. 00687 //End(); 00688 00689 return; 00690 } 00691 00692 /******************************************************************************************** 00693 // End of OpSelectNextFrame 00694 ********************************************************************************************/ 00695 00696 //------------------------------------------------------------------------------------------ 00697 // Methods for the OpCreateNewFrame 00698 //------------------------------------------------------------------------------------------ 00699 00700 /******************************************************************************************** 00701 00702 > OpState OpCreateNewFrame::GetState(String_256*, OpDescriptor*) 00703 00704 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00705 Created: 22/4/97 00706 Inputs: Name of the OpDescriptor being queried 00707 Outputs: The string to show to the user 00708 Returns: The state of the OpCreateNewFrame operation 00709 Purpose: For finding the OpCreateNewFrame's state. 00710 Errors: - 00711 SeeAlso: - 00712 00713 ********************************************************************************************/ 00714 00715 OpState OpCreateNewFrame::GetState(String_256 * pUIDescription, OpDescriptor * pOpDesc) 00716 { 00717 //The frame movement controls on the GIF animation bar now work on frames only. 00718 OpState OpSt; 00719 00720 #ifdef WEBSTER 00721 // Is there a selected spread? 00722 Spread * pSpread = Document::GetSelectedSpread(); 00723 if (pSpread) 00724 { 00725 // Yes, so we are allowed to move to the previous one 00726 OpSt.Greyed = FALSE; 00727 } 00728 else 00729 { 00730 // No selected spread, so we are greyed 00731 OpSt.Greyed = TRUE; 00732 } 00733 #else 00734 // Are we in frame mode. 00735 BOOL FrameMode = IsFrameMode(); 00736 00737 if(FrameMode) 00738 { 00739 // Is there a selected spread? 00740 Spread * pSpread = Document::GetSelectedSpread(); 00741 if (pSpread) 00742 { 00743 // Yes, so we are allowed to move to the previous one 00744 OpSt.Greyed = FALSE; 00745 } 00746 else 00747 { 00748 // No selected spread, so we are greyed 00749 OpSt.Greyed = TRUE; 00750 } 00751 } 00752 else 00753 { 00754 // The document is layer based, so we are greyed. 00755 OpSt.Greyed = TRUE; 00756 } 00757 #endif 00758 00759 return OpSt; 00760 } 00761 00762 /******************************************************************************************** 00763 00764 > void OpCreateNewFrame::Do(OpDescriptor * pOpDesc) 00765 00766 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00767 Created: 22/4/97 00768 Inputs: OpDescriptor (unused) 00769 Outputs: - 00770 Returns: - 00771 Purpose: Tries to create a new animation frame (i.e. layer). 00772 Errors: - 00773 SeeAlso: - 00774 00775 ********************************************************************************************/ 00776 00777 void OpCreateNewFrame::Do( OpDescriptor * pOpDesc ) 00778 { 00779 PORTNOTE("other", "Disabled BrowserPreviewOptions") 00780 #ifndef EXCLUDE_FROM_XARALX 00781 // Just find the background layer and then ask our baseclass to delete it for us 00782 // Is there a selected spread? 00783 Spread * pSpread = Document::GetSelectedSpread(); 00784 if (pSpread) 00785 { 00786 // Check that all visible layers are actually frame layers 00787 FrameSGallery::EnsureFrameLayerIntegrity(pSpread); 00788 // Use the spread as the context node 00789 OpLayerGalParam Param(FRAME_NEW, pSpread); 00790 Param.pLayer = NULL; 00791 Param.pContextNode = pSpread; 00792 Param.AttDir = LASTCHILD; 00793 // Set up the name that is going to be applied to the frame 00794 String_256 NewName = FrameSGallery::CreateUniqueLayerID(pSpread); 00795 //String_256 NewName(_R(IDS_DEFAULTFRAMENAME)); 00796 Param.Status.StringLayerID = NewName; 00797 DoWithParam(pOpDesc, (OpParam*)&Param); 00798 } 00799 00800 // End the operation, but we are calling DoWithParam() which we will assume does it for us. 00801 //End(); 00802 #endif 00803 00804 return; 00805 } 00806 00807 /******************************************************************************************** 00808 // End of OpCreateNewFrame 00809 ********************************************************************************************/ 00810 00811 //------------------------------------------------------------------------------------------ 00812 // Methods for the OpCopyFrame 00813 //------------------------------------------------------------------------------------------ 00814 00815 /******************************************************************************************** 00816 00817 > OpState OpCopyFrame::GetState(String_256*, OpDescriptor*) 00818 00819 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00820 Created: 22/4/97 00821 Inputs: Name of the OpDescriptor being queried 00822 Outputs: The string to show to the user 00823 Returns: The state of the OpCopyFrame operation 00824 Purpose: For finding the OpCopyFrame's state. 00825 Errors: - 00826 SeeAlso: - 00827 00828 ********************************************************************************************/ 00829 00830 OpState OpCopyFrame::GetState(String_256 * pUIDescription, OpDescriptor * pOpDesc) 00831 { 00832 //The frame movement controls on the GIF animation bar now work on frames only. 00833 OpState OpSt; 00834 00835 #ifdef WEBSTER 00836 // Is there a selected spread? 00837 Spread * pSpread = Document::GetSelectedSpread(); 00838 if (pSpread) 00839 { 00840 // yes, so check if there is an active layer 00841 Layer * pLayer = pSpread->FindActiveLayer(); 00842 // If there is an active layer then we are not greyed 00843 if (pLayer) 00844 { 00845 OpSt.Greyed = FALSE; 00846 } 00847 else 00848 { 00849 // No, so we are greyed 00850 OpSt.Greyed = TRUE; 00851 } 00852 } 00853 else 00854 { 00855 // No selected spread, so we are greyed 00856 OpSt.Greyed = TRUE; 00857 } 00858 #else 00859 // Are we in frame mode. 00860 BOOL FrameMode = IsFrameMode(); 00861 00862 if(FrameMode) 00863 { 00864 // Is there a selected spread? 00865 Spread * pSpread = Document::GetSelectedSpread(); 00866 if (pSpread) 00867 { 00868 // yes, so check if there is an active layer 00869 Layer * pLayer = pSpread->FindActiveLayer(); 00870 // If there is an active layer then we are not greyed 00871 if (pLayer) 00872 { 00873 OpSt.Greyed = FALSE; 00874 } 00875 else 00876 { 00877 // No, so we are greyed 00878 OpSt.Greyed = TRUE; 00879 } 00880 } 00881 else 00882 { 00883 // No selected spread, so we are greyed 00884 OpSt.Greyed = TRUE; 00885 } 00886 } 00887 else 00888 { 00889 // The document is layer based, so we are greyed. 00890 OpSt.Greyed = TRUE; 00891 } 00892 #endif 00893 00894 return OpSt; 00895 } 00896 00897 /******************************************************************************************** 00898 00899 > void OpCopyFrame::Do(OpDescriptor * pOpDesc) 00900 00901 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00902 Created: 22/4/97 00903 Inputs: OpDescriptor (unused) 00904 Outputs: - 00905 Returns: - 00906 Purpose: Tries to create a new frame by copying the present one. 00907 Errors: - 00908 SeeAlso: - 00909 00910 ********************************************************************************************/ 00911 00912 void OpCopyFrame::Do( OpDescriptor * pOpDesc ) 00913 { 00914 PORTNOTE("other", "Disabled FrameSGallery") 00915 #ifndef EXCLUDE_FROM_XARALX 00916 // Just find the background layer and then ask our baseclass to delete it for us 00917 // Is there a selected spread? 00918 Spread * pSpread = Document::GetSelectedSpread(); 00919 if (pSpread) 00920 { 00921 // Check that all visible layers are actually frame layers 00922 FrameSGallery::EnsureFrameLayerIntegrity(pSpread); 00923 00924 // yes, so check that there is a presently active layer and try to copy it 00925 // Use the spread as the context node 00926 Layer * pLayer = pSpread->FindActiveLayer(); 00927 if (pLayer) 00928 { 00929 OpLayerGalParam Param(FRAME_COPY, pSpread); 00930 Param.pLayer = pLayer; 00931 Param.pContextNode = pSpread; 00932 Param.AttDir = LASTCHILD; 00933 // Set up the name that is going to be applied to the frame 00934 String_256 NewName = FrameSGallery::CreateUniqueLayerID(pSpread); 00935 //String_256 NewName(_R(IDS_DEFAULTFRAMENAME)); 00936 Param.Status.StringLayerID = NewName; 00937 DoWithParam(pOpDesc, (OpParam*)&Param); 00938 } 00939 } 00940 00941 // End the operation, but we are calling DoWithParam() which we will assume does it for us. 00942 //End(); 00943 #endif 00944 return; 00945 } 00946 00947 /******************************************************************************************** 00948 // End of OpCopyFrame 00949 ********************************************************************************************/ 00950 00951 //------------------------------------------------------------------------------------------ 00952 // Methods for the OpDeleteFrame 00953 //------------------------------------------------------------------------------------------ 00954 00955 /******************************************************************************************** 00956 00957 > OpState OpDeleteFrame::GetState(String_256*, OpDescriptor*) 00958 00959 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 00960 Created: 23/4/97 00961 Inputs: Name of the OpDescriptor being queried 00962 Outputs: The string to show to the user 00963 Returns: The state of the OpDeleteFrame operation 00964 Purpose: For finding the OpDeleteFrame's state. 00965 Errors: - 00966 SeeAlso: - 00967 00968 ********************************************************************************************/ 00969 00970 OpState OpDeleteFrame::GetState(String_256 * pUIDescription, OpDescriptor * pOpDesc) 00971 { 00972 //The frame movement controls on the GIF animation bar now work on frames only. 00973 OpState OpSt; 00974 00975 #ifdef WEBSTER 00976 // Is there a selected spread? 00977 Spread * pSpread = Document::GetSelectedSpread(); 00978 if (pSpread) 00979 { 00980 // yes, so check if there is an active layer 00981 Layer * pLayer = pSpread->FindActiveLayer(); 00982 00983 // Get ptr's to the next and previous frame layers. 00984 Layer* pNextLayer = pLayer->FindNextFrameLayer(); 00985 Layer* pPrevLayer = pLayer->FindPrevFrameLayer(); 00986 00987 // If there is an active layer and a previous/next layer then we are not greyed. 00988 if ( pLayer && (pPrevLayer || pNextLayer) ) 00989 { 00990 OpSt.Greyed = FALSE; 00991 } 00992 else 00993 { 00994 // No, so we are greyed 00995 OpSt.Greyed = TRUE; 00996 } 00997 } 00998 else 00999 { 01000 // No selected spread, so we are greyed 01001 OpSt.Greyed = TRUE; 01002 } 01003 #else 01004 // Are we in frame mode. 01005 BOOL FrameMode = IsFrameMode(); 01006 01007 if(FrameMode) 01008 { 01009 // Is there a selected spread? 01010 Spread * pSpread = Document::GetSelectedSpread(); 01011 if (pSpread) 01012 { 01013 // yes, so check if there is an active layer 01014 Layer * pLayer = pSpread->FindActiveLayer(); 01015 01016 // Get ptr's to the next and previous frame layers. 01017 Layer* pNextLayer = pLayer->FindNextFrameLayer(); 01018 Layer* pPrevLayer = pLayer->FindPrevFrameLayer(); 01019 01020 // If there is an active layer and a previous/next layer then we are not greyed. 01021 if (pLayer && (pPrevLayer || pNextLayer) ) 01022 { 01023 OpSt.Greyed = FALSE; 01024 } 01025 else 01026 { 01027 // No, so we are greyed 01028 OpSt.Greyed = TRUE; 01029 } 01030 } 01031 else 01032 { 01033 // No selected spread, so we are greyed 01034 OpSt.Greyed = TRUE; 01035 } 01036 } 01037 else 01038 { 01039 // We are in layer mode, so we are greyed. 01040 OpSt.Greyed = TRUE; 01041 } 01042 #endif 01043 01044 return OpSt; 01045 } 01046 01047 /******************************************************************************************** 01048 01049 > void OpDeleteFrame::Do(OpDescriptor * pOpDesc) 01050 01051 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 01052 Created: 23/4/97 01053 Inputs: OpDescriptor (unused) 01054 Outputs: - 01055 Returns: - 01056 Purpose: Tries to create a new frame by copying the present one. 01057 Errors: - 01058 SeeAlso: - 01059 01060 ********************************************************************************************/ 01061 01062 void OpDeleteFrame::Do( OpDescriptor * pOpDesc ) 01063 { 01064 // Just find the background layer and then ask our baseclass to delete it for us 01065 // Is there a selected spread? 01066 Spread * pSpread = Document::GetSelectedSpread(); 01067 if (pSpread) 01068 { 01069 PORTNOTE("other", "Disabled FrameSGallery") 01070 #ifndef EXCLUDE_FROM_XARALX 01071 // Check that all visible layers are actually frame layers 01072 FrameSGallery::EnsureFrameLayerIntegrity(pSpread); 01073 #endif 01074 // yes, so check that there is a presently active layer and try to delete it 01075 Layer * pLayer = pSpread->FindActiveLayer(); 01076 if (pLayer) 01077 { 01078 OpLayerGalParam Param(FRAME_DELETE, pSpread); 01079 Param.pLayer = pLayer; 01080 DoWithParam(pOpDesc, (OpParam*)&Param); 01081 } 01082 } 01083 01084 // End the operation, but we are calling DoWithParam() which we will assume does it for us. 01085 //End(); 01086 01087 return; 01088 } 01089 01090 /******************************************************************************************** 01091 // End of OpDeleteFrame 01092 ********************************************************************************************/ 01093 01094 //------------------------------------------------------------------------------------------ 01095 // Methods for the OpFrameProperties 01096 //------------------------------------------------------------------------------------------ 01097 01098 /******************************************************************************************** 01099 01100 > OpState OpFrameProperties::GetState(String_256*, OpDescriptor*) 01101 01102 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 01103 Created: 29/4/97 01104 Inputs: Name of the OpDescriptor being queried 01105 Outputs: The string to show to the user 01106 Returns: The state of the OpFrameProperties operation 01107 Purpose: For finding the OpFrameProperties's state. 01108 Errors: - 01109 SeeAlso: - 01110 01111 ********************************************************************************************/ 01112 01113 OpState OpFrameProperties::GetState(String_256 * pUIDescription, OpDescriptor * pOpDesc) 01114 { 01115 //The frame movement controls on the GIF animation bar now work on frames only. 01116 OpState OpSt; 01117 01118 #ifdef WEBSTER 01119 // Is there a selected spread? 01120 Spread * pSpread = Document::GetSelectedSpread(); 01121 if (pSpread) 01122 { 01123 // yes, so check if there is an active layer 01124 Layer * pLayer = pSpread->FindActiveLayer(); 01125 // If there is an active layer and one following then we are not greyed 01126 if (pLayer) 01127 { 01128 // Yes, so we are allowed to move to the previous one 01129 OpSt.Greyed = FALSE; 01130 } 01131 else 01132 { 01133 // No, so we are greyed 01134 OpSt.Greyed = TRUE; 01135 } 01136 } 01137 else 01138 { 01139 // No selected spread, so we are greyed 01140 OpSt.Greyed = TRUE; 01141 } 01142 #else 01143 01144 BOOL FrameMode = FALSE; // Flag to determine the document mode. 01145 01146 // Is there a selected spread? 01147 Spread* pSpread = Document::GetSelectedSpread(); 01148 01149 // Ensure a valid spread ptr. 01150 if(pSpread) 01151 { 01152 // Are there any frame layers? 01153 Layer* pFrameLayer = pSpread->FindFirstFrameLayer(); 01154 01155 //If a frame layer exists, then this is an animation doc. 01156 if (pFrameLayer) 01157 FrameMode = TRUE; 01158 } 01159 01160 if(FrameMode) 01161 { 01162 if (pSpread) 01163 { 01164 // yes, so check if there is an active layer 01165 Layer * pLayer = pSpread->FindActiveLayer(); 01166 // If there is an active layer and one following then we are not greyed 01167 if (pLayer) 01168 // Yes, so we are allowed to move to the previous one 01169 OpSt.Greyed = FALSE; 01170 else 01171 // No, so we are greyed 01172 OpSt.Greyed = TRUE; 01173 } 01174 else 01175 // No selected spread, so we are greyed 01176 OpSt.Greyed = TRUE; 01177 } 01178 else 01179 { 01180 // The document is layer based, so we are greyed. 01181 OpSt.Greyed = TRUE; 01182 } 01183 #endif 01184 01185 return OpSt; 01186 } 01187 01188 /******************************************************************************************** 01189 01190 > void OpFrameProperties::Do(OpDescriptor * pOpDesc) 01191 01192 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 01193 Created: 29/4/97 01194 Inputs: OpDescriptor (unused) 01195 Outputs: - 01196 Returns: - 01197 Purpose: Tries to set some new animation properties. 01198 Errors: - 01199 SeeAlso: - 01200 01201 ********************************************************************************************/ 01202 01203 void OpFrameProperties::Do( OpDescriptor * pOpDesc ) 01204 { 01205 // Just find the background layer and then ask our baseclass to delete it for us 01206 // Is there a selected spread? 01207 Spread * pSpread = Document::GetSelectedSpread(); 01208 if (pSpread) 01209 { 01210 PORTNOTE("other", "Disabled FrameSGallery") 01211 #ifndef EXCLUDE_FROM_XARALX 01212 // Check that all visible layers are actually frame layers 01213 FrameSGallery::EnsureFrameLayerIntegrity(pSpread); 01214 #endif 01215 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_GIFANIMPROPERTYTABS); 01216 01217 if (pOpDesc != NULL) 01218 { 01219 // Select the "Frame properties tab". 01220 GIFAnimationPropertyTabsDlg::SetPageToOpen(GIFAnimationPropertyTabs::FramePropertiesTabNumber); 01221 01222 String_256 Str; 01223 OpState State = pOpDesc->GetOpsState(&Str); 01224 if (!State.Greyed) 01225 pOpDesc->Invoke(); 01226 else 01227 { 01228 GIFAnimationPropertyTabs * pTabHandler = GIFAnimationPropertyTabsDlg::GetGIFAnimationPropertiesTabs(); 01229 if (pTabHandler) 01230 { 01231 DialogTabOp* pDlg = pTabHandler->GetTabbedDlg(); 01232 if (pDlg != NULL) 01233 pDlg->Open(); 01234 } 01235 } 01236 } 01237 } 01238 01239 // End the operation 01240 End(); 01241 01242 return; 01243 } 01244 01245 /******************************************************************************************** 01246 // End of OpFrameProperties 01247 ********************************************************************************************/ 01248 01249 //------------------------------------------------------------------------------------------ 01250 // Methods for the OpAnimationProperties 01251 //------------------------------------------------------------------------------------------ 01252 01253 /******************************************************************************************** 01254 01255 > OpState OpAnimationProperties::GetState(String_256*, OpDescriptor*) 01256 01257 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 01258 Created: 29/4/97 01259 Inputs: Name of the OpDescriptor being queried 01260 Outputs: The string to show to the user 01261 Returns: The state of the OpAnimationProperties operation 01262 Purpose: For finding the OpAnimationProperties's state. 01263 Errors: - 01264 SeeAlso: - 01265 01266 ********************************************************************************************/ 01267 01268 OpState OpAnimationProperties::GetState(String_256 * pUIDescription, OpDescriptor * pOpDesc) 01269 { 01270 //The frame movement controls on the GIF animation bar now work on frames only. 01271 OpState OpSt; 01272 01273 #ifdef WBSTER 01274 // Is there a selected spread? 01275 Spread * pSpread = Document::GetSelectedSpread(); 01276 if (pSpread) 01277 { 01278 // yes, so check if there is an active layer 01279 Layer * pLayer = pSpread->FindActiveLayer(); 01280 // If there is an active layer and one following then we are not greyed 01281 if (pLayer) 01282 { 01283 // Yes, so we are allowed to move to the previous one 01284 OpSt.Greyed = FALSE; 01285 } 01286 else 01287 { 01288 // No, so we are greyed 01289 OpSt.Greyed = TRUE; 01290 } 01291 } 01292 else 01293 { 01294 // No selected spread, so we are greyed 01295 OpSt.Greyed = TRUE; 01296 } 01297 #else 01298 01299 BOOL FrameMode = FALSE; // Flag to determine the document mode. 01300 01301 // Is there a selected spread? 01302 Spread * pSpread = Document::GetSelectedSpread(); 01303 01304 // Ensure a valid spread ptr. 01305 if(pSpread) 01306 { 01307 // Are there any frame layers? 01308 Layer* pFrameLayer = pSpread->FindFirstFrameLayer(); 01309 01310 //If a frame layer exists, then this is an animation doc. 01311 if (pFrameLayer) 01312 FrameMode = TRUE; 01313 } 01314 01315 if(FrameMode) 01316 { 01317 if (pSpread) 01318 { 01319 // yes, so check if there is an active layer 01320 Layer * pLayer = pSpread->FindActiveLayer(); 01321 01322 // If there is an active layer and one following, then we are not greyed. 01323 if (pLayer) 01324 { 01325 // Yes, so we are allowed to move to the previous one