From: <vo...@us...> - 2012-07-09 07:27:33
|
Revision: 2711 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2711&view=rev Author: vomikan Date: 2012-07-09 07:27:23 +0000 (Mon, 09 Jul 2012) Log Message: ----------- update Modified Paths: -------------- branches/0.9.9.0/mmex/src/budgetingpanel.cpp branches/0.9.9.0/mmex/src/budgetingpanel.h Modified: branches/0.9.9.0/mmex/src/budgetingpanel.cpp =================================================================== --- branches/0.9.9.0/mmex/src/budgetingpanel.cpp 2012-07-08 20:42:33 UTC (rev 2710) +++ branches/0.9.9.0/mmex/src/budgetingpanel.cpp 2012-07-09 07:27:23 UTC (rev 2711) @@ -44,6 +44,7 @@ BEGIN_EVENT_TABLE(budgetingListCtrl, wxListCtrl) EVT_LIST_ITEM_SELECTED(ID_PANEL_CHECKING_LISTCTRL_ACCT, budgetingListCtrl::OnListItemSelected) EVT_LIST_ITEM_ACTIVATED(ID_PANEL_CHECKING_LISTCTRL_ACCT, budgetingListCtrl::OnListItemActivated) + EVT_LIST_COL_END_DRAG(ID_PANEL_CHECKING_LISTCTRL_ACCT, budgetingListCtrl::OnItemResize) END_EVENT_TABLE() /*******************************************************/ mmBudgetingPanel::mmBudgetingPanel(wxSQLite3Database* db, wxSQLite3Database* inidb, mmCoreDB* core, mmGUIFrame* mainFrame, int budgetYearID, wxWindow *parent, @@ -81,22 +82,22 @@ mmBudgetingPanel::~mmBudgetingPanel() { if (m_imageList) delete m_imageList; +} +void mmBudgetingPanel::save_column_width(const int width) +{ inidb_->Begin(); - for (int i = 0; i < listCtrlBudget_->GetColumnCount(); ++i) - { - mmDBWrapper::setINISettingValue(inidb_, - wxString::Format(wxT("BUDGET_COL%d_WIDTH"), i), - wxString::Format(wxT("%d"), listCtrlBudget_->GetColumnWidth(i))); - } + int col_x = listCtrlBudget_->GetColumnWidth(width); + mmDBWrapper::setINISettingValue(inidb_, + wxString::Format(wxT("BUDGET_COL%d_WIDTH"), width), + wxString::Format(wxT("%d"),col_x)); inidb_->Commit(); } void mmBudgetingPanel::OnViewPopupSelected(wxCommandEvent& event) { int evt = event.GetId(); - wxStaticText* header = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_PANELVIEW); - if (evt == MENU_VIEW_ALLBUDGETENTRIES) + if (evt == MENU_VIEW_ALLBUDGETENTRIES) currentView_ = wxTRANSLATE("View All Budget Categories"); else if (evt == MENU_VIEW_NONZEROBUDGETENTRIES) currentView_ = wxTRANSLATE("View Non-Zero Budget Categories"); @@ -109,11 +110,13 @@ else wxASSERT(false); - header->SetLabel(wxGetTranslation(wxT("View Budget Category Summary"))); + wxStaticText* header = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_PANELVIEW); + header->SetLabel(wxGetTranslation(wxTRANSLATE("View Budget Category Summary"))); listCtrlBudget_->DeleteAllItems(); initVirtualListControl(); - listCtrlBudget_->RefreshItems(0, ((int)trans_.size()) - 1); + if (trans_.size()>0) + listCtrlBudget_->RefreshItems(0, (static_cast<long>(trans_.size()-1))); } void mmBudgetingPanel::OnMouseLeftDown( wxMouseEvent& event ) @@ -192,45 +195,43 @@ _("Viewing All Budget Categories")); itemBoxSizerHHeader2->Add(itemStaticText18, 0, wxALL, 1); - wxSize distSize(250, 20); + wxFlexGridSizer* itemIncomeSizer = new wxFlexGridSizer(0,8,5,10); + itemBoxSizerVHeader->Add(itemIncomeSizer); - wxStaticText* itemStaticText100 = new wxStaticText( itemPanel3, wxID_ANY, _("Income......."), - wxDefaultPosition, wxSize(75, 20), 0 ); + wxStaticText* itemStaticText11 = new wxStaticText( itemPanel3, + wxID_ANY, _("Income.......")); + wxStaticText* itemStaticText12 = new wxStaticText( itemPanel3, + ID_DIALOG_BUDGETENTRY_SUMMARY_INCOME_EST, _("Estimated: ")); + wxStaticText* itemStaticText13 = new wxStaticText( itemPanel3, + ID_DIALOG_BUDGETENTRY_SUMMARY_INCOME_ACT, _("Actual: ")); + wxStaticText* itemStaticText14 = new wxStaticText( itemPanel3, + ID_DIALOG_BUDGETENTRY_SUMMARY_INCOME_DIF, _("Difference: ")); - wxStaticText* itemStaticText101 = new wxStaticText( itemPanel3, - ID_DIALOG_BUDGETENTRY_SUMMARY_INCOME_EST, _("Estimated: "), wxDefaultPosition, distSize, 0); + wxStaticText* itemStaticText21 = new wxStaticText( itemPanel3, wxID_ANY, _("Expenses...")); + wxStaticText* itemStaticText22 = new wxStaticText( itemPanel3, + ID_DIALOG_BUDGETENTRY_SUMMARY_EXPENSES_EST, _("Estimated: ")); + wxStaticText* itemStaticText23 = new wxStaticText( itemPanel3, + ID_DIALOG_BUDGETENTRY_SUMMARY_EXPENSES_ACT, _("Actual: ")); + wxStaticText* itemStaticText24 = new wxStaticText( itemPanel3, + ID_DIALOG_BUDGETENTRY_SUMMARY_EXPENSES_DIF, _("Difference: ")); - wxStaticText* itemStaticText102 = new wxStaticText( itemPanel3, - ID_DIALOG_BUDGETENTRY_SUMMARY_INCOME_ACT, _("Actual: "), wxDefaultPosition, distSize, 0); + itemIncomeSizer->Add(itemStaticText11); + itemIncomeSizer->Add(itemStaticText12); + itemIncomeSizer->AddSpacer(20); + itemIncomeSizer->AddSpacer(20); + itemIncomeSizer->Add(itemStaticText13); + itemIncomeSizer->AddSpacer(20); + itemIncomeSizer->AddSpacer(20); + itemIncomeSizer->Add(itemStaticText14); - wxStaticText* itemStaticText103 = new wxStaticText( itemPanel3, - ID_DIALOG_BUDGETENTRY_SUMMARY_INCOME_DIF, _("Difference: "), wxDefaultPosition, distSize, 0); - - wxBoxSizer* itemIncomeSizer = new wxBoxSizer(wxHORIZONTAL); - itemIncomeSizer->Add(itemStaticText100, 0, wxALL, 0); - itemIncomeSizer->Add(itemStaticText101, 0, wxALL, 0); - itemIncomeSizer->Add(itemStaticText102, 0, wxALL, 0); - itemIncomeSizer->Add(itemStaticText103, 0, wxALL, 0); - itemBoxSizerVHeader->Add(itemIncomeSizer, 0, wxALL, 1); - - wxStaticText* itemStaticText200 = new wxStaticText( itemPanel3, wxID_ANY, _("Expenses..."), - wxDefaultPosition, wxSize(75, 20), 0 ); - - wxStaticText* itemStaticText201 = new wxStaticText( itemPanel3, - ID_DIALOG_BUDGETENTRY_SUMMARY_EXPENSES_EST, _("Estimated: "), wxDefaultPosition, distSize, 0); - - wxStaticText* itemStaticText202 = new wxStaticText( itemPanel3, - ID_DIALOG_BUDGETENTRY_SUMMARY_EXPENSES_ACT, _("Actual: "), wxDefaultPosition, distSize, 0); - - wxStaticText* itemStaticText203 = new wxStaticText( itemPanel3, - ID_DIALOG_BUDGETENTRY_SUMMARY_EXPENSES_DIF, _("Difference: "), wxDefaultPosition, distSize, 0); - - wxBoxSizer* itemExpenseSizer = new wxBoxSizer(wxHORIZONTAL); - itemExpenseSizer->Add(itemStaticText200, 0, wxALL, 0); - itemExpenseSizer->Add(itemStaticText201, 0, wxALL, 0); - itemExpenseSizer->Add(itemStaticText202, 0, wxALL, 0); - itemExpenseSizer->Add(itemStaticText203, 0, wxALL, 0); - itemBoxSizerVHeader->Add(itemExpenseSizer, 0, wxALL, 1); + itemIncomeSizer->Add(itemStaticText21); + itemIncomeSizer->Add(itemStaticText22); + itemIncomeSizer->AddSpacer(20); + itemIncomeSizer->AddSpacer(20); + itemIncomeSizer->Add(itemStaticText23); + itemIncomeSizer->AddSpacer(20); + itemIncomeSizer->AddSpacer(20); + itemIncomeSizer->Add(itemStaticText24); /* ---------------------- */ wxSize imageSize(16, 16); @@ -493,6 +494,11 @@ } /*******************************************************/ +void budgetingListCtrl::OnItemResize(wxListEvent& event) +{ + cp_->save_column_width(event.GetColumn()); +} + void budgetingListCtrl::OnListItemSelected(wxListEvent& event) { selectedIndex_ = event.GetIndex(); Modified: branches/0.9.9.0/mmex/src/budgetingpanel.h =================================================================== --- branches/0.9.9.0/mmex/src/budgetingpanel.h 2012-07-08 20:42:33 UTC (rev 2710) +++ branches/0.9.9.0/mmex/src/budgetingpanel.h 2012-07-09 07:27:23 UTC (rev 2711) @@ -59,9 +59,9 @@ void OnItemRightClick(wxListEvent& event); void OnListItemSelected(wxListEvent& event); void OnListItemActivated(wxListEvent& event); - private: + void OnItemResize(wxListEvent& event); wxListItemAttr attr1_; // style1 wxListItemAttr attr2_; // style2 wxListItemAttr attr3_; // style3 @@ -124,6 +124,7 @@ void OnEditTransaction(wxCommandEvent& event); void OnViewPopupSelected(wxCommandEvent& event); void OnMouseLeftDown( wxMouseEvent& event ); + void save_column_width(const int width); std::vector<mmBudgetEntryHolder> trans_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |