home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / Bitmap / Sources / Frame.cpp < prev    next >
Encoding:
Text File  |  1996-04-25  |  18.9 KB  |  641 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Frame.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #include "Bitmap.hpp"
  13.  
  14. #ifndef FRAME_H
  15. #include "Frame.h"
  16. #endif
  17.  
  18. #ifndef PART_H
  19. #include "Part.h"
  20. #endif
  21.  
  22. #ifndef CONTENT_H
  23. #include "Content.h"
  24. #endif
  25.  
  26. #ifndef SELECT_H
  27. #include "Select.h"
  28. #endif
  29.  
  30. #ifndef RBBRBAND_H
  31. #include "RbbrBand.h"
  32. #endif
  33.  
  34. #ifndef DEFINES_K
  35. #include "Defines.k"
  36. #endif
  37.  
  38. // ----- Part Layer -----
  39.  
  40. #ifndef FWCLPCMD_H
  41. #include "FWClpCmd.h"
  42. #endif
  43.  
  44. #ifndef FWDRCMD_H
  45. #include "FWDrCmd.h"
  46. #endif
  47.  
  48. #ifndef FWUTIL_H
  49. #include "FWUtil.h"
  50. #endif
  51.  
  52. #ifndef FWPRTITE_H
  53. #include "FWPrtIte.h"
  54. #endif
  55.  
  56. #ifndef FWGROWBX_H
  57. #include "FWGrowBx.h"
  58. #endif
  59.  
  60. #ifndef FWSCLBAR_H
  61. #include "FWSclBar.h"
  62. #endif
  63.  
  64. #ifndef FWPRESEN_H
  65. #include "FWPresen.h"
  66. #endif
  67.  
  68. #ifndef FWITERS_H
  69. #include "FWIters.h"
  70. #endif
  71.  
  72. #ifndef FWIDLE_H
  73. #include "FWIdle.h"
  74. #endif
  75.  
  76. #ifndef FWCONTXT_H
  77. #include "FWContxt.h"
  78. #endif
  79.  
  80. // ----- OS Layer -----
  81.  
  82. #ifndef FWODGEOM_H
  83. #include "FWODGeom.h"
  84. #endif
  85.  
  86. #ifndef FWBMPSHP_H
  87. #include "FWBmpShp.h"
  88. #endif
  89.  
  90. #ifndef FWEVENT_H
  91. #include "FWEvent.h"
  92. #endif
  93.  
  94. #ifndef FWSUSINK_H
  95. #include "FWSUSink.h"
  96. #endif
  97.  
  98. #ifndef SLMixOS_H
  99. #include "SLMixOS.h"
  100. #endif
  101.  
  102. // ----- OpenDoc Includes -----
  103.  
  104. #ifndef SOM_Module_OpenDoc_StdProps_defined
  105. #include <StdProps.xh>
  106. #endif
  107.  
  108. #ifndef SOM_ODDragItemIterator_xh
  109. #include <DgItmIt.xh>
  110. #endif
  111.  
  112. //========================================================================================
  113. //    Runtime Informations
  114. //========================================================================================
  115.  
  116. #ifdef FW_BUILD_MAC
  117. #pragma segment odfbitmap
  118. #endif
  119.  
  120. //========================================================================================
  121. //    class CBitmapFrame
  122. //========================================================================================
  123.  
  124. FW_DEFINE_AUTO(CBitmapFrame)
  125.     
  126. //----------------------------------------------------------------------------------------
  127. //    CBitmapFrame::CBitmapFrame
  128. //----------------------------------------------------------------------------------------
  129. //    CBitmapFrame constructor
  130.  
  131. CBitmapFrame::CBitmapFrame(Environment* ev, ODFrame* odFrame, FW_CPresentation* presentation, CBitmapPart* bitmapPart, CBitmapContent* content) :
  132.     FW_CFrame(ev, odFrame, presentation, bitmapPart),
  133.     FW_MDroppableFrame(ev, this),
  134.     FW_MDraggableFrame(ev, this),
  135.     fBitmapContent(content),
  136.     fChoosenSize(cFitToFrame),
  137.     fSelection((CBitmapSelection*)presentation->GetSelection(ev)),
  138.     fIdler(NULL)
  139. {    
  140.     if (IsRoot(ev))
  141.         fChoosenSize = cRealSize;
  142.         
  143.     // ----- Save my current frame rect -----
  144.     fFrameRect = this->GetBounds(ev);
  145.         
  146.     fIdler = FW_NEW(FW_CIdler, (this, 15));
  147.     
  148.     // ----- I want to be able to drop even in thumbnail mode -----
  149.     ChangeDroppableState(ev, FW_kFrameDroppable | FW_kThumbnailDroppable);
  150.     
  151.     FW_END_CONSTRUCTOR
  152. }
  153.  
  154. //----------------------------------------------------------------------------------------
  155. //    CBitmapFrame::~CBitmapFrame
  156. //----------------------------------------------------------------------------------------
  157. //    CBitmapFrame destructor
  158.  
  159. CBitmapFrame::~CBitmapFrame()
  160. {
  161.     FW_START_DESTRUCTOR
  162.     
  163.     delete fIdler;
  164.     fIdler = NULL;
  165. }
  166.  
  167. //----------------------------------------------------------------------------------------
  168. //    CBitmapFrame::DoAdjustMenus
  169. //----------------------------------------------------------------------------------------
  170. //    ODF Method
  171.  
  172. FW_Boolean CBitmapFrame::DoAdjustMenus(Environment* ev, FW_CMenuBar* menuBar, FW_Boolean hasMenuFocus, FW_Boolean isRoot)
  173. {
  174.     if (hasMenuFocus)
  175.     {
  176.         // ----- OpenDoc Items -----    
  177.         FW_Boolean hasRightProperty = HasPropertyOnClipboard(ev, kODPropContents, GetPart(ev)->GetPartKind(ev));
  178.         
  179. #ifdef FW_BUILD_MAC
  180.         // ----- On the Mac I allow Paste for both my kind and PICT. On Window I only allow Paste for my kind
  181.         if (!hasRightProperty)
  182.             hasRightProperty = hasRightProperty || HasPropertyOnClipboard(ev, kODPropContents, FW_CPart::gMacPICTDataType);
  183. #endif
  184.     
  185.         menuBar->EnableCommand(ev, kODCommandSelectAll, TRUE);                        // Allow Select All
  186.         menuBar->EnableCommand(ev, kODCommandClear, FALSE);                            // Don't allow Clear
  187.         menuBar->EnableCommand(ev, kODCommandCut, FALSE);                            // Don't allow cut                        
  188.         menuBar->EnableCommand(ev, kODCommandCopy, !fSelection->IsEmpty(ev));    // Allow copy only if my selection is not empty
  189.         menuBar->EnableCommand(ev, kODCommandPaste, hasRightProperty);                // Allow Paste if right property on the clipboard
  190.         menuBar->EnableCommand(ev, kODCommandPasteAs, FALSE);                        // Don't allow Past As for now
  191.         
  192.         // ----- My Items -----
  193.         ODCommandID choosenSize = GetChoosenSize();
  194.         
  195.         menuBar->EnableAndCheckCommand(ev, cHalfSize, TRUE, fChoosenSize == cHalfSize);    
  196.         menuBar->EnableAndCheckCommand(ev, cRealSize, TRUE, fChoosenSize == cRealSize);
  197.         menuBar->EnableAndCheckCommand(ev, cDoubleSize, TRUE, fChoosenSize == cDoubleSize);
  198.         menuBar->EnableAndCheckCommand(ev, cFitToFrame, TRUE, fChoosenSize == cFitToFrame);
  199.         menuBar->EnableCommand(ev, cRequestFrame, !IsRoot(ev));
  200.         menuBar->EnableCommand(ev, cRemoveFrame, IsRequestedFrame(ev));
  201.     }
  202.     
  203.     return FALSE;
  204. }
  205.  
  206. //----------------------------------------------------------------------------------------
  207. //    CBitmapFrame::DoMenu
  208. //----------------------------------------------------------------------------------------
  209. // ODF method
  210.  
  211. FW_Boolean CBitmapFrame::DoMenu(Environment* ev, const FW_CMenuEvent& theMenuEvent)
  212. {
  213.     FW_Boolean result = TRUE;
  214.     ODCommandID commandID = theMenuEvent.GetCommandID(ev);
  215.  
  216.     FW_CPresentation* myPresentation = GetPresentation(ev);
  217.     
  218.     switch (commandID)
  219.     {
  220.         case cHalfSize:
  221.         case cRealSize:
  222.         case cDoubleSize:
  223.         case cFitToFrame:
  224.             if (commandID != fChoosenSize)
  225.             {
  226.                 fChoosenSize = commandID;
  227.                 AdjustFrameSize(ev);
  228.             }
  229.             break;
  230.  
  231.         case cRequestFrame:
  232.             {
  233.                 FW_CAcquiredODShape aqShape = FW_CopyAndRelease(ev, AcquireFrameShape(ev));
  234.                 ODID sequence = myPresentation->RequestSiblingFrame(ev, this, aqShape, GetViewType(ev), FALSE);
  235.                 if (sequence != kODNULLID)
  236.                     myPresentation->Invalidate(ev, NULL, sequence);    // invalidate all frames of this sequence
  237.             }
  238.             break;
  239.  
  240.         case cRemoveFrame:
  241.             myPresentation->RemoveSiblingFrame(ev, this);
  242.             break;
  243.             
  244.         default:        
  245.             result = FALSE;
  246.     }
  247.  
  248.     return result;
  249. }
  250.  
  251. //----------------------------------------------------------------------------------------
  252. //    CBitmapFrame::DoIdle
  253. //----------------------------------------------------------------------------------------
  254.  
  255. FW_Boolean CBitmapFrame::DoIdle(Environment* ev, const FW_CNullEvent& theNullEvent)
  256. {
  257. FW_UNUSED(theNullEvent);    
  258.     if (fSelection != NULL && !fSelection->IsEmpty(ev))
  259.         fSelection->MoveAnts(ev, this);
  260.     
  261.     return TRUE;
  262. }
  263.  
  264. //----------------------------------------------------------------------------------------
  265. //    CBitmapFrame::AdjustFrameSize
  266. //----------------------------------------------------------------------------------------
  267.  
  268. void CBitmapFrame::AdjustFrameSize(Environment* ev)
  269. {
  270.     if (IsRoot(ev))
  271.         UpdateUsedAndActiveShapes(ev);
  272.     else
  273.     {
  274.         FW_CRect usedRect;
  275.         CalcUsedRect(ev, usedRect);
  276.         usedRect.Place(FW_kZeroPoint);
  277.     
  278.         FW_CAcquiredODShape aqAskedFrameShape = ::FW_NewODShape(ev, usedRect);
  279.         FW_CAcquiredODShape aqFrameShape = AcquireFrameShape(ev);
  280.         
  281.         if (aqAskedFrameShape->IsSameAs(ev, aqFrameShape))
  282.             UpdateUsedAndActiveShapes(ev);
  283.         else
  284.             this->RequestFrameShape(ev, aqAskedFrameShape);
  285.     }
  286.     
  287.     this->Invalidate(ev);
  288. }
  289.  
  290. //----------------------------------------------------------------------------------------
  291. //    CBitmapFrame::FocusStateChanged
  292. //----------------------------------------------------------------------------------------
  293.  
  294. void CBitmapFrame::FocusStateChanged(Environment* ev, ODTypeToken focus, FW_Boolean newState, ODFrame* newOwner)
  295. {    
  296.     FW_CFrame::FocusStateChanged(ev, focus, newState, newOwner);
  297.  
  298.     if (focus == FW_CPart::gSelectionFocusToken)
  299.     {
  300.         if (!fSelection->IsEmpty(ev))
  301.             fSelection->DrawAnts(ev, this);
  302.         
  303.         fIdler->RegisterIdle(ev, newState);
  304.     }
  305. }
  306.  
  307. //----------------------------------------------------------------------------------------
  308. //    CBitmapFrame::FrameShapeChanged
  309. //----------------------------------------------------------------------------------------
  310.  
  311. void CBitmapFrame::FrameShapeChanged(Environment* ev)
  312. {    
  313.     FW_CFrame::FrameShapeChanged(ev);
  314.  
  315.     Invalidate(ev);        // redraw the whole frame
  316. }
  317.  
  318. //----------------------------------------------------------------------------------------
  319. //    CBitmapFrame::BuildThumbnail
  320. //----------------------------------------------------------------------------------------
  321. //    I just render the bitmap. I want to use the full 64*64
  322.  
  323. void CBitmapFrame::BuildThumbnail(Environment* ev, FW_CGraphicContext& gc, FW_CRect& usedRect)
  324. {
  325.     FW_CBitmap bitmap = fBitmapContent->GetBitmap(ev);    
  326.     FW_CBitmapShape::RenderBitmap(gc, bitmap, usedRect);
  327. }
  328.  
  329. //----------------------------------------------------------------------------------------
  330. //    CBitmapFrame::NewClipboardCommand
  331. //----------------------------------------------------------------------------------------
  332.  
  333. FW_CClipboardCommand* CBitmapFrame::NewClipboardCommand(Environment* ev, ODCommandID commandID)
  334. {
  335.     return FW_NEW(FW_CClipboardCommand, (ev,
  336.                                         commandID,
  337.                                          this,
  338.                                          FW_kCantUndo));
  339. }
  340.  
  341. //----------------------------------------------------------------------------------------
  342. //    CBitmapFrame::AdjustUsedShape
  343. //----------------------------------------------------------------------------------------
  344. // This Bitmap sample may draw in an area smaller than the frame shape. We let OpenDoc
  345. // know what shape is actually used so that containers of Bitmap can draw outside.
  346. // suggestedUsedShape is equal to the frame shape on entry.
  347.  
  348. ODShape* CBitmapFrame::AdjustUsedShape(Environment* ev, ODShape* suggestedUsedShape)
  349. {
  350.     // [LSD] OpenDoc bug or feature?  Do not make the used shape smaller than the frame
  351.     // shape in the case of root frames! Otherwise, since the active shape will be set
  352.     // to the used shape by default, mouse events won't be processed outside this shape.
  353.     
  354.     if (!IsRoot(ev))
  355.     {
  356.     FW_CRect usedShapeRect;
  357.     CalcUsedRect(ev, usedShapeRect);
  358.     
  359.     FW_CRect frameRect = GetBounds(ev);
  360.     usedShapeRect.Intersection(frameRect);
  361.     
  362.     ODRect odUsedShapeRect = usedShapeRect;
  363.     suggestedUsedShape->SetRectangle(ev, &odUsedShapeRect);
  364.     
  365.         // Must acquire it because I am reusing the shape passed as parameter
  366.         suggestedUsedShape->Acquire(ev);    
  367.         return suggestedUsedShape;
  368.     }
  369.     else
  370.         return NULL;    // use the frame shape for root frames
  371. }
  372.  
  373. //----------------------------------------------------------------------------------------
  374. //    CBitmapFrame::AdjustActiveShape
  375. //----------------------------------------------------------------------------------------
  376. // AdjustActiveShape must also be implemented whenever AdjustUsedShape is, otherwise
  377. // OpenDoc will use the frame shape by default, and we want the used shape to the default
  378. // active shape.
  379.  
  380. ODShape* CBitmapFrame::AdjustActiveShape(Environment* ev, ODFacet* facet, ODShape* suggestedActiveShape)
  381. {
  382.     // Root frames should not use a smaller active shape. See comments in AdjustUsedShape
  383.     
  384.     if (!IsRoot(ev))
  385.     {
  386.         // suggestedActiveShape is a copy of the used shape (in FW_CFrame::UpdateActiveShape)
  387.         // We tell OpenDoc that we're going to use it.
  388.         suggestedActiveShape->Acquire(ev);
  389.         return suggestedActiveShape;
  390.     }
  391.     else
  392.         return NULL;    // use the frame shape for root frames
  393. }
  394.  
  395. //----------------------------------------------------------------------------------------
  396. //    CBitmapFrame::AdjustZoomedWindowSize
  397. //----------------------------------------------------------------------------------------
  398.  
  399. void CBitmapFrame::AdjustZoomedWindowSize(Environment *ev, FW_CPoint& proposedSize)
  400. {
  401.     FW_CRect usedShapeRect;
  402.     CalcUsedRect(ev, usedShapeRect);
  403.     
  404.     proposedSize.Set(usedShapeRect.Width() + FW_IntToFixed(10), usedShapeRect.Height() + FW_IntToFixed(10));
  405. }
  406.  
  407. //----------------------------------------------------------------------------------------
  408. //    CBitmapFrame::GetZoomRatio
  409. //----------------------------------------------------------------------------------------
  410.  
  411. FW_CPoint CBitmapFrame::GetZoomRatio(Environment* ev) const
  412. {
  413.     FW_CBitmap bitmap = fBitmapContent->GetBitmap(ev);
  414.     FW_CRect bounds;
  415.     bitmap.GetBitmapBounds(bounds);
  416.     
  417.     FW_CRect usedRect;
  418.     CalcUsedRect(ev, usedRect);
  419.     
  420.     FW_CPoint ratio(
  421.         (usedRect.right - usedRect.left) / bounds.right, 
  422.         (usedRect.bottom - usedRect.top) / bounds.bottom);
  423.     
  424.     return ratio;
  425. }
  426.  
  427. //----------------------------------------------------------------------------------------
  428. //    CBitmapFrame::Draw
  429. //----------------------------------------------------------------------------------------
  430.  
  431. void CBitmapFrame::Draw(Environment* ev, ODFacet* odFacet, ODShape* invalidShape)
  432. {        
  433.     FW_CViewContext vc(ev, this, odFacet, invalidShape);
  434.     
  435.     // ------ [HLX] Will be moved to an adorner
  436.     if (IsTopFrame(ev))
  437.     {
  438.         FW_CRect invalidRect;
  439.         vc.GetClipRect(invalidRect);
  440.  
  441. #ifdef FW_BUILD_MAC
  442.         FW_CInk ink(FW_kRGBWhite,
  443.                     FW_kRGBWhite,
  444.                     FW_kErase);
  445. #else
  446.         FW_CInk ink(FW_CColor(::GetSysColor(COLOR_WINDOWTEXT), 0),
  447.                     FW_CColor(::GetSysColor(COLOR_APPWORKSPACE), 0),
  448.                     FW_kErase);
  449. #endif
  450.         FW_CRectShape::RenderRect(vc, invalidRect, FW_kFill, ink);
  451.     }
  452.  
  453.     FW_CRect usedRect;
  454.     CalcUsedRect(ev, usedRect);
  455.         
  456.     // ----- Use the static rendering method -----
  457.     FW_CBitmapShape::RenderBitmap(vc, fBitmapContent->GetBitmap(ev), usedRect);
  458.     
  459.     // ----- Draw the ants if there is a selection -----
  460.     if (HasSelectionFocus(ev) && !fSelection->IsEmpty(ev))
  461.     {
  462.         fSelection->DoDrawAnts(ev, vc, this);
  463.     }
  464. }
  465.  
  466. //----------------------------------------------------------------------------------------
  467. //    CBitmapFrame::CalcUsedRect
  468. //----------------------------------------------------------------------------------------
  469.  
  470. void CBitmapFrame::CalcUsedRect(Environment* ev, FW_CRect& newUsedRect) const
  471. {
  472.     ODCommandID choosenSize = GetChoosenSize();
  473.     
  474.     FW_CRect frameRect = GetBounds(ev);
  475.     frameRect.Place(FW_kZeroPoint);
  476.     
  477.     if (choosenSize == cFitToFrame)
  478.     {
  479.         newUsedRect = frameRect;
  480.     }
  481.     else
  482.     {    
  483.         fBitmapContent->GetBitmap(ev).GetBitmapBounds(newUsedRect);    // return in 72 dpi
  484.         
  485.         if (choosenSize == cHalfSize)
  486.         {
  487.             newUsedRect.right   = FW_Half(newUsedRect.right);
  488.             newUsedRect.bottom  = FW_Half(newUsedRect.bottom);
  489.         }
  490.         else if (choosenSize == cDoubleSize)
  491.         {
  492.             newUsedRect.right   = FW_MultipliedByInt(newUsedRect.right,  2);
  493.             newUsedRect.bottom  = FW_MultipliedByInt(newUsedRect.bottom, 2);
  494.         }
  495.         
  496.         newUsedRect.PlaceInCenter(frameRect);
  497.     }
  498. }
  499.  
  500. //----------------------------------------------------------------------------------------
  501. //    CBitmapFrame::DoMouseDown
  502. //----------------------------------------------------------------------------------------
  503.  
  504. FW_Boolean CBitmapFrame::DoMouseDown(Environment* ev, const FW_CMouseEvent& theMouseEvent)
  505. {    
  506.     if (fSelection->IsMouseInDraggableItem(ev, this, theMouseEvent, FALSE))
  507.     {
  508.         if (!Drag(ev, theMouseEvent))
  509.             fSelection->CloseSelection(ev);
  510.     }
  511.     else
  512.     {
  513.         fSelection->CloseSelection(ev);
  514.         
  515.         FW_CRect usedRect;
  516.         CalcUsedRect(ev, usedRect);
  517.         
  518.          FW_CPoint where = theMouseEvent.GetMousePosition(ev, FW_CMouseEvent::kFrame);
  519.         FW_CFrame *frame = FW_CFrame::ODtoFWFrame(ev, theMouseEvent.GetFacet(ev)->GetFrame(ev));
  520.         frame->GetContentView(ev)->FrameToViewContent(ev, where);
  521.         
  522.         if (usedRect.Contains(where))
  523.         {
  524.             // ----- start a track -----
  525.             CRectRubberBand rubberBand(ev, this, theMouseEvent.GetFacet(ev), usedRect, GetZoomRatio(ev));
  526.         
  527.             if (rubberBand.Track(ev, theMouseEvent))
  528.             {
  529.                 FW_CRect rect;
  530.                 rubberBand.GetRect(rect);
  531.                 
  532.                 // ----- Apply the zoom ratio ----
  533.                 fSelection->SetSelectRect(GetZoomRatio(ev), usedRect, rect);
  534.                 fSelection->DrawAnts(ev, this);
  535.             }
  536.         }
  537.         else
  538.             FW_Beep();
  539.     }        
  540.  
  541.     return TRUE;
  542. }
  543.  
  544. #ifdef FW_BUILD_MAC
  545. //----------------------------------------------------------------------------------------
  546. //    CBitmapFrame::CanAcceptDrop
  547. //----------------------------------------------------------------------------------------
  548.  
  549. ODDragResult CBitmapFrame::CanAcceptDrop(Environment* ev, ODDragItemIterator* dragInfo)
  550. {
  551.     ODDragResult result = FW_MDroppableFrame::CanAcceptDrop(ev, dragInfo);
  552.     
  553.     // ----- Test also for a PICT -----
  554.     if (!result)
  555.     {
  556.         for (ODStorageUnit *dragSU = dragInfo->First(ev); dragSU; dragSU = dragInfo->Next(ev))
  557.             if (dragSU->Exists(ev, kODPropContents, FW_CPart::gMacPICTDataType, 0))    // 'PICT' in Scrap
  558.                 return TRUE;
  559.             else if (dragSU->Exists(ev, kODPropContents, FW_CPart::gMacPICTFileType, 0))    // PICT file
  560.                 return TRUE;
  561.     }
  562.     
  563.     return result;
  564. }
  565. #endif
  566.  
  567. //----------------------------------------------------------------------------------------
  568. // CBitmapFrame::CreateSubViews
  569. //----------------------------------------------------------------------------------------
  570.  
  571. void CBitmapFrame::CreateSubViews(Environment* ev)
  572. {
  573.     // ----- Create a GrowBox only for root frames
  574.     //        (see Form or Container samples for declaring the grow-box in resources)
  575.     
  576.     if (IsRoot(ev))
  577.     {        
  578.         FW_CPoint sbSize = FW_CScrollBar::GetDefaultScrollBarSize();
  579.     
  580.         FW_CRect frameRect = this->GetBounds(ev);
  581.         frameRect.bottom -= sbSize.y;
  582.         frameRect.right -= sbSize.x;
  583.         
  584.         FW_CGrowBox* growBox = new FW_CGrowBox(ev, this, 0, frameRect[FW_kBotRight]);
  585.     }
  586. }
  587.  
  588. //----------------------------------------------------------------------------------------
  589. //    CBitmapFrame::ExternalizeFrame
  590. //----------------------------------------------------------------------------------------
  591.  
  592. void CBitmapFrame::ExternalizeFrame(Environment* ev, ODStorageUnitView* storageUnitView)
  593. {
  594.     FW_CFrame::ExternalizeFrame(ev, storageUnitView);
  595.  
  596.     FW_PStorageUnitSink suSink(ev, storageUnitView);
  597.     FW_CWritableStream stream(suSink);
  598.     stream << fChoosenSize;
  599. }
  600.  
  601. //----------------------------------------------------------------------------------------
  602. //    CBitmapFrame::InternalizeFrame
  603. //----------------------------------------------------------------------------------------
  604.  
  605. void CBitmapFrame::InternalizeFrame(Environment* ev, ODStorageUnitView* storageUnitView)
  606. {
  607.     FW_CFrame::InternalizeFrame(ev, storageUnitView);
  608.     
  609.     FW_PStorageUnitSink suSink(ev, storageUnitView);
  610. //    FW_PBufferedSink sink(ev, suSink);
  611.     FW_CReadableStream stream(suSink);
  612.     stream >> fChoosenSize;
  613. }
  614.  
  615. //----------------------------------------------------------------------------------------
  616. //    CBitmapFrame::NewDragCommand
  617. //----------------------------------------------------------------------------------------
  618.  
  619. FW_CDragCommand* CBitmapFrame::NewDragCommand(Environment *ev, 
  620.                                     FW_CFrame* theFrame,
  621.                                     const FW_CMouseEvent& theMouseEvent)
  622. {
  623. FW_UNUSED(theMouseEvent);
  624.  
  625.     return FW_NEW(FW_CDragCommand, (ev, theFrame, FW_kCantUndo));
  626. }
  627.  
  628. //----------------------------------------------------------------------------------------
  629. //    CBitmapFrame::NewDropCommand
  630. //----------------------------------------------------------------------------------------
  631.  
  632. FW_CDropCommand* CBitmapFrame::NewDropCommand(Environment *ev, 
  633.                                     FW_CFrame* frame,
  634.                                     ODDragItemIterator* dropInfo, 
  635.                                     ODFacet* facet, 
  636.                                     const FW_CPoint& dropPoint)
  637. {
  638.  
  639.     return FW_NEW(FW_CDropCommand, (ev, frame, dropInfo, facet, dropPoint, FW_kCantUndo));
  640. }
  641.