public override MapViewer.DragAction LeftButtonDown(Pane pane, PointF location, float pixelSize, ref bool displayUpdateNeeded) { if (pane != Pane.Map) { return(MapViewer.DragAction.None); } // Begin dragging out the description block. startLocation = location; startingObj = new BasicTextCourseObj(Id <Special> .None, displayText, new RectangleF(location, new SizeF(0.001F, 0.001F)), fontName, Util.GetFontStyle(fontBold, fontItalic), fontColor, fontHeight); handleDragging = location; DragTo(location); displayUpdateNeeded = true; return(MapViewer.DragAction.DelayedDrag); // Also allow a click. }
private float GetEmHeight(Graphics graphics, string fontName, FontStyle fontStyle, float desiredDigitHeight) { return(((float)pictureBoxPreview.Height / 10) * desiredDigitHeight * BasicTextCourseObj.EmHeightToDigitHeightRatio(fontName, fontStyle)); }
// Update currentObj to reflect dragging to the given location. void DragTo(PointF location) { currentObj = (BasicTextCourseObj)startingObj.Clone(); currentObj.MoveHandle(handleDragging, location); }
public void TextOffset2() { CourseObj courseobj = new BasicTextCourseObj(SpecialId(0), "sly", new RectangleF(-3.5F, -2.5F, 4.5F, 6), "Times New Roman", FontStyle.Italic, new SpecialColor(0.8F, 0, 0.6F, 0)); CheckOffsetBitmap(courseobj, "text2_offset"); }
public override void LeftButtonEndDrag(Pane pane, PointF location, PointF locationStart, float pixelSize, ref bool displayUpdateNeeded) { Debug.Assert(pane == Pane.Map); float deltaX = (location.X - startDrag.X); float deltaY = (location.Y - startDrag.Y); PointF newHandleLocation = new PointF(handleLocation.X + deltaX, handleLocation.Y + deltaY); if (courseObjectStart.specialId.IsNotNone) { // Moving a corner of a special Id <Special> specialId = courseObjectStart.specialId; if (courseObjectStart is DescriptionCourseObj) { // Moving a description. Descriptions are rather special in the way their locations are used. DescriptionCourseObj descObj = (DescriptionCourseObj)courseObjectStart.Clone(); descObj.MoveHandle(handleLocation, location); controller.MoveSpecial(specialId, new PointF[2] { new PointF(descObj.rect.Left, descObj.rect.Bottom), new PointF(descObj.rect.Left + descObj.CellSize, descObj.rect.Bottom) }, descObj.NumberOfColumns); } else if (courseObjectStart is RectCourseObj) { // Moving rectangle handles is sort of special too. RectCourseObj rectObj = (RectCourseObj)courseObjectStart.Clone(); rectObj.MoveHandle(handleLocation, location); RectangleF rect = rectObj.rect; controller.MoveSpecial(specialId, new PointF[2] { new PointF(rect.Left, rect.Bottom), new PointF(rect.Right, rect.Top) }); } else if (courseObjectStart is BasicTextCourseObj) { // Moving text handles is sort of special too. BasicTextCourseObj textObj = (BasicTextCourseObj)courseObjectStart.Clone(); textObj.MoveHandle(handleLocation, location); RectangleF rect = textObj.GetHighlightBounds(); rect = textObj.AdjustBoundingRect(rect); controller.MoveSpecial(specialId, new PointF[2] { new PointF(rect.Left, rect.Bottom), new PointF(rect.Right, rect.Top) }); } else { controller.MoveSpecialPoint(specialId, handleLocation, newHandleLocation); } } else if ((courseObjectStart is LegCourseObj) || (courseObjectStart is FlaggedLegCourseObj)) { // Moving a leg bend. LineCourseObj lineCourseObj = (LineCourseObj)courseObjectStart; controller.MoveLegBendOrGap(lineCourseObj.courseControlId, lineCourseObj.courseControlId2, handleLocation, newHandleLocation); } else if ((courseObjectStart is ControlCourseObj) || (courseObjectStart is FinishCourseObj)) { PointCourseObj pointObj = (PointCourseObj)courseObjectStart.Clone(); pointObj.MoveHandle(handleLocation, location); controller.MoveControlGap(courseObjectStart.controlId, pointObj.movableGaps); } else { Debug.Fail("unknown situation"); } controller.DefaultCommandMode(); }
public void TextOffset() { CourseObj courseobj = new BasicTextCourseObj(SpecialId(0), "sly", new RectangleF(-3.5F, -2.5F, 6.5F, 6), "Times New Roman", FontStyle.Italic, SpecialColor.Purple); CheckOffsetBitmap(courseobj, "text_offset"); }
public void TextHighlight2() { CourseObj courseobj = new BasicTextCourseObj(SpecialId(0), "sly", new RectangleF(-3.5F, -2.5F, 4, 6), "Times New Roman", FontStyle.Italic, new SpecialColor(0.7F, 0.5F, 0, 0)); CheckHighlightBitmap(courseobj, "text_highlight2"); }
public void TextEmpty() { CourseObj courseobj = new BasicTextCourseObj(SpecialId(0), "", new RectangleF(-4, -2, 8, 6), "Arial", FontStyle.Bold, new SpecialColor(0.8F, 0.5F, 0, 0)); CheckRenderBitmap(courseobj, "textempty"); }
public void Text2() { CourseObj courseobj = new BasicTextCourseObj(SpecialId(0), "Fly", new RectangleF(-4, -2, 4, 6), "Times New Roman", FontStyle.Bold, SpecialColor.Black); CheckRenderBitmap(courseobj, "text2"); }
public void Text() { CourseObj courseobj = new BasicTextCourseObj(SpecialId(0), "Fly", new RectangleF(-4, -2, 8, 6), "Times New Roman", FontStyle.Italic, SpecialColor.Purple); CheckRenderBitmap(courseobj, "text"); }