diff --git a/INSTALL b/INSTALL index a1fdb2d..794d553 100644 --- a/INSTALL +++ b/INSTALL @@ -14,6 +14,7 @@ php5 ** Compilation of extra libraries ** lib is not included by default and must be downloaded http://indefero.soutade.fr/p/kisscount/downloads/ +It must be decompressed beside "src" directory. cd lib/wxsqlite3-1.9.9 ./configure diff --git a/Makefile b/Makefile index cd69603..d753805 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ HEADERS+=$(wildcard src/controller/*.h) HEADERS+=src/main.h src/sha1.h OBJS=$(SOURCES:.cpp=.o) -all: kc +all: check kc clean: rm -f *~ src/*~ src/*.o src/model/*.o src/model/*~ src/view/*.o src/view/grid/*.o src/view/grid/*~ src/view/*~ src/controller/*.o src/controller/*~ kc @@ -28,6 +28,9 @@ clean: %.o : src/model/%.cpp src/view/%.cpp src/view/grid/%.cpp src/controller/%.cpp src/%.cpp $(CXX) $(CXXFLAGS) $< -c +check: + if ! test -d lib ; then echo lib directory not found, please see INSTALL ; return 1 ; fi + kc: $(OBJS) $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index f90a83c..5bf71e4 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -126,32 +126,26 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(* wxButton* buttonGroup = new wxButton(this, GROUP_ID, _("Group")); wxButton* buttonUnGroup = new wxButton(this, UNGROUP_ID, _("UnGroup")); - vbox3->Add(&_tree, 0); - vbox3->Add(-1, 30); - vbox3->Add(buttonGroup, 0); - vbox3->Add(-1, 10); - vbox3->Add(buttonUnGroup, 0); + vbox3->Add(&_tree, 0, wxGROW|wxALL, 2); + vbox3->Add(buttonGroup, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); + vbox3->Add(buttonUnGroup, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); - hbox->Add(vbox3, 0); - hbox2->Add(_accountsGrid, 0); - hbox2->Add(_calendar, 0); + hbox->Add(vbox3, 0, wxGROW|wxALL, 2); + hbox2->Add(_accountsGrid, 0, wxGROW|wxALL, 2); + hbox2->Add(_calendar, 0, wxALL, 2); vbox2->Add(hbox2, 0); - vbox2->Add(-1, 10); - vbox2->Add(_grid, 0); - hbox->Add(vbox2, 0); - vbox->Add(_statsGrid, 0); - vbox->Add(-1, 10); - vbox->Add(chart, 0); - hbox->Add(-1, 10); - vbox->Add(_checkCheckMode, 0); - hbox->Add(-1, 10); - hbox->Add(vbox, 0); + vbox2->Add(_grid, 0, wxGROW|wxALL, 2); + hbox->Add(vbox2, 0, wxGROW|wxALL, 2); + vbox->Add(_statsGrid, 0, wxGROW); + vbox->Add(chart, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 10); + vbox->Add(_checkCheckMode, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 10); + hbox->Add(vbox, 0, wxGROW|wxALL, 2); ChangeUser(); Fit(); - SetMinSize(wxSize(rect.width-rect.x, rect.height-rect.y-128)); + SetMinSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); SetScrollbars(10, 10, 100/10, 100/10); } diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 7e73bf6..4bc9bc3 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -65,8 +65,8 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p // User staticBoxSizer = new wxStaticBoxSizer (staticUser, wxVERTICAL); - gridBagSizer = new wxGridBagSizer(10, 10); - staticBoxSizer->Add(gridBagSizer); + gridBagSizer = new wxGridBagSizer(2, 3); + staticBoxSizer->Add(gridBagSizer, 0, wxGROW|wxALL, 2); label = new wxStaticText(this, wxID_ANY, _("Name")); gridBagSizer->Add(label, wxGBPosition(0, 0)); @@ -82,8 +82,7 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p gridBagSizer->Add(buttonChangePassword, wxGBPosition(1, 1)); gridBagSizer->Add(killMe, wxGBPosition(1, 2)); - vbox->Add(staticBoxSizer); - vbox->Add(-1, 20); + vbox->Add(staticBoxSizer, 0, wxALL, 10); // Account staticBoxSizer = new wxStaticBoxSizer (staticAccount, wxVERTICAL); @@ -96,15 +95,14 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p InitAccounts(user); - staticBoxSizer->Add(_accountsGrid); + staticBoxSizer->Add(_accountsGrid, 0, wxGROW|wxALL, 2); - hbox1->Add(staticBoxSizer); - hbox1->Add(-1, 20); + hbox1->Add(staticBoxSizer, 0, wxALL); staticBoxSizer = new wxStaticBoxSizer (staticSharedWith, wxVERTICAL); _sharedWith = new wxCheckListBox(this, SHARED_WITH_ID); - staticBoxSizer->Add(_sharedWith); + staticBoxSizer->Add(_sharedWith, 0, wxGROW); users = _kiss->GetUsers(); @@ -114,8 +112,8 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p _sharedWith->Enable(false); - hbox1->Add(staticBoxSizer); - hbox1->Add(-1, 20); + hbox1->Add(staticBoxSizer, 0, wxLEFT, 5); + vbox->Add(hbox1, 0, wxGROW|wxALL, 10); // Categories staticBoxSizer = new wxStaticBoxSizer (staticCategories, wxVERTICAL); @@ -126,15 +124,11 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p _categoriesGrid = new wxMyGrid(this, CATEGORIES_GRID_ID, clicks, 4); } - staticBoxSizer->Add(_categoriesGrid); + staticBoxSizer->Add(_categoriesGrid, 0, wxGROW|wxALL, 2); InitCategories(user); - vbox->Add(hbox1); - vbox->Add(-1, 20); - - vbox->Add(staticBoxSizer); - vbox->Add(-1, 20); + vbox->Add(staticBoxSizer, 0, wxALL, 10); // Operation Order staticBoxSizer = new wxStaticBoxSizer (staticOperationOrder, wxVERTICAL); @@ -142,10 +136,9 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p _operationOrder = new wxComboBox(this, OPERATION_ORDER_ID); _operationOrder->SetWindowStyle(wxCB_READONLY); - staticBoxSizer->Add(_operationOrder); + staticBoxSizer->Add(_operationOrder, 0, wxGROW|wxALL, 2); - hbox2->Add(staticBoxSizer); - hbox2->Add(-1, 20); + hbox2->Add(staticBoxSizer, 0); InitOperationOrder(user); @@ -155,16 +148,15 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p _language = new wxBitmapComboBox(this, LANGUAGE_ID); _language->SetWindowStyle(wxCB_READONLY); - staticBoxSizer->Add(_language); + staticBoxSizer->Add(_language, 0, wxGROW|wxALL, 2); - hbox2->Add(staticBoxSizer); - hbox2->Add(-1, 20); + hbox2->Add(staticBoxSizer, 0, wxLEFT, 10); InitLanguage(user); _language->Fit(); - vbox->Add(hbox2); + vbox->Add(hbox2, 0, wxALL, 10); Fit(); SetMinSize(GetSize()); diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index 1318a0c..bd71c76 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -107,16 +107,15 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*pa gridBagSizer->Add(_account, wxGBPosition(1, 7)); gridBagSizer->Add(_searchButton, wxGBPosition(2, 0)); - vbox->Add(gridBagSizer); - vbox->Add(-1, 20); + vbox->Add(gridBagSizer, 0, wxGROW|wxALL, 5); _grid = new GridAccount(_kiss, this, GRID_ID); - vbox->Add(_grid); + vbox->Add(_grid, 0, wxGROW|wxALL, 5); Fit(); - SetMinSize(wxSize(rect.width-rect.x, rect.height-rect.y-128)); + SetMinSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); SetScrollbars(10, 10, 100/10, 100/10); Hide(); diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index 62ca913..0f2e6da 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -60,16 +60,13 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _ki _yearTo->Select(i); wxStaticText* label = new wxStaticText(this, wxID_ANY, _("From")); - hbox->Add(label); - hbox->Add(-1, 10); - hbox->Add(_monthFrom); - hbox->Add(_yearFrom); + hbox->Add(label, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5); + hbox->Add(_monthFrom, 0, wxRIGHT, 5); + hbox->Add(_yearFrom, 0, wxRIGHT, 20); - hbox->Add(-1, 30); label = new wxStaticText(this, wxID_ANY, _("To")); - hbox->Add(label); - hbox->Add(-1, 10); - hbox->Add(_monthTo); + hbox->Add(label, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5); + hbox->Add(_monthTo, 0, wxRIGHT, 5); hbox->Add(_yearTo); _account = new wxCheckListBox(this, ACCOUNTS_ID); @@ -106,9 +103,8 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _ki _statsGrid->SetCellAlignment(i, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); } - _vbox2->Add(_account); - _vbox2->Add(-1, 10); - _vbox2->Add(_statsGrid); + _vbox2->Add(_account, 0, wxGROW|wxALL, 5); + _vbox2->Add(_statsGrid, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); _pie = new PiePlot(); @@ -133,11 +129,10 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _ki chart->SetMinSize(// chart->GetSize() wxSize(200,250)); - _vbox2->Add(-1, 10); - _vbox2->Add(chart); + _vbox2->Add(chart, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 10); - vbox->Add(hbox); - vbox->Add(_hbox2); + vbox->Add(hbox, 0, wxALIGN_CENTER_VERTICAL|wxGROW|wxALL, 5); + vbox->Add(_hbox2, 0, wxGROW|wxALL, 5); wxCommandEvent event ; OnRangeChange(event); @@ -295,7 +290,7 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT _chart->SetMinSize(// chart->GetSize() wxSize(750,550)); - _hbox2->Add(_chart); + _hbox2->Add(_chart, 0, wxGROW|wxALL, 5); total = 0.0; for(categoriesIt = categories.begin(); categoriesIt != categories.end(); categoriesIt++) @@ -317,7 +312,7 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT _pie->DatasetChanged(_dataset); - _hbox2->Add(_vbox2); + _hbox2->Add(_vbox2, 0, wxGROW|wxALL, 5); Layout(); } diff --git a/src/view/UsersDialog.cpp b/src/view/UsersDialog.cpp index ce60891..c53d52e 100644 --- a/src/view/UsersDialog.cpp +++ b/src/view/UsersDialog.cpp @@ -33,6 +33,7 @@ UsersDialog::UsersDialog(KissCount* kiss, wxUI *parent) : wxDialog(&(*parent), - wxStaticText* label; wxCommandEvent event; + wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); gridBagSizer = new wxGridBagSizer(4, 4); label = new wxStaticText(this, -1, _("User ")); @@ -63,10 +64,11 @@ UsersDialog::UsersDialog(KissCount* kiss, wxUI *parent) : wxDialog(&(*parent), - _users->Select(0); - SetSizer(gridBagSizer); + hbox->Add(gridBagSizer, 0, wxGROW|wxALL, 10); + SetSizer(hbox); _users->SetFocus(); - Layout(); + Fit(); Center(); if (users_list.size() == 0) diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 0d267fb..d5e17a4 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -250,7 +250,7 @@ void wxUI::ShowPanel(wxPanel* panel) } _curPanel = panel; - _hbox->Add(panel); + _hbox->Add(panel, 1, wxGROW|wxALL, 0); _curPanel->Show(); Layout(); }