Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
MacCalendarSetup.r
/* |
File: MacCalendarSetup.r |
Contains: Resources for the MacCalendar Setup application. |
Written by: Quinn "The Eskimo!" |
Copyright: © 1994-1997 by Apple Computer, Inc., all rights reserved. |
Change History (most recent first): |
You may incorporate this sample code into your applications without |
restriction, though the sample code has been provided "AS IS" and the |
responsibility for its operation is 100% yours. However, what you are |
not permitted to do is to redistribute the source as "DSC Sample Code" |
after having made changes. If you're going to re-distribute the source, |
we require that you make it clear in the source that the code was |
descended from Apple Sample Code, but that you've made changes. |
*/ |
///////////////////////////////////////////////////////////////////////// |
#define REZ |
///////////////////////////////////////////////////////////////////////// |
// Pick up resource constants common to both control strip |
// module and application. |
#include "MacCalendarCommon.h" |
// Pick up resource constants common to both C and Rez for |
// the application. |
#include "MacCalendarSetup.h" |
///////////////////////////////////////////////////////////////////////// |
// Pick up system resource types. |
#include "Pict.r" |
#include "Types.r" |
#include "SysTypes.r" |
#include "BalloonTypes.r" |
///////////////////////////////////////////////////////////////////////// |
resource 'vers' (1) { |
kVersionMajor, kVersionMinor, kVersionStage, kVersionRelease, verUS, |
kVersionIdent, |
kVersionString |
}; |
///////////////////////////////////////////////////////////////////////// |
// Define the bundle and Finder help. |
type kSetupAppCreator as 'STR '; |
resource kSetupAppCreator (0) { |
"MacCalendarSetup: " kVersionString |
}; |
resource 'BNDL' (BNDL_SetupApp) { |
kSetupAppCreator, 0, |
{ |
'FREF', {0, FREF_SetupApp}; |
'ICN#', {0, ICON_SetupApp}; |
} |
}; |
resource 'FREF' (FREF_SetupApp) { |
'APPL', 0, "" |
}; |
resource 'hfdr' (kHMHelpID) { |
HelpMgrVersion, hmDefaultOptions, 0, 0, |
{ |
HMStringItem { |
"MacCalendarSetup\n\n" |
"Use this application to configure the MacCalendar Control Strip module." |
}; |
} |
}; |
///////////////////////////////////////////////////////////////////////// |
// Define the main dialog along with its help, controls and popup menus. |
resource 'DLOG' (DLOG_Setup, "Setup Dialog", purgeable) { |
{ 0 + 30, 0 + 30, 320 + 30, 290 + 30 }, |
dBoxProc, |
invisible, |
noGoAway, |
0, |
DLOG_Setup, |
"", |
#if SystemSevenOrLater |
alertPositionMainScreen |
#endif |
}; |
resource 'DITL' (DLOG_Setup, "Setup Dialog", preload, purgeable) { |
{ |
{ 290, 200, 310, 280 }, Button { enabled, "OK" }, |
{ 290, 4, 310, 80 }, Button { enabled, "Cancel" }, |
{ 4, 4, 176, 286 }, UserItem { disabled /* Sample calendar */ }, |
#define kFontPopupRect { 230, 10, 250, 160 } |
kFontPopupRect, Control { enabled, CNTL_FontPopup }, |
#define kFontSizePopupRect { 230, 170, 250, 280 } |
kFontSizePopupRect, Control { enabled, CNTL_SizePopup }, |
#define kFirstDayPopupRect { 260, 10, 280, 280 } |
kFirstDayPopupRect, Control { enabled, CNTL_FirstDayPopup }, |
{ 180, 10, 196, 282 }, UserItem { disabled, /* Day labels */ }, |
{ 200, 10, 216, 42 }, EditText { enabled, "Su" }, |
{ 200, 50, 216, 82 }, EditText { enabled, "M" }, |
{ 200, 90, 216, 122 }, EditText { enabled, "Tu" }, |
{ 200, 130, 216, 162 }, EditText { enabled, "W" }, |
{ 200, 170, 216, 202 }, EditText { enabled, "Th" }, |
{ 200, 210, 216, 242 }, EditText { enabled, "F" }, |
{ 200, 250, 216, 282 }, EditText { enabled, "Sa" }, |
#if DEBUG |
/* |
* This lets us test the drawing algorithm without rebuilding the |
* actual status bar and rebooting the machine. |
*/ |
{ 290, 88, 310, 133 }, Button { enabled, "Prev" }, |
{ 290, 143, 310, 188 }, Button { enabled, "Next" }, |
#endif |
{ 0, 0, 0, 0}, HelpItem { disabled, HMScanhdlg { HELP_Setup }}, |
} |
}; |
resource 'hdlg' (HELP_Setup, "Setup Dialog Help", purgeable) { |
HelpMgrVersion, /* Help version */ |
0, /* Offset to first ditl */ |
0, /* Options */ |
0, /* The Proc */ |
0, /* Variant */ |
HMSkipItem { }, /* No missing item strings */ |
{ |
HMStringResItem { /* kOKButton */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp, 1, |
0, 0, |
0, 0, |
0, 0 |
}, |
HMStringResItem { /* kCancelButton */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp, 2, |
0, 0, |
0, 0, |
0, 0 |
}, |
HMStringResItem { /* kCalendarUserItem */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp, 3, |
STRN_SetupHelp, 3, |
STRN_SetupHelp, 3, |
STRN_SetupHelp, 3, |
}, |
HMStringResItem { /* kFontNamePopupItem */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp, 4, |
STRN_SetupHelp, 4, |
STRN_SetupHelp, 4, |
STRN_SetupHelp, 4, |
}, |
HMStringResItem { /* kFontSizePopupItem */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp, 5, |
STRN_SetupHelp, 5, |
STRN_SetupHelp, 5, |
STRN_SetupHelp, 5, |
}, |
HMStringResItem { /* kFirstDayPopupItem */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp, 6, |
STRN_SetupHelp, 6, |
STRN_SetupHelp, 6, |
STRN_SetupHelp, 6, |
}, |
HMSkipItem { }, /* kDayNameUserItem */ |
HMStringResItem { /* kSundayText */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp, 7, |
STRN_SetupHelp, 7, |
STRN_SetupHelp, 7, |
STRN_SetupHelp, 7, |
}, |
HMStringResItem { /* kMondayText */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp, 8, |
STRN_SetupHelp, 8, |
STRN_SetupHelp, 8, |
STRN_SetupHelp, 8, |
}, |
HMStringResItem { /* kTuesdayText */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp, 9, |
STRN_SetupHelp, 9, |
STRN_SetupHelp, 9, |
STRN_SetupHelp, 9, |
}, |
HMStringResItem { /* kWednesdayText */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp,10, |
STRN_SetupHelp,10, |
STRN_SetupHelp,10, |
STRN_SetupHelp,10, |
}, |
HMStringResItem { /* kThursdayText */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp,11, |
STRN_SetupHelp,11, |
STRN_SetupHelp,11, |
STRN_SetupHelp,11, |
}, |
HMStringResItem { /* kFridayText */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp,12, |
STRN_SetupHelp,12, |
STRN_SetupHelp,12, |
STRN_SetupHelp,12, |
}, |
HMStringResItem { /* kSaturdayText */ |
{ 0, 0 }, { 0, 0, 0, 0 }, |
STRN_SetupHelp,13, |
STRN_SetupHelp,13, |
STRN_SetupHelp,13, |
STRN_SetupHelp,13, |
}, |
} |
}; |
resource 'STR#' (STRN_SetupHelp, "Setup Dialog Help Strings", purgeable) { |
{ /* [1] kOKButton */ |
"Click this button to update the MacCalendar parameter" |
" resource. Changes take effect after you restart" |
" the computer.", |
/* [2] kCancelButton */ |
"Click this button to exit the MacCalendar Setup application" |
" without changing the MacCalendar parameter resource.", |
/* [3] kCalendarUserItem */ |
"This shows what the calendar will look like after" |
" you click the OK button and restart your computer.", |
/* [4] kFontNamePopupItem */ |
"This popup menu lets you select the font used to" |
" display the calendar.", |
/* [5] kFontSizePopupItem */ |
"This popup menu lets you select the font size used" |
" to display the calendar.", |
/* [6] kFirstDayPopupItem */ |
"This popup menu lets you select the first (leftmost)" |
" day of the week: either Sunday or Monday.", |
/* [7] kSundayText */ |
"Sunday: the first day of the week. Derived from late" |
" Latin Òdies solisÓ - day of the sun.", |
/* [8] kMondayText */ |
"Monday: the second day of the week. Derived from late" |
" Latin ÒLun¾ diesÓ - moonÕs day (compare French Lundi).", |
/* [9] kTuesdayText */ |
"Tuesday: the third day of the week. Derived from Old" |
" High German ÒZo,ÓÊan ancient Teutonic diety, identified" |
" with the Roman Mars; whence ÒTwesdag,Ó rendering" |
" late Latin Òdies MartisÓ (compare French Mardi).", |
/* [10] kWednesdayText */ |
"Wednesday: the fourth day of the week. ÒThe day of" |
" (the god) Woden,Ó a translation of late Latin" |
" ÒMercurii diesÓ whence the name of the day in" |
" the Romance languages.", |
/* [11] kThursdayText */ |
"Thursday: the fifth day of the week. Derived mainly from" |
" Old Norse ÒTrsdagrÓ Ôday of Thunor or Thor.Õ Middle" |
" Germanic Donderday (modern German Donnerstag) derives" |
" from late Latin Ódies JovisÓ (compare French Jeudi).", |
/* [12] kFridayText */ |
"Friday: the sixth day of the week. Derived from Old" |
" English ÒFrged¾gÓ Ôday of (the goddess) FrgÕ from" |
" Old Norse ÒFriggÓ the wife of Odin.", |
/* [13] kSaturdayText */ |
"Saturday: the seventh day of the week. A half-translated" |
" adoption of Latin ÒSaturni diesÓ Ôday of (the planet)" |
" Saturn.Õ", |
} |
}; |
resource 'CNTL' (CNTL_FontPopup, preload, purgeable) { |
kFontPopupRect, /* Must match DITL above */ |
popupTitleLeftJust, /* Left-justify */ |
visible, |
41, /* Title width */ |
MENU_Font, /* Font menu */ |
popupMenuCDEFProc, /* It's a popup menu */ |
0, /* refCon, unused */ |
"Font:" /* Title */ |
}; |
resource 'MENU' (MENU_Font, "Font Menu") { |
MENU_Font, |
textMenuProc, |
allEnabled, |
enabled, |
"Font", |
{ } |
}; |
resource 'CNTL' (CNTL_SizePopup, preload, purgeable) { |
kFontSizePopupRect, /* Must match DITL above */ |
popupTitleLeftJust | popupFixedWidth, /* Left-justify */ |
visible, |
41, /* Title width */ |
MENU_FontSize, /* Font Size menu */ |
popupMenuCDEFProc, /* It's a popup menu */ |
0, /* refCon, unused */ |
"Size:" /* Title */ |
}; |
resource 'MENU' (MENU_FontSize, "Font Size Menu") { |
MENU_FontSize, |
textMenuProc, |
allEnabled, |
enabled, |
"Size", |
{ |
"9", noIcon, noKey, noMark, plain, |
"10", noIcon, noKey, noMark, plain, |
"12", noIcon, noKey, noMark, plain, |
"14", noIcon, noKey, noMark, plain, |
"16", noIcon, noKey, noMark, plain, |
"18", noIcon, noKey, noMark, plain, |
"24", noIcon, noKey, noMark, plain, |
"36", noIcon, noKey, noMark, plain, |
} |
}; |
resource 'CNTL' (CNTL_FirstDayPopup, preload, purgeable) { |
kFirstDayPopupRect, /* Must match DITL above */ |
popupTitleLeftJust, /* Left-justify */ |
visible, |
135, /* Title width */ |
MENU_FirstDay, /* Font menu */ |
popupMenuCDEFProc, /* It's a popup menu */ |
0, /* refCon, unused */ |
"First Day of the Week:" /* Title */ |
}; |
resource 'MENU' (MENU_FirstDay, "First Day of the Week") { |
MENU_Font, |
textMenuProc, |
allEnabled, |
enabled, |
"Fonts", |
{ |
"Sunday", noIcon, noKey, noMark, plain, |
"Monday", noIcon, noKey, noMark, plain, |
} |
}; |
///////////////////////////////////////////////////////////////////////// |
// Define the menus. |
resource 'MBAR' (MBAR_MenuBar) { |
{ |
MENU_Apple, |
MENU_File, |
MENU_Edit |
} |
}; |
resource 'MENU' (MENU_Apple, "Apple Menu") { |
MENU_Apple, |
textMenuProc, |
0x7FFFFFFC, |
enabled, |
apple, |
{ |
"© 1993 Apple Computer Inc.", noIcon, noKey, noMark, plain, |
"-", noIcon, noKey, noMark, plain |
} |
}; |
resource 'MENU' (MENU_File, "File Menu") { |
MENU_File, |
textMenuProc, |
allEnabled, |
enabled, |
"File", |
{ |
"Quit", noIcon, "Q", noMark, plain |
} |
}; |
resource 'MENU' (MENU_Edit, "Edit Menu") { |
MENU_Edit, |
textMenuProc, |
0x0, |
enabled, |
"Edit", |
{ |
"Undo", noIcon, "Z", noMark, plain, |
"-", noIcon, noKey, noMark, plain, |
"Cut", noIcon, "X", noMark, plain, |
"Copy", noIcon, "C", noMark, plain, |
"Paste", noIcon, "V", noMark, plain, |
"Clear", noIcon, noKey, noMark, plain |
} |
}; |
///////////////////////////////////////////////////////////////////////// |
// Define the error alerts and strings. |
resource 'ALRT' (ALRT_NonFatalError, "Non-fatal Error") { |
{ 85, 85, 260, 400 }, |
ALRT_NonFatalError, |
{ |
OK, visible, silent, |
OK, visible, silent, |
OK, visible, silent, |
OK, visible, silent, |
}, |
#if SystemSevenOrLater |
alertPositionMainScreen |
#endif |
}; |
resource 'DITL' (ALRT_NonFatalError, "Non-fatal Error") { |
{ |
{ 140, 240, 160, 305 }, Button { enabled, "Exit" /* kOKButton */ }, |
{ 140, 140, 160, 230 }, Button { enabled, "Continue" }, |
{ 26, 86, 130, 305}, StaticText { disabled, |
"System Error ^0 (^1): ^2" }, |
} |
}; |
resource 'ALRT' (ALRT_FatalError, "Fatal Error") { |
{ 85, 85, 260, 400 }, |
ALRT_FatalError, |
{ |
OK, visible, silent, |
OK, visible, silent, |
OK, visible, silent, |
OK, visible, silent, |
}, |
#if SystemSevenOrLater |
alertPositionMainScreen |
#endif |
}; |
resource 'DITL' (ALRT_FatalError, "Fatal Error") { |
{ |
{ 140, 240, 160, 305 }, Button { enabled, "Exit" }, |
{ 26, 86, 130, 305}, StaticText { disabled, |
"Fatal Error ^0 (^1): ^2" }, |
} |
}; |
resource 'ALRT' (ALRT_NoPreferences, "No preference resource or file") { |
{ 85, 85, 280, 480 }, |
ALRT_NoPreferences, |
{ |
OK, visible, silent, |
OK, visible, silent, |
OK, visible, silent, |
OK, visible, silent, |
}, |
#if SystemSevenOrLater |
alertPositionMainScreen |
#endif |
}; |
resource 'DITL' (ALRT_NoPreferences, "No preference resource or file") { |
{ |
{ 160, 320, 180, 385 }, Button { enabled, "Exit" }, |
{ 26, 86, 150, 385}, StaticText { disabled, |
"Can't find the Control Strip preference.\n" |
"Please check that the MacCalendar Control Strip has been installed" |
" correctly. If you have just installed it, please restart" |
" your computer and try again." |
}, |
} |
}; |
resource 'STR#' (STRN_Messages, "Various messages") { |
{ |
"System Error", |
} |
}; |
type 'Estr' as 'STR '; |
resource 'Estr' (-23) { "openErr: Can't open file (permissions)" }; |
resource 'Estr' (-27) { "abortErr: I/O terminated" }; |
resource 'Estr' (-33) { "dirFulErr: Disk full: can't write data" }; |
resource 'Estr' (-36) { "ioErr: General I/O error (bummers)" }; |
resource 'Estr' (-41) { "mFulErr: Memory full (file won't fit)" }; |
resource 'Estr' (-43) { "fnfErr: File not found" }; |
resource 'Estr' (-50) { "paramErr: Error in user parameter block" }; |
resource 'Estr' (-108) { "memErr: Out of memory" }; |
resource 'Estr' (-109) { "nilHandleErr: Unexpected NULL handle" }; |
resource 'Estr' (-192) { "resNotFound: Missing resource" }; |
resource 'Estr' (-4101) { "No printer selected in Chooser" }; |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14