From: <vo...@us...> - 2013-06-14 09:19:12
|
Revision: 4075 http://sourceforge.net/p/moneymanagerex/code/4075 Author: vomikan Date: 2013-06-14 09:19:08 +0000 (Fri, 14 Jun 2013) Log Message: ----------- sort order for Deposit and Withdrawal columns of checking panel provided Modified Paths: -------------- trunk/src/mmcheckingpanel.cpp trunk/src/mmtransaction.cpp trunk/src/mmtransaction.h Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-14 04:09:03 UTC (rev 4074) +++ trunk/src/mmcheckingpanel.cpp 2013-06-14 09:19:08 UTC (rev 4075) @@ -286,47 +286,56 @@ if (g_sortcol == COL_DATE_OR_TRANSACTION_ID) { std::stable_sort(this->m_trans.begin(), this->m_trans.end() - , [] (const mmBankTransaction* x, const mmBankTransaction* y) { return x->date_ < y->date_; }); + , [] (const mmBankTransaction* x, const mmBankTransaction* y) + { return x->date_ < y->date_; }); } else if (g_sortcol == COL_TRANSACTION_NUMBER) { std::stable_sort(this->m_trans.begin(), this->m_trans.end() - , [] (const mmBankTransaction* x, const mmBankTransaction* y) { return x->transNum_ < y->transNum_; }); + , [] (const mmBankTransaction* x, const mmBankTransaction* y) + { return x->transNum_ < y->transNum_; }); } else if (g_sortcol == COL_PAYEE_STR) { std::stable_sort(this->m_trans.begin(), this->m_trans.end() - , [] (const mmBankTransaction* x, const mmBankTransaction* y) { return x->payeeStr_ < y->payeeStr_; }); + , [] (const mmBankTransaction* x, const mmBankTransaction* y) + { return x->payeeStr_ < y->payeeStr_; }); } else if (g_sortcol == COL_STATUS) { std::stable_sort(this->m_trans.begin(), this->m_trans.end() - , [] (const mmBankTransaction* x, const mmBankTransaction* y) { return x->status_ < y->status_; }); + , [] (const mmBankTransaction* x, const mmBankTransaction* y) + { return x->status_ < y->status_; }); } else if (g_sortcol == COL_CATEGORY) { std::stable_sort(this->m_trans.begin(), this->m_trans.end() - , [] (const mmBankTransaction* x, const mmBankTransaction* y) { return x->fullCatStr_ < y->fullCatStr_; }); + , [] (const mmBankTransaction* x, const mmBankTransaction* y) + { return x->fullCatStr_ < y->fullCatStr_; }); } - /*else if (g_sortcol == COL_WITHDRAWAL) + else if (g_sortcol == COL_WITHDRAWAL) { std::stable_sort(this->m_trans.begin(), this->m_trans.end() - , [] (const mmBankTransaction* x, const mmBankTransaction* y) { return x->balance_ < y->balance_; }); + , [] (const mmBankTransaction* x, const mmBankTransaction* y) + { return x->withdrawal_amt_ < y->withdrawal_amt_; }); } else if (g_sortcol == COL_DEPOSIT) { std::stable_sort(this->m_trans.begin(), this->m_trans.end() - , [] (const mmBankTransaction* x, const mmBankTransaction* y) { return x->balance_ < y->balance_; }); - }*/ + , [] (const mmBankTransaction* x, const mmBankTransaction* y) + { return x->deposit_amt_ < y->deposit_amt_; }); + } else if (g_sortcol == COL_BALANCE) { std::stable_sort(this->m_trans.begin(), this->m_trans.end() - , [] (const mmBankTransaction* x, const mmBankTransaction* y) { return x->balance_ < y->balance_; }); + , [] (const mmBankTransaction* x, const mmBankTransaction* y) + { return x->balance_ < y->balance_; }); } else if (g_sortcol == COL_NOTES) { std::stable_sort(this->m_trans.begin(), this->m_trans.end() - , [] (const mmBankTransaction* x, const mmBankTransaction* y) { return x->notes_ < y->notes_; }); + , [] (const mmBankTransaction* x, const mmBankTransaction* y) + { return x->notes_ < y->notes_; }); } if (!g_asc) std::reverse(this->m_trans.begin(), this->m_trans.end()); Modified: trunk/src/mmtransaction.cpp =================================================================== --- trunk/src/mmtransaction.cpp 2013-06-14 04:09:03 UTC (rev 4074) +++ trunk/src/mmtransaction.cpp 2013-06-14 09:19:08 UTC (rev 4075) @@ -165,6 +165,8 @@ bool forceUpdate ) { + deposit_amt_ = transType_ == TRANS_TYPE_DEPOSIT_STR ? amt_ : -1; + withdrawal_amt_ = transType_ == TRANS_TYPE_WITHDRAWAL_STR ? amt_ : -1; if ((isInited_) && (transType_ != TRANS_TYPE_TRANSFER_STR) && !forceUpdate) return; /* Load the Account Currency Settings for Formatting Strings */ @@ -222,13 +224,17 @@ if (accountID_ == accountID) { - withdrawalStr_ = transAmtString_; - payeeStr_ = toAccount; + withdrawalStr_ = transAmtString_; + withdrawal_amt_ = amt_; + deposit_amt_ = -1; + payeeStr_ = toAccount; } else if (toAccountID_ == accountID) { - depositStr_ = transToAmtString_; - payeeStr_ = fromAccount; + depositStr_ = transToAmtString_; + payeeStr_ = fromAccount; + deposit_amt_ = toAmt_; + withdrawal_amt_ = -1; } } Modified: trunk/src/mmtransaction.h =================================================================== --- trunk/src/mmtransaction.h 2013-06-14 04:09:03 UTC (rev 4074) +++ trunk/src/mmtransaction.h 2013-06-14 09:19:08 UTC (rev 4075) @@ -119,9 +119,11 @@ wxString transAmtString_; wxString transToAmtString_; wxString fromAccountStr_; + wxString fullCatStr_; wxString withdrawalStr_; + double withdrawal_amt_; wxString depositStr_; - wxString fullCatStr_; + double deposit_amt_; double balance_; wxString balanceStr_; @@ -184,7 +186,7 @@ , mmDateRange* date_range, bool ignoreFuture , bool group_by_month = true, bool with_date = true) const; - // The setting asDeposit is only valid if evaluateTransfer is true + // The setting asDeposit is only valid if evaluateTransfer is true double getAmountForCategory(int categID, int subcategID, bool ignoreDate, const wxDateTime &dtBegin, const wxDateTime &dtEnd, bool evaluateTransfer = false, bool asDeposit = false, bool ignoreFuture = false) const; double getAmountForPayee(int payeeID, bool ignoreDate, const wxDateTime &dtbegin, const wxDateTime &dtEnd, bool ignoreFuture = false) const; wxDateTime getLastDate(int accountID) const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-06-14 11:51:35
|
Revision: 4076 http://sourceforge.net/p/moneymanagerex/code/4076 Author: guanlisheng Date: 2013-06-14 11:51:31 +0000 (Fri, 14 Jun 2013) Log Message: ----------- simplify Modified Paths: -------------- trunk/src/mmtransaction.cpp trunk/src/mmtransaction.h trunk/src/splittransactionsdialog.cpp Modified: trunk/src/mmtransaction.cpp =================================================================== --- trunk/src/mmtransaction.cpp 2013-06-14 09:19:08 UTC (rev 4075) +++ trunk/src/mmtransaction.cpp 2013-06-14 11:51:31 UTC (rev 4076) @@ -23,19 +23,16 @@ void mmSplitTransactionEntries::addSplit(std::shared_ptr<mmSplitTransactionEntry> split) { - total_ += split->splitAmount_; entries_.push_back(split); } -double mmSplitTransactionEntries::getUpdatedTotalSplits() -{ - total_ = 0.0; - for (size_t i = 0; i < entries_.size(); ++i) - { - total_ += entries_[i]->splitAmount_; - } +double mmSplitTransactionEntries::getTotalSplits() const +{ + double total = 0.0; + for (const auto& tran: this->entries_) + total += tran->splitAmount_; - return total_; + return total; } void mmSplitTransactionEntries::removeSplit(int splitID) @@ -52,7 +49,6 @@ void mmSplitTransactionEntries::removeSplitByIndex(int splitIndex) { - total_ -= entries_[splitIndex]->splitAmount_; entries_.erase(entries_.begin() + splitIndex); } @@ -91,7 +87,6 @@ void mmSplitTransactionEntries::loadFromBDDB(mmCoreDB* core, int bdID) { entries_.clear(); - total_ = 0.0; wxSQLite3Statement st = core->db_->PrepareStatement(SELECT_ROW_FROM_BUDGETSPLITTRANSACTIONS_V1); st.Bind(1, bdID); @@ -318,7 +313,6 @@ void mmBankTransaction::getSplitTransactions(mmSplitTransactionEntries* splits) const { splits->entries_.clear(); - splits->total_ = 0.0; wxSQLite3Statement st = db_->PrepareStatement(SELECT_ROW_FROM_SPLITTRANSACTIONS_V1); st.Bind(1, transactionID()); Modified: trunk/src/mmtransaction.h =================================================================== --- trunk/src/mmtransaction.h 2013-06-14 09:19:08 UTC (rev 4075) +++ trunk/src/mmtransaction.h 2013-06-14 11:51:31 UTC (rev 4076) @@ -56,11 +56,11 @@ class mmSplitTransactionEntries { public: - mmSplitTransactionEntries() : total_() {} + mmSplitTransactionEntries() {} size_t numEntries() const { return entries_.size(); } - double getTotalSplits() const { return total_; } - double getUpdatedTotalSplits(); + double getTotalSplits() const; + double getUpdatedTotalSplits() const; void addSplit(std::shared_ptr<mmSplitTransactionEntry> split); void removeSplit(int splitID); @@ -70,7 +70,6 @@ void loadFromBDDB(mmCoreDB* core, int bdID); std::vector<std::shared_ptr<mmSplitTransactionEntry> > entries_; - double total_; }; class mmBankTransaction : public mmTransaction Modified: trunk/src/splittransactionsdialog.cpp =================================================================== --- trunk/src/splittransactionsdialog.cpp 2013-06-14 09:19:08 UTC (rev 4075) +++ trunk/src/splittransactionsdialog.cpp 2013-06-14 11:51:31 UTC (rev 4076) @@ -227,7 +227,7 @@ { // Update the total amount of all splits if (split_->numEntries() > 0) - transAmount_->SetLabel(CurrencyFormatter::float2String(split_->getUpdatedTotalSplits())); + transAmount_->SetLabel(CurrencyFormatter::float2String(split_->getTotalSplits())); else transAmount_->SetLabel(CurrencyFormatter::float2String(0.0)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-06-15 03:03:16
|
Revision: 4083 http://sourceforge.net/p/moneymanagerex/code/4083 Author: guanlisheng Date: 2013-06-15 03:03:13 +0000 (Sat, 15 Jun 2013) Log Message: ----------- cleanup Modified Paths: -------------- trunk/src/constants.cpp trunk/src/constants.h trunk/src/paths.cpp trunk/src/paths.h Modified: trunk/src/constants.cpp =================================================================== --- trunk/src/constants.cpp 2013-06-14 20:01:50 UTC (rev 4082) +++ trunk/src/constants.cpp 2013-06-15 03:03:13 UTC (rev 4083) @@ -33,9 +33,9 @@ const wxString MMEX_REVISION_ID = "$Rev$"; //--------------------------------------------------------------------------- const int mmex::MIN_DATAVERSION = 2; -const wxChar * const mmex::DATAVERSION = wxT("2"); -const wxChar *const mmex::DEFDATEFORMAT = wxT("%m/%d/%y"); -const wxChar *const mmex::DEFDELIMTER = wxT(","); +const wxString mmex::DATAVERSION = "2"; +const wxString mmex::DEFDATEFORMAT = "%m/%d/%y"; +const wxString mmex::DEFDELIMTER = ","; // Using google: To specify the exchange, use exch:code // Using yahoo: To specify the exchange, use code.exch Modified: trunk/src/constants.h =================================================================== --- trunk/src/constants.h 2013-06-14 20:01:50 UTC (rev 4082) +++ trunk/src/constants.h 2013-06-15 03:03:13 UTC (rev 4083) @@ -39,10 +39,10 @@ namespace mmex { extern const int MIN_DATAVERSION; -extern const wxChar * const DATAVERSION; +extern const wxString DATAVERSION; -extern const wxChar *const DEFDATEFORMAT; -extern const wxChar *const DEFDELIMTER; +extern const wxString DEFDATEFORMAT; +extern const wxString DEFDELIMTER; extern const wxString DEFSTOCKURL; /* Modified: trunk/src/paths.cpp =================================================================== --- trunk/src/paths.cpp 2013-06-14 20:01:50 UTC (rev 4082) +++ trunk/src/paths.cpp 2013-06-15 03:03:13 UTC (rev 4083) @@ -29,21 +29,21 @@ namespace { -inline const wxChar* getSettingsFileName() +inline const wxString getSettingsFileName() { - return wxT("mmexini.db3"); + return "mmexini.db3"; } //---------------------------------------------------------------------------- -inline const wxChar* getCustomReportIndexFilename() +inline const wxString getCustomReportIndexFilename() { - return wxT("CustomReportIndex.txt"); + return "CustomReportIndex.txt"; } //---------------------------------------------------------------------------- -inline const wxChar* getDirectory() +inline const wxString getDirectory() { - return wxT(""); + return ""; } //---------------------------------------------------------------------------- @@ -106,7 +106,7 @@ { fname = GetUserDir(create); //FIXME: file not found ERROR - //fname.AppendDir(wxT("logs")); + //fname.AppendDir("logs"); } return fname; @@ -120,21 +120,20 @@ } //---------------------------------------------------------------------------- -wxString mmex::getPathDoc(EDocFile f) +wxString mmex::getPathDoc(const EDocFile& f) { - static const wxChar* files[DOC_FILES_MAX] = { - wxT("README.TXT"), - wxT("contrib.txt"), - wxT("license.txt"), - wxT("version.txt"), - wxT("help/index.html"), - wxT("help/custom_reports.html"), - wxT("help/investment.html"), - wxT("help/budget.html"), + static const wxString files[DOC_FILES_MAX] = { + "README.TXT", + "contrib.txt", + "license.txt", + "version.txt", + "help/index.html", + "help/custom_reports.html", + "help/investment.html", + "help/budget.html", }; wxASSERT(f >= 0 && f < DOC_FILES_MAX); - wxASSERT(files[f]); wxString path = GetDocDir().GetPath(); path += wxFileName::GetPathSeparator(); @@ -146,14 +145,13 @@ wxString mmex::getPathResource(EResFile f) { - static const wxChar* files[RES_FILES_MAX] = { - wxT("mmex.ico"), - wxT("kaching.wav"), - wxT("currency_seed.csv") + static const wxString files[RES_FILES_MAX] = { + "mmex.ico", + "kaching.wav", + "currency_seed.csv" }; wxASSERT(f >= 0 && f < RES_FILES_MAX); - wxASSERT(files[f]); wxFileName fname = GetResourceDir(); fname.SetFullName(files[f]); @@ -164,12 +162,11 @@ wxString mmex::getPathShared(ESharedFile f) { - static const wxChar* files[SHARED_FILES_MAX] = { - wxT("po") + static const wxString files[SHARED_FILES_MAX] = { + "po" }; wxASSERT(f >= 0 && f < SHARED_FILES_MAX); - wxASSERT(files[f]); wxFileName fname = GetSharedDir(); fname.SetFullName(files[f]); @@ -187,7 +184,6 @@ }; wxASSERT(f >= 0 && f < USER_FILES_MAX); - wxASSERT(files[f]); wxFileName fname = GetUserDir(true); fname.SetFullName(files[f]); Modified: trunk/src/paths.h =================================================================== --- trunk/src/paths.h 2013-06-14 20:01:50 UTC (rev 4082) +++ trunk/src/paths.h 2013-06-15 03:03:13 UTC (rev 4083) @@ -32,7 +32,7 @@ { enum EDocFile { F_README, F_CONTRIB, F_LICENSE, F_VERSION, HTML_INDEX, HTML_CUSTOM_SQL, HTML_INVESTMENT, HTML_BUDGET, DOC_FILES_MAX }; -wxString getPathDoc(EDocFile f); +wxString getPathDoc(const EDocFile& f); enum EResFile { PROGRAM_ICON, TRANS_SOUND, CURRENCY_DB_SEED, RES_FILES_MAX }; wxString getPathResource(EResFile f); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-06-15 05:27:41
|
Revision: 4084 http://sourceforge.net/p/moneymanagerex/code/4084 Author: guanlisheng Date: 2013-06-15 05:27:37 +0000 (Sat, 15 Jun 2013) Log Message: ----------- pass const reference for wxString Modified Paths: -------------- trunk/src/budgetentrydialog.cpp trunk/src/budgetentrydialog.h trunk/src/categdialog.cpp trunk/src/categdialog.h trunk/src/customreportdialog.cpp trunk/src/customreportdialog.h trunk/src/customreportindex.cpp trunk/src/customreportindex.h trunk/src/mmex_settings.cpp trunk/src/mmex_settings.h trunk/src/mmtransaction.cpp trunk/src/mmtransaction.h trunk/src/optionsdialog.cpp trunk/src/optionsdialog.h trunk/src/recentfiles.h Modified: trunk/src/budgetentrydialog.cpp =================================================================== --- trunk/src/budgetentrydialog.cpp 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/budgetentrydialog.cpp 2013-06-15 05:27:37 UTC (rev 4084) @@ -42,7 +42,7 @@ mmBudgetEntryDialog::mmBudgetEntryDialog( mmCoreDB* core, int budgetYearID, int categID, int subcategID, - wxString categoryEstimate, wxString CategoryActual, + const wxString& categoryEstimate, const wxString& CategoryActual, wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) Modified: trunk/src/budgetentrydialog.h =================================================================== --- trunk/src/budgetentrydialog.h 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/budgetentrydialog.h 2013-06-15 05:27:37 UTC (rev 4084) @@ -37,7 +37,7 @@ mmBudgetEntryDialog(); mmBudgetEntryDialog(mmCoreDB* core, int budgetYearID, int categID, int subcategID, - wxString categoryEstimate, wxString CategoryActual, + const wxString& categoryEstimate, const wxString& CategoryActual, wxWindow* parent, wxWindowID id = SYMBOL_BUDGETENTRYDIALOG_IDNAME, const wxString& caption = SYMBOL_BUDGETENTRYDIALOG_TITLE, const wxPoint& pos = SYMBOL_BUDGETENTRYDIALOG_POSITION, Modified: trunk/src/categdialog.cpp =================================================================== --- trunk/src/categdialog.cpp 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/categdialog.cpp 2013-06-15 05:27:37 UTC (rev 4084) @@ -442,7 +442,7 @@ treeCtrl_->SetItemText(selectedItemId_, text); } -wxTreeItemId mmCategDialog::getTreeItemFor(wxTreeItemId itemID, wxString itemText) +wxTreeItemId mmCategDialog::getTreeItemFor(wxTreeItemId itemID, const wxString& itemText) { wxTreeItemIdValue treeDummyValue; @@ -458,7 +458,7 @@ return catID; } -void mmCategDialog::setTreeSelection(wxString catName, wxString subCatName) +void mmCategDialog::setTreeSelection(const wxString& catName, const wxString& subCatName) { if ( !catName.IsEmpty() ) { Modified: trunk/src/categdialog.h =================================================================== --- trunk/src/categdialog.h 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/categdialog.h 2013-06-15 05:27:37 UTC (rev 4084) @@ -65,7 +65,7 @@ const wxSize& size = SYMBOL_CATEGDIALOG_SIZE, long style = SYMBOL_CATEGDIALOG_STYLE ); - void setTreeSelection(wxString catName, wxString subCatName); + void setTreeSelection(const wxString& catName, const wxString& subCatName); int getCategId() {return categID_;} int getSubCategId() {return subcategID_;} bool getExpandStatus() {return cbExpand_->IsChecked();} @@ -90,7 +90,7 @@ wxTreeItemId selectedItemId_; wxTextCtrl* textCtrl_; wxTreeItemId root_; - wxTreeItemId getTreeItemFor(wxTreeItemId itemID, wxString itemText); + wxTreeItemId getTreeItemFor(wxTreeItemId itemID, const wxString& itemText); wxButton* addButton_; wxButton* editButton_; wxButton* selectButton_; Modified: trunk/src/customreportdialog.cpp =================================================================== --- trunk/src/customreportdialog.cpp 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/customreportdialog.cpp 2013-06-15 05:27:37 UTC (rev 4084) @@ -45,7 +45,7 @@ EVT_TIMER(wxID_ANY, mmCustomSQLDialog::ShowCursorCoordinates) END_EVENT_TABLE() -mmCustomSQLDialog::mmCustomSQLDialog(CustomReportIndex* reportIndex, wxString customSqlReportSelectedItem, wxWindow* parent, +mmCustomSQLDialog::mmCustomSQLDialog(CustomReportIndex* reportIndex, const wxString& customSqlReportSelectedItem, wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style) : reportIndex_(reportIndex) , tcSourceTxtCtrl_() Modified: trunk/src/customreportdialog.h =================================================================== --- trunk/src/customreportdialog.h 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/customreportdialog.h 2013-06-15 05:27:37 UTC (rev 4084) @@ -39,7 +39,7 @@ mmCustomSQLDialog( ) {} virtual ~mmCustomSQLDialog(); - mmCustomSQLDialog(CustomReportIndex* reportIndex, wxString customSqlReportSelectedItem, wxWindow* parent, + mmCustomSQLDialog(CustomReportIndex* reportIndex, const wxString& customSqlReportSelectedItem, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_CUSTOMSQLDIALOG_TITLE, const wxPoint& pos = SYMBOL_CUSTOMSQLDIALOG_POSITION, Modified: trunk/src/customreportindex.cpp =================================================================== --- trunk/src/customreportindex.cpp 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/customreportindex.cpp 2013-06-15 05:27:37 UTC (rev 4084) @@ -181,7 +181,7 @@ currentReportFileType_ = ""; } -wxString CustomReportIndex::GetUserTitleSelection(wxString description) +wxString CustomReportIndex::GetUserTitleSelection(const wxString& description) { wxArrayString reportTitles; wxArrayString reportFileNames; @@ -219,7 +219,7 @@ return wxString() << "Custom_Report_" << selectionIndex; } -bool CustomReportIndex::GetSelectedTitleSelection(wxString titleIndex) +bool CustomReportIndex::GetSelectedTitleSelection(const wxString& titleIndex) { long index; wxStringTokenizer tk(titleIndex, "_"); // get the 3rd token 'Custom_Report_xx' @@ -245,7 +245,7 @@ return true; } -void CustomReportIndex::AddReportTitle(wxString reportTitle, bool updateIndex, wxString ReportFileName, bool isSub) +void CustomReportIndex::AddReportTitle(const wxString& reportTitle, bool updateIndex, const wxString& ReportFileName, bool isSub) { if (!reportTitle.IsEmpty()) { Modified: trunk/src/customreportindex.h =================================================================== --- trunk/src/customreportindex.h 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/customreportindex.h 2013-06-15 05:27:37 UTC (rev 4084) @@ -63,15 +63,15 @@ /** Return index of user selected report title as ID: Custom_Report_xxx. sets: validTitle_ currentReportTitle_ currentReportFileName_ currentReportFileIndex_ */ - wxString GetUserTitleSelection(wxString description = ":"); + wxString GetUserTitleSelection(const wxString& description = ":"); /** Gets the report title from the given ID: Custom_Report_xxx. sets: currentReportTitle_ currentReportFileName_ currentReportFileIndex_ */ - bool GetSelectedTitleSelection(wxString titleIndex); + bool GetSelectedTitleSelection(const wxString& titleIndex); /** Adds a new listing to the index file at the currentReportFileIndex_ call GetUserTitleSelection() or GetSelectedTitleSelection() first. */ - void AddReportTitle(wxString reportTitle, bool updateIndex, wxString ReportFileName = "", bool isSub = false); + void AddReportTitle(const wxString& reportTitle, bool updateIndex, const wxString& ReportFileName = "", bool isSub = false); /** Returns true if the report list is not empty */ bool ReportListHasItems(); Modified: trunk/src/mmex_settings.cpp =================================================================== --- trunk/src/mmex_settings.cpp 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/mmex_settings.cpp 2013-06-15 05:27:37 UTC (rev 4084) @@ -50,7 +50,7 @@ ****************************************************************************/ MMEX_IniRecord::MMEX_IniRecord(std::shared_ptr<wxSQLite3Database> ini_db , bool main_db - , wxString name) + , const wxString& name) : iniDb_(ini_db) , main_db_(main_db) , settingId_(-1) Modified: trunk/src/mmex_settings.h =================================================================== --- trunk/src/mmex_settings.h 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/mmex_settings.h 2013-06-15 05:27:37 UTC (rev 4084) @@ -38,7 +38,7 @@ /// Create a new record setting. MMEX_IniRecord(std::shared_ptr<wxSQLite3Database> ini_db , bool main_db - , wxString name); + , const wxString& name); /// Create an existing record setting. MMEX_IniRecord(std::shared_ptr<wxSQLite3Database> ini_db Modified: trunk/src/mmtransaction.cpp =================================================================== --- trunk/src/mmtransaction.cpp 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/mmtransaction.cpp 2013-06-15 05:27:37 UTC (rev 4084) @@ -950,7 +950,7 @@ return categ_id; } -int mmBankTransactionList::getLastUsedPayeeID(int accountID, wxString sType, int& categID, int& subcategID) const +int mmBankTransactionList::getLastUsedPayeeID(int accountID, const wxString& sType, int& categID, int& subcategID) const { int payee_id = -1; int index = transactions_.size() - 1; Modified: trunk/src/mmtransaction.h =================================================================== --- trunk/src/mmtransaction.h 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/mmtransaction.h 2013-06-15 05:27:37 UTC (rev 4084) @@ -195,7 +195,7 @@ double getReconciledBalance(int accountID, bool ignoreFuture = false) const; int countFollowupTransactions() const; int getLastUsedCategoryID(int accountID, int payeeID, const wxString sType, int& subcategID) const; - int getLastUsedPayeeID(int accountID, wxString sType, int& categID, int& subcategID) const; + int getLastUsedPayeeID(int accountID, const wxString& sType, int& categID, int& subcategID) const; wxArrayString getTransactionNumber(int accountID, const wxDateTime transaction_date) const; bool IsCategoryUsed(int iCatID, int iSubCatID, bool& bIncome, bool bIgnor_subcat = true) const; bool IsPayeeUsed(int iPayeeID) const; Modified: trunk/src/optionsdialog.cpp =================================================================== --- trunk/src/optionsdialog.cpp 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/optionsdialog.cpp 2013-06-15 05:27:37 UTC (rev 4084) @@ -86,7 +86,7 @@ return TRUE; } -wxArrayString mmOptionsDialog::viewAccountStrings(bool translated, wxString input_string, int& row_id_) +wxArrayString mmOptionsDialog::viewAccountStrings(bool translated, const wxString& input_string, int& row_id_) { wxArrayString itemChoiceViewAccountStrings; Modified: trunk/src/optionsdialog.h =================================================================== --- trunk/src/optionsdialog.h 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/optionsdialog.h 2013-06-15 05:27:37 UTC (rev 4084) @@ -104,8 +104,8 @@ wxString dateFormat_; wxString currentLanguage_; - wxArrayString viewAccountStrings(bool translated, wxString get_string_id); - wxArrayString viewAccountStrings(bool translated, wxString input_string, int& row_id); + wxArrayString viewAccountStrings(bool translated, const wxString& get_string_id); + wxArrayString viewAccountStrings(bool translated, const wxString& input_string, int& row_id); /// Dialog Creation - Used by constructor bool Create( wxWindow* parent, wxWindowID id = SYMBOL_MMOPTIONSDIALOG_IDNAME, Modified: trunk/src/recentfiles.h =================================================================== --- trunk/src/recentfiles.h 2013-06-15 03:03:13 UTC (rev 4083) +++ trunk/src/recentfiles.h 2013-06-15 05:27:37 UTC (rev 4084) @@ -29,9 +29,6 @@ class RecentDatabaseFiles { public: - // This constructor is for a more generic use of this class - //RecentDatabaseFiles(std::shared_ptr<MMEX_IniSettings> pIniSettings, int listSize, wxString dbIndexName); - // This constructor is for recent files list RecentDatabaseFiles(std::shared_ptr<MMEX_IniSettings> pIniSettings, wxMenu *menuRecentFiles); ~RecentDatabaseFiles(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-15 05:41:50
|
Revision: 4085 http://sourceforge.net/p/moneymanagerex/code/4085 Author: vomikan Date: 2013-06-15 05:41:47 +0000 (Sat, 15 Jun 2013) Log Message: ----------- fix for validator Modified Paths: -------------- trunk/src/maincurrencydialog.cpp trunk/src/transdialog.cpp Added Paths: ----------- trunk/src/validators.h Modified: trunk/src/maincurrencydialog.cpp =================================================================== --- trunk/src/maincurrencydialog.cpp 2013-06-15 05:27:37 UTC (rev 4084) +++ trunk/src/maincurrencydialog.cpp 2013-06-15 05:41:47 UTC (rev 4085) @@ -23,6 +23,7 @@ #include "util.h" #include "defs.h" #include "paths.h" +#include "validators.h" IMPLEMENT_DYNAMIC_CLASS( mmMainCurrencyDialog, wxDialog ) @@ -94,16 +95,17 @@ currencyListBox_->DeleteAllItems(); int baseCurrencyID = core_->currencyList_.GetBaseCurrencySettings(); + wxVector<wxVariant> data; for (const auto& currency: core_->currencyList_.currencies_) { int currencyID = currency->currencyID_; - wxVector<wxVariant> data; + data.clear(); data.push_back( wxVariant(baseCurrencyID == currencyID) ); data.push_back( wxVariant(currency->currencySymbol_) ); data.push_back( wxVariant(currency->currencyName_) ); data.push_back( wxVariant(wxString()<<currency->baseConv_) ); - currencyListBox_->AppendItem(data,(wxUIntPtr)currencyID); + currencyListBox_->AppendItem(data, (wxUIntPtr)currencyID); } } @@ -133,14 +135,13 @@ wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5); - currencyListBox_ = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxSize(-1, 200)); + currencyListBox_ = new wxDataViewListCtrl( this + , wxID_ANY, wxDefaultPosition, wxSize(-1, 200), -1, calcValidator()); currencyListBox_ ->AppendToggleColumn( ColName_[CURR_BASE], wxDATAVIEW_CELL_INERT, 30 ); currencyListBox_ ->AppendTextColumn( ColName_[CURR_SYMBOL], wxDATAVIEW_CELL_INERT, 60); currencyListBox_ ->AppendTextColumn( ColName_[CURR_NAME], wxDATAVIEW_CELL_INERT, 170); currencyListBox_ ->AppendTextColumn( ColName_[BASE_RATE], wxDATAVIEW_CELL_EDITABLE, 60 ); - wxFloatingPointValidator<double> validator(4, NULL , wxNUM_VAL_NO_TRAILING_ZEROES ); - currencyListBox_ ->SetValidator(validator); itemBoxSizer3->Add(currencyListBox_, 1, wxGROW|wxALL, 1); Modified: trunk/src/transdialog.cpp =================================================================== --- trunk/src/transdialog.cpp 2013-06-15 05:27:37 UTC (rev 4084) +++ trunk/src/transdialog.cpp 2013-06-15 05:41:47 UTC (rev 4085) @@ -26,6 +26,7 @@ #include "categdialog.h" #include "payeedialog.h" #include "splittransactionsdialog.h" +#include "validators.h" #include <wx/valnum.h> @@ -389,13 +390,13 @@ textAmount_ = new wxTextCtrl( this, ID_DIALOG_TRANS_TEXTAMOUNT, "", wxDefaultPosition, wxSize(110, -1), - wxALIGN_RIGHT|wxTE_PROCESS_ENTER, wxFloatingPointValidator<double>()); + wxALIGN_RIGHT|wxTE_PROCESS_ENTER, calcValidator()); textAmount_->Connect(ID_DIALOG_TRANS_TEXTAMOUNT, wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(mmTransDialog::onTextEntered), NULL, this); toTextAmount_ = new wxTextCtrl( this, ID_DIALOG_TRANS_TOTEXTAMOUNT, "", wxDefaultPosition, wxSize(110, -1), - wxALIGN_RIGHT|wxTE_PROCESS_ENTER, wxFloatingPointValidator<double>()); + wxALIGN_RIGHT|wxTE_PROCESS_ENTER, calcValidator()); toTextAmount_->Connect(ID_DIALOG_TRANS_TOTEXTAMOUNT, wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(mmTransDialog::onTextEntered), NULL, this); Added: trunk/src/validators.h =================================================================== --- trunk/src/validators.h (rev 0) +++ trunk/src/validators.h 2013-06-15 05:41:47 UTC (rev 4085) @@ -0,0 +1,16 @@ +// Validators ----------------------------------------------------- +class calcValidator : public wxTextValidator { +public: +calcValidator() : wxTextValidator(wxFILTER_INCLUDE_CHAR_LIST) +{ + wxArrayString list; + for (const auto& c : "1234567890.,(/+-*)") { + list.Add(c); + } + SetIncludes(list); +} + +}; + +// wxFloatingPointValidator<double> validator(4, NULL , wxNUM_VAL_NO_TRAILING_ZEROES ); + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-06-15 06:34:07
|
Revision: 4088 http://sourceforge.net/p/moneymanagerex/code/4088 Author: guanlisheng Date: 2013-06-15 06:34:01 +0000 (Sat, 15 Jun 2013) Log Message: ----------- mmListCtrl Modified Paths: -------------- trunk/src/assetspanel.cpp trunk/src/assetspanel.h trunk/src/billsdepositspanel.cpp trunk/src/billsdepositspanel.h trunk/src/mmpanelbase.h trunk/src/stockspanel.cpp trunk/src/stockspanel.h Modified: trunk/src/assetspanel.cpp =================================================================== --- trunk/src/assetspanel.cpp 2013-06-15 05:47:09 UTC (rev 4087) +++ trunk/src/assetspanel.cpp 2013-06-15 06:34:01 UTC (rev 4088) @@ -20,7 +20,7 @@ #include "constants.h" /*******************************************************/ -BEGIN_EVENT_TABLE(mmAssetsListCtrl, wxListCtrl) +BEGIN_EVENT_TABLE(mmAssetsListCtrl, mmListCtrl) EVT_LIST_ITEM_ACTIVATED(IDC_PANEL_STOCKS_LISTCTRL, mmAssetsListCtrl::OnListItemActivated) EVT_RIGHT_DOWN(mmAssetsListCtrl::OnMouseRightClick) EVT_LEFT_DOWN(mmAssetsListCtrl::OnMouseLeftClick) @@ -40,9 +40,7 @@ mmAssetsListCtrl::mmAssetsListCtrl(mmAssetsPanel* cp, wxWindow *parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style) -: wxListCtrl(parent, id, pos, size, style) -, m_attr1(*wxBLACK, mmColors::listAlternativeColor0, wxNullFont) -, m_attr2(*wxBLACK, mmColors::listAlternativeColor1, wxNullFont) +: mmListCtrl(parent, id, pos, size, style) , cp_(cp) , selectedIndex_(-1) {} @@ -115,12 +113,6 @@ return image_id; } -wxListItemAttr* mmAssetsListCtrl::OnGetItemAttr(long item) const -{ - /* Returns the alternating background pattern */ - return item % 2 ? (wxListItemAttr *)&m_attr2 : (wxListItemAttr *)&m_attr1; -} - void mmAssetsListCtrl::OnListKeyDown(wxListEvent& event) { if (event.GetKeyCode() == WXK_DELETE) Modified: trunk/src/assetspanel.h =================================================================== --- trunk/src/assetspanel.h 2013-06-15 05:47:09 UTC (rev 4087) +++ trunk/src/assetspanel.h 2013-06-15 06:34:01 UTC (rev 4088) @@ -18,12 +18,11 @@ #include "mmpanelbase.h" #include "db/assets.h" -class wxListCtrl; class wxListEvent; class mmAssetsPanel; /* Custom ListCtrl class that implements virtual LC style */ -class mmAssetsListCtrl: public wxListCtrl +class mmAssetsListCtrl: public mmListCtrl { DECLARE_NO_COPY_CLASS(mmAssetsListCtrl) DECLARE_EVENT_TABLE() @@ -41,8 +40,6 @@ void doRefreshItems(int trx_id = -1); private: - wxListItemAttr m_attr1; // style1 - wxListItemAttr m_attr2; // style2 mmAssetsPanel* cp_; long selectedIndex_; int m_selected_col; @@ -51,7 +48,6 @@ /* required overrides for virtual style list control */ virtual wxString OnGetItemText(long item, long column) const; virtual int OnGetItemImage(long item) const; - virtual wxListItemAttr *OnGetItemAttr(long item) const; void OnMouseRightClick(wxMouseEvent& event); void OnMouseLeftClick(wxMouseEvent& event); Modified: trunk/src/billsdepositspanel.cpp =================================================================== --- trunk/src/billsdepositspanel.cpp 2013-06-15 05:47:09 UTC (rev 4087) +++ trunk/src/billsdepositspanel.cpp 2013-06-15 06:34:01 UTC (rev 4088) @@ -31,7 +31,7 @@ EVT_BUTTON(wxID_IGNORE, mmBillsDepositsPanel::OnSkipBDTransaction) END_EVENT_TABLE() /*******************************************************/ -BEGIN_EVENT_TABLE(billsDepositsListCtrl, wxListCtrl) +BEGIN_EVENT_TABLE(billsDepositsListCtrl, mmListCtrl) EVT_LIST_ITEM_ACTIVATED(ID_PANEL_BD_LISTCTRL, billsDepositsListCtrl::OnListItemActivated) EVT_LIST_ITEM_RIGHT_CLICK(ID_PANEL_BD_LISTCTRL, billsDepositsListCtrl::OnItemRightClick) EVT_LIST_ITEM_SELECTED(ID_PANEL_BD_LISTCTRL, billsDepositsListCtrl::OnListItemSelected) @@ -452,12 +452,6 @@ return -1; } -wxListItemAttr* billsDepositsListCtrl::OnGetItemAttr(long item) const -{ - /* Returns the alternating background pattern */ - return item % 2 ? (wxListItemAttr *)&attr2_ : (wxListItemAttr *)&attr1_; -} - void billsDepositsListCtrl::OnListKeyDown(wxListEvent& event) { switch ( event.GetKeyCode() ) Modified: trunk/src/billsdepositspanel.h =================================================================== --- trunk/src/billsdepositspanel.h 2013-06-15 05:47:09 UTC (rev 4087) +++ trunk/src/billsdepositspanel.h 2013-06-15 06:34:01 UTC (rev 4088) @@ -23,12 +23,11 @@ #include "mmpanelbase.h" #include "util.h" -class wxListCtrl; class wxListEvent; class mmBillsDepositsPanel; /* Custom ListCtrl class that implements virtual LC style */ -class billsDepositsListCtrl: public wxListCtrl +class billsDepositsListCtrl: public mmListCtrl { DECLARE_NO_COPY_CLASS(billsDepositsListCtrl) DECLARE_EVENT_TABLE() @@ -37,9 +36,7 @@ billsDepositsListCtrl(mmBillsDepositsPanel* cp, wxWindow *parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style) - : wxListCtrl(parent, id, pos, size, style), - attr1_(mmColors::listBorderColor, mmColors::listAlternativeColor0, wxNullFont), - attr2_(mmColors::listBorderColor, mmColors::listAlternativeColor1, wxNullFont), + : mmListCtrl(parent, id, pos, size, style), cp_(cp), selectedIndex_(-1) {} @@ -54,7 +51,6 @@ /* required overrides for virtual style list control */ virtual wxString OnGetItemText(long item, long column) const; virtual int OnGetItemImage(long item) const; - virtual wxListItemAttr *OnGetItemAttr(long item) const; void OnItemRightClick(wxListEvent& event); void OnListItemActivated(wxListEvent& event); @@ -67,8 +63,6 @@ void refreshVisualList(int selected_index = -1); - wxListItemAttr attr1_; // style1 - wxListItemAttr attr2_; // style2 mmBillsDepositsPanel* cp_; long selectedIndex_; }; Modified: trunk/src/mmpanelbase.h =================================================================== --- trunk/src/mmpanelbase.h 2013-06-15 05:47:09 UTC (rev 4087) +++ trunk/src/mmpanelbase.h 2013-06-15 06:34:01 UTC (rev 4088) @@ -20,8 +20,11 @@ #define _MM_EX_PANELBASE_H_ #include "mmcoredb.h" +#include "util.h" +#include <wx/listctrl.h> //---------------------------------------------------------------------------- class wxSQLite3Database; +class wxListItemAttr; struct mmHolderBase { @@ -30,6 +33,31 @@ double value_; }; +class mmListCtrl: public wxListCtrl +{ +public: + mmListCtrl(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_REPORT): wxListCtrl(parent, winid, pos, size, style) + , attr1_(new wxListItemAttr(mmColors::listBorderColor, mmColors::listAlternativeColor0, wxNullFont)) + , attr2_(new wxListItemAttr(mmColors::listBorderColor, mmColors::listAlternativeColor1, wxNullFont)) + {} + virtual ~mmListCtrl() + { + if (attr1_) delete attr1_; + if (attr2_) delete attr2_; + } +public: + wxListItemAttr *attr1_, *attr2_; // style1 +public: + virtual wxListItemAttr* OnGetItemAttr(long row) const + { + return row % 2 ? attr2_ : attr1_; + } +}; + class mmPanelBase : public wxPanel { public: Modified: trunk/src/stockspanel.cpp =================================================================== --- trunk/src/stockspanel.cpp 2013-06-15 05:47:09 UTC (rev 4087) +++ trunk/src/stockspanel.cpp 2013-06-15 06:34:01 UTC (rev 4088) @@ -23,7 +23,7 @@ #include "util.h" /*******************************************************/ -BEGIN_EVENT_TABLE(StocksListCtrl, wxListCtrl) +BEGIN_EVENT_TABLE(StocksListCtrl, mmListCtrl) EVT_LIST_ITEM_ACTIVATED(ID_PANEL_STOCKS_LISTCTRL, StocksListCtrl::OnListItemActivated) EVT_LIST_ITEM_RIGHT_CLICK(ID_PANEL_STOCKS_LISTCTRL, StocksListCtrl::OnItemRightClick) EVT_LIST_ITEM_SELECTED(ID_PANEL_STOCKS_LISTCTRL, StocksListCtrl::OnListItemSelected) @@ -41,9 +41,7 @@ StocksListCtrl::StocksListCtrl(mmStocksPanel* cp, wxWindow *parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style) -: wxListCtrl(parent, id, pos, size, style) -, attr1_(mmColors::listBorderColor, mmColors::listAlternativeColor0, wxNullFont) -, attr2_(mmColors::listBorderColor, mmColors::listAlternativeColor1, wxNullFont) +: mmListCtrl(parent, id, pos, size, style) , cp_(cp) , selectedIndex_(-1) {} @@ -98,12 +96,6 @@ return 1; } -wxListItemAttr* StocksListCtrl::OnGetItemAttr(long item) const -{ - /* Returns the alternating background pattern */ - return item % 2 ? (wxListItemAttr *)&attr2_ : (wxListItemAttr *)&attr1_; -} - void StocksListCtrl::OnListKeyDown(wxListEvent& event) { switch (event.GetKeyCode()) Modified: trunk/src/stockspanel.h =================================================================== --- trunk/src/stockspanel.h 2013-06-15 05:47:09 UTC (rev 4087) +++ trunk/src/stockspanel.h 2013-06-15 06:34:01 UTC (rev 4088) @@ -23,12 +23,11 @@ #include "guiid.h" #include <wx/tglbtn.h> -class wxListCtrl; class wxListEvent; class mmStocksPanel; /* Custom ListCtrl class that implements virtual LC style */ -class StocksListCtrl: public wxListCtrl +class StocksListCtrl: public mmListCtrl { DECLARE_NO_COPY_CLASS(StocksListCtrl) DECLARE_EVENT_TABLE() @@ -41,7 +40,6 @@ /* required overrides for virtual style list control */ virtual wxString OnGetItemText(long item, long column) const; virtual int OnGetItemImage(long item) const; - virtual wxListItemAttr *OnGetItemAttr(long item) const; void OnItemRightClick(wxListEvent& event); void OnListItemActivated(wxListEvent& event); @@ -63,8 +61,6 @@ long get_selectedIndex() {return selectedIndex_;} private: - wxListItemAttr attr1_; // style1 - wxListItemAttr attr2_; // style2 mmStocksPanel* cp_; long selectedIndex_; int m_selected_col; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-15 07:41:08
|
Revision: 4090 http://sourceforge.net/p/moneymanagerex/code/4090 Author: vomikan Date: 2013-06-15 07:41:02 +0000 (Sat, 15 Jun 2013) Log Message: ----------- validators replacement Modified Paths: -------------- trunk/src/assetdialog.cpp trunk/src/billsdepositsdialog.cpp trunk/src/currencydialog.cpp trunk/src/filtertransdialog.cpp trunk/src/maincurrencydialog.cpp trunk/src/mmcheckingpanel.cpp trunk/src/splitdetailsdialog.cpp trunk/src/stockdialog.cpp trunk/src/transdialog.cpp trunk/src/validators.h Modified: trunk/src/assetdialog.cpp =================================================================== --- trunk/src/assetdialog.cpp 2013-06-15 06:50:39 UTC (rev 4089) +++ trunk/src/assetdialog.cpp 2013-06-15 07:41:02 UTC (rev 4090) @@ -3,12 +3,12 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -17,13 +17,14 @@ #include "assetdialog.h" #include "paths.h" #include "mmCurrencyFormatter.h" +#include "validators.h" #include <wx/valnum.h> namespace { -enum -{ +enum +{ IDC_COMBO_TYPE = wxID_HIGHEST + 1, IDC_NOTES, }; @@ -63,7 +64,7 @@ { SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); - if (!wxDialog::Create(parent, id, caption, pos, size, style)) + if (!wxDialog::Create(parent, id, caption, pos, size, style)) return false; CreateControls(); @@ -71,10 +72,10 @@ GetSizer()->SetSizeHints(this); SetIcon(mmex::getProgramIcon()); - + if (m_edit) dataToControls(); - else + else enableDisableRate(false); Centre(); @@ -103,7 +104,7 @@ } void mmAssetDialog::CreateControls() -{ +{ wxSizerFlags flags, flagsExpand; flags.Align(wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL).Border(wxALL, 5); flagsExpand.Align(wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL).Border(wxALL, 5).Expand(); @@ -115,11 +116,11 @@ itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(this, wxID_ANY, _("Asset Details")); - wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, + wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL); itemBoxSizer3->Add(itemStaticBoxSizer4, flags); - wxPanel* itemPanel5 = new wxPanel( this, wxID_STATIC, wxDefaultPosition, + wxPanel* itemPanel5 = new wxPanel( this, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); itemStaticBoxSizer4->Add(itemPanel5, flags); @@ -133,9 +134,9 @@ itemFlexGridSizer6->Add(m_assetName, flagsExpand); itemFlexGridSizer6->Add(new wxStaticText( itemPanel5, wxID_STATIC, _("Date")), flags); - - m_dpc = new wxDatePickerCtrl( itemPanel5, wxID_ANY, wxDefaultDateTime, - wxDefaultPosition, wxSize(120, -1), wxDP_DROPDOWN|wxDP_SHOWCENTURY); + + m_dpc = new wxDatePickerCtrl( itemPanel5, wxID_ANY, wxDefaultDateTime, + wxDefaultPosition, wxSize(120, -1), wxDP_DROPDOWN|wxDP_SHOWCENTURY); itemFlexGridSizer6->Add(m_dpc, flags); m_dpc->SetToolTip(_("Specify the date of purchase of asset")); @@ -147,12 +148,14 @@ m_assetType->SetToolTip(_("Select type of asset")); m_assetType->SetSelection(TAssetEntry::TYPE_PROPERTY); - itemFlexGridSizer6->Add(m_assetType, 0, + itemFlexGridSizer6->Add(m_assetType, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5); itemFlexGridSizer6->Add(new wxStaticText( itemPanel5, wxID_STATIC, _("Value")), flags); - m_value = new wxTextCtrl( itemPanel5, wxID_STATIC, wxGetEmptyString(), wxDefaultPosition, wxSize(150,-1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER , wxFloatingPointValidator<double>() ); + m_value = new wxTextCtrl( itemPanel5, wxID_STATIC, wxGetEmptyString() + , wxDefaultPosition, wxSize(150,-1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER + , mmDoubleValidator2() ); m_value->SetToolTip(_("Enter the current value of the asset")); itemFlexGridSizer6->Add(m_value, flags); @@ -169,7 +172,9 @@ m_valueChangeRateLabel = new wxStaticText( itemPanel5, wxID_STATIC, _("% Rate")); itemFlexGridSizer6->Add(m_valueChangeRateLabel, flags); - m_valueChangeRate = new wxTextCtrl( itemPanel5, wxID_STATIC, wxGetEmptyString(), wxDefaultPosition, wxSize(150,-1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER , wxFloatingPointValidator<double>() ); + m_valueChangeRate = new wxTextCtrl( itemPanel5, wxID_STATIC, wxGetEmptyString() + , wxDefaultPosition, wxSize(150,-1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER + , mmDoubleValidator2() ); m_valueChangeRate->SetToolTip(_("Enter the rate at which the asset changes its value in % per year")); itemFlexGridSizer6->Add(m_valueChangeRate, flags); enableDisableRate(false); @@ -211,7 +216,7 @@ m_valueChangeRate->Enable(true); m_valueChangeRateLabel->Enable(true); } - else + else { //m_valueChangeRate->SetValue("0"); m_valueChangeRate->SetEditable(false); @@ -279,7 +284,7 @@ pAssetEntry_->Update(core_->db_.get()); else assetID_ = assetsPanel_->AssetList().AddEntry(pAssetEntry_); - + EndModal(wxID_OK); } @@ -287,7 +292,7 @@ { if (assetRichText) return; - else + else EndModal(wxID_CANCEL); } Modified: trunk/src/billsdepositsdialog.cpp =================================================================== --- trunk/src/billsdepositsdialog.cpp 2013-06-15 06:50:39 UTC (rev 4089) +++ trunk/src/billsdepositsdialog.cpp 2013-06-15 07:41:02 UTC (rev 4090) @@ -26,6 +26,7 @@ #include "categdialog.h" #include "payeedialog.h" #include "splittransactionsdialog.h" +#include "validators.h" #include <wx/valnum.h> IMPLEMENT_DYNAMIC_CLASS( mmBDDialog, wxDialog ) @@ -364,7 +365,7 @@ itemFlexGridSizer5->Add(staticTimesRepeat_, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 0); textNumRepeats_ = new wxTextCtrl( this, ID_DIALOG_BD_TEXTCTRL_NUM_TIMES, "", - wxDefaultPosition, wxSize(110, -1), 0, wxIntegerValidator<int>() ); + wxDefaultPosition, wxSize(110, -1), 0, wxIntegerValidator<int>() ); itemFlexGridSizer5->Add(textNumRepeats_, flags); textNumRepeats_->SetMaxLength(12); setRepeatDetails(); @@ -452,12 +453,14 @@ wxStaticText* staticTextAmount = new wxStaticText( transactionPanel, wxID_STATIC, _("Amount")); - textAmount_ = new wxTextCtrl( transactionPanel, ID_DIALOG_TRANS_TEXTAMOUNT, "", - wxDefaultPosition, wxSize(110, -1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER , wxFloatingPointValidator<double>() ); + textAmount_ = new wxTextCtrl( transactionPanel, ID_DIALOG_TRANS_TEXTAMOUNT, "" + , wxDefaultPosition, wxSize(110, -1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER + , mmDoubleValidator2() ); textAmount_->SetToolTip(amountNormalTip_); - toTextAmount_ = new wxTextCtrl( transactionPanel, ID_DIALOG_TRANS_TEXTAMOUNT, "", - wxDefaultPosition, wxSize(110, -1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER , wxFloatingPointValidator<double>() ); + toTextAmount_ = new wxTextCtrl( transactionPanel, ID_DIALOG_TRANS_TEXTAMOUNT, "" + , wxDefaultPosition, wxSize(110, -1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER + , mmDoubleValidator2() ); toTextAmount_->SetToolTip(_("Specify the transfer amount in the To Account")); wxBoxSizer* amountSizer = new wxBoxSizer(wxHORIZONTAL); Modified: trunk/src/currencydialog.cpp =================================================================== --- trunk/src/currencydialog.cpp 2013-06-15 06:50:39 UTC (rev 4089) +++ trunk/src/currencydialog.cpp 2013-06-15 07:41:02 UTC (rev 4090) @@ -22,6 +22,7 @@ #include "mmCurrencyFormatter.h" #include "defs.h" #include "paths.h" +#include "validators.h" #include <wx/combobox.h> #include <wx/valnum.h> @@ -210,15 +211,13 @@ itemFlexGridSizer3->Add(new wxStaticText( this, wxID_STATIC, _("Scale")), flags); scaleTx_ = new wxTextCtrl( this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize - , wxALIGN_RIGHT|wxTE_PROCESS_ENTER , wxIntegerValidator<unsigned int>() ); + , wxALIGN_RIGHT|wxTE_PROCESS_ENTER , mmDoubleValidator4() ); itemFlexGridSizer3->Add(scaleTx_, flagsExpand); - wxFloatingPointValidator<double> validator(4, &convRate_ , wxNUM_VAL_NO_TRAILING_ZEROES ); - validator.SetRange(0, 10000); itemFlexGridSizer3->Add(new wxStaticText( this, wxID_STATIC, _("Conversion to Base Rate")), flags); baseConvRate_ = new wxTextCtrl( this, ID_DIALOG_CURRENCY_TEXT_BASECONVRATE, "" , wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxTE_PROCESS_ENTER - , validator ); + , mmDoubleValidator4() ); itemFlexGridSizer3->Add(baseConvRate_, flagsExpand); baseConvRate_ ->SetToolTip(_("Other currency conversion rate. Set Base Currency to 1.")); Modified: trunk/src/filtertransdialog.cpp =================================================================== --- trunk/src/filtertransdialog.cpp 2013-06-15 06:50:39 UTC (rev 4089) +++ trunk/src/filtertransdialog.cpp 2013-06-15 07:41:02 UTC (rev 4090) @@ -20,6 +20,7 @@ #include "mmCurrencyFormatter.h" #include "categdialog.h" #include "paths.h" +#include "validators.h" #include <wx/valnum.h> IMPLEMENT_DYNAMIC_CLASS( mmFilterTransactionsDialog, wxDialog ) @@ -266,10 +267,12 @@ wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); itemPanelSizer->Add(amountRangeCheckBox_, flags); - amountMinEdit_ = new wxTextCtrl( itemPanel, wxID_ANY, "", - wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxTE_PROCESS_ENTER , wxFloatingPointValidator<double>() ); - amountMaxEdit_ = new wxTextCtrl( itemPanel, wxID_ANY, "", - wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxTE_PROCESS_ENTER , wxFloatingPointValidator<double>() ); + amountMinEdit_ = new wxTextCtrl( itemPanel, wxID_ANY, "" + , wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxTE_PROCESS_ENTER + , mmDoubleValidator2() ); + amountMaxEdit_ = new wxTextCtrl( itemPanel, wxID_ANY, "" + , wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxTE_PROCESS_ENTER + , mmDoubleValidator2() ); wxBoxSizer* amountSizer = new wxBoxSizer(wxHORIZONTAL); amountSizer->Add(amountMinEdit_, flagsExpand); Modified: trunk/src/maincurrencydialog.cpp =================================================================== --- trunk/src/maincurrencydialog.cpp 2013-06-15 06:50:39 UTC (rev 4089) +++ trunk/src/maincurrencydialog.cpp 2013-06-15 07:41:02 UTC (rev 4090) @@ -135,8 +135,9 @@ wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5); + //TODO:provide proper style and fix validator (does not working) currencyListBox_ = new wxDataViewListCtrl( this - , wxID_ANY, wxDefaultPosition, wxSize(-1, 200), -1, calcValidator()); + , wxID_ANY, wxDefaultPosition, wxSize(-1, 200), -1, mmDoubleValidator4()); currencyListBox_ ->AppendToggleColumn( ColName_[CURR_BASE], wxDATAVIEW_CELL_INERT, 30 ); currencyListBox_ ->AppendTextColumn( ColName_[CURR_SYMBOL], wxDATAVIEW_CELL_INERT, 60); Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-15 06:50:39 UTC (rev 4089) +++ trunk/src/mmcheckingpanel.cpp 2013-06-15 07:41:02 UTC (rev 4090) @@ -22,6 +22,7 @@ #include "mmex.h" #include "constants.h" #include "mmCurrencyFormatter.h" +#include "validators.h" //---------------------------------------------------------------------------- #include <wx/srchctrl.h> #include <algorithm> Modified: trunk/src/splitdetailsdialog.cpp =================================================================== --- trunk/src/splitdetailsdialog.cpp 2013-06-15 06:50:39 UTC (rev 4089) +++ trunk/src/splitdetailsdialog.cpp 2013-06-15 07:41:02 UTC (rev 4090) @@ -15,6 +15,7 @@ #include "util.h" #include "mmCurrencyFormatter.h" #include "constants.h" +#include "validators.h" #include <wx/valnum.h> @@ -123,7 +124,7 @@ textAmount_ = new wxTextCtrl( itemPanel7, ID_TEXTCTRLAMOUNT, "" , wxDefaultPosition, wxSize(110,-1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER - , wxFloatingPointValidator<double>()); + , mmDoubleValidator2()); controlSizer->Add(textAmount_, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0); wxStaticText* staticTextCategory = new wxStaticText( itemPanel7, wxID_STATIC, _("Category")); Modified: trunk/src/stockdialog.cpp =================================================================== --- trunk/src/stockdialog.cpp 2013-06-15 06:50:39 UTC (rev 4089) +++ trunk/src/stockdialog.cpp 2013-06-15 07:41:02 UTC (rev 4090) @@ -21,6 +21,7 @@ #include "paths.h" #include "mmCurrencyFormatter.h" #include "util.h" +#include "validators.h" #include <wx/valnum.h> IMPLEMENT_DYNAMIC_CLASS( mmStockDialog, wxDialog ) @@ -154,28 +155,28 @@ itemFlexGridSizer6->Add(new wxStaticText( itemPanel5, wxID_STATIC, _("Number of Shares")), flags); numShares_ = new wxTextCtrl( itemPanel5, ID_TEXTCTRL_NUMBER_SHARES, "", - wxDefaultPosition, wxSize(150, -1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER , wxFloatingPointValidator<double>() ); + wxDefaultPosition, wxSize(150, -1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER , mmDoubleValidator4() ); itemFlexGridSizer6->Add(numShares_, flags); numShares_->SetToolTip(_("Enter number of shares held")); itemFlexGridSizer6->Add(new wxStaticText( itemPanel5, wxID_STATIC, _("Purchase Price")), flags); purchasePrice_ = new wxTextCtrl( itemPanel5, ID_TEXTCTRL_STOCK_PP, "", - wxDefaultPosition, wxSize(150, -1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER , wxFloatingPointValidator<double>() ); + wxDefaultPosition, wxSize(150, -1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER , mmDoubleValidator4() ); itemFlexGridSizer6->Add(purchasePrice_, flags); purchasePrice_->SetToolTip(_("Enter purchase price for each stock")); itemFlexGridSizer6->Add(new wxStaticText( itemPanel5, wxID_STATIC, _("Current Price")), flags); currentPrice_ = new wxTextCtrl( itemPanel5, ID_TEXTCTRL_STOCK_CP, "", - wxDefaultPosition, wxSize(150, -1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER , wxFloatingPointValidator<double>() ); + wxDefaultPosition, wxSize(150, -1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER , mmDoubleValidator4() ); itemFlexGridSizer6->Add(currentPrice_, flags); currentPrice_->SetToolTip(_("Enter current stock price")); itemFlexGridSizer6->Add(new wxStaticText( itemPanel5, wxID_STATIC, _("Commission")), flags); commission_ = new wxTextCtrl( itemPanel5, ID_TEXTCTRL_STOCK_COMMISSION, "0", - wxDefaultPosition, wxSize(150, -1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER , wxFloatingPointValidator<double>() ); + wxDefaultPosition, wxSize(150, -1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER , mmDoubleValidator4() ); itemFlexGridSizer6->Add(commission_, flags); commission_->SetToolTip(_("Enter any commission paid")); Modified: trunk/src/transdialog.cpp =================================================================== --- trunk/src/transdialog.cpp 2013-06-15 06:50:39 UTC (rev 4089) +++ trunk/src/transdialog.cpp 2013-06-15 07:41:02 UTC (rev 4090) @@ -146,9 +146,9 @@ toTransAmount_ = pBankTransaction_->toAmt_; advancedToTransAmountSet_ = (transAmount_ != toTransAmount_); - dispAmount = CurrencyFormatter::float2String(transAmount_); + dispAmount = CurrencyFormatter::float2String(transAmount_); textAmount_->SetValue(dispAmount); - dispAmount = CurrencyFormatter::float2String(toTransAmount_); + dispAmount = CurrencyFormatter::float2String(toTransAmount_); toTextAmount_->SetValue(dispAmount); } else @@ -390,13 +390,13 @@ textAmount_ = new wxTextCtrl( this, ID_DIALOG_TRANS_TEXTAMOUNT, "", wxDefaultPosition, wxSize(110, -1), - wxALIGN_RIGHT|wxTE_PROCESS_ENTER, calcValidator()); + wxALIGN_RIGHT|wxTE_PROCESS_ENTER, mmCalcValidator()); textAmount_->Connect(ID_DIALOG_TRANS_TEXTAMOUNT, wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(mmTransDialog::onTextEntered), NULL, this); toTextAmount_ = new wxTextCtrl( this, ID_DIALOG_TRANS_TOTEXTAMOUNT, "", wxDefaultPosition, wxSize(110, -1), - wxALIGN_RIGHT|wxTE_PROCESS_ENTER, calcValidator()); + wxALIGN_RIGHT|wxTE_PROCESS_ENTER, mmCalcValidator()); toTextAmount_->Connect(ID_DIALOG_TRANS_TOTEXTAMOUNT, wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(mmTransDialog::onTextEntered), NULL, this); @@ -678,7 +678,7 @@ toTransAmount_ = transAmount_; } - amountStr = CurrencyFormatter::float2String(toTransAmount_); + amountStr = CurrencyFormatter::float2String(toTransAmount_); toTextAmount_->SetValue(amountStr); SetTransferControls(); @@ -979,7 +979,7 @@ } split_->removeSplitByIndex(0); } - wxString dispAmount = CurrencyFormatter::float2String(transAmount_); + wxString dispAmount = CurrencyFormatter::float2String(transAmount_); textAmount_->SetValue(dispAmount); } SetSplitState(); @@ -1111,7 +1111,7 @@ double amount = split_->getTotalSplits(); if (transaction_type_->GetSelection() == DEF_TRANSFER && amount < 0) amount = - amount; - wxString dispAmount = CurrencyFormatter::float2String(amount); + wxString dispAmount = CurrencyFormatter::float2String(amount); textAmount_->SetValue(dispAmount); } } Modified: trunk/src/validators.h =================================================================== --- trunk/src/validators.h 2013-06-15 06:50:39 UTC (rev 4089) +++ trunk/src/validators.h 2013-06-15 07:41:02 UTC (rev 4090) @@ -1,16 +1,32 @@ // Validators ----------------------------------------------------- -class calcValidator : public wxTextValidator { +class mmCalcValidator : public wxTextValidator { public: -calcValidator() : wxTextValidator(wxFILTER_INCLUDE_CHAR_LIST) + mmCalcValidator() : wxTextValidator(wxFILTER_INCLUDE_CHAR_LIST) + { + wxArrayString list; + for (const auto& c : "1234567890.,(/+-*)") { + list.Add(c); + } + SetIncludes(list); + } + +}; + +class mmDoubleValidator2: public wxFloatingPointValidator<double> { - wxArrayString list; - for (const auto& c : "1234567890.,(/+-*)") { - list.Add(c); +public: + mmDoubleValidator2(): wxFloatingPointValidator<double>(2, NULL, wxNUM_VAL_NO_TRAILING_ZEROES) + { + this->SetRange(0, 100000000); } - SetIncludes(list); -} +}; +class mmDoubleValidator4: public wxFloatingPointValidator<double> +{ +public: + mmDoubleValidator4(): wxFloatingPointValidator<double>(4, NULL, wxNUM_VAL_NO_TRAILING_ZEROES) + { + this->SetRange(0, 100000000); + } }; -// wxFloatingPointValidator<double> validator(4, NULL , wxNUM_VAL_NO_TRAILING_ZEROES ); - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-15 13:20:36
|
Revision: 4093 http://sourceforge.net/p/moneymanagerex/code/4093 Author: vomikan Date: 2013-06-15 13:20:33 +0000 (Sat, 15 Jun 2013) Log Message: ----------- reogranization std::shared_ptr removal Modified Paths: -------------- trunk/src/billsdepositsdialog.cpp trunk/src/mmcheckingpanel.cpp trunk/src/mmcoredb.cpp trunk/src/mmex.cpp trunk/src/mmtransaction.cpp trunk/src/mmtransaction.h trunk/src/qif_export.cpp trunk/src/qif_import.cpp trunk/src/transdialog.cpp trunk/src/univcsvdialog.cpp Modified: trunk/src/billsdepositsdialog.cpp =================================================================== --- trunk/src/billsdepositsdialog.cpp 2013-06-15 11:47:12 UTC (rev 4092) +++ trunk/src/billsdepositsdialog.cpp 2013-06-15 13:20:33 UTC (rev 4093) @@ -1064,8 +1064,8 @@ // repeats now hold extra info. Need to get repeats from dialog selection if ( (itemRepeats_->GetSelection() < 11) || (itemRepeats_->GetSelection() > 14) || (numRepeats > 0) ) { - std::shared_ptr<mmBankTransaction> pTransaction; - std::shared_ptr<mmBankTransaction> pTemp(new mmBankTransaction(core_->db_)); + mmBankTransaction* pTransaction; + mmBankTransaction* pTemp(new mmBankTransaction(core_)); pTransaction = pTemp; std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(fromAccountID); @@ -1084,7 +1084,7 @@ pTransaction->toAmt_ = toTransAmount_; *pTransaction->splitEntries_.get() = *split_.get(); - pTransaction->updateAllData(core_, fromAccountID, pCurrencyPtr); + //pTransaction->updateAllData(core_, fromAccountID, pCurrencyPtr); core_->bTransactionList_.addTransaction(pTransaction); } mmDBWrapper::completeBDInSeries(core_->db_.get(), bdID_); Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-15 11:47:12 UTC (rev 4092) +++ trunk/src/mmcheckingpanel.cpp 2013-06-15 13:20:33 UTC (rev 4093) @@ -382,8 +382,29 @@ } event.Skip(); } + //---------------------------------------------------------------------------- +void mmCheckingPanel::initVirtualListControl(int trans_id) +{ + //Initialization + core_->bTransactionList_.LoadAccountTransactions(m_AccountID); + + filteredBalance_ = 0.0; + // clear everything + m_trans = core_->bTransactionList_.accountTransactions_; + m_listCtrlAccount->DeleteAllItems(); + + // decide whether top or down icon needs to be shown + m_listCtrlAccount->setColumnImage(g_sortcol, g_asc ? ICON_ASC : ICON_DESC); + sortTable(); + m_listCtrlAccount->SetItemCount(m_trans.size()); + + setAccountSummary(); +} + +//---------------------------------------------------------------------------- + void mmCheckingPanel::CreateControls() { wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxVERTICAL); @@ -546,8 +567,38 @@ //Show tips when no any transaction selected showTips(); } + //---------------------------------------------------------------------------- +void mmCheckingPanel::setAccountSummary() +{ + std::shared_ptr<mmAccount> pAccount = core_->accountList_.GetAccountSharedPtr(m_AccountID); + //std::shared_ptr<mmCurrency> pCurrency = pAccount->currency_; + //wxASSERT(pCurrency); + //pCurrency->loadCurrencySettings(); + header_text_->SetLabel(wxString::Format(_("Account View : %s"), pAccount->name_)); + double checking_bal = core_->bTransactionList_.getBalance(m_AccountID); + double reconciledBal = core_->bTransactionList_.getReconciledBalance(m_AccountID); + double acctInitBalance = core_->accountList_.GetAccountSharedPtr(m_AccountID)->initialBalance_; + + bool show_displayed_balance_ = (transFilterActive_ || (currentView_ != VIEW_TRANS_ALL_STR)); + wxStaticText* header = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_BALHEADER1); + header->SetLabel(CurrencyFormatter::float2Money(checking_bal + acctInitBalance)); + header = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_BALHEADER2); + header->SetLabel(CurrencyFormatter::float2Money(reconciledBal + acctInitBalance)); + header = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_BALHEADER3); + header->SetLabel(CurrencyFormatter::float2Money(checking_bal - reconciledBal)); + header = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_BALHEADER4); + header->SetLabel(show_displayed_balance_ + ? _("Displayed Bal: ") + : " "); + header = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_BALHEADER5); + header->SetLabel(show_displayed_balance_ + ? CurrencyFormatter::float2Money(filteredBalance_) + : " "); +} + +//---------------------------------------------------------------------------- void mmCheckingPanel::enableEditDeleteButtons(bool en) { if (m_listCtrlAccount->GetSelectedItemCount()>1) @@ -710,183 +761,7 @@ info_panel_->SetLabel(Tips(TIPS_BANKS)); } //---------------------------------------------------------------------------- -void mmCheckingPanel::setAccountSummary() -{ - double checking_bal = core_->bTransactionList_.getBalance(m_AccountID); - double reconciledBal = core_->bTransactionList_.getReconciledBalance(m_AccountID); - double acctInitBalance = core_->accountList_.GetAccountSharedPtr(m_AccountID)->initialBalance_; - bool show_displayed_balance_ = (transFilterActive_ || (currentView_ != VIEW_TRANS_ALL_STR)); - wxStaticText* header = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_BALHEADER1); - header->SetLabel(CurrencyFormatter::float2Money(checking_bal + acctInitBalance)); - header = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_BALHEADER2); - header->SetLabel(CurrencyFormatter::float2Money(reconciledBal + acctInitBalance)); - header = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_BALHEADER3); - header->SetLabel(CurrencyFormatter::float2Money(checking_bal - reconciledBal)); - header = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_BALHEADER4); - header->SetLabel(show_displayed_balance_ - ? _("Displayed Bal: ") - : " "); - header = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_BALHEADER5); - header->SetLabel(show_displayed_balance_ - ? CurrencyFormatter::float2Money(filteredBalance_) - : " "); -} -//---------------------------------------------------------------------------- - -void mmCheckingPanel::initVirtualListControl(int trans_id) -{ - // clear everything - m_trans.clear(); - m_listCtrlAccount->DeleteAllItems(); - - std::shared_ptr<mmAccount> pAccount = core_->accountList_.GetAccountSharedPtr(m_AccountID); - std::shared_ptr<mmCurrency> pCurrency = pAccount->currency_; - wxASSERT(pCurrency); - pCurrency->loadCurrencySettings(); - - header_text_->SetLabel(wxString::Format(_("Account View : %s"), pAccount->name_)); - - filteredBalance_ = 0.0; - - //TODO: Stages 1-4 go away to proper place (TTransactionList) - /********************************************************************************** - Stage 1 - For the account being viewed, we need to get: - 1. All entries for the account to determine account balances. [ account_transPtr ] - 2. All entries for the account to be displayed. [ m_trans ] - **********************************************************************************/ - int numTransactions = 0; - std::vector<mmBankTransaction*> account_transPtr; - for (const auto& pBankTransaction: core_->bTransactionList_.transactions_) - { - if (pBankTransaction->accountID_ != m_AccountID - && (pBankTransaction->toAccountID_ != m_AccountID - || pBankTransaction->transType_ != TRANS_TYPE_TRANSFER_STR)) - continue; - - pBankTransaction->updateAllData(core_, m_AccountID, pCurrency); - - // Store all account transactions to determine the balances. - account_transPtr.push_back(pBankTransaction.get()); - - bool toAdd = true; - - if (transFilterActive_) - { - toAdd = transFilterDlg_->somethingSelected(); // remove transaction from list and add if wanted. - if (transFilterDlg_->getAccountCheckBox()) - toAdd = toAdd && (transFilterDlg_->getAccountID() == pBankTransaction->toAccountID_); - if (transFilterDlg_->getDateRangeCheckBox()) - toAdd = toAdd && (transFilterDlg_->getFromDateCtrl() <= pBankTransaction->date_ && transFilterDlg_->getToDateControl() >= pBankTransaction->date_); - if (transFilterDlg_->getPayeeCheckBox()) - toAdd = toAdd && (transFilterDlg_->userPayeeStr() == pBankTransaction->payeeStr_); - if (transFilterDlg_->getCategoryCheckBox()) - toAdd = toAdd && (pBankTransaction->containsCategory(transFilterDlg_->getCategoryID(), - transFilterDlg_->getSubCategoryID(), transFilterDlg_->getSubCategoryID() < 0)); - if (transFilterDlg_->getStatusCheckBox()) - toAdd = toAdd && (transFilterDlg_->getStatus() == pBankTransaction->status_); - if (transFilterDlg_->getTypeCheckBox()) - toAdd = toAdd && (transFilterDlg_->getType().Contains(pBankTransaction->transType_)); - if (transFilterDlg_->getAmountRangeCheckBox()) - toAdd = toAdd && (transFilterDlg_->getAmountMin() <= pBankTransaction->amt_ && transFilterDlg_->getAmountMax() >= pBankTransaction->amt_); - if (transFilterDlg_->getNumberCheckBox()) - toAdd = toAdd && (transFilterDlg_->getNumber().Trim().Lower() == pBankTransaction->transNum_.Lower()); - if (transFilterDlg_->getNotesCheckBox()) - toAdd = toAdd && (pBankTransaction->notes_.Lower().Matches(transFilterDlg_->getNotes().Trim().Lower())); - - } - - if (toAdd) - { - ++numTransactions; - m_trans.push_back(pBankTransaction.get()); - - double transBal = 0.0; - transBal = getBalance( pBankTransaction.get(), transBal); - filteredBalance_ += transBal; - } - } - - /********************************************************************************** - Stage 2 - Sort all account transactions by date to, determine balances. - **********************************************************************************/ - /*std::sort(account_transPtr.begin(), account_transPtr.end() - , [&] (const std::shared_ptr<mmBankTransaction>& i, const std::shared_ptr<mmBankTransaction>& j) - { return (i->date_ < j->date_); });*/ - - /********************************************************************************** - Stage 3 - Add the account balances to all the transactions in this account. - **********************************************************************************/ - double initBalance = pAccount->initialBalance_; - std::vector<mmBankTransaction*> visible_transPtr = account_transPtr; - - // Depending on the view - will determine the treatment of balances. - if ( currentView_ == VIEW_TRANS_RECONCILED_STR || - currentView_ == VIEW_TRANS_NOT_RECONCILED_STR || - currentView_ == VIEW_TRANS_UNRECONCILED_STR ) - { - visible_transPtr = m_trans; - } - - for (const auto& i : visible_transPtr) - { - initBalance = getBalance( i, initBalance); - setBalance( i, initBalance); - } - - /********************************************************************************** - Stage 4 - Sort the list of visible transactions dependant on user preferences. - **********************************************************************************/ - - // decide whether top or down icon needs to be shown - m_listCtrlAccount->setColumnImage(g_sortcol, g_asc ? ICON_ASC : ICON_DESC); - - sortTable(); - - m_listCtrlAccount->SetItemCount(numTransactions); - - /********************************************************************************** - Stage 5 - Find selected item and set focus to it. - **********************************************************************************/ - if (m_listCtrlAccount->m_selectedIndex > -1) - { - long i = 0; - for (const auto & pTrans : visible_transPtr) - { - if (trans_id == pTrans->transactionID() && trans_id > 0) { - m_listCtrlAccount->m_selectedIndex = i; - break; - } - ++i; - } - } - - if (m_trans.size() > 0 && m_listCtrlAccount->m_selectedIndex < 0) - { - if (g_asc) - m_listCtrlAccount->EnsureVisible(static_cast<long>(m_trans.size()) - 1); - else - m_listCtrlAccount->EnsureVisible(0); - } - else if (m_trans.size() > 0) - { - m_listCtrlAccount->EnsureVisible(m_listCtrlAccount->m_selectedIndex); - } - else - { - enableEditDeleteButtons(false); - showTips(); - } - - setAccountSummary(); -} -//---------------------------------------------------------------------------- - double mmCheckingPanel::getBalance(mmBankTransaction* transPtr, double currentBalance) const { if (transPtr->status_ != "V") @@ -1457,11 +1332,10 @@ bool useOriginalDate = m_cp->core_->iniSettings_->GetBoolSetting(INIDB_USE_ORG_DATE_COPYPASTE, false); - std::shared_ptr<mmBankTransaction> pCopiedTrans = + mmBankTransaction* pCopiedTrans = m_cp->core_->bTransactionList_.copyTransaction(m_selectedForCopy, m_cp->m_AccountID, useOriginalDate); std::shared_ptr<mmCurrency> pCurrencyPtr = m_cp->core_->accountList_.getCurrencySharedPtr(m_cp->m_AccountID); - //pCopiedTrans->updateAllData(m_cp->core_, m_cp->m_AccountID, pCurrencyPtr, true); int transID = pCopiedTrans->transactionID(); topItemIndex_ = m_selectedIndex; refreshVisualList(transID); @@ -1653,7 +1527,7 @@ int toAccountID = DestinationAccountID(); if (toAccountID != -1) { - std::shared_ptr<mmBankTransaction> pTransaction; + mmBankTransaction* pTransaction; pTransaction = m_cp->core_->bTransactionList_.getBankTransactionPtr( m_cp->m_AccountID, m_cp->m_trans[m_selectedIndex]->transactionID() ); Modified: trunk/src/mmcoredb.cpp =================================================================== --- trunk/src/mmcoredb.cpp 2013-06-15 11:47:12 UTC (rev 4092) +++ trunk/src/mmcoredb.cpp 2013-06-15 13:20:33 UTC (rev 4093) @@ -5,12 +5,12 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -37,7 +37,7 @@ { throw wxSQLite3Exception(WXSQLITE_ERROR, "Null pointer to database"); } - + // Create a global listing for info settings. dbInfoSettings_.reset(new MMEX_IniSettings(db, true)); currencyList_.SetInfoTable(dbInfoSettings_); @@ -47,13 +47,13 @@ { dbInfoSettings_->SetStringSetting("MMEXVERSION", mmex::getProgramVersion()); dbInfoSettings_->SetStringSetting("DATAVERSION", mmex::DATAVERSION); - dbInfoSettings_->SetStringSetting("CREATEDATE", wxDateTime::Now().FormatISODate()); + dbInfoSettings_->SetStringSetting("CREATEDATE", wxDateTime::Now().FormatISODate()); dbInfoSettings_->SetStringSetting("DATEFORMAT", mmex::DEFDATEFORMAT); dbInfoSettings_->Save(); } mmOptions::instance().loadOptions(dbInfoSettings_.get()); - /* Create the appropriate tables first if required */ + /* Create the appropriate tables first if required */ mmDBWrapper::initDB(db_.get()); /* Load the DB into memory */ @@ -61,6 +61,6 @@ categoryList_.LoadCategories(); // populate categoryList_ payeeList_.LoadPayees(); // populate payeeList_ accountList_.LoadAccounts(currencyList_); // populate accountList_ - bTransactionList_.LoadTransactions(this); // populate bTransactionList_ + bTransactionList_.LoadTransactions(); // populate bTransactionList_ } //---------------------------------------------------------------------------- Modified: trunk/src/mmex.cpp =================================================================== --- trunk/src/mmex.cpp 2013-06-15 11:47:12 UTC (rev 4092) +++ trunk/src/mmex.cpp 2013-06-15 13:20:33 UTC (rev 4093) @@ -829,7 +829,7 @@ */ //#define USING_NEW_DB_CLASSES // Activation switch #ifdef USING_NEW_DB_CLASSES - + /* Use local list for testing. Convert to global list in final version. For now, we only want to add new transactions. */ @@ -870,7 +870,7 @@ continueExecution = true; } } - + if (pBillEntry->autoExecuteManual_) { /* TODO: Set up the transaction dialog to accept a TTransactionEntry @@ -1007,8 +1007,8 @@ if ( (repeats < 11) || (numRepeats > 0) || (repeats > 14)) { continueExecution = true; - std::shared_ptr<mmBankTransaction> pTransaction; - std::shared_ptr<mmBankTransaction> pTemp(new mmBankTransaction(m_core.get()->db_)); + mmBankTransaction* pTransaction; + mmBankTransaction* pTemp(new mmBankTransaction(m_core.get())); pTransaction = pTemp; std::shared_ptr<mmCurrency> pCurrencyPtr = m_core.get()->accountList_.getCurrencySharedPtr(th.accountID_); @@ -1030,7 +1030,7 @@ split->loadFromBDDB(m_core.get(),th.id_); *pTransaction->splitEntries_.get() = *split.get(); - pTransaction->updateAllData(m_core.get(), th.accountID_, pCurrencyPtr); + //pTransaction->updateAllData(m_core.get(), th.accountID_, pCurrencyPtr); m_core.get()->bTransactionList_.addTransaction(pTransaction); } mmDBWrapper::completeBDInSeries(m_db.get(), th.id_); @@ -1551,7 +1551,7 @@ wxTreeItemId incexpOverTimeLastYear = navTreeCtrl_->AppendItem(incexpOverTime, _("Last Year"), 4, 4); navTreeCtrl_->SetItemData(incexpOverTimeLastYear - , new mmTreeItemData(wxTRANSLATE("Income vs Expenses - Last Year") + , new mmTreeItemData(wxTRANSLATE("Income vs Expenses - Last Year") , new mmReportIncomeExpensesLastYear(m_core.get()))); wxTreeItemId incexpOverTimeCurrentYear = navTreeCtrl_->AppendItem(incexpOverTime, _("Current Year"), 4, 4); Modified: trunk/src/mmtransaction.cpp =================================================================== --- trunk/src/mmtransaction.cpp 2013-06-15 11:47:12 UTC (rev 4092) +++ trunk/src/mmtransaction.cpp 2013-06-15 13:20:33 UTC (rev 4093) @@ -27,7 +27,7 @@ } double mmSplitTransactionEntries::getTotalSplits() const -{ +{ double total = 0.0; for (const auto& tran: this->entries_) total += tran->splitAmount_; @@ -110,9 +110,9 @@ st.Finalize(); } //-----------------------------------------------------------------------------// -mmBankTransaction::mmBankTransaction(std::shared_ptr<wxSQLite3Database> db) : +mmBankTransaction::mmBankTransaction(mmCoreDB* core) : mmTransaction(-1), - db_(db), + core_(core), isInited_(false), updateRequired_(false) { @@ -121,7 +121,7 @@ mmBankTransaction::mmBankTransaction(mmCoreDB* core, wxSQLite3ResultSet& q1) : mmTransaction(q1.GetInt("TRANSID")), - db_(core->db_), + core_(core), isInited_(false), updateRequired_(false) { @@ -143,8 +143,6 @@ splitEntries_ = std::shared_ptr<mmSplitTransactionEntries>(new mmSplitTransactionEntries()); getSplitTransactions(splitEntries_.get()); - - updateAllData(core, accountID_, pCurrencyPtr); } bool mmBankTransaction::operator < (const mmBankTransaction& tran) const @@ -154,16 +152,15 @@ return this->transactionID_ < tran.transactionID_; } -void mmBankTransaction::updateAllData(mmCoreDB* core - , int accountID, std::shared_ptr<mmCurrency> currencyPtr - , bool forceUpdate ) +void mmBankTransaction::updateTransactionData(int accountID, double& balance) { + if (isInited_) return; + deposit_amt_ = transType_ == TRANS_TYPE_DEPOSIT_STR ? amt_ : -amt_; withdrawal_amt_ = transType_ == TRANS_TYPE_WITHDRAWAL_STR ? amt_ : -amt_; - if ((isInited_) && (transType_ != TRANS_TYPE_TRANSFER_STR) && !forceUpdate) return; /* Load the Account Currency Settings for Formatting Strings */ - currencyPtr->loadCurrencySettings(); + //**//currencyPtr->loadCurrencySettings(); dateStr_ = mmGetDateForDisplay(date_); transAmtString_ = CurrencyFormatter::float2String(amt_); @@ -178,14 +175,14 @@ // needed to correct possible crash if database becomes corrupt. if (!payee_) { - if (core->displayDatabaseError_) + if (core_->displayDatabaseError_) { wxString errMsg = _("Payee not found in database for Account: "); - errMsg << core->accountList_.GetAccountName(accountID_) + errMsg << core_->accountList_.GetAccountName(accountID_) << "\n\n" << _("Subsequent errors not displayed."); wxMessageBox(errMsg,_("MMEX DATABASE ERROR"), wxOK|wxICON_ERROR); - core->displayDatabaseError_ = false; + core_->displayDatabaseError_ = false; } payeeID_ = -1; payeeStr_ = "Payee Error"; @@ -205,20 +202,26 @@ if (transType_ == TRANS_TYPE_DEPOSIT_STR) { depositStr_ = transAmtString_; + balance += amt_; + balance_ = balance; } else if (transType_== TRANS_TYPE_WITHDRAWAL_STR) { withdrawalStr_ = transToAmtString_; + balance -= amt_; + balance_ = balance; } else if (transType_ == TRANS_TYPE_TRANSFER_STR) { - wxString fromAccount = core->accountList_.GetAccountName(accountID_); - wxString toAccount = core->accountList_.GetAccountName(toAccountID_); + wxString fromAccount = core_->accountList_.GetAccountName(accountID_); + wxString toAccount = core_->accountList_.GetAccountName(toAccountID_); if (accountID_ == accountID) { withdrawalStr_ = transAmtString_; withdrawal_amt_ = amt_; + balance -= amt_; + balance_ = balance; deposit_amt_ = -amt_; payeeStr_ = toAccount; } @@ -228,19 +231,21 @@ payeeStr_ = fromAccount; deposit_amt_ = toAmt_; withdrawal_amt_ = -toAmt_; + balance += amt_; + balance_ = balance; } } - fromAccountStr_ = core->accountList_.GetAccountName(accountID_); + fromAccountStr_ = core_->accountList_.GetAccountName(accountID_); std::shared_ptr<mmCategory> pCategory = category_; if (!pCategory && !splitEntries_->numEntries()) { // If category is missing, we mark is as unknown - int categID = core->categoryList_.GetCategoryId("Unknown"); - if (categID == -1) categID = core->categoryList_.AddCategory("Unknown"); + int categID = core_->categoryList_.GetCategoryId("Unknown"); + if (categID == -1) categID = core_->categoryList_.AddCategory("Unknown"); - category_ = core->categoryList_.GetCategorySharedPtr(categID, -1); + category_ = core_->categoryList_.GetCategorySharedPtr(categID, -1); pCategory = category_; wxASSERT(pCategory); updateRequired_ = true; @@ -255,7 +260,7 @@ subCatStr_ = pCategory->categName_; categID_ = parent->categID_; subcategID_ = pCategory->categID_; - fullCatStr_ = core->categoryList_.GetFullCategoryString(categID_, subcategID_); + fullCatStr_ = core_->categoryList_.GetFullCategoryString(categID_, subcategID_); } else { @@ -272,7 +277,7 @@ subcategID_ = -1; catStr_= ""; subCatStr_ = ""; - fullCatStr_= core->categoryList_.GetFullCategoryString( + fullCatStr_= core_->categoryList_.GetFullCategoryString( splitEntries_->entries_[0]->categID_, splitEntries_->entries_[0]->subCategID_); } else if (splitEntries_->numEntries() > 1) @@ -283,8 +288,9 @@ catStr_= ""; subCatStr_ = ""; } + balanceStr_ = CurrencyFormatter::float2String(balance_); - isInited_ = true; + isInited_ = true; } double mmBankTransaction::value(int accountID) const @@ -312,7 +318,7 @@ { splits->entries_.clear(); - wxSQLite3Statement st = db_->PrepareStatement(SELECT_ROW_FROM_SPLITTRANSACTIONS_V1); + wxSQLite3Statement st = core_->db_->PrepareStatement(SELECT_ROW_FROM_SPLITTRANSACTIONS_V1); st.Bind(1, transactionID()); wxSQLite3ResultSet q1 = st.ExecuteQuery(); @@ -391,7 +397,7 @@ transactions_.reserve(5000); } -int mmBankTransactionList::addTransaction(std::shared_ptr<mmBankTransaction> pBankTransaction) +int mmBankTransactionList::addTransaction(mmBankTransaction* pBankTransaction) { if (checkForExistingTransaction(pBankTransaction)) { @@ -434,7 +440,7 @@ return pBankTransaction->transactionID(); } -bool mmBankTransactionList::checkForExistingTransaction(std::shared_ptr<mmBankTransaction> pBankTransaction) +bool mmBankTransactionList::checkForExistingTransaction(mmBankTransaction* pBankTransaction) { bool found = false; @@ -464,7 +470,7 @@ { mmSplitTransactionEntries* splits = pBankTransaction->splitEntries_.get(); - std::shared_ptr<mmBankTransaction> pTempTransaction = getBankTransactionPtr(transactionID); + mmBankTransaction* pTempTransaction = getBankTransactionPtr(transactionID); mmSplitTransactionEntries* temp_splits = pTempTransaction->splitEntries_.get(); if (splits->entries_.size() != temp_splits->entries_.size()) @@ -487,14 +493,14 @@ return found; } -std::shared_ptr<mmBankTransaction> mmBankTransactionList::copyTransaction( +mmBankTransaction* mmBankTransactionList::copyTransaction( const long transactionID, const long accountID, const bool useOriginalDate) { - std::shared_ptr<mmBankTransaction> pBankTransaction = getBankTransactionPtr(transactionID); + mmBankTransaction* pBankTransaction = getBankTransactionPtr(transactionID); if (!pBankTransaction) - return std::shared_ptr<mmBankTransaction>(); + return NULL; - std::shared_ptr<mmBankTransaction> pCopyTransaction(new mmBankTransaction(core_->db_)); + mmBankTransaction* pCopyTransaction(new mmBankTransaction(core_)); if (pBankTransaction->transType_!=TRANS_TYPE_TRANSFER_STR) pCopyTransaction->accountID_ = accountID; @@ -558,59 +564,70 @@ return pCopyTransaction; } -std::shared_ptr<mmBankTransaction> mmBankTransactionList::getBankTransactionPtr(int accountID, int transactionID) const +mmBankTransaction* mmBankTransactionList::getBankTransactionPtr(int accountID, int transactionID) const { - for (const_iterator i = transactions_.begin(); i!= transactions_.end(); ++i) + for (auto const& pBankTransaction : transactions_) { - std::shared_ptr<mmBankTransaction> pBankTransaction = *i; - if (pBankTransaction) + if (((pBankTransaction->accountID_ == accountID) || + (pBankTransaction->toAccountID_ == accountID)) + && (pBankTransaction->transactionID() == transactionID)) { - if (((pBankTransaction->accountID_ == accountID) || - (pBankTransaction->toAccountID_ == accountID)) - && (pBankTransaction->transactionID() == transactionID)) - { - return pBankTransaction; - } + return pBankTransaction; } } // didn't find the transaction wxASSERT(false); - return std::shared_ptr<mmBankTransaction> (); + return NULL; } -std::shared_ptr<mmBankTransaction> mmBankTransactionList::getBankTransactionPtr(int transactionID) const +mmBankTransaction* mmBankTransactionList::getBankTransactionPtr(int transactionID) const { - for (const_iterator i = transactions_.begin(); i!= transactions_.end(); ++i) + for (auto const& pBankTransaction : transactions_) { - std::shared_ptr<mmBankTransaction> pBankTransaction = *i; - if (pBankTransaction) + + if (pBankTransaction->transactionID() == transactionID) { - if (pBankTransaction->transactionID() == transactionID) - { - return pBankTransaction; - } + return pBankTransaction; } } // didn't find the transaction wxASSERT(false); - return std::shared_ptr<mmBankTransaction> (); + return NULL; } -void mmBankTransactionList::LoadTransactions(mmCoreDB* core) +void mmBankTransactionList::LoadTransactions() { wxSQLite3ResultSet q1 = core_->db_.get()->ExecuteQuery(SELECT_ALL_FROM_CHECKINGACCOUNT_V1); while (q1.NextRow()) { - std::shared_ptr<mmBankTransaction> pAccountTransaction(new mmBankTransaction(core, q1)); - transactions_.push_back(pAccountTransaction); + mmBankTransaction* pTransaction(new mmBankTransaction(core_, q1)); + transactions_.push_back(pTransaction); } q1.Finalize(); } -void mmBankTransactionList::UpdateTransaction(std::shared_ptr<mmBankTransaction> pBankTransaction) +void mmBankTransactionList::LoadAccountTransactions(int accountID) { + accountTransactions_.clear(); + std::shared_ptr<mmAccount> pAccount = core_->accountList_.GetAccountSharedPtr(accountID); + double balance = pAccount->initialBalance_; + for (const auto& pBankTransaction: transactions_) + { + if (pBankTransaction->accountID_ != accountID + && (pBankTransaction->toAccountID_ != accountID + || pBankTransaction->transType_ != TRANS_TYPE_TRANSFER_STR)) + continue; + //TODO: Calculate balance here + pBankTransaction->updateTransactionData(accountID, balance); + + accountTransactions_.push_back(pBankTransaction); + } +} + +void mmBankTransactionList::UpdateTransaction(mmBankTransaction* pBankTransaction) +{ if (pBankTransaction->transType_ == TRANS_TYPE_TRANSFER_STR) pBankTransaction->payeeID_ = -1; @@ -644,9 +661,8 @@ void mmBankTransactionList::UpdateAllTransactions() { // We need to update all transactions incase of errors when loading - for (const_iterator i = transactions_.begin(); i != transactions_.end(); ++i) + for (auto const& pBankTransaction : transactions_) { - std::shared_ptr<mmBankTransaction> pBankTransaction = *i; if (pBankTransaction && pBankTransaction->updateRequired_) { UpdateTransaction(pBankTransaction); @@ -659,9 +675,8 @@ int subCategID) { // We need to update all transactions incase of errors when loading - for (const_iterator i = transactions_.begin(); i != transactions_.end(); ++i) + for (auto const& pBankTransaction : transactions_) { - std::shared_ptr<mmBankTransaction> pBankTransaction = *i; if (pBankTransaction && (pBankTransaction->categID_ == categID) && (pBankTransaction->subcategID_ == subCategID)) { @@ -690,9 +705,8 @@ int mmBankTransactionList::UpdateAllTransactionsForPayee(int payeeID) { // We need to update all transactions incase of errors when loading - for (const_iterator i = transactions_.begin(); i != transactions_.end(); ++i) + for (auto const& pBankTransaction : transactions_) { - std::shared_ptr<mmBankTransaction> pBankTransaction = *i; if (pBankTransaction && (pBankTransaction->payeeID_ == payeeID)) { pBankTransaction->payee_ = core_->payeeList_.GetPayeeSharedPtr(payeeID); @@ -889,10 +903,8 @@ wxDateTime dt(wxDateTime::Now().Subtract(wxDateSpan::Years(20))); bool same_initial_date = true; - for (const_iterator i = transactions_.begin(); i != transactions_.end(); ++i) + for (auto const& pBankTransaction : transactions_) { - const std::shared_ptr<mmBankTransaction> pBankTransaction = *i; - if (pBankTransaction) { if (accountID != -1) @@ -925,27 +937,20 @@ { int categ_id = -1; subcategID = -1; - int index = transactions_.size() - 1; - bool searching = true; - while (searching && index >= 0) + for (const auto& pTransaction : transactions_) { - const std::shared_ptr<mmBankTransaction> pTransaction = transactions_[index]; - if (pTransaction) + if ((pTransaction->accountID_ == accountID || pTransaction->toAccountID_ == accountID) + && pTransaction->transType_ == sType + && pTransaction->payeeID_ == payeeID) { - if ((pTransaction->accountID_ == accountID || pTransaction->toAccountID_ == accountID) - && pTransaction->transType_ == sType - && pTransaction->payeeID_ == payeeID) + categ_id = pTransaction->categID_; + if (categ_id > -1) { - categ_id = pTransaction->categID_; - if (categ_id > -1) - { - subcategID = pTransaction->subcategID_; - searching = false; - } + subcategID = pTransaction->subcategID_; + break; } } - index --; } return categ_id; } @@ -953,23 +958,17 @@ int mmBankTransactionList::getLastUsedPayeeID(int accountID, const wxString& sType, int& categID, int& subcategID) const { int payee_id = -1; - int index = transactions_.size() - 1; - bool searching = true; - while (searching && index >= 0) + + for (const auto& pBankTransaction : transactions_) { - const std::shared_ptr<mmBankTransaction> pBankTransaction = transactions_[index]; - if (pBankTransaction) + if (pBankTransaction->accountID_ == accountID + && pBankTransaction->transType_ == sType) { - if (pBankTransaction->accountID_ == accountID - && pBankTransaction->transType_ == sType) - { - payee_id = pBankTransaction->payeeID_; - categID = pBankTransaction->categID_; - subcategID = pBankTransaction->subcategID_; - searching = false; - } + payee_id = pBankTransaction->payeeID_; + categID = pBankTransaction->categID_; + subcategID = pBankTransaction->subcategID_; + break; } - index --; } return payee_id; @@ -1155,10 +1154,10 @@ /** removes the transaction from memory */ bool mmBankTransactionList::removeTransaction(int accountID, int transactionID) { - std::vector< std::shared_ptr<mmBankTransaction> >::iterator i; + std::vector<mmBankTransaction* >::iterator i; for (i = transactions_.begin(); i!= transactions_.end(); ++i) { - std::shared_ptr<mmBankTransaction> pBankTransaction = *i; + mmBankTransaction* pBankTransaction = *i; if (pBankTransaction) { if ((pBankTransaction->accountID_ == accountID) || (pBankTransaction->toAccountID_ == accountID)) @@ -1189,19 +1188,12 @@ void mmBankTransactionList::deleteTransactions(int accountID) { - std::vector< std::shared_ptr<mmBankTransaction> >::iterator i; - for (i = transactions_.begin(); i!= transactions_.end(); ) + for (const auto& pBankTransaction : transactions_ ) { - std::shared_ptr<mmBankTransaction> pBankTransaction = *i; - if (pBankTransaction) + if ((pBankTransaction->accountID_ == accountID) || + (pBankTransaction->toAccountID_ == accountID)) { - if ((pBankTransaction->accountID_ == accountID) || - (pBankTransaction->toAccountID_ == accountID)) - { - i = transactions_.erase(i); - } - else - ++i; + transactions_.clear(); } } } @@ -1311,42 +1303,35 @@ bool mmBankTransactionList::IsCategoryUsed(int iCatID, int iSubCatID, bool& bIncome, bool bIgnor_subcat) const { - int index = transactions_.size() - 1; double sum = 0; bool bTrxUsed = false; - std::shared_ptr<mmBankTransaction> pBankTransaction; - while (index >= 0) + for (const auto& pBankTransaction : transactions_) { - pBankTransaction = transactions_[index]; - if (pBankTransaction) + if ((pBankTransaction->categID_ == iCatID) + && (bIgnor_subcat ? true : pBankTransaction->subcategID_== iSubCatID)) { - if ((pBankTransaction->categID_ == iCatID) - && (bIgnor_subcat ? true : pBankTransaction->subcategID_== iSubCatID)) + bTrxUsed = true; + if (pBankTransaction->transType_ == TRANS_TYPE_DEPOSIT_STR) + sum += pBankTransaction->amt_; + else + sum -= pBankTransaction->amt_; + } + + mmSplitTransactionEntries* splits = pBankTransaction->splitEntries_.get(); + + for (int i = 0; i < (int)splits->entries_.size(); ++i) + { + if (splits->entries_[i]->categID_==iCatID && splits->entries_[i]->subCategID_==iSubCatID) { bTrxUsed = true; - if (pBankTransaction->transType_ == TRANS_TYPE_DEPOSIT_STR) - sum += pBankTransaction->amt_; + if ((pBankTransaction->transType_ == TRANS_TYPE_DEPOSIT_STR && splits->entries_[i]->splitAmount_ > 0) + || (pBankTransaction->transType_ == TRANS_TYPE_WITHDRAWAL_STR && splits->entries_[i]->splitAmount_ < 0)) + sum += fabs(splits->entries_[i]->splitAmount_); else - sum -= pBankTransaction->amt_; + sum -= fabs(splits->entries_[i]->splitAmount_); } - - mmSplitTransactionEntries* splits = pBankTransaction->splitEntries_.get(); - - for (int i = 0; i < (int)splits->entries_.size(); ++i) - { - if (splits->entries_[i]->categID_==iCatID && splits->entries_[i]->subCategID_==iSubCatID) - { - bTrxUsed = true; - if ((pBankTransaction->transType_ == TRANS_TYPE_DEPOSIT_STR && splits->entries_[i]->splitAmount_ > 0) - || (pBankTransaction->transType_ == TRANS_TYPE_WITHDRAWAL_STR && splits->entries_[i]->splitAmount_ < 0)) - sum += fabs(splits->entries_[i]->splitAmount_); - else - sum -= fabs(splits->entries_[i]->splitAmount_); - } - } } - index --; } bIncome = sum > 0; return bTrxUsed; @@ -1354,17 +1339,13 @@ bool mmBankTransactionList::IsPayeeUsed(int iPayeeID) const { - int index = transactions_.size() - 1; bool searching = false; - std::shared_ptr<mmBankTransaction> pBankTransaction; - while (!searching && index >= 0) + for (const auto& pBankTransaction : transactions_) { - pBankTransaction = transactions_[index]; - if (pBankTransaction && (pBankTransaction->payeeID_ == iPayeeID)) + if (pBankTransaction->payeeID_ == iPayeeID) { - searching = true; + return true; } - index --; } return searching; } Modified: trunk/src/mmtransaction.h =================================================================== --- trunk/src/mmtransaction.h 2013-06-15 11:47:12 UTC (rev 4092) +++ trunk/src/mmtransaction.h 2013-06-15 13:20:33 UTC (rev 4093) @@ -76,20 +76,17 @@ { public: mmBankTransaction(mmCoreDB* core, wxSQLite3ResultSet& q1); - mmBankTransaction(std::shared_ptr<wxSQLite3Database> db); + mmBankTransaction(mmCoreDB* core); virtual ~mmBankTransaction() {} bool operator < (const mmBankTransaction& tran) const; bool containsCategory(int categID, int subcategID, bool ignoreSubCateg = false) const; double getAmountForSplit(int categID, int subcategID) const; double value(int accountID) const; - void updateAllData(mmCoreDB* core, - int accountID, - std::shared_ptr<mmCurrency> currencyPtr, - bool forceUpdate=false); + void updateTransactionData(int accountID, double& balance); void getSplitTransactions(mmSplitTransactionEntries* splits) const; - std::shared_ptr<wxSQLite3Database> db_; + mmCoreDB* core_; /* Core Data */ wxDateTime date_; @@ -147,18 +144,19 @@ mmBankTransactionList(mmCoreDB* core); ~mmBankTransactionList() {} - std::shared_ptr<mmBankTransaction> getBankTransactionPtr(int accountID, int transactionID) const; - std::shared_ptr<mmBankTransaction> getBankTransactionPtr(int transactionID) const; - int addTransaction(std::shared_ptr<mmBankTransaction> pTransaction); - bool checkForExistingTransaction(std::shared_ptr<mmBankTransaction> pTransaction); - std::shared_ptr<mmBankTransaction> copyTransaction(/*mmCoreDB* pCore,*/ + mmBankTransaction* getBankTransactionPtr(int accountID, int transactionID) const; + mmBankTransaction* getBankTransactionPtr(int transactionID) const; + int addTransaction(mmBankTransaction* pTransaction); + bool checkForExistingTransaction(mmBankTransaction* pTransaction); + mmBankTransaction* copyTransaction(/*mmCoreDB* pCore,*/ const long transactionID, const long accountID, const bool useOriginalDate); /// Loads database primary Transactions into memory. - void LoadTransactions(mmCoreDB* core); + void LoadTransactions(); + void LoadAccountTransactions(int accountID); /* Update Transactions */ - void UpdateTransaction(std::shared_ptr<mmBankTransaction> pTransaction); + void UpdateTransaction(mmBankTransaction* pTransaction); void UpdateAllTransactions(); void UpdateAllTransactionsForCategory(int categID, int subCategID); int UpdateAllTransactionsForPayee(int payeeID); @@ -201,8 +199,9 @@ bool IsPayeeUsed(int iPayeeID) const; /* Data */ - typedef std::vector< std::shared_ptr<mmBankTransaction> >::const_iterator const_iterator; - std::vector< std::shared_ptr<mmBankTransaction> > transactions_; + //typedef std::vector< std::shared_ptr<mmBankTransaction> >::const_iterator const_iterator; + std::vector<mmBankTransaction*> transactions_; + std::vector<mmBankTransaction*> accountTransactions_; private: mmCoreDB* core_; Modified: trunk/src/qif_export.cpp =================================================================== --- trunk/src/qif_export.cpp 2013-06-15 11:47:12 UTC (rev 4092) +++ trunk/src/qif_export.cpp 2013-06-15 13:20:33 UTC (rev 4093) @@ -410,9 +410,8 @@ buffer << writeAccHeader(fromAccountID, qif_csv); - for (size_t i = 0; i < core_->bTransactionList_.transactions_.size(); ++i) + for (const auto& pBankTransaction : core_->bTransactionList_.transactions_) { - std::shared_ptr<mmBankTransaction> pBankTransaction = core_->bTransactionList_.transactions_[i]; if ((pBankTransaction->accountID_ != fromAccountID) && (pBankTransaction->toAccountID_ != fromAccountID)) continue; Modified: trunk/src/qif_import.cpp =================================================================== --- trunk/src/qif_import.cpp 2013-06-15 11:47:12 UTC (rev 4092) +++ trunk/src/qif_import.cpp 2013-06-15 13:20:33 UTC (rev 4093) @@ -748,7 +748,7 @@ bTrxComplited = true; if (!bValid) continue; - std::shared_ptr<mmBankTransaction> pTransaction(new mmBankTransaction(core_->db_)); + std::shared_ptr<mmBankTransaction> pTransaction(new mmBankTransaction(core_)); pTransaction->date_ = dtdt; pTransaction->accountID_ = from_account_id; pTransaction->toAccountID_ = to_account_id; @@ -765,34 +765,33 @@ std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(from_account_id); wxASSERT(pCurrencyPtr); - pTransaction->updateAllData(core_, from_account_id, pCurrencyPtr, true); + //pTransaction->updateAllData(core_, from_account_id, pCurrencyPtr, true); //For any transfer transaction always mirrored transaction present //Just take alternate amount and skip it if (type == TRANS_TYPE_TRANSFER_STR) { - std::vector<std::shared_ptr<mmBankTransaction> >& refTrans = vQIF_trxs; - for (unsigned int index = 0; index < vQIF_trxs.size(); index++) + for (const auto& refTrans : vQIF_trxs) { - if (refTrans[index]->transType_ != TRANS_TYPE_TRANSFER_STR) continue; - if (refTrans[index]->status_ == "D") continue; - if (refTrans[index]->date_!= dtdt) continue; - if (((refTrans[index]->amt_ < 0) && (val < 0)) || ((refTrans[index]->amt_ > 0) && (val >0))) continue; - if (refTrans[index]->accountID_!= from_account_id) continue; - if (refTrans[index]->transNum_ != transNum) continue; - if (refTrans[index]->notes_ != notes) continue; + if (refTrans->transType_ != TRANS_TYPE_TRANSFER_STR) continue; + if (refTrans->status_ == "D") continue; + if (refTrans->date_!= dtdt) continue; + if (((refTrans->amt_ < 0) && (val < 0)) || ((refTrans->amt_ > 0) && (val >0))) continue; + if (refTrans->accountID_!= from_account_id) continue; + if (refTrans->transNum_ != transNum) continue; + if (refTrans->notes_ != notes) continue; if (val > 0.0) - refTrans[index]->toAmt_ = val; + refTrans->toAmt_ = val; else - refTrans[index]->amt_ = val; - refTrans[index]->status_ = "D"; + refTrans->amt_ = val; + refTrans->status_ = "D"; - sMsg = wxString::Format("%f -> %f (%f)\n", refTrans[index]->amt_ - , refTrans[index]->toAmt_ - , (fabs(refTrans[index]->amt_)/fabs(refTrans[index]->toAmt_)<1) - ? fabs(refTrans[index]->toAmt_)/fabs(refTrans[index]->amt_) - : fabs(refTrans[index]->amt_)/fabs(refTrans[index]->toAmt_)); + sMsg = wxString::Format("%f -> %f (%f)\n", refTrans->amt_ + , refTrans->toAmt_ + , (fabs(refTrans->amt_)/fabs(refTrans->toAmt_)<1) + ? fabs(refTrans->toAmt_)/fabs(refTrans->amt_) + : fabs(refTrans->amt_)/fabs(refTrans->toAmt_)); logWindow->AppendText(sMsg); bValid = false; @@ -816,23 +815,21 @@ { core_->db_.get()->Begin(); - std::vector<std::shared_ptr<mmBankTransaction> >& refTrans = vQIF_trxs; - //TODO: Update transfer transactions toAmount - for (unsigned int index = 0; index < vQIF_trxs.size(); index++) + for (const auto& refTrans : vQIF_trxs) { - //fromAccountID = refTrans[index]->accountID_; + //fromAccountID = refTrans->accountID_; std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(fromAccountID); wxASSERT(pCurrencyPtr); - refTrans[index]->amt_ = fabs(refTrans[index]->amt_); - refTrans[index]->toAmt_ = fabs(refTrans[index]->toAmt_); - refTrans[index]->updateAllData(core_, fromAccountID, pCurrencyPtr); - if (!core_->bTransactionList_.checkForExistingTransaction(refTrans[index])) - refTrans[index]->status_ = "F"; + refTrans->amt_ = fabs(refTrans->amt_); + refTrans->toAmt_ = fabs(refTrans->toAmt_); + //refTrans->updateAllData(core_, fromAccountID, pCurrencyPtr); + if (!core_->bTransactionList_.checkForExistingTransaction(refTrans.get())) + refTrans->status_ = "F"; else - refTrans[index]->status_ = "D"; - core_->bTransactionList_.addTransaction(refTrans[index]); + refTrans->status_ = "D"; + core_->bTransactionList_.addTransaction(refTrans.get()); } core_->db_.get()->Commit(); Modified: trunk/src/transdialog.cpp =================================================================== --- trunk/src/transdialog.cpp 2013-06-15 11:47:12 UTC (rev 4092) +++ trunk/src/transdialog.cpp 2013-06-15 13:20:33 UTC (rev 4093) @@ -888,10 +888,10 @@ if (status_obj) status = status_obj->GetData().Left(1); status.Replace("N", ""); - std::shared_ptr<mmBankTransaction> pTransaction; + mmBankTransaction* pTransaction; if (!edit_) { - std::shared_ptr<mmBankTransaction> pTemp(new mmBankTransaction(core_->db_)); + mmBankTransaction* pTemp(new mmBankTransaction(core_)); pTransaction = pTemp; } else @@ -916,7 +916,7 @@ pTransaction->toAmt_ = toTransAmount_; *pTransaction->splitEntries_.get() = *split_.get(); - pTransaction->updateAllData(core_, newAccountID_, pCurrencyPtr, true); + //pTransaction->updateAllData(core_, newAccountID_, pCurrencyPtr, true); if (!edit_) { Modified: trunk/src/univcsvdialog.cpp =================================================================== --- trunk/src/univcsvdialog.cpp 2013-06-15 11:47:12 UTC (rev 4092) +++ trunk/src/univcsvdialog.cpp 2013-06-15 13:20:33 UTC (rev 4093) @@ -698,7 +698,7 @@ wxString status = "F"; int toAccountID = -1; - std::shared_ptr<mmBankTransaction> pTransaction(new mmBankTransaction(core_->db_)); + mmBankTransaction* pTransaction(new mmBankTransaction(core_)); pTransaction->accountID_ = fromAccountID_; pTransaction->toAccountID_ = toAccountID; pTransaction->payee_ = core_->payeeList_.GetPayeeSharedPtr(payeeID_); @@ -710,7 +710,7 @@ pTransaction->category_ = core_->categoryList_.GetCategorySharedPtr(categID_, subCategID_); pTransaction->date_ = dtdt_; pTransaction->toAmt_ = 0.0; - pTransaction->updateAllData(core_, fromAccountID_, pCurrencyPtr); + //pTransaction->updateAllData(core_, fromAccountID_, pCurrencyPtr); int transID = core_->bTransactionList_.addTransaction(pTransaction); CSV_transID.push_back(transID); @@ -974,11 +974,8 @@ int row = 0; wxString delimit = this->delimit_; - for(std::vector< std::shared_ptr<mmBankTransaction> >::const_iterator it = core_->bTransactionList_.transactions_.begin(); - it != core_->bTransactionList_.transactions_.end(); - ++ it) + for(const auto& pBankTransaction : core_->bTransactionList_.transactions_) { - const mmBankTransaction* pBankTransaction = it->get(); if (pBankTransaction && (pBankTransaction->accountID_ == fromAccountID || pBankTransaction->toAccountID_ == fromAccountID)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-15 18:21:40
|
Revision: 4094 http://sourceforge.net/p/moneymanagerex/code/4094 Author: vomikan Date: 2013-06-15 18:21:36 +0000 (Sat, 15 Jun 2013) Log Message: ----------- std::shared_ptr removal Modified Paths: -------------- trunk/src/billsdepositsdialog.cpp trunk/src/budgetingpanel.cpp trunk/src/dbwrapper.h trunk/src/mmcategory.cpp trunk/src/mmcategory.h trunk/src/mmpayee.cpp trunk/src/mmpayee.h trunk/src/mmtransaction.cpp trunk/src/mmtransaction.h trunk/src/transdialog.cpp trunk/src/univcsvdialog.cpp Modified: trunk/src/billsdepositsdialog.cpp =================================================================== --- trunk/src/billsdepositsdialog.cpp 2013-06-15 13:20:33 UTC (rev 4093) +++ trunk/src/billsdepositsdialog.cpp 2013-06-15 18:21:36 UTC (rev 4094) @@ -621,7 +621,7 @@ if (split_->numEntries()) return; - std::shared_ptr<mmPayee> pPayee = core_->payeeList_.GetPayeeSharedPtr(payeeID_); + mmPayee* pPayee = core_->payeeList_.GetPayeeSharedPtr(payeeID_); bPayee_->SetLabel(pPayee->name_); payeeUnknown_ = false; @@ -1213,7 +1213,7 @@ int day = -1; if (forward) day = 1; - wxDateTime date = dpc->GetValue().Add(wxDateSpan::Days(day)); + wxDateTime date = dpc->GetValue().Add(wxDateSpan::Days(day)); dpc_->SetValue( date ); dpcbd_->SetValue( date ); Modified: trunk/src/budgetingpanel.cpp =================================================================== --- trunk/src/budgetingpanel.cpp 2013-06-15 13:20:33 UTC (rev 4093) +++ trunk/src/budgetingpanel.cpp 2013-06-15 18:21:36 UTC (rev 4094) @@ -363,12 +363,8 @@ trans_.push_back(th); } - for (std::vector<std::shared_ptr<mmCategory> >::const_iterator cit = category->children_.begin(); - cit != category->children_.end(); - ++ cit) + for (const auto& sub_category : category->children_) { - const std::shared_ptr<mmCategory> sub_category = *cit; - mmBudgetEntryHolder thsub; budgetDetails.initBudgetEntryFields(thsub, budgetYearID_); thsub.categID_ = th.categID_; Modified: trunk/src/dbwrapper.h =================================================================== --- trunk/src/dbwrapper.h 2013-06-15 13:20:33 UTC (rev 4093) +++ trunk/src/dbwrapper.h 2013-06-15 18:21:36 UTC (rev 4094) @@ -195,13 +195,16 @@ "ORDER BY SUBCATEGNAME"; static const char SELECT_ALL_CATEGORIES[] = - "SELECT C.CATEGID, C.CATEGNAME, " - "SC.SUBCATEGID, SC.SUBCATEGNAME " + "SELECT C.CATEGID, C.CATEGNAME " "FROM CATEGORY_V1 C " - "LEFT JOIN SUBCATEGORY_V1 SC " - "ON SC.CATEGID = C.CATEGID " - "ORDER BY C.CATEGNAME, SC.SUBCATEGNAME"; + "ORDER BY C.CATEGNAME "; +static const char SELECT_ALL_SUBCATEGORIES[] = + "SELECT S.SUBCATEGID, S.SUBCATEGNAME, " + "S.CATEGID " + "FROM SUBCATEGORY_V1 S " + "ORDER BY S.SUBCATEGNAME"; + //DELETE static const char DELETE_BUDGETENTRYIDS_FROM_BUDGETTABLE_V1[] = "DELETE FROM BUDGETTABLE_V1 " Modified: trunk/src/mmcategory.cpp =================================================================== --- trunk/src/mmcategory.cpp 2013-06-15 13:20:33 UTC (rev 4093) +++ trunk/src/mmcategory.cpp 2013-06-15 18:21:36 UTC (rev 4094) @@ -27,86 +27,75 @@ { entries_.clear(); wxSQLite3ResultSet q1 = core_->db_.get()->ExecuteQuery(SELECT_ALL_CATEGORIES); + wxSQLite3ResultSet q2 = core_->db_.get()->ExecuteQuery(SELECT_ALL_SUBCATEGORIES); - std::shared_ptr<mmCategory> pCat; + mmCategory* pCat; while (q1.NextRow()) { int catID = q1.GetInt("CATEGID"); + pCat = new mmCategory(catID, q1.GetString("CATEGNAME")); + entries_.push_back(pCat); - if (!pCat || pCat->categID_ != catID) + while (q2.NextRow()) { - if (pCat) + int scatID = q2.GetInt("CATEGID"); + if (catID == scatID) { - entries_.push_back(pCat); + int subCategID = q2.GetInt("SUBCATEGID"); + wxString subCategName = q2.GetString("SUBCATEGNAME"); + + mmCategory* pSubCat(new mmCategory(subCategID, subCategName)); + pSubCat->parent_ = pCat; + pCat->children_.push_back(pSubCat); } - pCat.reset(new mmCategory(catID, q1.GetString("CATEGNAME"))); } - - int sub_idx = q1.FindColumnIndex("SUBCATEGID"); - wxASSERT(sub_idx); - - if (!q1.IsNull(sub_idx)) - { - int subcatID = q1.GetInt(sub_idx); - std::shared_ptr<mmCategory> pSubCat(new mmCategory(subcatID, q1.GetString("SUBCATEGNAME"))); - - pSubCat->parent_ = pCat; - pCat->children_.push_back(pSubCat); - } } + q2.Finalize(); q1.Finalize(); - - if (pCat) - { - entries_.push_back(pCat); - } } -std::shared_ptr<mmCategory> mmCategoryList::GetCategorySharedPtr(int category, int subcategory) const +mmCategory* mmCategoryList::GetCategorySharedPtr(int category, int subcategory) const { if (category != -1) { - int numCategory = (int)entries_.size(); - for (int idx = 0; idx < numCategory; idx++) + for (const auto& entry : entries_) { - if (entries_[idx]->categID_ == category) + if (entry->categID_ == category) { if (subcategory == -1) - return entries_[idx]; + return entry; - size_t numSubCategory = entries_[idx]->children_.size(); + size_t numSubCategory = entry->children_.size(); for (size_t idxS = 0; idxS < numSubCategory; ++idxS) { - if (entries_[idx]->children_[idxS]->categID_ == subcategory) + if (entry->children_[idxS]->categID_ == subcategory) { - return entries_[idx]->children_[idxS]; + return entry->children_[idxS]; } } } } } - std::shared_ptr<mmCategory> categ; - return categ; + return NULL; } bool mmCategoryList::CategoryExists(const wxString& categoryName) const { - for (const_iterator it = entries_.begin(); it != entries_.end(); ++ it) + for (const auto& it : entries_) { - if (! (*it)->categName_.CmpNoCase(categoryName)) + if (! it->categName_.CmpNoCase(categoryName)) return true; } - return false; } int mmCategoryList::GetCategoryId(const wxString& categoryName) const { - for (const_iterator it = entries_.begin(); it != entries_.end(); ++ it) + for (const auto& it : entries_) { - if ((*it)->categName_ == categoryName) - return (*it)->categID_; + if (it->categName_ == categoryName) + return it->categID_; } return -1; @@ -114,9 +103,9 @@ wxString mmCategoryList::GetCategoryName(int categ_id) const { - for (const_iterator it = entries_.begin(); it != entries_.end(); ++ it) + for (const auto& it : entries_) { - if ((*it)->categID_ == categ_id) return (*it)->categName_; + if (it->categID_ == categ_id) return it->categName_; } return ""; @@ -124,18 +113,12 @@ wxString mmCategoryList::GetSubCategoryName(int categID, int subCategID) const { - for (const_iterator it = entries_.begin(); it != entries_.end(); ++ it) + for (const auto& category : entries_) { - const std::shared_ptr<mmCategory> category = *it; - if (category->categID_ == categID) { - for (std::vector<std::shared_ptr<mmCategory> >::const_iterator cit = category->children_.begin(); - cit != category->children_.end(); - ++ cit) + for (const auto& sub_category : category->children_) { - const std::shared_ptr<mmCategory> sub_category = *cit; - if (subCategID == sub_category->categID_) return sub_category->categName_; } @@ -146,18 +129,12 @@ int mmCategoryList::GetSubCategoryID(int parentID, const wxString& subCategoryName) const { - for (const_iterator it = entries_.begin(); it != entries_.end(); ++ it) + for (const auto& category : entries_) { - const std::shared_ptr<mmCategory> category = *it; - if (category->categID_ == parentID) { - for (std::vector<std::shared_ptr<mmCategory> >::const_iterator cit = category->children_.begin(); - cit != category->children_.end(); - ++ cit) + for (const auto& sub_category : category->children_) { - const std::shared_ptr<mmCategory> sub_category = *cit; - if (subCategoryName == sub_category->categName_) return sub_category->categID_; } Modified: trunk/src/mmcategory.h =================================================================== --- trunk/src/mmcategory.h 2013-06-15 13:20:33 UTC (rev 4093) +++ trunk/src/mmcategory.h 2013-06-15 18:21:36 UTC (rev 4094) @@ -38,8 +38,8 @@ /* Public Data */ int categID_; wxString categName_; - std::shared_ptr<mmCategory> parent_; - std::vector<std::shared_ptr<mmCategory> > children_; + mmCategory* parent_; + std::vector<mmCategory* > children_; }; class mmCategoryList @@ -61,7 +61,7 @@ bool CategoryExists(const wxString& categoryName) const; bool GetCategoryLikeString(wxString& str, int& categID, int& subcategID); - std::shared_ptr<mmCategory> GetCategorySharedPtr(int category, int subcategory) const; + mmCategory* GetCategorySharedPtr(int category, int subcategory) const; int GetSubCategoryID(int parentID, const wxString& subCategoryName) const; void LoadCategories(); @@ -73,8 +73,8 @@ bool UpdateCategory(int categID, int subCategID, const wxString& text); /* Public Data */ - std::vector< std::shared_ptr<mmCategory> > entries_; - typedef std::vector< std::shared_ptr<mmCategory> >::const_iterator const_iterator; + std::vector< mmCategory* > entries_; + //typedef std::vector< mmCategory* >::const_iterator const_iterator; private: mmCoreDB* core_; Modified: trunk/src/mmpayee.cpp =================================================================== --- trunk/src/mmpayee.cpp 2013-06-15 13:20:33 UTC (rev 4093) +++ trunk/src/mmpayee.cpp 2013-06-15 18:21:36 UTC (rev 4094) @@ -85,17 +85,16 @@ return wxEmptyString; } -std::shared_ptr<mmPayee> mmPayeeList::GetPayeeSharedPtr(int payeeID) +mmPayee* mmPayeeList::GetPayeeSharedPtr(int payeeID) { - int numPayees = (int)entries_.size(); - for (int idx = 0; idx < numPayees; idx++) + for (const auto& entry : entries_) { - if (entries_[idx]->id_ == payeeID) + if (entry->id_ == payeeID) { - return entries_[idx]; + return entry; } } - return std::shared_ptr<mmPayee>(); + return NULL; } wxArrayString mmPayeeList::FilterPayees(const wxString& patt) const @@ -117,7 +116,7 @@ entries_.clear(); while (q1.NextRow()) { - std::shared_ptr<mmPayee> pPayee(new mmPayee(q1)); + mmPayee* pPayee(new mmPayee(q1)); entries_.push_back(pPayee); } @@ -161,7 +160,7 @@ int mmPayeeList::UpdatePayee(int payeeID, const wxString& payeeName) { - std::shared_ptr<mmPayee> pPayee = GetPayeeSharedPtr(payeeID); + mmPayee* pPayee = GetPayeeSharedPtr(payeeID); if (!payeeName.IsEmpty()) pPayee->name_ = payeeName; std::vector<wxString> data; data.push_back(pPayee->name_); Modified: trunk/src/mmpayee.h =================================================================== --- trunk/src/mmpayee.h 2013-06-15 13:20:33 UTC (rev 4093) +++ trunk/src/mmpayee.h 2013-06-15 18:21:36 UTC (rev 4094) @@ -52,14 +52,10 @@ bool PayeeExists(int payeeid) const; int GetPayeeId(const wxString& payeeName) const; wxString GetPayeeName(int id) const; - std::shared_ptr<mmPayee> GetPayeeSharedPtr(int payeeID); + mmPayee* GetPayeeSharedPtr(int payeeID); wxArrayString FilterPayees(const wxString& patt) const; - std::vector< std::shared_ptr<mmPayee> > entries_; - int Num() const - { - return entries_.size(); - } + std::vector< mmPayee* > entries_; /// Loads database Payees into memory void LoadPayees(); Modified: trunk/src/mmtransaction.cpp =================================================================== --- trunk/src/mmtransaction.cpp 2013-06-15 13:20:33 UTC (rev 4093) +++ trunk/src/mmtransaction.cpp 2013-06-15 18:21:36 UTC (rev 4094) @@ -190,7 +190,7 @@ } else { - std::shared_ptr<mmPayee> pPayee = payee_; + mmPayee* pPayee = payee_; wxASSERT(pPayee); payeeStr_ = pPayee->name_; payeeID_ = pPayee->id_; @@ -238,7 +238,7 @@ fromAccountStr_ = core_->accountList_.GetAccountName(accountID_); - std::shared_ptr<mmCategory> pCategory = category_; + mmCategory* pCategory = category_; if (!pCategory && !splitEntries_->numEntries()) { // If category is missing, we mark is as unknown @@ -253,7 +253,7 @@ if (pCategory) { - std::shared_ptr<mmCategory> parent = pCategory->parent_; + mmCategory* parent = pCategory->parent_; if (parent) { catStr_ = parent->categName_; @@ -399,18 +399,21 @@ int mmBankTransactionList::addTransaction(mmBankTransaction* pBankTransaction) { + mmBankTransaction &r = *pBankTransaction; if (checkForExistingTransaction(pBankTransaction)) { - pBankTransaction->status_ = "D"; + r.status_ = "D"; } - if(core_->payeeList_.PayeeExists(pBankTransaction->payeeID_) == false) + if (!core_->payeeList_.PayeeExists(r.payeeID_) + && r.transType_ != TRANS_TYPE_TRANSFER_STR) { - pBankTransaction->payeeID_ = -1; + wxASSERT(false); + if (!core_->payeeList_.PayeeExists(_("Unknown"))) + r.payeeID_ = core_->payeeList_.AddPayee(_("Unknown")); } - + wxLogDebug(wxString::Format("Payee: %s, Category: %s", r.payeeStr_, r.fullCatStr_)); wxSQLite3Statement st = core_->db_.get()->PrepareStatement(INSERT_INTO_CHECKINGACCOUNT_V1); - mmBankTransaction &r = *pBankTransaction; int i = 0; st.Bind(++i, r.accountID_); @@ -681,9 +684,9 @@ && (pBankTransaction->subcategID_ == subCategID)) { pBankTransaction->category_ = core_->categoryList_.GetCategorySharedPtr(categID, subCategID); - std::shared_ptr<mmCategory> pCategory = pBankTransaction->category_; + mmCategory* pCategory = pBankTransaction->category_; - std::shared_ptr<mmCategory> parent = pCategory->parent_; + mmCategory* parent = pCategory->parent_; if (parent) { pBankTransaction->catStr_ = parent->categName_; @@ -712,7 +715,7 @@ pBankTransaction->payee_ = core_->payeeList_.GetPayeeSharedPtr(payeeID); if (pBankTransaction->transType_ != TRANS_TYPE_TRANSFER_STR) { - std::shared_ptr<mmPayee> pPayee = pBankTransaction->payee_; + mmPayee* pPayee = pBankTransaction->payee_; wxASSERT(pPayee); pBankTransaction->payeeStr_ = pPayee->name_; pBankTransaction->payeeID_ = pPayee->id_; Modified: trunk/src/mmtransaction.h =================================================================== --- trunk/src/mmtransaction.h 2013-06-15 13:20:33 UTC (rev 4093) +++ trunk/src/mmtransaction.h 2013-06-15 18:21:36 UTC (rev 4094) @@ -91,8 +91,8 @@ /* Core Data */ wxDateTime date_; - std::shared_ptr<mmCategory> category_; - std::shared_ptr<mmPayee> payee_; + mmCategory* category_; + mmPayee* payee_; wxString transNum_; wxString status_; Modified: trunk/src/transdialog.cpp =================================================================== --- trunk/src/transdialog.cpp 2013-06-15 13:20:33 UTC (rev 4093) +++ trunk/src/transdialog.cpp 2013-06-15 18:21:36 UTC (rev 4094) @@ -575,7 +575,7 @@ return; } - std::shared_ptr<mmPayee> pPayee = core_->payeeList_.GetPayeeSharedPtr(payeeID_); + mmPayee* pPayee = core_->payeeList_.GetPayeeSharedPtr(payeeID_); cbPayee_->SetValue(pPayee->name_); payeeUnknown_ = false; @@ -845,7 +845,7 @@ wxMessageDialog msgDlg( this , wxString::Format(_("Do you want to add new payee: \n%s?"), payee_name) , _("Confirm to add new payee") - , wxYES_NO | wxNO_DEFAULT | wxICON_EXCLAMATION); + , wxYES_NO | wxYES_DEFAULT | wxICON_EXCLAMATION); if (msgDlg.ShowModal() == wxID_YES) { payeeID_ = core_->payeeList_.AddPayee(payee_name); @@ -854,7 +854,7 @@ return; } } - + wxLogDebug(wxString::Format("Payee added. ID:%i : Name: %s", payeeID_, core_->payeeList_.GetPayeeName(payeeID_))); int toAccountID = -1; if (bTransfer) @@ -872,7 +872,7 @@ else { // save the category used for this payee to allow automatic category fill at user request. - std::shared_ptr<mmPayee> pPayee = core_->payeeList_.GetPayeeSharedPtr(payeeID_); + mmPayee* pPayee = core_->payeeList_.GetPayeeSharedPtr(payeeID_); pPayee->categoryId_ = categID_; pPayee->subcategoryId_ = subcategID_; core_->payeeList_.UpdatePayee(payeeID_, ""); @@ -906,17 +906,21 @@ pTransaction->accountID_ = newAccountID_; pTransaction->toAccountID_ = toAccountID; pTransaction->payee_ = core_->payeeList_.GetPayeeSharedPtr(payeeID_); + pTransaction->payeeID_ = payeeID_; pTransaction->transType_ = sTransaction_type_; pTransaction->amt_ = transAmount_; pTransaction->status_ = status; pTransaction->transNum_ = transNum; pTransaction->notes_ = notes; pTransaction->category_ = core_->categoryList_.GetCategorySharedPtr(categID_, subcategID_); + pTransaction->categID_ = categID_; + pTransaction->subcategID_ = subcategID_; pTransaction->date_ = dpc_->GetValue(); pTransaction->toAmt_ = toTransAmount_; *pTransaction->splitEntries_.get() = *split_.get(); - //pTransaction->updateAllData(core_, newAccountID_, pCurrencyPtr, true); + //double balance = 0; + //pTransaction->updateTransactionData(newAccountID_, balance); if (!edit_) { Modified: trunk/src/univcsvdialog.cpp =================================================================== --- trunk/src/univcsvdialog.cpp 2013-06-15 13:20:33 UTC (rev 4093) +++ trunk/src/univcsvdialog.cpp 2013-06-15 18:21:36 UTC (rev 4094) @@ -659,40 +659,10 @@ if (categID_ == -1) { - std::shared_ptr<mmPayee> pPayee = core_->payeeList_.GetPayeeSharedPtr(payeeID_); + mmPayee* pPayee = core_->payeeList_.GetPayeeSharedPtr(payeeID_); categID_ = pPayee->categoryId_; subCategID_ = pPayee->subcategoryId_; - - // TODO: Test functionality - // Category pointer removed from payee. Not sure what this code is trying to achieved here. - - //std::shared_ptr<mmCategory> pCategory = pPayee->category_; - //if (!pCategory) - //{ - // subCategID_ = -1; - // wxString categ = "Unknown"; - - // categID_ = core_->categoryList_.GetCategoryId(categ); - // if (categID_ == -1) - // { - // categID_ = core_->categoryList_.AddCategory(categ); - // } - //} - //else - //{ - // if (pCategory->parent_) - // { - // categID_ = pCategory->parent_->categID_; - // subCategID_ = pCategory->categID_; - // } - // else - // { - // categID_ = pCategory->categID_; - // subCategID_ = -1; - // } - //} - } wxString status = "F"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-06-16 04:29:05
|
Revision: 4096 http://sourceforge.net/p/moneymanagerex/code/4096 Author: guanlisheng Date: 2013-06-16 04:29:01 +0000 (Sun, 16 Jun 2013) Log Message: ----------- pass the refee for wxSQLite3ResultSet Modified Paths: -------------- trunk/src/mmpayee.cpp trunk/src/mmpayee.h Modified: trunk/src/mmpayee.cpp =================================================================== --- trunk/src/mmpayee.cpp 2013-06-16 04:15:37 UTC (rev 4095) +++ trunk/src/mmpayee.cpp 2013-06-16 04:29:01 UTC (rev 4096) @@ -23,7 +23,7 @@ #include <algorithm> // Constructor used when loading a payee from the database -mmPayee::mmPayee(wxSQLite3ResultSet q1) +mmPayee::mmPayee(wxSQLite3ResultSet& q1) { id_ = q1.GetInt("PAYEEID"); name_ = q1.GetString("PAYEENAME"); Modified: trunk/src/mmpayee.h =================================================================== --- trunk/src/mmpayee.h 2013-06-16 04:15:37 UTC (rev 4095) +++ trunk/src/mmpayee.h 2013-06-16 04:29:01 UTC (rev 4096) @@ -31,7 +31,7 @@ int subcategoryId_; /// Constructor used when loading a payee from the database - mmPayee(wxSQLite3ResultSet q1); + mmPayee(wxSQLite3ResultSet& q1); /// Constructor for adding a new payee to the database mmPayee(int id, const wxString& name); bool operator < (const mmPayee& entry) const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-16 08:23:32
|
Revision: 4097 http://sourceforge.net/p/moneymanagerex/code/4097 Author: vomikan Date: 2013-06-16 08:23:29 +0000 (Sun, 16 Jun 2013) Log Message: ----------- Filter added for checking panel Modified Paths: -------------- trunk/src/mmcheckingpanel.cpp trunk/src/mmcheckingpanel.h trunk/src/mmtransaction.cpp Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-16 04:29:01 UTC (rev 4096) +++ trunk/src/mmcheckingpanel.cpp 2013-06-16 08:23:29 UTC (rev 4097) @@ -341,6 +341,61 @@ if (!g_asc) std::reverse(this->m_trans.begin(), this->m_trans.end()); } + +void mmCheckingPanel::filterTable() +{ + std::vector<mmBankTransaction*> filtered_trans; + mmBankTransaction* pTempTransaction; + bool toAdd = transFilterDlg_->somethingSelected(); + + if (transFilterActive_) + { + for (const auto& pBankTransaction: m_trans) + { + pTempTransaction = pBankTransaction; + + if (transFilterDlg_->getAccountCheckBox()) + toAdd = toAdd && (transFilterDlg_->getAccountID() == pBankTransaction->toAccountID_); + + if (transFilterDlg_->getDateRangeCheckBox()) + toAdd = toAdd && (transFilterDlg_->getFromDateCtrl() <= pBankTransaction->date_ + && transFilterDlg_->getToDateControl() >= pBankTransaction->date_); + + if (transFilterDlg_->getPayeeCheckBox()) + toAdd = toAdd && (transFilterDlg_->userPayeeStr() == pBankTransaction->payeeStr_); + + if (transFilterDlg_->getCategoryCheckBox()) + toAdd = toAdd && (pBankTransaction->containsCategory(transFilterDlg_->getCategoryID(), + transFilterDlg_->getSubCategoryID(), transFilterDlg_->getSubCategoryID() < 0)); + + if (transFilterDlg_->getStatusCheckBox()) + toAdd = toAdd && (transFilterDlg_->getStatus() == pBankTransaction->status_); + + if (transFilterDlg_->getTypeCheckBox()) + toAdd = toAdd && (transFilterDlg_->getType().Contains(pBankTransaction->transType_)); + + if (transFilterDlg_->getAmountRangeCheckBox()) + toAdd = toAdd && (transFilterDlg_->getAmountMin() <= pBankTransaction->amt_ && transFilterDlg_->getAmountMax() >= pBankTransaction->amt_); + + if (transFilterDlg_->getNumberCheckBox()) + toAdd = toAdd && (transFilterDlg_->getNumber().Trim().Lower() == pBankTransaction->transNum_.Lower()); + + if (transFilterDlg_->getNotesCheckBox()) + toAdd = toAdd && (pBankTransaction->notes_.Lower().Matches(transFilterDlg_->getNotes().Trim().Lower())); + if (toAdd) + { + filtered_trans.push_back(pTempTransaction); + toAdd = false; + } + } + m_trans = filtered_trans; + } +} + +void mmCheckingPanel::markSelectedTransaction(int trans_id) +{ + trans_id; +} //---------------------------------------------------------------------------- void mmCheckingPanel::OnMouseLeftDown( wxMouseEvent& event ) @@ -398,7 +453,9 @@ // decide whether top or down icon needs to be shown m_listCtrlAccount->setColumnImage(g_sortcol, g_asc ? ICON_ASC : ICON_DESC); sortTable(); + filterTable(); m_listCtrlAccount->SetItemCount(m_trans.size()); + markSelectedTransaction(trans_id); setAccountSummary(); } Modified: trunk/src/mmcheckingpanel.h =================================================================== --- trunk/src/mmcheckingpanel.h 2013-06-16 04:29:01 UTC (rev 4096) +++ trunk/src/mmcheckingpanel.h 2013-06-16 08:23:29 UTC (rev 4097) @@ -67,7 +67,7 @@ wxStaticText* stxtMainFilter_; wxStaticText* statTextTransFilter_; wxStaticBitmap* bitmapTransFilter_; - wxStaticBitmap* bitmapMainFilter_; + wxStaticBitmap* bitmapMainFilter_; mmFilterTransactionsDialog* transFilterDlg_; wxString currentView_; @@ -84,6 +84,8 @@ void initViewTransactionsHeader(); void setAccountSummary(); void sortTable(); + void filterTable(); + void markSelectedTransaction(int trans_id); void CreateControls(); bool Create( @@ -94,7 +96,7 @@ long style = wxTAB_TRAVERSAL | wxNO_BORDER, const wxString& name = wxPanelNameStr ); - void enableEditDeleteButtons(bool en); + void enableEditDeleteButtons(bool en); void OnNewTransaction(wxCommandEvent& event); void OnDeleteTransaction(wxCommandEvent& event); Modified: trunk/src/mmtransaction.cpp =================================================================== --- trunk/src/mmtransaction.cpp 2013-06-16 04:29:01 UTC (rev 4096) +++ trunk/src/mmtransaction.cpp 2013-06-16 08:23:29 UTC (rev 4097) @@ -251,7 +251,7 @@ updateRequired_ = true; } - if (pCategory) + if (!pCategory) { mmCategory* parent = pCategory->parent_; if (parent) @@ -658,6 +658,18 @@ r.splitEntries_->updateToDB(core_->db_, r.transactionID(), true); st.Finalize(); + + for (auto& i : transactions_) + { + if (pBankTransaction->transactionID() == i->transactionID()) + { + i = pBankTransaction; + i->payeeStr_ = pBankTransaction->payeeStr_; + i->updateRequired_ = true; + break; + } + } + mmOptions::instance().databaseUpdated_ = true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-06-16 10:49:03
|
Revision: 4098 http://sourceforge.net/p/moneymanagerex/code/4098 Author: guanlisheng Date: 2013-06-16 10:49:00 +0000 (Sun, 16 Jun 2013) Log Message: ----------- format Modified Paths: -------------- trunk/src/mmcheckingpanel.cpp trunk/src/mmcheckingpanel.h Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-16 08:23:29 UTC (rev 4097) +++ trunk/src/mmcheckingpanel.cpp 2013-06-16 10:49:00 UTC (rev 4098) @@ -345,14 +345,13 @@ void mmCheckingPanel::filterTable() { std::vector<mmBankTransaction*> filtered_trans; - mmBankTransaction* pTempTransaction; bool toAdd = transFilterDlg_->somethingSelected(); if (transFilterActive_) { for (const auto& pBankTransaction: m_trans) { - pTempTransaction = pBankTransaction; + mmBankTransaction* pTempTransaction = pBankTransaction; if (transFilterDlg_->getAccountCheckBox()) toAdd = toAdd && (transFilterDlg_->getAccountID() == pBankTransaction->toAccountID_); @@ -388,7 +387,7 @@ toAdd = false; } } - m_trans = filtered_trans; + this->m_trans = filtered_trans; } } @@ -961,7 +960,7 @@ core_->db_.get()->Commit(); } -void mmCheckingPanel::DeleteFlaggedTransactions(const wxString status) +void mmCheckingPanel::DeleteFlaggedTransactions(const wxString& status) { for (size_t i = 0; i < m_trans.size(); ++i) { @@ -1084,7 +1083,7 @@ menu.AppendSeparator(); - wxMenu* subGlobalOpMenuDelete = new wxMenu; + wxMenu* subGlobalOpMenuDelete = new wxMenu(); subGlobalOpMenuDelete->Append(MENU_TREEPOPUP_DELETE, _("&Delete Transaction")); if (hide_menu_item) subGlobalOpMenuDelete->Enable(MENU_TREEPOPUP_DELETE, false); subGlobalOpMenuDelete->AppendSeparator(); @@ -1106,7 +1105,7 @@ if (hide_menu_item) menu.Enable(MENU_TREEPOPUP_MARKDUPLICATE, false); menu.AppendSeparator(); - wxMenu* subGlobalOpMenu = new wxMenu; + wxMenu* subGlobalOpMenu = new wxMenu(); subGlobalOpMenu->Append(MENU_TREEPOPUP_MARKRECONCILED_ALL, _("as Reconciled")); subGlobalOpMenu->Append(MENU_TREEPOPUP_MARKUNRECONCILED_ALL, _("as Unreconciled")); subGlobalOpMenu->Append(MENU_TREEPOPUP_MARKVOID_ALL, _("as Void")); Modified: trunk/src/mmcheckingpanel.h =================================================================== --- trunk/src/mmcheckingpanel.h 2013-06-16 08:23:29 UTC (rev 4097) +++ trunk/src/mmcheckingpanel.h 2013-06-16 10:49:00 UTC (rev 4098) @@ -110,7 +110,7 @@ void OnFilterResetToViewAll(wxMouseEvent& event); void DeleteViewedTransactions(); - void DeleteFlaggedTransactions(const wxString status); + void DeleteFlaggedTransactions(const wxString& status); void SetTransactionFilterState(bool active); /* updates the checking panel data */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-06-16 11:34:47
|
Revision: 4099 http://sourceforge.net/p/moneymanagerex/code/4099 Author: guanlisheng Date: 2013-06-16 11:34:43 +0000 (Sun, 16 Jun 2013) Log Message: ----------- format Modified Paths: -------------- trunk/src/mmex.cpp trunk/src/mmex.h Modified: trunk/src/mmex.cpp =================================================================== --- trunk/src/mmex.cpp 2013-06-16 10:49:00 UTC (rev 4098) +++ trunk/src/mmex.cpp 2013-06-16 11:34:43 UTC (rev 4099) @@ -2782,7 +2782,7 @@ _("Choose database file to create"), wxEmptyString, wxEmptyString, - "MMB Files(*.mmb|*.mmb)", + "MMB Files(*.mmb)|*.mmb", wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); @@ -2803,7 +2803,7 @@ autoRepeatTransactionsTimer_.Stop(); wxString fileName = wxFileSelector(_("Choose database file to open"), wxEmptyString, wxEmptyString, wxEmptyString, - "MMB Files(*.mmb|*.mmb|Encrypted MMB files (*.emb)|*.emb)", + "MMB Files(*.mmb)|*.mmb|Encrypted MMB files (*.emb)|*.emb)", wxFD_FILE_MUST_EXIST, this ); @@ -2820,7 +2820,7 @@ { wxString encFileName = wxFileSelector(_("Choose Encrypted database file to open"), wxEmptyString, wxEmptyString, wxEmptyString, - "Encrypted MMB files (*.emb|*.emb)", + "Encrypted MMB files (*.emb)|*.emb", wxFD_FILE_MUST_EXIST, this ); @@ -2836,7 +2836,7 @@ _("Choose database file to Save As"), wxEmptyString, wxEmptyString, - "MMB Files(*.mmb|*.mmb)", + "MMB Files(*.mmb)|*.mmb", wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); @@ -3883,7 +3883,7 @@ } //---------------------------------------------------------------------------- -void mmGUIFrame::SetDatabaseFile(wxString dbFileName, bool newDatabase) +void mmGUIFrame::SetDatabaseFile(const wxString& dbFileName, bool newDatabase) { autoRepeatTransactionsTimer_.Stop(); wxProgressDialog *progress = NULL; @@ -3924,7 +3924,7 @@ } //---------------------------------------------------------------------------- -void mmGUIFrame::BackupDatabase(wxString filename, bool updateRequired) +void mmGUIFrame::BackupDatabase(const wxString& filename, bool updateRequired) { wxFileName fn(filename); if (!fn.IsOk()) return; Modified: trunk/src/mmex.h =================================================================== --- trunk/src/mmex.h 2013-06-16 10:49:00 UTC (rev 4098) +++ trunk/src/mmex.h 2013-06-16 11:34:43 UTC (rev 4099) @@ -390,9 +390,9 @@ void OnClearRecentFiles(wxCommandEvent& /*event*/); /** Sets the database to the new database selected by the user */ - void SetDatabaseFile(wxString dbFileName, bool newDatabase = false); + void SetDatabaseFile(const wxString& dbFileName, bool newDatabase = false); /// Make a dated copy of the database. Keep only the last 4 copies. - void BackupDatabase(wxString filename, bool updateRequired = false); + void BackupDatabase(const wxString& filename, bool updateRequired = false); // any class wishing to process wxWindows events must use this macro DECLARE_EVENT_TABLE() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-16 18:45:37
|
Revision: 4102 http://sourceforge.net/p/moneymanagerex/code/4102 Author: vomikan Date: 2013-06-16 18:45:32 +0000 (Sun, 16 Jun 2013) Log Message: ----------- mmBankTransaction items reorganization Modified Paths: -------------- trunk/src/billsdepositsdialog.cpp trunk/src/mmcategory.cpp trunk/src/mmcheckingpanel.cpp trunk/src/mmex.cpp trunk/src/mmtransaction.cpp trunk/src/mmtransaction.h trunk/src/qif_import.cpp trunk/src/transdialog.cpp trunk/src/univcsvdialog.cpp Modified: trunk/src/billsdepositsdialog.cpp =================================================================== --- trunk/src/billsdepositsdialog.cpp 2013-06-16 12:13:40 UTC (rev 4101) +++ trunk/src/billsdepositsdialog.cpp 2013-06-16 18:45:32 UTC (rev 4102) @@ -1073,13 +1073,16 @@ pTransaction->accountID_ = fromAccountID; pTransaction->toAccountID_ = toAccountID; - pTransaction->payee_ = core_->payeeList_.GetPayeeSharedPtr(payeeID_); + pTransaction->payeeID_ = payeeID_; + pTransaction->payeeStr_ = core_->payeeList_.GetPayeeName(payeeID_); pTransaction->transType_ = transaction_type; pTransaction->amt_ = amount; pTransaction->status_ = status; pTransaction->transNum_ = transNum; pTransaction->notes_ = notes; - pTransaction->category_ = core_->categoryList_.GetCategorySharedPtr(categID_, subcategID_); + pTransaction->categID_ = categID_; + pTransaction->subcategID_ = subcategID_; + pTransaction->fullCatStr_ = core_->categoryList_.GetFullCategoryString(categID_, subcategID_); pTransaction->date_ = dpc_->GetValue(); pTransaction->toAmt_ = toTransAmount_; Modified: trunk/src/mmcategory.cpp =================================================================== --- trunk/src/mmcategory.cpp 2013-06-16 12:13:40 UTC (rev 4101) +++ trunk/src/mmcategory.cpp 2013-06-16 18:45:32 UTC (rev 4102) @@ -45,7 +45,7 @@ wxString subCategName = q2.GetString("SUBCATEGNAME"); mmCategory* pSubCat(new mmCategory(subCategID, subCategName)); - pSubCat->parent_ = pCat; + //pSubCat->parent_ = pCat; pCat->children_.push_back(pSubCat); } } Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-16 12:13:40 UTC (rev 4101) +++ trunk/src/mmcheckingpanel.cpp 2013-06-16 18:45:32 UTC (rev 4102) @@ -232,12 +232,12 @@ mmCoreDB* core, mmGUIFrame* mainFrame, int accountID, wxWindow *parent, wxWindowID winid, const wxPoint& pos, const wxSize& size, long style, const wxString& name -) -: mmPanelBase(core) -, mainFrame_(mainFrame) -, filteredBalance_(0.0) -, m_listCtrlAccount() -, m_AccountID(accountID) + ) + : mmPanelBase(core) + , mainFrame_(mainFrame) + , filteredBalance_(0.0) + , m_listCtrlAccount() + , m_AccountID(accountID) { wxASSERT(core_); Create(parent, winid, pos, size, style, name); @@ -347,18 +347,20 @@ std::vector<mmBankTransaction*> filtered_trans; bool toAdd = transFilterDlg_->somethingSelected(); - if (transFilterActive_) + if (transFilterActive_ && toAdd) { for (const auto& pBankTransaction: m_trans) { mmBankTransaction* pTempTransaction = pBankTransaction; + toAdd = true; + if (transFilterDlg_->getAccountCheckBox()) toAdd = toAdd && (transFilterDlg_->getAccountID() == pBankTransaction->toAccountID_); if (transFilterDlg_->getDateRangeCheckBox()) - toAdd = toAdd && (transFilterDlg_->getFromDateCtrl() <= pBankTransaction->date_ - && transFilterDlg_->getToDateControl() >= pBankTransaction->date_); + toAdd = toAdd && (transFilterDlg_->getFromDateCtrl().GetDateOnly() <= pBankTransaction->date_.GetDateOnly() + && transFilterDlg_->getToDateControl().GetDateOnly() >= pBankTransaction->date_.GetDateOnly()); if (transFilterDlg_->getPayeeCheckBox()) toAdd = toAdd && (transFilterDlg_->userPayeeStr() == pBankTransaction->payeeStr_); @@ -382,10 +384,7 @@ if (transFilterDlg_->getNotesCheckBox()) toAdd = toAdd && (pBankTransaction->notes_.Lower().Matches(transFilterDlg_->getNotes().Trim().Lower())); if (toAdd) - { filtered_trans.push_back(pTempTransaction); - toAdd = false; - } } this->m_trans = filtered_trans; } Modified: trunk/src/mmex.cpp =================================================================== --- trunk/src/mmex.cpp 2013-06-16 12:13:40 UTC (rev 4101) +++ trunk/src/mmex.cpp 2013-06-16 18:45:32 UTC (rev 4102) @@ -1014,13 +1014,16 @@ tran.accountID_ = th.accountID_; tran.toAccountID_ = th.toAccountID_; - tran.payee_ = m_core.get()->payeeList_.GetPayeeSharedPtr(th.payeeID_); + tran.payeeID_ = th.payeeID_; + tran.payeeStr_ = m_core.get()->payeeList_.GetPayeeName(th.payeeID_); tran.transType_ = th.transType_; tran.amt_ = th.amt_; tran.status_ = q1.GetString("STATUS"); tran.transNum_ = q1.GetString("TRANSACTIONNUMBER"); tran.notes_ = th.notes_; - tran.category_ = m_core.get()->categoryList_.GetCategorySharedPtr(th.categID_, th.subcategID_); + tran.categID_ = th.categID_; + tran.subcategID_ = th.subcategID_; + tran.fullCatStr_ = m_core->categoryList_.GetFullCategoryString(th.categID_, th.subcategID_); tran.date_ = th.nextOccurDate_; tran.toAmt_ = th.toAmt_; Modified: trunk/src/mmtransaction.cpp =================================================================== --- trunk/src/mmtransaction.cpp 2013-06-16 12:13:40 UTC (rev 4101) +++ trunk/src/mmtransaction.cpp 2013-06-16 18:45:32 UTC (rev 4102) @@ -53,8 +53,7 @@ } void mmSplitTransactionEntries::updateToDB(std::shared_ptr<wxSQLite3Database>& db, - int transID, - bool edit) + int transID, bool edit) { if (edit) { @@ -132,11 +131,14 @@ transType_ = q1.GetString("TRANSCODE"); accountID_ = q1.GetInt("ACCOUNTID"); toAccountID_ = q1.GetInt("TOACCOUNTID"); - payee_ = core->payeeList_.GetPayeeSharedPtr(q1.GetInt("PAYEEID")); + payeeID_ = q1.GetInt("PAYEEID"); + payeeStr_ = core->payeeList_.GetPayeeName(payeeID_); amt_ = q1.GetDouble("TRANSAMOUNT"); toAmt_ = q1.GetDouble("TOTRANSAMOUNT"); followupID_ = q1.GetInt("FOLLOWUPID"); - category_ = core->categoryList_.GetCategorySharedPtr(q1.GetInt("CATEGID"), q1.GetInt("SUBCATEGID")); + categID_ = q1.GetInt("CATEGID"); + subcategID_ = q1.GetInt("SUBCATEGID"); + fullCatStr_ = core->categoryList_.GetFullCategoryString(categID_, subcategID_); std::shared_ptr<mmCurrency> pCurrencyPtr = core->accountList_.getCurrencySharedPtr(accountID_); wxASSERT(pCurrencyPtr); @@ -154,7 +156,7 @@ void mmBankTransaction::updateTransactionData(int accountID, double& balance) { - if (isInited_) return; + //if (isInited_) return; deposit_amt_ = transType_ == TRANS_TYPE_DEPOSIT_STR ? amt_ : -amt_; withdrawal_amt_ = transType_ == TRANS_TYPE_WITHDRAWAL_STR ? amt_ : -amt_; @@ -170,32 +172,6 @@ if (toAmt_ < 0) toAmt_ = amt_; transToAmtString_ = CurrencyFormatter::float2String(toAmt_); - if (transType_ != TRANS_TYPE_TRANSFER_STR) - { - // needed to correct possible crash if database becomes corrupt. - if (!payee_) - { - if (core_->displayDatabaseError_) - { - wxString errMsg = _("Payee not found in database for Account: "); - errMsg << core_->accountList_.GetAccountName(accountID_) - << "\n\n" - << _("Subsequent errors not displayed."); - wxMessageBox(errMsg,_("MMEX DATABASE ERROR"), wxOK|wxICON_ERROR); - core_->displayDatabaseError_ = false; - } - payeeID_ = -1; - payeeStr_ = "Payee Error"; - status_ = "V"; - } - else - { - mmPayee* pPayee = payee_; - wxASSERT(pPayee); - payeeStr_ = pPayee->name_; - payeeID_ = pPayee->id_; - } - } depositStr_ = ""; withdrawalStr_ = ""; @@ -238,41 +214,8 @@ fromAccountStr_ = core_->accountList_.GetAccountName(accountID_); - mmCategory* pCategory = category_; - if (!pCategory && !splitEntries_->numEntries()) + if (splitEntries_->numEntries() == 1) { - // If category is missing, we mark is as unknown - int categID = core_->categoryList_.GetCategoryId("Unknown"); - if (categID == -1) categID = core_->categoryList_.AddCategory("Unknown"); - - category_ = core_->categoryList_.GetCategorySharedPtr(categID, -1); - pCategory = category_; - wxASSERT(pCategory); - updateRequired_ = true; - } - - if (!pCategory) - { - mmCategory* parent = pCategory->parent_; - if (parent) - { - catStr_ = parent->categName_; - subCatStr_ = pCategory->categName_; - categID_ = parent->categID_; - subcategID_ = pCategory->categID_; - fullCatStr_ = core_->categoryList_.GetFullCategoryString(categID_, subcategID_); - } - else - { - catStr_ = pCategory->categName_; - subCatStr_ = ""; - categID_ = pCategory->categID_; - subcategID_ = -1; - fullCatStr_ = catStr_; - } - } - else if (splitEntries_->numEntries() == 1) - { categID_ = -1; subcategID_ = -1; catStr_= ""; @@ -288,6 +231,11 @@ catStr_= ""; subCatStr_ = ""; } + else + { + fullCatStr_ = core_->categoryList_.GetFullCategoryString(categID_, subcategID_); + } + balanceStr_ = CurrencyFormatter::float2String(balance_); isInited_ = true; @@ -519,10 +467,8 @@ pCopyTransaction->toAmt_ = pBankTransaction->toAmt_; pCopyTransaction->transType_ = pBankTransaction->transType_; pCopyTransaction->status_ = pBankTransaction->status_; - pCopyTransaction->payee_ = pBankTransaction->payee_; pCopyTransaction->payeeStr_ = pBankTransaction->payeeStr_; pCopyTransaction->payeeID_ = pBankTransaction->payeeID_; - pCopyTransaction->category_ = pBankTransaction->category_; pCopyTransaction->categID_ = pBankTransaction->categID_; pCopyTransaction->subcategID_ = pBankTransaction->subcategID_; pCopyTransaction->followupID_ = pBankTransaction->followupID_; @@ -695,24 +641,9 @@ if (pBankTransaction && (pBankTransaction->categID_ == categID) && (pBankTransaction->subcategID_ == subCategID)) { - pBankTransaction->category_ = core_->categoryList_.GetCategorySharedPtr(categID, subCategID); - mmCategory* pCategory = pBankTransaction->category_; - - mmCategory* parent = pCategory->parent_; - if (parent) - { - pBankTransaction->catStr_ = parent->categName_; - pBankTransaction->subCatStr_ = pCategory->categName_; - pBankTransaction->categID_ = parent->categID_; - pBankTransaction->subcategID_ = pCategory->categID_; - } - else - { - pBankTransaction->catStr_ = pCategory->categName_; - pBankTransaction->subCatStr_ = ""; - pBankTransaction->categID_ = pCategory->categID_; - pBankTransaction->subcategID_ = -1; - } + pBankTransaction->fullCatStr_ = core_->categoryList_.GetFullCategoryString(categID, subCategID); + //pBankTransaction->categID_ = categID; + //pBankTransaction->subcategID_ = subCategID; } } } @@ -724,13 +655,10 @@ { if (pBankTransaction && (pBankTransaction->payeeID_ == payeeID)) { - pBankTransaction->payee_ = core_->payeeList_.GetPayeeSharedPtr(payeeID); if (pBankTransaction->transType_ != TRANS_TYPE_TRANSFER_STR) { - mmPayee* pPayee = pBankTransaction->payee_; - wxASSERT(pPayee); - pBankTransaction->payeeStr_ = pPayee->name_; - pBankTransaction->payeeID_ = pPayee->id_; + pBankTransaction->payeeStr_ = core_->payeeList_.GetPayeeName(payeeID); + //pBankTransaction->payeeID_ = payeeID; } } } @@ -1252,7 +1180,6 @@ { if (pBankTransaction->payeeID_ == sourcePayeeID) { - pBankTransaction->payee_ = core->payeeList_.GetPayeeSharedPtr(destPayeeID); pBankTransaction->payeeStr_ = core->payeeList_.GetPayeeName(destPayeeID); pBankTransaction->payeeID_ = destPayeeID; changedPayees_++; @@ -1279,9 +1206,8 @@ if ((pBankTransaction->categID_ == sourceCatID) && pBankTransaction->subcategID_== sourceSubCatID) { - pBankTransaction->category_ = core->categoryList_.GetCategorySharedPtr(destCatID, destSubCatID); - pBankTransaction->catStr_ = core->categoryList_.GetCategoryName(destCatID); - pBankTransaction->subCatStr_ = core->categoryList_.GetSubCategoryName(destCatID, destSubCatID); + //pBankTransaction->catStr_ = core->categoryList_.GetCategoryName(destCatID); + //pBankTransaction->subCatStr_ = core->categoryList_.GetSubCategoryName(destCatID, destSubCatID); pBankTransaction->categID_ = destCatID; pBankTransaction->subcategID_ = destSubCatID; pBankTransaction->fullCatStr_ = core->categoryList_.GetFullCategoryString(destCatID, destSubCatID); Modified: trunk/src/mmtransaction.h =================================================================== --- trunk/src/mmtransaction.h 2013-06-16 12:13:40 UTC (rev 4101) +++ trunk/src/mmtransaction.h 2013-06-16 18:45:32 UTC (rev 4102) @@ -91,9 +91,6 @@ /* Core Data */ wxDateTime date_; - mmCategory* category_; - mmPayee* payee_; - wxString transNum_; wxString status_; wxString notes_; Modified: trunk/src/qif_import.cpp =================================================================== --- trunk/src/qif_import.cpp 2013-06-16 12:13:40 UTC (rev 4101) +++ trunk/src/qif_import.cpp 2013-06-16 18:45:32 UTC (rev 4102) @@ -752,7 +752,8 @@ pTransaction->date_ = dtdt; pTransaction->accountID_ = from_account_id; pTransaction->toAccountID_ = to_account_id; - pTransaction->payee_ = core_->payeeList_.GetPayeeSharedPtr(payeeID); + pTransaction->payeeID_ = payeeID; + pTransaction->payeeStr_ = core_->payeeList_.GetPayeeName(payeeID); pTransaction->transType_ = type; pTransaction->amt_ = val; pTransaction->status_ = status; @@ -760,12 +761,13 @@ pTransaction->notes_ = notes; pTransaction->toAmt_ = val; if (mmSplit->numEntries()) categID = -1; - pTransaction->category_ = core_->categoryList_.GetCategorySharedPtr(categID, subCategID); + pTransaction->categID_ = categID; + pTransaction->subcategID_ = subCategID; + pTransaction->fullCatStr_ = core_->categoryList_.GetFullCategoryString(categID, subCategID); *pTransaction->splitEntries_ = *mmSplit; std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(from_account_id); wxASSERT(pCurrencyPtr); - //pTransaction->updateAllData(core_, from_account_id, pCurrencyPtr, true); //For any transfer transaction always mirrored transaction present //Just take alternate amount and skip it Modified: trunk/src/transdialog.cpp =================================================================== --- trunk/src/transdialog.cpp 2013-06-16 12:13:40 UTC (rev 4101) +++ trunk/src/transdialog.cpp 2013-06-16 18:45:32 UTC (rev 4102) @@ -343,7 +343,7 @@ long date_style = wxDP_DROPDOWN|wxDP_SHOWCENTURY; dpc_ = new wxDatePickerCtrl( this, ID_DIALOG_TRANS_BUTTONDATE, wxDateTime::Now(), - wxDefaultPosition, wxSize(110, -1), date_style); + wxDefaultPosition, wxSize(110, -1), date_style); //Text field for day of the week itemStaticTextWeek_ = new wxStaticText(this, wxID_STATIC, ""); @@ -805,7 +805,8 @@ textAmount_->SetFocus(); return; } - if (categID_ < 1) + + if (categID_ < 1 || !core_->categoryList_.CategoryExists(categoryName_)) { mmShowErrorMessageInvalid(this, _("Category")); return; @@ -854,7 +855,7 @@ return; } } - wxLogDebug(wxString::Format("Payee added. ID:%i : Name: %s", payeeID_, core_->payeeList_.GetPayeeName(payeeID_))); + int toAccountID = -1; if (bTransfer) @@ -905,22 +906,19 @@ pTransaction->accountID_ = newAccountID_; pTransaction->toAccountID_ = toAccountID; - pTransaction->payee_ = core_->payeeList_.GetPayeeSharedPtr(payeeID_); pTransaction->payeeID_ = payeeID_; + pTransaction->payeeStr_ = core_->payeeList_.GetPayeeName(payeeID_); pTransaction->transType_ = sTransaction_type_; pTransaction->amt_ = transAmount_; pTransaction->status_ = status; pTransaction->transNum_ = transNum; pTransaction->notes_ = notes; - pTransaction->category_ = core_->categoryList_.GetCategorySharedPtr(categID_, subcategID_); pTransaction->categID_ = categID_; pTransaction->subcategID_ = subcategID_; pTransaction->date_ = dpc_->GetValue(); pTransaction->toAmt_ = toTransAmount_; *pTransaction->splitEntries_.get() = *split_.get(); - //double balance = 0; - //pTransaction->updateTransactionData(newAccountID_, balance); if (!edit_) { Modified: trunk/src/univcsvdialog.cpp =================================================================== --- trunk/src/univcsvdialog.cpp 2013-06-16 12:13:40 UTC (rev 4101) +++ trunk/src/univcsvdialog.cpp 2013-06-16 18:45:32 UTC (rev 4102) @@ -671,16 +671,15 @@ mmBankTransaction* pTransaction(new mmBankTransaction(core_)); pTransaction->accountID_ = fromAccountID_; pTransaction->toAccountID_ = toAccountID; - pTransaction->payee_ = core_->payeeList_.GetPayeeSharedPtr(payeeID_); + pTransaction->payeeID_ = payeeID_; + pTransaction->payeeStr_ = core_->payeeList_.GetPayeeName(payeeID_); pTransaction->transType_ = type_; pTransaction->amt_ = val_; pTransaction->status_ = status; pTransaction->transNum_ = transNum_; pTransaction->notes_ = notes_; - pTransaction->category_ = core_->categoryList_.GetCategorySharedPtr(categID_, subCategID_); pTransaction->date_ = dtdt_; pTransaction->toAmt_ = 0.0; - //pTransaction->updateAllData(core_, fromAccountID_, pCurrencyPtr); int transID = core_->bTransactionList_.addTransaction(pTransaction); CSV_transID.push_back(transID); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-21 21:24:16
|
Revision: 4128 http://sourceforge.net/p/moneymanagerex/code/4128 Author: vomikan Date: 2013-06-21 21:24:11 +0000 (Fri, 21 Jun 2013) Log Message: ----------- cleanup std::shared_ptr Modified Paths: -------------- trunk/src/billsdepositsdialog.cpp trunk/src/currencydialog.cpp trunk/src/db/splittransaction.cpp trunk/src/db/splittransaction.h trunk/src/lua_interface.cpp trunk/src/maincurrencydialog.cpp trunk/src/mmaccount.cpp trunk/src/mmaccount.h trunk/src/mmcheckingpanel.cpp trunk/src/mmcurrency.cpp trunk/src/mmcurrency.h trunk/src/mmex.cpp trunk/src/mmhomepagepanel.cpp trunk/src/mmtransaction.cpp trunk/src/mmtransaction.h trunk/src/newacctdialog.cpp trunk/src/qif_export.cpp trunk/src/qif_import.cpp trunk/src/reports/cashflow.cpp trunk/src/reports/summary.cpp trunk/src/reports/transactions.cpp trunk/src/splittransactionsdialog.cpp trunk/src/stockspanel.cpp trunk/src/tests/dbwrapper_test.cpp trunk/src/transdialog.cpp trunk/src/transdialog.h trunk/src/univcsvdialog.cpp Modified: trunk/src/billsdepositsdialog.cpp =================================================================== --- trunk/src/billsdepositsdialog.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/billsdepositsdialog.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -1068,8 +1068,7 @@ mmBankTransaction* pTemp(new mmBankTransaction(core_)); pTransaction = pTemp; - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(fromAccountID); - wxASSERT(pCurrencyPtr); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(fromAccountID); pTransaction->accountID_ = fromAccountID; pTransaction->toAccountID_ = toAccountID; @@ -1086,7 +1085,7 @@ pTransaction->date_ = dpc_->GetValue(); pTransaction->toAmt_ = toTransAmount_; - *pTransaction->splitEntries_.get() = *split_.get(); + *pTransaction->splitEntries_ = *split_; //pTransaction->updateAllData(core_, fromAccountID, pCurrencyPtr); core_->bTransactionList_.addTransaction(pTransaction); } Modified: trunk/src/currencydialog.cpp =================================================================== --- trunk/src/currencydialog.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/currencydialog.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -118,7 +118,7 @@ void mmCurrencyDialog::updateControls() { wxString currencyName = currencyNameCombo_->GetStringSelection(); - std::shared_ptr<mmCurrency > pCurrency = core_->currencyList_.getCurrencySharedPtr(currencyName); + mmCurrency* pCurrency = core_->currencyList_.getCurrencySharedPtr(currencyName); pfxTx_->SetValue(pCurrency->pfxSymbol_); sfxTx_->SetValue(pCurrency->sfxSymbol_); @@ -258,7 +258,7 @@ scaleTx_->GetValue().ToLong(&scal); baseConvRate_->GetValue().ToDouble(&convRate_); - std::shared_ptr<mmCurrency> pCurrency = core_->currencyList_.getCurrencySharedPtr(currencyID_); + mmCurrency* pCurrency = core_->currencyList_.getCurrencySharedPtr(currencyID_); //wxASSERT(pCurrency->currencyID_ == currencyID_); pCurrency->pfxSymbol_ = pfxTx_->GetValue(); Modified: trunk/src/db/splittransaction.cpp =================================================================== --- trunk/src/db/splittransaction.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/db/splittransaction.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -115,7 +115,7 @@ wxSQLite3ResultSet q1 = ListDatabase()->ExecuteQuery(sql_statement); while (q1.NextRow()) { - std::shared_ptr<TSplitEntry> pEntry(new TSplitEntry(q1)); + TSplitEntry* pEntry(new TSplitEntry(q1)); global_entries_.push_back(pEntry); } q1.Finalize(); @@ -150,7 +150,7 @@ { if (entries_List_.global_entries_[index]->id_trans_ == id_transaction_) { - std::shared_ptr<TSplitEntry> pEntry = entries_List_.global_entries_[index]; + TSplitEntry* pEntry = entries_List_.global_entries_[index]; entries_.push_back(pEntry); total_ += pEntry->amount_; } @@ -167,7 +167,7 @@ void TSplitTransactionList::AddLocalEntry(int cat_id, int subcat_id, double amount) { - std::shared_ptr<TSplitEntry> pEntry(new TSplitEntry()); + TSplitEntry* pEntry(new TSplitEntry()); pEntry->id_category_ = cat_id; pEntry->id_subcategory_ = subcat_id; pEntry->amount_ = amount; @@ -193,7 +193,7 @@ return total_; } -void TSplitTransactionList::AddEntry(std::shared_ptr<TSplitEntry> pEntry) +void TSplitTransactionList::AddEntry(TSplitEntry* pEntry) { total_ += pEntry->amount_; entries_.push_back(pEntry); // Add to local list @@ -203,7 +203,7 @@ int TSplitTransactionList::AddEntry(int cat_id, int subcat_id, double amount) { - std::shared_ptr<TSplitEntry> pEntry(new TSplitEntry()); + TSplitEntry* pEntry(new TSplitEntry()); pEntry->id_trans_ = id_transaction_; pEntry->id_category_ = cat_id; @@ -252,7 +252,7 @@ { if (entries_[i]->id_ == id_split_trans) { - entry_ptr = entries_[i].get(); + entry_ptr = entries_[i]; break; } } @@ -262,7 +262,7 @@ TSplitEntry* TSplitTransactionList::GetIndexedEntryPtr(int index) { - return entries_[index].get(); + return entries_[index]; } void TSplitTransactionList::ReEvaluateTotal() Modified: trunk/src/db/splittransaction.h =================================================================== --- trunk/src/db/splittransaction.h 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/db/splittransaction.h 2013-06-21 21:24:11 UTC (rev 4128) @@ -63,7 +63,7 @@ friend class TSplitTransactionList; wxString db_table_; - std::vector< std::shared_ptr<TSplitEntry> > global_entries_; + std::vector< TSplitEntry* > global_entries_; void LoadSplitEntries(); @@ -80,12 +80,12 @@ int id_transaction_; TSplitEntriesList& entries_List_; double total_; - std::vector< std::shared_ptr<TSplitEntry> > entries_; + std::vector< TSplitEntry* > entries_; /// Load the transaction split entries from the global list. void LoadEntries(); - void AddEntry(std::shared_ptr<TSplitEntry> split_entry); + void AddEntry(TSplitEntry* split_entry); void ReEvaluateTotal(); void RemoveGlobalEntry(int entry_id); Modified: trunk/src/lua_interface.cpp =================================================================== --- trunk/src/lua_interface.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/lua_interface.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -530,7 +530,7 @@ wxString currency_symbol = GetLuaString(lua).MakeUpper(); g_static_currency_list->LoadCurrencySetting(currency_symbol); - std::shared_ptr<mmCurrency> pCurrency = g_static_currency_list->getCurrencySharedPtr(currency_symbol, true); + mmCurrency* pCurrency = g_static_currency_list->getCurrencySharedPtr(currency_symbol, true); if (pCurrency) { number = number * pCurrency->baseConv_; Modified: trunk/src/maincurrencydialog.cpp =================================================================== --- trunk/src/maincurrencydialog.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/maincurrencydialog.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -201,7 +201,7 @@ int currID = core_->currencyList_.getCurrencyID(currText); if (currID == -1) { - std::shared_ptr<mmCurrency> pCurrency(new mmCurrency()); + mmCurrency* pCurrency(new mmCurrency()); pCurrency->currencyName_ = currText; pCurrency->currencySymbol_ = currency_symbol; currencyID_ = core_->currencyList_.AddCurrency(pCurrency); @@ -282,7 +282,7 @@ selectedIndex_ = currencyListBox_->ItemToRow(item); currencyID_ = (int)currencyListBox_->GetItemData(item); wxString currency_name = core_->currencyList_.getCurrencyName(currencyID_); - std::shared_ptr<mmCurrency> pCurrency = core_->currencyList_.getCurrencySharedPtr(currencyID_); + mmCurrency* pCurrency = core_->currencyList_.getCurrencySharedPtr(currencyID_); curr_rate_ = pCurrency->baseConv_; wxLogDebug(wxString::Format("selected item:%i currency:%s", selectedIndex_, currency_name)); @@ -321,7 +321,7 @@ double convRate; if (val.ToDouble(&convRate)) { - std::shared_ptr<mmCurrency> pCurrency = core_->currencyList_.getCurrencySharedPtr(currencyID_); + mmCurrency* pCurrency = core_->currencyList_.getCurrencySharedPtr(currencyID_); pCurrency->baseConv_ = convRate; core_->currencyList_.UpdateCurrency(pCurrency); } Modified: trunk/src/mmaccount.cpp =================================================================== --- trunk/src/mmaccount.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/mmaccount.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -56,7 +56,7 @@ { if (accountID > 0) { - std::shared_ptr<mmCurrency> pCurrency = getCurrencySharedPtr(accountID); + mmCurrency* pCurrency = getCurrencySharedPtr(accountID); wxASSERT(pCurrency); @@ -67,13 +67,12 @@ return 1.0; } -std::shared_ptr<mmAccount> mmAccountList::GetAccountSharedPtr(int accountID) const +mmAccount* mmAccountList::GetAccountSharedPtr(int accountID) const { account_v::value_type res; - for (account_v::const_iterator i = accounts_.begin(); i != accounts_.end(); ++i) + for (const auto& r : accounts_) { - account_v::const_reference r = *i; if (r->id_ == accountID) { res = r; @@ -86,9 +85,9 @@ bool mmAccountList::AccountExists(const wxString& accountName) const { - for (const_iterator it = accounts_.begin(); it != accounts_.end(); ++ it) + for (const auto& it : accounts_) { - if ((*it)->name_ == accountName) return true; + if (it->name_ == accountName) return true; } return false; @@ -96,9 +95,9 @@ bool mmAccountList::has_term_account() const { - for (const_iterator it = accounts_.begin(); it != accounts_.end(); ++ it) + for (const auto& it : accounts_) { - if ((*it)->acctType_ == ACCOUNT_TYPE_TERM) return true; + if (it->acctType_ == ACCOUNT_TYPE_TERM) return true; } return false; @@ -106,9 +105,9 @@ bool mmAccountList::has_stock_account() const { - for (const_iterator it = accounts_.begin(); it != accounts_.end(); ++ it) + for (const auto& it : accounts_) { - if ((*it)->acctType_ == ACCOUNT_TYPE_STOCK) return true; + if (it->acctType_ == ACCOUNT_TYPE_STOCK) return true; } return false; @@ -117,9 +116,9 @@ int mmAccountList::getNumBankAccounts() const { int num = 0; - for (const_iterator it = accounts_.begin(); it != accounts_.end(); ++ it) + for (const auto& it : accounts_) { - if ((*it)->acctType_ != ACCOUNT_TYPE_STOCK) ++ num; + if (it->acctType_ != ACCOUNT_TYPE_STOCK) ++ num; } return num; @@ -127,9 +126,9 @@ int mmAccountList::GetAccountId(const wxString& accountName) const { - for (const_iterator it = accounts_.begin(); it != accounts_.end(); ++ it) + for (const auto& it : accounts_) { - if ((*it)->name_ == accountName) return (*it)->id_; + if (it->name_ == accountName) return it->id_; } return -1; @@ -137,9 +136,9 @@ wxString mmAccountList::GetAccountName(int accountID) const { - for (const_iterator it = accounts_.begin(); it != accounts_.end(); ++ it) + for (const auto& it : accounts_) { - if ((*it)->id_ == accountID) return (*it)->name_; + if (it->id_ == accountID) return it->name_; } return wxEmptyString; @@ -148,9 +147,9 @@ wxArrayInt mmAccountList::getAccountsID(const wxArrayString accounts_type, int except_id) const { wxArrayInt accounts_id; - for (const_iterator it = accounts_.begin(); it != accounts_.end(); ++ it) + for (const auto& it : accounts_) { - const mmAccount* account = it->get(); + const mmAccount* account = it; for (size_t i = 0; i < accounts_type.Count(); ++i) { if ((account->acctType_ == accounts_type[i]) @@ -167,9 +166,8 @@ wxArrayString mmAccountList::getAccountsName(int except_id) const { wxArrayString as; - for (const_iterator it = accounts_.begin(); it != accounts_.end(); ++ it) + for (const auto& account : accounts_) { - const mmAccount* account = it->get(); if ((account->acctType_ == ACCOUNT_TYPE_TERM || account->acctType_ == ACCOUNT_TYPE_BANK) && account->status_ != mmAccount::MMEX_Closed && account->id_ != except_id) { @@ -182,9 +180,9 @@ wxString mmAccountList::getAccountType(int accountID) const { - for (account_v::const_iterator it = accounts_.begin(); it != accounts_.end(); ++ it) + for (const auto& account : accounts_) { - if ((*it)->id_ == accountID) return (*it)->acctType_; + if (account->id_ == accountID) return account->acctType_; } wxASSERT(false); @@ -193,9 +191,9 @@ bool mmAccountList::getAccountFavorite(int accountID) const { - for (account_v::const_iterator it = accounts_.begin(); it != accounts_.end(); ++ it) + for (const auto& account : accounts_) { - if ((*it)->id_ == accountID) return (*it)->favoriteAcct_; + if (account->id_ == accountID) return account->favoriteAcct_; } wxASSERT(false); @@ -204,9 +202,9 @@ mmAccount::Status mmAccountList::getAccountStatus(int accountID) const { - for (account_v::const_iterator it = accounts_.begin(); it != accounts_.end(); ++ it) + for (const auto& account : accounts_) { - if ((*it)->id_ == accountID) return (*it)->status_; + if (account->id_ == accountID) return account->status_; } wxASSERT(false); @@ -215,9 +213,9 @@ bool mmAccountList::currencyInUse(int currencyID) const { - for (account_v::const_iterator it = accounts_.begin(); it != accounts_.end(); ++ it) + for (const auto& account : accounts_) { - if ((*it)->currencyID_ == currencyID) return true; + if (account->currencyID_ == currencyID) return true; } return false; @@ -225,8 +223,7 @@ wxString mmAccountList::getAccountCurrencyDecimalChar(int accountID) const { - std::shared_ptr<mmCurrency> pCurrency = getCurrencySharedPtr(accountID); - wxASSERT(pCurrency); + mmCurrency* pCurrency = getCurrencySharedPtr(accountID); if (pCurrency) return pCurrency->decChar_; @@ -236,7 +233,7 @@ wxString mmAccountList::getAccountCurrencyGroupChar(int accountID) const { - std::shared_ptr<mmCurrency> pCurrency = getCurrencySharedPtr(accountID); + mmCurrency* pCurrency = getCurrencySharedPtr(accountID); wxASSERT(pCurrency); if (pCurrency) @@ -247,7 +244,7 @@ wxString mmAccountList::GetAccountCurrencyName(int accountID) const { - std::shared_ptr<mmCurrency> pCurrency = getCurrencySharedPtr(accountID); + mmCurrency* pCurrency = getCurrencySharedPtr(accountID); wxASSERT(pCurrency); if (pCurrency) @@ -256,24 +253,23 @@ return ""; } -std::shared_ptr<mmCurrency> mmAccountList::getCurrencySharedPtr(int accountID) const +mmCurrency* mmAccountList::getCurrencySharedPtr(int accountID) const { - int len = (int)accounts_.size(); - for (int idx = 0; idx < len; idx++) + for (const auto& idx : accounts_) { - if (accounts_[idx]->id_ == accountID) - return accounts_[idx]->currency_; + if (idx->id_ == accountID) + return idx->currency_; } wxASSERT(false); - return std::shared_ptr<mmCurrency>(); + return NULL; } -int mmAccountList::UpdateAccount(std::shared_ptr<mmAccount> pAccount) +int mmAccountList::UpdateAccount(mmAccount* pAccount) { wxString statusStr = pAccount->status_ == mmAccount::MMEX_Closed ? "Closed" : "Open"; wxString favStr = pAccount->favoriteAcct_ ? "TRUE" : "FALSE"; - std::shared_ptr<mmCurrency> pCurrency = pAccount->currency_; + mmCurrency* pCurrency = pAccount->currency_; wxASSERT(pCurrency); int currencyID = pCurrency->currencyID_; @@ -304,7 +300,7 @@ return iError; } -int mmAccountList::AddAccount(std::shared_ptr<mmAccount> pAccount) +int mmAccountList::AddAccount(mmAccount* pAccount) { wxString statusStr = "Open"; if (pAccount->status_ == mmAccount::MMEX_Closed) @@ -314,7 +310,7 @@ if (!pAccount->favoriteAcct_) favStr = "FALSE"; - std::shared_ptr<mmCurrency> pCurrency = pAccount->currency_; + mmCurrency* pCurrency = pAccount->currency_; wxASSERT(pCurrency); int currencyID = pCurrency->currencyID_; @@ -393,10 +389,10 @@ mmOptions::instance().databaseUpdated_ = true; - std::vector<std::shared_ptr<mmAccount> >::iterator iter; + std::vector<mmAccount* >::iterator iter; for (iter = accounts_.begin(); iter != accounts_.end(); ) { - std::shared_ptr<mmAccount> pAccount = (*iter); + mmAccount* pAccount = (*iter); if (pAccount->id_ == accountID) { iter = accounts_.erase(iter); @@ -415,9 +411,9 @@ while (q1.NextRow()) { - std::shared_ptr<mmAccount> pAccount(new mmAccount(q1)); + mmAccount* pAccount(new mmAccount(q1)); - std::shared_ptr<mmCurrency> pCurrency = + mmCurrency* pCurrency = currencyList.getCurrencySharedPtr(q1.GetInt("CURRENCYID")); pAccount->currency_ = pCurrency; Modified: trunk/src/mmaccount.h =================================================================== --- trunk/src/mmaccount.h 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/mmaccount.h 2013-06-21 21:24:11 UTC (rev 4128) @@ -52,22 +52,22 @@ bool favoriteAcct_; double initialBalance_; int currencyID_; - std::shared_ptr<mmCurrency> currency_; + mmCurrency* currency_; }; class mmAccountList { private: - typedef std::vector< std::shared_ptr<mmAccount> > account_v; + typedef std::vector< mmAccount* > account_v; mmCoreDB* core_; public: mmAccountList(mmCoreDB* core); /* Account Functions */ - std::shared_ptr<mmAccount> GetAccountSharedPtr(int accountID) const; + mmAccount* GetAccountSharedPtr(int accountID) const; - int AddAccount(std::shared_ptr<mmAccount> pAccount); + int AddAccount(mmAccount* pAccount); /// returns the ACCOUNT_TYPE_xxxx String wxString getAccountType(int accountID) const; bool getAccountFavorite(int accountID) const; @@ -80,11 +80,11 @@ int getNumBankAccounts() const; int GetAccountId(const wxString& accountName) const; bool RemoveAccount(int accountID); - int UpdateAccount(std::shared_ptr<mmAccount> pAccount); + int UpdateAccount(mmAccount* pAccount); bool AccountExists(const wxString& accountName) const; bool has_term_account() const; bool has_stock_account() const; - std::shared_ptr<mmCurrency> getCurrencySharedPtr(int accountID) const; + mmCurrency* getCurrencySharedPtr(int accountID) const; double getAccountBaseCurrencyConvRate(int accountID) const; wxString GetAccountName(int accountID) const; wxArrayInt getAccountsID(const wxArrayString account_type, int except_id = -1) const; @@ -94,7 +94,7 @@ wxString GetAccountCurrencyName(int accountID) const; bool currencyInUse(int currencyID) const; account_v accounts_; - typedef std::vector<std::shared_ptr<mmAccount> >::const_iterator const_iterator; + typedef std::vector<mmAccount* >::const_iterator const_iterator; /// Loads database Accounts list into memory void LoadAccounts(const mmCurrencyList& currencyList); Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/mmcheckingpanel.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -657,10 +657,7 @@ //---------------------------------------------------------------------------- void mmCheckingPanel::setAccountSummary() { - std::shared_ptr<mmAccount> pAccount = core_->accountList_.GetAccountSharedPtr(m_AccountID); - //std::shared_ptr<mmCurrency> pCurrency = pAccount->currency_; - //wxASSERT(pCurrency); - //pCurrency->loadCurrencySettings(); + mmAccount* pAccount = core_->accountList_.GetAccountSharedPtr(m_AccountID); header_text_->SetLabel(wxString::Format(_("Account View : %s"), pAccount->name_)); double checking_bal = core_->bTransactionList_.getBalance(m_AccountID); @@ -744,7 +741,7 @@ double amount = m_trans[selIndex]->amt_; wxString amountStr; - std::shared_ptr<mmCurrency> pCurrency = core_->accountList_.getCurrencySharedPtr(accountId); + mmCurrency* pCurrency = core_->accountList_.getCurrencySharedPtr(accountId); int currencyid = pCurrency->currencyID_; //TODO: FIXME: If base currency does not set bug may happens if (basecurrencyid == -1) basecurrencyid = currencyid; @@ -756,7 +753,7 @@ if (transcodeStr == TRANS_TYPE_TRANSFER_STR) { double toconvrate = core_->accountList_.getAccountBaseCurrencyConvRate(toaccountId); - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(toaccountId); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(toaccountId); wxASSERT(pCurrencyPtr); wxString tocurpfxStr = pCurrencyPtr->pfxSymbol_; wxString tocursfxStr = pCurrencyPtr->sfxSymbol_; @@ -802,7 +799,7 @@ { //if (split_) { - mmSplitTransactionEntries* splits = m_trans[selIndex]->splitEntries_.get(); + mmSplitTransactionEntries* splits = m_trans[selIndex]->splitEntries_; m_trans[selIndex]->getSplitTransactions(splits); for (const auto &i : splits->entries_) @@ -823,7 +820,7 @@ { //load settings for base currency wxString currencyName = core_->currencyList_.getCurrencyName(basecurrencyid); - std::shared_ptr<mmCurrency> pCurrencyBase = core_->currencyList_.getCurrencySharedPtr(currencyName); + mmCurrency* pCurrencyBase = core_->currencyList_.getCurrencySharedPtr(currencyName); wxASSERT(pCurrencyBase); wxString basecuramountStr; mmDBWrapper::loadCurrencySettings(core_->db_.get(), pCurrencyBase->currencyID_); @@ -1417,7 +1414,7 @@ mmBankTransaction* pCopiedTrans = m_cp->core_->bTransactionList_.copyTransaction(m_selectedForCopy, m_cp->m_AccountID, useOriginalDate); - std::shared_ptr<mmCurrency> pCurrencyPtr = m_cp->core_->accountList_.getCurrencySharedPtr(m_cp->m_AccountID); + mmCurrency* pCurrencyPtr = m_cp->core_->accountList_.getCurrencySharedPtr(m_cp->m_AccountID); int transID = pCopiedTrans->transactionID(); topItemIndex_ = m_selectedIndex; refreshVisualList(transID); @@ -1747,7 +1744,7 @@ SplitTransactionDialog splitTransDialog( core_, - core_->bTransactionList_.getBankTransactionPtr(transID)->splitEntries_.get(), + core_->bTransactionList_.getBankTransactionPtr(transID)->splitEntries_, transType, this ); Modified: trunk/src/mmcurrency.cpp =================================================================== --- trunk/src/mmcurrency.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/mmcurrency.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -111,7 +111,7 @@ SetCurrencySetting(getCurrencySharedPtr(currencySymbol, true)); } -void mmCurrencyList::SetCurrencySetting(std::shared_ptr<mmCurrency> pCurrency) const +void mmCurrencyList::SetCurrencySetting(mmCurrency* pCurrency) const { if (pCurrency) { @@ -140,7 +140,7 @@ info_table_->SetIntSetting("BASECURRENCYID", currencyID); } -int mmCurrencyList::AddCurrency(std::shared_ptr<mmCurrency> pCurrency) +int mmCurrencyList::AddCurrency(mmCurrency* pCurrency) { const mmCurrency &r = *pCurrency; std::vector<wxString> data; @@ -166,7 +166,7 @@ return currencyID; } -void mmCurrencyList::UpdateCurrency(std::shared_ptr<mmCurrency> pCurrency) +void mmCurrencyList::UpdateCurrency(mmCurrency* pCurrency) { wxASSERT(pCurrency->currencyID_ > 0); @@ -199,7 +199,7 @@ bool result = false; if (mmDBWrapper::deleteCurrency(db_.get(), currencyID)) { - std::vector <std::shared_ptr<mmCurrency> >::iterator Iter; + std::vector <mmCurrency* >::iterator Iter; for ( Iter = currencies_.begin( ) ; Iter != currencies_.end( ) ; Iter++ ) { if ((*Iter)->currencyID_ == currencyID) @@ -216,14 +216,9 @@ int mmCurrencyList::getCurrencyID(const wxString& currencyName, bool symbol) const { int currencyID = -1; - std::shared_ptr<mmCurrency> pCurrency = getCurrencySharedPtr(currencyName, symbol); - - if (pCurrency) - { - currencyID = pCurrency->currencyID_; - } - - return currencyID; + mmCurrency* pCurrency = getCurrencySharedPtr(currencyName, symbol); + currencyID = pCurrency->currencyID_; + return currencyID; } wxString mmCurrencyList::getCurrencyName(int currencyID, bool symbol) const @@ -239,7 +234,7 @@ return wxEmptyString; } -std::shared_ptr<mmCurrency> mmCurrencyList::getCurrencySharedPtr(int currencyID) const +mmCurrency* mmCurrencyList::getCurrencySharedPtr(int currencyID) const { for (const auto ¤cy: currencies_) { @@ -248,10 +243,10 @@ } wxASSERT(false); - return std::shared_ptr<mmCurrency>(); + return NULL; } -std::shared_ptr<mmCurrency> mmCurrencyList::getCurrencySharedPtr(const wxString& currencyName, bool symbol) const +mmCurrency* mmCurrencyList::getCurrencySharedPtr(const wxString& currencyName, bool symbol) const { for (const auto ¤cy: currencies_) { @@ -267,7 +262,7 @@ } } - return std::shared_ptr<mmCurrency>(); + return NULL; } void mmCurrencyList::LoadCurrencies() @@ -276,7 +271,7 @@ while (q1.NextRow()) { - std::shared_ptr<mmCurrency> pCurrency(new mmCurrency(q1)); + mmCurrency* pCurrency(new mmCurrency(q1)); currencies_.push_back(pCurrency); } Modified: trunk/src/mmcurrency.h =================================================================== --- trunk/src/mmcurrency.h 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/mmcurrency.h 2013-06-21 21:24:11 UTC (rev 4128) @@ -59,13 +59,13 @@ void LoadCurrencies(); /* Currency Functions */ - int AddCurrency(std::shared_ptr<mmCurrency> pCurrency); + int AddCurrency(mmCurrency* pCurrency); bool DeleteCurrency(int currencyID); - void UpdateCurrency(std::shared_ptr<mmCurrency> pCurrency); + void UpdateCurrency(mmCurrency* pCurrency); int getCurrencyID(const wxString& currencyName, bool symbol = false) const; wxString getCurrencyName(int currencyID, bool symbol = false) const; - std::shared_ptr<mmCurrency> getCurrencySharedPtr(int currencyID) const; - std::shared_ptr<mmCurrency> getCurrencySharedPtr(const wxString& currencyName, bool symbol = false) const; + mmCurrency* getCurrencySharedPtr(int currencyID) const; + mmCurrency* getCurrencySharedPtr(const wxString& currencyName, bool symbol = false) const; void LoadBaseCurrencySettings() const; void LoadCurrencySetting(const wxString& currencySymbol); @@ -73,15 +73,15 @@ void SetBaseCurrencySettings(int currencyID); bool OnlineUpdateCurRate(wxString& sError); - std::vector< std::shared_ptr<mmCurrency> > currencies_; + std::vector< mmCurrency* > currencies_; - typedef std::vector< std::shared_ptr<mmCurrency> >::const_iterator const_iterator; + typedef std::vector< mmCurrency* >::const_iterator const_iterator; private: std::shared_ptr<wxSQLite3Database> db_; std::shared_ptr<MMEX_IniSettings> info_table_; - void SetCurrencySetting(std::shared_ptr<mmCurrency> pCurrency) const; + void SetCurrencySetting(mmCurrency* pCurrency) const; }; #endif Modified: trunk/src/mmex.cpp =================================================================== --- trunk/src/mmex.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/mmex.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -499,9 +499,8 @@ } mmAccount* ptrBase = new mmAccount(); + mmAccount* pAccount(ptrBase); - std::shared_ptr<mmAccount> pAccount(ptrBase); - pAccount->favoriteAcct_ = true; pAccount->status_ = mmAccount::MMEX_Open; pAccount->acctType_ = acctTypeStr; @@ -1009,7 +1008,7 @@ continueExecution = true; mmBankTransaction tran(m_core.get()); - std::shared_ptr<mmCurrency> pCurrencyPtr = m_core.get()->accountList_.getCurrencySharedPtr(th.accountID_); + mmCurrency* pCurrencyPtr = m_core.get()->accountList_.getCurrencySharedPtr(th.accountID_); wxASSERT(pCurrencyPtr); tran.accountID_ = th.accountID_; @@ -1027,9 +1026,9 @@ tran.date_ = th.nextOccurDate_; tran.toAmt_ = th.toAmt_; - std::shared_ptr<mmSplitTransactionEntries> split(new mmSplitTransactionEntries()); + mmSplitTransactionEntries* split(new mmSplitTransactionEntries()); split->loadFromBDDB(m_core.get(),th.id_); - *tran.splitEntries_.get() = *split.get(); + *tran.splitEntries_ = *split; m_core.get()->bTransactionList_.addTransaction(&tran); } @@ -1834,7 +1833,7 @@ } else { - std::shared_ptr<mmAccount> pAccount = m_core->accountList_.GetAccountSharedPtr(data); + mmAccount* pAccount = m_core->accountList_.GetAccountSharedPtr(data); if (pAccount) { wxString acctType = pAccount->acctType_; @@ -1943,7 +1942,7 @@ if (selectedItemData_) { int data = selectedItemData_->getData(); - std::shared_ptr<mmAccount> pAccount = m_core->accountList_.GetAccountSharedPtr(data); + mmAccount* pAccount = m_core->accountList_.GetAccountSharedPtr(data); if (pAccount) { wxString website = pAccount->website_; @@ -1959,7 +1958,7 @@ if (selectedItemData_) { int data = selectedItemData_->getData(); - std::shared_ptr<mmAccount> pAccount = m_core->accountList_.GetAccountSharedPtr(data); + mmAccount* pAccount = m_core->accountList_.GetAccountSharedPtr(data); if (pAccount) { wxString acctType = pAccount->acctType_; @@ -1982,7 +1981,7 @@ if (selectedItemData_) { int data = selectedItemData_->getData(); - std::shared_ptr<mmAccount> pAccount = m_core->accountList_.GetAccountSharedPtr(data); + mmAccount* pAccount = m_core->accountList_.GetAccountSharedPtr(data); if (pAccount) { wxMessageDialog msgDlg(this, @@ -2028,7 +2027,7 @@ int data = iData->getData(); if (!iData->isBudgetingNode()) { - std::shared_ptr<mmAccount> pAccount = m_core->accountList_.GetAccountSharedPtr(data); + mmAccount* pAccount = m_core->accountList_.GetAccountSharedPtr(data); if (pAccount) { wxString acctType = pAccount->acctType_; @@ -3187,8 +3186,7 @@ { tran->reportCategAmount_ = tran->getAmountForSplit(categID, subcategID); - std::shared_ptr<mmCurrency> pCurrencyPtr = m_core.get()->accountList_.getCurrencySharedPtr(tran->accountID_); - wxASSERT(pCurrencyPtr); + mmCurrency* pCurrencyPtr = m_core.get()->accountList_.getCurrencySharedPtr(tran->accountID_); tran->reportCategAmountStr_ = CurrencyFormatter::float2String(tran->reportCategAmount_); } else Modified: trunk/src/mmhomepagepanel.cpp =================================================================== --- trunk/src/mmhomepagepanel.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/mmhomepagepanel.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -207,7 +207,7 @@ { if (account->acctType_ != type || account->status_ == mmAccount::MMEX_Closed) continue; - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(account->id_); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(account->id_); wxASSERT(pCurrencyPtr); CurrencyFormatter::instance().loadSettings(*pCurrencyPtr); @@ -295,7 +295,7 @@ double baseconvrate = q1.GetDouble("BASECONVRATE"); double stockGain = q1.GetDouble("GAIN"); - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(stockaccountId); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(stockaccountId); wxASSERT(pCurrencyPtr); CurrencyFormatter::instance().loadSettings(*pCurrencyPtr); @@ -429,7 +429,7 @@ double convRate = q1.GetDouble("BASECONVRATE"); wxString convRateStr; - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(accountId); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(accountId); wxASSERT(pCurrencyPtr); wxString tBalanceStr; @@ -672,7 +672,7 @@ colorStr = "#FF6600"; // Load the currency for this BD - std::shared_ptr<mmCurrency> pCurrency = core_->accountList_.getCurrencySharedPtr(trans_[bdidx].accountID_); + mmCurrency* pCurrency = core_->accountList_.getCurrencySharedPtr(trans_[bdidx].accountID_); wxASSERT(pCurrency); if (pCurrency) pCurrency->loadCurrencySettings(); Modified: trunk/src/mmtransaction.cpp =================================================================== --- trunk/src/mmtransaction.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/mmtransaction.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -21,7 +21,7 @@ #include "mmOption.h" #include "mmcoredb.h" -void mmSplitTransactionEntries::addSplit(std::shared_ptr<mmSplitTransactionEntry> split) +void mmSplitTransactionEntries::addSplit(mmSplitTransactionEntry* split) { entries_.push_back(split); } @@ -93,7 +93,7 @@ wxSQLite3ResultSet q1 = st.ExecuteQuery(); while (q1.NextRow()) { - std::shared_ptr<mmSplitTransactionEntry> pSplitEntry(new mmSplitTransactionEntry()); + mmSplitTransactionEntry* pSplitEntry(new mmSplitTransactionEntry()); pSplitEntry->splitEntryID_ = q1.GetInt("SPLITTRANSID"); pSplitEntry->splitAmount_ = q1.GetDouble("SPLITTRANSAMOUNT"); @@ -115,7 +115,7 @@ isInited_(false), updateRequired_(false) { - splitEntries_ = std::shared_ptr<mmSplitTransactionEntries>(new mmSplitTransactionEntries()); + splitEntries_ = new mmSplitTransactionEntries(); } mmBankTransaction::mmBankTransaction(mmCoreDB* core, wxSQLite3ResultSet& q1) @@ -140,11 +140,10 @@ subcategID_ = q1.GetInt("SUBCATEGID"); fullCatStr_ = core->categoryList_.GetFullCategoryString(categID_, subcategID_); - std::shared_ptr<mmCurrency> pCurrencyPtr = core->accountList_.getCurrencySharedPtr(accountID_); - wxASSERT(pCurrencyPtr); + mmCurrency* pCurrencyPtr = core->accountList_.getCurrencySharedPtr(accountID_); - splitEntries_ = std::shared_ptr<mmSplitTransactionEntries>(new mmSplitTransactionEntries()); - getSplitTransactions(splitEntries_.get()); + splitEntries_ = new mmSplitTransactionEntries(); + getSplitTransactions(splitEntries_); } bool mmBankTransaction::operator < (const mmBankTransaction& tran) const @@ -273,7 +272,7 @@ while (q1.NextRow()) { - std::shared_ptr<mmSplitTransactionEntry> pSplitEntry(new mmSplitTransactionEntry); + mmSplitTransactionEntry* pSplitEntry(new mmSplitTransactionEntry); pSplitEntry->splitEntryID_ = q1.GetInt("SPLITTRANSID"); pSplitEntry->splitAmount_ = q1.GetDouble("SPLITTRANSAMOUNT"); @@ -419,10 +418,10 @@ int transactionID = q1.GetInt("TRANSID"); if (pBankTransaction->categID_ == -1) { - mmSplitTransactionEntries* splits = pBankTransaction->splitEntries_.get(); + mmSplitTransactionEntries* splits = pBankTransaction->splitEntries_; mmBankTransaction* pTempTransaction = getBankTransactionPtr(transactionID); - mmSplitTransactionEntries* temp_splits = pTempTransaction->splitEntries_.get(); + mmSplitTransactionEntries* temp_splits = pTempTransaction->splitEntries_; if (splits->entries_.size() != temp_splits->entries_.size()) continue; @@ -477,9 +476,9 @@ pCopyTransaction->notes_ = pBankTransaction->notes_; // we need to create a new pointer for Split transactions. - std::shared_ptr<mmSplitTransactionEntries> splitTransEntries(new mmSplitTransactionEntries()); - pBankTransaction->getSplitTransactions(splitTransEntries.get()); - pCopyTransaction->splitEntries_.get()->entries_ = splitTransEntries->entries_; + mmSplitTransactionEntries* splitTransEntries(new mmSplitTransactionEntries()); + pBankTransaction->getSplitTransactions(splitTransEntries); + pCopyTransaction->splitEntries_->entries_ = splitTransEntries->entries_; if (checkForExistingTransaction(pCopyTransaction)) pCopyTransaction->status_ = "D"; @@ -560,7 +559,7 @@ void mmBankTransactionList::LoadAccountTransactions(int accountID) { accountTransactions_.clear(); - std::shared_ptr<mmAccount> pAccount = core_->accountList_.GetAccountSharedPtr(accountID); + mmAccount* pAccount = core_->accountList_.GetAccountSharedPtr(accountID); double balance = pAccount->initialBalance_; for (const auto& pBankTransaction: transactions_) { @@ -684,7 +683,7 @@ double convRate = 1; for (const auto& account: core_->accountList_.accounts_) { - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(account->id_); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(account->id_); wxASSERT(pCurrencyPtr); CurrencyFormatter::instance().loadSettings(*pCurrencyPtr); double rate = pCurrencyPtr->baseConv_; @@ -748,7 +747,7 @@ double convRate = 1; for (const auto& account: core_->accountList_.accounts_) { - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(account->id_); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(account->id_); wxASSERT(pCurrencyPtr); CurrencyFormatter::instance().loadSettings(*pCurrencyPtr); double rate = pCurrencyPtr->baseConv_; @@ -1215,7 +1214,7 @@ } else if (pBankTransaction && (pBankTransaction->categID_ == -1)) { - mmSplitTransactionEntries* splits = pBankTransaction->splitEntries_.get(); + mmSplitTransactionEntries* splits = pBankTransaction->splitEntries_; pBankTransaction->getSplitTransactions(splits); for (int i = 0; i < (int)splits->entries_.size(); ++i) @@ -1259,7 +1258,7 @@ sum -= pBankTransaction->amt_; } - mmSplitTransactionEntries* splits = pBankTransaction->splitEntries_.get(); + mmSplitTransactionEntries* splits = pBankTransaction->splitEntries_; for (int i = 0; i < (int)splits->entries_.size(); ++i) { Modified: trunk/src/mmtransaction.h =================================================================== --- trunk/src/mmtransaction.h 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/mmtransaction.h 2013-06-21 21:24:11 UTC (rev 4128) @@ -62,14 +62,14 @@ double getTotalSplits() const; double getUpdatedTotalSplits() const; - void addSplit(std::shared_ptr<mmSplitTransactionEntry> split); + void addSplit(mmSplitTransactionEntry* split); void removeSplit(int splitID); void removeSplitByIndex(int splitIndex); void updateToDB(std::shared_ptr<wxSQLite3Database>& db, int transID, bool edit); void loadFromBDDB(mmCoreDB* core, int bdID); - std::vector<std::shared_ptr<mmSplitTransactionEntry> > entries_; + std::vector<mmSplitTransactionEntry* > entries_; }; class mmBankTransaction : public mmTransaction @@ -102,7 +102,7 @@ int accountID_; int toAccountID_; - std::shared_ptr<mmSplitTransactionEntries> splitEntries_; + mmSplitTransactionEntries* splitEntries_; /* Derived Data */ wxString dateStr_; Modified: trunk/src/newacctdialog.cpp =================================================================== --- trunk/src/newacctdialog.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/newacctdialog.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -82,7 +82,7 @@ void mmNewAcctDialog::fillControlsWithData() { this->SetTitle(_("Edit Account")); - std::shared_ptr<mmAccount> pAccount = core_->accountList_.GetAccountSharedPtr(accountID_); + mmAccount* pAccount = core_->accountList_.GetAccountSharedPtr(accountID_); wxASSERT(pAccount); textAccountName_->SetValue(pAccount->name_); @@ -123,7 +123,7 @@ textCtrl = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_INITBALANCE); double initBal = pAccount->initialBalance_; - std::shared_ptr<mmCurrency> pCurrency = pAccount->currency_; + mmCurrency* pCurrency = pAccount->currency_; wxASSERT(pCurrency); wxButton* bn = (wxButton*)FindWindow(ID_DIALOG_NEWACCT_BUTTON_CURRENCY); @@ -353,10 +353,10 @@ wxChoice* itemAcctType = (wxChoice*)FindWindow(ID_DIALOG_NEWACCT_COMBO_ACCTTYPE); int acctType = itemAcctType->GetSelection(); - std::shared_ptr<mmAccount> pAccount; + mmAccount* pAccount; if (!edit_) { - std::shared_ptr<mmAccount> tAccount(new mmAccount()); + mmAccount* tAccount(new mmAccount()); pAccount = tAccount; } else Modified: trunk/src/qif_export.cpp =================================================================== --- trunk/src/qif_export.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/qif_export.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -318,9 +318,9 @@ wxString buffer = ""; if (qif) { - std::shared_ptr<mmAccount> pAccount = core_->accountList_.GetAccountSharedPtr(accountID); + mmAccount* pAccount = core_->accountList_.GetAccountSharedPtr(accountID); wxASSERT(pAccount); - std::shared_ptr<mmCurrency> pCurrency = pAccount->currency_; + mmCurrency* pCurrency = pAccount->currency_; wxASSERT(pCurrency); const wxString sAccName = core_->accountList_.GetAccountName(accountID); @@ -488,7 +488,7 @@ //if categ id is empty that mean this is split transaction if (pBankTransaction->categID_ == -1) { - mmSplitTransactionEntries* splits = pBankTransaction->splitEntries_.get(); + mmSplitTransactionEntries* splits = pBankTransaction->splitEntries_; pBankTransaction->getSplitTransactions(splits); for (int i = 0; i < (int)splits->entries_.size(); ++i) Modified: trunk/src/qif_import.cpp =================================================================== --- trunk/src/qif_import.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/qif_import.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -456,7 +456,7 @@ { //TODO: Repeated code mmAccount* ptrBase = new mmAccount(); - std::shared_ptr<mmAccount> pAccount(ptrBase); + mmAccount* pAccount(ptrBase); pAccount->favoriteAcct_ = true; pAccount->status_ = mmAccount::MMEX_Open; @@ -592,7 +592,7 @@ if (type == TRANS_TYPE_WITHDRAWAL_STR) dSplitAmount = -dSplitAmount; //Add split entry - std::shared_ptr<mmSplitTransactionEntry> pSplitEntry(new mmSplitTransactionEntry); + mmSplitTransactionEntry* pSplitEntry(new mmSplitTransactionEntry); pSplitEntry->splitAmount_ = dSplitAmount; pSplitEntry->categID_ = categID; pSplitEntry->subCategID_ = subCategID; @@ -644,7 +644,7 @@ if (accounts_name.Index(sToAccountName) == wxNOT_FOUND) { mmAccount* ptrBase = new mmAccount(); - std::shared_ptr<mmAccount> pAccount(ptrBase); + mmAccount* pAccount(ptrBase); pAccount->favoriteAcct_ = true; pAccount->status_ = mmAccount::MMEX_Open; @@ -766,7 +766,7 @@ pTransaction->fullCatStr_ = core_->categoryList_.GetFullCategoryString(categID, subCategID); *pTransaction->splitEntries_ = *mmSplit; - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(from_account_id); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(from_account_id); wxASSERT(pCurrencyPtr); //For any transfer transaction always mirrored transaction present @@ -822,7 +822,7 @@ for (const auto& refTrans : vQIF_trxs) { //fromAccountID = refTrans->accountID_; - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(fromAccountID); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(fromAccountID); wxASSERT(pCurrencyPtr); refTrans->amt_ = fabs(refTrans->amt_); refTrans->toAmt_ = fabs(refTrans->toAmt_); Modified: trunk/src/reports/cashflow.cpp =================================================================== --- trunk/src/reports/cashflow.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/reports/cashflow.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -148,7 +148,7 @@ core_->bTransactionList_.getDailyBalance(core_, account->id_, daily_balance); - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(account->id_); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(account->id_); wxASSERT(pCurrencyPtr); CurrencyFormatter::instance().loadSettings(*pCurrencyPtr); double rate = pCurrencyPtr->baseConv_; Modified: trunk/src/reports/summary.cpp =================================================================== --- trunk/src/reports/summary.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/reports/summary.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -52,7 +52,7 @@ { double bal = account->initialBalance_ + core_->bTransactionList_.getBalance(account->id_, mmIniOptions::instance().ignoreFutureTransactions_); - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(account->id_); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(account->id_); wxASSERT(pCurrencyPtr); CurrencyFormatter::instance().loadSettings(*pCurrencyPtr); double rate = pCurrencyPtr->baseConv_; @@ -84,7 +84,7 @@ { double bal = account->initialBalance_ + core_->bTransactionList_.getBalance(account->id_, mmIniOptions::instance().ignoreFutureTransactions_); - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(account->id_); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(account->id_); wxASSERT(pCurrencyPtr); CurrencyFormatter::instance().loadSettings(*pCurrencyPtr); double rate = pCurrencyPtr->baseConv_; Modified: trunk/src/reports/transactions.cpp =================================================================== --- trunk/src/reports/transactions.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/reports/transactions.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -92,10 +92,11 @@ if ( refAccountID_ > -1 && transaction.transType_ == TRANS_TYPE_TRANSFER_STR && (refAccountID_ == transaction.accountID_ || refAccountID_ == transaction.toAccountID_) ) { - const std::shared_ptr<mmAccount> pAccount = core_->accountList_.GetAccountSharedPtr(refAccountID_); - const std::shared_ptr<mmCurrency> pCurrency = pAccount->currency_; + const mmAccount* pAccount = core_->accountList_.GetAccountSharedPtr(refAccountID_); + const mmCurrency* pCurrency = pAccount->currency_; wxASSERT(pCurrency); - pCurrency->loadCurrencySettings(); + //FIXME: + //pCurrency->loadCurrencySettings(); } bool negativeTransAmount = false; // this can be either a transfer or withdrawl Modified: trunk/src/splittransactionsdialog.cpp =================================================================== --- trunk/src/splittransactionsdialog.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/splittransactionsdialog.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -182,7 +182,7 @@ lcSplit_->SetItem(numToInsert, 1, CurrencyFormatter::float2String(*sdd.m_amount_)); - std::shared_ptr<mmSplitTransactionEntry> pSplitEntry(new mmSplitTransactionEntry); + mmSplitTransactionEntry* pSplitEntry(new mmSplitTransactionEntry); pSplitEntry->splitAmount_ = *sdd.m_amount_; pSplitEntry->categID_ = categID; pSplitEntry->subCategID_ = subcategID; Modified: trunk/src/stockspanel.cpp =================================================================== --- trunk/src/stockspanel.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/stockspanel.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -415,7 +415,7 @@ //mmDBWrapper::loadCurrencySettings(core_->db_.get(), accountID_); double originalVal = 0.0; - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(accountID_); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(accountID_); wxASSERT(pCurrencyPtr); CurrencyFormatter::instance().loadSettings(*pCurrencyPtr); Modified: trunk/src/tests/dbwrapper_test.cpp =================================================================== --- trunk/src/tests/dbwrapper_test.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/tests/dbwrapper_test.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -575,7 +575,7 @@ // -- int payeeID = pCore->payeeList_.AddPayee(g_PayeeName); - std::shared_ptr<mmPayee> pPayee = pCore->payeeList_.GetPayeeSharedPtr(payeeID); + mmPayee* pPayee = pCore->payeeList_.GetPayeeSharedPtr(payeeID); pPayee->categoryId_ = cat_id; pPayee->subcategoryId_ = sc_id; int errCode = pCore->payeeList_.UpdatePayee(pPayee->id_, pPayee->name_); @@ -619,7 +619,7 @@ int payee_id = pCore->payeeList_.GetPayeeId(g_PayeeName); CHECK(payee_id != -1); - std::shared_ptr<mmPayee> pPayee = pCore->payeeList_.GetPayeeSharedPtr(payee_id); + mmPayee* pPayee = pCore->payeeList_.GetPayeeSharedPtr(payee_id); CHECK(pPayee->name_ == g_PayeeName); CHECK(pPayee->categoryId_ != 0); CHECK(pPayee->subcategoryId_ != 0); @@ -639,7 +639,7 @@ int payee_id = pCore->payeeList_.GetPayeeId(g_PayeeName); CHECK(payee_id != -1); - std::shared_ptr<mmPayee> pPayee = pCore->payeeList_.GetPayeeSharedPtr(payee_id); + mmPayee* pPayee = pCore->payeeList_.GetPayeeSharedPtr(payee_id); int cat = pPayee->categoryId_; int subcat = pPayee->subcategoryId_; Modified: trunk/src/transdialog.cpp =================================================================== --- trunk/src/transdialog.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/transdialog.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -92,7 +92,7 @@ SetIcon(mmex::getProgramIcon()); - std::shared_ptr<mmSplitTransactionEntries> split(new mmSplitTransactionEntries()); + mmSplitTransactionEntries* split(new mmSplitTransactionEntries()); split_ = split; dataToControls(); @@ -175,8 +175,8 @@ updateControlsForTransType(); if (edit_) { - *split_.get() = *core_->bTransactionList_.getBankTransactionPtr( - pBankTransaction_->transactionID())->splitEntries_.get(); + *split_ = *core_->bTransactionList_.getBankTransactionPtr( + pBankTransaction_->transactionID())->splitEntries_; } else { @@ -901,7 +901,7 @@ , pBankTransaction_->transactionID()); } - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(newAccountID_); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(newAccountID_); wxASSERT(pCurrencyPtr); pTransaction->accountID_ = newAccountID_; @@ -918,7 +918,7 @@ pTransaction->date_ = dpc_->GetValue(); pTransaction->toAmt_ = toTransAmount_; - *pTransaction->splitEntries_.get() = *split_.get(); + *pTransaction->splitEntries_ = *split_; if (!edit_) { @@ -1093,7 +1093,7 @@ void mmTransDialog::activateSplitTransactionsDlg() { bool bDeposit = sTransaction_type_ == TRANS_TYPE_DEPOSIT_STR; - std::shared_ptr<mmSplitTransactionEntry> pSplitEntry(new mmSplitTransactionEntry); + mmSplitTransactionEntry* pSplitEntry(new mmSplitTransactionEntry); if (categID_ > -1) { wxString sAmount = textAmount_->GetValue(); @@ -1107,7 +1107,7 @@ categID_ = -1; subcategID_ = -1; - SplitTransactionDialog dlg(core_, split_.get(), transaction_type_->GetSelection(), this); + SplitTransactionDialog dlg(core_, split_, transaction_type_->GetSelection(), this); if (dlg.ShowModal() == wxID_OK) { double amount = split_->getTotalSplits(); @@ -1149,8 +1149,8 @@ this->SetTitle(_("Duplicate Transaction")); // we need to create a new pointer for Split transactions. - std::shared_ptr<mmSplitTransactionEntries> splitTransEntries(new mmSplitTransactionEntries()); + mmSplitTransactionEntries* splitTransEntries(new mmSplitTransactionEntries()); core_->bTransactionList_.getBankTransactionPtr(accountID_ - , pBankTransaction_->transactionID())->getSplitTransactions(splitTransEntries.get()); - split_.get()->entries_ = splitTransEntries->entries_; + , pBankTransaction_->transactionID())->getSplitTransactions(splitTransEntries); + split_->entries_ = splitTransEntries->entries_; } Modified: trunk/src/transdialog.h =================================================================== --- trunk/src/transdialog.h 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/transdialog.h 2013-06-21 21:24:11 UTC (rev 4128) @@ -134,7 +134,7 @@ double toTransAmount_; double transAmount_; bool advancedToTransAmountSet_; - std::shared_ptr<mmSplitTransactionEntries> split_; + mmSplitTransactionEntries* split_; // store the original currency rate for transaction editing double edit_currency_rate; Modified: trunk/src/univcsvdialog.cpp =================================================================== --- trunk/src/univcsvdialog.cpp 2013-06-21 18:08:23 UTC (rev 4127) +++ trunk/src/univcsvdialog.cpp 2013-06-21 21:24:11 UTC (rev 4128) @@ -553,7 +553,7 @@ if (fromAccountID_ > 0) { - std::shared_ptr<mmCurrency> pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(fromAccountID_); + mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(fromAccountID_); wxASSERT(pCurrencyPtr); CurrencyFormatter::instance().loadSettings(*pCurrencyPtr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-06-22 01:24:51
|
Revision: 4129 http://sourceforge.net/p/moneymanagerex/code/4129 Author: guanlisheng Date: 2013-06-22 01:24:47 +0000 (Sat, 22 Jun 2013) Log Message: ----------- remove shared_ptr fro MMEX_IniSettings Modified Paths: -------------- trunk/src/appstartdialog.cpp trunk/src/appstartdialog.h trunk/src/dbwrapper.cpp trunk/src/dbwrapper.h trunk/src/lua_interface.cpp trunk/src/mmOption.cpp trunk/src/mmOption.h trunk/src/mmcheckingpanel.cpp trunk/src/mmcoredb.cpp trunk/src/mmcoredb.h trunk/src/mmcurrency.cpp trunk/src/mmcurrency.h trunk/src/mmex.cpp trunk/src/mmex.h trunk/src/recentfiles.cpp trunk/src/recentfiles.h trunk/src/util.cpp trunk/src/util.h Modified: trunk/src/appstartdialog.cpp =================================================================== --- trunk/src/appstartdialog.cpp 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/appstartdialog.cpp 2013-06-22 01:24:47 UTC (rev 4129) @@ -45,7 +45,7 @@ {} -mmAppStartDialog::mmAppStartDialog(std::shared_ptr<MMEX_IniSettings> pIniSettings, wxWindow* parent) +mmAppStartDialog::mmAppStartDialog(MMEX_IniSettings* pIniSettings, wxWindow* parent) : pIniSettings_(pIniSettings) , itemCheckBox() { Modified: trunk/src/appstartdialog.h =================================================================== --- trunk/src/appstartdialog.h 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/appstartdialog.h 2013-06-22 01:24:47 UTC (rev 4129) @@ -33,13 +33,13 @@ public: mmAppStartDialog(); - mmAppStartDialog(std::shared_ptr<MMEX_IniSettings> pIniSettings, wxWindow* parent); + mmAppStartDialog(MMEX_IniSettings* pIniSettings, wxWindow* parent); ~mmAppStartDialog(); void SetCloseButtonToExit(); private: - std::shared_ptr<MMEX_IniSettings> pIniSettings_; + MMEX_IniSettings* pIniSettings_; wxCheckBox* itemCheckBox; wxButton* itemButtonClose_; wxButton* itemButtonExit_; Modified: trunk/src/dbwrapper.cpp =================================================================== --- trunk/src/dbwrapper.cpp 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/dbwrapper.cpp 2013-06-22 01:24:47 UTC (rev 4129) @@ -1307,7 +1307,7 @@ } //---------------------------------------------------------------------------- -wxString mmDBWrapper::getLastDbPath(std::shared_ptr<MMEX_IniSettings> iniSettings, const wxString &defaultVal) +wxString mmDBWrapper::getLastDbPath(MMEX_IniSettings* iniSettings, const wxString &defaultVal) { wxString path = iniSettings->GetStringSetting("LASTFILENAME", defaultVal); Modified: trunk/src/dbwrapper.h =================================================================== --- trunk/src/dbwrapper.h 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/dbwrapper.h 2013-06-22 01:24:47 UTC (rev 4129) @@ -596,7 +596,7 @@ bool deleteCurrency(wxSQLite3Database* db, int currencyID); int mmSQLiteExecuteUpdate(wxSQLite3Database* db, std::vector<wxString> data, const wxString& sql, long &lLastRowId); -wxString getLastDbPath(std::shared_ptr<MMEX_IniSettings> iniSettings, const wxString &defaultVal = wxGetEmptyString()); +wxString getLastDbPath(MMEX_IniSettings* iniSettings, const wxString &defaultVal = wxGetEmptyString()); /* Stocks API */ void deleteStockInvestment(wxSQLite3Database* db, int stockID); Modified: trunk/src/lua_interface.cpp =================================================================== --- trunk/src/lua_interface.cpp 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/lua_interface.cpp 2013-06-22 01:24:47 UTC (rev 4129) @@ -28,8 +28,7 @@ TLuaInterface::TLuaInterface(mmHTMLBuilder* hb) { this->html_builder_ = hb; - std::shared_ptr<MMEX_IniSettings> info_table; - info_table.reset(new MMEX_IniSettings(static_db_ptr(), true)); + MMEX_IniSettings* info_table = new MMEX_IniSettings(static_db_ptr(), true); g_static_currency_list = new mmCurrencyList(static_db_ptr()); g_static_currency_list->SetInfoTable(info_table); Modified: trunk/src/mmOption.cpp =================================================================== --- trunk/src/mmOption.cpp 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/mmOption.cpp 2013-06-22 01:24:47 UTC (rev 4129) @@ -90,7 +90,7 @@ return Singleton<mmIniOptions>::instance(); } -void mmIniOptions::loadOptions(std::shared_ptr<MMEX_IniSettings> pIniSettings) +void mmIniOptions::loadOptions(MMEX_IniSettings* pIniSettings) { expandStocksHome_ = pIniSettings->GetBoolSetting("ENABLESTOCKS", true); enableAssets_ = pIniSettings->GetBoolSetting("ENABLEASSETS", true); Modified: trunk/src/mmOption.h =================================================================== --- trunk/src/mmOption.h 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/mmOption.h 2013-06-22 01:24:47 UTC (rev 4129) @@ -51,7 +51,7 @@ public: mmIniOptions(); static mmIniOptions& instance(); - void loadOptions(std::shared_ptr<MMEX_IniSettings> pIniSettings); + void loadOptions(MMEX_IniSettings* pIniSettings); int account_image_id(mmCoreDB* core, int account_id); bool enableAssets_; Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/mmcheckingpanel.cpp 2013-06-22 01:24:47 UTC (rev 4129) @@ -585,7 +585,7 @@ m_listCtrlAccount->setSortColumn(g_sortcol); m_listCtrlAccount->SetFocus(); - createColumns(core_->iniSettings_.get(), *m_listCtrlAccount); + createColumns(core_->iniSettings_, *m_listCtrlAccount); // load the global variables long val = COL_DEF_SORT; Modified: trunk/src/mmcoredb.cpp =================================================================== --- trunk/src/mmcoredb.cpp 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/mmcoredb.cpp 2013-06-22 01:24:47 UTC (rev 4129) @@ -23,7 +23,7 @@ #include "mmOption.h" //---------------------------------------------------------------------------- -mmCoreDB::mmCoreDB(std::shared_ptr<wxSQLite3Database> db, std::shared_ptr<MMEX_IniSettings> iniSettings) +mmCoreDB::mmCoreDB(std::shared_ptr<wxSQLite3Database> db, MMEX_IniSettings* iniSettings) : db_(db) , iniSettings_(iniSettings) , payeeList_(this) @@ -39,7 +39,7 @@ } // Create a global listing for info settings. - dbInfoSettings_.reset(new MMEX_IniSettings(db, true)); + dbInfoSettings_ = new MMEX_IniSettings(db, true); currencyList_.SetInfoTable(dbInfoSettings_); // Initialize the database if creating a new one. @@ -51,7 +51,7 @@ dbInfoSettings_->SetStringSetting("DATEFORMAT", mmex::DEFDATEFORMAT); dbInfoSettings_->Save(); } - mmOptions::instance().loadOptions(dbInfoSettings_.get()); + mmOptions::instance().loadOptions(dbInfoSettings_); /* Create the appropriate tables first if required */ mmDBWrapper::initDB(db_.get()); Modified: trunk/src/mmcoredb.h =================================================================== --- trunk/src/mmcoredb.h 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/mmcoredb.h 2013-06-22 01:24:47 UTC (rev 4129) @@ -40,14 +40,14 @@ class mmCoreDB { public: - mmCoreDB(std::shared_ptr<wxSQLite3Database> db, std::shared_ptr<MMEX_IniSettings> iniSettings); + mmCoreDB(std::shared_ptr<wxSQLite3Database> db, MMEX_IniSettings* iniSettings); // Global access point to the database. std::shared_ptr<wxSQLite3Database> db_; // Global access point to inidb settings - std::shared_ptr<MMEX_IniSettings> iniSettings_; + MMEX_IniSettings* iniSettings_; // Global access point to database information settings - std::shared_ptr<MMEX_IniSettings> dbInfoSettings_; + MMEX_IniSettings* dbInfoSettings_; /* These variables form a global data access point. */ mmCurrencyList currencyList_; Modified: trunk/src/mmcurrency.cpp =================================================================== --- trunk/src/mmcurrency.cpp 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/mmcurrency.cpp 2013-06-22 01:24:47 UTC (rev 4129) @@ -86,7 +86,7 @@ , info_table_() {} -void mmCurrencyList::SetInfoTable(std::shared_ptr<MMEX_IniSettings> info_table) +void mmCurrencyList::SetInfoTable(MMEX_IniSettings* info_table) { info_table_ = info_table; } Modified: trunk/src/mmcurrency.h =================================================================== --- trunk/src/mmcurrency.h 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/mmcurrency.h 2013-06-22 01:24:47 UTC (rev 4129) @@ -55,7 +55,7 @@ mmCurrencyList(std::shared_ptr<wxSQLite3Database> db); /// Must be called after currency list object is created. - void SetInfoTable(std::shared_ptr<MMEX_IniSettings> info_table); + void SetInfoTable(MMEX_IniSettings* info_table); void LoadCurrencies(); /* Currency Functions */ @@ -79,7 +79,7 @@ private: std::shared_ptr<wxSQLite3Database> db_; - std::shared_ptr<MMEX_IniSettings> info_table_; + MMEX_IniSettings* info_table_; void SetCurrencySetting(mmCurrency* pCurrency) const; }; Modified: trunk/src/mmex.cpp =================================================================== --- trunk/src/mmex.cpp 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/mmex.cpp 2013-06-22 01:24:47 UTC (rev 4129) @@ -168,7 +168,7 @@ std::shared_ptr<wxSQLite3Database> pIniSettingsDb(new wxSQLite3Database); pIniSettingsDb.get()->Open(mmex::getPathUser(mmex::SETTINGS)); - std::shared_ptr<MMEX_IniSettings> pIniSettings(new MMEX_IniSettings(pIniSettingsDb)); + MMEX_IniSettings* pIniSettings = new MMEX_IniSettings(pIniSettingsDb); /* Load Colors from Database */ mmLoadColorsFromDatabase(pIniSettings); @@ -608,7 +608,7 @@ mmGUIFrame::mmGUIFrame(const wxString& title, const wxPoint& pos, const wxSize& size, - std::shared_ptr<MMEX_IniSettings> pIniSettings) + MMEX_IniSettings* pIniSettings) : wxFrame(0, -1, title, pos, size) , m_inisettings(pIniSettings) , gotoAccountID_(-1) @@ -2697,7 +2697,7 @@ m_core->currencyList_.LoadBaseCurrencySettings(); /* Load User Name and Other Settings */ - mmOptions::instance().loadOptions(m_core->dbInfoSettings_.get()); + mmOptions::instance().loadOptions(m_core->dbInfoSettings_); /* Jump to new account creation screen */ wxCommandEvent evt; Modified: trunk/src/mmex.h =================================================================== --- trunk/src/mmex.h 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/mmex.h 2013-06-22 01:24:47 UTC (rev 4129) @@ -159,7 +159,7 @@ mmGUIFrame(const wxString& title, const wxPoint& pos, const wxSize& size, - std::shared_ptr<MMEX_IniSettings> pIniSettings); + MMEX_IniSettings* pIniSettings); ~mmGUIFrame(); @@ -222,7 +222,7 @@ /* handles to SQLite Database */ std::shared_ptr<wxSQLite3Database> m_db; - std::shared_ptr<MMEX_IniSettings> m_inisettings; + MMEX_IniSettings* m_inisettings; /* Currently open file name */ wxString fileName_; Modified: trunk/src/recentfiles.cpp =================================================================== --- trunk/src/recentfiles.cpp 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/recentfiles.cpp 2013-06-22 01:24:47 UTC (rev 4129) @@ -19,7 +19,7 @@ #include "recentfiles.h" #include "guiid.h" -RecentDatabaseFiles::RecentDatabaseFiles(std::shared_ptr<MMEX_IniSettings> pIniSettings, wxMenu *menuRecentFiles) +RecentDatabaseFiles::RecentDatabaseFiles(MMEX_IniSettings* pIniSettings, wxMenu *menuRecentFiles) : pIniSettings_(pIniSettings) , menuRecentFiles_(menuRecentFiles) , recentListSize_(6) Modified: trunk/src/recentfiles.h =================================================================== --- trunk/src/recentfiles.h 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/recentfiles.h 2013-06-22 01:24:47 UTC (rev 4129) @@ -30,7 +30,7 @@ { public: // This constructor is for recent files list - RecentDatabaseFiles(std::shared_ptr<MMEX_IniSettings> pIniSettings, wxMenu *menuRecentFiles); + RecentDatabaseFiles(MMEX_IniSettings* pIniSettings, wxMenu *menuRecentFiles); ~RecentDatabaseFiles(); void loadRecentList(); @@ -44,7 +44,7 @@ bool validLastListedFile(wxString& lastListedFileName); private: - std::shared_ptr<MMEX_IniSettings> pIniSettings_; + MMEX_IniSettings* pIniSettings_; wxMenu *menuRecentFiles_; wxArrayString recentFileList_; Modified: trunk/src/util.cpp =================================================================== --- trunk/src/util.cpp 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/util.cpp 2013-06-22 01:24:47 UTC (rev 4129) @@ -91,7 +91,7 @@ locale.AddCatalog(lang) calls wxLogWarning and returns true for corrupted .mo file, so I should use locale.IsLoaded(lang) also. */ -wxString mmSelectLanguage(wxWindow *parent, std::shared_ptr<MMEX_IniSettings> pIniSettings, bool forced_show_dlg, bool save_setting) +wxString mmSelectLanguage(wxWindow *parent, MMEX_IniSettings* pIniSettings, bool forced_show_dlg, bool save_setting) { wxString lang; @@ -279,7 +279,7 @@ } -void mmLoadColorsFromDatabase(std::shared_ptr<MMEX_IniSettings> pIniSettings) +void mmLoadColorsFromDatabase(MMEX_IniSettings* pIniSettings) { mmColors::listAlternativeColor0 = mmGetColourFromString(pIniSettings->GetStringSetting("LISTALT0", "225,237,251")); mmColors::listAlternativeColor1 = mmGetColourFromString(pIniSettings->GetStringSetting("LISTALT1", "255,255,255")); Modified: trunk/src/util.h =================================================================== --- trunk/src/util.h 2013-06-21 21:24:11 UTC (rev 4128) +++ trunk/src/util.h 2013-06-22 01:24:47 UTC (rev 4129) @@ -85,7 +85,7 @@ void mmShowErrorMessageInvalid( wxWindow *parent, const wxString &message ); void mmShowErrorMessage( wxWindow *parent, const wxString &message, const wxString &messageheader ); -wxString mmSelectLanguage(wxWindow *parent, std::shared_ptr<MMEX_IniSettings> pIniSettings, bool forced_show_dlg, bool save_setting = true); +wxString mmSelectLanguage(wxWindow *parent, MMEX_IniSettings* pIniSettings, bool forced_show_dlg, bool save_setting = true); wxDateTime mmGetStorageStringAsDate( const wxString& str ); wxString mmGetDateForDisplay( const wxDateTime &dt ); @@ -98,7 +98,7 @@ void correctEmptyFileExt(const wxString& ext, wxString & fileName ); -void mmLoadColorsFromDatabase(std::shared_ptr<MMEX_IniSettings> pIniSettings); +void mmLoadColorsFromDatabase(MMEX_IniSettings* pIniSettings); wxColour mmGetColourFromString( const wxString& str ); wxString mmGetStringFromColour( wxColour color ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-22 04:40:55
|
Revision: 4131 http://sourceforge.net/p/moneymanagerex/code/4131 Author: vomikan Date: 2013-06-22 04:40:52 +0000 (Sat, 22 Jun 2013) Log Message: ----------- transaction filter presettings added Modified Paths: -------------- trunk/src/filtertransdialog.cpp trunk/src/filtertransdialog.h trunk/src/mmcheckingpanel.cpp trunk/src/mmcheckingpanel.h Modified: trunk/src/filtertransdialog.cpp =================================================================== --- trunk/src/filtertransdialog.cpp 2013-06-22 03:33:32 UTC (rev 4130) +++ trunk/src/filtertransdialog.cpp 2013-06-22 04:40:52 UTC (rev 4131) @@ -655,11 +655,37 @@ return settings_string_; } -void mmFilterTransactionsDialog::setAccountToolTip(wxString tip) const +void mmFilterTransactionsDialog::setAccountToolTip(const wxString& tip) const { accountDropDown_->SetToolTip(tip); } +void mmFilterTransactionsDialog::setPresettings(const wxString& view) +{ + //TODO: not finished + wxLogDebug(view); + if (view == VIEW_TRANS_ALL_STR) + { + dateRangeCheckBox_->SetValue(false); + date_range_ = new mmAllTime(); + } + else if (view == VIEW_TRANS_CURRENT_MONTH_STR) + { + dateRangeCheckBox_->SetValue(true); + date_range_ = new mmCurrentMonth; + fromDateCtrl_->SetValue(date_range_->start_date()); + toDateControl_->SetValue(date_range_->end_date()); + } + else if (view == VIEW_TRANS_LAST_30_DAYS_STR) + { + dateRangeCheckBox_->SetValue(true); + date_range_ = new mmLast30Days; + fromDateCtrl_->SetValue(date_range_->start_date()); + toDateControl_->SetValue(date_range_->end_date()); + } + +} + void mmFilterTransactionsDialog::OnPayeeUpdated(wxCommandEvent& event) { wxString value = cbPayee_->GetValue().Lower(); @@ -680,9 +706,7 @@ cbPayee_ ->Append(data[i]); } -#if wxCHECK_VERSION(2,9,0) - cbPayee_->AutoComplete(data); -#endif + cbPayee_->AutoComplete(data); if (cbPayee_->GetCount() == 1) cbPayee_->SetSelection(0); Modified: trunk/src/filtertransdialog.h =================================================================== --- trunk/src/filtertransdialog.h 2013-06-22 03:33:32 UTC (rev 4130) +++ trunk/src/filtertransdialog.h 2013-06-22 04:40:52 UTC (rev 4131) @@ -8,6 +8,7 @@ #endif #include "mmcoredb.h" +#include "reports/mmDateRange.h" #define ID_MYDIALOG9 10095 #define SYMBOL_MMFILTERTRANSACTIONSDIALOG_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX @@ -21,6 +22,8 @@ #define wxFIXED_MINSIZE 0 #endif +class mmDateRange; + class mmFilterTransactionsDialog: public wxDialog { DECLARE_DYNAMIC_CLASS( mmFilterTransactionsDialog ) @@ -88,7 +91,8 @@ /// Returns true with valid dates, when the dialog date range is selected. bool getDateRange(wxDateTime& startDate, wxDateTime& endDate) const; - void setAccountToolTip(wxString tip) const; + void setAccountToolTip(const wxString& tip) const; + void setPresettings(const wxString& view); private: /// Creation @@ -145,8 +149,10 @@ wxRadioBox* m_radio_box_; wxCheckBox* transNumberCheckBox_; wxTextCtrl* transNumberEdit_; + //TODO: remove std::shared_ptr std::vector< std::shared_ptr<mmBankTransaction> >* trans_; mmCoreDB* core_; + mmDateRange* date_range_; int categID_; int subcategID_; Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-22 03:33:32 UTC (rev 4130) +++ trunk/src/mmcheckingpanel.cpp 2013-06-22 04:40:52 UTC (rev 4131) @@ -269,12 +269,14 @@ GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); + //TODO: Load currency settings for current account /* Set up the transaction filter. The transFilter dialog will be destroyed when the checking panel is destroyed. */ transFilterActive_ = false; transFilterDlg_ = new mmFilterTransactionsDialog(core_, this); initViewTransactionsHeader(); + initFilterSettings(); initVirtualListControl(); windowsFreezeThaw(this); @@ -898,6 +900,10 @@ stxtMainFilter_->SetLabel(wxGetTranslation(currentView_)); } //---------------------------------------------------------------------------- +void mmCheckingPanel::initFilterSettings() +{ + transFilterDlg_->setPresettings(currentView_); +} void mmCheckingPanel::OnFilterResetToViewAll(wxMouseEvent& event) { if (currentView_ == VIEW_TRANS_ALL_STR) @@ -919,15 +925,6 @@ { int evt = event.GetId(); - if (evt != MENU_VIEW_ALLTRANSACTIONS && transFilterActive_) - { - wxString messageStr; - messageStr << _("Transaction Filter will interfere with this filtering.") << "\n\n"; - messageStr << _("Please deactivate Transaction Filter"); - wxMessageBox(messageStr, _("Transaction Filter"), wxOK|wxICON_WARNING); - return; - } - if (evt == MENU_VIEW_ALLTRANSACTIONS) { currentView_ = VIEW_TRANS_ALL_STR; @@ -972,6 +969,7 @@ m_listCtrlAccount->refreshVisualList(); core_->dbInfoSettings_->SetStringSetting(wxString::Format("CHECK_FILTER_ID_%ld", (long)m_AccountID), currentView_); + initFilterSettings(); } void mmCheckingPanel::DeleteViewedTransactions() Modified: trunk/src/mmcheckingpanel.h =================================================================== --- trunk/src/mmcheckingpanel.h 2013-06-22 03:33:32 UTC (rev 4130) +++ trunk/src/mmcheckingpanel.h 2013-06-22 04:40:52 UTC (rev 4131) @@ -82,6 +82,7 @@ std::shared_ptr<wxSQLite3Database> getDb() const; void initViewTransactionsHeader(); + void initFilterSettings(); void setAccountSummary(); void sortTable(); void filterTable(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-22 05:44:09
|
Revision: 4132 http://sourceforge.net/p/moneymanagerex/code/4132 Author: vomikan Date: 2013-06-22 05:44:05 +0000 (Sat, 22 Jun 2013) Log Message: ----------- fix for main filter Modified Paths: -------------- trunk/src/filtertransdialog.cpp trunk/src/filtertransdialog.h trunk/src/mmcheckingpanel.cpp Modified: trunk/src/filtertransdialog.cpp =================================================================== --- trunk/src/filtertransdialog.cpp 2013-06-22 04:40:52 UTC (rev 4131) +++ trunk/src/filtertransdialog.cpp 2013-06-22 05:44:05 UTC (rev 4132) @@ -31,6 +31,7 @@ EVT_BUTTON (wxID_OK, mmFilterTransactionsDialog::OnButtonokClick ) EVT_BUTTON (wxID_CANCEL, mmFilterTransactionsDialog::OnButtoncancelClick ) EVT_BUTTON (wxID_SAVE, mmFilterTransactionsDialog::OnButtonSaveClick ) + EVT_BUTTON (wxID_CLEAR, mmFilterTransactionsDialog::OnButtonClearClick ) END_EVENT_TABLE() @@ -327,6 +328,8 @@ wxButton* itemButtonCancel = new wxButton( buttonPanel, wxID_CANCEL); itemButtonCancel->SetFocus(); + wxButton* itemButtonClear = new wxButton( buttonPanel, wxID_CLEAR); + wxBitmapButton* save_button = new wxBitmapButton( buttonPanel, wxID_SAVE, wxBitmap(save_xpm), wxDefaultPosition, wxSize(itemButtonOK->GetSize().GetHeight(), itemButtonOK->GetSize().GetHeight())); @@ -336,6 +339,7 @@ buttonPanelSizer->Add(save_button, flags.Border(wxALL, 5)); buttonPanelSizer->Add(itemButtonOK, flags); buttonPanelSizer->Add(itemButtonCancel, flags); + buttonPanelSizer->Add(itemButtonClear, flags); } /*! @@ -587,6 +591,13 @@ core_->iniSettings_->SetStringSetting(wxString::Format("TRANSACTIONS_FILTER_%d", i), settings_string_); } +void mmFilterTransactionsDialog::OnButtonClearClick( wxCommandEvent& /*event*/ ) +{ + clearSettings(); + wxCommandEvent evt(/*wxEVT_CHECKBOX*/ wxID_ANY, wxID_ANY); + OnCheckboxClick(evt); +} + void mmFilterTransactionsDialog::OnSettingsSelected( wxCommandEvent& event ) { GetStoredSettings(event.GetSelection()); @@ -660,10 +671,27 @@ accountDropDown_->SetToolTip(tip); } +void mmFilterTransactionsDialog::clearSettings() +{ + accountCheckBox_->SetValue(false); + dateRangeCheckBox_->SetValue(false); + payeeCheckBox_->SetValue(false); + typeCheckBox_->SetValue(false); + cbTypeWithdrawal_->SetValue(false); + cbTypeDeposit_->SetValue(false); + cbTypeTransfer_->SetValue(false); + amountRangeCheckBox_->SetValue(false); + notesCheckBox_->SetValue(false); + transNumberCheckBox_->SetValue(false); + +} + void mmFilterTransactionsDialog::setPresettings(const wxString& view) { //TODO: not finished wxLogDebug(view); + m_radio_box_->SetSelection(0); + clearSettings(); if (view == VIEW_TRANS_ALL_STR) { dateRangeCheckBox_->SetValue(false); Modified: trunk/src/filtertransdialog.h =================================================================== --- trunk/src/filtertransdialog.h 2013-06-22 04:40:52 UTC (rev 4131) +++ trunk/src/filtertransdialog.h 2013-06-22 05:44:05 UTC (rev 4132) @@ -93,6 +93,7 @@ void setAccountToolTip(const wxString& tip) const; void setPresettings(const wxString& view); + void clearSettings(); private: /// Creation @@ -115,6 +116,7 @@ void OnButtonokClick( wxCommandEvent& event ); void OnButtoncancelClick( wxCommandEvent& event ); void OnButtonSaveClick( wxCommandEvent& event ); + void OnButtonClearClick( wxCommandEvent& event ); void OnSettingsSelected( wxCommandEvent& event ); void OnPayeeUpdated(wxCommandEvent& event); bool get_next_value(wxStringTokenizer& tkz, wxString& value); Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-22 04:40:52 UTC (rev 4131) +++ trunk/src/mmcheckingpanel.cpp 2013-06-22 05:44:05 UTC (rev 4132) @@ -349,7 +349,7 @@ std::vector<mmBankTransaction*> filtered_trans; bool toAdd = transFilterDlg_->somethingSelected(); - if (transFilterActive_ && toAdd) + if (/*transFilterActive_ &&*/ toAdd) { for (const auto& pBankTransaction: m_trans) { @@ -963,13 +963,13 @@ stxtMainFilter_->SetLabel(wxGetTranslation(currentView_)); SetTransactionFilterState(currentView_ == VIEW_TRANS_ALL_STR); - m_listCtrlAccount->DeleteAllItems(); m_listCtrlAccount->m_selectedIndex = -1; - m_listCtrlAccount->refreshVisualList(); core_->dbInfoSettings_->SetStringSetting(wxString::Format("CHECK_FILTER_ID_%ld", (long)m_AccountID), currentView_); - initFilterSettings(); + initFilterSettings(); + m_listCtrlAccount->refreshVisualList(m_listCtrlAccount->m_selectedID); + } void mmCheckingPanel::DeleteViewedTransactions() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-06-22 15:50:16
|
Revision: 4146 http://sourceforge.net/p/moneymanagerex/code/4146 Author: guanlisheng Date: 2013-06-22 15:50:13 +0000 (Sat, 22 Jun 2013) Log Message: ----------- cleanup Modified Paths: -------------- trunk/src/mac/platfdep.cpp trunk/src/unix/platfdep.cpp trunk/src/win/platfdep.cpp Modified: trunk/src/mac/platfdep.cpp =================================================================== --- trunk/src/mac/platfdep.cpp 2013-06-22 15:37:34 UTC (rev 4145) +++ trunk/src/mac/platfdep.cpp 2013-06-22 15:50:13 UTC (rev 4146) @@ -36,7 +36,7 @@ if (!fname.IsOk()) { fname = GetSharedDir(); - fname.AppendDir(wxT("doc")); + fname.AppendDir("doc"); } return fname; @@ -52,6 +52,6 @@ wxString mmex::GetAppName() { - return wxString(wxT("MoneyManagerEx")); + return "MoneyManagerEx"; } //---------------------------------------------------------------------------- Modified: trunk/src/unix/platfdep.cpp =================================================================== --- trunk/src/unix/platfdep.cpp 2013-06-22 15:37:34 UTC (rev 4145) +++ trunk/src/unix/platfdep.cpp 2013-06-22 15:50:13 UTC (rev 4146) @@ -78,7 +78,7 @@ if (dirs.Last().Lower() == GetAppName()) fname.RemoveLastDir(); // mmex folder - fname.AppendDir(wxT("doc")); + fname.AppendDir("doc"); fname.AppendDir(GetAppName()); } @@ -96,7 +96,7 @@ if (!fname.IsOk()) { fname = GetSharedDir(); - fname.AppendDir(wxT("res")); + fname.AppendDir("res"); } return fname; @@ -105,6 +105,6 @@ wxString mmex::GetAppName() { - return wxString(wxT("mmex")); + return "mmex"; } //---------------------------------------------------------------------------- Modified: trunk/src/win/platfdep.cpp =================================================================== --- trunk/src/win/platfdep.cpp 2013-06-22 15:37:34 UTC (rev 4145) +++ trunk/src/win/platfdep.cpp 2013-06-22 15:50:13 UTC (rev 4146) @@ -65,7 +65,7 @@ if (!fname.IsOk()) { fname = GetSharedDir(); - fname.AppendDir(wxT("res")); + fname.AppendDir("res"); } return fname; @@ -74,6 +74,6 @@ wxString mmex::GetAppName() { - return wxString(wxT("MoneyManagerEx")); + return "MoneyManagerEx"; } //---------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-22 19:12:14
|
Revision: 4148 http://sourceforge.net/p/moneymanagerex/code/4148 Author: vomikan Date: 2013-06-22 19:12:11 +0000 (Sat, 22 Jun 2013) Log Message: ----------- transaction filter update Modified Paths: -------------- trunk/src/constants.h trunk/src/filtertransdialog.cpp trunk/src/filtertransdialog.h trunk/src/reports/mmDateRange.cpp trunk/src/reports/mmDateRange.h Modified: trunk/src/constants.h =================================================================== --- trunk/src/constants.h 2013-06-22 16:06:09 UTC (rev 4147) +++ trunk/src/constants.h 2013-06-22 19:12:11 UTC (rev 4148) @@ -129,6 +129,17 @@ wxTRANSLATE("Duplicate") }; +static const wxString TRANSACTION_STATUSES[] = +{ + wxTRANSLATE("None"), + wxTRANSLATE("Reconciled"), + wxTRANSLATE("Void"), + wxTRANSLATE("Follow up"), + wxTRANSLATE("Duplicate"), + wxTRANSLATE("Un-Reconciled"), + wxTRANSLATE("All Except Reconciled") +}; + static const wxString TRANSACTION_TYPE[] = { wxTRANSLATE("Withdrawal"), Modified: trunk/src/filtertransdialog.cpp =================================================================== --- trunk/src/filtertransdialog.cpp 2013-06-22 16:06:09 UTC (rev 4147) +++ trunk/src/filtertransdialog.cpp 2013-06-22 19:12:11 UTC (rev 4148) @@ -207,9 +207,7 @@ cbPayee_->Connect(ID_DIALOG_TRANS_PAYEECOMBO, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(mmFilterTransactionsDialog::OnPayeeUpdated), NULL, this); -#if wxCHECK_VERSION(2,9,0) - cbPayee_->AutoComplete(core_->payeeList_.FilterPayees("")); -#endif + cbPayee_->AutoComplete(core_->payeeList_.FilterPayees("")); itemPanelSizer->Add(cbPayee_, flagsExpand); //--End of Row -------------------------------------------------------- @@ -234,9 +232,8 @@ choiceStatus_ = new wxChoice(itemPanel, wxID_ANY); - for(size_t i = 0; i < sizeof(TRANSACTION_STATUS)/sizeof(wxString); ++i) - choiceStatus_->Append(wxGetTranslation(TRANSACTION_STATUS[i]), - new wxStringClientData(TRANSACTION_STATUS[i])); + for(const auto i : TRANSACTION_STATUSES) + choiceStatus_->Append(wxGetTranslation(i), new wxStringClientData(i)); itemPanelSizer->Add(choiceStatus_, flagsExpand); choiceStatus_->SetToolTip(_("Specify the status for the transaction")); @@ -673,47 +670,105 @@ void mmFilterTransactionsDialog::clearSettings() { - accountCheckBox_->SetValue(false); - dateRangeCheckBox_->SetValue(false); - payeeCheckBox_->SetValue(false); - typeCheckBox_->SetValue(false); - cbTypeWithdrawal_->SetValue(false); - cbTypeDeposit_->SetValue(false); - cbTypeTransfer_->SetValue(false); - amountRangeCheckBox_->SetValue(false); - notesCheckBox_->SetValue(false); - transNumberCheckBox_->SetValue(false); - + accountCheckBox_->SetValue(false); + dateRangeCheckBox_->SetValue(false); + payeeCheckBox_->SetValue(false); + categoryCheckBox_->SetValue(false); + statusCheckBox_->SetValue(false); + typeCheckBox_->SetValue(false); + cbTypeWithdrawal_->SetValue(false); + cbTypeDeposit_->SetValue(false); + cbTypeTransfer_->SetValue(false); + amountRangeCheckBox_->SetValue(false); + notesCheckBox_->SetValue(false); + transNumberCheckBox_->SetValue(false); + } void mmFilterTransactionsDialog::setPresettings(const wxString& view) { - //TODO: not finished wxLogDebug(view); m_radio_box_->SetSelection(0); clearSettings(); + date_range_ = new mmCurrentMonth; + dateRangeCheckBox_->SetValue(true); + if (view == VIEW_TRANS_ALL_STR) - { - dateRangeCheckBox_->SetValue(false); - date_range_ = new mmAllTime(); - } + dateRangeCheckBox_->SetValue(false); + else if (view == VIEW_TRANS_TODAY_STR) + date_range_ = new mmToday; else if (view == VIEW_TRANS_CURRENT_MONTH_STR) - { - dateRangeCheckBox_->SetValue(true); - date_range_ = new mmCurrentMonth; - fromDateCtrl_->SetValue(date_range_->start_date()); - toDateControl_->SetValue(date_range_->end_date()); - } + date_range_ = new mmCurrentMonth; else if (view == VIEW_TRANS_LAST_30_DAYS_STR) + date_range_ = new mmLast30Days; + else if (view == VIEW_TRANS_LAST_90_DAYS_STR) + date_range_ = new mmLast90Days; + else if (view == VIEW_TRANS_LAST_MONTH_STR) + date_range_ = new mmLastMonth; + else if (view == VIEW_TRANS_LAST_3MONTHS_STR) + date_range_ = new mmLastMonth;//ToDO: + else if (view == VIEW_TRANS_CURRENT_YEAR_STR) + date_range_ = new mmCurrentYear; + else if (view == VIEW_TRANS_LAST_365_DAYS)//ToDO: + date_range_ = new mmLast12Months; + else if (view == VIEW_TRANS_RECONCILED_STR) + setReconciled(); + else if (view == "View UnReconciled") + setUnReconciled(); + else if (view == "View Not-Reconciled") + setAllExceptReconciled(); + else if (view == VIEW_TRANS_VOID) + setVoid(); + else if (view == VIEW_TRANS_FLAGGED) + setFlagged(); + else if (view == VIEW_TRANS_DUPLICATES) + setDuplicate(); + + if (dateRangeCheckBox_->IsChecked()) { - dateRangeCheckBox_->SetValue(true); - date_range_ = new mmLast30Days; - fromDateCtrl_->SetValue(date_range_->start_date()); - toDateControl_->SetValue(date_range_->end_date()); - } - + fromDateCtrl_->SetValue(date_range_->start_date()); + toDateControl_->SetValue(date_range_->end_date()); + } + } +void mmFilterTransactionsDialog::setReconciled() +{ + statusCheckBox_->SetValue(true); + choiceStatus_->SetStringSelection(wxGetTranslation("Reconciled")); + choiceStatus_->Enable(); +} +void mmFilterTransactionsDialog::setUnReconciled() +{ + statusCheckBox_->SetValue(true); + choiceStatus_->SetStringSelection(wxGetTranslation("Un-Reconciled")); + choiceStatus_->Enable(); +} +void mmFilterTransactionsDialog::setAllExceptReconciled() +{ + statusCheckBox_->SetValue(true); + choiceStatus_->SetStringSelection(wxGetTranslation("All Except Reconciled")); + choiceStatus_->Enable(); +} +void mmFilterTransactionsDialog::setVoid() +{ + statusCheckBox_->SetValue(true); + choiceStatus_->SetStringSelection(wxGetTranslation("Void")); + choiceStatus_->Enable(); +} +void mmFilterTransactionsDialog::setFlagged() +{ + statusCheckBox_->SetValue(true); + choiceStatus_->SetStringSelection(wxGetTranslation("Follow up")); + choiceStatus_->Enable(); +} +void mmFilterTransactionsDialog::setDuplicate() +{ + statusCheckBox_->SetValue(true); + choiceStatus_->SetStringSelection(wxGetTranslation("Duplicate")); + choiceStatus_->Enable(); +} + void mmFilterTransactionsDialog::OnPayeeUpdated(wxCommandEvent& event) { wxString value = cbPayee_->GetValue().Lower(); @@ -725,17 +780,14 @@ prev_value_ = value; cbPayee_->Clear(); - wxArrayString data; + cbPayee_->AutoComplete(core_->payeeList_.FilterPayees("")); - data = core_->payeeList_.FilterPayees(""); - for (size_t i = 0; i < data.Count(); ++i) + for (const auto& i : core_->payeeList_.FilterPayees("")) { - if (data[i].Lower().Matches(wxString(value).Append("*"))) - cbPayee_ ->Append(data[i]); + if (i.Lower().Matches(wxString(value).Append("*"))) + cbPayee_ ->Append(i); } - cbPayee_->AutoComplete(data); - if (cbPayee_->GetCount() == 1) cbPayee_->SetSelection(0); else Modified: trunk/src/filtertransdialog.h =================================================================== --- trunk/src/filtertransdialog.h 2013-06-22 16:06:09 UTC (rev 4147) +++ trunk/src/filtertransdialog.h 2013-06-22 19:12:11 UTC (rev 4148) @@ -122,6 +122,13 @@ bool get_next_value(wxStringTokenizer& tkz, wxString& value); void OnCategs(wxCommandEvent& event); + + void setReconciled(); + void setUnReconciled(); + void setAllExceptReconciled(); + void setVoid(); + void setFlagged(); + void setDuplicate(); /// Should we show tooltips? static bool ShowToolTips(); @@ -162,6 +169,7 @@ int payeeID_; int refAccountID_; wxString refAccountStr_; + }; #endif Modified: trunk/src/reports/mmDateRange.cpp =================================================================== --- trunk/src/reports/mmDateRange.cpp 2013-06-22 16:06:09 UTC (rev 4147) +++ trunk/src/reports/mmDateRange.cpp 2013-06-22 19:12:11 UTC (rev 4148) @@ -45,6 +45,14 @@ this->title_ = _("Current Month"); } +mmToday::mmToday() +: mmDateRange() +{ + this->start_date_ = today_; + this->end_date_ = today_; + this->title_ = _("Today"); +} + mmCurrentMonthToDate::mmCurrentMonthToDate() : mmDateRange() { @@ -64,13 +72,23 @@ mmLast30Days::mmLast30Days() : mmDateRange() { - this->start_date_ = wxDateTime(end_date_) + this->start_date_ = wxDateTime(start_date_) .Subtract(wxDateSpan::Months(1)) .Add(wxDateSpan::Days(1)); // no change to end_date_ this->title_ = _("Last 30 Days"); } +mmLast90Days::mmLast90Days() +: mmDateRange() +{ + this->start_date_ = wxDateTime(start_date_) + .Subtract(wxDateSpan::Months(3)) + .Add(wxDateSpan::Days(1)); + // no change to end_date_ + this->title_ = _("Last 90 Days"); +} + mmLast12Months::mmLast12Months() : mmDateRange() { Modified: trunk/src/reports/mmDateRange.h =================================================================== --- trunk/src/reports/mmDateRange.h 2013-06-22 16:06:09 UTC (rev 4147) +++ trunk/src/reports/mmDateRange.h 2013-06-22 19:12:11 UTC (rev 4148) @@ -28,6 +28,12 @@ mmCurrentMonth(); }; +class mmToday: public mmDateRange +{ +public: + mmToday(); +}; + class mmCurrentMonthToDate: public mmDateRange { public: @@ -46,6 +52,12 @@ mmLast30Days(); }; +class mmLast90Days: public mmDateRange +{ +public: + mmLast90Days(); +}; + class mmLast12Months: public mmDateRange { public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-22 19:51:12
|
Revision: 4149 http://sourceforge.net/p/moneymanagerex/code/4149 Author: vomikan Date: 2013-06-22 19:51:10 +0000 (Sat, 22 Jun 2013) Log Message: ----------- transaction filter update Modified Paths: -------------- trunk/src/filtertransdialog.cpp trunk/src/mmpayee.cpp Modified: trunk/src/filtertransdialog.cpp =================================================================== --- trunk/src/filtertransdialog.cpp 2013-06-22 19:12:11 UTC (rev 4148) +++ trunk/src/filtertransdialog.cpp 2013-06-22 19:51:10 UTC (rev 4149) @@ -61,6 +61,7 @@ CreateControls(); GetStoredSettings(-1); + dataToControls(); GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); @@ -93,7 +94,7 @@ status = get_next_value(tkz, value); payeeCheckBox_ ->SetValue(status); cbPayee_ ->Enable(status); - cbPayee_ ->SetValue(value); + cbPayee_ ->SetStringSelection(value); status = get_next_value(tkz, value); categoryCheckBox_ ->SetValue(status); @@ -687,7 +688,7 @@ void mmFilterTransactionsDialog::setPresettings(const wxString& view) { - wxLogDebug(view); + m_radio_box_->SetSelection(0); clearSettings(); date_range_ = new mmCurrentMonth; @@ -728,6 +729,8 @@ { fromDateCtrl_->SetValue(date_range_->start_date()); toDateControl_->SetValue(date_range_->end_date()); + fromDateCtrl_->Enable(); + toDateControl_->Enable(); } } Modified: trunk/src/mmpayee.cpp =================================================================== --- trunk/src/mmpayee.cpp 2013-06-22 19:12:11 UTC (rev 4148) +++ trunk/src/mmpayee.cpp 2013-06-22 19:51:10 UTC (rev 4149) @@ -99,12 +99,12 @@ wxArrayString mmPayeeList::FilterPayees(const wxString& patt) const { - wxArrayString payee_list; + wxSortedArrayString payee_list; - for (size_t idx = 0; idx < (int)entries_.size(); idx++) + for (const auto i : entries_) { - if (entries_[idx]->name_.Lower().Matches(patt.Lower().Append("*"))) - payee_list.Add(entries_[idx]->name_); + if (i->name_.Lower().Matches(patt.Lower().Append("*"))) + payee_list.Add(i->name_); } return payee_list; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-23 11:54:33
|
Revision: 4153 http://sourceforge.net/p/moneymanagerex/code/4153 Author: vomikan Date: 2013-06-23 11:54:29 +0000 (Sun, 23 Jun 2013) Log Message: ----------- transaction filter reorganization Modified Paths: -------------- trunk/src/constants.h trunk/src/filtertransdialog.cpp trunk/src/filtertransdialog.h trunk/src/guiid.h trunk/src/mmcheckingpanel.cpp trunk/src/mmcheckingpanel.h trunk/src/reports/mmDateRange.cpp Modified: trunk/src/constants.h =================================================================== --- trunk/src/constants.h 2013-06-23 06:30:57 UTC (rev 4152) +++ trunk/src/constants.h 2013-06-23 11:54:29 UTC (rev 4153) @@ -120,6 +120,18 @@ }; +static const wxString DATE_PRESETTINGS[] = { + VIEW_TRANS_ALL_STR, + VIEW_TRANS_TODAY_STR, + VIEW_TRANS_CURRENT_MONTH_STR, + VIEW_TRANS_LAST_30_DAYS_STR, + VIEW_TRANS_LAST_90_DAYS_STR, + VIEW_TRANS_LAST_MONTH_STR , + VIEW_TRANS_LAST_3MONTHS_STR, + VIEW_TRANS_LAST_365_DAYS, + VIEW_TRANS_CURRENT_YEAR_STR +}; + static const wxString TRANSACTION_STATUS[] = { wxTRANSLATE("None"), Modified: trunk/src/filtertransdialog.cpp =================================================================== --- trunk/src/filtertransdialog.cpp 2013-06-23 06:30:57 UTC (rev 4152) +++ trunk/src/filtertransdialog.cpp 2013-06-23 11:54:29 UTC (rev 4153) @@ -31,7 +31,8 @@ EVT_BUTTON (wxID_OK, mmFilterTransactionsDialog::OnButtonokClick ) EVT_BUTTON (wxID_CANCEL, mmFilterTransactionsDialog::OnButtoncancelClick ) EVT_BUTTON (wxID_SAVE, mmFilterTransactionsDialog::OnButtonSaveClick ) - EVT_BUTTON (wxID_CLEAR, mmFilterTransactionsDialog::OnButtonClearClick ) + EVT_BUTTON (wxID_CLEAR, mmFilterTransactionsDialog::OnButtonClearClick ) + EVT_MENU (wxID_ANY, mmFilterTransactionsDialog::datePresetMenuSelected ) END_EVENT_TABLE() @@ -170,7 +171,6 @@ itemPanel->SetSizer(itemBoxSizer4); itemBoxSizer4->Add(itemPanelSizer, flagsExpand); - //--Start of Row -------------------------------------------------------- accountCheckBox_ = new wxCheckBox( itemPanel, wxID_ANY, _("Account"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); @@ -191,6 +191,8 @@ wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN); toDateControl_ = new wxDatePickerCtrl( itemPanel, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN); + dateRangeCheckBox_->Connect(wxID_ANY, wxEVT_RIGHT_DOWN + , wxMouseEventHandler(mmFilterTransactionsDialog::datePresetMenu), NULL, this); wxBoxSizer* dateSizer = new wxBoxSizer(wxHORIZONTAL); dateSizer->Add(fromDateCtrl_, flagsExpand); @@ -668,12 +670,25 @@ settings_string_ = "0;;0;;0;;0;;0;;0;;0;;0;;0;;0;;0;;"; dataToControls(); } +void mmFilterTransactionsDialog::datePresetMenuSelected( wxCommandEvent& event ) +{ + int id = event.GetId(); + setPresettings(DATE_PRESETTINGS[id]); +} +void mmFilterTransactionsDialog::datePresetMenu( wxMouseEvent& event ) +{ + wxMenu menu; + int id = 0; + for (const auto& i : DATE_PRESETTINGS) + { + menu.Append(id++, wxGetTranslation(i)); + } + PopupMenu(&menu, event.GetPosition()); +} + void mmFilterTransactionsDialog::setPresettings(const wxString& view) { - - m_radio_box_->SetSelection(0); - clearSettings(); date_range_ = new mmCurrentMonth; dateRangeCheckBox_->SetValue(true); @@ -695,18 +710,6 @@ date_range_ = new mmCurrentYear; else if (view == VIEW_TRANS_LAST_365_DAYS)//ToDO: date_range_ = new mmLast12Months; - else if (view == VIEW_TRANS_RECONCILED_STR) - setReconciled(); - else if (view == "View UnReconciled") - setUnReconciled(); - else if (view == "View Not-Reconciled") - setAllExceptReconciled(); - else if (view == VIEW_TRANS_VOID) - setVoid(); - else if (view == VIEW_TRANS_FLAGGED) - setFlagged(); - else if (view == VIEW_TRANS_DUPLICATES) - setDuplicate(); if (dateRangeCheckBox_->IsChecked()) { @@ -715,46 +718,8 @@ fromDateCtrl_->Enable(); toDateControl_->Enable(); } - } -void mmFilterTransactionsDialog::setReconciled() -{ - statusCheckBox_->SetValue(true); - choiceStatus_->SetStringSelection(wxGetTranslation("Reconciled")); - choiceStatus_->Enable(); -} -void mmFilterTransactionsDialog::setUnReconciled() -{ - statusCheckBox_->SetValue(true); - choiceStatus_->SetStringSelection(wxGetTranslation("Un-Reconciled")); - choiceStatus_->Enable(); -} -void mmFilterTransactionsDialog::setAllExceptReconciled() -{ - statusCheckBox_->SetValue(true); - choiceStatus_->SetStringSelection(wxGetTranslation("All Except Reconciled")); - choiceStatus_->Enable(); -} -void mmFilterTransactionsDialog::setVoid() -{ - statusCheckBox_->SetValue(true); - choiceStatus_->SetStringSelection(wxGetTranslation("Void")); - choiceStatus_->Enable(); -} -void mmFilterTransactionsDialog::setFlagged() -{ - statusCheckBox_->SetValue(true); - choiceStatus_->SetStringSelection(wxGetTranslation("Follow up")); - choiceStatus_->Enable(); -} -void mmFilterTransactionsDialog::setDuplicate() -{ - statusCheckBox_->SetValue(true); - choiceStatus_->SetStringSelection(wxGetTranslation("Duplicate")); - choiceStatus_->Enable(); -} - void mmFilterTransactionsDialog::OnPayeeUpdated(wxCommandEvent& event) { wxString value = cbPayee_->GetValue().Lower(); Modified: trunk/src/filtertransdialog.h =================================================================== --- trunk/src/filtertransdialog.h 2013-06-23 06:30:57 UTC (rev 4152) +++ trunk/src/filtertransdialog.h 2013-06-23 11:54:29 UTC (rev 4153) @@ -118,17 +118,12 @@ void OnButtonSaveClick( wxCommandEvent& event ); void OnButtonClearClick( wxCommandEvent& event ); void OnSettingsSelected( wxCommandEvent& event ); + void datePresetMenu( wxMouseEvent& event ); + void datePresetMenuSelected( wxCommandEvent& event ); void OnPayeeUpdated(wxCommandEvent& event); bool get_next_value(wxStringTokenizer& tkz, wxString& value); void OnCategs(wxCommandEvent& event); - - void setReconciled(); - void setUnReconciled(); - void setAllExceptReconciled(); - void setVoid(); - void setFlagged(); - void setDuplicate(); /// Should we show tooltips? static bool ShowToolTips(); @@ -169,7 +164,6 @@ int payeeID_; int refAccountID_; wxString refAccountStr_; - }; #endif Modified: trunk/src/guiid.h =================================================================== --- trunk/src/guiid.h 2013-06-23 06:30:57 UTC (rev 4152) +++ trunk/src/guiid.h 2013-06-23 11:54:29 UTC (rev 4153) @@ -200,22 +200,17 @@ MENU_TREEPOPUP_VIEW_SPLIT_CATEGORIES, MENU_VIEW_ALLTRANSACTIONS, - MENU_VIEW_RECONCILED, - MENU_VIEW_UNRECONCILED, - MENU_VIEW_NOTRECONCILED, - MENU_VIEW_VOID, - MENU_VIEW_FLAGGED, - MENU_VIEW_DUPLICATE, MENU_VIEW_TODAY, + MENU_VIEW_CURRENTMONTH, MENU_VIEW_LAST30, + MENU_VIEW_LAST90, MENU_VIEW_LASTMONTH, - MENU_VIEW_LAST90, MENU_VIEW_LAST3MONTHS, + MENU_VIEW_LAST365, MENU_VIEW_CURRENTYEAR, - MENU_VIEW_LAST365, + MENU_VIEW_, MENU_VIEW_DELETE_TRANS, MENU_VIEW_DELETE_FLAGGED, - MENU_VIEW_CURRENTMONTH, MENU_ON_COPY_TRANSACTION, MENU_ON_PASTE_TRANSACTION, Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-23 06:30:57 UTC (rev 4152) +++ trunk/src/mmcheckingpanel.cpp 2013-06-23 11:54:29 UTC (rev 4153) @@ -272,10 +272,11 @@ //TODO: Load currency settings for current account /* Set up the transaction filter. The transFilter dialog will be destroyed when the checking panel is destroyed. */ - transFilterActive_ = true; + transFilterActive_ = false; transFilterDlg_ = new mmFilterTransactionsDialog(core_, this); + initViewTransactionsHeader(); + initFilterSettings(); - initViewTransactionsHeader(); initVirtualListControl(); windowsFreezeThaw(this); @@ -348,14 +349,12 @@ std::vector<mmBankTransaction*> filtered_trans; bool toAdd = transFilterDlg_->somethingSelected(); - if (/*transFilterActive_ &&*/ toAdd) + if (transFilterActive_ && toAdd) { for (const auto& pBankTransaction: m_trans) { - mmBankTransaction* pTempTransaction = pBankTransaction; toAdd = true; - if (transFilterDlg_->getAccountCheckBox()) toAdd = toAdd && (transFilterDlg_->getAccountID() == pBankTransaction->toAccountID_); @@ -385,10 +384,21 @@ if (transFilterDlg_->getNotesCheckBox()) toAdd = toAdd && (pBankTransaction->notes_.Lower().Matches(transFilterDlg_->getNotes().Trim().Lower())); if (toAdd) - filtered_trans.push_back(pTempTransaction); + filtered_trans.push_back(pBankTransaction); } - this->m_trans = filtered_trans; } + else + { + for (const auto& pBankTransaction: m_trans) + { + if (quickFilterBeginDate_ <= pBankTransaction->date_.GetDateOnly() + && quickFilterEndDate_ >= pBankTransaction->date_.GetDateOnly()) + { + filtered_trans.push_back(pBankTransaction); + } + } + } + this->m_trans = filtered_trans; } void mmCheckingPanel::markSelectedTransaction(int trans_id) @@ -433,23 +443,11 @@ default: { wxMenu menu; - menu.Append(MENU_VIEW_ALLTRANSACTIONS, wxGetTranslation(VIEW_TRANS_ALL_STR)); - menu.Append(MENU_VIEW_RECONCILED, wxGetTranslation(VIEW_TRANS_RECONCILED_STR)); - menu.Append(MENU_VIEW_UNRECONCILED, wxGetTranslation(wxTRANSLATE("View Un-Reconciled"))); - menu.Append(MENU_VIEW_NOTRECONCILED, wxGetTranslation(wxTRANSLATE("View All Except Reconciled"))); - menu.Append(MENU_VIEW_VOID, wxGetTranslation(VIEW_TRANS_VOID)); - menu.Append(MENU_VIEW_FLAGGED, wxGetTranslation(VIEW_TRANS_FLAGGED)); - menu.Append(MENU_VIEW_DUPLICATE, wxGetTranslation(VIEW_TRANS_DUPLICATES)); - menu.AppendSeparator(); - menu.Append(MENU_VIEW_TODAY, wxGetTranslation(VIEW_TRANS_TODAY_STR)); - menu.Append(MENU_VIEW_CURRENTMONTH, wxGetTranslation(VIEW_TRANS_CURRENT_MONTH_STR)); - menu.Append(MENU_VIEW_LAST30, wxGetTranslation(VIEW_TRANS_LAST_30_DAYS_STR)); - menu.Append(MENU_VIEW_LAST90, wxGetTranslation(VIEW_TRANS_LAST_90_DAYS_STR)); - menu.Append(MENU_VIEW_LASTMONTH, wxGetTranslation(VIEW_TRANS_LAST_MONTH_STR)); - menu.Append(MENU_VIEW_LAST3MONTHS, wxGetTranslation(VIEW_TRANS_LAST_3MONTHS_STR)); - menu.Append(MENU_VIEW_CURRENTYEAR, wxGetTranslation(VIEW_TRANS_CURRENT_YEAR_STR)); - menu.Append(MENU_VIEW_LAST365, wxGetTranslation(VIEW_TRANS_LAST_365_DAYS)); - + int id = MENU_VIEW_ALLTRANSACTIONS; + for (const auto& i : DATE_PRESETTINGS) + { + menu.Append(id++, wxGetTranslation(i)); + } PopupMenu(&menu, event.GetPosition()); break; @@ -464,7 +462,6 @@ { //Initialization core_->bTransactionList_.LoadAccountTransactions(m_AccountID); - initFilterSettings(); filteredBalance_ = 0.0; // clear everything @@ -902,7 +899,29 @@ //---------------------------------------------------------------------------- void mmCheckingPanel::initFilterSettings() { - transFilterDlg_->setPresettings(currentView_); + date_range_ = new mmAllTime; + + if (currentView_ == VIEW_TRANS_ALL_STR) + date_range_ = new mmAllTime; + else if (currentView_ == VIEW_TRANS_TODAY_STR) + date_range_ = new mmToday; + else if (currentView_ == VIEW_TRANS_CURRENT_MONTH_STR) + date_range_ = new mmCurrentMonth; + else if (currentView_ == VIEW_TRANS_LAST_30_DAYS_STR) + date_range_ = new mmLast30Days; + else if (currentView_ == VIEW_TRANS_LAST_90_DAYS_STR) + date_range_ = new mmLast90Days; + else if (currentView_ == VIEW_TRANS_LAST_MONTH_STR) + date_range_ = new mmLastMonth; + else if (currentView_ == VIEW_TRANS_LAST_3MONTHS_STR) + date_range_ = new mmLastMonth;//ToDO: + else if (currentView_ == VIEW_TRANS_CURRENT_YEAR_STR) + date_range_ = new mmCurrentYear; + else if (currentView_ == VIEW_TRANS_LAST_365_DAYS)//ToDO: + date_range_ = new mmLast12Months; + + quickFilterBeginDate_ = date_range_->start_date(); + quickFilterEndDate_ = date_range_->end_date(); } void mmCheckingPanel::OnFilterResetToViewAll(wxMouseEvent& event) { @@ -915,6 +934,7 @@ stxtMainFilter_->SetLabel(_("View All transactions")); currentView_ = VIEW_TRANS_ALL_STR; SetTransactionFilterState(true); + initFilterSettings(); m_listCtrlAccount->m_selectedIndex = -1; m_listCtrlAccount->refreshVisualList(); @@ -930,18 +950,6 @@ currentView_ = VIEW_TRANS_ALL_STR; transFilterActive_ = false; } - else if (evt == MENU_VIEW_RECONCILED) - currentView_ = VIEW_TRANS_RECONCILED_STR; - else if (evt == MENU_VIEW_NOTRECONCILED) - currentView_ = VIEW_TRANS_NOT_RECONCILED_STR; - else if (evt == MENU_VIEW_UNRECONCILED) - currentView_ = VIEW_TRANS_UNRECONCILED_STR; - else if (evt == MENU_VIEW_FLAGGED) - currentView_ = VIEW_TRANS_FLAGGED; - else if (evt == MENU_VIEW_DUPLICATE) - currentView_ = VIEW_TRANS_DUPLICATES; - else if (evt == MENU_VIEW_VOID) - currentView_ = VIEW_TRANS_VOID; else if (evt == MENU_VIEW_TODAY) currentView_ = VIEW_TRANS_TODAY_STR; else if (evt == MENU_VIEW_CURRENTMONTH) Modified: trunk/src/mmcheckingpanel.h =================================================================== --- trunk/src/mmcheckingpanel.h 2013-06-23 06:30:57 UTC (rev 4152) +++ trunk/src/mmcheckingpanel.h 2013-06-23 11:54:29 UTC (rev 4153) @@ -21,11 +21,13 @@ //---------------------------------------------------------------------------- #include "filtertransdialog.h" #include "mmpanelbase.h" +#include "reports/mmDateRange.h" //---------------------------------------------------------------------------- class mmGUIFrame; class mmBankTransaction; class TransactionListCtrl; class mmFilterTransactionsDialog; +class mmDateRange; //---------------------------------------------------------------------------- class mmCheckingPanel : public mmPanelBase @@ -57,6 +59,7 @@ DECLARE_EVENT_TABLE() friend class TransactionListCtrl; // needs access to m_core, initdb_, ... + mmDateRange* date_range_; wxButton* btnNew_; wxButton* btnEdit_; wxButton* btnDuplicate_; @@ -71,6 +74,8 @@ mmFilterTransactionsDialog* transFilterDlg_; wxString currentView_; + wxDateTime quickFilterBeginDate_; + wxDateTime quickFilterEndDate_; mmGUIFrame* mainFrame_; bool transFilterActive_; double filteredBalance_; Modified: trunk/src/reports/mmDateRange.cpp =================================================================== --- trunk/src/reports/mmDateRange.cpp 2013-06-23 06:30:57 UTC (rev 4152) +++ trunk/src/reports/mmDateRange.cpp 2013-06-23 11:54:29 UTC (rev 4153) @@ -162,7 +162,8 @@ : mmDateRange() { this->title_ = _("Over Time"); - this->start_date_.Subtract(today_); + this->start_date_.Subtract(wxDateSpan::Years(today_.GetYear())) + .SetDay(1).SetMonth(wxDateTime::Jan); } const bool mmAllTime::is_with_date() const This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-24 08:42:10
|
Revision: 4155 http://sourceforge.net/p/moneymanagerex/code/4155 Author: vomikan Date: 2013-06-24 08:42:04 +0000 (Mon, 24 Jun 2013) Log Message: ----------- Currency pointer update Modified Paths: -------------- trunk/src/mmaccount.cpp trunk/src/mmcheckingpanel.cpp trunk/src/mmex.cpp trunk/src/mmtransaction.cpp Modified: trunk/src/mmaccount.cpp =================================================================== --- trunk/src/mmaccount.cpp 2013-06-23 14:05:25 UTC (rev 4154) +++ trunk/src/mmaccount.cpp 2013-06-24 08:42:04 UTC (rev 4155) @@ -69,17 +69,15 @@ mmAccount* mmAccountList::GetAccountSharedPtr(int accountID) const { - account_v::value_type res; - for (const auto& r : accounts_) { if (r->id_ == accountID) { - res = r; - break; + return r; } } - + wxASSERT(false); + account_v::value_type res = 0; return res; } Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-23 14:05:25 UTC (rev 4154) +++ trunk/src/mmcheckingpanel.cpp 2013-06-24 08:42:04 UTC (rev 4155) @@ -274,6 +274,7 @@ when the checking panel is destroyed. */ transFilterActive_ = false; transFilterDlg_ = new mmFilterTransactionsDialog(core_, this); + core_->accountList_.getCurrencySharedPtr(m_AccountID)->loadCurrencySettings(); initViewTransactionsHeader(); initFilterSettings(); @@ -1420,7 +1421,6 @@ mmBankTransaction* pCopiedTrans = m_cp->core_->bTransactionList_.copyTransaction(m_selectedForCopy, m_cp->m_AccountID, useOriginalDate); - mmCurrency* pCurrencyPtr = m_cp->core_->accountList_.getCurrencySharedPtr(m_cp->m_AccountID); int transID = pCopiedTrans->transactionID(); topItemIndex_ = m_selectedIndex; refreshVisualList(transID); Modified: trunk/src/mmex.cpp =================================================================== --- trunk/src/mmex.cpp 2013-06-23 14:05:25 UTC (rev 4154) +++ trunk/src/mmex.cpp 2013-06-24 08:42:04 UTC (rev 4155) @@ -3185,8 +3185,7 @@ if (tran->splitEntries_->numEntries() > 0) { tran->reportCategAmount_ = tran->getAmountForSplit(categID, subcategID); - - mmCurrency* pCurrencyPtr = m_core.get()->accountList_.getCurrencySharedPtr(tran->accountID_); + m_core.get()->accountList_.getCurrencySharedPtr(tran->accountID_)->loadCurrencySettings(); tran->reportCategAmountStr_ = CurrencyFormatter::float2String(tran->reportCategAmount_); } else Modified: trunk/src/mmtransaction.cpp =================================================================== --- trunk/src/mmtransaction.cpp 2013-06-23 14:05:25 UTC (rev 4154) +++ trunk/src/mmtransaction.cpp 2013-06-24 08:42:04 UTC (rev 4155) @@ -140,7 +140,7 @@ subcategID_ = q1.GetInt("SUBCATEGID"); fullCatStr_ = core->categoryList_.GetFullCategoryString(categID_, subcategID_); - mmCurrency* pCurrencyPtr = core->accountList_.getCurrencySharedPtr(accountID_); + core->accountList_.getCurrencySharedPtr(accountID_)->loadCurrencySettings(); splitEntries_ = new mmSplitTransactionEntries(); getSplitTransactions(splitEntries_); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-24 13:19:50
|
Revision: 4167 http://sourceforge.net/p/moneymanagerex/code/4167 Author: vomikan Date: 2013-06-24 13:19:47 +0000 (Mon, 24 Jun 2013) Log Message: ----------- speed up for checking panel (updateTransactionData(...)) Modified Paths: -------------- trunk/src/mmcheckingpanel.cpp trunk/src/mmtransaction.cpp Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-24 13:10:49 UTC (rev 4166) +++ trunk/src/mmcheckingpanel.cpp 2013-06-24 13:19:47 UTC (rev 4167) @@ -1261,7 +1261,7 @@ wxString mmCheckingPanel::getItem(long item, long column) const { - wxString s; + wxString s = ""; bool ok = !m_trans.empty() && ( item >= 0 ) && @@ -1272,14 +1272,14 @@ { const mmBankTransaction &t = *m_trans[item]; - if (column == COL_DATE_OR_TRANSACTION_ID) s = t.dateStr_; + if (column == COL_DATE_OR_TRANSACTION_ID) s = mmGetDateForDisplay(t.date_); else if (column == COL_TRANSACTION_NUMBER) s = t.transNum_; else if (column == COL_PAYEE_STR) s = t.payeeStr_; else if (column == COL_STATUS) s = t.status_; else if (column == COL_CATEGORY) s = t.fullCatStr_; - else if (column == COL_WITHDRAWAL) s = t.withdrawalStr_; - else if (column == COL_DEPOSIT) s = t.depositStr_; - else if (column == COL_BALANCE) s = t.balanceStr_; + else if (column == COL_WITHDRAWAL) s = CurrencyFormatter::float2String(t.withdrawal_amt_); + else if (column == COL_DEPOSIT) s = CurrencyFormatter::float2String(t.deposit_amt_); + else if (column == COL_BALANCE) s = CurrencyFormatter::float2String(t.balance_); else if (column == COL_NOTES) s = t.notes_; else wxASSERT(false); Modified: trunk/src/mmtransaction.cpp =================================================================== --- trunk/src/mmtransaction.cpp 2013-06-24 13:10:49 UTC (rev 4166) +++ trunk/src/mmtransaction.cpp 2013-06-24 13:19:47 UTC (rev 4167) @@ -155,88 +155,60 @@ void mmBankTransaction::updateTransactionData(int accountID, double& balance) { - //if (isInited_) return; - deposit_amt_ = transType_ == TRANS_TYPE_DEPOSIT_STR ? amt_ : -amt_; withdrawal_amt_ = transType_ == TRANS_TYPE_WITHDRAWAL_STR ? amt_ : -amt_; - /* Load the Account Currency Settings for Formatting Strings */ - //**//currencyPtr->loadCurrencySettings(); + //TODO: Speedup me + //if (isInited_) return; - dateStr_ = mmGetDateForDisplay(date_); - transAmtString_ = CurrencyFormatter::float2String(amt_); - wxASSERT(toAmt_ >= 0); wxASSERT(amt_ >= 0); if (toAmt_ < 0) toAmt_ = amt_; - transToAmtString_ = CurrencyFormatter::float2String(toAmt_); - - depositStr_ = ""; - withdrawalStr_ = ""; if (transType_ == TRANS_TYPE_DEPOSIT_STR) - { - depositStr_ = transAmtString_; balance += amt_; - balance_ = balance; - } else if (transType_== TRANS_TYPE_WITHDRAWAL_STR) - { - withdrawalStr_ = transToAmtString_; balance -= amt_; - balance_ = balance; - } else if (transType_ == TRANS_TYPE_TRANSFER_STR) { - wxString fromAccount = core_->accountList_.GetAccountName(accountID_); + fromAccountStr_ = core_->accountList_.GetAccountName(accountID_); wxString toAccount = core_->accountList_.GetAccountName(toAccountID_); if (accountID_ == accountID) { - withdrawalStr_ = transAmtString_; withdrawal_amt_ = amt_; balance -= amt_; - balance_ = balance; deposit_amt_ = -amt_; - payeeStr_ = toAccount; + payeeStr_ = toAccount; } else if (toAccountID_ == accountID) { - depositStr_ = transToAmtString_; - payeeStr_ = fromAccount; deposit_amt_ = toAmt_; + balance += amt_; withdrawal_amt_ = -toAmt_; - balance += amt_; - balance_ = balance; + payeeStr_ = fromAccountStr_; } + balance_ = balance; } - fromAccountStr_ = core_->accountList_.GetAccountName(accountID_); - if (splitEntries_->numEntries() == 1) { categID_ = -1; subcategID_ = -1; - catStr_= ""; - subCatStr_ = ""; fullCatStr_= core_->categoryList_.GetFullCategoryString( splitEntries_->entries_[0]->categID_, splitEntries_->entries_[0]->subCategID_); } else if (splitEntries_->numEntries() > 1) { - fullCatStr_ = _("Split Category"); + fullCatStr_ = _("..."); categID_ = -1; subcategID_ = -1; - catStr_= ""; - subCatStr_ = ""; } else { fullCatStr_ = core_->categoryList_.GetFullCategoryString(categID_, subcategID_); } - balanceStr_ = CurrencyFormatter::float2String(balance_); - isInited_ = true; } @@ -567,7 +539,7 @@ && (pBankTransaction->toAccountID_ != accountID || pBankTransaction->transType_ != TRANS_TYPE_TRANSFER_STR)) continue; - //TODO: Calculate balance here + pBankTransaction->updateTransactionData(accountID, balance); accountTransactions_.push_back(pBankTransaction); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-06-25 03:31:53
|
Revision: 4170 http://sourceforge.net/p/moneymanagerex/code/4170 Author: vomikan Date: 2013-06-25 03:31:49 +0000 (Tue, 25 Jun 2013) Log Message: ----------- simplifications Modified Paths: -------------- trunk/src/categdialog.cpp trunk/src/mmcheckingpanel.cpp trunk/src/mmcheckingpanel.h trunk/src/mmtransaction.cpp trunk/src/mmtransaction.h trunk/src/optionsdialog.cpp trunk/src/payeedialog.cpp trunk/src/reports/transactions.cpp trunk/src/transdialog.cpp trunk/src/univcsvdialog.cpp Modified: trunk/src/categdialog.cpp =================================================================== --- trunk/src/categdialog.cpp 2013-06-24 15:10:52 UTC (rev 4169) +++ trunk/src/categdialog.cpp 2013-06-25 03:31:49 UTC (rev 4170) @@ -437,8 +437,6 @@ return; } - core_->bTransactionList_.UpdateAllTransactionsForCategory(categID, subcategID); - treeCtrl_->SetItemText(selectedItemId_, text); } Modified: trunk/src/mmcheckingpanel.cpp =================================================================== --- trunk/src/mmcheckingpanel.cpp 2013-06-24 15:10:52 UTC (rev 4169) +++ trunk/src/mmcheckingpanel.cpp 2013-06-25 03:31:49 UTC (rev 4170) @@ -840,21 +840,6 @@ } //---------------------------------------------------------------------------- -double mmCheckingPanel::getBalance(mmBankTransaction* transPtr, double currentBalance) const -{ - if (transPtr->status_ != "V") - currentBalance += transPtr->value(m_AccountID); - - return currentBalance; -} -//---------------------------------------------------------------------------- - -void mmCheckingPanel::setBalance(mmBankTransaction* transPtr, double currentBalance ) -{ - transPtr->balance_ = currentBalance; - transPtr->balanceStr_ = CurrencyFormatter::float2String(currentBalance); -} - void mmCheckingPanel::OnDeleteTransaction(wxCommandEvent& event) { m_listCtrlAccount->OnDeleteTransaction(event); @@ -1276,10 +1261,14 @@ else if (column == COL_TRANSACTION_NUMBER) s = t.transNum_; else if (column == COL_PAYEE_STR) s = t.payeeStr_; else if (column == COL_STATUS) s = t.status_; - else if (column == COL_CATEGORY) s = t.fullCatStr_; - else if (column == COL_WITHDRAWAL) s = CurrencyFormatter::float2String(t.withdrawal_amt_); - else if (column == COL_DEPOSIT) s = CurrencyFormatter::float2String(t.deposit_amt_); - else if (column == COL_BALANCE) s = CurrencyFormatter::float2String(t.balance_); + else if (column == COL_CATEGORY) + s = core_->categoryList_.GetFullCategoryString(t.categID_, t.subcategID_); + else if (column == COL_WITHDRAWAL) + s = (t.withdrawal_amt_ >= 0) ? CurrencyFormatter::float2String(t.withdrawal_amt_) : ""; + else if (column == COL_DEPOSIT) + s = (t.deposit_amt_ >= 0) ? CurrencyFormatter::float2String(t.deposit_amt_) : ""; + else if (column == COL_BALANCE) + s = CurrencyFormatter::float2String(t.balance_); else if (column == COL_NOTES) s = t.notes_; else wxASSERT(false); @@ -1609,7 +1598,7 @@ { mmBankTransaction* pTransaction; pTransaction = m_cp->core_->bTransactionList_.getBankTransactionPtr( - m_cp->m_AccountID, m_cp->m_trans[m_selectedIndex]->transactionID() + m_cp->m_trans[m_selectedIndex]->transactionID() ); // Looking at transaction from A end. Transaction is a deposit, withdrawal or transfer. Modified: trunk/src/mmcheckingpanel.h =================================================================== --- trunk/src/mmcheckingpanel.h 2013-06-24 15:10:52 UTC (rev 4169) +++ trunk/src/mmcheckingpanel.h 2013-06-25 03:31:49 UTC (rev 4170) @@ -128,9 +128,6 @@ wxString getItem(long item, long column) const; wxString getMiniInfoStr(int selIndex) const; - - double getBalance(mmBankTransaction* transPtr, double currentBalance) const; - void setBalance(mmBankTransaction* transPtr, double currentBalance); }; //---------------------------------------------------------------------------- #endif // _MM_EX_CHECKINGPANEL_H_ Modified: trunk/src/mmtransaction.cpp =================================================================== --- trunk/src/mmtransaction.cpp 2013-06-24 15:10:52 UTC (rev 4169) +++ trunk/src/mmtransaction.cpp 2013-06-25 03:31:49 UTC (rev 4170) @@ -111,34 +111,30 @@ //-----------------------------------------------------------------------------// mmBankTransaction::mmBankTransaction(mmCoreDB* core) : mmTransaction(-1), - core_(core), - isInited_(false), - updateRequired_(false) + core_(core) { splitEntries_ = new mmSplitTransactionEntries(); } mmBankTransaction::mmBankTransaction(mmCoreDB* core, wxSQLite3ResultSet& q1) : mmTransaction(q1.GetInt("TRANSID")), - core_(core), - isInited_(false), - updateRequired_(false) + core_(core) { date_ = q1.GetDate("TRANSDATE"); transNum_ = q1.GetString("TRANSACTIONNUMBER"); status_ = q1.GetString("STATUS"); notes_ = q1.GetString("NOTES"); - transType_ = q1.GetString("TRANSCODE"); accountID_ = q1.GetInt("ACCOUNTID"); toAccountID_ = q1.GetInt("TOACCOUNTID"); payeeID_ = q1.GetInt("PAYEEID"); - payeeStr_ = core->payeeList_.GetPayeeName(payeeID_); + //payeeStr_ = core->payeeList_.GetPayeeName(payeeID_); + transType_ = q1.GetString("TRANSCODE"); amt_ = q1.GetDouble("TRANSAMOUNT"); toAmt_ = q1.GetDouble("TOTRANSAMOUNT"); followupID_ = q1.GetInt("FOLLOWUPID"); categID_ = q1.GetInt("CATEGID"); subcategID_ = q1.GetInt("SUBCATEGID"); - fullCatStr_ = core->categoryList_.GetFullCategoryString(categID_, subcategID_); + //fullCatStr_ = core->categoryList_.GetFullCategoryString(categID_, subcategID_); core->accountList_.getCurrencySharedPtr(accountID_)->loadCurrencySettings(); @@ -208,8 +204,6 @@ { fullCatStr_ = core_->categoryList_.GetFullCategoryString(categID_, subcategID_); } - - isInited_ = true; } double mmBankTransaction::value(int accountID) const @@ -484,22 +478,6 @@ return pCopyTransaction; } -mmBankTransaction* mmBankTransactionList::getBankTransactionPtr(int accountID, int transactionID) const -{ - for (auto const& pBankTransaction : transactions_) - { - if (((pBankTransaction->accountID_ == accountID) || - (pBankTransaction->toAccountID_ == accountID)) - && (pBankTransaction->transactionID() == transactionID)) - { - return pBankTransaction; - } - } - // didn't find the transaction - wxASSERT(false); - return NULL; -} - mmBankTransaction* mmBankTransactionList::getBankTransactionPtr(int transactionID) const { for (auto const& pBankTransaction : transactions_) @@ -582,7 +560,6 @@ { i = pBankTransaction; i->payeeStr_ = pBankTransaction->payeeStr_; - i->updateRequired_ = true; break; } } @@ -590,53 +567,6 @@ mmOptions::instance().databaseUpdated_ = true; } -void mmBankTransactionList::UpdateAllTransactions() -{ - // We need to update all transactions incase of errors when loading - for (auto const& pBankTransaction : transactions_) - { - if (pBankTransaction && pBankTransaction->updateRequired_) - { - UpdateTransaction(pBankTransaction); - pBankTransaction->updateRequired_ = false; - } - } -} - -void mmBankTransactionList::UpdateAllTransactionsForCategory(int categID, - int subCategID) -{ - // We need to update all transactions incase of errors when loading - for (auto const& pBankTransaction : transactions_) - { - if (pBankTransaction && (pBankTransaction->categID_ == categID) - && (pBankTransaction->subcategID_ == subCategID)) - { - pBankTransaction->fullCatStr_ = core_->categoryList_.GetFullCategoryString(categID, subCategID); - //pBankTransaction->categID_ = categID; - //pBankTransaction->subcategID_ = subCategID; - } - } -} - -int mmBankTransactionList::UpdateAllTransactionsForPayee(int payeeID) -{ - // We need to update all transactions incase of errors when loading - for (auto const& pBankTransaction : transactions_) - { - if (pBankTransaction && (pBankTransaction->payeeID_ == payeeID)) - { - if (pBankTransaction->transType_ != TRANS_TYPE_TRANSFER_STR) - { - pBankTransaction->payeeStr_ = core_->payeeList_.GetPayeeName(payeeID); - //pBankTransaction->payeeID_ = payeeID; - } - } - } - - return 0; -} - void mmBankTransactionList::getExpensesIncomeStats (std::map<int, std::pair<double, double> > &incomeExpensesStats , mmDateRange* date_range @@ -819,22 +749,19 @@ for (auto const& pBankTransaction : transactions_) { - if (pBankTransaction) + if (accountID != -1) { - if (accountID != -1) - { - if (pBankTransaction->accountID_ != accountID && pBankTransaction->toAccountID_ != accountID) - continue; // skip + if (pBankTransaction->accountID_ != accountID && pBankTransaction->toAccountID_ != accountID) + continue; // skip - if (pBankTransaction->date_.IsLaterThan(wxDateTime::Now())) - continue; //skip future dated transactions - } + if (pBankTransaction->date_.IsLaterThan(wxDateTime::Now())) + continue; //skip future dated transactions + } - if (!dt.IsLaterThan(pBankTransaction->date_)) - { - dt = pBankTransaction->date_; - same_initial_date = false; - } + if (!dt.IsLaterThan(pBankTransaction->date_)) + { + dt = pBankTransaction->date_; + same_initial_date = false; } } @@ -1005,30 +932,6 @@ return balance; } -bool mmBankTransactionList::getDailyBalance(const mmCoreDB* core, int accountID, std::map<wxDateTime, double>& daily_balance, bool ignoreFuture) const -{ - wxDateTime now = wxDateTime::Now(); - double convRate = core->accountList_.getAccountBaseCurrencyConvRate(accountID); - for (const auto & pBankTransaction: transactions_) - { - if (pBankTransaction->accountID_ != accountID && pBankTransaction->toAccountID_ != accountID) - continue; // skip - - if (pBankTransaction->status_ == "V") - continue; // skip - - if (ignoreFuture) - { - if (pBankTransaction->date_.IsLaterThan(now)) - continue; //skip future dated transactions - } - - daily_balance[pBankTransaction->date_] += pBankTransaction->value(accountID) * convRate; - } - - return true; -} - double mmBankTransactionList::getReconciledBalance(int accountID, bool ignoreFuture) const { double balance = 0.0; @@ -1100,6 +1003,27 @@ return false; } +bool mmBankTransactionList::getDailyBalance(const mmCoreDB* core, int accountID, std::map<wxDateTime, double>& daily_balance, bool ignoreFuture) const +{ + wxDateTime now = wxDateTime::Now(); + double convRate = core->accountList_.getAccountBaseCurrencyConvRate(accountID); + for (const auto & pBankTransaction: transactions_) + { + if (pBankTransaction->accountID_ != accountID && pBankTransaction->toAccountID_ != accountID) + continue; // skip + if (pBankTransaction->status_ == "V") + continue; // skip + if (ignoreFuture) + { + if (pBankTransaction->date_.IsLaterThan(now)) + continue; //skip future dated transactions + } + daily_balance[pBankTransaction->date_] += pBankTransaction->value(accountID) * convRate; + } + return true; +} + + void mmBankTransactionList::deleteTransactions(int accountID) { for (const auto& pBankTransaction : transactions_ ) @@ -1206,14 +1130,6 @@ return err; } -void mmBankTransactionList::ChangeDateFormat() -{ - for (const auto & pBankTransaction: transactions_) - { - pBankTransaction->dateStr_ = (pBankTransaction->date_).Format(mmOptions::instance().dateFormat_); - } -} - bool mmBankTransactionList::IsCategoryUsed(int iCatID, int iSubCatID, bool& bIncome, bool bIgnor_subcat) const { double sum = 0; Modified: trunk/src/mmtransaction.h =================================================================== --- trunk/src/mmtransaction.h 2013-06-24 15:10:52 UTC (rev 4169) +++ trunk/src/mmtransaction.h 2013-06-25 03:31:49 UTC (rev 4170) @@ -90,49 +90,35 @@ /* Core Data */ wxDateTime date_; - wxString transNum_; + wxString transType_; wxString status_; - wxString notes_; - wxString transType_; - + int payeeID_; + wxString payeeStr_; + int categID_; + int subcategID_; + wxString fullCatStr_; double amt_; double toAmt_; int accountID_; + wxString fromAccountStr_; int toAccountID_; + int followupID_; + wxString notes_; mmSplitTransactionEntries* splitEntries_; /* Derived Data */ - wxString dateStr_; - wxString catStr_; - wxString subCatStr_; - wxString payeeStr_; - wxString transAmtString_; - wxString transToAmtString_; - wxString fromAccountStr_; - wxString fullCatStr_; - wxString withdrawalStr_; double withdrawal_amt_; - wxString depositStr_; double deposit_amt_; - double balance_; - wxString balanceStr_; - int payeeID_; - int categID_; - int subcategID_; - bool updateRequired_; - int followupID_; + //bool updateRequired_; // used for transaction reports double reportCategAmount_; wxString reportCategAmountStr_; - -private: - bool isInited_; }; class mmBankTransactionList @@ -141,7 +127,6 @@ mmBankTransactionList(mmCoreDB* core); ~mmBankTransactionList() {} - mmBankTransaction* getBankTransactionPtr(int accountID, int transactionID) const; mmBankTransaction* getBankTransactionPtr(int transactionID) const; int addTransaction(mmBankTransaction* pTransaction); bool checkForExistingTransaction(mmBankTransaction* pTransaction); @@ -154,9 +139,6 @@ /* Update Transactions */ void UpdateTransaction(mmBankTransaction* pTransaction); - void UpdateAllTransactions(); - void UpdateAllTransactionsForCategory(int categID, int subCategID); - int UpdateAllTransactionsForPayee(int payeeID); bool removeTransaction(int accountID, int transactionID); bool deleteTransaction(int accountID, int transactionID); @@ -165,7 +147,6 @@ int RelocateCategory(mmCoreDB* core, int destCatID, int destSubCatID, int sourceCatID, int sourceSubCatID, int& changedCats, int& changedSubCats); - void ChangeDateFormat(); /* Query Functions */ void getTransactionStats(std::map<wxDateTime::Month, std::map<int, int> > &stats, int start_year) const; @@ -186,7 +167,6 @@ wxDateTime getLastDate(int accountID) const; double getBalance(int accountID, bool ignoreFuture = false) const; - bool getDailyBalance(const mmCoreDB* core, int accountID, std::map<wxDateTime, double>& daily_balance, bool ignoreFuture = false) const; double getReconciledBalance(int accountID, bool ignoreFuture = false) const; int countFollowupTransactions() const; int getLastUsedCategoryID(int accountID, int payeeID, const wxString sType, int& subcategID) const; @@ -194,7 +174,9 @@ wxArrayString getTransactionNumber(int accountID, const wxDateTime transaction_date) const; bool IsCategoryUsed(int iCatID, int iSubCatID, bool& bIncome, bool bIgnor_subcat = true) const; bool IsPayeeUsed(int iPayeeID) const; + bool getDailyBalance(const mmCoreDB* core, int accountID, std::map<wxDateTime, double>& daily_balance, bool ignoreFuture = false) const; + /* Data */ //typedef std::vector< std::shared_ptr<mmBankTransaction> >::const_iterator const_iterator; std::vector<mmBankTransaction*> transactions_; Modified: trunk/src/optionsdialog.cpp =================================================================== --- trunk/src/optionsdialog.cpp 2013-06-24 15:10:52 UTC (rev 4169) +++ trunk/src/optionsdialog.cpp 2013-06-25 03:31:49 UTC (rev 4170) @@ -765,7 +765,6 @@ dateFormat_ = data->GetData(); mmOptions::instance().dateFormat_ = dateFormat_; sampleDateText_->SetLabel(wxDateTime::Now().Format(dateFormat_)); - core_->bTransactionList_.ChangeDateFormat(); } else return; Modified: trunk/src/payeedialog.cpp =================================================================== --- trunk/src/payeedialog.cpp 2013-06-24 15:10:52 UTC (rev 4169) +++ trunk/src/payeedialog.cpp 2013-06-25 03:31:49 UTC (rev 4170) @@ -308,21 +308,20 @@ void mmPayeeDialog::OnEdit(wxCommandEvent& event) { - wxString oldname = listBox_->GetStringSelection(); + wxString old_name = listBox_->GetStringSelection(); wxString mesg; - mesg.Printf(_("Enter a new name for %s"),oldname); - wxString newName = wxGetTextFromUser(mesg, _("Edit Payee Name"), oldname); - if (newName != wxGetEmptyString()) + mesg.Printf(_("Enter a new name for %s"), old_name); + wxString new_name = wxGetTextFromUser(mesg, _("Edit Payee Name"), old_name); + if (new_name != wxGetEmptyString()) { - core_->payeeList_.UpdatePayee(m_payee_id_, newName); - core_->bTransactionList_.UpdateAllTransactionsForPayee(m_payee_id_); + core_->payeeList_.UpdatePayee(m_payee_id_, new_name); editButton_->Disable(); fillControls(); // Now we need to make sure that the edited name is selected after the dialog is closed textCtrl_->Clear(); - listBox_->SetStringSelection(newName); + listBox_->SetStringSelection(new_name); OnSelChanged(event); } } Modified: trunk/src/reports/transactions.cpp =================================================================== --- trunk/src/reports/transactions.cpp 2013-06-24 15:10:52 UTC (rev 4169) +++ trunk/src/reports/transactions.cpp 2013-06-25 03:31:49 UTC (rev 4170) @@ -110,6 +110,7 @@ hb.addTableCell(transaction.status_); hb.addTableCell(transaction.fullCatStr_, false, true); + //TODO: make me simple if (transaction.transType_ == TRANS_TYPE_DEPOSIT_STR) hb.addTableCell(_("Deposit")); else if (transaction.transType_ == TRANS_TYPE_WITHDRAWAL_STR) @@ -133,21 +134,8 @@ // Get the exchange rate for the selected account double dbRate = core_->accountList_.getAccountBaseCurrencyConvRate(transaction.accountID_); double transAmount = transaction.amt_ * dbRate; - if (transaction.reportCategAmountStr_ != "") - { - transAmount = transaction.reportCategAmount_ * dbRate; - if (transaction.transType_ == TRANS_TYPE_WITHDRAWAL_STR && transAmount < 0) - negativeTransAmount = false; - else if (transaction.transType_ == TRANS_TYPE_DEPOSIT_STR && transAmount < 0) - negativeTransAmount = true; - } - wxString amtColour = negativeTransAmount ? "RED" : "BLACK"; - - if (transaction.reportCategAmountStr_ == "") - hb.addTableCell(transaction.transAmtString_, true, false,false, amtColour); - else - hb.addTableCell(transaction.reportCategAmountStr_, true, false,false, amtColour); + hb.addMoneyCell(transAmount); hb.addTableCell(transaction.transNum_); hb.addTableCell(transaction.notes_, false, true); hb.endTableRow(); Modified: trunk/src/transdialog.cpp =================================================================== --- trunk/src/transdialog.cpp 2013-06-24 15:10:52 UTC (rev 4169) +++ trunk/src/transdialog.cpp 2013-06-25 03:31:49 UTC (rev 4170) @@ -897,8 +897,8 @@ } else { - pTransaction = core_->bTransactionList_.getBankTransactionPtr(accountID_ - , pBankTransaction_->transactionID()); + pTransaction = core_->bTransactionList_.getBankTransactionPtr( + pBankTransaction_->transactionID()); } mmCurrency* pCurrencyPtr = core_->accountList_.getCurrencySharedPtr(newAccountID_); @@ -1150,7 +1150,6 @@ // we need to create a new pointer for Split transactions. mmSplitTransactionEntries* splitTransEntries(new mmSplitTransactionEntries()); - core_->bTransactionList_.getBankTransactionPtr(accountID_ - , pBankTransaction_->transactionID())->getSplitTransactions(splitTransEntries); + core_->bTransactionList_.getBankTransactionPtr(pBankTransaction_->transactionID())->getSplitTransactions(splitTransEntries); split_->entries_ = splitTransEntries->entries_; } Modified: trunk/src/univcsvdialog.cpp =================================================================== --- trunk/src/univcsvdialog.cpp 2013-06-24 15:10:52 UTC (rev 4169) +++ trunk/src/univcsvdialog.cpp 2013-06-25 03:31:49 UTC (rev 4170) @@ -821,10 +821,11 @@ buffer << inQuotes(amount, delimit); break; case UNIV_CSV_CATEGORY: - buffer << inQuotes(pBankTransaction->catStr_, delimit); + buffer << inQuotes(core_->categoryList_.GetCategoryName(pBankTransaction->categID_), delimit); break; case UNIV_CSV_SUBCATEGORY: - buffer << inQuotes(pBankTransaction->subCatStr_, delimit); + buffer << inQuotes(core_->categoryList_ + .GetSubCategoryName(pBankTransaction->categID_, pBankTransaction->subcategID_), delimit); break; case UNIV_CSV_TRANSNUM: buffer << inQuotes(pBankTransaction->transNum_, delimit); @@ -999,8 +1000,8 @@ wxString text; switch (*sit) { - case UNIV_CSV_DATE: - text << inQuotes(pBankTransaction->dateStr_, delimit); + case UNIV_CSV_DATE: //TODO: Proper date format + text << inQuotes(mmGetDateForDisplay(pBankTransaction->date_), delimit); break; case UNIV_CSV_PAYEE: text << inQuotes(payee, delimit); @@ -1009,10 +1010,11 @@ text << inQuotes(amount, delimit); break; case UNIV_CSV_CATEGORY: - text << inQuotes(pBankTransaction->catStr_, delimit); + text << inQuotes(core_->categoryList_.GetCategoryName(pBankTransaction->categID_), delimit); break; case UNIV_CSV_SUBCATEGORY: - text << inQuotes(pBankTransaction->subCatStr_, delimit); + text << inQuotes(core_->categoryList_ + .GetSubCategoryName(pBankTransaction->categID_, pBankTransaction->subcategID_), delimit); break; case UNIV_CSV_TRANSNUM: text << inQuotes(pBankTransaction->transNum_, delimit); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |