Fix a bug with category font/color on new operation insertion
This commit is contained in:
parent
41ace4621e
commit
67d3275b28
|
@ -277,9 +277,15 @@ void AccountPanel::LoadYear(int year, bool showMonth)
|
||||||
_wxUI->Layout();
|
_wxUI->Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SET_ROW_COLOR(row, color) for(int i=0; i<NUMBER_COLS_OPS; i++) \
|
#define SET_ROW_COLOR(row, backcolor, forecolor) for(int i=0; i<NUMBER_COLS_OPS; i++) \
|
||||||
{ \
|
{ \
|
||||||
_grid->SetCellBackgroundColour(row, i, color); \
|
_grid->SetCellBackgroundColour(row, i, backcolor); \
|
||||||
|
_grid->SetCellTextColour(row, i, forecolor); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SET_ROW_FONT(row, font) for(int i=0; i<NUMBER_COLS_OPS; i++) \
|
||||||
|
{ \
|
||||||
|
_grid->SetCellFont(row, i, font); \
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountPanel::ShowMonth(int month, int year)
|
void AccountPanel::ShowMonth(int month, int year)
|
||||||
|
@ -667,7 +673,8 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
||||||
color.Set(r, g, b, color.Alpha());
|
color.Set(r, g, b, color.Alpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_ROW_COLOR(event.GetRow(), color);
|
SET_ROW_COLOR(event.GetRow(), color, user->GetCategory(new_op.category).forecolor);
|
||||||
|
SET_ROW_FONT(event.GetRow(), user->GetCategoryFont(new_op.category));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (col == DELETE)
|
if (col == DELETE)
|
||||||
|
@ -733,6 +740,12 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
||||||
if (i == CATEGORY) continue;
|
if (i == CATEGORY) continue;
|
||||||
_grid->SetCellValue(event.GetRow(), i, wxT(""));
|
_grid->SetCellValue(event.GetRow(), i, wxT(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFAULT_FONT(font);
|
||||||
|
|
||||||
|
SET_ROW_COLOR(row, OWN_GREEN, *wxBLACK);
|
||||||
|
SET_ROW_FONT(row, font);
|
||||||
|
|
||||||
new_op.id = _kiss->AddOperation(new_op);
|
new_op.id = _kiss->AddOperation(new_op);
|
||||||
}
|
}
|
||||||
// Modify an operation
|
// Modify an operation
|
||||||
|
@ -783,6 +796,12 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
||||||
{
|
{
|
||||||
_grid->SetCellValue(event.GetRow(), i, wxT(""));
|
_grid->SetCellValue(event.GetRow(), i, wxT(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFAULT_FONT(font);
|
||||||
|
|
||||||
|
SET_ROW_COLOR(event.GetRow(), OWN_GREEN, *wxBLACK);
|
||||||
|
SET_ROW_FONT(event.GetRow(), font);
|
||||||
|
|
||||||
new_op.id = _kiss->AddOperation(new_op);
|
new_op.id = _kiss->AddOperation(new_op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,6 +825,7 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
_curOperations->insert(_curOperations->begin()+i ,new_op);
|
_curOperations->insert(_curOperations->begin()+i ,new_op);
|
||||||
|
|
||||||
i++; // For header
|
i++; // For header
|
||||||
if (!fix_op) i++;
|
if (!fix_op) i++;
|
||||||
InsertOperation(user, &new_op, i, fix_op);
|
InsertOperation(user, &new_op, i, fix_op);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user