Пример #1
0
void EditStaff::updateStaffType()
      {
      StaffType* staffType = staff->staffType();
      lines->setValue(staffType->lines());
      lineDistance->setValue(staffType->lineDistance().val());
      showClef->setChecked(staffType->genClef());
      showTimesig->setChecked(staffType->genTimesig());
      showBarlines->setChecked(staffType->showBarlines());
      staffGroupName->setText(qApp->translate("Staff type group name", staffType->groupName()));
      }
Пример #2
0
void EditStaffType::typeChanged(QListWidgetItem* n, QListWidgetItem* o)
      {
      if (n == 0)
            return;
      if (o)
            saveCurrent(o);
      // retrieve staff type corresponding to new current item in type list
      int idx = n->data(Qt::UserRole).toInt();
      StaffType* st = staffTypes[idx];

      // switch to stack page and set props specific to each staff group

      switch(st->group()) {
            case STANDARD_STAFF_GROUP:
                  {
                  StaffTypePitched* ps = static_cast<StaffTypePitched*>(st);
                  stack->setCurrentIndex(0);
                  name->setText(st->name());
                  lines->setValue(st->lines());
                  lineDistance->setValue(st->lineDistance().val());
                  genClef->setChecked(st->genClef());
                  showBarlines->setChecked(st->showBarlines());
                  genTimesig->setChecked(st->genTimesig());
                  genKeysigPitched->setChecked(ps->genKeysig());
                  showLedgerLinesPitched->setChecked(ps->showLedgerLines());
                  stemlessPitched->setChecked(st->slashStyle());
                  }
                  break;

            case TAB_STAFF_GROUP:
                  {
                  StaffTypeTablature* stt = static_cast<StaffTypeTablature*>(st);
                  blockTabPreviewSignals(true);
                  setDlgFromTab(stt);
                  name->setText(stt->name());   // setDlgFromTab() does not copy the name and it shouldn't
                  stack->setCurrentIndex(1);
                  blockTabPreviewSignals(false);
                  }
                  break;

            case PERCUSSION_STAFF_GROUP:
                  {
                  StaffTypePercussion* ps = static_cast<StaffTypePercussion*>(st);
                  blockPercPreviewSignals(true);
                  setDlgFromPerc(ps);
                  name->setText(ps->name());   // setDlgFromPerc() does not copy the name and it shouldn't
                  stack->setCurrentIndex(2);
                  blockPercPreviewSignals(false);
                  }
                  break;
            }
      }
Пример #3
0
void EditStaffType::saveCurrent(QListWidgetItem* o)
      {
      bool        modif = false;                            // assume no modifications
      int         idx   = o->data(Qt::UserRole).toInt();
      StaffType*  st    = staffTypes[idx];

      // if any of the common properties is modified
      if (name->text()              != st->name()
         || st->lines()             != lines->value()
         || st->lineDistance().val()!= lineDistance->value()
         || st->genClef()           != genClef->isChecked()
         || st->showBarlines()      != showBarlines->isChecked()
         || st->genTimesig()        != genTimesig->isChecked()
         ) {
            modif = true;
            }

      // or if any of the props specific to each group is modified
      switch(st->group()) {
            case STANDARD_STAFF_GROUP:
                  {
                  StaffTypePitched* sp = static_cast<StaffTypePitched*>(st);
                  if (sp->genKeysig()         != genKeysigPitched->isChecked()
                     || sp->showLedgerLines() != showLedgerLinesPitched->isChecked()
                     || st->slashStyle()      != stemlessPitched->isChecked()
                     ) {
                        modif = true;
                        }
                  }
                  break;

            case TAB_STAFF_GROUP:
                  {
                  StaffTypeTablature*  stt = static_cast<StaffTypeTablature*>(st);
                  TablatureMinimStyle minimStyle = minimNoneRadio->isChecked() ? TAB_MINIM_NONE :
                        (minimShortRadio->isChecked() ? TAB_MINIM_SHORTER : TAB_MINIM_SLASHED);
                  if (stt->durationFontName()    != durFontName->currentText()
                     || stt->durationFontSize() != durFontSize->value()
                     || stt->durationFontUserY()!= durY->value()
                     || stt->fretFontName()     != fretFontName->currentText()
                     || stt->fretFontSize()     != fretFontSize->value()
                     || stt->fretFontUserY()    != fretY->value()
                     || stt->linesThrough()     != linesThroughRadio->isChecked()
                     || stt->onLines()          != onLinesRadio->isChecked()
                     || stt->upsideDown()       != upsideDown->isChecked()
                     || stt->useNumbers()       != numbersRadio->isChecked()
                     || ( noteValuesNone->isChecked() && (!stt->slashStyle() ||  stt->genDurations()) )
                     || ( noteValuesSymb->isChecked() && (!stt->slashStyle() || !stt->genDurations()) )
                     // if stems, there are more values to take into account
                     || ( noteValuesStems->isChecked()&& ( stt->slashStyle() ||  stt->genDurations()
                              || stt->stemsDown()     != stemBelowRadio->isChecked()
                              || stt->stemThrough()   != stemThroughRadio->isChecked()
                              || stt->minimStyle()    != minimStyle)
                          )
                     || stt->showRests()        != showRests->isChecked()
                     ) {
                        modif = true;
                        }
                  }
                  break;

            case PERCUSSION_STAFF_GROUP:
                  {
                  StaffTypePercussion* sp = static_cast<StaffTypePercussion*>(st);
                  if (sp->genKeysig()         != genKeysigPercussion->isChecked()
                     || sp->showLedgerLines() != showLedgerLinesPercussion->isChecked()
                     || st->slashStyle()      != stemlessPercussion->isChecked()
                     ) {
                        modif = true;
                        }
                  }
                  break;
            }

      if (modif) {
            // save common properties
            // save-group specific properties
            if(name->text().isEmpty()) {
                  QString n = createUniqueStaffTypeName(st->group());
                  name->setText(n);
                  o->setText(n);
                  }
            switch(st->group()) {
                  case STANDARD_STAFF_GROUP:
                        {
                        StaffTypePitched* stp = static_cast<StaffTypePitched*>(st);
                        stp->setName(name->text());
                        stp->setLines(lines->value());
                        stp->setLineDistance(Spatium(lineDistance->value()));
                        stp->setShowBarlines(showBarlines->isChecked());
                        stp->setGenClef(genClef->isChecked());
                        stp->setGenTimesig(genTimesig->isChecked());
                        stp->setGenKeysig(genKeysigPitched->isChecked());
                        stp->setShowLedgerLines(showLedgerLinesPitched->isChecked());
                        stp->setSlashStyle(stemlessPitched->isChecked());
                        }
                        break;
                  case TAB_STAFF_GROUP:
                        {
                        StaffTypeTablature*  stt = static_cast<StaffTypeTablature*>(st);
                        setTabFromDlg(stt);
                        }
                        break;
                  case PERCUSSION_STAFF_GROUP:
                        {
                        StaffTypePercussion* stp = static_cast<StaffTypePercussion*>(st);
                        setPercFromDlg(stp);
                        }
                        break;
                  }
            modified = true;
            }
      }