wip
This commit is contained in:
parent
e4a81539a1
commit
6ca15e23b0
|
@ -24,8 +24,6 @@ enum {ACCOUNT_NUMBER, ACCOUNT_NAME, ACCOUNT_INIT, ACCOUNT_CUR, ACCOUNT_FINAL, NU
|
||||||
enum {CUR_CREDIT, CUR_DEBIT, TOTAL_CREDIT, TOTAL_DEBIT, REMAINS, STATS_ROW, CATS_STATS};
|
enum {CUR_CREDIT, CUR_DEBIT, TOTAL_CREDIT, TOTAL_DEBIT, REMAINS, STATS_ROW, CATS_STATS};
|
||||||
enum {CALENDAR_TREE_ID=1, OPS_GRID_ID, CALENDAR_ID, ACCOUNTS_GRID_ID, MENU_GENERATE_ID, MENU_DELETE_ID};
|
enum {CALENDAR_TREE_ID=1, OPS_GRID_ID, CALENDAR_ID, ACCOUNTS_GRID_ID, MENU_GENERATE_ID, MENU_DELETE_ID};
|
||||||
|
|
||||||
static wxString colsName[] = {_("Description"), _("Date"), _("Debit"), _("Credit"), _("Category"), _("Account"), wxT(""), wxT("")};
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(AccountPanel, wxPanel)
|
BEGIN_EVENT_TABLE(AccountPanel, wxPanel)
|
||||||
EVT_GRID_CMD_CELL_CHANGE(OPS_GRID_ID, AccountPanel::OnOperationModified)
|
EVT_GRID_CMD_CELL_CHANGE(OPS_GRID_ID, AccountPanel::OnOperationModified)
|
||||||
EVT_GRID_CMD_CELL_CHANGE(ACCOUNTS_GRID_ID, AccountPanel::OnAccountModified)
|
EVT_GRID_CMD_CELL_CHANGE(ACCOUNTS_GRID_ID, AccountPanel::OnAccountModified)
|
||||||
|
@ -111,11 +109,11 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*
|
||||||
_grid->SetColLabelSize(0);
|
_grid->SetColLabelSize(0);
|
||||||
_grid->SetRowLabelSize(0);
|
_grid->SetRowLabelSize(0);
|
||||||
|
|
||||||
_grid->CreateGrid(1, NUMBER_COLS_OPS);
|
|
||||||
_grid->SetColSize (0, _grid->GetColSize(0)*3);
|
_grid->SetColSize (0, _grid->GetColSize(0)*3);
|
||||||
_grid->SetDefaultCellFont(font);
|
_grid->SetDefaultCellFont(font);
|
||||||
|
|
||||||
font.SetWeight(wxFONTWEIGHT_BOLD);
|
font.SetWeight(wxFONTWEIGHT_BOLD);
|
||||||
|
wxString colsName[] = {_("Description"), _("Date"), _("Debit"), _("Credit"), _("Category"), _("Account"), wxT(""), wxT("")};
|
||||||
for(i=0; i<NUMBER_COLS_OPS; i++)
|
for(i=0; i<NUMBER_COLS_OPS; i++)
|
||||||
{
|
{
|
||||||
_grid->SetCellValue(0, i, colsName[i]);
|
_grid->SetCellValue(0, i, colsName[i]);
|
||||||
|
|
|
@ -29,16 +29,7 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "CalendarEditor.h"
|
#include "CalendarEditor.h"
|
||||||
#include "wxGridCellBitmapRenderer.h"
|
#include "wxGridCellBitmapRenderer.h"
|
||||||
|
|
||||||
#define OWN_CYAN wxColour(0x99, 0xCC, 0xFF)
|
#include "view.h"
|
||||||
#define OWN_YELLOW wxColour(0xFF, 0xFF, 0x99)
|
|
||||||
#define OWN_GREEN wxColour(0x3D, 0xEB, 0x3D)
|
|
||||||
|
|
||||||
#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 DELETE_ICON "ressources/icons/process-stop.png"
|
|
||||||
#define CHECKED_ICON "ressources/icons/tick-icon.png"
|
|
||||||
|
|
||||||
#include <controller/KissCount.h>
|
#include <controller/KissCount.h>
|
||||||
#include "wxUI.h"
|
#include "wxUI.h"
|
||||||
|
|
|
@ -23,6 +23,7 @@ enum {BUTTON_ACCOUNT_ID=1, BUTTON_STATS_ID, BUTTON_SEARCH_ID, BUTTON_PREFS_ID, B
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(ButtonPanel, wxPanel)
|
BEGIN_EVENT_TABLE(ButtonPanel, wxPanel)
|
||||||
EVT_BUTTON(BUTTON_ACCOUNT_ID, ButtonPanel::OnButtonAccount)
|
EVT_BUTTON(BUTTON_ACCOUNT_ID, ButtonPanel::OnButtonAccount)
|
||||||
|
EVT_BUTTON(BUTTON_SEARCH_ID, ButtonPanel::OnButtonSearch)
|
||||||
EVT_BUTTON(BUTTON_PREFS_ID, ButtonPanel::OnButtonPreferences)
|
EVT_BUTTON(BUTTON_PREFS_ID, ButtonPanel::OnButtonPreferences)
|
||||||
EVT_BUTTON(BUTTON_CHANGE_USER_ID, ButtonPanel::OnButtonChangeUser)
|
EVT_BUTTON(BUTTON_CHANGE_USER_ID, ButtonPanel::OnButtonChangeUser)
|
||||||
EVT_BUTTON(BUTTON_ABOUT_ID, ButtonPanel::OnButtonAbout)
|
EVT_BUTTON(BUTTON_ABOUT_ID, ButtonPanel::OnButtonAbout)
|
||||||
|
@ -75,6 +76,11 @@ void ButtonPanel::OnButtonAccount(wxCommandEvent& event)
|
||||||
_wxUI->ShowAccount();
|
_wxUI->ShowAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ButtonPanel::OnButtonSearch(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
_wxUI->ShowSearch();
|
||||||
|
}
|
||||||
|
|
||||||
void ButtonPanel::OnButtonPreferences(wxCommandEvent& event)
|
void ButtonPanel::OnButtonPreferences(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
_wxUI->ShowPreferences();
|
_wxUI->ShowPreferences();
|
||||||
|
|
|
@ -26,13 +26,7 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <controller/KissCount.h>
|
#include <controller/KissCount.h>
|
||||||
#include "wxUI.h"
|
#include "wxUI.h"
|
||||||
|
|
||||||
#define ACCOUNT_ICON "ressources/icons/administrator-icon.png"
|
#include "view.h"
|
||||||
#define STATS_ICON "ressources/icons/chart-icon.png"
|
|
||||||
#define SEARCH_ICON "ressources/icons/Search-icon.png"
|
|
||||||
#define PREFS_ICON "ressources/icons/options-icon.png"
|
|
||||||
#define CHANGE_USER_ICON "ressources/icons/Clients-icon.png"
|
|
||||||
#define ABOUT_ICON "ressources/icons/windows-users-icon.png"
|
|
||||||
#define QUIT_ICON "ressources/icons/system-log-out.png"
|
|
||||||
|
|
||||||
class KissCount;
|
class KissCount;
|
||||||
class wxUI;
|
class wxUI;
|
||||||
|
@ -45,6 +39,7 @@ class ButtonPanel: public wxPanel
|
||||||
~ButtonPanel();
|
~ButtonPanel();
|
||||||
|
|
||||||
void OnButtonAccount(wxCommandEvent& event);
|
void OnButtonAccount(wxCommandEvent& event);
|
||||||
|
void OnButtonSearch(wxCommandEvent& event);
|
||||||
void OnButtonPreferences(wxCommandEvent& event);
|
void OnButtonPreferences(wxCommandEvent& event);
|
||||||
void OnButtonChangeUser(wxCommandEvent& event);
|
void OnButtonChangeUser(wxCommandEvent& event);
|
||||||
void OnButtonAbout(wxCommandEvent& event);
|
void OnButtonAbout(wxCommandEvent& event);
|
||||||
|
|
|
@ -28,7 +28,10 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||||
class GridAccount : public wxGrid
|
class GridAccount : public wxGrid
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GridAccount(wxWindow *parent, wxWindowID id) : wxGrid(parent, id) {}
|
GridAccount(wxWindow *parent, wxWindowID id) : wxGrid(parent, id),
|
||||||
|
_fixCosts(0), _week1(0), _week2(0), _week3(0), _week4(0)
|
||||||
|
{}
|
||||||
|
|
||||||
wxPen GetColGridLinePen (int col) {return wxPen(*wxBLACK, 1, wxSOLID);}
|
wxPen GetColGridLinePen (int col) {return wxPen(*wxBLACK, 1, wxSOLID);}
|
||||||
wxPen GetRowGridLinePen (int row) {
|
wxPen GetRowGridLinePen (int row) {
|
||||||
if (row == 0 || row == _fixCosts ||
|
if (row == 0 || row == _fixCosts ||
|
||||||
|
|
|
@ -22,8 +22,8 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||||
wxString months[12] ;
|
wxString months[12] ;
|
||||||
|
|
||||||
wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxSize& size)
|
wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||||
: wxFrame(NULL, -1, title, pos, size), _kiss(kiss), _accountPanel(NULL), _preferencesPanel(NULL), _curPanel(NULL),
|
: wxFrame(NULL, -1, title, pos, size), _kiss(kiss), _accountPanel(NULL), _searchPanel(NULL), _preferencesPanel(NULL),
|
||||||
_locale(NULL), _needReload(false)
|
_curPanel(NULL), _locale(NULL), _needReload(false)
|
||||||
{
|
{
|
||||||
_hbox = new wxBoxSizer(wxVERTICAL);
|
_hbox = new wxBoxSizer(wxVERTICAL);
|
||||||
ButtonPanel* buttons = new ButtonPanel(_kiss, this);
|
ButtonPanel* buttons = new ButtonPanel(_kiss, this);
|
||||||
|
@ -50,6 +50,7 @@ wxUI::~wxUI()
|
||||||
{
|
{
|
||||||
if (_accountPanel) delete _accountPanel;
|
if (_accountPanel) delete _accountPanel;
|
||||||
if (_preferencesPanel) delete _preferencesPanel;
|
if (_preferencesPanel) delete _preferencesPanel;
|
||||||
|
if (_searchPanel) delete _searchPanel;
|
||||||
if (_locale) delete _locale;
|
if (_locale) delete _locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +112,11 @@ void wxUI::ShowAccount()
|
||||||
ShowPanel(_accountPanel);
|
ShowPanel(_accountPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxUI::ShowSearch()
|
||||||
|
{
|
||||||
|
ShowPanel(_searchPanel);
|
||||||
|
}
|
||||||
|
|
||||||
void wxUI::ShowPreferences()
|
void wxUI::ShowPreferences()
|
||||||
{
|
{
|
||||||
ShowPanel(_preferencesPanel);
|
ShowPanel(_preferencesPanel);
|
||||||
|
@ -138,18 +144,22 @@ void wxUI::LoadUser()
|
||||||
if (_preferencesPanel)
|
if (_preferencesPanel)
|
||||||
delete _preferencesPanel;
|
delete _preferencesPanel;
|
||||||
|
|
||||||
|
if (_searchPanel)
|
||||||
|
delete _searchPanel;
|
||||||
|
|
||||||
if (user->_preferences[wxT("language")] != wxT(""))
|
if (user->_preferences[wxT("language")] != wxT(""))
|
||||||
SetLanguage(user->GetLanguage());
|
SetLanguage(user->GetLanguage());
|
||||||
|
|
||||||
_preferencesPanel = new PreferencesPanel(_kiss, this);
|
|
||||||
_accountPanel = new AccountPanel(_kiss, this);
|
_accountPanel = new AccountPanel(_kiss, this);
|
||||||
|
_searchPanel = new SearchPanel(_kiss, this);
|
||||||
|
_preferencesPanel = new PreferencesPanel(_kiss, this);
|
||||||
|
|
||||||
ShowPanel(_accountPanel);
|
ShowPanel(_accountPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxUI::ShowPanel(wxPanel* panel)
|
void wxUI::ShowPanel(wxPanel* panel)
|
||||||
{
|
{
|
||||||
int month, year, account=0, preferences=0;
|
int month, year, account=0, preferences=0, search=0;
|
||||||
wxShowEvent event;
|
wxShowEvent event;
|
||||||
|
|
||||||
if (!panel) return;
|
if (!panel) return;
|
||||||
|
@ -174,13 +184,20 @@ void wxUI::ShowPanel(wxPanel* panel)
|
||||||
preferences = 1;
|
preferences = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (panel == _searchPanel)
|
||||||
|
{
|
||||||
|
search = 1;
|
||||||
|
}
|
||||||
|
|
||||||
delete _accountPanel;
|
delete _accountPanel;
|
||||||
delete _preferencesPanel;
|
delete _preferencesPanel;
|
||||||
|
delete _searchPanel;
|
||||||
|
|
||||||
_accountPanel = new AccountPanel(_kiss, this);
|
_accountPanel = new AccountPanel(_kiss, this);
|
||||||
if (year != -1)
|
if (year != -1)
|
||||||
_accountPanel->ShowMonth(month, year);
|
_accountPanel->ShowMonth(month, year);
|
||||||
_preferencesPanel = new PreferencesPanel(_kiss, this);
|
_preferencesPanel = new PreferencesPanel(_kiss, this);
|
||||||
|
_searchPanel = new SearchPanel(_kiss, this);
|
||||||
|
|
||||||
if (account)
|
if (account)
|
||||||
{
|
{
|
||||||
|
@ -192,6 +209,11 @@ void wxUI::ShowPanel(wxPanel* panel)
|
||||||
_preferencesPanel->OnShow(event);
|
_preferencesPanel->OnShow(event);
|
||||||
panel = _preferencesPanel;
|
panel = _preferencesPanel;
|
||||||
}
|
}
|
||||||
|
if (search)
|
||||||
|
{
|
||||||
|
_searchPanel->OnShow(event);
|
||||||
|
panel = _searchPanel;
|
||||||
|
}
|
||||||
|
|
||||||
_needReload = false;
|
_needReload = false;
|
||||||
}
|
}
|
||||||
|
@ -221,8 +243,12 @@ void wxUI::KillMe()
|
||||||
if (_preferencesPanel)
|
if (_preferencesPanel)
|
||||||
delete _preferencesPanel;
|
delete _preferencesPanel;
|
||||||
|
|
||||||
|
if (_searchPanel)
|
||||||
|
delete _searchPanel;
|
||||||
|
|
||||||
_accountPanel = NULL;
|
_accountPanel = NULL;
|
||||||
_preferencesPanel = NULL;
|
_preferencesPanel = NULL;
|
||||||
|
_searchPanel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxUI::NeedReload()
|
void wxUI::NeedReload()
|
||||||
|
|
|
@ -26,6 +26,7 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "PreferencesPanel.h"
|
#include "PreferencesPanel.h"
|
||||||
#include "UsersDialog.h"
|
#include "UsersDialog.h"
|
||||||
#include "GenerateDialog.h"
|
#include "GenerateDialog.h"
|
||||||
|
#include "SearchPanel.h"
|
||||||
#include <controller/KissCount.h>
|
#include <controller/KissCount.h>
|
||||||
|
|
||||||
class KissCount;
|
class KissCount;
|
||||||
|
@ -47,6 +48,7 @@ class wxUI: public wxFrame
|
||||||
void LoadUser();
|
void LoadUser();
|
||||||
|
|
||||||
void ShowAccount();
|
void ShowAccount();
|
||||||
|
void ShowSearch();
|
||||||
void ShowPreferences();
|
void ShowPreferences();
|
||||||
void GenerateMonth(int month, int year);
|
void GenerateMonth(int month, int year);
|
||||||
|
|
||||||
|
@ -61,6 +63,7 @@ class wxUI: public wxFrame
|
||||||
KissCount *_kiss;
|
KissCount *_kiss;
|
||||||
wxBoxSizer *_hbox;
|
wxBoxSizer *_hbox;
|
||||||
AccountPanel *_accountPanel;
|
AccountPanel *_accountPanel;
|
||||||
|
SearchPanel *_searchPanel;
|
||||||
PreferencesPanel *_preferencesPanel;
|
PreferencesPanel *_preferencesPanel;
|
||||||
wxPanel *_curPanel;
|
wxPanel *_curPanel;
|
||||||
wxLocale *_locale;
|
wxLocale *_locale;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user