Fix a lot of bugs :

*  Missing center in PreferencesPanel for categories suppression
*  Previous not checked operations needs to be inverted (positive if negative, and negative if positive)
*  New operation needs to be sorted before insertion in InsertIntoGrid (GridAccount.cpp)
This commit is contained in:
Grégory Soutadé 2010-10-27 21:01:32 +02:00
parent 6568acbae7
commit c3ecedb2c1
3 changed files with 25 additions and 6 deletions

View File

@ -503,12 +503,12 @@ void AccountPanel::UpdateStats()
value = _accountsInitValues[accountIt->id]; value = _accountsInitValues[accountIt->id];
value2 = (*notChecked)[accountIt->id]; value2 = (*notChecked)[accountIt->id];
_accountsGrid->SetCellValue(i, ACCOUNT_INIT, wxString::Format(wxT("%.2lf (%.2lf)"), value, value+value2)); _accountsGrid->SetCellValue(i, ACCOUNT_INIT, wxString::Format(wxT("%.2lf (%.2lf)"), value, value-value2));
value = curAccountAmount[accountIt->id]; value = curAccountAmount[accountIt->id];
_accountsGrid->SetCellValue(i, ACCOUNT_CUR, wxString::Format(wxT("%.2lf (%.2lf)"), value, value+value2)); _accountsGrid->SetCellValue(i, ACCOUNT_CUR, wxString::Format(wxT("%.2lf (%.2lf)"), value, value-value2));
_accountsGrid->SetCellTextColour(i, ACCOUNT_CUR, (value >= 0.0) ? wxColor(0x00, 0x00, 0x00) : wxColor(0xFF, 0x00, 0x00)); _accountsGrid->SetCellTextColour(i, ACCOUNT_CUR, (value >= 0.0) ? wxColor(0x00, 0x00, 0x00) : wxColor(0xFF, 0x00, 0x00));
value = finalAccountAmount[accountIt->id]; value = finalAccountAmount[accountIt->id];
_accountsGrid->SetCellValue(i, ACCOUNT_FINAL, wxString::Format(wxT("%.2lf (%.2lf)"), value, value+value2)); _accountsGrid->SetCellValue(i, ACCOUNT_FINAL, wxString::Format(wxT("%.2lf (%.2lf)"), value, value-value2));
} }
} }

View File

@ -273,6 +273,8 @@ void PreferencesPanel::InitCategories(User* user)
wxFont font = user->GetCategoryFont(it->id); wxFont font = user->GetCategoryFont(it->id);
SET_ROW_FONT(curLine, font); SET_ROW_FONT(curLine, font);
} }
_categoriesGrid->SetCellAlignment(curLine, CATEGORY_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE);
} }
_categoriesGrid->SetReadOnly(0, CATEGORY_NAME, true); _categoriesGrid->SetReadOnly(0, CATEGORY_NAME, true);

View File

@ -440,7 +440,7 @@ void GridAccount::DeleteOperation(const Operation& op)
void GridAccount::InsertIntoGrid(Operation& op) void GridAccount::InsertIntoGrid(Operation& op)
{ {
int i; int i, a;
User* user = _kiss->GetUser(); User* user = _kiss->GetUser();
for(i=0; i<(int)_displayedOperations.size(); i++) for(i=0; i<(int)_displayedOperations.size(); i++)
@ -468,9 +468,24 @@ void GridAccount::InsertIntoGrid(Operation& op)
else if (!(_displayedOperations)[i].fix_cost && op.fix_cost) else if (!(_displayedOperations)[i].fix_cost && op.fix_cost)
i --; i --;
_operations->push_back(op); for (a=0; a<(int)_operations->size(); a++)
{
if ((*_operations)[a].fix_cost && !op.fix_cost) continue;
if (!(*_operations)[a].fix_cost && op.fix_cost)
{
a--;
break;
}
if ((*_operations)[a].day > op.day)
{
a--;
break;
}
}
InsertOperationWithWeek(user, (*_operations)[_operations->size()-1], i, op.fix_cost, _curMonth, _curYear); _operations->insert(_operations->begin()+a, op);
InsertOperationWithWeek(user, (*_operations)[a], i, op.fix_cost, _curMonth, _curYear);
} }
void GridAccount::RemoveMeta(Operation& op, int line, bool removeRoot, bool deleteOp) void GridAccount::RemoveMeta(Operation& op, int line, bool removeRoot, bool deleteOp)
@ -1234,6 +1249,8 @@ void GridAccount::Group()
UpdateMeta(op); UpdateMeta(op);
InsertIntoGrid(op); InsertIntoGrid(op);
UpdateOperation(op);
} }