/*---------------------------------------------------------------*/ #include "TypesIIGS.r" #include "ScannerDefs.h" /* tricky, tricky! */ /*------------------- Values used through out -------------------*/ #define LELine1 20 #define LELeft1 10 #define LEHeight 15 #define LEWidth 80 #define TopOfRow4 90 #define LeftEdge3 100 #define BottomOfRow4 110 #define RightEdge3 130 #define disabled $80 #ifndef fUseShadowing #define fUseShadowing $8000 #define fFastPortAware $4000 #endif /*----------------------- About Box ------------------------------*/ resource rAlertString (AboutBox) { "\$00\$19\$00\$0A\$00\$AA\$00\$35\$01" "\$00/" TBCenterJust TBStyleOutline "AppleScan.GS" TBEndOfLine TBEndOfLine TBStylePlain "A Program to digitize images using the Apple Scanner." TBEndOfLine TBEndOfLine "by" TBEndOfLine "The Apple ][" TBEndOfLine "System Software Group" TBEndOfLine TBEndOfLine "© 1990, Apple Computer, Inc." TBEndOfLine "All Rights Reserved" TBEndOfLine "Version 1.0d1/^#6\$00" }; /*----------------------- Unable to allocate handle ------------------------------*/ resource rAlertString (noMemAvailable) { "20|Unable to allocate Handle.|^#0" }; /*----------------- no scanner device found in device list ------------------------*/ resource rAlertString (noScannerFound) { "83|AppleScan.GS is unable to find a scanner. " "Please check the power and SCSI connections, and " "make sure you have the scanner driver file installed " "in your system folder." TBEndOfLine TBEndOfLine "If you continue, you can work with documents, but " "you will not be able to scan." TBEndOfLine "|^#5|#6\$00" }; /*----------------------- Unable to allocate handle ------------------------------*/ resource rAlertString (scannerNotReady) { "83|Your scanner is not ready to be used. Please " "make sure it's turned on and warmed up, then " "click on the \"Try Again\" button." TBEndOfLine TBEndOfLine "If you \"Continue\", you can work with documents, but " "you will not be able to scan." TBEndOfLine "|^#5|#4|#6\$00" }; /*----------------------Startup Record ---------------------------*/ resource rToolStartup (1) { fUseShadowing + fFastPortAware, /* master SCB, mode 320 */ { 3,$0100, /* misc tools */ 4,$0100, /* quickdraw */ 5,$0100, /* desk manager */ 6,$0100, /* eventMgr */ /* 7,$0100, /* scheduler */ /* 8,$0100, /* sound tools */ /* 9,$0100, /* ADB tools */ /* 10,$0100, /* SANE */ 11,$0100, /* int math */ 14,$0300, /* Window Manager */ 15,$0300, /* Menu Manager */ 16,$0300, /* Control Manager */ 18,$0200, /* QD Aux */ 19,$0100, /* print manager */ 20,$0100, /* LineEdit tool set */ 21,$0100, /* Dialog Manager */ 22,$0100, /* Scrap manager */ 23,$0100, /* standard file */ 27,$0100, /* Font manager */ 28,$0100, /* list manager */ 34,$0100, /* text edit */ /* 29,$0100, /* ACE */ /* 32,$0100, /* Midi Tools */ /* 25,$0100, /* NoteSynth */ /* 26,$0100 /* Note Seq */ } }; /*********************************************************************/ /* /* Menus /* /*********************************************************************/ resource rMenuBar (1) { { AppleMenuID, FileMenuID, EditMenuID, ScanMenuID, }; }; resource rMenu (ScanMenuID) { ScanMenuID, 0xA008, ScanMenuID, { SettingsID, PreviewID }; }; resource rMenu (AppleMenuID) { AppleMenuID, 0xA008, AppleMenuID, { AboutID }; }; resource rMenu (FileMenuID) { FileMenuID, 0xA008, FileMenuID, { OpenID, SaveID, SaveAsID, PrefID, PrintID, CloseID, QuitID }; }; resource rMenu (EditMenuID) { EditMenuID, 0xA088, EditMenuID, { UndoID, CutID, CopyID, PasteID, ClearID }; }; resource rMenuItem (PreviewID) { PreviewID, "","", //"T","t", 0, 0x8000, PreviewID }; resource rMenuItem (SettingsID) { SettingsID, "","", 0, 0x8000, SettingsID }; resource rMenuItem (AboutID) { AboutID, "","", 0, 0x8040, AboutID }; resource rMenuItem (UndoID) { UndoID, "Z","z", 0, 0x8080, UndoID }; resource rMenuItem (CutID) { CutID, "X","x", 0, 0x8080, CutID }; resource rMenuItem (CopyID) { CopyID, "C","c", 0, 0x8080, CopyID }; resource rMenuItem (PasteID) { PasteID, "V","v", 0, 0x8080, PasteID }; resource rMenuItem (ClearID) { ClearID, "","", 0, 0x8080, ClearID }; resource rMenuItem (CloseID) { CloseID, "W","w", 0, 0x8000+disabled, CloseID }; resource rMenuItem (QuitID) { QuitID, "Q","q", 0, 0x8000, QuitID }; resource rMenuItem (OpenID) { OpenID, "O","o", 0, 0x8000+disabled, OpenID }; resource rMenuItem (SaveID) { SaveID, "S","s", 0, 0x8000+disabled, SaveID }; resource rMenuItem (SaveAsID) { SaveAsID, "","", 0, 0x8000+disabled, SaveAsID }; resource rMenuItem (PrefID) { PrefID, "","", 0, 0x8000+disabled, PrefID }; resource rMenuItem (PrintID) { PrintID, "P","p", 0, 0x8000+disabled, PrintID }; resource rPString (AppleMenuID) { "@" }; resource rPString (FileMenuID) { " File " }; resource rPString (EditMenuID) { " Edit " }; resource rPString (ScanMenuID) { " Scan " }; resource rPString (AboutID) { "About AppleScan.GSÉ" }; resource rPString (CloseID) { "Close" }; resource rPString (UndoID) { "Undo" }; resource rPString (CutID) { "Cut" }; resource rPString (CopyID) { "Copy" }; resource rPString (PasteID) { "Paste" }; resource rPString (ClearID) { "Clear" }; resource rPString (QuitID) { "Quit" }; resource rPString (PreviewID) { "Preview" }; resource rPString (OpenID) { "Open" }; resource rPString (SaveID) { "Save" }; resource rPString (SaveAsID) { "Save AsÉ" }; resource rPString (PrefID) { "PreferencesÉ" }; resource rPString (PrintID) { "Print" }; resource rPString (SettingsID) { "SettingsÉ" }; /*---------------------------------------------------------------------------*/ /* /* ImageWindowÉ /* /*---------------------------------------------------------------------------*/ resource rWindParam1 (ImageWindow) { fTitle+fMove+fZoom+fGrow+fBScroll+fRScroll+fClose+fVis, /* Frame Bits */ ImageWindow, /* title ID */ 0, /* ref Con */ {0,0,0,0}, /* Zoom Rect */ ImageWindow, /* color table id */ {0,0}, /* origin */ {400,640}, /* data size */ {200,640}, /* max height-width */ {2,2}, /* scroll amount, hor,ver */ {60,200}, /* page amount */ 0, /* wInfo Ref Con */ 0, /* wInfo height */ {50,50,120,260}, /* window Position */ infront, /* wPlane */ 0, /* Control Ref */ (refIsResource<<8) + /* descriptor for title */ (refIsResource<<10) /* descriptor for color table */ }; resource rpString (ImageWindow) { "Image Window" }; resource rWindColor (ImageWindow) { $0000, /* frameColor */ $0f00, /* titleColor */ $020f, /* tBarColor */ $00f0, /* growColor */ $0000 /* infoColor (not used, for now) */ }; //--------------------------------------------------------------------------- // // Thermometer Window // //--------------------------------------------------------------------------- resource rWindParam1 (ThermWindow) { fAlert+fVis, /* Frame Bits */ NIL, /* title ID */ NIL, /* ref Con */ {0,0,0,0}, /* Zoom Rect */ NIL, /* color table id */ {0,0}, /* origin */ {0,0}, /* data size */ {0,0}, /* max height-width */ {0,0}, /* scroll amount, hor,ver */ {0,0}, /* page amount */ NIL, /* wInfo Ref Con */ NIL, /* wInfo height */ {30,40,99,279}, /* window Position */ infront, /* wPlane */ NIL, /* controlList */ refIsResource*0x0100 /* descriptor */ }; /*---------------------------------------------------------------------------*/ /* /* PreviewWindowÉ /* /*---------------------------------------------------------------------------*/ resource rWindParam1 (PreviewWindow) { fTitle+fMove+fVis+fClose, /* Frame Bits */ PreviewWindow, /* title ID */ 0, /* ref Con */ {0,0,0,0}, /* Zoom Rect */ 0, /* color table id */ {0,0}, /* origin */ {79,103}, /* data size */ {79,103}, /* max height-width */ {0,0}, /* scroll amount, hor,ver */ {0,0}, /* page amount */ 0, /* wInfo Ref Con */ 0, /* wInfo height */ {27,2,198,186}, /* window Position */ infront, /* wPlane */ PreviewWindow, /* Control Ref */ refIsResource*0x0100+resourceToResource /* descriptor */ }; resource rpString (PreviewWindow) { "Preview" }; resource rControlList (PreviewWindow) { { 0 }; }; /*---------------------------------------------------------------------------*/ /* /* SettingsWindowÉ /* /* The Settings window /* /*---------------------------------------------------------------------------*/ #define ObjectOffset (21) #define windowHeight (4*ObjectOffset)+10 // leave a little slop #define windowWidth (316) #define windowBorderSize ((320-windowWidth-2 /* for border */) / 2) #define windowTop (13 /* menu bar height */ + 13 /* window title bar height */ + windowBorderSize) #define windowLeft (windowBorderSize+1) #define windowBottom ((4*ObjectOffset)+10+windowTop) #define windowRight (320-windowLeft) #define LeftInset (2) #define RightInset (196+2) // 196 = window field separation point #define scanButtonWidth (68) #define previewButtonWidth (85) #define freeFieldWidth ((windowWidth-previewButtonWidth-scanButtonWidth)/3) #define scrollHeight (11) resource rWindParam1 (SettingsWindow) { fTitle+fMove+fVis+fClose, /* Frame Bits */ SettingsWindow, /* title ID */ 0, /* ref Con */ {0,0,0,0}, /* Zoom Rect */ 0, /* color table id */ {0,0}, /* origin */ {400,640}, /* data size */ {200,640}, /* max height-width */ {1,1}, /* scroll amount, hor,ver */ {10,10}, /* page amount */ 0, /* wInfo Ref Con */ 0, /* wInfo height */ {windowTop,windowLeft,windowBottom,windowRight}, /* window Position */ infront, /* wPlane */ SettingsWindow, /* Control Ref */ refIsResource*0x0100+resourceToResource /* descriptor */ }; resource rpString (SettingsWindow) { "Settings" }; resource rControlList (SettingsWindow) { { CompositionPopUp, XResolutionPopUp, YResolutionPopUp, BrightnessScroll, BrightnessStatText, ContrastScroll, ContrastStatText, ThresholdScroll, ThresholdStatText, ScanButton, PreviewButton, 0 }; }; /*------ Image Composition ------*/ resource rControlTemplate (CompositionPopUp) { CompositionPopUp, /* control ID */ {1,LeftInset,0,0}, /* control rectangle */ PopUpControl{{ /* control type */ 0, /* flags */ fctlProcNotPtr+RefIsResource, /* MoreFlags */ 0, /* RefCon */ 0, /* Title Width */ CompositionPopUp, /* Menu ref */ 3 /* Initial Value */ }} }; resource rMenu (CompositionPopUp) { CompositionPopUp, /* id of menu */ RefIsResource*MenuTitleRefShift+RefIsResource*ItemRefShift+fAllowCache, /* menu flags */ CompositionPopUp, /* id of title string */ { /* id's of items */ CompositionPopUpItem1, CompositionPopUpItem2, CompositionPopUpItem3 }; }; resource rPString (CompositionPopUp) { "Composition: " }; resource rMenuItem (CompositionPopUpItem1) { 1, "","", 0, 0x8000, CompositionPopUpItem1 }; resource rMenuItem (CompositionPopUpItem2) { 2, "","", 0, 0x8000, CompositionPopUpItem2 }; resource rMenuItem (CompositionPopUpItem3) { 3, "","", 0, 0x8000, CompositionPopUpItem3 }; resource rPString (CompositionPopUpItem1) { "Line Art" }; resource rPString (CompositionPopUpItem2) { "Halftone" }; resource rPString (CompositionPopUpItem3) { "Greyscale" }; /*------ XResolutionPopUp ------*/ resource rControlTemplate (XResolutionPopUp) { XResolutionPopUp, /* control ID */ {(1*ObjectOffset)+1,LeftInset,0,0}, /* control rectangle */ PopUpControl{{ /* control type */ 0, /* flags */ fctlProcNotPtr+RefIsResource, /* MoreFlags */ 0, /* RefCon */ 0, /* Title Width */ XResolutionPopUp, /* Menu ref */ 1 /* Initial Value */ }} }; resource rMenu (XResolutionPopUp) { XResolutionPopUp, /* id of menu */ RefIsResource*MenuTitleRefShift+RefIsResource*ItemRefShift+fAllowCache, /* menu flags */ XResolutionPopUp, /* id of title string */ { /* id's of items */ XResolutionPopUpItem1, XResolutionPopUpItem2, XResolutionPopUpItem3, XResolutionPopUpItem4, XResolutionPopUpItem5 }; }; resource rPString (XResolutionPopUp) { "X Resolution: " }; resource rMenuItem (XResolutionPopUpItem1) { 1, "","", 0, 0x8000, XResolutionPopUpItem1 }; resource rMenuItem (XResolutionPopUpItem2) { 2, "","", 0, 0x8000, XResolutionPopUpItem2 }; resource rMenuItem (XResolutionPopUpItem3) { 3, "","", 0, 0x8000, XResolutionPopUpItem3 }; resource rMenuItem (XResolutionPopUpItem4) { 4, "","", 0, 0x8000, XResolutionPopUpItem4 }; resource rMenuItem (XResolutionPopUpItem5) { 5, "","", 0, 0x8000, XResolutionPopUpItem5 }; resource rPString (XResolutionPopUpItem1) { "75 dpi" }; resource rPString (XResolutionPopUpItem2) { "100 dpi" }; resource rPString (XResolutionPopUpItem3) { "150 dpi" }; resource rPString (XResolutionPopUpItem4) { "200 dpi" }; resource rPString (XResolutionPopUpItem5) { "300 dpi" }; /*------ YResolutionPopUp ------*/ resource rControlTemplate (YResolutionPopUp) { YResolutionPopUp, /* control ID */ {(2*ObjectOffset)+1,LeftInset,0,0}, /* control rectangle */ PopUpControl{{ /* control type */ 0, /* flags */ fctlProcNotPtr+RefIsResource, /* MoreFlags */ 0, /* RefCon */ 0, /* Title Width */ YResolutionPopUp, /* Menu ref */ 1 /* Initial Value */ }} }; resource rMenu (YResolutionPopUp) { YResolutionPopUp, /* id of menu */ RefIsResource*MenuTitleRefShift+RefIsResource*ItemRefShift+fAllowCache, /* menu flags */ YResolutionPopUp, /* id of title string */ { /* id's of items */ YResolutionPopUpItem1, YResolutionPopUpItem2, YResolutionPopUpItem3, YResolutionPopUpItem4, YResolutionPopUpItem5 }; }; resource rPString (YResolutionPopUp) { "Y Resolution: " }; resource rMenuItem (YResolutionPopUpItem1) { 1, "","", 0, 0x8000, YResolutionPopUpItem1 }; resource rMenuItem (YResolutionPopUpItem2) { 2, "","", 0, 0x8000, YResolutionPopUpItem2 }; resource rMenuItem (YResolutionPopUpItem3) { 3, "","", 0, 0x8000, YResolutionPopUpItem3 }; resource rMenuItem (YResolutionPopUpItem4) { 4, "","", 0, 0x8000, YResolutionPopUpItem4 }; resource rMenuItem (YResolutionPopUpItem5) { 5, "","", 0, 0x8000, YResolutionPopUpItem5 }; resource rPString (YResolutionPopUpItem1) { "75 dpi" }; resource rPString (YResolutionPopUpItem2) { "100 dpi" }; resource rPString (YResolutionPopUpItem3) { "150 dpi" }; resource rPString (YResolutionPopUpItem4) { "200 dpi" }; resource rPString (YResolutionPopUpItem5) { "300 dpi" }; /*------ Preview Button ------*/ resource rControlTemplate (PreviewButton) { PreviewButton, /* control ID */ {3*ObjectOffset+10,freeFieldWidth,0,0}, /* control rect */ SimpleButtonControl{{ /* control type */ NormalButton, /* flag */ 0x3002, /* more flags */ 0, /* ref con */ PreviewButton, /* title ref */ 0 }} }; resource rpString (PreviewButton) { "Preview" }; /*------ Brightness Scroll Bar ------*/ #define horScroll $0010 #define rightFlag $0008 #define leftFlag $0004 resource rControlTemplate (BrightnessScroll) { BrightnessScroll, /* control ID */ {(0*ObjectOffset)+1,RightInset,(0*ObjectOffset)+1+scrollHeight,windowWidth-2}, /* control rect */ scrollControl{{ /* control type */ horScroll+rightFlag+leftFlag, /* flag */ FctlProcNotPtr, /* more flags */ 0, /* ref con */ 256, /* max size */ 1, /* view size */ 128 /* initial value */ }} }; resource rControlTemplate (BrightnessStatText) { BrightnessStatText, /* control ID */ {(0*ObjectOffset)+1+11,RightInset,(0*ObjectOffset)+21,windowWidth-2}, /* control rect */ StatTextControl{{ /* control type */ 0, /* flags */ FctlProcNotPtr+RefIsResource, /* more flags */ 0, /* refcon */ BrightnessStatText, /* textRef */ 0, /* textSize */ 1 /* justification (centered) */ }} }; resource rTextForLETextBox2 (BrightnessStatText) { "Brightness" }; /*------ Contrast Scroll Bar ------*/ resource rControlTemplate (ContrastScroll) { ContrastScroll, /* control ID */ {(1*ObjectOffset)+1,RightInset,(1*ObjectOffset)+1+scrollHeight,windowWidth-2}, /* control rect */ scrollControl{{ /* control type */ horScroll+rightFlag+leftFlag, /* flag */ FctlProcNotPtr, /* more flags */ 0, /* ref con */ 256, /* max size */ 1, /* view size */ 128 /* initial value */ }} }; resource rControlTemplate (ContrastStatText) { ContrastStatText, /* control ID */ {(1*ObjectOffset)+1+11,RightInset,(1*ObjectOffset)+21,windowWidth-2}, /* control rect */ StatTextControl{{ /* control type */ 0, /* flags */ FctlProcNotPtr+RefIsResource, /* more flags */ 0, /* refcon */ ContrastStatText, /* textRef */ 0, /* textSize */ 1 /* justification (centered) */ }} }; resource rTextForLETextBox2 (ContrastStatText) { "Contrast" }; /*------ Threshold Scroll Bar ------*/ resource rControlTemplate (ThresholdScroll) { ThresholdScroll, /* control ID */ {(2*ObjectOffset)+1,RightInset,(2*ObjectOffset)+1+scrollHeight,windowWidth-2}, /* control rect */ scrollControl{{ /* control type */ horScroll+rightFlag+leftFlag, /* flag */ FctlProcNotPtr, /* more flags */ 0, /* ref con */ 256, /* max size */ 1, /* view size */ 128 /* initial value */ }} }; resource rControlTemplate (ThresholdStatText) { ThresholdStatText, /* control ID */ {(2*ObjectOffset)+1+11,RightInset,(2*ObjectOffset)+21,windowWidth-2}, /* control rect */ StatTextControl{{ /* control type */ 0, /* flags */ FctlProcNotPtr+RefIsResource, /* more flags */ 0, /* refcon */ ThresholdStatText, /* textRef */ 0, /* textSize */ 1 /* justification (centered) */ }} }; resource rTextForLETextBox2 (ThresholdStatText) { "Threshold" }; /*------ Scan Button ------*/ resource rControlTemplate (ScanButton) { ScanButton, /* control ID */ {3*ObjectOffset+10,windowWidth-freeFieldWidth-scanButtonWidth,0,0}, /* control rect */ SimpleButtonControl{{ /* control type */ DefaultButton, /* flag */ 0x3002, /* more flags */ 0, /* ref con */ ScanButton, /* title ref */ 0, /* color table ref */ {"\n","\n",0,0} /* key equivalents (return and enter) */ }} }; resource rpString (ScanButton) { "Scan" };