Exemplo n.º 1
0
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);
            CharacterHandler handler = this.Handler as CharacterHandler;
            Canvas           canvas  = handler.CurrentPage.Canvas;

            int y = args.Message.ReadVariableInt32();

            var rect = new Rectangle(0, y, canvas.Width, canvas.Height - y);

            if (!args.IsMe)
            {
                args.Invoke(delegate {
                    handler.Undo.Save(new UndoDeleteLine(handler, y)
                    {
                        CursorLocation = handler.CursorPosition
                    });
                    canvas.DeleteRow(y);
                    if (y < handler.CursorPosition.Y)
                    {
                        var pos = handler.CursorPosition;
                        pos.Y--;
                        handler.CursorPosition = pos;
                        var scrollpos          = handler.Viewer.ScrollPosition;
                        if (scrollpos.Y > handler.CurrentPage.Font.Height)
                        {
                            scrollpos.Y -= handler.CurrentPage.Font.Height;
                            handler.Viewer.ScrollPosition = scrollpos;
                        }
                    }
                    if (handler.SelectedTool != null)
                    {
                        handler.SelectedTool.DeleteLine(y);
                    }

                    handler.InvalidateCharacterRegion(rect, true);
                });
            }
            else
            {
                args.Invoke(delegate {
                    handler.Undo.Save(new UndoDeleteLine(handler, y)
                    {
                        CursorLocation = handler.CursorPosition
                    });
                    canvas.DeleteRow(y);
                    handler.InvalidateCharacterRegion(rect, true);
                });
            }
        }
Exemplo n.º 2
0
        public void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            var commands = new List <RipCommand>();

            args.Message.ReadCommands(handler.RipDocument, commands);
            handler.Document.IsModified = true;
            args.Invoke(delegate {
                var updates = new List <Rectangle>();
                if (handler.SelectedTool != null)
                {
                    handler.SelectedTool.RemoveDrawing(updates);
                }
                foreach (var cmd in commands)
                {
                    var optional = cmd as RipOptionalCommand;
                    if (optional != null && !optional.ShouldApply(handler.BGI))
                    {
                        continue;
                    }
                    handler.RipDocument.Commands.Add(cmd);
                    cmd.Apply(updates);
                }
                handler.RedoBuffer.Clear();
                if (handler.SelectedTool != null)
                {
                    handler.SelectedTool.ApplyDrawing(updates);
                }
                handler.BGI.UpdateRegion(updates);
            });
        }
Exemplo n.º 3
0
        public void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            var useIce = args.Message.ReadBoolean();

            args.Invoke(delegate
            {
                Do(useIce);
            });
        }
Exemplo n.º 4
0
        public void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            Palette = args.Message.ReadPalette();

            args.Invoke(delegate {
                Handler.CurrentPage.Palette = Palette;
                Handler.Document.IsModified = true;
            });
        }
Exemplo n.º 5
0
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);
            var rect    = args.Message.ReadRectangle();
            var element = args.Message.ReadCanvasElement();

            args.Invoke(delegate {
                Do(rect, null, element);
            });
        }
Exemplo n.º 6
0
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);
            var rect           = args.Message.ReadRectangle();
            var applyColour    = args.Message.ReadBoolean();
            var applyCharacter = args.Message.ReadBoolean();
            var filled         = args.Message.ReadBoolean();
            var element        = args.Message.ReadCanvasElement();

            args.Invoke(delegate {
                Do(null, rect, element, applyColour, applyCharacter, filled);
            });
        }
Exemplo n.º 7
0
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);
            var start          = args.Message.ReadPoint();
            var end            = args.Message.ReadPoint();
            var applyColour    = args.Message.ReadBoolean();
            var applyCharacter = args.Message.ReadBoolean();
            var element        = args.Message.ReadCanvasElement();

            args.Invoke(delegate {
                Do(null, start, end, element, applyColour, applyCharacter);
            });
        }
Exemplo n.º 8
0
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);
            var gradient    = args.Message.ReadArray <Character>();
            var location    = args.Message.ReadPoint();
            var attr        = args.Message.ReadAttribute();
            var inverse     = args.Message.ReadBoolean();
            var applyColour = args.Message.ReadBoolean();
            var size        = args.Message.ReadVariableInt32();

            args.Invoke(delegate {
                Do(location, null, attr, gradient, size, inverse, applyColour);
            });
        }
Exemplo n.º 9
0
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);
            var handler = Handler as CharacterHandler;
            var canvas  = handler.CurrentPage.Canvas;
            var x       = args.Message.ReadVariableInt32();

            args.Invoke(delegate {
                handler.Undo.Save(new UndoInsertColumn(handler, x)
                {
                    CursorLocation = handler.CursorPosition
                });
                canvas.InsertColumn(x);
                handler.InvalidateCharacterRegion(new Rectangle(x, 0, canvas.Width - x, canvas.Height), true);
            });
        }
Exemplo n.º 10
0
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);
            var handler = this.Handler as CharacterHandler;
            var attribs = new FillAttributes {
                Rectangle = args.Message.ReadRectangle(),
                Mode      = args.Message.ReadEnum <Controls.FillMode>(),
                Attribute = args.Message.ReadAttribute(),
                Character = args.Message.ReadInt32()
            };

            args.Invoke(delegate {
                Do(null, attribs);
                handler.InvalidateCharacterRegion(attribs.Rectangle, true);
            });
        }
Exemplo n.º 11
0
        public void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            var color = args.Message.ReadColor();
            var index = args.Message.ReadVariableInt32();

            args.Invoke(delegate {
                var pal = Handler.CurrentPage.Palette;
                if (index < pal.Count)
                {
                    Handler.Undo.Save(new UndoColour {
                        Color = pal [index], Index = index
                    });
                    pal [index] = color;
                    Handler.Document.IsModified = true;
                }
            });
        }
Exemplo n.º 12
0
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);
            var pos       = args.Message.ReadPoint();
            var insmod    = args.Message.ReadBoolean();
            var fore      = args.Message.ReadVariableInt32();
            var back      = args.Message.ReadVariableInt32();
            var character = args.Message.ReadVariableInt32();
            var ce        = new CanvasElement(character, new Attribute(fore, back));
            var nextPos   = pos;

            if (nextPos.X < Handler.CurrentPage.Canvas.Width - 1)
            {
                nextPos.X++;
            }
            args.Invoke(delegate {
                Do(Handler as CharacterHandler, pos, ce, insmod, true, true, args.IsMe ? (Point?)pos : null, args.IsMe ? (Point?)nextPos : null);
            });
        }