void BookTab::set_tab (UAS_Pointer<UAS_Common> &tab_ptr) { if (f_tab_ptr != tab_ptr) { f_tab_ptr = tab_ptr; if (f_tab_ptr != (const int)0) { UAS_String st = f_tab_ptr->tab_title(); LabelString ((char *) st); if (f_selected) { deselect(); f_selected = FALSE; } Manage(); } else { Unmanage(); } } }
void Ruler::Tick(int pos, double d, bool major) { wxString l; wxCoord strW, strH; int strPos, strLen, strLeft, strTop; Label *label; if (major) label = &mMajorLabels[mNumMajor++]; else label = &mMinorLabels[mNumMinor++]; label->pos = pos; label->lx = mLeft - 1000; // don't display label->ly = mTop - 1000; // don't display label->text = ""; mDC->SetFont(major? *mMajorFont: *mMinorFont); l = LabelString(d, major); mDC->GetTextExtent(l, &strW, &strH); if (mOrientation == wxHORIZONTAL) { strLen = strW; strPos = pos - strW/2; if (strPos < 0) strPos = 0; if (strPos + strW >= mLength) strPos = mLength - strW; strLeft = mLeft + strPos; if (mFlip) strTop = mTop + 4; else strTop = mBottom - strH - 6; } else { strLen = strH; strPos = pos - strH/2; if (strPos < 0) strPos = 0; if (strPos + strH >= mLength) strPos = mLength - strH; strTop = mTop + strPos; if (mFlip) strLeft = mLeft + 4; else strLeft = mRight - strW - 6; } // See if any of the pixels we need to draw this // label is already covered int i; for(i=0; i<strLen; i++) if (mBits[strPos+i]) return; // If not, position the label and give it text label->lx = strLeft; label->ly = strTop; label->text = l; // And mark these pixels, plus some surrounding // ones (the spacing between labels), as covered int leftMargin = mSpacing; if (strPos < leftMargin) leftMargin = strPos; strPos -= leftMargin; strLen += leftMargin; int rightMargin = mSpacing; if (strPos + strLen > mLength - mSpacing) rightMargin = mLength - strPos - strLen; strLen += rightMargin; for(i=0; i<strLen; i++) mBits[strPos+i] = 1; }