Subversion Repositories Games.Chess Giants

Rev

Rev 1 | Rev 124 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1 Rev 21
Line 244... Line 244...
244
      // convert the status bar message to a hyperlink
244
      // convert the status bar message to a hyperlink
245
      ConvertStaticToHyperlink (GetDlgItem (hWnd, WINDOW_TEXT_STATUSBAR));
245
      ConvertStaticToHyperlink (GetDlgItem (hWnd, WINDOW_TEXT_STATUSBAR));
246
 
246
 
247
      // now show the window
247
      // now show the window
248
      ShowWindow (hWnd, SW_SHOW);
248
      ShowWindow (hWnd, SW_SHOW);
-
 
249
 
-
 
250
      return (0); // as MSDN says
249
   }
251
   }
250
 
252
 
251
   // else did we click the close button on the title bar ?
253
   // else did we click the close button on the title bar ?
252
   else if (message == WM_CLOSE)
254
   else if (message == WM_CLOSE)
253
   {
255
   {
254
      chosen_game = NULL; // we chose no game
256
      chosen_game = NULL; // we chose no game
255
      DestroyWindow (hWnd); // close the window
257
      DestroyWindow (hWnd); // close the window
-
 
258
 
-
 
259
      return (0); // as MSDN says
256
   }
260
   }
257
 
261
 
258
   // else are we destroying this window ?
262
   // else are we destroying this window ?
259
   else if (message == WM_DESTROY)
263
   else if (message == WM_DESTROY)
260
   {
264
   {
261
      hThisWnd = NULL; // window is closed
265
      hThisWnd = NULL; // window is closed
262
      SetForegroundWindow (hMainWnd); // restore focus on the main window
266
      SetForegroundWindow (hMainWnd); // restore focus on the main window
263
      is_window_games_validated = true; // return a "load PGN game" value (cancel value will be implied if chosen_game is NULL)
267
      is_window_games_validated = true; // return a "load PGN game" value (cancel value will be implied if chosen_game is NULL)
-
 
268
 
-
 
269
      return (0); // as MSDN says
264
   }
270
   }
265
 
271
 
266
   // else are we resizing the window ?
272
   // else are we resizing the window ?
267
   else if (message == WM_SIZE)
273
   else if (message == WM_SIZE)
268
   {
274
   {
Line 272... Line 278...
272
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_SELECTGAME), NULL, 16, 16, client_rect.right - 32, 32, SWP_NOZORDER);
278
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_SELECTGAME), NULL, 16, 16, client_rect.right - 32, 32, SWP_NOZORDER);
273
      SetWindowPos (GetDlgItem (hWnd, WINDOW_LIST_GAMES), NULL, 16, 48, client_rect.right - 32, client_rect.bottom - 104, SWP_NOZORDER);
279
      SetWindowPos (GetDlgItem (hWnd, WINDOW_LIST_GAMES), NULL, 16, 48, client_rect.right - 32, client_rect.bottom - 104, SWP_NOZORDER);
274
      SetWindowPos (GetDlgItem (hWnd, WINDOW_BUTTON_OK), NULL, client_rect.right / 2 - 104, client_rect.bottom - 48, 96, 32, SWP_NOZORDER);
280
      SetWindowPos (GetDlgItem (hWnd, WINDOW_BUTTON_OK), NULL, client_rect.right / 2 - 104, client_rect.bottom - 48, 96, 32, SWP_NOZORDER);
275
      SetWindowPos (GetDlgItem (hWnd, WINDOW_BUTTON_CANCEL), NULL, client_rect.right / 2 + 8, client_rect.bottom - 48, 96, 32, SWP_NOZORDER);
281
      SetWindowPos (GetDlgItem (hWnd, WINDOW_BUTTON_CANCEL), NULL, client_rect.right / 2 + 8, client_rect.bottom - 48, 96, 32, SWP_NOZORDER);
276
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_STATUSBAR), NULL, 0, client_rect.bottom - 16, client_rect.right, 16, SWP_NOZORDER);
282
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_STATUSBAR), NULL, 0, client_rect.bottom - 16, client_rect.right, 16, SWP_NOZORDER);
-
 
283
 
-
 
284
      return (0); // as MSDN says
277
   }
285
   }
278
 
286
 
279
   // else are we asking how big/small we can resize ?
287
   // else are we asking how big/small we can resize ?
280
   else if (message == WM_GETMINMAXINFO)
288
   else if (message == WM_GETMINMAXINFO)
281
   {
289
   {
282
      minmax = (MINMAXINFO *) lParam; // get a pointer to the min/max info structure
290
      minmax = (MINMAXINFO *) lParam; // get a pointer to the min/max info structure
283
 
291
 
284
      minmax->ptMinTrackSize.x = WINDOW_MIN_WIDTH;
292
      minmax->ptMinTrackSize.x = WINDOW_MIN_WIDTH;
285
      minmax->ptMinTrackSize.y = WINDOW_MIN_HEIGHT;
293
      minmax->ptMinTrackSize.y = WINDOW_MIN_HEIGHT;
-
 
294
 
-
 
295
      return (0); // as MSDN says
286
   }
296
   }
287
 
297
 
288
   // is it a list view message ?
298
   // is it a list view message ?
289
   else if ((message == WM_NOTIFY) && (wParam == WINDOW_LIST_GAMES))
299
   else if ((message == WM_NOTIFY) && (wParam == WINDOW_LIST_GAMES))
290
   {
300
   {
Line 310... Line 320...
310
            Header_SetItem (ListView_GetHeader (lv->hdr.hwndFrom), column_index, &hdi); // update the column's sort arrow state
320
            Header_SetItem (ListView_GetHeader (lv->hdr.hwndFrom), column_index, &hdi); // update the column's sort arrow state
311
         }
321
         }
312
 
322
 
313
         // now sort the list view according to the column we selected and its current sort order
323
         // now sort the list view according to the column we selected and its current sort order
314
         ListView_SortItems (lv->hdr.hwndFrom, CompareProc_ListGames, lv->iSubItem);
324
         ListView_SortItems (lv->hdr.hwndFrom, CompareProc_ListGames, lv->iSubItem);
315
      }
325
      }
316
 
326
 
317
      // else is it a single click on one of the elements ?
327
      // else is it a single click on one of the elements ?
318
      else if (lv->hdr.code == NM_CLICK)
328
      else if (lv->hdr.code == NM_CLICK)
319
         EnableWindow (GetDlgItem (hWnd, WINDOW_BUTTON_OK), true); // enable the OK button back
329
         EnableWindow (GetDlgItem (hWnd, WINDOW_BUTTON_OK), true); // enable the OK button back
320
 
330
 
321
      // else is it a double-click on one of the elements ?
331
      // else is it a double-click on one of the elements ?
322
      else if (lv->hdr.code == NM_DBLCLK)
332
      else if (lv->hdr.code == NM_DBLCLK)
323
         PostMessage (hWnd, WM_COMMAND, WINDOW_BUTTON_OK, NULL); // if so, act as if we clicked the OK button
333
         PostMessage (hWnd, WM_COMMAND, WINDOW_BUTTON_OK, NULL); // if so, act as if we clicked the OK button
-
 
334
 
-
 
335
      // no return value, says MSDN
324
   }
336
   }
325
 
337
 
326
   // else did we take action on one of the controls ?
338
   // else did we take action on one of the controls ?
327
   else if (message == WM_COMMAND)
339
   else if (message == WM_COMMAND)
328
   {
340
   {
Line 339... Line 351...
339
            lvi.iItem = item_index;
351
            lvi.iItem = item_index;
340
            if (ListView_GetItem (hListWnd, &lvi))
352
            if (ListView_GetItem (hListWnd, &lvi))
341
               chosen_game = (pgngame_t *) lvi.lParam; // retrieve a pointer to the PGN game from the item
353
               chosen_game = (pgngame_t *) lvi.lParam; // retrieve a pointer to the PGN game from the item
342
         }
354
         }
343
 
355
 
344
         DestroyWindow (hWnd); // close the window
356
         DestroyWindow (hWnd); // close the window
345
      }
357
      }
346
 
358
 
347
      // else was it the cancel button ?
359
      // else was it the cancel button ?
348
      else if (wParam_loword == WINDOW_BUTTON_CANCEL)
360
      else if (wParam_loword == WINDOW_BUTTON_CANCEL)
349
      {
361
      {
350
         chosen_game = NULL; // we chose no game
362
         chosen_game = NULL; // we chose no game
351
         DestroyWindow (hWnd); // close the window
363
         DestroyWindow (hWnd); // close the window
352
      }
364
      }
353
 
365
 
354
      // else was it the status bar hyperlink ?
366
      // else was it the status bar hyperlink ?
355
      else if (wParam_loword == STATICTEXT_NEWGAME_STATUSBAR)
367
      else if (wParam_loword == STATICTEXT_NEWGAME_STATUSBAR)
356
         ShellExecute (NULL, L"open", PROGRAM_URL, NULL, NULL, SW_MAXIMIZE); // open the donation page in the default browser, maximized
368
         ShellExecute (NULL, L"open", PROGRAM_URL, NULL, NULL, SW_MAXIMIZE); // open the donation page in the default browser, maximized
-
 
369
 
-
 
370
      return (0); // as MSDN says
357
   }
371
   }
358
 
372
 
359
   // call the default window message processing function to keep things going
373
   // call the default window message processing function to keep things going
360
   return (DefWindowProc (hWnd, message, wParam, lParam));
374
   return (DefWindowProc (hWnd, message, wParam, lParam));
361
}
375
}