Ejemplo n.º 1
0
        /// <summary>
        /// Construct a view for the given model.
        /// </summary>
        /// <param name="m">Model for which to construct a view</param>
        /// <param name="reset">Callback to call when a UI layout change may be needed</param>
        public TransferView(TransferModel m, AstrogationView.ResetCallback reset)
            : base()
        {
            model         = m;
            resetCallback = reset;

            CreateLayout();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Construct a GUI object that allows the user to edit the settings.
        /// </summary>
        public SettingsView(AstrogationView.ResetCallback reset)
            : base(
                mainWindowMinWidth, 10,
                settingsSpacing, settingsPadding,
                TextAnchor.UpperLeft
                )
        {
            resetCallback = reset;

            try {
                AddChild(headerButton(
                             Localizer.Format("astrogator_manualLink"),
                             linkStyle, Localizer.Format("astrogator_manualLinkTooltip"), RowWidth, rowHeight,
                             () => { Application.OpenURL(docsURL); }
                             ));

                AddChild(LabelWithStyleAndSize(
                             Localizer.Format("astrogator_settingsSectionHeader"),
                             midHdrStyle,
                             mainWindowMinWidth
                             ));

                AddChild(new WrappingToggle(
                             () => Settings.Instance.GeneratePlaneChangeBurns,
                             Localizer.Format("astrogator_planeChangeBurnsSetting"),
                             (bool b) => {
                    Settings.Instance.GeneratePlaneChangeBurns = b;
                    if (!b)
                    {
                        Settings.Instance.DeleteExistingManeuvers = false;
                        Settings.Instance.AutoEditPlaneChangeNode = false;
                        Settings.Instance.AddPlaneChangeDeltaV    = false;
                    }
                },
                             mainWindowInternalWidth
                             ));

                AddChild(new WrappingToggle(
                             () => Settings.Instance.AddPlaneChangeDeltaV,
                             Localizer.Format("astrogator_addChangeBurnsSetting"),
                             (bool b) => {
                    Settings.Instance.AddPlaneChangeDeltaV = b;
                    // Only need to reload if we don't already have the plane change values
                    if (b)
                    {
                        Settings.Instance.GeneratePlaneChangeBurns = true;
                        resetCallback(true);
                    }
                },
                             mainWindowInternalWidth
                             ));

                AddChild(new WrappingToggle(
                             () => Settings.Instance.DeleteExistingManeuvers,
                             Localizer.Format("astrogator_autoDeleteNodesSetting"),
                             (bool b) => { Settings.Instance.DeleteExistingManeuvers = b; },
                             mainWindowInternalWidth
                             ));

                AddChild(new WrappingToggle(
                             () => Settings.Instance.ShowTrackedAsteroids,
                             Localizer.Format("astrogator_asteroidsSetting"),
                             (bool b) => { Settings.Instance.ShowTrackedAsteroids = b; resetCallback(true); },
                             mainWindowInternalWidth
                             ));

                AddChild(LabelWithStyleAndSize(
                             Localizer.Format("astrogator_maneuverCreationHeader"),
                             midHdrStyle,
                             mainWindowMinWidth
                             ));

                AddChild(new WrappingToggle(
                             () => Settings.Instance.AutoTargetDestination,
                             Localizer.Format("astrogator_autoTargetDestSetting"),
                             (bool b) => { Settings.Instance.AutoTargetDestination = b; },
                             mainWindowInternalWidth
                             ));

                AddChild(new WrappingToggle(
                             () => Settings.Instance.AutoFocusDestination,
                             Localizer.Format("astrogator_autoFocusDestSetting"),
                             (bool b) => { Settings.Instance.AutoFocusDestination = b; },
                             mainWindowInternalWidth
                             ));

                AddChild(new WrappingToggle(
                             () => Settings.Instance.AutoEditEjectionNode,
                             Localizer.Format("astrogator_autoEditEjecSetting"),
                             (bool b) => {
                    Settings.Instance.AutoEditEjectionNode = b;
                    if (b)
                    {
                        Settings.Instance.AutoEditPlaneChangeNode = false;
                    }
                },
                             mainWindowInternalWidth
                             ));

                AddChild(new WrappingToggle(
                             () => Settings.Instance.AutoEditPlaneChangeNode,
                             Localizer.Format("astrogator_autoEditPlaneChgSetting"),
                             (bool b) => {
                    Settings.Instance.AutoEditPlaneChangeNode = b;
                    if (b)
                    {
                        Settings.Instance.GeneratePlaneChangeBurns = true;
                        Settings.Instance.AutoEditEjectionNode     = false;
                    }
                },
                             mainWindowInternalWidth
                             ));

                AddChild(new WrappingToggle(
                             () => Settings.Instance.AutoSetSAS,
                             Localizer.Format("astrogator_autoSetSASSetting"),
                             (bool b) => { Settings.Instance.AutoSetSAS = b; },
                             mainWindowInternalWidth
                             ));

                AddChild(new WrappingToggle(
                             () => Settings.Instance.TranslationAdjust,
                             Localizer.Format("astrogator_adjustNodesSetting"),
                             (bool b) => { Settings.Instance.TranslationAdjust = b; },
                             mainWindowInternalWidth
                             ));

                AddChild(LabelWithStyleAndSize(
                             Localizer.Format("astrogator_unitsHeader"),
                             midHdrStyle,
                             mainWindowMinWidth
                             ));

                AddChild(new WrappingToggle(
                             () => Settings.Instance.DisplayUnits == DisplayUnitsEnum.Metric,
                             Localizer.Format("astrogator_metricSetting"),
                             (bool b) => { if (b)
                                           {
                                               Settings.Instance.DisplayUnits = DisplayUnitsEnum.Metric;
                                           }
                                           resetCallback(false); },
                             mainWindowInternalWidth
                             ));

                AddChild(new WrappingToggle(
                             () => Settings.Instance.DisplayUnits == DisplayUnitsEnum.UnitedStatesCustomary,
                             Localizer.Format("astrogator_imperialSetting"),
                             (bool b) => { if (b)
                                           {
                                               Settings.Instance.DisplayUnits = DisplayUnitsEnum.UnitedStatesCustomary;
                                           }
                                           resetCallback(false); },
                             mainWindowInternalWidth
                             ));
            } catch (Exception ex) {
                DbgExc("Problem constructing settings view", ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Construct a GUI object that allows the user to edit the settings.
        /// </summary>
        public SettingsView(AstrogationView.ResetCallback reset)
            : base(
                mainWindowMinWidth, 10,
                mainWindowSpacing, settingsPadding,
                TextAnchor.UpperLeft
                )
        {
            resetCallback = reset;

            try {
                AddChild(headerButton(
                             "Click for online manual",
                             linkStyle, "The meaning of each setting is explained in the README.md file", RowWidth, rowHeight,
                             () => { Application.OpenURL(docsURL); }
                             ));

                AddChild(LabelWithStyleAndSize(
                             "Settings:",
                             midHdrStyle,
                             mainWindowMinWidth, rowHeight
                             ));

                AddChild(new DialogGUIToggle(
                             () => Settings.Instance.GeneratePlaneChangeBurns,
                             "Generate plane change burns",
                             (bool b) => { Settings.Instance.GeneratePlaneChangeBurns = b; }
                             ));

                AddChild(new DialogGUIToggle(
                             () => Settings.Instance.AddPlaneChangeDeltaV,
                             "Add plane change burns to Δv column",
                             (bool b) => {
                    Settings.Instance.AddPlaneChangeDeltaV = b;
                    // Only need to reload if we don't already have the plane change values
                    if (b)
                    {
                        resetCallback(true);
                    }
                }
                             ));

                AddChild(new DialogGUIToggle(
                             () => Settings.Instance.DeleteExistingManeuvers,
                             "Auto-delete user-created maneuver nodes",
                             (bool b) => { Settings.Instance.DeleteExistingManeuvers = b; }
                             ));

                AddChild(new DialogGUIToggle(
                             () => Settings.Instance.ShowTrackedAsteroids,
                             "Calculate transfers to tracked asteroids",
                             (bool b) => { Settings.Instance.ShowTrackedAsteroids = b; resetCallback(true); }
                             ));

                AddChild(LabelWithStyleAndSize(
                             "Maneuver creation:",
                             midHdrStyle,
                             mainWindowMinWidth, rowHeight
                             ));

                AddChild(new DialogGUIToggle(
                             () => Settings.Instance.AutoTargetDestination,
                             "Automatically target destination",
                             (bool b) => { Settings.Instance.AutoTargetDestination = b; }
                             ));

                AddChild(new DialogGUIToggle(
                             () => Settings.Instance.AutoFocusDestination,
                             "Automatically focus destination",
                             (bool b) => { Settings.Instance.AutoFocusDestination = b; }
                             ));

                AddChild(new DialogGUIToggle(
                             () => Settings.Instance.AutoEditEjectionNode,
                             "Automatically edit ejection node",
                             (bool b) => { Settings.Instance.AutoEditEjectionNode = b; }
                             ));

                AddChild(new DialogGUIToggle(
                             () => Settings.Instance.AutoEditPlaneChangeNode,
                             "Automatically edit plane change node",
                             (bool b) => { Settings.Instance.AutoEditPlaneChangeNode = b; }
                             ));

                AddChild(new DialogGUIToggle(
                             () => Settings.Instance.AutoSetSAS,
                             "Automatically set SAS to maneuver mode",
                             (bool b) => { Settings.Instance.AutoSetSAS = b; }
                             ));

                AddChild(new DialogGUIToggle(
                             () => Settings.Instance.TranslationAdjust,
                             "Adjust nodes with translation controls when RCS is off",
                             (bool b) => { Settings.Instance.TranslationAdjust = b; }
                             ));

                AddChild(LabelWithStyleAndSize(
                             "Units:",
                             midHdrStyle,
                             mainWindowMinWidth, rowHeight
                             ));

                AddChild(new DialogGUIToggle(
                             () => Settings.Instance.DisplayUnits == DisplayUnitsEnum.Metric,
                             "Système International d'Unités (Metric)",
                             (bool b) => { if (b)
                                           {
                                               Settings.Instance.DisplayUnits = DisplayUnitsEnum.Metric;
                                           }
                                           resetCallback(false); }
                             ));

                AddChild(new DialogGUIToggle(
                             () => Settings.Instance.DisplayUnits == DisplayUnitsEnum.UnitedStatesCustomary,
                             "United States Customary (Imperial)",
                             (bool b) => { if (b)
                                           {
                                               Settings.Instance.DisplayUnits = DisplayUnitsEnum.UnitedStatesCustomary;
                                           }
                                           resetCallback(false); }
                             ));
            } catch (Exception ex) {
                DbgExc("Problem constructing settings view", ex);
            }
        }