OpShowPrinterColours Class Reference

An Op for toggling composite print preview on and off. More...

#include <opimgset.h>

Inheritance diagram for OpShowPrinterColours:

Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpShowPrinterColours ()
void Do (OpDescriptor *OpDesc)
 Does a "show printer colours" op.

Static Public Member Functions

static BOOL Init (void)
 Registers this Op.
static OpState GetState (String_256 *ShadeReason, OpDescriptor *OpDesc)
 As usual for GetStates.

Detailed Description

An Op for toggling composite print preview on and off.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/6/96
Notes: This Op is available from the main "Window" menu

Definition at line 151 of file opimgset.h.


Constructor & Destructor Documentation

OpShowPrinterColours::OpShowPrinterColours  )  [inline]
 

Definition at line 156 of file opimgset.h.

00156 : Operation() {};


Member Function Documentation

void OpShowPrinterColours::Do OpDescriptor OpDesc  )  [virtual]
 

Does a "show printer colours" op.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/12/2003

Reimplemented from Operation.

Definition at line 364 of file opimgset.cpp.

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 }

OpState OpShowPrinterColours::GetState String_256 ShadeReason,
OpDescriptor OpDesc
[static]
 

As usual for GetStates.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/6/96

Definition at line 688 of file opimgset.cpp.

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 }

BOOL OpShowPrinterColours::Init void   )  [static]
 

Registers this Op.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/6/96

Reimplemented from SimpleCCObject.

Definition at line 490 of file opimgset.cpp.

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 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:58:57 2007 for Camelot by  doxygen 1.4.4