Example #1
0
        void Do(Point?cursorPosition, FillAttributes attributes)
        {
            var handler = this.Handler as CharacterHandler;
            var rect    = attributes.Rectangle;

            rect.Normalize();

            handler.Undo.Save(cursorPosition, cursorPosition, rect);

            if (attributes.Mode.HasFlag(Controls.FillMode.Attribute))
            {
                handler.CurrentPage.Canvas.Fill(rect, attributes.Attribute);
            }
            else if (attributes.Mode.HasFlag(Controls.FillMode.Background))
            {
                handler.CurrentPage.Canvas.FillBackground(rect, attributes.Attribute.Background);
            }
            else if (attributes.Mode.HasFlag(Controls.FillMode.Foreground))
            {
                handler.CurrentPage.Canvas.FillForeground(rect, attributes.Attribute.Foreground);
            }

            if (attributes.Mode.HasFlag(Controls.FillMode.Character))
            {
                handler.CurrentPage.Canvas.Fill(rect, attributes.Character);
            }
        }
Example #2
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);
            });
        }
Example #3
0
        FillAttributes GetAttribs()
        {
            var attribs = this.Attributes;

            if (attribs == null)
            {
                var handler = this.Handler as CharacterHandler;
                var dialog  = new FillDialog(handler);
                var result  = dialog.ShowModal((Control)handler.Viewer);
                if (!result)
                {
                    return(null);
                }
                attribs = new FillAttributes {
                    Mode      = dialog.FillMode,
                    Attribute = dialog.Attribute,
                    Character = dialog.Character,
                    Rectangle = tool.SelectedRegion.Value
                };
            }
            return(attribs);
        }