-/* $Id: mac.c,v 1.6 2002/12/10 01:11:40 ben Exp $ */
+/* $Id: mac.c,v 1.11 2002/12/30 19:01:44 ben Exp $ */
/*
* Copyright (c) 1999 Ben Harris
* All rights reserved.
#include <Devices.h>
#include <DiskInit.h>
#include <Gestalt.h>
+#include <LowMem.h>
#include <Resources.h>
#include <Script.h>
+#include <TextCommon.h>
#include <ToolUtils.h>
+#include <UnicodeConverter.h>
#include <assert.h>
#include <limits.h>
static void mac_startup(void) {
Handle menuBar;
+ TECInfoHandle ti;
/* Init Memory Manager */
MaxApplZone();
/* Mac OS 8.5 Window Manager? */
if (Gestalt(gestaltWindowMgrAttr, &mac_gestalts.windattr) != noErr)
mac_gestalts.windattr = 0;
+ /* Text Encoding Conversion Manager? */
+ if (
+#if TARGET_RT_MAC_CFM
+ &TECGetInfo == kUnresolvedCFragSymbolAddress ||
+#else
+ InitializeUnicodeConverter(NULL) != noErr ||
+#endif
+ TECGetInfo(&ti) != noErr)
+ mac_gestalts.encvvers = 0;
+ else {
+ mac_gestalts.encvvers = (*ti)->tecVersion;
+ DisposeHandle((Handle)ti);
+ }
/* We've been tested with the Appearance Manager */
if (mac_gestalts.apprvers != 0)
windows.about = NULL;
windows.licence = NULL;
+ {
+ short vol;
+ long dirid;
+
+ /* Set the default directory for loading and saving settings. */
+ /* XXX Should we create it? */
+ if (get_session_dir(FALSE, &vol, &dirid) == noErr) {
+ LMSetSFSaveDisk(-vol);
+ LMSetCurDirStore(dirid);
+ }
+ }
init_ucs();
}
case iNew:
mac_newsession();
goto done;
+ case iOpen:
+ mac_opensession();
+ goto done;
case iClose:
mac_closewindow(window);
goto done;
}
static void mac_openlicence(void) {
- DialogItemType itemtype;
- Handle item;
- VersRecHndl vers;
- Rect box;
- StringPtr longvers;
if (windows.licence)
SelectWindow(windows.licence);
static void mac_shutdown(void) {
+#if !TARGET_RT_MAC_CFM
+ if (mac_gestalts.encvvers != 0)
+ TerminateUnicodeConverter();
+#endif
exit(0);
}