Rev 21 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 21 | Rev 124 | ||
---|---|---|---|
Line 307... | Line 307... | ||
307 | ShowWindow (hWnd, SW_SHOW); |
307 | ShowWindow (hWnd, SW_SHOW); |
308 | 308 | ||
309 | // and send focus to the player name filter field (note: GetDlgItem works ALSO with windows! MSDN certified :)) |
309 | // and send focus to the player name filter field (note: GetDlgItem works ALSO with windows! MSDN certified :)) |
310 | if (GetForegroundWindow () == hWnd) |
310 | if (GetForegroundWindow () == hWnd) |
311 | SetFocus (GetDlgItem (hWnd, WINDOW_EDITBOX_NAMECONTAINS)); |
311 | SetFocus (GetDlgItem (hWnd, WINDOW_EDITBOX_NAMECONTAINS)); |
- | 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 this window ? |
323 | // else are we destroying this 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 |
323 | SetForegroundWindow (hMainWnd); // restore focus on the main window |
328 | SetForegroundWindow (hMainWnd); // restore focus on the main window |
324 | is_window_opponents_validated = true; // remember we closed this window |
329 | is_window_opponents_validated = true; // remember we closed this window |
- | 330 | the_board.reevaluate = true; // refresh the GUI buttons if needed |
|
- | 331 | return (0); // as MSDN says |
|
325 | } |
332 | } |
326 | 333 | ||
327 | // else are we resizing the window ? |
334 | // else are we resizing the window ? |
328 | else if (message == WM_SIZE) |
335 | else if (message == WM_SIZE) |
329 | { |
336 | { |
Line 339... | Line 346... | ||
339 | SetWindowPos (GetDlgItem (hWnd, WINDOW_EDITBOX_LEVELFROM), NULL, 640, 38, 48, 20, SWP_NOZORDER); |
346 | SetWindowPos (GetDlgItem (hWnd, WINDOW_EDITBOX_LEVELFROM), NULL, 640, 38, 48, 20, SWP_NOZORDER); |
340 | SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_LEVELTO), NULL, 688, 40, 40, 16, SWP_NOZORDER); |
347 | SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_LEVELTO), NULL, 688, 40, 40, 16, SWP_NOZORDER); |
341 | SetWindowPos (GetDlgItem (hWnd, WINDOW_EDITBOX_LEVELTO), NULL, 736, 38, 48, 20, SWP_NOZORDER); |
348 | SetWindowPos (GetDlgItem (hWnd, WINDOW_EDITBOX_LEVELTO), NULL, 736, 38, 48, 20, SWP_NOZORDER); |
342 | SetWindowPos (GetDlgItem (hWnd, WINDOW_LIST_OPPONENTS), NULL, 16, 64, client_rect.right - 32, client_rect.bottom - 80, SWP_NOZORDER); |
349 | SetWindowPos (GetDlgItem (hWnd, WINDOW_LIST_OPPONENTS), NULL, 16, 64, client_rect.right - 32, client_rect.bottom - 80, SWP_NOZORDER); |
343 | SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_STATUSBAR), NULL, 0, client_rect.bottom - 16, client_rect.right, 16, SWP_NOZORDER); |
350 | SetWindowPos (GetDlgItem (hWnd, WINDOW_TEXT_STATUSBAR), NULL, 0, client_rect.bottom - 16, client_rect.right, 16, SWP_NOZORDER); |
- | 351 | ||
- | 352 | return (0); // as MSDN says |
|
344 | } |
353 | } |
345 | 354 | ||
346 | // else are we asking how big/small we can resize ? |
355 | // else are we asking how big/small we can resize ? |
347 | else if (message == WM_GETMINMAXINFO) |
356 | else if (message == WM_GETMINMAXINFO) |
348 | { |
357 | { |
349 | minmax = (MINMAXINFO *) lParam; // get a pointer to the min/max info structure |
358 | minmax = (MINMAXINFO *) lParam; // get a pointer to the min/max info structure |
350 | 359 | ||
351 | minmax->ptMinTrackSize.x = WINDOW_MIN_WIDTH; |
360 | minmax->ptMinTrackSize.x = WINDOW_MIN_WIDTH; |
352 | minmax->ptMinTrackSize.y = WINDOW_MIN_HEIGHT; |
361 | minmax->ptMinTrackSize.y = WINDOW_MIN_HEIGHT; |
- | 362 | ||
- | 363 | return (0); // as MSDN says |
|
353 | } |
364 | } |
354 | 365 | ||
355 | // else is it a timer event AND is it our refresh timer ? |
366 | // else is it a timer event AND is it our refresh timer ? |
356 | else if ((message == WM_TIMER) && (wParam == WINDOW_TIMER_REFRESH)) |
367 | else if ((message == WM_TIMER) && (wParam == WINDOW_TIMER_REFRESH)) |
357 | { |
368 | { |
358 | // do we need to update the opponents list ? |
369 | // do we need to update the opponents list ? |
359 | if (onlineplayers_updated) |
370 | if (onlineplayers_updated) |
360 | { |
371 | { |
361 | hListWnd = GetDlgItem (hWnd, WINDOW_LIST_OPPONENTS); // get a quick access to the list control |
372 | hListWnd = GetDlgItem (hWnd, WINDOW_LIST_OPPONENTS); // get a quick access to the list control |
362 | 373 | ||
363 | // grab the different filters |
374 | // grab the different filters |
364 | GetDlgItemText (hWnd, WINDOW_EDITBOX_NAMECONTAINS, opponent_namecontains, WCHAR_SIZEOF (opponent_namecontains)); |
375 | GetDlgItemText (hWnd, WINDOW_EDITBOX_NAMECONTAINS, opponent_namecontains, WCHAR_SIZEOF (opponent_namecontains)); |
365 | opponent_statusis = ComboBox_GetCurSel (GetDlgItem (hWnd, WINDOW_COMBOBOX_STATUSIS)); |
376 | opponent_statusis = ComboBox_GetCurSel (GetDlgItem (hWnd, WINDOW_COMBOBOX_STATUSIS)); |
366 | opponent_ratingfrom = GetDlgItemInt (hWnd, WINDOW_EDITBOX_LEVELFROM, &result, false); |
377 | opponent_ratingfrom = GetDlgItemInt (hWnd, WINDOW_EDITBOX_LEVELFROM, &result, false); |
367 | opponent_ratingto = GetDlgItemInt (hWnd, WINDOW_EDITBOX_LEVELTO, &result, false); |
378 | opponent_ratingto = GetDlgItemInt (hWnd, WINDOW_EDITBOX_LEVELTO, &result, false); |
Line 374... | Line 385... | ||
374 | 385 | ||
375 | // tell Windows which members of the LVCOLUMN structure we're filling |
386 | // tell Windows which members of the LVCOLUMN structure we're filling |
376 | memset (&lvi, 0, sizeof (lvi)); |
387 | memset (&lvi, 0, sizeof (lvi)); |
377 | lvi.mask = LVIF_IMAGE | LVIF_PARAM; // we want to set the image and the item's pointer |
388 | lvi.mask = LVIF_IMAGE | LVIF_PARAM; // we want to set the image and the item's pointer |
378 | for (onlineplayer_index = 0; onlineplayer_index < onlineplayer_count; onlineplayer_index++) |
389 | for (onlineplayer_index = 0; onlineplayer_index < onlineplayer_count; onlineplayer_index++) |
379 | { |
390 | { |
380 | onlineplayer = &onlineplayers[onlineplayer_index]; // quick access to online player |
391 | onlineplayer = &onlineplayers[onlineplayer_index]; // quick access to online player |
381 | 392 | ||
382 | // should item be skipped because of its name ? |
393 | // should item be skipped because of its name ? |
383 | if ((opponent_namecontains[0] != 0) && (wcsistr (onlineplayer->nickname, opponent_namecontains) == NULL)) |
394 | if ((opponent_namecontains[0] != 0) && (wcsistr (onlineplayer->nickname, opponent_namecontains) == NULL)) |
384 | continue; // if so, skip it |
395 | continue; // if so, skip it |
Line 476... | Line 487... | ||
476 | Header_GetItem (ListView_GetHeader (hListWnd), column_index, &hdi); // get the column's sort arrow state |
487 | Header_GetItem (ListView_GetHeader (hListWnd), column_index, &hdi); // get the column's sort arrow state |
477 | hdi.fmt &= ~(HDF_SORTDOWN | HDF_SORTUP); |
488 | hdi.fmt &= ~(HDF_SORTDOWN | HDF_SORTUP); |
478 | if (column_index == current_sortcolumn) |
489 | if (column_index == current_sortcolumn) |
479 | hdi.fmt |= (listviewcolumns[column_index].sort_descending ? HDF_SORTDOWN : HDF_SORTUP); |
490 | hdi.fmt |= (listviewcolumns[column_index].sort_descending ? HDF_SORTDOWN : HDF_SORTUP); |
480 | Header_SetItem (ListView_GetHeader (hListWnd), column_index, &hdi); // update the column's sort arrow state |
491 | Header_SetItem (ListView_GetHeader (hListWnd), column_index, &hdi); // update the column's sort arrow state |
481 | } |
492 | } |
482 | 493 | ||
483 | // now that the display is finished, IF the reply is arrived, set the totals in the window title |
494 | // now that the display is finished, IF the reply is arrived, set the totals in the window title |
484 | if (onlineplayer_count >= 0) |
495 | if (onlineplayer_count >= 0) |
485 | { |
496 | { |
486 | swprintf_s (window_title, WCHAR_SIZEOF (window_title), LOCALIZE (L"Opponents_Title"), onlineplayer_count, displayed_count); |
497 | swprintf_s (window_title, WCHAR_SIZEOF (window_title), LOCALIZE (L"Opponents_Title"), onlineplayer_count, displayed_count); |
487 | SetWindowText (hWnd, window_title); |
498 | SetWindowText (hWnd, window_title); |
488 | } |
499 | } |
489 | 500 | ||
490 | onlineplayers_updated = false; // remember we updated the list (don't do it twice) |
501 | onlineplayers_updated = false; // remember we updated the list (don't do it twice) |
491 | } |
502 | } |
- | 503 | ||
- | 504 | return (0); // as MSDN says |
|
492 | } |
505 | } |
493 | 506 | ||
494 | // is it a list view message ? |
507 | // is it a list view message ? |
495 | else if ((message == WM_NOTIFY) && (wParam == WINDOW_LIST_OPPONENTS)) |
508 | else if ((message == WM_NOTIFY) && (wParam == WINDOW_LIST_OPPONENTS)) |
496 | { |
509 | { |
Line 510... | Line 523... | ||
510 | { |
523 | { |
511 | listviewcolumns[column_index].sort_descending ^= true; // revert the sort order for the clicked column |
524 | listviewcolumns[column_index].sort_descending ^= true; // revert the sort order for the clicked column |
512 | hdi.fmt |= (listviewcolumns[column_index].sort_descending ? HDF_SORTDOWN : HDF_SORTUP); |
525 | hdi.fmt |= (listviewcolumns[column_index].sort_descending ? HDF_SORTDOWN : HDF_SORTUP); |
513 | current_sortcolumn = column_index; // save the current sort column |
526 | current_sortcolumn = column_index; // save the current sort column |
514 | } |
527 | } |
515 | else |
528 | else |
516 | listviewcolumns[column_index].sort_descending = false; // reset the sort order for all the other ones |
529 | listviewcolumns[column_index].sort_descending = false; // reset the sort order for all the other ones |
517 | Header_SetItem (ListView_GetHeader (lv->hdr.hwndFrom), column_index, &hdi); // update the column's sort arrow state |
530 | Header_SetItem (ListView_GetHeader (lv->hdr.hwndFrom), column_index, &hdi); // update the column's sort arrow state |
518 | } |
531 | } |
519 | 532 | ||
520 | // now sort the list view according to the column we selected and its current sort order |
533 | // now sort the list view according to the column we selected and its current sort order |
Line 523... | Line 536... | ||
523 | 536 | ||
524 | // else is it a double-click on one of the elements ? |
537 | // else is it a double-click on one of the elements ? |
525 | else if (lv->hdr.code == NM_DBLCLK) |
538 | else if (lv->hdr.code == NM_DBLCLK) |
526 | { |
539 | { |
527 | clickeditem = (NMITEMACTIVATE *) lParam; // get the item it is |
540 | clickeditem = (NMITEMACTIVATE *) lParam; // get the item it is |
528 | 541 | ||
529 | // is it valid ? |
542 | // is it valid ? |
530 | if (clickeditem->iItem != -1) |
543 | if (clickeditem->iItem != -1) |
531 | { |
544 | { |
532 | // get which item it is in the listview data |
545 | // get which item it is in the listview data |
533 | memset (&lvi, 0, sizeof (lvi)); |
546 | memset (&lvi, 0, sizeof (lvi)); |
Line 544... | Line 557... | ||
544 | Interlocutor_FindOrCreate (onlineplayer->nickname); |
557 | Interlocutor_FindOrCreate (onlineplayer->nickname); |
545 | else |
558 | else |
546 | PlayerCard_FindOrCreate (onlineplayer->nickname); // else just display his player card |
559 | PlayerCard_FindOrCreate (onlineplayer->nickname); // else just display his player card |
547 | } |
560 | } |
548 | } |
561 | } |
- | 562 | ||
- | 563 | return (0); // as MSDN says |
|
549 | } |
564 | } |
550 | 565 | ||
551 | // else did we take action on one of the controls ? |
566 | // else did we take action on one of the controls ? |
552 | else if (message == WM_COMMAND) |
567 | else if (message == WM_COMMAND) |
553 | { |
568 | { |
Line 578... | Line 593... | ||
578 | } |
593 | } |
579 | 594 | ||
580 | // else was it the status bar hyperlink ? |
595 | // else was it the status bar hyperlink ? |
581 | else if (wParam_loword == WINDOW_TEXT_STATUSBAR) |
596 | else if (wParam_loword == WINDOW_TEXT_STATUSBAR) |
582 | ShellExecute (NULL, L"open", PROGRAM_URL, NULL, NULL, SW_MAXIMIZE); // open the donation page in the default browser, maximized |
597 | ShellExecute (NULL, L"open", PROGRAM_URL, NULL, NULL, SW_MAXIMIZE); // open the donation page in the default browser, maximized |
- | 598 | ||
- | 599 | return (0); // as MSDN says |
|
583 | } |
600 | } |
584 | 601 | ||
585 | // call the default window message processing function to keep things going |
602 | // call the default window message processing function to keep things going |
586 | return (DefWindowProc (hWnd, message, wParam, lParam)); |
603 | return (DefWindowProc (hWnd, message, wParam, lParam)); |
587 | } |
604 | } |