Inheritance: CustomPanel
Exemple #1
0
        //public ToolsPanel PanelTools;
        public ToolPane()
            : base(Settings.Config.ToolPaneWidth - 1, Settings.Config.WindowHeight * 3)
        {
            PanelWidth = Settings.Config.ToolPaneWidth - 1;
            PanelWidthControls = PanelWidth - 2;

            _tools = new Dictionary<string, ITool>();

            CanUseKeyboard = false;
            ProcessMouseWithoutFocus = true;

            textSurface.DefaultBackground = Settings.Color_MenuBack;
            textSurface.DefaultForeground = Settings.Color_TitleText;
            Clear();

            _hotSpots = new List<Tuple<CustomPanel, int>>();

            // Create tools
            _tools.Add(PaintTool.ID, new PaintTool());
            textSurface.RenderArea = new Rectangle(0, 0, Width, Settings.Config.WindowHeight - 1);

            // Create panels
            PanelFiles = new FilesPanel();
            //PanelTools = new ToolsPanel();
        }
        public void FinishCreating()
        {
            ProcessMouseWithoutFocus = true;

            textSurface.DefaultBackground = Settings.Color_MenuBack;
            textSurface.DefaultForeground = Settings.Color_TitleText;
            Clear();

            _tools = new Dictionary<string, ITool>();
            _tools.Add(PaintTool.ID, new PaintTool());
            _tools.Add(RecolorTool.ID, new RecolorTool());
            _tools.Add(FillTool.ID, new FillTool());
            _tools.Add(TextTool.ID, new TextTool());
            _tools.Add(LineTool.ID, new LineTool());
            _tools.Add(BoxTool.ID, new BoxTool());
            //_tools.Add(ObjectTool.ID, new ObjectTool());
            _tools.Add(SelectionTool.ID, new SelectionTool());
            _tools.Add(CircleTool.ID, new CircleTool());
            _tools.Add(EntityCenterTool.ID, new EntityCenterTool());
            _tools.Add(SceneEntityMoveTool.ID, new SceneEntityMoveTool());

            FilesPanel = new FilesPanel();
            ToolsPanel = new ToolsPanel();
            LayersPanel = new LayersPanel();

            FilesPanel.IsCollapsed = true;
            LayersPanel.IsCollapsed = true;

            ToolsPanel.ToolsListBox.SelectedItemChanged += (sender, e) =>
            {
                if (selectedTool != null)
                {
                    selectedTool.OnDeselected();
                    if (selectedTool.ControlPanels != null)
                        foreach (var pane in selectedTool.ControlPanels)
                        {
                            foreach (var control in pane.Controls)
                            {
                                Remove(control);
                            }
                        }
                }

                if (e.Item != null)
                {
                    selectedTool = (ITool)e.Item;
                    EditorConsoleManager.Instance.ToolName = selectedTool.Title;

                    EditorConsoleManager.Instance.AllowKeyboardToMoveConsole = true;
                    CommonCharacterPickerPanel.HideCharacter = false;
                    CommonCharacterPickerPanel.HideForeground = false;
                    CommonCharacterPickerPanel.HideBackground = false;

                    selectedTool.OnSelected();
                    CommonCharacterPickerPanel.Reset();
                    RefreshControls();
                }

            };
        }