private void WavMp3_PropertyClicked(PropertyPage props, ClickType click, int propIdx, int rowIdx, int colIdx) { if (propIdx == 9 && click == ClickType.Right && colIdx == 2) { props.UpdateMultiColumnList(propIdx, rowIdx, colIdx, 50); } }
private void FFmpegPathButtonClicked(PropertyPage props, int propertyIndex) { var dummy = ""; #if FAMISTUDIO_WINDOWS var ffmpegExeFilter = "FFmpeg Executable (ffmpeg.exe)|ffmpeg.exe"; #else var ffmpegExeFilter = "FFmpeg Executable (ffmpeg)|*.*"; #endif #if FAMISTUDIO_MACOS dialog.TemporarelyHide(); #endif string filename = PlatformUtils.ShowOpenFileDialog("Please select FFmpeg executable", ffmpegExeFilter, ref dummy, dialog); #if FAMISTUDIO_MACOS dialog.TemporarelyShow(); #endif if (filename != null) { props.SetPropertyValue(propertyIndex, filename); // Update settings right away. Settings.FFmpegExecutablePath = filename; Settings.Save(); } }
private void VideoPage_PropertyChanged(PropertyPage props, int propIdx, int rowIdx, int colIdx, object value) { if (propIdx == props.PropertyCount - 2) // Stereo { props.SetColumnEnabled(props.PropertyCount - 1, 2, (bool)value); } }
private void PageGeneral_PropertyClicked(PropertyPage props, ClickType click, int propIdx, int rowIdx, int colIdx) { if (click == ClickType.Button) { PlatformUtils.OpenUrl(Settings.GetAutoSaveFilePath()); } }
public PropertyPage AddPropertyPage(string text, string image) { var suffix = DpiScaling.Dialog > 1.0f ? "@2x" : ""; var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"FamiStudio.Resources.{image}{suffix}.png"); if (stream == null) { Debug.WriteLine($"Error loading bitmap {image }."); } var bmp = stream != null?Image.FromStream(stream) as Bitmap : null; if ((DpiScaling.Dialog % 1.0f) != 0.0f && bmp != null) { var newWidth = (int)(bmp.Width * (DpiScaling.Dialog / 2.0f)); var newHeight = (int)(bmp.Height * (DpiScaling.Dialog / 2.0f)); bmp = new Bitmap(bmp, newWidth, newHeight); } var page = new PropertyPage(); page.Dock = DockStyle.Fill; panelProps.Controls.Add(page); var tab = new PropertyPageTab(); tab.button = AddButton(text, bmp); tab.properties = page; tabs.Add(tab); return(page); }
private PropertyPage CreatePropertyPage(PropertyPage page, TransformOperation section) { switch (section) { case TransformOperation.SongCleanup: page.AddCheckBox("Merge identical patterns:", true, MergePatternsTooltip); // 0 page.AddCheckBox("Delete empty patterns:", true, DeleteEmptyPatternsTooltip); // 1 page.AddCheckBox("Adjust maximum note lengths:", true, AdjustMaximumNoteLengthsTooltip); // 2 page.AddCheckBoxList(PlatformUtils.IsMobile ? "Songs to process:" : null, GetSongNames(), null, SongsTooltips); // 3 break; case TransformOperation.ProjectCleanup: page.AddCheckBox("Delete unused instruments:", true, DeleteUnusedInstrumentsTooltip); // 0 page.AddCheckBox("Merge identical instruments:", true, MergeIdenticalInstrumentsTooltip); // 1 page.AddCheckBox("Unassign unused DPCM instrument keys:", true, UnassignUnusedSamplesTooltip); // 2 page.AddCheckBox("Delete unassigned samples:", true, DeleteUnassignedSamplesTooltip); // 3 page.AddCheckBox("Permanently apply all DPCM samples processing:", false, PermanentlyApplyProcessingTooltip); // 4 page.AddCheckBox("Delete unused arpeggios:", true, DeleteUnusedArpeggiosTooltip); // 5 page.PropertyChanged += ProjectCleanup_PropertyChanged; break; } page.Build(); pages[(int)section] = page; return(page); }
private void Page_PropertyChanged(PropertyPage props, int idx, object value) { if (props == pages[(int)ConfigSection.UserInterface] && idx == 4) { props.SetPropertyEnabled(5, (bool)value); } }
private void Properties_PropertyChanged(PropertyPage props, int propIdx, int rowIdx, int colIdx, object value) { if (saveMode) { if (propIdx == 0) { var newFile = (int)value == userProjects.Count - 1; dialog.Properties.SetPropertyEnabled(1, newFile); dialog.Properties.SetPropertyEnabled(2, !newFile); } } else { if (inPropertyChange) { return; } inPropertyChange = true; if (propIdx == 0) { props.ClearRadioList(1); } else if (propIdx == 1 && userProjects != null && userProjects.Count > 0) { props.ClearRadioList(0); } inPropertyChange = false; } }
public PropertyPage AddPropertyPage(string text, string image) { var suffix = Direct2DTheme.DialogScaling > 1.0f ? "@2x" : ""; var bmp = Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream($"FamiStudio.Resources.{image}{suffix}.png")) as Bitmap; if ((Direct2DTheme.DialogScaling % 1.0f) != 0.0f) { var newWidth = (int)(bmp.Width * (Direct2DTheme.DialogScaling / 2.0f)); var newHeight = (int)(bmp.Height * (Direct2DTheme.DialogScaling / 2.0f)); bmp = new System.Drawing.Bitmap(bmp, newWidth, newHeight); } var page = new PropertyPage(); page.Dock = DockStyle.Fill; panelProps.Controls.Add(page); var tab = new PropertyPageTab(); tab.button = AddButton(text, bmp); tab.properties = page; tabs.Add(tab); return(page); }
private bool AddCommonVideoProperties(PropertyPage page, string[] songNames) { // TODO : Make this part of the VideoEncoder. canExportToVideo = (!PlatformUtils.IsDesktop || (!string.IsNullOrEmpty(Settings.FFmpegExecutablePath) && File.Exists(Settings.FFmpegExecutablePath))); if (canExportToVideo) { page.AddDropDownList("Song :", songNames, songNames[0]); // 0 page.AddDropDownList("Resolution :", VideoResolution.Names, VideoResolution.Names[0]); // 1 page.AddDropDownList("Frame Rate :", new[] { "50/60 FPS", "25/30 FPS" }, "50/60 FPS"); // 2 page.AddDropDownList("Audio Bit Rate (Kb/s) :", new[] { "64", "96", "112", "128", "160", "192", "224", "256" }, "128"); // 3 page.AddDropDownList("Video Bit Rate (Kb/s):", new[] { "250", "500", "750", "1000", "1500", "2000", "3000", "4000", "5000", "8000", "10000" }, "8000"); // 4 page.AddNumericUpDown("Loop Count :", 1, 1, 8); // 5 return(true); } else { page.AddLabel(null, "Video export requires FFmpeg. Please go in the application settings and look for the 'FFmpeg' section.", true); // HACK : Last minute hack, too lazy to debug GTK layouting issues right now. if (PlatformUtils.IsGTK) { page.AddLabel(null, " "); } return(false); } }
private PropertyPage CreatePropertyPage(PropertyPage page, TransformOperation section) { switch (section) { case TransformOperation.SongCleanup: page.AddCheckBox("Merge identical patterns:", true); // 0 page.AddCheckBox("Delete empty patterns:", true); // 1 page.AddCheckBox("Adjust maximum note lengths:", true); // 2 page.AddCheckBoxList(null, GetSongNames(), null); // 3 break; case TransformOperation.ProjectCleanup: page.AddCheckBox("Delete unused instruments:", true); // 0 page.AddCheckBox("Merge identical instruments:", true); // 1 page.AddCheckBox("Unassign unused DPCM instrument keys:", true); // 2 page.AddCheckBox("Delete unassigned samples:", true); // 3 page.AddCheckBox("Permanently apply all DPCM samples processing:", false); // 4 page.AddCheckBox("Delete unused arpeggios:", true); // 5 page.PropertyChanged += ProjectCleanup_PropertyChanged; break; } page.Build(); pages[(int)section] = page; return(page); }
private void ResetMixerClicked(PropertyPage props, int propertyIndex) { var expansion = props.GetSelectedIndex(0); expansionMixer[expansion] = Settings.DefaultExpansionMixerSettings[expansion]; RefreshMixerSettings(); }
private void Properties_PropertyClicked(PropertyPage props, ClickType click, int propIdx, int rowIdx, int colIdx) { if (saveMode) { var idx = dialog.Properties.GetSelectedIndex(0); if (idx >= 0 && idx < userProjects.Count - 1) { PlatformUtils.MessageBoxAsync("Delete project?", "Delete", MessageBoxButtons.YesNo, (r) => { if (r == DialogResult.Yes) { File.Delete(GetUserProjectFilename(userProjects[idx])); userProjects.RemoveAt(idx); props.UpdateRadioButtonList(0, userProjects.ToArray(), userProjects.Count - 1); props.SetPropertyEnabled(1, true); props.SetPropertyEnabled(2, false); PlatformUtils.ShowToast("Project Deleted!"); } }); } } else { // HACK : We dont support nested activities right now, so return // this special code to signal that we should open from storage. storageFilename = "///STORAGE///"; dialog.CloseWithResult(DialogResult.OK); } }
private void Midi_PropertyChanged(PropertyPage props, int propIdx, int rowIdx, int colIdx, object value) { if (propIdx == 4) { UpdateMidiInstrumentMapping(); } }
private void WavMp3_PropertyChanged(PropertyPage props, int propIdx, int rowIdx, int colIdx, object value) { if (propIdx == 1) { props.SetPropertyEnabled(3, (string)value != "WAV"); } else if (propIdx == 4) { props.SetPropertyEnabled(5, (string)value != "Duration"); props.SetPropertyEnabled(6, (string)value == "Duration"); } else if (propIdx == 7) { var separateChannels = (bool)value; props.SetPropertyEnabled(9, !separateChannels); if (separateChannels) { props.SetPropertyValue(9, false); } props.SetColumnEnabled(10, 2, props.GetPropertyValue <bool>(9)); } else if (propIdx == 9) { props.SetColumnEnabled(10, 2, (bool)value); } }
private void Midi_PropertyChanged(PropertyPage props, int idx, object value) { if (idx == 4) { midiInstrumentMapping = null; UpdateMidiInstrumentMapping(); } }
void QwertyListRightClicked(PropertyPage props, int propertyIndex, int itemIndex, int columnIndex) { if (columnIndex >= 2) { qwertyKeys[itemIndex, columnIndex - 2] = -1; pages[(int)ConfigSection.QWERTY].UpdateMultiColumnList(1, GetQwertyMappingStrings()); } }
private void SoundEngine_PropertyChanged(PropertyPage props, int propIdx, int rowIdx, int colIdx, object value) { if (propIdx == 1) { props.SetPropertyEnabled(2, (bool)value); props.SetPropertyEnabled(3, (bool)value); } }
private void Page_PropertyChanged(PropertyPage props, int idx, object value) { if (props == dialog.GetPropertyPage((int)ExportFormat.FamiTone2) && idx == 1) { props.SetPropertyEnabled(2, (bool)value); props.SetPropertyEnabled(3, (bool)value); } }
private void InitializeComponent() { propertyPage = new PropertyPage(); buttonYes = new NoFocusButton(); buttonNo = new NoFocusButton(); buttonAdvanced = new NoFocusButton(); toolTip = new ToolTip(); propertyPage.AutoSizeMode = AutoSizeMode.GrowAndShrink; propertyPage.BackColor = Theme.DarkGreyFillColor1; propertyPage.Dock = DockStyle.Top; propertyPage.Location = new Point(0, 0); propertyPage.Padding = new Padding(3); propertyPage.Size = new Size(298, 200); propertyPage.PropertyWantsClose += new PropertyPage.PropertyWantsCloseDelegate(propertyPage_PropertyWantsClose); buttonYes.FlatAppearance.BorderSize = 0; buttonYes.FlatStyle = FlatStyle.Flat; buttonYes.Location = new Point(224, 361); buttonYes.Size = new Size(32, 32); buttonYes.UseVisualStyleBackColor = true; buttonYes.Click += new EventHandler(buttonYes_Click); buttonNo.FlatAppearance.BorderSize = 0; buttonNo.FlatStyle = FlatStyle.Flat; buttonNo.Location = new Point(261, 361); buttonNo.Size = new Size(32, 32); buttonNo.UseVisualStyleBackColor = true; buttonNo.Click += new EventHandler(buttonNo_Click); buttonAdvanced.FlatAppearance.BorderSize = 0; buttonAdvanced.FlatStyle = FlatStyle.Flat; buttonAdvanced.Location = new Point(5, 361); buttonAdvanced.Size = new Size(32, 32); buttonAdvanced.UseVisualStyleBackColor = true; buttonAdvanced.Visible = false; buttonAdvanced.Click += new EventHandler(buttonAdvanced_Click); AutoScaleMode = AutoScaleMode.None; BackColor = Theme.DarkGreyFillColor1; ClientSize = new Size(298, 398); FormBorderStyle = FormBorderStyle.FixedToolWindow; ControlBox = false; KeyPreview = true; MaximizeBox = false; MinimizeBox = false; ShowInTaskbar = false; SizeGripStyle = SizeGripStyle.Hide; KeyDown += new KeyEventHandler(PropertyDialog_KeyDown); SuspendLayout(); Controls.Add(buttonAdvanced); Controls.Add(propertyPage); Controls.Add(buttonYes); Controls.Add(buttonNo); ResumeLayout(true); }
private void MixerPage_PropertyClicked(PropertyPage props, ClickType click, int propIdx, int rowIdx, int colIdx) { if (propIdx == 4 && click == ClickType.Button) { var expansion = props.GetSelectedIndex(1); expansionMixer[expansion] = Settings.DefaultExpansionMixerSettings[expansion]; RefreshMixerSettings(); } }
private void PageGeneral_PropertyChanged(PropertyPage props, int propIdx, int rowIdx, int colIdx, object value) { if (props == pages[(int)ConfigSection.General] && propIdx == 2) { var macOsPage = pages[(int)ConfigSection.MacOS]; macOsPage.SetPropertyEnabled(0, (bool)value); macOsPage.SetPropertyEnabled(1, (bool)value); macOsPage.SetPropertyEnabled(2, (bool)value); } }
public TempoProperties(PropertyPage props, Song song, int patternIdx = -1, int minPatternIdx = -1, int maxPatternIdx = -1) { this.song = song; this.props = props; this.patternIdx = patternIdx; this.minPatternIdx = minPatternIdx; this.maxPatternIdx = maxPatternIdx; props.PropertyChanged += Props_PropertyChanged; }
private void QwertyPage_PropertyClicked(PropertyPage props, ClickType click, int propIdx, int rowIdx, int colIdx) { if (propIdx == 1 && colIdx >= 2) { if (click == ClickType.Double) { var dlg = new PropertyDialog("", 300, false, true, dialog); dlg.Properties.AddLabel(null, "Press the new key or ESC to cancel."); dlg.Properties.Build(); // TODO : Make this cross-platform. #if FAMISTUDIO_WINDOWS dlg.KeyDown += (sender, e) => { if (PlatformUtils.KeyCodeToString((int)e.KeyCode) != null) { if (e.KeyCode != Keys.Escape) { AssignQwertyKey(rowIdx, colIdx - 2, (int)e.KeyCode); } dlg.Close(); } }; #elif FAMISTUDIO_LINUX || FAMISTUDIO_MACOS dlg.KeyPressEvent += (o, args) => { // These 2 keys are used by the QWERTY input. if (args.Event.Key != Gdk.Key.Tab && args.Event.Key != Gdk.Key.BackSpace && PlatformUtils.KeyCodeToString((int)args.Event.Key) != null) { if (args.Event.Key != Gdk.Key.Escape) { AssignQwertyKey(rowIdx, colIdx - 2, (int)args.Event.Key); } dlg.Accept(); } }; #endif dlg.ShowDialogAsync(null, (r) => { }); pages[(int)ConfigSection.QWERTY].UpdateMultiColumnList(1, GetQwertyMappingStrings()); } else if (click == ClickType.Right) { qwertyKeys[rowIdx, colIdx - 2] = -1; pages[(int)ConfigSection.QWERTY].UpdateMultiColumnList(1, GetQwertyMappingStrings()); } } else if (propIdx == 2 && click == ClickType.Button) { Array.Copy(Settings.DefaultQwertyKeys, qwertyKeys, Settings.DefaultQwertyKeys.Length); pages[(int)ConfigSection.QWERTY].UpdateMultiColumnList(1, GetQwertyMappingStrings()); } }
private PropertyPage CreatePropertyPage(PropertyPage page, ConfigSection section) { switch (section) { case ConfigSection.UserInterface: { #if FAMISTUDIO_WINDOWS var scalingValues = new[] { "System", "100%", "150%", "200%" }; #else var scalingValues = new[] { "System", "100%", "200%" }; #endif var idx = Settings.DpiScaling == 0 ? 0 : Array.IndexOf(scalingValues, $"{Settings.DpiScaling}%"); page.AddStringList("Scaling (Requires Restart):", scalingValues, scalingValues[idx]); // 0 page.AddBoolean("Check for updates:", true); // 1 break; } case ConfigSection.Sound: { page.AddIntegerRange("Stop Instruments After (sec):", Settings.InstrumentStopTime, 0, 10); // 0 break; } case ConfigSection.MIDI: { int midiDeviceCount = Midi.InputCount; var midiDevices = new List <string>(); for (int i = 0; i < midiDeviceCount; i++) { midiDevices.Add(Midi.GetDeviceName(i)); } var midiDevice = ""; if (Settings.MidiDevice.Length > 0 && midiDevices.Contains(Settings.MidiDevice)) { midiDevice = Settings.MidiDevice; } else if (midiDevices.Count > 0) { midiDevice = midiDevices[0]; } page.AddStringList("Device :", midiDevices.ToArray(), midiDevice); // 0 break; } } page.Build(); pages[(int)section] = page; return(page); }
private PropertyPage CreatePropertyPage(PropertyPage page, ExportFormat format) { var songNames = GetSongNames(); switch (format) { case ExportFormat.Wav: page.AddStringList("Song :", songNames, songNames[0]); // 0 page.AddStringList("Sample Rate :", new[] { "11025", "22050", "44100", "48000" }, "44100"); // 1 break; case ExportFormat.Nsf: page.AddString("Name :", project.Name, 31); // 0 page.AddString("Artist :", project.Author, 31); // 1 page.AddString("Copyright :", project.Copyright, 31); // 2 page.AddStringList("Mode :", Enum.GetNames(typeof(MachineType)), Enum.GetNames(typeof(MachineType))[0]); // 3 page.AddStringListMulti(null, songNames, null); // 4 #if DEBUG page.AddStringList("Engine :", Enum.GetNames(typeof(FamitoneMusicFile.FamiToneKernel)), Enum.GetNames(typeof(FamitoneMusicFile.FamiToneKernel))[0]); // 5 #endif page.SetPropertyEnabled(3, !project.UsesExpansionAudio); break; case ExportFormat.Rom: page.AddString("Name :", project.Name.Substring(0, Math.Min(28, project.Name.Length)), 28); // 0 page.AddString("Artist :", project.Author.Substring(0, Math.Min(28, project.Author.Length)), 28); // 1 page.AddStringListMulti(null, songNames, null); // 2 break; case ExportFormat.Text: page.AddStringListMulti(null, songNames, null); // 0 break; case ExportFormat.FamiTracker: page.AddStringListMulti(null, songNames, null); // 0 break; case ExportFormat.FamiTone2: page.AddStringList("Variant :", Enum.GetNames(typeof(FamitoneMusicFile.FamiToneKernel)), Enum.GetNames(typeof(FamitoneMusicFile.FamiToneKernel))[0]); // 0 page.AddStringList("Format :", Enum.GetNames(typeof(FamitoneMusicFile.OutputFormat)), Enum.GetNames(typeof(FamitoneMusicFile.OutputFormat))[0]); // 1 page.AddBoolean("Separate Files :", false); // 2 page.AddString("Song Name Pattern :", "{project}_{song}"); // 3 page.AddString("DMC Name Pattern :", "{project}"); // 4 page.AddStringListMulti(null, songNames, null); // 5 page.SetPropertyEnabled(3, false); page.SetPropertyEnabled(4, false); break; } page.Build(); page.PropertyChanged += Page_PropertyChanged; return(page); }
private void Page_PropertyChanged(PropertyPage props, int idx, object value) { if (props == dialog.GetPropertyPage((int)ExportFormat.FamiTone2Music) && idx == 2) { props.SetPropertyEnabled(3, (bool)value); props.SetPropertyEnabled(4, (bool)value); } else if (props == dialog.GetPropertyPage((int)ExportFormat.Wav) && idx == 2) { props.SetPropertyEnabled(3, (string)value == "Duration"); } }
private void WavMp3_PropertyChanged(PropertyPage props, int idx, object value) { if (idx == 1) { props.SetPropertyEnabled(3, (string)value == "MP3"); } else if (idx == 4) { props.SetPropertyEnabled(5, (string)value != "Duration"); props.SetPropertyEnabled(6, (string)value == "Duration"); } }
private void Properties_PropertyClicked(PropertyPage props, ClickType click, int propIdx, int rowIdx, int colIdx) { if (click == ClickType.Button && (propIdx == 3 || propIdx == 4)) { var keys = new bool[checkToEffect.Count]; for (int i = 0; i < keys.Length; i++) { keys[i] = propIdx == 3; } props.UpdateCheckBoxList(2, keys); } }
private void SelectClicked(PropertyPage props, int propertyIndex) { var keys = new bool[MidiFileReader.MidiDrumKeyNames.Length]; if (propertyIndex == 4) { for (int i = 0; i < keys.Length; i++) { keys[i] = true; } } props.UpdateCheckBoxList(3, keys); }