Esempio n. 1
0
 public void ShowDialogAsync()
 {
     dialog.ShowDialogAsync(app.MainForm, (r) =>
     {
         if (r == DialogResult.OK)
         {
             Export(false);
             lastExportCrc = lastExportFilename != null ? ComputeProjectCrc(project) : 0;
         }
     });
 }
Esempio n. 2
0
        public void ShowDialogAsync(FamiStudioForm parent, Action <DialogResult> callback)
        {
            dialog.ShowDialogAsync(parent, (r) =>
            {
                if (r == DialogResult.OK)
                {
                    var operation = (TransformOperation)dialog.SelectedIndex;

                    switch (operation)
                    {
                    case TransformOperation.SongCleanup:
                        SongCleanup();
                        break;

                    case TransformOperation.ProjectCleanup:
                        ProjectCleanup();
                        break;
                    }
                }

                callback(r);
            });
        }
Esempio n. 3
0
        public void ShowDialogAsync(FamiStudioForm parent, Action <DialogResult> callback)
        {
            dialog.ShowDialogAsync(parent, (r) =>
            {
                if (r == DialogResult.OK)
                {
                    var pageGeneral = pages[(int)ConfigSection.General];
                    var pageUI      = pages[(int)ConfigSection.UserInterface];
                    var pageSound   = pages[(int)ConfigSection.Sound];
                    var pageMixer   = pages[(int)ConfigSection.Mixer];

                    // General
                    Settings.CheckUpdates           = pageGeneral.GetPropertyValue <bool>(0);
                    Settings.ShowTutorial           = pageGeneral.GetPropertyValue <bool>(1);
                    Settings.TrackPadControls       = pageGeneral.GetPropertyValue <bool>(2);
                    Settings.ClearUndoRedoOnSave    = pageGeneral.GetPropertyValue <bool>(3);
                    Settings.OpenLastProjectOnStart = pageGeneral.GetPropertyValue <bool>(4);
                    Settings.AutoSaveCopy           = pageGeneral.GetPropertyValue <bool>(5);

                    // UI
                    var scalingString = pageUI.GetPropertyValue <string>(0);

                    Settings.DpiScaling             = scalingString == "System" ? 0 : Utils.ParseIntWithTrailingGarbage(scalingString);
                    Settings.TimeFormat             = pageUI.GetSelectedIndex(1);
                    Settings.FollowMode             = pageUI.GetSelectedIndex(2);
                    Settings.FollowSync             = pageUI.GetSelectedIndex(3);
                    Settings.ScrollBars             = pageUI.GetSelectedIndex(4);
                    Settings.ShowPianoRollViewRange = pageUI.GetPropertyValue <bool>(5);
                    Settings.ShowNoteLabels         = pageUI.GetPropertyValue <bool>(6);
                    Settings.ShowImplicitStopNotes  = pageUI.GetPropertyValue <bool>(7);
                    Settings.ShowOscilloscope       = pageUI.GetPropertyValue <bool>(8);
                    Settings.ForceCompactSequencer  = pageUI.GetPropertyValue <bool>(9);

                    // Sound
                    Settings.NumBufferedAudioFrames = pageSound.GetPropertyValue <int>(0);
                    Settings.InstrumentStopTime     = pageSound.GetPropertyValue <int>(1);
                    Settings.SquareSmoothVibrato    = pageSound.GetPropertyValue <bool>(2);
                    Settings.NoDragSoungWhenPlaying = pageSound.GetPropertyValue <bool>(3);
                    Settings.MetronomeVolume        = (int)pageSound.GetPropertyValue <double>(4);

                    // Mixer.
                    Settings.GlobalVolume = (float)pageMixer.GetPropertyValue <double>(0);
                    Array.Copy(expansionMixer, Settings.ExpansionMixerSettings, Settings.ExpansionMixerSettings.Length);

                    // MIDI
                    var pageMIDI = pages[(int)ConfigSection.MIDI];

                    Settings.MidiDevice = pageMIDI.GetPropertyValue <string>(0);

                    // FFmpeg
                    var pageFFmpeg = pages[(int)ConfigSection.FFmpeg];

                    Settings.FFmpegExecutablePath = pageFFmpeg.GetPropertyValue <string>(1);

                    // QWERTY
                    Array.Copy(qwertyKeys, Settings.QwertyKeys, Settings.QwertyKeys.Length);
                    Settings.UpdateKeyCodeMaps();

                    // Mac OS
                    var pageMacOS                  = pages[(int)ConfigSection.MacOS];
                    Settings.ReverseTrackPad       = pageMacOS.GetPropertyValue <bool>(0);
                    Settings.TrackPadMoveSensitity = pageMacOS.GetPropertyValue <int>(1);
                    Settings.TrackPadZoomSensitity = pageMacOS.GetPropertyValue <int>(2);

                    // Mobile
                    var pageMobile             = pages[(int)ConfigSection.Mobile];
                    Settings.AllowVibration    = pageMobile.GetPropertyValue <bool>(0);
                    Settings.DoubleClickDelete = pageMobile.GetPropertyValue <bool>(1);

                    Settings.Save();
                }

                callback(r);
            });
        }