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

void CAMainWin::removeSheet ( CASheet sheet  ) 

Removes the sheet from the GUI and deletes the viewports and viewport containers and tabs pointing to the given sheet.

Definition at line 3830 of file mainwin.cpp.

References CASourceViewPort::lyricsContext(), CAContext::sheet(), CAVoice::staff(), and CASourceViewPort::voice().

Referenced by on_uiRemoveSheet_triggered().

                                            {
      CAViewPortContainer *vpc = _sheetMap.key(sheet);
      _sheetMap.remove(vpc);

      // remove tab
      int idx = uiTabWidget->indexOf(vpc);
      uiTabWidget->removeTab( idx );
      delete vpc;
      if (idx < uiTabWidget->count())
            uiTabWidget->setCurrentIndex(idx);
      setCurrentViewPortContainer( static_cast<CAViewPortContainer*>(uiTabWidget->currentWidget()) );
      setCurrentViewPort( static_cast<CAViewPortContainer*>(uiTabWidget->currentWidget())?static_cast<CAViewPortContainer*>(uiTabWidget->currentWidget())->currentViewPort():0 );

      // remove other viewports pointing to the sheet
      QList<CAViewPort*> vpl = viewPortList();
      for (int i=0; i<vpl.size(); i++) {
            switch (vpl[i]->viewPortType()) {
                  case CAViewPort::ScoreViewPort: {
                        if (static_cast<CAScoreViewPort*>(vpl[i])->sheet()==sheet)
                              delete vpl[i];
                        break;
                  }
                  case CAViewPort::SourceViewPort: {
                        CASourceViewPort *sv = static_cast<CASourceViewPort*>(vpl[i]);
                        if (sv->voice() && sv->voice()->staff()->sheet()==sheet)
                              delete vpl[i];
                        else
                        if (sv->lyricsContext() && sv->lyricsContext()->sheet()==sheet)
                              delete vpl[i];

                        break;
                  }
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index