//----------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------- public EditorForm() { InitializeComponent(); editorControl = new EditorControl(); editorControl.EditorForm = this; // Create the level display. levelDisplay = new LevelDisplay(); levelDisplay.EditorControl = editorControl; levelDisplay.Name = "levelDisplay"; levelDisplay.Dock = DockStyle.Fill; levelDisplay.EditorForm = this; panelWorld.Controls.Add(this.levelDisplay); tileDisplay = new TileDisplay(); tileDisplay.EditorControl = editorControl; tileDisplay.Name = "tileDisplay"; tileDisplay.Dock = DockStyle.Fill; tileDisplay.EditorForm = this; panelTiles2.Controls.Add(tileDisplay); /*treeViewLevels.AfterLabelEdit += delegate(object sender, NodeLabelEditEventArgs e) { Console.WriteLine("Renamed level to " + e.Label); int levelIndex = e.Node.Index; Level level = editorControl.World.GetLevel(levelIndex); level.Name = e.Label; };*/ treeViewWorld.NodeMouseDoubleClick += delegate(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Name == "level") { editorControl.OpenLevel(e.Node.Index); } else if (e.Node.Name == "world") { editorControl.OpenObjectProperties(editorControl.World); } }; this.comboBoxWorldLayer.Items.Add("Layer 1"); this.comboBoxWorldLayer.Items.Add("Layer 2"); this.comboBoxWorldLayer.Items.Add("Layer 3"); this.comboBoxWorldLayer.Items.Add("Events"); this.comboBoxWorldLayer.SelectedIndex = 0; // Create tools. this.toolButtons = new ToolStripButton[] { buttonToolPointer, buttonToolPlace, buttonToolSelection, buttonToolEyedropper }; this.hotKeyCommands = new Dictionary<Keys, HotKeyAction>(); this.hotKeyCommands.Add(Keys.PageUp, delegate() { cycleLayerUpToolStripMenuItem_Click(null, null); }); this.hotKeyCommands.Add(Keys.PageDown, delegate() { cycleLayerUpToolStripMenuItem1_Click(null, null); }); this.hotKeyCommands.Add(Keys.M, delegate() { buttonTool_Click(this.buttonToolPointer, null); }); this.hotKeyCommands.Add(Keys.P, delegate() { buttonTool_Click(this.buttonToolPlace, null); }); this.hotKeyCommands.Add(Keys.S, delegate() { buttonTool_Click(this.buttonToolSelection, null); }); this.hotKeyCommands.Add(Keys.K, delegate() { buttonTool_Click(this.buttonToolEyedropper, null); }); }
//----------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------- public EditorForm() { InitializeComponent(); // Create the editor control instance. editorControl = new EditorControl(this); // Initialize world tree view. worldTreeView.EditorControl = editorControl; // Initialize property grid. propertyGrid.Initialize(editorControl); // Create the level display. levelDisplay = new LevelDisplay(); levelDisplay.EditorControl = editorControl; levelDisplay.Name = "levelDisplay"; levelDisplay.Dock = DockStyle.Fill; levelDisplay.EditorForm = this; panelWorld.Controls.Add(this.levelDisplay); // Create the tileset display. tileDisplay = new TileDisplay(); tileDisplay.EditorControl = editorControl; tileDisplay.Name = "tileDisplay"; tileDisplay.Dock = DockStyle.Fill; tileDisplay.EditorForm = this; panelTiles2.Controls.Add(tileDisplay); activeControl = null; objectEditorForm = null; statusLabelTask.Text = null; // Setup layer combo-box. this.comboBoxWorldLayer.Items.Add("Layer 1"); this.comboBoxWorldLayer.Items.Add("Layer 2"); this.comboBoxWorldLayer.Items.Add("Layer 3"); this.comboBoxWorldLayer.Items.Add("Events"); this.comboBoxWorldLayer.SelectedIndex = 0; // Create tools. this.toolButtons = new ToolStripButton[] { buttonToolPointer, buttonToolPlace, buttonToolSquare, buttonToolFill, buttonToolSelection, buttonToolEyedropper }; // Add hotkeys. hotKeyCommands = new Dictionary<Keys, HotKeyAction>(); hotKeyCommands.Add(Keys.PageUp, delegate() { cycleLayerUpToolStripMenuItem_Click(null, null); }); hotKeyCommands.Add(Keys.PageDown, delegate() { cycleLayerUpToolStripMenuItem1_Click(null, null); }); hotKeyCommands.Add(Keys.M, delegate() { buttonTool_Click(this.buttonToolPointer, null); }); hotKeyCommands.Add(Keys.P, delegate() { buttonTool_Click(this.buttonToolPlace, null); }); hotKeyCommands.Add(Keys.O, delegate() { buttonTool_Click(this.buttonToolSquare, null); }); hotKeyCommands.Add(Keys.F, delegate() { buttonTool_Click(this.buttonToolFill, null); }); hotKeyCommands.Add(Keys.S, delegate() { buttonTool_Click(this.buttonToolSelection, null); }); hotKeyCommands.Add(Keys.K, delegate() { buttonTool_Click(this.buttonToolEyedropper, null); }); }
//----------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------- public EditorForm() { InitializeComponent(); // Create the editor control instance. editorControl = new EditorControl(this); // Initialize world tree view. worldTreeView.EditorControl = editorControl; // Initialize property grid. propertyGrid.Initialize(editorControl); // Create the level display. levelDisplay = new LevelDisplay(); levelDisplay.EditorControl = editorControl; levelDisplay.Name = "levelDisplay"; levelDisplay.Dock = DockStyle.Fill; levelDisplay.EditorForm = this; panelWorld.Controls.Add(this.levelDisplay); // Create the tileset display. tileDisplay = new TileDisplay(); tileDisplay.EditorControl = editorControl; tileDisplay.Name = "tileDisplay"; tileDisplay.Dock = DockStyle.Fill; tileDisplay.EditorForm = this; panelTiles2.Controls.Add(tileDisplay); activeControl = null; objectEditorForm = null; statusLabelTask.Text = null; // Setup layer combo-box. this.comboBoxWorldLayer.Items.Add("Layer 1"); this.comboBoxWorldLayer.Items.Add("Layer 2"); this.comboBoxWorldLayer.Items.Add("Layer 3"); this.comboBoxWorldLayer.Items.Add("Events"); this.comboBoxWorldLayer.SelectedIndex = 0; // Create tools. this.toolButtons = new ToolStripButton[] { buttonToolPointer, buttonToolPlace, buttonToolSquare, buttonToolFill, buttonToolSelection, buttonToolEyedropper }; // Add hotkeys. hotKeyCommands = new Dictionary <Keys, HotKeyAction>(); hotKeyCommands.Add(Keys.PageUp, delegate() { cycleLayerUpToolStripMenuItem_Click(null, null); }); hotKeyCommands.Add(Keys.PageDown, delegate() { cycleLayerUpToolStripMenuItem1_Click(null, null); }); hotKeyCommands.Add(Keys.M, delegate() { buttonTool_Click(this.buttonToolPointer, null); }); hotKeyCommands.Add(Keys.P, delegate() { buttonTool_Click(this.buttonToolPlace, null); }); hotKeyCommands.Add(Keys.O, delegate() { buttonTool_Click(this.buttonToolSquare, null); }); hotKeyCommands.Add(Keys.F, delegate() { buttonTool_Click(this.buttonToolFill, null); }); hotKeyCommands.Add(Keys.S, delegate() { buttonTool_Click(this.buttonToolSelection, null); }); hotKeyCommands.Add(Keys.K, delegate() { buttonTool_Click(this.buttonToolEyedropper, null); }); }