public void UpdateFrom(ToolTable otherTable) { foreach (CncTool tool in otherTable.tools) { AddUpdateTool(tool); } }
public MainForm() { // we want all key events to pass first on main window, so we can jog // regardless of selected sub control KeyPreview = true; InitializeComponent(); InitializeGlControl(); Global.SettingsPath = Assembly.GetEntryAssembly().Location; Global.ToolTableFile = Utils.SettingPath("ToolTable.gtt"); toolTable = new ToolTable(); Global.toolTable = toolTable; toolTable.Load(Global.ToolTableFile); Global.mdiControl = mdiCtrl; toolStrip1.Renderer = new ToolButton(); ginterp = new GcodeInterp(); Global.ginterp = ginterp; visualizerWinMain.ginterp = ginterp; visualizerWinMain.NewGcodeLoaded += visualizerWinMain_NewGcodeLoaded; gcodeMainViewer.SelectedLineChanged += gcodeMainViewer_SelectedLineChanged; simTimer = new Timer(); simTimer.Interval = 40; simTimer.Tick += simTimer_Tick; // grbl communication grblComm = new GrblComm(); grblComm.CommStatusChanged += grblComm_StatusChanged; grblComm.LineReceived += grblComm_LineReceived; grblComm.StatusUpdate += grblComm_StatusUpdate; grblComm.ParameterUpdate += grblComm_ParameterUpdate; grblComm.MessageReceived += grblComm_MessageReceived; grblComm.ChangeToolNotify += grblComm_ChangeToolNotify; grblComm.GrblStatusChanged += grblComm_GrblStatusChanged; Global.grblComm = grblComm; grblScanTimer = new Timer(); grblScanTimer.Interval = 100; grblScanTimer.Tick += grblScanTimer_Tick; grblScanTimer.Start(); // grbl manual controll manualControl.AxisStepJogPressed += manualControl_AxisStepJogPressed; manualControl.AxisContinuesJogPressed += manualControl_AxisContinuesJogPressed; manualControl.AxisActionPressed += manualControl_AxisActionPressed; manualControl.SpindleAction += manualControl_SpindleAction; grblParamEdit = new ParametersEdit(); Global.grblParameterEditor = grblParamEdit; toolTableEdit = new ToolTableEdit(); Global.toolTableEdit = toolTableEdit; frmOffset = new FormOffset(); frmProbe = new FormProbe(); frmPopup = new FormPopWindow(); frmConfirmation = new FormConfirmation(); frmChangeTool = new FormChangeTool(); frmAbout = new FormAbout(); Global.grblParameterEditor.SetPatrameterTemplate(Global.grblConfig.GetParamDescription()); errDisplayHandler = new ErrorDisplayHandler(this); }