コード例 #1
0
 public PartSegmentDrawing(List <string> measuresList, string partId, PartProperties partProperites, int systemIndex, int pageIndex)
 {
     _measuresList   = measuresList;
     _partId         = partId;
     _partProperties = partProperites;
     _systemIndex    = systemIndex;
     _pageIndex      = pageIndex;
     _stavesCount    = _partProperties.NumberOfStaves;
     _staffDistance  = partProperites.StaffLayoutPerPage[pageIndex][systemIndex].StaffDistance;
     CalculateDimensions();
 }
コード例 #2
0
 public PartSegmentDrawing(List <MeasureSegmentController> measureSegments, string partId, LayoutSystemInfo layoutInfo)
 {
     _partId           = partId;
     _measuresList     = measureSegments.Select(x => x.MeasureId).ToList();
     _partMeasures     = measureSegments;
     _partProperties   = ViewModel.ViewModelLocator.Instance.Main.PartsProperties[partId];
     _stavesCount      = _partProperties.NumberOfStaves;
     _systemLayoutInfo = layoutInfo;
     _systemLayoutInfo.PropertyChanged += SystemLayoutInfo_PropertyChanged;
     _staffDistance = _partProperties.StaffLayoutPerPage[_pageIndex][0].StaffDistance;
     CalculateDimensions();
 }
コード例 #3
0
        public void ArrangeSystems(bool advancedLayout = false, List <Point> precalculatedCoords = null)
        {
            double systemDistanceToPrevious = 0.0;
            double leftMarginScore          = _pageLayout.PageMargins.LeftMargin.TenthsToWPFUnit();

            if (!advancedLayout)
            {
                var firstSystemPartProperties = _partsProperties.ElementAt(0).Value;
                systemDistanceToPrevious += _pageLayout.PageMargins.TopMargin.TenthsToWPFUnit();
                PartProperties currentPartProperties = ViewModelLocator.Instance.Main.PartsProperties.Values.FirstOrDefault();
                foreach (var system in _partSystemsList)
                {
                    double lMargin = 0.0;

                    int systemIndex = _partSystemsList.IndexOf(system);
                    lMargin = leftMarginScore + currentPartProperties.SystemLayoutPerPage[_pageIndex][system.SystemIndex].SystemMargins
                              .LeftMargin.TenthsToWPFUnit();
                    if (systemIndex == 0)
                    {
                        systemDistanceToPrevious += firstSystemPartProperties.SystemLayoutPerPage[_pageIndex][0].TopSystemDistance
                                                    .TenthsToWPFUnit();
                    }
                    if (systemIndex != 0)
                    {
                        systemDistanceToPrevious += firstSystemPartProperties.SystemLayoutPerPage[_pageIndex][systemIndex]
                                                    .SystemDistance.TenthsToWPFUnit();
                    }

                    Canvas.SetTop(system.PartSystemCanvas, systemDistanceToPrevious);
                    Canvas.SetLeft(system.PartSystemCanvas, lMargin);
                    systemDistanceToPrevious += system.Size.Height;
                }
            }
            else
            {
                if (precalculatedCoords != null)
                {
                    if (_partSystemsList.Count > precalculatedCoords.Count)
                    {
                        throw new NotImplementedException();
                    }
                    for (int i = 0; i < _partSystemsList.Count; i++)
                    {
                        Canvas.SetTop(_partSystemsList[i].PartSystemCanvas, precalculatedCoords[i].Y);
                        Canvas.SetLeft(_partSystemsList[i].PartSystemCanvas, precalculatedCoords[i].X + leftMarginScore);
                    }
                }
            }
        }
コード例 #4
0
 private void GenerateMeasuresRangePerSystem()
 {
     foreach (var part in _score.Part)
     {
         PartProperties tempPartProperties = ViewModelLocator.Instance.Main.PartsProperties[part.Id];
         int            partIndex          = _score.Part.IndexOf(part);
         if (partIndex != 0)
         {
             _partsProperties.Add(part.Id, tempPartProperties);
         }
         else
         {
             _partsProperties.Add(part.Id, tempPartProperties);
         }
     }
     _measuresIdRangePerSystem = _partsProperties.ElementAt(0).Value.MeasuresPerSystemPerPage[_pageIndex];
 }