| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2006-2009 by Guy Rutenberg * |
| 3 | * [email protected] * |
| 4 | * * |
| 5 | * This program is free software; you can redistribute it and/or modify * |
| 6 | * it under the terms of the GNU General Public License as published by * |
| 7 | * the Free Software Foundation; either version 2 of the License, or * |
| 8 | * (at your option) any later version. * |
| 9 | * * |
| 10 | * This program is distributed in the hope that it will be useful, * |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 13 | * GNU General Public License for more details. * |
| 14 | * * |
| 15 | * You should have received a copy of the GNU General Public License * |
| 16 | * along with this program; if not, write to the * |
| 17 | * Free Software Foundation, Inc., * |
| 18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 19 | ***************************************************************************/ |
| 20 | |
| 21 | #include <wx/button.h> |
| 22 | #include <wx/sizer.h> |
| 23 | |
| 24 | #include "statistics_dialog.h"cxx . . $ `<file>/src/statistics_dialog.h`/ |
| 25 | |
| 26 | #include "icon32.xpm"cxx . . $ `<file>/src/icon32.xpm`/ |
| 27 | |
| 28 | using namespace std; |
| 29 | using namespace statistics_dialog; |
| 30 | |
| 31 | StatisticsDialogcxx . . $ statistics_dialog/StatisticsDialog#::StatisticsDialogcxx . . $ statistics_dialog/StatisticsDialog#StatisticsDialog(1d7a04b1140c57b2).(wxWindowcxx . . $ wxWindow#* parent,statisticscxx . . $ statistics/::Statisticscxx . . $ statistics/Statistics#* stats) : |
| 32 | wxDialogcxx . . $ wxDialog#wxDialog(d091a3913c1b2ac).(parent, wxID_ANYcxx . . $ wxID_ANY., wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("Statistics"), wxDefaultPositioncxx . . $ wxDefaultPosition., wxDefaultSizecxx . . $ wxDefaultSize., wxDEFAULT_DIALOG_STYLEcxx . . $ `<external>/1556222971298634691/dialog.h:31:9`! | wxRESIZE_BORDERcxx . . $ `<external>/10524890736914687764/toplevel.h:76:9`!) |
| 33 | { |
| 34 | m_statscxx . . $ statistics_dialog/StatisticsDialog#m_stats. = stats; |
| 35 | |
| 36 | SetIconcxx . . $ wxTopLevelWindowBase#SetIcon(d249de01a60891a7).(wxIconcxx . . $ wxIcon#wxIcon(ac4b840ac9fbb56d).(icon32_xpmcxx . . $ icon32_xpm.)); |
| 37 | |
| 38 | CreateControlscxx . . $ statistics_dialog/StatisticsDialog#CreateControls(49f6e7a06ebc5aa8).(); |
| 39 | LoadDatacxx . . $ statistics_dialog/StatisticsDialog#LoadData(49f6e7a06ebc5aa8).(); |
| 40 | DoLayoutcxx . . $ statistics_dialog/StatisticsDialog#DoLayout(49f6e7a06ebc5aa8).(); |
| 41 | ConnectEventTablecxx . . $ statistics_dialog/StatisticsDialog#ConnectEventTable(49f6e7a06ebc5aa8).(); |
| 42 | } |
| 43 | |
| 44 | void StatisticsDialogcxx . . $ statistics_dialog/StatisticsDialog#::CreateControlscxx . . $ statistics_dialog/StatisticsDialog#CreateControls(49f6e7a06ebc5aa8).() |
| 45 | { |
| 46 | games_startedcxx . . $ statistics_dialog/StatisticsDialog#games_started. = new wxStaticTextcxx . . $ wxStaticText#(this, wxID_ANYcxx . . $ wxID_ANY., wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("")); |
| 47 | games_finishedcxx . . $ statistics_dialog/StatisticsDialog#games_finished. = new wxStaticTextcxx . . $ wxStaticText#(this, wxID_ANYcxx . . $ wxID_ANY., wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("")); |
| 48 | pie_plotcxx . . $ statistics_dialog/StatisticsDialog#pie_plot. = new simple_pie_plotcxx . . $ simple_pie_plot/::SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#(this, wxID_ANYcxx . . $ wxID_ANY.); |
| 49 | statistics_reset_datecxx . . $ statistics_dialog/StatisticsDialog#statistics_reset_date. = new wxStaticTextcxx . . $ wxStaticText#(this, wxID_ANYcxx . . $ wxID_ANY., wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("")); |
| 50 | } |
| 51 | |
| 52 | void StatisticsDialogcxx . . $ statistics_dialog/StatisticsDialog#::LoadDatacxx . . $ statistics_dialog/StatisticsDialog#LoadData(49f6e7a06ebc5aa8).() |
| 53 | { |
| 54 | wxStringcxx . . $ wxString# tmpcxx . . $ wxString#wxString(49f6e7a06ebc5aa8).; |
| 55 | tmp =cxx . . $ wxString#`operator=`(112791f5da12414c). wxStringcxx . . $ wxString#::Formatcxx . . $ wxString#Format(790352b8134174a2).(wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("Games started: %i"), m_statscxx . . $ statistics_dialog/StatisticsDialog#m_stats.->games_startedcxx . . $ statistics/Statistics#games_started(b126dc7c1de90089).()); |
| 56 | games_startedcxx . . $ statistics_dialog/StatisticsDialog#games_started.->SetLabelcxx . . $ wxStaticText#SetLabel(eec3608749d303b4).(tmp); |
| 57 | |
| 58 | tmp =cxx . . $ wxString#`operator=`(112791f5da12414c). wxStringcxx . . $ wxString#::Formatcxx . . $ wxString#Format(790352b8134174a2).(wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("Games finished: %i"), m_statscxx . . $ statistics_dialog/StatisticsDialog#m_stats.->games_finishedcxx . . $ statistics/Statistics#games_finished(b126dc7c1de90089).()); |
| 59 | games_finishedcxx . . $ statistics_dialog/StatisticsDialog#games_finished.->SetLabelcxx . . $ wxStaticText#SetLabel(eec3608749d303b4).(tmp); |
| 60 | |
| 61 | wxDateTimecxx . . $ wxDateTime# reset_timecxx . . $ wxDateTime#wxDateTime(1624ee8275b10bda).(m_statscxx . . $ statistics_dialog/StatisticsDialog#m_stats.->last_resetcxx . . $ statistics/Statistics#last_reset(da6335ded91d79c2).()); |
| 62 | tmp =cxx . . $ wxString#`operator=`(112791f5da12414c). wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("Last reset: ") +cxx . . $ operator+(b9d4cd82031bb246). reset_time.Formatcxx . . $ wxDateTime#Format(7503292c5415c523).(); |
| 63 | statistics_reset_datecxx . . $ statistics_dialog/StatisticsDialog#statistics_reset_date.->SetLabelcxx . . $ wxStaticText#SetLabel(eec3608749d303b4).(tmp); |
| 64 | |
| 65 | vectorcxx . . $ std/vector#<int> score_dist = m_statscxx . . $ std/vector#vector(b1ea180184b47f03).->score_distributioncxx . . $ statistics/Statistics#score_distribution(95cc8889724c44b9).(); |
| 66 | vectorcxx . . $ std/vector#<double> distcxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 67 | vectorcxx . . $ std/vector#<wxStringcxx . . $ wxString#> labelscxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 68 | for (int i; i<score_dist.sizecxx . . $ std/vector#size(fe4d2d262d4164a8).(); i++) { |
| 69 | if (score_dist[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i]) { |
| 70 | assertcxx . . $ `/usr/include/assert.h:102:11`!(score_dist[i]>0); |
| 71 | dist.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(score_dist[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i]); |
| 72 | tmp =cxx . . $ wxString#`operator=`(112791f5da12414c). wxStringcxx . . $ wxString#::Formatcxx . . $ wxString#Format(24300e04ac582c49).(wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("%i - %i"), |
| 73 | i*statisticscxx . . $ statistics/::score_distribution_granualitycxx . . $ statistics/score_distribution_granuality., |
| 74 | (i+1)*statisticscxx . . $ statistics/::score_distribution_granualitycxx . . $ statistics/score_distribution_granuality.); |
| 75 | labels.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(tmp); |
| 76 | } |
| 77 | } |
| 78 | pie_plotcxx . . $ statistics_dialog/StatisticsDialog#pie_plot.->SetDatacxx . . $ simple_pie_plot/SimplePiePlot#SetData(9cc36d28fd3db431).(distcxx . . $ std/vector#vector(a1201200cf0efa42)., labelscxx . . $ std/vector#vector(a1201200cf0efa42).); |
| 79 | } |
| 80 | |
| 81 | void StatisticsDialogcxx . . $ statistics_dialog/StatisticsDialog#::DoLayoutcxx . . $ statistics_dialog/StatisticsDialog#DoLayout(49f6e7a06ebc5aa8).() |
| 82 | { |
| 83 | wxBoxSizercxx . . $ wxBoxSizer#* top_sizer = new wxBoxSizercxx . . $ wxBoxSizer#wxBoxSizer(d4f767463ce0a6b3).(wxVERTICALcxx . . $ wxVERTICAL.); |
| 84 | |
| 85 | wxStaticBoxSizercxx . . $ wxStaticBoxSizer#* game_counts = new wxStaticBoxSizercxx . . $ wxStaticBoxSizer#( new wxStaticBoxcxx . . $ wxStaticBox#wxStaticBox(d091a3913c1b2ac).( this, wxID_ANYcxx . . $ wxID_ANY., wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("Game Counts") ), wxHORIZONTALcxx . . $ wxHORIZONTAL.); |
| 86 | game_counts->Addcxx . . $ wxSizer#Add(71dcc790f806ec5).(games_startedcxx . . $ statistics_dialog/StatisticsDialog#games_started.); |
| 87 | game_counts->AddStretchSpacercxx . . $ wxSizer#AddStretchSpacer(fab1f36e22a68e4b).(10); |
| 88 | game_counts->Addcxx . . $ wxSizer#Add(71dcc790f806ec5).(games_finishedcxx . . $ statistics_dialog/StatisticsDialog#games_finished.); |
| 89 | top_sizer->Addcxx . . $ wxSizer#Add(c5b4b396efb9dbb2).(game_counts,0,wxEXPANDcxx . . $ wxEXPAND.,10); |
| 90 | |
| 91 | wxStaticBoxSizercxx . . $ wxStaticBoxSizer#* score_distribution = new wxStaticBoxSizercxx . . $ wxStaticBoxSizer#( new wxStaticBoxcxx . . $ wxStaticBox#wxStaticBox(d091a3913c1b2ac).( this, wxID_ANYcxx . . $ wxID_ANY., wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("Score Distribution") ), wxHORIZONTALcxx . . $ wxHORIZONTAL.); |
| 92 | score_distribution->Addcxx . . $ wxSizer#Add(71dcc790f806ec5).(pie_plotcxx . . $ statistics_dialog/StatisticsDialog#pie_plot., 1, wxEXPANDcxx . . $ wxEXPAND., 10); |
| 93 | top_sizer->Addcxx . . $ wxSizer#Add(c5b4b396efb9dbb2).(score_distribution,10,wxEXPANDcxx . . $ wxEXPAND., 10); |
| 94 | |
| 95 | top_sizer->Addcxx . . $ wxSizer#Add(71dcc790f806ec5).(statistics_reset_datecxx . . $ statistics_dialog/StatisticsDialog#statistics_reset_date.,0,wxEXPANDcxx . . $ wxEXPAND.,10); |
| 96 | |
| 97 | wxBoxSizercxx . . $ wxBoxSizer# *button_sizer = new wxBoxSizercxx . . $ wxBoxSizer#wxBoxSizer(d4f767463ce0a6b3).( wxHORIZONTALcxx . . $ wxHORIZONTAL. ); |
| 98 | wxSizerFlagscxx . . $ wxSizerFlags# flags = wxSizerFlagscxx . . $ wxSizerFlags#wxSizerFlags(d4f767463ce0a6b3).().Bordercxx . . $ wxSizerFlags#Border(dfdbc60f023876a4).(wxALLcxx . . $ wxALL. & ~wxLEFTcxx . . $ wxLEFT., 10); |
| 99 | button_sizer->AddStretchSpacercxx . . $ wxSizer#AddStretchSpacer(fab1f36e22a68e4b).(); |
| 100 | button_sizer->Addcxx . . $ wxSizer#Add(2646dc3ffda68198).(new wxButtoncxx . . $ wxButton#(this,wxID_CLEARcxx . . $ wxID_CLEAR., wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("Reset")),flags); |
| 101 | button_sizer->Addcxx . . $ wxSizer#Add(2646dc3ffda68198).( new wxButtoncxx . . $ wxButton#(this,wxID_CLOSEcxx . . $ wxID_CLOSE.), flags); |
| 102 | top_sizer->Addcxx . . $ wxSizer#Add(c5b4b396efb9dbb2).(button_sizer,0,wxEXPANDcxx . . $ wxEXPAND.); |
| 103 | |
| 104 | SetSizercxx . . $ wxWindowBase#SetSizer(6b8f606b81107616).(top_sizer); |
| 105 | top_sizer->SetSizeHintscxx . . $ wxSizer#SetSizeHints(4289b2e0b1e17a99).(this); |
| 106 | } |
| 107 | |
| 108 | |
| 109 | void StatisticsDialogcxx . . $ statistics_dialog/StatisticsDialog#::ConnectEventTablecxx . . $ statistics_dialog/StatisticsDialog#ConnectEventTable(49f6e7a06ebc5aa8).() |
| 110 | { |
| 111 | Connectcxx . . $ wxEvtHandler#Connect(bb4f3294b37e5589).(wxID_CLOSEcxx . . $ wxID_CLOSE., wxEVT_COMMAND_BUTTON_CLICKEDcxx . . $ `<external>/9123237030240659982/event.h:4822:9`!, wxCommandEventHandlercxx . . $ `<external>/9123237030240659982/event.h:4270:9`!(StatisticsDialog::OnClose)); |
| 112 | Connectcxx . . $ wxEvtHandler#Connect(bb4f3294b37e5589).(wxID_CLEARcxx . . $ wxID_CLEAR., wxEVT_COMMAND_BUTTON_CLICKEDcxx . . $ `<external>/9123237030240659982/event.h:4822:9`!, wxCommandEventHandlercxx . . $ `<external>/9123237030240659982/event.h:4270:9`!(StatisticsDialog::OnReset)); |
| 113 | } |
| 114 | |
| 115 | void StatisticsDialogcxx . . $ statistics_dialog/StatisticsDialog#::OnClosecxx . . $ statistics_dialog/StatisticsDialog#OnClose(f55e5a77ec619b42).(wxCommandEventcxx . . $ wxCommandEvent#& event) |
| 116 | { |
| 117 | Closecxx . . $ wxWindowBase#Close(efaadfb7dc14930a).(); |
| 118 | } |
| 119 | |
| 120 | |
| 121 | void StatisticsDialogcxx . . $ statistics_dialog/StatisticsDialog#::OnResetcxx . . $ statistics_dialog/StatisticsDialog#OnReset(f55e5a77ec619b42).(wxCommandEventcxx . . $ wxCommandEvent#& event) |
| 122 | { |
| 123 | int answer = wxMessageBoxcxx . . $ wxMessageBox(ecb3b78af7b1e8ff).( |
| 124 | wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("Are you sure you want to clear the statistics data?\nThis action cannot be reversed."), |
| 125 | wxTcxx . . $ `<external>/13533349018018911527/chartype.h:199:17`!("Are You Sure?"), |
| 126 | wxYEScxx . . $ `<external>/14689491191722134862/defs.h:1889:9`! | wxNOcxx . . $ `<external>/14689491191722134862/defs.h:1891:9`!, |
| 127 | this); |
| 128 | |
| 129 | if (answer == wxYEScxx . . $ `<external>/14689491191722134862/defs.h:1889:9`!) { |
| 130 | m_statscxx . . $ statistics_dialog/StatisticsDialog#m_stats.->resetcxx . . $ statistics/Statistics#reset(49f6e7a06ebc5aa8).(); |
| 131 | LoadDatacxx . . $ statistics_dialog/StatisticsDialog#LoadData(49f6e7a06ebc5aa8).(); |
| 132 | } |
| 133 | } |