Esempio n. 1
0
 public void OnOctaveUpUncheckedCommand(ExtendedCommandParameter commandParameter)
 {
     Direction = _Enum.Direction.None;
     DeltaOctave = 0;
 }
 public void OnMouseLeftButtonDownOnPause(ExtendedCommandParameter commandParameter)
 {
     if ((EditorState.IsPlaying) && EditorState.ActivePlaybackControlId == this.Id)
     {
         SetButtonStyle(ButtonState.Selected, ButtonType.Pause);
         this.PauseButtonOpacity = 1;
     }
 }
 public void OnMouseLeftButtonDownOnStop(ExtendedCommandParameter commandParameter)
 {
     if ((EditorState.IsPlaying || EditorState.IsPaused) && EditorState.ActivePlaybackControlId == this.Id)
     {
         SetButtonStyle(ButtonState.Selected, ButtonType.Stop);
         this.StopButtonOpacity = Preferences.PlaybackControlOpacity_Enabled;
     }
 }
        public void OnSelectionChanged(ExtendedCommandParameter param)
        {
            //the Clear button handler sets the SelectedIndex to null, throwing the SelectionChanged event, triggering this handler.
            _listBox = (ListBox)param.Sender;
            var collaborator = (Collaborator)_listBox.SelectedItem;
            if (collaborator == null || Collaborations.CurrentCollaborator != null) //if we click the clear button OR select a different collaborator
            {
                //here we are hiding the previously selected collaborator changes.
                string currentCollaboratorId = Collaborations.CurrentCollaborator.Author_Id;
                Collaborations.CurrentCollaborator = null;
                CanExecuteClear = false;
                foreach (var note in Cache.Notes)
                {
                    if (note.Audit.Author_Id == currentCollaboratorId ||
                        Collaborations.GetStatus(note) == (int)_Enum.Status.ContributorDeleted)
                    {
                        EA.GetEvent<UpdateNote>().Publish(note);
                        EA.GetEvent<RemoveOverlay>().Publish(note);
                    }
                }
            }

            if (collaborator != null)
            {
                //TODO: replace all 'EA.GetEvent<UpdateNote>().Publish(note)' lines with a boolean that indicates
                //the note needs to be updated, then publish the UpdateNote event once, at bottom of method if the boolean is true.

                //show the currently selected collaborator changes.
                CanExecuteClear = true;
                string id = (collaborator.Author_Id == CompositionManager.Composition.Audit.Author_Id) ? Current.User.Id : collaborator.Author_Id;
                int index = (from b in Collaborations.CurrentCollaborations where b.Collaborator_Id == id select b.Index).First();
                Collaborations.Index = index;
                Collaborations.CurrentCollaborator = collaborator;

                EA.GetEvent<UpdateCollaboratorName>().Publish(string.Format("{0} {1}", collaborator.Name, string.Empty));

                foreach (var note in Cache.Notes)
                {
                    var status = Collaborations.GetStatus(note, index);

                    //TODO: is "EditorState.IsAuthor" equivalent to "EditContext == _Enum.EditContext.authoring". if so refactor
                    //"EditorState.IsAuthor" to "if (EditContext == _Enum.EditContext.authoring)"
                    if (EditorState.IsAuthor) //is the logged on user the composition author?
                    {
                        //there is one author but many contributors, so we must check if
                        //this note was created by the currently selected contributor.
                        if (note.Audit.Author_Id == collaborator.Author_Id)
                        {
                            //has the disposition of the note been resolved? if so, it's status will now
                            //be Enum.Status.ContributorAdded and the style of the note should reflect a pending addition.
                            if (status == (int)_Enum.Status.ContributorAdded)
                            {
                                note.Foreground = Preferences.AddedColor;
                                EA.GetEvent<UpdateNote>().Publish(note);
                            }
                        }
                        else
                        {
                            //has the disposition of the note been resolved? if so, it's status will now
                            //be Enum.Status.ContributorDeleted and the style of the note should reflect a pending deletion.
                            if (status == (int)_Enum.Status.ContributorDeleted)
                            {
                                if (note.Audit.CollaboratorIndex == Collaborations.CurrentCollaborator.Index)
                                //is the creator of this note the currently selected collaborator ?
                                {
                                    note.Foreground = Preferences.DeletedColor;
                                    EA.GetEvent<UpdateNote>().Publish(note);
                                }
                            }
                        }
                        EA.GetEvent<UpdateNote>().Publish(note);
                    }
                    else
                    {
                        //if we arrive here, the current user is a contributor, not the author.
                        //There can be many contributors but only one author, so unlike
                        //above we only need to check the status of the note instead of
                        //both status and ownership.

                        //has the disposition of the note been resolved? if so, it's status will now
                        //be Enum.Status.AuthorAdded and the style of the note should reflect a pending addition.
                        if (status == (int)_Enum.Status.AuthorAdded)
                        {
                            note.Foreground = Preferences.AddedColor;
                            EA.GetEvent<UpdateNote>().Publish(note);
                        }
                        else
                        {
                            //has the disposition of the note been resolved? if so, it's status will now
                            //be Enum.Status.AuthorDeleted and the style of the note should reflect a pending deletion.
                            if (status == (int)_Enum.Status.AuthorDeleted)
                            {
                                note.Foreground = Preferences.DeletedColor;
                                EA.GetEvent<UpdateNote>().Publish(note);
                            }
                        }
                    }
                }
                EA.GetEvent<ShowMeasureFooter>().Publish(_Enum.MeasureFooter.Collaboration);
            }
            UpdateComposition();
        }
Esempio n. 5
0
 public override void OnMouseLeave(ExtendedCommandParameter commandParameter)
 {
     //TODO: for some reason CanExecute() not working for MouseLeave and MouseEnter
     EditorState.IsOverArc = false;
     if (CanHandleMouseLeave(""))
     {
         Background = Preferences.ArcBackground;
         Foreground = Preferences.ArcForeground;
         StrokeWidth = Preferences.ArcStrokeThickness.ToString(CultureInfo.InvariantCulture);
     }
 }
Esempio n. 6
0
 public override void OnMouseLeave(ExtendedCommandParameter commandParameter)
 {
     if (!Debugging)
     {
         return;
     }
     PropertiesPanelVisibility = Visibility.Collapsed;
 }
Esempio n. 7
0
 public void OnMouseLeftButtonDownReject(ExtendedCommandParameter commandParameter)
 {
     if (_disposition == _Enum.Disposition.Reject)
     {
         RejectOpacity = .5;
     }
     else
     {
         DispositionRejectBackground = RejectBackground;
         DispositionRejectForeground = RejectForeground;
         RejectOpacity = 1;
     }
 }
Esempio n. 8
0
 public void OnMouseLeaveBar(ExtendedCommandParameter commandParameter)
 {
     if (!EditorState.IsPrinting)
     {
         var item = (Path)commandParameter.Parameter;
         item.Cursor = Cursors.Hand;
         BarBackground = Preferences.BarBackground;
         BarForeground = Preferences.BarForeground;
         EA.GetEvent<UpdateMeasureBarColor>().Publish(new Tuple<Guid, string>(Measure.Id, Preferences.BarForeground));
         EditorState.IsOverBar = false;
     }
 }
Esempio n. 9
0
 public void OnMouseLeftButtonDownOnBar(ExtendedCommandParameter commandParameter)
 {
     if (!EditorState.IsPrinting)
     {
         EditorState.IsResizingMeasure = true;
         EA.GetEvent<HideEditPopup>().Publish(string.Empty);
         var item = (Path)commandParameter.Parameter;
         var args = (MouseEventArgs)commandParameter.EventArgs;
         _mouseY = args.GetPosition(null).Y;
         _mouseX = args.GetPosition(null).X;
         _measureBarBeforeDragX = _mouseX;
         _isMouseCaptured = true;
         item.CaptureMouse();
     }
 }
Esempio n. 10
0
 public void OnTransposeOctaveUncheckedCommand(ExtendedCommandParameter commandParameter)
 {
     OctaveTranspositionEnabled = false;
     DeltaOctave = 0;
 }
Esempio n. 11
0
 public override void OnMouseLeave(ExtendedCommandParameter param)
 {
     EA.GetEvent<HideMeasureEditHelpers>().Publish(string.Empty);
     HideCursor();
     HideLedgerGuide();
     HideMarker();
 }
Esempio n. 12
0
 public void OnTransposeKeyUncheckedCommand(ExtendedCommandParameter commandParameter)
 {
     KeyTranspositionEnabled = false;
 }
Esempio n. 13
0
 public void OnTransposeKeyCheckedCommand(ExtendedCommandParameter commandParameter)
 {
     KeyTranspositionEnabled = true;
 }
Esempio n. 14
0
 public void OnTransposeIntervalUncheckedCommand(ExtendedCommandParameter commandParameter)
 {
     IntervalTranspositionEnabled = false;
 }
Esempio n. 15
0
        public override void OnMouseMove(ExtendedCommandParameter commandParameter)
        {
            if (commandParameter.EventArgs.GetType() == typeof(MouseEventArgs))
            {

            }
        }
Esempio n. 16
0
        public void OnMouseLeftButtonUpOnBar(ExtendedCommandParameter commandParameter)
        {
            if (!EditorState.IsPrinting)
            {
                var item = (Path)commandParameter.Parameter;
                var args = (MouseEventArgs)commandParameter.EventArgs;
                if (_debugging)
                {
                    item.Stroke = new SolidColorBrush(Colors.Black);
                }
                _mouseX = args.GetPosition(null).X;
                _measureBarAfterDragX = _mouseX;
                _isMouseCaptured = false;
                item.ReleaseMouseCapture();
                _mouseY = -1;
                _mouseX = -1;

                var payload =
                    new MeasureWidthChangePayload
                    {
                        Id = Measure.Id,
                        Sequence = Measure.Sequence,
                        Width = (int)(Width - (int)(_measureBarBeforeDragX - _measureBarAfterDragX)),
                        StaffgroupId = Guid.NewGuid()
                    };

                EA.GetEvent<ResizeMeasure>().Publish(payload);
                _initializedWidth = Width;
                EditorState.IsResizingMeasure = false;
            }
        }
Esempio n. 17
0
 public override void OnMouseEnter(ExtendedCommandParameter commandParameter)
 {
     if (!Debugging)
     {
         return;
     }
     PropertiesPanelVisibility = Visibility.Visible;
 }
Esempio n. 18
0
        public override void OnMouseMove(ExtendedCommandParameter commandParameter)
        {
            if (!EditorState.IsNewCompositionPanel)
            {
                Coordinates = string.Format("{0}, {1}", _measureClickX, _measureClickY);

                SwitchContext();
                if (commandParameter.EventArgs.GetType() == typeof(MouseEventArgs))
                {
                    var e = commandParameter.EventArgs as MouseEventArgs;
                    if (commandParameter.Parameter != null)
                    {
                        var view = commandParameter.Parameter as UIElement;
                        if (e != null)
                        {
                            MeasureClick_X = (int)e.GetPosition(view).X;
                            MeasureClick_Y = (int)e.GetPosition(view).Y;

                            if (EditorState.IsNoteSelected())
                            {
                                _compositionView = null;
                                TrackLedger();
                                if (!EditorState.IsResizingMeasure)
                                {
                                    TrackChordMarker();
                                    TrackInsertMarker();
                                }
                            }
                            else
                            {
                                TrackAreaSelectRectangle(e);
                            }
                        }
                        TrackMeasureCursor();
                    }
                }
            }
        }
Esempio n. 19
0
 public void OnMouseLeftButtonDownAccept(ExtendedCommandParameter commandParameter)
 {
     if (_disposition == _Enum.Disposition.Accept)
     {
         AcceptOpacity = .5;
     }
     else
     {
         DispositionAcceptBackground = AcceptBackground;
         DispositionAcceptForeground = AcceptForeground;
         AcceptOpacity = 1;
     }
 }
Esempio n. 20
0
 public void OnMouseMoveBar(ExtendedCommandParameter commandParameter)
 {
     try
     {
         if (EditorState.IsPrinting) return;
         var item = (Path)commandParameter.Parameter;
         var e = (MouseEventArgs)commandParameter.EventArgs;
         if (_isMouseCaptured)
         {
             BarBackground = Preferences.BarSelectorColor;
             BarForeground = Preferences.BarSelectorColor;
             var x = e.GetPosition(null).X;
             var deltaH = x - _mouseX;
             var newLeft = deltaH + (double)item.GetValue(Canvas.LeftProperty);
             EA.GetEvent<UpdateMeasureBarX>().Publish(new Tuple<Guid, double>(Measure.Id, newLeft));
             EA.GetEvent<UpdateMeasureBarColor>().Publish(new Tuple<Guid, string>(Measure.Id, Preferences.BarSelectorColor));
             item.SetValue(Canvas.LeftProperty, newLeft);
             _mouseY = e.GetPosition(null).Y;
             _mouseX = e.GetPosition(null).X;
         }
     }
     catch (Exception ex)
     {
         Exceptions.HandleException(ex);
     }
 }
Esempio n. 21
0
 public void OnMouseRightButtonDown(ExtendedCommandParameter commandParameter)
 {
     EditorState.IsOverNote = true;
     NoteController.SelectedNoteId = Note.Id;
     ChordManager.SelectedChordId = Note.Chord_Id;
 }
Esempio n. 22
0
        public void OnMouseRightButtonUp(ExtendedCommandParameter commandParameter)
        {
            var pt = new Point(MeasureClick_X + 10 - CompositionManager.XScrollOffset, MeasureClick_Y + 10 - CompositionManager.YScrollOffset);
            var payload =
                new Tuple<Point, int, int, double, double, string, Guid>(pt, Measure.Sequence, Measure.Index, Measure.Index * DurationManager.BPM, DurationManager.BPM, Measure.Width, Measure.Staff_Id);

            EA.GetEvent<SetEditPopupMenu>().Publish(payload);
            EA.GetEvent<UpdateEditPopupMenuTargetMeasure>().Publish(this);
            EA.GetEvent<UpdateEditPopupMenuItemsEnableState>().Publish(string.Empty);
            EA.GetEvent<ShowEditPopupMenu>().Publish(string.Empty);

            SetChordContext();
        }
Esempio n. 23
0
 public override void OnMouseEnter(ExtendedCommandParameter commandParameter)
 {
     //TODO: for some reason CanExecute() not working for MouseLeave and MouseEnter
     EditorState.IsOverArc = false;
     if (CanHandleMouseEnter(""))
     {
         Background = Preferences.ArcHighlightBackground;
         Foreground = Preferences.ArcSelectorColor;
         StrokeWidth = Preferences.ArcHighlightStrokeWidth;
     }
 }
Esempio n. 24
0
 public override void OnMouseMove(ExtendedCommandParameter commandParameter)
 {
     MouseEventArgs e;
     if (commandParameter.EventArgs.GetType() == typeof(MouseEventArgs))
     {
         e = commandParameter.EventArgs as MouseEventArgs;
         if (commandParameter.Parameter != null)
         {
             var view = commandParameter.Parameter as UIElement;
         }
     }
 }
 public void OnMouseLeavePause(ExtendedCommandParameter commandParameter)
 {
     if ((EditorState.IsPlaying) && EditorState.ActivePlaybackControlId == this.Id)
     {
         SetButtonStyle(ButtonState.Default, ButtonType.Pause);
         this.PauseButtonOpacity = Preferences.PlaybackControlOpacity_Disabled;
     }
 }
Esempio n. 26
0
 public void OnMouseMoveSidebar(ExtendedCommandParameter commandParameter)
 {
 }
 public void OnMouseLeftButtonDownOnPlay(ExtendedCommandParameter commandParameter)
 {
     if (EditorState.ActivePlaybackControlId != this.Id && !this.IsPaused)
     {
         SetButtonStyle(ButtonState.Selected, ButtonType.Play);
         this.PlayButtonOpacity = Preferences.PlaybackControlOpacity_Enabled;
     }
 }
Esempio n. 28
0
 public void OnMouseLeftButtonUpCommand(ExtendedCommandParameter commandParameter)
 {
     EA.GetEvent<DeSelectAll>().Publish(string.Empty);
 }
Esempio n. 29
0
 public void OnTextChangedCommand(ExtendedCommandParameter sender)
 {
     var tb = (TextBox)sender.Sender;
     EditorText = tb.Text;
     CanExecuteApply = EditorText.Length > 0 && EditorText.Trim() != NewVerseMessage;
     CanExecuteClear = EditorText.Length > 0;
 }
Esempio n. 30
0
 public void OnOctaveUpCheckedCommand(ExtendedCommandParameter commandParameter)
 {
     Direction = _Enum.Direction.Up;
     Interval = (Direction == _Enum.Direction.Up) ? int.Parse((1 * 12).ToString(CultureInfo.InvariantCulture)) : int.Parse((-1 * 12).ToString(CultureInfo.InvariantCulture));
     DeltaOctave = int.Parse(1.ToString(CultureInfo.InvariantCulture));
     CanExecuteTranspose = IsTransposable();
 }