MCPcopy Create free account
hub / github.com/audacity/audacity / Create

Method Create

src/RealtimeEffectPanel.cpp:485–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483 }
484
485 void Create(wxWindow* parent,
486 wxWindowID winid,
487 const wxPoint& pos = wxDefaultPosition,
488 const wxSize& size = wxDefaultSize)
489 {
490
491 //Prevents flickering and paint order issues
492 MovableControl::SetBackgroundStyle(wxBG_STYLE_PAINT);
493 MovableControl::Create(parent, winid, pos, size, wxNO_BORDER | wxWANTS_CHARS);
494
495 Bind(wxEVT_PAINT, &RealtimeEffectControl::OnPaint, this);
496 Bind(wxEVT_SET_FOCUS, &RealtimeEffectControl::OnFocusChange, this);
497 Bind(wxEVT_KILL_FOCUS, &RealtimeEffectControl::OnFocusChange, this);
498
499 auto sizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
500
501 //On/off button
502 auto enableButton = safenew ThemedAButtonWrapper<AButton>(this);
503 enableButton->SetTranslatableLabel(XO("Power"));
504 enableButton->SetImageIndices(0, bmpEffectOff, bmpEffectOff, bmpEffectOn, bmpEffectOn, bmpEffectOff);
505 enableButton->SetButtonToggles(true);
506 enableButton->SetBackgroundColorIndex(clrEffectListItemBackground);
507 mEnableButton = enableButton;
508
509 enableButton->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) {
510 if(mDelegate && mEffectState)
511 {
512 mEffectState->SetActive(mEnableButton->IsDown());
513 if (mProject)
514 {
515 auto const effectName{GetEffectName(*mEffectState)};
516 ProjectHistory::Get(*mProject).PushState(
517 /*! i18n-hint: undo history record
518 first parameter - realtime effect name
519 */
520 XO("Change settings for realtime effect %s on %s").Format(effectName, mDelegate->GetSourceName()),
521 /*! i18n-hint: undo history record
522 first parameter - realtime effect name
523 */
524 XO("Change realtime effect %s on %s").Format(effectName, mDelegate->GetSourceName()),
525 UndoPush::CONSOLIDATE);
526 }
527 }
528 });
529
530 //Central button with effect name, show settings
531 const auto optionsButton = safenew ThemedAButtonWrapper<AButton>(this, wxID_ANY);
532 optionsButton->SetImageIndices(0,
533 bmpHButtonNormal,
534 bmpHButtonHover,
535 bmpHButtonDown,
536 bmpHButtonHover,
537 bmpHButtonDisabled);
538 optionsButton->SetBackgroundColorIndex(clrEffectListItemBackground);
539 optionsButton->SetForegroundColorIndex(clrTrackPanelText);
540 optionsButton->SetButtonType(AButton::TextButton);
541 optionsButton->Bind(wxEVT_BUTTON, &RealtimeEffectControl::OnOptionsClicked, this);
542

Callers

nothing calls this directly

Calls 15

CreateFunction · 0.85
BindClass · 0.85
GetEffectNameFunction · 0.85
GetFunction · 0.85
wxStaticBitmapClass · 0.85
SetImageIndicesMethod · 0.80
BindMethod · 0.80
SetButtonTypeMethod · 0.80
DisableMethod · 0.80
SetTranslatableLabelMethod · 0.45
SetActiveMethod · 0.45

Tested by

no test coverage detected