Example #1
0
        protected override void DrawFrame (Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor)
        {        
            // base.DrawFrame (context, lineWidth, lineColor, fillColor);

            rect = DisplayBox;
            rect.OffsetDot5();

            // HERZUM SPRINT 1.2
            // CairoFigures.CurvedRectangle(context, rect, 30);
            CairoFigures.AngleFrame(context, rect, 0,0,0,0);
            // END HERZUM SPRINT 1.2

            Cairo.Color fillColorOrigin;
            fillColorOrigin = fillColor;

            lineWidth = 1;
            fillColor = new Cairo.Color (1.0, 1.0, 1.0, 1.0);

            context.Color = fillColor;  
            context.FillPreserve();
            context.Color = lineColor;
            context.LineWidth = lineWidth;

            double[] dash = {2, 0, 2};
            context.SetDash (dash, 0);

            context.Stroke();

            rect2 = DisplayBox;
            rect2.Width = DisplayBox.Width;
            rect2.Height = 30;
            rect2.OffsetDot5();
            CairoFigures.CurvedRectangle(context, rect2, 30);
            fillColor = fillColorOrigin;
            context.Color = fillColor;  
            context.FillPreserve();
            context.Color = lineColor;
            context.LineWidth = lineWidth;

            context.Stroke();

            // HERZUM SPRINT 2.1
            // m_applicationContext.MainWindow.ExperimentCanvasPad.LoopNodeControlCurrent = this;
            // END HERZUM SPRINT 2.1

            // HERZUM SPRINT 5.0: TLAB-235
            // DrawScope ();
            DrawScope ("Enter","Exit");
            // END HERZUM SPRINT 5.0: TLAB-235
        }
Example #2
0
		public override void Draw (MonoTextEditor editor, Cairo.Context cr, LineMetrics layout, int startOffset, int endOffset)
		{
			if (DebuggingService.IsDebugging)
				return;
			int markerStart = Segment.Offset;
			int markerEnd = Segment.EndOffset;
			if (markerEnd < startOffset || markerStart > endOffset) 
				return;
			
			double drawFrom;
			double drawTo;
			double y = layout.LineYRenderStartPosition;
			double startXPos = layout.TextRenderStartPosition;
			double endXPos = layout.TextRenderEndPosition;

			if (markerStart < startOffset && endOffset < markerEnd) {
				drawTo = endXPos;
				var line = editor.GetLineByOffset (startOffset);
				int offset = line.GetIndentation (editor.Document).Length;
				drawFrom = startXPos + (layout.Layout.Layout.IndexToPos (offset).X  / Pango.Scale.PangoScale);
			} else {
				int start;
				if (startOffset < markerStart) {
					start = markerStart;
				} else {
					var line = editor.GetLineByOffset (startOffset);
					int offset = line.GetIndentation (editor.Document).Length;
					start = startOffset + offset;
				}
				int end = endOffset < markerEnd ? endOffset : markerEnd;
				int x_pos;

				x_pos = layout.Layout.Layout.IndexToPos (start - startOffset).X;
				drawFrom = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
				x_pos = layout.Layout.Layout.IndexToPos (end - startOffset).X;
	
				drawTo = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
			}
			
			drawFrom = Math.Max (drawFrom, editor.TextViewMargin.XOffset);
			drawTo = Math.Max (drawTo, editor.TextViewMargin.XOffset);
			if (drawFrom >= drawTo)
				return;
			
			double height = editor.LineHeight / 5;
			cr.SetSourceColor (color);
			if (effect == MonoDevelop.Ide.Editor.TextSegmentMarkerEffect.WavedLine) {	
				Pango.CairoHelper.ShowErrorUnderline (cr, drawFrom, y + editor.LineHeight - height, drawTo - drawFrom, height);
			} else if (effect == MonoDevelop.Ide.Editor.TextSegmentMarkerEffect.DottedLine) {
				cr.Save ();
				cr.LineWidth = 1;
				cr.MoveTo (drawFrom + 1, y + editor.LineHeight - 1 + 0.5);
				cr.RelLineTo (Math.Min (drawTo - drawFrom, 4 * 3), 0);
				cr.SetDash (new double[] { 2, 2 }, 0);
				cr.Stroke ();
				cr.Restore ();
			} else {
				cr.MoveTo (drawFrom, y + editor.LineHeight - 1);
				cr.LineTo (drawTo, y + editor.LineHeight - 1);
				cr.Stroke ();
			}
		}
		void DrawIndent (Cairo.Context cr, LayoutWrapper layout, DocumentLine line, double xPos, double y)
		{
			if (!textEditor.Options.DrawIndentationMarkers)
				return;
			if (line.Length == 0) {
				var nextLine = line.NextLine;
				while (nextLine != null && nextLine.Length == 0)
					nextLine = nextLine.NextLine;
				if (nextLine != null)
					layout = GetLayout (nextLine);
			}
			if (layout.IndentSize == 0)
				return;
			cr.Save ();
			var dotted = new [] { textEditor.Options.Zoom };
			cr.SetDash (dotted, (int)y + textEditor.VAdjustment.Value);
			var top = y;
			var bottom = y + LineHeight;
			if (Caret.Line == line.LineNumber && textEditor.Options.HighlightCaretLine) {
				top += textEditor.Options.Zoom;
				bottom -= textEditor.Options.Zoom;
			}
			for (int i = 0; i < layout.IndentSize; i += textEditor.Options.IndentationSize) {
				var x = System.Math.Floor (xPos + i * charWidth);
				cr.MoveTo (x + 0.5, top);
				cr.LineTo (x + 0.5, bottom);

				cr.Color = ColorStyle.IndentationGuide.Color;
				cr.Stroke ();
			}
			cr.Restore ();
		}
Example #4
0
        public void Draw(Cairo.Context g, double scale, bool fillSelection)
        {
            g.Save ();
            g.Translate (0.5, 0.5);
            g.Scale (scale, scale);

            g.AppendPath (selection_path);

            if (fillSelection)
            {
                g.Color = new Cairo.Color (0.7, 0.8, 0.9, 0.2);
                g.FillRule = Cairo.FillRule.EvenOdd;
                g.FillPreserve ();
            }

            g.LineWidth = 1 / scale;

            // Draw a white line first so it shows up on dark backgrounds
            g.Color = new Cairo.Color (1, 1, 1);
            g.StrokePreserve ();

            // Draw a black dashed line over the white line
            g.SetDash (new double[] { 2 / scale, 4 / scale }, 0);
            g.Color = new Cairo.Color (0, 0, 0);

            g.Stroke ();
            g.Restore ();
        }
Example #5
0
        public static void DrawSelectionBox(Cairo.Context cr, double x, double y, double width, double height)
        {
            double[] dashes = {10.0,  /* ink */
                   10.0,  /* skip */
                   10.0,  /* ink */
                   10.0   /* skip*/
            };

            cr.Save ();
            cr.Color = new Cairo.Color (0.9, 0.9, 0.9, 1);
            cr.SetDash (dashes, 0);
            cr.Rectangle (x, y, width, height);
            cr.Stroke ();
            cr.Restore ();
        }
Example #6
0
		public override void Draw (TextEditor editor, Cairo.Context cr, Pango.Layout layout, bool selected, int startOffset, int endOffset, double y, double startXPos, double endXPos)
		{
			if (Debugger.DebuggingService.IsDebugging)
				return;
			int markerStart = Segment.Offset;
			int markerEnd = Segment.EndOffset;
			if (markerEnd < startOffset || markerStart > endOffset) 
				return;
			
			bool drawOverlay = result.InspectionMark == IssueMarker.GrayOut;
			
			if (drawOverlay && editor.IsSomethingSelected) {
				var selectionRange = editor.SelectionRange;
				if (selectionRange.Contains (markerStart) && selectionRange.Contains (markerEnd))
					return;
				if (selectionRange.Contains (markerEnd))
					markerEnd = selectionRange.Offset;
				if (selectionRange.Contains (markerStart))
					markerStart = selectionRange.EndOffset;
				if (markerEnd <= markerStart)
					return;
			}
			
			double drawFrom;
			double drawTo;
				
			if (markerStart < startOffset && endOffset < markerEnd) {
				drawTo = endXPos;
				var line = editor.GetLineByOffset (startOffset);
				int offset = line.GetIndentation (editor.Document).Length;
				drawFrom = startXPos + (layout.IndexToPos (offset).X  / Pango.Scale.PangoScale);
			} else {
				int start;
				if (startOffset < markerStart) {
					start = markerStart;
				} else {
					var line = editor.GetLineByOffset (startOffset);
					int offset = line.GetIndentation (editor.Document).Length;
					start = startOffset + offset;
				}
				int end = endOffset < markerEnd ? endOffset : markerEnd;
				int x_pos;

				x_pos = layout.IndexToPos (start - startOffset).X;
				drawFrom = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
				x_pos = layout.IndexToPos (end - startOffset).X;
	
				drawTo = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
			}
			
			drawFrom = System.Math.Max (drawFrom, editor.TextViewMargin.XOffset);
			drawTo = System.Math.Max (drawTo, editor.TextViewMargin.XOffset);
			if (drawFrom >= drawTo)
				return;
			
			double height = editor.LineHeight / 5;
			cr.SetSourceColor (GetColor (editor, Result));
			if (drawOverlay) {
				cr.Rectangle (drawFrom, y, drawTo - drawFrom, editor.LineHeight);
				var color = editor.ColorStyle.PlainText.Background;
				color.A = 0.6;
				cr.SetSourceColor (color);
				cr.Fill ();
			} else if (result.InspectionMark == IssueMarker.WavedLine) {	
				Pango.CairoHelper.ShowErrorUnderline (cr, drawFrom, y + editor.LineHeight - height, drawTo - drawFrom, height);
			} else if (result.InspectionMark == IssueMarker.DottedLine) {
				cr.Save ();
				cr.LineWidth = 1;
				cr.MoveTo (drawFrom + 1, y + editor.LineHeight - 1 + 0.5);
				cr.RelLineTo (System.Math.Min (drawTo - drawFrom, 4 * 3), 0);
				cr.SetDash (new double[] { 2, 2 }, 0);
				cr.Stroke ();
				cr.Restore ();
			} else {
				cr.MoveTo (drawFrom, y + editor.LineHeight - 1);
				cr.LineTo (drawTo, y + editor.LineHeight - 1);
				cr.Stroke ();
			}
		}
Example #7
0
        private void DrawLine(Cairo.Color c, BorderStyleEnum bs, float w, Cairo.Context g, double x, double y, double x2, double y2)
        {
            if (bs == BorderStyleEnum.None//|| c.IsEmpty 
                || w <= 0)   // nothing to draw 
                return;

            g.Save();
//          Pen p = null;  
//          p = new Pen(c, w);
            g.Color = c;
            g.LineWidth = w;
            switch (bs)
            {
                case BorderStyleEnum.Dashed:
//	                p.DashStyle = DashStyle.Dash;
                    g.SetDash(new double[] { 2, 1 }, 0.0);
                    break;
                case BorderStyleEnum.Dotted:
//                        p.DashStyle = DashStyle.Dot;
                    g.SetDash(new double[] { 1 }, 0.0);
                    break;
                case BorderStyleEnum.Double:
                case BorderStyleEnum.Groove:
                case BorderStyleEnum.Inset:
                case BorderStyleEnum.Solid:
                case BorderStyleEnum.Outset:
                case BorderStyleEnum.Ridge:
                case BorderStyleEnum.WindowInset:
                default:
                    g.SetDash(new double[] { }, 0.0);
                    break;
            }
	
//  	    g.DrawLine(p, x, y, x2, y2);
            g.MoveTo(x, y);
            g.LineTo(x2, y2);
            g.Stroke();
            
            g.Restore();
        }
Example #8
0
        protected override void DrawFrame (Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor)
        {          
            rect = DisplayBox;
            rect.OffsetDot5();
            CairoFigures.AngleFrame(context, rect, 0, 0, 0, 0);

            Cairo.Color fillColorOrigin;
            fillColorOrigin = fillColor;

            lineWidth = 1;
            fillColor = new Cairo.Color (1.0, 1.0, 1.0, 1.0);

            context.Color = fillColor;  
            context.FillPreserve();
            context.Color = lineColor;
            context.LineWidth = lineWidth;

            double[] dash = {2, 0, 2};
            context.SetDash (dash, 0);

            context.Stroke();

            rect2 = DisplayBox;
            rect2.Width = DisplayBox.Width;
            rect2.Height = 30;
            rect2.OffsetDot5();
            CairoFigures.AngleFrame(context, rect2, 0, 0, 0, 0);
            fillColor = fillColorOrigin;
            context.Color = fillColor;  
            context.FillPreserve();
            context.Color = lineColor;
            context.LineWidth = lineWidth;

            context.Stroke();

            // HERZUM SPRINT 1.1 LOOP 
            DrawScope ();
            // END HERZUM SPRINT 1.1 LOOP

        }
Example #9
0
    public override void Draw(Cairo.Context cr)
    {
        int dir = X1 > X0 ? 1 : -1;

        cr.Save();

        cr.SetFontSize(8);
        if(arrow_kind == ArrowKind.Return)
        {
            double[] returnDash = new double[]{ 3.0, 3.0 };
            cr.SetDash(returnDash, 0);
        }

        cr.MoveTo(X0, Y0);
        cr.LineTo(X1, Y1);
        cr.Stroke();

        cr.MoveTo(X1 - dir*7, Y1 - 3);
        cr.LineTo(X1, Y1);
        cr.LineTo(X1 - dir*7, Y1 + 3);
        if(arrow_kind == ArrowKind.Async)
        {
            cr.Stroke();
        }
        else
        {
            cr.MoveTo(X1 - dir*7, Y1 - 3);
            cr.Fill();
        }

        if((text != null) && !text.Equals(""))
        {
            if(dir > 0)
            {
                cr.MoveTo(XText + 5, Y0 - 5);
                cr.ShowText(text);
            }
            else
            {
                TextExtents te = cr.TextExtents(text);
                cr.MoveTo(XText - 5 - te.Width, Y0 - 5);
                cr.ShowText(text);
            }
        }
        cr.Restore();
    }
Example #10
0
    public override void Draw(Cairo.Context cr)
    {
        cr.Save();

        cr.SetFontSize(8);
        if(ArrowKind == ArrowKind.Return)
        {
            double[] returnDash = new double[]{ 3.0, 3.0 };
            cr.SetDash(returnDash, 0);
        }

        cr.MoveTo(X0, Y0);
        cr.LineTo(X1, Y0);
        cr.LineTo(X1, Y1);
        cr.LineTo(X0b, Y1);
        cr.Stroke();

        cr.MoveTo(X0b + 7, Y1 - 3);
        cr.LineTo(X0b, Y1);
        cr.LineTo(X0b + 7, Y1 + 3);
        if(ArrowKind == ArrowKind.Async)
        {
            cr.Stroke();
        }
        else
        {
            cr.MoveTo(X0b + 7, Y1 - 3);
            cr.Fill();
        }

        if((Text != null) && !Text.Equals(""))
        {
            cr.MoveTo(XText + 5, Y0 - 5);
            cr.ShowText(Text);
        }
        cr.Restore();
    }
Example #11
0
        protected override void onDraw(Cairo.Context gr)
        {
            base.onDraw (gr);

            if (values.Count == 0)
                return;
            Rectangle r = ClientRectangle;

            int i = values.Count -1;

            double ptrX = (double)r.Right;
            double scaleY = (double)r.Height / (Maximum - Minimum);
            double stepX = (double)r.Width / (double)(nbValues-1);

            gr.LineWidth = 1.0;
            gr.SetDash (new double[]{ 1.0 },0.0);

            LowThresholdFill.SetAsSource (gr);
            gr.MoveTo (r.Left, r.Bottom - LowThreshold * scaleY);
            gr.LineTo (r.Right, r.Bottom - LowThreshold * scaleY);
            //			gr.Rectangle (r.Left, r.Bottom - LowThreshold * scaleY, r.Width, LowThreshold * scaleY);
            gr.Stroke();

            HighThresholdFill.SetAsSource (gr);
            gr.MoveTo (r.Left, (Maximum - HighThreshold) * scaleY);
            gr.LineTo (r.Right, (Maximum - HighThreshold) * scaleY);
            //			gr.Rectangle (r.Left, r.Top, r.Width, (Maximum - HighThreshold) * scaleY);
            gr.Stroke();

            gr.MoveTo (ptrX, values [i] * scaleY);

            Foreground.SetAsSource (gr);
            gr.SetDash (new double[]{ }, 0.0);

            while (i >= 0) {
                    gr.LineTo (ptrX, r.Bottom - values [i] * scaleY);
                ptrX -= stepX;
                i--;
            }
            gr.Stroke ();
        }