static void drawTreeInLabelArea(struct hacTree *ht, struct hvGfx *hvg, int yOff, int clipHeight, struct yFromNodeHelper *yHelper, struct titleHelper *titleHelper, boolean drawRectangle) /* Draw the haplotype clustering in the left label area (as much as fits there). */ { // Figure out which hvg to use, save current clipping, and clip to left label coords: struct hvGfx *hvgLL = (hvgSide != NULL) ? hvgSide : hvg; int clipXBak, clipYBak, clipWidthBak, clipHeightBak; hvGfxGetClip(hvgLL, &clipXBak, &clipYBak, &clipWidthBak, &clipHeightBak); hvGfxUnclip(hvgLL); hvGfxSetClip(hvgLL, leftLabelX, yOff, leftLabelWidth, clipHeight); // Draw the tree: int x = leftLabelX; (void)rDrawTreeInLabelArea(ht, hvgLL, yrtMidPoint, x, yFromHapNode, yHelper, titleHelper, drawRectangle); // Restore the prior clipping: hvGfxUnclip(hvgLL); hvGfxSetClip(hvgLL, clipXBak, clipYBak, clipWidthBak, clipHeightBak); }
void bigDrawWarning(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, MgFont *font, Color color, enum trackVisibility vis) /* Draw the network error message, for the first window only. * Use the entire screen space across all windows. */ { if (currentWindow != windows) return; int clipXBak, clipYBak, clipWidthBak, clipHeightBak; hvGfxGetClip(hvg, &clipXBak, &clipYBak, &clipWidthBak, &clipHeightBak); hvGfxUnclip(hvg); hvGfxSetClip(hvg, fullInsideX, yOff, fullInsideWidth, tg->height); xOff = fullInsideX; width = fullInsideWidth; char message[1024]; Color yellow = hvGfxFindRgb(hvg, &undefinedYellowColor); char *errMsg = bigWarnReformat(tg->networkErrMsg); char *nl = errMsg; int sl = strlen(errMsg); // in some cases, cannot use tg-> values, so recalc local equivalents. int heightPer = tl.fontHeight; /* Height per item line minus border. */ int lineHeight = heightPer+4; /* Height per item line including border. */ if (lineHeight > tg->height) lineHeight = tg->height; int n = bigWarnNumLines(errMsg); /* Lines of warning text */ int m = tg->height / lineHeight; /* Lines of text space available */ if (m < 1) m = 1; // make yellow background to draw user's attention to the err msg if (!sameOk(parentContainerType(tg), "multiWig")) // multiWig knows full parent height hvGfxBox(hvg, xOff, yOff, width, tg->height, yellow); // leading blank lines if any int bl = (m-n)/2; int i; for(i=0;i<bl;++i) yOff += lineHeight; int l = 0; while (TRUE) { char *msg = nl; nl = strchr(nl,'\n'); if (nl) nl[0] = 0; if (nl || ((sl > 0) && (errMsg[sl-1]!='\n'))) { safef(message, sizeof(message), "%s", msg); hvGfxTextCentered(hvg, xOff, yOff, width, lineHeight, MG_BLACK, font, message); yOff += lineHeight; ++l; if (l > n) break; if (l > m) break; } if (!nl) break; ++nl; } freeMem(errMsg); hvGfxUnclip(hvg); hvGfxSetClip(hvg, clipXBak, clipYBak, clipWidthBak, clipHeightBak); }