Exemplo n.º 1
0
 protected virtual void OnToolSelected(VMSubTool tool)
 {
     if (ToolSelected != null)
     {
         ToolSelected(this, tool);
     }
 }
Exemplo n.º 2
0
 public void SelectTool(VMSubTool tool)
 {
     ControlPanel.Text = tool.GetName();
     ControlPanel.Controls.Clear();
     if (tool.Control != null)
     {
         ControlPanel.Controls.Add(tool.Control);
         //ControlPanel.Height = tool.Control.PreferredSize.Height;
         tool.Control.Dock = DockStyle.Top;
     }
     OnToolSelected(tool);
 }
Exemplo n.º 3
0
 public void SetSelectedTool(VMSubTool tool)
 {
     foreach (RadioButton rb in ButtonLayoutPanel.Controls)
     {
         if (rb.Name != tool.GetName())
         {
             rb.Checked = false;
         }
         else if (!rb.Checked)
         {
             rb.Checked = true;
         }
     }
 }
Exemplo n.º 4
0
        private void VMToolSelected(object sender, VMSubTool tool)
        {
            if (_currentTool == tool)
            {
                return;
            }
            _controlPanel.SetSelectedTool(tool);
            if (_currentTool != null)
            {
                _currentTool.ToolDeselected(false);
            }
            _currentTool = tool;
            if (_currentTool != null)
            {
                _currentTool.ToolSelected(false);
            }

            Mediator.Publish(EditorMediator.ContextualHelpChanged);
        }
Exemplo n.º 5
0
        public void AddTool(VMSubTool tool)
        {
            var rdo = new RadioButton
            {
                Name = tool.GetName(),
                Text = tool.GetName(),
                //Appearance = Appearance.Button,
                AutoSize = true,
                //Size = new Size(110, 17)
            };

            rdo.Click += (sender, e) => SelectTool(tool);
            ButtonLayoutPanel.Controls.Add(rdo);
            if (!_tools.Any())
            {
                rdo.Checked = true;
                SelectTool(tool);
            }
            _tools.Add(tool);
        }
Exemplo n.º 6
0
        public VMTool()
        {
            _controlPanel = new VMSidebarPanel();
            _controlPanel.ToolSelected += VMToolSelected;
            _controlPanel.DeselectAll  += DeselectAll;
            _controlPanel.Reset        += Reset;

            _errorPanel               = new VMErrorsSidebarPanel();
            _errorPanel.SelectError  += SelectError;
            _errorPanel.FixError     += FixError;
            _errorPanel.FixAllErrors += FixAllErrors;

            _tools = new List <VMSubTool>();

            AddTool(new StandardTool(this));
            AddTool(new ScaleTool(this));
            AddTool(new EditFaceTool(this));
            _currentTool = _tools.FirstOrDefault();

            _showPoints = ShowPoints.All;
        }
Exemplo n.º 7
0
 private void AddTool(VMSubTool tool)
 {
     _controlPanel.AddTool(tool);
     _tools.Add(tool);
 }