From: <vo...@us...> - 2011-11-28 14:02:40
|
Revision: 1541 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=1541&view=rev Author: vomikan Date: 2011-11-28 14:02:29 +0000 (Mon, 28 Nov 2011) Log Message: ----------- New style for buttons Modified Paths: -------------- trunk/mmex/src/guiid.h trunk/mmex/src/mmhelppanel.cpp Modified: trunk/mmex/src/guiid.h =================================================================== --- trunk/mmex/src/guiid.h 2011-11-28 13:34:23 UTC (rev 1540) +++ trunk/mmex/src/guiid.h 2011-11-28 14:02:29 UTC (rev 1541) @@ -282,8 +282,8 @@ ID_PANEL_REPORTS_HTMLWINDOW, ID_PANEL_REPORTS_HEADER_PANEL, ID_PANEL_REPORTS_STATIC_HEADER, - ID_PANEL_REPORTS_HELP_BUTTON_BACK, - ID_PANEL_REPORTS_HELP_BUTTON_FORWARD, + //ID_PANEL_REPORTS_HELP_BUTTON_BACK, + //ID_PANEL_REPORTS_HELP_BUTTON_FORWARD, /* Category */ ID_DIALOG_CATEGORY, Modified: trunk/mmex/src/mmhelppanel.cpp =================================================================== --- trunk/mmex/src/mmhelppanel.cpp 2011-11-28 13:34:23 UTC (rev 1540) +++ trunk/mmex/src/mmhelppanel.cpp 2011-11-28 14:02:29 UTC (rev 1541) @@ -29,8 +29,8 @@ #include <algorithm> BEGIN_EVENT_TABLE(mmHelpPanel, wxPanel) - EVT_BUTTON(ID_PANEL_REPORTS_HELP_BUTTON_BACK, mmHelpPanel::OnHelpPageBack) - EVT_BUTTON(ID_PANEL_REPORTS_HELP_BUTTON_FORWARD, mmHelpPanel::OnHelpPageForward) + EVT_BUTTON(wxID_BACKWARD, mmHelpPanel::OnHelpPageBack) + EVT_BUTTON(wxID_FORWARD, mmHelpPanel::OnHelpPageForward) END_EVENT_TABLE() mmHelpPanel::mmHelpPanel( mmGUIFrame* frame, wxSQLite3Database* db, wxWindow *parent, @@ -80,17 +80,17 @@ wxBoxSizer* itemBoxSizerHeader = new wxBoxSizer(wxHORIZONTAL); itemPanel3->SetSizer(itemBoxSizerHeader); - wxButton* buttonBack = new wxButton(itemPanel3, ID_PANEL_REPORTS_HELP_BUTTON_BACK, wxT("<")); - wxButton* buttonFordward = new wxButton(itemPanel3, ID_PANEL_REPORTS_HELP_BUTTON_FORWARD, wxT(">")); + wxButton* buttonBack = new wxButton(itemPanel3, wxID_BACKWARD, _("&Back")); + wxButton* buttonFordward = new wxButton(itemPanel3, wxID_FORWARD, _("&Forward") ); wxString helpHeader = mmex::getProgramName() + _(" Help"); wxStaticText* itemStaticText9 = new wxStaticText( itemPanel3, ID_PANEL_REPORTS_STATIC_HEADER, helpHeader, wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText9->SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD, FALSE, wxT(""))); - itemBoxSizerHeader->Add(buttonBack, 0, wxALL, 1); - itemBoxSizerHeader->Add(buttonFordward, 0, wxRIGHT, 31); - itemBoxSizerHeader->Add(itemStaticText9, 0, wxALL, 1); + itemBoxSizerHeader->Add(buttonBack, 0, wxLEFT, 5); + itemBoxSizerHeader->Add(buttonFordward, 0, wxLEFT|wxRIGHT, 5); + itemBoxSizerHeader->Add(itemStaticText9, 0, wxLEFT|wxTOP, 5); htmlWindow_ = new wxHtmlWindow( itemDialog1, ID_PANEL_REPORTS_HTMLWINDOW, wxDefaultPosition, wxDefaultSize, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2012-02-25 19:40:37
|
Revision: 1890 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=1890&view=rev Author: vomikan Date: 2012-02-25 19:40:30 +0000 (Sat, 25 Feb 2012) Log Message: ----------- new style for income/expences reports Modified Paths: -------------- trunk/mmex/src/mmhomepagepanel.cpp trunk/mmex/src/reportincexpenses.cpp trunk/mmex/src/reportincexpensesfinancialperiod.cpp trunk/mmex/src/reportincexpesestime.cpp Modified: trunk/mmex/src/mmhomepagepanel.cpp =================================================================== --- trunk/mmex/src/mmhomepagepanel.cpp 2012-02-25 16:29:13 UTC (rev 1889) +++ trunk/mmex/src/mmhomepagepanel.cpp 2012-02-25 19:40:30 UTC (rev 1890) @@ -418,7 +418,7 @@ gg.init(tincome, texpenses); gg.Generate(wxT("")); - hb.addTableHeaderRow(_("Income vs Expenses: "), 2); + hb.addTableHeaderRow(wxString()<<_("Income vs Expenses: ") << _("Current Month"), 2); hb.startTableRow(); //hb.startTableCell(wxT("50%\" align=\"center")); @@ -431,8 +431,12 @@ //start table in table hb.startTable(); - hb.addTableHeaderRow(_ ("Current Month"), 2); hb.startTableRow(); + hb.addTableHeaderCell(_("Type")); + hb.addTableHeaderCell(_("Amount")); + hb.endTableRow(); +// hb.addTableHeaderRow(_("Current Month"), 2); + hb.startTableRow(); hb.addTableCell(_("Income:"), false, true); hb.addTableCell(incStr, true); hb.endTableRow(); Modified: trunk/mmex/src/reportincexpenses.cpp =================================================================== --- trunk/mmex/src/reportincexpenses.cpp 2012-02-25 16:29:13 UTC (rev 1889) +++ trunk/mmex/src/reportincexpenses.cpp 2012-02-25 19:40:30 UTC (rev 1890) @@ -28,22 +28,6 @@ wxDateTime tBegin = dtBegin_; // date needs to be adjusted dateDisplay.DisplayDateHeading(hb, tBegin.Add(wxDateSpan::Day()), dtEnd_, !ignoreDate_); - //wxDateTime now = wxDateTime::Now(); - //wxString dt = _("Today's Date: ") + mmGetNiceDateString(now); - //hb.addHeader(7, dt); - //hb.addLineBreak(); - //hb.addLineBreak(); - - //wxDateTime tBegin = dtBegin_; - //if (!ignoreDate_) - //{ - // wxString dtRange = _("From: ") - // + mmGetNiceDateSimpleString(tBegin.Add(wxDateSpan::Day())) + _(" To: ") - // + mmGetNiceDateSimpleString(dtEnd_); - // hb.addHeader(7, dtRange); - // hb.addLineBreak(); - //} - hb.addLineBreak(); hb.startCenter(); @@ -54,12 +38,20 @@ double income = 0.0; core_->bTransactionList_.getExpensesIncome(-1,expenses, income, ignoreDate_, dtBegin_,dtEnd_, mmIniOptions::instance().ignoreFutureTransactions_); + hb.startTable(wxT("75%")); + hb.addTableHeaderRow(wxT(""), 2); + hb.startTableRow(); + hb.startTableCell(); + mmGraphIncExpensesMonth gg; gg.init(income, expenses); gg.Generate(_("Income vs Expenses")); hb.addImage(gg.getOutputFileName()); - hb.startTable(wxT("60%")); + hb.endTableCell(); + hb.startTableCell(); + + hb.startTable(wxT("95%")); hb.startTableRow(); hb.addTableHeaderCell(_("Type")); hb.addTableHeaderCell(_("Amount")); @@ -80,21 +72,19 @@ hb.startTableRow(); hb.addTableCell(_("Expenses:"), false, true); - if(expenses > income) - { - hb.addTableCell(expString, true, true, true, wxT("#ff0000")); - } - else - { - hb.addTableCell(expString, true, false, true); - } - + hb.addTableCell(expString, true, true, true, (expenses > income ? wxT("RED") : wxT(""))); hb.endTableRow(); hb.addRowSeparator(2); hb.addTotalRow(_("Difference:"), 2, diffString); hb.endTable(); + + hb.endTableCell(); + hb.endTableRow(); + hb.addRowSeparator(2); + hb.endTable(); + hb.endCenter(); hb.end(); Modified: trunk/mmex/src/reportincexpensesfinancialperiod.cpp =================================================================== --- trunk/mmex/src/reportincexpensesfinancialperiod.cpp 2012-02-25 16:29:13 UTC (rev 1889) +++ trunk/mmex/src/reportincexpensesfinancialperiod.cpp 2012-02-25 19:40:30 UTC (rev 1890) @@ -67,10 +67,11 @@ hb.startTable(wxT("75%")); hb.startTableRow(); + hb.addTableHeaderCell(_("Year")); hb.addTableHeaderCell(_("Month")); - hb.addTableHeaderCell(_("Income")); - hb.addTableHeaderCell(_("Expenses")); - hb.addTableHeaderCell(_("Difference")); + hb.addTableHeaderCell(_("Income"), true); + hb.addTableHeaderCell(_("Expenses"), true); + hb.addTableHeaderCell(_("Difference"), true); hb.endTableRow(); double income = 0.0; @@ -93,7 +94,7 @@ yearStr = wxString::Format(wxT("%d"), year_); } - wxString monName = mmGetNiceMonthName(yidx) + wxT(" ") + yearStr; + wxString monName = mmGetNiceMonthName(yidx); if (yearIndex == 0) dayStart = startDay; @@ -119,24 +120,17 @@ mmex::formatDoubleToCurrencyEdit(income, actualIncStr); hb.startTableRow(); + hb.addTableCell(yearStr, false, true); hb.addTableCell(monName, false, true); balance = income - expenses; wxString actualBalStr; mmex::formatDoubleToCurrencyEdit(balance, actualBalStr); - if (balance < 0.0) - { - hb.addTableCell(actualIncStr, true, true, true); - hb.addTableCell(actualExpStr, true, true, true, wxT("#ff0000")); - hb.addTableCell(actualBalStr, true, true, true, wxT("#ff0000")); - } - else - { - hb.addTableCell(actualIncStr, true, false, true); - hb.addTableCell(actualExpStr, true, false, true); - hb.addTableCell(actualBalStr, true, false, true); - } + hb.addTableCell(actualIncStr, true, true, true); + hb.addTableCell(actualExpStr, true, true, true); + hb.addTableCell(actualBalStr, true, true, true, (balance < 0.0 ? wxT("RED") : wxT(""))); + hb.endTableRow(); } @@ -160,14 +154,13 @@ data.push_back(actualExpStr); data.push_back(actualBalStr); - hb.addRowSeparator(4); - hb.addTotalRow(_("Total"), 4, data); + hb.addRowSeparator(5); + hb.addTotalRow(_("Total:"), 5, data); hb.endTable(); - hb.endCenter(); - hb.end(); + // restore year value for printing purposes. year_ = printYear_; return hb.getHTMLText(); Modified: trunk/mmex/src/reportincexpesestime.cpp =================================================================== --- trunk/mmex/src/reportincexpesestime.cpp 2012-02-25 16:29:13 UTC (rev 1889) +++ trunk/mmex/src/reportincexpesestime.cpp 2012-02-25 19:40:30 UTC (rev 1890) @@ -36,10 +36,11 @@ hb.startTable(wxT("75%")); hb.startTableRow(); + hb.addTableHeaderCell(_("Year")); hb.addTableHeaderCell(_("Month")); - hb.addTableHeaderCell(_("Income")); - hb.addTableHeaderCell(_("Expenses")); - hb.addTableHeaderCell(_("Difference")); + hb.addTableHeaderCell(_("Income"), true); + hb.addTableHeaderCell(_("Expenses"), true); + hb.addTableHeaderCell(_("Difference"), true); hb.endTableRow(); double income = 0.0; @@ -48,7 +49,7 @@ for (int yidx = 0; yidx < 12; yidx++) { - wxString monName = mmGetNiceMonthName(yidx) + wxT(" ") + yearStr; + wxString monName = mmGetNiceMonthName(yidx); wxDateTime dtBegin(1, (wxDateTime::Month)yidx, year_); wxDateTime dtEnd = dtBegin.GetLastMonthDay((wxDateTime::Month)yidx, year_); @@ -65,24 +66,17 @@ mmex::formatDoubleToCurrencyEdit(income, actualIncStr); hb.startTableRow(); + hb.addTableCell(yearStr, false, true); hb.addTableCell(monName, false, true); balance = income - expenses; wxString actualBalStr; mmex::formatDoubleToCurrencyEdit(balance, actualBalStr); - if (balance < 0.0) - { - hb.addTableCell(actualIncStr, true, true, true); - hb.addTableCell(actualExpStr, true, true, true, wxT("#ff0000")); - hb.addTableCell(actualBalStr, true, true, true, wxT("#ff0000")); - } - else - { - hb.addTableCell(actualIncStr, true, false, true); - hb.addTableCell(actualExpStr, true, false, true); - hb.addTableCell(actualBalStr, true, false, true); - } + hb.addTableCell(actualIncStr, true, true, true); + hb.addTableCell(actualExpStr, true, true, true); + hb.addTableCell(actualBalStr, true, true, true, (balance < 0.0 ? wxT("RED") : wxT(""))); + hb.endTableRow(); } @@ -114,13 +108,12 @@ data.push_back(actualExpStr); data.push_back(actualBalStr); - hb.addRowSeparator(4); - hb.addTotalRow(_("Total"), 4, data); + hb.addRowSeparator(5); + hb.addTotalRow(_("Total:"), 5, data); hb.endTable(); - hb.endCenter(); - hb.end(); + return hb.getHTMLText(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2012-04-30 11:04:35
|
Revision: 2217 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2217&view=rev Author: guanlisheng Date: 2012-04-30 11:04:29 +0000 (Mon, 30 Apr 2012) Log Message: ----------- sync from branch Modified Paths: -------------- trunk/mmex/src/assetdialog.cpp trunk/mmex/src/assetspanel.cpp trunk/mmex/src/reportsummaryassets.cpp Modified: trunk/mmex/src/assetdialog.cpp =================================================================== --- trunk/mmex/src/assetdialog.cpp 2012-04-30 10:50:51 UTC (rev 2216) +++ trunk/mmex/src/assetdialog.cpp 2012-04-30 11:04:29 UTC (rev 2217) @@ -20,12 +20,9 @@ #include "currencydialog.h" #include "defs.h" #include "paths.h" +#include "mmex_db_view.h" #include <wx/datectrl.h> - -namespace -{ - enum { DEF_CHANGE_NONE, DEF_CHANGE_APPRECIATE, DEF_CHANGE_DEPRECIATE }; enum { DEF_ASSET_PROPERTY, DEF_ASSET_AUTO, DEF_ASSET_HOUSE, DEF_ASSET_ART, DEF_ASSET_JEWELLERY, DEF_ASSET_CASH, DEF_ASSET_OTHER }; @@ -35,9 +32,6 @@ IDC_NOTES, }; -} // namespace - - IMPLEMENT_DYNAMIC_CLASS( mmAssetDialog, wxDialog ) BEGIN_EVENT_TABLE( mmAssetDialog, wxDialog ) @@ -85,52 +79,35 @@ void mmAssetDialog::dataToControls() { - static const char sql[] = - "select ASSETNAME, " - "NOTES, " - "STARTDATE, " - "VALUE, " - "VALUECHANGERATE, " - "VALUECHANGE, " - "ASSETTYPE " - "from ASSETS_V1 " - "where ASSETID = ?"; - - wxSQLite3Statement st = m_db->PrepareStatement(sql); - st.Bind(1, m_assetID); - - wxSQLite3ResultSet q1 = st.ExecuteQuery(); - if (q1.NextRow()) + const DB_View_ASSETS_V1::Data *asset = ASSETS_V1.find(m_assetID, m_db); + if (asset) { - m_assetName->SetValue(q1.GetString(wxT("ASSETNAME"))); - m_notes->SetValue(q1.GetString(wxT("NOTES"))); + m_assetName->SetValue(asset->ASSETNAME); + m_notes->SetValue(asset->NOTES); - wxString dateString = q1.GetString(wxT("STARTDATE")); - wxDateTime dtdt = mmGetStorageStringAsDate(dateString); + wxDateTime dtdt = mmGetStorageStringAsDate(asset->STARTDATE); wxString dt = mmGetDateForDisplay(m_db, dtdt); m_dpc->SetValue(dtdt); wxString value; - mmex::formatDoubleToCurrencyEdit(q1.GetDouble(wxT("VALUE")), value); + mmex::formatDoubleToCurrencyEdit(asset->VALUE, value); m_value->SetValue(value); wxString valueChangeRate; - valueChangeRate.Printf(wxT("%.3f"), q1.GetDouble(wxT("VALUECHANGERATE"))); + valueChangeRate.Printf(wxT("%.3f"), asset->VALUECHANGERATE); m_valueChangeRate->SetValue(valueChangeRate); - wxString valueChangeTypeStr = q1.GetString(wxT("VALUECHANGE")); - if (valueChangeTypeStr == wxT("None")) + if (asset->VALUECHANGE == wxT("None")) { m_valueChange->SetSelection(DEF_CHANGE_NONE); enableDisableRate(false); } - else if (valueChangeTypeStr == wxT("Appreciates")) + else if (asset->VALUECHANGE == wxT("Appreciates")) { m_valueChange->SetSelection(DEF_CHANGE_APPRECIATE); enableDisableRate(true); } - else if (valueChangeTypeStr == wxT("Depreciates")) - + else if (asset->VALUECHANGE == wxT("Depreciates")) { m_valueChange->SetSelection(DEF_CHANGE_DEPRECIATE); enableDisableRate(true); @@ -140,7 +117,7 @@ wxASSERT(false); } - wxString assetTypeStr = q1.GetString(wxT("ASSETTYPE")); + wxString assetTypeStr = asset->ASSETTYPE; if (assetTypeStr == wxT("Property")) m_assetType->SetSelection(DEF_ASSET_PROPERTY); else if (assetTypeStr == wxT("Automobile")) @@ -155,9 +132,7 @@ m_assetType->SetSelection(DEF_ASSET_CASH); else if (assetTypeStr == wxT("Other")) m_assetType->SetSelection(DEF_ASSET_OTHER); - } - st.Finalize(); } void mmAssetDialog::fillControls() @@ -238,9 +213,9 @@ wxArrayString itemTypeStrings; - itemTypeStrings.Add(_("None")); - itemTypeStrings.Add(_("Appreciates")); - itemTypeStrings.Add(_("Depreciates")); + itemTypeStrings.Add(_("None")); + itemTypeStrings.Add(_("Appreciates")); + itemTypeStrings.Add(_("Depreciates")); m_valueChange = new wxChoice( itemPanel5, IDC_COMBO_TYPE, wxDefaultPosition, wxSize(150,-1), itemTypeStrings); m_valueChange->SetToolTip(_("Specify if the value of the asset changes over time")); @@ -368,56 +343,20 @@ else wxASSERT(false); - if (!m_edit) - { - static const char sql[] = - "insert into ASSETS_V1 (" - "STARTDATE, ASSETNAME, VALUE, VALUECHANGE, NOTES, VALUECHANGERATE, ASSETTYPE " - ") values (?, ?, ?, ?, ?, ?, ?)"; + DB_View_ASSETS_V1::Data* asset = ASSETS_V1.find(m_assetID, m_db); + if (! asset) + asset = ASSETS_V1.create(); - wxSQLite3Statement st = m_db->PrepareStatement(sql); - - int i = 0; - st.Bind(++i, pdate); - st.Bind(++i, name); - st.Bind(++i, value); - st.Bind(++i, valueChangeTypeStr); - st.Bind(++i, notes); - st.Bind(++i, valueChangeRate); - st.Bind(++i, assetTypeStr); + asset->STARTDATE = pdate; + asset->ASSETNAME = name; + asset->VALUE = value; + asset->VALUECHANGE = valueChangeTypeStr; + asset->NOTES = notes; + asset->VALUECHANGERATE = valueChangeRate; + asset->ASSETTYPE = assetTypeStr; - wxASSERT(st.GetParamCount() == i); + asset->save(m_db); - st.ExecuteUpdate(); - st.Finalize(); - } - else - { - static const char sql[] = - "update ASSETS_V1 " - "SET STARTDATE = ?, ASSETNAME = ?, " - "VALUE = ?, VALUECHANGE = ?," - "NOTES = ?, VALUECHANGERATE = ?, " - "ASSETTYPE = ? " - "where ASSETID = ?"; - - wxSQLite3Statement st = m_db->PrepareStatement(sql); - - int i = 0; - st.Bind(++i, pdate); - st.Bind(++i, name); - st.Bind(++i, value); - st.Bind(++i, valueChangeTypeStr); - st.Bind(++i, notes); - st.Bind(++i, valueChangeRate); - st.Bind(++i, assetTypeStr); - st.Bind(++i, m_assetID); - - wxASSERT(st.GetParamCount() == i); - - st.ExecuteUpdate(); - st.Finalize(); - } mmOptions::instance().databaseUpdated_ = true; EndModal(wxID_OK); } Modified: trunk/mmex/src/assetspanel.cpp =================================================================== --- trunk/mmex/src/assetspanel.cpp 2012-04-30 10:50:51 UTC (rev 2216) +++ trunk/mmex/src/assetspanel.cpp 2012-04-30 11:04:29 UTC (rev 2217) @@ -18,13 +18,11 @@ #include "util.h" #include "dbwrapper.h" #include "assetdialog.h" +#include "mmex_db_view.h" +#include <boost/foreach.hpp> /* Include XPM Support */ #include "../resources/assets.xpm" - -namespace -{ - enum { IDC_PANEL_STOCKS_LISTCTRL = wxID_HIGHEST + 1, @@ -39,7 +37,7 @@ }; enum EColumn { - COL_NAME, + COL_NAME = 0, COL_DATE, COL_TYPE, COL_VALUE, @@ -47,8 +45,6 @@ COL_MAX, // number of columns }; -} // namespace - /*******************************************************/ BEGIN_EVENT_TABLE(mmAssetsPanel, wxPanel) EVT_BUTTON(wxID_NEW, mmAssetsPanel::OnNewAsset) @@ -154,25 +150,12 @@ wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxLC_VIRTUAL | wxLC_SINGLE_SEL ); //m_listCtrlAssets->SetBackgroundColour(mmColors::listDetailsPanelColor); m_listCtrlAssets->SetImageList(m_imageList.get(), wxIMAGE_LIST_SMALL); - m_listCtrlAssets->InsertColumn(COL_NAME, _("Name")); - wxListItem itemCol; - itemCol.SetImage(-1); - itemCol.SetAlign(wxLIST_FORMAT_LEFT); - itemCol.SetText(_("Type")); - m_listCtrlAssets->InsertColumn(COL_TYPE, itemCol); - - itemCol.SetAlign(wxLIST_FORMAT_RIGHT); - itemCol.SetText(_("Value")); - m_listCtrlAssets->InsertColumn(COL_VALUE, itemCol); + m_listCtrlAssets->InsertColumn(COL_NAME, _("Name"), wxLIST_FORMAT_RIGHT); + m_listCtrlAssets->InsertColumn(COL_TYPE, _("Type"), wxLIST_FORMAT_RIGHT); + m_listCtrlAssets->InsertColumn(COL_VALUE, _("Value"), wxLIST_FORMAT_RIGHT); + m_listCtrlAssets->InsertColumn(COL_DATE, _("Date"), wxLIST_FORMAT_RIGHT); + m_listCtrlAssets->InsertColumn(COL_NOTES, _("Notes")); - itemCol.SetAlign(wxLIST_FORMAT_RIGHT); - itemCol.SetText(_("Date")); - m_listCtrlAssets->InsertColumn(COL_DATE, itemCol); - - itemCol.SetAlign(wxLIST_FORMAT_LEFT); - itemCol.SetText(_("Notes")); - m_listCtrlAssets->InsertColumn(COL_NOTES, itemCol); - /* See if we can get data from inidb */ long col0, col1, col2, col3, col4; mmDBWrapper::getINISettingValue(inidb_, wxT("ASSETS_COL0_WIDTH"), wxT("150")).ToLong(&col0); @@ -244,57 +227,36 @@ wxString lbl = wxString::Format(_("Total: %s"), balance.c_str()); header->SetLabel(lbl); - static const char sql[] = - "select a.ASSETID as ASSETID, " - "a.ASSETNAME as ASSETNAME, " - "a.ASSETTYPE as ASSETTYPE, " - "a.STARTDATE as STARTDATE, " - "ifnull (strftime(INFOVALUE, a.STARTDATE), " - "(strftime(replace (i.infovalue, '%y', SubStr (strftime('%Y', a.STARTDATE),3,2)),a.STARTDATE))) " - "as FORMATEDDATE, " - "a.NOTES as NOTES, " - "VALUECHANGE as VALUECHANGE, " - "VALUECHANGERATE as VALUECHANGERATE " - "from ASSETS_V1 a " - "left join infotable_v1 i on i.INFONAME='DATEFORMAT' " - "order by a.STARTDATE " ; + long count = 0; - wxSQLite3ResultSet q1 = db_->ExecuteQuery(sql); - long cnt = 0; - - for ( ; q1.NextRow(); ++cnt) + std::vector<DB_View_ASSETS_V1::Data> all_assets = ASSETS_V1.all(db_); + BOOST_FOREACH(const DB_View_ASSETS_V1::Data &asset, all_assets) { mmAssetHolder th; - th.id_ = q1.GetInt(wxT("ASSETID")); - th.value_ = mmDBWrapper::getAssetValue(db_, th.id_); - th.assetName_ = q1.GetString(wxT("ASSETNAME")); - th.assetDate_ = q1.GetString(wxT("FORMATEDDATE")); - //sqlite does not support %y date mask therefore null value should be replaces - if (th.assetDate_ == wxT("")) - { - wxString dateString = q1.GetString(wxT("STARTDATE")); - wxDateTime dtdt = mmGetStorageStringAsDate(dateString); - th.assetDate_ = mmGetDateForDisplay(db_, dtdt); - } + th.id_= asset.ASSETID; + th.value_ = mmDBWrapper::getAssetValue(db_, asset.ASSETID); + th.assetName_ = asset.ASSETNAME; + + wxString dateString = asset.STARTDATE; + wxDateTime dtdt = mmGetStorageStringAsDate(dateString); + th.assetDate_ = mmGetDateForDisplay(db_, dtdt); - wxString assetStr = q1.GetString(wxT("ASSETTYPE")); - th.assetType_ = wxGetTranslation(assetStr); // string should be marked for translation - assetStr = q1.GetString(wxT("VALUECHANGE")); - th.assetValueChange_ = wxGetTranslation(assetStr); + th.assetType_ = wxGetTranslation(asset.ASSETTYPE); // string should be marked for translation + th.assetValueChange_ = wxGetTranslation(asset.VALUECHANGE); - th.assetNotes_ = q1.GetString(wxT("NOTES")); + th.assetNotes_ = asset.NOTES; - th.valueChange_ = q1.GetDouble(wxT("VALUECHANGERATE")); + th.valueChange_ = asset.VALUECHANGERATE; mmex::formatDoubleToCurrencyEdit(th.value_, th.valueStr_); mmex::formatDoubleToCurrencyEdit(th.valueChange_, th.valueChangeStr_); m_trans.push_back(th); + ++ count; } - m_listCtrlAssets->SetItemCount(cnt); - q1.Finalize(); + m_listCtrlAssets->SetItemCount(count); } void mmAssetsPanel::OnDeleteAsset(wxCommandEvent& event) @@ -364,7 +326,7 @@ enableEditDeleteButtons(true); wxString miniInfo; wxString infoStr; - infoStr = getItem(selIndex, COL_NOTES); + infoStr = m_trans[selIndex].assetNotes_; miniInfo << wxT("\t") << _("Change in Value") << wxT(": ") << m_trans[selIndex].assetValueChange_ ; if (m_trans[selIndex].assetValueChange_ != _("None")) miniInfo<< wxT(" = ") << m_trans[selIndex].valueChange_ << wxT("%"); @@ -436,15 +398,10 @@ wxMessageDialog msgDlg(this, _("Do you really want to delete the Asset?"), _("Confirm Asset Deletion"), wxYES_NO | wxNO_DEFAULT | wxICON_EXCLAMATION); if (msgDlg.ShowModal() == wxID_YES) { - mmDBWrapper::deleteAsset(m_cp->getDb(), m_cp->getTrans()[m_selectedIndex].id_); + ASSETS_V1.remove(m_cp->getTrans()[m_selectedIndex].id_, m_cp->getDb()); DeleteItem(m_selectedIndex); m_cp->initVirtualListControl(); - wxMessageDialog* msgDlg = new wxMessageDialog(NULL, - _("Thank you! "), _("App"), wxOK); - msgDlg->ShowModal(); - msgDlg->Destroy(); - //if (m_cp->getTrans().empty()) //after delition of asset - index and extra panel should be erased { m_selectedIndex = -1; Modified: trunk/mmex/src/reportsummaryassets.cpp =================================================================== --- trunk/mmex/src/reportsummaryassets.cpp 2012-04-30 10:50:51 UTC (rev 2216) +++ trunk/mmex/src/reportsummaryassets.cpp 2012-04-30 11:04:29 UTC (rev 2217) @@ -24,6 +24,8 @@ #include "util.h" #include "dbwrapper.h" #include "assetspanel.h" +#include "mmex_db_view.h" +#include <boost/foreach.hpp> wxString mmReportSummaryAssets::getHTMLText() { @@ -48,43 +50,27 @@ hb.endTableRow(); mmDBWrapper::loadBaseCurrencySettings(db_); - - static const char sql[] = - "select ASSETID, " - "ASSETNAME, " - "ASSETTYPE, " - "NOTES " - "from ASSETS_V1"; - wxSQLite3ResultSet q1 = db_->ExecuteQuery(sql); - - while (q1.NextRow()) + double assetBalance = 0.0; + wxString assetBalanceStr; + std::vector<DB_View_ASSETS_V1::Data> all_assets = ASSETS_V1.all(db_); + BOOST_FOREACH(const DB_View_ASSETS_V1::Data &asset, all_assets) { - mmAssetHolder th; - - th.id_ = q1.GetInt(wxT("ASSETID")); - th.value_ = mmDBWrapper::getAssetValue(db_, th.id_); - th.assetName_ = q1.GetString(wxT("ASSETNAME")); - th.asset_notes_ = q1.GetString(wxT("NOTES")); - - wxString assetTypeStr = q1.GetString(wxT("ASSETTYPE")); - th.assetType_ = wxGetTranslation(assetTypeStr); - - mmex::formatDoubleToCurrencyEdit(th.value_, th.valueStr_); - + double value = mmDBWrapper::getAssetValue(db_, asset.ASSETID); + assetBalance += value; + wxString asset_type = wxGetTranslation(asset.ASSETTYPE); + wxString value_str; + mmex::formatDoubleToCurrencyEdit(value, value_str); + hb.startTableRow(); - hb.addTableCell(th.assetName_, false, true); - hb.addTableCell(th.assetType_); - hb.addTableCell(th.valueStr_, true); - hb.addTableCell(th.asset_notes_); + hb.addTableCell(asset.ASSETNAME, false, true); + hb.addTableCell(asset_type); + hb.addTableCell(value_str, true); + hb.addTableCell(asset.NOTES); hb.endTableRow(); } - q1.Finalize(); /* Assets */ - double assetBalance = mmDBWrapper::getAssetBalance(db_); - wxString assetBalanceStr; - mmDBWrapper::loadBaseCurrencySettings(db_); mmex::formatDoubleToCurrency(assetBalance, assetBalanceStr); hb.addRowSeparator(4); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2012-05-14 13:22:59
|
Revision: 2342 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2342&view=rev Author: vomikan Date: 2012-05-14 13:22:48 +0000 (Mon, 14 May 2012) Log Message: ----------- added disable for parent window to fix multiple call of single choise window in GTK Modified Paths: -------------- trunk/mmex/src/billsdepositsdialog.cpp trunk/mmex/src/optionsdialog.cpp trunk/mmex/src/stockdialog.cpp Modified: trunk/mmex/src/billsdepositsdialog.cpp =================================================================== --- trunk/mmex/src/billsdepositsdialog.cpp 2012-05-14 10:10:03 UTC (rev 2341) +++ trunk/mmex/src/billsdepositsdialog.cpp 2012-05-14 13:22:48 UTC (rev 2342) @@ -577,6 +577,11 @@ void mmBDDialog::OnAccountName(wxCommandEvent& /*event*/) { wxArrayString as = core_->getAccountsName(); + + //Disable parent window (bug fix for GTK) +#ifdef __WXGTK__ + this->Disable(); +#endif wxSingleChoiceDialog scd(this, _("Choose Bank Account or Term Account"), _("Select Account"), as); if (scd.ShowModal() == wxID_OK) @@ -585,6 +590,9 @@ accountID_ = core_->getAccountID(acctName); itemAccountName_->SetLabel(acctName); } +#ifdef __WXGTK__ + this->Enable(); +#endif } void mmBDDialog::OnPayee(wxCommandEvent& /*event*/) Modified: trunk/mmex/src/optionsdialog.cpp =================================================================== --- trunk/mmex/src/optionsdialog.cpp 2012-05-14 10:10:03 UTC (rev 2341) +++ trunk/mmex/src/optionsdialog.cpp 2012-05-14 13:22:48 UTC (rev 2342) @@ -747,7 +747,9 @@ wxButton *btn = (wxButton*)FindWindow(ID_DIALOG_OPTIONS_BUTTON_LANGUAGE); wxASSERT(btn); //Disable parent window (bug fix for GTK) +#ifdef __WXGTK__ this->Disable(); +#endif wxString lang = mmSelectLanguage(this, inidb_, true, false); if (!lang.empty()) { @@ -757,7 +759,9 @@ btn->SetLabel(lang.Left(1).Upper() + lang.SubString(1,lang.Len())); } +#ifdef __WXGTK__ this->Enable(); +#endif } void mmOptionsDialog::OnCurrency(wxCommandEvent& /*event*/) Modified: trunk/mmex/src/stockdialog.cpp =================================================================== --- trunk/mmex/src/stockdialog.cpp 2012-05-14 10:10:03 UTC (rev 2341) +++ trunk/mmex/src/stockdialog.cpp 2012-05-14 13:22:48 UTC (rev 2342) @@ -252,7 +252,10 @@ { account_names.Add(account.ACCOUNTNAME); } - + //Disable parent window (bug fix for GTK) +#ifdef __WXGTK__ + this->Disable(); +#endif wxSingleChoiceDialog scd(0, _("Choose Investment Account"), _("Select Account"), account_names); if (scd.ShowModal() == wxID_OK) { @@ -260,6 +263,9 @@ accountID_ = core_->getAccountID(acctName); heldAt_->SetLabel(acctName); } +#ifdef __WXGTK__ + this->Enable(); +#endif } void mmStockDialog::OnCancel(wxCommandEvent& /*event*/) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2012-06-09 13:24:47
|
Revision: 2553 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2553&view=rev Author: vomikan Date: 2012-06-09 13:24:41 +0000 (Sat, 09 Jun 2012) Log Message: ----------- last used file Modified Paths: -------------- trunk/mmex/src/appstartdialog.cpp trunk/mmex/src/dbwrapper.cpp trunk/mmex/src/dbwrapper.h trunk/mmex/src/mmex.cpp trunk/mmex/src/recentfiles.cpp Modified: trunk/mmex/src/appstartdialog.cpp =================================================================== --- trunk/mmex/src/appstartdialog.cpp 2012-06-09 12:11:49 UTC (rev 2552) +++ trunk/mmex/src/appstartdialog.cpp 2012-06-09 13:24:41 UTC (rev 2553) @@ -157,21 +157,14 @@ itemButtonClose_->SetFocus(); itemBoxSizer2->Add(itemButtonClose_, 0, wxALIGN_RIGHT|wxALL, 10); - if (inidb_) + wxString val = config->Read("LASTFILENAME", ""); + if (val.IsEmpty()) { - wxString val = mmDBWrapper::getLastDbPath(inidb_); - if (val.IsEmpty()) - { - itemButton61->Disable(); - } - else - { - itemButton61->SetToolTip(_("Open the previously opened database : ") + val); - } + itemButton61->Disable(); } else { - itemButton61->Disable(); + itemButton61->SetToolTip(_("Open the previously opened database : ") + val); } } Modified: trunk/mmex/src/dbwrapper.cpp =================================================================== --- trunk/mmex/src/dbwrapper.cpp 2012-06-09 12:11:49 UTC (rev 2552) +++ trunk/mmex/src/dbwrapper.cpp 2012-06-09 13:24:41 UTC (rev 2553) @@ -1652,9 +1652,10 @@ } //---------------------------------------------------------------------------- -wxString mmDBWrapper::getLastDbPath(wxSQLite3Database *db, const wxString &defaultVal) +wxString mmDBWrapper::getLastDbPath(const wxString &defaultVal) { - wxString path = getINISettingValue(db, ("LASTFILENAME"), defaultVal); + wxConfigBase *config = wxConfigBase::Get(); + wxString path = config->Read("LASTFILENAME", defaultVal); if (!mmex::isPortableMode()) { return path; Modified: trunk/mmex/src/dbwrapper.h =================================================================== --- trunk/mmex/src/dbwrapper.h 2012-06-09 12:11:49 UTC (rev 2552) +++ trunk/mmex/src/dbwrapper.h 2012-06-09 13:24:41 UTC (rev 2553) @@ -165,8 +165,7 @@ wxString getINISettingValue(wxSQLite3Database* db, const wxString& settingName, const wxString& defaultVal = wxGetEmptyString()); void setINISettingValue(wxSQLite3Database* db, const wxString& settingName, const wxString& settingValue); -wxString getLastDbPath(wxSQLite3Database *db, const wxString &defaultVal = wxGetEmptyString()); -void setLastDbPath(wxSQLite3Database *db, const wxString &path); +wxString getLastDbPath(const wxString &defaultVal = wxGetEmptyString()); /* Stocks API */ double getStockInvestmentBalance(wxSQLite3Database* db, double& invested); @@ -182,11 +181,5 @@ } // namespace mmDBWrapper //---------------------------------------------------------------------------- - -inline void mmDBWrapper::setLastDbPath(wxSQLite3Database *db, const wxString &path) -{ - setINISettingValue(db, ("LASTFILENAME"), path); -} -//---------------------------------------------------------------------------- #endif // _MM_EX_DBWRAPPER_H_ //---------------------------------------------------------------------------- Modified: trunk/mmex/src/mmex.cpp =================================================================== --- trunk/mmex/src/mmex.cpp 2012-06-09 12:11:49 UTC (rev 2552) +++ trunk/mmex/src/mmex.cpp 2012-06-09 13:24:41 UTC (rev 2553) @@ -596,7 +596,7 @@ // decide if we need to show app start dialog bool from_scratch = config->ReadBool("SHOWBEGINAPP", true); - wxFileName dbpath = from_scratch ? wxGetEmptyString() : mmDBWrapper::getLastDbPath(m_inidb.get()); + wxFileName dbpath = from_scratch ? wxGetEmptyString() : mmDBWrapper::getLastDbPath(); if (from_scratch || !dbpath.IsOk()) { @@ -877,10 +877,11 @@ */ void mmGUIFrame::saveConfigFile() { + wxConfigBase *config = wxConfigBase::Get(); + wxFileName fname(fileName_); - mmDBWrapper::setLastDbPath(m_inidb.get(), fname.GetFullPath()); + config->Write("LASTFILENAME", fname.GetFullPath()); - wxConfigBase *config = wxConfigBase::Get(); /* Aui Settings */ config->Write("AUIPERSPECTIVE", m_mgr.SavePerspective()); @@ -892,10 +893,10 @@ this->GetPosition(&valx, &valy); this->GetSize(&valw, &valh); - config->Write("ORIGINX", valx); - config->Write("ORIGINY", valx); - config->Write("SIZEW", valw); - config->Write("SIZEH", valh); + config->Write("ORIGINX", (long)valx); + config->Write("ORIGINY", (long)valx); + config->Write("SIZEW", (long)valw); + config->Write("SIZEH", (long)valh); config->Write("ISMAXIMIZED", this->IsMaximized()); } //---------------------------------------------------------------------------- @@ -3881,6 +3882,7 @@ void mmGUIFrame::showBeginAppDialog(bool fromScratch) { + wxConfigBase *config = wxConfigBase::Get(); mmAppStartDialog dlg(m_inidb.get(), this); if (fromScratch) dlg.SetCloseButtonToExit(); if (dlg.ShowModal() == wxID_OK) @@ -3911,7 +3913,7 @@ } else if (rc == appStartDialog(APP_START_LAST_DB)) { - wxFileName fname(mmDBWrapper::getLastDbPath(m_inidb.get())); + wxFileName fname(mmDBWrapper::getLastDbPath()); if (fname.IsOk()) SetDatabaseFile(fname.GetFullPath()); } else if (rc == -1) Modified: trunk/mmex/src/recentfiles.cpp =================================================================== --- trunk/mmex/src/recentfiles.cpp 2012-06-09 12:11:49 UTC (rev 2552) +++ trunk/mmex/src/recentfiles.cpp 2012-06-09 13:24:41 UTC (rev 2553) @@ -33,7 +33,8 @@ { recentListSize_ = 6; dbIndexName_ = ("RECENT_DB_"); - recentFileList_.Add(mmDBWrapper::getLastDbPath(mmex_inidb_)); + wxConfigBase *config = wxConfigBase::Get(); + recentFileList_.Add(config->Read("LASTFILENAME", "")); for (int index = 1; index < recentListSize_; index ++ ) { recentFileList_.Add(wxEmptyString); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2012-10-17 09:39:10
|
Revision: 3064 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3064&view=rev Author: vomikan Date: 2012-10-17 09:38:59 +0000 (Wed, 17 Oct 2012) Log Message: ----------- update Modified Paths: -------------- trunk/mmex/src/mmcheckingpanel.cpp trunk/mmex/src/transdialog.cpp trunk/mmex/src/transdialog.h Modified: trunk/mmex/src/mmcheckingpanel.cpp =================================================================== --- trunk/mmex/src/mmcheckingpanel.cpp 2012-10-17 07:01:39 UTC (rev 3063) +++ trunk/mmex/src/mmcheckingpanel.cpp 2012-10-17 09:38:59 UTC (rev 3064) @@ -1758,7 +1758,7 @@ { if (m_selectedIndex != -1) { - mmTransDialog dlg(m_cp->getDb(), m_cp->core_, m_cp->accountID(), + mmTransDialog dlg(m_cp->core_, m_cp->accountID(), m_cp->m_trans[m_selectedIndex], true, this); if ( dlg.ShowModal() == wxID_OK ) { @@ -1771,7 +1771,7 @@ void TransactionListCtrl::OnNewTransaction(wxCommandEvent& /*event*/) { - mmTransDialog dlg(m_cp->getDb(), m_cp->core_, m_cp->accountID(), NULL, false, this); + mmTransDialog dlg(m_cp->core_, m_cp->accountID(), NULL, false, this); if ( dlg.ShowModal() == wxID_OK ) { @@ -1786,7 +1786,7 @@ if (m_selectedIndex < 0) return; wxDateTime transTime = m_cp->m_trans[m_selectedIndex]->date_; - mmTransDialog dlg(m_cp->getDb(), m_cp->core_, m_cp->accountID(), + mmTransDialog dlg(m_cp->core_, m_cp->accountID(), m_cp->m_trans[m_selectedIndex], true, this); dlg.SetDialogToDuplicateTransaction(); @@ -1877,7 +1877,7 @@ if (m_selectedIndex == -1) return; int transID = m_cp->m_trans[m_selectedIndex]->transactionID(); - mmTransDialog dlg(m_cp->getDb(), m_cp->core_, m_cp->accountID(), + mmTransDialog dlg(m_cp->core_, m_cp->accountID(), m_cp->m_trans[m_selectedIndex], true, this); if ( dlg.ShowModal() == wxID_OK ) { Modified: trunk/mmex/src/transdialog.cpp =================================================================== --- trunk/mmex/src/transdialog.cpp 2012-10-17 07:01:39 UTC (rev 3063) +++ trunk/mmex/src/transdialog.cpp 2012-10-17 09:38:59 UTC (rev 3064) @@ -52,14 +52,12 @@ END_EVENT_TABLE() mmTransDialog::mmTransDialog( - boost::shared_ptr<wxSQLite3Database> db, mmCoreDB* core, int accountID, mmBankTransaction* pBankTransaction, bool edit, wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) : - db_(db), core_(core), parent_(parent), pBankTransaction_(pBankTransaction), @@ -106,7 +104,7 @@ { wxString dateString = pBankTransaction_->dateStr_; wxDateTime trx_date = pBankTransaction_->date_; - wxString dt = mmGetDateForDisplay(db_.get(), trx_date); + wxString dt = mmGetDateForDisplay(core_->db_.get(), trx_date); dpc_->SetValue(trx_date); //process date change event for set weekday name wxDateEvent dateEvent(FindWindow(ID_DIALOG_TRANS_BUTTONDATE), trx_date, wxEVT_DATE_CHANGED); @@ -775,7 +773,7 @@ boost::shared_ptr<mmPayee> pPayee = core_->payeeList_.GetPayeeSharedPtr(payeeID_); pPayee->categoryId_ = categID_; pPayee->subcategoryId_ = subcategID_; - pPayee->UpdateDb(db_.get()); + pPayee->UpdateDb(core_->db_.get()); if (referenceAccountID_ != accountID_) // Transfer transaction has defected to other side. { Modified: trunk/mmex/src/transdialog.h =================================================================== --- trunk/mmex/src/transdialog.h 2012-10-17 07:01:39 UTC (rev 3063) +++ trunk/mmex/src/transdialog.h 2012-10-17 09:38:59 UTC (rev 3064) @@ -41,8 +41,7 @@ public: mmTransDialog() {} - mmTransDialog(boost::shared_ptr<wxSQLite3Database> db, - mmCoreDB* core, + mmTransDialog( mmCoreDB* core, int accountID, mmBankTransaction* pBankTransaction, bool edit, wxWindow* parent, @@ -58,8 +57,21 @@ const wxSize& size = SYMBOL_TRANSDIALOG_SIZE, long style = SYMBOL_TRANSDIALOG_STYLE ); - void CreateControls(); + void SetDialogToDuplicateTransaction(); + int transID_; +private: + + mmCoreDB* core_; + mmBankTransaction* pBankTransaction_; + wxWindow* parent_; + int accountID_; + int referenceAccountID_; // used for transfer transactions + + void CreateControls(); + bool getPayeeID(wxString payee, int& payeeID, int& categID, int& subcategID ); + void addPayee(wxString payee, int categID, int subcategID ); + void OnSplitChecked(wxCommandEvent& event); void OnOk(wxCommandEvent& event); void OnCancel(wxCommandEvent& event); void OnQuit(wxCloseEvent& event); @@ -72,9 +84,6 @@ void dataToControls(); void updateControlsForTransType(); void displayControlsToolTips(int transType/*, bool enableAdvanced = false*/); - bool getPayeeID(wxString payee, int& payeeID, int& categID, int& subcategID ); - void addPayee(wxString payee, int categID, int subcategID ); - void OnSplitChecked(wxCommandEvent& event); void changeFocus(wxChildFocusEvent& event); void onTextEntered(wxCommandEvent& event); void onChoiceTransChar(wxKeyEvent& event); @@ -82,17 +91,12 @@ void OnButtonPayeeChar(wxKeyEvent& event); void OnButtonPayeeMouse(wxMouseEvent& event); void OnButtonDateChar(wxKeyEvent& event); + void OnAdvanceChecked(wxCommandEvent& event); + void SetTransferControls(bool transfers = false); + void SetAdvancedTransferControls(bool advanced = false); + void activateSplitTransactionsDlg(); + void SetSplitState(); - void SetDialogToDuplicateTransaction(); - int transID_; - -private: - boost::shared_ptr<wxSQLite3Database> db_; - mmCoreDB* core_; - mmBankTransaction* pBankTransaction_; - wxWindow* parent_; - int accountID_; - int referenceAccountID_; // used for transfer transactions wxTextCtrl *textNumber_; wxTextCtrl *textAmount_; wxTextCtrl *toTextAmount_; @@ -139,12 +143,6 @@ wxString resetPayeeString(/*bool normal = true*/); wxString resetCategoryString(); - void OnAdvanceChecked(wxCommandEvent& event); - void SetTransferControls(bool transfers = false); - void SetAdvancedTransferControls(bool advanced = false); - - void activateSplitTransactionsDlg(); - void SetSplitState(); }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2012-11-06 01:13:36
|
Revision: 3113 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3113&view=rev Author: stef145g Date: 2012-11-06 01:13:27 +0000 (Tue, 06 Nov 2012) Log Message: ----------- Compiler Warning Corrections Modified Paths: -------------- trunk/mmex/src/filtertransdialog.cpp trunk/mmex/src/filtertransdialog.h Modified: trunk/mmex/src/filtertransdialog.cpp =================================================================== --- trunk/mmex/src/filtertransdialog.cpp 2012-11-05 18:51:31 UTC (rev 3112) +++ trunk/mmex/src/filtertransdialog.cpp 2012-11-06 01:13:27 UTC (rev 3113) @@ -187,7 +187,7 @@ accountDropDown_ = new wxChoice( itemPanel, wxID_STATIC, wxDefaultPosition, wxSize(fieldWidth,-1), as, 0 ); itemPanelSizer->Add(accountDropDown_, flags); accountDropDown_ -> Connect(wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, - wxCommandEventHandler(mmFilterTransactionsDialog::accountSelected), NULL, this); + wxCommandEventHandler(mmFilterTransactionsDialog::AccountSelected), NULL, this); //--End of Row -------------------------------------------------------- @@ -634,9 +634,9 @@ return settings_string_; } -void mmFilterTransactionsDialog::accountSelected(wxCommandEvent& event) +void mmFilterTransactionsDialog::AccountSelected(wxCommandEvent& /*event*/) { - int id = event.GetId(); +// int id = event.GetId(); wxString accountName = accountDropDown_->GetStringSelection(); refAccountStr_ = accountName; refAccountID_ = core_->accountList_.GetAccountId(accountName); Modified: trunk/mmex/src/filtertransdialog.h =================================================================== --- trunk/mmex/src/filtertransdialog.h 2012-11-05 18:51:31 UTC (rev 3112) +++ trunk/mmex/src/filtertransdialog.h 2012-11-06 01:13:27 UTC (rev 3113) @@ -152,7 +152,7 @@ int payeeID_; int refAccountID_; wxString refAccountStr_; - void accountSelected(wxCommandEvent& event); + void AccountSelected(wxCommandEvent& /*event*/); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2012-11-10 23:13:19
|
Revision: 3130 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3130&view=rev Author: vomikan Date: 2012-11-10 23:13:12 +0000 (Sat, 10 Nov 2012) Log Message: ----------- update Modified Paths: -------------- trunk/mmex/src/transdialog.cpp trunk/mmex/src/transdialog.h Modified: trunk/mmex/src/transdialog.cpp =================================================================== --- trunk/mmex/src/transdialog.cpp 2012-11-10 09:09:06 UTC (rev 3129) +++ trunk/mmex/src/transdialog.cpp 2012-11-10 23:13:12 UTC (rev 3130) @@ -72,7 +72,9 @@ subcategID_(-1), payeeID_(-1), toID_(-1), - toTransAmount_(-1) + toTransAmount_(-1), + transAmount_(-1) + { Create(parent, id, caption, pos, size, style); } @@ -92,7 +94,7 @@ boost::shared_ptr<mmSplitTransactionEntries> split(new mmSplitTransactionEntries()); split_ = split; - if (edit_) dataToControls(); + dataToControls(); Centre(); Fit(); @@ -102,92 +104,166 @@ void mmTransDialog::dataToControls() { - wxString dateString = pBankTransaction_->dateStr_; - wxDateTime trx_date = pBankTransaction_->date_; - wxString dt = mmGetDateForDisplay(core_->db_.get(), trx_date); - dpc_->SetValue(trx_date); + // Use last date used as per user option. + wxDateTime trx_date = wxDateTime::Now(); + if (mmIniOptions::instance().transDateDefault_ != 0) + trx_date = core_->bTransactionList_.getLastDate(accountID_); + + dpc_->SetValue(edit_ ? pBankTransaction_->date_: trx_date); //process date change event for set weekday name - wxDateEvent dateEvent(FindWindow(ID_DIALOG_TRANS_BUTTONDATE), trx_date, wxEVT_DATE_CHANGED); + wxDateEvent dateEvent(dpc_, trx_date, wxEVT_DATE_CHANGED); GetEventHandler()->ProcessEvent(dateEvent); - wxString statusString = pBankTransaction_->status_; - if (statusString == wxT("")) statusString = wxT("N"); - choiceStatus_->SetSelection(wxString(wxT("NRVFD")).Find(statusString)); + if (edit_) + { + wxString statusString = pBankTransaction_->status_; + if (statusString == wxT("")) statusString = wxT("N"); + choiceStatus_->SetSelection(wxString(wxT("NRVFD")).Find(statusString)); + } + else + choiceStatus_->SetSelection(mmIniOptions::instance().transStatusReconciled_); - wxString transTypeString = pBankTransaction_->transType_; - transaction_type_->SetStringSelection(wxGetTranslation(transTypeString)); + wxString transTypeString; + if (edit_) + { + transTypeString = pBankTransaction_->transType_; + transaction_type_->SetStringSelection(wxGetTranslation(transTypeString)); + } + else + transaction_type_->SetSelection(0); - categID_ = pBankTransaction_->categID_; - categoryName_ = core_->categoryList_.GetCategoryName(categID_); - subcategID_ = pBankTransaction_->subcategID_; - subCategoryName_ = core_->categoryList_.GetSubCategoryName(categID_, subcategID_); + if (edit_) + { + categID_ = pBankTransaction_->categID_; + categoryName_ = core_->categoryList_.GetCategoryName(categID_); + subcategID_ = pBankTransaction_->subcategID_; + subCategoryName_ = core_->categoryList_.GetSubCategoryName(categID_, subcategID_); + } + else + { + //TODO: + } + + if (edit_) + { + accountID_ = pBankTransaction_->accountID_; + toID_ = pBankTransaction_->toAccountID_; - accountID_ = pBankTransaction_->accountID_; - toID_ = pBankTransaction_->toAccountID_; + payeeID_ = pBankTransaction_->payeeID_; + if (payeeID_ > -1) // transaction_type != TRANS_TYPE_TRANSFER_STR + payeeUnknown_ = false; - payeeID_ = pBankTransaction_->payeeID_; - if (payeeID_ > -1) // transaction_type != TRANS_TYPE_TRANSFER_STR - payeeUnknown_ = false; + textNotes_->SetValue(pBankTransaction_->notes_); + textNumber_->SetValue(pBankTransaction_->transNum_); - wxString transNumString = pBankTransaction_->transNum_; - wxString notesString = pBankTransaction_->notes_; - double transAmount = pBankTransaction_->amt_; - toTransAmount_ = pBankTransaction_->toAmt_; - - // backup the original currency rate first - if (transAmount > 0.0) { - edit_currency_rate = toTransAmount_ / transAmount; + transAmount_ = pBankTransaction_->amt_; + toTransAmount_ = pBankTransaction_->toAmt_; } + // backup the original currency rate first + if (transAmount_ > 0.0) + edit_currency_rate = toTransAmount_ / transAmount_; updateControlsForTransType(); - *split_.get() = *core_->bTransactionList_.getBankTransactionPtr(pBankTransaction_->transactionID())->splitEntries_.get(); + wxString dispAmount; + if (edit_) + { + mmex::formatDoubleToCurrencyEdit(transAmount_, dispAmount); + textAmount_->SetValue(dispAmount); + mmex::formatDoubleToCurrencyEdit(toTransAmount_, dispAmount); + toTextAmount_->SetValue(dispAmount); + } + + cAdvanced_->SetValue(advancedToTransAmountSet_); - if (split_->numEntries() > 0) + wxString payeeName; + wxString categString = _("Select Category"); + + if (transTypeString == TRANS_TYPE_TRANSFER_STR) { - bCategory_->SetLabel(_("Split Category")); - cSplit_->SetValue(true); - cSplit_->Disable(); + advancedToTransAmountSet_ = (transAmount_!=toTransAmount_); + SetTransferControls(); // hide appropriate fields } else { - bCategory_->SetLabel(pBankTransaction_->fullCatStr_); + cAdvanced_->Disable(); + if (edit_) + bPayee_->SetLabel(pBankTransaction_->payeeStr_); + else + { + //If user does not want payee to be auto filled for the new transaction + payeeName = resetPayeeString(); + payeeID_ = core_->bTransactionList_.getLastUsedPayeeID(accountID_, categID_, subcategID_); + payeeUnknown_ = true; + + if ( mmIniOptions::instance().transPayeeSelectionNone_ > 0) + { + if (payeeID_ > -1) + { + payeeName = core_->payeeList_.GetPayeeName(payeeID_); + payeeUnknown_ = false; + } + } + } } - textNotes_->SetValue(notesString); - textNumber_->SetValue(transNumString); + if (edit_) + { + *split_.get() = *core_->bTransactionList_.getBankTransactionPtr(pBankTransaction_->transactionID())->splitEntries_.get(); + + if (split_->numEntries() > 0) + { + bCategory_->SetLabel(_("Split Category")); + cSplit_->SetValue(true); + cSplit_->Disable(); + } + else + { + categString = pBankTransaction_->fullCatStr_; + } + } + else + { + if (mmIniOptions::instance().transCategorySelectionNone_> 0) + if (categID_ > -1) categString = core_->categoryList_.GetFullCategoryString(categID_, subcategID_); + } + + bCategory_->SetLabel(categString); + bPayee_->SetLabel(payeeName); if (split_->numEntries() > 0) { //transAmount = split_->getTotalSplits(); textAmount_->Enable(false); } - wxString dispAmount; - mmex::formatDoubleToCurrencyEdit(transAmount, dispAmount); - textAmount_->SetValue(dispAmount); + + if (!edit_) + { + notesColour_ = textNotes_->GetForegroundColour(); + textNotes_->SetForegroundColour(wxColour(wxT("GREY"))); + textNotes_->SetValue(notesTip_); + int font_size = textNotes_->GetFont().GetPointSize(); + textNotes_->SetFont(wxFont(font_size, wxSWISS, wxNORMAL, wxNORMAL, FALSE, wxT(""))); + } +} - if (transTypeString == TRANS_TYPE_TRANSFER_STR) +void mmTransDialog::SetTransferControls() +{ + cAdvanced_->SetValue(advancedToTransAmountSet_); + cAdvanced_->Enable(); + if (accountID_ == referenceAccountID_) { - if (accountID_ == referenceAccountID_) - { - bPayee_->SetLabel(core_->accountList_.GetAccountName(toID_)); - } - else - { - bPayee_->SetLabel(core_->accountList_.GetAccountName(accountID_)); - payee_label_->SetLabel(_("From")); - } - // When editing an advanced transaction record, we do not reset the toTransAmount_ - if (edit_ && (toTransAmount_ != transAmount)) - { - cAdvanced_->SetValue(true); - SetAdvancedTransferControls(true); - } + toTextAmount_->Enable(cAdvanced_->GetValue()); + if (toID_>0) bPayee_->SetLabel(core_->accountList_.GetAccountName(toID_)); + payee_label_->SetLabel(_("To")); } else - bPayee_->SetLabel(pBankTransaction_->payeeStr_); - + { + textAmount_->Enable(cAdvanced_->GetValue()); + if (accountID_>0) bPayee_->SetLabel(core_->accountList_.GetAccountName(accountID_)); + payee_label_->SetLabel(_("From")); + } } void mmTransDialog::CreateControls() @@ -211,14 +287,7 @@ // Date -------------------------------------------- long date_style = wxDP_DROPDOWN|wxDP_SHOWCENTURY; - wxDateTime trx_date = wxDateTime::Now(); // Default to Today's Date. - if (mmIniOptions::instance().transDateDefault_ != 0) - { - // Use last date used as per user option. - trx_date = core_->bTransactionList_.getLastDate(accountID_); - } - - dpc_ = new wxDatePickerCtrl( this, ID_DIALOG_TRANS_BUTTONDATE, trx_date, + dpc_ = new wxDatePickerCtrl( this, ID_DIALOG_TRANS_BUTTONDATE, wxDateTime::Now(), wxDefaultPosition, wxSize(110, -1), date_style); #ifdef __WXGTK__ @@ -229,7 +298,6 @@ //Text field for day of the week itemStaticTextWeek_ = new wxStaticText(this, wxID_STATIC, wxT("")); // Display the day of the week - itemStaticTextWeek_->SetLabel(mmGetNiceWeekDayName(trx_date.GetWeekDay())); spinCtrl_ = new wxSpinButton(this, wxID_STATIC, wxDefaultPosition, wxSize(18, wxSize(dpc_->GetSize()).GetHeight()), @@ -250,7 +318,6 @@ for(size_t i = 0; i < sizeof(TRANSACTION_STATUS)/sizeof(wxString); ++i) choiceStatus_->Append(wxGetTranslation(TRANSACTION_STATUS[i]), new wxStringClientData(TRANSACTION_STATUS[i])); - choiceStatus_->SetSelection(mmIniOptions::instance().transStatusReconciled_); flex_sizer->Add(new wxStaticText(this, wxID_STATIC, _("Status")), flags); flex_sizer->Add(choiceStatus_, flags); @@ -266,12 +333,9 @@ transaction_type_->Append(wxGetTranslation(TRANSACTION_TYPE[i]), new wxStringClientData(TRANSACTION_TYPE[i])); - transaction_type_->SetSelection(0); - cAdvanced_ = new wxCheckBox(this, ID_DIALOG_TRANS_ADVANCED_CHECKBOX, _("Advanced"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); - cAdvanced_->SetValue(FALSE); wxBoxSizer* typeSizer = new wxBoxSizer(wxHORIZONTAL); @@ -305,44 +369,11 @@ payee_label_ = new wxStaticText(this, wxID_STATIC, _("Payee")); wxString payeeName = resetPayeeString(); - wxString categString; - if (!edit_) - { - //If user does not want payee to be auto filled for the new transaction - if ( mmIniOptions::instance().transPayeeSelectionNone_ == 0) - { - payeeName = resetPayeeString(); - payeeUnknown_ = true; - } - else // determine the payee for this account - { - payeeID_ = core_->bTransactionList_.getLastUsedPayeeID(accountID_, categID_, subcategID_); - if (payeeID_ > -1) - { - payeeName = core_->payeeList_.GetPayeeName(payeeID_); - payeeUnknown_ = false; - } - else - { - payeeName = resetPayeeString(); - payeeUnknown_ = true; - } - if (categID_ > -1) - { - categString = core_->categoryList_.GetFullCategoryString(categID_, subcategID_); - } - } - - if ( mmIniOptions::instance().transCategorySelectionNone_== 0 || categString.IsEmpty() ) - categString = resetCategoryString(); - } - bPayee_ = new wxButton( this, ID_DIALOG_TRANS_BUTTONPAYEE, payeeName, wxDefaultPosition, wxSize((choiceStatus_->GetSize().GetWidth()+border)*2, -1)); bPayee_->Connect(wxEVT_CHAR, wxKeyEventHandler(mmTransDialog::OnButtonPayeeChar), NULL, this); - bPayee_->Connect(wxEVT_MOUSEWHEEL, wxMouseEventHandler(mmTransDialog::OnButtonPayeeMouse), NULL, this); flex_sizer->Add(payee_label_, flags); flex_sizer->Add(bPayee_, flags); @@ -356,7 +387,7 @@ flex_sizer->Add(cSplit_, flags); // Category ------------------------------------------------- - bCategory_ = new wxButton(this, ID_DIALOG_TRANS_BUTTONCATEGS, categString, + bCategory_ = new wxButton(this, ID_DIALOG_TRANS_BUTTONCATEGS, wxT(""), wxDefaultPosition, bPayee_->GetSize()); flex_sizer->Add(new wxStaticText(this, wxID_STATIC, _("Category")), flags); @@ -384,19 +415,9 @@ notesTip_ = _("Notes"); textNotes_ = new wxTextCtrl(this, ID_DIALOG_TRANS_TEXTNOTES, wxT(""), wxDefaultPosition, wxSize(-1,80), wxTE_MULTILINE); - if (!edit_) - { - notesColour_ = textNotes_->GetForegroundColour(); - textNotes_->SetForegroundColour(wxColour(wxT("GREY"))); - textNotes_->SetValue(notesTip_); - int font_size = textNotes_->GetFont().GetPointSize(); - textNotes_->SetFont(wxFont(font_size, wxSWISS, wxNORMAL, wxNORMAL, FALSE, wxT(""))); - } box_sizer->Add(textNotes_, flagsExpand.Border(wxLEFT|wxRIGHT|wxBOTTOM, 10)); - SetTransferControls(); // hide appropriate fields - amountNormalTip_ = _("Specify the amount for this transaction"); amountTransferTip_ = _("Specify the amount to be transfered"); if (true) //TODO: Add parameter @@ -538,12 +559,8 @@ void mmTransDialog::OnAdvanceChecked(wxCommandEvent& /*event*/) { - if (cAdvanced_->IsChecked()) { - SetAdvancedTransferControls(true); - } else { - SetAdvancedTransferControls(); - textAmount_->SetToolTip(amountTransferTip_); - } + advancedToTransAmountSet_ = cAdvanced_->GetValue(); + SetTransferControls(); } void mmTransDialog::OnCategs(wxCommandEvent& /*event*/) @@ -602,11 +619,8 @@ else { displayControlsToolTips(DEF_TRANSFER/*, true*/); - SetTransferControls(true); - if (cAdvanced_->IsChecked()) - SetAdvancedTransferControls(true); + SetTransferControls(); - payee_label_->SetLabel(_("To")); if (core_->accountList_.getNumBankAccounts() == 2) { wxArrayString accName = core_->accountList_.getAccountsName(accountID_); @@ -678,6 +692,8 @@ void mmTransDialog::OnOk(wxCommandEvent& /*event*/) { + textNotes_->SetFocus(); + wxString transaction_type = wxT(""); wxStringClientData* type_obj = (wxStringClientData *)transaction_type_->GetClientObject(transaction_type_->GetSelection()); if (type_obj) transaction_type = type_obj->GetData(); @@ -691,6 +707,7 @@ if (toID_ == -1 && transaction_type == TRANS_TYPE_TRANSFER_STR) { mmShowErrorMessageInvalid(this, _("To Account")); + bPayee_->SetFocus(); return; } @@ -734,24 +751,25 @@ textAmount_->SetBackgroundColour(wxT("RED")); mmShowErrorMessageInvalid(parent_, _("Amount")); textAmount_->SetBackgroundColour(wxNullColour); + textAmount_->SetFocus(); return; } } - //if (advancedToTransAmountSet_) + if (advancedToTransAmountSet_) { wxString amountStr = toTextAmount_->GetValue().Trim(); - if ((!mmex::formatCurrencyToDouble(amountStr, toTransAmount_) || (toTransAmount_ < 0.0)) && !amountStr.IsEmpty()) + if (amountStr.IsEmpty() || !mmex::formatCurrencyToDouble(amountStr, toTransAmount_) || (toTransAmount_ < 0.0)) { - toTextAmount_->Enable(!advancedToTransAmountSet_); + //toTextAmount_->Enable(!advancedToTransAmountSet_); toTextAmount_->SetBackgroundColour(wxT("RED")); mmShowErrorMessageInvalid(parent_, _("Advanced Amount")); toTextAmount_->SetBackgroundColour(wxNullColour); - toTextAmount_->Enable(advancedToTransAmountSet_); + //toTextAmount_->Enable(advancedToTransAmountSet_); + toTextAmount_->SetFocus(); return; } - } //else - if (!advancedToTransAmountSet_) + } else toTransAmount_ = amount; int toAccountID = -1; @@ -889,51 +907,6 @@ } } -void mmTransDialog::SetTransferControls(bool transfers) -{ - if (transfers) - { - cAdvanced_->Enable(); - } - else - { - cAdvanced_->Disable(); - SetAdvancedTransferControls(); - } -} - -void mmTransDialog::SetAdvancedTransferControls(bool advanced) -{ - if (advanced) - { - toTextAmount_->Enable(); - textAmount_->Enable(); - advancedToTransAmountSet_ = true; - // Display the transfer amount in the toTextAmount control. - if (toTransAmount_ >= 0) - { - wxString dispAmount; - mmex::formatDoubleToCurrencyEdit(toTransAmount_, dispAmount); - toTextAmount_->SetValue(dispAmount); - } - else - { - toTextAmount_->SetValue(textAmount_->GetValue()); - } - - textAmount_->SetToolTip(_("Specify the transfer amount in the From Account")); - - } - else - { - if (accountID_ == referenceAccountID_) - toTextAmount_->Disable(); - else - textAmount_->Disable(); - advancedToTransAmountSet_ = false; - } -} - //---------------------------------------------------------------------------- void mmTransDialog::changeFocus(wxChildFocusEvent& event) @@ -1181,69 +1154,6 @@ } } -void mmTransDialog::OnButtonPayeeMouse(wxMouseEvent& event) -{ - int i = event.GetWheelRotation(); - - size_t c = 0; - wxString currentPayeeName = bPayee_->GetLabel(); - wxArrayString filtd; - if (transaction_type_->GetSelection() == DEF_TRANSFER) - { - filtd = core_->accountList_.getAccountsName(); - if (filtd.IsEmpty()) - //No accounts present. Should be added one as minimum - return; - for (size_t i = 0; i < (size_t)filtd.GetCount(); ++i) - { - if (filtd.Item(i) == currentPayeeName) - { - c = i; - break; - } - } - - } - else - { - filtd = core_->payeeList_.FilterPayees(wxT("")); - if (filtd.IsEmpty()) - //No payee present. Should be added one as minimum - return; - if (currentPayeeName == _("Select Payee")) - { - c = 0; - } - else - { - for (size_t i = 0; i < (size_t)filtd.GetCount(); ++i) - { - if (filtd.Item(i) == currentPayeeName) - { - c = i; - break; - } - } - } - } - if (i < 0) - { - if ((c + 1) < (size_t)filtd.GetCount()) currentPayeeName = filtd.Item(++c); - } - else if (i > 0) - { - if (c > 0) currentPayeeName = filtd.Item(--c); - } - - currentPayeeName = filtd.Item(c); - bPayee_->SetLabel(currentPayeeName); - - if (transaction_type_->GetSelection() == DEF_TRANSFER) - toID_ = core_->accountList_.GetAccountId(currentPayeeName); - else - payeeID_ = core_->payeeList_.GetPayeeId(currentPayeeName); -} - void mmTransDialog::SetDialogToDuplicateTransaction() { // we want the dialog to treat the transaction as a new transaction. Modified: trunk/mmex/src/transdialog.h =================================================================== --- trunk/mmex/src/transdialog.h 2012-11-10 09:09:06 UTC (rev 3129) +++ trunk/mmex/src/transdialog.h 2012-11-10 23:13:12 UTC (rev 3130) @@ -88,15 +88,15 @@ void changeFocus(wxChildFocusEvent& event); void onTextEntered(wxCommandEvent& event); void onChoiceTransChar(wxKeyEvent& event); - void onChoiceStatusChar(wxKeyEvent& event); - void OnButtonPayeeChar(wxKeyEvent& event); - void OnButtonPayeeMouse(wxMouseEvent& event); void OnButtonDateChar(wxKeyEvent& event); void OnAdvanceChecked(wxCommandEvent& event); - void SetTransferControls(bool transfers = false); - void SetAdvancedTransferControls(bool advanced = false); + void SetTransferControls(); + void activateSplitTransactionsDlg(); void SetSplitState(); + //TODO: that functions not needed for wx2.9 + void onChoiceStatusChar(wxKeyEvent& event); + void OnButtonPayeeChar(wxKeyEvent& event); wxTextCtrl *textNumber_; wxTextCtrl *textAmount_; @@ -128,6 +128,7 @@ int payeeID_; int toID_; double toTransAmount_; + double transAmount_; bool advancedToTransAmountSet_; boost::shared_ptr<mmSplitTransactionEntries> split_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2012-12-16 05:13:59
|
Revision: 3212 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3212&view=rev Author: stef145g Date: 2012-12-16 05:13:51 +0000 (Sun, 16 Dec 2012) Log Message: ----------- Update mmex_settings classes to allow usage for main infotable_v1 and ini settings_v1 tables. Tests to match Modified Paths: -------------- trunk/mmex/src/mmex_settings.cpp trunk/mmex/src/mmex_settings.h trunk/mmex/src/tests/dbwrapper_test.cpp Modified: trunk/mmex/src/mmex_settings.cpp =================================================================== --- trunk/mmex/src/mmex_settings.cpp 2012-12-15 22:32:13 UTC (rev 3211) +++ trunk/mmex/src/mmex_settings.cpp 2012-12-16 05:13:51 UTC (rev 3212) @@ -33,21 +33,48 @@ const char INSERT_INI_RECORD[] = "insert into SETTING_V1 (SETTINGNAME, SETTINGVALUE) values (?, ?)"; const char SELECT_INI_RECORD[] = "select * from SETTING_V1"; +//--------------------------------------------------------------------------- +const wxString INFO_TABLE_NAME = wxT("INFOTABLE_V1"); +const char CREATE_INFO_TABLE[] = + "create table INFOTABLE_V1 (" + "INFOID integer not null primary key, " + "INFONAME TEXT NOT NULL UNIQUE, " + "INFOVALUE TEXT)"; + +const char UPDATE_INFO_RECORD[] = "update INFOTABLE_V1 set INFOVALUE = ? where INFONAME = ?"; +const char INSERT_INFO_RECORD[] = "insert into INFOTABLE_V1 (INFONAME, INFOVALUE) values (?, ?)"; +const char SELECT_INFO_RECORD[] = "select * from INFOTABLE_V1"; + /**************************************************************************** MMEX_IniRecord Class methods ****************************************************************************/ -MMEX_IniRecord::MMEX_IniRecord(boost::shared_ptr<wxSQLite3Database> ini_db, wxString name) +MMEX_IniRecord::MMEX_IniRecord(boost::shared_ptr<wxSQLite3Database> ini_db + , bool main_db + , wxString name) : iniDb_(ini_db) +, main_db_(main_db) , settingId_(-1) , settingName_(name) {} -MMEX_IniRecord::MMEX_IniRecord(boost::shared_ptr<wxSQLite3Database> ini_db, wxSQLite3ResultSet& q1) +MMEX_IniRecord::MMEX_IniRecord(boost::shared_ptr<wxSQLite3Database> ini_db + , bool main_db + , wxSQLite3ResultSet& q1) : iniDb_(ini_db) +, main_db_(main_db) { - settingId_ = q1.GetInt(wxT("SETTINGID")); - settingName_ = q1.GetString(wxT("SETTINGNAME")); - settingValue_ = q1.GetString(wxT("SETTINGVALUE")); + if (main_db) + { + settingId_ = q1.GetInt(wxT("INFOID")); + settingName_ = q1.GetString(wxT("INFONAME")); + settingValue_ = q1.GetString(wxT("INFOVALUE")); + } + else + { + settingId_ = q1.GetInt(wxT("SETTINGID")); + settingName_ = q1.GetString(wxT("SETTINGNAME")); + settingValue_ = q1.GetString(wxT("SETTINGVALUE")); + } } wxString MMEX_IniRecord::Name() @@ -69,7 +96,9 @@ { try { - wxSQLite3Statement st = iniDb_->PrepareStatement(UPDATE_INI_RECORD); + wxSQLite3Statement st; + if (main_db_) st = iniDb_->PrepareStatement(UPDATE_INFO_RECORD); + else st = iniDb_->PrepareStatement(UPDATE_INI_RECORD); st.Bind(1, settingValue_); st.Bind(2, settingName_); @@ -78,7 +107,8 @@ if (!rows_affected) { - st = iniDb_->PrepareStatement(INSERT_INI_RECORD); + if (main_db_) st = iniDb_->PrepareStatement(INSERT_INFO_RECORD); + else st = iniDb_->PrepareStatement(INSERT_INI_RECORD); st.Bind(1, settingName_); st.Bind(2, settingValue_); @@ -98,21 +128,28 @@ /**************************************************************************** MMEX_IniSettings Class methods ****************************************************************************/ -MMEX_IniSettings::MMEX_IniSettings(boost::shared_ptr<wxSQLite3Database> ini_db) +MMEX_IniSettings::MMEX_IniSettings(boost::shared_ptr<wxSQLite3Database> ini_db, bool main_db) : ini_db_(ini_db) +, main_db_(main_db) { try { - if (!ini_db->TableExists(INI_TABLE_NAME)) + wxString table_name = INI_TABLE_NAME; + if (main_db_) { - ini_db->ExecuteUpdate(CREATE_INI_TABLE); + table_name = INFO_TABLE_NAME; } + if (!ini_db->TableExists(table_name)) + { + if (main_db_) ini_db->ExecuteUpdate(CREATE_INFO_TABLE); + else ini_db->ExecuteUpdate(CREATE_INI_TABLE); + } Load(); } catch (const wxSQLite3Exception& e) { wxLogDebug(wxT("MMEX_IniSettings Constructor: Exception: %s"), e.GetMessage().c_str()); - wxLogError(wxT("MMEX_IniSettings Constructor: create/Load table SETTING_V1. ") + wxString::Format(_("Error: %s"), e.GetMessage().c_str())); + wxLogError(wxT("MMEX_IniSettings Constructor: create/Load table. ") + wxString::Format(_("Error: %s"), e.GetMessage().c_str())); } } @@ -123,10 +160,12 @@ void MMEX_IniSettings::Load() { - wxSQLite3ResultSet q1 = ini_db_->ExecuteQuery(SELECT_INI_RECORD); + wxSQLite3ResultSet q1; + if (main_db_) q1 = ini_db_->ExecuteQuery(SELECT_INFO_RECORD); + else q1 = ini_db_->ExecuteQuery(SELECT_INI_RECORD); while (q1.NextRow()) { - boost::shared_ptr<MMEX_IniRecord> pRecord(new MMEX_IniRecord(ini_db_, q1)); + boost::shared_ptr<MMEX_IniRecord> pRecord(new MMEX_IniRecord(ini_db_, main_db_, q1)); ini_records_.push_back(pRecord); } q1.Finalize(); @@ -194,7 +233,7 @@ MMEX_IniRecord* pExistingRecord = GetRecord(name); if (!pExistingRecord) { - boost::shared_ptr<MMEX_IniRecord> pNewRecord(new MMEX_IniRecord(ini_db_, name)); + boost::shared_ptr<MMEX_IniRecord> pNewRecord(new MMEX_IniRecord(ini_db_, main_db_, name)); ini_records_.push_back(pNewRecord); pExistingRecord = pNewRecord.get(); } @@ -207,7 +246,7 @@ MMEX_IniRecord* pExistingRecord = GetRecord(name); if (!pExistingRecord) { - boost::shared_ptr<MMEX_IniRecord> pNewRecord(new MMEX_IniRecord(ini_db_, name)); + boost::shared_ptr<MMEX_IniRecord> pNewRecord(new MMEX_IniRecord(ini_db_, main_db_, name)); ini_records_.push_back(pNewRecord); pExistingRecord = pNewRecord.get(); } @@ -219,7 +258,7 @@ MMEX_IniRecord* pExistingRecord = GetRecord(name); if (!pExistingRecord) { - boost::shared_ptr<MMEX_IniRecord> pNewRecord(new MMEX_IniRecord(ini_db_, name)); + boost::shared_ptr<MMEX_IniRecord> pNewRecord(new MMEX_IniRecord(ini_db_, main_db_, name)); ini_records_.push_back(pNewRecord); pExistingRecord = pNewRecord.get(); } Modified: trunk/mmex/src/mmex_settings.h =================================================================== --- trunk/mmex/src/mmex_settings.h 2012-12-15 22:32:13 UTC (rev 3211) +++ trunk/mmex/src/mmex_settings.h 2012-12-16 05:13:51 UTC (rev 3212) @@ -36,10 +36,14 @@ { public: /// Create a new record setting. - MMEX_IniRecord(boost::shared_ptr<wxSQLite3Database> ini_db, wxString name); + MMEX_IniRecord(boost::shared_ptr<wxSQLite3Database> ini_db + , bool main_db + , wxString name); /// Create an existing record setting. - MMEX_IniRecord(boost::shared_ptr<wxSQLite3Database> ini_db, wxSQLite3ResultSet& q1); + MMEX_IniRecord(boost::shared_ptr<wxSQLite3Database> ini_db + , bool main_db + , wxSQLite3ResultSet& q1); /// Set the value of the record void SetValue(const wxString& value); @@ -49,6 +53,7 @@ private: boost::shared_ptr<wxSQLite3Database> iniDb_; + bool main_db_; int settingId_; wxString settingName_; wxString settingValue_; @@ -63,7 +68,7 @@ { public: /// Constructor - MMEX_IniSettings(boost::shared_ptr<wxSQLite3Database> ini_db); + MMEX_IniSettings(boost::shared_ptr<wxSQLite3Database> ini_db, bool main_db = false); ~MMEX_IniSettings(); bool GetBoolSetting(const wxString& name, bool default_value); @@ -80,6 +85,7 @@ void Save(); private: boost::shared_ptr<wxSQLite3Database> ini_db_; + bool main_db_; std::vector< boost::shared_ptr<MMEX_IniRecord> > ini_records_; MMEX_IniRecord* GetRecord(const wxString& name); Modified: trunk/mmex/src/tests/dbwrapper_test.cpp =================================================================== --- trunk/mmex/src/tests/dbwrapper_test.cpp 2012-12-15 22:32:13 UTC (rev 3211) +++ trunk/mmex/src/tests/dbwrapper_test.cpp 2012-12-16 05:13:51 UTC (rev 3212) @@ -1124,7 +1124,6 @@ { const wxDateTime start_time(wxDateTime::UNow()); - boost::shared_ptr<wxSQLite3Database> pInidb = get_pInidb(); MMEX_IniSettings* pSettings = pSettingsList().get(); pSettings->Load(); @@ -1140,6 +1139,92 @@ displayTimeTaken(wxT("New_INIDB_TEST_5"), start_time); } #endif + +#if 1 +TEST(New_INFO_DB_TEST_1) +{ + const wxDateTime start_time(wxDateTime::UNow()); + + boost::shared_ptr<wxSQLite3Database> pdb = get_pInidb(); +// boost::shared_ptr<wxSQLite3Database> pdb = get_pDb(); + + MMEX_IniSettings pdb_settings(pdb, true); + pdb_settings.Load(); + + const wxString name = wxT("setting name"); + const wxString val = wxT("setting value"); + const wxString new_val = wxT("new setting value"); + + wxString test_name = pdb_settings.GetStringSetting(name, val); + CHECK_EQUAL(test_name, val); + + pdb_settings.SetStringSetting(name, new_val); + test_name = pdb_settings.GetStringSetting(name, val); + CHECK_EQUAL(test_name, new_val); +// pdb_settings->Save(); + + displayTimeTaken(wxT("New_INFO_DB_TEST_1"), start_time); +} +#endif + +#if 1 +TEST(New_INFO_DB_TEST_2) +{ + const wxDateTime start_time(wxDateTime::UNow()); + + // Save the details in the global ini database + boost::shared_ptr<wxSQLite3Database> pdb = get_pInidb(); + + MMEX_IniSettings pdb_settings(pdb, true); + pdb_settings.Load(); + + const wxString name = wxT("Test 2 Setting name"); + const wxString val = wxT("Test 2 Setting value"); + const wxString new_val = wxT("Test 2 new setting value"); + + wxString test_name = pdb_settings.GetStringSetting(name, val); + CHECK_EQUAL(test_name, val); + + pdb_settings.SetStringSetting(name, new_val); + test_name = pdb_settings.GetStringSetting(name, val); + CHECK_EQUAL(test_name, new_val); + + displayTimeTaken(wxT("New_INFO_DB_TEST_2"), start_time); +} +#endif + +#if 1 +TEST(New_INFO_DB_TEST_3) +{ + const wxDateTime start_time(wxDateTime::UNow()); + + // Save the details in the main database + boost::shared_ptr<wxSQLite3Database> pdb = get_pDb(); + + MMEX_IniSettings pdb_settings(pdb, true); + pdb_settings.Load(); + + const wxString name = wxT("Test 3 Setting name"); + const wxString val = wxT("Test 3 Setting value"); + const wxString new_val = wxT("Test 3 new setting value"); + + wxString test_name = pdb_settings.GetStringSetting(name, val); + CHECK_EQUAL(test_name, val); + + pdb_settings.SetStringSetting(name, new_val); + test_name = pdb_settings.GetStringSetting(name, val); + CHECK_EQUAL(test_name, new_val); + + const wxString prev_name = wxT("settings name"); + const wxString prev_val = wxT("settings value"); + + test_name = pdb_settings.GetStringSetting(prev_name, wxT("")); + CHECK_EQUAL(test_name, prev_val); + + displayTimeTaken(wxT("New_INFO_DB_TEST_3"), start_time); +} +#endif + } // SUITE end Inidb_test //---------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2012-12-21 22:09:27
|
Revision: 3237 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3237&view=rev Author: vomikan Date: 2012-12-21 22:09:15 +0000 (Fri, 21 Dec 2012) Log Message: ----------- Split entries update Modified Paths: -------------- trunk/mmex/src/transdialog.cpp trunk/mmex/src/transdialog.h Modified: trunk/mmex/src/transdialog.cpp =================================================================== --- trunk/mmex/src/transdialog.cpp 2012-12-21 18:37:49 UTC (rev 3236) +++ trunk/mmex/src/transdialog.cpp 2012-12-21 22:09:15 UTC (rev 3237) @@ -113,7 +113,6 @@ wxDateEvent dateEvent(dpc_, trx_date, wxEVT_DATE_CHANGED); GetEventHandler()->ProcessEvent(dateEvent); - wxString transTypeString; wxString dispAmount; if (edit_) { @@ -121,7 +120,7 @@ if (statusString == wxT("")) statusString = wxT("N"); choiceStatus_->SetSelection(wxString(wxT("NRVFD")).Find(statusString)); - transTypeString = pBankTransaction_->transType_; + sTransaction_type_ = pBankTransaction_->transType_; categID_ = pBankTransaction_->categID_; categoryName_ = core_->categoryList_.GetCategoryName(categID_); @@ -149,7 +148,7 @@ else { choiceStatus_->SetSelection(mmIniOptions::instance().transStatusReconciled_); - transTypeString = TRANS_TYPE_WITHDRAWAL_STR; + sTransaction_type_ = TRANS_TYPE_WITHDRAWAL_STR; notesColour_ = textNotes_->GetForegroundColour(); textNotes_->SetForegroundColour(wxColour(wxT("GREY"))); @@ -162,7 +161,7 @@ edit_currency_rate = toTransAmount_ / transAmount_; size_t begin = 0, size = sizeof(TRANSACTION_TYPE)/sizeof(wxString); - if (transTypeString == TRANS_TYPE_TRANSFER_STR) + if (sTransaction_type_ == TRANS_TYPE_TRANSFER_STR) { begin = size-1; transaction_type_->Disable(); @@ -174,13 +173,13 @@ transaction_type_->Append(wxGetTranslation(TRANSACTION_TYPE[i]), new wxStringClientData(TRANSACTION_TYPE[i])); } - transaction_type_->SetStringSelection(wxGetTranslation(transTypeString)); + transaction_type_->SetStringSelection(wxGetTranslation(sTransaction_type_)); cAdvanced_->SetValue(advancedToTransAmountSet_); wxString categString = _("Select Category"); - if (transTypeString == TRANS_TYPE_TRANSFER_STR) + if (sTransaction_type_ == TRANS_TYPE_TRANSFER_STR) { advancedToTransAmountSet_ = (transAmount_ != toTransAmount_); payee_name_ = cbPayee_->GetValue(); @@ -214,17 +213,6 @@ if (edit_) { *split_.get() = *core_->bTransactionList_.getBankTransactionPtr(pBankTransaction_->transactionID())->splitEntries_.get(); - - if (split_->numEntries() > 0) - { - bCategory_->SetLabel(_("Split Category")); - cSplit_->SetValue(true); - cSplit_->Disable(); - } - else - { - categString = pBankTransaction_->fullCatStr_; - } } else { @@ -232,24 +220,23 @@ if (categID_ > -1) categString = core_->categoryList_.GetFullCategoryString(categID_, subcategID_); } + SetSplitState(); - bCategory_->SetLabel(categString); - - if (split_->numEntries() > 0) - textAmount_->Enable(false); - } void mmTransDialog::OnTransTypeChanged(wxCommandEvent& /*event*/) { - updateControlsForTransType(); + sTransaction_type_ = TRANS_TYPE_WITHDRAWAL_STR; + wxStringClientData* type_obj = (wxStringClientData *)transaction_type_->GetClientObject(transaction_type_->GetSelection()); + if (type_obj) sTransaction_type_ = type_obj->GetData(); + + if (payeeID_ == -1 && sTransaction_type_ != TRANS_TYPE_TRANSFER_STR) + updateControlsForTransType(); } void mmTransDialog::updateControlsForTransType() { - //FIXME: - //SetTransferControls(transaction_type_->GetSelection()==DEF_TRANSFER); - bool transfer_transaction = transaction_type_->GetStringSelection() == wxGetTranslation(TRANS_TYPE_TRANSFER_STR); + bool transfer_transaction = sTransaction_type_ == TRANS_TYPE_TRANSFER_STR; SetTransferControls(transfer_transaction); if (!edit_) { @@ -713,10 +700,9 @@ void mmTransDialog::OnCategs(wxCommandEvent& /*event*/) { - if (cSplit_->GetValue()) + if (cSplit_->IsChecked()) { activateSplitTransactionsDlg(); - SetSplitState(); } else { @@ -730,10 +716,9 @@ categoryName_ = core_->categoryList_.GetCategoryName(categID_); subCategoryName_ = core_->categoryList_.GetSubCategoryName(categID_, subcategID_); - - bCategory_->SetLabel(core_->categoryList_.GetFullCategoryString(categID_, subcategID_)); } } + SetSplitState(); } wxString mmTransDialog::resetPayeeString(/*bool normal*/) //normal is deposits or withdrawls @@ -760,18 +745,15 @@ wxString mmTransDialog::resetCategoryString() { - const wxString catStr = _("Select Category"); categID_ = -1; subcategID_ = -1; - return catStr; + return _("Select Category"); } void mmTransDialog::OnOk(wxCommandEvent& /*event*/) { - wxString transaction_type = wxT(""); - wxStringClientData* type_obj = (wxStringClientData *)transaction_type_->GetClientObject(transaction_type_->GetSelection()); - if (type_obj) transaction_type = type_obj->GetData(); + wxString transaction_type = sTransaction_type_; if (payeeID_ == -1 && transaction_type != TRANS_TYPE_TRANSFER_STR) { @@ -971,41 +953,58 @@ void mmTransDialog::SetSplitState() { - if (split_->numEntries() > 0) - cSplit_->Disable(); - else - { - cSplit_->Enable(); - cSplit_->SetValue(false); - bCategory_->SetLabel(_("Select Category")); - } + int entries = split_->numEntries(); + wxString categString; + if (split_->numEntries() > 0) + categString = _("Split Category"); + else + { + if (categID_ < 0) + categString = edit_ ? pBankTransaction_->fullCatStr_ : _("Select Category"); + else + categString = core_->categoryList_.GetFullCategoryString(categID_, subcategID_); + } + + bCategory_->SetLabel(categString); + cSplit_->SetValue(entries > 0); + cSplit_->Enable(entries < 2 || categID_ > -1); + textAmount_->Enable(entries < 1); } void mmTransDialog::OnSplitChecked(wxCommandEvent& /*event*/) { /* Reset Category */ - categID_ = -1; - subcategID_ = -1; - split_ = boost::shared_ptr<mmSplitTransactionEntries>(new mmSplitTransactionEntries()); - - if (cSplit_->GetValue()) + //split_ = boost::shared_ptr<mmSplitTransactionEntries>(new mmSplitTransactionEntries()); + if (cSplit_->IsChecked()) { - bCategory_->SetLabel(_("Split Category")); textAmount_->Enable(false); - wxString dispAmount; - mmex::formatDoubleToCurrencyEdit(split_->getTotalSplits(), dispAmount); - textAmount_->SetValue(dispAmount); activateSplitTransactionsDlg(); SetSplitState(); } else { - bCategory_->SetLabel(_("Select Category")); - textAmount_->Enable(true); + if (split_->numEntries() != 1) + { + transAmount_ = 0; + } + else + { + categID_ = split_->entries_[0]->categID_; + subcategID_ = split_->entries_[0]->subCategID_; + transAmount_ = split_->entries_[0]->splitAmount_; + + if (transAmount_ < 0 ) + { + transAmount_ = - transAmount_; + transaction_type_->SetStringSelection(wxGetTranslation(TRANS_TYPE_WITHDRAWAL_STR)); + } + split_->removeSplitByIndex(0); + } wxString dispAmount; - mmex::formatDoubleToCurrencyEdit(0.0, dispAmount); + mmex::formatDoubleToCurrencyEdit(transAmount_, dispAmount); textAmount_->SetValue(dispAmount); } + SetSplitState(); } //---------------------------------------------------------------------------- @@ -1116,7 +1115,21 @@ void mmTransDialog::activateSplitTransactionsDlg() { - SplitTransactionDialog dlg(core_, split_.get(), transaction_type_->GetSelection(), this); + bool bDeposit = sTransaction_type_ == TRANS_TYPE_DEPOSIT_STR; + boost::shared_ptr<mmSplitTransactionEntry> pSplitEntry(new mmSplitTransactionEntry); + if (categID_ > -1) + { + pSplitEntry->splitAmount_ = bDeposit ? transAmount_ : transAmount_; + pSplitEntry->categID_ = categID_; + pSplitEntry->subCategID_ = subcategID_; + pSplitEntry->category_ = core_->categoryList_.GetCategorySharedPtr(categID_, subcategID_); + wxASSERT(pSplitEntry->category_.lock()); + split_->addSplit(pSplitEntry); + } + categID_ = -1; + subcategID_ = -1; + + SplitTransactionDialog dlg(core_, split_.get(), transaction_type_->GetSelection(), this); if (dlg.ShowModal() == wxID_OK) { double amount = split_->getTotalSplits(); Modified: trunk/mmex/src/transdialog.h =================================================================== --- trunk/mmex/src/transdialog.h 2012-12-21 18:37:49 UTC (rev 3236) +++ trunk/mmex/src/transdialog.h 2012-12-21 22:09:15 UTC (rev 3237) @@ -113,6 +113,7 @@ wxString categoryName_; wxString subCategoryName_; + wxString sTransaction_type_; wxChoice* choiceStatus_; wxChoice* transaction_type_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-01-06 20:50:22
|
Revision: 3301 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3301&view=rev Author: vomikan Date: 2013-01-06 20:50:16 +0000 (Sun, 06 Jan 2013) Log Message: ----------- update Modified Paths: -------------- trunk/mmex/src/categdialog.cpp trunk/mmex/src/categdialog.h Modified: trunk/mmex/src/categdialog.cpp =================================================================== --- trunk/mmex/src/categdialog.cpp 2013-01-06 03:51:57 UTC (rev 3300) +++ trunk/mmex/src/categdialog.cpp 2013-01-06 20:50:16 UTC (rev 3301) @@ -30,11 +30,11 @@ EVT_BUTTON(wxID_ADD, mmCategDialog::OnAdd) EVT_BUTTON(wxID_REMOVE, mmCategDialog::OnDelete) EVT_BUTTON(wxID_EDIT, mmCategDialog::OnEdit) - EVT_TREE_SEL_CHANGED(ID_DIALOG_CATEG_TREECTRL_CATS, mmCategDialog::OnSelChanged) - EVT_TREE_ITEM_RIGHT_CLICK(ID_DIALOG_CATEG_TREECTRL_CATS, mmCategDialog::OnSelChanged) - EVT_TREE_ITEM_ACTIVATED(ID_DIALOG_CATEG_TREECTRL_CATS, mmCategDialog::OnDoubleClicked) + EVT_TREE_SEL_CHANGED(wxID_ANY, mmCategDialog::OnSelChanged) + EVT_TREE_ITEM_RIGHT_CLICK(wxID_ANY, mmCategDialog::OnSelChanged) + EVT_TREE_ITEM_ACTIVATED(wxID_ANY, mmCategDialog::OnDoubleClicked) + EVT_TREE_ITEM_MENU(wxID_ANY, mmCategDialog::OnItemRightClick) EVT_MENU_RANGE(0, 9, mmCategDialog::OnMenuSelected) - EVT_TREE_ITEM_MENU(ID_DIALOG_CATEG_TREECTRL_CATS, mmCategDialog::OnItemRightClick) END_EVENT_TABLE() mmCategDialog::mmCategDialog( ) @@ -58,13 +58,13 @@ bEnableSelect_ = bEnableSelect; bEnableRelocate_ = bEnableRelocate; - //Get Hiden Categories id from stored string - hiden_categs_.clear(); - wxString sSettings = core_->dbInfoSettings_->GetStringSetting(wxT("HIDEN_CATEGS_ID"), wxT("")); + //Get Hidden Categories id from stored string + hidden_categs_.clear(); + wxString sSettings = core_->dbInfoSettings_->GetStringSetting(wxT("HIDDEN_CATEGS_ID"), wxT("")); wxStringTokenizer token(sSettings, wxT(";")); while (token.HasMoreTokens()) { - hiden_categs_.Add( token.GetNextToken() ); + hidden_categs_.Add( token.GetNextToken() ); } // @@ -99,7 +99,7 @@ treeCtrl_->SetItemBold(root_, true); treeCtrl_->SetFocus (); NormalColor_ = treeCtrl_->GetItemTextColour(root_); - bool bResult = core_->iniSettings_->GetBoolSetting(wxT("SHOW_HIDEN_CATEGS"), true); + bool bResult = core_->iniSettings_->GetBoolSetting(wxT("SHOW_HIDDEN_CATEGS"), true); cbShowAll_->SetValue(bResult); wxFont italicFont = wxFont(treeCtrl_->GetFont()); @@ -164,7 +164,7 @@ this->SetSizer(itemBoxSizer2); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 1); + itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 1); wxBoxSizer* itemBoxSizer33 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer3->Add(itemBoxSizer33); @@ -181,9 +181,9 @@ cbShowAll_ = new wxCheckBox(this, wxID_SELECTALL, _("Show All"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE); - cbShowAll_->SetToolTip(_("Show all hiden categories")); + cbShowAll_->SetToolTip(_("Show all hidden categories")); cbShowAll_->Connect(wxID_SELECTALL, wxEVT_COMMAND_CHECKBOX_CLICKED, - wxCommandEventHandler(mmCategDialog::OnShowHidenChbClick), NULL, this); + wxCommandEventHandler(mmCategDialog::OnShowHiddenChbClick), NULL, this); itemBoxSizer33->Add(btnCateg_relocate_, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); itemBoxSizer33->AddSpacer(10); @@ -192,10 +192,10 @@ itemBoxSizer33->Add(cbShowAll_, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); #if defined (__WXGTK__) || defined (__WXMAC__) - treeCtrl_ = new wxTreeCtrl( this, ID_DIALOG_CATEG_TREECTRL_CATS, + treeCtrl_ = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxSize(200, 380)); #else - treeCtrl_ = new wxTreeCtrl( this, ID_DIALOG_CATEG_TREECTRL_CATS, + treeCtrl_ = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxSize(200, 380), wxTR_SINGLE | wxTR_HAS_BUTTONS | wxTR_ROW_LINES ); @@ -333,18 +333,18 @@ wxString sIndex = wxString::Format(wxT("*%i:%i*"),categID, subcategID); wxString sSettings = wxT(""); - for (size_t i = 0; i < hiden_categs_.GetCount(); i++) + for (size_t i = 0; i < hidden_categs_.GetCount(); i++) { - if (subcategID != -1 && hiden_categs_[i] == sIndex) - hiden_categs_.RemoveAt(i, i); - else if (subcategID == -1 && hiden_categs_[i].Contains(wxString::Format(wxT("*%i:"),categID))) - hiden_categs_.RemoveAt(i, i); + if (subcategID != -1 && hidden_categs_[i] == sIndex) + hidden_categs_.RemoveAt(i, i); + else if (subcategID == -1 && hidden_categs_[i].Contains(wxString::Format(wxT("*%i:"),categID))) + hidden_categs_.RemoveAt(i, i); else - sSettings << hiden_categs_[i] << wxT(";"); + sSettings << hidden_categs_[i] << wxT(";"); } sIndex.RemoveLast(1); - core_->dbInfoSettings_->SetStringSetting(wxT("HIDEN_CATEGS_ID"), sSettings); + core_->dbInfoSettings_->SetStringSetting(wxT("HIDDEN_CATEGS_ID"), sSettings); core_->dbInfoSettings_->Save(); } @@ -523,7 +523,7 @@ core_->iniSettings_->Save(); } -void mmCategDialog::OnShowHidenChbClick(wxCommandEvent& /*event*/) +void mmCategDialog::OnShowHiddenChbClick(wxCommandEvent& /*event*/) { if (cbShowAll_->IsChecked()) { @@ -533,7 +533,7 @@ { treeCtrl_->SelectItem(selectedItemId_); } - core_->iniSettings_->SetBoolSetting(wxT("SHOW_HIDEN_CATEGS"), cbShowAll_->IsChecked()); + core_->iniSettings_->SetBoolSetting(wxT("SHOW_HIDDEN_CATEGS"), cbShowAll_->IsChecked()); core_->iniSettings_->Save(); fillControls(); } @@ -546,27 +546,27 @@ if (id == 0) { treeCtrl_->SetItemTextColour(selectedItemId_, wxColour(wxT("GREY"))); - if (hiden_categs_.Index(index) == wxNOT_FOUND ) - hiden_categs_.Add(index); + if (hidden_categs_.Index(index) == wxNOT_FOUND ) + hidden_categs_.Add(index); } else if (id == 1) { treeCtrl_->SetItemTextColour(selectedItemId_, NormalColor_); - hiden_categs_.Remove(index); + hidden_categs_.Remove(index); } else if (id == 2) { - hiden_categs_.Clear(); + hidden_categs_.Clear(); } wxString sSettings = wxT(""); - for (size_t i = 0; i < hiden_categs_.GetCount(); i++) + for (size_t i = 0; i < hidden_categs_.GetCount(); i++) { - sSettings.Append(hiden_categs_[i]).Append(wxT(";")); + sSettings.Append(hidden_categs_[i]).Append(wxT(";")); } sSettings.RemoveLast(1); - core_->dbInfoSettings_->SetStringSetting(wxT("HIDEN_CATEGS_ID"), sSettings); + core_->dbInfoSettings_->SetStringSetting(wxT("HIDDEN_CATEGS_ID"), sSettings); core_->dbInfoSettings_->Save(); if (!cbShowAll_->IsChecked() || id == 2) fillControls(); @@ -581,9 +581,9 @@ mainMenu->AppendSeparator(); mainMenu->Append(new wxMenuItem(mainMenu, 2, _("Clear Settings"))); - bool bItemHiden = (treeCtrl_->GetItemTextColour(selectedItemId_) != NormalColor_); - mainMenu->Enable(0, !bItemHiden && (selectedItemId_ != root_)); - mainMenu->Enable(1, bItemHiden && (selectedItemId_ != root_)); + bool bItemHidden = (treeCtrl_->GetItemTextColour(selectedItemId_) != NormalColor_); + mainMenu->Enable(0, !bItemHidden && (selectedItemId_ != root_)); + mainMenu->Enable(1, bItemHidden && (selectedItemId_ != root_)); PopupMenu(mainMenu, event.GetPoint()); delete mainMenu; @@ -593,5 +593,5 @@ bool mmCategDialog::categShowStatus(int categId, int subCategId) { wxString index = wxString::Format(wxT("*%i:%i*"),categId, subCategId); - return hiden_categs_.Index(index) == wxNOT_FOUND; + return hidden_categs_.Index(index) == wxNOT_FOUND; } Modified: trunk/mmex/src/categdialog.h =================================================================== --- trunk/mmex/src/categdialog.h 2013-01-06 03:51:57 UTC (rev 3300) +++ trunk/mmex/src/categdialog.h 2013-01-06 20:50:16 UTC (rev 3301) @@ -101,7 +101,7 @@ void showCategDialogDeleteError(wxString deleteCategoryErrMsg, bool category = true); void OnCategoryRelocation(wxCommandEvent& /*event*/); void OnExpandChbClick(wxCommandEvent& /*event*/); - void OnShowHidenChbClick (wxCommandEvent& /*event*/); + void OnShowHiddenChbClick (wxCommandEvent& /*event*/); void OnMenuSelected(wxCommandEvent& event); void OnItemRightClick(wxTreeEvent& event); bool categShowStatus(int categId, int subCategId); @@ -111,7 +111,7 @@ int categID_; int subcategID_; wxColour NormalColor_; - wxArrayString hiden_categs_; + wxArrayString hidden_categs_; }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-01-28 17:47:44
|
Revision: 3405 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3405&view=rev Author: vomikan Date: 2013-01-28 17:47:30 +0000 (Mon, 28 Jan 2013) Log Message: ----------- update Modified Paths: -------------- trunk/mmex/src/mmtransaction.cpp trunk/mmex/src/mmtransaction.h trunk/mmex/src/transdialog.cpp Modified: trunk/mmex/src/mmtransaction.cpp =================================================================== --- trunk/mmex/src/mmtransaction.cpp 2013-01-28 14:39:38 UTC (rev 3404) +++ trunk/mmex/src/mmtransaction.cpp 2013-01-28 17:47:30 UTC (rev 3405) @@ -855,44 +855,30 @@ return dt; } -int mmBankTransactionList::getLastUsedCategoryID(const int accountID, const int payeeID, int& subcategID) const +int mmBankTransactionList::getLastUsedCategoryID(const int accountID + , const int payeeID, const wxString sType, int& subcategID) const { int categ_id = -1; subcategID = -1; int index = transactions_.size() - 1; bool searching = true; - bool transfer = (accountID > 0 && payeeID < 0); + while (searching && index >= 0) { boost::shared_ptr<const mmBankTransaction> pTransaction = transactions_[index]; if (pTransaction) { - if (transfer) + if ((pTransaction->accountID_ == accountID || pTransaction->toAccountID_ == accountID) + && pTransaction->transType_ == sType + && pTransaction->payeeID_ == payeeID) { - if ((pTransaction->accountID_ == accountID || pTransaction->toAccountID_ == accountID) - && pTransaction->transType_ == TRANS_TYPE_TRANSFER_STR) + categ_id = pTransaction->categID_; + if (categ_id > -1) { - categ_id = pTransaction->categID_; - if (categ_id > -1) - { - subcategID = pTransaction->subcategID_; - searching = false; - } + subcategID = pTransaction->subcategID_; + searching = false; } } - else - { - if (pTransaction->payeeID_ == payeeID - && pTransaction->transType_ != TRANS_TYPE_TRANSFER_STR) - { - categ_id = pTransaction->categID_; - if (categ_id > -1) - { - subcategID = pTransaction->subcategID_; - searching = false; - } - } - } } index --; } Modified: trunk/mmex/src/mmtransaction.h =================================================================== --- trunk/mmex/src/mmtransaction.h 2013-01-28 14:39:38 UTC (rev 3404) +++ trunk/mmex/src/mmtransaction.h 2013-01-28 17:47:30 UTC (rev 3405) @@ -182,7 +182,7 @@ 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(const int accountID, const int payeeID, int& subcategID) const; + int getLastUsedCategoryID(const int accountID, const int payeeID, const wxString sType, int& subcategID) const; int getLastUsedPayeeID(const int accountID, wxString sType, int& categID, int& subcategID) const; wxArrayString getTransactionNumber(const int accountID, const wxDateTime transaction_date) const; bool IsCategoryUsed(mmCoreDB* core, const int iCatID, const int iSubCatID, bool bIgnor_subcat = true) const; Modified: trunk/mmex/src/transdialog.cpp =================================================================== --- trunk/mmex/src/transdialog.cpp 2013-01-28 14:39:38 UTC (rev 3404) +++ trunk/mmex/src/transdialog.cpp 2013-01-28 17:47:30 UTC (rev 3405) @@ -224,7 +224,7 @@ wxString categString = resetCategoryString(); if (mmIniOptions::instance().transCategorySelectionNone_ != 0) { - categID_ = core_->bTransactionList_.getLastUsedCategoryID(accountID_, transfer ? -1 : payeeID_, subcategID_); + categID_ = core_->bTransactionList_.getLastUsedCategoryID(accountID_, payeeID_, sTransaction_type_, subcategID_); categString = core_->categoryList_.GetFullCategoryString(categID_, subcategID_); categoryName_ = core_->categoryList_.GetCategoryName(categID_); subCategoryName_ = core_->categoryList_.GetSubCategoryName(categID_, subcategID_); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-02-03 18:39:54
|
Revision: 3427 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3427&view=rev Author: vomikan Date: 2013-02-03 18:39:48 +0000 (Sun, 03 Feb 2013) Log Message: ----------- simplification Modified Paths: -------------- trunk/mmex/src/billsdepositspanel.cpp trunk/mmex/src/billsdepositspanel.h trunk/mmex/src/mmex.cpp Modified: trunk/mmex/src/billsdepositspanel.cpp =================================================================== --- trunk/mmex/src/billsdepositspanel.cpp 2013-02-03 18:23:12 UTC (rev 3426) +++ trunk/mmex/src/billsdepositspanel.cpp 2013-02-03 18:39:48 UTC (rev 3427) @@ -59,10 +59,10 @@ } // namespace -mmBillsDepositsPanel::mmBillsDepositsPanel(wxSQLite3Database* db, mmCoreDB* core, +mmBillsDepositsPanel::mmBillsDepositsPanel(mmCoreDB* core, wxWindow *parent, wxWindowID winid, const wxPoint& pos, const wxSize& size, long style, const wxString& name) -: mmPanelBase(db, core) +: mmPanelBase(NULL, core) , m_imageList() , listCtrlAccount_() { Modified: trunk/mmex/src/billsdepositspanel.h =================================================================== --- trunk/mmex/src/billsdepositspanel.h 2013-02-03 18:23:12 UTC (rev 3426) +++ trunk/mmex/src/billsdepositspanel.h 2013-02-03 18:39:48 UTC (rev 3427) @@ -120,7 +120,6 @@ public: mmBillsDepositsPanel( - wxSQLite3Database* db, mmCoreDB* core, wxWindow *parent, wxWindowID winid = wxID_ANY, Modified: trunk/mmex/src/mmex.cpp =================================================================== --- trunk/mmex/src/mmex.cpp 2013-02-03 18:23:12 UTC (rev 3426) +++ trunk/mmex/src/mmex.cpp 2013-02-03 18:39:48 UTC (rev 3427) @@ -3953,7 +3953,7 @@ { wxSizer *sizer = cleanupHomePanel(); - panelCurrent_ = new mmBillsDepositsPanel(m_db.get(), m_core.get(), homePanel_, wxID_STATIC, + panelCurrent_ = new mmBillsDepositsPanel(m_core.get(), homePanel_, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); sizer->Add(panelCurrent_, 1, wxGROW|wxALL, 1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-02-03 20:28:57
|
Revision: 3431 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3431&view=rev Author: vomikan Date: 2013-02-03 20:28:51 +0000 (Sun, 03 Feb 2013) Log Message: ----------- update Modified Paths: -------------- trunk/mmex/src/optionsdialog.cpp trunk/mmex/src/optionsdialog.h Modified: trunk/mmex/src/optionsdialog.cpp =================================================================== --- trunk/mmex/src/optionsdialog.cpp 2013-02-03 20:24:55 UTC (rev 3430) +++ trunk/mmex/src/optionsdialog.cpp 2013-02-03 20:28:51 UTC (rev 3431) @@ -66,7 +66,6 @@ wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style) : core_(core) -, db_(core->db_.get()) , restartRequired_(false) , changesApplied_(false) { @@ -856,7 +855,7 @@ else { // Clear database record: Allows value to reset to system default. - db_->ExecuteUpdate("DELETE FROM INFOTABLE_V1 where INFONAME = \"STOCKURL\";"); + core_->db_.get()->ExecuteUpdate("DELETE FROM INFOTABLE_V1 where INFONAME = \"STOCKURL\";"); } } @@ -864,7 +863,7 @@ void mmOptionsDialog::SaveNewSystemSettings() { // initialize database saves ------------------------------------------------------------- - db_->Begin(); + core_->db_.get()->Begin(); // Save all the details for all the panels SaveGeneralPanelSettings(); @@ -874,7 +873,7 @@ SaveImportExportPanelSettings(); // finalise database saves --------------------------------------------------------------- - db_->Commit(); + core_->db_.get()->Commit(); } void mmOptionsDialog::SaveGeneralPanelSettings() Modified: trunk/mmex/src/optionsdialog.h =================================================================== --- trunk/mmex/src/optionsdialog.h 2013-02-03 20:24:55 UTC (rev 3430) +++ trunk/mmex/src/optionsdialog.h 2013-02-03 20:28:51 UTC (rev 3431) @@ -58,7 +58,6 @@ private: /// System database access variables mmCoreDB* core_; - wxSQLite3Database* db_; /// Dialog specific controls wxImageList* m_imageList; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-02-12 13:04:15
|
Revision: 3467 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3467&view=rev Author: vomikan Date: 2013-02-12 13:04:06 +0000 (Tue, 12 Feb 2013) Log Message: ----------- update Modified Paths: -------------- trunk/mmex/src/fileviewerdialog.cpp trunk/mmex/src/fileviewerdialog.h trunk/mmex/src/qif_import.cpp Modified: trunk/mmex/src/fileviewerdialog.cpp =================================================================== --- trunk/mmex/src/fileviewerdialog.cpp 2013-02-12 12:27:50 UTC (rev 3466) +++ trunk/mmex/src/fileviewerdialog.cpp 2013-02-12 13:04:06 UTC (rev 3467) @@ -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 @@ -28,15 +28,15 @@ { } -fileviewer::fileviewer(const wxString& fileName, wxWindow* parent, - wxWindowID id,const wxString& caption, +fileviewer::fileviewer(const wxString& fileName, wxWindow* parent, + wxWindowID id,const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) : fileName_(fileName) { Create(parent, id, caption, pos, size, style); } -bool fileviewer::Create( wxWindow* parent, wxWindowID id, const wxString& caption, +bool fileviewer::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); @@ -50,17 +50,17 @@ } void fileviewer::CreateControls() -{ +{ wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); this->SetSizer(itemBoxSizer2); - wxTextCtrl *itemTextCtrl3 = new wxTextCtrl( this, - ID_TEXTCTRL_FILEVIEWER, wxT(""), - SYMBOL_FILEVIEWER_POSITION, SYMBOL_FILEVIEWER_SIZE, + textCtrl_ = new wxTextCtrl( this, + ID_TEXTCTRL_FILEVIEWER, wxT(""), + SYMBOL_FILEVIEWER_POSITION, SYMBOL_FILEVIEWER_SIZE, wxTE_MULTILINE|wxTE_READONLY ); - - itemBoxSizer2->Add(itemTextCtrl3, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxGROW, 10); + itemBoxSizer2->Add(textCtrl_, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxGROW, 10); + /* Load the Text from the file */ if ( !fileName_.empty() ) { @@ -71,18 +71,18 @@ wxString line = text.ReadLine(); if (!line.IsEmpty()) { - *itemTextCtrl3 << line << wxT("\n"); + *textCtrl_ << line << wxT("\n"); } else { - *itemTextCtrl3 << wxT("\n"); + *textCtrl_ << wxT("\n"); } } - + } //Scroll to the top of file - itemTextCtrl3->SetInsertionPoint(0); - + textCtrl_->SetInsertionPoint(0); + wxButton* itemButtonOK = new wxButton( this, wxID_OK); itemBoxSizer2->Add(itemButtonOK, 0, wxALIGN_RIGHT|wxALL, 4); itemButtonOK->SetFocus(); Modified: trunk/mmex/src/fileviewerdialog.h =================================================================== --- trunk/mmex/src/fileviewerdialog.h 2013-02-12 12:27:50 UTC (rev 3466) +++ trunk/mmex/src/fileviewerdialog.h 2013-02-12 13:04:06 UTC (rev 3467) @@ -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 @@ -29,26 +29,27 @@ #define SYMBOL_FILEVIEWER_POSITION wxDefaultPosition class fileviewer: public wxDialog -{ +{ DECLARE_DYNAMIC_CLASS( fileviewer ) DECLARE_EVENT_TABLE() public: fileviewer( ); - fileviewer( const wxString& fileName, wxWindow* parent, - wxWindowID id = SYMBOL_FILEVIEWER_IDNAME, - const wxString& caption = SYMBOL_FILEVIEWER_TITLE, - const wxPoint& pos = SYMBOL_FILEVIEWER_POSITION, - const wxSize& size = SYMBOL_FILEVIEWER_SIZE, + fileviewer( const wxString& fileName, wxWindow* parent, + wxWindowID id = SYMBOL_FILEVIEWER_IDNAME, + const wxString& caption = SYMBOL_FILEVIEWER_TITLE, + const wxPoint& pos = SYMBOL_FILEVIEWER_POSITION, + const wxSize& size = SYMBOL_FILEVIEWER_SIZE, long style = SYMBOL_FILEVIEWER_STYLE ); - bool Create( wxWindow* parent, wxWindowID id = SYMBOL_FILEVIEWER_IDNAME, - const wxString& caption = SYMBOL_FILEVIEWER_TITLE, - const wxPoint& pos = SYMBOL_FILEVIEWER_POSITION, - const wxSize& size = SYMBOL_FILEVIEWER_SIZE, + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_FILEVIEWER_IDNAME, + const wxString& caption = SYMBOL_FILEVIEWER_TITLE, + const wxPoint& pos = SYMBOL_FILEVIEWER_POSITION, + const wxSize& size = SYMBOL_FILEVIEWER_SIZE, long style = SYMBOL_FILEVIEWER_STYLE ); void CreateControls(); + wxTextCtrl *textCtrl_; private: wxString fileName_; Modified: trunk/mmex/src/qif_import.cpp =================================================================== --- trunk/mmex/src/qif_import.cpp 2013-02-12 12:27:50 UTC (rev 3466) +++ trunk/mmex/src/qif_import.cpp 2013-02-12 13:04:06 UTC (rev 3467) @@ -144,7 +144,7 @@ if (!warning_message()) return -1; - wxString acctName; + wxString acctName, sMsg; wxArrayString accounts_name = core->accountList_.getAccountsName(); if (destinationAccountName == wxEmptyString) @@ -171,8 +171,10 @@ wxFileName logFile = mmex::GetLogDir(true); logFile.SetFullName(fileName); logFile.SetExt(wxT("log")); - bool canceledbyuser = false; + fileviewer file_dlg(wxT(""), parent_); + bool canceledbyuser = file_dlg.Show() == wxID_CANCEL; + if ( !fileName.IsEmpty() ) { wxFileInputStream input(fileName); @@ -196,18 +198,8 @@ std::vector<int> QIF_transID; core->db_.get()->Begin(); - wxProgressDialog* dlg = new wxProgressDialog(_("QIF Import"), _("Transactions imported from QIF: "), 100, - NULL, wxPD_AUTO_HIDE | wxPD_CAN_ABORT); - while(!input.Eof()) + while(!input.Eof() && !canceledbyuser) { - wxString progressMsg; - progressMsg << _("Transactions imported from QIF") << wxT("\n") - << _("to account ") << acctName << wxT(": ") << numImported; - if (!dlg->Update(static_cast<int>((static_cast<double>(numImported)/100.0 - numImported/100) *99), progressMsg)) - { - canceledbyuser = true; - break; // abort processing - } readLine = getFileLine(text, numLines); if (readLine.Length() == 0) @@ -216,7 +208,9 @@ bool isOK = isLineOK(readLine); if (!isOK) { - log << _("Line: ") << numLines << wxT(" ") << _(" Unknown QIF line: ") << readLine << endl; + sMsg = wxString()<< _("Line: ") << numLines << wxT(" ") << _(" Unknown QIF line: ") << readLine; + log << sMsg << endl; + file_dlg.textCtrl_->AppendText(wxString() << sMsg << wxT("\n")); continue; } @@ -228,6 +222,7 @@ (!accountType.CmpNoCase(wxT("Type:CCard")))) { log << _("Importing account type: ") << accountType << endl; + file_dlg.textCtrl_->AppendText(wxString() << _("Importing account type: ") << accountType << wxT("\n")); continue; } @@ -241,8 +236,10 @@ int i = accountInfoType(readLine); if (i == Name) { - log << _("Line: " ) << numLines << _(" : ") - << getLineData(readLine) << _(" account name ") << endl; + sMsg = wxString() << _("Line: " ) << numLines << _(" : ") + << getLineData(readLine) << _(" account name "); + log << sMsg << endl; + file_dlg.textCtrl_->AppendText(wxString()<< sMsg << wxT("\n")); continue; } else if (i == AccountType || i == Description || i == CreditLimit || i == BalanceDate || i == Balance) @@ -284,11 +281,11 @@ log << errLineMsgStr << endl; log << errMsgStr << endl; + file_dlg.textCtrl_->AppendText(wxString()<< errLineMsgStr << wxT("\n") << errMsgStr << wxT("\n")); wxMessageBox( errLineMsgStr + wxT("\n\n") + errMsgStr, _("QIF Import"), wxICON_ERROR); // exit: while(!input.Eof()) loop and allow to exit routine and allow user to save or abort break; - // return -1; } wxString cat, subcat; @@ -304,6 +301,7 @@ if (!core->payeeList_.PayeeExists(payee)) { log << _("Payee Added: ") << payee << endl; + file_dlg.textCtrl_->AppendText(wxString()<< _("Payee Added: ") << payee << wxT("\n")); payeeID = core->payeeList_.AddPayee(payee); } else @@ -318,6 +316,7 @@ if (!mmex::formatCurrencyToDouble(amount, val)) { log << _("Line: " ) << numLines << _(" invalid amount, skipping.") << endl; + file_dlg.textCtrl_->AppendText(wxString()<< _("Line: " ) << numLines << _(" invalid amount, skipping.") << wxT("\n")); continue; } @@ -400,19 +399,23 @@ if (dt.Trim().IsEmpty()) { log << _("Date is empty, ") << endl; + file_dlg.textCtrl_->AppendText(wxString()<< _("Date is empty, ") << wxT("\n")); } else if (type.Trim().IsEmpty()) { log << _("Transaction Type is empty") << endl; + file_dlg.textCtrl_->AppendText(wxString()<< _("Transaction Type is empty") << wxT("\n")); } else if (amount.Trim().IsEmpty()) { log << _("Amount is empty") << endl; + file_dlg.textCtrl_->AppendText(wxString()<< _("Amount is empty") << wxT("\n")); } if (to_account_id == -1) { log << _("Account: ") << from_account_name << wxT(" ") << _("Unknown") << endl; + file_dlg.textCtrl_->AppendText(wxString()<< _("Account: ") << from_account_name << wxT(" ") << _("Unknown") << wxT("\n")); //FIXME: Transfer transaction with sane to and from account id will be created to_account_id = fromAccountID; } @@ -444,6 +447,7 @@ if (pPayee->categoryId_ == -1) { log << _("Category is empty, marking transaction as Unknown category") << endl; + file_dlg.textCtrl_->AppendText(wxString()<< _("Category is empty, marking transaction as Unknown category") << wxT("\n")); categID = core->categoryList_.GetCategoryId(wxT("Unknown")); if (categID == -1) @@ -455,14 +459,22 @@ if(dt.Trim().IsEmpty() || type.Trim().IsEmpty() || amount.Trim().IsEmpty()) { - log << _("Skipping QIF transaction because date, type, amount is empty/invalid, transaction skipped had "); - log << _(" payee ") << payee << _(" type ") << type - << _(" amount ") << amount << _(" date ") << convDate - << endl; + sMsg = _("Skipping QIF transaction because date, type, amount is empty/invalid, transaction skipped had "); + sMsg << _(" payee ") << payee << _(" type ") << type + << _(" amount ") << amount << _(" date ") << convDate; + log << sMsg << endl; + file_dlg.textCtrl_->AppendText(wxString()<< sMsg << wxT("\n")); continue; } + file_dlg.textCtrl_->AppendText(wxString::Format( + _("Trx: %s %s %s \n") + , wxString::Format( wxT("Acc:%s"), core->accountList_.GetAccountName(fromAccountID).c_str()) + , wxString::Format( wxT("Amt:%s"), (wxString()<<val).c_str()) + , wxString::Format( wxT("Cat:%s"), core->categoryList_.GetFullCategoryString(categID, subCategID).c_str()) + )); + boost::shared_ptr<mmBankTransaction> pTransaction(new mmBankTransaction(core->db_)); pTransaction->accountID_ = fromAccountID; pTransaction->toAccountID_ = to_account_id; @@ -471,12 +483,13 @@ pTransaction->amt_ = val; pTransaction->status_ = status; pTransaction->transNum_ = transNum; - pTransaction->notes_ = (wxString(notes.Last()) == wxT("\n") ? notes.RemoveLast() : notes); + pTransaction->notes_ = notes; pTransaction->category_ = core->categoryList_.GetCategorySharedPtr(categID, subCategID); pTransaction->date_ = dtdt; pTransaction->toAmt_ = val; pTransaction->updateAllData(core, fromAccountID, pCurrencyPtr); + //TODO: it's should be moved from here int transID = core->bTransactionList_.addTransaction(core, pTransaction); QIF_transID.push_back(transID); @@ -495,22 +508,24 @@ } } - dlg->Destroy(); + sMsg = wxString() << _("Transactions imported from QIF: ") << numImported; + log << sMsg << endl; + file_dlg.textCtrl_->AppendText(wxString()<< sMsg << wxT("\n")); - log << _("Transactions imported from QIF: ") << numImported << endl; - wxString confirmMsg; - confirmMsg << _("Total Imported : ") << numImported << wxT ("\n\n") - << _("Log file written to : ") << logFile.GetFullPath() << wxT ("\n\n") - << _("Please confirm saving..."); - if (!canceledbyuser && wxMessageBox(confirmMsg, _("QIF Import"),wxOK|wxCANCEL|wxICON_INFORMATION) == wxCANCEL) - canceledbyuser = true; + sMsg = wxString() << _("Log file written to : ") << logFile.GetFullPath() << wxT ("\n\n") + << _("Please confirm saving..."); + file_dlg.textCtrl_->AppendText(wxString()<< sMsg << wxT("\n")); + canceledbyuser = wxMessageDialog(parent_, _("Please confirm saving...") + , _("QIF Import"), wxYES_NO|wxYES_DEFAULT|wxICON_QUESTION).ShowModal() == wxID_NO; // Since all database transactions are only in memory, if (!canceledbyuser) { // we need to save them to the database. core->db_.get()->Commit(); - log << endl << _("Transactions saved to database in account: ") << acctName << endl; + sMsg = wxString()<< _("Transactions saved to database in account: ") << acctName; + log << endl << sMsg << endl; + file_dlg.textCtrl_->AppendText(wxString()<< sMsg << wxT("\n")); } else { @@ -523,16 +538,16 @@ } // and discard the database changes. core->db_.get()->Rollback(); - log << endl << _("Imported transactions discarded by user!") << endl; + sMsg = wxString()<< _("Imported transactions discarded by user!"); + log << endl << sMsg << endl; + file_dlg.textCtrl_->AppendText(wxString()<< sMsg << wxT("\n")); } outputLog.Close(); //clear the vector to avoid memory leak - done at same level created. QIF_transID.clear(); + file_dlg.ShowModal(); } - if ( !fileName.IsEmpty() ) - fileviewer(logFile.GetFullPath(), parent_).ShowModal(); - return fromAccountID; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-03-02 12:25:27
|
Revision: 3538 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3538&view=rev Author: vomikan Date: 2013-03-02 12:25:17 +0000 (Sat, 02 Mar 2013) Log Message: ----------- update Modified Paths: -------------- trunk/mmex/src/qif_export.cpp trunk/mmex/src/qif_export.h trunk/mmex/src/qif_import.cpp Modified: trunk/mmex/src/qif_export.cpp =================================================================== --- trunk/mmex/src/qif_export.cpp 2013-03-02 09:06:52 UTC (rev 3537) +++ trunk/mmex/src/qif_export.cpp 2013-03-02 12:25:17 UTC (rev 3538) @@ -75,12 +75,12 @@ const int fieldWidth = 180; wxSizerFlags flags, flagsExpand; flags.Align(wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL).Border(wxALL, border); - flagsExpand.Align(wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL).Border(wxALL, border).Expand(); + flagsExpand.Align(wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL).Border(wxALL|wxGROW, border).Expand().Proportion(1); wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); this->SetSizer(main_sizer); wxBoxSizer* box_sizer1 = new wxBoxSizer(wxVERTICAL); - main_sizer->Add(box_sizer1, 1, wxGROW); + main_sizer->Add(box_sizer1, flagsExpand); wxNotebook* export_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_MULTILINE ); @@ -94,7 +94,7 @@ wxBoxSizer *tab2_sizer = new wxBoxSizer(wxVERTICAL); log_tab->SetSizer(tab2_sizer); - box_sizer1->Add(export_notebook, flags); + box_sizer1->Add(export_notebook, flagsExpand); // wxString choices[] = { _("QIF"), _("CSV")}; @@ -164,7 +164,7 @@ flex_sizer->AddSpacer(1); flex_sizer->Add(file_name_label_, flags); flex_sizer->Add(button_search_, flags); - tab1_sizer->Add(m_text_ctrl_, 1, wxALL|wxGROW, 5); + tab1_sizer->Add(m_text_ctrl_, 0, wxALL|wxGROW, border); //Log viewer log_field_ = new wxTextCtrl( log_tab, wxID_ANY, wxT("") Modified: trunk/mmex/src/qif_export.h =================================================================== --- trunk/mmex/src/qif_export.h 2013-03-02 09:06:52 UTC (rev 3537) +++ trunk/mmex/src/qif_export.h 2013-03-02 12:25:17 UTC (rev 3538) @@ -3,7 +3,7 @@ ********************************************************/ -#define SYMBOL_QIFDIALOG_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX +#define SYMBOL_QIFDIALOG_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX #define SYMBOL_QIFDIALOG_TITLE _("QIF Export") #define SYMBOL_QIFDIALOG_IDNAME wxID_HIGHEST+1 #define SYMBOL_QIFDIALOG_SIZE wxSize(500, 300) Modified: trunk/mmex/src/qif_import.cpp =================================================================== --- trunk/mmex/src/qif_import.cpp 2013-03-02 09:06:52 UTC (rev 3537) +++ trunk/mmex/src/qif_import.cpp 2013-03-02 12:25:17 UTC (rev 3538) @@ -145,19 +145,17 @@ } void mmQIFImportDialog::CreateControls() -{ - const int border = 5; - const int fieldWidth = 180; - wxSizerFlags flags, flagsExpand; - flags.Align(wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL).Border(wxALL, border); - flagsExpand.Align(wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL).Border(wxALL, border).Expand(); +{ + wxSizerFlags flags, flagsExpand; + flags.Align(wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL).Border(wxALL, 5); + flagsExpand.Align(wxALIGN_CENTER).Border(wxALL, 5).Expand().Proportion(1); wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); this->SetSizer(main_sizer); wxBoxSizer* box_sizer1 = new wxBoxSizer(wxVERTICAL); - main_sizer->Add(box_sizer1, 1, wxGROW|wxALL, 10); wxFlexGridSizer* flex_sizer = new wxFlexGridSizer(0, 3, 0, 0); + //flex_sizer->AddGrowableCol(1); // File Name -------------------------------------------- wxStaticText* file_name_label = new wxStaticText(this, wxID_STATIC, _("File Name:")); @@ -172,8 +170,8 @@ flex_sizer->Add(file_name_label, flags); flex_sizer->Add(button_search_, flags); flex_sizer->Add(bbFile_, flags); - main_sizer->Add(file_name_ctrl_, 1, wxALL|wxGROW, 5); - main_sizer->Add(flex_sizer, flags.Left()); + main_sizer->Add(file_name_ctrl_, 0, wxALL|wxGROW, 5); + box_sizer1->Add(flex_sizer, flagsExpand); // Date Format Settings wxStaticText* dateFormat = new wxStaticText(this, wxID_STATIC, _("Date Format")); @@ -199,7 +197,7 @@ dateFromCheckBox_ = new wxCheckBox( this, wxID_ANY, _("From Date") , wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); fromDateCtrl_ = new wxDatePickerCtrl( this, wxID_STATIC, wxDefaultDateTime - , wxDefaultPosition, wxSize(fieldWidth,-1), wxDP_DROPDOWN); + , wxDefaultPosition, wxSize(150, -1), wxDP_DROPDOWN); fromDateCtrl_->Enable(false); flex_sizer->Add(dateFromCheckBox_, flags); flex_sizer->Add(fromDateCtrl_, flags); @@ -209,17 +207,19 @@ dateToCheckBox_ = new wxCheckBox( this, wxID_ANY, _("To Date") , wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); toDateCtrl_ = new wxDatePickerCtrl( this, wxID_STATIC, wxDefaultDateTime - , wxDefaultPosition, wxSize(fieldWidth,-1), wxDP_DROPDOWN); + , wxDefaultPosition, wxSize(150, -1), wxDP_DROPDOWN); toDateCtrl_->Enable(false); flex_sizer->Add(dateToCheckBox_, flags); flex_sizer->Add(toDateCtrl_, flags); flex_sizer->AddSpacer(1); - /********************************************************************************************** + main_sizer->Add(box_sizer1, flagsExpand); + + /********************************************************************************************** Button Panel with OK and Cancel Buttons ***********************************************************************************************/ wxPanel* buttons_panel = new wxPanel(this, wxID_ANY); - main_sizer->Add(buttons_panel, flags.Center().Border(wxALL, 10)); + main_sizer->Add(buttons_panel, flags.Center()); wxStdDialogButtonSizer* buttons_sizer = new wxStdDialogButtonSizer; buttons_panel->SetSizer(buttons_sizer); @@ -233,6 +233,7 @@ buttons_sizer->Add(itemButtonCancel_, flags); buttons_sizer->Realize(); + Fit(); } void mmQIFImportDialog::fillControls() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2013-03-07 10:57:52
|
Revision: 3545 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3545&view=rev Author: stef145g Date: 2013-03-07 10:57:45 +0000 (Thu, 07 Mar 2013) Log Message: ----------- New Lua command: mmGetDocDir(...), mmGetExeDir(...), mmGetLuaDir(...) Modified Paths: -------------- trunk/mmex/src/lua_interface.cpp trunk/mmex/src/lua_interface.h Modified: trunk/mmex/src/lua_interface.cpp =================================================================== --- trunk/mmex/src/lua_interface.cpp 2013-03-06 16:49:16 UTC (rev 3544) +++ trunk/mmex/src/lua_interface.cpp 2013-03-07 10:57:45 UTC (rev 3545) @@ -19,6 +19,7 @@ #include "lua_interface.h" #include "util.h" #include "htmlbuilder.h" +#include <wx/stdpaths.h> // Constructor: Initialises Lua when an instant is created. TLuaInterface::TLuaInterface() @@ -157,6 +158,9 @@ lua_register(lua_, "mmCurrencyFormat", cpp2Lua_CurrencyFormat); lua_register(lua_, "mmBaseCurrencyFormat", cpp2Lua_BaseCurrencyFormat); lua_register(lua_, "mmDateFormat", cpp2Lua_DateFormat); + lua_register(lua_, "mmGetDocDir", cpp2lua_GetDocDir); + lua_register(lua_, "mmGetExeDir", cpp2lua_GetExeDir); + lua_register(lua_, "mmGetLuaDir", cpp2lua_GetLuaDir); } /****************************************************************************** @@ -533,6 +537,59 @@ } /****************************************************************************** + Private Helper function to set the directory settings on the return stack + *****************************************************************************/ +void TLuaInterface::SetDirSetting(lua_State* lua, wxString dir_setting) +{ + bool add_slash = ! OptionalParameter(lua, 1); + dir_setting.Replace(wxT("\\"),wxT("/")); + if (add_slash) + { + dir_setting << wxT("/"); + } + lua_pushstring(lua, dir_setting.ToUTF8()); +} + +/****************************************************************************** + current_working_dir = mmGetDocDir([without_end_slash]]) + *****************************************************************************/ +int TLuaInterface::cpp2lua_GetDocDir(lua_State* lua) +{ + static wxStandardPaths stdpath = wxStandardPaths(); + + SetDirSetting(lua, stdpath.GetDocumentsDir()); + return 1; +} + +/****************************************************************************** + exe_dir = mmGetExeDir([without_end_slash]) + *****************************************************************************/ +int TLuaInterface::cpp2lua_GetExeDir(lua_State* lua) +{ + static wxStandardPaths stdpath = wxStandardPaths(); + wxFileName fn(stdpath.GetExecutablePath()); + + SetDirSetting(lua, fn.GetPath()); + return 1; +} + +/****************************************************************************** + lua_dir = mmGetLuaDir([without_end_slash]) + *****************************************************************************/ +int TLuaInterface::cpp2lua_GetLuaDir(lua_State* lua) +{ + static wxStandardPaths stdpath = wxStandardPaths(); + wxFileName fn(stdpath.GetExecutablePath()); + + const wxArrayString &dirs = fn.GetDirs(); + if (dirs.Last().Upper() == wxT("BIN")) // bin\mmex.exe + fn.RemoveLastDir(); + + SetDirSetting(lua, fn.GetPath() + wxT("/lua")); + return 1; +} + +/****************************************************************************** html = mmHTMLBuilder("function[, value_1][, value_2][, value_3][, value_4]") *****************************************************************************/ int TLuaInterface::cpp2lua_HTMLBuilder(lua_State* lua) Modified: trunk/mmex/src/lua_interface.h =================================================================== --- trunk/mmex/src/lua_interface.h 2013-03-06 16:49:16 UTC (rev 3544) +++ trunk/mmex/src/lua_interface.h 2013-03-07 10:57:45 UTC (rev 3545) @@ -53,6 +53,7 @@ static wxString GetLuaString(lua_State* lua); static bool OptionalParameter(lua_State* lua, int parameter_possition); static void SetCurrencyFormat(lua_State* lua, double number, bool for_edit); + static void SetDirSetting(lua_State* lua, wxString dir_setting); /************************************************************************** Lua function extensions provided by c++ code: @@ -76,6 +77,9 @@ static int cpp2Lua_BaseCurrencyFormat(lua_State* lua); static int cpp2Lua_CurrencyFormat(lua_State* lua); static int cpp2Lua_DateFormat(lua_State* lua); + static int cpp2lua_GetDocDir(lua_State* lua); + static int cpp2lua_GetExeDir(lua_State* lua); + static int cpp2lua_GetLuaDir(lua_State* lua); static int cpp2lua_HTMLBuilder(lua_State* lua); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-03-20 17:00:54
|
Revision: 3598 http://sourceforge.net/p/moneymanagerex/code/3598 Author: vomikan Date: 2013-03-20 17:00:52 +0000 (Wed, 20 Mar 2013) Log Message: ----------- update for payee functions Modified Paths: -------------- trunk/mmex/src/dbwrapper.cpp trunk/mmex/src/dbwrapper.h trunk/mmex/src/mmcoredb.cpp trunk/mmex/src/mmpayee.cpp trunk/mmex/src/mmpayee.h trunk/mmex/src/transdialog.cpp Modified: trunk/mmex/src/dbwrapper.cpp =================================================================== --- trunk/mmex/src/dbwrapper.cpp 2013-03-20 15:04:14 UTC (rev 3597) +++ trunk/mmex/src/dbwrapper.cpp 2013-03-20 17:00:52 UTC (rev 3598) @@ -715,46 +715,6 @@ return err; } -bool mmDBWrapper::deletePayeeWithConstraints(wxSQLite3Database* db, int payeeID) -{ - try - { - char sql[] = - "select 1 " - "from CHECKINGACCOUNT_V1 " - "where transcode <> 'Transfer' " //for transfer transactions payee id should be null. if not null jast ignore it - "and PAYEEID = ? " - "limit 1"; - - wxSQLite3Statement st = db->PrepareStatement(sql); - st.Bind(1, payeeID); - wxSQLite3ResultSet q1 = st.ExecuteQuery(); - - bool found = q1.NextRow(); - st.Finalize(); - - if (found) - { - return false; - } - // -- - st = db->PrepareStatement("delete from PAYEE_V1 where PAYEEID = ?"); - st.Bind(1, payeeID); - - st.ExecuteUpdate(); - st.Finalize(); - mmOptions::instance().databaseUpdated_ = true; - - } - catch(const wxSQLite3Exception& e) - { - wxLogDebug(wxT("Database::deletePayeeWithConstraints: Exception"), e.GetMessage().c_str()); - wxLogError(wxT("delete from PAYEE_V1. ") + wxString::Format(_("Error: %s"), e.GetMessage().c_str())); - return false; - } - - return true; -} //-------------------------------------------------------------------- bool mmDBWrapper::updateTransactionWithStatus(wxSQLite3Database &db, int transID, const wxString& status) Modified: trunk/mmex/src/dbwrapper.h =================================================================== --- trunk/mmex/src/dbwrapper.h 2013-03-20 15:04:14 UTC (rev 3597) +++ trunk/mmex/src/dbwrapper.h 2013-03-20 17:00:52 UTC (rev 3598) @@ -245,13 +245,16 @@ static const char DELETE_FROM_BUDGETTABLE_V1[] = "DELETE FROM BUDGETTABLE_V1 where BUDGETENTRYID = ?"; +static const char DELETE_FROM_PAYEE_V1[] = + "DELETE FROM PAYEE_V1 WHERE PAYEEID = ?"; + static const char DELETE_FROM_SPLITTRANSACTIONS_V1[] = "DELETE FROM SPLITTRANSACTIONS_V1 " "where TRANSID in( SELECT TRANSID " "from CHECKINGACCOUNT_V1 " "where ACCOUNTID = ? OR TOACCOUNTID = ? )"; -static const char DELETE_TRANSID_SPLITTRANSACTIONS_V1[] = +static const char DELETE_TRANSID_SPLITTRANSACTIONS_V1[] = "DELETE FROM SPLITTRANSACTIONS_V1 where TRANSID = ?"; static const char DELETE_FROM_BUDGETSPLITTRANSACTIONS_V1[] = @@ -384,6 +387,9 @@ static const char INSERT_INTO_INFOTABLE_V1[] = "INSERT INTO INFOTABLE_V1 (INFONAME, INFOVALUE) VALUES (?, ?)"; +static const char INSERT_INTO_PAYEE_V1[] = + "INSERT INTO PAYEE_V1 (PAYEENAME, CATEGID, SUBCATEGID) VALUES (?, ?, ?)"; + static const char INSERT_INTO_SPLITTRANSACTIONS_V1[] = "INSERT INTO SPLITTRANSACTIONS_V1 (TRANSID, CATEGID, SUBCATEGID, SPLITTRANSAMOUNT) " "VALUES (?, ?, ?, ?)"; @@ -579,9 +585,6 @@ /* Account API */ void removeSplitsForAccount(wxSQLite3Database* db, int accountID); -/* Payee Table API */ -bool deletePayeeWithConstraints(wxSQLite3Database* db, int payeeID); - /* Category Table API */ bool deleteCategoryWithConstraints(wxSQLite3Database* db, int categID); bool deleteSubCategoryWithConstraints(wxSQLite3Database* db, int categID, int subcategID); Modified: trunk/mmex/src/mmcoredb.cpp =================================================================== --- trunk/mmex/src/mmcoredb.cpp 2013-03-20 15:04:14 UTC (rev 3597) +++ trunk/mmex/src/mmcoredb.cpp 2013-03-20 17:00:52 UTC (rev 3598) @@ -25,7 +25,7 @@ mmCoreDB::mmCoreDB(boost::shared_ptr<wxSQLite3Database> db, boost::shared_ptr<MMEX_IniSettings> iniSettings) : db_(db) , iniSettings_(iniSettings) -, payeeList_(db) +, payeeList_(this) , categoryList_(db) , accountList_(db) , currencyList_(db) Modified: trunk/mmex/src/mmpayee.cpp =================================================================== --- trunk/mmex/src/mmpayee.cpp 2013-03-20 15:04:14 UTC (rev 3597) +++ trunk/mmex/src/mmpayee.cpp 2013-03-20 17:00:52 UTC (rev 3598) @@ -19,6 +19,7 @@ #include "mmpayee.h" #include "util.h" #include "dbwrapper.h" +#include "mmcoredb.h" // Constructor used when loading a payee from the database mmPayee::mmPayee(wxSQLite3ResultSet q1) @@ -37,30 +38,6 @@ , subcategoryId_(-1) {} -bool mmPayee::UpdateDb(wxSQLite3Database* db) -{ - try - { - wxSQLite3Statement st = db->PrepareStatement(UPDATE_PAYEE_V1); - st.Bind(1, name_); - st.Bind(2, categoryId_); - st.Bind(3, subcategoryId_); - st.Bind(4, id_); - - st.ExecuteUpdate(); - st.Finalize(); - mmOptions::instance().databaseUpdated_ = true; - } - catch(const wxSQLite3Exception& e) - { - wxLogDebug(wxT("Database::updatePayee: Exception"), e.GetMessage().c_str()); - wxLogError(wxT("update PAYEE_V1. ") + wxString::Format(_("Error: %s"), e.GetMessage().c_str())); - return false; - } - - return true; -} - bool mmPayeeList::PayeeExists(const wxString& payeeName) const { for (std::vector< boost::shared_ptr<mmPayee> >::const_iterator it = entries_.begin(); it != entries_.end(); ++ it) @@ -81,26 +58,6 @@ return false; } -int mmPayeeList::AddPayee(const wxString &payeeName) -{ - std::vector<wxString> data; - data.push_back(payeeName); - data.push_back(wxT("-1")); - data.push_back(wxT("-1")); - static const char INSERT_INTO_PAYEE_V1[] = - "INSERT INTO PAYEE_V1 (PAYEENAME, CATEGID, SUBCATEGID) VALUES (?, ?, ?)"; - long payeeID = -1; - wxString sql = wxString::FromUTF8(INSERT_INTO_PAYEE_V1); - int iError = mmDBWrapper::mmSQLiteExecuteUpdate(db_.get(), data, sql, payeeID); - if (iError != 0) - return -1; - - boost::shared_ptr<mmPayee> pPayee(new mmPayee(payeeID, payeeName)); - entries_.push_back(pPayee); - - return payeeID; -} - int mmPayeeList::GetPayeeId(const wxString& payeeName) const { for (std::vector< boost::shared_ptr<mmPayee> >::const_iterator it = entries_.begin(); it != entries_.end(); ++ it) @@ -121,23 +78,6 @@ return wxEmptyString; } -bool mmPayeeList::RemovePayee(int payeeID) -{ - if (mmDBWrapper::deletePayeeWithConstraints(db_.get(), payeeID)) - { - std::vector <boost::shared_ptr<mmPayee> >::iterator Iter; - for ( Iter = entries_.begin( ) ; Iter != entries_.end( ) ; Iter++ ) - { - if ((*Iter)->id_ == payeeID) - { - entries_.erase(Iter); - return true; - } - } - } - return false; -} - bool sortPayees(const boost::shared_ptr<mmPayee>& elem1, const boost::shared_ptr<mmPayee>& elem2 ) { return elem1->name_ < elem2->name_; @@ -162,13 +102,6 @@ return boost::shared_ptr<mmPayee>(); } -void mmPayeeList::UpdatePayee(int payeeID, const wxString& payeeName) -{ - boost::shared_ptr<mmPayee> pPayee = GetPayeeSharedPtr(payeeID); - pPayee->name_ = payeeName; - pPayee->UpdateDb(db_.get()); -} - wxArrayString mmPayeeList::FilterPayees(const wxString& patt) const { wxArrayString payee_list; @@ -183,7 +116,7 @@ void mmPayeeList::LoadPayees() { - wxSQLite3ResultSet q1 = db_->ExecuteQuery(SELECT_ALL_FROM_PAYEE_V1); + wxSQLite3ResultSet q1 = core_->db_.get()->ExecuteQuery(SELECT_ALL_FROM_PAYEE_V1); while (q1.NextRow()) { @@ -194,3 +127,65 @@ q1.Finalize(); SortList(); } + +bool mmPayeeList::RemovePayee(int payeeID) +{ + if (core_->bTransactionList_.IsPayeeUsed(payeeID)) return false; + + long payeeId = payeeID; + std::vector<wxString> data; + data.push_back(wxString()<<payeeID); + wxString sql = wxString::FromUTF8(DELETE_FROM_PAYEE_V1); + int iError = mmDBWrapper::mmSQLiteExecuteUpdate(core_->db_.get(), data, sql, payeeId); + if (iError != 0) + return -1; + + std::vector <boost::shared_ptr<mmPayee> >::iterator Iter; + for ( Iter = entries_.begin( ) ; Iter != entries_.end( ) ; Iter++ ) + { + if ((*Iter)->id_ == payeeID) + { + entries_.erase(Iter); + return true; + } + } + return false; +} + +int mmPayeeList::AddPayee(const wxString &payeeName) +{ + std::vector<wxString> data; + data.push_back(payeeName); + data.push_back(wxT("-1")); + data.push_back(wxT("-1")); + long payeeID = -1; + wxString sql = wxString::FromUTF8(INSERT_INTO_PAYEE_V1); + int iError = mmDBWrapper::mmSQLiteExecuteUpdate(core_->db_.get(), data, sql, payeeID); + if (iError != 0) + return -1; + + boost::shared_ptr<mmPayee> pPayee(new mmPayee(payeeID, payeeName)); + entries_.push_back(pPayee); + + return payeeID; +} + +int mmPayeeList::UpdatePayee(int payeeID, const wxString& payeeName) +{ + boost::shared_ptr<mmPayee> pPayee = GetPayeeSharedPtr(payeeID); + if (!payeeName.IsEmpty()) pPayee->name_ = payeeName; + std::vector<wxString> data; + data.push_back(pPayee->name_); + data.push_back(wxString()<<pPayee->categoryId_); + data.push_back(wxString()<<pPayee->subcategoryId_); + data.push_back(wxString()<<payeeID); + + long payeeId = -1; + wxString sql = wxString::FromUTF8(UPDATE_PAYEE_V1); + int iError = mmDBWrapper::mmSQLiteExecuteUpdate(core_->db_.get(), data, sql, payeeId); + if (iError != 0) + return -1; + + mmOptions::instance().databaseUpdated_ = true; + return iError; +} Modified: trunk/mmex/src/mmpayee.h =================================================================== --- trunk/mmex/src/mmpayee.h 2013-03-20 15:04:14 UTC (rev 3597) +++ trunk/mmex/src/mmpayee.h 2013-03-20 17:00:52 UTC (rev 3598) @@ -20,6 +20,8 @@ #include "mmcategory.h" #include "boost/shared_ptr.hpp" +class mmCoreDB; + class mmPayee { public: @@ -29,24 +31,22 @@ 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 UpdateDb(wxSQLite3Database* db); }; class mmPayeeList { public: - mmPayeeList(boost::shared_ptr<wxSQLite3Database> db) - : db_(db) + mmPayeeList(mmCoreDB* core) + : core_(core) {} /* Payee Functions */ int AddPayee(const wxString& payeeName); bool RemovePayee(int payeeID); - void UpdatePayee(int payeeID, const wxString& payeeName); + int UpdatePayee(int payeeID, const wxString& payeeName); bool PayeeExists(const wxString& payeeName) const; bool PayeeExists(const int payeeid) const; int GetPayeeId(const wxString& payeeName) const; @@ -70,7 +70,7 @@ void LoadPayees(); private: - boost::shared_ptr<wxSQLite3Database> db_; + mmCoreDB* core_; }; #endif Modified: trunk/mmex/src/transdialog.cpp =================================================================== --- trunk/mmex/src/transdialog.cpp 2013-03-20 15:04:14 UTC (rev 3597) +++ trunk/mmex/src/transdialog.cpp 2013-03-20 17:00:52 UTC (rev 3598) @@ -896,7 +896,7 @@ boost::shared_ptr<mmPayee> pPayee = core_->payeeList_.GetPayeeSharedPtr(payeeID_); pPayee->categoryId_ = categID_; pPayee->subcategoryId_ = subcategID_; - pPayee->UpdateDb(core_->db_.get()); + core_->payeeList_.UpdatePayee(payeeID_, wxT("")); } wxString transNum = textNumber_->GetValue(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2013-03-27 12:42:59
|
Revision: 3632 http://sourceforge.net/p/moneymanagerex/code/3632 Author: stef145g Date: 2013-03-27 12:42:55 +0000 (Wed, 27 Mar 2013) Log Message: ----------- Addition of Duplicate command for Assets, and fix asset icons Modified Paths: -------------- trunk/mmex/src/assetspanel.cpp trunk/mmex/src/assetspanel.h Modified: trunk/mmex/src/assetspanel.cpp =================================================================== --- trunk/mmex/src/assetspanel.cpp 2013-03-27 12:31:42 UTC (rev 3631) +++ trunk/mmex/src/assetspanel.cpp 2013-03-27 12:42:55 UTC (rev 3632) @@ -46,6 +46,7 @@ EVT_MENU(MENU_TREEPOPUP_NEW, mmAssetsListCtrl::OnNewAsset) EVT_MENU(MENU_TREEPOPUP_EDIT, mmAssetsListCtrl::OnEditAsset) EVT_MENU(MENU_TREEPOPUP_DELETE, mmAssetsListCtrl::OnDeleteAsset) + EVT_MENU(MENU_ON_DUPLICATE_TRANSACTION, mmAssetsListCtrl::OnDuplicateAsset) EVT_LIST_KEY_DOWN(wxID_ANY, mmAssetsListCtrl::OnListKeyDown) END_EVENT_TABLE() @@ -81,6 +82,8 @@ wxMenu menu; menu.Append(MENU_TREEPOPUP_NEW, _("&New Asset")); menu.AppendSeparator(); + menu.Append(MENU_ON_DUPLICATE_TRANSACTION, _("D&uplicate Asset")); + menu.AppendSeparator(); menu.Append(MENU_TREEPOPUP_EDIT, _("&Edit Asset")); menu.Append(MENU_TREEPOPUP_DELETE, _("&Delete Asset")); PopupMenu(&menu, event.GetPoint()); @@ -109,11 +112,11 @@ size_t size = sizeof(ASSET_TYPE_DEF)/sizeof(wxString); for(size_t i = 0; i < size; ++i) { - if (ASSET_TYPE_DEF[i] == OnGetItemText(item, COL_TYPE)) + if (ASSET_TYPE_DEF[i] == cp_->AssetList().entrylist_[item]->type_) image_id = i; } - return item; + return image_id; } wxListItemAttr* mmAssetsListCtrl::OnGetItemAttr(long item) const @@ -191,15 +194,45 @@ AddPendingEvent(evt); } +void mmAssetsListCtrl::OnDuplicateAsset(wxCommandEvent& /*event*/) +{ + if (selectedIndex_ < 0) return; + + int original_index = selectedIndex_; + + // Duplicate the asset entry + TAssetEntry* pNewEntry = new TAssetEntry(cp_->AssetList().entrylist_[selectedIndex_].get()); + int new_asset_id = cp_->AssetList().AddEntry(pNewEntry); + // Locate new entry in the visual list. + cp_->AssetList().GetEntryPtr(new_asset_id); + selectedIndex_ = cp_->AssetList().GetCurrentIndex(); + + if (! EditAsset(pNewEntry)) + { + // remove the duplicate asset canceled by user. + cp_->AssetList().DeleteEntry(new_asset_id); + selectedIndex_ = original_index; + cp_->updateExtraAssetData(selectedIndex_); + } +} + void mmAssetsListCtrl::OnListItemActivated(wxListEvent& /*event*/) { - //selectedIndex_ = event.GetIndex(); - mmAssetDialog dlg(this, cp_->core_, cp_, cp_->AssetList().entrylist_[selectedIndex_].get(), true); + EditAsset(cp_->AssetList().entrylist_[selectedIndex_].get()); +} +bool mmAssetsListCtrl::EditAsset(TAssetEntry* pEntry) +{ + mmAssetDialog dlg(this, cp_->core_, cp_, pEntry, true); + bool edit = true; if (dlg.ShowModal() == wxID_OK) + { doRefreshItems(dlg.GetAssetID()); + cp_->updateExtraAssetData(selectedIndex_); + } + else edit = false; - cp_->updateExtraAssetData(selectedIndex_); + return edit; } void mmAssetsListCtrl::OnColClick(wxListEvent& event) @@ -300,29 +333,24 @@ /* ---------------------- */ wxSplitterWindow* itemSplitterWindow10 = new wxSplitterWindow( this, wxID_STATIC, - wxDefaultPosition, wxSize(200, 200), wxSP_3DBORDER|wxSP_3DSASH|wxNO_BORDER ); + wxDefaultPosition, wxSize(200, 200), wxSP_3DBORDER|wxSP_3DSASH|wxNO_BORDER); + m_listCtrlAssets = new mmAssetsListCtrl( this, itemSplitterWindow10, + IDC_PANEL_STOCKS_LISTCTRL, wxDefaultPosition, wxDefaultSize, + wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxLC_VIRTUAL | wxLC_SINGLE_SEL); + wxSize imageSize(16, 16); m_imageList.reset(new wxImageList(imageSize.GetWidth(), imageSize.GetHeight())); - m_imageList->Add(wxBitmap(wxImage(assets_xpm).Scale(16, 16))); - //TODO: Provide more icons - //m_imageList->Add(wxBitmap(wxImage(car_xpm).Scale(16, 16))); - m_imageList->Add(wxBitmap(wxImage(assets_xpm).Scale(16, 16))); - m_imageList->Add(wxBitmap(wxImage(assets_xpm).Scale(16, 16))); - m_imageList->Add(wxBitmap(wxImage(assets_xpm).Scale(16, 16))); - m_imageList->Add(wxBitmap(wxImage(assets_xpm).Scale(16, 16))); - m_imageList->Add(wxBitmap(wxImage(assets_xpm).Scale(16, 16))); - m_imageList->Add(wxBitmap(wxImage(assets_xpm).Scale(16, 16))); - m_imageList->Add(wxBitmap(wxImage(uparrow_xpm).Scale(16, 16))); - m_imageList->Add(wxBitmap(wxImage(downarrow_xpm).Scale(16, 16))); + //TODO: Provide better icons + m_imageList->Add(wxBitmap(wxImage(house_xpm).Scale(16, 16))); // Property + m_imageList->Add(wxBitmap(wxImage(car_xpm).Scale(16, 16))); // Automobile + m_imageList->Add(wxBitmap(wxImage(clock_xpm).Scale(16, 16))); // Household Object + m_imageList->Add(wxBitmap(wxImage(art_xpm).Scale(16, 16))); // Art + m_imageList->Add(wxBitmap(wxImage(rubik_cube_xpm).Scale(16, 16))); // Jewellery + m_imageList->Add(wxBitmap(wxImage(money_dollar_xpm).Scale(16, 16))); // Cash + m_imageList->Add(wxBitmap(wxImage(assets_xpm).Scale(16, 16))); // Other - m_listCtrlAssets = new mmAssetsListCtrl( this, itemSplitterWindow10, - IDC_PANEL_STOCKS_LISTCTRL, wxDefaultPosition, wxDefaultSize, - wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxLC_VIRTUAL | wxLC_SINGLE_SEL ); - - //m_imageList.get()->Add(wxBitmap(assets_xpm)); m_listCtrlAssets->SetImageList(m_imageList.get(), wxIMAGE_LIST_SMALL); - m_listCtrlAssets->InsertColumn(COL_NAME, _("Name")); wxListItem itemCol; @@ -457,6 +485,21 @@ return wxGetEmptyString(); } +void mmAssetsPanel::SetFilter(wxString filter) +{ + filter_ = filter; +} + +int mmAssetsPanel::GetListCtrlWidth(int id) +{ + return m_listCtrlAssets->GetColumnWidth(id); +} + +void mmAssetsPanel::SetListCtrlColumn(int m_selected_col, wxListItem item) +{ + m_listCtrlAssets->SetColumn(m_selected_col, item); +} + void mmAssetsPanel::updateExtraAssetData(int selIndex) { wxStaticText* st = (wxStaticText*)FindWindow(IDC_PANEL_ASSET_STATIC_DETAILS); Modified: trunk/mmex/src/assetspanel.h =================================================================== --- trunk/mmex/src/assetspanel.h 2013-03-27 12:31:42 UTC (rev 3631) +++ trunk/mmex/src/assetspanel.h 2013-03-27 12:42:55 UTC (rev 3632) @@ -36,6 +36,8 @@ void OnNewAsset(wxCommandEvent& event); void OnEditAsset(wxCommandEvent& event); void OnDeleteAsset(wxCommandEvent& event); + void OnDuplicateAsset(wxCommandEvent& event); + void InitVariables(); void doRefreshItems(int trx_id = -1); @@ -59,6 +61,7 @@ void OnListItemDeselected(wxListEvent& event); void OnColClick(wxListEvent& event); void OnItemResize(wxListEvent& event); + bool EditAsset(TAssetEntry* pEntry); }; class mmAssetsPanel : public mmPanelBase @@ -71,10 +74,10 @@ void updateExtraAssetData(int selIndex); int initVirtualListControl(int trx_id = -1, int col = 0, bool asc = true); wxString getItem(long item, long column); - void SetFilter(wxString filter) {filter_=filter; } - int GetListCtrlWidth(int id) {return m_listCtrlAssets->GetColumnWidth(id);} - void SetListCtrlColumn(int m_selected_col, wxListItem item) - {m_listCtrlAssets->SetColumn(m_selected_col, item);} + void SetFilter(wxString filter); + int GetListCtrlWidth(int id); + void SetListCtrlColumn(int m_selected_col, wxListItem item); + TAssetList& AssetList() { return asset_list_; } private: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-05-23 12:51:13
|
Revision: 3964 http://sourceforge.net/p/moneymanagerex/code/3964 Author: guanlisheng Date: 2013-05-23 12:51:11 +0000 (Thu, 23 May 2013) Log Message: ----------- cleanup Modified Paths: -------------- trunk/mmex/src/mmex.cpp trunk/mmex/src/mmgraphpie.cpp trunk/mmex/src/mmgraphpie.h Modified: trunk/mmex/src/mmex.cpp =================================================================== --- trunk/mmex/src/mmex.cpp 2013-05-23 12:29:52 UTC (rev 3963) +++ trunk/mmex/src/mmex.cpp 2013-05-23 12:51:11 UTC (rev 3964) @@ -3679,7 +3679,6 @@ } wxArrayString as; - //int num = (int)m_core->accountList_.accounts_.size(); std::vector<int> arrAcctID; int idx = 0; Modified: trunk/mmex/src/mmgraphpie.cpp =================================================================== --- trunk/mmex/src/mmgraphpie.cpp 2013-05-23 12:29:52 UTC (rev 3963) +++ trunk/mmex/src/mmgraphpie.cpp 2013-05-23 12:51:11 UTC (rev 3964) @@ -5,12 +5,13 @@ mmGraphPie::mmGraphPie() : mmGraphGenerator(PIE), - chart(new PieChart(480, 320)) + chart_(new PieChart(480, 320)) { } mmGraphPie::~mmGraphPie() { + if (chart_) delete chart_; } void mmGraphPie::init(std::vector<ValuePair>& valueList) @@ -30,12 +31,12 @@ pieData.push_back(ChartData(_("All Others"), othersum)); } - chart->SetData(pieData); - chart->Init(240, CHART_LEGEND_FIXED, PIE_CHART_ABSOLUT); + chart_->SetData(pieData); + chart_->Init(240, CHART_LEGEND_FIXED, PIE_CHART_ABSOLUT); } bool mmGraphPie::Generate(const wxString& chartTitle) { - chart->Render(chartTitle); - return chart->Save(getOutputFileName()); + chart_->Render(chartTitle); + return chart_->Save(getOutputFileName()); } Modified: trunk/mmex/src/mmgraphpie.h =================================================================== --- trunk/mmex/src/mmgraphpie.h 2013-05-23 12:29:52 UTC (rev 3963) +++ trunk/mmex/src/mmgraphpie.h 2013-05-23 12:51:11 UTC (rev 3964) @@ -21,7 +21,6 @@ #include "mmgraphgenerator.h" -#include <wx/scopedptr.h> #include <vector> struct ValuePair; @@ -37,7 +36,7 @@ bool Generate(const wxString& chartTitle); private: - wxScopedPtr<PieChart> chart; + PieChart* chart_; }; #endif // _MM_EX_GRAPHPIE_H_ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2013-06-09 00:30:38
|
Revision: 4050 http://sourceforge.net/p/moneymanagerex/code/4050 Author: stef145g Date: 2013-06-09 00:30:34 +0000 (Sun, 09 Jun 2013) Log Message: ----------- Fix: restore tree selection of category in dialogue Modified Paths: -------------- trunk/mmex/src/filtertransdialog.cpp trunk/mmex/src/relocatecategorydialog.cpp Modified: trunk/mmex/src/filtertransdialog.cpp =================================================================== --- trunk/mmex/src/filtertransdialog.cpp 2013-06-08 13:27:48 UTC (rev 4049) +++ trunk/mmex/src/filtertransdialog.cpp 2013-06-09 00:30:34 UTC (rev 4050) @@ -424,6 +424,9 @@ { mmCategDialog dlg(core_, this); + dlg.setTreeSelection(core_->categoryList_.GetCategoryName(categID_) + , core_->categoryList_.GetSubCategoryName(categID_,subcategID_)); + if (dlg.ShowModal() == wxID_OK) { categID_ = dlg.getCategId(); @@ -431,7 +434,6 @@ btnCategory_->SetLabel(core_->categoryList_.GetFullCategoryString(categID_, subcategID_)); bExpandStaus_ = dlg.getExpandStatus(); } - } bool mmFilterTransactionsDialog::somethingSelected() Modified: trunk/mmex/src/relocatecategorydialog.cpp =================================================================== --- trunk/mmex/src/relocatecategorydialog.cpp 2013-06-08 13:27:48 UTC (rev 4049) +++ trunk/mmex/src/relocatecategorydialog.cpp 2013-06-09 00:30:34 UTC (rev 4050) @@ -124,8 +124,8 @@ { mmCategDialog* sourceCat = new mmCategDialog(core_ , this, true, false); - sourceCat->setTreeSelection(core_->categoryList_.GetCategoryName(sourceCatID_), - core_->categoryList_.GetSubCategoryName(sourceCatID_, sourceSubCatID_)); + sourceCat->setTreeSelection(core_->categoryList_.GetCategoryName(sourceCatID_) + , core_->categoryList_.GetSubCategoryName(sourceCatID_, sourceSubCatID_)); if (sourceCat->ShowModal() == wxID_OK) { @@ -139,6 +139,10 @@ void relocateCategoryDialog::OnSelectDest(wxCommandEvent& /*event*/) { mmCategDialog* destCat = new mmCategDialog(core_ , this, true, false); + + destCat->setTreeSelection(core_->categoryList_.GetCategoryName(destCatID_) + , core_->categoryList_.GetSubCategoryName(destCatID_, destSubCatID_)); + if (destCat->ShowModal() == wxID_OK) { destCatID_ = destCat->getCategId(); @@ -156,7 +160,6 @@ return countStr; } - void relocateCategoryDialog::OnOk(wxCommandEvent& /*event*/) { if ((sourceCatID_ > 0) && (destCatID_ > 0) ) @@ -174,4 +177,3 @@ } } } - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kkk...@us...> - 2009-12-06 13:06:49
|
Revision: 866 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=866&view=rev Author: kkkvadim Date: 2009-12-06 13:06:41 +0000 (Sun, 06 Dec 2009) Log Message: ----------- BUGFIX: const XXX& parameters instead of XXX Modified Paths: -------------- trunk/mmex/src/util.cpp trunk/mmex/src/util.h Modified: trunk/mmex/src/util.cpp =================================================================== --- trunk/mmex/src/util.cpp 2009-12-06 13:05:18 UTC (rev 865) +++ trunk/mmex/src/util.cpp 2009-12-06 13:06:41 UTC (rev 866) @@ -285,7 +285,7 @@ return mon[month]; } -wxString mmGetNiceDateString(wxDateTime dt) +wxString mmGetNiceDateString(const wxDateTime &dt) { static const wxString gDaysInWeek[7] = { _("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), @@ -299,7 +299,7 @@ return dts; } -wxString mmGetNiceDateSimpleString(wxDateTime dt) +wxString mmGetNiceDateSimpleString(const wxDateTime &dt) { wxString dts = mmGetNiceMonthName(dt.GetMonth()) + wxString(wxT(" ")); dts += wxString::Format(wxT("%d"), dt.GetDay()) + wxT(", ") @@ -307,12 +307,18 @@ return dts; } -void mmShowErrorMessage(wxWindow* parent, wxString message, wxString messageheader) +void mmShowErrorMessage(wxWindow *parent, const wxString &message, const wxString &messageheader) { wxMessageDialog msgDlg(parent, message, messageheader); msgDlg.ShowModal(); } +void mmShowErrorMessageInvalid(wxWindow *parent, const wxString &message) +{ + wxString msg = _("Entry ") + message + _(" is invalid."); + mmShowErrorMessage(parent, msg, _("Invalid Entry")); +} + wxString mmNotes4ExportString(const wxString& orig) { wxString toReturn = orig; @@ -1133,17 +1139,8 @@ } -void mmShowErrorMessageInvalid(wxWindow* parent, wxString message) +wxString mmGetDateForDisplay(wxSQLite3Database* /*db*/, const wxDateTime &dt) { - wxString msg = _("Entry ") + message + _(" is invalid."); - wxMessageDialog msgDlg(parent, msg, - _("Invalid Entry")); - msgDlg.ShowModal(); -} - -/* -------------------------------------------- */ -wxString mmGetDateForDisplay(wxSQLite3Database* /*db*/, wxDateTime dt) -{ return dt.Format(mmOptions::dateFormat); } @@ -1157,7 +1154,7 @@ return dt; } -wxString mmGetDateForStorage(wxDateTime dt) +wxString mmGetDateForStorage(const wxDateTime &dt) { return dt.FormatISODate(); } @@ -1286,8 +1283,8 @@ double dummy; return modf(double(value) / mmCurrencyFormatter::scale, &dummy),dummy; } -void mmCurrencyFormatter::loadSettings(wxString pfx, wxString sfx, wxChar dec, wxChar grp, - wxString unit, wxString cent, double scale) +void mmCurrencyFormatter::loadSettings(const wxString &pfx, const wxString &sfx, wxChar dec, wxChar grp, + const wxString &unit, const wxString ¢, double scale) { pfx_symbol = pfx; sfx_symbol = sfx; Modified: trunk/mmex/src/util.h =================================================================== --- trunk/mmex/src/util.h 2009-12-06 13:05:18 UTC (rev 865) +++ trunk/mmex/src/util.h 2009-12-06 13:06:41 UTC (rev 866) @@ -32,17 +32,17 @@ double amount; }; -void mmShowErrorMessageInvalid(wxWindow* parent, wxString message); -void mmShowErrorMessage(wxWindow* parent, wxString message, wxString messageheader); +void mmShowErrorMessageInvalid(wxWindow *parent, const wxString &message); +void mmShowErrorMessage(wxWindow *parent, const wxString &message, const wxString &messageheader); wxString mmSelectLanguage(wxWindow *parent, wxSQLite3Database *inidb, bool forced_show_dlg); -wxString mmGetDateForStorage(wxDateTime dt); +wxString mmGetDateForStorage(const wxDateTime &dt); wxDateTime mmGetStorageStringAsDate(const wxString& str); -wxString mmGetDateForDisplay(wxSQLite3Database* db, wxDateTime dt); +wxString mmGetDateForDisplay(wxSQLite3Database* db, const wxDateTime &dt); wxDateTime mmParseDisplayStringToDate(wxSQLite3Database* db, const wxString& dt); -wxString mmGetNiceDateString(wxDateTime dt); -wxString mmGetNiceDateSimpleString(wxDateTime dt); +wxString mmGetNiceDateString(const wxDateTime &dt); +wxString mmGetNiceDateSimpleString(const wxDateTime &dt); wxString mmGetNiceMonthName(int month); wxString mmGetNiceShortMonthName(int month); @@ -126,7 +126,7 @@ { public: -static void loadSettings(wxString pfx, wxString sfx, wxChar dec, wxChar grp, wxString unit, wxString cent, double scale); +static void loadSettings(const wxString &pfx, const wxString &sfx, wxChar dec, wxChar grp, const wxString &unit, const wxString ¢, double scale); static void loadDefaultSettings(); static bool formatDoubleToCurrency(double val, wxString& data); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kkk...@us...> - 2009-12-06 13:07:58
|
Revision: 867 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=867&view=rev Author: kkkvadim Date: 2009-12-06 13:07:51 +0000 (Sun, 06 Dec 2009) Log Message: ----------- wxSQLite3Database::InitializeSQLite(); wxSQLite3Database::ShutdownSQLite(); Modified Paths: -------------- trunk/mmex/src/mmex.cpp trunk/mmex/src/mmex.h Modified: trunk/mmex/src/mmex.cpp =================================================================== --- trunk/mmex/src/mmex.cpp 2009-12-06 13:06:41 UTC (rev 866) +++ trunk/mmex/src/mmex.cpp 2009-12-06 13:07:51 UTC (rev 867) @@ -59,6 +59,7 @@ #include "paths.h" #include "constants.h" #include "platfdep.h" +#include "helpers.h" //---------------------------------------------------------------------------- /* Include XPM Support */ @@ -399,6 +400,18 @@ IMPLEMENT_APP(mmGUIApp) //---------------------------------------------------------------------------- +mmGUIApp::SQLiteInit::SQLiteInit() +{ + wxSQLite3Database::InitializeSQLite(); +} +//---------------------------------------------------------------------------- + +mmGUIApp::SQLiteInit::~SQLiteInit() +{ + wxSQLite3Database::ShutdownSQLite(); +} +//---------------------------------------------------------------------------- + /* Class used to store item specific information in a tree node */ @@ -2194,7 +2207,7 @@ menuFile_->Append(menuItemSaveAs); menuFile_->AppendSeparator(); - + // Create the recently used files list recentMenu_ = new wxMenu; RecentFilesMenu(); @@ -2627,6 +2640,7 @@ } } +//---------------------------------------------------------------------------- void mmGUIFrame::RecentFilesMenu() { @@ -2738,69 +2752,71 @@ void mmGUIFrame::OnOpen(wxCommandEvent& /*event*/) { wxString fileName = wxFileSelector(_("Choose database file to open"), - wxGetEmptyString(), - wxGetEmptyString(), - wxGetEmptyString(), + 0, 0, 0, wxT("MMB Files(*.mmb)|*.mmb|Encrypted MMB files (*.emb)|*.emb"), - wxFILE_MUST_EXIST + wxFILE_MUST_EXIST, + this ); if (!fileName.empty()) { openFile(fileName, false); } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnOpenRecent(wxCommandEvent& event) { - wxString rfq; - rfq.Printf(wxT("FILEHIST%d"),event.GetId()-MENU_RECENT); - wxString fileName = mmDBWrapper::getINISettingValue(inidb_.get(), rfq, wxGetEmptyString()); - openFile(fileName, false); + wxString s; + s.Printf(wxT("FILEHIST%d"),event.GetId()-MENU_RECENT); + + wxString fileName = mmDBWrapper::getINISettingValue(inidb_.get(), s); + + if (!fileName.empty()) { + openFile(fileName, false); + } } - //---------------------------------------------------------------------------- void mmGUIFrame::OnConvertEncryptedDB(wxCommandEvent& /*event*/) { - wxString extSupported = wxT("Encrypted MMB files (*.emb)|*.emb"); wxString encFileName = wxFileSelector(_("Choose Encrypted database file to open"), - wxGetEmptyString(), wxGetEmptyString(), wxGetEmptyString(), extSupported, wxFILE_MUST_EXIST); - if ( !encFileName.empty() ) - { - wxString password = wxGetPasswordFromUser(_("Enter password for database")); - if (!password.IsEmpty()) - { - wxString wildCardStr = wxT("MMB Files(*.mmb)|*.mmb"); - wxFileDialog dlg(this, _("Choose database file to Save As"), - wxGetEmptyString(), wxGetEmptyString(), wildCardStr, wxSAVE | wxOVERWRITE_PROMPT); - - if(dlg.ShowModal() == wxID_OK) - { - wxString fileName = dlg.GetPath(); - if (!dlg.GetPath().Contains(wxT(".mmb"))) - fileName = dlg.GetPath() + wxT(".mmb"); + 0, 0, 0, + wxT("Encrypted MMB files (*.emb)|*.emb"), + wxFILE_MUST_EXIST, + this + ); - wxCopyFile(encFileName, fileName, false); + if (encFileName.empty()) + return; + + wxString password = wxGetPasswordFromUser(_("Enter password for database")); + if (password.empty()) + return; + + wxFileDialog dlg(this, + _("Choose database file to Save As"), + wxGetEmptyString(), + wxGetEmptyString(), + wxT("MMB Files(*.mmb)|*.mmb"), + wxSAVE | wxOVERWRITE_PROMPT + ); - try - { - boost::shared_ptr<wxSQLite3Database> pDB(new wxSQLite3Database()); - pDB->Open(fileName, password); + if(dlg.ShowModal() != wxID_OK) + return; + + wxString fileName = dlg.GetPath(); + + if (!dlg.GetPath().EndsWith(wxT(".mmb"))) + fileName += wxT(".mmb"); - pDB->ReKey(wxEmptyString); - pDB->Close(); - mmShowErrorMessage(0, _("Converted DB!"), - _("MMEX message")); + wxCopyFile(encFileName, fileName); - } - catch(...) - { - mmShowErrorMessage(0, _("Unable to convert db successfully. Check Password!"), - _("Error")); - } - } - } - } + wxSQLite3Database db; + db.Open(fileName, password); + db.ReKey(wxEmptyString); + db.Close(); + + mmShowErrorMessage(this, _("Converted DB!"), _("MMEX message")); } //---------------------------------------------------------------------------- @@ -2917,9 +2933,8 @@ return; } - mmUnivCSVImportDialog *dlg = new mmUnivCSVImportDialog(core_.get(), this); + boost::shared_ptr<mmUnivCSVImportDialog> dlg(new mmUnivCSVImportDialog(core_.get(), this), mmex::Destroy); dlg->ShowModal(); - dlg->Destroy(); } //---------------------------------------------------------------------------- Modified: trunk/mmex/src/mmex.h =================================================================== --- trunk/mmex/src/mmex.h 2009-12-06 13:06:41 UTC (rev 866) +++ trunk/mmex/src/mmex.h 2009-12-06 13:07:51 UTC (rev 867) @@ -56,6 +56,14 @@ wxLocale& getLocale() { return m_locale; } private: + + struct SQLiteInit { + SQLiteInit(); + ~SQLiteInit(); + }; + + SQLiteInit m_sqlite_init; + wxLocale m_locale; // locale we'll be using bool OnInit(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kkk...@us...> - 2009-12-12 12:03:13
|
Revision: 871 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=871&view=rev Author: kkkvadim Date: 2009-12-12 12:03:03 +0000 (Sat, 12 Dec 2009) Log Message: ----------- minor changes Modified Paths: -------------- trunk/mmex/src/chart.h trunk/mmex/src/htmlbuilder.h Modified: trunk/mmex/src/chart.h =================================================================== --- trunk/mmex/src/chart.h 2009-12-12 12:01:11 UTC (rev 870) +++ trunk/mmex/src/chart.h 2009-12-12 12:03:03 UTC (rev 871) @@ -9,7 +9,7 @@ class ChartData { public: - ChartData(const wxString &aKey, float aVal = 0.0); + ChartData(const wxString &aKey, float aVal = 0); ChartData(const wxString &aKey, const std::vector<float> &aSerie); wxString key; @@ -74,7 +74,7 @@ PieChart(int aWidth, int aHeight); void Init(int aChartsize, EChartLegend aLegendMode = CHART_LEGEND_FIXED, EPieChartStyle aPieMode = PIE_CHART_PERCENT); - bool Render(const wxString& title = wxT("")); + bool Render(const wxString& title = wxGetEmptyString()); private: int csize; @@ -91,7 +91,7 @@ BarChart(int aWidth, int aHeight); void Init(int aChartsize, EChartLegend aLegendMode = CHART_LEGEND_FIXED, EBarChartStyle aMode = BAR_CHART_SIMPLE); - bool Render(const wxString& title = wxT("")); + bool Render(const wxString& title = wxGetEmptyString()); private: int csize; Modified: trunk/mmex/src/htmlbuilder.h =================================================================== --- trunk/mmex/src/htmlbuilder.h 2009-12-12 12:01:11 UTC (rev 870) +++ trunk/mmex/src/htmlbuilder.h 2009-12-12 12:03:03 UTC (rev 871) @@ -96,13 +96,11 @@ void endTable(); void endTableRow(); - void endTableCell(); + void endTableCell(); - wxString getHTMLText() { - return html; - } + wxString getHTMLText() const { return html; } - void addHTML(const wxString& raw) { html += raw; } + void addHTML(const wxString& raw) { html += raw; } private: wxString html; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kkk...@us...> - 2009-12-12 12:05:01
|
Revision: 872 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=872&view=rev Author: kkkvadim Date: 2009-12-12 12:04:53 +0000 (Sat, 12 Dec 2009) Log Message: ----------- - ID_PANEL_CHECKING_STATIC_DETAILS unnecessary notes removed on the bottom of the main screen Modified Paths: -------------- trunk/mmex/src/assetspanel.cpp trunk/mmex/src/billsdepositspanel.cpp trunk/mmex/src/guiid.h trunk/mmex/src/mmcheckingpanel.cpp trunk/mmex/src/mmhomepagepanel.cpp trunk/mmex/src/stockspanel.cpp Modified: trunk/mmex/src/assetspanel.cpp =================================================================== --- trunk/mmex/src/assetspanel.cpp 2009-12-12 12:03:03 UTC (rev 871) +++ trunk/mmex/src/assetspanel.cpp 2009-12-12 12:04:53 UTC (rev 872) @@ -193,10 +193,6 @@ itemButton7->SetToolTip(_("Delete Asset")); itemBoxSizer5->Add(itemButton7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); itemButton7->Enable(false); - - wxStaticText* itemStaticText11 = new wxStaticText( itemPanel12, - ID_PANEL_CHECKING_STATIC_DETAILS, wxT(""), wxDefaultPosition, wxDefaultSize, wxNO_BORDER ); - itemBoxSizer4->Add(itemStaticText11, 1, wxGROW|wxALL, 5); } void mmAssetsPanel::initVirtualListControl() Modified: trunk/mmex/src/billsdepositspanel.cpp =================================================================== --- trunk/mmex/src/billsdepositspanel.cpp 2009-12-12 12:03:03 UTC (rev 871) +++ trunk/mmex/src/billsdepositspanel.cpp 2009-12-12 12:04:53 UTC (rev 872) @@ -49,6 +49,19 @@ EVT_LIST_KEY_DOWN(ID_PANEL_BD_LISTCTRL, billsDepositsListCtrl::OnListKeyDown) END_EVENT_TABLE() /*******************************************************/ + +namespace +{ + +inline bool sortTransactionsByRemainingDays(const mmBDTransactionHolder &p1, const mmBDTransactionHolder &p2) +{ + return p1.daysRemaining_ < p2.daysRemaining_; +} + +} // namespace + + + mmBillsDepositsPanel::mmBillsDepositsPanel(wxSQLite3Database* db, wxSQLite3Database* inidb, mmCoreDB* core, wxWindow *parent, @@ -230,18 +243,8 @@ itemButton8->SetToolTip(_("Enter Next Bills && Deposit Occurrence")); itemBoxSizer5->Add(itemButton8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); itemButton8->Enable(false); - - wxStaticText* itemStaticText11 = new wxStaticText( itemPanel12, - ID_PANEL_CHECKING_STATIC_DETAILS, wxT(""), wxDefaultPosition, wxDefaultSize, wxNO_BORDER ); - itemBoxSizer4->Add(itemStaticText11, 1, wxGROW|wxALL, 5); } -bool sortTransactionsByRemainingDays( mmBDTransactionHolder elem1, mmBDTransactionHolder elem2 ) -{ - return elem1.daysRemaining_ < elem2.daysRemaining_; -} - - void mmBillsDepositsPanel::initVirtualListControl() { static const char sql[] = @@ -381,18 +384,6 @@ std::sort(trans_.begin(), trans_.end(), sortTransactionsByRemainingDays); listCtrlAccount_->SetItemCount(static_cast<long>(trans_.size())); - - // set an empty text for Bottom Info Panel - - wxString text(_("Category : ")); - text += wxT("\n"); - text += _("Sub Category : "); - text += wxT("\n"); - text += _("Notes : "); - - wxStaticText* st = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_DETAILS); - wxASSERT(st); - st->SetLabel(text); } void mmBillsDepositsPanel::OnDeleteBDSeries(wxCommandEvent& event) @@ -612,29 +603,7 @@ void mmBillsDepositsPanel::updateBottomPanelData(int selIndex) { - // Get the items we need to change - wxStaticText* st = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_DETAILS); - wxString text; - if (selIndex!=-1) - { - enableEditDeleteButtons(true); - text += _("Category : "); - text += trans_[selIndex].categoryStr_; - text += wxT("\n"); - text += _("Sub Category : "); - text += trans_[selIndex].subcategoryStr_; - text += wxT("\n"); - text += _("Notes : "); - text += trans_[selIndex].notesStr_; -// text += wxT("\n"); - } - else - { - enableEditDeleteButtons(false); - text = wxT(""); - } - - st->SetLabel(text); + enableEditDeleteButtons(selIndex >= 0); } void mmBillsDepositsPanel::enableEditDeleteButtons(bool en) Modified: trunk/mmex/src/guiid.h =================================================================== --- trunk/mmex/src/guiid.h 2009-12-12 12:03:03 UTC (rev 871) +++ trunk/mmex/src/guiid.h 2009-12-12 12:04:53 UTC (rev 872) @@ -157,7 +157,6 @@ ID_PANEL_CHECKING_STATIC_HEADER, ID_PANEL_CHECKING_STATIC_BALHEADER, ID_PANEL_CHECKING_LISTCTRL_ACCT, - ID_PANEL_CHECKING_STATIC_DETAILS, ID_PANEL_CHECKING_STATIC_BITMAP_VIEW, ID_PANEL_CHECKING_STATIC_PANELVIEW, Modified: trunk/mmex/src/mmcheckingpanel.cpp =================================================================== --- trunk/mmex/src/mmcheckingpanel.cpp 2009-12-12 12:03:03 UTC (rev 871) +++ trunk/mmex/src/mmcheckingpanel.cpp 2009-12-12 12:04:53 UTC (rev 872) @@ -127,8 +127,7 @@ long width = -1; - if (val.ToLong(&width)) - { + if (val.ToLong(&width)) { lst.SetColumnWidth(i, width); } } @@ -489,8 +488,7 @@ } //---------------------------------------------------------------------------- -bool mmCheckingPanel::Create -( +bool mmCheckingPanel::Create( wxWindow *parent, wxWindowID winid, const wxPoint& pos, const wxSize& size,long style, const wxString& name @@ -676,41 +674,45 @@ m_listCtrlAccount->setColumnImage(m_listCtrlAccount->getSortColumn(), m_listCtrlAccount->getSortOrder() ? ICON_ASC : ICON_DESC); // asc\desc sort mark (arrow) } - wxPanel* itemPanel12 = new wxPanel( itemSplitterWindow10, ID_PANEL1, - wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL ); + wxPanel *itemPanel12 = new wxPanel(itemSplitterWindow10, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL); + itemPanel12->SetBackgroundColour(mmColors::listDetailsPanelColor); itemSplitterWindow10->SplitHorizontally(m_listCtrlAccount, itemPanel12); - itemSplitterWindow10->SetMinimumPaneSize(100); + itemSplitterWindow10->SetMinimumPaneSize(itemPanel12->GetSize().GetHeight()); itemSplitterWindow10->SetSashGravity(1.0); + itemBoxSizer9->Add(itemSplitterWindow10, 1, wxGROW|wxALL, 1); - wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL); - itemPanel12->SetSizer(itemBoxSizer4); - itemPanel12->SetBackgroundColour(mmColors::listDetailsPanelColor); - wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer4->Add(itemBoxSizer5, 0, wxALIGN_LEFT|wxALL, 5); + itemPanel12->SetSizer(itemBoxSizer5); - wxButton* itemButton6 = new wxButton( itemPanel12, ID_BUTTON_NEW_TRANS, _("&New"), - wxDefaultPosition, wxDefaultSize, 0 ); + wxSizerFlags flags; + flags.Center().Border().Expand().Proportion(1); + + wxButton* itemButton6 = new wxButton(itemPanel12, ID_BUTTON_NEW_TRANS, _("&New")); itemButton6->SetToolTip(_("New Transaction")); - itemBoxSizer5->Add(itemButton6, 0, wxGROW|wxALL, 1); - wxButton* itemButton7 = new wxButton( itemPanel12, ID_BUTTON_EDIT_TRANS, _("&Edit"), - wxDefaultPosition, wxDefaultSize, 0 ); + wxFont fnt = itemButton6->GetFont(); + fnt.SetWeight(wxFONTWEIGHT_BOLD); + fnt.SetPointSize(fnt.GetPointSize()*3/2); + + itemButton6->SetFont(fnt); + itemButton6->SetForegroundColour(wxColour(wxT("FOREST GREEN"))); + itemBoxSizer5->Add(itemButton6, flags); + + wxButton* itemButton7 = new wxButton(itemPanel12, ID_BUTTON_EDIT_TRANS, _("&Edit")); itemButton7->SetToolTip(_("Edit Transaction")); - itemBoxSizer5->Add(itemButton7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); - itemButton7->Enable(false); + itemButton7->SetFont(fnt); + itemButton7->SetForegroundColour(wxColour(wxT("SALMON"))); + itemBoxSizer5->Add(itemButton7, flags); + itemButton7->Enable(false); - wxButton* itemButton8 = new wxButton( itemPanel12, ID_BUTTON_DELETE_TRANS, _("&Delete"), - wxDefaultPosition, wxDefaultSize, 0 ); + wxButton* itemButton8 = new wxButton(itemPanel12, ID_BUTTON_DELETE_TRANS, _("&Delete")); itemButton8->SetToolTip(_("Delete Transaction")); - itemBoxSizer5->Add(itemButton8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); + itemButton8->SetFont(fnt); + itemButton8->SetForegroundColour(wxColour(wxT("ORANGE"))); // FIREBRICK + itemBoxSizer5->Add(itemButton8, flags); itemButton8->Enable(false); - - wxStaticText* itemStaticText11 = new wxStaticText( itemPanel12, - ID_PANEL_CHECKING_STATIC_DETAILS, wxT(""), wxDefaultPosition, wxDefaultSize, wxNO_BORDER ); - itemBoxSizer4->Add(itemStaticText11, 1, wxGROW|wxALL, 5); } //---------------------------------------------------------------------------- @@ -721,26 +723,11 @@ bE->Enable(en); bD->Enable(en); } +//---------------------------------------------------------------------------- void mmCheckingPanel::updateExtraTransactionData(int selIndex) { - // Get the items we need to change - wxStaticText* st = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_DETAILS); - wxString text; - if (selIndex!=-1) - { - enableEditDeleteButtons(true); - wxString cat = _("Category : ") + m_trans[selIndex]->catStr_ + wxT("\n"); - wxString subcat = _("Sub Category : ") + m_trans[selIndex]->subCatStr_ + wxT("\n"); - wxString notes = _("Notes : ") + mmReadyDisplayString(m_trans[selIndex]->notes_) + wxT("\n"); - text = cat + subcat + notes; - } - else - { - enableEditDeleteButtons(false); - text = wxT(""); - } - st->SetLabel(text); + enableEditDeleteButtons(selIndex >= 0); } //---------------------------------------------------------------------------- @@ -788,15 +775,6 @@ setAccountSummary(); - wxString text; - text += _("Category : "); - text += wxT("\n"); - text += _("Sub Category : "); - text += wxT("\n"); - text += _("Notes : "); - wxStaticText* st = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_DETAILS); - st->SetLabel(text); - int numTransactions = 0; double unseenBalance = 0.0; for (size_t i = 0; i < m_core->bTransactionList_.transactions_.size(); ++i) Modified: trunk/mmex/src/mmhomepagepanel.cpp =================================================================== --- trunk/mmex/src/mmhomepagepanel.cpp 2009-12-12 12:03:03 UTC (rev 871) +++ trunk/mmex/src/mmhomepagepanel.cpp 2009-12-12 12:04:53 UTC (rev 872) @@ -53,7 +53,7 @@ struct CurrencyCompare : public std::binary_function<boost::shared_ptr<mmCurrency>, boost::shared_ptr<mmCurrency>, bool> { - bool operator() (boost::shared_ptr<mmCurrency> _Left, boost::shared_ptr<mmCurrency> _Right) const + bool operator() (const boost::shared_ptr<mmCurrency> &_Left, const boost::shared_ptr<mmCurrency> &_Right) const { return _Left->currencyName_ < _Right->currencyName_; // order by currency name } Modified: trunk/mmex/src/stockspanel.cpp =================================================================== --- trunk/mmex/src/stockspanel.cpp 2009-12-12 12:03:03 UTC (rev 871) +++ trunk/mmex/src/stockspanel.cpp 2009-12-12 12:04:53 UTC (rev 872) @@ -292,10 +292,6 @@ wxDefaultPosition, wxDefaultSize, 0 ); itemButton9->SetToolTip(_("Change settings for automatic refresh")); itemBoxSizer5->Add(itemButton9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); - - wxStaticText* itemStaticText11 = new wxStaticText( itemPanel12, - ID_PANEL_CHECKING_STATIC_DETAILS, wxT(""), wxDefaultPosition, wxDefaultSize, wxNO_BORDER ); - itemBoxSizer4->Add(itemStaticText11, 1, wxGROW|wxALL, 5); } void mmStocksPanel::initVirtualListControl() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |