--- np2/macosx/toolwin.cpp 2003/11/24 20:44:14 1.13 +++ np2/macosx/toolwin.cpp 2004/01/05 01:53:34 1.15 @@ -113,6 +113,7 @@ static const OSType subcommand[11] ={ '- #define BASENUMBER 4 static const ControlID popup[2] = { {'pop1', 1}, {'pop2', 2} }; +static const ControlID imageid = {'back', 0}; static DragReceiveHandlerUPP dr; static DragTrackingHandlerUPP tr; @@ -191,7 +192,6 @@ static void setlist(ControlRef hwnd, con const char *q; const char *p; CFStringRef str; - SInt32 attr = kMenuItemAttrIconDisabled; Str255 pname; bool success = false; @@ -209,6 +209,7 @@ const char *p; } #endif for (i=0; icnt; i++) { + SInt32 attr = kMenuItemAttrIconDisabled; p = fdd->name[fdd->pos[i]]; success = getLongFileName(cfname, p); str = CFStringCreateWithCString(NULL, cfname, CFStringGetSystemEncoding()); @@ -238,6 +239,9 @@ const char *p; if (file_attr(p)==FILEATTR_ARCHIVE) { EnableMenuItem(menu, i+1); } + else { + DisableMenuItem(menu, i+1); + } } p += sizeof(fdd->name[0]); } @@ -358,6 +362,22 @@ static pascal OSStatus cfControlproc(Eve return err; } +static PixPatHandle portpat; + +static void setDragColor(GrafPtr window) { + GrafPtr port; + RGBColor color; + bool portchanged; + + portchanged = QDSwapPort(window, &port); + GetThemeBrushAsColor(kThemeBrushDragHilite, 32, true, &color); + portpat = NewPixPat(); + MakeRGBPat(portpat, &color); + PenPixPat(portpat); + PenSize(3, 3); + if (portchanged) QDSwapPort(port, NULL); +} + static void toolwincreate(WindowRef hWnd) { const SUBITEM *p; @@ -366,6 +386,8 @@ const SUBITEM *p; const char *cls; UInt32 style; + setDragColor(GetWindowPort(hWnd)); + ControlButtonContentInfo info; info.contentType = kControlContentPictHandle; info.u.picture = NULL; @@ -465,6 +487,7 @@ static void toolwindestroy(void) { DisposePixPat(toolwin.access[1]); KillPicture(toolwin.hbmp); toolwin.hbmp = NULL; + DisposePixPat(portpat); } } @@ -692,7 +715,7 @@ static OSErr DragTracker (DragTrackingMe bool portchanged = false; static bool hilite = false; Rect bounds; - Boolean inframe = TRUE; + ControlRef back; if (message == kDragTrackingEnterHandler || message == kDragTrackingLeaveHandler) { hilite = false; @@ -700,9 +723,9 @@ static OSErr DragTracker (DragTrackingMe } if (getFSSpecFromDragItem(theDrag, &aHFSFlavor) != noErr) { if (hilite) { - if (HideDragHilite(theDrag) == noErr) { - hilite = false; - } + GetControlByID(theWindow, &imageid, &back); + Draw1Control(back); + hilite = false; } return (-1); } @@ -715,22 +738,16 @@ static OSErr DragTracker (DragTrackingMe message = kDragTrackingLeaveWindow; } else { - rgn = NewRgn(); GetControlByID(theWindow, &popup[drv], &targetControl); GetControlBounds(targetControl, &bounds); - RectRgn(rgn, &bounds); - inframe = FALSE; } break; case FTYPE_INI: case FTYPE_THD: case FTYPE_HDI: - rgn = NewRgn(); GetWindowBounds(theWindow, kWindowContentRgn, &bounds); OffsetRect(&bounds, -bounds.left, -bounds.top); - RectRgn(rgn, &bounds); - inframe = TRUE; break; default: @@ -740,17 +757,20 @@ static OSErr DragTracker (DragTrackingMe portchanged = QDSwapPort(GetWindowPort(theWindow), &port); if (message == kDragTrackingLeaveWindow && hilite) { - if (HideDragHilite(theDrag) == noErr) { - hilite = false; - } + GetControlByID(theWindow, &imageid, &back); + Draw1Control(back); + hilite = false; } else { - if (ShowDragHilite(theDrag, rgn, inframe) == noErr) { - hilite = true; + rgn = NewRgn(); + if (rgn) { + RectRgn(rgn, &bounds); + FrameRgn(rgn); + DisposeRgn(rgn); } + hilite = true; } if (portchanged) QDSwapPort(port, NULL); - if (rgn) DisposeRgn(rgn); return(noErr); } @@ -759,6 +779,10 @@ static pascal OSErr DragReceiver( Window { SInt16 drv = -1; HFSFlavor aHFSFlavor; + ControlRef back; + + GetControlByID(theWindow, &imageid, &back); + Draw1Control(back); if (getFSSpecFromDragItem(theDrag, &aHFSFlavor) != noErr) { return (-1); @@ -968,6 +992,7 @@ void toolwin_open(void) { info.contentType = kControlContentPictHandle; info.u.picture = hbmp; CreatePictureControl(hWnd, &bounds, &info, true, &image); + SetControlID(image, &imageid); InstallControlEventHandler (image, NewEventHandlerUPP(cfControlproc), GetEventTypeCount(list), list, (void *)hWnd, &ref); if (!isPUMA) { toolwincreate(hWnd);