}
void
+ClockClick(int which)
+{ // [HGM] code moved to back-end from winboard.c
+ if(which) { // black clock
+ if (gameMode == EditPosition || gameMode == IcsExamining) {
+ SetBlackToPlayEvent();
+ } else if (gameMode == EditGame || shiftKey) {
+ AdjustClock(which, -1);
+ } else if (gameMode == IcsPlayingWhite ||
+ gameMode == MachinePlaysBlack) {
+ CallFlagEvent();
+ }
+ } else { // white clock
+ if (gameMode == EditPosition || gameMode == IcsExamining) {
+ SetWhiteToPlayEvent();
+ } else if (gameMode == EditGame || shiftKey) {
+ AdjustClock(which, -1);
+ } else if (gameMode == IcsPlayingBlack ||
+ gameMode == MachinePlaysWhite) {
+ CallFlagEvent();
+ }
+ }
+}
+
+void
DrawEvent()
{
/* Offer draw or accept pending draw offer from opponent */
void TruncateGameEvent P((void));
void PauseEvent P((void));
void CallFlagEvent P((void));
+void ClockClick P((int which));
void AcceptEvent P((void));
void DeclineEvent P((void));
void RematchEvent P((void));
switch (message) {\r
case WM_LBUTTONDOWN:\r
if (PtInRect((LPRECT) &whiteRect, pt)) {\r
- if (gameMode == EditPosition) {\r
- SetWhiteToPlayEvent();\r
- } else if (gameMode == EditGame || GetKeyState(VK_SHIFT) < 0) {\r
- AdjustClock(flipClock, -1);\r
- } else if (gameMode == IcsPlayingBlack ||\r
- gameMode == MachinePlaysWhite) {\r
- CallFlagEvent();\r
- }\r
+ ClockClick(flipClock);\r
} else if (PtInRect((LPRECT) &blackRect, pt)) {\r
- if (gameMode == EditPosition) {\r
- SetBlackToPlayEvent();\r
- } else if (gameMode == EditGame || GetKeyState(VK_SHIFT) < 0) {\r
- AdjustClock(!flipClock, -1);\r
- } else if (gameMode == IcsPlayingWhite ||\r
- gameMode == MachinePlaysBlack) {\r
- CallFlagEvent();\r
- }\r
+ ClockClick(!flipClock);\r
}\r
dragInfo.start.x = dragInfo.start.y = -1;\r
dragInfo.from = dragInfo.start;\r
String *prms;
Cardinal *nprms;
{
- if (gameMode == EditPosition || gameMode == IcsExamining) {
- SetWhiteToPlayEvent();
- } else if (gameMode == IcsPlayingBlack || gameMode == MachinePlaysWhite) {
- CallFlagEvent();
- }
+ ClockClick(0);
}
void BlackClock(w, event, prms, nprms)
String *prms;
Cardinal *nprms;
{
- if (gameMode == EditPosition || gameMode == IcsExamining) {
- SetBlackToPlayEvent();
- } else if (gameMode == IcsPlayingWhite || gameMode == MachinePlaysBlack) {
- CallFlagEvent();
- }
+ ClockClick(1);
}