JPEGView/Source/C/JPEGViewGlobals.c
Aaron Giles 92bdb55672 JPEGView 3.3 for Macintosh
These are the sources for the final official release of JPEGView for the
Mac, back in 1994.
2015-02-05 00:18:10 -08:00

1 line
9.4 KiB
C

/*********************************************************/
/* This source code copyright (c) 1991-2001, Aaron Giles */
/* See the Read Me file for licensing information. */
/* Contact email: mac@aarongiles.com */
/*********************************************************/
#if THINK_C
#include "THINK.Header"
#elif applec
#pragma load ":Headers:MPW.Header"
#elif __MWERKS__
//#include "MW.Header"
#else
#include "JPEGView.h"
#endif
AEIdleUPP gAEIdleProc;
ICMProgressUPP gGenericProgress, gSlideProgress, gDrawProgress;
UserItemUPP gOutlineOK, gPopUpMenuBox, gLineItem;
ModalFilterUPP gGenericFilter;
ModalFilterYDUPP gOpenSaveModalFilter;
/*
* Global flags
*
*/
Boolean
gInAppleEvent = false, // true if we're operating from within an AppleEvent
gInBackground = false, // true if we're running in the background
gDone = false, // true to break out of the main event loop & exit JPEGView
gMenuVisible = true, // true if the menubar is visible to the user
gMenuEnabled = true, // true if the menus are currently enabled
gCommentsOpen = false, // true if the user has opened the comments window
gHidden = false, // true if we've hidden our windows
gGetAbout = false, // true if we're to open an about box
gScreenSaver = false, // true if we're running the slide show as a screen saver
gSlideFolderValid = false,// true if the slide show folder is valid
gFoundOSL = true, // true if we have the Object Support Library
gDragMgrPresent = false,// true if the Drag Manager is available
gHelpFound = false; // true if the help file was found
/*
* Default preferences
*
*/
PrefsData
gThePrefs = {
kPrefsVersion, // Version number
sizeof(PrefsData), // Prefs size
osDeepest, // Open on deepest screen by default
true, // Choose color screens over B&W
ofNever, // Never open in full screen
false, // Don't expand small images
false, // Allow multiple images simultaneously
iqVHigh, // Very high quality by default
true, // Update background images
aqOnly, // Quantize only if there isn't a CLUT
true, // Dither quantized images
true, // Use image palette by default
true, // Restore colors by default
ubOptional, // Use bitmaps only if enough memory
false, // Not at original size
false, // Use bitmaps for uncompressed PICTs as well
true, // Automatically fix files types
false, // But don't change creators
sqOnly, // Only save CLUT if there isn't one already
false, // Don't save as PICT by default
true, // Save previews by default
true, // Compress JFIF previews by default
true, // Make custom icons by default
isSquareDog, // Square icon style
swOpen, // Start with Open dialog
true, // No automatic comments window
bgReasonable, // Give a reasonable amount of time to BG apps
#if defined(powerc) || defined(__powerc)
false, // Use IJG code for JPEG decompression
#else
true, // Use QuickTime for JPEG decompression by default
#endif
//----------------------------------------
1, // Initial help section
1, // Initial prefs section
true, // Stats initially zoomed
99, // Initial countdown for nags
//----------------------------------------
false, // Stats initially not visible
false, // Same for comments
false, // Same for colors
{ 0, 0, 0, 0 }, // Set window bounds to 0 to default to
{ 0, 0, 0, 0 }, // a reasonable position
{ 0, 0, 0, 0 }, //
{ 0, 0, 0, 0 }, //
{ 0, 0, 0, 0 }, //
{ 0, 0, 0, 0 }, //
{ 0, 0, 0, 0 }, //
{ 0, 0, 0, 0 } //
};
SlideOptions
gDefaultSlideOptions = {
false, // Not user-controlled
30, // 30-second slide show delay
true, // Shuffle up the slides
true, // Repeat indefinitely
true, // Don't report minor errors
true, // Hide the windoids
false, // Don't hide the controls
false, // Don't show comments
false, // Disk-based slide show
false, // Don't scan recursively
false, // Don't import other files
true, // Show filenames
true // Render offscreen first
};
SlideOptionsHandle
gSlideOptions;
/*
* Image format routines
*
*/
ImageFormat
gPICTFormat = {
kPICTType, 0, kPICTType,
kStandardQTPreview, kCanSaveQuantization, kCanSaveBanded, kIDIsPositive,
"\p",
(idImagePtr)idPICT,
(LoadImagePtr)LoadPICT,
(OpenImagePtr)OpenPICT,
(DrawImagePtr)DrawPICT,
(FixImagePtr)FixPICT,
(SaveImagePtr)SavePICT,
(CloneImagePtr)nil,
(CloseImagePtr)nil
},
gJFIFFormat = {
kJPEGType, kJFIFType, kJPEGType,
kCustomPreview, kCanSaveQuantization, kCantSaveBanded, kIDIsPositive,
"\p",
(idImagePtr)idJPEG,
(LoadImagePtr)nil,
(OpenImagePtr)OpenJPEG,
(DrawImagePtr)DrawJPEG,
(FixImagePtr)FixJPEG,
(SaveImagePtr)SaveJPEG,
(CloneImagePtr)nil,
(CloseImagePtr)nil
},
gGIFFormat = {
kGIFType, 0, kGIFType,
kStandardQTPreview, kCantSaveQuantization, kCantSaveBanded, kIDIsPositive,
"\p",
(idImagePtr)idGIF,
(LoadImagePtr)nil,
(OpenImagePtr)OpenGIF,
(DrawImagePtr)DrawGIF,
(FixImagePtr)nil,
(SaveImagePtr)nil,
(CloneImagePtr)nil,
(CloseImagePtr)nil
},
gTIFFFormat = {
kTIFFType, 0, kTIFFType,
kStandardQTPreview, kCantSaveQuantization, kCantSaveBanded, kIDIsPositive,
"\p",
(idImagePtr)idTIFF,
(LoadImagePtr)nil,
(OpenImagePtr)OpenTIFF,
(DrawImagePtr)DrawTIFF,
(FixImagePtr)nil,
(SaveImagePtr)nil,
(CloneImagePtr)CloneTIFF,
(CloseImagePtr)CloseTIFF
},
gBMPFormat = {
kBMPType, 0, kBMPType,
kStandardQTPreview, kCantSaveQuantization, kCantSaveBanded, kIDIsPositive,
"\p",
(idImagePtr)idBMP,
(LoadImagePtr)nil,
(OpenImagePtr)OpenBMP,
(DrawImagePtr)DrawBMP,
(FixImagePtr)nil,
(SaveImagePtr)nil,
(CloneImagePtr)CloneBMP,
(CloseImagePtr)CloseBMP
},
gSCRNFormat = {
kSCRNType, 0, kSCRNType,
kStandardQTPreview, kCanSaveQuantization, kCanSaveBanded, kIDIsPossible,
"\p",
(idImagePtr)idSCRN,
(LoadImagePtr)LoadSCRN,
(OpenImagePtr)OpenSCRN,
(DrawImagePtr)DrawSCRN,
(FixImagePtr)nil,
(SaveImagePtr)SaveSCRN,
(CloneImagePtr)nil,
(CloseImagePtr)nil
},
gPNTGFormat = {
kPNTGType, 0, kPNTGType,
kStandardQTPreview, kCantSaveQuantization, kCantSaveBanded, kIDIsPossible,
"\p",
(idImagePtr)idPNTG,
(LoadImagePtr)nil,
(OpenImagePtr)OpenPNTG,
(DrawImagePtr)DrawPNTG,
(FixImagePtr)nil,
(SaveImagePtr)nil,
(CloneImagePtr)nil,
(CloseImagePtr)nil
},
gPICTRFormat = {
0, 0, kSCRNType,
kStandardQTPreview, kCanSaveQuantization, kCanSaveBanded, kIDIsPossible,
"\p",
(idImagePtr)nil,
(LoadImagePtr)nil,
(OpenImagePtr)nil,
(DrawImagePtr)nil,
(FixImagePtr)FixSCRN,
(SaveImagePtr)SaveSCRN,
(CloneImagePtr)nil,
(CloseImagePtr)nil
};
ImageFormatPtr
gFormat[kFileFormats] = {
&gPICTFormat,
&gJFIFFormat,
&gGIFFormat,
&gTIFFFormat,
&gBMPFormat,
&gSCRNFormat,
&gPNTGFormat,
&gPICTRFormat
};
/*
* RGB Color Specs
*
*/
RGBColor
gBlack = { 0x0000, 0x0000, 0x0000 }, // Black
gWhite = { 0xffff, 0xffff, 0xffff }, // White
gFGrey = { 0x1111, 0x1111, 0x1111 }; // Windowframe Grey
/*
* Other globals
*
*/
#if defined(powerc) || defined(__powerc)
#ifndef __MWERKS__
QDGlobals qd;
#endif
#endif
NMRec
gTheNotification; // Notification Mgr. record
THPrint
gPrintRecord = nil; // the global print record
ImageHandle
gDrawing = nil, // handle to image we're currently drawing
gImageRoot = nil; // pointer to the root of the linked list of images
MonitorHandle
gMainMonitor = nil; // pointer to the main monitor; also head of linked list
MenuHandle
gAppleMenu; // handle to the Apple menu
CursHandle
gCross, // handle to the cross cursor
gHand, // handle to the hand cursor
gSize; // handle to the size-box cursor
PaletteHandle
gColorPalette[9], // handle to color palettes of varying depths (1,2,4,8)
gGreyPalette[9]; // handle to greyscale palettes of varying depths (4,8)
DialogRecord
*gPortPool; // pointer to the pool of WindowPtrs we have
GWorldPtr
gGenericGWorld, // pointer to the generic GWorld
gPreviewGWorld, // pointer to the preview GWorld
gIconGWorld; // pointer to the icon GWorld
CodecInfo
gJPEGInfo; // the codec information record for the JPEG codec
PrefsData
gOldPrefs; // area for temporarily holding the old preferences data
StringPtr
gString[kNumStrings], // pointers to all our resource-based strings
gNullString = (StringPtr)"\p"; // a null string
NestedProgress
gDummyProg = { { nil, 0 }, 0, 0L, 0x10000L, false };
// Dummy progress procedure
FSSpec
gSlideSpec; // file specification of
Point
gScreenSaverPoint; // initial location of the mouse when slide show started
Handle
gIconSuite = nil; // handle to the JPEGView application icon suite
long
gQTVersion = 0, // the version of QuickTime we found
gBadWindowID, // ID of the window we were unable to find (for Open events)
gMemSlop = 96L * 1024L; // amount of memory to reserve for internal buffer use
short
gTitleBarHeight, // height of a window's titlebar
gMenuHeight, // the original height of the menubar
gIntError = 0, // internal error number
gPendingButton = -1, // pending slide show button
gHelpItem; // item number of our JPEGView Help
short
*gErrTable = nil; // pointer to table for truncating dithering errors
uchar
*gScaleTable, // pointer to a table for fast scaling
gThousandsSep = ',', // character for thousands separation
gDecimal = '.', // character for decimal point
gListSep = ','; // character for list separation
char
gSlideShow = 0; // status of the slide show