public Button GenerateEditButton() { ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png"); int iconSize = (int)(16 * TextWidget.GlobalPointSizeScaleRatio); normalImage = ImageBuffer.CreateScaledImage(normalImage, iconSize, iconSize); Button editButton = new Button(0, 0, new ButtonViewThreeImage(normalImage, WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Gray), WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Black))); editButton.Margin = new BorderDouble(2, 2, 2, 0); editButton.VAnchor = Agg.UI.VAnchor.ParentTop; return(editButton); }
public GuiWidget GenerateGroupBoxLabelWithEdit(TextWidget textWidget, out Button editButton) { FlowLayoutWidget groupLableAndEditControl = new FlowLayoutWidget(); ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png"); int iconSize = (int)(16 * TextWidget.GlobalPointSizeScaleRatio); normalImage = ImageBuffer.CreateScaledImage(normalImage, iconSize, iconSize); editButton = new Button(0, 0, new ButtonViewThreeImage(normalImage, WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Gray), WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Black))); editButton.Margin = new BorderDouble(2, 2, 2, 0); editButton.VAnchor = Agg.UI.VAnchor.ParentBottom; textWidget.VAnchor = Agg.UI.VAnchor.ParentBottom; groupLableAndEditControl.AddChild(textWidget); groupLableAndEditControl.AddChild(editButton); return(groupLableAndEditControl); }
public virtual FlowLayoutWidget GetPulldownContainer() { DropDownList = CreateDropdown(); FlowLayoutWidget container = new FlowLayoutWidget(); container.HAnchor = HAnchor.ParentLeftRight; container.Padding = new BorderDouble(6, 0); ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png"); int iconSize = (int)(16 * TextWidget.GlobalPointSizeScaleRatio); normalImage = ImageBuffer.CreateScaledImage(normalImage, iconSize, iconSize); editButton = imageButtonFactory.Generate(normalImage, WhiteToColor.CreateWhiteToColor(normalImage, RGBA_Bytes.Gray)); editButton.VAnchor = VAnchor.ParentCenter; editButton.Margin = new BorderDouble(right: 6); editButton.Click += (sender, e) => { #if DO_IN_PLACE_EDIT if (filterTag == "quality") { SliceSettingsWidget.SettingsIndexBeingEdited = 2; } else { SliceSettingsWidget.SettingsIndexBeingEdited = 3; } // If there is a setting selected then reload the silce setting widget with the presetIndex to edit. ApplicationController.Instance.ReloadAdvancedControlsPanel(); // If no setting selected then call onNewItemSelect(object sender, EventArgs e) #else if (filterTag == "material") { if (ApplicationController.Instance.EditMaterialPresetsWindow == null) { ApplicationController.Instance.EditMaterialPresetsWindow = new SlicePresetsWindow(ReloadOptions, filterLabel, filterTag); ApplicationController.Instance.EditMaterialPresetsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { ApplicationController.Instance.EditMaterialPresetsWindow = null; }; } else { ApplicationController.Instance.EditMaterialPresetsWindow.BringToFront(); } } if (filterTag == "quality") { if (ApplicationController.Instance.EditQualityPresetsWindow == null) { ApplicationController.Instance.EditQualityPresetsWindow = new SlicePresetsWindow(ReloadOptions, filterLabel, filterTag); ApplicationController.Instance.EditQualityPresetsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { ApplicationController.Instance.EditQualityPresetsWindow = null; }; } else { ApplicationController.Instance.EditQualityPresetsWindow.BringToFront(); } } #endif }; container.AddChild(editButton); container.AddChild(DropDownList); return(container); }
public override void OnLoad(EventArgs args) { base.OnLoad(args); bool smallScreen = Parent.Width <= 1180; Padding = smallScreen ? new BorderDouble(20, 5) : new BorderDouble(50, 30); var topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom) { VAnchor = VAnchor.ParentBottomTop, HAnchor = HAnchor.ParentLeftRight }; AddChild(topToBottom); var bodyRow = new FlowLayoutWidget(FlowDirection.LeftToRight) { VAnchor = VAnchor.ParentBottomTop, HAnchor = HAnchor.ParentLeftRight, Margin = smallScreen ? new BorderDouble(30, 5, 30, 0) : new BorderDouble(30, 20, 30, 0), // the -12 is to take out the top bar }; topToBottom.AddChild(bodyRow); // Thumbnail section { int imageSize = smallScreen ? 300 : 500; ImageBuffer imageBuffer = PartThumbnailWidget.GetImageForItem(PrinterConnectionAndCommunication.Instance.ActivePrintItem, imageSize, imageSize); if (imageBuffer == null) { imageBuffer = StaticData.Instance.LoadImage(Path.Combine("Images", "Screensaver", "part_thumbnail.png")); } WhiteToColor.DoWhiteToColor(imageBuffer, ActiveTheme.Instance.PrimaryAccentColor); var partThumbnail = new ImageWidget(imageBuffer) { VAnchor = VAnchor.ParentCenter, Margin = smallScreen ? new BorderDouble(right: 20) : new BorderDouble(right: 50), }; bodyRow.AddChild(partThumbnail); } bodyRow.AddChild(PrintingWindow.CreateVerticalLine()); // Progress section { var expandingContainer = new HorizontalSpacer() { VAnchor = VAnchor.FitToChildren | VAnchor.ParentCenter }; bodyRow.AddChild(expandingContainer); var progressContainer = new FlowLayoutWidget(FlowDirection.TopToBottom) { Margin = new BorderDouble(50, 0), VAnchor = VAnchor.ParentCenter | VAnchor.FitToChildren, HAnchor = HAnchor.ParentCenter | HAnchor.FitToChildren, }; expandingContainer.AddChild(progressContainer); progressDial = new ProgressDial() { HAnchor = HAnchor.ParentCenter, Height = 200 * DeviceScale, Width = 200 * DeviceScale }; progressContainer.AddChild(progressDial); var timeContainer = new FlowLayoutWidget() { HAnchor = HAnchor.ParentCenter | HAnchor.FitToChildren, Margin = 3 }; progressContainer.AddChild(timeContainer); var timeImage = StaticData.Instance.LoadImage(Path.Combine("Images", "Screensaver", "time.png")); if (!ActiveTheme.Instance.IsDarkTheme) { timeImage.InvertLightness(); } timeContainer.AddChild(new ImageWidget(timeImage)); timeWidget = new TextWidget("", pointSize: 22, textColor: ActiveTheme.Instance.PrimaryTextColor) { AutoExpandBoundsToText = true, Margin = new BorderDouble(10, 0, 0, 0), VAnchor = VAnchor.ParentCenter, }; timeContainer.AddChild(timeWidget); int maxTextWidth = 350; printerName = new TextWidget(ActiveSliceSettings.Instance.GetValue(SettingsKey.printer_name), pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor) { HAnchor = HAnchor.ParentCenter, MinimumSize = new Vector2(maxTextWidth, MinimumSize.y), Width = maxTextWidth, Margin = new BorderDouble(0, 3), }; progressContainer.AddChild(printerName); partName = new TextWidget(PrinterConnectionAndCommunication.Instance.ActivePrintItem.GetFriendlyName(), pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor) { HAnchor = HAnchor.ParentCenter, MinimumSize = new Vector2(maxTextWidth, MinimumSize.y), Width = maxTextWidth, Margin = new BorderDouble(0, 3) }; progressContainer.AddChild(partName); } bodyRow.AddChild(PrintingWindow.CreateVerticalLine()); // ZControls { var widget = new ZAxisControls(smallScreen) { Margin = new BorderDouble(left: 50), VAnchor = VAnchor.ParentCenter, Width = 135 }; bodyRow.AddChild(widget); } var footerBar = new FlowLayoutWidget(FlowDirection.LeftToRight) { VAnchor = VAnchor.ParentBottom | VAnchor.FitToChildren, HAnchor = HAnchor.ParentCenter | HAnchor.FitToChildren, Margin = new BorderDouble(bottom: 0), }; topToBottom.AddChild(footerBar); int extruderCount = ActiveSliceSettings.Instance.GetValue <int>(SettingsKey.extruder_count); extruderStatusWidgets = Enumerable.Range(0, extruderCount).Select((i) => new ExtruderStatusWidget(i)).ToList(); bool hasHeatedBed = ActiveSliceSettings.Instance.GetValue <bool>("has_heated_bed"); if (hasHeatedBed) { var extruderColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); footerBar.AddChild(extruderColumn); // Add each status widget into the scene, placing into the appropriate column for (var i = 0; i < extruderCount; i++) { var widget = extruderStatusWidgets[i]; widget.Margin = new BorderDouble(right: 20); extruderColumn.AddChild(widget); } footerBar.AddChild(new BedStatusWidget(smallScreen) { VAnchor = VAnchor.ParentCenter, }); } else { if (extruderCount == 1) { footerBar.AddChild(extruderStatusWidgets[0]); } else { var columnA = new FlowLayoutWidget(FlowDirection.TopToBottom); footerBar.AddChild(columnA); var columnB = new FlowLayoutWidget(FlowDirection.TopToBottom); footerBar.AddChild(columnB); // Add each status widget into the scene, placing into the appropriate column for (var i = 0; i < extruderCount; i++) { var widget = extruderStatusWidgets[i]; if (i % 2 == 0) { widget.Margin = new BorderDouble(right: 20); columnA.AddChild(widget); } else { columnB.AddChild(widget); } } } } UiThread.RunOnIdle(() => { CheckOnPrinter(); }); }