コード例 #1
0
ファイル: TilePoolPane.cs プロジェクト: Jorch72/CS-Treefrog
        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;
        }
コード例 #2
0
ファイル: ObjectPanel.cs プロジェクト: Jorch72/CS-Treefrog
        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;
        }
コード例 #3
0
ファイル: TileBrushPanel.cs プロジェクト: Jorch72/CS-Treefrog
        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;
        }
コード例 #4
0
ファイル: LayerPane.cs プロジェクト: Jorch72/CS-Treefrog
        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);
        }