From: Max H. <ma...@qu...> - 2001-10-09 15:13:38
|
OK, got the source for the OS X version, thanks. I am already using 10.1 + 10.1 dev tools, which meant I first had a hard time using the ObjC parts - the problem is that several files (e.g. main.h) use C++ constructs, which is not allowed in the ObjC file (at least in 10.1, the compiler is now properly checking the code :). The simple fix was to change the suffices to .mm which turns on the ObjectiveC++ compiler on OS X 10.1 Maybe some of my problems are also because I am trying to mix this with the CVS version of Basilisk? That would explain why i get this error: video_MacOSX.cpp:65: `struct monitor_desc' has no member named `bytes_per_row' I added some .mode. in there that helped. As for various of the problems mentioned in the README (regarding double clicks, intercepting Cmd-key shortcuts etc.), that is because the approach you used to hook into the system is not so good for this kind of application. A view just doesn't get it all. The solution usually is to subcalls NSApplication, and provie an own sendEvent method. There you can intercept any events you want, and pass the ones you are not interested to the original implementation. There are some variations of this technique, which all have some pro and cons. I will take a closer look at the current code, trying to understand how it all fits together, then I am convinced I will be able to give a better judgment of the situation. Oh, and I am not so convinced that this is good style: void errorPanel (const char *text), warningPanel (const char *text); But well, maybe a matter of taste (it is actually the first time i ever I see this :) ##################################### In main_MacOSX.h: #ifdef __cplusplus } #else // These are called from Objective-C methods only extern void errorSheet (NSString *msg1, NSString *msg2, NSString *button, NSWindow *win), warningSheet (NSString *msg1, NSString *msg2, NSString *button, NSWindow *win); #endif This ain't no good, either, it causes a catch 22 - if I turn on C++ extensions, I can't compile because those definitions are gone. If I turn them off, I can't compile because main.h uses C++ code. Bad. The proper way of doing this is to check the __OBJC__ macro ##################################### In controller.h, there is a line #import <Foundation/NSArray.h>; Please remove the ; it causes a compiler error in the new dev tools (rightfully). In fact the line is not needed at all since it is already covered by Cocoa.h Same in PrefsEditor.h, there is a line #include "Emulator.h"; ##################################### In Emulator.m/.h, you use a variable called "clock" which somehow clashes with the unix function of the same name somehow. It shouldn't but it does. Just rename the variable. ##################################### In Emulator.m: [emul terminate]; emul = nil; [emul release]; This is nonsense! It doesn't crash because ObjC is graceful and just does nothing when you send a message to nil, but please remove the [emul release] part (and the same for the other cases where this is done. ##################################### In Emulator.m. method SpeedChange, you call [redraw changeIntervalTo:redrawDelay * 1e6 units:NNmicroSeconds ]; However, this doesn't make sense to me looking at how changeIntervalTo:units: is implemented - why don't you simply change the first parameter of that function to accept a double? then change the above mentioned call to [redraw changeIntervalTo:redrawDelay units:NNSeconds ]; ##################################### In various places, floats, double and ints are mixed up. Not bad but causes warnings. ##################################### Could you give me a quick hint what NNThread and NNTimer are needed for - what advantage do they have over NSThread and NSTimer? Max -- ----------------------------------------------- Max Horn Software Developer email: <mailto:ma...@qu...> phone: (+49) 6151-494890 |