Logo Search packages:      
Sourcecode: inkscape version File versions

static void Inkscape::validateScalar ( double  oldVal,
double *  pTarget 
) [static]

If the passed scalar is invalid (<=0), then set the widget and the scalar to use the given old value.

Parameters:
oldVal Old value to use if the new one is invalid.
pTarget The scalar to validate.
widget Widget associated with the scalar.

Definition at line 519 of file canvas-grid.cpp.

References validateScalar().

Referenced by validateScalar().

{
    // Avoid nullness.
    if ( pTarget == NULL )
        return;

    // Invalid new value?
    if ( *pTarget <= 0 ) {
        // If the old value is somehow invalid as well, then default to 1.
        if ( oldVal <= 0 )
            oldVal = 1;

        // Reset the scalar and associated widget to the old value.
        *pTarget = oldVal;
    } //if

} //validateScalar


Generated by  Doxygen 1.6.0   Back to index