public FunctionWindow(Registration registration, FunctionObjectRec functionObject, Document document, IMainWindowServices mainWindow) { this.registration = registration; this.functionObject = functionObject; this.document = document; this.mainWindow = mainWindow; InitializeComponent(); this.Icon = OutOfPhase.Properties.Resources.Icon2; this.textBoxFunctionBody.TextService = Program.Config.EnableDirectWrite ? TextEditor.TextService.DirectWrite : TextEditor.TextService.Uniscribe; this.textBoxFunctionBody.AutoIndent = Program.Config.AutoIndent; DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom); menuStripManager.SetGlobalHandler(mainWindow); menuStripManager.HookUpTextEditorWindowHelper(this.textEditorWindowHelper); menuStripManager.HookUpTextBoxWindowHelper(this.textBoxWindowHelper); documentBindingSource.Add(mainWindow.Document); functionObjectRecBindingSource.Add(functionObject); textBoxFunctionName.TextChanged += new EventHandler(textBoxFunctionName_TextChanged); GlobalNameChanged(); registration.Register(functionObject, this); }
public DisassemblyWindow(string text, IMainWindowServices mainWindow, string functionModuleName) { this.mainWindow = mainWindow; this.functionModuleName = functionModuleName; InitializeComponent(); this.Icon = OutOfPhase.Properties.Resources.Icon2; menuStripManager.SetGlobalHandler(mainWindow); menuStripManager.HookUpTextEditorWindowHelper(this.textEditorWindowHelper); mainWindow.AddMiscForm(this); textBoxDisassembly.TextService = Program.Config.EnableDirectWrite ? TextEditor.TextService.DirectWrite : TextEditor.TextService.Uniscribe; textBoxDisassembly.Text = text; textBoxDisassembly.SetInsertionPoint(0, 0); DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom, delegate() { return(new Control[] { textBoxDisassembly }); }); // By default make disassembly window tkae up most of the vertical screen height. const int Margin = 20; Size = new Size(Size.Width, Screen.PrimaryScreen.WorkingArea.Height - Margin); GlobalNameChanged(); }
public SectionEditDialog(Registration registration, Document document, IMainWindowServices mainWindow) { this.registration = registration; this.document = document; this.mainWindow = mainWindow; InitializeComponent(); this.Icon = OutOfPhase.Properties.Resources.Icon2; DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom); myListBoxSections.SetUnderlying(displayList, DisplayNameOfListEntry); myListBoxSections.SelectionChanged += new EventHandler(delegate(object sender, EventArgs e) { OnSelectionChanged(); }); myListBoxSections.DoubleClick2 += new MyListBox.DoubleClick2EventHandler(myListBoxSections_DoubleClick2); document.SectionList.ListChanged += SectionList_ListChanged; document.TrackList.ListChanged += TrackList_ListChanged; RebuildScrollingList(); OnSelectionChanged(); Disposed += SectionEditDialog_Disposed; registration.Register(document.SectionList, this); }
public static OutputGeneric<T, WaveTableTestGeneratorParams<T, W>, W> Do( string baseName, GetDestinationMethod<T> getDestination, CreateDestinationHandlerMethod<T, W> createDestinationHandler, W destinationHandlerArguments, GeneratorMainLoopMethod<T, WaveTableTestGeneratorParams<T, W>, W> generatorMainLoop, WaveTableTestGeneratorParams<T, W> generatorParams, GeneratorCompletionMethod<WaveTableTestGeneratorParams<T, W>> generatorCompletion, IMainWindowServices mainWindow, NumChannelsType channels, NumBitsType bits, int samplingRate, int oversamplingFactor, bool showProgressWindow, bool modal) { // prerequisites return OutputGeneric<T, WaveTableTestGeneratorParams<T, W>, W>.Do( baseName, getDestination, createDestinationHandler, destinationHandlerArguments, generatorMainLoop, generatorParams, generatorCompletion, channels, bits, samplingRate, oversamplingFactor, showProgressWindow, modal); }
public AlgoWaveTableWindow(Registration registration, AlgoWaveTableObjectRec algoWaveTableObject, IMainWindowServices mainWindow) { this.registration = registration; this.algoWaveTableObject = algoWaveTableObject; this.mainWindow = mainWindow; InitializeComponent(); this.Icon = OutOfPhase.Properties.Resources.Icon2; this.textBoxFunction.TextService = Program.Config.EnableDirectWrite ? TextEditor.TextService.DirectWrite : TextEditor.TextService.Uniscribe; this.textBoxFunction.AutoIndent = Program.Config.AutoIndent; DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom); menuStripManager.SetGlobalHandler(mainWindow); menuStripManager.HookUpTextEditorWindowHelper(this.textEditorWindowHelper); menuStripManager.HookUpTextBoxWindowHelper(this.textBoxWindowHelper); foreach (int i in AlgoWaveTableObjectRec.NumFramesAllowedValues) { comboBoxNumFrames.Items.Add(i.ToString()); } documentBindingSource.Add(mainWindow.Document); algoWaveTableObjectRecBindingSource.Add(algoWaveTableObject); textBoxName.TextChanged += new EventHandler(textBoxName_TextChanged); GlobalNameChanged(); registration.Register(algoWaveTableObject, this); }
public TrackWindow(Registration registration, TrackObjectRec trackObject, IMainWindowServices mainWindow) { this.registration = registration; this.trackObject = trackObject; this.mainWindow = mainWindow; InitializeComponent(); this.Icon = OutOfPhase.Properties.Resources.Icon2; // By default make new tracks take up most of the horizontal screen width. SetDesktopBounds(DesktopBounds.X, DesktopBounds.Y, Screen.PrimaryScreen.Bounds.Width - DesktopBounds.X - 100, DesktopBounds.Height); menuStripManager.SetGlobalHandler(mainWindow); GlobalNameChanged(); registration.Register(trackObject, this); backgroundToolStripMenuItem = new ToolStripMenuItem("Background", null, new EventHandler(backgroundMenuItem_Click)); menuStripManager.ContainedMenuStrip.Items.Add(backgroundToolStripMenuItem); inlineEditToolStripMenuItem = new ToolStripMenuItem("Inline", null, new EventHandler(inlineEditMenuItem_Click)); menuStripManager.ContainedMenuStrip.Items.Add(inlineEditToolStripMenuItem); trackEditControl.Init(trackObject, mainWindow, menuStripManager, backgroundToolStripMenuItem, inlineEditToolStripMenuItem); trackObject.PropertyChanged += TrackObject_PropertyChanged; // Change font if preferences have scale factor. Use 'force' to ensure note view and parma strip always compute the // correct height even if font hasn't changed to prevent layout glitch. DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom, true /*force*/); }
private bool suppressTableOrFrameChange = true; // suppress until after form is loaded - since init fires notifications public WaveTableWindow(Registration registration, WaveTableObjectRec waveTableObject, IMainWindowServices mainWindow) { this.registration = registration; this.waveTableObject = waveTableObject; this.mainWindow = mainWindow; InitializeComponent(); this.Icon = OutOfPhase.Properties.Resources.Icon2; this.textBoxFormula.TextService = Program.Config.EnableDirectWrite ? TextEditor.TextService.DirectWrite : TextEditor.TextService.Uniscribe; this.textBoxFormula.AutoIndent = Program.Config.AutoIndent; DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom); menuStripManager.SetGlobalHandler(mainWindow); menuStripManager.HookUpTextEditorWindowHelper(this.textEditorWindowHelper); menuStripManager.HookUpTextBoxWindowHelper(this.textBoxWindowHelper); waveTableControl.WaveTableObject = waveTableObject; hScrollBarWaveTable.Scroll += new ScrollEventHandler(waveTableControl.OnIndexChanged); foreach (int i in WaveTableObjectRec.NumFramesAllowedValues) { comboBoxNumFrames.Items.Add(i.ToString()); } foreach (string item in EnumUtility.GetDescriptions(WaveTableObjectRec.NumBitsAllowedValues)) { comboBoxNumBits.Items.Add(item); } documentBindingSource.Add(mainWindow.Document); waveTableObjectRecBindingSource.Add(waveTableObject); waveTableObject.PropertyChanged += WaveTableObject_PropertyChanged; textBoxName.TextChanged += new EventHandler(textBoxName_TextChanged); GlobalNameChanged(); buttonTest.MouseDown += new MouseEventHandler(buttonTest_MouseDown); buttonTest.MouseUp += new MouseEventHandler(buttonTest_MouseUp); textBoxNumTables.Validated += new EventHandler(textBoxNumTables_TextChanged); comboBoxNumFrames.TextChanged += new EventHandler(comboBoxNumFrames_TextChanged); comboBoxNumBits.TextChanged += new EventHandler(ComboBoxNumBits_TextChanged); tabControlWave.SelectedIndexChanged += TabControlWave_SelectedIndexChanged; // dataGridViewWave.CellValueNeeded += DataGridViewWave_CellValueNeeded; dataGridViewWave.CellValuePushed += DataGridViewWave_CellValuePushed; RebuildDataGrid(); // labelScale.Visible = false; comboBoxScale.Visible = false; comboBoxScale.SelectedIndex = 0; registration.Register(waveTableObject, this); }
public PlayFileWithEffectsGeneratorParams( Stream stream, AudioFileReader reader, Synthesizer.EffectSpecListRec effectSpec, IMainWindowServices mainWindow) { this.stream = stream; this.reader = reader; this.effectSpec = effectSpec; this.mainWindow = mainWindow; }
public PlayAudioFileWithEffects(IMainWindowServices mainWindow) { this.mainWindow = mainWindow; InitializeComponent(); this.Icon = OutOfPhase.Properties.Resources.Icon2; this.textBoxEffectBody.TextService = Program.Config.EnableDirectWrite ? TextEditor.TextService.DirectWrite : TextEditor.TextService.Uniscribe; this.textBoxEffectBody.AutoIndent = Program.Config.AutoIndent; DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom); textBoxAudioFilePath.Text = filePath; textBoxEffectBody.TabSize = Program.Config.TabSize; textBoxEffectBody.Text = effectBody; }
public void Play(string path, IMainWindowServices mainWindow) { Stream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, Constants.BufferSize); AudioFileReader reader = null; try { reader = new WAVReader(stream); } catch (FormatException) { try { stream.Seek(0, SeekOrigin.Begin); reader = new AIFFReader(stream); } catch (FormatException) { MessageBox.Show("File is not a recognized AIFF or WAV file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } const double BufferDuration = 2; #if true // prevents "Add New Data Source..." from working state = AudioFilePlayGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .Do( mainWindow.DisplayName, OutputDeviceEnumerator.OutputDeviceGetDestination, OutputDeviceEnumerator.CreateOutputDeviceDestinationHandler, new OutputDeviceArguments(BufferDuration), AudioFilePlayGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .MainLoop, generatorParams = new AudioFilePlayGeneratorParams <OutputDeviceDestination, OutputDeviceArguments>( reader), AudioFilePlayGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .Completion, mainWindow, reader.NumChannels, reader.NumBits, reader.SamplingRate, 1 /*oversampling*/, true /*showProgressWindow*/, true /*modal*/); #endif }
public static OutputGeneric <T, SynthesizerGeneratorParams <T, W>, W> Do( string baseName, GetDestinationMethod <T> getDestination, CreateDestinationHandlerMethod <T, W> createDestinationHandler, W destinationHandlerArguments, GeneratorMainLoopMethod <T, SynthesizerGeneratorParams <T, W>, W> generatorMainLoop, SynthesizerGeneratorParams <T, W> generatorParams, GeneratorCompletionMethod <SynthesizerGeneratorParams <T, W> > generatorCompletion, IMainWindowServices mainWindow, NumChannelsType channels, NumBitsType bits, int samplingRate, int oversamplingFactor, bool showProgressWindow, bool modal) { // prerequisites /* force an auto-save since play may take a long time */ MainWindow.DoAutosaveGlobally(); /* make sure all objects are up to date */ if (!mainWindow.MakeUpToDate()) { /* couldn't compile score elements */ return(null); } return(OutputGeneric <T, SynthesizerGeneratorParams <T, W>, W> .Do( baseName, getDestination, createDestinationHandler, destinationHandlerArguments, generatorMainLoop, generatorParams, generatorCompletion, channels, bits, samplingRate, oversamplingFactor, showProgressWindow, modal)); }
public static bool ImportRawSample( Registration registration, IMainWindowServices mainWindow, out int index) { index = -1; string path; using (OpenFileDialog dialog = new OpenFileDialog()) { if (dialog.ShowDialog() != DialogResult.OK) { return(false); } path = dialog.FileName; } SessionSettings.Name = Path.GetFileName(path); using (ImportRawSampleDialog dialog = new ImportRawSampleDialog(SessionSettings, path)) { if (dialog.ShowDialog() == DialogResult.OK) { SampleObjectRec ReturnedSampleObject; ImportRawSample( mainWindow.Document, path, null /*truncate*/, SessionSettings, out ReturnedSampleObject); index = mainWindow.Document.SampleList.Count; mainWindow.Document.SampleList.Add(ReturnedSampleObject); new SampleWindow(registration, ReturnedSampleObject, mainWindow).Show(); return(true); } } return(false); }
public PlayPrefsDialog(Registration registration, object identity, IMainWindowServices mainWindow, Document document) { this.registration = registration; this.identity = identity; this.mainWindow = mainWindow; this.document = document; InitializeComponent(); this.Icon = OutOfPhase.Properties.Resources.Icon2; DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom); foreach (string item in EnumUtility.GetDescriptions(Source.OutputNumBitsAllowedValues)) { comboBoxBitDepth.Items.Add(item); } foreach (string item in EnumUtility.GetDescriptions(Source.NumChannelsAllowedValues)) { comboBoxNumChannels.Items.Add(item); } source = new Source(document); sourceBindingSource.Add(source); listBoxIncludedTracks.SetUnderlying(source.IncludedTracks, delegate(object obj) { return(((Source.TrackInclusionRec)obj).Name); }); for (int i = 0; i < source.IncludedTracks.Count; i++) { if (source.IncludedTracks[i].Included) { listBoxIncludedTracks.SelectItem(i, false /*clear other selections*/); } } listBoxIncludedTracks.SelectionChanged += new EventHandler(delegate(object sender, EventArgs e) { PropagateTrackInclusion(); }); source.OnIncludedTracksAdded += Source_OnIncludedTracksAdded; checkBoxDeterministic.CheckedChanged += new EventHandler(delegate(object sender, EventArgs e) { textBoxSeed.Enabled = checkBoxDeterministic.Checked; }); this.Text = String.Format("{0} - {1}", mainWindow.DisplayName, "Play"); registration.Register(identity, this); }
public CalculatorWindow(Document document, IMainWindowServices mainWindow) { this.document = document; this.mainWindow = mainWindow; InitializeComponent(); this.Icon = OutOfPhase.Properties.Resources.Icon2; this.textBox.TextService = Program.Config.EnableDirectWrite ? TextEditor.TextService.DirectWrite : TextEditor.TextService.Uniscribe; this.textBox.AutoIndent = Program.Config.AutoIndent; DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom); menuStripManager.SetGlobalHandler(mainWindow); menuStripManager.HookUpTextEditorWindowHelper(this.textEditorWindowHelper); documentBindingSource.Add(mainWindow.Document); mainWindow.AddMiscForm(this); GlobalNameChanged(); }
public SynthesizerGeneratorParams( IMainWindowServices mainWindow, Document document, List <TrackObjectRec> listOfTracks, TrackObjectRec keyTrack, int frameToStartAt, int samplingRate, int envelopeRate, NumChannelsType channels, LargeBCDType defaultBeatsPerMinute, double overallVolumeScalingReciprocal, LargeBCDType scanningGap, NumBitsType bits, bool clipWarn, int oversamplingFactor, bool showSummary, bool deterministic,// now ignored - control by setting randomSeed to null or int int?randomSeed, Synthesizer.AutomationSettings automationSettings) { this.mainWindow = mainWindow; this.document = document; this.listOfTracks = listOfTracks; this.keyTrack = keyTrack; this.frameToStartAt = frameToStartAt; this.samplingRate = samplingRate; this.envelopeRate = envelopeRate; this.channels = channels; this.defaultBeatsPerMinute = defaultBeatsPerMinute; this.overallVolumeScalingReciprocal = overallVolumeScalingReciprocal; this.scanningGap = scanningGap; this.bits = bits; this.clipWarn = clipWarn; this.oversamplingFactor = oversamplingFactor; this.showSummary = showSummary; this.deterministic = deterministic; this.randomSeed = randomSeed; this.automationSettings = automationSettings; }
public AlgoSampWindow(Registration registration, AlgoSampObjectRec algoSampObject, IMainWindowServices mainWindow) { this.registration = registration; this.algoSampObject = algoSampObject; this.mainWindow = mainWindow; InitializeComponent(); this.Icon = OutOfPhase.Properties.Resources.Icon2; this.textBoxFormula.TextService = Program.Config.EnableDirectWrite ? TextEditor.TextService.DirectWrite : TextEditor.TextService.Uniscribe; this.textBoxFormula.AutoIndent = Program.Config.AutoIndent; DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom); menuStripManager.SetGlobalHandler(mainWindow); menuStripManager.HookUpTextEditorWindowHelper(this.textEditorWindowHelper); menuStripManager.HookUpTextBoxWindowHelper(this.textBoxWindowHelper); foreach (string item in EnumUtility.GetDescriptions(AlgoSampObjectRec.NumChannelsAllowedValues)) { comboBoxChannels.Items.Add(item); } foreach (string item in EnumUtility.GetDescriptions(AlgoSampObjectRec.LoopBidirectionalAllowedValues)) { comboBoxLoop1Bidirectional.Items.Add(item); comboBoxLoop2Bidirectional.Items.Add(item); comboBoxLoop3Bidirectional.Items.Add(item); } documentBindingSource.Add(mainWindow.Document); algoSampObjectRecBindingSource.Add(algoSampObject); textBoxName.TextChanged += new EventHandler(textBoxName_TextChanged); GlobalNameChanged(); registration.Register(algoSampObject, this); }
public InteractionWindow(IMainWindowServices mainWindow) { this.mainWindow = mainWindow; InitializeComponent(); this.Icon = OutOfPhase.Properties.Resources.Icon2; this.textBox.TextService = Program.Config.EnableDirectWrite ? TextEditor.TextService.DirectWrite : TextEditor.TextService.Uniscribe; DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom, delegate() { return(new Control[] { textBox }); }); // Place interaction window across bottom of screen. const int Margin = 50; int width = Screen.PrimaryScreen.Bounds.Width - 2 * Margin; Size = new Size(width, Height); Location = new Point(Margin, Screen.PrimaryScreen.Bounds.Height - Height - Margin); menuStripManager.SetGlobalHandler(mainWindow); menuStripManager.HookUpTextEditorWindowHelper(this.textEditorWindowHelper); GlobalNameChanged(); }
public ScoreEffectWindow(Registration registration, ScoreEffectsRec scoreEffectsObject, IMainWindowServices mainWindow) { this.registration = registration; this.scoreEffectsObject = scoreEffectsObject; this.mainWindow = mainWindow; InitializeComponent(); this.Icon = OutOfPhase.Properties.Resources.Icon2; this.textBoxScoreEffectsText.TextService = Program.Config.EnableDirectWrite ? TextEditor.TextService.DirectWrite : TextEditor.TextService.Uniscribe; this.textBoxScoreEffectsText.AutoIndent = Program.Config.AutoIndent; DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom); menuStripManager.SetGlobalHandler(mainWindow); menuStripManager.HookUpTextEditorWindowHelper(this.textEditorWindowHelper); documentBindingSource.Add(mainWindow.Document); scoreEffectsRecBindingSource.Add(scoreEffectsObject); GlobalNameChanged(); registration.Register(scoreEffectsObject, this); }
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(); }
public PcodeExterns(IMainWindowServices mainWindow) { this.mainWindow = mainWindow; }
/* this routine asks for a file and tries to import the contents of that */ /* file as an AIFF sample. it reports any errors to the user. */ public static bool ImportAIFFSample( Registration registration, IMainWindowServices mainWindow, out int index) { index = -1; string path; using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.Title = "Import AIFF Sample"; dialog.Filter = "AIFF Audio File (.aif, .aiff)|*.aif;*.aiff|Any File Type (*)|*"; DialogResult result = dialog.ShowDialog(); if (result != DialogResult.OK) { return(false); } path = dialog.FileName; } using (Stream input = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, Constants.BufferSize)) { try { using (AudioFileReader reader = new AIFFReader(input, true /*allowTruncated*/)) { NumBitsType numBits = reader.NumBits; NumChannelsType numChannels = reader.NumChannels; int numFrames = reader.NumFrames; int samplingRate = reader.SamplingRate; float[] sampleData; try { sampleData = new float[(numFrames + 1) * reader.PointsPerFrame]; } catch (OutOfMemoryException) { throw new AudioFileReaderException(AudioFileReaderErrors.OutOfMemory); } reader.ReadPoints(sampleData, 0, numFrames * reader.PointsPerFrame); if (reader.Truncated) { const string ErrorTooShort = "The file appears to be incomplete. Appending silence to end of sample data."; MessageBox.Show(ErrorTooShort, "Import Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } SampleObjectRec ReturnedSampleObject = new SampleObjectRec( mainWindow.Document, sampleData, numFrames, numBits, numChannels, 0, 0, 0, 0, 0, 0, 0, samplingRate, Constants.MIDDLEC); ReturnedSampleObject.Name = Path.GetFileName(path); index = mainWindow.Document.SampleList.Count; mainWindow.Document.SampleList.Add(ReturnedSampleObject); new SampleWindow(registration, ReturnedSampleObject, mainWindow).Show(); return(true); } } catch (AudioFileReaderException exception) { MessageBox.Show(AudioFileReaderException.MessageFromError(exception.Error), "Import Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } return(false); }
public FindInFilesApplication(IMainWindowServices mainWindow) { this.mainWindow = mainWindow; }