From 08ba72664cd8c200d7264f7a25004f0eb5b10f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Tue, 16 Aug 2011 18:22:35 +0200 Subject: [PATCH] Use class enums and constants rather than global enums and define Fix a bug : virtual transferts must not be considered as a debit --- ChangeLog | 3 ++- src/controller/KissCount.cpp | 16 +++++++------- src/model/Database.cpp | 2 +- src/model/Database.h | 15 ++++++------- src/model/Database_Update.cpp | 10 ++++----- src/model/User.cpp | 2 +- src/model/import/GrisbiImportEngine.cpp | 2 +- src/model/import/ImportEngine.cpp | 2 ++ src/model/import/ImportEngine.h | 4 ++-- src/view/AccountPanel.cpp | 28 ++++++++++++------------- src/view/GenerateDialog.cpp | 10 ++++----- src/view/PreferencesPanel.cpp | 10 ++++----- src/view/SearchBanner.cpp | 8 +++---- src/view/StatsPanel.cpp | 8 +++---- src/view/SupportedLanguages.cpp | 26 ----------------------- src/view/SupportedLanguages.h | 23 +++++++++++++------- src/view/grid/GridAccount.cpp | 14 ++++++------- src/view/view.h | 14 +++++++------ src/view/wxUI.cpp | 4 ++-- src/view/wxUI.h | 8 +++---- 20 files changed, 97 insertions(+), 112 deletions(-) delete mode 100644 src/view/SupportedLanguages.cpp diff --git a/ChangeLog b/ChangeLog index 7d68969..fcfc383 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,10 @@ -v0.3 (06/08/2011) +v0.3 (16/08/2011) ** User ** Install KissCount into /usr/local instead of /usr ** Bugs ** Fix a bug in language settings + Virtual transferts must not be considered as a debit v0.2 (04/07/2011) diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index de4360c..fcfc8e7 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -354,17 +354,17 @@ void KissCount::NewUser(const wxString& name) AddAccount(ac); - cat.parent = wxT("0") ; cat.name = wxT("Fix") ; cat.backcolor = OWN_YELLOW ; cat.forecolor = *wxBLACK; cat.fix_cost = true; + cat.parent = wxT("0") ; cat.name = wxT("Fix") ; cat.backcolor = view::OWN_YELLOW ; cat.forecolor = *wxBLACK; cat.fix_cost = true; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = wxT("Groceries") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; + cat.parent = wxT("0") ; cat.name = wxT("Groceries") ; cat.backcolor = view::OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = wxT("Hobbies") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; + cat.parent = wxT("0") ; cat.name = wxT("Hobbies") ; cat.backcolor = view::OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = wxT("Car") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; + cat.parent = wxT("0") ; cat.name = wxT("Car") ; cat.backcolor = view::OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = wxT("Unexpected") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; + cat.parent = wxT("0") ; cat.name = wxT("Unexpected") ; cat.backcolor = view::OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = wxT("Other") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; + cat.parent = wxT("0") ; cat.name = wxT("Other") ; cat.backcolor = view::OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); SetOperationOrder(wxT("ASC")); @@ -427,9 +427,9 @@ bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month date = new wxDateTime(0, (wxDateTime::Month)month, year); if (limitToType) - operations = _db->Search(_user, &op.description, date, 0, 0, 0, v, op.fix_cost ? FIX_OP : NON_FIX_OP, v, false); + operations = _db->Search(_user, &op.description, date, 0, 0, 0, v, op.fix_cost ? +Database::FIX_OP : +Database::NON_FIX_OP, v, false); else - operations = _db->Search(_user, &op.description, date, 0, 0, 0, v, ALL_OP, v, false); + operations = _db->Search(_user, &op.description, date, 0, 0, 0, v, Database::ALL_OP, v, false); delete date; diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 85421e4..dba7158 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -1757,7 +1757,7 @@ void Database::UpdateImportPattern(User* user) it != user->_importPatterns.end(); it++) { - if (it->second.pattern == NULL_IMPORT_PATTERN) continue; + if (it->second.pattern == ImportEngine::NULL_IMPORT_PATTERN) continue; key = ImportEngine::RemoveUnused(it->first); diff --git a/src/model/Database.h b/src/model/Database.h index e741ef1..68488ba 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -33,16 +33,9 @@ #include #include "model.h" -#define DATABASE_VERSION 2 - #define BDD_FILE "/.kisscount/kc.bdd" #define INIT_SCRIPT RESSOURCES_ROOT "init.sql" -#define FIX_OP (1 << 0) -#define NON_FIX_OP (1 << 1) -#define CHECKED_OP (1 << 2) -#define NOT_CHECKED_OP (1 << 3) -#define ALL_OP (~0) // if (!_db.CheckSyntax(req)) // { @@ -96,6 +89,14 @@ class User; class Database { public: + static const int FIX_OP = 1;//(1 << 0); + static const int NON_FIX_OP = 2;//(1 << 1); + static const int CHECKED_OP = (1 << 2); + static const int NOT_CHECKED_OP = (1 << 3); + static const int ALL_OP = (~0); + + static const int VERSION = 2; + Database(const char* filename, KissCount* kiss); std::list GetUsers(); diff --git a/src/model/Database_Update.cpp b/src/model/Database_Update.cpp index 4d39648..adbe6bd 100644 --- a/src/model/Database_Update.cpp +++ b/src/model/Database_Update.cpp @@ -91,9 +91,9 @@ void Database::CheckDatabaseVersion() ON_ERROR("Invalid database version"); } - if (version == DATABASE_VERSION) return; + if (version == Database::VERSION) return; - if (version > DATABASE_VERSION) + if (version > Database::VERSION) { ON_ERROR("Your current version of KissCount is too old and can't load this database. Please upgrade KissCount"); } @@ -101,7 +101,7 @@ void Database::CheckDatabaseVersion() version--; // Maybe one update is impossible - for(i=version; i_unresolvedCategories.push_back(cat); diff --git a/src/model/import/ImportEngine.cpp b/src/model/import/ImportEngine.cpp index 11fc6ca..9f1f0a8 100644 --- a/src/model/import/ImportEngine.cpp +++ b/src/model/import/ImportEngine.cpp @@ -19,6 +19,8 @@ #include "ImportEngine.h" +wxString ImportEngine::NULL_IMPORT_PATTERN = wxT("(nil)"); + ImportEngine::ImportEngine() { } diff --git a/src/model/import/ImportEngine.h b/src/model/import/ImportEngine.h index 9db452e..2e5db80 100644 --- a/src/model/import/ImportEngine.h +++ b/src/model/import/ImportEngine.h @@ -33,10 +33,10 @@ public: wxString category; } ; -#define NULL_IMPORT_PATTERN wxT("(nil)") - class ImportEngine { public: + static wxString NULL_IMPORT_PATTERN; + ImportEngine(); ~ImportEngine(); diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index bbb7eae..adcf2a4 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -59,7 +59,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare SetSizer(hbox); - ColorScheme* colorScheme = new ColorScheme(categoryColors, WXSIZEOF(categoryColors)); + ColorScheme* colorScheme = new ColorScheme(wxUI::categoryColors, WXSIZEOF(wxUI::categoryColors)); _pie = new PiePlot(); _calendar = new wxCalendarCtrl(this, CALENDAR_ID, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, @@ -85,7 +85,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare _categoriesIndexes[categoryIt->name] = i; } - nbCategories = (user->GetCategoriesNumber() <= MAX_CATEGORY) ? user->GetCategoriesNumber() : MAX_CATEGORY; + nbCategories = (user->GetCategoriesNumber() <= wxUI::MAX_CATEGORY) ? user->GetCategoriesNumber() : wxUI::MAX_CATEGORY; _categoriesValues = new double[user->GetCategoriesNumber()]; for(i=0; iGetCategoriesNumber(); i++) @@ -283,7 +283,7 @@ void AccountPanel::ChangeUser() else { curNode = _tree.AppendItem(rootNode, wxString::Format(wxT("%d"), curDate.GetYear())); - _tree.AppendItem(curNode, months[(int)curDate.GetYear()]); + _tree.AppendItem(curNode, wxUI::months[(int)curDate.GetYear()]); Fit(); } } @@ -316,10 +316,10 @@ void AccountPanel::LoadYear(int year, bool showMonth) if (curMonth == -1 || (year == curDate.GetYear() && *it <= curDate.GetMonth())) { curMonth = *it; - curMonthNode = _tree.AppendItem(parentNode, months[*it]); + curMonthNode = _tree.AppendItem(parentNode, wxUI::months[*it]); } else - _tree.AppendItem(parentNode, months[*it]); + _tree.AppendItem(parentNode, wxUI::months[*it]); } _tree.Expand(parentNode); @@ -371,7 +371,7 @@ void AccountPanel::ShowMonth(int month, int year) _curYear = year; _curMonth = month; - _wxUI->SetTitle(user->_name + wxT(" - ") + months[month] + wxT(" ") + wxString::Format(wxT("%d"), year)); + _wxUI->SetTitle(user->_name + wxT(" - ") + wxUI::months[month] + wxT(" ") + wxString::Format(wxT("%d"), year)); _calendar->Enable(true); if (_grid->GetNumberRows() > 1) @@ -529,7 +529,7 @@ void AccountPanel::UpdateStats() if (!op.transfert.Length() && user->GetCategoryName(op.category) != _("Unknown")) _categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ; - if (!op.transfert.Length() || op._virtual) + if (!op.transfert.Length()) totalDebit += -op.amount; if (blocked_account) @@ -537,7 +537,7 @@ void AccountPanel::UpdateStats() if (day >= op.day) { - if (!op.transfert.Length() || op._virtual) + if (!op.transfert.Length()) curDebit += -op.amount; curAccountAmount[op.account] += op.amount; } @@ -748,7 +748,7 @@ void AccountPanel::OnTreeChange(wxTreeEvent& event) monthString = _tree.GetItemText(event.GetItem()); for (i=0; i<12; i++) - if (monthString == months[i]) + if (monthString == wxUI::months[i]) { month = i; break; @@ -804,7 +804,7 @@ void AccountPanel::GetTreeSelection(int* month, int* year) monthString = _tree.GetItemText(_tree.GetSelection()); for (i=0; i<12; i++) - if (monthString == months[i]) + if (monthString == wxUI::months[i]) { *month = i; break; @@ -873,7 +873,7 @@ void AccountPanel::OnMenuDelete(wxCommandEvent& event) message = _("Are you sure want to delete "); if (month != -1) - message += months[month] + wxT(" "); + message += wxUI::months[month] + wxT(" "); message += wxString::Format(wxT("%d"), year); message += _(" operations ?"); @@ -920,7 +920,7 @@ void AccountPanel::GenerateMonth(int month, int year) root = _tree.GetRootItem(); yearString = wxString::Format(wxT("%d"), year); - monthString = months[month]; + monthString = wxUI::months[month]; ops = _kiss->GetAllOperations(); @@ -985,7 +985,7 @@ void AccountPanel::GenerateMonth(int month, int year) void AccountPanel::OnShow(wxShowEvent& event) { if (_curMonth != -1) - _wxUI->SetTitle(_kiss->GetUser()->_name + wxT(" - ") + months[_curMonth] + wxT(" ") + wxString::Format(wxT("%d"), _curYear)); + _wxUI->SetTitle(_kiss->GetUser()->_name + wxT(" - ") + wxUI::months[_curMonth] + wxT(" ") + wxString::Format(wxT("%d"), _curYear)); else _wxUI->SetTitle(_kiss->GetUser()->_name); } @@ -1104,7 +1104,7 @@ void AccountPanel::OnUpdateNextMonths(wxCommandEvent& event) end: if (accounts_updated) { - wxString message = _("Accounts updated until ") + months[last_month]; + wxString message = _("Accounts updated until ") + wxUI::months[last_month]; message += wxT(" ") + wxString::Format(wxT("%d"), last_year); diff --git a/src/view/GenerateDialog.cpp b/src/view/GenerateDialog.cpp index 3d5d8ef..8e340af 100644 --- a/src/view/GenerateDialog.cpp +++ b/src/view/GenerateDialog.cpp @@ -83,7 +83,7 @@ GenerateDialog::GenerateDialog(KissCount* kiss, wxUI *parent, int month, int yea { for(i=0; i<(int)_monthFrom->GetCount(); i++) { - if (_monthFrom->GetString(i) == months[month]) + if (_monthFrom->GetString(i) == wxUI::months[month]) { toSelect = i; break; @@ -158,7 +158,7 @@ void GenerateDialog::OnYearFromChange(wxCommandEvent& event) year = wxAtoi(years); for(it=_ops[year].begin(); it!=_ops[year].end(); it++) - _monthFrom->Append(months[*it]); + _monthFrom->Append(wxUI::months[*it]); _monthFrom->Select(0); Layout(); @@ -184,7 +184,7 @@ void GenerateDialog::OnYearToChange(wxCommandEvent& event) } } if (ok) - _monthTo->Append(months[i]); + _monthTo->Append(wxUI::months[i]); } _monthTo->Select(0); @@ -205,7 +205,7 @@ void GenerateDialog::OnOK(wxCommandEvent& event) { for (i=0; i<12; i++) { - if (months[i] == _monthFrom->GetString(_monthFrom->GetCurrentSelection())) + if (wxUI::months[i] == _monthFrom->GetString(_monthFrom->GetCurrentSelection())) { monthFrom = i; break; @@ -216,7 +216,7 @@ void GenerateDialog::OnOK(wxCommandEvent& event) for (i=0; i<12; i++) { - if (months[i] == _monthTo->GetString(_monthTo->GetCurrentSelection())) + if (wxUI::months[i] == _monthTo->GetString(_monthTo->GetCurrentSelection())) { monthTo = i; break; diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 43800a0..dd1eb1c 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -344,7 +344,7 @@ void PreferencesPanel::AddCategory(int line, Category cat) _categoriesGrid->SetReadOnly(line, CATEGORY_FOREGROUND_COLOR, true); _categoriesGrid->SetReadOnly(line, CATEGORY_FONT, true); _categoriesGrid->SetReadOnly(line, CATEGORY_DELETE, true); - SET_ROW_COLOR(line, OWN_GREEN, *wxBLACK); + SET_ROW_COLOR(line, view::OWN_GREEN, *wxBLACK); _categoriesGrid->AutoSizeColumns(true); } @@ -354,10 +354,10 @@ void PreferencesPanel::InitLanguage(User* user) { int i, select=0; - for (i=0; iAppend(languages[i].name, wxBitmap(languages[i].icon, wxBITMAP_TYPE_PNG)); - if (languages[i].language == _wxUI->_language) + _language->Append(SupportedLanguages::languages[i].name, wxBitmap(SupportedLanguages::languages[i].icon, wxBITMAP_TYPE_PNG)); + if (SupportedLanguages::languages[i].language == _wxUI->_language) select = i; } @@ -816,7 +816,7 @@ void PreferencesPanel::OnOperationOrderChange(wxCommandEvent& event) void PreferencesPanel::OnLanguageChange(wxCommandEvent& event) { - wxLanguage language = languages[_language->GetSelection()].language; + wxLanguage language = SupportedLanguages::languages[_language->GetSelection()].language; if (_wxUI->SetLanguage(language) || language == wxLANGUAGE_ENGLISH) { _wxUI->NeedReload(); diff --git a/src/view/SearchBanner.cpp b/src/view/SearchBanner.cpp index d16f148..0dcdaf3 100644 --- a/src/view/SearchBanner.cpp +++ b/src/view/SearchBanner.cpp @@ -183,10 +183,10 @@ std::vector * SearchBanner::Search() if (_category->IsChecked(i)) categories.push_back((i) ? user->_categories[i-1].id : wxT("0")); - types |= (_optype->IsChecked(0)) ? FIX_OP : 0; - types |= (_optype->IsChecked(1)) ? NON_FIX_OP : 0; - types |= (_optype->IsChecked(2)) ? CHECKED_OP : 0; - types |= (_optype->IsChecked(3)) ? NOT_CHECKED_OP : 0; + types |= (_optype->IsChecked(0)) ? Database::FIX_OP : 0; + types |= (_optype->IsChecked(1)) ? Database::NON_FIX_OP : 0; + types |= (_optype->IsChecked(2)) ? Database::CHECKED_OP : 0; + types |= (_optype->IsChecked(3)) ? Database::NOT_CHECKED_OP : 0; for(i=0; iGetAccountsNumber(); i++) if (_account->IsChecked(i)) diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index f3cb6a9..4a77f2f 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -42,9 +42,9 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), SetSizer(vbox); - _monthFrom = new wxChoice (this, RANGE_ID, wxDefaultPosition, wxDefaultSize, 12, months); + _monthFrom = new wxChoice (this, RANGE_ID, wxDefaultPosition, wxDefaultSize, 12, wxUI::months); _yearFrom = new wxChoice (this, RANGE_ID); - _monthTo = new wxChoice (this, RANGE_ID, wxDefaultPosition, wxDefaultSize, 12, months); + _monthTo = new wxChoice (this, RANGE_ID, wxDefaultPosition, wxDefaultSize, 12, wxUI::months); _yearTo = new wxChoice (this, RANGE_ID); operations = _kiss->GetAllOperations(); @@ -122,10 +122,10 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _pie = new PiePlot(); - nbCategories = (user->GetCategoriesNumber() <= MAX_CATEGORY) ? user->GetCategoriesNumber() : MAX_CATEGORY; + nbCategories = (user->GetCategoriesNumber() <= wxUI::MAX_CATEGORY) ? user->GetCategoriesNumber() : wxUI::MAX_CATEGORY; _dataset = new CategorySimpleDataset(_categories, nbCategories); - ColorScheme* colorScheme = new ColorScheme(categoryColors, WXSIZEOF(categoryColors)); + ColorScheme* colorScheme = new ColorScheme(wxUI::categoryColors, WXSIZEOF(wxUI::categoryColors)); _categoriesValues = new double[user->GetCategoriesNumber()]; for(i=0; iGetCategoriesNumber(); i++) diff --git a/src/view/SupportedLanguages.cpp b/src/view/SupportedLanguages.cpp deleted file mode 100644 index 44062ca..0000000 --- a/src/view/SupportedLanguages.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - Copyright 2010-2011 Grégory Soutadé - - This file is part of KissCount. - - KissCount is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - KissCount is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with KissCount. If not, see . -*/ - -#include "SupportedLanguages.h" - -language languages[NB_SUPPORTED_LANGUAGES] = { - { wxT("English"), wxT(ICONS_PATH "/United Kingdom.png"), wxLANGUAGE_ENGLISH}, - { wxT("Français"), wxT(ICONS_PATH "/France.png"), wxLANGUAGE_FRENCH} -}; - diff --git a/src/view/SupportedLanguages.h b/src/view/SupportedLanguages.h index 2df9936..4b29ca7 100644 --- a/src/view/SupportedLanguages.h +++ b/src/view/SupportedLanguages.h @@ -22,15 +22,22 @@ #include -typedef struct { - wxString name; - wxString icon; - wxLanguage language; -} language ; - -#define NB_SUPPORTED_LANGUAGES 2 +namespace SupportedLanguages { #define ICONS_PATH RESSOURCES_ROOT "icons/" -extern language languages[NB_SUPPORTED_LANGUAGES]; + typedef struct { + wxString name; + wxString icon; + wxLanguage language; + } language ; + + const int NB_SUPPORTED_LANGUAGES = 2; + + static const language languages[NB_SUPPORTED_LANGUAGES] = { + { wxT("English"), wxT(ICONS_PATH "/United Kingdom.png"), wxLANGUAGE_ENGLISH}, + { wxT("Français"), wxT(ICONS_PATH "/France.png"), wxLANGUAGE_FRENCH} + }; +} + #endif diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 58ff944..7b08cc8 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -64,7 +64,7 @@ GridAccount::GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id, for(i=0; iAddOperation(new_op); @@ -1061,7 +1061,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) DEFAULT_FONT(font); - SET_ROW_COLOR(row, OWN_GREEN, *wxBLACK); + SET_ROW_COLOR(row, view::OWN_GREEN, *wxBLACK); SET_ROW_FONT(row, font); new_op.id = _kiss->AddOperation(new_op); @@ -1093,7 +1093,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) if (new_op.category.Length()) color = cat.backcolor; else - color = OWN_GREEN; + color = view::OWN_GREEN; if (new_op.checked) { diff --git a/src/view/view.h b/src/view/view.h index 5360adb..54a4417 100644 --- a/src/view/view.h +++ b/src/view/view.h @@ -20,13 +20,15 @@ #ifndef VIEW_H #define VIEW_H -#define OWN_CYAN wxColour(0x99, 0xCC, 0xFF) -#define OWN_YELLOW wxColour(0xFF, 0xFF, 0x99) -#define OWN_GREEN wxColour(0x3D, 0xEB, 0x3D) +namespace view { + const wxColour OWN_CYAN(0x99, 0xCC, 0xFF); + const wxColour OWN_YELLOW(0xFF, 0xFF, 0x99); + const wxColour OWN_GREEN(0x3D, 0xEB, 0x3D); + const wxString DEFAULT_FONT_NAME(wxT("Liberation Sans")); + const int DEFAULT_FONT_SIZE = 12; -#define DEFAULT_FONT_NAME wxT("Liberation Sans") -#define DEFAULT_FONT_SIZE 12 -#define DEFAULT_FONT(font_name) wxFont font_name(DEFAULT_FONT_SIZE, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, DEFAULT_FONT_NAME); +#define DEFAULT_FONT(font_name) wxFont font_name(view::DEFAULT_FONT_SIZE, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, view::DEFAULT_FONT_NAME); +}; #define DELETE_ICON RESSOURCES_ROOT "icons/process-stop.png" #define CHECKED_ICON RESSOURCES_ROOT "icons/tick-icon.png" diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 0e10cf2..5660672 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -27,8 +27,8 @@ EVT_BUTTON(BUTTON_ABOUT_ID, wxUI::OnButtonAbout) EVT_BUTTON(BUTTON_QUIT_ID, wxUI::OnButtonQuit) END_EVENT_TABLE() -wxString months[12] ; -wxColour categoryColors[MAX_CATEGORY] = {wxColour(0x00, 0x45, 0x86), +wxString wxUI::months[12] ; +wxColour wxUI::categoryColors[MAX_CATEGORY] = {wxColour(0x00, 0x45, 0x86), wxColour(0xFF, 0x3E, 0x0E), wxColour(0xFF, 0xD3, 0x20), wxColour(0x58, 0x9D, 0x1B), diff --git a/src/view/wxUI.h b/src/view/wxUI.h index 921ee6b..f47b680 100644 --- a/src/view/wxUI.h +++ b/src/view/wxUI.h @@ -46,14 +46,12 @@ class KissCount; class AccountPanel; class PreferencesPanel; -extern wxString months[12]; -extern wxColour categoryColors[12]; - -#define MAX_CATEGORY 12 - class wxUI: public wxFrame { public: + static const int MAX_CATEGORY = 12; + static wxString months[MAX_CATEGORY]; + static wxColour categoryColors[MAX_CATEGORY]; wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxSize& size); ~wxUI();