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

void CAMainWin::rebuildUI ( CASheet sheet,
bool  repaint = true 
)

Rebuilds the GUI from data.

This method is called eg. when multiple viewports share the same data and a change has been made (eg. a note pitch has changed or a new element added). ViewPorts content is repositioned and redrawn (CAEngraver creates CADrawable elements for every score viewport, sources are updated in source viewports etc.).

sheet argument is a pointer to the data sheet where the change occured. This way only viewports showing the given sheet are updated which speeds up the process. If sheet argument is null, all viewports are rebuilt, but the viewports contents, number and locations remain the same.

If repaint is True (default) the rebuilt viewports are also repainted. If False, viewports content is only created but not yet drawn. This is useful when multiple operations which could potentially change the content are to happen and we want to actually draw it only at the end.

Definition at line 1397 of file mainwin.cpp.

References _viewPortList, clearUI(), CAResourceView::rebuildUi(), and updateToolBars().

Referenced by on_uiNewWindow_triggered(), and openDocument().

                                                      {
      if (rebuildUILock()) return;

      setRebuildUILock( true );
      if (document()) {
            for (int i=0; i<_viewPortList.size(); i++) {
                  if (sheet && _viewPortList[i]->viewPortType()==CAViewPort::ScoreViewPort &&
                            static_cast<CAScoreViewPort*>(_viewPortList[i])->sheet()!=sheet)
                        continue;

                  _viewPortList[i]->rebuild();

                  if (_viewPortList[i]->viewPortType() == CAViewPort::ScoreViewPort)
                        static_cast<CAScoreViewPort*>(_viewPortList[i])->checkScrollBars();

                  if (repaint)
                        _viewPortList[i]->repaint();
            }
      } else {
            clearUI();
      }

      if (_resourceView) {
            _resourceView->rebuildUi();
      }

      updateWindowTitle();
      updateToolBars();
      setRebuildUILock( false );
}


Generated by  Doxygen 1.6.0   Back to index