Exemplo n.º 1
0
        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (logDetailed)
            {
                Logger.Trace("pictureBox1_MouseDown e.x:{0} y:{1}  absPos-x:{2:0.00} y:{3:0.00}", e.X, e.Y, picAbsPos.X, picAbsPos.Y);
            }
            pictureBox1.Focus();
            moveTranslationOld = new xyPoint(e.X, e.Y);
            allowZoom          = false;
            if (e.Button == MouseButtons.Left)
            {
                if ((fCTBCode.LinesCount > 2) && !posIsMoving)
                {
                    int line = 0;
                    posMoveStart = picAbsPos;
                    posMoveTmp   = posMoveStart;
                    posMoveEnd   = posMoveStart;

                    int fold = foldLevel;
                    expandGCode = Properties.Settings.Default.FCTBBlockExpandOnSelect;
                    if (!expandGCode)
                    {
                        fold = 0;
                    }

                    if (manualEdit)
                    {
                        newCodeEnd();
                    }
                    if (Panel.ModifierKeys == Keys.Alt)
                    {
                        line = VisuGCode.setPosMarkerNearBy(picAbsPos, false);           // find line with coord nearby, mark / unmark figure
                        fCTBCodeClickedLineNow = line;
                        findFigureMarkSelection(xmlMarkerType.Line, line, (fold > 0));   // collapse=true
                    }
                    else if (Panel.ModifierKeys == Keys.Control)
                    {
                        line = VisuGCode.setPosMarkerNearBy(picAbsPos, false);           // find line with coord nearby, mark / unmark figure
                        fCTBCodeClickedLineNow = line;
                        findFigureMarkSelection(xmlMarkerType.Group, line, (fold > 0));
                    }
                    else if (Panel.ModifierKeys == Keys.Shift)
                    {
                        line = VisuGCode.setPosMarkerNearBy(picAbsPos, false);           // find line with coord nearby, mark / unmark figure
                        fCTBCodeClickedLineNow = line;
                        findFigureMarkSelection(xmlMarkerType.Tile, line, (fold > 0));
                    }
                    else
                    {
                        line = VisuGCode.setPosMarkerNearBy(picAbsPos);                 // find line with coord nearby, mark / unmark figure
                        fCTBCodeClickedLineNow = line;
                        findFigureMarkSelection(xmlMarkerType.Figure, line, (fold > 0));
                    }

                    cmsPicBoxMoveToMarkedPosition.ToolTipText = "Work X: " + grbl.posMarker.X.ToString() + "   Y: " + grbl.posMarker.Y.ToString();
                    enableBlockCommands(VisuGCode.getHighlightStatus() > 0);
                    if (VisuGCode.codeBlocksAvailable())
                    {
                        statusStripSet(1, Localization.getString("statusStripeClickKeys2"), Color.LightGreen);
                    }
                    posIsMoving = false;
                }
            }
        }