--- np2/macosx/toolwin.cpp 2003/11/05 15:12:17 1.3 +++ np2/macosx/toolwin.cpp 2003/11/05 16:08:59 1.4 @@ -12,8 +12,6 @@ #include "soundmng.h" #include "fdefine.h" -//for 10.2 -//#define JAGUAR enum { IDC_TOOLHDDACC = 0, @@ -117,6 +115,16 @@ static DragReceiveHandlerUPP dr; // ---- +static bool isPuma(void) { + long res; + Gestalt(gestaltSystemVersion, &res); + if (res<0x1020) { + return(true); + } + return(false); +} + + static PicHandle skinload(const char *path, Rect* bounds) { char fname[MAX_PATH]; @@ -600,13 +608,15 @@ static pascal OSErr DragReceiver( Window static WindowRef makeNibWindow (IBNibRef nibRef) { OSStatus err; WindowRef win = NULL; -#ifndef JAGUAR - Rect bounds; - SetRect(&bounds, 0, 0, 100, 100); - err = CreateNewWindow(kFloatingWindowClass, kWindowStandardHandlerAttribute, &bounds, &win); -#else - err = CreateWindowFromNib(nibRef, CFSTR("ToolWindow"), &win); -#endif + + if (isPuma()) { + Rect bounds; + SetRect(&bounds, 0, 0, 100, 100); + err = CreateNewWindow(kFloatingWindowClass, kWindowStandardHandlerAttribute, &bounds, &win); + } + else { + err = CreateWindowFromNib(nibRef, CFSTR("ToolWindow"), &win); + } if (err == noErr) { InstallStandardEventHandler(GetWindowEventTarget(win)); EventTypeSpec list[]={ @@ -796,31 +806,31 @@ void toolwin_open(void) { goto twope_err2; } -#ifndef JAGUAR - toolwincreate(hWnd); -#endif + if (isPuma()) { + toolwincreate(hWnd); + } SizeWindow(hWnd, bounds.right-bounds.left, bounds.bottom-bounds.top, true); ControlButtonContentInfo info; info.contentType = kControlContentPictHandle; info.u.picture = hbmp; CreatePictureControl(hWnd, &bounds, &info, true, &image); InstallControlEventHandler (image, NewEventHandlerUPP(cfControlproc), GetEventTypeCount(list), list, (void *)hWnd, &ref); + if (!isPuma()) { + toolwincreate(hWnd); + } -#ifdef JAGUAR - toolwincreate(hWnd); -#endif - -#ifndef JAGUAR - if (np2tool.posy < 35) np2tool.posy = 35; - if (np2tool.posx < 5 ) np2tool.posx = 5; - MoveWindow(hWnd, np2tool.posx, np2tool.posy, true); - ShowWindow(hWnd); -#else - SetDrawerParent(hWnd, hWndMain); - SetDrawerOffsets(hWnd, (640-(bounds.right-bounds.left))/2-11, (640-(bounds.right-bounds.left))/2-11); - SetDrawerPreferredEdge(hWnd, kWindowEdgeTop); - OpenDrawer(hWnd, kWindowEdgeDefault, 1); -#endif + if (isPuma()) { + if (np2tool.posy < 35) np2tool.posy = 35; + if (np2tool.posx < 5 ) np2tool.posx = 5; + MoveWindow(hWnd, np2tool.posx, np2tool.posy, true); + ShowWindow(hWnd); + } + else{ + SetDrawerParent(hWnd, hWndMain); + SetDrawerOffsets(hWnd, (640-(bounds.right-bounds.left))/2-11, (640-(bounds.right-bounds.left))/2-11); + SetDrawerPreferredEdge(hWnd, kWindowEdgeTop); + OpenDrawer(hWnd, kWindowEdgeDefault, 1); + } return; @@ -835,11 +845,12 @@ twope_err1: void toolwin_close(void) { if (toolwin.hwnd) { -#ifdef JAGUAR - CloseDrawer(toolwin.hwnd, 0); -#else - DisposeWindow(toolwin.hwnd); -#endif + if (!isPuma()) { + CloseDrawer(toolwin.hwnd, 0); + } + else{ + DisposeWindow(toolwin.hwnd); + } RemoveReceiveHandler(dr, toolwin.hwnd); toolwindestroy(); DisposeWindow(toolwin.hwnd);