PrintSepsTab Class Reference

Allows the user to set options which are associated with printing colour separations. More...

#include <optsprin.h>

Inheritance diagram for PrintSepsTab:

PrintBaseTab OptionsTabs ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 PrintSepsTab ()
 PrintSepsTab constructor.
 ~PrintSepsTab ()
 PrintSepsTab destructor.
virtual BOOL HandleMsg (DialogMsg *Msg)
 Handles messages sent by various controls on this tab.
virtual MsgResult Message (Msg *pMessage)
 Handles miscellaneous system messages Note that many messages (e.g. docuement/view changing) are handled by the base dialogue, and call our UpdateSection() function. Only "left over" messages like ColourChangingMsg are passed on to the tabs.
virtual BOOL CommitSection ()
 Takes the values in the Print Separations section tab of the options dialog box and sets the associated preference values accordingly Called when ok is pressed on the dialog box.
virtual BOOL InitSection ()
 Sets initial values for the print separations section of the options dialog box. This section includes the:-.
virtual BOOL GreySection ()
 Called when the user has closed all documents. Gives any tabbed dialog a chance to grey any fields which are document specific.
virtual BOOL UngreySection ()
 Called when the user has opened a document. Gives any tabbed dialog a chance to update any fields which may have been greyed when the last document was closed.
virtual BOOL UpdateSection (String_256 *DocumentName)
 Called when the user has clicked on a new document or opened a new document. Gives any tabbed dialog a chance to update any fields which are used to reflect the current document's status. The document name allows the info field on the tab to be filled in correctly.
virtual CDlgResID GetPageID ()

Private Member Functions

INT32 ConvertDoubleToMinString (double Value, String_256 *Result)
 Converts a double to a "minimal" string. That is, it outputs up to 4 decimal places, but strips any trailing zeroes off (excepting the first after the decimal point).
void ReadCurrentPlateSettings (TypesetInfo *pTypesetInfo)
 Retrieves all the colour plate settings in the dialogue and writes them into the given TypesetInfo. Used to update both the LocalPrintControl.GetTypesetInfo() (when settings are changed) and the document's TypesetInfo (in CommitSection).
BOOL EnableControls ()
 Enables and disables the controls on the tab as appropriate for the current settings.
virtual BOOL ShowDetails ()
 Sets values for the print layout section of the options dialog box.
ColourPlateGetSelectedPlate ()
 used to invoke the Properties popup with the curently selected plate
BOOL ShowDetails (CGadgetID *pGadgetIDList, CGadgetID Exclude)
 Sets values for the print seps section of the options dialog box.

Private Attributes

BOOL OldPrintSpotsAsProcess

Detailed Description

Allows the user to set options which are associated with printing colour separations.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/6/96
See also:
OptionsTabs; AppPrefsDlg; DocPrefsDlg;

Definition at line 341 of file optsprin.h.


Constructor & Destructor Documentation

PrintSepsTab::PrintSepsTab  ) 
 

PrintSepsTab constructor.

> PrintSepsTab::PrintSepsTab()

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/6/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2025 of file optsprin.cpp.

PrintSepsTab::~PrintSepsTab  ) 
 

PrintSepsTab destructor.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/6/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2047 of file optsprin.cpp.

02048 { 
02049 }        


Member Function Documentation

BOOL PrintSepsTab::CommitSection  )  [virtual]
 

Takes the values in the Print Separations section tab of the options dialog box and sets the associated preference values accordingly Called when ok is pressed on the dialog box.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>/Jason
Date:
12/6/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
True if values in dialog box ok, False otherwise.

Errors: -

See also:
-

Reimplemented from PrintBaseTab.

Definition at line 2338 of file optsprin.cpp.

02339 {
02340     if (IsAllGreyed() || pDocument == NULL)
02341         return(PrintBaseTab::CommitSection());
02342 
02343     ERROR3IF(pPrefsDlg == NULL, "PrintLayoutTab::CommitSection called with no dialog pointer");
02344 
02345     if (!TalkToPage())
02346         return TRUE;    // Just return if TalkToPage() fails
02347 
02348     // Always update the real document print control
02349     PrintControl* pPrCtrl = &LocalPrintControl; //GetPrintControl();
02350     ERROR2IF(pPrCtrl == NULL,TRUE,"NULL print control object");
02351 
02352     TypesetInfo *pTypesetInfo = pPrCtrl->GetTypesetInfo();
02353     ERROR2IF(pTypesetInfo == NULL, TRUE, "Can't find typesetting info structure");
02354 
02355     // Read the screening settings
02356     BOOL AreScreening = pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CUSTOMSETTINGS));
02357     if (AreScreening)
02358     {
02359         // Custom screening settings - read the other controls
02360         pTypesetInfo->SetPrintResolution(pPrefsDlg->GetLongGadgetValue(_R(IDC_COMBORESOLUTION), 100, 100000));
02361         pTypesetInfo->SetDefaultScreenFrequency(pPrefsDlg->GetDoubleGadgetValue(_R(IDC_COMBOFREQUENCY), 2, 1000));
02362         pTypesetInfo->SetScreenFunction((ScreenType) (pPrefsDlg->GetSelectedValueIndex(_R(IDC_COMBOTYPE)) + 1));
02363     }
02364 
02365     // Read the current plate settings into the document's TypesetInfo
02366     ReadCurrentPlateSettings(pTypesetInfo);
02367 
02368     // And turn on screening, making sure that the "global" screen settings are properly copied
02369     // through all the ColourPlates
02370     pTypesetInfo->SetScreening(AreScreening);
02371     pTypesetInfo->EnsureAllPlatesHaveGlobalSettings();
02372 
02373     // Read the "print spot colours as process colours" state, and now that we've committed to the value,
02374     // remember it as the "old" state so that cancel doesn't "undo" it! (Needed if the user uses "Apply"
02375     // followed by "Cancel")
02376     OldPrintSpotsAsProcess = pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKPROCESS));
02377     IndexedColour::ForceSpotsToBeProcess(OldPrintSpotsAsProcess);
02378 
02379     return(PrintBaseTab::CommitSection());
02380 }

INT32 PrintSepsTab::ConvertDoubleToMinString double  Value,
String_256 Result
[private]
 

Converts a double to a "minimal" string. That is, it outputs up to 4 decimal places, but strips any trailing zeroes off (excepting the first after the decimal point).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/9/96
Parameters:
Value - The number to output [INPUTS]
Result - Returned with a string representation of the number [OUTPUTS]
Returns:
The number of decimal places that were output
e.g 1.23456 -> 1.2345 1.230000 -> 1.23 1.00001 -> 1.0

Definition at line 2403 of file optsprin.cpp.

02404 {
02405     ERROR3IF(Result == NULL, "Illegal null param");
02406 
02407     INT32 DecimalPlaces = 4;
02408     const String_8 Zero(TEXT("0"));
02409     String_8 Temp;
02410 
02411     // Let's do this with applied brute force!
02412     while (DecimalPlaces >= 1)
02413     {
02414         Convert::DoubleToString(Value, (StringBase *)Result, DecimalPlaces);
02415 
02416         Result->Right(&Temp, 1);    // If the rightmost character isn't a 0, then return the string immediately
02417         if (Temp != Zero)
02418             return(DecimalPlaces);
02419 
02420         // Otherwise, see if we can stripanother char off the end
02421         DecimalPlaces--;
02422     }
02423 
02424     // Stripped loads of trailing zeroes, so return 1 d.p.
02425     return(1);
02426 }

BOOL PrintSepsTab::EnableControls  )  [private, virtual]
 

Enables and disables the controls on the tab as appropriate for the current settings.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>/Jason
Date:
12/6/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if all went well

Errors: -

See also:
-

Implements PrintBaseTab.

Definition at line 2981 of file optsprin.cpp.

02982 {
02983     if (pPrefsDlg == NULL)
02984         return TRUE;
02985 
02986     if (!TalkToPage())
02987         return(FALSE);
02988 
02989     // If there is no XaraCMS colour manager, we simply can't do colour separations
02990     if (GetApplication()->GetCMSManager() == NULL)
02991         EnableControl(_R(IDC_CHECKSEPARATIONS), FALSE);
02992 
02993     TypesetInfo* tpInfo = NULL;
02994     if (!IsAllGreyed() && pDocument != NULL)
02995         tpInfo = LocalPrintControl.GetTypesetInfo();
02996 
02997     // Enable/Disable the postscript/screening options as appropriate
02998     BOOL Enabled = (tpInfo == NULL) ? FALSE : tpInfo->AreScreening();
02999     EnableControl(_R(IDC_COMBORESOLUTION),  Enabled);
03000     EnableControl(_R(IDC_COMBOFREQUENCY),   Enabled);
03001     EnableControl(_R(IDC_COMBOTYPE),        Enabled);
03002 
03003 
03004     // Enable/Disable the separation plate options depending on whether we're doing separations
03005     Enabled = (tpInfo != NULL && tpInfo->AreSeparating() && !IsAllGreyed() && pDocument != NULL);
03006     EnableControl(_R(IDC_LISTCOLOURS),      Enabled);
03007     EnableControl(_R(IDC_PLATEPROPS),       Enabled);
03008 
03009     Enabled = (!IsAllGreyed() && pDocument != NULL);
03010     EnableControl(_R(IDC_PRINTERDEFAULTS),  Enabled);
03011 
03012     EnableControl(_R(IDC_CHECKPROCESS),     Enabled);
03013 
03014     EnableControl(_R(IDC_CUSTOMSETTINGS),   Enabled);
03015     EnableControl(_R(IDC_CHECKSEPARATIONS), Enabled);
03016 
03017     return TRUE;
03018 }

CDlgResID PrintSepsTab::GetPageID  )  [virtual]
 

Implements OptionsTabs.

Definition at line 2051 of file optsprin.cpp.

02051 { return _R(IDD_OPTSTAB_PRINTPRINT); }

ColourPlate * PrintSepsTab::GetSelectedPlate  )  [private]
 

used to invoke the Properties popup with the curently selected plate

> PrintSepsTab::GetSelectedPlate()

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>/Jason
Date:
12/6/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
- a pointer to the colour plate currently selected in the list box (NULL if none)

Errors: -

See also:
- class SepsDlg

Definition at line 3037 of file optsprin.cpp.

03038 {
03039     if (IsAllGreyed() || pDocument == NULL)
03040         return(NULL);
03041 
03042     ERROR2IF(pPrefsDlg == NULL,FALSE,"Error in PrintSepsTab::GetSelectedPlate() : unexpected null pointer");
03043 
03044 PORTNOTE("other", "Disabled CCustomList")
03045 #ifndef EXCLUDE_FROM_XARALX
03046     ColourPlate* pPlate = NULL;
03047 
03048     CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_LISTCOLOURS));
03049     if (pListGadget)
03050     {
03051         INT32 index = pListGadget->GetSelectedItemIndex(); 
03052         if (index != -1)
03053         {
03054             TypesetInfo* tpInfo = LocalPrintControl.GetTypesetInfo();
03055             if (tpInfo)
03056             {
03057                 tpInfo->CreatePlateList();
03058 
03059                 pPlate = tpInfo->GetFirstPlate();
03060                 for (INT32 i = 0; i < index && pPlate != NULL; i++)
03061                     pPlate = tpInfo->GetNextPlate(pPlate);
03062             }
03063             return pPlate;
03064         }
03065     }
03066     else
03067         ERROR3("Cannot find list gadget");
03068 #endif
03069 
03070     return(NULL); // return NULL if no plate is selected
03071 }

BOOL PrintSepsTab::GreySection  )  [virtual]
 

Called when the user has closed all documents. Gives any tabbed dialog a chance to grey any fields which are document specific.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>/Adrian
Date:
20/8/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
PrintSepsTab::UngreySection(); PrintSepsTab::UpdateSection();

Reimplemented from PrintBaseTab.

Definition at line 2563 of file optsprin.cpp.

02564 {
02565     if (TalkToPage())
02566     {
02567 PORTNOTE("other", "Disabled CCustomList")
02568 #ifndef EXCLUDE_FROM_XARALX
02569         // Delete the contents of the list
02570         CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_LISTCOLOURS));
02571         if (pListGadget != NULL)
02572                 pListGadget->DeleteAllItems();      
02573 #endif
02574         // Destroy the plate list to avoid all kinds of problems that might arise if it contained spot plates 
02575         TypesetInfo *pTypesetInfo = LocalPrintControl.GetTypesetInfo();
02576         ERROR2IF(pTypesetInfo == NULL, TRUE, "Can't find typesetting info structure");
02577 
02578         pTypesetInfo->DestroyPlateList();
02579 
02580         // Grey out all controls
02581         pPrefsDlg->SetBoolGadgetSelected(_R(IDC_PRINTERDEFAULTS), FALSE);
02582         pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CUSTOMSETTINGS), FALSE);
02583         pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKSEPARATIONS), FALSE);
02584         pPrefsDlg->DeleteAllValues(_R(IDC_COMBORESOLUTION));
02585         pPrefsDlg->DeleteAllValues(_R(IDC_COMBOFREQUENCY));
02586         pPrefsDlg->DeleteAllValues(_R(IDC_COMBOTYPE));
02587         pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKPROCESS), FALSE);
02588         EnableControl((CGadgetID) _R(IDC_PRINT_DOCNAMETEXT), FALSE);
02589         EnableControl((CGadgetID) _R(IDC_PRINT_DOCNAME), FALSE);
02590         EnableControl((CGadgetID) _R(IDC_SSTATIC1), FALSE);
02591         EnableControl((CGadgetID) _R(IDC_SSTATIC2), FALSE);
02592         EnableControl((CGadgetID) _R(IDC_SSTATIC3), FALSE);
02593         EnableControl((CGadgetID) _R(IDC_SSTATIC4), FALSE);
02594         EnableControl((CGadgetID) _R(IDC_SSTATIC5), FALSE);
02595         EnableControl((CGadgetID) _R(IDC_SSTATIC6), FALSE);
02596     }
02597     return(PrintBaseTab::GreySection());
02598 }

BOOL PrintSepsTab::HandleMsg DialogMsg Msg  )  [virtual]
 

Handles messages sent by various controls on this tab.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>/Jason
Date:
12/6/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from PrintBaseTab.

Definition at line 2068 of file optsprin.cpp.

02069 {
02070     if ((IsAllGreyed() || pDocument == NULL) && Msg->DlgMsg != DIM_CREATE)
02071         return(TRUE);
02072 
02073     ERROR2IF(Msg == NULL,FALSE,"PrintSepsTab::Message null message received");
02074     if ((IsAllGreyed() || pDocument == NULL) && Msg->DlgMsg != DIM_CREATE)
02075         return(TRUE);
02076 
02077 
02078     BOOL ok = TalkToPage();
02079     if (!ok)
02080         return TRUE;        // page not present
02081 
02082     TypesetInfo *pTypesetInfo = LocalPrintControl.GetTypesetInfo();
02083     ERROR2IF(pTypesetInfo == NULL, TRUE, "Can't find typesetting info structure");
02084 
02085     switch(Msg->DlgMsg)
02086     {
02087         case DIM_CANCEL:
02088             // If cancelled, we have to restore the previous setting of the "print spot colours as process"
02089             // flag, which (rather than being local has to be set on a global scale).
02090             IndexedColour::ForceSpotsToBeProcess(OldPrintSpotsAsProcess);
02091 
02092             // And call the base class to keep it happy.
02093             return(PrintBaseTab::HandleMsg(Msg));
02094 
02095 
02096         case DIM_LFT_BN_CLICKED:
02097             if (FALSE) {}
02098             // Separations checkbox
02099             else if (Msg->GadgetID == _R(IDC_CHECKSEPARATIONS))
02100             {
02101                 BOOL DoSeparations = pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKSEPARATIONS));
02102                 pTypesetInfo->SetSeparations(DoSeparations);
02103 
02104                 // Toggle the OutputPrintersMarks state automatically
02105                 if (pTypesetInfo->OutputPrintersMarks() != DoSeparations)
02106                 {
02107                     pTypesetInfo->SetOutputPrintersMarks(DoSeparations);
02108 
02109                     // Make sure the print layout tab updates scale factors etc suitably
02110                     BROADCAST_TO_ALL(PrintMsg(PrintMsg::SETTINGSCHANGED));
02111                 }
02112 
02113                 // And let the imagesetting tab know that the seps state has changed
02114                 BROADCAST_TO_ALL(OptionsChangingMsg(OptionsChangingMsg::SEPARATIONSENABLED));
02115 
02116                 // Adjust the shading of controls as appropriate, and make sure things like
02117                 // the page size are updated to take printers marks into account
02118                 PageSizeHasChanged();
02119                 OptionsTabs::SetApplyNowState(TRUE);
02120             }
02121             else if (Msg->GadgetID == _R(IDC_CHECKPROCESS))
02122             {
02123                 // If the "print spot colours as process colours" option is changed,
02124                 // interactively update the plate list
02125                 IndexedColour::ForceSpotsToBeProcess(pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKPROCESS)));
02126                 ShowDetails();
02127                 OptionsTabs::SetApplyNowState(TRUE);
02128             }
02129             else if (Msg->GadgetID == _R(IDC_PRINTERDEFAULTS))
02130             {
02131                 EnableControl(_R(IDC_COMBORESOLUTION),  FALSE);
02132                 EnableControl(_R(IDC_COMBOFREQUENCY),   FALSE);
02133                 EnableControl(_R(IDC_COMBOTYPE),        FALSE);
02134 
02135                 pTypesetInfo->SetScreening(FALSE);      // Disable screening
02136                 pTypesetInfo->ResetAllPlatesToDefaultScreens();
02137                 ShowDetails();                          // Make sure colour plate list resets to defaults
02138 
02139                 OptionsTabs::SetApplyNowState(TRUE);
02140             }
02141             else if (Msg->GadgetID == _R(IDC_CUSTOMSETTINGS))
02142             {
02143                 EnableControl(_R(IDC_COMBORESOLUTION),  TRUE);
02144                 EnableControl(_R(IDC_COMBOFREQUENCY),   TRUE);
02145                 EnableControl(_R(IDC_COMBOTYPE),        TRUE);
02146 
02147                 pTypesetInfo->SetScreening(TRUE);
02148                 OptionsTabs::SetApplyNowState(TRUE);
02149             }
02150             else if (Msg->GadgetID == _R(IDC_PLATEPROPS))
02151             {
02152                 if (pTypesetInfo->AreSeparating())
02153                 {
02154                     String_256 GreyReason;
02155                     OpState DlgState = SepsDlg::GetState(&GreyReason, NULL);
02156 
02157                     if (!DlgState.Greyed)
02158                     {
02159                         // Store away the current plate settings in our local print control
02160                         ReadCurrentPlateSettings(pTypesetInfo);
02161 
02162                         ColourPlate *pPlate = GetSelectedPlate();
02163                         if (pPlate != NULL)
02164                         {
02165                             if (SepsDlg::InvokeDialog(pPlate, this))
02166                             {
02167                                 // The angle or frequency has been changed by the user, so make sure that
02168                                 // screening is auto-enabled...
02169                                 if (!pTypesetInfo->AreScreening())
02170                                     pTypesetInfo->SetScreening(TRUE);
02171                             }
02172 
02173                             ShowDetails(); //update tab data - maybe it should check whether the dialog returned with OK or Cancel 
02174                             OptionsTabs::SetApplyNowState(TRUE);
02175                         }
02176                     }
02177                 }
02178             }
02179 
02180         case DIM_TEXT_CHANGED:
02181             // Enable the Apply button 
02182             OptionsTabs::SetApplyNowState(TRUE);
02183             break;
02184 
02185         case DIM_FOCUS_LOST:
02186             if (FALSE) {}
02187             else if (Msg->GadgetID == _R(IDC_COMBORESOLUTION))
02188             {
02189                 pTypesetInfo->SetPrintResolution(pPrefsDlg->GetLongGadgetValue(_R(IDC_COMBORESOLUTION), 100, 10000));
02190             }
02191             else if (Msg->GadgetID == _R(IDC_COMBOFREQUENCY))
02192             {
02193                 BOOL valid = TRUE;
02194                 // Check that the value is within range, if not warn the user and fall back to a default value
02195                 
02196                 double NewVal = pPrefsDlg->GetDoubleGadgetValue(_R(IDC_COMBOFREQUENCY), 2, 1000, _R(IDS_INVALID_FREQUENCY), &valid);
02197                 if (valid) // update the default frequency
02198                 {
02199                     pTypesetInfo->SetScreening(pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CUSTOMSETTINGS)));
02200                     if (pTypesetInfo->AreScreening())
02201                         pTypesetInfo->SetDefaultScreenFrequency(NewVal, TRUE);
02202                 }
02203 
02204                 ShowDetails();
02205             }
02206             break;
02207 
02208         
02209         case DIM_SELECTION_CHANGED:
02210             if (FALSE) {}
02211             else if (Msg->GadgetID == _R(IDC_COMBOFREQUENCY)) // make sure a change in the default frequency is reflected in the plate list
02212             {
02213                 pTypesetInfo->SetScreening(pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CUSTOMSETTINGS)));
02214                 if (pTypesetInfo->AreScreening())
02215                     pTypesetInfo->SetDefaultScreenFrequency(pPrefsDlg->GetDoubleGadgetValue(_R(IDC_COMBOFREQUENCY), 2, 1000), TRUE);
02216 
02217                 ShowDetails();
02218             }
02219             else if (Msg->GadgetID == _R(IDC_COMBORESOLUTION))
02220             {
02221                 pTypesetInfo->SetPrintResolution(pPrefsDlg->GetLongGadgetValue(_R(IDC_COMBORESOLUTION), 100, 10000));
02222             }
02223             else if (Msg->GadgetID == _R(IDC_COMBOTYPE))
02224             {
02225                 pTypesetInfo->SetScreenFunction((ScreenType) (pPrefsDlg->GetSelectedValueIndex(_R(IDC_COMBOTYPE)) + 1));
02226             }
02227             else if (Msg->GadgetID == _R(IDC_LISTCOLOURS))
02228             {
02229                 // Store away the current plate settings in our local print control
02230                 if (pTypesetInfo->AreSeparating())
02231                     ReadCurrentPlateSettings(pTypesetInfo);
02232             }           
02233             OptionsTabs::SetApplyNowState(TRUE); // enable the Apply button
02234             break;
02235 
02236 
02237         case DIM_SELECTION_CHANGED_COMMIT:
02238             OptionsTabs::SetApplyNowState(TRUE);
02239             if (FALSE) {}
02240             else if (Msg->GadgetID == _R(IDC_LISTCOLOURS))
02241             {
02242                 if (pTypesetInfo->AreSeparating())
02243                 {
02244                     String_256 GreyReason;
02245                     OpState DlgState = SepsDlg::GetState(&GreyReason, NULL);
02246 
02247                     if (!DlgState.Greyed)
02248                     {
02249                         // Store away the current plate settings in our local print control
02250                         ReadCurrentPlateSettings(pTypesetInfo);
02251 
02252                         // And give the user a properties dialogue to edit in
02253                         ColourPlate *pPlate = GetSelectedPlate();
02254                         if (pPlate != NULL)
02255                         {
02256                             if (SepsDlg::InvokeDialog(pPlate, this))
02257                             {
02258                                 // The angle or frequency has been changed by the user, so make sure that
02259                                 // screening is auto-enabled...
02260                                 if (!pTypesetInfo->AreScreening())
02261                                     pTypesetInfo->SetScreening(TRUE);
02262                             }
02263                         }
02264 
02265                         ShowDetails(); //update tab data - maybe it should check whether the dialog returned with OK or Cancel
02266                     }
02267                 }
02268             }
02269             break;
02270 
02271         default:
02272             return(PrintBaseTab::HandleMsg(Msg));
02273     }       
02274     return TRUE;
02275 }  

BOOL PrintSepsTab::InitSection  )  [virtual]
 

Sets initial values for the print separations section of the options dialog box. This section includes the:-.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com> - adapted from Markn's stuff
Date:
12/6/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
AppPrefsDlg; OptionsTabs;

Reimplemented from PrintBaseTab.

Definition at line 2512 of file optsprin.cpp.

02513 {
02514     if (PrintBaseTab::InitSection())
02515     {
02516         TalkToPage();
02517         // First retrieve the custom list control object and set the column widths
02518 PORTNOTE("other", "Disabled CCustomList")
02519 #ifndef EXCLUDE_FROM_XARALX
02520         CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_LISTCOLOURS));
02521         ERROR2IF(!pListGadget, FALSE, "No list gadget");
02522         pListGadget->SetColumnWidth(0, GetSystemMetrics(SM_CXMENUCHECK) + 4); // Check 1
02523         pListGadget->SetColumnWidth(1, GetSystemMetrics(SM_CXMENUCHECK) + 5); // Check 2
02524         pListGadget->SetColumnWidth(2, 17); // Colour bitmaps
02525         pListGadget->SetColumnWidth(3, 90); // text 1
02526         pListGadget->SetColumnWidth(4, 50); // text 2
02527 
02528         BOOL ok = pListGadget->CreateCustomHeader(_R(IDB_HEADER));
02529         ERROR3IF(!ok, "Cannot create listview header");
02530 
02531         // Remember the current "print spots as process" setting so we can undo it on a cancel
02532         OldPrintSpotsAsProcess = IndexedColour::AreSpotsForcedToProcess();
02533 
02534         BOOL Result = UpdateSection(OptionsTabs::GetDocumentName());        // Update section just fills everything in from scratch
02535 
02536         if (!IsAllGreyed() && pDocument != NULL)
02537             pListGadget->SetSelectedItemIndex(0);
02538 
02539         return(Result);
02540 #endif
02541     }
02542 
02543     return FALSE;
02544 }

MsgResult PrintSepsTab::Message Msg pMessage  )  [virtual]
 

Handles miscellaneous system messages Note that many messages (e.g. docuement/view changing) are handled by the base dialogue, and call our UpdateSection() function. Only "left over" messages like ColourChangingMsg are passed on to the tabs.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/8/96
Parameters:
pMessage - the message [INPUTS]
Returns:
OK

Reimplemented from OptionsTabs.

Definition at line 2296 of file optsprin.cpp.

02297 {
02298     if (MESSAGE_IS_A(pMessage, ColourChangingMsg))
02299     {
02300         ColourChangingMsg *TheMsg = (ColourChangingMsg *) pMessage;
02301 
02302         switch ( TheMsg->State )
02303         {
02304             case ColourChangingMsg::COLOURUPDATED:
02305             case ColourChangingMsg::COLOURUPDATEDINVISIBLE:
02306             case ColourChangingMsg::LISTUPDATED:
02307                 // Only handle these messages - others will be handled implicitly
02308                 // by the Document/View changing handlers.
02309                 ShowDetails();
02310                 break;
02311             default:
02312                 break;
02313         }
02314     }
02315 
02316     return(OK);
02317 }

void PrintSepsTab::ReadCurrentPlateSettings TypesetInfo pTypesetInfo  )  [private]
 

Retrieves all the colour plate settings in the dialogue and writes them into the given TypesetInfo. Used to update both the LocalPrintControl.GetTypesetInfo() (when settings are changed) and the document's TypesetInfo (in CommitSection).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/9/96
Parameters:
pTypesetInfo is updated to reflect the current dialogue state [OUTPUTS]

Definition at line 2446 of file optsprin.cpp.

02447 {
02448     if (!TalkToPage())
02449         return;
02450 
02451     // Read the "Print Colour separations" check box state and set the print control
02452     // setting as appropriate
02453     BOOL DoSeparations = pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKSEPARATIONS));
02454     pTypesetInfo->SetSeparations(DoSeparations);
02455 
02456 PORTNOTE("other", "Disabled CCustomList")
02457 #ifndef EXCLUDE_FROM_XARALX
02458     // Read back the settings from the list view
02459     CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_LISTCOLOURS));
02460     if (pListGadget)
02461     {
02462         // Read the values of the list switches and set the print/overprint options accordingly
02463         BOOL ok = pTypesetInfo->CreatePlateList();
02464         ERROR3IF(!ok, "Unable to create plate list");
02465 
02466         ColourPlate* pPlate;
02467         pPlate = pTypesetInfo->GetFirstPlate();
02468         ERROR3IF(pPlate == NULL,"Error building colour plate list");
02469         for (INT32 j = 0; j < (INT32) pTypesetInfo->GetNumPlates(); j++)
02470         {
02471             if (pPlate)
02472             {
02473                 pPlate->SetDisabled(!pListGadget->GetSwitchState(j, 0));
02474                 pPlate->SetOverprint(pListGadget->GetSwitchState(j, 1));
02475 
02476                 // Reading in the angle and frequency values is a bit more complicated
02477                 String_256 Angle;
02478                 String_256 Frequency;
02479                 pListGadget->GetItemString(Angle, j, 4);
02480                 pListGadget->GetItemString(Frequency, j, 5);
02481                 pPlate->SetScreenInfo(camAtof((TCHAR*) Angle) , camAtof((TCHAR*) Frequency));
02482 
02483                 pPlate = pTypesetInfo->GetNextPlate(pPlate);
02484             }
02485         }
02486     }
02487     else
02488     {
02489         ERROR3("Failed to find list gadget");
02490     }
02491 #endif
02492 }

BOOL PrintSepsTab::ShowDetails CGadgetID pGadgetIDList,
CGadgetID  Exclude
[private]
 

Sets values for the print seps section of the options dialog box.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com> - adapted from Markn's stuff
Date:
12/6/96
Parameters:
pGadgetIDList = ptr to gadgets to show details in (NULL means all gadgets) [INPUTS] Exclude = gadget to exclude in list
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
AppPrefsDlg; OptionsTabs;

Definition at line 2717 of file optsprin.cpp.

02718 {
02719     // For now, just rebuild the entire tab
02720     BOOL ok = TalkToPage();
02721     if (!ok)
02722         return(FALSE);
02723 
02724     if (IsAllGreyed() || pDocument == NULL) // Don't try to fill in anything when the window is shaded
02725     {
02726 PORTNOTE("other", "Disabled CCustomList")
02727 #ifndef EXCLUDE_FROM_XARALX
02728         CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_LISTCOLOURS));
02729         if (pListGadget != NULL)
02730             pListGadget->DeleteAllItems();
02731 #endif
02732         EnableControls();
02733         return(TRUE);
02734     }
02735 
02736     ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintSepsTab::InitSection called with no dialog pointer");
02737 
02738     TypesetInfo* tpInfo = LocalPrintControl.GetTypesetInfo();
02739     ERROR2IF(tpInfo == NULL,FALSE,"Error in PrintSepsTab::InitSection() : unexpected null pointer");
02740 
02741     // Now set up the controls
02742     pPrefsDlg->SetBoolGadgetSelected(_R(IDC_PRINTERDEFAULTS), !tpInfo->AreScreening());
02743     pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CUSTOMSETTINGS), tpInfo->AreScreening());
02744 
02745 
02746     // Set up the printer resolution list (just a default value at this stage)
02747     static INT32 Resolution[] = 
02748     {
02749         300,
02750         600,
02751         635,
02752         1200,
02753         1270,
02754         1693,
02755         2400,
02756         2540,
02757         0       // NULL terminator
02758     };
02759 
02760     pPrefsDlg->DeleteAllValues(_R(IDC_COMBORESOLUTION));
02761     String_256 Temp;
02762     INT32 i = 0;
02763     INT32 Selected = -1;
02764     while (Resolution[i] != 0)
02765     {
02766         if (Resolution[i] == tpInfo->GetPrintResolution())
02767             Selected = i;
02768 
02769         Temp._MakeMsg(TEXT("#1%ld"), Resolution[i]);
02770         pPrefsDlg->SetStringGadgetValue(_R(IDC_COMBORESOLUTION), Temp, FALSE, i);
02771         i++;
02772     }
02773 // As usual, this call causes dreadful gadget flicker
02774 //  pPrefsDlg->SetComboListLength(_R(IDC_COMBORESOLUTION));
02775 
02776     if (Selected >= 0)
02777         pPrefsDlg->SetSelectedValueIndex(_R(IDC_COMBORESOLUTION), Selected);
02778     else
02779     {
02780         Temp._MakeMsg(TEXT("#1%ld"), tpInfo->GetPrintResolution());
02781         pPrefsDlg->SetStringGadgetValue(_R(IDC_COMBORESOLUTION),Temp, FALSE, -1);
02782     }
02783 
02784     //Set up the screen frequency list (just a default value at this stage)  
02785     static INT32 Frequency[] =
02786     {
02787         60,
02788         70,
02789         80,
02790         90,
02791         100,
02792         110,
02793         120,
02794         130,
02795         140,
02796         150,
02797         0
02798     };
02799 
02800     pPrefsDlg->DeleteAllValues(_R(IDC_COMBOFREQUENCY));
02801     i = 0;
02802     Selected = -1;
02803     while (Frequency[i] != 0)
02804     {
02805         if ((double)Frequency[i] == tpInfo->GetDefaultScreenFrequency())
02806             Selected = i;
02807 
02808         Temp._MakeMsg(TEXT("#1%ld"), Frequency[i]);
02809         pPrefsDlg->SetStringGadgetValue(_R(IDC_COMBOFREQUENCY), Temp, FALSE, i);
02810         i++;
02811     }
02812 // As usual, this call causes dreadful gadget flicker
02813 //  pPrefsDlg->SetComboListLength(_R(IDC_COMBOFREQUENCY));
02814 
02815     if (Selected >= 0)
02816         pPrefsDlg->SetSelectedValueIndex(_R(IDC_COMBOFREQUENCY), Selected);
02817     else
02818     {
02819         // Put in the user custom value, with as few decimal places as we can get away with
02820 //      ConvertDoubleToMinString(tpInfo->GetDefaultScreenFrequency(), &Temp);
02821         INT32 IntFreq = (INT32) floor(tpInfo->GetDefaultScreenFrequency());
02822         Temp._MakeMsg(TEXT("#1%d"), IntFreq);
02823         pPrefsDlg->SetStringGadgetValue(_R(IDC_COMBOFREQUENCY), Temp, FALSE, -1);
02824     }
02825 
02826     //Set up the screen types list
02827     pPrefsDlg->DeleteAllValues(_R(IDC_COMBOTYPE));
02828 
02829     for (i = 0; ScreenIDs[i]; i++)
02830     {
02831         String_256 screenType(ScreenIDs[i]);
02832         pPrefsDlg->SetStringGadgetValue(_R(IDC_COMBOTYPE), screenType, FALSE, i);
02833     }
02834 
02835     pPrefsDlg->SetSelectedValueIndex(_R(IDC_COMBOTYPE), ((INT32)tpInfo->GetScreenFunction()) - 1);
02836 
02837     // Set the "Print colour separations" checkbox
02838     pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKSEPARATIONS), tpInfo->AreSeparating());
02839 
02840     // Set up the separations list box
02841 PORTNOTE("other", "Disabled CCustomList")
02842 #ifndef EXCLUDE_FROM_XARALX
02843     CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_LISTCOLOURS));
02844     ERROR2IF(pListGadget == NULL, FALSE, "No list gadget?!");
02845 
02846     // Remember the selected item so we can restore it after rebuilding the list
02847     INT32 SelectedItem = pListGadget->GetSelectedItemIndex();
02848     if (SelectedItem < 0)
02849         SelectedItem = 0;
02850 
02851     // Clear the gadget out and rebuild it for the (new) plate list
02852     pListGadget->DeleteAllItems();
02853 #endif
02854 
02855     // Set the "print spot colours as process colours" flag appropriately
02856     pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKPROCESS), IndexedColour::AreSpotsForcedToProcess());
02857 
02858     // Call CreatePlateList to ensure that the list of printing plates is set up
02859     // This will just update the list (if necessary) if it has been previously created
02860     ok = tpInfo->CreatePlateList();
02861     ERROR2IF(!ok, FALSE, "Unable to create plate list");
02862 
02863     ColourPlate* pPlate;
02864     pPlate = tpInfo->GetFirstPlate();
02865     ERROR2IF(pPlate == NULL, FALSE, "PrintSepsTab::Init() : unable to get first plate");
02866 
02867     // First we loop through the plates just to have a look at their angle values so that we know how
02868     // to format them in the second loop
02869     INT32 AnglePrecision = 1;
02870     INT32 FreqPrecision = 1;
02871     for (i = 0 ; i < (INT32) tpInfo->GetNumPlates(); i++)
02872     {
02873         if (pPlate)
02874         {
02875             // For each plate, see how many decimal places it needs to display
02876             INT32 MinPrecision = ConvertDoubleToMinString(pPlate->GetScreenAngle(), &Temp);
02877             if (MinPrecision > AnglePrecision)
02878                 AnglePrecision = MinPrecision;
02879 
02880             MinPrecision = ConvertDoubleToMinString(pPlate->GetScreenFrequency(), &Temp);
02881             if (MinPrecision > FreqPrecision)
02882                 FreqPrecision = MinPrecision;
02883 
02884             pPlate = tpInfo->GetNextPlate(pPlate);
02885         }
02886     }
02887 
02888     // Second loop, this time round we fill in the plate list
02889     pPlate = tpInfo->GetFirstPlate();
02890     for (i = 0 ; i < (INT32) tpInfo->GetNumPlates(); i++)
02891     {
02892         if (pPlate)
02893         {
02894             String_256 plateDescription;
02895             pPlate->GetDescription(&plateDescription);
02896 
02897             double Angle = pPlate->GetScreenAngle();
02898             double Frequency = pPlate->GetScreenFrequency();
02899             ERROR3IF(Angle < 0.0 || Angle >= 360.0, "Colour plate returns an illegal screen angle");
02900             ERROR3IF(Frequency < 1.0 || Frequency > 1000.0, "Colour plate returns an illegal screen frequency");
02901 
02902 
02903             String_256 plateAngle;
02904             String_256 plateFrequency;
02905 
02906 //          plateAngle.MakeMsg(_R(IDS_DEGREES), Angle);
02907 //          String_256 DegreeFormat(_R(IDS_DEGREES));           
02908             //_stprintf((TCHAR *)plateAngle, (TCHAR *)DegreeFormat, Angle);
02909 //          _stprintf((TCHAR *)plateAngle,"%.*f", precision,  Angle);
02910             Convert::DoubleToString(Angle, (StringBase *) &plateAngle, AnglePrecision);
02911             plateAngle += TEXT("");     // Let's give the internationalisation boys a heart attack
02912 
02913 //          plateFrequency.MakeMsg(_R(IDS_LPI_FLOAT), Frequency);           
02914 //          String_256 FreqFormat(_R(IDS_LPI_FLOAT));
02915 //          _stprintf((TCHAR *)plateFrequency, (TCHAR *)FreqFormat, Frequency);
02916             Convert::DoubleToString(Frequency, (StringBase *) &plateFrequency, FreqPrecision);
02917 
02918             // Draw the colour patch, converting to screen RGB with the selected view's
02919             // colour context, so that we use the same colour correction options as that view
02920             ColourContext *cc = ColourManager::GetColourContext(COLOURMODEL_RGBT, DocView::GetSelected());
02921 
02922             DocColour PlateCol;
02923             pPlate->GetDisplayColour(&PlateCol);
02924 
02925             PColourRGBT RGB;
02926             cc->ConvertColour(&PlateCol, (ColourPacked *) &RGB);
02927 
02928 PORTNOTE("other", "Disabled CCustomList")
02929 #ifndef EXCLUDE_FROM_XARALX
02930             ok = pListGadget->AddColourListItem(plateDescription, RGB.Red, RGB.Green, RGB.Blue,
02931                                                 pPlate->GetType() == COLOURPLATE_SPOT);
02932             ERROR3IF(!ok, "Failed to add item to list");
02933 
02934             // Add the text columns
02935             ok = pListGadget->SetItemString(plateAngle, i, 4);
02936             ERROR3IF(!ok, "Failed to set listview string");
02937 
02938             ok = pListGadget->SetItemString(plateFrequency, i, 5);
02939             ERROR3IF(!ok, "Failed to set listview string");
02940 
02941             pListGadget->SetSwitchState(!pPlate->IsDisabled(), i, 0);
02942             pListGadget->SetSwitchState(pPlate->Overprints(), i, 1);
02943 #endif
02944             pPlate = tpInfo->GetNextPlate(pPlate);
02945         }
02946         else
02947             ERROR3("Fewer printing plates were found than expected");
02948 
02949     }
02950 
02951     // Shade/unshade the controls as appropriate
02952     EnableControls();
02953 
02954 PORTNOTE("other", "Disabled CCustomList")
02955 #ifndef EXCLUDE_FROM_XARALX
02956     // And re-select the previously selected (or first) item in the plate list
02957     pListGadget->SetSelectedItemIndex(SelectedItem);
02958 #endif
02959 
02960     return TRUE;
02961 }

BOOL PrintSepsTab::ShowDetails  )  [private, virtual]
 

Sets values for the print layout section of the options dialog box.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/6/96
Parameters:
pGadgetIDList = ptr to gadgets to show details in (NULL means all gadgets) [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
AppPrefsDlg; OptionsTabs; ShowDetails(CGadgetID* pGadgetIDList,CGadgetID Exclude)

Implements PrintBaseTab.

Definition at line 2694 of file optsprin.cpp.

02695 {
02696     return ShowDetails(NULL,0);
02697 }

BOOL PrintSepsTab::UngreySection  )  [virtual]
 

Called when the user has opened a document. Gives any tabbed dialog a chance to update any fields which may have been greyed when the last document was closed.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>/Adrian
Date:
20/8/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
PrintSepsTab::GreySection(); PrintSepsTab::UpdateSection();

Reimplemented from PrintBaseTab.

Definition at line 2619 of file optsprin.cpp.

02620 {
02621     if (TalkToPage())
02622     {
02623         // Switch to the new document print control  and update the tab
02624         if (pDocument)
02625             UpdateSection(OptionsTabs::GetDocumentName());  
02626 
02627         EnableControl((CGadgetID) _R(IDC_PRINT_DOCNAMETEXT), TRUE);
02628         EnableControl((CGadgetID) _R(IDC_PRINT_DOCNAME), TRUE);
02629         EnableControl((CGadgetID) _R(IDC_SSTATIC1), TRUE);
02630         EnableControl((CGadgetID) _R(IDC_SSTATIC2), TRUE);
02631         EnableControl((CGadgetID) _R(IDC_SSTATIC3), TRUE);
02632         EnableControl((CGadgetID) _R(IDC_SSTATIC4), TRUE);
02633         EnableControl((CGadgetID) _R(IDC_SSTATIC5), TRUE);
02634         EnableControl((CGadgetID) _R(IDC_SSTATIC6), TRUE);
02635     }
02636     return PrintBaseTab::UngreySection();
02637 }

BOOL PrintSepsTab::UpdateSection String_256 DocumentName  )  [virtual]
 

Called when the user has clicked on a new document or opened a new document. Gives any tabbed dialog a chance to update any fields which are used to reflect the current document's status. The document name allows the info field on the tab to be filled in correctly.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/8/96
Parameters:
Name of document [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
PrintSepsTab::UngreySection(); PrintSepsTab::GreySection();

Reimplemented from PrintBaseTab.

Definition at line 2659 of file optsprin.cpp.

02660 {
02661     // Copy all the new document's details into our local print control
02662     CopyLocalPrintControlFromDoc();
02663 
02664     BOOL ok = TalkToPage();
02665     if (!ok)
02666         return(FALSE);
02667 
02668     // Set the new document name
02669     pPrefsDlg->SetStringGadgetValue(_R(IDC_PRINT_DOCNAME), *DocumentName);
02670 
02671     // And show the new details
02672     ShowDetails(NULL, 0);
02673     
02674     return TRUE;
02675 }


Member Data Documentation

BOOL PrintSepsTab::OldPrintSpotsAsProcess [private]
 

Definition at line 376 of file optsprin.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:07 2007 for Camelot by  doxygen 1.4.4