Ejemplo n.º 1
0
        public MapTerritory(String name, bool land_i, ArrayList borders_i)
        {
            deepSea = false; /* defaults off, will be set later */
            isLand = land_i;
            Name = name;

            borders = new Point[borders_i.Count];
            connectedTerritories = new ArrayList();

            int totalX = 0, totalY = 0;

               	for (int i=0; i < borders_i.Count; i++)
            {
              			borders[i]=(Gdk.Point)borders_i[i];
               		totalX += borders[i].X;
            totalY += borders[i].Y;
            }

            /* Find the mathCenter of the border */
            mathCenterX = (totalX / borders_i.Count);
            mathCenterY = (totalY / borders_i.Count);

            physCenterX = mathCenterX;
            physCenterY = mathCenterY;

               	/* Make region */
               	region = Gdk.Region.Polygon(borders, FillRule.WindingRule);
        }
Ejemplo n.º 2
0
 void Highlight(string tag, Region region)
 {
     var start = buffer.GetIterAtMark(lineStart);
     start.ForwardChars(region.Location.Column);
     var end = start;
     end.ForwardChars(region.Length);
     buffer.ApplyTag(tag, start, end);
 }
Ejemplo n.º 3
0
        bool OnSelectionExposeEvent(EventExpose evnt)
        {
            if (selection == Rectangle.Zero)
                return false;

            Rectangle win_selection = ImageCoordsToWindow (selection);
            using (var evnt_region = evnt.Region.Copy ()) {
                using (Region r = new Region ()) {
                    r.UnionWithRect (win_selection);
                    evnt_region.Subtract (r);
                }

                using (Cairo.Context ctx = CairoHelper.Create (GdkWindow)) {
                    ctx.SetSourceRGBA (.5, .5, .5, .7);
                    CairoHelper.Region (ctx, evnt_region);
                    ctx.Fill ();
                }
            }
            return true;
        }
Ejemplo n.º 4
0
 public override void HighlightStringLiteral(Region region)
 {
     Highlight("string", region);
 }
Ejemplo n.º 5
0
 public override void HighlightNumberLiteral(Region region)
 {
     Highlight("number", region);
 }