1
//---------------------------------------------------------------------------------------
2
// LenMus Phonascus: The teacher of music
3
// Copyright (c) 2002-2012 LenMus project
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU General Public License as published by the Free Software Foundation,
7
// either version 3 of the License, or (at your option) any later version.
9
// This program is distributed in the hope that it will be useful, but WITHOUT ANY
10
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License along with this
14
// program. If not, see <http://www.gnu.org/licenses/>.
16
// For any comment, suggestion or feature request, please contact the manager of
17
// the project at cecilios@users.sourceforge.net
19
//---------------------------------------------------------------------------------------
22
#include "lenmus_dlg_exercise_mode.h"
23
#include "lenmus_constrains.h"
27
//#include "lomse_pitch.h"
28
//#include "lomse_internal_model.h"
29
//using namespace lomse;
32
#include <wx/wxprec.h>
34
#include <wx/dialog.h>
35
#include <wx/button.h>
41
//-----------------------------------------------------------------------------
42
// Event table: connect the events to the handler functions to process them
43
//-----------------------------------------------------------------------------
45
BEGIN_EVENT_TABLE(DlgExerciseMode, wxDialog)
46
EVT_BUTTON(wxID_OK, DlgExerciseMode::OnAcceptClicked)
51
//---------------------------------------------------------------------------------------
52
DlgExerciseMode::DlgExerciseMode(wxWindow* parent, int* pMode,
53
ExerciseOptions* pConstrains)
54
: wxDialog(parent, wxID_ANY, _("Choose the operation mode"),
55
#if (LENMUS_PLATFORM_UNIX == 1)
56
//BUG BYPASS: In linux doesn't auto-resize. I don't know why
57
wxDefaultPosition, wxSize(700, 520),
59
wxDefaultPosition, wxSize(700, -1),
61
wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER )
63
, m_pRadLearning(NULL)
64
, m_pRadPractice(NULL)
68
, m_pConstrains(pConstrains)
75
//---------------------------------------------------------------------------------------
76
DlgExerciseMode::~DlgExerciseMode()
80
//---------------------------------------------------------------------------------------
81
void DlgExerciseMode::create_controls()
83
//AWARE: Code created with wxFormBuilder and copied here.
85
//added if-then blocks to control which buttons to create
86
//added window style wxRB_GROUP to first radio button
88
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
90
wxBoxSizer* pMainSizer;
91
pMainSizer = new wxBoxSizer( wxVERTICAL );
93
if (m_pConstrains->IsGenerationModeSupported(k_learning_mode))
95
m_pRadLearning = new wxRadioButton( this, wxID_ANY, _("Learning mode"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
96
pMainSizer->Add( m_pRadLearning, 0, wxTOP|wxRIGHT|wxLEFT|wxBOTTOM, 10 );
98
m_pLblLearning = new wxStaticText( this, wxID_ANY, _("The program will record and analyse your answers. Questions will focus on those issues in wich the program detects that you are having more trouble. This mode minimizes your study time and optimises your learning rate. It is based on the 'Leitner' methodology, also known as 'spaced repetition'."), wxPoint( -1,-1 ), wxDefaultSize, 0 );
99
m_pLblLearning->Wrap( 650 );
100
pMainSizer->Add( m_pLblLearning, 0, wxLEFT, 30 );
103
if (m_pConstrains->IsGenerationModeSupported(k_practise_mode))
105
m_pRadPractice = new wxRadioButton( this, wxID_ANY, _("Practice mode"), wxDefaultPosition, wxDefaultSize, 0 );
106
pMainSizer->Add( m_pRadPractice, 0, wxTOP|wxRIGHT|wxLEFT|wxBOTTOM, 10 );
108
m_pLblPractice = new wxStaticText( this, wxID_ANY, _("The program uses your performance data, saved in learning mode, to choose questions. It selects questions at random but giving more probability to those that are troubling you. This mode is useful when you have finished your daily assignment in 'learning' mode and you would like to practise more."), wxPoint( -1,-1 ), wxDefaultSize, 0 );
109
m_pLblPractice->Wrap( 650 );
110
pMainSizer->Add( m_pLblPractice, 0, wxLEFT, 30 );
113
if (m_pConstrains->IsGenerationModeSupported(k_exam_mode))
115
m_pRadExam = new wxRadioButton( this, wxID_ANY, _("Exam mode"), wxDefaultPosition, wxDefaultSize, 0 );
116
pMainSizer->Add( m_pRadExam, 0, wxTOP|wxRIGHT|wxLEFT|wxBOTTOM, 10 );
118
m_pLblExam = new wxStaticText( this, wxID_ANY, _("Neither your saved performance data not your answers to previous questions are taken into account to formulate questions. At any moment, all possible questions have the same probability of being asked. This mode is useful for testing your knowledge before taking an examination, but is less useful for learning."), wxPoint( -1,-1 ), wxDefaultSize, 0 );
119
m_pLblExam->Wrap( 650 );
120
pMainSizer->Add( m_pLblExam, 0, wxLEFT, 30 );
123
if (m_pConstrains->IsGenerationModeSupported(k_quiz_mode))
125
m_pRadQuiz = new wxRadioButton( this, wxID_ANY, _("Quiz mode"), wxDefaultPosition, wxDefaultSize, 0 );
126
pMainSizer->Add( m_pRadQuiz, 0, wxTOP|wxRIGHT|wxLEFT|wxBOTTOM, 10 );
128
m_pLblQuiz = new wxStaticText( this, wxID_ANY, _("This mode is similar to the 'exam' mode but two answer counters are displayed and questions are accounted in both counters: one in the first counter and the next one in the second counter. This mode is useful to work in pairs or in teams at classroom."), wxPoint( -1,-1 ), wxDefaultSize, 0 );
129
m_pLblQuiz->Wrap( 650 );
130
pMainSizer->Add( m_pLblQuiz, 0, wxBOTTOM|wxLEFT, 30 );
133
wxBoxSizer* pButtonSizer;
134
pButtonSizer = new wxBoxSizer( wxHORIZONTAL );
137
pButtonSizer->Add( 0, 0, 1, wxEXPAND, 5 );
139
m_pBtnAccept = new wxButton( this, wxID_OK, _("Accept"), wxDefaultPosition, wxDefaultSize, 0 );
140
pButtonSizer->Add( m_pBtnAccept, 0, wxBOTTOM, 5 );
143
pButtonSizer->Add( 0, 0, 1, wxEXPAND, 5 );
145
pMainSizer->Add( pButtonSizer, 1, wxEXPAND|wxBOTTOM, 20 );
147
this->SetSizer( pMainSizer );
152
//---------------------------------------------------------------------------------------
153
void DlgExerciseMode::set_current_mode()
155
if (*m_pMode == k_learning_mode)
156
m_pRadLearning->SetValue(true);
157
else if (*m_pMode == k_practise_mode)
158
m_pRadPractice->SetValue(true);
159
else if (*m_pMode == k_exam_mode)
160
m_pRadExam->SetValue(true);
162
m_pRadQuiz->SetValue(true);
165
//---------------------------------------------------------------------------------------
166
void DlgExerciseMode::OnAcceptClicked(wxCommandEvent& WXUNUSED(event))
168
if (m_pRadLearning && m_pRadLearning->GetValue())
169
*m_pMode = k_learning_mode;
170
else if (m_pRadPractice && m_pRadPractice->GetValue())
171
*m_pMode = k_practise_mode;
172
else if (m_pRadQuiz && m_pRadQuiz->GetValue())
173
*m_pMode = k_quiz_mode;
175
*m_pMode = k_exam_mode;
177
//terminate the dialog