9b6b330f40b16fdd1e155e860dcad5559cb75d4e braney Fri Mar 11 15:42:51 2011 -0800 put out one mapBox per row if there are too many individual items #1279 diff --git src/hg/hgTracks/bamTrack.c src/hg/hgTracks/bamTrack.c index 35a6df4..503e44b 100644 --- src/hg/hgTracks/bamTrack.c +++ src/hg/hgTracks/bamTrack.c @@ -686,66 +686,78 @@ int xOff, int yOff, int width, int height, boolean withCenterLabels, MgFont *font, Color color, enum trackVisibility vis) /* If this is invoked, we are hiding item labels. In full mode, that means no left labels. * In dense mode, we do need the left label to show shortLabel. */ { if (tg->limitedVis == tvDense) { int fontHeight = mgFontLineHeight(font); if (isCenterLabelIncluded(tg)) yOff += fontHeight; hvGfxTextRight(hvg, xOff, yOff, width, tg->lineHeight, color, font, tg->shortLabel); } return; } +static void doMapBoxPerRow(struct track *tg, + int seqStart, int seqEnd, + struct hvGfx *hvg, int xOff, int yOff, int width, + MgFont *font, Color color, enum trackVisibility vis) +{ +int fontHeight = mgFontLineHeight(font); +int numRows = tg->height / fontHeight; + +while(numRows--) + { + char buffer[1024]; + safef(buffer, sizeof buffer, + "Too many items in display. Zoom in to click on items. (%d)",numRows); + mapBoxHc(hvg, seqStart, seqEnd, xOff, yOff, width, fontHeight, + tg->track, "zoom in", + buffer); + yOff += fontHeight; + } + +// just do this once +tg->customInt = 0; +} void bamLinkedFeaturesSeriesDraw(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, MgFont *font, Color color, enum trackVisibility vis) /* Draw bam linked features items. */ { linkedFeaturesSeriesDraw(tg, seqStart, seqEnd, hvg, xOff, yOff, width, font, color, vis); if(tg->customInt) - { - mapBoxHc(hvg, seqStart, seqEnd, xOff, yOff, width, tg->height, - tg->track, tg->track, - "Too many items in display. Zoom in to click on items"); - // just do this once - tg->customInt = 0; - } + doMapBoxPerRow(tg, seqStart, seqEnd, hvg, xOff, yOff, width, + font, color, vis); } void bamLinkedFeaturesDraw(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, MgFont *font, Color color, enum trackVisibility vis) /* Draw linked features items. */ { linkedFeaturesDraw(tg, seqStart, seqEnd, hvg, xOff, yOff, width, font, color, vis); if(tg->customInt) - { - mapBoxHc(hvg, seqStart, seqEnd, xOff, yOff, width, tg->height, - tg->track, tg->track, - "Too many items in display. Zoom in to click on items"); - // just do this once - tg->customInt = 0; - } + doMapBoxPerRow(tg, seqStart, seqEnd, hvg, xOff, yOff, width, + font, color, vis); } void bamMethods(struct track *track) /* Methods for BAM alignment files. */ { #if (defined USE_BAM && defined KNETFILE_HOOKS) knetUdcInstall(); #endif//def USE_BAM && KNETFILE_HOOKS track->canPack = TRUE; boolean compositeLevel = isNameAtCompositeLevel(track->tdb, BAM_PAIR_ENDS_BY_NAME); boolean isPaired = cartUsualBooleanClosestToHome(cart, track->tdb, compositeLevel, BAM_PAIR_ENDS_BY_NAME, (trackDbSettingClosestToHome(track->tdb, BAM_PAIR_ENDS_BY_NAME) != NULL)); char *tdbShowNames = trackDbSetting(track->tdb, BAM_SHOW_NAMES);