private void FillScoreViewer(Model.Score score)
        {
            sheetTabControl.Items.Clear();

            double width = sheetTabControl.ActualWidth - 75;

            if (width > 0)
            {
                for (int i = 0; i < score.GetAmountOfStaves(); i++)
                {
                    Model.Staff staff = score.GetStaff(i);

                    ScrollViewer scrollViewer    = new ScrollViewer();
                    StackPanel   scoreStackPanel = new StackPanel(); // TODO fix width

                    scrollViewer.Content = scoreStackPanel;

                    PSAMWPFControlLibrary.IncipitViewerWPF incipitViewer = new PSAMWPFControlLibrary.IncipitViewerWPF();

                    Thickness margin = incipitViewer.Margin;
                    margin.Top          += 50;
                    incipitViewer.Margin = margin;
                    incipitViewer.Width  = width;

                    scoreStackPanel.Children.Add(incipitViewer);

                    Model.ScoreVisitor smVisitor = new Model.ScoreVisitor(staff, incipitViewer, scoreStackPanel, width);

                    for (int j = 0; j < staff.Symbols.Count; j++)
                    {
                        Model.StaffSymbol symbol = staff.Symbols[j];
                        smVisitor.CheckIfNewStaffNeeded();
                        symbol.Accept(smVisitor, j);
                    }

                    TabItem tab = new TabItem();
                    tab.Header  = staff.StaffName;
                    tab.Content = scrollViewer;
                    sheetTabControl.Items.Add(tab);
                }
            }

            sheetTabControl.SelectedIndex = 0;
        }
示例#2
0
 public override void Accept(ScoreVisitor smVisitor, int index)
 {
     smVisitor.Visit(this);
 }
 public abstract void Accept(ScoreVisitor smVisitor, int index);