a7ab24571507f19cc40e4ef65800401b43000a0f braney Mon Dec 6 13:16:27 2021 -0800 support itemRgb for bigPsl, remove overload of lf->extra field for USE_ITEM_RGB and replace it with a reasonably named field in lf (useItemRbg) diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c index d0ce687..fa18fae 100644 --- src/hg/hgTracks/simpleTracks.c +++ src/hg/hgTracks/simpleTracks.c @@ -3546,31 +3546,31 @@ int x1 = x+1; int x2 = x + w - 1; if (x1 < 0) x1 = 0; if (x2 > hvg->width) x2 = hvg->width; if (x2-x1 > 0) hvGfxLine(hvg, x1, y, x2, y, color); } } static void lfColors(struct track *tg, struct linkedFeatures *lf, struct hvGfx *hvg, Color *retColor, Color *retBarbColor) /* Figure out color to draw linked feature in. */ { if (!((lf->isBigGenePred) ||(lf->filterColor == 0)|| (lf->filterColor == -1))) { - if (lf->extra == (void *)USE_ITEM_RGB) + if (lf->useItemRgb) { struct rgbColor itemRgb; itemRgb.r = (lf->filterColor & 0xff0000) >> 16; itemRgb.g = (lf->filterColor & 0xff00) >> 8; itemRgb.b = lf->filterColor & 0xff; *retColor = *retBarbColor = hvGfxFindColorIx(hvg, itemRgb.r, itemRgb.g, itemRgb.b); } else *retColor = *retBarbColor = lf->filterColor; } else if (tg->itemColor) { *retColor = tg->itemColor(tg, lf, hvg); *retBarbColor = tg->ixAltColor; @@ -5174,31 +5174,31 @@ sf->end = lf->end; lf->orientation = lfs->orientation; lf->components = sf; lf->grayIx = lfs->grayIx; /* Do some logic for thickStart/thickEnd. */ lf->tallStart = lf->start; lf->tallEnd = lf->end; if ((bed->thickStart < lf->end) && (bed->thickStart >= lf->start)) lf->tallStart = bed->thickStart; if ((bed->thickEnd < lf->end) && (bed->thickEnd >= lf->start)) lf->tallEnd = bed->thickEnd; if (((bed->thickStart < lf->start) && (bed->thickEnd < lf->start)) || ((bed->thickStart > lf->end) && (bed->thickEnd > lf->end))) lf->tallStart = lf->end; /* Finally the business about the color. */ - lf->extra = (void *)USE_ITEM_RGB; + lf->useItemRgb = TRUE; lf->filterColor = (unsigned)bed->expIds[i]; slAddHead(&lfList, lf); } slReverse(&lfList); lfs->features = lfList; lfs->noLine = FALSE; return lfs; } struct linkedFeatures *lfFromBed(struct bed *bed) { return lfFromBedExtra(bed, 0, 1000); } struct linkedFeaturesSeries *lfsFromBed(struct lfs *lfsbed, char *tdbPslTable) @@ -12452,31 +12452,31 @@ else return hvGfxFindColorIx(hvg, 0, 253, 0); //253.8 */ } struct linkedFeatures *bedDetailLoadAsLf (char **row, int rowOffset, int fieldCount, boolean useItemRgb) /* load as a linked features track and use default displays */ { struct bed *bedPart = bedLoadN(row+rowOffset, fieldCount); struct linkedFeatures *lf; if (fieldCount < 12) bed8To12(bedPart); lf = lfFromBed(bedPart); if (useItemRgb) { - lf->extra = (void *)USE_ITEM_RGB; /* signal for coloring */ + lf->useItemRgb = TRUE; lf->filterColor=bedPart->itemRgb; } return lf; } struct bed *bedDetailLoadAsBed (char **row, int rowOffset, int fieldCount) /* load as a bed track and use default displays */ { return bedLoadN(row+rowOffset, fieldCount); } void loadBedDetailSimple(struct track *tg) /* Load bedDetails track as bed 4-7, other fields are for hgc clicks */ { struct bed *list = NULL, *el; @@ -13723,59 +13723,59 @@ while ((row = sqlNextRow(sr)) != NULL) { struct variome *item = variomeLoad(row); AllocVar(bed); bed->chrom = cloneString(item->chrom); bed->chromStart = item->chromStart; bed->chromEnd = item->chromEnd; bed->name = cloneString(item->name); bed->score = item->score; safecpy(bed->strand, sizeof(bed->strand), item->strand); bed->thickStart = item->chromStart; bed->thickEnd = item->chromEnd; bed->itemRgb = bedParseRgb(item->color); bed8To12(bed); lf = lfFromBedExtra(bed, scoreMin, scoreMax); - lf->extra = (void *)USE_ITEM_RGB; /* signal for coloring */ + lf->useItemRgb = TRUE; lf->filterColor=bed->itemRgb; /* overload itemAttr fields to be able to pass id to hgc click box */ struct itemAttr *id; AllocVar(id); id->chromStart = item->id; lf->itemAttr = id; slAddHead(&lfList, lf); variomeFree(&item); } sqlFreeResult(&sr); slSort(&lfList, linkedFeaturesCmp); // add special item to allow creation of new entries AllocVar(bed); bed->chrom = chromName; bed->chromStart = winStart; bed->chromEnd = winEnd; bed->name = cloneString("Make new entry"); bed->score = 100; bed->strand[0] = ' '; /* no barbs when strand is unknown */ bed->thickStart = winStart; bed->thickEnd = winEnd; bed->itemRgb = 0xcc0000; bed8To12(bed); lf = lfFromBedExtra(bed, scoreMin, scoreMax); -lf->extra = (void *)USE_ITEM_RGB; /* signal for coloring */ +lf->useItemRgb = TRUE; lf->filterColor=bed->itemRgb; slAddHead(&lfList, lf); tg->items = lfList; wikiDisconnect(&conn); } void variomeMapItem(struct track *tg, struct hvGfx *hvg, void *item, char *itemName, char *mapItemName, int start, int end, int x, int y, int width, int height) /* create a special map box item with different i=hgcClickName and * pop-up statusLine with the item name */ { char *hgcClickName = tg->mapItemName(tg, item); char *statusLine = tg->itemName(tg, item);