Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
0
 void CurveEditor::NotifyRangeLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _old)
 {
     RefreshRange();
 }
Ejemplo n.º 4
0
 void CurveEditor::NotifyRangeEditAccept(MyGUI::EditBox* _sender)
 {
     RefreshRange();
 }