public GCodeViewerApplication(string gCodeToLoad = "") : base(800, 600) { this.Title = "G Code Visualizer"; MinimumSize = new VectorMath.Vector2(200, 200); Title = "MatterHackers GCodeVisualizer"; gCodeViewWidget = new GCodeViewWidget(new Vector2(), new Vector2(100, 100)); AddChild(gCodeViewWidget); FlowLayoutWidget keepOnTop = new FlowLayoutWidget(); prevLayerButton = new Button("<<", 0, 0); prevLayerButton.Click += prevLayer_ButtonClick; keepOnTop.AddChild(prevLayerButton); currentLayerIndex = new NumberEdit(1, pixelWidth: 40); keepOnTop.AddChild(currentLayerIndex); currentLayerIndex.EditComplete += new EventHandler(layerCountTextWidget_EditComplete); layerCountTextWidget = new TextWidget("/1____", 12); keepOnTop.AddChild(layerCountTextWidget); nextLayerButton = new Button(">>", 0, 0); nextLayerButton.Click += nextLayer_ButtonClick; keepOnTop.AddChild(nextLayerButton); if (gCodeToLoad != "") { gCodeViewWidget.LoadFile(gCodeToLoad); } else { openFileButton = new Button("Open GCode", 0, 0); openFileButton.Click += openFileButton_ButtonClick; keepOnTop.AddChild(openFileButton); } AddChild(keepOnTop); AnchorAll(); UiThread.RunOnIdle(currentLayerIndex.Focus); }
public GCodeViewerApplication(string gCodeToLoad = "") : base(800, 600) { MinimumSize = new VectorMath.Vector2(200, 200); Title = "MatterHackers GCodeVisualizer"; gCodeViewWidget = new GCodeViewWidget(new Vector2(), new Vector2(100, 100)); AddChild(gCodeViewWidget); FlowLayoutWidget keepOnTop = new FlowLayoutWidget(); prevLayerButton = new Button("<<", 0, 0); prevLayerButton.Click += new Button.ButtonEventHandler(prevLayer_ButtonClick); keepOnTop.AddChild(prevLayerButton); currentLayerIndex = new NumberEdit(1, pixelWidth: 40); keepOnTop.AddChild(currentLayerIndex); currentLayerIndex.EditComplete += new EventHandler(layerCountTextWidget_EditComplete); layerCountTextWidget = new TextWidget("/1____", 12); keepOnTop.AddChild(layerCountTextWidget); nextLayerButton = new Button(">>", 0, 0); nextLayerButton.Click += new Button.ButtonEventHandler(nextLayer_ButtonClick); keepOnTop.AddChild(nextLayerButton); if (gCodeToLoad != "") { gCodeViewWidget.Load(gCodeToLoad); } else { openFileButton = new Button("Open GCode", 0, 0); openFileButton.Click += new Button.ButtonEventHandler(openFileButton_ButtonClick); keepOnTop.AddChild(openFileButton); } AddChild(keepOnTop); AnchorAll(); currentLayerIndex.Focus(); }
public LayerNavigationWidget(GCodeViewWidget gcodeViewWidget) :base(FlowDirection.LeftToRight) { this.gcodeViewWidget = gcodeViewWidget; textImageButtonFactory.normalTextColor = RGBA_Bytes.White; textImageButtonFactory.hoverTextColor = RGBA_Bytes.White; textImageButtonFactory.disabledTextColor = RGBA_Bytes.White; textImageButtonFactory.pressedTextColor = RGBA_Bytes.White; prevLayerButton = textImageButtonFactory.Generate("<<"); prevLayerButton.Click += new Button.ButtonEventHandler(prevLayer_ButtonClick); this.AddChild(prevLayerButton); layerCountTextWidget = new TextWidget("/1____", 12); layerCountTextWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor; layerCountTextWidget.VAnchor = VAnchor.ParentCenter; layerCountTextWidget.AutoExpandBoundsToText = true; layerCountTextWidget.Margin = new BorderDouble(5, 0); this.AddChild(layerCountTextWidget); nextLayerButton = textImageButtonFactory.Generate(">>"); nextLayerButton.Click += new Button.ButtonEventHandler(nextLayer_ButtonClick); this.AddChild(nextLayerButton); }
public SetLayerWidget(GCodeViewWidget gcodeViewWidget) :base(FlowDirection.LeftToRight) { this.gcodeViewWidget = gcodeViewWidget; textImageButtonFactory.normalTextColor = RGBA_Bytes.White; textImageButtonFactory.hoverTextColor = RGBA_Bytes.White; textImageButtonFactory.disabledTextColor = RGBA_Bytes.White; textImageButtonFactory.pressedTextColor = RGBA_Bytes.White; editCurrentLayerIndex = new NumberEdit(1, pixelWidth: 40); editCurrentLayerIndex.VAnchor = VAnchor.ParentCenter; editCurrentLayerIndex.Margin = new BorderDouble(5, 0); editCurrentLayerIndex.EditComplete += new EventHandler(editCurrentLayerIndex_EditComplete); this.AddChild(editCurrentLayerIndex); gcodeViewWidget.ActiveLayerChanged += new EventHandler(gcodeViewWidget_ActiveLayerChanged); setLayerButton = textImageButtonFactory.Generate(new LocalizedString("Go").Translated); setLayerButton.VAnchor = Agg.UI.VAnchor.ParentCenter; setLayerButton.Click += new Button.ButtonEventHandler(layerCountTextWidget_EditComplete); this.AddChild(setLayerButton); }
private GuiWidget CreateGCodeViewWidget(string pathAndFileName) { gcodeViewWidget = new GCodeViewWidget(bedSizeFunction(), bedCenterFunction()); gcodeViewWidget.DoneLoading += DoneLoadingGCode; gcodeViewWidget.LoadingProgressChanged += LoadingProgressChanged; partToStartLoadingOnFirstDraw = pathAndFileName; return gcodeViewWidget; }