-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathClockAdjustDialog.cpp
46 lines (38 loc) · 1.39 KB
/
ClockAdjustDialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "stdafx.h"
#include "ClockAdjustDialog.h"
#include "TimeControl.h"
#include "FastBoard.h"
ClockAdjustDialog::ClockAdjustDialog( wxWindow* parent )
:
TClockAdjustDialog( parent )
{
}
void ClockAdjustDialog::doCancel( wxCommandEvent& event ) {
event.Skip();
}
void ClockAdjustDialog::doOK( wxCommandEvent& event ) {
int tleftmins = m_spinCtrlBlackMins->GetValue();
int tleftsecs = m_spinCtrlBlackSecs->GetValue();
m_tc.adjust_time(FastBoard::BLACK, (tleftmins * 60 + tleftsecs) * 100, 0);
tleftmins = m_spinCtrlWhiteMins->GetValue();
tleftsecs = m_spinCtrlWhiteSecs->GetValue();
m_tc.adjust_time(FastBoard::WHITE, (tleftmins * 60 + tleftsecs) * 100, 0);
event.Skip();
}
void ClockAdjustDialog::doInit( wxInitDialogEvent& event ) {
int mins, secs;
mins = (m_tc.get_remaining_time(FastBoard::BLACK) / 100) / 60;
secs = (m_tc.get_remaining_time(FastBoard::BLACK) / 100) % 60;
m_spinCtrlBlackMins->SetValue(mins);
m_spinCtrlBlackSecs->SetValue(secs);
mins = (m_tc.get_remaining_time(FastBoard::WHITE) / 100) / 60;
secs = (m_tc.get_remaining_time(FastBoard::WHITE) / 100) % 60;
m_spinCtrlWhiteMins->SetValue(mins);
m_spinCtrlWhiteSecs->SetValue(secs);
}
void ClockAdjustDialog::setTimeControl(TimeControl tc) {
m_tc = tc;
}
TimeControl ClockAdjustDialog::getTimeControl(void) {
return m_tc;
}