1 |
nigel |
1.1 |
/* |
2 |
|
|
* $Id$ |
3 |
|
|
* |
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 |
|
|
|
40 |
|
|
void ErrorSheet (NSString * message1, NSString * message2, |
41 |
|
|
NSString * button, NSWindow * win) |
42 |
|
|
{ |
43 |
|
|
NSBeginCriticalAlertSheet(message1, button, nil, nil, win, |
44 |
|
|
nil, NULL, NULL, NULL, message2); |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
|
48 |
|
|
void WarningSheet (NSString * message1, NSString * message2, |
49 |
|
|
NSString * button, NSWindow * win) |
50 |
|
|
{ |
51 |
|
|
NSBeginAlertSheet(message1, button, nil, nil, win, |
52 |
|
|
nil, NULL, NULL, NULL, message2); |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
|
56 |
|
|
void InfoSheet (NSString * message1, NSString * message2, |
57 |
|
|
NSString * button, NSWindow * win) |
58 |
|
|
{ |
59 |
|
|
NSBeginInformationalAlertSheet(message1, button, nil, nil, win, |
60 |
|
|
nil, NULL, NULL, NULL, message2); |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
|
64 |
|
|
// Convert a frequency (i.e. updates per second) to a 60hz tick delay, and update prefs |
65 |
|
|
int frequencyToTickDelay (float freq) |
66 |
|
|
{ |
67 |
|
|
if ( freq == 0.0 ) |
68 |
|
|
return 0; |
69 |
|
|
else |
70 |
|
|
{ |
71 |
|
|
int delay = (int) (60.0 / freq); |
72 |
|
|
|
73 |
|
|
PrefsReplaceInt32("frameskip", delay); |
74 |
|
|
return delay; |
75 |
|
|
} |
76 |
|
|
} |