1 line
6.2 KiB
C
1 line
6.2 KiB
C
/*********************************************************/
|
|
/* This source code copyright (c) 1991-2001, Aaron Giles */
|
|
/* See the Read Me file for licensing information. */
|
|
/* Contact email: mac@aarongiles.com */
|
|
/*********************************************************/
|
|
|
|
/*
|
|
* JPEGView header file, to be #included with every JPEGView code segment
|
|
*
|
|
* Contains (in order):
|
|
* Constants (#defines and enums)
|
|
* In-line functions (#defines)
|
|
* Typedefs
|
|
* Structures
|
|
* Function and Variable Prototypes
|
|
*
|
|
*/
|
|
|
|
// Make sure we don't include any unnecessary glue
|
|
#define SystemSevenOrLater 1
|
|
|
|
#if THINK_C
|
|
#define applec 1
|
|
#endif
|
|
|
|
// Standard Mac includes
|
|
#include <AEObjects.h>
|
|
#include <AEPackObject.h>
|
|
#include <AERegistry.h>
|
|
#include <Aliases.h>
|
|
#include <AppleEvents.h>
|
|
#include <Balloons.h>
|
|
#include <Controls.h>
|
|
#include <Desk.h>
|
|
#include <Devices.h>
|
|
#include <Dialogs.h>
|
|
#include <DiskInit.h>
|
|
#include <Drag.h>
|
|
#include <Errors.h>
|
|
#include <Events.h>
|
|
#include <Files.h>
|
|
#include <Finder.h>
|
|
#include <FixMath.h>
|
|
#include <Folders.h>
|
|
#include <Fonts.h>
|
|
#include <FragLoad.h>
|
|
#include <GestaltEqu.h>
|
|
#include <Icons.h>
|
|
#include <ImageCompression.h>
|
|
#include <IntlResources.h>
|
|
#include <LowMem.h>
|
|
#include <Memory.h>
|
|
#include <Menus.h>
|
|
#include <Movies.h>
|
|
#include <Notification.h>
|
|
#include <OSUtils.h>
|
|
#include <Palettes.h>
|
|
#include <Printing.h>
|
|
#include <Processes.h>
|
|
#include <QDOffscreen.h>
|
|
#include <Quickdraw.h>
|
|
#include <Resources.h>
|
|
#include <Retrace.h>
|
|
#include <Scrap.h>
|
|
#include <Script.h>
|
|
#include <StandardFile.h>
|
|
#include <TextEdit.h>
|
|
#include <TextUtils.h>
|
|
#include <Timer.h>
|
|
#include <ToolUtils.h>
|
|
#include <Traps.h>
|
|
#include <Types.h>
|
|
#include <Values.h>
|
|
#include <Windows.h>
|
|
|
|
// JPEGView resource definitions
|
|
#include "JPEGView.r.h"
|
|
|
|
/*** Compile-time constants ***/
|
|
#ifndef USE_ASM
|
|
#if defined(powerc) || defined (__powerc)
|
|
#define USE_ASM 0
|
|
#else
|
|
#define USE_ASM 1
|
|
#endif
|
|
#endif
|
|
|
|
/*** General constants ***/
|
|
enum
|
|
{
|
|
kStackSize = 48L * 1024L,
|
|
kMaxPorts = 100,
|
|
|
|
kDialogClose = 0x7acd,
|
|
kDialogCancel = 0x7ace,
|
|
kDialogOK = 0x7acf,
|
|
|
|
kCodeResource = 'CODE',
|
|
kPictResource = 'PICT',
|
|
|
|
kBSChar = 0x08,
|
|
kTabChar = 0x09,
|
|
kHelpChar = 0x05,
|
|
kReturnChar = 0x0d,
|
|
kEnterChar = 0x03,
|
|
kEscapeChar = 0x1b,
|
|
kHomeChar = 0x01,
|
|
kEndChar = 0x04,
|
|
kPageUpChar = 0x0b,
|
|
kPageDownChar = 0x0c,
|
|
kLeftArrowChar = 0x1c,
|
|
kRightArrowChar = 0x1d,
|
|
kUpArrowChar = 0x1e,
|
|
kDownArrowChar = 0x1f,
|
|
|
|
kClockFreq = 60,
|
|
kSelRectSpeed = 5,
|
|
kUpdateDelay = 300,
|
|
kSleepTime = kSelRectSpeed,
|
|
|
|
kMinSelection = 16,
|
|
kHeaderSize = 512,
|
|
kImageID = 'Im',
|
|
|
|
kTitleBarHeight = 19,
|
|
kFloatingTitleBarHeight = 11,
|
|
kWindowStepDown = kTitleBarHeight - 1,
|
|
kWindowStepRight = kTitleBarHeight - 1,
|
|
kWindowBorderWidth = 6,
|
|
kWindowBorderHeight = 5,
|
|
|
|
kFileFormats = 8,
|
|
kInvalidType = -1,
|
|
|
|
kNumStrings = strLast,
|
|
kNumCursors = rLastSpin - rFirstSpin + 1,
|
|
|
|
kSpinFrequency = 6,
|
|
kSpinContinue = kNumCursors,
|
|
|
|
errNotADirectory = -31111,
|
|
errBadJPEG = -31112,
|
|
|
|
codecProgressUpdateScaling = -1,
|
|
codecProgressUpdateDithering = -2,
|
|
codecProgressStartAdjust = -3,
|
|
codecProgressStopAdjust = -4,
|
|
codecProgressRealOpen = -5,
|
|
codecProgressRealClose = -6
|
|
};
|
|
|
|
/*** State constants ***/
|
|
enum {
|
|
bfOffscreen = 0x0001, // bf ==> gBitsFlags constants
|
|
bfOnscreen = 0x0002,
|
|
bfQuantize = 0x0004,
|
|
bfUseSlideProgress = 0x0008,
|
|
bfForceFull = 0x0010
|
|
};
|
|
|
|
enum {
|
|
plNone, // pl ==> Palettes
|
|
plSys,
|
|
plGrey,
|
|
plImage,
|
|
plQuant
|
|
};
|
|
|
|
enum {
|
|
ofNever, // of ==> Open Full Screen Options
|
|
ofAlways,
|
|
ofAsk,
|
|
ofNoMatterWhat
|
|
};
|
|
|
|
enum {
|
|
osDeepest, // os ==> Open Screen options
|
|
osLargest,
|
|
osMain
|
|
};
|
|
|
|
enum {
|
|
otSame, // ot ==> Open Statistics options
|
|
otMain
|
|
};
|
|
|
|
enum {
|
|
swNone, // su ==> Startup Options
|
|
swOpen,
|
|
swSlide,
|
|
swAutoSlide
|
|
};
|
|
|
|
enum {
|
|
aqAlways, // aq ==> autoQuantize options
|
|
aqOnly,
|
|
aqNever
|
|
};
|
|
|
|
enum {
|
|
sqAlways, // sq ==> saveQuantize options
|
|
sqOnly,
|
|
sqNever
|
|
};
|
|
|
|
enum {
|
|
ubAlways, // ub ==> useBitmaps options
|
|
ubOptional,
|
|
ubNever
|
|
};
|
|
|
|
enum {
|
|
iqVHigh, // iq ==> imageQuality options
|
|
iqHigh,
|
|
iqMedium,
|
|
iqLow
|
|
};
|
|
|
|
enum {
|
|
bgMaximal, // bg ==> backgroundTime options
|
|
bgReasonable,
|
|
bgMinimal
|
|
};
|
|
|
|
enum { // is ==> iconStyle options
|
|
isSquare = 1,
|
|
isSquareDog = 2,
|
|
isProportional = 3,
|
|
isProportionalDog = 4
|
|
};
|
|
|
|
/*
|
|
* Typedefs
|
|
*/
|
|
|
|
#include "JPEGViewTypes.h"
|
|
|
|
/**************************************** Main ****************************************/
|
|
|
|
extern void main(void);
|
|
extern void StartSpinning(void);
|
|
extern void StopSpinning(CursPtr newCursor);
|
|
extern void KeepSpinning(void);
|
|
extern void SpinIndef(void);
|
|
extern void HandleAEError(OSErr theErr, short memErr, StringPtr theString);
|
|
extern void MinorError(short theErr);
|
|
extern void FatalError(short theErr);
|
|
extern void StringError(short theErr, StringPtr origString);
|
|
extern void RequestForeground(void);
|
|
|
|
#include "EventHandlers.h"
|
|
#include "EventUtils.h"
|
|
#include "FloatingWindows.h"
|
|
#include "JPEGViewGlobals.h"
|
|
#include "MemoryUtils.h"
|
|
|
|
#include "AppleMenu.h"
|
|
#include "ColorsMenu.h"
|
|
#include "EditMenu.h"
|
|
#include "FileMenu.h"
|
|
#include "GeneralMenus.h"
|
|
#include "HelpMenu.h"
|
|
#include "MercutioAPI.h"
|
|
#include "ViewMenu.h"
|
|
#include "WindowMenu.h"
|
|
|
|
#include "CompressedResource.h"
|
|
#include "DialogUtils.h"
|
|
#include "ImageUtils.h"
|
|
#include "MarchingAnts.h"
|
|
#include "MiscellaneousUtils.h"
|
|
#include "MonitorUtils.h"
|
|
#include "ProgressProcs.h"
|
|
#include "QuickDrawUtils.h"
|
|
#include "StandardFolder.h"
|
|
#include "WindowUtils.h"
|
|
|
|
#include "Bottlenecks.h"
|
|
#include "CustomCopyBits.h"
|
|
#include "BMP.h"
|
|
#include "GIF.h"
|
|
#include "JPEG.h"
|
|
#include "JPEGNoQuickTime.h"
|
|
#include "PICT.h"
|
|
#include "PNTG.h"
|
|
#include "SCRN.h"
|
|
#include "TIFF.h"
|
|
#include "QDxDispatchPatch.h"
|
|
#include "Quantize.h"
|
|
|
|
#include "ColorsWindow.h"
|
|
#include "CommentsWindow.h"
|
|
#include "Preferences.h"
|
|
#include "SaveOpen.h"
|
|
#include "SlideControlsWindow.h"
|
|
#include "SlideShow.h"
|
|
#include "SlideShowOptions.h"
|
|
#include "StatisticsWindow.h"
|
|
|
|
#include "AppleEventUtils.h"
|
|
#include "CoreEventHandlers.h"
|
|
#include "JPEGViewEventHandlers.h"
|
|
#include "RequiredEventHandlers.h"
|
|
#include "SendAppleEvents.h"
|
|
|
|
#include "cApplication.h"
|
|
#include "cDocument.h"
|
|
#include "cDrawingArea.h"
|
|
#include "cFile.h"
|
|
#include "cImage.h"
|
|
#include "cPixelMap.h"
|
|
#include "cSelection.h"
|
|
#include "cWindow.h"
|
|
|
|
#if applec
|
|
#pragma dump ":Headers:MPW.Header"
|
|
#endif
|