public virtual void InsertVertexAction()
        {
            // Start drawing mode
            DrawLinesMode drawmode = new DrawLinesMode();

            if (mouseinside)
            {
                bool        snaptogrid    = General.Interface.ShiftState ^ General.Interface.SnapToGrid;
                bool        snaptonearest = General.Interface.CtrlState ^ General.Interface.AutoMerge;
                DrawnVertex v             = DrawLinesMode.GetCurrentPosition(mousemappos, snaptonearest, snaptogrid, renderer, new List <DrawnVertex>());
                drawmode.DrawPointAt(v);
            }
            General.Editing.ChangeMode(drawmode);
        }
        // Start editing
        protected override void OnEditBegin()
        {
            // Item highlighted?
            if ((highlighted != null) && !highlighted.IsDisposed)
            {
                // Edit pressed in this mode
                editpressed = true;

                // Highlighted item not selected?
                if (!highlighted.Selected && (BuilderPlug.Me.AutoClearSelection || (General.Map.Map.SelectedLinedefsCount == 0)))
                {
                    // Make this the only selection
                    General.Map.Map.ClearSelectedLinedefs();
                    highlighted.Selected = true;
                    General.Interface.RedrawDisplay();
                }

                // Update display
                if (renderer.StartPlotter(false))
                {
                    // Redraw highlight to show selection
                    renderer.PlotLinedef(highlighted, renderer.DetermineLinedefColor(highlighted));
                    renderer.PlotVertex(highlighted.Start, renderer.DetermineVertexColor(highlighted.Start));
                    renderer.PlotVertex(highlighted.End, renderer.DetermineVertexColor(highlighted.End));
                    renderer.Finish();
                    renderer.Present();
                }
            }
            else
            {
                // Start drawing mode
                DrawLinesMode drawmode      = new DrawLinesMode();
                bool          snaptogrid    = General.Interface.ShiftState ^ General.Interface.SnapToGrid;
                bool          snaptonearest = General.Interface.CtrlState ^ General.Interface.AutoMerge;
                DrawnVertex   v             = DrawLinesMode.GetCurrentPosition(mousemappos, snaptonearest, snaptogrid, renderer, new List <DrawnVertex>());

                if (drawmode.DrawPointAt(v))
                {
                    General.Editing.ChangeMode(drawmode);
                }
                else
                {
                    General.Interface.DisplayStatus(StatusType.Warning, "Failed to draw point: outside of map boundaries.");
                }
            }

            base.OnEditBegin();
        }
        // Start editing
        protected override void OnEditBegin()
        {
            bool snaptogrid    = General.Interface.ShiftState ^ General.Interface.SnapToGrid;
            bool snaptonearest = General.Interface.CtrlState ^ General.Interface.AutoMerge;

            // Vertex highlighted?
            if ((highlighted != null) && !highlighted.IsDisposed)
            {
                // Edit pressed in this mode
                editpressed = true;

                // Highlighted item not selected?
                if (!highlighted.Selected && (BuilderPlug.Me.AutoClearSelection || (General.Map.Map.SelectedVerticesCount == 0)))
                {
                    // Make this the only selection
                    General.Map.Map.ClearSelectedVertices();
                    highlighted.Selected = true;
                    General.Interface.RedrawDisplay();
                }

                // Update display
                if (renderer.StartPlotter(false))
                {
                    // Redraw highlight to show selection
                    renderer.PlotVertex(highlighted, renderer.DetermineVertexColor(highlighted));
                    renderer.Finish();
                    renderer.Present();
                }
            }
            else
            {
                // Find the nearest linedef within highlight range
                Linedef l = General.Map.Map.NearestLinedefRange(mousemappos, BuilderPlug.Me.SplitLinedefsRange / renderer.Scale);
                if (l != null)
                {
                    // Create undo
                    General.Map.UndoRedo.CreateUndo("Split line");

                    Vector2D insertpos;

                    // Snip to grid also?
                    if (snaptogrid)
                    {
                        // Find all points where the grid intersects the line
                        List <Vector2D> points = l.GetGridIntersections();
                        insertpos = mousemappos;
                        float distance = float.MaxValue;
                        foreach (Vector2D p in points)
                        {
                            float pdist = Vector2D.DistanceSq(p, mousemappos);
                            if (pdist < distance)
                            {
                                insertpos = p;
                                distance  = pdist;
                            }
                        }
                    }
                    else
                    {
                        // Just use the nearest point on line
                        insertpos = l.NearestOnLine(mousemappos);
                    }

                    // Make the vertex
                    Vertex v = General.Map.Map.CreateVertex(insertpos);
                    if (v == null)
                    {
                        General.Map.UndoRedo.WithdrawUndo();
                        return;
                    }

                    // Snap to map format accuracy
                    //v.SnapToAccuracy();

                    // Split the line with this vertex
                    Linedef sld = l.Split(v);
                    if (sld == null)
                    {
                        General.Map.UndoRedo.WithdrawUndo();
                        return;
                    }
                    BuilderPlug.Me.AdjustSplitCoordinates(l, sld);

                    // Update
                    General.Map.Map.Update();

                    // Highlight it
                    Highlight(v);

                    // Redraw display
                    General.Interface.RedrawDisplay();
                }
                else
                {
                    // Start drawing mode
                    DrawLinesMode drawmode = new DrawLinesMode();
                    DrawnVertex   v        = DrawLinesMode.GetCurrentPosition(mousemappos, snaptonearest, snaptogrid, renderer, new List <DrawnVertex>());

                    if (drawmode.DrawPointAt(v))
                    {
                        General.Editing.ChangeMode(drawmode);
                    }
                    else
                    {
                        General.Interface.DisplayStatus(StatusType.Warning, "Failed to draw point: outside of map boundaries.");
                    }
                }
            }

            base.OnEditBegin();
        }