Exemplo n.º 1
0
        public TLValueTrack(string name)
            : base(name)
        {
            Keyframes     = new EditableIDList <TLValueKeyframe>("Keyframes");
            Curves        = new EditableIDList <TLCurve>("Curves");
            Minimum       = new EditableProperty <float>("Minimum");
            Minimum.Value = -1f;
            Maximum       = new EditableProperty <float>("Maximum");
            Maximum.Value = 1f;
            Add(Keyframes);
            Add(Curves);
            Add(Minimum);
            Add(Maximum);
            Keyframes.Added   += Keyframes_Added;
            Keyframes.Removed += Keyframes_Removed;


            Label.Value = "Value " + name;
        }
        public PropertiesFormTextBox(EditableProperty property, Widget parent)
            : base(property, parent, "Anomalous.GuiFramework.Editor.GUI.PropertiesForm.PropertiesFormTextBox.layout")
        {
            widget.ForwardMouseWheelToParent = true;

            TextBox textBox = (TextBox)widget.findWidget("TextBox");

            textBox.Caption = property.getValue(0);
            textBox.ForwardMouseWheelToParent = true;
            if (textBox.ClientWidget != null)
            {
                textBox.ClientWidget.ForwardMouseWheelToParent = true;
            }

            editBox          = (EditBox)widget.findWidget("EditBox");
            editBox.OnlyText = property.getValue(1);
            editBox.ForwardMouseWheelToParent = true;
            editBox.KeyLostFocus          += new MyGUIEvent(editBox_KeyLostFocus);
            editBox.EventEditSelectAccept += new MyGUIEvent(editBox_EventEditSelectAccept);
        }
Exemplo n.º 3
0
        public PropertiesFormIntSize2(EditableProperty property, Widget parent)
            : base(property, parent, "Anomalous.GuiFramework.Editor.GUI.PropertiesForm.PropertiesFormWidthHeight.layout")
        {
            widget.ForwardMouseWheelToParent = true;

            TextBox textBox = (TextBox)widget.findWidget("TextBox");

            textBox.Caption = property.getValue(0);
            textBox.ForwardMouseWheelToParent = true;

            IntSize2 value = (IntSize2)property.getRealValue(1);

            width               = new Int32NumericEdit((EditBox)widget.findWidget("Width"));
            width.Value         = value.Width;
            width.ValueChanged += new MyGUIEvent(editBox_ValueChanged);

            height               = new Int32NumericEdit((EditBox)widget.findWidget("Height"));
            height.Value         = value.Height;
            height.ValueChanged += new MyGUIEvent(editBox_ValueChanged);
        }
Exemplo n.º 4
0
        public Property AddNewProperty(EditableProperty editableProperty)
        {
            if (!editableProperty.OwnerId.HasValue)
            {
                throw new ValidationException("OwnerId is required to add a property.");
            }
            var propertyCol = db.GetCollection <Property>("Properties");
            var newProperty = new Property()
            {
                Id            = Guid.NewGuid(),
                OwnerId       = editableProperty.OwnerId.Value,
                StreetAddress = editableProperty.StreetAddress,
                City          = editableProperty.City,
                State         = editableProperty.State,
                Zip           = editableProperty.Zip ?? "99999"
            };

            propertyCol.Insert(newProperty);
            return(newProperty);
        }
Exemplo n.º 5
0
        public PropertiesFormVector2(EditableProperty property, Widget parent)
            : base(property, parent, "Anomalous.GuiFramework.Editor.GUI.PropertiesForm.PropertiesFormXY.layout")
        {
            widget.ForwardMouseWheelToParent = true;

            TextBox textBox = (TextBox)widget.findWidget("TextBox");

            textBox.Caption = property.getValue(0);
            textBox.ForwardMouseWheelToParent = true;

            Vector2 value = (Vector2)property.getRealValue(1);

            x               = new SingleNumericEdit((EditBox)widget.findWidget("X"));
            x.Value         = value.x;
            x.ValueChanged += new MyGUIEvent(editBox_ValueChanged);

            y               = new SingleNumericEdit((EditBox)widget.findWidget("Y"));
            y.Value         = value.y;
            y.ValueChanged += new MyGUIEvent(editBox_ValueChanged);
        }
Exemplo n.º 6
0
        private void remove(EditUICallback callback, EditableProperty property)
        {
            var listProp = property as ListItemEditableProperty <T>;
            int index    = listProp.Index;

            //Remove the item from the real list
            var item = list[index];

            removed(item);
            list.RemoveAt(index);

            //Reindex the remaining properties
            foreach (var reindex in properties.Skip(index))
            {
                reindex.Index--;
            }

            //Remove the property from the edit interface and local listing.
            removeEditableProperty(listProp);
            properties.Remove(listProp);
        }
Exemplo n.º 7
0
        private TableCell createCell(Type propType, bool hasBrowser, EditableProperty property)
        {
            foreach (ICustomCellProvider customCellProvider in customCells)
            {
                TableCell cell = customCellProvider.createCell(propType, hasBrowser, property);
                if (cell != null)
                {
                    return(cell);
                }
            }
            if (propType.GetTypeInfo().IsEnum)
            {
                if (propType.GetCustomAttributes(typeof(FlagsAttribute), true).Any())
                {
                    Type genericEditor = typeof(EnumFlagsTableCell <>).MakeGenericType(propType);
                    return(Activator.CreateInstance(genericEditor) as TableCell);
                }
                else
                {
                    Type genericEditor = typeof(EnumComboBoxTableCell <>).MakeGenericType(propType);
                    return(Activator.CreateInstance(genericEditor) as TableCell);
                }
            }
            if (propType == typeof(bool))
            {
                return(new CheckTableCell());
            }

            if (propType == typeof(Color))
            {
                return(new ColorEditCell());
            }

            if (hasBrowser)
            {
                return(new EditTableBrowserCell(uiCallback, property));
            }
            return(new EditTableCell());
        }
Exemplo n.º 8
0
        public PropertiesFormColor(EditableProperty property, Widget parent)
            : base(property, parent, "Anomalous.GuiFramework.Editor.GUI.PropertiesForm.PropertiesFormColorButton.layout")
        {
            widget.ForwardMouseWheelToParent = true;

            TextBox textBox = (TextBox)widget.findWidget("TextBox");

            textBox.Caption = property.getValue(0);
            textBox.ForwardMouseWheelToParent = true;
            if (textBox.ClientWidget != null)
            {
                textBox.ClientWidget.ForwardMouseWheelToParent = true;
            }

            Button colorButton = (Button)widget.findWidget("ColorButton");

            colorButton.MouseButtonClick         += colorButton_MouseButtonClick;
            colorButton.ForwardMouseWheelToParent = true;

            colorPreview = widget.findWidget("ColorPreview");
            colorPreview.ForwardMouseWheelToParent = true;

            refreshData();
        }
Exemplo n.º 9
0
 public void addProperty(Object key, EditableProperty property)
 {
     properties.Add(key, property);
     propertiesToObjects.Add(property, key);
     editInterface.addEditableProperty(property);
 }
Exemplo n.º 10
0
 set => SetValue(EditableProperty, value);
Exemplo n.º 11
0
 public TLStringKeyframe(string name, float time, string text)
     : base(name, time)
 {
     Text = new EditableProperty <string>("Text", text);
     Add(Text);
 }
Exemplo n.º 12
0
        public void SetActiveItem(IObject3D selectedItem)
        {
            this.item = selectedItem;
            editorPanel.CloseAllChildren();

            // Allow caller to clean up with passing null for selectedItem
            if (item == null)
            {
                return;
            }

            var selectedItemType = selectedItem.GetType();

            editorSectionWidget.Text = selectedItem.Name ?? selectedItemType.Name;

            HashSet <IObject3DEditor> mappedEditors = ApplicationController.Instance.GetEditorsForType(selectedItemType);

            var undoBuffer = sceneContext.Scene.UndoBuffer;

            bool allowOperations = true;

            // put in a color edit field
            var colorField = new ColorField(theme, selectedItem.Color);

            colorField.Initialize(0);
            colorField.ValueChanged += (s, e) =>
            {
                if (selectedItem.Color != colorField.Color)
                {
                    undoBuffer.AddAndDo(new ChangeColor(selectedItem, colorField.Color));
                }
            };

            var colorRow = PublicPropertyEditor.CreateSettingsRow("Color".Localize());

            colorRow.AddChild(colorField.Content);
            colorField.Content.MouseDown += (s, e) =>
            {
                // make sure the render mode is set to shaded or outline
                if (sceneContext.ViewState.RenderType != RenderOpenGl.RenderTypes.Shaded &&
                    sceneContext.ViewState.RenderType != RenderOpenGl.RenderTypes.Outlines)
                {
                    // make sure the render mode is set to material
                    sceneContext.ViewState.RenderType = RenderOpenGl.RenderTypes.Outlines;
                }
            };
            editorPanel.AddChild(colorRow);

            // put in a material edit field
            var materialField = new MaterialIndexField(theme, selectedItem.MaterialIndex);

            materialField.Initialize(0);
            materialField.ValueChanged += (s, e) =>
            {
                if (selectedItem.MaterialIndex != materialField.MaterialIndex)
                {
                    undoBuffer.AddAndDo(new ChangeMaterial(selectedItem, materialField.MaterialIndex));
                }
            };

            var materialRow = PublicPropertyEditor.CreateSettingsRow("Material".Localize());

            materialRow.AddChild(materialField.Content);
            materialField.Content.MouseDown += (s, e) =>
            {
                if (sceneContext.ViewState.RenderType != RenderOpenGl.RenderTypes.Materials)
                {
                    // make sure the render mode is set to material
                    sceneContext.ViewState.RenderType = RenderOpenGl.RenderTypes.Materials;
                }
            };
            editorPanel.AddChild(materialRow);

            // put in the normal editor
            if (selectedItem is ComponentObject3D componentObject &&
                componentObject.Finalized)
            {
                allowOperations = false;

                foreach (var selector in componentObject.SurfacedEditors)
                {
                    // Get the named property via reflection
                    // Selector example:            '$.Children<CylinderObject3D>'
                    var match = pathResolver.Select(componentObject, selector).ToList();

                    //// TODO: Create editor row for each property
                    //// - Use the type of the property to find a matching editor (ideally all datatype -> editor functionality would resolve consistently)
                    //// - Add editor row for each

                    foreach (var instance in match)
                    {
                        if (instance is IObject3D object3D)
                        {
                            if (ApplicationController.Instance.GetEditorsForType(object3D.GetType())?.FirstOrDefault() is IObject3DEditor editor)
                            {
                                ShowObjectEditor((editor, object3D, object3D.Name), selectedItem, allowOperations: allowOperations);
                            }
                        }
                        else if (JsonPath.JsonPathContext.ReflectionValueSystem.LastMemberValue is ReflectionTarget reflectionTarget)
                        {
                            var context = new PPEContext();

                            if (reflectionTarget.Source is IObject3D editedChild)
                            {
                                context.item = editedChild;
                            }
                            else
                            {
                                context.item = item;
                            }

                            var editableProperty = new EditableProperty(reflectionTarget.PropertyInfo, reflectionTarget.Source);

                            var editor = PublicPropertyEditor.CreatePropertyEditor(editableProperty, undoBuffer, context, theme);
                            if (editor != null)
                            {
                                editorPanel.AddChild(editor);
                            }
                        }
                    }
                }

                // Enforce panel padding
                foreach (var sectionWidget in editorPanel.Descendants <SectionWidget>())
                {
                    sectionWidget.Margin = new BorderDouble(0, theme.DefaultContainerPadding / 2);
                }
            }
Exemplo n.º 13
0
 public TLSample(string name, float time, float value)
     : base(name, time)
 {
     Value = new EditableProperty<float>("Value", value);
     Add(Time);
     Add(Value);
 }
Exemplo n.º 14
0
 public IconEnumField(EditableProperty property, IconsAttribute iconsAttribute, ThemeConfig theme)
 {
     this.property       = property;
     this.iconsAttribute = iconsAttribute;
     this.theme          = theme;
 }
Exemplo n.º 15
0
 public FontSelectorField(EditableProperty property, ThemeConfig theme)
 {
     this.property = property;
     this.theme    = theme;
 }
Exemplo n.º 16
0
        public TLValueTrack(string name)
            : base(name)
        {
            Keyframes = new EditableIDList<TLValueKeyframe>("Keyframes");
            Curves = new EditableIDList<TLCurve>("Curves");
            Minimum = new EditableProperty<float>("Minimum");
            Minimum.Value = -1f;
            Maximum = new EditableProperty<float>("Maximum");
            Maximum.Value = 1f;
            Add(Keyframes);
            Add(Curves);
            Add(Minimum);
            Add(Maximum);
            Keyframes.Added += Keyframes_Added;
            Keyframes.Removed += Keyframes_Removed;

            Label.Value = "Value " + name;
        }
Exemplo n.º 17
0
        public TLValueKeyframe(string name, float time, float value)
            : base(name, time)
        {
            Value = new EditableProperty<float>("Value", value);
            Add(Value);

            Ease = new EditableProperty<int>("Ease", 0);
            Add(Ease);

            //handles should probably be clamped to 0.5
            EaseIn = new EditableProperty<Vector2D>("EaseIn", new Vector2D(-1, 0));
            Add(EaseIn);

            EaseOut = new EditableProperty<Vector2D>("EaseOut", new Vector2D(1, 0));
            Add(EaseOut);
        }
Exemplo n.º 18
0
        public void SetActiveItem(ISceneContext sceneContext)
        {
            var selectedItem = sceneContext?.Scene?.SelectedItem;

            if (this.item == selectedItem)
            {
                return;
            }

            this.item = selectedItem;
            editorPanel.CloseChildren();

            // Allow caller to clean up with passing null for selectedItem
            if (item == null)
            {
                editorSectionWidget.Text = editorTitle;
                return;
            }

            var selectedItemType = selectedItem.GetType();

            primaryActionsPanel.RemoveChildren();

            IEnumerable <SceneOperation> primaryActions;

            if ((primaryActions = SceneOperations.GetPrimaryOperations(selectedItemType)) == null)
            {
                primaryActions = new List <SceneOperation>();
            }
            else
            {
                // Loop over primary actions creating a button for each
                foreach (var primaryAction in primaryActions)
                {
                    // TODO: Run visible/enable rules on actions, conditionally add/enable as appropriate
                    var button = new IconButton(primaryAction.Icon(theme.InvertIcons), theme)
                    {
                        // Name = namedAction.Title + " Button",
                        ToolTipText     = primaryAction.Title,
                        Margin          = theme.ButtonSpacing,
                        BackgroundColor = theme.ToolbarButtonBackground,
                        HoverColor      = theme.ToolbarButtonHover,
                        MouseDownColor  = theme.ToolbarButtonDown,
                    };

                    button.Click += (s, e) =>
                    {
                        primaryAction.Action.Invoke(sceneContext);
                    };

                    primaryActionsPanel.AddChild(button);
                }
            }

            if (primaryActionsPanel.Children.Any())
            {
                // add in a separator from the apply and cancel buttons
                primaryActionsPanel.AddChild(new ToolbarSeparator(theme.GetBorderColor(50), theme.SeparatorMargin));
            }

            editorSectionWidget.Text = selectedItem.Name ?? selectedItemType.Name;

            HashSet <IObject3DEditor> mappedEditors = ApplicationController.Instance.Extensions.GetEditorsForType(selectedItemType);

            var undoBuffer = sceneContext.Scene.UndoBuffer;

            // put in a color edit field
            var colorField = new ColorField(theme, selectedItem.Color);

            colorField.Initialize(0);
            colorField.ValueChanged += (s, e) =>
            {
                if (selectedItem.Color != colorField.Color)
                {
                    undoBuffer.AddAndDo(new ChangeColor(selectedItem, colorField.Color));
                }
            };

            colorField.Content.MouseDown += (s, e) =>
            {
                // make sure the render mode is set to shaded or outline
                if (sceneContext.ViewState.RenderType != RenderOpenGl.RenderTypes.Shaded &&
                    sceneContext.ViewState.RenderType != RenderOpenGl.RenderTypes.Outlines)
                {
                    // make sure the render mode is set to outline
                    sceneContext.ViewState.RenderType = RenderOpenGl.RenderTypes.Outlines;
                }
            };

            // color row
            var row = new SettingsRow("Color".Localize(), null, colorField.Content, theme);

            // Special top border style for first item in editor
            row.Border = new BorderDouble(0, 1);

            editorPanel.AddChild(row);

            // put in a material edit field
            var materialField = new MaterialIndexField(sceneContext.Printer, theme, selectedItem.MaterialIndex);

            materialField.Initialize(0);
            materialField.ValueChanged += (s, e) =>
            {
                if (selectedItem.MaterialIndex != materialField.MaterialIndex)
                {
                    undoBuffer.AddAndDo(new ChangeMaterial(selectedItem, materialField.MaterialIndex));
                }
            };

            materialField.Content.MouseDown += (s, e) =>
            {
                if (sceneContext.ViewState.RenderType != RenderOpenGl.RenderTypes.Materials)
                {
                    // make sure the render mode is set to material
                    sceneContext.ViewState.RenderType = RenderOpenGl.RenderTypes.Materials;
                }
            };

            // material row
            editorPanel.AddChild(
                new SettingsRow("Material".Localize(), null, materialField.Content, theme));

            // put in the normal editor
            if (selectedItem is ComponentObject3D componentObject &&
                componentObject.Finalized)
            {
                PublicPropertyEditor.AddUnlockLinkIfRequired(selectedItem, editorPanel, theme);
                foreach (var selector in componentObject.SurfacedEditors)
                {
                    // Get the named property via reflection
                    // Selector example:            '$.Children<CylinderObject3D>'
                    var match = pathResolver.Select(componentObject, selector).ToList();

                    //// TODO: Create editor row for each property
                    //// - Use the type of the property to find a matching editor (ideally all datatype -> editor functionality would resolve consistently)
                    //// - Add editor row for each

                    foreach (var instance in match)
                    {
                        if (instance is IObject3D object3D)
                        {
                            if (ApplicationController.Instance.Extensions.GetEditorsForType(object3D.GetType())?.FirstOrDefault() is IObject3DEditor editor)
                            {
                                ShowObjectEditor((editor, object3D, object3D.Name), selectedItem);
                            }
                        }
                        else if (JsonPath.JsonPathContext.ReflectionValueSystem.LastMemberValue is ReflectionTarget reflectionTarget)
                        {
                            var context = new PPEContext();

                            if (reflectionTarget.Source is IObject3D editedChild)
                            {
                                context.item = editedChild;
                            }
                            else
                            {
                                context.item = item;
                            }

                            var editableProperty = new EditableProperty(reflectionTarget.PropertyInfo, reflectionTarget.Source);

                            var editor = PublicPropertyEditor.CreatePropertyEditor(editableProperty, undoBuffer, context, theme);
                            if (editor != null)
                            {
                                editorPanel.AddChild(editor);
                            }
                        }
                    }
                }

                // Enforce panel padding
                foreach (var sectionWidget in editorPanel.Descendants <SectionWidget>())
                {
                    sectionWidget.Margin = 0;
                }
            }
Exemplo n.º 19
0
 /// <summary>
 /// Callback to remove a resource.
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="property"></param>
 private void removeResource(EditUICallback callback, EditableProperty property)
 {
     removeResource(editInterface.getKeyObjectForProperty <Resource>(property).LocName);
 }
Exemplo n.º 20
0
 void currentEditInterface_OnPropertyRemoved(EditableProperty property)
 {
     removeProperty(property);
     propertiesTable.layout();
 }
Exemplo n.º 21
0
 public EnumField(EditableProperty property, ThemeConfig theme)
 {
     this.property = property;
     this.theme    = theme;
 }
Exemplo n.º 22
0
 public ChildrenSelectorListField(EditableProperty property, ThemeConfig theme)
 {
     this.property = property;
     this.theme    = theme;
 }
Exemplo n.º 23
0
 abstract public void AddProperty(string name, EditableProperty property);
Exemplo n.º 24
0
 void currentEditInterface_OnPropertyAdded(EditableProperty property)
 {
     addProperty(property);
     propertiesTable.layout();
 }
Exemplo n.º 25
0
        public void SetActiveItem(ISceneContext sceneContext)
        {
            var selectedItem = sceneContext?.Scene?.SelectedItem;

            if (this.item == selectedItem)
            {
                return;
            }

            this.item = selectedItem;
            editorPanel.CloseChildren();

            // Allow caller to clean up with passing null for selectedItem
            if (item == null)
            {
                editorSectionWidget.Text = editorTitle;
                return;
            }

            var selectedItemType = selectedItem.GetType();

            primaryActionsPanel.RemoveChildren();

            IEnumerable <SceneOperation> primaryActions;

            if ((primaryActions = SceneOperations.GetPrimaryOperations(selectedItemType)) == null)
            {
                primaryActions = new List <SceneOperation>();
            }
            else
            {
                // Loop over primary actions creating a button for each
                foreach (var primaryAction in primaryActions)
                {
                    // TODO: Run visible/enable rules on actions, conditionally add/enable as appropriate
                    var button = new IconButton(primaryAction.Icon(theme), theme)
                    {
                        // Name = namedAction.Title + " Button",
                        ToolTipText     = primaryAction.Title,
                        Margin          = theme.ButtonSpacing,
                        BackgroundColor = theme.ToolbarButtonBackground,
                        HoverColor      = theme.ToolbarButtonHover,
                        MouseDownColor  = theme.ToolbarButtonDown,
                    };

                    button.Click += (s, e) =>
                    {
                        primaryAction.Action.Invoke(sceneContext);
                    };

                    primaryActionsPanel.AddChild(button);
                }
            }

            if (primaryActionsPanel.Children.Any())
            {
                // add in a separator from the apply and cancel buttons
                primaryActionsPanel.AddChild(new ToolbarSeparator(theme.GetBorderColor(50), theme.SeparatorMargin));
            }

            editorSectionWidget.Text = selectedItem.Name ?? selectedItemType.Name;

            HashSet <IObject3DEditor> mappedEditors = ApplicationController.Instance.Extensions.GetEditorsForType(selectedItemType);

            var undoBuffer = sceneContext.Scene.UndoBuffer;

            if (!(selectedItem.GetType().GetCustomAttributes(typeof(HideMeterialAndColor), true).FirstOrDefault() is HideMeterialAndColor))
            {
                // put in a color edit field
                var colorField = new ColorField(theme, selectedItem.Color);
                colorField.Initialize(0);
                colorField.ValueChanged += (s, e) =>
                {
                    if (selectedItem.Color != colorField.Color)
                    {
                        undoBuffer.AddAndDo(new ChangeColor(selectedItem, colorField.Color));
                    }
                };

                colorField.Content.MouseDown += (s, e) =>
                {
                    // make sure the render mode is set to shaded or outline
                    if (sceneContext.ViewState.RenderType != RenderOpenGl.RenderTypes.Shaded &&
                        sceneContext.ViewState.RenderType != RenderOpenGl.RenderTypes.Outlines)
                    {
                        // make sure the render mode is set to outline
                        sceneContext.ViewState.RenderType = RenderOpenGl.RenderTypes.Outlines;
                    }
                };

                // color row
                var row = new SettingsRow("Color".Localize(), null, colorField.Content, theme);

                // Special top border style for first item in editor
                row.Border = new BorderDouble(0, 1);

                editorPanel.AddChild(row);

                // put in a material edit field
                var materialField = new MaterialIndexField(sceneContext.Printer, theme, selectedItem.MaterialIndex);
                materialField.Initialize(0);
                materialField.ValueChanged += (s, e) =>
                {
                    if (selectedItem.MaterialIndex != materialField.MaterialIndex)
                    {
                        undoBuffer.AddAndDo(new ChangeMaterial(selectedItem, materialField.MaterialIndex));
                    }
                };

                materialField.Content.MouseDown += (s, e) =>
                {
                    if (sceneContext.ViewState.RenderType != RenderOpenGl.RenderTypes.Materials)
                    {
                        // make sure the render mode is set to material
                        sceneContext.ViewState.RenderType = RenderOpenGl.RenderTypes.Materials;
                    }
                };

                // material row
                editorPanel.AddChild(
                    new SettingsRow("Material".Localize(), null, materialField.Content, theme));
            }

            var rows = new SafeList <SettingsRow>();

            // put in the normal editor
            if (selectedItem is ComponentObject3D componentObject &&
                componentObject.Finalized)
            {
                var context = new PPEContext();
                PublicPropertyEditor.AddUnlockLinkIfRequired(selectedItem, editorPanel, theme);
                foreach (var selector in componentObject.SurfacedEditors)
                {
                    // if it is a reference to a sheet cell
                    if (selector.StartsWith("!"))
                    {
                        var firtSheet = componentObject.Descendants <SheetObject3D>().FirstOrDefault();
                        if (firtSheet != null)
                        {
                            var cellId = selector.Substring(1);
                            var cell   = firtSheet.SheetData[cellId];
                            if (cell != null)
                            {
                                // add an editor for the cell
                                var field = new DoubleField(theme);
                                field.Initialize(0);
                                double.TryParse(firtSheet.SheetData.EvaluateExpression(cellId), out double value);
                                field.DoubleValue = value;
                                field.ClearUndoHistory();

                                field.Content.Descendants <InternalNumberEdit>().First().MaxDecimalsPlaces = 3;
                                field.ValueChanged += (s, e) =>
                                {
                                    cell.Expression = field.Value;
                                    firtSheet.SheetData.Recalculate();
                                };

                                var row = new SettingsRow(cell.Name == null ? cellId : cell.Name, null, field.Content, theme);

                                editorPanel.AddChild(row);
                            }
                        }
                    }
                    else                     // parse it as a path to an object
                    {
                        // Get the named property via reflection
                        // Selector example:            '$.Children<CylinderObject3D>'
                        var match = pathResolver.Select(componentObject, selector).ToList();

                        //// - Add editor row for each
                        foreach (var instance in match)
                        {
                            if (instance is IObject3D object3D)
                            {
                                if (ApplicationController.Instance.Extensions.GetEditorsForType(object3D.GetType())?.FirstOrDefault() is IObject3DEditor editor)
                                {
                                    ShowObjectEditor((editor, object3D, object3D.Name), selectedItem);
                                }
                            }
                            else if (JsonPathContext.ReflectionValueSystem.LastMemberValue is ReflectionTarget reflectionTarget)
                            {
                                if (reflectionTarget.Source is IObject3D editedChild)
                                {
                                    context.item = editedChild;
                                }
                                else
                                {
                                    context.item = item;
                                }

                                var editableProperty = new EditableProperty(reflectionTarget.PropertyInfo, reflectionTarget.Source);

                                var editor = PublicPropertyEditor.CreatePropertyEditor(rows, editableProperty, undoBuffer, context, theme);
                                if (editor != null)
                                {
                                    editorPanel.AddChild(editor);
                                }

                                // Init with custom 'UpdateControls' hooks
                                (context.item as IPropertyGridModifier)?.UpdateControls(new PublicPropertyChange(context, "Update_Button"));
                            }
                        }
                    }
                }

                // Enforce panel padding
                foreach (var sectionWidget in editorPanel.Descendants <SectionWidget>())
                {
                    sectionWidget.Margin = 0;
                }
            }
Exemplo n.º 26
0
 public IconEnumField(EditableProperty property, IconsAttribute iconsAttribute)
 {
     this.property       = property;
     this.iconsAttribute = iconsAttribute;
 }
Exemplo n.º 27
0
 public EditTableBrowserCell(EditUICallback uiCallback, EditableProperty editProperty)
 {
     this.uiCallback   = uiCallback;
     this.editProperty = editProperty;
 }
Exemplo n.º 28
0
 private void OnGeoPointLabelChanged(EditableProperty<GeoPoint>sender, string newLabel)
 {
     OnLabelChanged(sender.UserData.GetData("Name") as string, newLabel);
 }
Exemplo n.º 29
0
 public ConstrainableFormComponent(EditableProperty property, Widget parent, String layoutFile)
     : base(property, parent, layoutFile)
 {
 }
Exemplo n.º 30
0
 private void OnLengthLabelChanged(EditableProperty<double> sender, string newLabel)
 {
     OnLabelChanged(sender.UserData.GetData("Name") as string, newLabel);
 }
Exemplo n.º 31
0
 public EnumField(EditableProperty property)
 {
     this.property = property;
 }
Exemplo n.º 32
0
 public EnumDisplayField(EditableProperty property, EnumDisplayAttribute iconsAttribute, ThemeConfig theme)
 {
     this.property            = property;
     this.enumDisplayAttibute = iconsAttribute;
     this.theme = theme;
 }
Exemplo n.º 33
0
        public void SetActiveItem(IObject3D selectedItem)
        {
            this.item = selectedItem;
            editorPanel.CloseAllChildren();

            // Allow caller to clean up with passing null for selectedItem
            if (item == null)
            {
                return;
            }

            var selectedItemType = selectedItem.GetType();

            editorSectionWidget.Text = selectedItem.Name ?? selectedItemType.Name;

            HashSet <IObject3DEditor> mappedEditors = ApplicationController.Instance.GetEditorsForType(selectedItemType);

            var undoBuffer = sceneContext.Scene.UndoBuffer;

            bool allowOperations = true;

            if (selectedItem is ComponentObject3D componentObject &&
                componentObject.Finalized)
            {
                allowOperations = false;

                foreach (var selector in componentObject.SurfacedEditors)
                {
                    // Get the named property via reflection
                    // Selector example:            '$.Children<CylinderObject3D>'
                    var match = xpathLikeResolver.Select(componentObject, selector).ToList();

                    //// TODO: Create editor row for each property
                    //// - Use the type of the property to find a matching editor (ideally all datatype -> editor functionality would resolve consistently)
                    //// - Add editor row for each

                    foreach (var instance in match)
                    {
                        if (instance is IObject3D object3D)
                        {
                            if (ApplicationController.Instance.GetEditorsForType(object3D.GetType())?.FirstOrDefault() is IObject3DEditor editor)
                            {
                                ShowObjectEditor((editor, object3D, object3D.Name), selectedItem, allowOperations: allowOperations);
                            }
                        }
                        else if (JsonPath.JsonPathContext.ReflectionValueSystem.LastMemberValue is ReflectionTarget reflectionTarget)
                        {
                            var context = new PPEContext();

                            if (reflectionTarget.Source is IObject3D editedChild)
                            {
                                context.item = editedChild;
                            }
                            else
                            {
                                context.item = item;
                            }

                            var editableProperty = new EditableProperty(reflectionTarget.PropertyInfo, reflectionTarget.Source);

                            var editor = PublicPropertyEditor.CreatePropertyEditor(editableProperty, undoBuffer, context, theme);
                            if (editor != null)
                            {
                                editorPanel.AddChild(editor);
                            }
                        }
                    }
                }

                // Enforce panel padding
                foreach (var sectionWidget in editorPanel.Descendants <SectionWidget>())
                {
                    sectionWidget.Margin = new BorderDouble(0, theme.DefaultContainerPadding / 2);
                }
            }
Exemplo n.º 34
0
 public TLStringKeyframe(string name, float time, string text)
     : base(name, time)
 {
     Text = new EditableProperty<string>("Text", text);
     Add(Text);
 }