protected void CreateHandler() { controls[0] = new ToolControl((x, y, s) => { shape_origin.X = x; shape_origin.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) { shape_origin.X = shape_end.X - shape_end.Y + shape_origin.Y; } else { shape_origin.Y = shape_end.Y - shape_end.X + shape_origin.X; } } ReDraw(s); }); controls[1] = new ToolControl((x, y, s) => { shape_origin.X = x; shape_end.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) { shape_origin.X = shape_end.X - shape_end.Y + shape_origin.Y; } else { shape_end.Y = shape_origin.Y + shape_end.X - shape_origin.X; } } ReDraw(s); }); controls[2] = new ToolControl((x, y, s) => { shape_end.X = x; shape_origin.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) { shape_end.X = shape_origin.X + shape_end.Y - shape_origin.Y; } else { shape_origin.Y = shape_end.Y - shape_end.X + shape_origin.X; } } ReDraw(s); }); controls[3] = new ToolControl((x, y, s) => { shape_end.X = x; shape_end.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) { shape_end.X = shape_origin.X + shape_end.Y - shape_origin.Y; } else { shape_end.Y = shape_origin.Y + shape_end.X - shape_origin.X; } } ReDraw(s); }); controls[4] = new ToolControl((x, y, s) => { shape_origin.X = x; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.X - shape_origin.X; shape_origin.Y = (shape_origin.Y + shape_end.Y - d) / 2; shape_end.Y = (shape_origin.Y + shape_end.Y + d) / 2; } ReDraw(s); }); controls[5] = new ToolControl((x, y, s) => { shape_origin.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.Y - shape_origin.Y; shape_origin.X = (shape_origin.X + shape_end.X - d) / 2; shape_end.X = (shape_origin.X + shape_end.X + d) / 2; } ReDraw(s); }); controls[6] = new ToolControl((x, y, s) => { shape_end.X = x; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.X - shape_origin.X; shape_origin.Y = (shape_origin.Y + shape_end.Y - d) / 2; shape_end.Y = (shape_origin.Y + shape_end.Y + d) / 2; } ReDraw(s); }); controls[7] = new ToolControl((x, y, s) => { shape_end.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.Y - shape_origin.Y; shape_origin.X = (shape_origin.X + shape_end.X - d) / 2; shape_end.X = (shape_origin.X + shape_end.X + d) / 2; } ReDraw(s); }); }
protected void CreateHandler() { controls[0] = new ToolControl (CursorType.TopLeftCorner, (x, y, s) => { shape_origin.X = x; shape_origin.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) shape_origin.X = shape_end.X - shape_end.Y + shape_origin.Y; else shape_origin.Y = shape_end.Y - shape_end.X + shape_origin.X; } }); controls[1] = new ToolControl (CursorType.BottomLeftCorner, (x, y, s) => { shape_origin.X = x; shape_end.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) shape_origin.X = shape_end.X - shape_end.Y + shape_origin.Y; else shape_end.Y = shape_origin.Y + shape_end.X - shape_origin.X; } }); controls[2] = new ToolControl (CursorType.TopRightCorner, (x, y, s) => { shape_end.X = x; shape_origin.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) shape_end.X = shape_origin.X + shape_end.Y - shape_origin.Y; else shape_origin.Y = shape_end.Y - shape_end.X + shape_origin.X; } }); controls[3] = new ToolControl (CursorType.BottomRightCorner, (x, y, s) => { shape_end.X = x; shape_end.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) shape_end.X = shape_origin.X + shape_end.Y - shape_origin.Y; else shape_end.Y = shape_origin.Y + shape_end.X - shape_origin.X; } }); controls[4] = new ToolControl (CursorType.LeftSide, (x, y, s) => { shape_origin.X = x; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.X - shape_origin.X; shape_origin.Y = (shape_origin.Y + shape_end.Y - d) / 2; shape_end.Y = (shape_origin.Y + shape_end.Y + d) / 2; } }); controls[5] = new ToolControl (CursorType.TopSide, (x, y, s) => { shape_origin.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.Y - shape_origin.Y; shape_origin.X = (shape_origin.X + shape_end.X - d) / 2; shape_end.X = (shape_origin.X + shape_end.X + d) / 2; } }); controls[6] = new ToolControl (CursorType.RightSide, (x, y, s) => { shape_end.X = x; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.X - shape_origin.X; shape_origin.Y = (shape_origin.Y + shape_end.Y - d) / 2; shape_end.Y = (shape_origin.Y + shape_end.Y + d) / 2; } }); controls[7] = new ToolControl (CursorType.BottomSide, (x, y, s) => { shape_end.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.Y - shape_origin.Y; shape_origin.X = (shape_origin.X + shape_end.X - d) / 2; shape_end.X = (shape_origin.X + shape_end.X + d) / 2; } }); }
protected void CreateHandler() { controls[0] = new ToolControl(CursorType.TopLeftCorner, (x, y, s) => { shape_origin.X = x; shape_origin.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) { shape_origin.X = shape_end.X - shape_end.Y + shape_origin.Y; } else { shape_origin.Y = shape_end.Y - shape_end.X + shape_origin.X; } } }); controls[1] = new ToolControl(CursorType.BottomLeftCorner, (x, y, s) => { shape_origin.X = x; shape_end.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) { shape_origin.X = shape_end.X - shape_end.Y + shape_origin.Y; } else { shape_end.Y = shape_origin.Y + shape_end.X - shape_origin.X; } } }); controls[2] = new ToolControl(CursorType.TopRightCorner, (x, y, s) => { shape_end.X = x; shape_origin.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) { shape_end.X = shape_origin.X + shape_end.Y - shape_origin.Y; } else { shape_origin.Y = shape_end.Y - shape_end.X + shape_origin.X; } } }); controls[3] = new ToolControl(CursorType.BottomRightCorner, (x, y, s) => { shape_end.X = x; shape_end.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) { shape_end.X = shape_origin.X + shape_end.Y - shape_origin.Y; } else { shape_end.Y = shape_origin.Y + shape_end.X - shape_origin.X; } } }); controls[4] = new ToolControl(CursorType.LeftSide, (x, y, s) => { shape_origin.X = x; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.X - shape_origin.X; shape_origin.Y = (shape_origin.Y + shape_end.Y - d) / 2; shape_end.Y = (shape_origin.Y + shape_end.Y + d) / 2; } }); controls[5] = new ToolControl(CursorType.TopSide, (x, y, s) => { shape_origin.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.Y - shape_origin.Y; shape_origin.X = (shape_origin.X + shape_end.X - d) / 2; shape_end.X = (shape_origin.X + shape_end.X + d) / 2; } }); controls[6] = new ToolControl(CursorType.RightSide, (x, y, s) => { shape_end.X = x; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.X - shape_origin.X; shape_origin.Y = (shape_origin.Y + shape_end.Y - d) / 2; shape_end.Y = (shape_origin.Y + shape_end.Y + d) / 2; } }); controls[7] = new ToolControl(CursorType.BottomSide, (x, y, s) => { shape_end.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.Y - shape_origin.Y; shape_origin.X = (shape_origin.X + shape_end.X - d) / 2; shape_end.X = (shape_origin.X + shape_end.X + d) / 2; } }); }
protected void CreateHandler() { controls[0] = new ToolControl ((x, y, s) => { shape_origin.X = x; shape_origin.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) shape_origin.X = shape_end.X - shape_end.Y + shape_origin.Y; else shape_origin.Y = shape_end.Y - shape_end.X + shape_origin.X; } ReDraw (s); }); controls[1] = new ToolControl ((x, y, s) => { shape_origin.X = x; shape_end.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) shape_origin.X = shape_end.X - shape_end.Y + shape_origin.Y; else shape_end.Y = shape_origin.Y + shape_end.X - shape_origin.X; } ReDraw (s); }); controls[2] = new ToolControl ((x, y, s) => { shape_end.X = x; shape_origin.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) shape_end.X = shape_origin.X + shape_end.Y - shape_origin.Y; else shape_origin.Y = shape_end.Y - shape_end.X + shape_origin.X; } ReDraw (s); }); controls[3] = new ToolControl ((x, y, s) => { shape_end.X = x; shape_end.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { if (shape_end.X - shape_origin.X <= shape_end.Y - shape_origin.Y) shape_end.X = shape_origin.X + shape_end.Y - shape_origin.Y; else shape_end.Y = shape_origin.Y + shape_end.X - shape_origin.X; } ReDraw (s); }); controls[4] = new ToolControl ((x, y, s) => { shape_origin.X = x; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.X - shape_origin.X; shape_origin.Y = (shape_origin.Y + shape_end.Y - d) / 2; shape_end.Y = (shape_origin.Y + shape_end.Y + d) / 2; } ReDraw (s); }); controls[5] = new ToolControl ((x, y, s) => { shape_origin.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.Y - shape_origin.Y; shape_origin.X = (shape_origin.X + shape_end.X - d) / 2; shape_end.X = (shape_origin.X + shape_end.X + d) / 2; } ReDraw (s); }); controls[6] = new ToolControl ((x, y, s) => { shape_end.X = x; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.X - shape_origin.X; shape_origin.Y = (shape_origin.Y + shape_end.Y - d) / 2; shape_end.Y = (shape_origin.Y + shape_end.Y + d) / 2; } ReDraw (s); }); controls[7] = new ToolControl ((x, y, s) => { shape_end.Y = y; if ((s & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) { double d = shape_end.Y - shape_origin.Y; shape_origin.X = (shape_origin.X + shape_end.X - d) / 2; shape_end.X = (shape_origin.X + shape_end.X + d) / 2; } ReDraw (s); }); }