Logo Search packages:      
Sourcecode: canorus version File versions  Download package

void CAMainWin::updatePlayableToolBar (  )  [private]

Show/Hides the playable tool bar and its properties according to the current state.

Definition at line 4196 of file mainwin.cpp.

References CAToolButton::currentId(), CAMusElement::musElementType(), CAPlayableLength::musicLength(), CAPlayable::playableLength(), CARest::restType(), CAScoreViewPort::selection(), CAMenuToolButton::setCurrentId(), CANote::stemDirection(), CAPlayable::voice(), and CAVoice::voiceNumber().

Referenced by updateToolBars().

                                      {
      if ( uiInsertPlayable->isChecked() && mode()==InsertMode ) {
            uiPlayableLength->setCurrentId( musElementFactory()->playableLength().musicLength() );
            uiNoteStemDirection->setCurrentId( musElementFactory()->noteStemDirection() );

            if ( uiTupletType->isChecked() && uiTupletType->currentId()==1 ) {
                  uiTupletNumberAction->setVisible(true);
                  uiTupletNumberAction->setEnabled(true);
                  uiTupletInsteadOfAction->setVisible(true);
                  uiTupletInsteadOfAction->setEnabled(true);
                  uiTupletActualNumberAction->setVisible(true);
                  uiTupletActualNumberAction->setEnabled(true);
            } else {
                  uiTupletNumberAction->setVisible(false);
                  uiTupletInsteadOfAction->setVisible(false);
                  uiTupletActualNumberAction->setVisible(false);
            }

            uiHiddenRest->setEnabled(true);
            uiHiddenRest->setChecked( musElementFactory()->restType()==CARest::Hidden );
            uiPlayableToolBar->show();
      } else if ( mode()==EditMode && currentScoreViewPort() &&
                  currentScoreViewPort()->selection().size() &&
                  dynamic_cast<CAPlayable*>(currentScoreViewPort()->selection().at(0)->musElement()) ) {
            CAScoreViewPort *v = currentScoreViewPort();
            if (v && v->selection().size()) {
                  CAPlayable *playable = dynamic_cast<CAPlayable*>(v->selection().at(0)->musElement());
                  if (playable) {
                        uiPlayableLength->setCurrentId( playable->playableLength().musicLength() );
                        if (playable->musElementType()==CAMusElement::Note) {
                              CANote *note = static_cast<CANote*>(playable);
                              uiNoteStemDirection->setCurrentId( note->stemDirection() );
                              uiHiddenRest->setEnabled(false);
                        } else if (playable->musElementType()==CAMusElement::Rest) {
                              CARest *rest = static_cast<CARest*>(playable);
                              uiHiddenRest->setEnabled(true);
                              uiHiddenRest->setChecked(rest->restType()==CARest::Hidden);
                        }
                        uiPlayableToolBar->show();
                        uiVoiceNum->setRealValue( playable->voice()->voiceNumber() );
                  } else {
                        uiPlayableToolBar->hide();
                        uiHiddenRest->setEnabled(false);
                  }

                  uiTupletType->defaultAction()->setChecked( false );
                  uiTupletNumber->show();
                  uiTupletInsteadOf->show();
                  uiTupletActualNumber->show();
            }
      } else {
            uiPlayableToolBar->hide();
      }
}


Generated by  Doxygen 1.6.0   Back to index