public ObjectPanel() { InitializeComponent(); // Load form elements System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); _buttonRemoveObject.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.game--minus.png")); _buttonAddObject.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.game--plus.png")); _commandController = new UICommandController(); _commandController.MapButtons(new Dictionary<CommandKey, ToolStripButton>() { { CommandKey.ObjectProtoImport, _buttonAddObject }, { CommandKey.ObjectProtoDelete, _buttonRemoveObject }, }); _itemContextMenu = CommandMenuBuilder.BuildContextMenu(new CommandMenu("", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.ObjectProtoProperties, }, })); _commandController.MapMenuItems(_itemContextMenu.Items); // Wire events _listView.ItemSelectionChanged += ListViewSelectionChangedHandler; _listView.MouseClick += ListViewMouseClickHandler; }
public LayerPane() { InitializeComponent(); ResetComponent(); // Load form elements _buttonAdd.Image = Properties.Resources.LayerPlus; _buttonRemove.Image = Properties.Resources.LayerMinus; _buttonUp.Image = Properties.Resources.Arrow90; _buttonDown.Image = Properties.Resources.Arrow270; _buttonCopy.Image = Properties.Resources.Layers; _buttonProperties.Image = Properties.Resources.Tags; _menuNewTileLayer.Image = Properties.Resources.Grid; _menuNewObjectLayer.Image = Properties.Resources.Game; _commandController = new UICommandController(); _commandController.MapButtons(new Dictionary<CommandKey, ToolStripButton>() { { CommandKey.LayerDelete, _buttonRemove }, { CommandKey.LayerClone, _buttonCopy }, { CommandKey.LayerProperties, _buttonProperties }, { CommandKey.LayerMoveUp, _buttonUp }, { CommandKey.LayerMoveDown, _buttonDown }, }); _commandController.MapMenuItems(new Dictionary<CommandKey, ToolStripMenuItem>() { { CommandKey.NewTileLayer, _menuNewTileLayer }, { CommandKey.NewObjectLayer, _menuNewObjectLayer }, }); _itemContextMenu = CommandMenuBuilder.BuildContextMenu(new CommandMenu("", new List<CommandMenuGroup>() { new CommandMenuGroup() { new CommandMenuEntry(CommandKey.LayerEdit) { Default = true }, }, new CommandMenuGroup() { CommandKey.LayerClone, CommandKey.LayerDelete, }, new CommandMenuGroup() { CommandKey.LayerMoveTop, CommandKey.LayerMoveUp, CommandKey.LayerMoveDown, CommandKey.LayerMoveBottom, }, new CommandMenuGroup() { CommandKey.LayerExportRaster, CommandKey.LayerProperties, }, })); _commandController.MapMenuItems(_itemContextMenu.Items); }
public TilePoolPane() { InitializeComponent(); ResetComponent(); // Load form elements _buttonRemove.Image = Properties.Resources.Minus; _buttonAdd.Image = Properties.Resources.Plus; _buttonProperties.Image = Properties.Resources.Tags; ToolStripMenuItem tilePropertiesItem = new ToolStripMenuItem("Tile Properties") { Image = Properties.Resources.Tags, }; ToolStripMenuItem tileDeleteItem = new ToolStripMenuItem("Delete Tile") { Image = Properties.Resources.Cross, }; _tileContextMenu = new ContextMenuStrip(); _tileContextMenu.Items.AddRange(new ToolStripItem[] { tileDeleteItem, new ToolStripSeparator(), tilePropertiesItem, }); _commandController = new UICommandController(); _commandController.MapButtons(new Dictionary<CommandKey, ToolStripButton>() { { CommandKey.TilePoolDelete, _buttonRemove }, { CommandKey.TilePoolProperties, _buttonProperties }, }); _commandController.MapMenuItems(new Dictionary<CommandKey, ToolStripMenuItem>() { { CommandKey.TilePoolImport, importNewToolStripMenuItem }, { CommandKey.TilePoolImportMerge, importMergeToolStripMenuItem }, { CommandKey.TileProperties, tilePropertiesItem }, { CommandKey.TileDelete, tileDeleteItem }, }); _pointerController = new ControlPointerEventController(_layerControl, _layerControl); // Setup control _poolComboBox.ComboBox.DisplayMember = "Name"; _layerControl.BackColor = System.Drawing.Color.SlateGray; _layerControl.WidthSynced = true; _layerControl.CanvasAlignment = CanvasAlignment.UpperLeft; // Wire events _poolComboBox.SelectedIndexChanged += SelectTilePoolHandler; }
public Main() { InitializeComponent(); // Toolbars _menu = new StandardMenu(); _standardToolbar = new StandardToolbar(); _tileToolbar = new TileToolbar(); toolStripContainer1.TopToolStripPanel.Controls.AddRange(new Control[] { _standardToolbar.Strip, _tileToolbar.Strip }); Controls.Add(_menu.Strip); MainMenuStrip = _menu.Strip; _infoStatus = new InfoStatus(statusBar); _editor = new EditorPresenter(); _editor.SyncContentTabs += SyncContentTabsHandler; _editor.SyncContentView += SyncContentViewHandler; _editor.SyncModified += SyncProjectModified; _editor.PanelActivation += PanelActivated; //_editor.CommandManager.Perform(Presentation.Commands.CommandKey.OpenProject); _editor.NewDefault(); tabControlEx1.ContextMenuStrip = CommandMenuBuilder.BuildContextMenu(new CommandMenu("", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.LevelClose, CommandKey.LevelCloseAllOther, }, new CommandMenuGroup() { CommandKey.LevelRename, CommandKey.LevelResize, }, new CommandMenuGroup() { CommandKey.LevelProperties, }, })); tabControlEx1.ContextMenuStrip.Opening += contextMenuStrip1_Opening; _commandController = new UICommandController(); _commandController.BindCommandManager(_editor.CommandManager); _commandController.MapMenuItems(tabControlEx1.ContextMenuStrip.Items); System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); }
public TilePoolPane() { InitializeComponent(); ResetComponent(); // Load form elements System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); _buttonRemove.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons.minus16.png")); _buttonAdd.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons.plus16.png")); _buttonProperties.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.tags.png")); ToolStripMenuItem tilePropertiesItem = new ToolStripMenuItem("Tile Properties") { Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.tags.png")), }; _tileContextMenu = new ContextMenuStrip(); _tileContextMenu.Items.AddRange(new ToolStripItem[] { tilePropertiesItem, }); _commandController = new UICommandController(); _commandController.MapButtons(new Dictionary<CommandKey, ToolStripButton>() { { CommandKey.TilePoolDelete, _buttonRemove }, { CommandKey.TilePoolProperties, _buttonProperties }, }); _commandController.MapMenuItems(new Dictionary<CommandKey, ToolStripMenuItem>() { { CommandKey.TilePoolImport, importNewToolStripMenuItem }, { CommandKey.TileProperties, tilePropertiesItem }, }); _pointerController = new ControlPointerEventController(_layerControl, _layerControl); // Setup control _poolComboBox.ComboBox.DisplayMember = "Name"; _layerControl.BackColor = System.Drawing.Color.SlateGray; _layerControl.WidthSynced = true; _layerControl.CanvasAlignment = CanvasAlignment.UpperLeft; // Wire events _poolComboBox.SelectedIndexChanged += SelectTilePoolHandler; }
public TileBrushPanel() { InitializeComponent(); ResetComponent(); // Load form elements System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); _buttonRemove.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.paint-brush--minus.png")); _buttonAdd.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.paint-brush--plus.png")); _buttonFilter.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.funnel.png")); ToolStripMenuItem buttonAddStatic = new ToolStripMenuItem("New Static Brush...") { Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.stamp.png")), }; ToolStripMenuItem buttonAddDynamic = new ToolStripMenuItem("New Dynamic Brush...") { Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.table-dynamic.png")), }; _buttonAdd.DropDownItems.AddRange(new ToolStripItem[] { buttonAddStatic, buttonAddDynamic, }); _commandController = new UICommandController(); _commandController.MapButtons(new Dictionary<CommandKey, ToolStripButton>() { { CommandKey.TileBrushDelete, _buttonRemove }, }); _commandController.MapMenuItems(new Dictionary<CommandKey, ToolStripMenuItem>() { { CommandKey.NewStaticTileBrush, buttonAddStatic }, { CommandKey.NewDynamicTileBrush, buttonAddDynamic }, }); // Wire Events _listView.ItemSelectionChanged += ListViewSelectionChangedHandler; _listView.MouseClick += ListViewItemActivateHandler; _listView.MouseDoubleClick += ListViewMouseDoubleClick; }
public TileBrushPanel() { InitializeComponent(); ResetComponent(); // Load form elements _buttonRemove.Image = Properties.Resources.PaintBrushMinus; _buttonAdd.Image = Properties.Resources.PaintBrushPlus; _buttonFilter.Image = Properties.Resources.Funnel; ToolStripMenuItem buttonAddStatic = new ToolStripMenuItem("New Static Brush...") { Image = Properties.Resources.Stamp, }; ToolStripMenuItem buttonAddDynamic = new ToolStripMenuItem("New Dynamic Brush...") { Image = Properties.Resources.TableDynamic, }; _buttonAdd.DropDownItems.AddRange(new ToolStripItem[] { buttonAddStatic, buttonAddDynamic, }); _commandController = new UICommandController(); _commandController.MapButtons(new Dictionary<CommandKey, ToolStripButton>() { { CommandKey.TileBrushDelete, _buttonRemove }, }); _commandController.MapMenuItems(new Dictionary<CommandKey, ToolStripMenuItem>() { { CommandKey.NewStaticTileBrush, buttonAddStatic }, { CommandKey.NewDynamicTileBrush, buttonAddDynamic }, }); // Wire Events _listView.ItemSelectionChanged += ListViewSelectionChangedHandler; _listView.MouseClick += ListViewItemActivateHandler; _listView.MouseDoubleClick += ListViewMouseDoubleClick; }
public LayerPane() { InitializeComponent(); ResetComponent(); // Load form elements System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); _buttonAdd.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.layer--plus.png")); _buttonRemove.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.layer--minus.png")); _buttonUp.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.arrow-090.png")); _buttonDown.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.arrow-270.png")); _buttonCopy.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.layers.png")); _buttonProperties.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.tags.png")); _menuNewTileLayer.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.grid.png")); _menuNewObjectLayer.Image = Image.FromStream(assembly.GetManifestResourceStream("Treefrog.Icons._16.game.png")); _commandController = new UICommandController(); _commandController.MapButtons(new Dictionary<CommandKey, ToolStripButton>() { { CommandKey.LayerDelete, _buttonRemove }, { CommandKey.LayerClone, _buttonCopy }, { CommandKey.LayerProperties, _buttonProperties }, { CommandKey.LayerMoveUp, _buttonUp }, { CommandKey.LayerMoveDown, _buttonDown }, }); _commandController.MapMenuItems(new Dictionary<CommandKey, ToolStripMenuItem>() { { CommandKey.NewTileLayer, _menuNewTileLayer }, { CommandKey.NewObjectLayer, _menuNewObjectLayer }, }); // Wire events _listControl.ItemSelectionChanged += SelectedItemChangedHandler; _listControl.ItemChecked += ItemCheckedHandler; }
public ObjectPanel() { InitializeComponent(); // Load form elements _buttonRemoveObject.Image = Properties.Resources.GameMinus; _buttonAddObject.Image = Properties.Resources.GamePlus; _commandController = new UICommandController(); _commandController.MapButtons(new Dictionary<CommandKey, ToolStripButton>() { { CommandKey.ObjectProtoImport, _buttonAddObject }, { CommandKey.ObjectProtoDelete, _buttonRemoveObject }, }); _itemContextMenu = CommandMenuBuilder.BuildContextMenu(new CommandMenu("", new List<CommandMenuGroup>() { new CommandMenuGroup() { new CommandMenuEntry(CommandKey.ObjectProtoEdit) { Default = true }, }, new CommandMenuGroup() { CommandKey.ObjectProtoClone, CommandKey.ObjectProtoDelete, CommandKey.ObjectProtoRename, }, new CommandMenuGroup() { CommandKey.ObjectProtoProperties, }, })); _commandController.MapMenuItems(_itemContextMenu.Items); // Wire events _listView.ItemSelectionChanged += ListViewSelectionChangedHandler; _listView.MouseClick += ListViewMouseClickHandler; }
private void ContextMenuActivatedHandler(object sender, ContextMenuEventArgs e) { ContextMenuStrip menu = CommandMenuBuilder.BuildContextMenu(e.Menu); if (_contextController != null) _contextController.Dispose(); _contextController = new UICommandController(); _contextController.BindCommandManager(_controller.CommandManager); _contextController.MapMenuItems(menu.Items); menu.Show(this, _pointerController.UntranslatePosition(new Point(e.Location.X, e.Location.Y))); }
/* private ToolStripMenuItem _levelsExportRaster; private ToolStripMenuItem _objectsGroups; private ToolStripMenuItem _objectsAlign; private ToolStripMenuItem _objectsAlignTop; private ToolStripMenuItem _objectsAlignBottom; private ToolStripMenuItem _objectsAlignLeft; private ToolStripMenuItem _objectsAlignRight; private ToolStripMenuItem _objectsAlignCenterHorz; private ToolStripMenuItem _objectsAlignCenterVert;*/ public StandardMenu() { _menuStrip = new MenuStrip(); _fileStrip = CommandMenuBuilder.BuildToolStripMenu(new CommandMenu("&File", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.NewProject, CommandKey.OpenProject, CommandKey.Save, CommandKey.SaveAs, }, new CommandMenuGroup() { CommandKey.Exit, }, })); _editStrip = CommandMenuBuilder.BuildToolStripMenu(new CommandMenu("&Edit", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.Undo, CommandKey.Redo, }, new CommandMenuGroup() { CommandKey.Cut, CommandKey.Copy, CommandKey.Paste, CommandKey.Delete, }, new CommandMenuGroup() { CommandKey.SelectAll, CommandKey.SelectNone, }, })); _viewStrip = CommandMenuBuilder.BuildToolStripMenu(new CommandMenu("&View", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.ViewZoomNormal, CommandKey.ViewZoomIn, CommandKey.ViewZoomOut, }, new CommandMenuGroup() { CommandKey.ViewGrid, }, })); _projectStrip = CommandMenuBuilder.BuildToolStripMenu(new CommandMenu("&Project", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.ProjectAddLevel, }, })); _levelStrip = CommandMenuBuilder.BuildToolStripMenu(new CommandMenu("&Level", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.LevelResize, }, })); _layerStrip = CommandMenuBuilder.BuildToolStripMenu(new CommandMenu("La&yers", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.NewTileLayer, CommandKey.NewObjectLayer, }, new CommandMenuGroup() { CommandKey.LayerClone, CommandKey.LayerDelete, CommandKey.LayerProperties, }, new CommandMenuGroup() { new CommandMenuEntry(new CommandMenu("&Arrange", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.LayerMoveTop, CommandKey.LayerMoveUp, CommandKey.LayerMoveDown, CommandKey.LayerMoveBottom, }, })), new CommandMenuEntry(new CommandMenu("&View", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.LayerShowCurrentOnly, CommandKey.LayerShowAll, CommandKey.LayerShowNone, }, })), }, new CommandMenuGroup() { CommandKey.LayerExportRaster, }, })); _tileStrip = CommandMenuBuilder.BuildToolStripMenu(new CommandMenu("&Tiles", new List<CommandMenuGroup>() { new CommandMenuGroup() { new CommandMenuEntry(new CommandMenu("&Brushes", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.NewStaticTileBrush, CommandKey.NewDynamicTileBrush, }, new CommandMenuGroup() { CommandKey.TileBrushClone, CommandKey.TileBrushDelete, }, })), new CommandMenuEntry(new CommandMenu("&Selections", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.TileSelectionCreateBrush, CommandKey.TileSelectionPromoteLayer, }, new CommandMenuGroup() { CommandKey.TileSelectionFloat, CommandKey.TileSelectionDefloat, }, })), }, new CommandMenuGroup() { CommandKey.TilePoolExport, CommandKey.TilePoolImportOver, }, })); _objectStrip = CommandMenuBuilder.BuildToolStripMenu(new CommandMenu("&Objects", new List<CommandMenuGroup>() { new CommandMenuGroup() { new CommandMenuEntry(new CommandMenu("Object &Prototypes", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.ObjectProtoImport }, new CommandMenuGroup() { CommandKey.ObjectProtoClone, CommandKey.ObjectProtoDelete, CommandKey.ObjectProtoProperties, }, })), }, new CommandMenuGroup() { new CommandMenuEntry(new CommandMenu("&Arrange", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.ObjectMoveTop, CommandKey.ObjectMoveUp, CommandKey.ObjectMoveDown, CommandKey.ObjectMoveBottom, }, })), }, new CommandMenuGroup() { new CommandMenuEntry(new CommandMenu("&Reference Point", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.ObjectReferenceImage, CommandKey.ObjectReferenceMask, CommandKey.ObjectReferenceOrigin, }, })), new CommandMenuEntry(new CommandMenu("&Snapping", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.ObjectSnappingNone, CommandKey.ObjectSnappingTopLeft, CommandKey.ObjectSnappingTopRight, CommandKey.ObjectSnappingBottomLeft, CommandKey.ObjectSnappingBottomRight, CommandKey.ObjectSnappingTop, CommandKey.ObjectSnappingBottom, CommandKey.ObjectSnappingLeft, CommandKey.ObjectSnappingRight, CommandKey.ObjectSnappingVert, CommandKey.ObjectSnappingHorz, CommandKey.ObjectSnappingCenter, }, })), }, })); _helpStrip = CommandMenuBuilder.BuildToolStripMenu(new CommandMenu("&Help")); _commandController = new UICommandController(); _commandController.MapMenuItems(new List<ToolStripMenuItem>() { _fileStrip, _editStrip, _viewStrip, _projectStrip, _levelStrip, _layerStrip, _tileStrip, _objectStrip, _helpStrip }); _menuStrip.Items.AddRange(new ToolStripItem[] { _fileStrip, _editStrip, _viewStrip, _projectStrip, _levelStrip, _layerStrip, _tileStrip, _objectStrip, _helpStrip, }); }
internal Main(Loader loader) { InitializeComponent(); FormClosing += FormClosingHandler; // Toolbars _menu = new StandardMenu(); _standardToolbar = new StandardToolbar(); _tileToolbar = new TileToolbar(); toolStripContainer1.TopToolStripPanel.Controls.AddRange(new Control[] { _standardToolbar.Strip, _tileToolbar.Strip }); Controls.Add(_menu.Strip); MainMenuStrip = _menu.Strip; _infoStatus = new InfoStatus(statusBar); //PresenterManager pm = new PresenterManager(); //_editor = new EditorPresenter(); //_editor.Initialize(pm); _pm = loader.InitializePresenterManager(); _editor = _pm.Lookup<EditorPresenter>(); loader.InitializeProjectPanelComponents(projectPanel1.ComponentManager); //pm.Register(_editor); //_editor.SyncContentTabs += SyncContentTabsHandler; _editor.SyncContentView += SyncContentViewHandler; _editor.SyncModified += SyncProjectModified; _editor.PanelActivation += PanelActivated; _editor.SyncCurrentLevel += SyncCurrentLevel; _editor.ContentWorkspace.ContentOpened += ContentWorkspaceContentOpened; _editor.ContentWorkspace.ContentClosed += ContentWorkspaceContentClosed; _editor.ContentWorkspace.ProjectReset += ContentWorkspaceReset; //_editor.CommandManager.Perform(Presentation.Commands.CommandKey.OpenProject); _editor.NewDefault(); tabControlEx1.ContextMenuStrip = CommandMenuBuilder.BuildContextMenu(new CommandMenu("", new List<CommandMenuGroup>() { new CommandMenuGroup() { CommandKey.LevelClose, CommandKey.LevelCloseAllOther, }, new CommandMenuGroup() { CommandKey.LevelRename, CommandKey.LevelResize, }, new CommandMenuGroup() { CommandKey.LevelProperties, }, })); tabControlEx1.ContextMenuStrip.Opening += contextMenuStrip1_Opening; _commandController = new UICommandController(); _commandController.BindCommandManager(_editor.CommandManager); _commandController.MapMenuItems(tabControlEx1.ContextMenuStrip.Items); }