Exemplo n.º 1
0
        void IMenuStripManagerHandler.EnableMenuItems(MenuStripManager menuStrip)
        {
            textEditorWindowHelper.MenuActivateDelegate();
            textBoxWindowHelper.MenuActivateDelegate();

            menuStrip.buildObjectToolStripMenuItem.Enabled = true;
        }
Exemplo n.º 2
0
        void IMenuStripManagerHandler.EnableMenuItems(MenuStripManager menuStrip)
        {
            menuStrip.deleteObjectToolStripMenuItem.Enabled = true;
            menuStrip.deleteObjectToolStripMenuItem.Text    = "Delete Track";

            ((IMenuStripManagerHandler)trackEditControl).EnableMenuItems(menuStrip);
        }
Exemplo n.º 3
0
 bool IMenuStripManagerHandler.ExecuteMenuItem(MenuStripManager menuStrip, ToolStripMenuItem menuItem)
 {
     if (menuItem == menuStrip.evaluateToolStripMenuItem)
     {
         Eval();
         return true;
     }
     else if (menuItem == menuStrip.undoToolStripMenuItem)
     {
         Undo();
         return true;
     }
     else if (menuItem == menuStrip.redoToolStripMenuItem)
     {
         Redo();
         return true;
     }
     else if (menuItem == menuStrip.insertTableToolStripMenuItem)
     {
         using (CmdDlgOneParam dialog = new CmdDlgOneParam("Insert new wave table at which index?", "Index:", hScrollBarWaveTable.Value.ToString(), CmdDlgOneParam.Options.None))
         {
             if (dialog.ShowDialog() == DialogResult.OK)
             {
                 int index;
                 if (Int32.TryParse(dialog.Value, out index) && unchecked((uint)index) <= (uint)waveTableObject.NumTables)
                 {
                     undo.Push(waveTableObject.WaveTableData);
                     redo.Clear();
                     waveTableObject.WaveTableData = WaveTableStorageRec.InsertTable(waveTableObject.WaveTableData, index);
                 }
             }
         }
         return true;
     }
     else if (menuItem == menuStrip.deleteTableToolStripMenuItem)
     {
         using (CmdDlgOneParam dialog = new CmdDlgOneParam("Delete wave table at which index?", "Index:", hScrollBarWaveTable.Value.ToString(), CmdDlgOneParam.Options.None))
         {
             if (dialog.ShowDialog() == DialogResult.OK)
             {
                 int index;
                 if (Int32.TryParse(dialog.Value, out index) && unchecked((uint)index) < (uint)waveTableObject.NumTables)
                 {
                     undo.Push(waveTableObject.WaveTableData);
                     redo.Clear();
                     waveTableObject.WaveTableData = WaveTableStorageRec.DeleteTable(waveTableObject.WaveTableData, index);
                 }
             }
         }
         return true;
     }
     else if (menuItem == menuStrip.deleteObjectToolStripMenuItem)
     {
         Close();
         mainWindow.DeleteObject(waveTableObject, mainWindow.Document.WaveTableList);
         return true;
     }
     return false;
 }
Exemplo n.º 4
0
 bool IMenuStripManagerHandler.ExecuteMenuItem(MenuStripManager menuStrip, ToolStripMenuItem menuItem)
 {
     if (menuItem == menuStrip.buildObjectToolStripMenuItem)
     {
         BuildThis(true /*force*/);
         return(true);
     }
     return(false);
 }
Exemplo n.º 5
0
        void IMenuStripManagerHandler.EnableMenuItems(MenuStripManager menuStrip)
        {
            textEditorWindowHelper.MenuActivateDelegate();

            menuStrip.evaluateToolStripMenuItem.Enabled = true;

            menuStrip.disassembleToolStripMenuItem.Visible = true;
            menuStrip.disassembleToolStripMenuItem.Enabled = true;
        }
Exemplo n.º 6
0
        void IMenuStripManagerHandler.EnableMenuItems(MenuStripManager menuStrip)
        {
            textEditorWindowHelper.MenuActivateDelegate();
            textBoxWindowHelper.MenuActivateDelegate();

            menuStrip.buildObjectToolStripMenuItem.Enabled = true;

            menuStrip.envelopeSegmentCalculatorToolStripMenuItem.Visible = true;
            menuStrip.envelopeSegmentCalculatorToolStripMenuItem.Enabled = true;

            menuStrip.deleteObjectToolStripMenuItem.Enabled = true;
            menuStrip.deleteObjectToolStripMenuItem.Text    = "Delete Instrument";
        }
Exemplo n.º 7
0
        void IMenuStripManagerHandler.EnableMenuItems(MenuStripManager menuStrip)
        {
            textEditorWindowHelper.MenuActivateDelegate();
            textBoxWindowHelper.MenuActivateDelegate();

            menuStrip.buildObjectToolStripMenuItem.Enabled = true;

            menuStrip.disassembleToolStripMenuItem.Visible = true;
            menuStrip.disassembleToolStripMenuItem.Enabled = true;

            menuStrip.deleteObjectToolStripMenuItem.Enabled = true;
            menuStrip.deleteObjectToolStripMenuItem.Text    = "Delete Function Module";
        }
Exemplo n.º 8
0
 bool IMenuStripManagerHandler.ExecuteMenuItem(MenuStripManager menuStrip, ToolStripMenuItem menuItem)
 {
     if (menuItem == menuStrip.evaluateToolStripMenuItem)
     {
         DoCalculation();
         return(true);
     }
     else if (menuItem == menuStrip.disassembleToolStripMenuItem)
     {
         Disassemble();
         return(true);
     }
     return(false);
 }
Exemplo n.º 9
0
 bool IMenuStripManagerHandler.ExecuteMenuItem(MenuStripManager menuStrip, ToolStripMenuItem menuItem)
 {
     if (menuItem == menuStrip.buildObjectToolStripMenuItem)
     {
         BuildThis(true /*force*/);
         return(true);
     }
     else if (menuItem == menuStrip.disassembleToolStripMenuItem)
     {
         DisassembleThis();
         return(true);
     }
     else if (menuItem == menuStrip.openAsSampleToolStripMenuItem)
     {
         if (BuildThis(false /*force*/))
         {
             NumBitsType numBits = NumBitsType.Max;
             float[]     buffer  = (float[])algoSampObject.SampleData.Buffer.Clone();
             SampConv.QuantizeAndClampVector(buffer, numBits); // ensure target bit depth is honored
             SampleObjectRec sampleObject = new SampleObjectRec(
                 mainWindow.Document,
                 buffer,
                 algoSampObject.SampleData.NumFrames,
                 numBits,
                 algoSampObject.NumChannels,
                 algoSampObject.Origin,
                 algoSampObject.LoopStart1,
                 algoSampObject.LoopStart2,
                 algoSampObject.LoopStart3,
                 algoSampObject.LoopEnd1,
                 algoSampObject.LoopEnd2,
                 algoSampObject.LoopEnd3,
                 algoSampObject.SamplingRate,
                 algoSampObject.NaturalFrequency);
             sampleObject.Name = String.Format("Copy of {0}", algoSampObject.Name);
             mainWindow.Document.SampleList.Add(sampleObject);
             new SampleWindow(registration, sampleObject, mainWindow).Show();
         }
         return(true);
     }
     else if (menuItem == menuStrip.deleteObjectToolStripMenuItem)
     {
         Close();
         mainWindow.DeleteObject(algoSampObject, mainWindow.Document.AlgoSampList);
         return(true);
     }
     return(false);
 }
Exemplo n.º 10
0
        bool IMenuStripManagerHandler.ExecuteMenuItem(MenuStripManager menuStrip, ToolStripMenuItem menuItem)
        {
            if (menuItem == menuStrip.buildObjectToolStripMenuItem)
            {
                BuildThis(true /*force*/);
                return(true);
            }
            else if (menuItem == menuStrip.disassembleToolStripMenuItem)
            {
                switch (BuildThis(false /*force*/))
                {
                default:
                    Debug.Assert(false);
                    throw new ArgumentException();

                case BuildResult.Succeeded:
                    StringBuilder sb = new StringBuilder();
                    foreach (FuncCodeRec TheFunction in document.CodeCenter.GetListOfFunctionsForModule(functionObject))
                    {
                        sb.AppendLine();
                        sb.AppendLine();
                        sb.AppendLine(TheFunction.GetFunctionName());
                        sb.AppendLine();

                        sb.Append(Compiler.DisassemblePcode(TheFunction.GetFunctionPcode()));
                    }
                    sb.AppendLine();
                    new DisassemblyWindow(sb.ToString(), mainWindow, textBoxFunctionName.Text).Show();
                    break;

                case BuildResult.Failed:
                    break;

                case BuildResult.SyntaxCheckedOnly:
                    MessageBox.Show("Compile errors in other modules prevented the disassembly for this module from being generated.", "Out Of Phase");
                    break;
                }
                return(true);
            }
            else if (menuItem == menuStrip.deleteObjectToolStripMenuItem)
            {
                Close();
                mainWindow.DeleteObject(functionObject, mainWindow.Document.FunctionList);
                return(true);
            }
            return(false);
        }
Exemplo n.º 11
0
        void IMenuStripManagerHandler.EnableMenuItems(MenuStripManager menuStrip)
        {
            textEditorWindowHelper.MenuActivateDelegate();
            textBoxWindowHelper.MenuActivateDelegate();

            menuStrip.evaluateToolStripMenuItem.Enabled = true;
            menuStrip.undoToolStripMenuItem.Enabled = undo.Count != 0;
            menuStrip.redoToolStripMenuItem.Enabled = redo.Count != 0;

            menuStrip.insertTableToolStripMenuItem.Visible = true;
            menuStrip.insertTableToolStripMenuItem.Enabled = true;
            menuStrip.deleteTableToolStripMenuItem.Visible = true;
            menuStrip.deleteTableToolStripMenuItem.Enabled = waveTableObject.NumTables != 0;

            menuStrip.deleteObjectToolStripMenuItem.Enabled = true;
            menuStrip.deleteObjectToolStripMenuItem.Text = "Delete Wave Table";
        }
Exemplo n.º 12
0
        bool IMenuStripManagerHandler.ExecuteMenuItem(MenuStripManager menuStrip, ToolStripMenuItem menuItem)
        {
            if (menuItem == menuStrip.closeDocumentToolStripMenuItem)
            {
                Close();
                return(true);
            }
            else if (menuItem == menuStrip.deleteObjectToolStripMenuItem)
            {
                Close();
                mainWindow.DeleteObject(trackObject, mainWindow.Document.TrackList);
                return(true);
            }
            else if (((IMenuStripManagerHandler)trackEditControl).ExecuteMenuItem(menuStrip, menuItem))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 13
0
 bool IMenuStripManagerHandler.ExecuteMenuItem(MenuStripManager menuStrip, ToolStripMenuItem menuItem)
 {
     if (menuItem == menuStrip.buildObjectToolStripMenuItem)
     {
         BuildThis(true /*force*/);
         return(true);
     }
     else if (menuItem == menuStrip.envelopeSegmentCalculatorToolStripMenuItem)
     {
         SegmentCalculatorDialog segmentCalculator = new SegmentCalculatorDialog(this);
         segmentCalculators.Add(segmentCalculator);
         segmentCalculator.Show();
         return(true);
     }
     else if (menuItem == menuStrip.deleteObjectToolStripMenuItem)
     {
         Close();
         mainWindow.DeleteObject(instrumentObject, mainWindow.Document.InstrumentList);
         return(true);
     }
     return(false);
 }
Exemplo n.º 14
0
 bool IMenuStripManagerHandler.ExecuteMenuItem(MenuStripManager menuStrip, ToolStripMenuItem menuItem)
 {
     if (menuItem == menuStrip.buildObjectToolStripMenuItem)
     {
         BuildThis(true /*force*/);
         return(true);
     }
     else if (menuItem == menuStrip.disassembleToolStripMenuItem)
     {
         DisassembleThis();
         return(true);
     }
     else if (menuItem == menuStrip.openAsWaveTableToolStripMenuItem)
     {
         if (BuildThis(false /*force*/))
         {
             float[] raw = algoWaveTableObject.WaveTableData.GetRawCopy();
             SampConv.QuantizeAndClampVector(raw, algoWaveTableObject.WaveTableData.NumBits); // ensure target bit depth is honored
             WaveTableObjectRec waveTableObject = new WaveTableObjectRec(
                 mainWindow.Document,
                 new WaveTableStorageRec(
                     algoWaveTableObject.WaveTableData.NumTables,
                     algoWaveTableObject.WaveTableData.NumFrames,
                     algoWaveTableObject.WaveTableData.NumBits,
                     raw));
             waveTableObject.Name = String.Format("Copy of {0}", algoWaveTableObject.Name);
             mainWindow.Document.WaveTableList.Add(waveTableObject);
             new WaveTableWindow(registration, waveTableObject, mainWindow).Show();
         }
         return(true);
     }
     else if (menuItem == menuStrip.deleteObjectToolStripMenuItem)
     {
         Close();
         mainWindow.DeleteObject(algoWaveTableObject, mainWindow.Document.AlgoWaveTableList);
         return(true);
     }
     return(false);
 }
Exemplo n.º 15
0
        bool IMenuStripManagerHandler.ExecuteMenuItem(MenuStripManager menuStrip, ToolStripMenuItem menuItem)
        {
            if (menuItem == menuStrip.editNotePropertiesToolStripMenuItem)
            {
                EditNoteProperties();
                return(true);
            }
            else if (menuItem == menuStrip.editTrackPropertiesToolStripMenuItem)
            {
                EditTrackProperties();
                return(true);
            }
            else if (menuItem == menuStrip.selectAllToolStripMenuItem)
            {
                trackViewControl.TrackViewSelectAll();
                return(true);
            }
            else if (menuItem == menuStrip.pasteToolStripMenuItem)
            {
                trackViewControl.TrackViewAttemptPaste();
                return(true);
            }
            else if (menuItem == menuStrip.clearToolStripMenuItem)
            {
                if (trackViewControl.TrackViewIsASingleNoteSelected() || trackViewControl.TrackViewIsASingleCommandSelected())
                {
                    trackViewControl.TrackViewDeleteSingleNoteOrCommand();
                }
                else if (trackViewControl.TrackViewIsARangeSelected())
                {
                    trackViewControl.TrackViewDeleteRangeSelection();
                }
                trackViewControl.TrackViewShowSelection();
                return(true);
            }
            else if (menuItem == menuStrip.cutToolStripMenuItem)
            {
                trackViewControl.TrackViewCutRangeSelection();
                trackViewControl.TrackViewShowSelection();
                return(true);
            }
            else if (menuItem == menuStrip.copyToolStripMenuItem)
            {
                trackViewControl.TrackViewCopyRangeSelection();
                return(true);
            }
            else if (menuItem == menuStrip.undoToolStripMenuItem)
            {
                trackViewControl.UndoHelper.Undo();
                return(true);
            }
            else if (menuItem == menuStrip.redoToolStripMenuItem)
            {
                trackViewControl.UndoHelper.Redo();
                return(true);
            }
            else if ((menuItem == menuStrip.playTrackFromHereToolStripMenuItem) ||
                     (menuItem == menuStrip.playTrackFromHereToDiskToolStripMenuItem))
            {
                IPlayPrefsProvider playPrefsProvider = mainWindow.GetPlayPrefsProvider();

                int StartIndex;
                if (trackViewControl.TrackViewIsARangeSelected())
                {
                    StartIndex = trackViewControl.TrackViewGetRangeStart();
                }
                else if (trackViewControl.TrackViewIsThereInsertionPoint())
                {
                    StartIndex = trackViewControl.TrackViewGetInsertionPointIndex();
                }
                else if (trackViewControl.TrackViewIsASingleNoteSelected() ||
                         trackViewControl.TrackViewIsASingleCommandSelected())
                {
                    StartIndex = trackViewControl.TrackViewGetSingleNoteSelectionFrameNumber();
                }
                else
                {
                    StartIndex = 0; /* default to the beginning for other selections */
                }

                List <TrackObjectRec> TrackList = new List <TrackObjectRec>();
                TrackList.Add(trackObject);

                if (menuItem == menuStrip.playTrackFromHereToolStripMenuItem)
                {
#if true // prevents "Add New Data Source..." from working
                    SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .Do(
                        mainWindow.DisplayName,
                        OutputDeviceEnumerator.OutputDeviceGetDestination,
                        OutputDeviceEnumerator.CreateOutputDeviceDestinationHandler,
                        new OutputDeviceArguments(playPrefsProvider.BufferDuration),
                        SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .SynthesizerMainLoop,
                        new SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments>(
                            mainWindow,
                            mainWindow.Document,
                            TrackList,
                            trackObject,
                            StartIndex,
                            playPrefsProvider.SamplingRate,
                            playPrefsProvider.EnvelopeUpdateRate,
                            playPrefsProvider.NumChannels,
                            (LargeBCDType)playPrefsProvider.DefaultBeatsPerMinute,
                            playPrefsProvider.OverallVolumeScalingFactor,
                            (LargeBCDType)playPrefsProvider.ScanningGap,
                            playPrefsProvider.OutputNumBits,
                            false /*clipWarning*/,
                            playPrefsProvider.Oversampling,
                            playPrefsProvider.ShowSummary,
                            playPrefsProvider.Deterministic,
                            playPrefsProvider.Seed,
                            null /*automationSettings*/),
                        SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .SynthesizerCompletion,
                        mainWindow,
                        playPrefsProvider.NumChannels,
                        playPrefsProvider.OutputNumBits,
                        playPrefsProvider.SamplingRate,
                        playPrefsProvider.Oversampling,
                        true /*showProgressWindow*/,
                        true /*modal*/);
#endif
                }
                else
                {
#if true // prevents "Add New Data Source..." from working
                    SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments> .Do(
                        mainWindow.DisplayName,
                        OutputSelectableFileDestinationHandler.OutputSelectableFileGetDestination,
                        OutputSelectableFileDestinationHandler.CreateOutputSelectableFileDestinationHandler,
                        new OutputSelectableFileArguments(),
                        SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments> .SynthesizerMainLoop,
                        new SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments>(
                            mainWindow,
                            mainWindow.Document,
                            TrackList,
                            trackObject,
                            StartIndex,
                            playPrefsProvider.SamplingRate,
                            playPrefsProvider.EnvelopeUpdateRate,
                            playPrefsProvider.NumChannels,
                            (LargeBCDType)playPrefsProvider.DefaultBeatsPerMinute,
                            playPrefsProvider.OverallVolumeScalingFactor,
                            (LargeBCDType)playPrefsProvider.ScanningGap,
                            playPrefsProvider.OutputNumBits,
                            false /*clipWarning*/,
                            playPrefsProvider.Oversampling,
                            playPrefsProvider.ShowSummary,
                            playPrefsProvider.Deterministic,
                            playPrefsProvider.Seed,
                            null /*automationSettings*/),
                        SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments> .SynthesizerCompletion,
                        mainWindow,
                        playPrefsProvider.NumChannels,
                        playPrefsProvider.OutputNumBits,
                        playPrefsProvider.SamplingRate,
                        playPrefsProvider.Oversampling,
                        true /*showProgressWindow*/,
                        true /*modal*/);
#endif
                }
                return(true);
            }
            else if ((menuItem == menuStrip.playAllFromHereToolStripMenuItem) ||
                     (menuItem == menuStrip.playAllFromHereToDiskToolStripMenuItem))
            {
                IPlayPrefsProvider playPrefsProvider = mainWindow.GetPlayPrefsProvider();

                int StartIndex;
                if (trackViewControl.TrackViewIsARangeSelected())
                {
                    StartIndex = trackViewControl.TrackViewGetRangeStart();
                }
                else if (trackViewControl.TrackViewIsThereInsertionPoint())
                {
                    StartIndex = trackViewControl.TrackViewGetInsertionPointIndex();
                }
                else if (trackViewControl.TrackViewIsASingleNoteSelected() ||
                         trackViewControl.TrackViewIsASingleCommandSelected())
                {
                    StartIndex = trackViewControl.TrackViewGetSingleNoteSelectionFrameNumber();
                }
                else
                {
                    StartIndex = 0; /* default to the beginning for other selections */
                }

                List <TrackObjectRec> TrackList = new List <TrackObjectRec>();
                TrackList.Add(trackObject); // we must include the current track
                foreach (TrackObjectRec track in playPrefsProvider.IncludedTracks)
                {
                    if (track != trackObject)
                    {
                        TrackList.Add(track);
                    }
                }

                if (menuItem == menuStrip.playAllFromHereToolStripMenuItem)
                {
#if true // prevents "Add New Data Source..." from working
                    SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .Do(
                        mainWindow.DisplayName,
                        OutputDeviceEnumerator.OutputDeviceGetDestination,
                        OutputDeviceEnumerator.CreateOutputDeviceDestinationHandler,
                        new OutputDeviceArguments(playPrefsProvider.BufferDuration),
                        SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .SynthesizerMainLoop,
                        new SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments>(
                            mainWindow,
                            mainWindow.Document,
                            TrackList,
                            trackObject,
                            StartIndex,
                            playPrefsProvider.SamplingRate,
                            playPrefsProvider.EnvelopeUpdateRate,
                            playPrefsProvider.NumChannels,
                            (LargeBCDType)playPrefsProvider.DefaultBeatsPerMinute,
                            playPrefsProvider.OverallVolumeScalingFactor,
                            (LargeBCDType)playPrefsProvider.ScanningGap,
                            playPrefsProvider.OutputNumBits,
                            false /*clipWarning*/,
                            playPrefsProvider.Oversampling,
                            playPrefsProvider.ShowSummary,
                            playPrefsProvider.Deterministic,
                            playPrefsProvider.Seed,
                            null /*automationSettings*/),
                        SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .SynthesizerCompletion,
                        mainWindow,
                        playPrefsProvider.NumChannels,
                        playPrefsProvider.OutputNumBits,
                        playPrefsProvider.SamplingRate,
                        playPrefsProvider.Oversampling,
                        true /*showProgressWindow*/,
                        true /*modal*/);
#endif
                }
                else
                {
#if true // prevents "Add New Data Source..." from working
                    SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments> .Do(
                        mainWindow.DisplayName,
                        OutputSelectableFileDestinationHandler.OutputSelectableFileGetDestination,
                        OutputSelectableFileDestinationHandler.CreateOutputSelectableFileDestinationHandler,
                        new OutputSelectableFileArguments(),
                        SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments> .SynthesizerMainLoop,
                        new SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments>(
                            mainWindow,
                            mainWindow.Document,
                            TrackList,
                            trackObject,
                            StartIndex,
                            playPrefsProvider.SamplingRate,
                            playPrefsProvider.EnvelopeUpdateRate,
                            playPrefsProvider.NumChannels,
                            (LargeBCDType)playPrefsProvider.DefaultBeatsPerMinute,
                            playPrefsProvider.OverallVolumeScalingFactor,
                            (LargeBCDType)playPrefsProvider.ScanningGap,
                            playPrefsProvider.OutputNumBits,
                            false /*clipWarning*/,
                            playPrefsProvider.Oversampling,
                            playPrefsProvider.ShowSummary,
                            playPrefsProvider.Deterministic,
                            playPrefsProvider.Seed,
                            null /*automationSettings*/),
                        SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments> .SynthesizerCompletion,
                        mainWindow,
                        playPrefsProvider.NumChannels,
                        playPrefsProvider.OutputNumBits,
                        playPrefsProvider.SamplingRate,
                        playPrefsProvider.Oversampling,
                        true /*showProgressWindow*/,
                        true /*modal*/);
#endif
                }
                return(true);
            }
            else if (menuItem == menuStrip.showSelectionToolStripMenuItem)
            {
                trackViewControl.TrackViewShowSelection();
                return(true);
            }
            else if (menuItem == menuStrip.transposeToolStripMenuItem)
            {
                double Transpose = 0;
                CmdDlgOneParam.CommandDialogOneParam("Transpose half-steps:", null, ref Transpose);
                if (Transpose != 0)
                {
                    trackViewControl.TrackViewTransposeSelection((int)Transpose);
                }
                return(true);
            }
            else if (menuItem == menuStrip.goToLineToolStripMenuItem)
            {
                double NewMeasure = 0;
                CmdDlgOneParam.CommandDialogOneParam("Go To Measure:", null, ref NewMeasure);
                if (NewMeasure != 0)
                {
                    trackViewControl.TrackViewShowMeasure((int)NewMeasure);
                }
                return(true);
            }
            else if (menuItem == menuStrip.doubleDurationToolStripMenuItem)
            {
                trackViewControl.TrackViewAdjustDuration(2, 1);
                return(true);
            }
            else if (menuItem == menuStrip.halveDurationToolStripMenuItem)
            {
                trackViewControl.TrackViewAdjustDuration(1, 2);
                return(true);
            }

            return(false);
        }
Exemplo n.º 16
0
        void IMenuStripManagerHandler.EnableMenuItems(MenuStripManager menuStrip)
        {
            menuStrip.editNotePropertiesToolStripMenuItem.Visible = true;
            if (trackViewControl.TrackViewIsASingleNoteSelected() ||
                trackViewControl.TrackViewIsASingleCommandSelected())
            {
                menuStrip.editNotePropertiesToolStripMenuItem.Enabled = true;
                menuStrip.editNotePropertiesToolStripMenuItem.Text    = trackViewControl.TrackViewIsASingleNoteSelected()
                    ? "Edit Note Attributes..."
                    : "Edit Command Attributes...";
            }

            menuStrip.editTrackPropertiesToolStripMenuItem.Visible = true;
            menuStrip.editTrackPropertiesToolStripMenuItem.Enabled = true;

            menuStrip.showSelectionToolStripMenuItem.Enabled = true;

            menuStrip.selectAllToolStripMenuItem.Enabled = true;

            if (trackViewControl.TrackViewIsThereInsertionPoint() || trackViewControl.TrackViewIsARangeSelected())
            {
                bool        enablePaste = false;
                IDataObject dataObject  = Clipboard.GetDataObject();
                foreach (string format in dataObject.GetFormats())
                {
                    if (String.Equals(format, TrackClipboard.ClipboardIdentifer))
                    {
                        enablePaste = true;
                        break;
                    }
                }
                if (enablePaste)
                {
                    menuStrip.pasteToolStripMenuItem.Enabled = true;
                }
            }
            if (trackViewControl.TrackViewIsASingleNoteSelected() || trackViewControl.TrackViewIsASingleCommandSelected())
            {
                menuStrip.clearToolStripMenuItem.Enabled = true;
                menuStrip.clearToolStripMenuItem.Text    = "Delete Note";
            }

            if (trackViewControl.TrackViewIsARangeSelected())
            {
                menuStrip.clearToolStripMenuItem.Enabled = true;
                menuStrip.clearToolStripMenuItem.Text    = "Delete Selection";
                menuStrip.cutToolStripMenuItem.Enabled   = true;
                menuStrip.cutToolStripMenuItem.Text      = "Cut Selection";
                menuStrip.copyToolStripMenuItem.Enabled  = true;
                menuStrip.copyToolStripMenuItem.Text     = "Copy Selection";
            }
            if (trackViewControl.UndoHelper.UndoAvailable)
            {
                menuStrip.undoToolStripMenuItem.Enabled = true;
                string undoLabel = trackViewControl.UndoHelper.UndoLabel;
                menuStrip.undoToolStripMenuItem.Text = String.Format("Undo {0}", undoLabel != null ? undoLabel : "Track Edit");
            }
            if (trackViewControl.UndoHelper.RedoAvailable)
            {
                menuStrip.redoToolStripMenuItem.Enabled = true;
                string redoLabel = trackViewControl.UndoHelper.RedoLabel;
                menuStrip.redoToolStripMenuItem.Text = String.Format("Redo {0}", redoLabel != null ? redoLabel : "Track Edit");
            }

            if (trackViewControl.TrackViewIsARangeSelected() || trackViewControl.TrackViewIsASingleNoteSelected())
            {
                menuStrip.transposeToolStripMenuItem.Enabled = true;
            }

            menuStrip.playTrackFromHereToolStripMenuItem.Enabled       = true;
            menuStrip.playTrackFromHereToolStripMenuItem.Visible       = true;
            menuStrip.playAllFromHereToolStripMenuItem.Enabled         = true;
            menuStrip.playAllFromHereToolStripMenuItem.Visible         = true;
            menuStrip.playTrackFromHereToDiskToolStripMenuItem.Enabled = true;
            menuStrip.playTrackFromHereToDiskToolStripMenuItem.Visible = true;
            menuStrip.playAllFromHereToDiskToolStripMenuItem.Enabled   = true;
            menuStrip.playAllFromHereToDiskToolStripMenuItem.Visible   = true;

            menuStrip.goToLineToolStripMenuItem.Enabled = true;
            menuStrip.goToLineToolStripMenuItem.Text    = "Go To Measure...";

            if (trackViewControl.TrackViewIsARangeSelected() || trackViewControl.TrackViewIsASingleNoteSelected())
            {
                menuStrip.doubleDurationToolStripMenuItem.Enabled = true;
                menuStrip.halveDurationToolStripMenuItem.Enabled  = true;
            }

            foreach (KeyValuePair <InlineParamVis, ToolStripMenuItem> inlineOption in GetInlineOptions())
            {
                inlineOption.Value.Enabled = true;
                inlineOption.Value.Checked = (trackObject.InlineParamVis & inlineOption.Key) != 0;
            }

            PrepareMenuItemsBackground();
        }
Exemplo n.º 17
0
        //

        void IMenuStripManagerHandler.EnableMenuItems(MenuStripManager menuStrip)
        {
            textEditorWindowHelper.MenuActivateDelegate();
        }
Exemplo n.º 18
0
 bool IMenuStripManagerHandler.ExecuteMenuItem(MenuStripManager menuStrip, ToolStripMenuItem menuItem)
 {
     return(false);
 }
Exemplo n.º 19
0
        public void Init(
            TrackObjectRec trackObject,
            IMainWindowServices mainWindow,
            MenuStripManager menuStripManager,
            ToolStripMenuItem backgroundToolStripMenuItem,
            ToolStripMenuItem inlineEditToolStripMenuItem)
        {
            this.trackObject                 = trackObject;
            this.mainWindow                  = mainWindow;
            this.menuStripManager            = menuStripManager;
            this.backgroundToolStripMenuItem = backgroundToolStripMenuItem;
            this.inlineEditToolStripMenuItem = inlineEditToolStripMenuItem;

            noteViewControl.UndoHelper = trackViewControl.UndoHelper;
            noteParamStrip.UndoHelper  = trackViewControl.UndoHelper;

            trackViewControl.NoteView       = noteViewControl;
            trackViewControl.NoteParamStrip = noteParamStrip;
            trackViewControl.ContextUI      = this;

            //documentBindingSource.Add(document);
            trackObjectRecBindingSource.Add(trackObject);

            trackViewControl.SetTrackObject(trackObject);
            trackViewControl.RestoreSavedScrollPosition(trackObject.SavedHScrollPos, trackObject.SavedVScrollPos);
            trackViewControl.Scroll += new ScrollEventHandler(trackViewControl_Scroll);

            ToolStripButton[] group;
            //
            group = new ToolStripButton[] { toolStripButtonArrow, toolStripButtonCommand, toolStripButtonSixtyFourth, toolStripButtonThirtySecond, toolStripButtonSixteenth, toolStripButtonEighth, toolStripButtonQuarter, toolStripButtonHalf, toolStripButtonWhole, toolStripButtonDouble, toolStripButtonQuad };
            SetButton(toolStripButtonArrow, Bitmaps1Class.gdiArrowButtonBits, Bitmaps1Class.gdiArrowButtonSelectedBits, group, new ToolStripButton[] { toolStripButtonQuarter, toolStripButtonDiv1, toolStripButtonNatural, toolStripButtonNoDot, toolStripButtonNoteVsRest });
            toolStripButtonArrow.Checked = true;
            //
            SetButton(toolStripButtonCommand, Bitmaps1Class.gdiCommandButtonBits, Bitmaps1Class.gdiCommandButtonSelectedBits, group, null);
            //
            SetButton(toolStripButtonSixtyFourth, Bitmaps1Class.gdiSixtyFourthButtonBits, Bitmaps1Class.gdiSixtyFourthButtonSelectedBits, group, null);
            SetButton(toolStripButtonThirtySecond, Bitmaps1Class.gdiThirtySecondButtonBits, Bitmaps1Class.gdiThirtySecondButtonSelectedBits, group, null);
            SetButton(toolStripButtonSixteenth, Bitmaps1Class.gdiSixteenthButtonBits, Bitmaps1Class.gdiSixteenthButtonSelectedBits, group, null);
            SetButton(toolStripButtonEighth, Bitmaps1Class.gdiEighthButtonBits, Bitmaps1Class.gdiEighthButtonSelectedBits, group, null);
            SetButton(toolStripButtonQuarter, Bitmaps1Class.gdiQuarterButtonBits, Bitmaps1Class.gdiQuarterButtonSelectedBits, group, null);
            SetButton(toolStripButtonHalf, Bitmaps1Class.gdiHalfButtonBits, Bitmaps1Class.gdiHalfButtonSelectedBits, group, null);
            SetButton(toolStripButtonWhole, Bitmaps1Class.gdiWholeButtonBits, Bitmaps1Class.gdiWholeButtonSelectedBits, group, null);
            SetButton(toolStripButtonDouble, Bitmaps1Class.gdiDoubleButtonBits, Bitmaps1Class.gdiDoubleButtonSelectedBits, group, null);
            SetButton(toolStripButtonQuad, Bitmaps1Class.gdiQuadButtonBits, Bitmaps1Class.gdiQuadButtonSelectedBits, group, null);
            //
            group = new ToolStripButton[] { toolStripButtonSharp, toolStripButtonFlat, toolStripButtonNatural };
            SetButton(toolStripButtonSharp, Bitmaps1Class.gdiSharpButtonBits, Bitmaps1Class.gdiSharpButtonSelectedBits, group, null);
            SetButton(toolStripButtonFlat, Bitmaps1Class.gdiFlatButtonBits, Bitmaps1Class.gdiFlatButtonSelectedBits, group, null);
            SetButton(toolStripButtonNatural, Bitmaps1Class.gdiNaturalButtonBits, Bitmaps1Class.gdiNaturalButtonSelectedBits, group, null);
            toolStripButtonNatural.Checked = true;
            //
            group = new ToolStripButton[] { toolStripButtonNoteVsRest, toolStripButtonNoteVsRest2 };
            SetButton(toolStripButtonNoteVsRest, Bitmaps1Class.gdiNoteVsRestButtonBits, Bitmaps1Class.gdiNoteVsRestButtonSelectedBits, group, null);
            SetButton(toolStripButtonNoteVsRest2, Bitmaps1Class.gdiRestVsNoteButtonBits, Bitmaps1Class.gdiRestVsNoteButtonSelectedBits, group, null);
            toolStripButtonNoteVsRest.Checked = true;
            //
            group = new ToolStripButton[] { toolStripButtonNoDot, toolStripButtonYesDot };
            SetButton(toolStripButtonNoDot, Bitmaps1Class.gdiNoDotButtonBits, Bitmaps1Class.gdiNoDotButtonSelectedBits, group, null);
            SetButton(toolStripButtonYesDot, Bitmaps1Class.gdiYesDotButtonBits, Bitmaps1Class.gdiYesDotButtonSelectedBits, group, null);
            toolStripButtonNoDot.Checked = true;
            //
            group = new ToolStripButton[] { toolStripButtonDiv1, toolStripButtonDiv3, toolStripButtonDiv5, toolStripButtonDiv7 };
            SetButton(toolStripButtonDiv1, Bitmaps1Class.gdiDiv1ButtonBits, Bitmaps1Class.gdiDiv1ButtonSelectedBits, group, null);
            SetButton(toolStripButtonDiv3, Bitmaps1Class.gdiDiv3ButtonBits, Bitmaps1Class.gdiDiv3ButtonSelectedBits, group, null);
            SetButton(toolStripButtonDiv5, Bitmaps1Class.gdiDiv5ButtonBits, Bitmaps1Class.gdiDiv5ButtonSelectedBits, group, null);
            SetButton(toolStripButtonDiv7, Bitmaps1Class.gdiDiv7ButtonBits, Bitmaps1Class.gdiDiv7ButtonSelectedBits, group, null);
            toolStripButtonDiv1.Checked = true;

            PrepareInlineEditingMenu();

            trackViewControl.Focus();
        }