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 #include "camtypes.h"
00101
00102
00103
00104
00105
00106 #include "sgbitmap.h"
00107 #include "sginit.h"
00108 #include "sgmenu.h"
00109
00110
00111
00112
00113
00114
00115 #include "bitmpinf.h"
00116
00117
00118 #include "nodebmp.h"
00119
00120
00121
00122 #include "dragmgr.h"
00123 #include "dragbmp.h"
00124
00125
00126
00127
00128 #include "tracedlg.h"
00129 #include "bfxdlg.h"
00130
00131
00132 #include "impexpop.h"
00133
00134
00135
00136
00137
00138
00139 #include "bmpcomp.h"
00140
00141
00142
00143 #include "comattrmsg.h"
00144 #include "bmpsdlg.h"
00145
00146
00147 #include "giffiltr.h"
00148 #include "bmpsrc.h"
00149
00150 #include "plugop.h"
00151 #include "backgrnd.h"
00152 #include "keypress.h"
00153 #include "impexpop.h"
00154 #include "prevwdlg.h"
00155 #include "bmpexprw.h"
00156
00157 #include "helpuser.h"
00158
00159
00160
00161 #include "qualattr.h"
00162 #include "bfxop.h"
00163 #include "fillattr2.h"
00164
00165 #ifdef PHOTOSHOPPLUGINS
00166 #include "plugmngr.h"
00167 #endif //PHOTOSHOPPLUGINS
00168
00169 #include "camview.h"
00170
00171
00172 CC_IMPLEMENT_DYNCREATE(BitmapSGallery, SuperGallery)
00173 CC_IMPLEMENT_DYNAMIC(SGDisplayKernelBitmap, SGDisplayItem)
00174 CC_IMPLEMENT_DYNCREATE(OpDisplayBitmapGallery,Operation);
00175 CC_IMPLEMENT_DYNAMIC(SGBitmapDragTarget, SGListDragTarget);
00176
00177 CC_IMPLEMENT_DYNCREATE(GalleryBitmapDragInfo, BitmapDragInformation)
00178
00179
00180
00181
00182
00183 #define new CAM_DEBUG_NEW
00184
00185
00186 BOOL BitmapSGallery::IgnoreBmpListChange = FALSE;
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202 SGBitmapDragTarget::SGBitmapDragTarget(DialogOp *TheDialog, CGadgetID TheGadget)
00203 : SGListDragTarget(TheDialog, TheGadget)
00204 {
00205 ERROR3IF(!TheDialog->IsKindOf(CC_RUNTIME_CLASS(BitmapSGallery)),
00206 "You can only use SGBitmapDragTargets with BitmapSGallery dialogues!");
00207 }
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232 BOOL SGBitmapDragTarget::ProcessEvent(DragEventType Event, DragInformation *pDragInfo,
00233 OilCoord *pMousePos, KeyPress* pKeyPress)
00234 {
00235 if (!pDragInfo->IsKindOf(CC_RUNTIME_CLASS(BitmapDragInformation)))
00236 return(FALSE);
00237
00238 SGDisplayNode *DraggedNode = NULL;
00239 BOOL IsSimpleBitmapDrag = TRUE;
00240
00241 if (IS_A(pDragInfo, GalleryBitmapDragInfo))
00242 {
00243 DraggedNode = ((GalleryBitmapDragInfo *)pDragInfo)->GetDraggedBitmap();
00244
00245 IsSimpleBitmapDrag = FALSE;
00246
00247 }
00248
00249 if (DraggedNode != NULL)
00250 {
00251 switch(Event)
00252 {
00253 case DRAGEVENT_COMPLETED:
00254 HandleDragCompleted((SuperGallery *) TargetDialog,
00255 DraggedNode, pMousePos, IsSimpleBitmapDrag);
00256 return(TRUE);
00257
00258
00259 case DRAGEVENT_MOUSESTOPPED:
00260 case DRAGEVENT_MOUSEMOVED:
00261 case DRAGEVENT_MOUSEIDLE:
00262
00263 return(DetermineCursorShape((SuperGallery *) TargetDialog,
00264 DraggedNode, pMousePos));
00265 default:
00266 break;
00267 }
00268 }
00269
00270 return(FALSE);
00271 }
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284 GalleryBitmapDragInfo::GalleryBitmapDragInfo()
00285 {
00286 ERROR3("Default GalleryBitmapDragInfo constructor called");
00287 }
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309 GalleryBitmapDragInfo::GalleryBitmapDragInfo(SGDisplayKernelBitmap *pSourceItem,
00310 SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo,
00311 BOOL IsAdjust)
00312 : BitmapDragInformation(pSourceItem->GetDisplayedKernelBitmap(),
00313 120, 0, 0, 0, IsAdjust)
00314 {
00315 SourceItem = pSourceItem;
00316
00317 MouseInfo = *pMouseInfo;
00318 MiscInfo = *pMiscInfo;
00319 }
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332 GalleryBitmapDragInfo::~GalleryBitmapDragInfo()
00333 {
00334 }
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354 void GalleryBitmapDragInfo::OnClick(INT32 Flags ,POINT Point)
00355 {
00356 if (SourceItem != NULL)
00357 SourceItem->DragWasReallyAClick(&MouseInfo, &MiscInfo);
00358 }
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371 UINT32 GalleryBitmapDragInfo::GetCursorID(DragTarget* pDragTarget)
00372 {
00373 if (pDragTarget && pDragTarget->IS_KIND_OF(ViewDragTarget))
00374 {
00375 PageDropInfo PageDropInfo;
00376 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo);
00377
00378 NodeRenderableInk* pObjectHit = PageDropInfo.pObjectHit;
00379 ObjectDragTarget TargetHit = PageDropInfo.TargetHit;
00380
00381 if (pObjectHit && pObjectHit->IS_KIND_OF(NodeBitmap))
00382 TargetHit = NO_TARGET;
00383
00384 ClickModifiers ClickMods = ClickModifiers::GetClickModifiers();
00385 BOOL IsInside = ClickMods.Constrain;
00386
00387 if (!IsInside && pObjectHit && pObjectHit->IsCompound())
00388 {
00389 TargetHit = MANY_TARGET;
00390 }
00391
00392 UINT32 CanFill = IsInside ? _R(IDC_DROPINSIDEONFILL) : _R(IDC_CANDROPONFILL);
00393
00394 switch (TargetHit)
00395 {
00396 case FILL_TARGET:
00397 case LINE_TARGET:
00398 case STARTCOL_TARGET:
00399 case ENDCOL_TARGET:
00400 case ENDCOL2_TARGET:
00401 case ENDCOL3_TARGET:
00402 case MANY_TARGET:
00403 return CanFill;
00404
00405 case NO_TARGET:
00406
00407 return IsInside ? _R(IDC_CANFILLPAGE) : _R(IDC_CANDROPONPAGE);
00408
00409 };
00410
00411 return _R(IDC_CANDROPONPAGE);
00412 }
00413
00414 return _R(IDC_CANTDROP);
00415 }
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428 BOOL GalleryBitmapDragInfo::GetStatusLineText(String_256 * TheText, DragTarget* pDragTarget)
00429 {
00430 ERROR2IF(TheText==NULL,FALSE,"NULL string in GetStatusLineText()");
00431
00432 if (TheBitmap == NULL || TheBitmap->ActualBitmap == NULL)
00433 return FALSE;
00434
00435 String_256 DragString;
00436 String_256 BmpName(TheBitmap->ActualBitmap->GetName());
00437 DragString.MakeMsg(_R(IDS_SGBITMAP_DRAGGING_BITMAP), (TCHAR *)BmpName);
00438
00439 if (pDragTarget && pDragTarget->IS_KIND_OF(ViewDragTarget))
00440 {
00441 PageDropInfo PageDropInfo;
00442 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo);
00443
00444 NodeRenderableInk* pObjectHit = PageDropInfo.pObjectHit;
00445 ObjectDragTarget TargetHit = PageDropInfo.TargetHit;
00446
00447 String_256 ObjectDesc = String_32(_R(IDS_SGBITMAP_THIS_OBJECT));
00448
00449 if (pObjectHit)
00450 {
00451 ObjectDesc = pObjectHit->Describe(FALSE);
00452 }
00453
00454 if (pObjectHit && pObjectHit->IS_KIND_OF(NodeBitmap))
00455 TargetHit = NO_TARGET;
00456
00457 ClickModifiers ClickMods = ClickModifiers::GetClickModifiers();
00458 BOOL IsInside = ClickMods.Constrain;
00459
00460 if (!IsInside && pObjectHit && pObjectHit->IsCompound())
00461 {
00462 TargetHit = MANY_TARGET;
00463 }
00464
00465 switch (TargetHit)
00466 {
00467 case FILL_TARGET:
00468 case LINE_TARGET:
00469 case STARTCOL_TARGET:
00470 case ENDCOL_TARGET:
00471 case ENDCOL2_TARGET:
00472 case ENDCOL3_TARGET:
00473 DragString += String_256(_R(IDS_SGBITMAP_DROP_APPLY_FILL));
00474 DragString += ObjectDesc;
00475 if (IsInside)
00476 DragString += String_16(_R(IDS_SGBITMAP_ALONE));
00477 break;
00478 case MANY_TARGET:
00479 DragString += String_256(_R(IDS_SGBITMAP_DROP_APPLY_FILL));
00480 DragString += ObjectDesc;
00481 DragString += String_256(_R(IDS_SGBITMAP_CONTROL_DROP_INSIDE));
00482 break;
00483 case NO_TARGET:
00484 if (IsInside)
00485 {
00486 DragString += String_256(_R(IDS_DRAGBMP_DROP_SETPAGEBACKGROUND));
00487 }
00488 else
00489 {
00490 DragString += String_256(_R(IDS_SGBITMAP_DROP_INSERT_BITMAP));
00491 }
00492 break;
00493 };
00494
00495 *TheText = DragString;
00496 return TRUE;
00497 }
00498
00499 return FALSE;
00500 }
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517 BOOL GalleryBitmapDragInfo::OnPageDrop(ViewDragTarget* pDragTarget)
00518 {
00519 PageDropInfo ThePageDropInfo;
00520 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&ThePageDropInfo);
00521 NodeRenderableInk* pObjectHit = ThePageDropInfo.pObjectHit;
00522
00523
00524 KernelBitmap* BitmapToApply = TheBitmap;
00525 TheBitmap = NULL;
00526
00527 if(BitmapToApply == NULL)
00528 return FALSE;
00529
00530
00531
00532 if (pObjectHit && !pObjectHit->IS_KIND_OF(NodeBitmap))
00533 {
00534
00535 AttrBitmapColourFill* Attrib = new AttrBitmapColourFill;
00536 if (Attrib == NULL)
00537 return FALSE;
00538
00539 Attrib->AttachBitmap(BitmapToApply);
00540
00541 AttributeManager::ApplyAttribToNode(pObjectHit, Attrib);
00542 }
00543 else
00544 {
00545
00546
00547 BOOL Constrain = KeyPress::IsConstrainPressed();
00548 if (Constrain)
00549 {
00550
00551
00552 Document * pDocument = ThePageDropInfo.pDoc;
00553 if (pDocument == NULL)
00554 return FALSE;
00555 OpBackgroundParam Param;
00556 Param.pBitmap = BitmapToApply;
00557 Param.pDoc = pDocument;
00558 Param.pSpread = ThePageDropInfo.pSpread;
00559
00560
00561 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_BACKGROUND);
00562
00563
00564 if (pOpDesc)
00565 pOpDesc->Invoke(&Param);
00566 }
00567 else
00568 {
00569
00570
00571
00572 OpDescriptor* OpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpCreateNodeBitmap));
00573
00574 if (OpDesc)
00575 {
00576
00577 OpParam param((void *)BitmapToApply,(void *)&ThePageDropInfo);
00578 OpDesc->Invoke(¶m);
00579 }
00580 }
00581 }
00582
00583 return TRUE;
00584 }
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599 SGDisplayKernelBitmap::SGDisplayKernelBitmap()
00600 {
00601 ERROR3("Illegal call on default SGDisplayKernelBitmap constructor - call the other one!");
00602 TheKernelBitmap = NULL;
00603 }
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619 SGDisplayKernelBitmap::SGDisplayKernelBitmap(KernelBitmap *KernelBitmapToDisplay)
00620 {
00621 ERROR3IF(KernelBitmapToDisplay == NULL,
00622 "SGDisplayKernelBitmap - trying to construct me with a NULL parameter is bad");
00623
00624 TheKernelBitmap = KernelBitmapToDisplay;
00625 }
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655 void SGDisplayKernelBitmap::CalculateMyRect(SGFormatInfo *FormatInfo, SGMiscInfo *MiscInfo)
00656 {
00657 INT32 XSize;
00658 INT32 YSize;
00659
00660 switch (MiscInfo->DisplayMode)
00661 {
00662 case 1:
00663 XSize = GridLock(MiscInfo, SG_InfiniteWidth);
00664 YSize = GridLock(MiscInfo, SG_DefaultSmallBmp);
00665 break;
00666
00667 case 2:
00668 XSize = GridLock(MiscInfo, SG_DefaultLargeBmpText);
00669 YSize = GridLock(MiscInfo, SG_DefaultLargeBmp);
00670 break;
00671
00672 default:
00673 XSize = GridLock(MiscInfo, SG_InfiniteWidth);
00674 YSize = GridLock(MiscInfo, SG_DefaultLargeBmp);
00675 break;
00676 }
00677
00678 BitmapInfo Info;
00679 INT32 MaxYSize = YSize;
00680
00681 if (TheKernelBitmap->ActualBitmap &&
00682 TheKernelBitmap->ActualBitmap->GetInfo( &Info )
00683 )
00684 {
00685
00686
00687
00688 double BitmapWidth = Info.RecommendedWidth;
00689 double BitmapHeight = Info.RecommendedHeight;
00690
00691
00692 double Ratio = BitmapHeight/BitmapWidth;
00693
00694 YSize = INT32(YSize * Ratio);
00695
00696
00697 INT32 SelHeight = 16000;
00698
00699 if (YSize < SelHeight*3)
00700 YSize = SelHeight*3;
00701
00702 if (YSize > MaxYSize)
00703 YSize = MaxYSize;
00704 }
00705
00706 CalculateFormatRect(FormatInfo, MiscInfo, XSize, YSize);
00707 }
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732 void SGDisplayKernelBitmap::HandleRedraw(SGRedrawInfo *RedrawInfo, SGMiscInfo *MiscInfo)
00733 {
00734 if (TheKernelBitmap == NULL || TheKernelBitmap->ActualBitmap == NULL)
00735 return;
00736
00737 StartRendering(RedrawInfo, MiscInfo);
00738
00739 DocRect MyRect(FormatRect);
00740
00741
00742
00743 if (MyRect.IsEmpty() || !MyRect.IsValid())
00744 {
00745
00746
00747 StopRendering(RedrawInfo, MiscInfo);
00748 return;
00749 }
00750
00751
00752
00753
00754
00755 INT32 SelHeight = 23000;
00756
00757 if (MyRect.Height() < SelHeight*3)
00758 {
00759 INT32 diff = SelHeight*3 - MyRect.Height();
00760 MyRect.Inflate(0, diff);
00761 }
00762
00763 RenderRegion *Renderer = RedrawInfo->Renderer;
00764
00765 INT32 OnePixel = (INT32) DevicePixels(MiscInfo, 1);
00766 INT32 TwoPixels = (INT32) DevicePixels(MiscInfo, 2);
00767 INT32 ThreePixels = (INT32) DevicePixels(MiscInfo, 3);
00768
00769 Renderer->SetLineWidth(0);
00770 Renderer->SetLineColour(RedrawInfo->Transparent);
00771
00772
00773 DocRect IconRect(MyRect);
00774
00775 BitmapInfo Info;
00776
00777 BOOL bScaleDown = FALSE;
00778
00779 if (TheKernelBitmap->ActualBitmap &&
00780 TheKernelBitmap->ActualBitmap->GetInfo( &Info ))
00781 {
00782
00783 double BitmapWidth = Info.RecommendedWidth;
00784 double BitmapHeight = Info.RecommendedHeight;
00785
00786
00787 double Ratio = BitmapWidth/BitmapHeight;
00788
00789 INT32 IconWidth = INT32(IconRect.Height() * Ratio);
00790
00791 INT32 YSize;
00792 switch (MiscInfo->DisplayMode)
00793 {
00794 case 1:
00795 YSize = GridLock(MiscInfo, SG_DefaultSmallBmp);
00796 break;
00797
00798 case 2:
00799 YSize = GridLock(MiscInfo, SG_DefaultLargeBmp);
00800 break;
00801
00802 default:
00803 YSize = GridLock(MiscInfo, SG_DefaultLargeBmp);
00804 break;
00805 }
00806
00807
00808
00809 if (IconWidth > YSize)
00810 {
00811 Matrix Scale;
00812 Ratio = double(IconWidth)/double(YSize);
00813
00814 Scale = Matrix(FIXED16(1)/Ratio, FIXED16(1)/Ratio);
00815
00816 DocCoord Centre;
00817 Centre.x = IconRect.lo.x;
00818 Centre.y = IconRect.lo.y + IconRect.Height()/2;
00819
00820
00821
00822 IconRect.Translate(-Centre.x, -Centre.y);
00823 Scale.transform(&IconRect.lo);
00824 Scale.transform(&IconRect.hi);
00825 IconRect.Translate(Centre.x, Centre.y);
00826
00827 IconWidth = YSize;
00828 bScaleDown = TRUE;
00829 }
00830
00831 INT32 RightSpace = 0;
00832
00833 if (IconWidth < YSize)
00834 {
00835 INT32 LeftSpace = TwoPixels * 4;
00836 RightSpace = YSize - IconWidth - LeftSpace;
00837 IconRect.Translate(LeftSpace, 0);
00838 }
00839
00840
00841 IconRect.hi.x = IconRect.lo.x + IconWidth;
00842
00843 MyRect.lo.x = IconRect.hi.x + RightSpace + TwoPixels;
00844 MyRect.lo.x += TwoPixels;
00845
00846
00847
00848 INT32 MaxYSize = YSize;
00849 INT32 IconHeight = IconRect.Height();
00850 if (IconHeight > MaxYSize)
00851 {
00852 Matrix Scale;
00853 Ratio = double(IconHeight)/double(YSize);
00854
00855 Scale = Matrix(FIXED16(1)/Ratio, FIXED16(1)/Ratio);
00856
00857 DocCoord Centre;
00858 Centre.x = IconRect.lo.x + IconRect.Width()/2;
00859 Centre.y = IconRect.hi.y;
00860
00861
00862
00863 IconRect.Translate(-Centre.x, -Centre.y);
00864 Scale.transform(&IconRect.lo);
00865 Scale.transform(&IconRect.hi);
00866 IconRect.Translate(Centre.x, Centre.y);
00867
00868 MyRect.lo.y = IconRect.lo.y;
00869 MyRect.hi.y = IconRect.hi.y;
00870 bScaleDown = TRUE;
00871 }
00872 }
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894 GridLockRect(MiscInfo, &MyRect);
00895
00896
00897
00898
00899
00900
00901 if (IconRect.Height() > ThreePixels * 2)
00902 IconRect.Inflate(0, -ThreePixels);
00903
00904 if (IconRect.Width() > ThreePixels * 2)
00905 IconRect.Inflate(-ThreePixels, 0);
00906
00907 GridLockRect(MiscInfo, &IconRect);
00908
00909
00910 DocRect ThumbnailRect(IconRect);
00911
00912
00913
00914
00915 if (ThumbnailRect.Width()==0)
00916 ThumbnailRect.hi.x = ThumbnailRect.lo.x + OnePixel;
00917 if (ThumbnailRect.Height()==0)
00918 ThumbnailRect.hi.y = ThumbnailRect.lo.y + OnePixel;
00919
00920
00921 if (Flags.Selected)
00922 {
00923
00924
00925
00926
00927 Renderer->SetFillColour(RedrawInfo->SelBackground);
00928
00929 Renderer->SetFillColour(COLOUR_BLACK);
00930 IconRect.Inflate(ThreePixels);
00931
00932
00933
00934
00935 Renderer->DrawRect(&IconRect);
00936
00937
00938
00939 if (MyRect.IsValid())
00940 {
00941 DocRect SelRect(MyRect);
00942 if (SelHeight > MyRect.Height()/2)
00943 SelHeight = MyRect.Height()/2;
00944
00945 SelRect.hi.y = MyRect.lo.y + MyRect.Height()/2 + SelHeight;
00946 SelRect.lo.y = MyRect.lo.y + MyRect.Height()/2 - SelHeight;
00947 SelRect.lo.x += ThreePixels;
00948 GridLockRect(MiscInfo, &SelRect);
00949
00950 Renderer->SetFillColour(RedrawInfo->SelBackground);
00951 Renderer->DrawRect(&SelRect);
00952 }
00953
00954 Renderer->SetFixedSystemTextColours(&RedrawInfo->SelForeground, &RedrawInfo->SelBackground);
00955 }
00956 else
00957 {
00958
00959 Renderer->SetFixedSystemTextColours(&RedrawInfo->Foreground, &RedrawInfo->Background);
00960 }
00961
00962
00963 #ifdef SGBITMAP_BACKGROUND_REDRAW
00964
00965 BOOL DrawnBitmap = FALSE;
00966
00967 if (ShouldIDrawForeground(DrawnBitmap))
00968 {
00969 if(!DrawnBitmap)
00970 {
00971
00972
00973 NodeBitmap* DummyBmp = new NodeBitmap();
00974 if (DummyBmp == NULL)
00975 {
00976
00977 SGLibDisplayItem::DrawNullBitmapRect(Renderer, MiscInfo, &ThumbnailRect, FALSE);
00978 StopRendering(RedrawInfo, MiscInfo);
00979 return;
00980 }
00981
00982
00983
00984 DummyBmp->SetUpPath();
00985 DummyBmp->CreateShape(ThumbnailRect);
00986 DummyBmp->GetBitmapRef()->SetBitmap(TheKernelBitmap);
00987
00988
00989 DummyBmp->Render(Renderer);
00990
00991 delete DummyBmp;
00992 }
00993 }
00994 else
00995 {
00996
00997 if(!DrawnBitmap)
00998 SGLibDisplayItem::DrawNullBitmapRect(Renderer, MiscInfo, &ThumbnailRect, TRUE);
00999 }
01000
01001 #else
01002
01003
01004
01005 NodeBitmap* DummyBmp = new NodeBitmap();
01006 if (DummyBmp == NULL)
01007 {
01008
01009 StopRendering(RedrawInfo, MiscInfo);
01010 return;
01011 }
01012
01013
01014
01015 DummyBmp->SetUpPath();
01016 DummyBmp->CreateShape(ThumbnailRect);
01017 DummyBmp->GetBitmapRef()->SetBitmap(TheKernelBitmap);
01018
01019
01020 DummyBmp->Render(Renderer);
01021
01022 delete DummyBmp;
01023
01024 #endif
01025
01026
01027 MyRect.lo.x += SG_GapBeforeText*2;
01028
01029
01030
01031 if (MyRect.IsValid())
01032 {
01033
01034 String_256 BitmapName = TheKernelBitmap->ActualBitmap->GetName();
01035
01036
01037 String_256 BitmapCols;
01038 INT32 bpp = TheKernelBitmap->GetBPP();
01039
01040 BOOL HasTransparency = FALSE;
01041
01042 if (bpp <= 8)
01043 {
01044
01045 INT32 Index;
01046
01047 if (TheKernelBitmap->GetTransparencyIndex(&Index))
01048 HasTransparency = TRUE;
01049 }
01050
01051 switch (bpp)
01052 {
01053 case 1:
01054 if (HasTransparency)
01055 BitmapCols = _R(IDS_SGBITMAP_MONOCHROME_T);
01056 else
01057 BitmapCols = _R(IDS_SGBITMAP_MONOCHROME);
01058 break;
01059
01060 case 2:
01061 if (HasTransparency)
01062 BitmapCols = _R(IDS_SGBITMAP_4COLOURS_T);
01063 else
01064 BitmapCols = _R(IDS_SGBITMAP_4COLOURS);
01065 break;
01066
01067 case 4:
01068 if (HasTransparency)
01069 BitmapCols = _R(IDS_SGBITMAP_16COLOURS_T);
01070 else
01071 BitmapCols = _R(IDS_SGBITMAP_16COLOURS);
01072 break;
01073
01074 case 8:
01075 if (HasTransparency)
01076 BitmapCols = _R(IDS_SGBITMAP_256COLOURS_T);
01077 else
01078 BitmapCols = _R(IDS_SGBITMAP_256COLOURS);
01079 break;
01080
01081 case 16:
01082 BitmapCols = _R(IDS_SGBITMAP_65COLOURS);
01083 break;
01084
01085 case 24:
01086 BitmapCols = _R(IDS_SGBITMAP_MILLIONS_COLOURS);
01087 break;
01088
01089 case 32:
01090 BitmapCols = _R(IDS_SGBITMAP_32_BIT);
01091 break;
01092
01093 default:
01094 BitmapCols = "";
01095 break;
01096 }
01097
01098
01099 String_256 BitmapWidth;
01100 Convert::LongToString(Info.PixelWidth, &BitmapWidth);
01101
01102 String_256 BitmapHeight;
01103 Convert::LongToString(Info.PixelHeight, &BitmapHeight);
01104
01105
01106 UINT32 BitmapDelay = TheKernelBitmap->ActualBitmap->GetBitmapAnimDelay();
01107 String_256 Delay;
01108 Convert::LongToString(BitmapDelay, &Delay);
01109
01110
01111
01112
01113 INT32 Bytes = 0;
01114 BitmapSource* pSource = NULL;
01115 BaseBitmapFilter* pDummyFilter;
01116
01117 PORTNOTE("other", "Removed XPE hook")
01118 #ifndef EXCLUDE_FROM_XARALX
01119 KernelBitmap* pMaster = NULL;
01120 IXMLDOMDocumentPtr pEdits = NULL;
01121 TheKernelBitmap->GetXPEInfo(pMaster, pEdits);
01122 BOOL bIsXPE = (pMaster!=NULL && pEdits!=NULL);
01123 #else
01124 BOOL bIsXPE = FALSE;
01125 #endif
01126
01127 BOOL OriginalSourcePresent = TheKernelBitmap->GetOriginalSource(&pSource, &pDummyFilter);
01128 String_256 BitmapFormat;
01129 if(OriginalSourcePresent)
01130 {
01131 if (pSource != NULL)
01132 {
01133 if (pSource->IsJPEG())
01134 {
01135 Bytes = pSource->GetSize();
01136 BitmapFormat = _R(IDS_FORMAT_JPEG);
01137 }
01138 }
01139 }
01140 else if (bIsXPE)
01141 {
01142 BitmapFormat = _R(IDS_FORMAT_XPE);
01143 }
01144 else
01145 {
01146 Bytes = (Info.PixelWidth * Info.PixelHeight * bpp)/8;
01147 BitmapFormat = _R(IDS_FORMAT_BITMAP);
01148 }
01149
01150 String_256 MemoryUsed;
01151 Convert::BytesToString(&MemoryUsed, Bytes);
01152
01153 if (!BaseCamelotFilter::ShouldSaveXPEBitmaps() && bIsXPE)
01154 {
01155
01156
01157 MemoryUsed.Load(_R(IDS_SGBITMAP_XPE));
01158 }
01159
01160
01161
01162 DocRect TopRect(MyRect);
01163 DocRect MiddleRect(MyRect);
01164 DocRect BottomRect(MyRect);
01165
01166
01167 TopRect.lo.y += 18000;
01168 MiddleRect.hi.y -= 5000;
01169
01170 BottomRect.hi.y -= 26000;
01171
01172
01173 String_256 TopLine;
01174 TopLine.MakeMsg(_R(IDS_SGBITMAP_FULLINFO_TOPLINE),(TCHAR *)BitmapName,(TCHAR*)BitmapFormat,(TCHAR *)MemoryUsed);
01175 Renderer->DrawFixedSystemText(&TopLine, TopRect);
01176
01177
01178
01179 String_256 MiddleLine;
01180
01181
01182 UINT32 hdpi = TheKernelBitmap->ActualBitmap->GetHorizontalDPI();
01183 UINT32 vdpi = TheKernelBitmap->ActualBitmap->GetVerticalDPI();
01184
01185 if (hdpi == vdpi)
01186 {
01187 String_256 dpitext;
01188 Convert::LongToString(hdpi, &dpitext);
01189 MiddleLine.MakeMsg(_R(IDS_SGBITMAP_FULLINFO_BOTTOMLINE), (TCHAR *)BitmapWidth, (TCHAR *)BitmapHeight, (TCHAR *)BitmapCols, (TCHAR *)dpitext);
01190 }
01191 else
01192 {
01193 String_256 dpitext;
01194 camSnprintf(dpitext, 256, _T("%u x %u"), hdpi, vdpi);
01195 MiddleLine.MakeMsg(_R(IDS_SGBITMAP_FULLINFO_BOTTOMLINE), (TCHAR *)BitmapWidth, (TCHAR *)BitmapHeight, (TCHAR *)BitmapCols, (TCHAR *)dpitext);
01196 }
01197 Renderer->DrawFixedSystemText(&MiddleLine, MiddleRect);
01198
01199
01200
01201 GIFDisposalMethod RestoreType = TheKernelBitmap->ActualBitmap->GetAnimationRestoreType();
01202
01203 switch(RestoreType)
01204 {
01205 case GDM_NONE:
01206 {
01207 String_256 BottomLine;
01208 String_256 Nothing(_R(IDS_NOTHING));
01209 BottomLine.MakeMsg(_R(IDS_SGBITMAP_DELAY_RESTORE_BOTTOMLINE), (