Edit Drumset APPLY button doesn't work

• Jul 28, 2016 - 01:58
Type
Graphical (UI)
Frequency
Few
Severity
S4 - Minor
Status
active
Regression
No
Workaround
Yes
Project

... on score.

As the title says, the apply button doesn't affect the score when a staff line is changed for a particular drum note. It does, however, go into effect when the OK button is pressed. This is inconvenient because the dialogue box is closed once OK is pressed and so there is no sort of preview for the user which should be the case with the apply button. Hopefully this would require only a line or two of code for this take place. Cheers.

GIT commit: 3c7a69d


Comments

Reported version 2.1 2.2

2.1 / Win7 / Win8

4a34643

Same problem in the 2.1 nightlies. To see it, create a one bar percussion pattern. Then go into the "Edit drumset" window and change the stave line position of one of the notes you have entered on the staff. This changes in the dialogue display but if you press "Apply" nothing happens in the score. The change is only applied when you press "OK".

FWIW, as of right now, it doesn't look like Appy was ever meant to affect the score, it seems it was originally meant to just commit the current change within the drumset editor.

As far as I can tell the code for this is fine though:

void EditDrumset::bboxClicked(QAbstractButton* button)
      {
      QDialogButtonBox::ButtonRole br = buttonBox->buttonRole(button);
      switch(br) {
            case QDialogButtonBox::ApplyRole:
                  apply();
                  break;
 
            case QDialogButtonBox::AcceptRole:
                  apply();
                  // fall through
 
            case QDialogButtonBox::RejectRole:
                  close();
                  break;
 
            default:
                  qDebug("EditDrumSet: unknown button");
                  break;
            }
      }
 
//---------------------------------------------------------
//   apply
//---------------------------------------------------------
void EditDrumset::apply()
      {
      valueChanged();  //save last changes in name
      }

Yeah the code there is cool. A glance seems like EditDrumset doesn't have access to the current working score though, and I think that's when the "update" occurs when after the exec() of the dialog ensues. I.e.

else if (cmd == "edit-drumset") {
            EditDrumset drumsetEdit(staff->part()->instrument(obj->tick())->drumset(), this);
            if (drumsetEdit.exec()) {
                  _score->undo(new ChangeDrumset(staff->part()->instrument(obj->tick()), drumsetEdit.drumset()));
                  mscore->updateDrumTools(drumsetEdit.drumset());
                  if (_score->undoStack()->active()) {
                        _score->setLayoutAll();
                        _score->endCmd();
                        }
                  }
            }

So if this code here could somehow get into the EditDrumset code (looks like it needs a valid instrument and drumset + score. . . then you could do this stuff when applying. Just a guess though ;)