Called when the format drop downs is changed. This causes recreation of the toolbar contents.
| 289 | // Called when the format drop downs is changed. |
| 290 | // This causes recreation of the toolbar contents. |
| 291 | void TimeToolBar::OnUpdate(wxCommandEvent &evt) |
| 292 | { |
| 293 | evt.Skip(false); |
| 294 | |
| 295 | ToolBar::ReCreateButtons(); |
| 296 | |
| 297 | // Reset to allow resizing to work |
| 298 | SetMinSize(wxDefaultSize); |
| 299 | SetMaxSize(wxDefaultSize); |
| 300 | |
| 301 | // Save format name before recreating the controls so they resize properly |
| 302 | auto &formats = ProjectNumericFormats::Get(mProject); |
| 303 | formats.SetAudioTimeFormat(evt.GetString()); |
| 304 | // Then my subscription is called |
| 305 | |
| 306 | // During initialization, the desired size will have already been set at this point |
| 307 | // and the "best" size" would override it, so we simply send a size event to force |
| 308 | // the content to fit inside the toolbar. |
| 309 | if (mSettingInitialSize) { |
| 310 | mSettingInitialSize = false; |
| 311 | SendSizeEvent(); |
| 312 | } |
| 313 | // Otherwise we want the toolbar to resize to fit around the content |
| 314 | else { |
| 315 | // Fit() while retaining height |
| 316 | SetSize(GetBestSize().x, GetSize().y); |
| 317 | } |
| 318 | |
| 319 | // Go set the new size limits |
| 320 | SetResizingLimits(); |
| 321 | |
| 322 | // Inform others the toobar has changed |
| 323 | Updated(); |
| 324 | } |
| 325 | |
| 326 | void TimeToolBar::OnSize(wxSizeEvent &evt) |
| 327 | { |
nothing calls this directly
no test coverage detected