home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 4.6 KB | 189 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: DrawFrame.cpp
- // Release Version: $ 1.0d1 $
- //
- // Author: Henri Lamiraux
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef DRAWFRAME_H
- #include "DrawFrame.h"
- #endif
-
- #ifndef DRAWPART_H
- #include "DrawPart.h"
- #endif
-
- #ifndef DRAWSELECTION_H
- #include "DrawSelection.h"
- #endif
-
- #ifndef UTILITIES_H
- #include "Utilities.h"
- #endif
-
- #ifndef SHAPES_H
- #include "Shapes.h"
- #endif
-
- #ifndef DRAWDACET_H
- #include "DrawFacet.h"
- #endif
-
- // ----- Framework Includes -----
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWFACET_H
- #include "FWFacet.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef _MENUBAR_
- #include "MenuBar.h"
- #endif
-
- #ifndef _WINDOW_
- #include "Window.h"
- #endif
-
- #ifndef _SHAPE_
- #include "Shape.h"
- #endif
-
- #ifndef _DRAFT_
- #include "Draft.h"
- #endif
-
- #ifndef _TRNSFORM_
- #include "Trnsform.h"
- #endif
-
- #pragma segment drawpart
-
- //=========================================================================
- // CDrawFrame
- //=========================================================================
-
- //------------------------------------------------------------------------------
- // CDrawFrame::CDrawFrame
- //------------------------------------------------------------------------------
-
- CDrawFrame::CDrawFrame()
- {
- }
-
- //------------------------------------------------------------------------------
- // CDrawFrame::IDrawFrame
- //------------------------------------------------------------------------------
-
- void CDrawFrame::IDrawFrame(XMPFrame* xmpFrame, CDrawPart* drawPart)
- {
- InitEmbeddingFrame(xmpFrame, drawPart);
-
- // ----- By default we put all of them
- AddToFocusSet(drawPart->GetKeyFocusToken());
- AddToFocusSet(drawPart->GetMenuFocusToken());
- AddToFocusSet(drawPart->GetSelectionFocusToken());
-
- fDrawPart = drawPart;
-
- this->SetDroppable(TRUE);
- }
-
- //------------------------------------------------------------------------------
- // CDrawFrame::~CDrawFrame
- //------------------------------------------------------------------------------
-
- CDrawFrame::~CDrawFrame()
- {
- }
-
- //------------------------------------------------------------------------------
- // CDrawFrame::RemoveEmbeddedFrame
- //------------------------------------------------------------------------------
-
- void CDrawFrame::RemoveEmbeddedFrame(FW_CProxyFrame* proxy)
- {
- // ----- Invalidate the shape of the old frame -----
- XMPShape* shape = ::NewXMPShape();
- proxy->GetFrameShape(shape);
- proxy->Invalidate(shape);
- delete shape;
-
- // ----- Call inherited -----
- FW_CEmbeddingFrame::RemoveEmbeddedFrame(proxy);
-
- // ------ Clip -----
- ClipEmbeddedFrames();
- }
-
- //-------------------------------------------------------------------------
- // CDrawFrame::HandleKeyDown
- //-------------------------------------------------------------------------
-
- FW_Boolean CDrawFrame::HandleKeyDown(XMPEventData event)
- {
- FW_UNUSED(event);
- return TRUE;
- }
-
- //------------------------------------------------------------------------------
- // CDrawFrame::ActiveStateChanged
- //------------------------------------------------------------------------------
-
- void CDrawFrame::FocusStateChanged(XMPTypeToken focus, FW_Boolean newState)
- {
- FW_CEmbeddingFrame::FocusStateChanged(focus, newState);
-
- if (focus == GetPart()->GetSelectionFocusToken())
- {
- CDrawSelection *selection = (CDrawSelection*)fDrawPart->GetSelection();
-
- selection->DrawAllHandles(this, newState);
- }
- }
-
- //------------------------------------------------------------------------------
- // CDrawFrame::NewFacet
- //------------------------------------------------------------------------------
-
- FW_CFacet* CDrawFrame::NewFacet(XMPFacet* xmpFacet)
- {
- CDrawFacet* facet = new CDrawFacet;
- facet->IDrawFacet(xmpFacet, fDrawPart);
- return facet;
- }
-
- //------------------------------------------------------------------------------
- // CDrawFrame::UsedShapeChanged
- //
- //------------------------------------------------------------------------------
-
- void CDrawFrame::UsedShapeChanged(FW_CProxyRun* proxyRun, XMPFrame* embeddedXMPFrame)
- {
- XMPShape *oldUpdateShape = ::NewXMPShape();
- CProxyShape* shape = ((CDrawProxyRun*)proxyRun)->GetShape();
- shape->GetUpdateShape(oldUpdateShape);
- oldUpdateShape->Transform(GetInternalTransform());
-
- FW_CEmbeddingFrame::UsedShapeChanged(proxyRun, embeddedXMPFrame);
-
- XMPShape *updateShape = ::NewXMPShape();
- shape->GetUpdateShape(updateShape);
- updateShape->Transform(GetInternalTransform());
-
- updateShape->Union(oldUpdateShape);
- delete oldUpdateShape;
-
- InvalidateAllFacets(NULL, updateShape);
- delete updateShape;
- }
-