bool GenomeRegionSeqStats::UpdateRegionStats(String &chr, int start, int end) { int ¤tIndex = genomeRegions_currentIndex[chr]; if(currentIndex<0) return(false); if(currentIndex>=(int)genomeRegions[chr].size()){ currentIndex=-1; contigFinishedCnt++; return(false); } vector< std::pair<int, int> > ®ion = genomeRegions[chr]; if(end<region[currentIndex].first) return(false); bool overlap = PartialUpdate(chr, start, end); if(overlap==true) return(true); // No overlap found and find the next overlapping region // If found, update the stats and adjust index // If not, adjust the index for next sequence while(start>=region[currentIndex++].second) { if(currentIndex>=(int)genomeRegions[chr].size()) return(false); if(PartialUpdate(chr, start, end)) return(true); if(end<=region[currentIndex].first) return(false); } return(false); }
// destructor Zoomer::~Zoomer() { // restore event handler if (m_PrevHandler != 0) { iv_seteventhandler(m_PrevHandler); } // restore area behind zoomer int xframe, yframe, wframe, hframe; GetWindowFrameRect(xframe, yframe, wframe, hframe); DrawBitmap(xframe, yframe, m_SavedArea); // deallocate memory which was allocated for saved area free(m_SavedArea); // update screen PartialUpdate(xframe, yframe, wframe, hframe); // notify that zoomer is about to close if (m_CloseHandler != 0) { ZoomerParameters zoomerParameters = s_Strategies[m_Position]->GetZoomParameters(); m_CloseHandler(&zoomerParameters); } // delete strategies for (int i = ZOOM_STRATEGY_FIRST; i <= ZOOM_STRATEGY_LAST; ++i) { delete s_Strategies[i]; } m_Instance = 0; }
static void close_zoomer() { DrawBitmap(dx, dy, isaves); free(isaves); isaves = NULL; iv_seteventhandler(prevhandler); SetKeyboardRate(700, 500); PartialUpdate(dx, dy, dw + 4, dh + 4); CloseFont(menu_arrow_font); }
static void draw_new_zoomer(int update) { char buf[80]; int cw, ch; int deltaw = 36; iv_windowframe(dx, dy, dw, dh, BLACK, WHITE, "@Zoom", 0); DrawBitmap(dx + 40, dy + th + 8, bm_touchzoom); cw = bm_touchzoom->width / 6 - deltaw; ch = bm_touchzoom->height / 5 - 48; // invert_item(dx+40+(cw + 6)*pos + 3, dy+th+8, cw, ch); SetFont(menu_n_font, 0); // snprintf(buf, sizeof(buf), "%s", GetLangText("@Preview")); // DrawTextRect(dx, dy + th + 8, dw, 1, buf, ALIGN_CENTER); // snprintf(buf, sizeof(buf), "%s", GetLangText("@Normal_page")); // DrawTextRect(dx, dy + th + 8 + ch + 48, dw, 1, buf, ALIGN_CENTER); // snprintf(buf, sizeof(buf), "%s", GetLangText("@Reflow")); // DrawTextRect(dx, dy + th + 8 + 48 + (ch + 24) * 3 + 24, dw, 1, buf, ALIGN_CENTER); DrawTextRect(dx + 40, dy + th + 8 + ch + 24, cw + deltaw, 1, "4", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 2, dy + th + 8 + ch + 24, cw + deltaw, 1, (char*)((GetOrientation() + 1) % 4 > 2 ? "6" : "9"), ALIGN_CENTER); snprintf(buf, sizeof(buf), "%s", GetLangText("@Fit_width")); // DrawTextRect(dx + 40 + (cw + deltaw) * 4 - 30, dy + th + 8 + ch + 24, cw + deltaw + 60, 1, buf, ALIGN_CENTER); DrawTextRect(dx + 40, dy + th + 8 + (ch + 48) * 2 - 24, cw + deltaw, 1, "75%", ALIGN_CENTER); DrawTextRect(dx + 40 + cw + deltaw, dy + th + 8 + (ch + 48) * 2 - 24, cw + deltaw, 1, "80%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 2, dy + th + 8 + (ch + 48) * 2 - 24, cw + deltaw, 1, "85%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 3, dy + th + 8 + (ch + 48) * 2 - 24, cw + deltaw, 1, "90%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 4, dy + th + 8 + (ch + 48) * 2 - 24, cw + deltaw, 1, "95%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 5, dy + th + 8 + (ch + 48) * 2 - 24, cw + deltaw, 1, "100%", ALIGN_CENTER); DrawTextRect(dx + 40, dy + th + 8 + (ch + 48) * 3 - 24, cw + deltaw, 1, "105%", ALIGN_CENTER); DrawTextRect(dx + 40 + cw + deltaw, dy + th + 8 + (ch + 48) * 3 - 24, cw + deltaw, 1, "120%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 2, dy + th + 8 + (ch + 48) * 3 - 24, cw + deltaw, 1, "130%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 3, dy + th + 8 + (ch + 48) * 3 - 24, cw + deltaw, 1, "140%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 4, dy + th + 8 + (ch + 48) * 3 - 24, cw + deltaw, 1, "150%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 5, dy + th + 8 + (ch + 48) * 3 - 24, cw + deltaw, 1, "170%", ALIGN_CENTER); DrawTextRect(dx + 40, dy + th + 8 + (ch + 48) * 4 - 24, cw + deltaw, 1, "200%", ALIGN_CENTER); DrawTextRect(dx + 40 + cw + deltaw, dy + th + 8 + (ch + 48) * 4 - 24, cw + deltaw, 1, "300%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 2, dy + th + 8 + (ch + 48) * 4 - 24, cw + deltaw, 1, "400%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 3, dy + th + 8 + (ch + 48) * 4 - 24, cw + deltaw, 1, "500%", ALIGN_CENTER); DrawTextRect(dx + 40, dy + th + 8 + (ch + 48) * 5 - 24, cw + deltaw, 1, "150%", ALIGN_CENTER); DrawTextRect(dx + 40 + cw + deltaw, dy + th + 8 + (ch + 48) * 5 - 24, cw + deltaw, 1, "200%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 2, dy + th + 8 + (ch + 48) * 5 - 24, cw + deltaw, 1, "300%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 3, dy + th + 8 + (ch + 48) * 5 - 24, cw + deltaw, 1, "400%", ALIGN_CENTER); DrawTextRect(dx + 40 + (cw + deltaw) * 4, dy + th + 8 + (ch + 48) * 5 - 24, cw + deltaw, 1, "500%", ALIGN_CENTER); if (update) PartialUpdate(dx, dy, dw + 4, dh + 4); }