Example #1
0
        protected virtual void OnDeleteRowClick(object sender, RoutedEventArgs e)
        {
            rMindRow row = (sender as Button)?.Tag as rMindRow;

            if (row == null)
            {
                return;
            }

            RemoveRow(row);
        }
Example #2
0
        public virtual void RemoveRow(rMindRow row)
        {
            if (!m_static)
            {
                Template.Children.Remove(row.DeleteButton);
            }
            row.DeleteButton.Click -= OnDeleteRowClick;
            RemoveNode(row.InputNode);
            RemoveNode(row.OutputNode);

            Template.Children.Remove(row.Content);
            Template.RowDefinitions.Remove(Template.RowDefinitions[GetRowIndex(row)]);

            m_rows.Remove(row);
            UpdateRowsIndexes();
        }
Example #3
0
        public Material(rMindBaseController parent) : base(parent)
        {
            var row = new rMindRow
            {
                InputNode = new Node(this)
                {
                    HLSLValueBaseType = HLSLValueBaseType.FLOAT4,
                    IDS             = "color",
                    Label           = "Color",
                    ConnectionType  = rMindNodeConnectionType.Container,
                    NodeOrientation = rMindNodeOriantation.Left,
                    Stroke          = new SolidColorBrush(Colors.White)
                },
                OutputNodeType = rMindNodeConnectionType.None
            };

            AddRow(row);
        }
Example #4
0
        public virtual rMindRow AddRow()
        {
            rMindRow row = null;

            if (AddRowTemplate == null)
            {
                row = new rMindRow()
                {
                    InputNodeType = rMindNodeConnectionType.Value,
                    Content       = new Rectangle()
                    {
                        Margin           = m_static ? new Thickness(2) : new Thickness(10, 2, 2, 2),
                        Fill             = new SolidColorBrush(Colors.CadetBlue),
                        IsHitTestVisible = false
                    }
                }
            }
            ;
            else
            {
                var temp = AddRowTemplate;
                row = new Content.Row.rMindRow
                {
                    InputNode = new Nodes.rMindBaseNode(this)
                    {
                        NodeType        = rMindNodeType.Input,
                        ConnectionType  = temp.InputNode.ConnectionType,
                        NodeOrientation = temp.InputNode.NodeOrientation,
                        AttachMode      = temp.InputNode.AttachMode,
                        Theme           = temp.InputNode.Theme
                    },
                    OutputNode = new Nodes.rMindBaseNode(this)
                    {
                        NodeType        = rMindNodeType.Output,
                        ConnectionType  = temp.OutputNode.ConnectionType,
                        NodeOrientation = temp.OutputNode.NodeOrientation,
                        AttachMode      = temp.OutputNode.AttachMode,
                        Theme           = temp.OutputNode.Theme
                    },
                };
            }

            return(AddRow(row));
        }
 protected override int GetRowIndex(rMindRow row)
 {
     return(base.GetRowIndex(row) + 1);
 }
Example #6
0
        public virtual rMindRow AddRow(rMindRow row)
        {
            m_rows.Add(row);
            // Данная секция добавлена чисто для тестирования
            AddRowDefinition();

            // Получаем строчку грида
            var idx_row = GetRowIndex(row);

            if (row.InputNodeType != rMindNodeConnectionType.None)
            {
                if (row.InputNode == null)
                {
                    row.InputNode = CreateNode(new Nodes.rMindNodeDesc {
                        ConnectionType  = row.InputNodeType,
                        NodeOrientation = rMindNodeOriantation.Left
                    });
                }
                else
                {
                    AddNode(row.InputNode);
                }

                row.InputNode.SetCell(0, idx_row);
            }

            if (row.OutputNodeType != rMindNodeConnectionType.None)
            {
                if (row.OutputNode == null)
                {
                    row.OutputNode = CreateNode(new Nodes.rMindNodeDesc {
                        ConnectionType  = row.OutputNodeType,
                        NodeOrientation = rMindNodeOriantation.Right
                    });
                }
                else
                {
                    AddNode(row.OutputNode);
                }

                row.OutputNode.SetCell(2, idx_row);
            }

            if (row.Content != null)
            {
                Grid.SetColumn(row.Content, 1);
                Grid.SetRow(row.Content, idx_row);
                Template.Children.Add(row.Content);
            }

            if (!m_static)
            {
                row.DeleteButton.Click += OnDeleteRowClick;
                Grid.SetColumn(row.DeleteButton, 1);

                Grid.SetRow(row.DeleteButton, idx_row);
                Template.Children.Add(row.DeleteButton);
            }

            if (m_rows.Count == 1)
            {
                m_base.Visibility = Visibility.Visible;
            }

            Grid.SetRowSpan(m_base, GetBaseRowSpan());
            Grid.SetRowSpan(m_selector, GetBaseRowSpan());

            if (!m_static)
            {
                Grid.SetRow(m_add_button, Template.RowDefinitions.Count - 1);
            }

            return(row);
        }
Example #7
0
 protected virtual int GetRowIndex(rMindRow row)
 {
     return(m_rows.IndexOf(row));
 }
Example #8
0
        public virtual rMindRow AddRow(rMindRow row)
        {
            m_rows.Add(row);
            // Данная секция добавлена чисто для тестирования
            if (m_rows.Count > 0)
            {
                // Если это не первая строка, то надо добавить строку в шаблон
                Template.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });
            }

            // Получаем строчку грида
            var idx_row = GetRowIndex(row);

            if (row.InputNodeType != rMindNodeConnectionType.None)
            {
                row.InputNode = CreateNode(new Nodes.rMindNodeDesc {
                    ConnectionType = row.InputNodeType
                });
                row.InputNode.SetCell(0, idx_row);
            }

            if (row.OutputNodeType != rMindNodeConnectionType.None)
            {
                row.OutputNode = CreateNode(new Nodes.rMindNodeDesc {
                    ConnectionType = row.OutputNodeType
                });
                row.OutputNode.SetCell(2, idx_row);
            }

            row.Content = new Rectangle()
            {
                Margin           = m_static ? new Thickness(2) : new Thickness(10, 2, 2, 2),
                Fill             = new SolidColorBrush(Colors.CadetBlue),
                IsHitTestVisible = false
            };

            Grid.SetColumn(row.Content, 1);
            Grid.SetRow(row.Content, idx_row);
            Template.Children.Add(row.Content);

            if (!m_static)
            {
                row.DeleteButton.Click += OnDeleteRowClick;
                Grid.SetColumn(row.DeleteButton, 1);

                Grid.SetRow(row.DeleteButton, idx_row);
                Template.Children.Add(row.DeleteButton);
            }

            if (m_rows.Count == 1)
            {
                m_base.Visibility = Visibility.Visible;
            }

            Grid.SetRowSpan(m_base, GetBaseRowSpan());
            Grid.SetRowSpan(m_selector, GetBaseRowSpan());

            if (!m_static)
            {
                Grid.SetRow(m_add_button, Template.RowDefinitions.Count - 1);
            }

            return(row);
        }