ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/misc_macosx.mm
Revision: 1.2
Committed: 2002-05-25T23:54:39Z (22 years, 5 months ago) by nigel
Branch: MAIN
Changes since 1.1: +40 -10 lines
Log Message:
Blocking sheet presentation routines, simpler interfaces

File Contents

# User Rev Content
1 nigel 1.1 /*
2 nigel 1.2 * $Id: misc_macosx.mm,v 1.1 2002/03/16 04:00:25 nigel Exp $
3 nigel 1.1 *
4     * misc_macosx.m - Miscellaneous Mac OS X routines.
5     *
6     * Basilisk II (C) 1997-2002 Christian Bauer
7     *
8     * This program is free software; you can redistribute it and/or modify
9     * it under the terms of the GNU General Public License as published by
10     * the Free Software Foundation; either version 2 of the License, or
11     * (at your option) any later version.
12     *
13     * This program is distributed in the hope that it will be useful,
14     * but WITHOUT ANY WARRANTY; without even the implied warranty of
15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16     * GNU General Public License for more details.
17     *
18     * You should have received a copy of the GNU General Public License
19     * along with this program; if not, write to the Free Software
20     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21     */
22    
23     #import <AppKit/AppKit.h>
24    
25     #import "sysdeps.h" // Types used in Basilisk C++ code
26    
27     #import <prefs.h>
28    
29     #define DEBUG 0
30     #import <debug.h>
31    
32    
33    
34     /************************************************************************/
35     /* Display Errors and Warnings in a sliding thingy attached to a */
36     /* particular window, instead of as a separate window (Panel or Dialog) */
37     /************************************************************************/
38    
39 nigel 1.2 void ErrorSheet (NSString * message, NSWindow * window)
40     {
41     NSLog(message);
42     NSBeginCriticalAlertSheet(message, nil, nil, nil, window,
43     nil, nil, nil, NULL, @"");
44     while ( [window attachedSheet] )
45     [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow: 1.0]];
46     }
47 nigel 1.1
48     void ErrorSheet (NSString * message1, NSString * message2,
49 nigel 1.2 NSString * button, NSWindow * window)
50 nigel 1.1 {
51 nigel 1.2 NSLog(message1);
52     NSLog(message2);
53     NSBeginCriticalAlertSheet(message1, button, nil, nil, window,
54     nil, nil, nil, NULL, message2);
55     while ( [window attachedSheet] )
56     [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow: 1.0]];
57 nigel 1.1 }
58    
59    
60 nigel 1.2 void WarningSheet (NSString * message, NSWindow * window)
61     {
62     NSLog(message);
63     NSBeginAlertSheet(message, nil, nil, nil, window,
64     nil, nil, nil, NULL, @"");
65     }
66    
67 nigel 1.1 void WarningSheet (NSString * message1, NSString * message2,
68 nigel 1.2 NSString * button, NSWindow * window)
69 nigel 1.1 {
70 nigel 1.2 NSLog(message1);
71     NSLog(message2);
72     NSBeginAlertSheet(message1, button, nil, nil, window,
73     nil, nil, nil, NULL, message2);
74 nigel 1.1 }
75    
76    
77 nigel 1.2 void InfoSheet (NSString * message, NSWindow * window)
78     {
79     NSLog(message);
80     NSBeginInformationalAlertSheet(message, nil, nil, nil, window,
81     nil, nil, nil, NULL, @"");
82     }
83    
84 nigel 1.1 void InfoSheet (NSString * message1, NSString * message2,
85 nigel 1.2 NSString * button, NSWindow * window)
86 nigel 1.1 {
87 nigel 1.2 NSLog(message1);
88     NSLog(message2);
89     NSBeginInformationalAlertSheet(message1, nil, nil, nil, window,
90     nil, nil, nil, NULL, message2);
91 nigel 1.1 }
92    
93    
94     // Convert a frequency (i.e. updates per second) to a 60hz tick delay, and update prefs
95     int frequencyToTickDelay (float freq)
96     {
97     if ( freq == 0.0 )
98     return 0;
99     else
100     {
101     int delay = (int) (60.0 / freq);
102    
103     PrefsReplaceInt32("frameskip", delay);
104     return delay;
105     }
106     }