Exemple #1
0
        public void ToolMouseDoubleClick(object sender, MouseEventArgs e)
        {
            string input;

            canvas.DeselectAllObjects();
            selectedObject = canvas.SelectObjectAt(e.X, e.Y);

            if (selectedObject != null && selectedObject is Text)
            {
                input = Microsoft.VisualBasic.Interaction.InputBox("Input Text", "Text Box", this.selectedObject.GetText(), 500, 300);

                if (input.Length > 0)
                {
                    this.selectedObject.SetText(input.ToString());
                    canvas.initUndoRedo();
                }
            }
            else
            {
                Text text = new Text();
                input      = Microsoft.VisualBasic.Interaction.InputBox("Input Text", "Text Box", "", 500, 300);
                text.Value = input;

                canvas.AddDrawingObject(text);
                text.X = e.X;
                text.Y = e.Y;
                canvas.initUndoRedo();
            }

            Debug.WriteLine("selection tool double click");
        }
Exemple #2
0
        public ObjectShape SelectObjectAt(int x, int y)
        {
            ObjectShape obj = GetObjectAt(x, y);

            if (obj != null)
            {
                obj.Select();
            }

            return(obj);
        }
        public MemMemento getMemento()
        {
            List <ObjectShape> objectShapes = new List <ObjectShape>();

            foreach (ObjectShape obj in canvasState.getObjectShapes())
            {
                ObjectShape newObj = (ObjectShape)obj.Clone();
                objectShapes.Add(newObj);
            }

            return(new MemMemento(objectShapes));
        }
        public MemMemento CloneMemento(MemMemento mem)
        {
            List <ObjectShape> objectShapes = new List <ObjectShape>();

            foreach (ObjectShape obj in mem.getSavedObject())
            {
                ObjectShape newObj = (ObjectShape)obj.Clone();
                objectShapes.Add(newObj);
            }

            return(new MemMemento(objectShapes));
        }
        public void ToolMouseDown(object sender, MouseEventArgs e)
        {
            this.xInitial = e.X;
            this.yInitial = e.Y;

            if (e.Button == MouseButtons.Left && canvas != null)
            {
                canvas.DeselectAllObjects();
                selectedObject = canvas.SelectObjectAt(e.X, e.Y);
                canvas.RemoveDrawingObject(selectedObject);
            }
        }
Exemple #6
0
 public override void Deselect(ObjectShape obj)
 {
     obj.ChangeState(StaticState.GetInstance());
 }
Exemple #7
0
 public abstract bool Remove(ObjectShape obj);
Exemple #8
0
 public abstract bool Add(ObjectShape obj);
Exemple #9
0
        public override bool Remove(ObjectShape obj)
        {
            drawingObjects.Remove(obj);

            return(true);
        }
Exemple #10
0
        public override bool Add(ObjectShape obj)
        {
            drawingObjects.Add(obj);

            return(true);
        }
 public override void Draw(ObjectShape obj)
 {
     obj.RenderOnStaticView();
 }
Exemple #12
0
 public override bool Add(ObjectShape obj)
 {
     return(false);
 }
Exemple #13
0
 public override void Draw(ObjectShape obj)
 {
     obj.RenderOnEditingView();
 }
Exemple #14
0
 public override void Select(ObjectShape obj)
 {
 }
Exemple #15
0
 public override void Draw(ObjectShape obj)
 {
     obj.RenderOnPreview();
 }
Exemple #16
0
 public void AddDrawingObject(ObjectShape drawingObject)
 {
     this.objectShapes.Add(drawingObject);
 }
Exemple #17
0
 public void RemoveDrawingObject(ObjectShape drawingObject)
 {
     this.objectShapes.Remove(drawingObject);
     undoObject.SetStateForUndoRedo();
 }
 public override void Select(ObjectShape obj)
 {
     obj.ChangeState(EditState.GetInstance());
 }
Exemple #19
0
 public override bool Remove(ObjectShape obj)
 {
     return(false);
 }