예제 #1
0
파일: Classes.cs 프로젝트: alexfordc/Au
            public static _Enum Copy(_Enum x, string name)
            {
                var r = new _Enum(name, x.forwardDecl);

                r.defAfterName = x.defAfterName;
                r.isFlags      = x.isFlags;
                return(r);
            }
예제 #2
0
 public static void AddDispositionChangeItem(Note clonedNote, Note cloneSource, _Enum.Disposition disposition)
 {
     if (Collaborations.DispositionChanges == null)
     {
         Collaborations.DispositionChanges = new List<DispositionChangeItem>();
     }
     Collaborations.DispositionChanges.Add(new DispositionChangeItem(clonedNote.Id, cloneSource.Id, disposition));
 }
예제 #3
0
        public TranspositionState(TranspositionState before, int rawInterval, int deltaOctave, _Enum.TranspositionMode mode, int interval)
        {
            SlotIndex = before.SlotIndex + rawInterval;

            SetOctave(before, mode, deltaOctave);

            SlotIndex = (SlotIndex >= 0) ? SlotIndex % 12 : (SlotIndex + 12) % 12;

            SetPitch(mode, before, interval);
            SetAccidental();

            SetSlot();
            DeltaSlot = int.Parse(Slot) - int.Parse(before.Slot);
            SetLocationY();
            Pitch = (Pitch.Length == 1) ? string.Format("{0}{1}", Pitch, Octave) : string.Format("{0}{1}{2}", Pitch.ToCharArray()[0], Octave, Pitch.ToCharArray()[1]);
        }
예제 #4
0
 public static Arc Create(Guid parentId, Guid staffId, _Enum.ArcType type)
 {
     var obj = repository.Create<Arc>();
     obj.Id = Guid.NewGuid();
     obj.Note_Id1 = Infrastructure.Support.Selection.Notes[0].Id;
     obj.Note_Id2 = Infrastructure.Support.Selection.Notes[1].Id;
     obj.Chord_Id1 = (from a in Cache.Chords where a.Id == Infrastructure.Support.Selection.Notes[0].Chord_Id select a.Id).SingleOrDefault();
     obj.Chord_Id2 = (from a in Cache.Chords where a.Id == Infrastructure.Support.Selection.Notes[1].Chord_Id select a.Id).SingleOrDefault();
     obj.Audit.CreateDate = DateTime.Now;
     obj.Audit.ModifyDate = DateTime.Now;
     obj.Audit.Author_Id = Current.User.Id;
     obj.ArcSweep = "";
     obj.FlareSweep = "";
     obj.Top = 0;
     obj.Staff_Id = staffId;
     obj.Composition_Id = parentId;
     obj.Type = (short)type;
     obj.Status = CollaborationManager.GetBaseStatus();
     return obj;
 }
예제 #5
0
 public static void OnPlayComposition(_Enum.PlaybackInitiatedFrom location)
 {
     Cache.PlaybackNotes = new System.Collections.ObjectModel.ObservableCollection<Repository.DataService.Note>();
     foreach (Repository.DataService.Staffgroup sg in CompositionManager.Composition.Staffgroups)
     {
         foreach (Repository.DataService.Staff s in sg.Staffs)
         {
             foreach (Repository.DataService.Measure m in s.Measures)
             {
                 FilterActionableNotes(m);
             }
         }
     }
     _ea.GetEvent<Play>().Publish(0);
     //when playback initiated from the hub, no composition has been selected and opened, so CompositionManager.Composition
     //contains nothing. But when a composition is played, it compiles the playback using CompositionManager.Composition. So,
     //to avoid having yet another PlayComposition method, we borrow CompositionManager.Composition and set it
     //to whatever composition the user has selected in the Hub. Then when the playback is complete, we set it back to null.
     if (location == _Enum.PlaybackInitiatedFrom.Hub)
     {
         CompositionManager.Composition = null;
     }
 }
예제 #6
0
 private void SetDisposition(_Enum.Disposition disposition, Guid noteId)
 {
     if (Collaborations.DispositionChanges == null)
     {
         Collaborations.DispositionChanges = new List<DispositionChangeItem>();
     }
     var a = from b in Collaborations.DispositionChanges where b.ItemId == noteId select b;
     var dispositionChangeItems = a as List<DispositionChangeItem> ?? a.ToList();
     if (dispositionChangeItems.Any())
     {
         DispositionChangeItem item = dispositionChangeItems.SingleOrDefault();
         if (item != null) item.Disposition = _disposition;
     }
     else
     {
         NoteController.AddDispositionChangeItem(Note, Note, disposition);
     }
     var c = from d in Collaborations.DispositionChanges where d.Disposition != _Enum.Disposition.Na select d;
     EA.GetEvent<UpdateCollaborationPanelSaveButtonEnableState>().Publish(c.Any());
 }
예제 #7
0
 public static bool Validate(_Enum.ArcType type)
 {
     bool result = false;
     switch (type)
     {
         case _Enum.ArcType.Slur:
             result = Infrastructure.Support.Selection.Notes[0].StartTime != Infrastructure.Support.Selection.Notes[1].StartTime;
             break;
         case _Enum.ArcType.Tie:
             result = Infrastructure.Support.Selection.Notes[0].StartTime != Infrastructure.Support.Selection.Notes[1].StartTime &&
                     Infrastructure.Support.Selection.Notes[0].Pitch == Infrastructure.Support.Selection.Notes[1].Pitch &&
                     AreContiguous();
             break;
     }
     return result;
 }
예제 #8
0
 public DispositionChangeItem(Guid itemId, Guid sourceId, _Enum.Disposition disposition)
 {
     ItemId = itemId;
     SourceId = sourceId;
     Disposition = disposition;
 }
예제 #9
0
 private void AcceptOrRejectAll(_Enum.Disposition disposition)
 {
     var chords = ChordManager.GetActiveChords(Measure);
     foreach (var chord in chords)
     {
         foreach (var note in chord.Notes)
         {
             switch (disposition)
             {
                 case _Enum.Disposition.Accept:
                     EA.GetEvent<AcceptChange>().Publish(note.Id);
                     break;
                 case _Enum.Disposition.Reject:
                     EA.GetEvent<RejectChange>().Publish(note.Id);
                     break;
             }
         }
     }
 }
예제 #10
0
 private static bool DispatchArcTool(_Enum.ArcType type)
 {
     bool bDeSelectAll = false;
     if (ViewModel.IsSelected)
     {
         if (Infrastructure.Support.Selection.Notes.Count == 2)
         {
             if (ArcManager.Validate(type))
             {
                 var c = (from a in Cache.Chords where a.Id == ViewModel.Note.Chord_Id select a).First();
                 var m = (from a in Cache.Measures where a.Id == c.Measure_Id select a).First();
                 var arc = ArcManager.Create(CompositionManager.Composition.Id, m.Staff_Id, type);
                 Ea.GetEvent<AddArc>().Publish(arc);
             }
             else
             {
                 bDeSelectAll = true;
             }
         }
     }
     return bDeSelectAll;
 }
예제 #11
0
 private static void setSocialChannelsVisibility(_Enum.SocialChannelCategory obj, string visibility)
 {
     //granular control of social channel visibility
     switch (obj)
     {
         case _Enum.SocialChannelCategory.All:
             setElementStyleAttribute("pinterestButtonContainer", "display", visibility);
             setElementStyleAttribute("likeButtonContainer", "display", visibility);
             setElementStyleAttribute("sendButtonContainer", "display", visibility);
             setElementStyleAttribute("tweetButtonContainer", "display", visibility);
             setElementStyleAttribute("googlePlusoneButtonContainer", "display", visibility);
             setElementStyleAttribute("requestContainer", "display", visibility);
             break;
         case _Enum.SocialChannelCategory.Facebook_Feed:
             break;
         case _Enum.SocialChannelCategory.Facebook_Like:
             setElementStyleAttribute("likeButtonContainer", "display", visibility);
             break;
         case _Enum.SocialChannelCategory.Facebook_Send:
             setElementStyleAttribute("sendButtonContainer", "display", visibility);
             break;
         case _Enum.SocialChannelCategory.Facebook_All:
             setElementStyleAttribute("likeButtonContainer", "display", visibility);
             setElementStyleAttribute("sendButtonContainer", "display", visibility);
             break;
         case _Enum.SocialChannelCategory.Pinterest:
             setElementStyleAttribute("pinterestButtonContainer", "display", visibility);
             break;
         case _Enum.SocialChannelCategory.Twitter:
             setElementStyleAttribute("tweetButtonContainer", "display", visibility);
             break;
         case _Enum.SocialChannelCategory.Google_Plusone:
             setElementStyleAttribute("googlePlusoneButtonContainer", "display", visibility);
             break;
         case _Enum.SocialChannelCategory.Requests:
             setElementStyleAttribute("requestContainer", "display", visibility);
             break;
     }
 }
예제 #12
0
 public void OnShowFooter(_Enum.MeasureFooter footer)
 {
     HideFooters();
     if (Measure.Chords.Count > 0)
     {
         switch (footer)
         {
             case _Enum.MeasureFooter.Collaboration:
                 ObservableCollection<Chord> chords = ChordManager.GetActiveChords(Measure);
                 if (Measure.Chords.Count - chords.Count > 0)
                 {
                     CollaborationFooterVisible = Visibility.Visible;
                 }
                 break;
             case _Enum.MeasureFooter.Editing:
                 var s = (from a in Cache.Staffs where a.Id == Measure.Staff_Id select a).First();
                 if (EditorState.StaffConfiguration == _Enum.StaffConfiguration.Simple ||
                    (EditorState.StaffConfiguration == _Enum.StaffConfiguration.Grand && s.Index % 2 == 0))
                 {
                     EditingFooterVisible = Visibility.Visible;
                 }
                 break;
         }
     }
 }
예제 #13
0
        private void SetPitch(_Enum.TranspositionMode mode, TranspositionState before, int interval)
        {
            string[] pitches = (from a in Infrastructure.Dimensions.Keys.KeyList
                                where (a.Name == before.Pitch)
                                select a.Scale).Single().Split(',')[interval].Split('-');

            if (mode == _Enum.TranspositionMode.Octave)
                Pitch = before.Pitch;
            else
                Pitch = (pitches.Length == 1) ? pitches[0] : (EditorState.TargetAccidental == "f") ? pitches[1] : pitches[0];
        }
예제 #14
0
 public static Arc Create(Guid parentId, _Enum.ArcType type, Guid note_Id1, Guid note_Id2, Guid chord_Id1, Guid chord_Id2)
 {
     var obj = repository.Create<Arc>();
     obj.Id = Guid.NewGuid();
     obj.Note_Id1 = note_Id1;
     obj.Note_Id2 = note_Id2;
     obj.Chord_Id1 = chord_Id1;
     obj.Chord_Id2 = chord_Id2;
     obj.Audit.CreateDate = DateTime.Now;
     obj.Audit.ModifyDate = DateTime.Now;
     obj.Audit.Author_Id = Current.User.Id;
     obj.ArcSweep = "";
     obj.FlareSweep = "";
     obj.Top = 0;
     obj.Composition_Id = parentId;
     obj.Type = (short)type;
     obj.Status = CollaborationManager.GetBaseStatus();
     return obj;
 }
예제 #15
0
 private bool ContainsStatus(Chord chord, _Enum.Status status)
 {
     return chord.Notes.Any(note => ContainsStatus(note, status));
 }
예제 #16
0
 private bool ContainsStatus(Note note, _Enum.Status status)
 {
     return Collaborations.GetStatus(note) == (short)status;
 }
예제 #17
0
 public static void SetAccidental(_Enum.Accidental accidental)
 {
     LoadEventAggregator();
     foreach (Note note in Notes)
     {
         var p = new Tuple<_Enum.Accidental, Note>(accidental, note);
         _ea.GetEvent<SetAccidental>().Publish(p);
     }
 }
예제 #18
0
 private static int GetChordXCoordinate(_Enum.NotePlacementMode notePlacementType, Chord chord)
 {
     var locationX = 0;
     var proportionalSpace = DurationManager.GetProportionalSpace();
     var spacing = ((Preferences.SpacingMode == _Enum.MeasureSpacingMode.Constant) ? Measure.Spacing : proportionalSpace);
     MeasureChordNotegroups = NotegroupManager.ParseMeasure(out ChordStartTimes, out ChordInactiveTimes);
     var chords = GetActiveChords(Measure.Chords);
     switch (notePlacementType)
     {
         case _Enum.NotePlacementMode.Insert:
             if (_chord1 != null && _chord2 != null)
             {
                 locationX = _chord1.Location_X + spacing;
                 chord.Location_X = locationX;
                 chord.StartTime = _chord2.StartTime;
                 foreach (Chord c in chords)  //no need to filter measure.chords using GetActiveChords().
                 {
                     if (c.Location_X > _chord1.Location_X && chord != c)
                     {
                         c.Location_X += spacing;
                         if (c.StartTime != null) c.StartTime = (double)c.StartTime + (double)chord.Duration;
                         _r.Update(c);
                     }
                     _ea.GetEvent<SynchronizeChord>().Publish(c);
                     _ea.GetEvent<UpdateChord>().Publish(c);
                 }
             }
             break;
         case _Enum.NotePlacementMode.Append:
             var a = (from c in chords where c.StartTime < Chord.StartTime select c.Location_X);
             var e = a as List<int> ?? a.ToList();
             locationX = (!e.Any()) ? Infrastructure.Constants.Measure.Padding : Convert.ToInt32(e.Max()) + spacing;
             break;
     }
     return locationX;
 }
예제 #19
0
 private void SetOctave(TranspositionState before,_Enum.TranspositionMode mode, int deltaOctave)
 {
     Octave = before.Octave;
     if (mode == _Enum.TranspositionMode.Octave)
     {
         Octave = Octave + deltaOctave;
     }
     else
     {
         if (SlotIndex > 11)
         {
             Octave++;
         }
         else if (SlotIndex < 0) Octave--;
     }
 }
예제 #20
0
 public static void OnHideSocialChannels(_Enum.SocialChannelCategory obj)
 {
     setSocialChannelsVisibility(obj, "none");
 }
예제 #21
0
 public static void OnShowSocialChannels(_Enum.SocialChannelCategory obj)
 {
     setSocialChannelsVisibility(obj, "inline-block");
 }
        public void OnNewCompositionPanelStaffConfigurationChanged(_Enum.StaffConfiguration staffConfiguration)
        {
            CompositionPanelVisibility = Visibility.Collapsed;
            EditorState.StaffConfiguration = staffConfiguration;
            _staffConfiguration = staffConfiguration;
            DetachNewCompositionPanelComposition();
            Composition = null;

            CreateNewCompositionForPanel();
            if (Composition == null)
            {
                throw new ArgumentNullException("NewCompositionViewModel.OnNewCompositionPanelStaffConfigurationChanged.Composition");
            }
            Composition.StaffConfiguration = (short)staffConfiguration;
            SetMargins();
            GrandStaffConfigurationClefComboBoxVisibility = (staffConfiguration == _Enum.StaffConfiguration.Grand) ? Visibility.Visible : Visibility.Collapsed;
            CompositionPanelVisibility = Visibility.Visible;
        }