示例#1
0
        private void CmdScoreNoteModifySpecial_Executed(object sender, ExecutedEventArgs e)
        {
            var hit = (ScoreEditorHitTestResult)e.Parameter;

            if (hit == null || !hit.HitAnyNote)
            {
                return;
            }

            var note = hit.Note;

            Debug.Assert(note.Params != null, "note.Params != null");

            var originalBpm = note.Params.NewBpm;

            var(r, newBpm) = FSpecialNote.VariantBpmRequestInput(this, hit.Bar.Basic.Index, hit.Row, originalBpm);

            if (r == DialogResult.Cancel)
            {
                return;
            }
            note.Params.NewBpm = newBpm;
            InformProjectModified();
            visualizer.Editor.UpdateBarStartTimeText();

            ctxScoreNoteInsertSpecial.DeleteCommandParameter();
            ctxScoreNoteModifySpecial.DeleteCommandParameter();
            ctxScoreNoteDeleteSpecial.DeleteCommandParameter();
        }
示例#2
0
        private void CmdScoreNoteInsertSpecial_Executed(object sender, ExecutedEventArgs e)
        {
            var    hit = (ScoreEditorHitTestResult)e.Parameter;
            double newBpm;
            Bar    bar;
            int    newRowIndex;

            if (hit == null)
            {
                var r = FSpecialNote.VariantBpmRequestInput(this, visualizer.Editor.CurrentScore);
                if (r.DialogResult == DialogResult.Cancel)
                {
                    return;
                }
                newBpm = r.NewBpm;
                bar    = visualizer.Editor.CurrentScore?.Bars.Find(b => b.Basic.Index == r.BarIndex);
                if (bar == null)
                {
                    return;
                }
                newRowIndex = r.RowIndex;
            }
            else
            {
                if (!hit.HitAnyBar)
                {
                    return;
                }
                var r = FSpecialNote.VariantBpmRequestInput(this, hit.Bar.Basic.Index, hit.Row);
                if (r.DialogResult == DialogResult.Cancel)
                {
                    return;
                }
                newBpm      = r.NewBpm;
                bar         = hit.Bar;
                newRowIndex = hit.Row;
            }

            var note = bar.AddSpecialNote(NoteType.VariantBpm);

            Debug.Assert(note.Params != null, "note.Params != null");

            note.Params.NewBpm     = newBpm;
            note.Basic.IndexInGrid = newRowIndex;

            InformProjectModified();
            visualizer.Editor.UpdateBarStartTimeText();

            ctxScoreNoteInsertSpecial.DeleteCommandParameter();
            ctxScoreNoteModifySpecial.DeleteCommandParameter();
            ctxScoreNoteDeleteSpecial.DeleteCommandParameter();
        }
示例#3
0
 public static (DialogResult DialogResult, double NewBpm, int BarIndex, int RowIndex) VariantBpmRequestInput(IWin32Window parent, Score score)
 {
     using (var f = new FSpecialNote()) {
         f._bpm   = 0;
         f._score = score;
         f.FillMeasureComboBox();
         f.CboMeasures_SelectedIndexChanged(f, EventArgs.Empty);
         f.Localize(LanguageManager.Current);
         f.MonitorLocalizationChange();
         var r = f.ShowDialog(parent);
         f.UnmonitorLocalizationChange();
         var bpm      = f._bpm;
         var barIndex = f._barIndex;
         var row      = f._rowIndex;
         return(r, bpm, barIndex, row);
     }
 }
示例#4
0
 public static (DialogResult DialogResult, double NewBpm) VariantBpmRequestInput(IWin32Window parent, int barIndex, int rowIndex, double originalBpm = 0)
 {
     using (var f = new FSpecialNote()) {
         f._bpm = originalBpm;
         f.SetManualSelection(false);
         f.cboMeasures.Items.Add((barIndex + 1).ToString());
         f.cboMeasures.SelectedIndex = 0;
         f.cboRows.Items.Add((rowIndex + 1).ToString());
         f.cboRows.SelectedIndex = 0;
         f.Localize(LanguageManager.Current);
         f.MonitorLocalizationChange();
         var r = f.ShowDialog(parent);
         f.UnmonitorLocalizationChange();
         var bpm = f._bpm;
         return(r, bpm);
     }
 }