From: <oma...@us...> - 2009-11-12 21:46:38
|
Revision: 762 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=762&view=rev Author: omalleypat Date: 2009-11-12 21:46:27 +0000 (Thu, 12 Nov 2009) Log Message: ----------- Merge asset dialog from branch svn merge -r 407:HEAD -x -w -x --ignore-eol-style ^/tags/releases/0.9.5.1/include/assetdialog.h ./src/assetdialog.h svn merge -r 407:HEAD -x -w -x --ignore-eol-style ^/tags/releases/0.9.5.1/src/assetdialog.cpp ./src/assetdialog.cpp Minor conflicts were resolved. Modified Paths: -------------- trunk/mmex/src/assetdialog.cpp trunk/mmex/src/assetdialog.h Property Changed: ---------------- trunk/mmex/src/assetdialog.cpp trunk/mmex/src/assetdialog.h Modified: trunk/mmex/src/assetdialog.cpp =================================================================== --- trunk/mmex/src/assetdialog.cpp 2009-11-12 21:38:13 UTC (rev 761) +++ trunk/mmex/src/assetdialog.cpp 2009-11-12 21:46:27 UTC (rev 762) @@ -43,6 +43,7 @@ BEGIN_EVENT_TABLE( mmAssetDialog, wxDialog ) EVT_BUTTON(ID_BUTTON_ASSET_OK, mmAssetDialog::OnOk) EVT_BUTTON(ID_BUTTON_ASSET_CANCEL, mmAssetDialog::OnCancel) + EVT_CHOICE(ID_DIALOG_ASSETDIALOG_COMBO_TYPE, mmAssetDialog::OnChangeAppreciationType) END_EVENT_TABLE() mmAssetDialog::mmAssetDialog( ) @@ -80,7 +81,12 @@ { dataToControls(); } + else + { + enableDisableRate(false); + } + Centre(); return TRUE; } @@ -123,14 +129,26 @@ wxString valueChangeTypeStr = q1.GetString(wxT("VALUECHANGE")); if (valueChangeTypeStr == wxT("None")) + { valueChange_->SetSelection(DEF_CHANGE_NONE); + enableDisableRate(false); + } else if (valueChangeTypeStr == wxT("Appreciates")) - valueChange_->SetSelection(DEF_CHANGE_APPRECIATE); + { + valueChange_->SetSelection(DEF_CHANGE_APPRECIATE); + enableDisableRate(true); + } else if (valueChangeTypeStr == wxT("Depreciates")) + + { valueChange_->SetSelection(DEF_CHANGE_DEPRECIATE); + enableDisableRate(true); + } else + { wxASSERT(false); - + } + wxString assetTypeStr = q1.GetString(wxT("ASSETTYPE")); if (assetTypeStr == wxT("Property")) assetType_->SetSelection(DEF_ASSET_PROPERTY); @@ -250,9 +268,9 @@ valueChange_->SetSelection(DEF_CHANGE_NONE); itemFlexGridSizer6->Add(valueChange_, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticText* itemStaticText13 = new wxStaticText( itemPanel5, + valueChangeRateLabel_ = new wxStaticText( itemPanel5, wxID_STATIC, _("Rate of Change"), wxDefaultPosition, wxDefaultSize, 0 ); - itemFlexGridSizer6->Add(itemStaticText13, 0, + itemFlexGridSizer6->Add(valueChangeRateLabel_, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); valueChangeRate_ = new wxTextCtrl( itemPanel5, ID_TEXTCTRL_ASSETDIALOG_CHANGERATE, wxT(""), @@ -260,7 +278,7 @@ valueChangeRate_->SetToolTip(_("Enter the rate at which the asset changes its value in % per year")); itemFlexGridSizer6->Add(valueChangeRate_, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); - + enableDisableRate(false); wxStaticText* itemStaticText19 = new wxStaticText( itemPanel5, wxID_STATIC, _("Notes"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -337,6 +355,7 @@ if(valueChangeRateStr.ToDouble(&valueChangeRate) == false) { valueChangeRate = -1.0; } + //This should be unnecessary with hidden controls if ((valueChangeType != DEF_CHANGE_NONE) && (valueChangeRate < 0.0)) { mmShowErrorMessage(this, _("Invalid Value "), _("Error")); @@ -416,3 +435,24 @@ EndModal(wxID_OK); } +void mmAssetDialog::OnChangeAppreciationType(wxCommandEvent& event) +{ + int selection = valueChange_->GetSelection(); + // Disable for "None", Enable for "Appreciates" or "Depreciates" + enableDisableRate(selection != DEF_CHANGE_NONE); +} + +void mmAssetDialog::enableDisableRate(bool en) +{ + if (en) + { + valueChangeRate_->SetEditable(true); + valueChangeRateLabel_->Enable(true); + } + else + { + valueChangeRate_->SetValue(wxT("0")); + valueChangeRate_->SetEditable(false); + valueChangeRateLabel_->Enable(false); + } +} Property changes on: trunk/mmex/src/assetdialog.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/assetdialog.cpp:408-735 /tags/releases/0.9.5.1/src/assetdialog.cpp:736-761 Modified: trunk/mmex/src/assetdialog.h =================================================================== --- trunk/mmex/src/assetdialog.h 2009-11-12 21:38:13 UTC (rev 761) +++ trunk/mmex/src/assetdialog.h 2009-11-12 21:46:27 UTC (rev 762) @@ -56,6 +56,8 @@ void OnOk(wxCommandEvent& event); void OnCancel(wxCommandEvent& event); + void OnChangeAppreciationType(wxCommandEvent& event); + void enableDisableRate(bool en); void fillControls(); void dataToControls(); @@ -72,6 +74,8 @@ wxChoice* assetType_; wxChoice* valueChange_; + + wxStaticText* valueChangeRateLabel_; bool edit_; Property changes on: trunk/mmex/src/assetdialog.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/assetdialog.h:408-735 /tags/releases/0.9.5.1/include/assetdialog.h:736-761 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |