GrFmtWriter::GrFmtWriter( const char* filename ) { strncpy( m_filename, filename, sizeof(m_filename) - 1 ); m_filename[sizeof(m_filename)-1] = '\0'; SetFormatString( "jp2" ); SetOptionString( "" ); }
void TextFormat::SetCoordFormat(size_t maxFrames, double min, double step, int default_width, int default_precision) { int col_precision = default_precision; // Determine maximum coordinate. double maxCoord = (step * (double)maxFrames) + min; // Determine character width necessary to hold largest coordinate. int col_width = DigitWidth( (long int)maxCoord ); // Check if the precision is enough to support the step size. if (step < 1.0) { int prec_exp_width = FloatWidth( step ); if (prec_exp_width > col_precision) col_precision = prec_exp_width; } // If the width for the column plus the characters needed for precision // (plus 1 for decimal point) would be greated than default_width, increment // the column width by (precision+1). if (col_precision != 0) { int precision_width = col_width + col_precision + 1; if (precision_width > default_width) col_width = precision_width; } // Default width for column is at least default_width. if (col_width < default_width) col_width = default_width; // Set column data format string, left-aligned (no leading space). type_ = DOUBLE; width_ = col_width; precision_ = col_precision; align_ = RIGHT; SetFormatString(); }
CFloatSpinCtrl::CFloatSpinCtrl() { m_Delta = 1; m_MinVal = 0; m_MaxVal = 100; m_IntRange = 100; lconv* pLconv = localeconv(); m_DecSymbol = *pLconv->decimal_point; m_bTrimTrailingZeros = TRUE; SetDecimalPlaces(-1); // simple formatting through "%g" SetFormatString(NULL); }
nmeaSendObj::nmeaSendObj(NmeaConverter_pi* pi, wxString FormatStr) { //set some variables plugin = pi; DlgActive = false; SendMode = ALLVAL; RepeatTime = 1; p_timer = NULL; ValidFormatStr = false; VarAlphaDigit = wxT("$ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?"); VarAlpha = wxT("$ABCDEFGHIJKLMNOPQRSTUVWXYZ?"); VarDigit = wxT("0123456789"); //parse Formatstring into arrays SetFormatString( FormatStr ); }
void TimeTextCtrl::OnMenu(wxCommandEvent &event) { int id = event.GetId() - ID_MENU; if (!mMenuEnabled || id < 0 || id > GetNumBuiltins()) { event.Skip(); return; } SetFormatString(GetBuiltinFormat(id)); wxCommandEvent e(EVT_TIMETEXTCTRL_UPDATED, GetId()); e.SetInt(id); e.SetString(GetBuiltinName(id)); GetParent()->GetEventHandler()->AddPendingEvent(e); }
int nmeaSendObj::ShowModal (wxWindow* parent) { // temp store variables wxString temp_FormatString = FormatString; SentenceSendMode temp_SendMode = SendMode; if( plugin->p_nmeaSendObjectDlg == NULL) plugin->p_nmeaSendObjectDlg = new nmeaSendObjectDlg( parent ); DlgActive = true; // send sentences to dlg insteade of the big wide open. plugin->p_nmeaSendObjectDlg->SetSendObjOfThisDlg(this); // tell dlg the object it should use int r = plugin->p_nmeaSendObjectDlg->ShowModal(); if ( r != wxID_OK ) //return status dlg is not OK set back stored varibles { SetFormatString(temp_FormatString); SendMode = temp_SendMode; } plugin->p_nmeaSendObjectDlg->Destroy(); plugin->p_nmeaSendObjectDlg = NULL; DlgActive = false; return r; }