00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 #include "camtypes.h"
00105
00106
00107 #ifndef WEBSTER
00108 #include "appprefs.h"
00109 #include "optsprin.h"
00110 #include "optsmsgs.h"
00111
00112 #include "princomp.h"
00113
00114
00115 #include "colplate.h"
00116 #include "printmsg.h"
00117
00118
00119
00120 #include "prdlgctl.h"
00121
00122 #include "camelot.h"
00123
00124 #include "prnmks.h"
00125 #include "prnmkcom.h"
00126 #include "colmsg.h"
00127 #include "colormgr.h"
00128 #include "bubbleid.h"
00129
00130
00131 #ifdef _DEBUG
00132 #include "noderect.h"
00133 #include "layer.h"
00134
00135
00136 #include "sglayer.h"
00137 #include "keypress.h"
00138
00139 #endif
00140
00141
00142
00143
00144 CC_IMPLEMENT_DYNAMIC(PrintBaseTab, OptionsTabs)
00145 CC_IMPLEMENT_DYNAMIC(PrintGeneralTab, PrintBaseTab)
00146 CC_IMPLEMENT_DYNAMIC(PrintLayoutTab, PrintBaseTab)
00147 CC_IMPLEMENT_DYNAMIC(PrintSepsTab, PrintBaseTab)
00148 CC_IMPLEMENT_DYNAMIC(PrintImagesetterTab, PrintBaseTab)
00149 CC_IMPLEMENT_DYNCREATE(OpShowPrintBorders, Operation)
00150 CC_IMPLEMENT_DYNCREATE(SepsDlg, DialogOp);
00151
00152
00153
00154
00155 DECLARE_SOURCE("$Revision: 1357 $");
00156
00157
00158
00159 static BOOL IgnoreTextChangedMsgs = FALSE;
00160
00161
00162
00163
00164
00165
00166 PrintControl PrintBaseTab::LocalPrintControl;
00167 Document *PrintBaseTab::pLastPrintControlDocument = NULL;
00168
00169 static CGadgetID ScreenIDs[] =
00170 {
00171
00172 _R(SCREEN_TYPE_BASE),
00173 _R(IDS_SCRTYPE_SPOT1),
00174 _R(IDS_SCRTYPE_SPOT2),
00175 _R(IDS_SCRTYPE_TRIPLESPOT1),
00176 _R(IDS_SCRTYPE_TRIPLESPOT2),
00177 _R(IDS_SCRTYPE_ELLIPTICAL),
00178 _R(IDS_SCRTYPE_LINE),
00179 _R(IDS_SCRTYPE_CROSSHATCH),
00180 _R(IDS_SCRTYPE_MEZZOTINT),
00181 _R(IDS_SCRTYPE_SQUARE),
00182 _R(IDS_SCRTYPE_DITHER),
00183 0
00184 };
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203 PrintBaseTab::PrintBaseTab()
00204 {
00205 }
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225 PrintBaseTab::~PrintBaseTab()
00226 {
00227
00228 pLastPrintControlDocument = NULL;
00229
00230
00231
00232 PrintControl BlankPC;
00233 LocalPrintControl = BlankPC;
00234 }
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254 BOOL PrintBaseTab::IsDocumentOption()
00255 {
00256 return FALSE;
00257 }
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 BOOL PrintBaseTab::IsProgramOption()
00278 {
00279 return FALSE;
00280 }
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300 BOOL PrintBaseTab::IsPrintingOption()
00301 {
00302 return TRUE;
00303 }
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322 BOOL PrintBaseTab::TalkToPage()
00323 {
00324 if (pPrefsDlg != NULL)
00325 return (pPrefsDlg->TalkToPage(GetPageID()));
00326
00327 return FALSE;
00328 }
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348 void PrintBaseTab::UpdateDocName()
00349 {
00350 if (pPrefsDlg != NULL && TalkToPage())
00351 pPrefsDlg->SetStringGadgetValue(_R(IDC_PRINT_DOCNAME),*GetDocumentName());
00352 }
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371 BOOL PrintBaseTab::GreySection()
00372 {
00373 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintBaseTab::GreySection called with no dialog pointer");
00374
00375
00376 pLastPrintControlDocument = NULL;
00377
00378
00379
00380 PrintControl BlankPC;
00381 LocalPrintControl = BlankPC;
00382
00383 if (TalkToPage())
00384 {
00385
00386
00387 UpdateDocName();
00388
00389 AllGreyed = TRUE;
00390 EnableControls();
00391 }
00392
00393 return TRUE;
00394 }
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413 BOOL PrintBaseTab::UngreySection()
00414 {
00415 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintBaseTab::UngreySection called with no dialog pointer");
00416
00417
00418 pLastPrintControlDocument = NULL;
00419
00420
00421
00422 PrintControl BlankPC;
00423 LocalPrintControl = BlankPC;
00424
00425 if (TalkToPage())
00426 {
00427
00428
00429 UpdateDocName();
00430
00431 AllGreyed = FALSE;
00432
00433 ShowDetails();
00434 EnableControls();
00435 }
00436
00437 return TRUE;
00438 }
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458 BOOL PrintBaseTab::UpdateSection(String_256 *DocumentName)
00459 {
00460 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintBaseTab::UpdateSection called with no dialog pointer");
00461
00462 if (!TalkToPage())
00463 return TRUE;
00464
00465
00466 return InitSection();
00467 }
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489 PrintControl* PrintBaseTab::GetPrintControl()
00490 {
00491
00492 if (pDocument == NULL)
00493 return NULL;
00494
00495
00496 PrintComponent* pPrComp = (PrintComponent*)pDocument->GetDocComponent(CC_RUNTIME_CLASS(PrintComponent));
00497 ERROR2IF(pPrComp == NULL,NULL,"Can't find the associated doc's print component");
00498
00499
00500 PrintControl* pPrCtrl = pPrComp->GetPrintControl();
00501 ERROR2IF(pPrCtrl == NULL,NULL,"The doc's print component gave me a NULL print control object");
00502
00503 return pPrCtrl;
00504 }
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536 void PrintBaseTab::CopyLocalPrintControlFromDoc(void)
00537 {
00538
00539
00540 if (pLastPrintControlDocument == pDocument)
00541 return;
00542
00543 PrintControl *PrintCtrl = GetPrintControl();
00544 if (PrintCtrl != NULL)
00545 {
00546 LocalPrintControl = *PrintCtrl;
00547 LocalPrintControl.SetUp(pDocument->GetSelectedSpread());
00548
00549 pLastPrintControlDocument = pDocument;
00550 }
00551 }
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566 void PrintBaseTab::DocumentSettingsUpdated(void)
00567 {
00568 Document *pDoc = Document::GetSelected();
00569 if (pDoc != NULL)
00570 {
00571 PrintComponent* pPrComp = (PrintComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(PrintComponent));
00572 if (pPrComp != NULL)
00573 {
00574 PrintControl* pPrCtrl = pPrComp->GetPrintControl();
00575 if (pPrCtrl != NULL)
00576 {
00577 LocalPrintControl = *pPrCtrl;
00578 LocalPrintControl.SetUp(pDoc->GetSelectedSpread());
00579
00580 pLastPrintControlDocument = pDoc;
00581 }
00582 }
00583 }
00584 }
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604 void PrintBaseTab::CopyLocalPrintControlToDoc(void)
00605 {
00606 PrintControl *PrintCtrl = GetPrintControl();
00607 if (PrintCtrl != NULL)
00608 {
00609 *PrintCtrl = LocalPrintControl;
00610 if (pDocument)
00611 pDocument->SetModified(TRUE);
00612 }
00613 }
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631 BOOL PrintBaseTab::InitSection()
00632 {
00633 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintBaseTab::InitSection called with no dialog pointer");
00634
00635 if (pDocument == NULL)
00636 return GreySection();
00637
00638 AllGreyed = FALSE;
00639
00640
00641
00642 UpdateDocName();
00643
00644
00645 CopyLocalPrintControlFromDoc();
00646
00647 if (!TalkToPage())
00648 return TRUE;
00649
00650
00651
00652 return TRUE;
00653 }
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672 BOOL PrintBaseTab::PageSizeHasChanged()
00673 {
00674
00675 LocalPrintControl.SetUp(pDocument->GetSelectedSpread());
00676
00677 if (!TalkToPage())
00678 return TRUE;
00679
00680 return ShowDetails();
00681 }
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701 void PrintBaseTab::EnableControl(CGadgetID Gadget, BOOL Enabled)
00702 {
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720 if (pPrefsDlg != NULL)
00721 pPrefsDlg->EnableGadget(Gadget,Enabled && !AllGreyed);
00722 }
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739 void PrintBaseTab::PrintSettingsChanged()
00740 {
00741 if (IsAllGreyed())
00742 return;
00743
00744
00745 LocalPrintControl.SetUp(pDocument->GetSelectedSpread());
00746
00747 if (TalkToPage())
00748 ShowDetails();
00749 }
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773 BOOL PrintBaseTab::HandleMsg(DialogMsg* Msg)
00774 {
00775 ERROR2IF(Msg == NULL,FALSE,"PrintGeneralTab::Message null message received");
00776 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintGeneralTab::HandleMsg called with no dialog pointer");
00777
00778 BOOL ok = TalkToPage();
00779 if (!ok)
00780 return TRUE;
00781
00782 switch(Msg->DlgMsg)
00783 {
00784 case DIM_CREATE:
00785 ok = InitSection();
00786 if (!ok)
00787 InformError();
00788 else
00789 ShowDetails();
00790 break;
00791
00792
00793 case DIM_CANCEL:
00794 {
00795
00796 pLastPrintControlDocument = NULL;
00797
00798
00799
00800 PrintControl BlankPC;
00801 LocalPrintControl = BlankPC;
00802 break;
00803 }
00804
00805 default:
00806 break;
00807 }
00808
00809 return TRUE;
00810 }
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830 BOOL PrintBaseTab::CommitSection()
00831 {
00832 if (!IsAllGreyed() && pDocument != NULL)
00833 CopyLocalPrintControlToDoc();
00834
00835 pLastPrintControlDocument = NULL;
00836
00837 return(TRUE);
00838 }
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865 PrintGeneralTab::PrintGeneralTab()
00866 {
00867 }
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885 PrintGeneralTab::~PrintGeneralTab()
00886 {
00887 }
00888
00889 CDlgResID PrintGeneralTab::GetPageID() { return _R(IDD_OPTSTAB_PRINTGENERAL); }
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906 BOOL PrintGeneralTab::HandleMsg(DialogMsg* Msg)
00907 {
00908 ERROR2IF(Msg == NULL,FALSE,"PrintGeneralTab::Message null message received");
00909 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintGeneralTab::HandleMsg called with no dialog pointer");
00910
00911 BOOL ok = TalkToPage();
00912 if (!ok)
00913 return TRUE;
00914
00915 switch(Msg->DlgMsg)
00916 {
00917 case DIM_LFT_BN_CLICKED:
00918 OptionsTabs::SetApplyNowState(TRUE);
00919 if (FALSE) {}
00920
00921 else if (Msg->GadgetID == _R(IDC_ALLFOREGROUND))
00922 {
00923 LocalPrintControl.SetPrintLayers(PRINTLAYERS_ALLFOREGROUND);
00924 }
00925 else if (Msg->GadgetID == _R(IDC_VISIBLEFOREGROUND))
00926 {
00927 LocalPrintControl.SetPrintLayers(PRINTLAYERS_VISIBLEFOREGROUND);
00928 }
00929 #if 0
00930
00931
00932 else if (Msg->GadgetID == _R(IDC_PSLEVELAUTO))
00933 {
00934 LocalPrintControl.SetPSLevel(PSLEVEL_AUTO);
00935 }
00936 else if (Msg->GadgetID == _R(IDC_PSLEVEL1))
00937 {
00938 LocalPrintControl.SetPSLevel(PSLEVEL_1);
00939 }
00940 else if (Msg->GadgetID == _R(IDC_PSLEVEL2))
00941 {
00942 LocalPrintControl.SetPSLevel(PSLEVEL_2);
00943 }
00944 #endif
00945
00946 else if (Msg->GadgetID == _R(IDC_PRINTMETHOD_NORMAL))
00947 {
00948 LocalPrintControl.SetPrintMethod(PRINTMETHOD_NORMAL);
00949 ShowDetails();
00950 }
00951 else if (Msg->GadgetID == _R(IDC_PRINTMETHOD_BITMAP))
00952 {
00953 LocalPrintControl.SetPrintMethod(PRINTMETHOD_BITMAP);
00954 ShowDetails();
00955 }
00956 else if (Msg->GadgetID == _R(IDC_PRINTMETHOD_AABITMAP))
00957 {
00958 LocalPrintControl.SetPrintMethod(PRINTMETHOD_AABITMAP);
00959 ShowDetails();
00960 }
00961
00962
00963 else if (Msg->GadgetID == _R(IDC_DPIAUTO))
00964 {
00965 LocalPrintControl.SetBitmapResMethod(BITMAPRES_AUTO);
00966 ShowDetails();
00967 }
00968 else if (Msg->GadgetID == _R(IDC_DPIMANUAL))
00969 {
00970 LocalPrintControl.SetBitmapResMethod(BITMAPRES_MANUAL);
00971 ShowDetails();
00972 }
00973
00974 else if (Msg->GadgetID == _R(IDC_ALLTEXTASSHAPES))
00975 {
00976 PrintTextOptions pto = LocalPrintControl.GetTextOptions();
00977 pto = (pto == PRINTTEXTOPTIONS_NORMAL) ? PRINTTEXTOPTIONS_ALLTEXTASSHAPES
00978 : PRINTTEXTOPTIONS_NORMAL;
00979 LocalPrintControl.SetTextOptions(pto);
00980 ShowDetails();
00981 }
00982
00983 break;
00984
00985 case DIM_SELECTION_CHANGED:
00986 OptionsTabs::SetApplyNowState(TRUE);
00987 if (Msg->GadgetID == _R(IDC_FILLQUALLIST))
00988 {
00989 WORD Index;
00990 pPrefsDlg->GetValueIndex(_R(IDC_FILLQUALLIST),&Index);
00991 LocalPrintControl.SetFillQuality(PrintFillQuality(Index));
00992 ShowDetails();
00993 }
00994 break;
00995
00996 case DIM_TEXT_CHANGED:
00997 OptionsTabs::SetApplyNowState(TRUE);
00998 if (Msg->GadgetID == _R(IDC_DPIEDIT))
00999 {
01000 INT32 DPI = pPrefsDlg->GetLongGadgetValue(_R(IDC_DPIEDIT),0,0);
01001 LocalPrintControl.SetDotsPerInch(DPI);
01002 }
01003 break;
01004
01005 default:
01006 return(PrintBaseTab::HandleMsg(Msg));
01007 }
01008
01009 return TRUE;
01010 }
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029 BOOL PrintGeneralTab::CommitSection()
01030 {
01031 if (IsAllGreyed() || pDocument == NULL)
01032 return(PrintBaseTab::CommitSection());
01033
01034 ERROR3IF(pPrefsDlg == NULL, "PrintGeneralTab::CommitSection called with no dialog pointer");
01035
01036 if (!TalkToPage())
01037 return TRUE;
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100 return(PrintBaseTab::CommitSection());
01101 }
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119 BOOL PrintGeneralTab::ShowDetails()
01120 {
01121 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintGeneralTab::ShowDetailscalled with no dialog pointer");
01122
01123 String_256 Str;
01124
01125
01126 PrintLayers pl = LocalPrintControl.GetPrintLayers();
01127 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_ALLFOREGROUND), pl == PRINTLAYERS_ALLFOREGROUND);
01128 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_VISIBLEFOREGROUND),pl == PRINTLAYERS_VISIBLEFOREGROUND);
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140 PrintMethodType pm = LocalPrintControl.GetPrintMethod();
01141 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_PRINTMETHOD_NORMAL), pm == PRINTMETHOD_NORMAL);
01142 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_PRINTMETHOD_BITMAP), pm == PRINTMETHOD_BITMAP);
01143 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_PRINTMETHOD_AABITMAP), pm == PRINTMETHOD_AABITMAP);
01144
01145 if (CCPrintDialog::IsPostscript())
01146 Str.Load(_R(IDS_K_OPTSPRIN_POSTSCIPT));
01147 else
01148 Str.Load(_R(IDS_K_OPTSPRIN_NORMAL));
01149
01150 pPrefsDlg->SetStringGadgetValue(_R(IDC_PRINTMETHOD_NORMAL),Str);
01151
01152
01153 BitmapResMethod brm = LocalPrintControl.GetBitmapResMethod();
01154 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_DPIAUTO), brm == BITMAPRES_AUTO);
01155 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_DPIMANUAL),brm == BITMAPRES_MANUAL);
01156 pPrefsDlg->SetLongGadgetValue(_R(IDC_DPIEDIT), LocalPrintControl.GetDotsPerInch());
01157
01158
01159 if (pm == PRINTMETHOD_NORMAL) Str.Load(_R(IDS_K_OPTSPRIN_TRANSRES));
01160 if (pm == PRINTMETHOD_BITMAP) Str.Load(_R(IDS_K_OPTSPRIN_BITMAPRES));
01161 if (pm == PRINTMETHOD_AABITMAP) Str.Load(_R(IDS_K_OPTSPRIN_AABITMAPRES));
01162 pPrefsDlg->SetStringGadgetValue(_R(IDC_GROUP_DPI),Str);
01163
01164
01165 pPrefsDlg->SetSelectedValueIndex(_R(IDC_FILLQUALLIST),INT32(LocalPrintControl.GetFillQuality()));
01166
01167
01168 PrintTextOptions pto = LocalPrintControl.GetTextOptions();
01169 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_ALLTEXTASSHAPES), pto != PRINTTEXTOPTIONS_NORMAL);
01170
01171
01172 return EnableControls();
01173 }
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191 BOOL PrintGeneralTab::EnableControls()
01192 {
01193 if (pPrefsDlg == NULL) return TRUE;
01194
01195 if (!TalkToPage())
01196 return(TRUE);
01197
01198
01199 EnableControl(_R(IDC_PRINT_DOCNAME), TRUE);
01200 EnableControl(_R(IDC_OUTPUT_DOCNAMETEXT),TRUE);
01201
01202
01203 EnableControl(_R(IDC_GROUP_PRINTLAYERS),TRUE);
01204 EnableControl(_R(IDC_ALLFOREGROUND), TRUE);
01205 EnableControl(_R(IDC_VISIBLEFOREGROUND),TRUE);
01206
01207
01208 BOOL IsPostcript = CCPrintDialog::IsPostscript();
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218 EnableControl(_R(IDC_GROUP_PRINTMETHOD), TRUE);
01219 EnableControl(_R(IDC_PRINTMETHOD_NORMAL), TRUE);
01220 EnableControl(_R(IDC_PRINTMETHOD_BITMAP), TRUE);
01221 EnableControl(_R(IDC_PRINTMETHOD_AABITMAP), TRUE);
01222
01223
01224 EnableControl(_R(IDC_GROUP_DPI), TRUE);
01225 EnableControl(_R(IDC_DPIAUTO), TRUE);
01226 EnableControl(_R(IDC_DPIMANUAL), TRUE);
01227 EnableControl(_R(IDC_DPIEDIT), (LocalPrintControl.GetBitmapResMethod() == BITMAPRES_MANUAL));
01228 EnableControl(_R(IDC_DPIEDITTEXT), (LocalPrintControl.GetBitmapResMethod() == BITMAPRES_MANUAL));
01229
01230
01231 BOOL Normal = (LocalPrintControl.GetPrintMethod() == PRINTMETHOD_NORMAL);
01232 EnableControl(_R(IDC_GROUP_FILLQUAL), Normal && (!IsPostcript));
01233 EnableControl(_R(IDC_FILLQUALTEXT), Normal && (!IsPostcript));
01234 EnableControl(_R(IDC_FILLQUALLIST), Normal && (!IsPostcript));
01235
01236
01237 EnableControl(_R(IDC_GROUP_TEXTOPTIONS), TRUE);
01238 EnableControl(_R(IDC_ALLTEXTASSHAPES), TRUE);
01239
01240 return TRUE;
01241 }
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263 PrintLayoutTab::PrintLayoutTab()
01264 {
01265 }
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283 PrintLayoutTab::~PrintLayoutTab()
01284 {
01285 }
01286
01287 CDlgResID PrintLayoutTab::GetPageID() { return _R(IDD_OPTSTAB_PRINTLAYOUT); }
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304 BOOL PrintLayoutTab::HandleMsg(DialogMsg* Msg)
01305 {
01306 ERROR2IF(Msg == NULL,FALSE,"PrintLayoutTab::Message null message received");
01307 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintLayoutTab::HandleMsg called with no dialog pointer");
01308
01309 BOOL ok = TalkToPage();
01310 if (!ok)
01311 return TRUE;
01312
01313 switch(Msg->DlgMsg)
01314 {
01315 case DIM_CREATE:
01316 ok = InitSection();
01317 if (!ok)
01318 InformError();
01319 break;
01320
01321 case DIM_LFT_BN_CLICKED:
01322 OptionsTabs::SetApplyNowState(TRUE);
01323
01324 if (FALSE) {}
01325
01326 else if (Msg->GadgetID == _R(IDC_BTN_UPRIGHT))
01327 {
01328 LocalPrintControl.SetPrintOrient(PRINTORIENTATION_UPRIGHT);
01329 ShowDetails();
01330 }
01331 else if (Msg->GadgetID == _R(IDC_BTN_SIDEWAYS))
01332 {
01333 LocalPrintControl.SetPrintOrient(PRINTORIENTATION_SIDEWAYS);
01334 ShowDetails();
01335 }
01336
01337 else if (Msg->GadgetID == _R(IDC_DPS_INDIVIDUALPAGES))
01338 {
01339 LocalPrintControl.SetWholeSpread(FALSE);
01340 ShowDetails();
01341 }
01342 else if (Msg->GadgetID == _R(IDC_DPS_WHOLESPREAD))
01343 {
01344 LocalPrintControl.SetWholeSpread(TRUE);
01345 ShowDetails();
01346 }
01347
01348 else if (Msg->GadgetID == _R(IDC_BESTFIT))
01349 {
01350 LocalPrintControl.SetFitType(PRINTFIT_BEST);
01351 ShowDetails();
01352 }
01353 else if (Msg->GadgetID == _R(IDC_CUSTOMFIT))
01354 {
01355 LocalPrintControl.SetFitType(PRINTFIT_CUSTOM);
01356 ShowDetails();
01357 }
01358 else if (Msg->GadgetID == _R(IDC_MULTIPLEFIT))
01359 {
01360 LocalPrintControl.SetFitType(PRINTFIT_MULTIPLE);
01361 ShowDetails();
01362 }
01363 else if (Msg->GadgetID == _R(IDC_BESTFITPAPER))
01364 {
01365 LocalPrintControl.SetFitType(PRINTFIT_BESTPAPER);
01366 ShowDetails();
01367 }
01368 break;
01369
01370 case DIM_SELECTION_CHANGED:
01371 OptionsTabs::SetApplyNowState(TRUE);
01372 break;
01373
01374 case DIM_TEXT_CHANGED:
01375 OptionsTabs::SetApplyNowState(TRUE);
01376
01377 if (!IgnoreTextChangedMsgs)
01378 {
01379 if (FALSE) {}
01380
01381 else if (Msg->GadgetID == _R(IDC_SCALEEDIT))
01382 {
01383 double Scale = pPrefsDlg->GetDoubleGadgetValue(_R(IDC_SCALEEDIT),0,0);
01384
01385 if (Scale > 32000.0) Scale = 32000.0;
01386 if (Scale < 0) Scale = 0.0;
01387 LocalPrintControl.SetScale(FIXED16(Scale));
01388 ShowDetails(NULL,_R(IDC_SCALEEDIT));
01389 }
01390
01391 else if (Msg->GadgetID == _R(IDC_TOPEDIT))
01392 {
01393 LocalPrintControl.SetTopMargin(pPrefsDlg->GetUnitGadgetValue(_R(IDC_TOPEDIT),CurrentPageUnits,0,0));
01394 ShowDetails(NULL,_R(IDC_TOPEDIT));
01395 }
01396 else if (Msg->GadgetID == _R(IDC_LEFTEDIT))
01397 {
01398 LocalPrintControl.SetLeftMargin(pPrefsDlg->GetUnitGadgetValue(_R(IDC_LEFTEDIT),CurrentPageUnits,0,0));
01399 ShowDetails(NULL,_R(IDC_LEFTEDIT));
01400 }
01401 else if (Msg->GadgetID == _R(IDC_WIDTHEDIT))
01402 {
01403 LocalPrintControl.SetWidth(pPrefsDlg->GetUnitGadgetValue(_R(IDC_WIDTHEDIT),CurrentPageUnits,0,0));
01404 ShowDetails(NULL,_R(IDC_WIDTHEDIT));
01405 }
01406 else if (Msg->GadgetID == _R(IDC_HEIGHTEDIT))
01407 {
01408 LocalPrintControl.SetHeight(pPrefsDlg->GetUnitGadgetValue(_R(IDC_HEIGHTEDIT),CurrentPageUnits,0,0));
01409 ShowDetails(NULL,_R(IDC_HEIGHTEDIT));
01410 }
01411
01412 else if (Msg->GadgetID == _R(IDC_ROWSEDIT))
01413 {
01414 LocalPrintControl.SetRows(pPrefsDlg->GetLongGadgetValue(_R(IDC_ROWSEDIT),0,0));
01415 ShowDetails(NULL,_R(IDC_ROWSEDIT));
01416 }
01417 else if (Msg->GadgetID == _R(IDC_COLUMNSEDIT))
01418 {
01419 LocalPrintControl.SetColumns(pPrefsDlg->GetLongGadgetValue(_R(IDC_COLUMNSEDIT),0,0));
01420 ShowDetails(NULL,_R(IDC_COLUMNSEDIT));
01421 }
01422 else if (Msg->GadgetID == _R(IDC_GUTTEREDIT))
01423 {
01424 LocalPrintControl.SetGutter(pPrefsDlg->GetUnitGadgetValue(_R(IDC_GUTTEREDIT),CurrentPageUnits,0,0));
01425 ShowDetails(NULL,_R(IDC_GUTTEREDIT));
01426 }
01427 }
01428 break;
01429
01430 case DIM_KILL_FOCUS:
01431 {
01432 CGadgetID List[] = { 0, 0 };
01433
01434 if ((Msg->GadgetID == _R(IDC_SCALEEDIT)) ||
01435 (Msg->GadgetID == _R(IDC_ROWSEDIT)) ||
01436 (Msg->GadgetID == _R(IDC_COLUMNSEDIT)) ||
01437 (Msg->GadgetID == _R(IDC_GUTTEREDIT)) ||
01438 (Msg->GadgetID == _R(IDC_TOPEDIT)) ||
01439 (Msg->GadgetID == _R(IDC_LEFTEDIT)) ||
01440 (Msg->GadgetID == _R(IDC_WIDTHEDIT)) ||
01441 (Msg->GadgetID == _R(IDC_HEIGHTEDIT)) )
01442 {
01443 List[0] = Msg->GadgetID;
01444 ShowDetails(List, 0);
01445 }
01446 }
01447 break;
01448
01449 default:
01450 return(PrintBaseTab::HandleMsg(Msg));
01451 }
01452
01453 #ifdef _DEBUG
01454 if (Msg->DlgMsg == DIM_LFT_BN_CLICKED &&
01455 ((Msg->GadgetID == _R(IDC_BESTFIT)) || (Msg->GadgetID == _R(IDC_CUSTOMFIT)) || (Msg->GadgetID == _R(IDC_MULTIPLEFIT))) &&
01456 KeyPress::IsConstrainPressed())
01457 {
01458 PrintLayoutTab::TestPrinting(&LocalPrintControl);
01459 }
01460 #endif
01461
01462 return TRUE;
01463 }
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484 BOOL PrintLayoutTab::CommitSection()
01485 {
01486 if (IsAllGreyed() || pDocument == NULL)
01487 return(PrintBaseTab::CommitSection());
01488
01489 ERROR3IF(pPrefsDlg == NULL, "PrintLayoutTab::CommitSection called with no dialog pointer");
01490
01491 if (!TalkToPage())
01492 return TRUE;
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543
01544
01545
01546
01547
01548
01549
01550
01551
01552
01553
01554
01555
01556
01557
01558
01559
01560
01561 FRDocViewFunc pFunc = PrintControl::RedrawPrintableArea;
01562 pDocument->ForceRedraw(pFunc);
01563
01564 return(PrintBaseTab::CommitSection());
01565 }
01566
01567
01568
01569
01570
01571
01572
01573
01574
01575
01576
01577
01578
01579
01580
01581
01582
01583
01584 BOOL PrintLayoutTab::InitSection()
01585 {
01586 if (PrintBaseTab::InitSection())
01587 {
01588 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintLayoutTab::InitSection called with no dialog pointer");
01589
01590 pPrefsDlg->SetGadgetBitmaps(_R(IDC_BTN_SIDEWAYS),0,0);
01591 pPrefsDlg->SetGadgetBitmaps(_R(IDC_BTN_UPRIGHT),0,0);
01592
01593
01594
01595
01596 if (!SetUpDocUnits())
01597 {
01598
01599
01600 GreySection();
01601 return (TRUE);
01602 }
01603
01604 return ShowDetails();
01605 }
01606 else
01607 return FALSE;
01608 }
01609
01610
01611
01612
01613
01614
01615
01616
01617
01618
01619
01620
01621
01622
01623
01624
01625 BOOL PrintLayoutTab::ShowDetails()
01626 {
01627 return ShowDetails(NULL, 0);
01628 }
01629
01630
01631
01632
01633
01634
01635
01636
01637
01638
01639
01640
01641
01642
01643
01644
01645
01646 BOOL PrintLayoutTab::ShowDetails(CGadgetID* pGadgetIDList, CGadgetID Exclude)
01647 {
01648 if (Document::GetSelected() == NULL)
01649 return(FALSE);
01650
01651 IgnoreTextChangedMsgs = TRUE;
01652
01653 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintLayoutTab::ShowDetailscalled with no dialog pointer");
01654
01655
01656 static CGadgetID pAllGadgets[] ={ _R(IDC_LAYOUTINFO),_R(IDC_PAPERSIZEINFO),_R(IDC_DPS_WHOLESPREAD),
01657 _R(IDC_BTN_UPRIGHT),_R(IDC_SCALEEDIT),_R(IDC_BESTFIT),
01658 _R(IDC_TOPEDIT),_R(IDC_LEFTEDIT),_R(IDC_WIDTHEDIT),_R(IDC_HEIGHTEDIT),
01659 _R(IDC_ROWSEDIT),_R(IDC_COLUMNSEDIT),_R(IDC_GUTTEREDIT),
01660 0 };
01661
01662
01663 if (pGadgetIDList == NULL)
01664 pGadgetIDList = pAllGadgets;
01665
01666 BOOL ShowMargins = ( (LocalPrintControl.GetFitType() != PRINTFIT_MULTIPLE) ||
01667 ((LocalPrintControl.GetRows() == 1) && (LocalPrintControl.GetColumns() == 1))
01668 );
01669
01670 String_256 Str;
01671 String_256 Dash = "-";
01672
01673 for (INT32 i=0; pGadgetIDList[i]; i++)
01674 {
01675
01676 if (pGadgetIDList[i] == Exclude)
01677 continue;
01678
01679 if (FALSE) {}
01680 else if (pGadgetIDList[i] == _R(IDC_LAYOUTINFO))
01681 {
01682
01683 Str = LocalPrintControl.BuildPrintInfoStr();
01684 pPrefsDlg->SetStringGadgetValue(_R(IDC_LAYOUTINFO),Str);
01685 }
01686 else if (pGadgetIDList[i] == _R(IDC_PAPERSIZEINFO))
01687 {
01688
01689 Str = LocalPrintControl.BuildPaperSizeStr();
01690 pPrefsDlg->SetStringGadgetValue(_R(IDC_PAPERSIZEINFO),Str);
01691 }
01692 else if (pGadgetIDList[i] == _R(IDC_DPS_WHOLESPREAD))
01693 {
01694
01695 BOOL WholeSpread = LocalPrintControl.IsWholeSpread();
01696 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_DPS_WHOLESPREAD),WholeSpread);
01697 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_DPS_INDIVIDUALPAGES),!WholeSpread);
01698 }
01699 else if (pGadgetIDList[i] == _R(IDC_BTN_UPRIGHT))
01700 {
01701
01702 BOOL Upright = (LocalPrintControl.GetPrintOrient() == PRINTORIENTATION_UPRIGHT);
01703 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_BTN_UPRIGHT),Upright);
01704 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_BTN_SIDEWAYS),!Upright);
01705 }
01706 else if (pGadgetIDList[i] == _R(IDC_SCALEEDIT))
01707 {
01708
01709 FIXED16 Scale = LocalPrintControl.GetScale();
01710 pPrefsDlg->SetDoubleGadgetValue(_R(IDC_SCALEEDIT),Scale.MakeDouble());
01711 }
01712 else if (pGadgetIDList[i] == _R(IDC_BESTFIT))
01713 {
01714
01715 CGadgetID FitList[] = { _R(IDC_BESTFIT),_R(IDC_CUSTOMFIT),_R(IDC_MULTIPLEFIT),_R(IDC_BESTFITPAPER), 0 };
01716
01717 switch (LocalPrintControl.GetFitType())
01718 {
01719 case PRINTFIT_BEST: pPrefsDlg->SetRadioGroupSelected(FitList,_R(IDC_BESTFIT)); break;
01720 case PRINTFIT_CUSTOM: pPrefsDlg->SetRadioGroupSelected(FitList,_R(IDC_CUSTOMFIT)); break;
01721 case PRINTFIT_MULTIPLE: pPrefsDlg->SetRadioGroupSelected(FitList,_R(IDC_MULTIPLEFIT)); break;
01722 case PRINTFIT_BESTPAPER:pPrefsDlg->SetRadioGroupSelected(FitList,_R(IDC_BESTFITPAPER)); break;
01723 default: ERROR2(FALSE,"Unknown print fit type");
01724 }
01725 }
01726 else if (pGadgetIDList[i] == _R(IDC_TOPEDIT))
01727 {
01728
01729 if (ShowMargins)
01730 pPrefsDlg->SetUnitGadgetValue(_R(IDC_TOPEDIT), CurrentPageUnits, LocalPrintControl.GetTopMargin());
01731 else
01732 pPrefsDlg->SetStringGadgetValue(_R(IDC_TOPEDIT), Dash);
01733 }
01734 else if (pGadgetIDList[i] == _R(IDC_LEFTEDIT))
01735 {
01736
01737 if (ShowMargins)
01738 pPrefsDlg->SetUnitGadgetValue(_R(IDC_LEFTEDIT), CurrentPageUnits, LocalPrintControl.GetLeftMargin());
01739 else
01740 pPrefsDlg->SetStringGadgetValue(_R(IDC_LEFTEDIT), Dash);
01741 }
01742 else if (pGadgetIDList[i] == _R(IDC_WIDTHEDIT))
01743 {
01744 pPrefsDlg->SetUnitGadgetValue(_R(IDC_WIDTHEDIT),CurrentPageUnits, LocalPrintControl.GetWidth());
01745 }
01746 else if (pGadgetIDList[i] == _R(IDC_HEIGHTEDIT))
01747 {
01748 pPrefsDlg->SetUnitGadgetValue(_R(IDC_HEIGHTEDIT),CurrentPageUnits, LocalPrintControl.GetHeight());
01749 }
01750 else if (pGadgetIDList[i] == _R(IDC_ROWSEDIT))
01751 {
01752 pPrefsDlg->SetLongGadgetValue(_R(IDC_ROWSEDIT), LocalPrintControl.GetRows());
01753 }
01754 else if (pGadgetIDList[i] == _R(IDC_COLUMNSEDIT))
01755 {
01756 pPrefsDlg->SetLongGadgetValue(_R(IDC_COLUMNSEDIT),LocalPrintControl.GetColumns());
01757 }
01758 else if (pGadgetIDList[i] == _R(IDC_GUTTEREDIT))
01759 {
01760 pPrefsDlg->SetUnitGadgetValue(_R(IDC_GUTTEREDIT),CurrentPageUnits, LocalPrintControl.GetGutter());
01761 }
01762 else
01763 {
01764 ERROR3_PF(("Unknown gadget ID (%D)",pGadgetIDList));
01765 }
01766 }
01767
01768 BOOL ok = EnableControls();
01769
01770 IgnoreTextChangedMsgs = FALSE;
01771
01772 return ok;
01773 }
01774
01775
01776
01777
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791 BOOL PrintLayoutTab::EnableControls()
01792 {
01793 if (pPrefsDlg == NULL) return TRUE;
01794
01795 if (!TalkToPage())
01796 return(TRUE);
01797
01798
01799 BOOL CustomFit = (LocalPrintControl.GetFitType() == PRINTFIT_CUSTOM);
01800 BOOL MultipleFit = (LocalPrintControl.GetFitType() == PRINTFIT_MULTIPLE);
01801
01802
01803
01804 EnableControl(_R(IDC_BESTFIT), TRUE);
01805 EnableControl(_R(IDC_CUSTOMFIT), TRUE);
01806 EnableControl(_R(IDC_MULTIPLEFIT), TRUE);
01807 EnableControl(_R(IDC_BESTFITPAPER), TRUE);
01808 EnableControl(_R(IDC_PRINT_DOCNAME), TRUE);
01809 EnableControl(_R(IDC_PRINT_DOCNAMETEXT),TRUE);
01810 EnableControl(_R(IDC_LAYOUTINFO), TRUE);
01811 EnableControl(_R(IDC_PAPERSIZETEXT), TRUE);
01812 EnableControl(_R(IDC_PAPERSIZEINFO), TRUE);
01813
01814
01815 EnableControl(_R(IDC_TOPEDIT), CustomFit);
01816 EnableControl(_R(IDC_LEFTEDIT), CustomFit);
01817 EnableControl(_R(IDC_WIDTHEDIT), CustomFit);
01818 EnableControl(_R(IDC_HEIGHTEDIT), CustomFit);
01819 EnableControl(_R(IDC_TOPTEXT), CustomFit);
01820 EnableControl(_R(IDC_LEFTTEXT), CustomFit);
01821 EnableControl(_R(IDC_WIDTHTEXT), CustomFit);
01822 EnableControl(_R(IDC_HEIGHTTEXT), CustomFit);
01823 EnableControl(_R(IDC_SCALEEDIT), CustomFit);
01824 EnableControl(_R(IDC_SCALETEXT), CustomFit);
01825 EnableControl(_R(IDC_SCALEPERCENT), CustomFit);
01826
01827
01828 EnableControl(_R(IDC_ROWSEDIT), MultipleFit);
01829 EnableControl(_R(IDC_COLUMNSEDIT), MultipleFit);
01830 EnableControl(_R(IDC_GUTTEREDIT), MultipleFit);
01831 EnableControl(_R(IDC_ROWSTEXT), MultipleFit);
01832 EnableControl(_R(IDC_COLUMNSTEXT), MultipleFit);
01833 EnableControl(_R(IDC_GUTTERTEXT), MultipleFit);
01834
01835
01836 EnableControl(_R(IDC_BTN_UPRIGHT), CustomFit || MultipleFit);
01837 EnableControl(_R(IDC_BTN_SIDEWAYS), CustomFit || MultipleFit);
01838 EnableControl(_R(IDC_PRINTORIENTATIONTEXT), CustomFit || MultipleFit);
01839
01840
01841 EnableControl(_R(IDC_DPS_WHOLESPREAD), LocalPrintControl.IsDoublePageSpread());
01842 EnableControl(_R(IDC_DPS_INDIVIDUALPAGES), LocalPrintControl.IsDoublePageSpread());
01843
01844
01845 PORTNOTE("other", "Assume new windows UI")
01846 #ifndef EXCLUDE_FROM_XARALX
01847 if (CCamApp::IsNewWindowsUI())
01848 #endif
01849 {
01850 if (pPrefsDlg != NULL)
01851 {
01852 pPrefsDlg->HideGadget(_R(IDC_LAYOUTINFO_BOX),TRUE);
01853 pPrefsDlg->HideGadget(_R(IDC_PAPERSIZEINFO_BOX),TRUE);
01854 }
01855 }
01856
01857 return TRUE;
01858 }
01859
01860 #ifdef _DEBUG
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876 void PrintLayoutTab::TestPrinting(PrintControl* pPrCtrl)
01877 {
01878 PORTNOTE("printing", "Disable PrintLayoutTab::TestPrinting")
01879 #ifndef EXCLUDE_FROM_XARALX
01880 if (pPrCtrl != NULL && pPrCtrl->StartPrinting())
01881 {
01882 BOOL Aborted = FALSE;
01883 PrintProgressDlg* pPrgDlg = new PrintProgressDlg(NULL);
01884
01885 if (pPrgDlg != NULL)
01886 {
01887 pPrgDlg->SetDocName(Document::GetCurrent()->GetTitle());
01888 pPrgDlg->Show();
01889 }
01890
01891 time_t CurrentTime = time(NULL);
01892
01893 while (!Aborted && pPrCtrl->GetNextPaper())
01894 {
01895 Layer* pLayer = new Layer;
01896
01897 PrintPatchInfo PatchInfo;
01898
01899 SIZEL PaperSize;
01900 if (!CCPrintDialog::GetPaperSize(&PaperSize))
01901 return;
01902 MakeRectangle(pLayer,DocRect(0,0,PaperSize.cx,PaperSize.cy),COLOUR_MIDGREY);
01903
01904 BOOL DisplayClipRect = TRUE;
01905
01906 while (!Aborted && pPrCtrl->GetNextPatch(&PatchInfo))
01907 {
01908 if (pPrgDlg != NULL)
01909 {
01910 pPrgDlg->SetPageNumber( PatchInfo.PaperNumber,
01911 PatchInfo.MaxPaperNumber,
01912 1, 1, NULL,
01913 PatchInfo.PatchNumber,
01914 PatchInfo.MaxPatchNumber);
01915
01916 pPrgDlg->SetSliderSubRangeMax(2000);
01917 }
01918
01919 INT32 pos=0;
01920 while ((time(NULL) - CurrentTime) < 2)
01921 {
01922 if (!PrintProgressDlg::AbortProc(0,0))
01923 {
01924 Aborted = TRUE;
01925 break;
01926 }
01927 if (pPrgDlg != NULL)
01928 pPrgDlg->SetSliderSubRangePos(pos++);
01929 }
01930 CurrentTime = time(NULL);
01931
01932 if (DisplayClipRect)
01933 {
01934 MakeRectangle(pLayer,PatchInfo.GetClipRect(FALSE,FALSE),COLOUR_GREEN);
01935 DisplayClipRect = FALSE;
01936 }
01937
01938 DocRect Rect = PatchInfo.GetClipRect(FALSE,FALSE);
01939 double ScaleFactor = PatchInfo.Scale.MakeDouble() / 100;
01940
01941 INT32 w = Rect.Width();
01942 INT32 h = Rect.Height();
01943
01944 if (PatchInfo.Rotate)
01945 { INT32 t = w; w = h; h = t; }
01946
01947 Rect.lox = PatchInfo.XTrans;
01948 Rect.loy = PatchInfo.YTrans;
01949
01950 Rect.hix = Rect.lox + (INT32((double(w) * ScaleFactor)+0.5));
01951 Rect.hiy = Rect.loy + (INT32((double(h) * ScaleFactor)+0.5));
01952
01953 MakeRectangle(pLayer,Rect,COLOUR_RED);
01954 }
01955
01956 if (!Aborted && pLayer != NULL && PatchInfo.pSpread != NULL)
01957 {
01958 TCHAR name[256];
01959 camSprintf(name,_T("Page %d"),PatchInfo.PaperNumber);
01960 pLayer->SetLayerID(String_256(name));
01961 pLayer->AttachNode(PatchInfo.pSpread,LASTCHILD);
01962 pLayer->SetVisible(FALSE);
01963 LayerSGallery::MakeActiveLayer(pLayer);
01964 }
01965 }
01966
01967 if (pPrgDlg != NULL)
01968 {
01969 pPrgDlg->DestroyWindow();
01970 delete pPrgDlg;
01971 pPrgDlg = NULL;
01972 }
01973
01974 pPrCtrl->EndPrinting();
01975 Document::GetCurrent()->ForceRedraw();
01976 }
01977 #endif
01978 }
01979
01980 void PrintLayoutTab::MakeRectangle(Layer* pLayer,DocRect Rect, StockColour Col)
01981 {
01982 NodeRect* pNodeRect = new NodeRect;
01983 if (pNodeRect != NULL && pLayer != NULL)
01984 {
01985 if (pNodeRect->InkPath.Initialise())
01986 {
01987 pNodeRect->CreateShape(Rect);
01988 pNodeRect->AttachNode(pLayer,LASTCHILD);
01989 pNodeRect->InkPath.IsFilled = TRUE;
01990 pNodeRect->InkPath.IsStroked = TRUE;
01991
01992 DocColour DocCol(Col);
01993
01994 FlatFillAttribute Attr(DocCol);
01995 NodeAttribute* pAttr = Attr.MakeNode();
01996 if (pAttr != NULL)
01997 pAttr->AttachNode(pNodeRect,LASTCHILD);
01998 }
01999 }
02000 }
02001
02002 #endif // _DEBUG
02003
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014
02015
02016
02017
02018
02019
02020
02021
02022
02023
02024
02025 PrintSepsTab::PrintSepsTab()
02026 {
02027 OldPrintSpotsAsProcess = IndexedColour::AreSpotsForcedToProcess();
02028 }
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039
02040
02041
02042
02043
02044
02045
02046
02047 PrintSepsTab::~PrintSepsTab()
02048 {
02049 }
02050
02051 CDlgResID PrintSepsTab::GetPageID() { return _R(IDD_OPTSTAB_PRINTPRINT); }
02052
02053
02054
02055
02056
02057
02058
02059
02060
02061
02062
02063
02064
02065
02066
02067
02068 BOOL PrintSepsTab::HandleMsg(DialogMsg* Msg)
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;
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
02089
02090 IndexedColour::ForceSpotsToBeProcess(OldPrintSpotsAsProcess);
02091
02092
02093 return(PrintBaseTab::HandleMsg(Msg));
02094
02095
02096 case DIM_LFT_BN_CLICKED:
02097 if (FALSE) {}
02098
02099 else if (Msg->GadgetID == _R(IDC_CHECKSEPARATIONS))
02100 {
02101 BOOL DoSeparations = pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKSEPARATIONS));
02102 pTypesetInfo->SetSeparations(DoSeparations);
02103
02104
02105 if (pTypesetInfo->OutputPrintersMarks() != DoSeparations)
02106 {
02107 pTypesetInfo->SetOutputPrintersMarks(DoSeparations);
02108
02109
02110 BROADCAST_TO_ALL(PrintMsg(PrintMsg::SETTINGSCHANGED));
02111 }
02112
02113
02114 BROADCAST_TO_ALL(OptionsChangingMsg(OptionsChangingMsg::SEPARATIONSENABLED));
02115
02116
02117
02118 PageSizeHasChanged();
02119 OptionsTabs::SetApplyNowState(TRUE);
02120 }
02121 else if (Msg->GadgetID == _R(IDC_CHECKPROCESS))
02122 {
02123
02124
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);
02136 pTypesetInfo->ResetAllPlatesToDefaultScreens();
02137 ShowDetails();
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
02160 ReadCurrentPlateSettings(pTypesetInfo);
02161
02162 ColourPlate *pPlate = GetSelectedPlate();
02163 if (pPlate != NULL)
02164 {
02165 if (SepsDlg::InvokeDialog(pPlate, this))
02166 {
02167
02168
02169 if (!pTypesetInfo->AreScreening())
02170 pTypesetInfo->SetScreening(TRUE);
02171 }
02172
02173 ShowDetails();
02174 OptionsTabs::SetApplyNowState(TRUE);
02175 }
02176 }
02177 }
02178 }
02179
02180 case DIM_TEXT_CHANGED:
02181
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
02195
02196 double NewVal = pPrefsDlg->GetDoubleGadgetValue(_R(IDC_COMBOFREQUENCY), 2, 1000, _R(IDS_INVALID_FREQUENCY), &valid);
02197 if (valid)
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))
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
02230 if (pTypesetInfo->AreSeparating())
02231 ReadCurrentPlateSettings(pTypesetInfo);
02232 }
02233 OptionsTabs::SetApplyNowState(TRUE);
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
02250 ReadCurrentPlateSettings(pTypesetInfo);
02251
02252
02253 ColourPlate *pPlate = GetSelectedPlate();
02254 if (pPlate != NULL)
02255 {
02256 if (SepsDlg::InvokeDialog(pPlate, this))
02257 {
02258
02259
02260 if (!pTypesetInfo->AreScreening())
02261 pTypesetInfo->SetScreening(TRUE);
02262 }
02263 }
02264
02265 ShowDetails();
02266 }
02267 }
02268 }
02269 break;
02270
02271 default:
02272 return(PrintBaseTab::HandleMsg(Msg));
02273 }
02274 return TRUE;
02275 }
02276
02277
02278
02279
02280
02281
02282
02283
02284
02285
02286
02287
02288
02289
02290
02291
02292
02293
02294
02295
02296 MsgResult PrintSepsTab::Message(Msg *pMessage)
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
02308
02309 ShowDetails();
02310 break;
02311 default:
02312 break;
02313 }
02314 }
02315
02316 return(OK);
02317 }
02318
02319
02320
02321
02322
02323
02324
02325
02326
02327
02328
02329
02330
02331
02332
02333
02334
02335
02336
02337
02338 BOOL PrintSepsTab::CommitSection()
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;
02347
02348
02349 PrintControl* pPrCtrl = &LocalPrintControl;
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
02356 BOOL AreScreening = pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CUSTOMSETTINGS));
02357 if (AreScreening)
02358 {
02359
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
02366 ReadCurrentPlateSettings(pTypesetInfo);
02367
02368
02369
02370 pTypesetInfo->SetScreening(AreScreening);
02371 pTypesetInfo->EnsureAllPlatesHaveGlobalSettings();
02372
02373
02374
02375
02376 OldPrintSpotsAsProcess = pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKPROCESS));
02377 IndexedColour::ForceSpotsToBeProcess(OldPrintSpotsAsProcess);
02378
02379 return(PrintBaseTab::CommitSection());
02380 }
02381
02382
02383
02384
02385
02386
02387
02388
02389
02390
02391
02392
02393
02394
02395
02396
02397
02398
02399
02400
02401
02402
02403 INT32 PrintSepsTab::ConvertDoubleToMinString(double Value, String_256 *Result)
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
02412 while (DecimalPlaces >= 1)
02413 {
02414 Convert::DoubleToString(Value, (StringBase *)Result, DecimalPlaces);
02415
02416 Result->Right(&Temp, 1);
02417 if (Temp != Zero)
02418 return(DecimalPlaces);
02419
02420
02421 DecimalPlaces--;
02422 }
02423
02424
02425 return(1);
02426 }
02427
02428
02429
02430
02431
02432
02433
02434
02435
02436
02437
02438
02439
02440
02441
02442
02443
02444
02445
02446 void PrintSepsTab::ReadCurrentPlateSettings(TypesetInfo *pTypesetInfo)
02447 {
02448 if (!TalkToPage())
02449 return;
02450
02451
02452
02453 BOOL DoSeparations = pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKSEPARATIONS));
02454 pTypesetInfo->SetSeparations(DoSeparations);
02455
02456 PORTNOTE("other", "Disabled CCustomList")
02457 #ifndef EXCLUDE_FROM_XARALX
02458
02459 CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_LISTCOLOURS));
02460 if (pListGadget)
02461 {
02462
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
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 }
02493
02494
02495
02496
02497
02498
02499
02500
02501
02502
02503
02504
02505
02506
02507
02508
02509
02510
02511
02512 BOOL PrintSepsTab::InitSection()
02513 {
02514 if (PrintBaseTab::InitSection())
02515 {
02516 TalkToPage();
02517
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);
02523 pListGadget->SetColumnWidth(1, GetSystemMetrics(SM_CXMENUCHECK) + 5);
02524 pListGadget->SetColumnWidth(2, 17);
02525 pListGadget->SetColumnWidth(3, 90);
02526 pListGadget->SetColumnWidth(4, 50);
02527
02528 BOOL ok = pListGadget->CreateCustomHeader(_R(IDB_HEADER));
02529 ERROR3IF(!ok, "Cannot create listview header");
02530
02531
02532 OldPrintSpotsAsProcess = IndexedColour::AreSpotsForcedToProcess();
02533
02534 BOOL Result = UpdateSection(OptionsTabs::GetDocumentName());
02535
02536 if (!IsAllGreyed() && pDocument != NULL)
02537 pListGadget->SetSelectedItemIndex(0);
02538
02539 return(Result);
02540 #endif
02541 }
02542
02543 return FALSE;
02544 }
02545
02546
02547
02548
02549
02550
02551
02552
02553
02554
02555
02556
02557
02558
02559
02560
02561
02562
02563 BOOL PrintSepsTab::GreySection()
02564 {
02565 if (TalkToPage())
02566 {
02567 PORTNOTE("other", "Disabled CCustomList")
02568 #ifndef EXCLUDE_FROM_XARALX
02569
02570 CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_LISTCOLOURS));
02571 if (pListGadget != NULL)
02572 pListGadget->DeleteAllItems();
02573 #endif
02574
02575 TypesetInfo *pTypesetInfo = LocalPrintControl.GetTypesetInfo();
02576 ERROR2IF(pTypesetInfo == NULL, TRUE, "Can't find typesetting info structure");
02577
02578 pTypesetInfo->DestroyPlateList();
02579
02580
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 }
02599
02600
02601
02602
02603
02604
02605
02606
02607
02608
02609
02610
02611
02612
02613
02614
02615
02616
02617
02618
02619 BOOL PrintSepsTab::UngreySection()
02620 {
02621 if (TalkToPage())
02622 {
02623
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 }
02638
02639
02640
02641
02642
02643
02644
02645
02646
02647
02648
02649
02650
02651
02652
02653
02654
02655
02656
02657
02658
02659 BOOL PrintSepsTab::UpdateSection(String_256 *DocumentName)
02660 {
02661
02662 CopyLocalPrintControlFromDoc();
02663
02664 BOOL ok = TalkToPage();
02665 if (!ok)
02666 return(FALSE);
02667
02668
02669 pPrefsDlg->SetStringGadgetValue(_R(IDC_PRINT_DOCNAME), *DocumentName);
02670
02671
02672 ShowDetails(NULL, 0);
02673
02674 return TRUE;
02675 }
02676
02677
02678
02679
02680
02681
02682
02683
02684
02685
02686
02687
02688
02689
02690
02691
02692
02693
02694 BOOL PrintSepsTab::ShowDetails()
02695 {
02696 return ShowDetails(NULL,0);
02697 }
02698
02699
02700
02701
02702
02703
02704
02705
02706
02707
02708
02709
02710
02711
02712
02713
02714
02715
02716
02717 BOOL PrintSepsTab::ShowDetails(CGadgetID* pGadgetIDList, CGadgetID Exclude)
02718 {
02719
02720 BOOL ok = TalkToPage();
02721 if (!ok)
02722 return(FALSE);
02723
02724 if (IsAllGreyed() || pDocument == NULL)
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
02742 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_PRINTERDEFAULTS), !tpInfo->AreScreening());
02743 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CUSTOMSETTINGS), tpInfo->AreScreening());
02744
02745
02746
02747 static INT32 Resolution[] =
02748 {
02749 300,
02750 600,
02751 635,
02752 1200,
02753 1270,
02754 1693,
02755 2400,
02756 2540,
02757 0
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
02774
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
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
02813
02814
02815 if (Selected >= 0)
02816 pPrefsDlg->SetSelectedValueIndex(_R(IDC_COMBOFREQUENCY), Selected);
02817 else
02818 {
02819
02820
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
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
02838 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKSEPARATIONS), tpInfo->AreSeparating());
02839
02840
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
02847 INT32 SelectedItem = pListGadget->GetSelectedItemIndex();
02848 if (SelectedItem < 0)
02849 SelectedItem = 0;
02850
02851
02852 pListGadget->DeleteAllItems();
02853 #endif
02854
02855
02856 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKPROCESS), IndexedColour::AreSpotsForcedToProcess());
02857
02858
02859
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
02868
02869 INT32 AnglePrecision = 1;
02870 INT32 FreqPrecision = 1;
02871 for (i = 0 ; i < (INT32) tpInfo->GetNumPlates(); i++)
02872 {
02873 if (pPlate)
02874 {
02875
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
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
02907
02908
02909
02910 Convert::DoubleToString(Angle, (StringBase *) &plateAngle, AnglePrecision);
02911 plateAngle += TEXT("");
02912
02913
02914
02915
02916 Convert::DoubleToString(Frequency, (StringBase *) &plateFrequency, FreqPrecision);
02917
02918
02919
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
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
02952 EnableControls();
02953
02954 PORTNOTE("other", "Disabled CCustomList")
02955 #ifndef EXCLUDE_FROM_XARALX
02956
02957 pListGadget->SetSelectedItemIndex(SelectedItem);
02958 #endif
02959
02960 return TRUE;
02961 }
02962
02963
02964
02965
02966
02967
02968
02969
02970
02971
02972
02973
02974
02975
02976
02977
02978
02979
02980
02981 BOOL PrintSepsTab::EnableControls()
02982 {
02983 if (pPrefsDlg == NULL)
02984 return TRUE;
02985
02986 if (!TalkToPage())
02987 return(FALSE);
02988
02989
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
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
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 }
03019
03020
03021
03022
03023
03024
03025
03026
03027
03028
03029
03030
03031
03032
03033
03034
03035
03036
03037 ColourPlate* PrintSepsTab::GetSelectedPlate()
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);
03071 }
03072
03073
03074
03075
03076
03077
03078
03079
03080
03081
03082
03083
03084
03085
03086
03087
03088
03089
03090
03091
03092
03093 const INT32 SepsDlg::IDD = _R(IDD_PLATEPROPS);
03094 const CDlgMode SepsDlg::Mode = MODAL;
03095
03096
03097
03098
03099
03100
03101
03102
03103
03104
03105
03106
03107
03108
03109
03110
03111 SepsDlg::SepsDlg() : DialogOp(IDD, Mode)
03112 {
03113 pColourPlate = NULL;
03114 pLocalColourPlate = NULL;
03115 pParam = NULL;
03116 }
03117
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127
03128
03129
03130
03131
03132
03133 BOOL SepsDlg::Create()
03134 {
03135 return DialogOp::Create();
03136 }
03137
03138
03139
03140
03141
03142
03143
03144
03145
03146
03147
03148
03149
03150
03151 void SepsDlg::InitControls(void)
03152 {
03153 String_256 Temp;
03154 pColourPlate->GetDescription(&Temp);
03155
03156 String_256 plateDescr;
03157 plateDescr.MakeMsg(_R(IDS_SEPPROPERTIES), (TCHAR *) Temp);
03158
03159 SetStringGadgetValue(_R(IDC_PLATECAPTION), plateDescr);
03160
03161
03162 String_256 frequency;
03163 camSprintf((TCHAR*) frequency, _T("%1.4f"), double(pColourPlate->GetScreenFrequency()));
03164 SetStringGadgetValue(_R(IDC_EDITFREQUENCY), frequency, TRUE);
03165
03166
03167 String_256 angle;
03168 camSprintf((TCHAR*) angle, _T("%1.4f"), double(pColourPlate->GetScreenAngle()));
03169 SetStringGadgetValue(_R(IDC_EDITANGLE), angle, TRUE);
03170
03171
03172 SetBoolGadgetSelected(_R(IDC_CHECKPRINT), !pColourPlate->IsDisabled());
03173
03174
03175 SetBoolGadgetSelected(_R(IDC_CHECKOVERPRINT), pColourPlate->Overprints());
03176 }
03177
03178
03179
03180
03181
03182
03183
03184
03185
03186
03187
03188
03189
03190
03191
03192
03193
03194
03195
03196 MsgResult SepsDlg::Message(Msg* Message)
03197 {
03198 if (IS_OUR_DIALOG_MSG(Message))
03199 return HandleMessage((DialogMsg*) Message);
03200
03201 return DialogOp::Message(Message);
03202 }
03203
03204
03205
03206
03207
03208
03209
03210
03211
03212
03213
03214
03215
03216
03217
03218
03219
03220 MsgResult SepsDlg::HandleMessage(DialogMsg* Msg)
03221 {
03222 ERROR2IF(pColourPlate == NULL,FAIL,"Error in SepsDlg::HandleMessage() : unexpected null pointer");
03223 ERROR2IF(pLocalColourPlate == NULL,FAIL,"Error in SepsDlg::HandleMessage() : unexpected null pointer");
03224 switch (Msg->DlgMsg)
03225 {
03226 case DIM_CREATE:
03227
03228 InitControls();
03229 break;
03230
03231 case DIM_COMMIT:
03232 {
03233 BOOL angleIsValid = FALSE;
03234 BOOL frequencyIsValid = FALSE;
03235 double angle = GetDoubleGadgetValue(_R(IDC_EDITANGLE), 0, 360, _R(IDS_INVALID_ANGLE), &angleIsValid);
03236 double frequency = GetDoubleGadgetValue(_R(IDC_EDITFREQUENCY), 1, 1000, _R(IDS_INVALID_FREQUENCY), &frequencyIsValid);
03237 if (angleIsValid && frequencyIsValid)
03238 {
03239 pColourPlate->SetOverprint(pLocalColourPlate->Overprints());
03240 pColourPlate->SetScreenInfo(angle, frequency);
03241 pColourPlate->SetDisabled(pLocalColourPlate->IsDisabled());
03242
03243 if (fabs(pLocalColourPlate->GetScreenAngle() - pColourPlate->GetScreenAngle()) > 0.0001)
03244 pParam->Result = TRUE;
03245 else if (fabs(pLocalColourPlate->GetScreenFrequency() - pColourPlate->GetScreenFrequency()) > 0.0001)
03246 pParam->Result = TRUE;
03247
03248 Close();
03249 End();
03250 return OK;
03251 }
03252 }
03253 break;
03254
03255 case DIM_CANCEL:
03256 {
03257 Close();
03258 End();
03259 return OK;
03260 }
03261 break;
03262
03263 case DIM_LFT_BN_CLICKED:
03264 {
03265 if (Msg->GadgetID == _R(IDC_CHECKPRINT))
03266 pLocalColourPlate->SetDisabled(!GetBoolGadgetSelected(_R(IDC_CHECKPRINT)));
03267 else if (Msg->GadgetID == _R(IDC_CHECKOVERPRINT))
03268 pLocalColourPlate->SetOverprint(GetBoolGadgetSelected(_R(IDC_CHECKOVERPRINT)));
03269 }
03270 default:
03271 break;
03272
03273 }
03274
03275 return DialogOp::Message(Msg);
03276 }
03277
03278
03279
03280
03281
03282
03283
03284
03285
03286
03287
03288
03289
03290
03291
03292
03293
03294 SepsDlg::~SepsDlg()
03295 {
03296 delete pLocalColourPlate;
03297 }
03298
03299
03300 void SepsDlg::Do(OpDescriptor*)
03301 {
03302 ERROR3("Don't call SepsDlg::Do - use DoWithParam");
03303 End();
03304 }
03305
03306
03307 void SepsDlg::DoWithParam(OpDescriptor*, OpParam *Param)
03308 {
03309 ERROR3IF(Param == NULL, "Illegal NULL param");
03310 if (!Param)
03311 return;
03312
03313 pParam = (SepsDlgParam *) Param;
03314 ERROR3IF(pParam->pColourPlate == NULL, "Illegal NULL param");
03315 if (!pParam->pColourPlate)
03316 return;
03317
03318 pColourPlate = pParam->pColourPlate;
03319 pLocalColourPlate = new ColourPlate(*pColourPlate);
03320 ERROR3IF(pLocalColourPlate == NULL,"Error in SepsDlg::DoWithParam() : allocation failure");
03321 if (!pLocalColourPlate)
03322 return;
03323
03324 pParent = pParam->pParent;
03325
03326 pParam->Result = FALSE;
03327
03328 if (!Create())
03329 {
03330 InformError();
03331 End();
03332 }
03333 }
03334
03335
03336 BOOL SepsDlg::Init(void)
03337 {
03338 return RegisterOpDescriptor( 0,
03339 _R(IDS_SEPSDIALOG),
03340 CC_RUNTIME_CLASS(SepsDlg),
03341 OPTOKEN_SEPSDIALOG,
03342 SepsDlg::GetState,
03343 0,
03344 0
03345 );
03346
03347 }
03348
03349
03350
03351 OpState SepsDlg::GetState(String_256*, OpDescriptor*)
03352 {
03353 OpState State;
03354
03355 return(State);
03356 }
03357
03358
03359
03360
03361
03362
03363
03364
03365
03366
03367
03368
03369
03370
03371
03372 BOOL SepsDlg::InvokeDialog(ColourPlate *pTheColourPlate, PrintBaseTab* pParentDialog)
03373 {
03374 ERROR3IF(pTheColourPlate == NULL, "Come on, play by the rules");
03375 ERROR3IF(pParentDialog == NULL, "Come on, play by the rules!!!");
03376
03377 OpDescriptor *TheDlg = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(SepsDlg));
03378
03379 ERROR3IF(TheDlg == NULL, "SepsDlg::InvokeDialog is unable to find the Dlg OpDescriptor");
03380
03381 if (TheDlg != NULL)
03382 {
03383 SepsDlgParam Param;
03384 Param.pColourPlate = pTheColourPlate;
03385 Param.pParent = pParentDialog;
03386 Param.Result = FALSE;
03387
03388 TheDlg->Invoke(&Param);
03389 return(Param.Result);
03390 }
03391
03392 return(FALSE);
03393 }
03394
03395
03396
03397
03398
03399
03400
03401
03402
03403
03404
03405
03406
03407
03408
03409
03410
03411
03412
03413
03414
03415
03416
03417
03418
03419
03420
03421
03422
03423
03424
03425
03426
03427
03428
03429
03430
03431
03432
03433
03434
03435
03436 PrintImagesetterTab::PrintImagesetterTab()
03437 {
03438 }
03439
03440
03441
03442
03443
03444
03445
03446
03447
03448
03449
03450
03451
03452
03453
03454
03455
03456 PrintImagesetterTab::~PrintImagesetterTab()
03457 {
03458 }
03459
03460 CDlgResID PrintImagesetterTab::GetPageID() { return _R(IDD_OPTSTAB_IMAGESETTING); }
03461
03462
03463
03464
03465
03466
03467
03468
03469
03470
03471
03472
03473
03474
03475
03476
03477 BOOL PrintImagesetterTab::HandleMsg(DialogMsg* Msg)
03478 {
03479 if (Msg->DlgMsg != DIM_CREATE && (IsAllGreyed() || pDocument == NULL))
03480 return(TRUE);
03481
03482 ERROR2IF(Msg == NULL,FALSE,"PrintImagesetterTab::Message null message received");
03483 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintImagesetterTab::HandleMsg called with no dialog pointer");
03484
03485 BOOL ok = TalkToPage();
03486 if (!ok)
03487 return TRUE;
03488
03489 switch(Msg->DlgMsg)
03490 {
03491 case DIM_LFT_BN_CLICKED:
03492 {
03493 TypesetInfo *tpInfo = LocalPrintControl.GetTypesetInfo();
03494 ERROR2IF(tpInfo == NULL, TRUE, "No typesetInfo?!");
03495
03496 if (FALSE) {}
03497 else if (Msg->GadgetID == _R(IDC_CHECKPMARKS))
03498 {
03499 tpInfo->SetOutputPrintersMarks(pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKPMARKS)));
03500
03501
03502 BROADCAST_TO_ALL(PrintMsg(PrintMsg::SETTINGSCHANGED));
03503
03504
03505 EnableControls();
03506 }
03507 else if (Msg->GadgetID == _R(IDC_CHECKOPBLACK))
03508 {
03509 tpInfo->SetOverprintBlack(pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKOPBLACK)));
03510 }
03511 else if (Msg->GadgetID == _R(IDC_CHECKNEGATIVE))
03512 {
03513 tpInfo->SetPhotoNegative(pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKNEGATIVE)));
03514 }
03515 else if (Msg->GadgetID == _R(IDC_CHECKREFLECT))
03516 {
03517 tpInfo->SetEmulsionDown(pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKREFLECT)));
03518 }
03519 OptionsTabs::SetApplyNowState(TRUE);
03520 }
03521 break;
03522
03523 case DIM_SELECTION_CHANGED:
03524 case DIM_SELECTION_CHANGED_COMMIT:
03525
03526
03527 EnsureSensiblePrintMarks();
03528 break;
03529
03530 default:
03531 return(PrintBaseTab::HandleMsg(Msg));
03532 }
03533
03534 return TRUE;
03535 }
03536
03537
03538
03539
03540
03541
03542
03543
03544
03545
03546
03547
03548
03549
03550
03551
03552
03553
03554
03555 BOOL PrintImagesetterTab::GreySection()
03556 {
03557 if (TalkToPage())
03558 {
03559 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKPMARKS), FALSE);
03560 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKREFLECT), FALSE);
03561 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKNEGATIVE), FALSE);
03562 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKOPBLACK), FALSE);
03563
03564 PORTNOTE("other", "Disabled CCustomList")
03565 #ifndef EXCLUDE_FROM_XARALX
03566 CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_PRINTERMARKSLIST));
03567 if (pListGadget != NULL)
03568 pListGadget->DeleteAllItems();
03569 #endif
03570
03571 EnableControl((CGadgetID) _R(IDC_PRINT_DOCNAME), FALSE);
03572 EnableControl((CGadgetID) _R(IDC_ISTATIC1), FALSE);
03573 EnableControl((CGadgetID) _R(IDC_ISTATIC2), FALSE);
03574 EnableControl((CGadgetID) _R(IDC_ISTATIC3), FALSE);
03575 EnableControl((CGadgetID) _R(IDC_ISTATIC4), FALSE);
03576 }
03577 return(PrintBaseTab::GreySection());
03578 }
03579
03580
03581
03582
03583
03584
03585
03586
03587
03588
03589
03590
03591
03592
03593
03594
03595
03596
03597
03598
03599
03600 BOOL PrintImagesetterTab::UngreySection()
03601 {
03602 if (TalkToPage())
03603 {
03604 EnableControl((CGadgetID) _R(IDC_PRINT_DOCNAME), TRUE);
03605 EnableControl((CGadgetID) _R(IDC_ISTATIC1), TRUE);
03606 EnableControl((CGadgetID) _R(IDC_ISTATIC2), TRUE);
03607 EnableControl((CGadgetID) _R(IDC_ISTATIC3), TRUE);
03608 EnableControl((CGadgetID) _R(IDC_ISTATIC4), TRUE);
03609 }
03610 return PrintBaseTab::UngreySection();
03611 }
03612
03613
03614
03615
03616
03617
03618
03619
03620
03621
03622
03623
03624
03625
03626
03627
03628
03629
03630
03631
03632
03633 void PrintImagesetterTab::EnsureSensiblePrintMarks(void)
03634 {
03635 if (!pDocument)
03636 return;
03637
03638 OptionsTabs::SetApplyNowState(TRUE);
03639
03640 INT32 SelIndex = 0;
03641
03642 PORTNOTE("other", "Disabled CCustomList")
03643 #ifndef EXCLUDE_FROM_XARALX
03644 CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_PRINTERMARKSLIST));
03645 if (!pListGadget)
03646 return;
03647
03648 SelIndex = pListGadget->GetSelectedItemIndex();
03649 if (SelIndex < 0)
03650 return;
03651
03652 if (!pListGadget->GetSwitchState(SelIndex, 0))
03653 return;
03654 #endif
03655
03656 PrintMarksMan* pMarksMan = GetApplication()->GetMarksManager();
03657 if (pMarksMan == NULL)
03658 return;
03659
03660 if (!TalkToPage())
03661 return;
03662
03663
03664 PrintMarksComponent* pMarksComp = (PrintMarksComponent*)pDocument->GetDocComponent(CC_RUNTIME_CLASS(PrintMarksComponent));
03665 if (!pMarksComp)
03666 return;
03667
03668
03669 PrintMarkItem* pMarkItem = pMarksMan->PMMCache.GetFirstMark();
03670 INT32 Index = 0;
03671 while (pMarkItem && Index < SelIndex)
03672 {
03673 Index++;
03674 pMarkItem = pMarksMan->PMMCache.GetNextMark(pMarkItem);
03675 }
03676
03677
03678 if (pMarkItem == NULL)
03679 return;
03680
03681 PrintMark *ThisMark = pMarkItem->GetPrintMark();
03682 if (ThisMark == NULL)
03683 return;
03684
03685
03686 MarkType TypeToKill = ThisMark->GetType();
03687
03688 if (TypeToKill != MarkType_Star && TypeToKill != MarkType_Registration)
03689 return;
03690
03691
03692 pMarkItem = pMarksMan->PMMCache.GetFirstMark();
03693 Index = 0;
03694 while (pMarkItem)
03695 {
03696 if (Index != SelIndex)
03697 {
03698 ThisMark = pMarkItem->GetPrintMark();
03699 PORTNOTE("other", "Disabled CCustomList")
03700 #ifndef EXCLUDE_FROM_XARALX
03701 if (ThisMark != NULL && ThisMark->GetType() == TypeToKill)
03702 pListGadget->SetSwitchState(FALSE, Index, 0);
03703 #endif
03704 }
03705
03706 pMarkItem = pMarksMan->PMMCache.GetNextMark(pMarkItem);
03707 Index++;
03708 }
03709 }
03710
03711
03712
03713
03714
03715
03716
03717
03718
03719
03720
03721
03722
03723
03724
03725
03726
03727
03728
03729
03730 MsgResult PrintImagesetterTab::Message(Msg *pMessage)
03731 {
03732 if (MESSAGE_IS_A(pMessage, OptionsChangingMsg))
03733 {
03734 OptionsChangingMsg *TheMsg = (OptionsChangingMsg *) pMessage;
03735
03736 switch ( TheMsg->State )
03737 {
03738 case OptionsChangingMsg::SEPARATIONSENABLED:
03739
03740
03741
03742
03743
03744 ShowDetails();
03745 break;
03746 default:
03747 break;
03748 }
03749 }
03750
03751 return(OK);
03752 }
03753
03754
03755
03756
03757
03758
03759
03760
03761
03762
03763
03764
03765
03766
03767
03768
03769
03770
03771
03772
03773 BOOL PrintImagesetterTab::CommitSection()
03774 {
03775 if (IsAllGreyed() || pDocument == NULL || !TalkToPage())
03776 return(PrintBaseTab::CommitSection());
03777
03778 ERROR3IF(pPrefsDlg == NULL, "PrintImagesetterTab::CommitSection called with no dialog pointer");
03779 ERROR2IF(GetPrintControl() == NULL, FALSE, "Can't find PrintControl info");
03780
03781 TypesetInfo* tpInfo = LocalPrintControl.GetTypesetInfo();
03782 ERROR2IF(tpInfo == NULL,FALSE,"Error in PrintImagesetterTab::CommitSection() : unexpected null pointer");
03783
03784 PORTNOTE("other", "Disabled CCustomList")
03785 #ifndef EXCLUDE_FROM_XARALX
03786
03787 CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_PRINTERMARKSLIST));
03788 if (pListGadget)
03789 {
03790
03791 PrintMarksMan* pMarksMan = GetApplication()->GetMarksManager();
03792 ERROR2IF(!pMarksMan, FALSE, "Print marks manager is NULL");
03793
03794
03795 BOOL UseMarks = pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKPMARKS));
03796 tpInfo->SetOutputPrintersMarks(UseMarks);
03797 TalkToPage();
03798
03799 if (pDocument)
03800 {
03801
03802 PrintMarksComponent* pMarksComp = (PrintMarksComponent*)pDocument->GetDocComponent(CC_RUNTIME_CLASS(PrintMarksComponent));
03803 if (pMarksComp)
03804 {
03805
03806 pMarksComp->RemoveAllMarks();
03807
03808
03809 PrintMarkItem* pMarkItem = pMarksMan->PMMCache.GetFirstMark();
03810 INT32 index = 0;
03811 while (pMarkItem)
03812 {
03813
03814 UINT32 handle = pMarkItem->GetHandle();
03815
03816
03817 if (pListGadget->GetSwitchState(index, 0))
03818 pMarksComp->AddMark(handle);
03819
03820
03821 pMarkItem = pMarksMan->PMMCache.GetNextMark(pMarkItem);
03822 index++;
03823 }
03824 }
03825 }
03826 }
03827 else
03828 {
03829 ERROR3("Failed to find list gadget");
03830 }
03831 #endif
03832
03833
03834 tpInfo->SetOverprintBlack(pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKOPBLACK)));
03835 tpInfo->SetPhotoNegative(pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKNEGATIVE)));
03836 tpInfo->SetEmulsionDown(pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKREFLECT)));
03837
03838
03839
03840
03841 return(PrintBaseTab::CommitSection());
03842 }
03843
03844
03845
03846
03847
03848
03849
03850
03851
03852
03853
03854
03855
03856
03857
03858
03859
03860
03861
03862 BOOL PrintImagesetterTab::InitSection()
03863 {
03864 if (!TalkToPage())
03865 return(FALSE);
03866
03867 if (PrintBaseTab::InitSection())
03868 {
03869 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintImagesetterTab::InitSection called with no dialog pointer");
03870
03871
03872 if (!TalkToPage())
03873 return TRUE;
03874
03875 PORTNOTE("other", "Disabled CCustomList")
03876 #ifndef EXCLUDE_FROM_XARALX
03877
03878 CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_PRINTERMARKSLIST));
03879 ERROR2IF(!pListGadget, FALSE, "No list gadget");
03880 pListGadget->SetColumnWidth(0, GetSystemMetrics(SM_CXMENUCHECK) + 2);
03881 pListGadget->SetColumnWidth(1, 20);
03882 #endif
03883
03884
03885 UpdateSection(OptionsTabs::GetDocumentName());
03886 return TRUE;
03887 }
03888
03889 return FALSE;
03890 }
03891
03892
03893
03894
03895
03896
03897
03898
03899
03900
03901
03902
03903
03904
03905
03906
03907
03908
03909 BOOL PrintImagesetterTab::UpdateSection(String_256 *DocumentName)
03910 {
03911 if (!TalkToPage())
03912 return(FALSE);
03913
03914
03915 pPrefsDlg->SetStringGadgetValue(_R(IDC_PRINT_DOCNAME), *DocumentName);
03916
03917
03918 ShowDetails();
03919
03920 return(TRUE);
03921 }
03922
03923
03924
03925
03926
03927
03928
03929
03930
03931
03932
03933
03934
03935
03936
03937
03938
03939
03940 BOOL PrintImagesetterTab::ShowDetails()
03941 {
03942 if (IsAllGreyed() || pDocument == NULL)
03943 {
03944 PORTNOTE("other", "Disabled CCustomList")
03945 #ifndef EXCLUDE_FROM_XARALX
03946 CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_PRINTERMARKSLIST));
03947 if (pListGadget != NULL)
03948 pListGadget->DeleteAllItems();
03949 #endif
03950 EnableControls();
03951 return(TRUE);
03952 }
03953
03954 ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintBaseTab::UpdateSection called with no dialog pointer");
03955
03956 if (!TalkToPage())
03957 return(FALSE);
03958
03959 TypesetInfo* tpInfo = LocalPrintControl.GetTypesetInfo();
03960 ERROR2IF(tpInfo == NULL,FALSE,"Error in PrintSepsTab::InitSection() : unexpected null pointer");
03961
03962 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKREFLECT), tpInfo->PrintEmulsionDown());
03963 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKNEGATIVE), tpInfo->PrintPhotoNegative());
03964 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKOPBLACK), tpInfo->AlwaysOverprintBlack());
03965
03966
03967 pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECKPMARKS), tpInfo->OutputPrintersMarks());
03968
03969 PORTNOTE("other", "Disabled CCustomList")
03970 #ifndef EXCLUDE_FROM_XARALX
03971
03972 CCustomList* pListGadget = CCustomList::GetGadget(pPrefsDlg->GetReadWriteWindowID(), _R(IDC_PRINTERMARKSLIST));
03973 if (!pListGadget)
03974 return(FALSE);
03975 #endif
03976
03977 PrintMarksMan* pMarksMan = GetApplication()->GetMarksManager();
03978 ERROR3IF(pMarksMan == NULL, "No print mark manager?");
03979
03980
03981 if (Document::GetSelected() != NULL)
03982 pMarksMan->AddDefaultMarksToDoc(Document::GetSelected());
03983
03984 PrintMarkItem* pMarkItem = pMarksMan->PMMCache.GetFirstMark();
03985
03986 PORTNOTE("other", "Disabled CCustomList")
03987 #ifndef EXCLUDE_FROM_XARALX
03988
03989 pListGadget->DeleteAllItems();
03990 #endif
03991
03992 while (pDocument && pMarkItem)
03993 {
03994 PrintMarksComponent* pMarksComp = (PrintMarksComponent*)pDocument->GetDocComponent(CC_RUNTIME_CLASS(PrintMarksComponent));
03995
03996 UINT32 handle = pMarkItem->GetHandle();
03997
03998
03999 PORTNOTE("other", "While CCustomList, mark 2 variables as used to avoid warnings")
04000
04001 CAM_USE(pMarksComp);
04002 CAM_USE(handle);
04003
04004 ERROR2IF(!pMarkItem->GetPrintMark(), FALSE, "Illegal NULL pointer");
04005
04006 UINT32 ImageID = _R(IDB_PRINTMARK_UNKNOWNMK);
04007 UINT32 GreyedID = _R(IDB_PRINTMARK_UNKNOWNMK);
04008 MarkType markType = pMarkItem->GetPrintMark()->GetType();
04009 switch (markType)
04010 {
04011 case MarkType_Star: ImageID = _R(IDB_PRINTMARK_STARMK); GreyedID = _R(IDB_PRINTMARK_GREYED_STARMK); break;
04012 case MarkType_Registration: ImageID = _R(IDB_PRINTMARK_REGISTRATIONMK); GreyedID = _R(IDB_PRINTMARK_GREYED_REGISTRATIONMK); break;
04013 case MarkType_Information: ImageID = _R(IDB_PRINTMARK_INFORMATIONMK); GreyedID = _R(IDB_PRINTMARK_GREYED_INFORMATIONMK); break;
04014 case MarkType_Crop: ImageID = _R(IDB_PRINTMARK_CROPMK); GreyedID = _R(IDB_PRINTMARK_GREYED_CROPMK); break;
04015 case MarkType_GreyBar: ImageID = _R(IDB_PRINTMARK_GRAYBARMK); GreyedID = _R(IDB_PRINTMARK_GRAYBARMK); break;
04016 case MarkType_ColourBar: ImageID = _R(IDB_PRINTMARK_COLOURBARMK); GreyedID = _R(IDB_PRINTMARK_GREYED_COLOURBARMK); break;
04017 default:
04018 break;
04019 }
04020
04021 String_256 markDescription(pMarkItem->GetPrintMark()->GetMarkMenuText());
04022 PORTNOTE("other", "Disabled CCustomList")
04023 #ifndef EXCLUDE_FROM_XARALX
04024 pListGadget->AddItem(markDescription, ImageID, GreyedID);
04025
04026 if (pMarksComp)
04027 pListGadget->SetSwitchState(NULL != pMarksComp->FindMark(handle), (pListGadget->GetItemCount() - 1), 0);
04028 #endif
04029
04030
04031 pMarkItem = pMarksMan->PMMCache.GetNextMark(pMarkItem);
04032 }
04033
04034 PORTNOTE("other", "Disabled CCustomList")
04035 #ifndef EXCLUDE_FROM_XARALX
04036
04037 pListGadget->SetSelectedItemIndex(0);
04038 #endif
04039
04040 EnableControls();
04041
04042 return(TRUE);
04043 }
04044
04045
04046
04047
04048
04049
04050
04051
04052
04053
04054
04055
04056
04057
04058
04059
04060
04061
04062
04063 BOOL PrintImagesetterTab::EnableControls()
04064 {
04065 if (pPrefsDlg == NULL)
04066 return TRUE;
04067
04068 if (!TalkToPage())
04069 return(TRUE);
04070
04071 if (!IsAllGreyed() && pDocument != NULL)
04072 {
04073
04074 PrintMarksMan *pPMM = GetApplication()->GetMarksManager();
04075
04076
04077 EnableControl(_R(IDC_PRINTERMARKSLIST),
04078 (pPMM != NULL && pDocument != NULL && pPrefsDlg->GetBoolGadgetSelected(_R(IDC_CHECKPMARKS))));
04079 }
04080 else
04081 EnableControl(_R(IDC_PRINTERMARKSLIST), FALSE);
04082
04083
04084 EnableControl(_R(IDC_CHECKREFLECT), !IsAllGreyed() && pDocument != NULL);
04085 EnableControl(_R(IDC_CHECKNEGATIVE), !IsAllGreyed() && pDocument != NULL);
04086 EnableControl(_R(IDC_CHECKOPBLACK), !IsAllGreyed() && pDocument != NULL);
04087 EnableControl(_R(IDC_CHECKPMARKS), !IsAllGreyed() && pDocument != NULL);
04088
04089 return TRUE;
04090 }
04091
04092
04093
04094
04095
04096
04097
04098
04099
04100
04101
04102
04103
04104
04105
04106
04107
04108
04109
04110
04111
04112
04113
04114
04115 BOOL OpShowPrintBorders::Init()
04116 {
04117 return RegisterOpDescriptor( 0,
04118 _R(IDS_SHOWPRINTBORDERS),
04119 CC_RUNTIME_CLASS(OpShowPrintBorders),
04120 OPTOKEN_SHOWPRINTBORDERS,
04121 GetState,
04122 0,
04123 _R(IDBBL_PRINTBORDERS),
04124 _R(IDD_BARCONTROLSTORE),
04125 _R(IDC_PRINTBORDERS),
04126 SYSTEMBAR_FILE,
04127 TRUE,
04128 FALSE,
04129 TRUE,
04130 0,
04131 0,
04132 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC)
04133 );
04134 }
04135
04136
04137
04138
04139
04140
04141
04142
04143
04144
04145
04146
04147
04148
04149
04150 OpShowPrintBorders::OpShowPrintBorders()
04151 {
04152 }
04153
04154
04155
04156
04157
04158
04159
04160
04161
04162
04163
04164
04165
04166
04167
04168 void OpShowPrintBorders::Do(OpDescriptor*)
04169 {
04170 DocView *pDocView = DocView::GetSelected();
04171
04172 if (pDocView != NULL)
04173 {
04174 pDocView->SetShowPrintBorders(!pDocView->GetShowPrintBorders());
04175 pDocView->ForceRedraw(TRUE);
04176 }
04177
04178 End();
04179 }
04180
04181
04182
04183
04184
04185
04186
04187
04188
04189
04190
04191
04192
04193
04194
04195 OpState OpShowPrintBorders::GetState(String_256*, OpDescriptor*)
04196 {
04197 OpState OpSt;
04198
04199 DocView *pDocView = DocView::GetSelected();
04200 if (pDocView != NULL)
04201 OpSt.Ticked = pDocView->GetShowPrintBorders();
04202
04203 return OpSt;
04204 }
04205
04206
04207
04208 #endif //webster