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

void CAMainWin::updateVoiceToolBar (  )  [private]

Shows/Hides the Voice properties tool bar according to the currently selected context and updates its properties.

Definition at line 4016 of file mainwin.cpp.

References CAContext::contextType(), currentContext(), currentVoice(), CAVoice::name(), CAMenuToolButton::setCurrentId(), CAVoice::stemDirection(), CAStaff::voiceAt(), and CAStaff::voiceCount().

Referenced by on_uiVoiceNum_valChanged(), and updateToolBars().

                                   {
      CAContext *context = currentContext();
      if ( mode()==SelectMode && context && context->contextType() == CAContext::Staff ) {
            CAStaff *staff = static_cast<CAStaff*>(context);
            uiNewVoice->setVisible(true);
            uiNewVoice->setEnabled(true);
            if (staff->voiceCount()) {
                  uiVoiceNum->setMax(staff->voiceCount());
                  int voiceNr = uiVoiceNum->getRealValue();
                  if (voiceNr) {
                        CAVoice *curVoice = (voiceNr<=staff->voiceCount()?staff->voiceAt(voiceNr-1):staff->voiceAt(0));
                        uiVoiceName->setText(curVoice->name());
                        uiVoiceName->setEnabled(true);
                        uiVoiceInstrument->setEnabled(true);
                              uiVoiceInstrument->setCurrentIndex( currentVoice()->midiProgram() );
                        uiRemoveVoice->setEnabled(true);
                        uiVoiceStemDirection->setCurrentId( curVoice->stemDirection() );
                        uiVoiceStemDirection->setEnabled(true);
                        uiVoiceProperties->setEnabled(true);
                  } else {
                        uiVoiceName->setEnabled(false);
                        uiVoiceInstrument->setEnabled(false);
                        uiRemoveVoice->setEnabled(false);
                        uiVoiceStemDirection->setEnabled(false);
                        uiVoiceProperties->setEnabled(false);
                  }
            }

            uiVoiceToolBar->show();
      } else {
            uiNewVoice->setVisible(false);
            uiVoiceToolBar->hide();
      }
}


Generated by  Doxygen 1.6.0   Back to index