From: <vo...@us...> - 2013-12-30 19:36:34
|
Revision: 5766 http://sourceforge.net/p/moneymanagerex/code/5766 Author: vomikan Date: 2013-12-30 19:36:29 +0000 (Mon, 30 Dec 2013) Log Message: ----------- fix for precision save Modified Paths: -------------- branches/version_1.0.0.0/src/currencydialog.cpp Modified: branches/version_1.0.0.0/src/currencydialog.cpp =================================================================== --- branches/version_1.0.0.0/src/currencydialog.cpp 2013-12-30 17:23:49 UTC (rev 5765) +++ branches/version_1.0.0.0/src/currencydialog.cpp 2013-12-30 19:36:29 UTC (rev 5766) @@ -44,10 +44,10 @@ } mmCurrencyDialog::mmCurrencyDialog(wxWindow* parent, Model_Currency::Data * currency) -: m_currency(currency) - , scale_(1) + : m_currency(currency) + , scale_(2) { - long style = wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX; + long style = wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX; Create(parent, wxID_STATIC, _("Currency Manager"), wxDefaultPosition, wxSize(500, 300), style); } @@ -55,8 +55,8 @@ , const wxString& caption, const wxPoint& pos , const wxSize& size, long style) { - SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); - wxDialog::Create( parent, id, caption, pos, size, style ); + SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS); + wxDialog::Create(parent, id, caption, pos, size, style); CreateControls(); GetSizer()->Fit(this); @@ -129,15 +129,15 @@ grpTx_->SetValue(m_currency->GROUP_SEPARATOR); unitTx_->SetValue(m_currency->UNIT_NAME); centTx_->SetValue(m_currency->CENT_NAME); - wxString scale_value = wxString::Format("%i", scale_); - scaleTx_->SetValue(scale_value); + scale_ = log10(m_currency->SCALE); + scaleTx_->SetValue(wxString::Format("%i", scale_)); baseConvRate_->SetValue(wxString::Format("%.4f", m_currency->BASECONVRATE)); m_currencySymbol->SetValue(m_currency->CURRENCY_SYMBOL); } else { convRate_ = 1; - scale_ = 1; + scale_ = 2; baseConvRate_->SetValue("1"); } @@ -195,13 +195,13 @@ grpTx_ = new wxTextCtrl( this, ID_DIALOG_CURRENCY_TEXT_GROUP, ""); itemFlexGridSizer3->Add(grpTx_, flagsExpand); - wxIntegerValidator<int> valInt(&scale_, - wxNUM_VAL_THOUSANDS_SEPARATOR | wxNUM_VAL_ZERO_AS_BLANK); + wxIntegerValidator<int> valInt(&scale_ + , wxNUM_VAL_THOUSANDS_SEPARATOR | wxNUM_VAL_ZERO_AS_BLANK); valInt.SetMin(0); // Only allow positive numbers valInt.SetMax(6); - itemFlexGridSizer3->Add(new wxStaticText( this, wxID_STATIC, _("Scale")), flags); - scaleTx_ = new wxTextCtrl( this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize - , wxALIGN_RIGHT|wxTE_PROCESS_ENTER , valInt ); + itemFlexGridSizer3->Add(new wxStaticText(this, wxID_STATIC, _("Scale")), flags); + scaleTx_ = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize + , wxALIGN_RIGHT | wxTE_PROCESS_ENTER, valInt); itemFlexGridSizer3->Add(scaleTx_, flagsExpand); itemFlexGridSizer3->Add(new wxStaticText( this, wxID_STATIC, _("Conversion to Base Rate")), flags); @@ -274,7 +274,7 @@ m_currency->GROUP_SEPARATOR = grpTx_->GetValue(); m_currency->UNIT_NAME = unitTx_->GetValue(); m_currency->CENT_NAME = centTx_->GetValue(); - m_currency->SCALE = static_cast<int>(pow(10,scal)); + m_currency->SCALE = static_cast<int>(pow(10, scal)); m_currency->BASECONVRATE = convRate; m_currency->CURRENCY_SYMBOL = m_currencySymbol->GetValue(); m_currency->CURRENCYNAME = m_currencyName->GetValue(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |