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
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00113
00114
00115 #include "camtypes.h"
00116
00117 #if _DEBUG
00118
00119
00120 #include "debugdlg.h"
00121
00122
00123 #include "progress.h"
00124
00125
00126
00127 #include "colcontx.h"
00128 #include "colormgr.h"
00129 #include "colplate.h"
00130
00131
00132
00133
00134
00135 #include "bitmpinf.h"
00136
00137 #include "prnmks.h"
00138
00139 #include "princomp.h"
00140 #include "printctl.h"
00141
00142
00143
00144 #include "nodecont.h"
00145
00146
00147 #include "groupops.h"
00148 #include "lineattr.h"
00149 #include "mkshapes.h"
00150 #include "pathstrk.h"
00151 #include "ppairbsh.h"
00152 #include "ppstroke.h"
00153 #include "ppvecstr.h"
00154 #include "strkattr.h"
00155 #include "valfunc.h"
00156
00157 #include "objcache.h"
00158 #include "cachrand.h"
00159 #include "cachweak.h"
00160 #include "cachfifo.h"
00161
00162 #include "opimgset.h"
00163
00164 #include "opliveeffects.h"
00165
00166
00167
00168 #include <time.h>
00169 #include <stdlib.h>
00170
00171 #if FALSE
00172 #include <activscp.h>
00173 #include "ccc.h"
00174 #endif
00175
00176
00177
00178 CC_IMPLEMENT_DYNCREATE(DebugDlg, DialogOp)
00179
00180 #define new CAM_DEBUG_NEW
00181
00182
00183 const INT32 DebugDlg::IDD = _R(IDD_DEBUGDLG);
00184 const CDlgMode DebugDlg::Mode = MODELESS;
00185
00186
00187
00188 static INT32 LastSelectedIndex = 0;
00189 static INT32 LastSelectedGroup = 8;
00190 static BOOL CloseAndExecute = FALSE;
00191
00192 #if FALSE
00193 static TCHAR g_szScriptToExecute[] = TEXT("ScriptToExecute");
00194 static String_256 g_ScriptToExecute;
00195
00196
00197 static TCHAR g_szScriptEngineCLSID[] = TEXT("B54F3741-5B07-11CF-A4B0-00AA004A55E8");
00198 static String_256 g_ScriptEngineCLSID;
00199
00200 static IActiveScript* m_pScriptEngine = NULL;
00201 static IActiveScriptParse* m_pScriptParser = NULL;
00202
00203
00204 static const IID IID_IActiveScript =
00205 { 0xbb1a2ae1, 0xa4f9, 0x11cf, {0x8f, 0x20, 0x0, 0x80, 0x5f, 0x2c, 0xd0, 0x64}};
00206
00207
00208 static const IID IID_IActiveScriptParse =
00209 { 0xbb1a2ae2, 0xa4f9, 0x11cf, {0x8f, 0x20, 0x0, 0x80, 0x5f, 0x2c, 0xd0, 0x64}};
00210
00211 HRESULT InitializeScriptEngine(const GUID& ScriptCLSID)
00212 {
00213 HRESULT Result = S_OK;
00214
00215 Result = CoCreateInstance(ScriptCLSID, NULL, CLSCTX_INPROC_SERVER, IID_IActiveScript, (void**)&m_pScriptEngine);
00216
00217 if (SUCCEEDED(Result))
00218 {
00219 Result = m_pScriptEngine->QueryInterface(IID_IActiveScriptParse, (void**)&m_pScriptParser);
00220 }
00221
00222 if (SUCCEEDED(Result))
00223 {
00224 Result = m_pScriptEngine->SetScriptState(SCRIPTSTATE_INITIALIZED);
00225 }
00226
00227 if (SUCCEEDED(Result))
00228 {
00229 Result = m_pScriptParser->InitNew();
00230 }
00231
00232 if (SUCCEEDED(Result))
00233 {
00234 Result = m_pScriptEngine->AddNamedItem(OLESTR("Application"), SCRIPTITEM_ISVISIBLE);
00235 }
00236
00237
00238 return Result;
00239 }
00240
00241 HRESULT ParseScript(const StringBase& ScriptName)
00242 {
00243 HRESULT Result = S_OK;
00244
00245 ScriptName;
00246 BSTR bstrScript;
00247 EXCEPINFO ExceptionInfo;
00248 Result = m_pScriptParser->ParseScriptText(bstrScript, NULL,NULL,NULL,0,0,SCRIPTTEXT_ISVISIBLE,NULL,&ExceptionInfo);
00249
00250 if (SUCCEEDED(Result))
00251 {
00252 Result = m_pScriptEngine->SetScriptState(SCRIPTSTATE_STARTED);
00253 }
00254
00255 return Result;
00256 }
00257
00258
00259 void ExecuteScript(const StringBase& ScriptName)
00260 {
00261 HRESULT Result = S_OK;
00262
00263 CLSID ScriptCLSID;
00264 LPOLESTR OSScriptCLSID = (LPOLESTR)((LPTSTR)g_ScriptEngineCLSID);
00265 Result = ::CLSIDFromString(OSScriptCLSID, &ScriptCLSID);
00266
00267 if (SUCCEEDED(Result))
00268 {
00269 Result = InitializeScriptEngine(ScriptCLSID);
00270 }
00271
00272 if (SUCCEEDED(Result))
00273 {
00274 Result = ParseScript(ScriptName);
00275 }
00276
00277
00278
00279 }
00280
00281 CC_IMPLEMENT_MEMDUMP(ConcurrencyController, CC_CLASS_MEMDUMP)
00282 ConcurrencyController::ConcurrencyController()
00283 {
00284 }
00285 ConcurrencyController::~ConcurrencyController()
00286 {
00287 }
00288
00289 void ExecuteScript(const StringBase& ScriptName)
00290 {
00291 AfxMessageBox(TEXT("Not this week"));
00292 }
00293 #endif // Automation
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307 DebugDlg::DebugDlg() : DialogOp(DebugDlg::IDD, DebugDlg::Mode)
00308 {
00309 }
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324 DebugDlg::~DebugDlg()
00325 {
00326 }
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345 MsgResult DebugDlg::Message(Msg* Message)
00346 {
00347 if (IS_OUR_DIALOG_MSG(Message))
00348 {
00349 DialogMsg* Msg = (DialogMsg*)Message;
00350 BOOL EndDlg = FALSE;
00351
00352 switch (Msg->DlgMsg)
00353 {
00354 case DIM_CREATE:
00355 {
00356
00357 SetGroupList();
00358
00359
00360 SetCommandList(LastSelectedGroup);
00361
00362
00363
00364 INT32 Index = GetSelectedValueIndex(_R(IDC_DEBUGDLG_LIST));
00365 SetCommandValue(LastSelectedGroup, Index);
00366 SetKeyboardFocus (_R(IDC_DEBUGDLG_VALUE1)) ;
00367 HighlightText (_R(IDC_DEBUGDLG_VALUE1)) ;
00368 CloseAndExecute = FALSE;
00369 }
00370 break;
00371
00372
00373 case DIM_COMMIT:
00374 case DIM_SOFT_COMMIT:
00375 {
00376 LastSelectedGroup = GetSelectedValueIndex(_R(IDC_DEBUGDLG_GROUP));
00377 LastSelectedIndex = GetSelectedValueIndex(_R(IDC_DEBUGDLG_LIST));
00378 String_256 Value = GetStringGadgetValue(_R(IDC_DEBUGDLG_VALUE1));
00379 InvokeCommand(LastSelectedGroup, LastSelectedIndex, &Value);
00380
00381
00382 SetCommandValue(LastSelectedGroup, LastSelectedIndex);
00383 }
00384 break;
00385
00386 case DIM_CANCEL:
00387 EndDlg = TRUE;
00388 break;
00389
00390 case DIM_SELECTION_CHANGED:
00391 if (Msg->GadgetID == _R(IDC_DEBUGDLG_LIST))
00392 {
00393 LastSelectedIndex = GetSelectedValueIndex(_R(IDC_DEBUGDLG_LIST));
00394 SetCommandValue(LastSelectedGroup, LastSelectedIndex);
00395 }
00396 else if (Msg->GadgetID == _R(IDC_DEBUGDLG_GROUP))
00397 {
00398 LastSelectedGroup = GetSelectedValueIndex(_R(IDC_DEBUGDLG_GROUP));
00399 SetCommandList(LastSelectedGroup);
00400 LastSelectedIndex = 0;
00401 SetCommandValue(LastSelectedGroup, LastSelectedIndex);
00402 }
00403 break;
00404
00405 case DIM_SELECTION_CHANGED_COMMIT:
00406 if (Msg->GadgetID == _R(IDC_DEBUGDLG_LIST))
00407 {
00408 LastSelectedGroup = GetSelectedValueIndex(_R(IDC_DEBUGDLG_GROUP));
00409 LastSelectedIndex = GetSelectedValueIndex(_R(IDC_DEBUGDLG_LIST));
00410 SetCommandValue(LastSelectedGroup, LastSelectedIndex);
00411
00412 String_256 Value = GetStringGadgetValue(_R(IDC_DEBUGDLG_VALUE1));
00413 InvokeCommand(LastSelectedGroup, LastSelectedIndex, &Value);
00414
00415
00416 SetCommandValue(LastSelectedGroup, LastSelectedIndex);
00417 }
00418 break;
00419 default:
00420
00421 break;
00422 }
00423
00424 if (EndDlg)
00425 {
00426 Close();
00427 End();
00428 return(OK);
00429 }
00430
00431 if (CloseAndExecute)
00432 {
00433 CloseAndExecute=FALSE;
00434 Close();
00435 End();
00436 InvokeLateCommand(LastSelectedGroup, LastSelectedIndex);
00437 return(OK);
00438 }
00439
00440 return (DLG_EAT_IF_HUNGRY(Msg));
00441 }
00442
00443 return OK;
00444 }
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458 OpState DebugDlg::GetState(String_256*, OpDescriptor*)
00459 {
00460 OpState OpSt;
00461 return(OpSt);
00462 }
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477 BOOL DebugDlg::Init(void)
00478 {
00479 #if FALSE
00480 Camelot.DeclarePref( "DebugFlags", g_szScriptToExecute, &g_ScriptToExecute);
00481 Camelot.DeclarePref( "DebugFlags", g_szScriptEngineCLSID, &g_ScriptEngineCLSID);
00482 #endif
00483 return (RegisterOpDescriptor(
00484 0,
00485 _R(IDS_DEBUGDLG),
00486 CC_RUNTIME_CLASS(DebugDlg),
00487 OPTOKEN_DEBUGDLG,
00488 DebugDlg::GetState,
00489 0,
00490 0
00491 )
00492 );
00493 }
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508 BOOL DebugDlg::Create()
00509 {
00510 return(DialogOp::Create());
00511 }
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527 void DebugDlg::Do(OpDescriptor *Bob)
00528 {
00529 if (!Create())
00530 {
00531 InformError();
00532 End();
00533 return;
00534 }
00535
00536 Open();
00537 }
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559 void DebugDlg::SetGroupList(void)
00560 {
00561 String_256 Temp;
00562
00563 DeleteAllValues(_R(IDC_DEBUGDLG_GROUP));
00564
00565 #define ADDGROUP(name) { Temp = TEXT(name); SetStringGadgetValue(_R(IDC_DEBUGDLG_GROUP), Temp); }
00566
00567 ADDGROUP("Imagesetting (Jason)");
00568 ADDGROUP("Jason personal debug");
00569 ADDGROUP("Mikes personal debug");
00570 ADDGROUP("Wills bitmap debug");
00571 ADDGROUP("Low memory debug");
00572 ADDGROUP("Operation history dump");
00573
00574 #ifdef VECTOR_STROKING
00575 ADDGROUP("Shadow rendering tests");
00576 ADDGROUP("Stroke providers")
00577 ADDGROUP("Vector strokes")
00578 ADDGROUP("ObjectCache tests");
00579 #endif
00580 #if FALSE
00581 ADDGROUP("Script Execution");
00582 #endif
00583 ADDGROUP("Phil Debug");
00584 ADDGROUP("Gerry Debug");
00585
00586
00587
00588 #undef ADDGROUP
00589
00590
00591 SetSelectedValueIndex(_R(IDC_DEBUGDLG_GROUP), LastSelectedGroup);
00592 }
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616 void DebugDlg::SetCommandList(INT32 GroupIndex)
00617 {
00618 String_256 Temp;
00619
00620 DeleteAllValues(_R(IDC_DEBUGDLG_LIST));
00621
00622 #define ADDCOMMAND(name) { Temp = TEXT(name); SetStringGadgetValue(_R(IDC_DEBUGDLG_LIST), Temp); }
00623
00624 switch (GroupIndex)
00625 {
00626 case 0:
00627 ADDCOMMAND("Normal document view");
00628
00629 ADDCOMMAND(" Composite preview");
00630 ADDCOMMAND(" Cyan preview");
00631 ADDCOMMAND(" Magenta preview");
00632 ADDCOMMAND(" Yellow preview");
00633 ADDCOMMAND(" Key preview");
00634
00635 ADDCOMMAND(" Spot plate");
00636
00637 ADDCOMMAND("Monochrome toggle");
00638 ADDCOMMAND("Photographic negative toggle");
00639
00640 ADDCOMMAND("Overprint toggle");
00641 ADDCOMMAND("Always overprint black");
00642 break;
00643
00644
00645 case 1:
00646 ADDCOMMAND("Write line to debug stream");
00647 break;
00648
00649 case 2:
00650 ADDCOMMAND("Initialise print marks");
00651 ADDCOMMAND("Add doc print mark");
00652 ADDCOMMAND("Add a colour ramp entry");
00653 ADDCOMMAND("Add a transparency ramp entry");
00654 break;
00655
00656 case 3:
00657 ADDCOMMAND("Dump global bitmap list");
00658 ADDCOMMAND("Dump greyscale bitmap list");
00659 break;
00660
00661 case 4:
00662 ADDCOMMAND("Enable Low Memory Testing");
00663 ADDCOMMAND(" Fail all claims");
00664 ADDCOMMAND(" Fail all claims after n bytes");
00665 ADDCOMMAND("Memory dump");
00666 ADDCOMMAND("Camelot memory check");
00667 ADDCOMMAND("MFC memory check (not for SmartHeap users)");
00668 break;
00669
00670 case 5:
00671 ADDCOMMAND("Dump last operation");
00672 ADDCOMMAND("Dump all operations");
00673 break;
00674
00675
00676 #ifdef VECTOR_STROKING
00677 case 6:
00678 ADDCOMMAND("Random positioning");
00679 ADDCOMMAND("Linewidth");
00680 ADDCOMMAND("StrokePathToPath");
00681 ADDCOMMAND("FlattenExpand");
00682 ADDCOMMAND("Bitmap Shadow");
00683 break;
00684
00685 case 7:
00686 ADDCOMMAND("Old-style line");
00687 ADDCOMMAND("Constant width stroke");
00688 ADDCOMMAND("Linear Ramp");
00689 ADDCOMMAND("S Ramp");
00690 ADDCOMMAND("Blip");
00691 ADDCOMMAND("Ellipse");
00692 ADDCOMMAND("Teardrop");
00693 ADDCOMMAND("Thumbtack");
00694 ADDCOMMAND("Airbrush - S");
00695 ADDCOMMAND("Airbrush - linear");
00696 ADDCOMMAND("Airbrush - random");
00697 ADDCOMMAND("Airbrush - L");
00698 break;
00699
00700 case 8:
00701 ADDCOMMAND("Create new vector stroke");
00702 ADDCOMMAND("Create new repeating vector stroke");
00703 ADDCOMMAND("Apply last created vector stroke");
00704 break;
00705
00706 case 9:
00707 ADDCOMMAND("Fill up the cache");
00708 ADDCOMMAND("Add fixed size objects");
00709 ADDCOMMAND("Add randomed size objects")
00710 ADDCOMMAND("Add a big object");
00711 break;
00712 #endif
00713
00714 #if FALSE
00715 case 10:
00716 ADDCOMMAND("Run the Script");
00717 break;
00718
00719 #endif
00720 case 10:
00721 ADDCOMMAND("Apply default Live Effect (blur)");
00722 ADDCOMMAND("Invoke IXaraPhotoEditor3");
00723 ADDCOMMAND("End IXaraPhotoEditor3 Session");
00724 ADDCOMMAND("Dump Bitmap Cache");
00725 ADDCOMMAND("Create new spread");
00726 break;
00727
00728 case 11:
00729 ADDCOMMAND("Command 0");
00730 break;
00731 }
00732
00733 #undef ADDCOMMMAND
00734
00735
00736 SetSelectedValueIndex(_R(IDC_DEBUGDLG_LIST), LastSelectedIndex);
00737 }
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763 void DebugDlg::SetCommandValue(INT32 GroupIndex, INT32 CommandIndex)
00764 {
00765 String_256 Description(TEXT("Does an unknown debug option"));
00766
00767 String_256 Value(TEXT("0"));
00768 BOOL IsEditable = FALSE;
00769
00770 switch(GroupIndex)
00771 {
00772 case 0:
00773 switch (CommandIndex)
00774 {
00775 case 0: Description = TEXT("Disables global colour separations"); break;
00776 case 1: Description = TEXT("Changes to a composite WYSIWYG print preview"); break;
00777 case 2: Description = TEXT("Changes to CYAN colour separation"); break;
00778 case 3: Description = TEXT("Changes to MAGENTA colour separation"); break;
00779 case 4: Description = TEXT("Changes to YELLOW colour separation"); break;
00780 case 5: Description = TEXT("Changes to KEY colour separation"); break;
00781 case 6:
00782 {
00783 Description = TEXT("Changes to specified SPOT separation");
00784 Value = TEXT("1");
00785
00786 ColourContext *cc = ColourManager::GetColourContext(COLOURMODEL_RGBT, DocView::GetSelected());
00787 ColourPlate *SepDescriptor = cc->GetColourPlate();
00788 if (SepDescriptor && SepDescriptor->GetType() == COLOURPLATE_SPOT)
00789 {
00790 IndexedColour *pSpotCol = SepDescriptor->GetSpotColour();
00791 if (pSpotCol)
00792 {
00793
00794 ColourList* pColList = Document::GetSelected()->GetIndexedColours();
00795 IndexedColour* pCol = (IndexedColour*) pColList->GetHead();
00796 INT32 Count = 0;
00797
00798 while (pCol != NULL)
00799 {
00800 if (pCol->GetType() == COLOURTYPE_SPOT && !pCol->IsDeleted())
00801 {
00802 Count++;
00803 }
00804
00805 if (pCol == pSpotCol)
00806 break;
00807
00808 pCol = (IndexedColour*) pColList->GetNext(pCol);
00809 }
00810
00811 if (pCol && Count > 0)
00812 Value._MakeMsg(_T("#1%d"), Count);
00813 }
00814 }
00815
00816
00817 IsEditable = TRUE;
00818 }
00819 break;
00820
00821 case 7:
00822 {
00823 Description = TEXT("Toggles colour output to/from monochrome");
00824
00825 ColourContext *cc = ColourManager::GetColourContext(COLOURMODEL_RGBT, DocView::GetSelected());
00826 ColourPlate *SepDescriptor = cc->GetColourPlate();
00827 BOOL Mono = (SepDescriptor != NULL) ? SepDescriptor->IsMonochrome() : FALSE;
00828
00829 Value = (Mono) ? TEXT("Enabled") : TEXT("Disabled");
00830 }
00831 break;
00832
00833 case 8:
00834 {
00835 Description = TEXT("Toggles colour output to/from photographic negative");
00836
00837 ColourContext *cc = ColourManager::GetColourContext(COLOURMODEL_RGBT, DocView::GetSelected());
00838 ColourPlate *SepDescriptor = cc->GetColourPlate();
00839 BOOL Negate = (SepDescriptor != NULL) ? SepDescriptor->IsNegative() : FALSE;
00840
00841 Value = (Negate) ? TEXT("Enabled") : TEXT("Disabled");
00842 }
00843 break;
00844
00845 case 9: Description = TEXT("Toggles plate overprint for the current plate"); break;
00846 case 10:
00847 Description = TEXT("Toggles 'Always overprint black' state");
00848 {
00849 Document *Bob = Document::GetSelected();
00850
00851 if (Bob != NULL)
00852 {
00853 PrintComponent *Sally = (PrintComponent *)
00854 Bob->GetDocComponent(CC_RUNTIME_CLASS(PrintComponent));
00855 if (Sally != NULL)
00856 {
00857 PrintControl *Ernest = Sally->GetPrintControl();
00858 if (Ernest != NULL)
00859 {
00860 TypesetInfo *Mavis = Ernest->GetTypesetInfo();
00861 if (Mavis != NULL)
00862 {
00863 Value = (Mavis->AlwaysOverprintBlack()) ? TEXT("Enabled") : TEXT("Disabled");
00864 }
00865 }
00866 }
00867 }
00868 }
00869 break;
00870 }
00871 break;
00872
00873
00874 case 1:
00875 switch (CommandIndex)
00876 {
00877 case 0:
00878 Description = TEXT("Writes the 'value' string to the debug stream");
00879
00880
00881 Value = TEXT("--- trace marker inserted by user ---");
00882
00883
00884 IsEditable = TRUE;
00885 break;
00886 }
00887 break;
00888
00889 #ifndef WEBSTER // Neville 6/8/97
00890 case 2:
00891 switch (CommandIndex)
00892 {
00893 case 0: Description = TEXT("Initialises the print mark managers cache"); break;
00894 case 1: Description = TEXT("Adds the first print mark to the selected doc"); break;
00895
00896 case 2: Description = TEXT("Adds a new colour to a grad fills colour ramp");
00897
00898 Value = TEXT("128");
00899 IsEditable = TRUE;
00900 break;
00901 case 3: Description = TEXT("Adds a new transp to a grad transp ramp");
00902
00903 Value = TEXT("128");
00904 IsEditable = TRUE;
00905 break;
00906 }
00907 break;
00908 #endif // WEBSTER
00909
00910 case 3:
00911 switch (CommandIndex)
00912 {
00913 case 0: Description = TEXT("Dumps the current global bitmap list"); break;
00914 case 1: Description = TEXT("Dumps the current greyscale bitmap list"); break;
00915 }
00916 break;
00917
00918 case 4:
00919 switch (CommandIndex)
00920 {
00921 case 0: Description = TEXT("Enable or disbale low memory testing");
00922 Value = (SimpleCCObject::GetLowMemoryState()) ? TEXT("Enabled") : TEXT("Disabled");
00923 break;
00924 case 1: Description = TEXT("Fails all memory claims.");
00925 if (SimpleCCObject::GetLowMemoryState() && SimpleCCObject::GetLowMemoryLimit()==0)
00926 Value = TEXT("Enabled");
00927 else
00928 Value = TEXT("Disabled");
00929 break;
00930 case 2: Description = TEXT("Fails memory claims after the specified number of bytes have been claimed.");
00931 {
00932 String_32 Number;
00933 Number._MakeMsg(_T("#1%lu"), SimpleCCObject::GetLowMemoryLimit());
00934 Value = Number;
00935 IsEditable = TRUE;
00936 break;
00937 }
00938 case 3: Description = TEXT("Lists all allocated objects to the TRACE display.");
00939 break;
00940 case 4: Description = TEXT("Checks guardwords on Camelot memory allocations.");
00941 break;
00942 case 5: Description = TEXT("MFC memory allocation check.");
00943 break;
00944 }
00945 break;
00946
00947 case 5:
00948 switch (CommandIndex)
00949 {
00950 case 0: Description = TEXT("Dump actions in the last operation (in the selected document) to TRACE display"); break;
00951 case 1: Description = TEXT("Dump actions in all operations (in the selected document) to TRACE display"); break;
00952 }
00953 break;
00954
00955 #ifdef VECTOR_STROKING // Neville 6/8/97
00956 case 6:
00957 switch (CommandIndex)
00958 {
00959 case 0: Description = TEXT("Render n copies around a centrepoint (Fails on large penumbras)"); break;
00960 case 1: Description = TEXT("Render decreasing linewidths with decreasing transparency (Fails on transparent shadows)"); break;
00961 case 2: Description = TEXT("Render StrokePathToPath linewidths (Far too slow (on complex shapes))"); break;
00962 case 3: Description = TEXT("Flatten and expand paths (Fails on inverted paths)"); break;
00963 case 4: Description = TEXT("Bitmap shadower Using new Shadower COM Object"); break;
00964 }
00965 break;
00966
00967 case 7:
00968 switch (CommandIndex)
00969 {
00970 case 0: Description = TEXT("Reset the stroke to 'old style line' (the default)"); break;
00971 case 1: Description = TEXT("Apply a constant width variable-width stroke attribute"); break;
00972 case 2: Description = TEXT("Apply a linear ramp variable-width stroke attribute"); break;
00973 case 3: Description = TEXT("Apply an 'S' ramp variable-width stroke attribute"); break;
00974 case 4: Description = TEXT("Apply a 'blip' variable-width stroke attribute"); break;
00975 case 5: Description = TEXT("Apply an 'ellipse' variable-width stroke attribute"); break;
00976 case 6: Description = TEXT("Apply a 'teardrop' variable-width stroke attribute"); break;
00977 case 7: Description = TEXT("Apply a 'thumbtack' variable-width stroke attribute"); break;
00978 case 8: Description = TEXT("Apply an airbrush stroke attribute"); break;
00979 case 9: Description = TEXT("Apply an airbrush stroke attribute"); break;
00980 case 10:Description = TEXT("Apply an airbrush stroke attribute"); break;
00981 case 11:Description = TEXT("Apply an airbrush stroke attribute"); break;
00982 }
00983 break;
00984
00985 case 8:
00986 switch (CommandIndex)
00987 {
00988 case 0: Description = TEXT("Set the vector stroke brush from the selection"); break;
00989 case 1: Description = TEXT("Set the vector stroke brush, and make it repeating"); break;
00990 case 2: Description = TEXT("Apply the last vector stroke you created"); break;
00991 }
00992 break;
00993
00994 case 9:
00995 switch (CommandIndex)
00996 {
00997 case 0: Description = TEXT("Add as many objects as needed to fill up the cache");break;
00998 case 1: Description = TEXT("Add several objects which size increase");break;
00999 case 2: Description = TEXT("Add several objects with a random size");break;
01000 case 3: Description = TEXT("Add an object bigger than the cachesize");break;
01001 }
01002 break;
01003 #endif // VECTOR_STROKING
01004
01005 #if FALSE
01006 case 10:
01007 switch (CommandIndex)
01008 {
01009 case 0:
01010 Description = TEXT("Run a Script");
01011 break;
01012 }
01013 break;
01014 #endif
01015 case 10:
01016 switch (CommandIndex)
01017 {
01018 case 0:
01019 Description = TEXT("Apply the default debug effect to the selection");
01020 break;
01021 case 1:
01022 Description = TEXT("Call the new XPE interface for modeless editing");
01023 break;
01024 case 2:
01025 Description = TEXT("End the XPE editing session successfully");
01026 break;
01027 case 3:
01028 Description = TEXT("Dump a description of the bitmap cache to the debug output");
01029 break;
01030 case 4:
01031 Description = TEXT("Create a second spread! OOER!");
01032 break;
01033 }
01034 break;
01035
01036 case 11:
01037 switch (CommandIndex)
01038 {
01039 case 0:
01040 Description = TEXT("Command 0");
01041 break;
01042 }
01043 break;
01044
01045
01046 }
01047
01048 SetStringGadgetValue(_R(IDC_DEBUGDLG_COMMENT), Description);
01049
01050 SetStringGadgetValue(_R(IDC_DEBUGDLG_VALUE1), Value);
01051 EnableGadget(_R(IDC_DEBUGDLG_VALUE1), IsEditable);
01052 }
01053
01054
01055 class NodeShadowController;
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078 void DebugDlg::InvokeCommand(INT32 GroupIndex, INT32 CommandIndex, StringBase *NewValue)
01079 {
01080 String_256 Desc(TEXT("Doing debug command..."));
01081 Progress Hourglass((StringBase *) &Desc, -1, FALSE);
01082
01083 switch (GroupIndex)
01084 {
01085 case 0:
01086 switch (CommandIndex)
01087 {
01088 case 0:
01089 if (DocView::GetSelected() != NULL)
01090 {
01091
01092 DocView::GetSelected()->SetColourPlate(NULL);
01093 ColourManager::SelViewContextHasChanged();
01094 }
01095 break;
01096
01097 case 1: SetNewColourPlate(COLOURPLATE_COMPOSITE,0,0); break;
01098 case 2: SetNewColourPlate(COLOURPLATE_CYAN, 0,0); break;
01099 case 3: SetNewColourPlate(COLOURPLATE_MAGENTA, 0,0); break;
01100 case 4: SetNewColourPlate(COLOURPLATE_YELLOW, 0,0); break;
01101 case 5: SetNewColourPlate(COLOURPLATE_KEY, 0,0); break;
01102 case 6:
01103 {
01104 INT32 Pos = 0;
01105 INT32 SpotPlate = NewValue->ConvertToInteger(Pos);
01106 SetNewColourPlate(COLOURPLATE_SPOT, 0,SpotPlate);
01107 }
01108 break;
01109 case 7: SetNewColourPlate(COLOURPLATE_NONE, 1,0); break;
01110 case 8: SetNewColourPlate(COLOURPLATE_NONE, 2,0); break;
01111 case 9: SetNewColourPlate(COLOURPLATE_NONE, 3,0); break;
01112
01113 case 10:
01114 {
01115 Document *Bob = Document::GetSelected();
01116
01117 if (Bob != NULL)
01118 {
01119 PrintComponent *Sally = (PrintComponent *)
01120 Bob->GetDocComponent(CC_RUNTIME_CLASS(PrintComponent));
01121 if (Sally != NULL)
01122 {
01123 PrintControl *Ernest = Sally->GetPrintControl();
01124 if (Ernest != NULL)
01125 {
01126 TypesetInfo *Mavis = Ernest->GetTypesetInfo();
01127 if (Mavis != NULL)
01128 {
01129 Mavis->SetOverprintBlack(!Mavis->AlwaysOverprintBlack());
01130 }
01131 }
01132 }
01133 }
01134 }
01135 break;
01136
01137 default:
01138 ERROR3("Unknown debug command");
01139 break;
01140 }
01141 break;
01142
01143
01144 case 1:
01145 switch (CommandIndex)
01146 {
01147 case 0:
01148
01149
01150
01151
01152 TRACE( _T("%s\n"), (TCHAR *) (*NewValue));
01153 break;
01154
01155 default:
01156 ERROR3("Unknown debug command");
01157 break;
01158 }
01159 break;
01160
01161 #ifndef WEBSTER // Neville 6/8/97
01162 case 2:
01163 switch (CommandIndex)
01164 {
01165 case 0:
01166 {
01167
01168
01169 PrintMarksMan* pMarksMan = GetApplication()->GetMarksManager();
01170 if (pMarksMan!=NULL)
01171 pMarksMan->ConstructCache();
01172 }
01173 break;
01174
01175 case 1:
01176 {
01177 PrintMarksMan* pMarksMan = GetApplication()->GetMarksManager();
01178 if (pMarksMan!=NULL)
01179 {
01180
01181 PrintMarkItem *pMarkItem = pMarksMan->PMMCache.GetFirstMark();
01182 if (pMarkItem!=NULL)
01183 {
01184 UINT32 Handle=pMarkItem->GetHandle();
01185 Document* pDoc = Document::GetSelected();
01186 if (pDoc)
01187 pMarksMan->AddMarkToDoc(Handle,pDoc);
01188 }
01189 }
01190
01191 }
01192 break;
01193
01194 case 2:
01195 {
01196
01197
01198
01199
01200
01201 AttrColFillRampChange* pAttrib = new AttrColFillRampChange;
01202 if (pAttrib!=NULL)
01203 {
01204 INT32 Pos = 0;
01205 INT32 NewVal = NewValue->ConvertToInteger(Pos);
01206 float pos = ((float)NewVal) / 255.0f;
01207 if (pos<0.0f) pos=0.0f;
01208 if (pos>1.0f) pos=1.0f;
01209
01210
01211 srand((unsigned)time(NULL));
01212 INT32 r,g,b;
01213 r = rand();
01214 g = rand();
01215 b = rand();
01216 r &= 0xFF;
01217 g &= 0xFF;
01218 g &= 0xFF;
01219 DocColour TestColour(r,g,b);
01220 pAttrib->InitForColourAdd(&TestColour, pos);
01221
01222
01223 AttributeManager::AttributeSelected(NULL, pAttrib);
01224 }
01225 }
01226 break;
01227
01228 case 3:
01229 {
01230
01231 AttrTranspFillRampChange* pAttrib = new AttrTranspFillRampChange;
01232 if (pAttrib!=NULL)
01233 {
01234 INT32 Pos = 0;
01235 INT32 NewVal = NewValue->ConvertToInteger(Pos);
01236
01237 float pos = ((float)NewVal) / 255.0f;
01238 if (pos<0.0f) pos=0.0f;
01239 if (pos>1.0f) pos=1.0f;
01240
01241
01242 srand((unsigned)time(NULL));
01243 UINT32 t = (UINT32)rand();
01244 t = t & 0xFF;
01245 pAttrib->InitForTranspAdd(t, pos);
01246
01247
01248 AttributeManager::AttributeSelected(NULL, pAttrib);
01249 }
01250 }
01251 break;
01252
01253 default:
01254 ERROR3("Unknown debug command");
01255 break;
01256 }
01257 break;
01258 #endif // WEBSTER
01259
01260 case 3:
01261 switch (CommandIndex)
01262 {
01263 case 0:
01264 {
01265 GlobalBitmapList* pBmpList = GetApplication()->GetGlobalBitmapList();
01266 if (pBmpList)
01267 pBmpList->DumpGlobalBitmapListToTrace();
01268 }
01269 break;
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280 default:
01281 ERROR3("Unknown debug command");
01282 break;
01283 }
01284 break;
01285
01286 case 4 :
01287 switch (CommandIndex)
01288 {
01289 case 0:
01290 {
01291 SimpleCCObject::EnableLowMemoryTesting();
01292 }
01293 break;
01294
01295 case 1:
01296 {
01297 SimpleCCObject::EnableLowMemoryTesting();
01298 SimpleCCObject::SetClaimLimit(0);
01299 }
01300 break;
01301
01302 case 2:
01303 {
01304 INT32 Pos = 0;
01305 INT32 NewVal = NewValue->ConvertToInteger(Pos);
01306 SimpleCCObject::SetClaimLimit(NewVal);
01307 }
01308 break;
01309
01310 case 3:
01311 {
01312 SimpleCCObject::MemoryDump();
01313 }
01314 break;
01315
01316 case 4:
01317 {
01318 SimpleCCObject::CheckMemory(TRUE);
01319 }
01320 break;
01321
01322 case 5:
01323 {
01324
01325
01326 }
01327 break;
01328
01329 default:
01330 ERROR3("Unknown/Unimplemented debug command");
01331 break;
01332 }
01333 break;
01334
01335 case 5:
01336 switch (CommandIndex)
01337 {
01338 case 0: GetApplication()->DumpLastOp(); break;
01339 case 1: GetApplication()->DumpAllOps(); break;
01340 default: ERROR3("Unknown/Unimplemented debug command"); break;
01341 }
01342 break;
01343
01344 #ifdef VECTOR_STROKING // Neville 6/8/97
01345 case 6:
01346
01347 break;
01348
01349 case 7:
01350 {
01351 AttrStrokeType *pStrokeAttr = new AttrStrokeType;
01352 PathProcessorStroke *pProcessor = NULL;
01353
01354 AttrVariableWidth *pWidthAttr = new AttrVariableWidth;
01355 VariableWidthID Function = VarWidth_NotPredefined;
01356 ValueFunction *pFunction = NULL;
01357
01358
01359
01360
01361 BOOL NeedToApplyType = FALSE;
01362
01363
01364 {
01365 SelRange *Selection = Camelot.FindSelection();
01366 ERROR3IF(Selection == NULL, "No Selection SelRange!?!");
01367
01368 NodeAttribute *pNode = NULL;
01369 switch(Selection->FindCommonAttribute(CC_RUNTIME_CLASS(AttrStrokeType), &pNode))
01370 {
01371 case SelRange::ATTR_COMMON:
01372 if (pNode != NULL)
01373 {
01374
01375
01376 StrokeTypeAttrValue *pSAV = (StrokeTypeAttrValue *) ((AttrStrokeType *)pNode)->GetAttributeValue();
01377 if (pSAV == NULL || pSAV->GetPathProcessor() == NULL)
01378 NeedToApplyType = TRUE;
01379 }
01380 else
01381 NeedToApplyType = TRUE;
01382 break;
01383
01384 default:
01385 NeedToApplyType = TRUE;
01386 break;
01387 }
01388 }
01389
01390 switch (CommandIndex)
01391 {
01392 case 0:
01393
01394 break;
01395
01396
01397 case 1: Function = VarWidth_Constant; break;
01398 case 2: Function = VarWidth_LinRamp; break;
01399 case 3: Function = VarWidth_SRamp; break;
01400 case 4: pFunction = new ValueFunctionBlip; break;
01401 case 5: pFunction = new ValueFunctionEllipse; break;
01402 case 6: pFunction = new ValueFunctionTeardrop; break;
01403 case 7: pFunction = new ValueFunctionThumbtack; break;
01404
01405 case 8:
01406 case 9:
01407 case 10:
01408 case 11:
01409 pProcessor = new PathProcessorStrokeAirbrush;
01410
01411 switch(CommandIndex)
01412 {
01413 case 8:
01414 break;
01415
01416 case 9:
01417 {
01418 ValueFunction *pFunc = new ValueFunctionRampLinear(1.0, 0.0);
01419 ((PathProcessorStrokeAirbrush *)pProcessor)->SetIntensityFunction(pFunc);
01420 }
01421 break;
01422
01423 case 10:
01424 {
01425 ValueFunction *pFunc = new ValueFunctionRandom(0, 0.0, 0.8);
01426 ((PathProcessorStrokeAirbrush *)pProcessor)->SetIntensityFunction(pFunc);
01427 }
01428 break;
01429
01430 case 11:
01431 {
01432 ValueFunction *pFunc = new ValueFunctionRampL;
01433 ((PathProcessorStrokeAirbrush *)pProcessor)->SetIntensityFunction(pFunc);
01434 }
01435 break;
01436 }
01437
01438
01439 {
01440
01441 AttrJoinType *pJoinAttr = new AttrJoinType();
01442 if (pJoinAttr != NULL)
01443 {
01444 pJoinAttr->Value.JoinType = RoundJoin;
01445 AttributeManager::AttributeSelected(pJoinAttr);
01446 }
01447
01448 AttrStartCap *pCapAttr = new AttrStartCap;
01449 if (pCapAttr != NULL)
01450 {
01451 pCapAttr->Value.StartCap = LineCapRound;
01452 AttributeManager::AttributeSelected(pCapAttr);
01453 }
01454 }
01455 break;
01456 }
01457
01458 if (CommandIndex != 0 && pProcessor == NULL)
01459 {
01460
01461
01462
01463 if (NeedToApplyType)
01464 pProcessor = new PathProcessorStroke;
01465 else
01466 {
01467 delete pStrokeAttr;
01468 pStrokeAttr = NULL;
01469 }
01470 }
01471
01472 if (pStrokeAttr != NULL && pProcessor != NULL)
01473 ((StrokeTypeAttrValue *)pStrokeAttr->GetAttributeValue())->SetPathProcessor(pProcessor);
01474
01475 if (pWidthAttr != NULL)
01476 {
01477 if (Function != VarWidth_NotPredefined)
01478 ((VariableWidthAttrValue *)pWidthAttr->GetAttributeValue())->SetWidthFunction(Function);
01479 else if (pFunction != NULL)
01480 ((VariableWidthAttrValue *)pWidthAttr->GetAttributeValue())->SetWidthFunction(pFunction);
01481 else
01482 {
01483
01484 delete pWidthAttr;
01485 pWidthAttr = NULL;
01486 }
01487 }
01488
01489
01490 if (pStrokeAttr != NULL)
01491 AttributeManager::AttributeSelected(pStrokeAttr);
01492
01493 if (pWidthAttr != NULL)
01494 AttributeManager::AttributeSelected(pWidthAttr);
01495 }
01496 break;
01497
01498 case 8:
01499 {
01500 switch (CommandIndex)
01501 {
01502 case 0:
01503 case 1:
01504
01505 {
01506
01507 String_256 Desc("Building new stroke brush...");
01508 Progress::Start(FALSE, &Desc);
01509 OpDescriptor *pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_MAKE_SHAPES);
01510 if (pOp != NULL)
01511 pOp->Invoke();
01512
01513
01514 pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_GROUP);
01515 if (pOp != NULL)
01516 pOp->Invoke();
01517
01518
01519 PathStrokerVector::BodgeRipSelection((CommandIndex == 0) ? FALSE : TRUE);
01520 Progress::Stop();
01521 }
01522 break;
01523
01524
01525 case 2:
01526 {
01527 AttrStrokeType *pStrokeAttr = new AttrStrokeType;
01528 PathProcessorStrokeVector *pProcessor = new PathProcessorStrokeVector;
01529
01530 if (pStrokeAttr != NULL && pProcessor != NULL)
01531 {
01532 pProcessor->SetStrokeDefinition(PathStrokerVector::GetCurrentBrush());
01533 ((StrokeTypeAttrValue *)pStrokeAttr->GetAttributeValue())->SetPathProcessor(pProcessor);
01534 AttributeManager::AttributeSelected(pStrokeAttr);
01535 }
01536 }
01537 break;
01538 }
01539 }
01540 break;
01541
01542
01543 case 9:
01544 {
01545
01546 ObjectCache* pObjCache = GetApplication()->GetObjectCache();
01547
01548 if (pObjCache == NULL)
01549 return;
01550
01551 WORD hObj = 0;
01552
01553 switch(CommandIndex)
01554 {
01555 case 0:
01556 {
01557 for (INT32 i=0;i<=50;i++)
01558 {
01559 DummyCachedObject* a = new DummyCachedObject;
01560 pObjCache->Add(a);
01561 }
01562 }
01563 break;
01564 case 1:
01565 {
01566 for (INT32 i=0;i<=50;i++)
01567 {
01568 DummyCachedObject* b = new DummyCachedObject(i);
01569 pObjCache->Add(b);
01570 }
01571 }
01572 break;
01573 case 2:
01574 {
01575 srand((unsigned)time(NULL));
01576 for (INT32 i=1;i<=50;i++)
01577 {
01578 DummyCachedObject* c = new DummyCachedObject(rand()%50+1);
01579 pObjCache->Add(c);
01580 }
01581 }
01582 break;
01583
01584 case 3:
01585 {
01586 DummyCachedObject* u = new DummyCachedObject(55);
01587 hObj = pObjCache->Add(u);
01588 }
01589 break;
01590 default:
01591 ERROR3("Unknown/Unimplemented debug command");
01592 break;
01593 }
01594 }
01595 break;
01596 #endif // VECTOR_STROKING
01597
01598 #if FALSE
01599 case 10:
01600 {
01601 ExecuteScript(g_ScriptToExecute);
01602 }
01603 break;
01604 #endif
01605 case 10:
01606 {
01607 switch(CommandIndex)
01608 {
01609 PORTNOTE("LiveEffects", "Removed use of LiveEffects")
01610 #ifndef EXCLUDE_FROM_XARALX
01611 case 0:
01612 {
01613 OpDescriptor* pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_APPLY_LIVEEFFECT);
01614 if (pOp != NULL)
01615 {
01616 OpLiveEffectParam Param;
01617 Param.bIsDestructive = FALSE;
01618 Param.strOpUnique = String(_T("Enhance"));
01619 pOp->Invoke(&Param);
01620 }
01621 }
01622 break;
01623 case 1:
01624 {
01625 OpDescriptor* pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_EDIT_LIVEEFFECT);
01626 if (pOp != NULL)
01627 {
01628 OpLiveEffectParam Param;
01629 Param.bIsDestructive = FALSE;
01630 Param.strOpUnique = String(_T("Enhance"));
01631 pOp->Invoke(&Param);
01632 }
01633 }
01634 break;
01635 #endif
01636 case 2:
01637 {
01638
01639 }
01640 break;
01641 case 3:
01642 {
01643 CBitmapCache* pCache = GetApplication()->GetBitmapCache();
01644 pCache->DebugDump();
01645 }
01646 break;
01647 case 4:
01648 {
01649
01650 Spread* pSpread = Document::GetSelectedSpread();
01651 Spread* pNewSpread = NULL;
01652 pSpread->NodeCopy((Node**)&pNewSpread);
01653 if (pNewSpread)
01654 {
01655 pNewSpread->AttachNode(pSpread, NEXT);
01656 pSpread->AdjustPasteboards();
01657 }
01658
01659
01660
01661 }
01662 break;
01663 }
01664 }
01665 break;
01666
01667 case 11:
01668 {
01669 switch(CommandIndex)
01670 {
01671 case 0:
01672 {
01673
01674
01675
01676
01677 }
01678 break;
01679 }
01680 }
01681 break;
01682
01683
01684
01685 }
01686 }
01687
01688
01689
01690
01691
01692
01693
01694
01695
01696
01697
01698
01699
01700
01701
01702
01703
01704
01705
01706
01707
01708
01709
01710
01711
01712 void DebugDlg::InvokeLateCommand(INT32 GroupIndex, INT32 CommandIndex)
01713 {
01714 String_256 Desc(TEXT("Doing debug command..."));
01715 Progress Hourglass((StringBase *) &Desc, -1, FALSE);
01716
01717 switch (GroupIndex)
01718 {
01719 case 0:
01720 break;
01721
01722 case 1:
01723 break;
01724
01725 case 2:
01726 switch (CommandIndex)
01727 {
01728 case 0:
01729 {
01730
01731
01732
01733 }
01734 break;
01735 }
01736 break;
01737
01738
01739
01740 }
01741 }
01742
01743
01744 #endif // if _DEBUG