Fix a bug with
This commit is contained in:
@@ -31,7 +31,7 @@ KissCount::KissCount(const char* bdd_filename) : _user(NULL)
|
||||
|
||||
try
|
||||
{
|
||||
_db = new Database(bdd_filename);
|
||||
_db = new Database(bdd_filename, this);
|
||||
}
|
||||
catch (std::string s)
|
||||
{
|
||||
@@ -193,6 +193,7 @@ void KissCount::UpdateCategory(Category& category)
|
||||
if (_user->_categories[i].id == category.id)
|
||||
{
|
||||
_user->_categories[i] = category;
|
||||
_user->_categoriesFonts[i] = ExtractFont(category.font);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -236,6 +237,7 @@ void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int year
|
||||
op = *it;
|
||||
op.month = monthTo;
|
||||
op.year = yearTo;
|
||||
op.checked = false;
|
||||
op.id = AddOperation(op);
|
||||
(*_user->_operations[yearTo])[monthTo].push_back(op);
|
||||
}
|
||||
@@ -372,3 +374,59 @@ std::map<wxString, double>* KissCount::GetNotChecked(int month, int year)
|
||||
{
|
||||
return _db->GetNotChecked(_user, month, year);
|
||||
}
|
||||
|
||||
wxFont KissCount::ExtractFont(wxString strFont)
|
||||
{
|
||||
long int pos, pointSize, family, style, weight;
|
||||
wxString faceName;
|
||||
|
||||
if (!strFont.Length())
|
||||
{
|
||||
DEFAULT_FONT(f);
|
||||
return f;
|
||||
}
|
||||
|
||||
pos = strFont.Find(wxT(";"));
|
||||
|
||||
if (pos != -1)
|
||||
{
|
||||
strFont.SubString(0, pos).ToLong(&pointSize);
|
||||
strFont = strFont.SubString(pos+1, strFont.Length());
|
||||
}
|
||||
|
||||
pos = strFont.Find(wxT(";"));
|
||||
|
||||
if (pos != -1)
|
||||
{
|
||||
strFont.SubString(0, pos).ToLong(&family);
|
||||
strFont = strFont.SubString(pos+1, strFont.Length());
|
||||
}
|
||||
|
||||
pos = strFont.Find(wxT(";"));
|
||||
|
||||
if (pos != -1)
|
||||
{
|
||||
strFont.SubString(0, pos).ToLong(&style);
|
||||
strFont = strFont.SubString(pos+1, strFont.Length());
|
||||
}
|
||||
|
||||
pos = strFont.Find(wxT(";"));
|
||||
|
||||
if (pos != -1)
|
||||
{
|
||||
strFont.SubString(0, pos).ToLong(&weight);
|
||||
strFont = strFont.SubString(pos+1, strFont.Length());
|
||||
}
|
||||
|
||||
faceName = strFont;
|
||||
|
||||
return wxFont(pointSize, family, style, weight, false, faceName) ;
|
||||
}
|
||||
|
||||
wxString KissCount::CompactFont(const wxFont& font)
|
||||
{
|
||||
wxString res = wxString::Format(wxT("%d;%d;%d;%d;"), font.GetPointSize(), font.GetFamily(), font.GetStyle(), font.GetWeight());
|
||||
res += font.GetFaceName();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#define APP_VERSION "v0.1 beta"
|
||||
|
||||
class wxUI;
|
||||
class Database;
|
||||
|
||||
class KissCount
|
||||
{
|
||||
public:
|
||||
@@ -82,6 +84,9 @@ public:
|
||||
|
||||
std::map<wxString, double>* GetNotChecked(int month, int year);
|
||||
|
||||
wxFont ExtractFont(wxString strFont);
|
||||
wxString CompactFont(const wxFont& font);
|
||||
|
||||
private:
|
||||
wxUI* _wxUI;
|
||||
Database* _db;
|
||||
|
||||
Reference in New Issue
Block a user