| 779 | } |
| 780 | |
| 781 | void MacrosWindow::UpdateDisplay( bool bExpanded ) |
| 782 | { |
| 783 | // If we failed to save changes, we abandon the attempt to |
| 784 | // change the expand/shrink state of the GUI. |
| 785 | if( !SaveChanges() ) |
| 786 | return; |
| 787 | |
| 788 | mbExpanded = bExpanded; |
| 789 | |
| 790 | mChanged = false; |
| 791 | // if we try to access the about to be destroyed mSave button |
| 792 | // inappropriately, we need to crash rather than (sometimes) silently |
| 793 | // succeed. |
| 794 | mSave = nullptr; |
| 795 | |
| 796 | DestroyChildren(); |
| 797 | SetSizer( nullptr ); |
| 798 | |
| 799 | mSelectedCommand = 0; |
| 800 | SetMinSize( wxSize( 200,200 )); |
| 801 | |
| 802 | // Get and set position for optical stability. |
| 803 | // Expanded and shrunk dialogs 'stay where they were'. |
| 804 | // That's OK , and what we want, even if we exapnd off-screen. |
| 805 | // We won't shrink to being off-screen, since the shrink button |
| 806 | // was clicked, so must have been on screen. |
| 807 | wxPoint p = GetPosition( ); |
| 808 | if( mbExpanded ) |
| 809 | Populate(); |
| 810 | else |
| 811 | ApplyMacroDialog::Populate(); |
| 812 | SetPosition( p ); |
| 813 | mResize->SetFocus(); |
| 814 | |
| 815 | auto Title = WindowTitle(); |
| 816 | SetLabel( Title ); // Provide visual label |
| 817 | SetName( Title ); // Provide audible label |
| 818 | SetTitle( Title ); |
| 819 | } |
| 820 | |
| 821 | void MacrosWindow::OnExpand(wxCommandEvent &WXUNUSED(event)) |
| 822 | { UpdateDisplay( true );} |
no test coverage detected