Пример #1
0
        Widget CreateGeneralPane()
        {
            var pane = new ThemedScrollView {
                Padding = new Thickness {
                    Right = 15,
                },
            };

            pane.Content.Layout = new VBoxLayout {
                Spacing = 4
            };
            new Vector2PropertyEditor(
                new PropertyEditorParams(pane.Content, Tangerine.AppUserPreferences.Instance, nameof(Tangerine.AppUserPreferences.DefaultSceneDimensions), "Default scene dimensions"));
            new BooleanPropertyEditor(
                new PropertyEditorParams(pane.Content, CoreUserPreferences.Instance, nameof(CoreUserPreferences.AutoKeyframes), "Automatic keyframes"));
            new BooleanPropertyEditor(
                new PropertyEditorParams(pane.Content, UI.Timeline.TimelineUserPreferences.Instance, nameof(UI.Timeline.TimelineUserPreferences.AnimationMode), "Animation mode"));
            new IntPropertyEditor(
                new PropertyEditorParams(pane.Content, Tangerine.AppUserPreferences.Instance, nameof(Tangerine.AppUserPreferences.AutosaveDelay), "Autosave delay"));
            var boneWidthPropertyEditor = new FloatPropertyEditor(
                new PropertyEditorParams(pane.Content, UI.SceneView.SceneUserPreferences.Instance, nameof(UI.SceneView.SceneUserPreferences.DefaultBoneWidth), "Bone Width"));

            boneWidthPropertyEditor.ContainerWidget.AddChangeWatcher(
                () => UI.SceneView.SceneUserPreferences.Instance.DefaultBoneWidth, (v) => Application.InvalidateWindows());
            return(pane);
        }
Пример #2
0
        Widget CreateGeneralPane()
        {
            var parent = new Widget();

            parent.Layout = new VBoxLayout {
                Spacing = 0
            };
            parent.Padding = contentPadding;
            var platform = new Widget();

            platform.Layout = new HBoxLayout {
                Spacing = 4, DefaultCell = new DefaultLayoutCell(Alignment.Center)
            };
            platform.Padding = contentPadding;
            platform.AddNode(new ThemedSimpleText("Target platform"));
            var platformPicker = (Orange.The.UI as OrangeInterface).PlatformPicker;

            platformPicker.Unlink();
            platform.AddNode(platformPicker);
            parent.AddNode(platform);
            var pane = new ThemedScrollView();

            pane.Content.Layout = new VBoxLayout {
                Spacing = 4
            };
            pane.Content.Padding = contentPadding;
            editors.AddRange(new IPropertyEditor[] {
                new BooleanPropertyEditor(
                    new PreferencesPropertyEditorParams(pane.Content, CoreUserPreferences.Instance, propertyName: nameof(CoreUserPreferences.ReloadModifiedFiles), displayName: "Reload modified files")),
                new Vector2PropertyEditor(
                    new PreferencesPropertyEditorParams(pane.Content, Tangerine.AppUserPreferences.Instance, propertyName: nameof(Tangerine.AppUserPreferences.DefaultSceneDimensions), displayName: "Default scene dimensions")),
                new BooleanPropertyEditor(
                    new PreferencesPropertyEditorParams(pane.Content, CoreUserPreferences.Instance, propertyName: nameof(CoreUserPreferences.AutoKeyframes), displayName: "Automatic keyframes")),
                new IntPropertyEditor(
                    new PreferencesPropertyEditorParams(pane.Content, Tangerine.AppUserPreferences.Instance, propertyName: nameof(Tangerine.AppUserPreferences.AutosaveDelay), displayName: "Autosave delay")),
                new BooleanPropertyEditor(
                    new PreferencesPropertyEditorParams(pane.Content, CoreUserPreferences.Instance, propertyName: nameof(CoreUserPreferences.StopAnimationOnCurrentFrame), displayName: "Stop animaion on current frame")),
                new BooleanPropertyEditor(
                    new PreferencesPropertyEditorParams(pane.Content, CoreUserPreferences.Instance, propertyName: nameof(CoreUserPreferences.ShowSceneThumbnail), displayName: "Show scene thumbnail")),
                new BooleanPropertyEditor(
                    new PreferencesPropertyEditorParams(pane.Content, CoreUserPreferences.Instance, propertyName: nameof(CoreUserPreferences.ShowSplinesGlobally), displayName: "Show splines globally")),
                new BooleanPropertyEditor(
                    new PreferencesPropertyEditorParams(pane.Content, CoreUserPreferences.Instance, propertyName: nameof(CoreUserPreferences.DontPasteAtMouse), displayName: "Don't paste at mouse pointer")),
                new BooleanPropertyEditor(
                    new PreferencesPropertyEditorParams(pane.Content, CoreUserPreferences.Instance, propertyName: nameof(CoreUserPreferences.InverseShiftKeyframeDrag), displayName: "Inverse Shift behaviour when dragging keyframes")),
                new BooleanPropertyEditor(
                    new PreferencesPropertyEditorParams(pane.Content, CoreUserPreferences.Instance, propertyName: nameof(CoreUserPreferences.SwapMouseButtonsForKeyframeSwitch), displayName: "Swap mouse buttons for keyframe switch")),
            });
            var boneWidthPropertyEditor =
                new FloatPropertyEditor(
                    new PreferencesPropertyEditorParams(pane.Content, UI.SceneView.SceneUserPreferences.Instance, propertyName: nameof(UI.SceneView.SceneUserPreferences.DefaultBoneWidth), displayName: "Bone Width"));

            boneWidthPropertyEditor.ContainerWidget.AddChangeWatcher(
                () => UI.SceneView.SceneUserPreferences.Instance.DefaultBoneWidth, (v) => Application.InvalidateWindows());
            new EnumPropertyEditor <KeyFunction>(
                new PreferencesPropertyEditorParams(pane.Content, CoreUserPreferences.Instance, propertyName: nameof(CoreUserPreferences.DefaultKeyFunction), displayName: "Default interpolation"));
            parent.AddNode(pane);
            return(parent);
        }
Пример #3
0
        public NumericScaleDialog()
        {
            window = new Window(new WindowOptions {
                ClientSize = new Vector2(250, 70),
                FixedSize  = true,
                Title      = "Numeric Scale",
                Visible    = false,
            });
            rootWidget = new ThemedInvalidableWindowWidget(window)
            {
                Padding = new Thickness(8),
                Layout  = new VBoxLayout(),
                Nodes   =
                {
                    (container               = new Widget       {
                        Layout               = new VBoxLayout(),
                    }),
                    new Widget {
                        Layout               = new HBoxLayout   {
                            Spacing          =           8
                        },
                        LayoutCell           = new LayoutCell   {
                            StretchY         =              0
                        },
                        Padding              = new Thickness    {
                            Top              =                5
                        },
                        Nodes                =
                        {
                            new Widget {
                                MinMaxHeight =        0
                            },
                            (okButton        = new ThemedButton{
                                Text         = "Ok"
                            }),
                            (cancelButton    = new ThemedButton{
                                Text         = "Cancel"
                            }),
                        },
                    }
                }
            };
            rootWidget.FocusScope = new KeyboardFocusScope(rootWidget);
            Scale = 1;
            var editor = new FloatPropertyEditor(new PropertyEditorParams(container, this, nameof(Scale), "Scale"));

            cancelButton.Clicked += () => {
                window.Close();
            };
            okButton.Clicked += () => {
                editor.Submit();
                if (Scale < Mathf.ZeroTolerance)
                {
                    AlertDialog.Show("Scale value too small");
                    window.Close();
                    return;
                }
                Document.Current.History.DoTransaction(() => {
                    ScaleKeyframes();
                });
                window.Close();
            };
            cancelButton.SetFocus();
            window.ShowModal();
        }