Beispiel #1
0
 protected override void DoPaint(PaintArgs p)
 {
     this.Plot.LayoutManager.Execute(p, false, base.InnerRectangle, base.InnerRectangle);
     this.Plot.LayoutManager.DrawLayout(p, base.Font, SystemColors.ControlText, SystemColors.Control);
     PlotLayoutViewer.DragControl.Draw(p, base.Font, SystemColors.ControlText, Color.FromArgb(200, Color.SteelBlue));
     this.DoSetup();
 }
Beispiel #2
0
        public void Paint(PaintArgs args)
        {
            // Check if the actor is valid for this paint operation.
            if (lastPaintType != args.PaintType)
            {
                // Invalid actor. Change it.
                currentActor.Clear();

                currentActor = actors[args.PaintType];
            }

            lastPaintType = args.PaintType;

            // Let the actor paint.
            currentActor.Paint(args);
        }
Beispiel #3
0
        protected override void DoPaint(PaintArgs p)
        {
            base.m_ObjectList.Clear();
            foreach (PlotObject dataView in this.DataViews)
            {
                base.m_ObjectList.Add(dataView);
            }
            foreach (PlotObject label in base.Labels)
            {
                base.m_ObjectList.Add(label);
            }
            foreach (PlotObject legend in base.Legends)
            {
                base.m_ObjectList.Add(legend);
            }
            foreach (PlotObject table in base.Tables)
            {
                base.m_ObjectList.Add(table);
            }
            foreach (PlotObject xAxis in this.XAxes)
            {
                base.m_ObjectList.Add(xAxis);
            }
            foreach (PlotObject yAxis in this.YAxes)
            {
                base.m_ObjectList.Add(yAxis);
            }
            foreach (PlotObject annotation in base.Annotations)
            {
                base.m_ObjectList.Add(annotation);
            }
            foreach (PlotObject dataCursor in this.DataCursors)
            {
                base.m_ObjectList.Add(dataCursor);
            }
            foreach (PlotObject limit in this.Limits)
            {
                base.m_ObjectList.Add(limit);
            }
            foreach (PlotChannelBase channel in this.Channels)
            {
                channel.LegendRectangle = Rectangle.Empty;
                base.m_ObjectList.Add(channel);
            }
            base.m_ObjectList.Sort(base.m_SorterLayer);
            this.m_LayoutManager.Execute(p, false, p.DrawRectangle, p.DrawRectangle);
            GraphicsState gstate = p.Graphics.Save();

            p.Graphics.ResetTransform();
            if (base.Background.Visible)
            {
                p.Graphics.FillRectangle(base.I_Background.GetBrush(p, base.ClientRectangle), base.ClientRectangle);
            }
            p.Graphics.Restore(gstate);
            foreach (IPlotDraw @object in base.m_ObjectList)
            {
                @object.DrawSetup(p);
            }
            foreach (IPlotDraw object2 in base.m_ObjectList)
            {
                object2.UpdateCanDraw(p);
                object2.UpdateBoundsClip(p);
            }
            foreach (IPlotDraw object3 in base.m_ObjectList)
            {
                object3.DrawCalculations(p);
            }
            foreach (IPlotDraw object4 in base.m_ObjectList)
            {
                p.Graphics.ResetClip();
                object4.DrawBackgroundLayer1(p);
            }
            foreach (IPlotDraw object5 in base.m_ObjectList)
            {
                p.Graphics.ResetClip();
                object5.DrawBackgroundLayer2(p);
            }
            foreach (IPlotDraw object6 in base.m_ObjectList)
            {
                p.Graphics.ResetClip();
                object6.Draw(p);
            }
            foreach (IPlotDraw object7 in base.m_ObjectList)
            {
                p.Graphics.ResetClip();
                object7.DrawForegroundLayer1(p);
            }
            foreach (IPlotDraw object8 in base.m_ObjectList)
            {
                p.Graphics.ResetClip();
                object8.DrawForegroundLayer2(p);
            }
            foreach (IPlotDraw object9 in base.m_ObjectList)
            {
                p.Graphics.ResetClip();
                object9.DrawFocusRectangles(p);
            }
        }
Beispiel #4
0
 protected override void DoPaint(PaintArgs p)
 {
     ((ITextLayoutBase)this.TextLayout).Draw(p.Graphics, base.Font, p.Graphics.Brush(base.ForeColor), this.Text, p.DrawRectangle);
 }
Beispiel #5
0
 /// <summary>
 /// Called when tile is painted.
 /// </summary>
 public abstract void Paint(PaintArgs args);
Beispiel #6
0
        private void Paint()
        {
            if (!layers.HasLayerSelected)
            {
                return;
            }
            if (!tilesets.HasTilesetSelected)
            {
                return;
            }

            // Get brush bucket.
            BrushBucket brushBucket = brushBuckets[tilesets.SelectedTileset];

            // Return if no brush is selected or it cant be used for painting.
            if (!brushBucket.HasBrushSelected)
            {
                return;
            }
            if (!brushBucket.SelectedBrush.CanPaint())
            {
                return;
            }

            int fromX = Mouse.GetState().X;
            int fromY = Mouse.GetState().Y;

            // Check that mouse is inside editors view port.
            if (!SpriteBatch.GraphicsDevice.Viewport.Bounds.Contains(fromX, fromY))
            {
                return;
            }

            // Calculate index.
            fromX = fromX / tileEngine.TileSizeInPixels.X;
            fromY = fromY / tileEngine.TileSizeInPixels.Y;

            // Check that the index is in bounds.
            if (fromX < 0 || fromX >= layers.SelectedLayer.Width)
            {
                return;
            }
            if (fromY < 0 || fromY >= layers.SelectedLayer.Height)
            {
                return;
            }

            // Get brush and paint with it.
            TileBrush brush = brushBucket.SelectedBrush;

            // Transform position relative to the layer.
            fromX -= layers.SelectedLayer.X / tileEngine.TileSizeInPixels.X;
            fromY -= layers.SelectedLayer.Y / tileEngine.TileSizeInPixels.Y;

            int toX = fromX + brush.Width;

            toX = toX >= layers.SelectedLayer.Width ? layers.SelectedLayer.Width : toX;

            int toY = fromY + brush.Height;

            toY = toY >= layers.SelectedLayer.Height ? layers.SelectedLayer.Height : toY;

            // Begin paint.
            brush.BeginPainting();

            for (int i = fromY; i < toY; i++)
            {
                // Check if brush has finished painting.
                if (!brush.Painting())
                {
                    return;
                }

                for (int j = fromX; j < toX; j++)
                {
                    // Check if brush has finished painting.
                    if (!brush.Painting())
                    {
                        return;
                    }

                    PaintArgs paintArgs = brush.Paint();

                    layers.SelectedLayer.TileAtIndex(j, i).Paint(paintArgs);
                }
            }

            // End paint.
            brush.EndPainting();
        }