Beispiel #1
0
 public void UnselectEveryoneExceptMe(LayoutEditor.LayoutEditor editor)
 {
     foreach (var l in LayoutEditors)
     {
         if (l != editor)
         {
             l.SetSelectedIndex(-1);
         }
     }
 }
Beispiel #2
0
 public void SetLayoutEditorStripItemName(LayoutEditor.LayoutEditor sender, string newName)
 {
     foreach (ToolStripDropDownItem t in LayoutEditorDict.Keys)
     {
         if (LayoutEditorDict[t].Equals(sender))
         {
             t.Text = newName;
             return;
         }
     }
     throw new Exception("Error renaming layout editor");
 }
Beispiel #3
0
 public void CloseLayoutEditor(LayoutEditor.LayoutEditor sender)
 {
     foreach (ToolStripDropDownItem t in LayoutEditorDict.Keys)
     {
         if (LayoutEditorDict[t].Equals(sender))
         {
             LayoutEditorDict.Remove(t);
             layoutEditorToolStripMenuItem.DropDownItems.Remove(t);
             return;
         }
     }
     throw new Exception("Error closing layout editor");
 }
Beispiel #4
0
        public void AddLayoutEditor(string filePath = null, bool show = false)
        {
            ToolStripMenuItem tempMenuItem = new ToolStripMenuItem("No file loaded");

            tempMenuItem.Click += new EventHandler(LayoutEditorToolStripMenuItemClick);
            layoutEditorToolStripMenuItem.DropDownItems.Add(tempMenuItem);

            LayoutEditor.LayoutEditor tempLayoutEditor = new LayoutEditor.LayoutEditor();

            LayoutEditorDict.Add(tempMenuItem, tempLayoutEditor);
            if (show)
            {
                LayoutEditorDict[tempMenuItem].Show();
            }

            if (filePath != null)
            {
                tempLayoutEditor.OpenFile(filePath, this);
            }
        }
Beispiel #5
0
        private void ScreenClickedSelectObject(Ray ray, bool isMouseDown)
        {
            // select object in layout editor
            float minDistance = 40000f;
            int   index       = -1;

            LayoutEditor.LayoutEditor e = null;

            foreach (var l in LayoutEditors)
            {
                l.ScreenClicked(renderer, ray, isMouseDown, renderer.ShowObjects == CheckState.Checked, out float distance, out int newIndex);
                if (newIndex != -1 && distance < minDistance)
                {
                    index       = newIndex;
                    minDistance = distance;
                    e           = l;
                }
            }

            if (!isMouseDown)
            {
                foreach (var l in LayoutEditors)
                {
                    if (l.finishedMovingGizmo)
                    {
                        l.finishedMovingGizmo = false;
                    }
                    else if (l == e)
                    {
                        l.SetSelectedIndex(index);
                    }
                    else
                    {
                        l.SetSelectedIndex(-1);
                    }
                }
            }
        }