Ejemplo n.º 1
0
 public CloneStampProperties(CloneStamp tool)
 {
     InitializeComponent();
     Tool                = tool;
     Tool.Invalidated   += Tool_Invalidated;
     Tool.CursorChanged += Tool_Invalidated;
     Tool_Invalidated(Tool, null);
 }
Ejemplo n.º 2
0
        private void setTool(string name)
        {
            if (Tool != null)
            {
                Tool.Exit();
            }
            if (tools.ContainsKey(name))
            {
                Tool = tools[name];
            }
            else
            {
                switch (name)
                {
                case "move":
                    Tool = new MoveTool(Project);
                    break;

                case "pencil":
                    Tool = new Pencil(Project, MyForeColor);
                    break;

                case "eraser":
                    Tool = new Eraser(Project);
                    break;

                case "picker":
                    Tool = new ColorPicker(Project, MyForeColor, MyBackColor);
                    (Tool as ColorPicker).ColorChanged += colorPicker_ColorChanged;
                    break;

                case "selection":
                    Tool = new SelectionTool(Project);
                    break;

                case "transform":
                    Tool = new Transform(Project);
                    break;

                case "shape":
                    Tool = new Shape(Project, MyForeColor, MyBackColor);
                    break;

                case "stamp":
                    Tool = new CloneStamp(Project);
                    break;

                case "brush":
                    Tool = new FuzzyBrush(Project);
                    break;

                default:
                    throw new ArgumentException();
                }
                Tool.Invalidated   += Tool_Invalidated;
                Tool.CursorChanged += Tool_CursorChanged;
                tools[name]         = Tool;
            }
            Tool.Init();
            updateToolColor();
            Tool_CursorChanged(this, null);
            setToolPanel();
        }