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

void CAMainWin::updateContextToolBar (  )  [private]

Shows/Hides context tool bar according to the selected context (if any) and hides/shows specific actions in the toolbar for the current context.

Definition at line 4054 of file mainwin.cpp.

References CALyricsContext::associatedVoice(), CAContext::contextType(), currentContext(), CAContext::name(), CALyricsContext::stanzaNumber(), and CASheet::voiceList().

Referenced by updateToolBars().

                                     {
      CAContext *context = currentContext();
      if (mode()==SelectMode && context) {
            if (!uiInsertPlayable->isChecked())
                  uiContextToolBar->show();

            switch (context->contextType()) {
                  case CAContext::Staff: {
                        uiStanzaNumberAction->setVisible(false);
                        uiAssociatedVoiceAction->setVisible(false);
                        break;
                  }
                  case CAContext::LyricsContext: {
                        CALyricsContext *c = static_cast<CALyricsContext*>(context);
                        uiStanzaNumber->setValue(c->stanzaNumber());
                        uiStanzaNumberAction->setVisible(true);
                        uiStanzaNumberAction->setEnabled(true);

                        uiAssociatedVoice->clear();
                        QList<CAVoice*> voiceList = currentSheet()->voiceList();
                        for (int i=0; i<voiceList.count(); i++) uiAssociatedVoice->addItem(voiceList[i]->name());
                        uiAssociatedVoice->setCurrentIndex( voiceList.indexOf( c->associatedVoice() ) );
                        uiAssociatedVoiceAction->setVisible(true);
                        uiAssociatedVoiceAction->setEnabled(true);

                        break;
                  }
                  case CAContext::FunctionMarkContext: {
                        uiStanzaNumberAction->setVisible(false);
                        uiAssociatedVoiceAction->setVisible(false);
                        break;
                  }
            }
            uiContextName->setText(context->name());
      } else
            uiContextToolBar->hide();
}


Generated by  Doxygen 1.6.0   Back to index