+ if ( m_snap_to_ticks && (m_increment != 0) )
+ {
+ double snap_value = val / m_increment;
+
+ if (wxFinite(snap_value)) // FIXME what to do about a failure?
+ {
+ if ((snap_value - floor(snap_value)) < (ceil(snap_value) - snap_value))
+ val = floor(snap_value) * m_increment;
+ else
+ val = ceil(snap_value) * m_increment;
+ }
+ }
+
+ wxString str(wxString::Format(m_format.c_str(), val));
+
+ if ((val != m_value) || (str != m_textCtrl->GetValue()))
+ {
+ m_value = val;
+ str.ToDouble( &m_value ); // wysiwyg for textctrl
+ m_textCtrl->SetValue( str );
+ m_textCtrl->SetInsertionPointEnd();
+ m_textCtrl->DiscardEdits();
+ return true;
+ }
+
+ return false;