void RichTextView::RefreshSel() { int l = minmax(min(cursor, anchor), 0, text.GetLength()); int h = minmax(max(cursor, anchor), 0, text.GetLength()); if(sell == l && selh == h || sell == selh && l == h) return; RichPos pl = text.GetRichPos(l); RichPos ph = text.GetRichPos(h); RichPos psell = text.GetRichPos(sell); RichPos pselh = text.GetRichPos(selh); if(psell.parai != pl.parai || pselh.parai != ph.parai || psell.table != pl.table || pselh.table != ph.table || psell.cell != pl.cell || pselh.cell != ph.cell) Refresh(); else { RefreshRange(l, sell); RefreshRange(h, selh); } sell = l; selh = h; }
void CurveEditor::SetAttribute(DiAttributeCurved& rhs) { rhs.CopyTo(&mCurvedAttr); mSplineButton->setStateSelected(mCurvedAttr.GetInterpolationType() == IT_SPLINE); // delete all buttons for (auto i : mButtons) mCanvasWidget->_destroyChildWidget(i); mButtons.clear(); auto& pts = mCurvedAttr.GetControlPoints(); float minVal = 0; float maxVal = 10; // calculate the range for (auto p : pts) { minVal = DiMath::Min(minVal, p.y); maxVal = DiMath::Max(maxVal, p.y); } float defaultRangeMin = 0; float defaultRangeMax = 10; if(minVal < 0) { int v = minVal / 10 - 1; minVal = v * 10; } if(maxVal > 10) { int v = maxVal / 10 + 1; maxVal = v * 10; } DiString temp; temp.Format("%g", minVal); mRangeMinEditBox->setCaption(temp.c_str()); temp.Format("%g", maxVal); mRangeMaxEditBox->setCaption(temp.c_str()); RefreshRange(); // add buttons for (auto p : pts) { auto point = GetButtonPoint(p); AddButton(point.left, point.top); } }
void CurveEditor::NotifyRangeLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _old) { RefreshRange(); }
void CurveEditor::NotifyRangeEditAccept(MyGUI::EditBox* _sender) { RefreshRange(); }