From ad29793f8c0d2cee8a9b44a4d799cc4c1a88a697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 20 Aug 2011 11:43:12 +0200 Subject: [PATCH] Clean header includes --- src/ParseExp.cpp | 7 +++--- src/ParseExp.h | 4 ++++ src/controller/KissCount.cpp | 6 ++++++ src/controller/KissCount.h | 5 ++--- src/main.cpp | 3 ++- src/main.h | 26 ----------------------- src/model/Database.cpp | 5 +++++ src/model/Database.h | 6 ------ src/model/User.cpp | 2 ++ src/model/User.h | 1 - src/model/export/XMLExportEngine.cpp | 3 +++ src/model/export/XMLExportEngine.h | 3 --- src/model/import/GrisbiImportEngine.cpp | 2 ++ src/model/import/ImportEngine.cpp | 2 ++ src/view/AccountPanel.cpp | 3 +++ src/view/AccountPanel.h | 7 +++--- src/view/ExportPanel.cpp | 2 ++ src/view/ExportPanel.h | 2 -- src/view/GenerateDialog.cpp | 4 ++++ src/view/GenerateDialog.h | 7 +++--- src/view/ImportPanel.cpp | 10 +++++++++ src/view/ImportPanel.h | 11 ++-------- src/view/KissPanel.h | 2 ++ src/view/PasswordDialog.cpp | 4 ++++ src/view/PasswordDialog.h | 5 ----- src/view/PreferencesPanel.cpp | 17 +++++++++++++++ src/view/PreferencesPanel.h | 10 --------- src/view/SearchBanner.h | 1 + src/view/SearchPanel.cpp | 7 +++++- src/view/SearchPanel.h | 5 ----- src/view/StatsPanel.cpp | 3 +++ src/view/StatsPanel.h | 6 ++---- src/view/UsersDialog.cpp | 5 +++++ src/view/UsersDialog.h | 4 ---- src/view/grid/GridAccount.h | 1 + src/view/grid/wxGridCellFormulaEditor.cpp | 6 +++--- src/view/view.h | 2 ++ src/view/wxUI.cpp | 14 ++++++++++++ src/view/wxUI.h | 15 +++---------- 39 files changed, 123 insertions(+), 105 deletions(-) delete mode 100644 src/main.h diff --git a/src/ParseExp.cpp b/src/ParseExp.cpp index e51b553..9f1d157 100644 --- a/src/ParseExp.cpp +++ b/src/ParseExp.cpp @@ -66,7 +66,7 @@ enum {DOUBLE_POINTED=1, INVALID_CHAR, INVALID_PARENTHESIS, INVALID_OPERATION}; #define P(x) #endif -double atof(char* s, int size) +static double atof(char* s, int size) { int neg = 0; double res = 0; @@ -94,7 +94,7 @@ double atof(char* s, int size) return res; } -void ParseExp(char** expr, struct parse_opt* root, bool needParenthesis) +void ParseExp::ParseExp(char** expr, struct parse_opt* root, bool needParenthesis) { char* temp; bool pointed = false; @@ -256,7 +256,7 @@ void ParseExp(char** expr, struct parse_opt* root, bool needParenthesis) return ; } -double EvaluateExpr(struct parse_opt* root, bool del) +double ParseExp::EvaluateExpr(struct parse_opt* root, bool del) { double l, r; char type; @@ -304,6 +304,7 @@ double EvaluateExpr(struct parse_opt* root, bool del) } #ifdef DEBUG +using namespace ParseExp; int main() { diff --git a/src/ParseExp.h b/src/ParseExp.h index 41bb170..a6e42c8 100644 --- a/src/ParseExp.h +++ b/src/ParseExp.h @@ -17,6 +17,8 @@ along with KissCount. If not, see . */ +namespace ParseExp { + struct parse_opt { struct parse_opt* root; char type; @@ -27,3 +29,5 @@ struct parse_opt { void ParseExp(char** expr, struct parse_opt* root, bool needParenthesis); double EvaluateExpr(struct parse_opt* root, bool del); + +}; diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index fcfc8e7..3029b3e 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -17,7 +17,13 @@ along with KissCount. If not, see . */ +#include +#include +#include + #include "KissCount.h" + +#include std::vector * KissCount::_importEngines; std::vector * KissCount::_exportEngines; diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index 98eb08f..1ae0554 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -20,17 +20,16 @@ #ifndef KISSCOUNT_H #define KISSCOUNT_H -#include -#include #include #include #include #include -#include #include +#include + #define APP_VERSION "0.3" #define ESCAPE_CHARS(s) { \ diff --git a/src/main.cpp b/src/main.cpp index 5d211be..f53c439 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,8 @@ along with KissCount. If not, see . */ -#include "main.h" +#include +#include class MyApp: public wxApp { diff --git a/src/main.h b/src/main.h deleted file mode 100644 index 68b9370..0000000 --- a/src/main.h +++ /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 . -*/ - -#ifndef MAIN_H -#define MAIN_H - -#include -#include - -#endif diff --git a/src/model/Database.cpp b/src/model/Database.cpp index dba7158..9198f08 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -17,6 +17,11 @@ along with KissCount. If not, see . */ +#include +#include +#include +#include + #include "Database.h" static inline wxString DoubleToString(double d) diff --git a/src/model/Database.h b/src/model/Database.h index 68488ba..0619387 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -20,15 +20,9 @@ #ifndef DATABASE_H #define DATABASE_H -#include -#include #include #include #include -#include -#include -#include -#include #include #include "model.h" diff --git a/src/model/User.cpp b/src/model/User.cpp index c897644..7dcf688 100644 --- a/src/model/User.cpp +++ b/src/model/User.cpp @@ -17,6 +17,8 @@ along with KissCount. If not, see . */ +#include +#include #include "User.h" User::User(Database* db) : _db(db) diff --git a/src/model/User.h b/src/model/User.h index c13c4c5..e58cf12 100644 --- a/src/model/User.h +++ b/src/model/User.h @@ -23,7 +23,6 @@ #include #include #include -#include #include "Category.h" #include "Account.h" diff --git a/src/model/export/XMLExportEngine.cpp b/src/model/export/XMLExportEngine.cpp index 8580fa1..cdbae4a 100644 --- a/src/model/export/XMLExportEngine.cpp +++ b/src/model/export/XMLExportEngine.cpp @@ -17,6 +17,9 @@ along with KissCount. If not, see . */ +#include +#include + #include "XMLExportEngine.h" static XMLExportEngine xmlExportEngine; diff --git a/src/model/export/XMLExportEngine.h b/src/model/export/XMLExportEngine.h index f91c0f8..4de446d 100644 --- a/src/model/export/XMLExportEngine.h +++ b/src/model/export/XMLExportEngine.h @@ -20,9 +20,6 @@ #ifndef XMLEXPORTENGINE_H #define XMLEXPORTENGINE_H -#include -#include - #include #include #include "ExportEngine.h" diff --git a/src/model/import/GrisbiImportEngine.cpp b/src/model/import/GrisbiImportEngine.cpp index 22caea6..ae755b4 100644 --- a/src/model/import/GrisbiImportEngine.cpp +++ b/src/model/import/GrisbiImportEngine.cpp @@ -19,6 +19,8 @@ #include "GrisbiImportEngine.h" +#include + static GrisbiImportEngine grisbiImportEngine; void GrisbiImportEngine::LoadAccount(GrisbiImportEngine* _this, const char** attrs) diff --git a/src/model/import/ImportEngine.cpp b/src/model/import/ImportEngine.cpp index 9f1f0a8..2e746f8 100644 --- a/src/model/import/ImportEngine.cpp +++ b/src/model/import/ImportEngine.cpp @@ -17,6 +17,8 @@ along with KissCount. If not, see . */ +#include + #include "ImportEngine.h" wxString ImportEngine::NULL_IMPORT_PATTERN = wxT("(nil)"); diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index adcf2a4..7b69026 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -17,6 +17,9 @@ along with KissCount. If not, see . */ +#include "grid/wxGridCellBitmapRenderer.h" +#include "GenerateDialog.h" + #include "AccountPanel.h" enum {ACCOUNT_NUMBER, ACCOUNT_NAME, ACCOUNT_INIT, ACCOUNT_CUR, ACCOUNT_FINAL, NUMBER_COLS_ACCOUNTS}; diff --git a/src/view/AccountPanel.h b/src/view/AccountPanel.h index a96dd4e..9ec0920 100644 --- a/src/view/AccountPanel.h +++ b/src/view/AccountPanel.h @@ -26,16 +26,17 @@ #include #include #include -#include "grid/CalendarEditor.h" -#include "grid/wxGridCellBitmapRenderer.h" #include "view.h" -#include +//#include #include #include "grid/GridAccount.h" +#include "grid/CalendarEditor.h" #include +class GridAccount; + class AccountPanel: public KissPanel { public: diff --git a/src/view/ExportPanel.cpp b/src/view/ExportPanel.cpp index 34fdaa5..d401158 100644 --- a/src/view/ExportPanel.cpp +++ b/src/view/ExportPanel.cpp @@ -17,6 +17,8 @@ along with KissCount. If not, see . */ +#include "grid/CalendarEditor.h" +#include "grid/wxGridCellBitmapRenderer.h" #include "ExportPanel.h" enum {EXPORT_ID=1, SEARCH_ID, GRID_ID}; diff --git a/src/view/ExportPanel.h b/src/view/ExportPanel.h index 67c2be8..e446a30 100644 --- a/src/view/ExportPanel.h +++ b/src/view/ExportPanel.h @@ -25,8 +25,6 @@ #include #include #include "view.h" -#include "grid/CalendarEditor.h" -#include "grid/wxGridCellBitmapRenderer.h" #include "grid/GridAccount.h" #include "SearchBanner.h" #include diff --git a/src/view/GenerateDialog.cpp b/src/view/GenerateDialog.cpp index 8e340af..409eca6 100644 --- a/src/view/GenerateDialog.cpp +++ b/src/view/GenerateDialog.cpp @@ -17,6 +17,10 @@ along with KissCount. If not, see . */ +#include +#include +#include + #include "GenerateDialog.h" enum {BUTTON_OK_ID=1, BUTTON_CANCEL_ID, YEAR_FROM_ID, MONTH_FROM_ID, YEAR_TO_ID, MONTH_TO_ID}; diff --git a/src/view/GenerateDialog.h b/src/view/GenerateDialog.h index f3c2d4a..0038aae 100644 --- a/src/view/GenerateDialog.h +++ b/src/view/GenerateDialog.h @@ -20,15 +20,14 @@ #ifndef GENERATEDIALOG_H #define GENERATEDIALOG_H -#include +#include #include -#include -#include #include -#include "wxUI.h" #include +#include "wxUI.h" + class wxUI; class KissCount; diff --git a/src/view/ImportPanel.cpp b/src/view/ImportPanel.cpp index 92d246c..7a2a52b 100644 --- a/src/view/ImportPanel.cpp +++ b/src/view/ImportPanel.cpp @@ -17,6 +17,16 @@ along with KissCount. If not, see . */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "ImportPanel.h" enum {OPEN_FILE_ID=1, BUTTON_OPEN_ID, NAME_ID, BUTTON_LOAD_ID, BUTTON_INTEGRATE_ID, CHECK_SAVE_ID, OPS_GRID_ID}; diff --git a/src/view/ImportPanel.h b/src/view/ImportPanel.h index 8ef365c..2b0861b 100644 --- a/src/view/ImportPanel.h +++ b/src/view/ImportPanel.h @@ -21,20 +21,13 @@ #define IMPORTPANEL_H #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "view.h" #include #include +#include "grid/GridAccount.h" + class ImportPanel: public KissPanel { public: diff --git a/src/view/KissPanel.h b/src/view/KissPanel.h index dd7d2e9..bef0add 100644 --- a/src/view/KissPanel.h +++ b/src/view/KissPanel.h @@ -24,6 +24,8 @@ #include #include +#include "wxUI.h" + class wxUI; class KissCount; diff --git a/src/view/PasswordDialog.cpp b/src/view/PasswordDialog.cpp index 4071f2a..37e5651 100644 --- a/src/view/PasswordDialog.cpp +++ b/src/view/PasswordDialog.cpp @@ -17,6 +17,10 @@ along with KissCount. If not, see . */ +#include +#include +#include + #include "PasswordDialog.h" enum {BUTTON_OK_ID=1, BUTTON_CANCEL_ID, OLD_PASSWORD_ID, NEW_PASSWORD_ID, CONFIRM_PASSWORD_ID}; diff --git a/src/view/PasswordDialog.h b/src/view/PasswordDialog.h index cbd1a7d..94ee363 100644 --- a/src/view/PasswordDialog.h +++ b/src/view/PasswordDialog.h @@ -20,12 +20,7 @@ #ifndef PASSWORDDIALOG_H #define PASSWORDDIALOG_H -#include - #include -#include -#include -#include #include "wxUI.h" #include diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index dd1eb1c..6dd0e54 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -17,6 +17,23 @@ along with KissCount. If not, see . */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "grid/wxMyGrid.h" +#include "grid/wxGridCellStarEditor.h" +#include "grid/wxGridCellFastBoolEditor.h" +#include "grid/wxGridCellButtonRenderer.h" +#include "grid/wxGridCellButtonEditor.h" +#include "PasswordDialog.h" + #include "PreferencesPanel.h" enum {ACCOUNT_NAME, ACCOUNT_NUMBER, ACCOUNT_DEFAULT, ACCOUNT_VIRTUAL, ACCOUNT_BLOCKED, ACCOUNT_DELETE, NUMBER_COLS_ACCOUNT}; diff --git a/src/view/PreferencesPanel.h b/src/view/PreferencesPanel.h index 8910edd..51724de 100644 --- a/src/view/PreferencesPanel.h +++ b/src/view/PreferencesPanel.h @@ -21,21 +21,11 @@ #define PREFERENCESPANEL_H #include -#include -#include -#include -#include -#include -#include #include -#include -#include #include "view.h" #include -#include "PasswordDialog.h" #include "SupportedLanguages.h" -#include "grid/wxGridCellStarEditor.h" class PreferencesPanel: public KissPanel { diff --git a/src/view/SearchBanner.h b/src/view/SearchBanner.h index 5ea8517..dbc7c56 100644 --- a/src/view/SearchBanner.h +++ b/src/view/SearchBanner.h @@ -22,6 +22,7 @@ #include #include +#include #include #include #include "view.h" diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index 6881b3f..c71c448 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -17,7 +17,12 @@ along with KissCount. If not, see . */ -#include "AccountPanel.h" +#include +#include +#include "grid/CalendarEditor.h" +#include "grid/wxGridCellBitmapRenderer.h" + +#include "SearchPanel.h" enum {SEARCH_ID=1, GRID_ID, CHANGE_ACCOUNT_ID, CHANGE_CATEGORY_ID, RENAME_ID}; diff --git a/src/view/SearchPanel.h b/src/view/SearchPanel.h index b60ee0b..c6fb51c 100644 --- a/src/view/SearchPanel.h +++ b/src/view/SearchPanel.h @@ -22,11 +22,7 @@ #include #include -#include -#include #include "view.h" -#include "grid/CalendarEditor.h" -#include "grid/wxGridCellBitmapRenderer.h" #include "grid/GridAccount.h" #include "AccountPanel.h" #include "SearchBanner.h" @@ -34,7 +30,6 @@ #include class GridAccount; -class SearchBanner; class SearchPanel: public KissPanel { diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index 4a77f2f..e4d442b 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -17,6 +17,9 @@ along with KissCount. If not, see . */ +#include +#include + #include "StatsPanel.h" enum {RANGE_ID=1, ACCOUNTS_ID}; diff --git a/src/view/StatsPanel.h b/src/view/StatsPanel.h index 1e2596b..4f7bafc 100644 --- a/src/view/StatsPanel.h +++ b/src/view/StatsPanel.h @@ -24,16 +24,14 @@ #include #include -#include -#include -#include #include #include #include #include #include +#include +#include -#include #include "view.h" #include diff --git a/src/view/UsersDialog.cpp b/src/view/UsersDialog.cpp index 5a43486..2255108 100644 --- a/src/view/UsersDialog.cpp +++ b/src/view/UsersDialog.cpp @@ -17,6 +17,11 @@ along with KissCount. If not, see . */ +#include +#include +#include +#include + #include "UsersDialog.h" enum {TEXT_PASSWORD_ID=1, BUTTON_OK_ID, BUTTON_CANCEL_ID, BUTTON_NEW_USER_ID}; diff --git a/src/view/UsersDialog.h b/src/view/UsersDialog.h index d753628..9f22819 100644 --- a/src/view/UsersDialog.h +++ b/src/view/UsersDialog.h @@ -23,10 +23,6 @@ #include #include -#include -#include -#include -#include #include "wxUI.h" class wxUI; diff --git a/src/view/grid/GridAccount.h b/src/view/grid/GridAccount.h index a4e073b..a0cf95f 100644 --- a/src/view/grid/GridAccount.h +++ b/src/view/grid/GridAccount.h @@ -31,6 +31,7 @@ #include "wxGridCellFastBoolEditor.h" #include "wxGridCellTreeButtonRenderer.h" #include "wxGridCellTreeButtonEditor.h" +#include "wxGridCellBitmapRenderer.h" #include "wxGridCellFormulaEditor.h" #include "wxGridCellTabStringRenderer.h" diff --git a/src/view/grid/wxGridCellFormulaEditor.cpp b/src/view/grid/wxGridCellFormulaEditor.cpp index 619023e..9a61635 100644 --- a/src/view/grid/wxGridCellFormulaEditor.cpp +++ b/src/view/grid/wxGridCellFormulaEditor.cpp @@ -48,7 +48,7 @@ bool wxGridCellFormulaEditor::EndEdit (int row, int col, wxGrid *grid/*, const w wxString res = GetValue(); Operation op; char* str, *str2; - struct parse_opt opt, *r; + struct ParseExp::parse_opt opt, *r; bool ret; res = res.Trim(); @@ -62,7 +62,7 @@ bool wxGridCellFormulaEditor::EndEdit (int row, int col, wxGrid *grid/*, const w r = &opt; str = str2; try { - ParseExp(&str2, r, false); + ParseExp::ParseExp(&str2, r, false); } catch(...) { @@ -76,7 +76,7 @@ bool wxGridCellFormulaEditor::EndEdit (int row, int col, wxGrid *grid/*, const w ret = wxGridCellTextEditor::EndEdit(row, col, grid); - grid->SetCellValue(row, col, wxString::Format(wxT("%.2lf"), EvaluateExpr(&opt, true))); + grid->SetCellValue(row, col, wxString::Format(wxT("%.2lf"), ParseExp::EvaluateExpr(&opt, true))); } else { diff --git a/src/view/view.h b/src/view/view.h index 54a4417..e0b19ec 100644 --- a/src/view/view.h +++ b/src/view/view.h @@ -20,6 +20,8 @@ #ifndef VIEW_H #define VIEW_H +#include + namespace view { const wxColour OWN_CYAN(0x99, 0xCC, 0xFF); const wxColour OWN_YELLOW(0xFF, 0xFF, 0x99); diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 5660672..06c521c 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -17,6 +17,20 @@ along with KissCount. If not, see . */ +#include "AccountPanel.h" +#include "PreferencesPanel.h" +#include "UsersDialog.h" +#include "GenerateDialog.h" +#include "SearchPanel.h" +#include "StatsPanel.h" +#include "ImportPanel.h" +#include "ExportPanel.h" + +#include "grid/wxMyGrid.h" +#include "grid/wxGridCellFastBoolEditor.h" +#include "grid/wxGridCellButtonRenderer.h" +#include "grid/wxGridCellButtonEditor.h" + #include "wxUI.h" enum {BUTTON_CHANGE_USER_ID=-4, BUTTON_ABOUT_ID=-5, BUTTON_QUIT_ID=-6}; diff --git a/src/view/wxUI.h b/src/view/wxUI.h index f47b680..ff23f82 100644 --- a/src/view/wxUI.h +++ b/src/view/wxUI.h @@ -23,19 +23,9 @@ class ImportEngine; #include -#include "AccountPanel.h" -#include "PreferencesPanel.h" -#include "UsersDialog.h" -#include "GenerateDialog.h" -#include "SearchPanel.h" -#include "StatsPanel.h" -#include "ImportPanel.h" -#include "ExportPanel.h" #include -#include "grid/wxMyGrid.h" -#include "grid/wxGridCellFastBoolEditor.h" -#include "grid/wxGridCellButtonRenderer.h" -#include "grid/wxGridCellButtonEditor.h" + +#include "KissPanel.h" #ifdef WIN32 #undef _ @@ -43,6 +33,7 @@ class ImportEngine; #endif class KissCount; +class KissPanel; class AccountPanel; class PreferencesPanel;