| 601 | } |
| 602 | |
| 603 | int PrefsDialog::ShowModal() |
| 604 | { |
| 605 | if (mCategories) { |
| 606 | /* long is signed, size_t is unsigned. On some platforms they are different |
| 607 | * lengths as well. So we must check that the stored category is both > 0 |
| 608 | * and within the possible range of categories, making the first check on the |
| 609 | * _signed_ value to avoid issues when converting an unsigned one. |
| 610 | */ |
| 611 | long selected = GetPreferredPage(); |
| 612 | if (selected < 0 || size_t(selected) >= mCategories->GetPageCount()) |
| 613 | selected = 0; // clamp to available range of tabs |
| 614 | mCategories->SetSelection(selected); |
| 615 | } |
| 616 | else if (mUniquePage) { |
| 617 | auto Temp = mTitlePrefix; |
| 618 | Temp.Join( Verbatim( mUniquePage->GetLabel() ), wxT(" ") ); |
| 619 | SetTitle(Temp); |
| 620 | SetName(Temp); |
| 621 | } |
| 622 | |
| 623 | return wxDialogWrapper::ShowModal(); |
| 624 | } |
| 625 | |
| 626 | void PrefsDialog::OnCancel(wxCommandEvent & WXUNUSED(event)) |
| 627 | { |
no test coverage detected