<commit_before>﻿using System;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Xml.Linq;
using System.Windows.Forms;
using System.Collections.Generic;

using WeifenLuo.WinFormsUI.Docking;
using AdamsLair.WinForms.PropertyEditing;
using PropertyGrid = AdamsLair.WinForms.PropertyEditing;

using Duality;
using Duality.Resources;
using Duality.Editor;

namespace Duality.Editor.Plugins.ObjectInspector
{
	public partial class ObjectInspector : DockContent
	{
		private	int							runtimeId			= 0;
		private	double						lastAutoRefresh		= 0.0d;
		private	ObjectSelection.Category	selSchedMouseCat	= ObjectSelection.Category.None;
		private	ObjectSelection				selSchedMouse		= null;
		private	ObjectSelection				displaySel			= null;
		private	ObjectSelection.Category	displayCat			= ObjectSelection.Category.None;

		private	ExpandState					gridExpandState		= new ExpandState();


		public bool LockedSelection
		{
			get { return this.buttonLock.Checked; }
			set { this.buttonLock.Checked = value; }
		}
		public ObjectSelection DisplayedSelection
		{
			get { return (this.timerSelectSched.Enabled || this.selSchedMouse != null) ? this.selSchedMouse : this.displaySel; }
			set { this.UpdateSelection(value, value.Categories); }
		}
		public ObjectSelection.Category DisplayedCategory
		{
			get { return (this.timerSelectSched.Enabled || this.selSchedMouse != null) ? this.selSchedMouseCat : this.displayCat; }
		}
		public bool EmptySelection
		{
			get { return (this.displaySel == null || this.displaySel.Empty) && (!this.timerSelectSched.Enabled || this.selSchedMouse == null); }
		}


		public ObjectInspector(int runtimeId)
		{
			this.InitializeComponent();
			this.runtimeId = runtimeId;
			this.toolStrip.Renderer = new Duality.Editor.Controls.ToolStrip.DualitorToolStripProfessionalRenderer();
		}
		public void CopyTo(ObjectInspector other)
		{
			this.gridExpandState.UpdateFrom(this.propertyGrid.MainEditor);

			other.buttonAutoRefresh.Checked = this.buttonAutoRefresh.Checked;
			other.buttonLock.Checked = this.buttonLock.Checked;

			this.gridExpandState.CopyTo(other.gridExpandState);
		}

		public bool AcceptsSelection(ObjectSelection sel)
		{
			if (this.LockedSelection) return false;
			return true;
		}

		protected override void OnShown(EventArgs e)
		{
			base.OnShown(e);

			this.UpdateButtons();

			// Add the global selection event once
			DualityEditorApp.SelectionChanged -= GlobalUpdateSelection;
			DualityEditorApp.SelectionChanged += GlobalUpdateSelection;

			DualityEditorApp.UpdatingEngine += this.EditorForm_AfterUpdateDualityApp;
			DualityEditorApp.ObjectPropertyChanged += this.EditorForm_ObjectPropertyChanged;
			FileEventManager.ResourceModified += this.EditorForm_ResourceModified;
			DualityEditorApp.Terminating += this.DualityEditorApp_Terminating;

			// Select something initially, if not done yet
			if (this.propertyGrid.Selection.Count() == 0)<commit_msg>Object Inspector Clone Fixes #FIX: When cloning an object inspector, debug and sorting modes are copied as well.<commit_after>﻿using System;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Xml.Linq;
using System.Windows.Forms;
using System.Collections.Generic;

using WeifenLuo.WinFormsUI.Docking;
using AdamsLair.WinForms.PropertyEditing;
using PropertyGrid = AdamsLair.WinForms.PropertyEditing;

using Duality;
using Duality.Resources;
using Duality.Editor;

namespace Duality.Editor.Plugins.ObjectInspector
{
	public partial class ObjectInspector : DockContent
	{
		private	int							runtimeId			= 0;
		private	double						lastAutoRefresh		= 0.0d;
		private	ObjectSelection.Category	selSchedMouseCat	= ObjectSelection.Category.None;
		private	ObjectSelection				selSchedMouse		= null;
		private	ObjectSelection				displaySel			= null;
		private	ObjectSelection.Category	displayCat			= ObjectSelection.Category.None;

		private	ExpandState					gridExpandState		= new ExpandState();


		public bool LockedSelection
		{
			get { return this.buttonLock.Checked; }
			set { this.buttonLock.Checked = value; }
		}
		public ObjectSelection DisplayedSelection
		{
			get { return (this.timerSelectSched.Enabled || this.selSchedMouse != null) ? this.selSchedMouse : this.displaySel; }
			set { this.UpdateSelection(value, value.Categories); }
		}
		public ObjectSelection.Category DisplayedCategory
		{
			get { return (this.timerSelectSched.Enabled || this.selSchedMouse != null) ? this.selSchedMouseCat : this.displayCat; }
		}
		public bool EmptySelection
		{
			get { return (this.displaySel == null || this.displaySel.Empty) && (!this.timerSelectSched.Enabled || this.selSchedMouse == null); }
		}


		public ObjectInspector(int runtimeId)
		{
			this.InitializeComponent();
			this.runtimeId = runtimeId;
			this.toolStrip.Renderer = new Duality.Editor.Controls.ToolStrip.DualitorToolStripProfessionalRenderer();
		}
		public void CopyTo(ObjectInspector other)
		{
			this.gridExpandState.UpdateFrom(this.propertyGrid.MainEditor);

			other.buttonAutoRefresh.Checked = this.buttonAutoRefresh.Checked;
			other.buttonLock.Checked = this.buttonLock.Checked;
			other.buttonDebug.Checked = this.buttonDebug.Checked;
			other.buttonSortByName.Checked = this.buttonSortByName.Checked;

			this.gridExpandState.CopyTo(other.gridExpandState);
		}

		public bool AcceptsSelection(ObjectSelection sel)
		{
			if (this.LockedSelection) return false;
			return true;
		}

		protected override void OnShown(EventArgs e)
		{
			base.OnShown(e);

			this.UpdateButtons();

			// Add the global selection event once
			DualityEditorApp.SelectionChanged -= GlobalUpdateSelection;
			DualityEditorApp.SelectionChanged += GlobalUpdateSelection;

			DualityEditorApp.UpdatingEngine += this.EditorForm_AfterUpdateDualityApp;
			DualityEditorApp.ObjectPropertyChanged += this.EditorForm_ObjectPropertyChanged;
			FileEventManager.ResourceModified += this.EditorForm_ResourceModified;
			DualityEditorApp.Terminating += this.DualityEditorApp_Terminating;

			// Select something initially, if not done yet
			if (this.propertyGrid.Selection.Count() == 0)
{'fraction_non_alphanumeric': 0.08773940088394172, 'fraction_numerical': 0.0013095432967752496, 'mean_word_length': 4.726335520149953, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7486636', 'n_tokens_mistral': 2061, 'n_tokens_neox': 1763, 'n_words': 360}