home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
-
- StamperMac.c
-
- This file is furnished to you by Adobe Systems Incorporated
- under the terms of the Acrobat(r) Plug-ins Software
- Development Kit License Agreement.
-
- Copyright (C) 1994-1997, Adobe Systems Inc. All Rights Reserved.
-
-
- Implementation of Macintosh-specific functions for the Stamper plug-in
-
- ******************************************************************************/
-
- #include <Resources.h>
- //#include <Sound.h>
- #include <ToolUtils.h>
- #include <Windows.h>
- #include "PIQuickdraw.h"
- #include "SafeResources.h"
-
- #include "AVCalls.h"
- #include "MacCalls.h"
- #include "StampPr.h"
-
- #define CURSStamperCursor 150
- #define SICNStamperToolIcon 150
- #define cicnStamperIcon 150
- #define sndStamperSound 150
-
- AVCursor GetStamperCursor(void)
- {
- return (AVCursor)SafeGetCursor(CURSStamperCursor);
- }
-
- void *GetStamperToolButtonIcon(void)
- {
- return (void *)SafeGetResource('SICN', SICNStamperToolIcon);
- }
-
- void *GetStamperMenuItemIcon(void)
- {
- return (void *)SafeGetResource('SICN', SICNStamperToolIcon);
- }
-
- /*void StampSound(void)
- {
- Handle sndHdl = SafeGetResource('snd ', sndStamperSound);
- if (sndHdl){
- #if __MWERKS__
- SndPlay(NULL, (SndListHandle)sndHdl, false);
- #else
- SndPlay(NULL, sndHdl, false);
- #endif
- }
- }*/
-
- #define KNOBSIZE 5
-
- static void DoForEachKnob(AVPageView pageView, const AVRect *annotRect,
- void (*func)(const Rect *knobRect))
- {
- Rect qdRect;
- GrafPtr port;
- AVRect aperture;
- Rect knobRect;
-
- AVRectToRect(annotRect, &qdRect);
-
- /* AVPageViewAcquireMachinePort returns the pageView's
- ** GrafPort.
- */
- port = (GrafPtr)AVPageViewAcquireMachinePort(pageView);
-
- /* The GrafPort's origin is located at the top left corner of the
- ** AVPageView's gray area. Since the AVPageView's aperture
- ** is expressed in the coordinate space where the page's crop
- ** box's origin is (0, 0), the QD coordinates of the top left
- ** corner of the crop box are the inverse of the top left
- ** corner of the aperture.
- */
- AVPageViewGetAperture(pageView, &aperture);
- OffsetRect(&qdRect, -aperture.left, -aperture.top);
-
- SetRect(&knobRect, qdRect.left, qdRect.top, qdRect.left + KNOBSIZE,
- qdRect.top + KNOBSIZE);
- (*func)(&knobRect);
- SetRect(&knobRect, qdRect.right - KNOBSIZE, qdRect.top, qdRect.right,
- qdRect.top + KNOBSIZE);
- (*func)(&knobRect);
- SetRect(&knobRect, qdRect.left, qdRect.bottom - KNOBSIZE, qdRect.left + KNOBSIZE,
- qdRect.bottom);
- (*func)(&knobRect);
- SetRect(&knobRect, qdRect.right - KNOBSIZE, qdRect.bottom - KNOBSIZE, qdRect.right,
- qdRect.bottom);
- (*func)(&knobRect);
-
- AVPageViewReleaseMachinePort(pageView, port);
- }
-
- static void drawKnob(const Rect *knobRect)
- {
- FillRect(knobRect, (ConstPatternParam)&qd.black);
- }
-
- static void invalidateKnob(const Rect *knobRect)
- {
- InvalRect(knobRect);
- }
-
- void DrawKnobs(AVPageView pageView, const AVRect *annotRect)
- {
- DoForEachKnob(pageView, annotRect, &drawKnob);
- }
-
- void EraseKnobs(AVPageView pageView, const AVRect *annotRect)
- {
- DoForEachKnob(pageView, annotRect, &invalidateKnob);
- }
-