Example #1
0
 private void Vector3DCollectionSidebarEditorItem_Load(object sender, EventArgs e)
 {
     if (!DesignMode)
     {
         if (Parent != null)
         {
             if (Parent.Parent != null)
             {
                 if (Parent.Parent is Vector3DCollectionSidebarEditor)
                 {
                     Vector3DCollectionSidebarEditor editorparent = (Vector3DCollectionSidebarEditor)Parent.Parent;
                     editorparent.SelectedCollection.CollectionChanged += SelectedCollection_CollectionChanged;
                 }
             }
         }
     }
 }
Example #2
0
 private void SelectedCollection_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (Parent != null)
     {
         if (Parent.Parent != null)
         {
             if (Parent.Parent is Vector3DCollectionSidebarEditor)
             {
                 Vector3DCollectionSidebarEditor editorparent = (Vector3DCollectionSidebarEditor)Parent.Parent;
                 if (_SelectedIndex < editorparent.SelectedCollection.Count)
                 {
                     XAxisEditor.Text  = editorparent.SelectedCollection[_SelectedIndex].x.ToString();
                     YAxisEditor.Text  = editorparent.SelectedCollection[_SelectedIndex].y.ToString();
                     ZAxisEditor.Text  = editorparent.SelectedCollection[_SelectedIndex].z.ToString();
                     SummaryLabel.Text = "X: " + XAxisEditor.Text + " Y: " + YAxisEditor.Text + " Z: " + ZAxisEditor.Text;
                 }
             }
         }
     }
 }
Example #3
0
 private void removeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (EditorUI.GetParentVD2DataIsReadOnly(this))
     {
         return;
     }
     if (Parent != null)
     {
         if (Parent.Parent != null)
         {
             if (Parent.Parent is Vector3DCollectionSidebarEditor)
             {
                 Vector3DCollectionSidebarEditor editorparent = (Vector3DCollectionSidebarEditor)Parent.Parent;
                 if ((_SelectedIndex >= 0) && (_SelectedIndex < editorparent.SelectedCollection.Count))
                 {
                     editorparent.SelectedCollection.RemoveAt(_SelectedIndex);
                 }
             }
         }
     }
 }
Example #4
0
 private void duplicateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (EditorUI.GetParentVD2DataIsReadOnly(this))
     {
         return;
     }
     if (Parent != null)
     {
         if (Parent.Parent != null)
         {
             if (Parent.Parent is Vector3DCollectionSidebarEditor)
             {
                 Vector3DCollectionSidebarEditor editorparent = (Vector3DCollectionSidebarEditor)Parent.Parent;
                 if ((_SelectedIndex >= 0) && (_SelectedIndex < editorparent.SelectedCollection.Count))
                 {
                     Vector3D vec = new Vector3D(editorparent.SelectedCollection[_SelectedIndex]);
                     editorparent.SelectedCollection.Add(vec);
                 }
             }
         }
     }
 }
Example #5
0
 private void OnDragDropped(object sender, DragEventArgs e)
 {
     if (EditorUI.GetParentVD2DataIsReadOnly(this))
     {
         return;
     }
     if (e.Data.GetDataPresent("System.Int32"))
     {
         object data = e.Data.GetData("System.Int32");
         if (data is Int32)
         {
             int idx = (int)data;
             if (idx != SelectedIndex)
             {
                 if (Parent != null)
                 {
                     if (Parent.Parent != null)
                     {
                         if (Parent.Parent is Vector3DCollectionSidebarEditor)
                         {
                             Vector3DCollectionSidebarEditor editorparent = (Vector3DCollectionSidebarEditor)Parent.Parent;
                             if ((idx >= 0) && (idx < editorparent.SelectedCollection.Count))
                             {
                                 editorparent.SelectedCollection.Move(idx, _SelectedIndex);
                             }
                         }
                     }
                 }
             }
             else
             {
                 ToggleCollectionsItemModeCollapse();//user is trying to click this to collapse
             }
         }
     }
 }
Example #6
0
        private void DoTextToFloatInput(byte axis)
        {
            if (EditorUI.GetParentVD2DataIsReadOnly(this))
            {
                if (Parent != null)
                {
                    if (Parent.Parent != null)
                    {
                        if (Parent.Parent is Vector3DCollectionSidebarEditor)
                        {
                            Vector3DCollectionSidebarEditor editorparent = (Vector3DCollectionSidebarEditor)Parent.Parent;
                            if (_SelectedIndex < editorparent.SelectedCollection.Count)
                            {
                                XAxisEditor.Text  = editorparent.SelectedCollection[_SelectedIndex].x.ToString();
                                YAxisEditor.Text  = editorparent.SelectedCollection[_SelectedIndex].y.ToString();
                                ZAxisEditor.Text  = editorparent.SelectedCollection[_SelectedIndex].z.ToString();
                                SummaryLabel.Text = "X: " + XAxisEditor.Text + " Y: " + YAxisEditor.Text + " Z: " + ZAxisEditor.Text;
                            }
                        }
                    }
                }
                return;
            }
            if (Parent != null)
            {
                if (Parent.Parent != null)
                {
                    if (Parent.Parent is Vector3DCollectionSidebarEditor)
                    {
                        Vector3DCollectionSidebarEditor editorparent = (Vector3DCollectionSidebarEditor)Parent.Parent;
                        if (_SelectedIndex < editorparent.SelectedCollection.Count)
                        {
                            string texttoparse = "";
                            float  valuetotest = 0.0f;
                            switch (axis)
                            {
                            case 1:
                                texttoparse = XAxisEditor.Text;
                                valuetotest = editorparent.SelectedCollection[_SelectedIndex].x;
                                break;

                            case 2:
                                texttoparse = YAxisEditor.Text;
                                valuetotest = editorparent.SelectedCollection[_SelectedIndex].y;
                                break;

                            case 3:
                                texttoparse = ZAxisEditor.Text;
                                valuetotest = editorparent.SelectedCollection[_SelectedIndex].z;
                                break;
                            }
                            float parseresult;
                            if (float.TryParse(texttoparse, out parseresult))
                            {
                                if (valuetotest != parseresult)
                                {
                                    editorparent.SelectedCollection.CollectionChanged -= SelectedCollection_CollectionChanged;
                                    switch (axis)
                                    {
                                    case 1:
                                        editorparent.SelectedCollection[_SelectedIndex].x = parseresult;
                                        break;

                                    case 2:
                                        editorparent.SelectedCollection[_SelectedIndex].y = parseresult;
                                        break;

                                    case 3:
                                        editorparent.SelectedCollection[_SelectedIndex].z = parseresult;
                                        break;
                                    }
                                    SummaryLabel.Text = "X: " + XAxisEditor.Text + " Y: " + YAxisEditor.Text + " Z: " + ZAxisEditor.Text;
                                    editorparent.SelectedCollection.CollectionChanged += SelectedCollection_CollectionChanged;
                                }
                            }
                            else
                            {
                                switch (axis)
                                {
                                case 1:
                                    XAxisEditor.Text = editorparent.SelectedCollection[_SelectedIndex].x.ToString();
                                    break;

                                case 2:
                                    YAxisEditor.Text = editorparent.SelectedCollection[_SelectedIndex].y.ToString();
                                    break;

                                case 3:
                                    ZAxisEditor.Text = editorparent.SelectedCollection[_SelectedIndex].z.ToString();
                                    break;
                                }
                                SummaryLabel.Text = "X: " + XAxisEditor.Text + " Y: " + YAxisEditor.Text + " Z: " + ZAxisEditor.Text;
                            }
                        }
                    }
                }
            }
        }