opimgset.cpp

Go to the documentation of this file.
00001 // $Id: opimgset.cpp 1357 2006-06-25 11:31:45Z 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 // OpImgSet - Ops for imagesetting options
00099 
00100 
00101 #include "camtypes.h"
00102 
00103 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 #include "camframe.h"
00105 //#include "attrmgr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 //#include "barsdlgs.h"
00107 #include "colcontx.h"
00108 #include "colormgr.h"
00109 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00110 #include "isetattr.h"
00111 //#include "isetres.h"
00112 //#include "jason.h"
00113 #include "menuops.h"
00114 #include "opimgset.h"
00115 #include "progress.h"
00116 //#include "simon.h"            // for _R(IDS_NO_OBJECTS_SELECTED)
00117 //#include "xaracms.h"
00118 //#include "gerry.h"
00119 
00120 
00121 CC_IMPLEMENT_DYNCREATE(OpShowPrinterColours, Operation)
00122 //CC_IMPLEMENT_DYNCREATE(OpToggleCompositePreview, Operation)
00123 //CC_IMPLEMENT_DYNCREATE(OpToggleCyanPreview, Operation)
00124 //CC_IMPLEMENT_DYNCREATE(OpToggleMagentaPreview, Operation)
00125 //CC_IMPLEMENT_DYNCREATE(OpToggleYellowPreview, Operation)
00126 //CC_IMPLEMENT_DYNCREATE(OpToggleKeyPreview, Operation)
00127 //CC_IMPLEMENT_DYNCREATE(OpToggleSpotPreview, Operation)
00128 //CC_IMPLEMENT_DYNCREATE(OpToggleMonoPlatePreview, Operation)
00129 CC_IMPLEMENT_DYNCREATE(OpOverprintLine, SelOperation)
00130 CC_IMPLEMENT_DYNCREATE(OpOverprintFill, SelOperation)
00131 CC_IMPLEMENT_DYNCREATE(OpPrintOnAllPlates, SelOperation)
00132 
00133 
00134 #define new CAM_DEBUG_NEW
00135 
00136 
00137 
00138 /*******************************************************************
00139 
00140 >   BOOL ::InitImagesettingOps(void)
00141 
00142     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00143     Created:    24/7/96
00144 
00145     Purpose:    Centralised initialisation of all the imagesetting
00146                 Ops in this file (opimgset.cpp).
00147                 Called from ColourManager::Init()
00148 
00149 *******************************************************************/
00150 
00151 BOOL InitImagesettingOps(void)
00152 {
00153     if (!OpShowPrinterColours::Init())
00154         return(FALSE);
00155 #if FALSE
00156     if (!OpToggleCompositePreview::Init())
00157         return(FALSE);
00158 
00159     if (!OpToggleCyanPreview::Init())
00160         return(FALSE);
00161 
00162     if (!OpToggleMagentaPreview::Init())
00163         return(FALSE);
00164 
00165     if (!OpToggleYellowPreview::Init())
00166         return(FALSE);
00167 
00168     if (!OpToggleKeyPreview::Init())
00169         return(FALSE);
00170 
00171     if (!OpToggleSpotPreview::Init())
00172         return(FALSE);
00173 
00174     if (!OpToggleMonoPlatePreview::Init())
00175         return(FALSE);
00176 #endif
00177     if (!OpOverprintLine::Init())
00178         return(FALSE);
00179 
00180     if (!OpOverprintFill::Init())
00181         return(FALSE);
00182 
00183     if (!OpPrintOnAllPlates::Init())
00184         return(FALSE);
00185 
00186     // Finally, register an OpDescriptor for the "Imagesetting" Submenu item,
00187     // which just connects up to DummyOp (see menuops.cpp)
00188     return(Operation::RegisterOpDescriptor(0,
00189                                 _R(IDS_IMAGESETTING),
00190                                 CC_RUNTIME_CLASS(DummyOp),
00191                                 OPTOKEN_IMAGESETTING,
00192                                 DummyOp::GetState,
00193                                 0,  /* help ID */
00194                                 0,  /* bubble help ID */
00195                                 0,  /* resource ID */
00196                                 0   /* control ID */
00197                             ));
00198 }
00199 
00200 IndexedColour* FindWhichSpot(INT32 WhichSpot)
00201 {
00202     INT32 Count = 0;
00203     
00204     // Find the required "live" spot colour in the colour list
00205     ColourList *ColList = Document::GetSelected()->GetIndexedColours();
00206     IndexedColour *SpotColour = (IndexedColour *) ColList->GetHead();
00207 
00208     while (SpotColour != NULL)
00209     {
00210         if (!SpotColour->IsDeleted() && SpotColour->GetType() == COLOURTYPE_SPOT)
00211         {
00212             Count++;
00213         }
00214 
00215         if (Count == WhichSpot)
00216             break;
00217 
00218         SpotColour = (IndexedColour *) ColList->GetNext(SpotColour);
00219     }
00220 
00221     return(SpotColour);
00222 }
00223 
00224 
00225 void SetNewColourPlate(ColourPlateType NewType, INT32 WhichToggle, INT32 WhichSpot)
00226     // SetNewColourPlate Jason 22/5/96
00227     // Sets a new colour separation mode for the selected view
00228     //   NewType     -  if WhichToggle == 0, sets the new plate type
00229     //   WhichToggle -  0 = just set the type;
00230     //                  1 = just toggle monochrome mode,
00231     //                  2 = just toggle invert mode
00232     //                  3 = just toggle overprint mode
00233     //   WhichSpot   -  Number of spot plate required (1-based)
00234     //
00235     // If a SPOT plate is desired, the colour list will be searched until 
00236     // the required spot colour is found
00237 {
00238     // For convenience in Jason's debug cases
00239     View *SelView = DocView::GetSelected();
00240     if (SelView == NULL)
00241         return;
00242 
00243     // Get the currently active ColourPlate descriptor for the selected view (may be NULL)
00244     ColourPlate *SepDescriptor = SelView->GetColourPlate();
00245 
00246     BOOL Mono   = (SepDescriptor != NULL) ? SepDescriptor->IsMonochrome()  : FALSE;
00247     BOOL Negate = (SepDescriptor != NULL) ? SepDescriptor->IsNegative()    : FALSE;
00248     BOOL Overprint = (SepDescriptor != NULL) ? SepDescriptor->Overprints() : FALSE;
00249 
00250     switch(WhichToggle)
00251     {
00252         case 0:
00253             // Nothing to do here
00254             break;
00255 
00256         case 1:
00257             Mono = (Mono) ? FALSE : TRUE;
00258             NewType = (SepDescriptor != NULL) ? SepDescriptor->GetType() : COLOURPLATE_NONE;
00259             break;
00260 
00261         case 2:
00262             Negate = (Negate) ? FALSE : TRUE;
00263             NewType = (SepDescriptor != NULL) ? SepDescriptor->GetType() : COLOURPLATE_NONE;
00264             break;
00265 
00266         case 3:
00267             Overprint = (Overprint) ? FALSE : TRUE;
00268             NewType = (SepDescriptor != NULL) ? SepDescriptor->GetType() : COLOURPLATE_NONE;
00269             break;
00270     }
00271 
00272     if (SepDescriptor && SepDescriptor->GetType() == COLOURPLATE_SPOT)
00273     {
00274         if (WhichSpot < 1)
00275         {
00276             IndexedColour *pSpotCol = SepDescriptor->GetSpotColour();
00277             if (pSpotCol)
00278             {
00279                 // Count the spot colours until we find the required one
00280                 ColourList* pColList = Document::GetSelected()->GetIndexedColours();
00281                 IndexedColour* pCol = (IndexedColour*) pColList->GetHead();
00282                 INT32 Count = 0;
00283 
00284                 while (pCol != NULL)
00285                 {
00286                     if (pCol->GetType() == COLOURTYPE_SPOT && !pCol->IsDeleted())
00287                     {
00288                         Count++;
00289                     }
00290 
00291                     if (pCol == pSpotCol)
00292                         break;
00293 
00294                     pCol = (IndexedColour*) pColList->GetNext(pCol);
00295                 }
00296 
00297                 if (pCol && Count > 0)
00298                     WhichSpot = Count;
00299             }
00300         }
00301     }
00302 
00303     // Make sure we blank this
00304     SepDescriptor = NULL;
00305 
00306     // Try to create a spot plate
00307     if (NewType == COLOURPLATE_SPOT)
00308     {
00309         if (WhichSpot < 1)
00310         {
00311             ERROR3("Spot plate must be greater than 0");
00312             return;
00313         }
00314 
00315         IndexedColour *SpotColour = FindWhichSpot(WhichSpot);
00316 
00317         // If we found a spot colour, create the plate
00318         if (SpotColour != NULL)
00319             SepDescriptor = new ColourPlate(SpotColour, Mono, Negate);
00320 
00321         // Can't do it - no memory or no spots
00322         if (SepDescriptor == NULL)
00323         {
00324             ERROR3("Can't create spot plate - requested spot colour does not exist");
00325             return;
00326         }
00327     }
00328 
00329     if (NewType == COLOURPLATE_COMPOSITE)
00330     {
00331         Mono = FALSE;
00332         Negate = FALSE;
00333         Overprint = FALSE;
00334     }
00335 
00336     if (SepDescriptor == NULL)
00337         SepDescriptor = new ColourPlate(NewType, Mono, Negate);
00338 
00339     if (SepDescriptor != NULL)
00340         SepDescriptor->SetOverprint(Overprint);
00341 
00342     SelView->SetColourPlate(SepDescriptor);     // This makes a copy of the plate
00343     delete SepDescriptor;
00344 
00345     // Redraw anything affected by the change
00346     // Removed by Gerry as it already happens in SetColourPlate above
00347 //  ColourManager::SelViewContextHasChanged();
00348 }
00349 
00350 
00351 
00352 
00353 /*******************************************************************
00354 
00355 >   void OpShowPrinterColours::Do(OpDescriptor *pOpDesc)
00356 
00357     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00358     Created:    8/12/2003
00359 
00360     Purpose:    Does a "show printer colours" op
00361 
00362 *******************************************************************/
00363 
00364 void OpShowPrinterColours::Do(OpDescriptor *OpDesc)
00365 {
00366     if (DocView::GetSelected() != NULL &&               // A view to toggle!
00367         GetApplication()->GetCMSManager() != NULL)      // and CMS
00368     {
00369         String Token = OpDesc->Token;
00370         INT32 WhichToggle = 0;
00371 //      INT32 WhichSpot = 0;
00372         INT32 TokenSpot = 0;
00373         ColourPlateType TokenPlate = COLOURPLATE_NONE;
00374         IndexedColour* pSpotColour = NULL;
00375         IndexedColour* pTokenColour = NULL;
00376         String_16 TempString;
00377         Token.Left(&TempString, 11);
00378         if (Token == String(OPTOKEN_COMPOSITEPREVIEW))
00379             TokenPlate = COLOURPLATE_COMPOSITE;
00380         else if (Token == String(OPTOKEN_CYANPREVIEW))
00381             TokenPlate = COLOURPLATE_CYAN;
00382         else if (Token == String(OPTOKEN_MAGENTAPREVIEW))
00383             TokenPlate = COLOURPLATE_MAGENTA;
00384         else if (Token == String(OPTOKEN_YELLOWPREVIEW))
00385             TokenPlate = COLOURPLATE_YELLOW;
00386         else if (Token == String(OPTOKEN_KEYPREVIEW))
00387             TokenPlate = COLOURPLATE_KEY;
00388         else if (TempString == String(OPTOKEN_SPOTPREVIEWBASE))
00389         {
00390             TokenSpot = (Token[11] - _T('0'));
00391             if (TokenSpot > 8)
00392                 TokenSpot = -1;
00393             pTokenColour = FindWhichSpot(TokenSpot);
00394             TokenPlate = COLOURPLATE_SPOT;
00395         }
00396         else if (Token == String(OPTOKEN_MONOPLATEPREVIEW))
00397             WhichToggle = 1;
00398         
00399         // Determine what mode we are in and check against which OpDescriptor
00400         ColourPlateType PlateType = COLOURPLATE_NONE;
00401         ColourContext *cc = DocView::GetSelected()->GetColourContext(COLOURMODEL_RGBT);
00402         if (cc && cc->GetColourPlate())
00403         {
00404             PlateType = cc->GetColourPlate()->GetType();
00405 
00406             if (PlateType == COLOURPLATE_SPOT)
00407             {
00408                 pSpotColour = cc->GetColourPlate()->GetSpotColour();
00409                 if (pSpotColour != pTokenColour)
00410                     PlateType = COLOURPLATE_NONE;
00411             }
00412         }
00413 
00414         if (PlateType == TokenPlate ||
00415             (Token == String(OPTOKEN_CANCELPREVIEW) && PlateType != COLOURPLATE_NONE))
00416         {
00417             // To restore normal view, we just remove any attached ColourPlate from the view
00418             DocView::GetSelected()->SetColourPlate(NULL);
00419             ColourManager::SelViewContextHasChanged();  // Redraw everything which is affected
00420 PORTNOTE("printing", "Disabled SetPrinterColourStatus")
00421 #ifndef EXCLUDE_FROM_XARALX
00422             CCamFrame* pMainFrame = CCamFrame::GetMainFrame();
00423             if (pMainFrame)
00424                 pMainFrame->SetPrinterColourStatus(FALSE);
00425 #endif
00426         }
00427         else
00428         {
00429             SetNewColourPlate(TokenPlate, WhichToggle, TokenSpot);
00430 
00431             // To avoid a huge delay the next time a bitmap is rendered in this composite view,
00432             // we get XaraCMS to cache its lookup table now. If no deep bitmaps are rendered,
00433             // this is wasteful, but better than getting a several-second delay part-way
00434             // through the next document redraw.
00435 PORTNOTE("printing", "Disabled SetPrinterColourStatus")
00436 #ifndef EXCLUDE_FROM_XARALX
00437             Progress::Start();      // Fail to show an hourglass (this doesn't work for some reason)
00438             DWORD *Dummy = GetApplication()->GetCMSManager()->GetPaperViewTable();
00439             Progress::Stop();
00440             CCamFrame* pMainFrame = CCamFrame::GetMainFrame();
00441             if (pMainFrame)
00442             {
00443                 String_256 sPlateName;
00444 
00445                 switch (TokenPlate)
00446                 {
00447                 case COLOURPLATE_CYAN:
00448                     sPlateName.Load(_R(IDS_PLATENAME_CYAN));
00449                     break;
00450                 case COLOURPLATE_MAGENTA:
00451                     sPlateName.Load(_R(IDS_PLATENAME_MAGENTA));
00452                     break;
00453                 case COLOURPLATE_YELLOW:
00454                     sPlateName.Load(_R(IDS_PLATENAME_YELLOW));
00455                     break;
00456                 case COLOURPLATE_KEY:
00457                     sPlateName.Load(_R(IDS_PLATENAME_KEY));
00458                     break;
00459                 case COLOURPLATE_COMPOSITE:
00460                     sPlateName.Load(_R(IDS_PLATENAME_COMPOSITE));
00461                     break;
00462                 case COLOURPLATE_SPOT:
00463                     if (pTokenColour)
00464                         sPlateName = *(pTokenColour->GetName());
00465                     break;
00466                 }
00467                 
00468                 pMainFrame->SetPrinterColourStatus(TRUE, &sPlateName);
00469             }
00470 #endif
00471         }
00472     }
00473 
00474     End();
00475 }
00476 
00477 
00478 
00479 /*******************************************************************
00480 
00481 >   static BOOL OpShowPrinterColours::Init()
00482 
00483     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00484     Created:    7/6/96
00485 
00486     Purpose:    Registers this Op
00487 
00488 *******************************************************************/
00489 
00490 BOOL OpShowPrinterColours::Init()
00491 {
00492 
00493     if (!Operation::RegisterOpDescriptor(
00494                         0,
00495                         _R(IDS_TOGGLENORMALPREVIEW),
00496                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00497                         OPTOKEN_CANCELPREVIEW,
00498                         OpShowPrinterColours::GetState,
00499                         _R(IDS_TOGGLENORMALHELP),           // Help string ID
00500                         _R(IDS_TOGGLENORMALBBL)         // Bubble help ID
00501                         ))
00502         return(FALSE);
00503 
00504     if (!Operation::RegisterOpDescriptor(
00505                         0,
00506                         _R(IDS_TOGGLECOMPPREVIEW),
00507                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00508                         OPTOKEN_SHOWPRINTERCOLOURS,
00509                         OpShowPrinterColours::GetState,
00510                         _R(IDS_TOGGLECOMPHELP),         // Help string ID
00511                         _R(IDS_TOGGLECOMPBBL)           // Bubble help ID
00512                         ))
00513         return(FALSE);
00514 
00515     if (!Operation::RegisterOpDescriptor(
00516                         0,
00517                         _R(IDS_TOGGLESHOWPRINTCOLS),
00518                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00519                         OPTOKEN_COMPOSITEPREVIEW,
00520                         OpShowPrinterColours::GetState,
00521                         _R(IDS_TOGGLESHOWPRINTCOLSHELP),            // Help string ID
00522                         _R(IDS_TOGGLESHOWPRINTCOLSBBL),         // Bubble help ID
00523                         _R(IDD_BARCONTROLSTORE),        // resource ID
00524                         _R(IDC_COMPOSITEPREVIEW),       // control ID
00525                         SYSTEMBAR_UTILITIES         // Bar ID
00526                         ))
00527         return(FALSE);
00528 
00529     if (!Operation::RegisterOpDescriptor(
00530                         0,
00531                         _R(IDS_TOGGLECYANPREVIEW),
00532                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00533                         OPTOKEN_CYANPREVIEW,
00534                         OpShowPrinterColours::GetState,
00535                         _R(IDS_TOGGLECYANHELP),         // Help string ID
00536                         _R(IDS_TOGGLECYANBBL)           // Bubble help ID
00537                         ))
00538         return(FALSE);
00539 
00540     if (!Operation::RegisterOpDescriptor(
00541                         0,
00542                         _R(IDS_TOGGLEMAGENTAPREVIEW),
00543                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00544                         OPTOKEN_MAGENTAPREVIEW,
00545                         OpShowPrinterColours::GetState,
00546                         _R(IDS_TOGGLEMAGENTAHELP),          // Help string ID
00547                         _R(IDS_TOGGLEMAGENTABBL)            // Bubble help ID
00548                         ))
00549         return(FALSE);
00550 
00551     if (!Operation::RegisterOpDescriptor(
00552                         0,
00553                         _R(IDS_TOGGLEYELLOWPREVIEW),
00554                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00555                         OPTOKEN_YELLOWPREVIEW,
00556                         OpShowPrinterColours::GetState,
00557                         _R(IDS_TOGGLEYELLOWHELP),           // Help string ID
00558                         _R(IDS_TOGGLEYELLOWBBL)         // Bubble help ID
00559                         ))
00560         return(FALSE);
00561 
00562     if (!Operation::RegisterOpDescriptor(
00563                         0,
00564                         _R(IDS_TOGGLEKEYPREVIEW),
00565                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00566                         OPTOKEN_KEYPREVIEW,
00567                         OpShowPrinterColours::GetState,
00568                         _R(IDS_TOGGLEKEYHELP),          // Help string ID
00569                         _R(IDS_TOGGLEKEYBBL)            // Bubble help ID
00570                         ))
00571         return(FALSE);
00572 
00573     if (!Operation::RegisterOpDescriptor(
00574                         0,
00575                         _R(IDS_TOGGLEMONOPLATEPREVIEW),
00576                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00577                         OPTOKEN_MONOPLATEPREVIEW,
00578                         OpShowPrinterColours::GetState,
00579                         _R(IDS_TOGGLEMONOPLATEHELP),            // Help string ID
00580                         _R(IDS_TOGGLEMONOPLATEBBL)          // Bubble help ID
00581                         ))
00582         return(FALSE);
00583 
00584     if (!Operation::RegisterOpDescriptor(
00585                         0,
00586                         _R(IDS_TOGGLESPOTPREVIEW),
00587                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00588                         OPTOKEN_SPOTPREVIEW1,
00589                         OpShowPrinterColours::GetState,
00590                         _R(IDS_TOGGLESPOTHELP),         // Help string ID
00591                         _R(IDS_TOGGLESPOTBBL)           // Bubble help ID
00592                         ))
00593         return(FALSE);
00594 
00595     if (!Operation::RegisterOpDescriptor(
00596                         0,
00597                         _R(IDS_TOGGLESPOTPREVIEW),
00598                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00599                         OPTOKEN_SPOTPREVIEW2,
00600                         OpShowPrinterColours::GetState,
00601                         _R(IDS_TOGGLESPOTHELP),         // Help string ID
00602                         _R(IDS_TOGGLESPOTBBL)           // Bubble help ID
00603                         ))
00604         return(FALSE);
00605 
00606     if (!Operation::RegisterOpDescriptor(
00607                         0,
00608                         _R(IDS_TOGGLESPOTPREVIEW),
00609                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00610                         OPTOKEN_SPOTPREVIEW3,
00611                         OpShowPrinterColours::GetState,
00612                         _R(IDS_TOGGLESPOTHELP),         // Help string ID
00613                         _R(IDS_TOGGLESPOTBBL)           // Bubble help ID
00614                         ))
00615         return(FALSE);
00616 
00617     if (!Operation::RegisterOpDescriptor(
00618                         0,
00619                         _R(IDS_TOGGLESPOTPREVIEW),
00620                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00621                         OPTOKEN_SPOTPREVIEW4,
00622                         OpShowPrinterColours::GetState,
00623                         _R(IDS_TOGGLESPOTHELP),         // Help string ID
00624                         _R(IDS_TOGGLESPOTBBL)           // Bubble help ID
00625                         ))
00626         return(FALSE);
00627 
00628     if (!Operation::RegisterOpDescriptor(
00629                         0,
00630                         _R(IDS_TOGGLESPOTPREVIEW),
00631                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00632                         OPTOKEN_SPOTPREVIEW5,
00633                         OpShowPrinterColours::GetState,
00634                         _R(IDS_TOGGLESPOTHELP),         // Help string ID
00635                         _R(IDS_TOGGLESPOTBBL)           // Bubble help ID
00636                         ))
00637         return(FALSE);
00638 
00639     if (!Operation::RegisterOpDescriptor(
00640                         0,
00641                         _R(IDS_TOGGLESPOTPREVIEW),
00642                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00643                         OPTOKEN_SPOTPREVIEW6,
00644                         OpShowPrinterColours::GetState,
00645                         _R(IDS_TOGGLESPOTHELP),         // Help string ID
00646                         _R(IDS_TOGGLESPOTBBL)           // Bubble help ID
00647                         ))
00648         return(FALSE);
00649 
00650     if (!Operation::RegisterOpDescriptor(
00651                         0,
00652                         _R(IDS_TOGGLESPOTPREVIEW),
00653                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00654                         OPTOKEN_SPOTPREVIEW7,
00655                         OpShowPrinterColours::GetState,
00656                         _R(IDS_TOGGLESPOTHELP),         // Help string ID
00657                         _R(IDS_TOGGLESPOTBBL)           // Bubble help ID
00658                         ))
00659         return(FALSE);
00660 
00661     if (!Operation::RegisterOpDescriptor(
00662                         0,
00663                         _R(IDS_TOGGLESPOTPREVIEW),
00664                         CC_RUNTIME_CLASS(OpShowPrinterColours),
00665                         OPTOKEN_SPOTPREVIEW8,
00666                         OpShowPrinterColours::GetState,
00667                         _R(IDS_TOGGLESPOTHELP),         // Help string ID
00668                         _R(IDS_TOGGLESPOTBBL)           // Bubble help ID
00669                         ))
00670         return(FALSE);
00671 
00672     return(TRUE);
00673 }
00674 
00675 
00676 
00677 /*******************************************************************
00678 
00679 >   static OpState OpShowPrinterColours::GetState(String_256*, OpDescriptor*)
00680 
00681     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00682     Created:    7/6/96
00683 
00684     Purpose:    As usual for GetStates
00685 
00686 *******************************************************************/
00687 
00688 OpState OpShowPrinterColours::GetState(String_256 *ShadeReason, OpDescriptor* OpDesc)
00689 {
00690     // By default we will be unticked, grey and present
00691     OpState OpSt(FALSE, TRUE, FALSE);
00692 
00693     if (DocView::GetSelected() == NULL ||               // No view to toggle!
00694         GetApplication()->GetCMSManager() == NULL)      // Or no CMS
00695     {
00696         // Set a sensible reason here
00697         ShadeReason->MakeMsg(_R(IDS_NOCOMPPREVIEW));
00698         return(OpSt);
00699     }
00700 
00701     String Token = OpDesc->Token;
00702     if (Token != String(OPTOKEN_MONOPLATEPREVIEW))
00703         OpSt.Greyed = FALSE;
00704 
00705     String_16 TempString;
00706     Token.Left(&TempString, 11);
00707     BOOL bIsSpot = (TempString == String(OPTOKEN_SPOTPREVIEWBASE));
00708 
00709     IndexedColour* pSpotColour = NULL;
00710     INT32 TokenSpot = 0;
00711     if (bIsSpot)
00712     {
00713         TokenSpot = (Token[11] - _T('0'));
00714         if (TokenSpot > 8)
00715             TokenSpot = -1;
00716     }
00717 
00718     IndexedColour *pTokenColour = NULL;
00719     if (TokenSpot > 0)
00720     {
00721         pTokenColour = FindWhichSpot(TokenSpot);
00722         if (pTokenColour == NULL)
00723         {
00724             // n'th spot colour doesn't exist so remove this item
00725             return(OpState(FALSE, FALSE, TRUE));
00726         }
00727         *ShadeReason = *(pTokenColour->GetName());
00728     }
00729 
00730     // Determine what mode we are in and check against which OpDescriptor
00731     ColourContext *cc = DocView::GetSelected()->GetColourContext(COLOURMODEL_RGBT);
00732     if (cc && cc->GetColourPlate())
00733     {
00734         ColourPlateType PlateType = cc->GetColourPlate()->GetType();
00735         if (TokenSpot > 0)
00736         {
00737             if (PlateType == COLOURPLATE_SPOT)
00738             {
00739                 pSpotColour = cc->GetColourPlate()->GetSpotColour();
00740                 if (pSpotColour == pTokenColour)
00741                     OpSt.Ticked = TRUE;
00742             }
00743         
00744             return(OpSt);
00745         }
00746         else if (Token == String(OPTOKEN_MONOPLATEPREVIEW))
00747         {
00748             OpSt.Greyed = (PlateType != COLOURPLATE_CYAN && PlateType != COLOURPLATE_MAGENTA && PlateType != COLOURPLATE_YELLOW);
00749             OpSt.Ticked = cc->GetColourPlate()->IsMonochrome();
00750         }
00751         else if (Token == String(OPTOKEN_CANCELPREVIEW))
00752         {
00753             OpSt.Ticked = (PlateType == COLOURPLATE_NONE);
00754         }
00755         else
00756         {
00757             ColourPlateType TokenPlate = COLOURPLATE_NONE;
00758             if (Token == String(OPTOKEN_COMPOSITEPREVIEW))
00759                 TokenPlate = COLOURPLATE_COMPOSITE;
00760             else if (Token == String(OPTOKEN_CYANPREVIEW))
00761                 TokenPlate = COLOURPLATE_CYAN;
00762             else if (Token == String(OPTOKEN_MAGENTAPREVIEW))
00763                 TokenPlate = COLOURPLATE_MAGENTA;
00764             else if (Token == String(OPTOKEN_YELLOWPREVIEW))
00765                 TokenPlate = COLOURPLATE_YELLOW;
00766             else if (Token == String(OPTOKEN_KEYPREVIEW))
00767                 TokenPlate = COLOURPLATE_KEY;
00768             
00769             if (PlateType == TokenPlate)
00770                 OpSt.Ticked = TRUE;
00771         }
00772     }
00773     else if (Token == String(OPTOKEN_CANCELPREVIEW))
00774     {
00775         // No colour plate and the "Normal view" item
00776         OpSt.Ticked = TRUE;
00777     }
00778 
00779     return(OpSt);
00780 }
00781 
00782 
00783 
00784 
00785 
00786 /*******************************************************************
00787 
00788 >   OpOverprintLine::OpOverprintLine()
00789 
00790     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00791     Created:    24/7/96
00792 
00793     Purpose:    Constructor for OpOverprintLine operation
00794 
00795 *******************************************************************/
00796 
00797 OpOverprintLine::OpOverprintLine()
00798 {
00799 }
00800 
00801 
00802 
00803 /*******************************************************************
00804 
00805 >   void OpOverprintLine::Do(OpDescriptor *OpDesc)
00806 
00807     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00808     Created:    24/7/96
00809 
00810     Purpose:    Applies the "overprint line" attribute to the selection
00811 
00812 *******************************************************************/
00813 
00814 void OpOverprintLine::Do(OpDescriptor *OpDesc)
00815 {
00816     // Determine if we can apply ourself at the moment. We call GetState
00817     // so that the state determination code is nicely centralised.
00818     OpState State = GetState(NULL, OpDesc);
00819 
00820     if (!State.Greyed)
00821     {
00822         // Create a new overprint attribute
00823         NodeAttribute *Attrib = new AttrOverprintLine;
00824 
00825         if (Attrib != NULL)
00826         {
00827             // By default we've made an attribute which is OFF. If the State indicates
00828             // (via the ticked flag) that the selection contains some item(s) which are ON,
00829             // then we want to toggle the state OFF - otherwise, we force the attribute ON.
00830             if (!State.Ticked)
00831                 ((OverprintLineAttrValue *)Attrib->GetAttributeValue())->SetOverprint(TRUE);
00832 
00833             // And apply it
00834             AttributeManager::AttributeSelected(Attrib);
00835         }
00836     }
00837 
00838     End();
00839 }
00840 
00841 
00842 
00843 /*******************************************************************
00844 
00845 >   static BOOL OpOverprintLine::Init()
00846 
00847     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00848     Created:    24/7/96
00849 
00850     Purpose:    Registers this Op
00851 
00852 *******************************************************************/
00853 
00854 BOOL OpOverprintLine::Init()
00855 {
00856     return(Operation::RegisterOpDescriptor(
00857                         0,
00858                         _R(IDS_ATTROVERPRINTLINE),
00859                         CC_RUNTIME_CLASS(OpOverprintLine),
00860                         OPTOKEN_OVERPRINTLINE,
00861                         OpOverprintLine::GetState,
00862                         _R(IDS_HELP_OVERPRINTLINE),     // Help ID
00863                         _R(IDS_BBL_OVERPRINTLINE),      // bubble help ID
00864                         _R(IDD_BARCONTROLSTORE),        // resource ID
00865                         _R(IDC_OVERPRINTLINE),          // control ID
00866                         SYSTEMBAR_UTILITIES,        // Bar ID
00867                         TRUE,                       // Recieve system messages
00868                         FALSE,                      // Smart duplicate operation
00869                         FALSE,                      // NOT Clean operation
00870                         NULL,                       // No vertical counterpart
00871                         0,                          // String for one copy only error
00872                         GREY_WHEN_NO_SELECTION |    // Auto state flags
00873                         DONT_GREY_WHEN_SELECT_INSIDE
00874                     ));
00875 }
00876 
00877 
00878 
00879 /*******************************************************************
00880 
00881 >   OpState OpOverprintLine::GetState(String_256 *ShadeReason, OpDescriptor *OpDesc)
00882 
00883     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00884     Created:    24/7/96
00885 
00886     Outputs:    ShadeReason - If this is non-NULL, and if the returned OpState
00887                 indicates that this Op is shaded, it will be returned filled
00888                 in with a string describing why the Op is shaded.
00889                 Otherwise this string is left untouched
00890 
00891                 OpDesc - The descriptor with which we'll be invoked
00892 
00893     Returns:    An OpState indicating this Op's state
00894 
00895     Purpose:    As usual for GetStates
00896 
00897 *******************************************************************/
00898 
00899 OpState OpOverprintLine::GetState(String_256 *ShadeReason, OpDescriptor *OpDesc)
00900 {
00901     OpState State;
00902 
00903     SelRange *Selection = GetApplication()->FindSelection();
00904     if (Selection == NULL || Selection->Count() < 1)
00905     {
00906         State.Greyed = TRUE;
00907         if (ShadeReason != NULL)
00908             ShadeReason->MakeMsg(_R(IDS_NO_OBJECTS_SELECTED));
00909     }
00910     else
00911     {
00912         // If any of the selection has the attribute applied, tick the op
00913         NodeAttribute *CurAttr = NULL;
00914 
00915         SelRange::CommonAttribResult result =
00916             Selection->FindCommonAttribute(CC_RUNTIME_CLASS(AttrOverprintLine), &CurAttr);
00917 
00918         if (result == SelRange::ATTR_MANY)
00919             State.Ticked = TRUE;            // Selection includes all states, so mark it as ON
00920         else if (result == SelRange::ATTR_COMMON)
00921         {
00922             // The entire selection uses the same attribute - but is it ON or OFF?
00923             if ( ((OverprintLineAttrValue *)CurAttr->GetAttributeValue())->IsOverprintOn() )
00924                 State.Ticked = TRUE;        // It's ON
00925         }
00926     }
00927 
00928     return(State);
00929 }
00930 
00931 
00932 
00933 
00934 
00935 
00936 
00937 
00938 
00939 
00940 
00941 
00942 
00943 /*******************************************************************
00944 
00945 >   OpOverprintFill::OpOverprintFill()
00946 
00947     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00948     Created:    24/7/96
00949 
00950     Purpose:    Constructor for OpOverprintFill operation
00951 
00952 *******************************************************************/
00953 
00954 OpOverprintFill::OpOverprintFill()
00955 {
00956 }
00957 
00958 
00959 
00960 /*******************************************************************
00961 
00962 >   void OpOverprintFill::Do(OpDescriptor *OpDesc)
00963 
00964     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00965     Created:    24/7/96
00966 
00967     Purpose:    Applies the "overprint fill" attribute to the selection
00968 
00969 *******************************************************************/
00970 
00971 void OpOverprintFill::Do(OpDescriptor *OpDesc)
00972 {
00973     // Determine if we can apply ourself at the moment. We call GetState
00974     // so that the state determination code is nicely centralised.
00975     OpState State = GetState(NULL, OpDesc);
00976 
00977     if (!State.Greyed)
00978     {
00979         // Create a new overprint attribute
00980         NodeAttribute *Attrib = new AttrOverprintFill;
00981 
00982         if (Attrib != NULL)
00983         {
00984             // By default we've made an attribute which is OFF. If the State indicates
00985             // (via the ticked flag) that the selection contains some item(s) which are ON,
00986             // then we want to toggle the state OFF - otherwise, we force the attribute ON.
00987             if (!State.Ticked)
00988                 ((OverprintFillAttrValue *)Attrib->GetAttributeValue())->SetOverprint(TRUE);
00989 
00990             // And apply it
00991             AttributeManager::AttributeSelected(Attrib);
00992         }
00993     }
00994 
00995     End();
00996 }
00997 
00998 
00999 
01000 /*******************************************************************
01001 
01002 >   static BOOL OpOverprintFill::Init()
01003 
01004     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01005     Created:    24/7/96
01006 
01007     Purpose:    Registers this Op
01008 
01009 *******************************************************************/
01010 
01011 BOOL OpOverprintFill::Init()
01012 {
01013     return(Operation::RegisterOpDescriptor(
01014                         0,
01015                         _R(IDS_ATTROVERPRINTFILL),
01016                         CC_RUNTIME_CLASS(OpOverprintFill),
01017                         OPTOKEN_OVERPRINTFILL,
01018                         OpOverprintFill::GetState,
01019                         _R(IDS_HELP_OVERPRINTFILL),
01020                         _R(IDS_BBL_OVERPRINTFILL),      // bubble help ID
01021                         _R(IDD_BARCONTROLSTORE),        // resource ID
01022                         _R(IDC_OVERPRINTFILL),          // control ID
01023                         SYSTEMBAR_UTILITIES,        // Bar ID
01024                         TRUE,                       // Recieve system messages
01025                         FALSE,                      // No smart duplicate operation
01026                         FALSE,                      // Not Clean operation
01027                         NULL,                       // No vertical counterpart
01028                         0,                          // String for one copy only error
01029                         GREY_WHEN_NO_SELECTION |    // Auto state flags
01030                         DONT_GREY_WHEN_SELECT_INSIDE
01031                     ));
01032 }
01033 
01034 
01035 
01036 /*******************************************************************
01037 
01038 >   OpState OpOverprintFill::GetState(String_256 *ShadeReason, OpDescriptor *OpDesc)
01039 
01040     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01041     Created:    24/7/96
01042 
01043     Outputs:    ShadeReason - If this is non-NULL, and if the returned OpState
01044                 indicates that this Op is shaded, it will be returned filled
01045                 in with a string describing why the Op is shaded.
01046                 Otherwise this string is left untouched
01047 
01048                 OpDesc - The descriptor with which we'll be invoked
01049 
01050     Returns:    An OpState indicating this Op's state
01051 
01052     Purpose:    As usual for GetStates
01053 
01054 *******************************************************************/
01055 
01056 OpState OpOverprintFill::GetState(String_256 *ShadeReason, OpDescriptor *OpDesc)
01057 {
01058     OpState State;
01059 
01060     SelRange *Selection = GetApplication()->FindSelection();
01061     if (Selection == NULL || Selection->Count() < 1)
01062     {
01063         State.Greyed = TRUE;
01064         if (ShadeReason != NULL)
01065             ShadeReason->MakeMsg(_R(IDS_NO_OBJECTS_SELECTED));
01066     }
01067     else
01068     {
01069         // If any of the selection has the attribute applied, tick the op
01070         NodeAttribute *CurAttr = NULL;
01071 
01072         SelRange::CommonAttribResult result =
01073             Selection->FindCommonAttribute(CC_RUNTIME_CLASS(AttrOverprintFill), &CurAttr);
01074 
01075         if (result == SelRange::ATTR_MANY)
01076             State.Ticked = TRUE;            // Selection includes all states, so mark it as ON
01077         else if (result == SelRange::ATTR_COMMON)
01078         {
01079             // The entire selection uses the same attribute - but is it ON or OFF?
01080             if ( ((OverprintFillAttrValue *)CurAttr->GetAttributeValue())->IsOverprintOn() )
01081                 State.Ticked = TRUE;        // It's ON
01082         }
01083     }
01084 
01085     return(State);
01086 }
01087 
01088 
01089 
01090 
01091 
01092 
01093 
01094 
01095 
01096 
01097 
01098 
01099 
01100 
01101 
01102 /*******************************************************************
01103 
01104 >   OpPrintOnAllPlates::OpPrintOnAllPlates()
01105 
01106     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01107     Created:    24/7/96
01108 
01109     Purpose:    Constructor for OpPrintOnAllPlates operation
01110 
01111 *******************************************************************/
01112 
01113 OpPrintOnAllPlates::OpPrintOnAllPlates()
01114 {
01115 }
01116 
01117 
01118 
01119 /*******************************************************************
01120 
01121 >   void OpPrintOnAllPlates::Do(OpDescriptor *OpDesc)
01122 
01123     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01124     Created:    24/7/96
01125 
01126     Purpose:    Applies the "print on all plates" attribute to the selection
01127 
01128 *******************************************************************/
01129 
01130 void OpPrintOnAllPlates::Do(OpDescriptor *OpDesc)
01131 {
01132     // Determine if we can apply ourself at the moment. We call GetState
01133     // so that the state determination code is nicely centralised.
01134     OpState State = GetState(NULL, OpDesc);
01135 
01136     if (!State.Greyed)
01137     {
01138         // Create a new overprint attribute
01139         NodeAttribute *Attrib = new AttrPrintOnAllPlates;
01140 
01141         if (Attrib != NULL)
01142         {
01143             // By default we've made an attribute which is OFF. If the State indicates
01144             // (via the ticked flag) that the selection contains some item(s) which are ON,
01145             // then we want to toggle the state OFF - otherwise, we force the attribute ON.
01146             if (!State.Ticked)
01147                 ((PrintOnAllPlatesAttrValue *)Attrib->GetAttributeValue())->SetPrintOnAllPlates(TRUE);
01148 
01149             // And apply it
01150             AttributeManager::AttributeSelected(Attrib);
01151         }
01152     }
01153 
01154     End();
01155 }
01156 
01157 
01158 
01159 /*******************************************************************
01160 
01161 >   static BOOL OpPrintOnAllPlates::Init()
01162 
01163     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01164     Created:    24/7/96
01165 
01166     Purpose:    Registers this Op
01167 
01168 *******************************************************************/
01169 
01170 BOOL OpPrintOnAllPlates::Init()
01171 {
01172     return(Operation::RegisterOpDescriptor(
01173                         0,
01174                         _R(IDS_ATTRPRINTONALLPLATES),
01175                         CC_RUNTIME_CLASS(OpPrintOnAllPlates),
01176                         OPTOKEN_PRINTONALLPLATES,
01177                         OpPrintOnAllPlates::GetState,
01178                         _R(IDS_HELP_PRINTONALLPLATES),  // Help string ID
01179                         _R(IDS_BBL_PRINTONALLPLATES),   // bubble help ID
01180                         _R(IDD_BARCONTROLSTORE),        // resource ID
01181                         _R(IDC_PRINTONALLPLATES),       // control ID
01182                         SYSTEMBAR_UTILITIES,        // Bar ID
01183                         TRUE,                       // Recieve system messages
01184                         FALSE,                      // Smart duplicate operation
01185                         FALSE,                      // NOT Clean operation
01186                         NULL,                       // No vertical counterpart
01187                         0,                          // String for one copy only error
01188                         GREY_WHEN_NO_SELECTION |    // Auto state flags
01189                         DONT_GREY_WHEN_SELECT_INSIDE
01190                     ));
01191 }
01192 
01193 
01194 
01195 /*******************************************************************
01196 
01197 >   OpState OpPrintOnAllPlates::GetState(String_256 *ShadeReason, OpDescriptor *OpDesc)
01198 
01199     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01200     Created:    24/7/96
01201 
01202     Outputs:    ShadeReason - If this is non-NULL, and if the returned OpState
01203                 indicates that this Op is shaded, it will be returned filled
01204                 in with a string describing why the Op is shaded.
01205                 Otherwise this string is left untouched
01206 
01207                 OpDesc - The descriptor with which we'll be invoked
01208 
01209     Returns:    An OpState indicating this Op's state
01210 
01211     Purpose:    As usual for GetStates
01212 
01213 *******************************************************************/
01214 
01215 OpState OpPrintOnAllPlates::GetState(String_256 *ShadeReason, OpDescriptor *OpDesc)
01216 {
01217     OpState State;
01218 
01219     SelRange *Selection = GetApplication()->FindSelection();
01220     if (Selection == NULL || Selection->Count() < 1)
01221     {
01222         State.Greyed = TRUE;
01223         if (ShadeReason != NULL)
01224             ShadeReason->MakeMsg(_R(IDS_NO_OBJECTS_SELECTED));
01225     }
01226     else
01227     {
01228         // If any of the selection has the attribute applied, tick the op
01229         NodeAttribute *CurAttr = NULL;
01230 
01231         SelRange::CommonAttribResult result =
01232             Selection->FindCommonAttribute(CC_RUNTIME_CLASS(AttrPrintOnAllPlates), &CurAttr);
01233 
01234         if (result == SelRange::ATTR_MANY)
01235             State.Ticked = TRUE;            // Selection includes all states, so mark it as ON
01236         else if (result == SelRange::ATTR_COMMON)
01237         {
01238             // The entire selection uses the same attribute - but is it ON or OFF?
01239             if ( ((PrintOnAllPlatesAttrValue *)CurAttr->GetAttributeValue())->IsPrintOnAllPlatesOn() )
01240                 State.Ticked = TRUE;        // It's ON
01241         }
01242     }
01243 
01244     return(State);
01245 }
01246 
01247 
01248 
01249 #if FALSE
01250 
01251 /*******************************************************************
01252 
01253 >   OpToggleCompositePreview::OpToggleCompositePreview()
01254 
01255     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01256     Created:    7/6/96
01257 
01258     Purpose:    Constructor for OpToggleCompositePreview operation
01259 
01260 *******************************************************************/
01261 
01262 OpToggleCompositePreview::OpToggleCompositePreview()
01263 {
01264 }
01265 
01266 
01267 
01268 /*******************************************************************
01269 
01270 >   void OpToggleCompositePreview::Do(OpDescriptor *)
01271 
01272     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01273     Created:    7/6/96
01274 
01275     Purpose:    Toggles the selected view between "normal view" and
01276                 "composite print preview" modes.
01277 
01278 *******************************************************************/
01279 
01280 void OpToggleCompositePreview::Do(OpDescriptor *)
01281 {
01282     if (CanToggleState())
01283     {
01284         if (IsInCompositeMode())
01285         {
01286             if (DocView::GetSelected() != NULL)
01287             {
01288                 // To restore normal view, we just remove any attached ColourPlate from the view
01289                 DocView::GetSelected()->SetColourPlate(NULL);
01290                 ColourManager::SelViewContextHasChanged();  // Redraw everything which is affected
01291             }
01292         }
01293         else
01294         {
01295             SetNewColourPlate(COLOURPLATE_COMPOSITE, 0, 0);
01296 
01297             // To avoid a huge delay the next time a bitmap is rendered in this composite view,
01298             // we get XaraCMS to cache its lookup table now. If no deep bitmaps are rendered,
01299             // this is wasteful, but better than getting a several-second delay part-way
01300             // through the next document redraw.
01301             Progress::Start();      // Fail to show an hourglass (this doesn't work for some reason)
01302             DWORD *Dummy = GetApplication()->GetCMSManager()->GetPaperViewTable();
01303             Progress::Stop();
01304         }
01305     }
01306 
01307     End();
01308 }
01309 
01310 
01311 
01312 /*******************************************************************
01313 
01314 >   static BOOL OpToggleCompositePreview::Init()
01315 
01316     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01317     Created:    7/6/96
01318 
01319     Purpose:    Registers this Op
01320 
01321 *******************************************************************/
01322 
01323 BOOL OpToggleCompositePreview::Init()
01324 {
01325     return(Operation::RegisterOpDescriptor(
01326                         0,
01327                         _R(IDS_TOGGLECOMPPREVIEW),
01328                         CC_RUNTIME_CLASS(OpToggleCompositePreview),
01329                         OPTOKEN_COMPOSITEPREVIEW,
01330                         OpToggleCompositePreview::GetState,
01331                         _R(IDS_TOGGLECOMPHELP),         // Help string ID
01332                         _R(IDS_TOGGLECOMPBBL),          // Bubble help ID
01333                         _R(IDD_BARCONTROLSTORE),        // resource ID
01334                         _R(IDC_COMPOSITEPREVIEW),       // control ID
01335                         SYSTEMBAR_UTILITIES,        // Bar ID
01336                         TRUE,                       // Recieve system messages
01337                         FALSE,                      // No smart duplicate operation
01338                         TRUE,                       // Clean operation
01339                         NULL,                       // No vertical counterpart
01340                         NULL,                       // String for one copy only error
01341                         0                           // Auto state flags
01342                     ));
01343 }
01344 
01345 
01346 
01347 /*******************************************************************
01348 
01349 >   static OpState OpToggleCompositePreview::GetState(String_256*, OpDescriptor*)
01350 
01351     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01352     Created:    7/6/96
01353 
01354     Purpose:    As usual for GetStates
01355 
01356 *******************************************************************/
01357 
01358 OpState OpToggleCompositePreview::GetState(String_256 *ShadeReason, OpDescriptor*)
01359 {
01360     OpState OpSt;
01361 
01362     if (!CanToggleState())
01363     {
01364         OpSt.Greyed = TRUE;
01365         ShadeReason->MakeMsg(_R(IDS_NOCOMPPREVIEW));
01366     }
01367 
01368     if (IsInCompositeMode())
01369         OpSt.Ticked = TRUE;
01370 
01371     return OpSt;
01372 }
01373 
01374 
01375 
01376 /*******************************************************************
01377 
01378 >   static BOOL OpToggleCompositePreview::CanToggleState(void)
01379 
01380     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01381     Created:    7/6/96
01382 
01383     Returns:    TRUE if this Op can be invoked
01384 
01385     Purpose:    To determine if the state can be toggled.
01386                 This can only be done when we have a view to toggle, 
01387                 and when the XaraCMS manager is available.
01388 
01389 *******************************************************************/
01390 
01391 BOOL OpToggleCompositePreview::CanToggleState(void)
01392 {
01393     if (DocView::GetSelected() == NULL)                 // No view to toggle!
01394         return(FALSE);
01395 
01396     if (GetApplication()->GetCMSManager() == NULL)      // Can't do composite preview
01397         return(FALSE);
01398 
01399     return(TRUE);
01400 }
01401 
01402 
01403 
01404 /*******************************************************************
01405 
01406 >   static BOOL OpToggleCompositePreview::IsInCompositeMode(void)
01407 
01408     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01409     Created:    7/6/96
01410 
01411     Returns:    TRUE if in composite mode
01412                 FALSE if not (i.e. if in normal mode, although other
01413                 modes like separation plates will also return FALSE)
01414 
01415     Purpose:    To determine whether the currently selected view is
01416                 in normal or composite view mode.
01417 
01418 *******************************************************************/
01419 
01420 BOOL OpToggleCompositePreview::IsInCompositeMode(void)
01421 {
01422     if (DocView::GetSelected() == NULL)                 // No view to toggle!
01423         return(FALSE);
01424 
01425     ColourContext *cc = DocView::GetSelected()->GetColourContext(COLOURMODEL_RGBT);
01426 
01427     if (cc == NULL || cc->GetColourPlate() == NULL)
01428         return(FALSE);                                  // No special plate
01429 
01430     if (cc->GetColourPlate()->GetType() != COLOURPLATE_COMPOSITE)
01431         return(FALSE);                                  // Not a composite plate
01432 
01433     return(TRUE);
01434 }
01435 
01436 
01437 
01438 
01439 
01440 
01441 /*******************************************************************
01442 
01443 >   void OpToggleCyanPreview::Do(OpDescriptor *)
01444 
01445     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01446     Created:    7/6/96
01447 
01448     Purpose:    Toggles the selected view between "normal view" and
01449                 "Cyan print preview" modes.
01450 
01451 *******************************************************************/
01452 
01453 void OpToggleCyanPreview::Do(OpDescriptor *)
01454 {
01455     if (CanToggleState())
01456     {
01457         if (IsInCyanMode())
01458         {
01459             if (DocView::GetSelected() != NULL)
01460             {
01461                 // To restore normal view, we just remove any attached ColourPlate from the view
01462                 DocView::GetSelected()->SetColourPlate(NULL);
01463                 ColourManager::SelViewContextHasChanged();  // Redraw everything which is affected
01464             }
01465         }
01466         else
01467         {
01468             SetNewColourPlate(COLOURPLATE_CYAN, 0, 0);
01469 
01470             // To avoid a huge delay the next time a bitmap is rendered in this composite view,
01471             // we get XaraCMS to cache its lookup table now. If no deep bitmaps are rendered,
01472             // this is wasteful, but better than getting a several-second delay part-way
01473             // through the next document redraw.
01474 //          Progress::Start();      // Fail to show an hourglass (this doesn't work for some reason)
01475 //          DWORD *Dummy = GetApplication()->GetCMSManager()->GetPaperViewTable();
01476 //          Progress::Stop();
01477         }
01478     }
01479 
01480     End();
01481 }
01482 
01483 
01484 
01485 /*******************************************************************
01486 
01487 >   static BOOL OpToggleCyanPreview::Init()
01488 
01489     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01490     Created:    7/6/96
01491 
01492     Purpose:    Registers this Op
01493 
01494 *******************************************************************/
01495 
01496 BOOL OpToggleCyanPreview::Init()
01497 {
01498     return(Operation::RegisterOpDescriptor(
01499                         0,
01500                         _R(IDS_TOGGLECYANPREVIEW),
01501                         CC_RUNTIME_CLASS(OpToggleCyanPreview),
01502                         OPTOKEN_CYANPREVIEW,
01503                         OpToggleCyanPreview::GetState,
01504                         _R(IDS_TOGGLECYANHELP),         // Help string ID
01505                         _R(IDS_TOGGLECYANBBL),          // Bubble help ID
01506                         NULL,                       // resource ID
01507                         NULL,                       // control ID
01508                         SYSTEMBAR_UTILITIES,        // Bar ID
01509                         TRUE,                       // Recieve system messages
01510                         FALSE,                      // No smart duplicate operation
01511                         TRUE,                       // Clean operation
01512                         NULL,                       // No vertical counterpart
01513                         NULL,                       // String for one copy only error
01514                         0                           // Auto state flags
01515                     ));
01516 }
01517 
01518 
01519 
01520 /*******************************************************************
01521 
01522 >   static OpState OpToggleCyanPreview::GetState(String_256*, OpDescriptor*)
01523 
01524     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01525     Created:    7/6/96
01526 
01527     Purpose:    As usual for GetStates
01528 
01529 *******************************************************************/
01530 
01531 OpState OpToggleCyanPreview::GetState(String_256 *ShadeReason, OpDescriptor*)
01532 {
01533     OpState OpSt;
01534 
01535     if (!CanToggleState())
01536     {
01537         OpSt.Greyed = TRUE;
01538         ShadeReason->MakeMsg(_R(IDS_NOCOMPPREVIEW));
01539     }
01540 
01541     if (IsInCyanMode())
01542         OpSt.Ticked = TRUE;
01543 
01544     return OpSt;
01545 }
01546 
01547 
01548 
01549 /*******************************************************************
01550 
01551 >   static BOOL OpToggleCyanPreview::CanToggleState(void)
01552 
01553     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01554     Created:    7/6/96
01555 
01556     Returns:    TRUE if this Op can be invoked
01557 
01558     Purpose:    To determine if the state can be toggled.
01559                 This can only be done when we have a view to toggle, 
01560                 and when the XaraCMS manager is available.
01561 
01562 *******************************************************************/
01563 
01564 BOOL OpToggleCyanPreview::CanToggleState(void)
01565 {
01566     if (DocView::GetSelected() == NULL)                 // No view to toggle!
01567         return(FALSE);
01568 
01569     if (GetApplication()->GetCMSManager() == NULL)      // Can't do composite preview
01570         return(FALSE);
01571 
01572     return(TRUE);
01573 }
01574 
01575 
01576 
01577 /*******************************************************************
01578 
01579 >   static BOOL OpToggleCyanPreview::IsInCyanMode(void)
01580 
01581     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01582     Created:    7/6/96
01583 
01584     Returns:    TRUE if in Cyan mode
01585                 FALSE if not (i.e. if in normal mode, although other
01586                 modes like separation plates will also return FALSE)
01587 
01588     Purpose:    To determine whether the currently selected view is
01589                 in normal or Cyan view mode.
01590 
01591 *******************************************************************/
01592 
01593 BOOL OpToggleCyanPreview::IsInCyanMode(void)
01594 {
01595     if (DocView::GetSelected() == NULL)                 // No view to toggle!
01596         return(FALSE);
01597 
01598     ColourContext *cc = DocView::GetSelected()->GetColourContext(COLOURMODEL_RGBT);
01599 
01600     if (cc == NULL || cc->GetColourPlate() == NULL)
01601         return(FALSE);                                  // No special plate
01602 
01603     if (cc->GetColourPlate()->GetType() != COLOURPLATE_CYAN)
01604         return(FALSE);                                  // Not a Cyan plate
01605 
01606     return(TRUE);
01607 }
01608 
01609 
01610 
01611 
01612 
01613 
01614 /*******************************************************************
01615 
01616 >   void OpToggleMagentaPreview::Do(OpDescriptor *)
01617 
01618     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01619     Created:    7/6/96
01620 
01621     Purpose:    Toggles the selected view between "normal view" and
01622                 "Magenta preview" modes.
01623 
01624 *******************************************************************/
01625 
01626 void OpToggleMagentaPreview::Do(OpDescriptor *)
01627 {
01628     if (CanToggleState())
01629     {
01630         if (IsInMagentaMode())
01631         {
01632             if (DocView::GetSelected() != NULL)
01633             {
01634                 // To restore normal view, we just remove any attached ColourPlate from the view
01635                 DocView::GetSelected()->SetColourPlate(NULL);
01636                 ColourManager::SelViewContextHasChanged();  // Redraw everything which is affected
01637             }
01638         }
01639         else
01640         {
01641             SetNewColourPlate(COLOURPLATE_MAGENTA, 0, 0);
01642 
01643             // To avoid a huge delay the next time a bitmap is rendered in this composite view,
01644             // we get XaraCMS to cache its lookup table now. If no deep bitmaps are rendered,
01645             // this is wasteful, but better than getting a several-second delay part-way
01646             // through the next document redraw.
01647 //          Progress::Start();      // Fail to show an hourglass (this doesn't work for some reason)
01648 //          DWORD *Dummy = GetApplication()->GetCMSManager()->GetPaperViewTable();
01649 //          Progress::Stop();
01650         }
01651     }
01652 
01653     End();
01654 }
01655 
01656 
01657 
01658 /*******************************************************************
01659 
01660 >   static BOOL OpToggleMagentaPreview::Init()
01661 
01662     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01663     Created:    7/6/96
01664 
01665     Purpose:    Registers this Op
01666 
01667 *******************************************************************/
01668 
01669 BOOL OpToggleMagentaPreview::Init()
01670 {
01671     return(Operation::RegisterOpDescriptor(
01672                         0,
01673                         _R(IDS_TOGGLEMAGENTAPREVIEW),
01674                         CC_RUNTIME_CLASS(OpToggleMagentaPreview),
01675                         OPTOKEN_MAGENTAPREVIEW,
01676                         OpToggleMagentaPreview::GetState,
01677                         _R(IDS_TOGGLEMAGENTAHELP),          // Help string ID
01678                         _R(IDS_TOGGLEMAGENTABBL),           // Bubble help ID
01679                         NULL,                       // resource ID
01680                         NULL,                       // control ID
01681                         SYSTEMBAR_UTILITIES,        // Bar ID
01682                         TRUE,                       // Recieve system messages
01683                         FALSE,                      // No smart duplicate operation
01684                         TRUE,                       // Clean operation
01685                         NULL,                       // No vertical counterpart
01686                         NULL,                       // String for one copy only error
01687                         0                           // Auto state flags
01688                     ));
01689 }
01690 
01691 
01692 
01693 /*******************************************************************
01694 
01695 >   static OpState OpToggleMagentaPreview::GetState(String_256*, OpDescriptor*)
01696 
01697     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01698     Created:    7/6/96
01699 
01700     Purpose:    As usual for GetStates
01701 
01702 *******************************************************************/
01703 
01704 OpState OpToggleMagentaPreview::GetState(String_256 *ShadeReason, OpDescriptor*)
01705 {
01706     OpState OpSt;
01707 
01708     if (!CanToggleState())
01709     {
01710         OpSt.Greyed = TRUE;
01711         ShadeReason->MakeMsg(_R(IDS_NOCOMPPREVIEW));
01712     }
01713 
01714     if (IsInMagentaMode())
01715         OpSt.Ticked = TRUE;
01716 
01717     return OpSt;
01718 }
01719 
01720 
01721 
01722 /*******************************************************************
01723 
01724 >   static BOOL OpToggleMagentaPreview::CanToggleState(void)
01725 
01726     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01727     Created:    7/6/96
01728 
01729     Returns:    TRUE if this Op can be invoked
01730 
01731     Purpose:    To determine if the state can be toggled.
01732                 This can only be done when we have a view to toggle, 
01733                 and when the XaraCMS manager is available.
01734 
01735 *******************************************************************/
01736 
01737 BOOL OpToggleMagentaPreview::CanToggleState(void)
01738 {
01739     if (DocView::GetSelected() == NULL)                 // No view to toggle!
01740         return(FALSE);
01741 
01742     if (GetApplication()->GetCMSManager() == NULL)      // Can't do composite preview
01743         return(FALSE);
01744 
01745     return(TRUE);
01746 }
01747 
01748 
01749 
01750 /*******************************************************************
01751 
01752 >   static BOOL OpToggleMagentaPreview::IsInMagentaMode(void)
01753 
01754     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01755     Created:    7/6/96
01756 
01757     Returns:    TRUE if in composite mode
01758                 FALSE if not (i.e. if in normal mode, although other
01759                 modes like separation plates will also return FALSE)
01760 
01761     Purpose:    To determine whether the currently selected view is
01762                 in normal or composite view mode.
01763 
01764 *******************************************************************/
01765 
01766 BOOL OpToggleMagentaPreview::IsInMagentaMode(void)
01767 {
01768     if (DocView::GetSelected() == NULL)                 // No view to toggle!
01769         return(FALSE);
01770 
01771     ColourContext *cc = DocView::GetSelected()->GetColourContext(COLOURMODEL_RGBT);
01772 
01773     if (cc == NULL || cc->GetColourPlate() == NULL)
01774         return(FALSE);                                  // No special plate
01775 
01776     if (cc->GetColourPlate()->GetType() != COLOURPLATE_MAGENTA)
01777         return(FALSE);                                  // Not a composite plate
01778 
01779     return(TRUE);
01780 }
01781 
01782 
01783 
01784 
01785 /*******************************************************************
01786 
01787 >   void OpToggleYellowPreview::Do(OpDescriptor *)
01788 
01789     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01790     Created:    7/6/96
01791 
01792     Purpose:    Toggles the selected view between "normal view" and
01793                 "Yellow preview" modes.
01794 
01795 *******************************************************************/
01796 
01797 void OpToggleYellowPreview::Do(OpDescriptor *)
01798 {
01799     if (CanToggleState())
01800     {
01801         if (IsInYellowMode())
01802         {
01803             if (DocView::GetSelected() != NULL)
01804             {
01805                 // To restore normal view, we just remove any attached ColourPlate from the view
01806                 DocView::GetSelected()->SetColourPlate(NULL);
01807                 ColourManager::SelViewContextHasChanged();  // Redraw everything which is affected
01808             }
01809         }
01810         else
01811         {
01812             SetNewColourPlate(COLOURPLATE_YELLOW, 0, 0);
01813 
01814             // To avoid a huge delay the next time a bitmap is rendered in this composite view,
01815             // we get XaraCMS to cache its lookup table now. If no deep bitmaps are rendered,
01816             // this is wasteful, but better than getting a several-second delay part-way
01817             // through the next document redraw.
01818 //          Progress::Start();      // Fail to show an hourglass (this doesn't work for some reason)
01819 //          DWORD *Dummy = GetApplication()->GetCMSManager()->GetPaperViewTable();
01820 //          Progress::Stop();
01821         }
01822     }
01823 
01824     End();
01825 }
01826 
01827 
01828 
01829 /*******************************************************************
01830 
01831 >   static BOOL OpToggleYellowPreview::Init()
01832 
01833     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01834     Created:    7/6/96
01835 
01836     Purpose:    Registers this Op
01837 
01838 *******************************************************************/
01839 
01840 BOOL OpToggleYellowPreview::Init()
01841 {
01842     return(Operation::RegisterOpDescriptor(
01843                         0,
01844                         _R(IDS_TOGGLEYELLOWPREVIEW),
01845                         CC_RUNTIME_CLASS(OpToggleYellowPreview),
01846                         OPTOKEN_YELLOWPREVIEW,
01847                         OpToggleYellowPreview::GetState,
01848                         _R(IDS_TOGGLEYELLOWHELP),           // Help string ID
01849                         _R(IDS_TOGGLEYELLOWBBL),            // Bubble help ID
01850                         NULL,                       // resource ID
01851                         NULL,                       // control ID
01852                         SYSTEMBAR_UTILITIES,        // Bar ID
01853                         TRUE,                       // Recieve system messages
01854                         FALSE,                      // No smart duplicate operation
01855                         TRUE,                       // Clean operation
01856                         NULL,                       // No vertical counterpart
01857                         NULL,                       // String for one copy only error
01858                         0                           // Auto state flags
01859                     ));
01860 }
01861 
01862 
01863 
01864 /*******************************************************************
01865 
01866 >   static OpState OpToggleYellowPreview::GetState(String_256*, OpDescriptor*)
01867 
01868     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01869     Created:    7/6/96
01870 
01871     Purpose:    As usual for GetStates
01872 
01873 *******************************************************************/
01874 
01875 OpState OpToggleYellowPreview::GetState(String_256 *ShadeReason, OpDescriptor*)
01876 {
01877     OpState OpSt;
01878 
01879     if (!CanToggleState())
01880     {
01881         OpSt.Greyed = TRUE;
01882         ShadeReason->MakeMsg(_R(IDS_NOCOMPPREVIEW));
01883     }
01884 
01885     if (IsInYellowMode())
01886         OpSt.Ticked = TRUE;
01887 
01888     return OpSt;
01889 }
01890 
01891 
01892 
01893 /*******************************************************************
01894 
01895 >   static BOOL OpToggleYellowPreview::CanToggleState(void)
01896 
01897     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01898     Created:    7/6/96
01899 
01900     Returns:    TRUE if this Op can be invoked
01901 
01902     Purpose:    To determine if the state can be toggled.
01903                 This can only be done when we have a view to toggle, 
01904                 and when the XaraCMS manager is available.
01905 
01906 *******************************************************************/
01907 
01908 BOOL OpToggleYellowPreview::CanToggleState(void)
01909 {
01910     if (DocView::GetSelected() == NULL)                 // No view to toggle!
01911         return(FALSE);
01912 
01913     if (GetApplication()->GetCMSManager() == NULL)      // Can't do composite preview
01914         return(FALSE);
01915 
01916     return(TRUE);
01917 }
01918 
01919 
01920 
01921 /*******************************************************************
01922 
01923 >   static BOOL OpToggleYellowPreview::IsInYellowMode(void)
01924 
01925     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01926     Created:    7/6/96
01927 
01928     Returns:    TRUE if in composite mode
01929                 FALSE if not (i.e. if in normal mode, although other
01930                 modes like separation plates will also return FALSE)
01931 
01932     Purpose:    To determine whether the currently selected view is
01933                 in normal or composite view mode.
01934 
01935 *******************************************************************/
01936 
01937 BOOL OpToggleYellowPreview::IsInYellowMode(void)
01938 {
01939     if (DocView::GetSelected() == NULL)                 // No view to toggle!
01940         return(FALSE);
01941 
01942     ColourContext *cc = DocView::GetSelected()->GetColourContext(COLOURMODEL_RGBT);
01943 
01944     if (cc == NULL || cc->GetColourPlate() == NULL)
01945         return(FALSE);                                  // No special plate
01946 
01947     if (cc->GetColourPlate()->GetType() != COLOURPLATE_YELLOW)
01948         return(FALSE);                                  // Not a composite plate
01949 
01950     return(TRUE);
01951 }
01952 
01953 
01954 
01955 /*******************************************************************
01956 
01957 >   void OpToggleKeyPreview::Do(OpDescriptor *)
01958 
01959     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01960     Created:    7/6/96
01961 
01962     Purpose:    Toggles the selected view between "normal view" and
01963                 "Key preview" modes.
01964 
01965 *******************************************************************/
01966 
01967 void OpToggleKeyPreview::Do(OpDescriptor *)
01968 {
01969     if (CanToggleState())
01970     {
01971         if (IsInKeyMode())
01972         {
01973             if (DocView::GetSelected() != NULL)
01974             {
01975                 // To restore normal view, we just remove any attached ColourPlate from the view
01976                 DocView::GetSelected()->SetColourPlate(NULL);
01977                 ColourManager::SelViewContextHasChanged();  // Redraw everything which is affected
01978             }
01979         }
01980         else
01981         {
01982             SetNewColourPlate(COLOURPLATE_KEY, 0, 0);
01983 
01984             // To avoid a huge delay the next time a bitmap is rendered in this composite view,
01985             // we get XaraCMS to cache its lookup table now. If no deep bitmaps are rendered,
01986             // this is wasteful, but better than getting a several-second delay part-way
01987             // through the next document redraw.
01988 //          Progress::Start();      // Fail to show an hourglass (this doesn't work for some reason)
01989 //          DWORD *Dummy = GetApplication()->GetCMSManager()->GetPaperViewTable();
01990 //          Progress::Stop();
01991         }
01992     }
01993 
01994     End();
01995 }
01996 
01997 
01998 
01999 /*******************************************************************
02000 
02001 >   static BOOL OpToggleKeyPreview::Init()
02002 
02003     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02004     Created:    7/6/96
02005 
02006     Purpose:    Registers this Op
02007 
02008 *******************************************************************/
02009 
02010 BOOL OpToggleKeyPreview::Init()
02011 {
02012     return(Operation::RegisterOpDescriptor(
02013                         0,
02014                         _R(IDS_TOGGLEKEYPREVIEW),
02015                         CC_RUNTIME_CLASS(OpToggleKeyPreview),
02016                         OPTOKEN_KEYPREVIEW,
02017                         OpToggleKeyPreview::GetState,
02018                         _R(IDS_TOGGLEKEYHELP),          // Help string ID
02019                         _R(IDS_TOGGLEKEYBBL),           // Bubble help ID
02020                         NULL,                       // resource ID
02021                         NULL,                       // control ID
02022                         SYSTEMBAR_UTILITIES,        // Bar ID
02023                         TRUE,                       // Recieve system messages
02024                         FALSE,                      // No smart duplicate operation
02025                         TRUE,                       // Clean operation
02026                         NULL,                       // No vertical counterpart
02027                         NULL,                       // String for one copy only error
02028                         0                           // Auto state flags
02029                     ));
02030 }
02031 
02032 
02033 
02034 /*******************************************************************
02035 
02036 >   static OpState OpToggleKeyPreview::GetState(String_256*, OpDescriptor*)
02037 
02038     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02039     Created:    7/6/96
02040 
02041     Purpose:    As usual for GetStates
02042 
02043 *******************************************************************/
02044 
02045 OpState OpToggleKeyPreview::GetState(String_256 *ShadeReason, OpDescriptor*)
02046 {
02047     OpState OpSt;
02048 
02049     if (!CanToggleState())
02050     {
02051         OpSt.Greyed = TRUE;
02052         ShadeReason->MakeMsg(_R(IDS_NOCOMPPREVIEW));
02053     }
02054 
02055     if (IsInKeyMode())
02056         OpSt.Ticked = TRUE;
02057 
02058     return OpSt;
02059 }
02060 
02061 
02062 
02063 /*******************************************************************
02064 
02065 >   static BOOL OpToggleKeyPreview::CanToggleState(void)
02066 
02067     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02068     Created:    7/6/96
02069 
02070     Returns:    TRUE if this Op can be invoked
02071 
02072     Purpose:    To determine if the state can be toggled.
02073                 This can only be done when we have a view to toggle, 
02074                 and when the XaraCMS manager is available.
02075 
02076 *******************************************************************/
02077 
02078 BOOL OpToggleKeyPreview::CanToggleState(void)
02079 {
02080     if (DocView::GetSelected() == NULL)                 // No view to toggle!
02081         return(FALSE);
02082 
02083     if (GetApplication()->GetCMSManager() == NULL)      // Can't do composite preview
02084         return(FALSE);
02085 
02086     return(TRUE);
02087 }
02088 
02089 
02090 
02091 /*******************************************************************
02092 
02093 >   static BOOL OpToggleKeyPreview::IsInKeyMode(void)
02094 
02095     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02096     Created:    7/6/96
02097 
02098     Returns:    TRUE if in composite mode
02099                 FALSE if not (i.e. if in normal mode, although other
02100                 modes like separation plates will also return FALSE)
02101 
02102     Purpose:    To determine whether the currently selected view is
02103                 in normal or composite view mode.
02104 
02105 *******************************************************************/
02106 
02107 BOOL OpToggleKeyPreview::IsInKeyMode(void)
02108 {
02109     if (DocView::GetSelected() == NULL)                 // No view to toggle!
02110         return(FALSE);
02111 
02112     ColourContext *cc = DocView::GetSelected()->GetColourContext(COLOURMODEL_RGBT);
02113 
02114     if (cc == NULL || cc->GetColourPlate() == NULL)
02115         return(FALSE);                                  // No special plate
02116 
02117     if (cc->GetColourPlate()->GetType() != COLOURPLATE_KEY)
02118         return(FALSE);                                  // Not a composite plate
02119 
02120     return(TRUE);
02121 }
02122 
02123 
02124 
02125 /*******************************************************************
02126 
02127 >   void OpToggleSpotPreview::Do(OpDescriptor *)
02128 
02129     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02130     Created:    7/6/96
02131 
02132     Purpose:    Toggles the selected view between "normal view" and
02133                 "Spot preview" modes.
02134 
02135 *******************************************************************/
02136 
02137 void OpToggleSpotPreview::Do(OpDescriptor *)
02138 {
02139     if (CanToggleState())
02140     {
02141         if (IsInSpotMode())
02142         {
02143             if (DocView::GetSelected() != NULL)
02144             {
02145                 // To restore normal view, we just remove any attached ColourPlate from the view
02146                 DocView::GetSelected()->SetColourPlate(NULL);
02147                 ColourManager::SelViewContextHasChanged();  // Redraw everything which is affected
02148             }
02149         }
02150         else
02151         {
02152             SetNewColourPlate(COLOURPLATE_SPOT, 0, 1);
02153 
02154             // To avoid a huge delay the next time a bitmap is rendered in this composite view,
02155             // we get XaraCMS to cache its lookup table now. If no deep bitmaps are rendered,
02156             // this is wasteful, but better than getting a several-second delay part-way
02157             // through the next document redraw.
02158 //          Progress::Start();      // Fail to show an hourglass (this doesn't work for some reason)
02159 //          DWORD *Dummy = GetApplication()->GetCMSManager()->GetPaperViewTable();
02160 //          Progress::Stop();
02161         }
02162     }
02163 
02164     End();
02165 }
02166 
02167 
02168 
02169 /*******************************************************************
02170 
02171 >   static BOOL OpToggleSpotPreview::Init()
02172 
02173     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02174     Created:    7/6/96
02175 
02176     Purpose:    Registers this Op
02177 
02178 *******************************************************************/
02179 
02180 BOOL OpToggleSpotPreview::Init()
02181 {
02182     return(Operation::RegisterOpDescriptor(
02183                         0,
02184                         _R(IDS_TOGGLESPOTPREVIEW),
02185                         CC_RUNTIME_CLASS(OpToggleSpotPreview),
02186                         OPTOKEN_SPOTPREVIEW,
02187                         OpToggleSpotPreview::GetState,
02188                         _R(IDS_TOGGLESPOTHELP),         // Help string ID
02189                         _R(IDS_TOGGLESPOTBBL),          // Bubble help ID
02190                         NULL,                       // resource ID
02191                         NULL,                       // control ID
02192                         SYSTEMBAR_UTILITIES,        // Bar ID
02193                         TRUE,                       // Recieve system messages
02194                         FALSE,                      // No smart duplicate operation
02195                         TRUE,                       // Clean operation
02196                         NULL,                       // No vertical counterpart
02197                         NULL,                       // String for one copy only error
02198                         0                           // Auto state flags
02199                     ));
02200 }
02201 
02202 
02203 
02204 /*******************************************************************
02205 
02206 >   static OpState OpToggleSpotPreview::GetState(String_256*, OpDescriptor*)
02207 
02208     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02209     Created:    7/6/96
02210 
02211     Purpose:    As usual for GetStates
02212 
02213 *******************************************************************/
02214 
02215 OpState OpToggleSpotPreview::GetState(String_256 *ShadeReason, OpDescriptor*)
02216 {
02217     OpState OpSt;
02218 
02219     if (!CanToggleState())
02220     {
02221         OpSt.Greyed = TRUE;
02222         ShadeReason->MakeMsg(_R(IDS_NOCOMPPREVIEW));
02223     }
02224 
02225     if (IsInSpotMode())
02226         OpSt.Ticked = TRUE;
02227 
02228     return OpSt;
02229 }
02230 
02231 
02232 
02233 /*******************************************************************
02234 
02235 >   static BOOL OpToggleSpotPreview::CanToggleState(void)
02236 
02237     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02238     Created:    7/6/96
02239 
02240     Returns:    TRUE if this Op can be invoked
02241 
02242     Purpose:    To determine if the state can be toggled.
02243                 This can only be done when we have a view to toggle, 
02244                 and when the XaraCMS manager is available.
02245 
02246 *******************************************************************/
02247 
02248 BOOL OpToggleSpotPreview::CanToggleState(void)
02249 {
02250     if (DocView::GetSelected() == NULL)                 // No view to toggle!
02251         return(FALSE);
02252 
02253     if (GetApplication()->GetCMSManager() == NULL)      // Can't do composite preview
02254         return(FALSE);
02255 
02256     return(TRUE);
02257 }
02258 
02259 
02260 
02261 /*******************************************************************
02262 
02263 >   static BOOL OpToggleSpotPreview::IsInSpotMode(void)
02264 
02265     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02266     Created:    7/6/96
02267 
02268     Returns:    TRUE if in composite mode
02269                 FALSE if not (i.e. if in normal mode, although other
02270                 modes like separation plates will also return FALSE)
02271 
02272     Purpose:    To determine whether the currently selected view is
02273                 in normal or composite view mode.
02274 
02275 *******************************************************************/
02276 
02277 BOOL OpToggleSpotPreview::IsInSpotMode(void)
02278 {
02279     if (DocView::GetSelected() == NULL)                 // No view to toggle!
02280         return(FALSE);
02281 
02282     ColourContext *cc = DocView::GetSelected()->GetColourContext(COLOURMODEL_RGBT);
02283 
02284     if (cc == NULL || cc->GetColourPlate() == NULL)
02285         return(FALSE);                                  // No special plate
02286 
02287     if (cc->GetColourPlate()->GetType() != COLOURPLATE_SPOT)
02288         return(FALSE);                                  // Not a spot plate
02289 
02290     return(TRUE);
02291 }
02292 
02293 
02294 
02295 
02296 /*******************************************************************
02297 
02298 >   void OpToggleMonoPlatePreview::Do(OpDescriptor *)
02299 
02300     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02301     Created:    7/6/96
02302 
02303     Purpose:    Toggles the selected view between "normal view" and
02304                 "Spot preview" modes.
02305 
02306 *******************************************************************/
02307 
02308 void OpToggleMonoPlatePreview::Do(OpDescriptor *)
02309 {
02310     if (CanToggleState())
02311     {
02312         if (IsInMonoMode())
02313         {
02314             if (DocView::GetSelected() != NULL)
02315             {
02316                 // To restore normal view, we just remove any attached ColourPlate from the view
02317                 DocView::GetSelected()->SetColourPlate(NULL);
02318                 ColourManager::SelViewContextHasChanged();  // Redraw everything which is affected
02319             }
02320         }
02321         else
02322         {
02323             SetNewColourPlate(COLOURPLATE_NONE, 1, 0);      // Just toggle the mono flag
02324 
02325             // To avoid a huge delay the next time a bitmap is rendered in this composite view,
02326             // we get XaraCMS to cache its lookup table now. If no deep bitmaps are rendered,
02327             // this is wasteful, but better than getting a several-second delay part-way
02328             // through the next document redraw.
02329 //          Progress::Start();      // Fail to show an hourglass (this doesn't work for some reason)
02330 //          DWORD *Dummy = GetApplication()->GetCMSManager()->GetPaperViewTable();
02331 //          Progress::Stop();
02332         }
02333     }
02334 
02335     End();
02336 }
02337 
02338 
02339 
02340 /*******************************************************************
02341 
02342 >   static BOOL OpToggleMonoPlatePreview::Init()
02343 
02344     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02345     Created:    7/6/96
02346 
02347     Purpose:    Registers this Op
02348 
02349 *******************************************************************/
02350 
02351 BOOL OpToggleMonoPlatePreview::Init()
02352 {
02353     return(Operation::RegisterOpDescriptor(
02354                         0,
02355                         _R(IDS_TOGGLEMONOPLATEPREVIEW),
02356                         CC_RUNTIME_CLASS(OpToggleMonoPlatePreview),
02357                         OPTOKEN_MONOPLATEPREVIEW,
02358                         OpToggleMonoPlatePreview::GetState,
02359                         _R(IDS_TOGGLEMONOPLATEHELP),    // Help string ID
02360                         _R(IDS_TOGGLEMONOPLATEBBL),     // Bubble help ID
02361                         NULL,                       // resource ID
02362                         NULL,                       // control ID
02363                         SYSTEMBAR_UTILITIES,        // Bar ID
02364                         TRUE,                       // Recieve system messages
02365                         FALSE,                      // No smart duplicate operation
02366                         TRUE,                       // Clean operation
02367                         NULL,                       // No vertical counterpart
02368                         NULL,                       // String for one copy only error
02369                         0                           // Auto state flags
02370                     ));
02371 }
02372 
02373 
02374 
02375 /*******************************************************************
02376 
02377 >   static OpState OpToggleMonoPlatePreview::GetState(String_256*, OpDescriptor*)
02378 
02379     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02380     Created:    7/6/96
02381 
02382     Purpose:    As usual for GetStates
02383 
02384 *******************************************************************/
02385 
02386 OpState OpToggleMonoPlatePreview::GetState(String_256 *ShadeReason, OpDescriptor*)
02387 {
02388     OpState OpSt;
02389 
02390     if (!CanToggleState())
02391     {
02392         OpSt.Greyed = TRUE;
02393         ShadeReason->MakeMsg(_R(IDS_NOCOMPPREVIEW));
02394     }
02395 
02396     if (IsInMonoMode())
02397         OpSt.Ticked = TRUE;
02398 
02399     return OpSt;
02400 }
02401 
02402 
02403 
02404 /*******************************************************************
02405 
02406 >   static BOOL OpToggleMonoPlatePreview::CanToggleState(void)
02407 
02408     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02409     Created:    7/6/96
02410 
02411     Returns:    TRUE if this Op can be invoked
02412 
02413     Purpose:    To determine if the state can be toggled.
02414                 This can only be done when we have a view to toggle, 
02415                 and when the XaraCMS manager is available.
02416 
02417 *******************************************************************/
02418 
02419 BOOL OpToggleMonoPlatePreview::CanToggleState(void)
02420 {
02421     if (DocView::GetSelected() == NULL)                 // No view to toggle!
02422         return(FALSE);
02423 
02424     // TODOG: Check that we are showing a standard plate (not a spot)
02425 
02426     return(TRUE);
02427 }
02428 
02429 
02430 
02431 /*******************************************************************
02432 
02433 >   static BOOL OpToggleMonoPlatePreview::IsInMonoMode(void)
02434 
02435     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02436     Created:    7/6/96
02437 
02438     Returns:    TRUE if in composite mode
02439                 FALSE if not (i.e. if in normal mode, although other
02440                 modes like separation plates will also return FALSE)
02441 
02442     Purpose:    To determine whether the currently selected view is
02443                 in normal or composite view mode.
02444 
02445 *******************************************************************/
02446 
02447 BOOL OpToggleMonoPlatePreview::IsInMonoMode(void)
02448 {
02449     if (DocView::GetSelected() == NULL)                 // No view to toggle!
02450         return(FALSE);
02451 
02452     ColourContext *cc = DocView::GetSelected()->GetColourContext(COLOURMODEL_RGBT);
02453 
02454     if (cc == NULL || cc->GetColourPlate() == NULL)
02455         return(FALSE);                                  // No special plate
02456 
02457     if (!(cc->GetColourPlate()->IsMonochrome()))
02458         return(FALSE);                                  // Not mono
02459 
02460     return(TRUE);
02461 }
02462 
02463 #endif

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