/* ** tuiShowLocatorContent() */ void tuiShowLocatorContent (void) { char *string; TuiGenWinInfoPtr locator; locator = locatorWinInfoPtr (); if (m_genWinPtrNotNull (locator) && locator->handle != (WINDOW *) NULL) { string = displayableWinContentAt (locator, 0); if (string != (char *) NULL) { wmove (locator->handle, 0, 0); wstandout (locator->handle); waddstr (locator->handle, string); wstandend (locator->handle); tuiRefreshWin (locator); wmove (locator->handle, 0, 0); if (string != nullStr ()) tuiFree (string); locator->contentInUse = TRUE; } } return; } /* tuiShowLocatorContent */
/* ** freeContent(). */ static void freeContent (TuiWinContent content, int contentSize, TuiWinType winType) { if (content != (TuiWinContent) NULL) { freeContentElements (content, contentSize, winType); tuiFree ((char *) content); } return; } /* freeContent */
/* ** freeContentElements(). */ static void freeContentElements (TuiWinContent content, int contentSize, TuiWinType type) { if (content != (TuiWinContent) NULL) { int i; if (type == SRC_WIN || type == DISASSEM_WIN) { /* free whole source block */ if (content[0]->whichElement.source.line != (char *) NULL) tuiFree (content[0]->whichElement.source.line); } else { for (i = 0; i < contentSize; i++) { TuiWinElementPtr element; element = content[i]; if (element != (TuiWinElementPtr) NULL) { switch (type) { case DATA_WIN: tuiFree ((char *) element); break; case DATA_ITEM_WIN: /* ** Note that data elements are not allocated ** in a single block, but individually, as needed. */ if (element->whichElement.data.type != TUI_REGISTER) tuiFree ((char *) element->whichElement.data.name); tuiFree ((char *) element->whichElement.data.value); tuiFree ((char *) element); break; case CMD_WIN: tuiFree ((char *) element->whichElement.command.line); break; default: break; } } } } if (type != DATA_WIN && type != DATA_ITEM_WIN) tuiFree ((char *) content[0]); /* free the element block */ } return; } /* freeContentElements */
/* ** allocContent(). ** Allocates the content and elements in a block. */ TuiWinContent allocContent (int numElements, TuiWinType type) { TuiWinContent content = (TuiWinContent) NULL; char *elementBlockPtr = (char *) NULL; int i; if ((content = (TuiWinContent) xmalloc (sizeof (TuiWinElementPtr) * numElements)) != (TuiWinContent) NULL) { /* ** All windows, except the data window, can allocate the elements ** in a chunk. The data window cannot because items can be ** added/removed from the data display by the user at any time. */ if (type != DATA_WIN) { if ((elementBlockPtr = (char *) xmalloc (sizeof (TuiWinElement) * numElements)) != (char *) NULL) { for (i = 0; i < numElements; i++) { content[i] = (TuiWinElementPtr) elementBlockPtr; initContentElement (content[i], type); elementBlockPtr += sizeof (TuiWinElement); } } else { tuiFree ((char *) content); content = (TuiWinContent) NULL; } } } return content; } /* allocContent */