Example #1
0
        private void Shape_OnEndEdit(object sender, OnShapeEndEdit e)
        {
            ShapeEditorWindow _sender = (ShapeEditorWindow)sender;

            Editors.Remove(_sender);

            if (e.DialogResult != DialogResult.OK)
            {
                return;
            }

            modified = true;
            bool exists = false;

            for (int i = 0; i < Data.Shapes.Length; i++)
            {
                if (Data.Shapes[i].GUID.ToUpper() == e.Data.GUID.ToUpper())
                {
                    exists         = true;
                    Data.Shapes[i] = e.Data;
                }
            }

            if (!exists)
            {
                Array.Resize <Shape>(ref Data.Shapes, Data.Shapes.Length + 1);
                Data.Shapes[Data.Shapes.Length - 1] = e.Data;
            }

            UpdateFields();
        }
Example #2
0
        private void AddShapeButton_Click(object sender, EventArgs e)
        {
            ShapeEditorWindow shapeEditorWindow = new ShapeEditorWindow(this);

            shapeEditorWindow.OnEndEdit += Shape_OnEndEdit;
            shapeEditorWindow.Show();
            Editors.Add(shapeEditorWindow);
        }
Example #3
0
 public EntityEditorTab(TabControl Parent, ShapeEditorWindow Root)
 {
     this.Parent = Parent;
     this.Root   = Root;
     this.Data   = new MatchEntity();
     InitializeComponent();
     FillValues();
 }
Example #4
0
 public EntityEditorTab(TabControl Parent, ShapeEditorWindow Root, Entity Data, int Index)
 {
     SourceIndex = Index;
     this.Parent = Parent;
     this.Root   = Root;
     this.Data   = Data;
     InitializeComponent();
     FillValues();
 }
Example #5
0
        private void EditShapeButton_Click(object sender, EventArgs e)
        {
            string guid = (string)ShapeView.Rows[ShapeView.CurrentCell.RowIndex].Cells[0].Value;

            bool found = false;

            foreach (Shape shape in Data.Shapes)
            {
                if (shape.GUID.ToUpper() == guid.ToUpper())
                {
                    ShapeEditorWindow shapeEditor = new ShapeEditorWindow(this, shape);
                    shapeEditor.OnEndEdit += Shape_OnEndEdit;
                    Editors.Add(shapeEditor);
                    shapeEditor.Show();
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                MessageBox.Show("Could not find shape with GUID: \"" + guid.ToUpper() + "\".", "Error!");
            }
        }