コード例 #1
0
        public ToolBox() : base(typeof(ToolBoxUI))
        {
            instance         = this;
            ui               = uistate as ToolBoxUI;
            toolLineProperty = new ToolLineProperty();
            toolSetting      = new ToolSetting();
            toolImage        = new ToolImage();

            flyCam    = new FlyCam();
            toolShape = new ToolShape();

            SelectedTool = ToolType.None;
        }
コード例 #2
0
ファイル: MachineTool.cs プロジェクト: tsvilans/tas
 public MachineTool(string name   = "MachineTool", double diameter = 12, int tool_number = 0, int offset_number = 0,
                    double length = 0.0, int feed = 2000, int speed = 15000, int plunge = 600, ToolShape shape = ToolShape.Flat)
 {
     Name         = name;
     Diameter     = diameter;
     Length       = length;
     Number       = tool_number;
     FeedRate     = feed;
     PlungeRate   = plunge;
     SpindleSpeed = speed;
     OffsetNumber = offset_number;
     StepDown     = Diameter / 2;
     StepOver     = Diameter / 2;
     Shape        = shape;
 }
コード例 #3
0
ファイル: GridControl.cs プロジェクト: GalacticSoft/Azmyth
        protected override void OnMouseDown(MouseEventArgs e)
        {
            m_selectionShape = ToolShape;
            m_selectionSize = ToolSize;

            m_mouseDownLocation = e.Location;

            if (e.Button == MouseButtons.Left)
            {
                m_isLeftMouseDown = true;
                Invalidate();

                if (CellHover != null)
                {
                    CellHover(this, m_highlightedCellLocation);
                }
            }

            if (e.Button == MouseButtons.Right)
            {
                m_isRightMouseDown = true;
                Invalidate();
            }

            this.Focus();
        }
コード例 #4
0
        internal static void Select(UISlotTool slot)
        {
            ToolShape.Clear();
            if (UISlotImage.SelectedImage != null)
            {
                UISlotImage.SelectedImage.isSelect = false;
                UISlotImage.SelectedImage          = null;
            }

            if (slot == null)
            {
                if (SelectedSlot != null)
                {
                    SelectedSlot.isSelect = false;
                    SelectedSlot          = null;
                }
                SelectedTool = ToolType.None;
            }
            else if (SelectedSlot == slot)
            {
                SelectedSlot.isSelect = false;
                SelectedSlot          = null;
                SelectedTool          = ToolType.None;
            }
            else
            {
                if (SelectedSlot != null)
                {
                    SelectedSlot.isSelect = false;
                    SelectedSlot          = null;
                }
                SelectedTool          = slot.Tool;
                SelectedSlot          = slot;
                SelectedSlot.isSelect = true;
            }

            if (SelectedTool == ToolType.None)
            {
                if (backupMouseColor != null)
                {
                    Main.mouseColor        = (Color)backupMouseColor;
                    Main.MouseBorderColor  = (Color)backupMouseBorderColor;
                    backupMouseColor       = null;
                    backupMouseBorderColor = null;
                }
            }
            else
            {
                if (backupMouseColor == null && ModContent.GetInstance <TeraCADConfig>().isBorderCursorNone&& !SelectedTool.isSelect())
                {
                    backupMouseColor       = Main.mouseColor;
                    backupMouseBorderColor = Main.MouseBorderColor;
                    Main.MouseBorderColor  = Color.Transparent;
                }
                else if (SelectedTool.isSelect() && backupMouseColor != null)
                {
                    Main.mouseColor        = (Color)backupMouseColor;
                    Main.MouseBorderColor  = (Color)backupMouseBorderColor;
                    backupMouseColor       = null;
                    backupMouseBorderColor = null;
                }
            }

            if (SelectedTool == ToolType.ParallelCopy)
            {
                SettingUI.instance.Show = true;
            }
            else
            {
                SettingUI.instance.Show = false;
            }
        }
コード例 #5
0
        private void bmiShape_SubTool_Click(object sender, RoutedEventArgs e)
        {
            ImageButton bmi = sender as ImageButton;
            ToolShape tool = bmi.Tag as ToolShape;

            // Step 1: Check if the sender has the tool of the currently active tool
            if (tool == GuiCouplingProvider.ActiveTool)
            {
                return;
            }

            // TODO: maybe this is redundant, because in GuiCoupling.ActiveTool, we did it
            // Deactivate the current tool
            if (GuiCouplingProvider.ActiveTool != null && GuiCouplingProvider.ActiveTool.ToolState != ToolState.Idle)
            {
                GuiCouplingProvider.ActiveTool.Deactivate();
            }

            bmiShape.IconName = "ToolBar_ShapeTool_WhiteArrow_" + tool.ToolType.ToString() + "Tool";
            GuiCouplingProvider.ActiveTool = tool;
            lastShapeTool = tool;

            // TODO: Maybe we don't need this, because this should be handled by ShortcutManager
            if (StrokeWidthSelectorView != null)
                StrokeWidthSelectorView.Focus();
        }
コード例 #6
0
        public void Initialize(Workspace ws)
        {
            WorkspaceController = ws.WorkspaceController;

            bmiAnimate.Tag = new ToolAnimate(ws);
            bmiPivot.Tag = new ToolPivot(ws);
            bmiSelect.Tag = new ToolSelect(ws);
            bmiPencil.Tag = new ToolPencil(ws);
            bmiInvisibleInk.Tag = new ToolInvisibleInk(ws);
            bmiBucket.Tag = new ToolBucket(ws);
            bmiDropper.Tag = new ToolDropper(ws);
            bmiPenknife.Tag = new ToolPenknife(ws);
            bmiText.Tag = new ToolText(ws);
            bmiHand.Tag = new ToolHand(ws);
            bmiMagnify.Tag = new ToolMagnify(ws);

            bmiShape.Tag = "ToolShape"; // NOTE: this is special see ToolIsCheckedConverter

            bmiShape_Rectangle.Tag = new ToolRectangle(ws);
            bmiShape_Triangle.Tag = new ToolTriangle(ws);
            bmiShape_Ellipse.Tag = new ToolEllipse(ws);
            bmiShape_Star.Tag = new ToolStar(ws);
            bmiShape_SpeechBubble.Tag = new ToolSpeechBubble(ws);
            bmiShape_Pen.Tag = new ToolPen(ws);

            lastShapeTool = bmiShape_Rectangle.Tag as ToolShape;

            GuiCouplingProvider.ActiveTool = bmiPencil.Tag as ToolPencil;

            // TODO: The user can still manually switch to another tool by simply clicking
            //       the tool.  We should disable a lot of tools as well as other features (Playing Senario)
            ViewModelLocator.AppVMLocator.PlayBackMenuVM.PropertyChanged += new PropertyChangedEventHandler((s, e) =>
            {
                if (e.PropertyName == "IsPlaying" && ViewModelLocator.AppVMLocator.PlayBackMenuVM.IsPlaying)
                {
                    // When it's in Playing Mode, the current tool should switch to Animate Tool
                    // (if is not already), and the Animate Selection Box should be hidden (NOT deselected).
                    if (GuiCouplingProvider.ActiveTool.ToolType != TnToolType.Pivot)
                    {
                        bmiTool_Click(bmiPivot, null);
                    }
                }
            });
        }
コード例 #7
0
ファイル: MapViewer.cs プロジェクト: GalacticSoft/Azmyth
 public void SetTool(ToolShape shape)
 {
     gridControl1.ToolShape = shape;
     gridControl2.ToolShape = shape;
     gridControl3.ToolShape = shape;
 }