private FlowLayoutWidget GetHomeButtonBar() { var toolbar = new FlowLayoutWidget { HAnchor = HAnchor.Stretch, Margin = new BorderDouble(bottom: 10) }; var homeIcon = new IconButton(AggContext.StaticData.LoadIcon("fa-home_16.png", theme.InvertIcons), theme) { ToolTipText = "Home X, Y and Z".Localize(), BackgroundColor = theme.MinimalShade, Margin = theme.ButtonSpacing }; homeIcon.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.XYZ); toolbar.AddChild(homeIcon); var homeXButton = new TextButton("X", theme) { ToolTipText = "Home X".Localize(), BackgroundColor = theme.MinimalShade, Margin = theme.ButtonSpacing }; homeXButton.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.X); toolbar.AddChild(homeXButton); var homeYButton = new TextButton("Y", theme) { ToolTipText = "Home Y".Localize(), BackgroundColor = theme.MinimalShade, Margin = theme.ButtonSpacing }; homeYButton.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.Y); toolbar.AddChild(homeYButton); var homeZButton = new TextButton("Z", theme) { ToolTipText = "Home Z".Localize(), BackgroundColor = theme.MinimalShade, Margin = theme.ButtonSpacing }; homeZButton.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.Z); toolbar.AddChild(homeZButton); // Display the current baby step offset stream values var offsetStreamLabel = new TextWidget("Z Offset".Localize() + ":", pointSize: 8) { TextColor = ActiveTheme.Instance.PrimaryTextColor, Margin = new BorderDouble(left: 10), AutoExpandBoundsToText = true, VAnchor = VAnchor.Center }; toolbar.AddChild(offsetStreamLabel); var ztuningWidget = new ZTuningWidget(printer.Settings, theme); toolbar.AddChild(ztuningWidget); toolbar.AddChild(new HorizontalSpacer()); // Create 'Release' button var disableMotors = new TextButton("Release".Localize(), theme) { BackgroundColor = theme.MinimalShade, }; disableMotors.Click += (s, e) => { printer.Connection.ReleaseMotors(true); }; toolbar.AddChild(disableMotors); return(toolbar); }
private FlowLayoutWidget GetHomeButtonBar() { FlowLayoutWidget homeButtonBar = new FlowLayoutWidget(); homeButtonBar.HAnchor = HAnchor.ParentLeftRight; homeButtonBar.Margin = new BorderDouble(3, 0, 3, 6); homeButtonBar.Padding = new BorderDouble(0); textImageButtonFactory.borderWidth = 1; textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); ImageBuffer helpIconImage = StaticData.Instance.LoadIcon("icon_home_white_24x24.png", 24, 24); if (ActiveTheme.Instance.IsDarkTheme) { helpIconImage.InvertLightness(); } ImageWidget homeIconImageWidget = new ImageWidget(helpIconImage); homeIconImageWidget.Margin = new BorderDouble(0, 0, 6, 0); homeIconImageWidget.OriginRelativeParent += new Vector2(0, 2) * GuiWidget.DeviceScale; RGBA_Bytes oldColor = this.textImageButtonFactory.normalFillColor; textImageButtonFactory.normalFillColor = new RGBA_Bytes(180, 180, 180); homeAllButton = textImageButtonFactory.Generate("ALL".Localize()); this.textImageButtonFactory.normalFillColor = oldColor; homeAllButton.ToolTipText = "Home X, Y and Z".Localize(); homeAllButton.Margin = new BorderDouble(0, 0, 6, 0); homeAllButton.Click += homeAll_Click; textImageButtonFactory.FixedWidth = (int)homeAllButton.Width * GuiWidget.DeviceScale; homeXButton = textImageButtonFactory.Generate("X", centerText: true); homeXButton.ToolTipText = "Home X".Localize(); homeXButton.Margin = new BorderDouble(0, 0, 6, 0); homeXButton.Click += homeXButton_Click; homeYButton = textImageButtonFactory.Generate("Y", centerText: true); homeYButton.ToolTipText = "Home Y".Localize(); homeYButton.Margin = new BorderDouble(0, 0, 6, 0); homeYButton.Click += homeYButton_Click; homeZButton = textImageButtonFactory.Generate("Z", centerText: true); homeZButton.ToolTipText = "Home Z".Localize(); homeZButton.Margin = new BorderDouble(0, 0, 6, 0); homeZButton.Click += homeZButton_Click; textImageButtonFactory.normalFillColor = RGBA_Bytes.White; textImageButtonFactory.FixedWidth = 0; disableMotors = textImageButtonFactory.Generate("Release".Localize().ToUpper()); disableMotors.Margin = new BorderDouble(0); disableMotors.Click += (s, e) => { PrinterConnectionAndCommunication.Instance.ReleaseMotors(); }; this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; GuiWidget spacerReleaseShow = new GuiWidget(10 * GuiWidget.DeviceScale, 0); homeButtonBar.AddChild(homeIconImageWidget); homeButtonBar.AddChild(homeAllButton); homeButtonBar.AddChild(homeXButton); homeButtonBar.AddChild(homeYButton); homeButtonBar.AddChild(homeZButton); offsetStreamLabel = new TextWidget("Z Offset".Localize() + ":", pointSize: 8) { TextColor = ActiveTheme.Instance.PrimaryTextColor, Margin = new BorderDouble(left: 10), AutoExpandBoundsToText = true, VAnchor = VAnchor.ParentCenter }; homeButtonBar.AddChild(offsetStreamLabel); var ztuningWidget = new ZTuningWidget(); homeButtonBar.AddChild(ztuningWidget); homeButtonBar.AddChild(new HorizontalSpacer()); homeButtonBar.AddChild(disableMotors); homeButtonBar.AddChild(spacerReleaseShow); return(homeButtonBar); }