/* -----------------------------------------------------------------------------*/ void CloseMSConnect (void) { short i; MidiClose (myRefNum); for (i = 0; i < listSize; i++) { LDispose(theList[i]); } }
void mac_freeeventlog(Session *s) { if (s->eventlog != NULL) LDispose(s->eventlog); if (s->eventlog_window != NULL) { sfree((WinInfo *)GetWRefCon(s->eventlog_window)); DisposeWindow(s->eventlog_window); } }
// -------------------------------------------------------------------------------------- static ListHandle createIconList(WindowRef window, Rect listRect) { ListBounds dataBounds; Point cellSize; ListHandle iconList; Cell theCell; ListDefSpec listSpec; OSStatus error; SetRect(&dataBounds, 0, 0, 1, 0); // initially there are no rows SetPt(&cellSize, kListWidth, kCellHeight); #if TARGET_API_MAC_OS8 #pragma unused (listSpec, error) iconList = LNew(&listRect, &dataBounds, cellSize, kIconListLDEF, window, true, false, false, true); #else // we could use RegisterListDefinition and LNew in Carbon instead // but we already show how to do that in PrefsDialog.c gIconListDef = NewListDefUPP(IconListDef); listSpec.defType = kListDefUserProcType; listSpec.u.userProc = gIconListDef; error = CreateCustomList(&listRect, &dataBounds, cellSize, &listSpec, window, true, false, false, true, &iconList); if (error && (iconList != NULL)) { LDispose(iconList); DisposeListDefUPP(gIconListDef); iconList = NULL; } #endif if (iconList != NULL) { SetListSelectionFlags(iconList, lOnlyOne); AddRowsAndDataToIconList(iconList, rIconListIconBaseID); SetPt(&theCell, 0, 0); LSetSelect(true, theCell, iconList); // select the first Cell drawFrameAndFocus(iconList, true, window); } return iconList; }
// -------------------------------------------------------------------------------------- void ClosePrefsWindow(WindowRef prefsWindow) { ListHandle iconList; HideWindow(prefsWindow); DisableMenuItem(GetMenuRef(mFile), iClose); GetWindowProperty(prefsWindow, kAppSignature, kIconListTag, sizeof(ListHandle), NULL, &iconList); ReleaseIconListIcons(iconList); LDispose(iconList); #if TARGET_API_MAC_CARBON DisposeListDefUPP(gIconListDef); DisposeEventHandlerUPP(gWindowEventHandler); DisposePrefsWindowHelpTags(); #endif DisposeWindow(prefsWindow); EnableMenuItem(GetMenuRef(mDemonstration), iPrefsWindow); }