private void MakeStructureEditorsPage()
        {
            int x = 0;

            backgroundMaterialEditor = new BackgroundMaterialEditor();
            foreach (MaterialDataBinder binder in Materials)
            {
                backgroundMaterialEditor.Materials.Add(binder);
            }
            backgroundMaterialEditor.ProjectManifest = Application.OpenedProject.ProjectManifest;
            panelStructure.Controls.Add(backgroundMaterialEditor);
            backgroundMaterialEditor.Font           = new Font("Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
            backgroundMaterialEditor.Location       = new Point(0, 0);
            backgroundMaterialEditor.Margin         = new Padding(3, 4, 3, 4);
            backgroundMaterialEditor.Name           = "backgroundMaterialEditor";
            backgroundMaterialEditor.TabIndex       = 0;
            backgroundMaterialEditor.ZRangeChanged += BackgroundMaterialEditor_ZRangeChanged;
            backgroundMaterialEditor.Anchor         = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
            x += backgroundMaterialEditor.Width;

            Editors = new List <LayerMaterialEditor>();
            LayerMaterialEditor editor;

            foreach (LayerData layer in Application.OpenedProject.Layers)
            {
                editor = new LayerMaterialEditor();
                foreach (MaterialDataBinder binder in Materials)
                {
                    editor.Materials.Add(binder);
                }
                Editors.Add(editor);
                panelStructure.Controls.Add(editor);
                editor.Location            = new Point(x, 0);
                editor.Anchor              = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
                editor.LayerNumberChanged += Editor_LayerNumberChanged;
                editor.Layer = layer;

                x += editor.Width;
            }
            BackgroundMaterialEditor_ZRangeChanged(this, EventArgs.Empty);
        }
		private void MakeStructureEditorsPage()
			{
			int x = 0;

			backgroundMaterialEditor = new BackgroundMaterialEditor();
			foreach( MaterialDataBinder binder in Materials )
				backgroundMaterialEditor.Materials.Add( binder );
			backgroundMaterialEditor.ProjectManifest = Application.OpenedProject.ProjectManifest;
			panelStructure.Controls.Add( backgroundMaterialEditor );
			backgroundMaterialEditor.Font = new Font( "Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ( (byte)( 128 ) ) );
			backgroundMaterialEditor.Location = new Point( 0, 0 );
			backgroundMaterialEditor.Margin = new Padding( 3, 4, 3, 4 );
			backgroundMaterialEditor.Name = "backgroundMaterialEditor";
			backgroundMaterialEditor.TabIndex = 0;
			backgroundMaterialEditor.ZRangeChanged += BackgroundMaterialEditor_ZRangeChanged;
			backgroundMaterialEditor.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
			x += backgroundMaterialEditor.Width;

			Editors = new List<LayerMaterialEditor>();
			LayerMaterialEditor editor;
			foreach( LayerData layer in Application.OpenedProject.Layers )
				{
				editor = new LayerMaterialEditor();
				foreach( MaterialDataBinder binder in Materials )
					editor.Materials.Add( binder );
				Editors.Add( editor );
				panelStructure.Controls.Add( editor );
				editor.Location = new Point( x, 0 );
				editor.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
				editor.LayerNumberChanged += Editor_LayerNumberChanged;
				editor.Layer = layer;

				x += editor.Width;
				}
			BackgroundMaterialEditor_ZRangeChanged( this, EventArgs.Empty );
			}
		private void Editor_LayerNumberChanged(object sender, LayerMaterialEditor.LayerNumberChangedEventArgs e)
			{
			int index = Editors.IndexOf( sender as LayerMaterialEditor );
			if( e.BeforeLayerNumber < e.AfterLayerNumber ) index++;
			else index--;
			if( index < 0 || Editors.Count <= index ) return;
			if( Editors[index].LayerNumber == e.AfterLayerNumber )
				{
				Editors[index].LayerNumber = e.BeforeLayerNumber;
				SortLayer();
				}
			}