void CLREnvelopeEditorCtrl::recalcVerticalRange(void)
{
	float	fMin,fMax;
	float	fTmpVal=0.0f;
	long	lI;
	long	lNumKeys=m_pEnvelope->getNumKeys();
	fMin=fMax=0.0f;
	try {
		for(lI=0;lI<lNumKeys;lI++) {
			fTmpVal=m_pEnvelope->getKeyValueAtIndex(lI);
			if(fTmpVal>fMax) {
				fMax=fTmpVal;
			}
			if(fTmpVal<fMin) {
				fMin=fTmpVal;
			}
		}
	}
	catch(LR::Exception &e) {
		AfxMessageBox(e.getDescription());
		return;
	}
	if(fMin!=fMax) {
		float	fVerticalExtent=(float)fabs(fMax-fMin);
		fMin-=0.2f*fVerticalExtent;
		fMax+=0.2f*fVerticalExtent;
		setVerticalRange(fMin,fMax);
	}
}
Exemple #2
0
 bool ScrollPanner::event(QEvent *e)
 {
     if (e->type() == QEvent::Paint)
     {
         if (m_sliderX && m_sliderX->pageStep() != m_viewSize.width())
         {
             setHorizontalRange(m_sliderX->minimum(), m_sliderX->maximum());
             setHorizontalViewSize(m_sliderX->pageStep());
             setHorizontalValue(m_sliderX->value());
         }

         if (m_sliderY && m_sliderY->pageStep() != m_viewSize.height())
         {
             setVerticalRange(m_sliderY->minimum(), m_sliderY->maximum());
             setVerticalViewSize(m_sliderY->pageStep());
             setVerticalValue(m_sliderY->value());
         }
     }

     return QWidget::event(e);
 }