home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 10.0 KB | 286 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWUtil.cpp
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWFrameW.hpp"
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWACQUIR_H
- #include "FWAcquir.h"
- #endif
-
- #ifndef FWPOINT_H
- #include "FWPoint.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef SOM_ODStorageUnit_xh
- #include <StorageU.xh>
- #endif
-
- #ifndef SOM_ODFacet_xh
- #include <Facet.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_Errors_defined
- #include <ErrorDef.xh>
- #endif
-
- //========================================================================================
- // Runtime Informations
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment framework
- #endif
-
- //========================================================================================
- // Storage Unit Utilities
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_SUAddPropValue
- //----------------------------------------------------------------------------------------
-
- void FW_SUAddPropValue(Environment* ev, ODStorageUnit* su, ODPropertyName prop, ODValueType val)
- {
- if (!su->Exists(ev, prop, NULL, 0))
- {
- su->AddProperty(ev, prop)->AddValue(ev, val);
- }
- else
- {
- su->Focus(ev, prop, kODPosUndefined, NULL, 0, kODPosUndefined);
- if (!su->Exists(ev, prop, val, 0))
- su->AddValue(ev, val);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_IsInLimbo
- //----------------------------------------------------------------------------------------
- // [HLX] I have to put a try block because of a bug in OpenDoc 1.0
-
- FW_Boolean FW_IsInLimbo(Environment* ev, ODFrame* frame)
- {
- FW_Boolean result = FALSE;
- FW_TRY
- {
- result = frame->IsInLimbo(ev);
- }
- FW_CATCH_BEGIN
- FW_CATCH_EVERYTHING ()
- {
- if (FW_GetEvError(ev) != kODErrInvalidFrame)
- FW_THROW_SAME ();
- }
- FW_CATCH_END
-
- return result;
- }
-
- //========================================================================================
- // Content to Frame and Frame to Content coordinate conversions
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_ContentToFrame
- //----------------------------------------------------------------------------------------
-
- void FW_ContentToFrame(Environment* ev, ODFrame* frame, ODShape* shape)
- {
- FW_CAcquiredODTransform transform = frame->AcquireInternalTransform(ev, NULL);
- shape->Transform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_FrameToContent
- //----------------------------------------------------------------------------------------
-
- void FW_FrameToContent(Environment* ev, ODFrame* frame, ODShape* shape)
- {
- FW_CAcquiredODTransform transform = frame->AcquireInternalTransform(ev, NULL);
- shape->InverseTransform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_ContentToFrame
- //----------------------------------------------------------------------------------------
-
- void FW_ContentToFrame(Environment* ev, ODFrame* frame, FW_CPoint& point)
- {
- FW_CAcquiredODTransform transform = frame->AcquireInternalTransform(ev, NULL);
- point.Transform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_FrameToContent
- //----------------------------------------------------------------------------------------
-
- void FW_FrameToContent(Environment* ev, ODFrame* frame, FW_CPoint& point)
- {
- FW_CAcquiredODTransform transform = frame->AcquireInternalTransform(ev, NULL);
- point.InverseTransform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_ContentToFrame
- //----------------------------------------------------------------------------------------
-
- void FW_ContentToFrame(Environment* ev, ODFrame* frame, FW_CRect& rect)
- {
- FW_CAcquiredODTransform transform = frame->AcquireInternalTransform(ev, NULL);
- rect.Transform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_FrameToContent
- //----------------------------------------------------------------------------------------
-
- void FW_FrameToContent(Environment* ev, ODFrame* frame, FW_CRect& rect)
- {
- FW_CAcquiredODTransform transform = frame->AcquireInternalTransform(ev, NULL);
- rect.InverseTransform(ev, transform);
- }
-
- //========================================================================================
- // Content to Window and Window to Content coordinate conversions
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_ContentToWindow
- //----------------------------------------------------------------------------------------
-
- void FW_ContentToWindow(Environment* ev, ODFacet* facet, ODShape* shape)
- {
- FW_CAcquiredODTransform transform = facet->AcquireWindowContentTransform(ev, NULL);
- shape->Transform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_WindowToContent
- //----------------------------------------------------------------------------------------
-
- void FW_WindowToContent(Environment* ev, ODFacet* facet, ODShape* shape)
- {
- FW_CAcquiredODTransform transform = facet->AcquireWindowContentTransform(ev, NULL);
- shape->InverseTransform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_ContentToWindow
- //----------------------------------------------------------------------------------------
-
- void FW_ContentToWindow(Environment* ev, ODFacet* facet, FW_CPoint& point)
- {
- FW_CAcquiredODTransform transform = facet->AcquireWindowContentTransform(ev, NULL);
- point.Transform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_WindowToContent
- //----------------------------------------------------------------------------------------
-
- void FW_WindowToContent(Environment* ev, ODFacet* facet, FW_CPoint& point)
- {
- FW_CAcquiredODTransform transform = facet->AcquireWindowContentTransform(ev, NULL);
- point.InverseTransform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_ContentToWindow
- //----------------------------------------------------------------------------------------
-
- void FW_ContentToWindow(Environment* ev, ODFacet* facet, FW_CRect& rect)
- {
- FW_CAcquiredODTransform transform = facet->AcquireWindowContentTransform(ev, NULL);
- rect.Transform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_WindowToContent
- //----------------------------------------------------------------------------------------
-
- void FW_WindowToContent(Environment* ev, ODFacet* facet, FW_CRect& rect)
- {
- FW_CAcquiredODTransform transform = facet->AcquireWindowContentTransform(ev, NULL);
- rect.InverseTransform(ev, transform);
- }
-
- //========================================================================================
- // Frame to Window and Window to Frame coordinate conversions
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_FrameToWindow
- //----------------------------------------------------------------------------------------
-
- void FW_FrameToWindow(Environment* ev, ODFacet* facet, ODShape* shape)
- {
- FW_CAcquiredODTransform transform = facet->AcquireWindowFrameTransform(ev, NULL);
- shape->Transform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_WindowToFrame
- //----------------------------------------------------------------------------------------
-
- void FW_WindowToFrame(Environment* ev, ODFacet* facet, ODShape* shape)
- {
- FW_CAcquiredODTransform transform = facet->AcquireWindowFrameTransform(ev, NULL);
- shape->InverseTransform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_FrameToWindow
- //----------------------------------------------------------------------------------------
-
- void FW_FrameToWindow(Environment* ev, ODFacet* facet, FW_CPoint& point)
- {
- FW_CAcquiredODTransform transform = facet->AcquireWindowFrameTransform(ev, NULL);
- point.Transform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_WindowToFrame
- //----------------------------------------------------------------------------------------
-
- void FW_WindowToFrame(Environment* ev, ODFacet* facet, FW_CPoint& point)
- {
- FW_CAcquiredODTransform transform = facet->AcquireWindowFrameTransform(ev, NULL);
- point.InverseTransform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_FrameToWindow
- //----------------------------------------------------------------------------------------
-
- void FW_FrameToWindow(Environment* ev, ODFacet* facet, FW_CRect& rect)
- {
- FW_CAcquiredODTransform transform = facet->AcquireWindowFrameTransform(ev, NULL);
- rect.Transform(ev, transform);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_WindowToFrame
- //----------------------------------------------------------------------------------------
-
- void FW_WindowToFrame(Environment* ev, ODFacet* facet, FW_CRect& rect)
- {
- FW_CAcquiredODTransform transform = facet->AcquireWindowFrameTransform(ev, NULL);
- rect.InverseTransform(ev, transform);
- }
-
-
-