示例#1
0
Mat::Mat(Int rows, Int cols, double elt0, ...) : rows(rows), cols(cols)
// The double is hardwired here because it is the only type that will work
// with var args and C++ real numbers.
{
    Assert(rows > 0 && cols > 0, "(Mat) illegal matrix size");

    va_list ap;
    Int     i, j;

    data = new Real[rows * cols];
    va_start(ap, elt0);

    SetReal(data[0], elt0);

    for (i = 1; i < cols; i++)
        SetReal(Elt(0, i), va_arg(ap, double));

    for (i = 1; i < rows; i++)
        for (j = 0; j < cols; j++)
            SetReal(Elt(i, j), va_arg(ap, double));

    va_end(ap);
}
ExponentialNumericControl::ExponentialNumericControl( Control& parent ) : NumericEdit( parent )
{
    SetReal();
    SetPrecision( 8 );
    SetRange( 0.0, 1.0 );

    m_coefficient.label.Hide();
    m_coefficient.slider.SetRange( 0, 180 ); // step size = 0.05
    m_coefficient.slider.SetScaledMinWidth( 250 );
    m_coefficient.SetReal();
    m_coefficient.SetRange( 1.00, 10.00 );
    m_coefficient.SetPrecision( 2 );
    m_coefficient.SetToolTip( "<p>Coefficient value in the range [1.0,9.99]</p>" );
    m_coefficient.OnValueUpdated( (NumericEdit::value_event_handler)&ExponentialNumericControl::__CoefficientValueUpdated, *this );

    m_exponent.SetRange( -8, 0 );
    m_exponent.SetToolTip( "<p>Exponent in the range [-8,0]</p>" );
    m_exponent.OnValueUpdated( (SpinBox::value_event_handler)&ExponentialNumericControl::__ExponentValueUpdated, *this );

    sizer.Add( m_coefficient, 100 );
    sizer.Add( m_exponent );

    AdjustToContents();
}