@@ -43,6 +43,7 @@ BEGIN_EVENT_TABLE(AttackDialog, wxDialog)
4343 EVT_BUTTON(ID_ATK_DIALOG_DELETE_LOOP_BTN, AttackDialog::OnRemoveLoopBtn)
4444 EVT_SPINCTRL(ID_ATK_DIALOG_LOOP_START_SPIN, AttackDialog::OnLoopStartSpin)
4545 EVT_SPINCTRL(ID_ATK_DIALOG_LOOP_END_SPIN, AttackDialog::OnLoopEndSpin)
46+ EVT_CHECKBOX(ID_RANK_COPY_REPLACE_ODF_LOOPS, AttackDialog::OnCopyReplaceLoopCheck)
4647END_EVENT_TABLE()
4748
4849AttackDialog::AttackDialog(std::list<Attack>& attack_list, unsigned selected_attack) : m_attacklist(attack_list) {
@@ -395,12 +396,13 @@ void AttackDialog::CreateControls() {
395396 wxT (" A loop must be selected in the listbox to the left to enable." )
396397 );
397398 loopPropertiesContainer->Add (commentText1, 0 , wxGROW|wxALL, 5 );
398- wxStaticText *commentText2 = new wxStaticText (
399+ m_copyReplaceLoopsCheck = new wxCheckBox (
399400 loopPropertiesContainer->GetStaticBox (),
400- wxID_STATIC ,
401- wxT (" Also please note that no loops will be copied to other attacks!" )
401+ ID_RANK_COPY_REPLACE_ODF_LOOPS ,
402+ wxT (" Copy/replace loops to other attacks too !" )
402403 );
403- loopPropertiesContainer->Add (commentText2, 0 , wxGROW|wxALL, 5 );
404+ m_copyReplaceLoopsCheck->SetValue (false );
405+ loopPropertiesContainer->Add (m_copyReplaceLoopsCheck, 0 , wxGROW|wxALL, 5 );
404406 sixthRow->Add (loopPropertiesContainer, 1 , wxEXPAND|wxALL, 5 );
405407 mainSizer->Add (sixthRow, 1 , wxGROW);
406408
@@ -436,6 +438,10 @@ unsigned AttackDialog::GetSelectedAttackIndex() {
436438 return m_selectedAttackIndex;
437439}
438440
441+ bool AttackDialog::GetCopyReplaceLoops () {
442+ return m_copyReplaceLoopsCheck->IsChecked ();
443+ }
444+
439445std::list<Attack>::iterator AttackDialog::GetAttackIterator (unsigned index) {
440446 auto iterator = std::next (m_attacklist.begin (), index);
441447 return iterator;
@@ -473,44 +479,52 @@ void AttackDialog::OnLoadReleaseSelection(wxCommandEvent& event) {
473479 m_currentAttack->loadRelease = false ;
474480 }
475481 m_copyPropertiesBtn->Enable ();
482+ ::wxGetApp ().m_frame->m_organ->setModified(true );
476483}
477484
478485void AttackDialog::OnAttackVelocitySpin (wxSpinEvent& WXUNUSED (event)) {
479486 m_currentAttack->attackVelocity = m_attackVelocitySpin->GetValue ();
480487 m_copyPropertiesBtn->Enable ();
488+ ::wxGetApp ().m_frame->m_organ->setModified(true );
481489}
482490
483491void AttackDialog::OnMaxTimeSinceLastSpin (wxSpinEvent& WXUNUSED (event)) {
484492 m_currentAttack->maxTimeSinceLastRelease = m_maxTimeSinceLastSpin->GetValue ();
485493 m_copyPropertiesBtn->Enable ();
494+ ::wxGetApp ().m_frame->m_organ->setModified(true );
486495}
487496
488497void AttackDialog::OnTremulantChoice (wxCommandEvent& WXUNUSED (event)) {
489498 if (m_isTremulantChoice->GetSelection () != wxNOT_FOUND) {
490499 int tremChoice = m_isTremulantChoice->GetSelection () - 1 ;
491500 m_currentAttack->isTremulant = tremChoice;
492501 m_copyPropertiesBtn->Enable ();
502+ ::wxGetApp ().m_frame->m_organ->setModified(true );
493503 }
494504}
495505
496506void AttackDialog::OnMaxKeyPressTimeSpin (wxSpinEvent& WXUNUSED (event)) {
497507 m_currentAttack->maxKeyPressTime = m_maxKeyPressTime->GetValue ();
498508 m_copyPropertiesBtn->Enable ();
509+ ::wxGetApp ().m_frame->m_organ->setModified(true );
499510}
500511
501512void AttackDialog::OnAttackStartSpin (wxSpinEvent& WXUNUSED (event)) {
502513 m_currentAttack->attackStart = m_attackStartSpin->GetValue ();
503514 m_copyPropertiesBtn->Enable ();
515+ ::wxGetApp ().m_frame->m_organ->setModified(true );
504516}
505517
506518void AttackDialog::OnCuePointSpin (wxSpinEvent& WXUNUSED (event)) {
507519 m_currentAttack->cuePoint = m_cuePointSpin->GetValue ();
508520 m_copyPropertiesBtn->Enable ();
521+ ::wxGetApp ().m_frame->m_organ->setModified(true );
509522}
510523
511524void AttackDialog::OnReleaseEndSpin (wxSpinEvent& WXUNUSED (event)) {
512525 m_currentAttack->releaseEnd = m_releaseEndSpin->GetValue ();
513526 m_copyPropertiesBtn->Enable ();
527+ ::wxGetApp ().m_frame->m_organ->setModified(true );
514528}
515529
516530void AttackDialog::OnLoopListSelection (wxCommandEvent& WXUNUSED (event)) {
@@ -538,6 +552,8 @@ void AttackDialog::OnAddLoopBtn(wxCommandEvent& WXUNUSED(event)) {
538552 m_loopsList->SetSelection (lastLoopIndex);
539553 m_selectedLoop = m_currentAttack->getLoopAt (lastLoopIndex);
540554 LoopInListSelected ();
555+ if (GetCopyReplaceLoops ())
556+ m_copyPropertiesBtn->Enable ();
541557}
542558
543559void AttackDialog::OnRemoveLoopBtn (wxCommandEvent& WXUNUSED (event)) {
@@ -556,6 +572,8 @@ void AttackDialog::OnRemoveLoopBtn(wxCommandEvent& WXUNUSED(event)) {
556572 m_selectedLoop = m_currentAttack->getLoopAt (lastLoopIndex);
557573 LoopInListSelected ();
558574 }
575+ if (GetCopyReplaceLoops ())
576+ m_copyPropertiesBtn->Enable ();
559577 }
560578}
561579
@@ -567,6 +585,9 @@ void AttackDialog::OnLoopStartSpin(wxSpinEvent& WXUNUSED(event)) {
567585 }
568586 m_selectedLoop->start = value;
569587 SetLoopStartAndEndRanges ();
588+ ::wxGetApp ().m_frame->m_organ->setModified(true );
589+ if (GetCopyReplaceLoops ())
590+ m_copyPropertiesBtn->Enable ();
570591}
571592
572593void AttackDialog::OnLoopEndSpin (wxSpinEvent& WXUNUSED (event)) {
@@ -577,6 +598,14 @@ void AttackDialog::OnLoopEndSpin(wxSpinEvent& WXUNUSED(event)) {
577598 }
578599 m_selectedLoop->end = value;
579600 SetLoopStartAndEndRanges ();
601+ ::wxGetApp ().m_frame->m_organ->setModified(true );
602+ if (GetCopyReplaceLoops ())
603+ m_copyPropertiesBtn->Enable ();
604+ }
605+
606+ void AttackDialog::OnCopyReplaceLoopCheck (wxCommandEvent& WXUNUSED (event)) {
607+ if (GetCopyReplaceLoops ())
608+ m_copyPropertiesBtn->Enable ();
580609}
581610
582611void AttackDialog::SetButtonState () {
@@ -598,7 +627,7 @@ void AttackDialog::TransferAttackValuesToWindow() {
598627 m_attackName->SetLabel (m_currentAttack->fileName );
599628 m_attackPath->SetLabel (m_currentAttack->fullPath );
600629 if (m_currentAttack->fullPath .IsSameAs (wxT (" DUMMY" ))) {
601- // almoast everything should be set to default and disabled
630+ // almost everything should be set to default and disabled
602631 m_loadReleaseYes->SetValue (true );
603632 m_loadReleaseNo->SetValue (false );
604633 m_attackVelocitySpin->SetValue (m_currentAttack->attackVelocity );
0 commit comments