private void AddItem(ObjectEditor.Json.DataObject obj, int index, bool select, bool report = true)
        {
            List <Json.DataObject> objs = new List <Json.DataObject>();

            objs.Add(obj);
            AddItems(objs, index, select, report);
        }
        private void UpdateSelectedItemText()
        {
            ObjectEditor.Json.DataObject obj = CurrentItem;
            if (obj == null)
            {
                return;
            }
            int    index = listBoxList.SelectedIndex;
            string name  = SafeName(obj);

            if ((string)listBoxList.Items[index] != name)
            {
                listBoxList.SelectedIndexChanged -= listBoxList_SelectedIndexChanged;
                listBoxList.Items[index]          = name;
                listBoxList.SelectedIndex         = index;
                listBoxList.SelectedIndexChanged += listBoxList_SelectedIndexChanged;
            }
        }
        private void UpdateSelectedListItem()
        {
            int  index   = listBoxList.SelectedIndex;
            bool enabled = index >= 0;

            this.buttonDelete.Enabled = this.buttonUp.Enabled = this.buttonDown.Enabled = enabled;
            if (!enabled)
            {
                Controls.Remove(nextEditor);
                return;
            }

            if (index == 0)
            {
                this.buttonUp.Enabled = false;
            }
            if (index == CurrentList.Count - 1)
            {
                this.buttonDown.Enabled = false;
            }
            if (listBoxList.SelectedIndices.Count > 1)
            {
                this.buttonUp.Enabled   = false;
                this.buttonDown.Enabled = false;
            }

            ObjectEditor.Json.DataObject obj = CurrentItem;
            if (nextEditor == null)
            {
                nextEditor                 = new DataObjectEditor(this);
                nextEditor.Anchor          = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom;
                nextEditor.Height          = Height;
                nextEditor.Holder          = this;
                nextEditor.OnObjectEdited += (sender, e) => OnItemEdited(e);
                nextEditor.Location        = new Point(groupBox.Width + 5, 0);
            }
            if (nextEditor.Parent == null)
            {
                this.Collapsed = true;
                Controls.Add(nextEditor);
            }
            if (AutoCollapse)
            {
                if (nextEditor.nextEditor == null || nextEditor.nextEditor.Parent == null)
                {
                    nextEditor.Collapsed = false;
                }
            }
            nextEditor.DataObject = obj;

            //Console.WriteLine(ParentForm.HorizontalScroll.Value);
            //Console.WriteLine(ParentForm.HorizontalScroll.Minimum + ", " + ParentForm.HorizontalScroll.Maximum);
            //int relX = listBoxList.FindForm().PointToClient(
            //    listBoxList.Parent.PointToScreen(listBoxList.Location)).X;
            //Console.WriteLine(relX);
            //Console.WriteLine(ParentForm.HorizontalScroll.Value);
            //int value = ParentForm.HorizontalScroll.Value + relX - 75;
            //ParentForm.HorizontalScroll.Value = Math.Max(ParentForm.HorizontalScroll.Minimum, Math.Min(ParentForm.HorizontalScroll.Maximum, value));
            //Console.WriteLine(value + " / " + ParentForm.HorizontalScroll.Value);
            //ParentForm.Refresh();
        }