コード例 #1
0
ファイル: SendCommands.cs プロジェクト: themnotyou/pablodraw
        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);
            });
        }
コード例 #2
0
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);
            var pos = args.Message.ReadPoint();

            DoDelete(pos);
        }
コード例 #3
0
ファイル: UndoRect.cs プロジェクト: themnotyou/pablodraw
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);
            Location = args.Message.ReadPoint();
            var characterDocument = args.Document as CharacterDocument;

            Canvas = args.Message.ReadCanvas(characterDocument.Pages[0].Palette);
        }
コード例 #4
0
ファイル: User.cs プロジェクト: themnotyou/pablodraw
 public void Receive(ReceiveCommandArgs args)
 {
     Key      = new Guid(args.Message.ReadString());
     Alias    = args.Message.ReadString();
     HostName = args.Message.ReadString();
     //IPAddress = args.Message.ReadIPAddress();
     Level = (UserLevel)args.Message.ReadVariableInt32();
 }
コード例 #5
0
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);
            var cursor = args.Message.ReadPoint();
            var pos    = args.Message.ReadPoint();

            InsertLine(pos, cursor);
        }
コード例 #6
0
        public void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            Palette = args.Message.ReadPalette();

            args.Invoke(delegate {
                Handler.CurrentPage.Palette = Palette;
                Handler.Document.IsModified = true;
            });
        }
コード例 #7
0
ファイル: IUndoItem.cs プロジェクト: themnotyou/pablodraw
        public virtual void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            var id = args.Message.ReadInt32();

            if (id != UndoID)
            {
                throw new InvalidOperationException("invalid undo type");
            }
        }
コード例 #8
0
        public void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            var useIce = args.Message.ReadBoolean();

            args.Invoke(delegate
            {
                Do(useIce);
            });
        }
コード例 #9
0
ファイル: Delete.cs プロジェクト: themnotyou/pablodraw
        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);
            });
        }
コード例 #10
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);
            });
        }
コード例 #11
0
ファイル: DrawLine.cs プロジェクト: themnotyou/pablodraw
        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);
            });
        }
コード例 #12
0
ファイル: DeleteLine.cs プロジェクト: themnotyou/pablodraw
        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);
                });
            }
        }
コード例 #13
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);
            });
        }
コード例 #14
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);
            });
        }
コード例 #15
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);
            });
        }
コード例 #16
0
ファイル: SetColour.cs プロジェクト: themnotyou/pablodraw
        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;
                }
            });
        }
コード例 #17
0
ファイル: DrawCharacter.cs プロジェクト: themnotyou/pablodraw
        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);
            });
        }
コード例 #18
0
ファイル: UndoBuffer.cs プロジェクト: themnotyou/pablodraw
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);

            /*var hasLocation = args.Message.ReadBoolean ();
             * CursorLocation = hasLocation ? (Point?)args.Message.ReadPoint() : null;
             *
             * var hasnextLocation = args.Message.ReadBoolean ();
             * NextLocation = hasnextLocation ? (Point?)args.Message.ReadPoint () : null;*/

            Items.Clear();
            var count = args.Message.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                var type = (UndoType)Enum.ToObject(typeof(UndoType), args.Message.PeekInt32());
                var item = UndoManager.CreateUndoItem(type);
                if (item != null)
                {
                    item.Receive(args);
                    Items.Add(item);
                }
            }
        }
コード例 #19
0
 public override void Receive(Pablo.Network.ReceiveCommandArgs args)
 {
     base.Receive(args);
     Position     = args.Message.ReadPoint();
     NextPosition = args.Message.ReadBoolean() ? (Point?)args.Message.ReadPoint() : null;
 }
コード例 #20
0
 public void Receive(Pablo.Network.ReceiveCommandArgs args)
 {
     character = args.Message.ReadInt16();
 }
コード例 #21
0
 public override void Receive(Pablo.Network.ReceiveCommandArgs args)
 {
     base.Receive(args);
     Color = args.Message.ReadColor();
     Index = args.Message.ReadVariableInt32();
 }