From effc630650deac0886e8badfa8967e1f1d2d52d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 10 Oct 2010 21:34:37 +0200 Subject: [PATCH] * Fix a bug due to formulas (impossible to add a new operation) --- src/view/grid/GridAccount.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index c0935ce..d7756ba 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -302,6 +302,9 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix, _fixCosts++; } + SetCellEditor(line, DEBIT, new wxGridCellFormulaEditor(op.formula)); + SetCellEditor(line, CREDIT, new wxGridCellFormulaEditor(op.formula)); + if (op.id.Length()) { cat = user->GetCategory(op.category); @@ -316,9 +319,6 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix, else SetCellValue(line, CREDIT, wxString::Format(wxT("%.2lf"), op.amount)); - SetCellEditor(line, DEBIT, new wxGridCellFormulaEditor(op.formula)); - SetCellEditor(line, CREDIT, new wxGridCellFormulaEditor(op.formula)); - if (!op.meta) SetCellValue(line, ACCOUNT, user->GetAccountName(op.account)); if (!fix && !op.meta) @@ -638,7 +638,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) value.ToDouble(&new_op.amount); new_op.amount *= -1.0; op_complete--; - wxGridCellFormulaEditor* pEditor = (wxGridCellFormulaEditor*) GetCellEditor(row, col); + wxGridCellFormulaEditor* pEditor = (wxGridCellFormulaEditor*) GetCellEditor(row, DEBIT); new_op.formula = pEditor->GetFormula(); pEditor->DecRef(); } @@ -648,7 +648,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) { value.ToDouble(&new_op.amount); op_complete--; - wxGridCellFormulaEditor* pEditor = (wxGridCellFormulaEditor*) GetCellEditor(row, col); + wxGridCellFormulaEditor* pEditor = (wxGridCellFormulaEditor*) GetCellEditor(row, CREDIT); new_op.formula = pEditor->GetFormula(); pEditor->DecRef(); }