Subversion Repositories Games.Chess Giants

Rev

Rev 21 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21 Rev 124
Line 307... Line 307...
307
      // convert the status bar message to a hyperlink
307
      // convert the status bar message to a hyperlink
308
      ConvertStaticToHyperlink (GetDlgItem (hWnd, WINDOW_TEXT_STATUSBAR));
308
      ConvertStaticToHyperlink (GetDlgItem (hWnd, WINDOW_TEXT_STATUSBAR));
309
 
309
 
310
      // now show the window
310
      // now show the window
311
      ShowWindow (hWnd, SW_SHOW);
311
      ShowWindow (hWnd, SW_SHOW);
-
 
312
 
-
 
313
      return (0); // as MSDN says
312
   }
314
   }
313
 
315
 
314
   // else did we click the close button on the title bar ?
316
   // else did we click the close button on the title bar ?
315
   else if (message == WM_CLOSE)
317
   else if (message == WM_CLOSE)
-
 
318
   {
316
      DestroyWindow (hWnd); // close the window
319
      DestroyWindow (hWnd); // close the window
-
 
320
      return (0); // as MSDN says
-
 
321
   }
317
 
322
 
318
   // else are we destroying the window ?
323
   // else are we destroying the window ?
319
   else if (message == WM_DESTROY)
324
   else if (message == WM_DESTROY)
320
   {
325
   {
321
      KillTimer (hWnd, WINDOW_TIMER_REFRESH); // destroy the timer we used to refresh the window
326
      KillTimer (hWnd, WINDOW_TIMER_REFRESH); // destroy the timer we used to refresh the window
322
      hThisWnd = NULL; // window is closed
327
      hThisWnd = NULL; // window is closed
Line 327... Line 332...
327
 
332
 
328
      SAFE_free ((void **) &gametypes); // free the game types array
333
      SAFE_free ((void **) &gametypes); // free the game types array
329
      gametype_count = 0; // and reset its count
334
      gametype_count = 0; // and reset its count
330
 
335
 
331
      is_window_sought_validated = true; // remember we closed this window
336
      is_window_sought_validated = true; // remember we closed this window
-
 
337
      the_board.reevaluate = true; // refresh the GUI buttons if needed
-
 
338
      return (0); // as MSDN says
332
   }
339
   }
333
 
340
 
334
   // else are we resizing the window ?
341
   // else are we resizing the window ?
335
   else if (message == WM_SIZE)
342
   else if (message == WM_SIZE)
336
   {
343
   {
337
      // get the new window size
344
      // get the new window size
338
      GetClientRect (hWnd, &client_rect);
345
      GetClientRect (hWnd, &client_rect);
339
 
346
 
340
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_DOUBLECLICKORNARROWDOWN), NULL, 16, 16, client_rect.right - 32, 16, SWP_NOZORDER);
347
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_DOUBLECLICKORNARROWDOWN), NULL, 16, 16, client_rect.right - 32, 16, SWP_NOZORDER);
341
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_GAMEIS),           NULL,   8, 40, 208, 16, SWP_NOZORDER);
348
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_GAMEIS),           NULL,   8, 40, 208, 16, SWP_NOZORDER);
342
      SetWindowPos (GetDlgItem (hWnd, WINDOW_COMBOBOX_GAMEIS),       NULL, 224, 38, 128, 20, SWP_NOZORDER);
349
      SetWindowPos (GetDlgItem (hWnd, WINDOW_COMBOBOX_GAMEIS),       NULL, 224, 38, 128, 20, SWP_NOZORDER);
343
      SetWindowPos (GetDlgItem (hWnd, WINDOW_COMBOBOX_RATEDUNRATED), NULL, 384, 38,  96, 20, SWP_NOZORDER);
350
      SetWindowPos (GetDlgItem (hWnd, WINDOW_COMBOBOX_RATEDUNRATED), NULL, 384, 38,  96, 20, SWP_NOZORDER);
344
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_LEVELFROM),        NULL, 512, 40, 120, 16, SWP_NOZORDER);
351
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_LEVELFROM),        NULL, 512, 40, 120, 16, SWP_NOZORDER);
Line 346... Line 353...
346
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_LEVELTO),          NULL, 688, 40,  40, 16, SWP_NOZORDER);
353
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_LEVELTO),          NULL, 688, 40,  40, 16, SWP_NOZORDER);
347
      SetWindowPos (GetDlgItem (hWnd, WINDOW_EDITBOX_LEVELTO),       NULL, 736, 38,  48, 20, SWP_NOZORDER);
354
      SetWindowPos (GetDlgItem (hWnd, WINDOW_EDITBOX_LEVELTO),       NULL, 736, 38,  48, 20, SWP_NOZORDER);
348
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_YOUCANALSOPOSTYOURSBYCLICKINGHERE), NULL, 16, 64, client_rect.right - 32, 16, SWP_NOZORDER);
355
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_YOUCANALSOPOSTYOURSBYCLICKINGHERE), NULL, 16, 64, client_rect.right - 32, 16, SWP_NOZORDER);
349
      SetWindowPos (GetDlgItem (hWnd, WINDOW_LIST_SOUGHTGAMES), NULL, 16, 88, client_rect.right - 32, client_rect.bottom - 104, SWP_NOZORDER);
356
      SetWindowPos (GetDlgItem (hWnd, WINDOW_LIST_SOUGHTGAMES), NULL, 16, 88, client_rect.right - 32, client_rect.bottom - 104, SWP_NOZORDER);
350
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_STATUSBAR), NULL, 0, client_rect.bottom - 16, client_rect.right, 16, SWP_NOZORDER);
357
      SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_STATUSBAR), NULL, 0, client_rect.bottom - 16, client_rect.right, 16, SWP_NOZORDER);
-
 
358
 
-
 
359
      return (0); // as MSDN says
351
   }
360
   }
352
 
361
 
353
   // else are we asking how big/small we can resize ?
362
   // else are we asking how big/small we can resize ?
354
   else if (message == WM_GETMINMAXINFO)
363
   else if (message == WM_GETMINMAXINFO)
355
   {
364
   {
356
      minmax = (MINMAXINFO *) lParam; // get a pointer to the min/max info structure
365
      minmax = (MINMAXINFO *) lParam; // get a pointer to the min/max info structure
357
 
366
 
358
      minmax->ptMinTrackSize.x = WINDOW_MIN_WIDTH;
367
      minmax->ptMinTrackSize.x = WINDOW_MIN_WIDTH;
359
      minmax->ptMinTrackSize.y = WINDOW_MIN_HEIGHT;
368
      minmax->ptMinTrackSize.y = WINDOW_MIN_HEIGHT;
-
 
369
 
-
 
370
      return (0); // as MSDN says
360
   }
371
   }
361
 
372
 
362
   // else did we take action on one of the controls ?
373
   // else did we take action on one of the controls ?
363
   else if (message == WM_COMMAND)
374
   else if (message == WM_COMMAND)
364
   {
375
   {
365
      // was the filter combo box changed ?
376
      // was the filter combo box changed ?
Line 372... Line 383...
372
      // else was the rated/unrated combo box changed ?
383
      // else was the rated/unrated combo box changed ?
373
      if ((wParam_loword == WINDOW_COMBOBOX_RATEDUNRATED) && (wParam_hiword == CBN_SELCHANGE))
384
      if ((wParam_loword == WINDOW_COMBOBOX_RATEDUNRATED) && (wParam_hiword == CBN_SELCHANGE))
374
      {
385
      {
375
         soughtgames_updated = true; // remember sought games display is to be updated
386
         soughtgames_updated = true; // remember sought games display is to be updated
376
         SendMessage (hWnd, WM_TIMER, WINDOW_TIMER_REFRESH, NULL); // refresh window now
387
         SendMessage (hWnd, WM_TIMER, WINDOW_TIMER_REFRESH, NULL); // refresh window now
377
      }
388
      }
378
 
389
 
379
      // else was either of the rating edit box changed ?
390
      // else was either of the rating edit box changed ?
380
      else if ((wParam_loword == WINDOW_EDITBOX_LEVELFROM) && (wParam_hiword == EN_CHANGE))
391
      else if ((wParam_loword == WINDOW_EDITBOX_LEVELFROM) && (wParam_hiword == EN_CHANGE))
381
      {
392
      {
382
         soughtgames_updated = true; // remember sought games display is to be updated
393
         soughtgames_updated = true; // remember sought games display is to be updated
383
         SendMessage (hWnd, WM_TIMER, WINDOW_TIMER_REFRESH, NULL); // refresh window now
394
         SendMessage (hWnd, WM_TIMER, WINDOW_TIMER_REFRESH, NULL); // refresh window now
384
      }
395
      }
385
      else if ((wParam_loword == WINDOW_EDITBOX_LEVELTO) && (wParam_hiword == EN_CHANGE))
396
      else if ((wParam_loword == WINDOW_EDITBOX_LEVELTO) && (wParam_hiword == EN_CHANGE))
386
      {
397
      {
387
         soughtgames_updated = true; // remember sought games display is to be updated
398
         soughtgames_updated = true; // remember sought games display is to be updated
388
         SendMessage (hWnd, WM_TIMER, WINDOW_TIMER_REFRESH, NULL); // refresh window now
399
         SendMessage (hWnd, WM_TIMER, WINDOW_TIMER_REFRESH, NULL); // refresh window now
Line 393... Line 404...
393
         DialogBox_SendSeek (); // if so, open the seek dialog box
404
         DialogBox_SendSeek (); // if so, open the seek dialog box
394
 
405
 
395
      // else was it the status bar hyperlink ?
406
      // else was it the status bar hyperlink ?
396
      else if (wParam_loword == WINDOW_TEXT_STATUSBAR)
407
      else if (wParam_loword == WINDOW_TEXT_STATUSBAR)
397
         ShellExecute (NULL, L"open", PROGRAM_URL, NULL, NULL, SW_MAXIMIZE); // open the donation page in the default browser, maximized
408
         ShellExecute (NULL, L"open", PROGRAM_URL, NULL, NULL, SW_MAXIMIZE); // open the donation page in the default browser, maximized
-
 
409
 
-
 
410
      return (0); // as MSDN says
398
   }
411
   }
399
 
412
 
400
   // else is it a timer event AND is it our refresh timer AND do we need to update the sought games list ?
413
   // else is it a timer event AND is it our refresh timer AND do we need to update the sought games list ?
401
   else if ((message == WM_TIMER) && (wParam == WINDOW_TIMER_REFRESH) && (soughtgames_updated))
414
   else if ((message == WM_TIMER) && (wParam == WINDOW_TIMER_REFRESH) && (soughtgames_updated))
402
   {
415
   {
403
      // get a quick access to the list and the combo box controls
416
      // get a quick access to the list and the combo box controls
404
      hListWnd = GetDlgItem (hWnd, WINDOW_LIST_SOUGHTGAMES);
417
      hListWnd = GetDlgItem (hWnd, WINDOW_LIST_SOUGHTGAMES);
Line 526... Line 539...
526
            ListView_SetItemText (hListWnd, insert_index, 5, temp_string);
539
            ListView_SetItemText (hListWnd, insert_index, 5, temp_string);
527
         }
540
         }
528
 
541
 
529
         // requested color
542
         // requested color
530
         if (soughtgame->color != COLOR_UNSPECIFIED)
543
         if (soughtgame->color != COLOR_UNSPECIFIED)
531
         {
544
         {
532
            if (soughtgame->color == COLOR_BLACK)
545
            if (soughtgame->color == COLOR_BLACK)
533
               swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), LOCALIZE (L"Games_Black"));
546
               swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), LOCALIZE (L"Games_Black"));
534
            else
547
            else
535
               swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), LOCALIZE (L"Games_White"));
548
               swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), LOCALIZE (L"Games_White"));
536
            ListView_SetItemText (hListWnd, insert_index, 6, temp_string);
549
            ListView_SetItemText (hListWnd, insert_index, 6, temp_string);
537
         }
550
         }
538
 
551
 
539
         // minimal accepted ELO
552
         // minimal accepted ELO
540
         if (soughtgame->lowest_accepted > 0)
553
         if (soughtgame->lowest_accepted > 0)
541
         {
554
         {
542
            swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), L"> %d", soughtgame->lowest_accepted);
555
            swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), L"> %d", soughtgame->lowest_accepted);
Line 570... Line 583...
570
         Header_GetItem (ListView_GetHeader (hListWnd), column_index, &hdi); // get the column's sort arrow state
583
         Header_GetItem (ListView_GetHeader (hListWnd), column_index, &hdi); // get the column's sort arrow state
571
         hdi.fmt &= ~(HDF_SORTDOWN | HDF_SORTUP);
584
         hdi.fmt &= ~(HDF_SORTDOWN | HDF_SORTUP);
572
         if (column_index == current_sortcolumn)
585
         if (column_index == current_sortcolumn)
573
            hdi.fmt |= (listviewcolumns[column_index].sort_descending ? HDF_SORTDOWN : HDF_SORTUP);
586
            hdi.fmt |= (listviewcolumns[column_index].sort_descending ? HDF_SORTDOWN : HDF_SORTUP);
574
         Header_SetItem (ListView_GetHeader (hListWnd), column_index, &hdi); // update the column's sort arrow state
587
         Header_SetItem (ListView_GetHeader (hListWnd), column_index, &hdi); // update the column's sort arrow state
575
      }
588
      }
576
 
589
 
577
      // now that the display is finished, IF the reply is arrived, set the totals in the window title
590
      // now that the display is finished, IF the reply is arrived, set the totals in the window title
578
      if (soughtgame_count >= 0)
591
      if (soughtgame_count >= 0)
579
         SetWindowText (hWnd, LOCALIZE (L"SoughtGames_Title"));
592
         SetWindowText (hWnd, LOCALIZE (L"SoughtGames_Title"));
580
 
593
 
581
      soughtgames_updated = false; // remember we updated the list (don't do it twice)
594
      soughtgames_updated = false; // remember we updated the list (don't do it twice)
-
 
595
 
-
 
596
      return (0); // as MSDN says
582
   }
597
   }
583
 
598
 
584
   // else is it a list view message AND is it for this list view ?
599
   // else is it a list view message AND is it for this list view ?
585
   else if ((message == WM_NOTIFY) && (wParam == WINDOW_LIST_SOUGHTGAMES))
600
   else if ((message == WM_NOTIFY) && (wParam == WINDOW_LIST_SOUGHTGAMES))
586
   {
601
   {
Line 658... Line 673...
658
            }
673
            }
659
            else
674
            else
660
               DialogBox_SendSeek (); // else it's our own seek, so open the seek dialog box to modify it
675
               DialogBox_SendSeek (); // else it's our own seek, so open the seek dialog box to modify it
661
         }
676
         }
662
      }
677
      }
-
 
678
 
-
 
679
      return (0); // as MSDN says
663
   }
680
   }
664
 
681
 
665
   // call the default window message processing function to keep things going
682
   // call the default window message processing function to keep things going
666
   return (DefWindowProc (hWnd, message, wParam, lParam));
683
   return (DefWindowProc (hWnd, message, wParam, lParam));
667
}
684
}