private FlowLayoutWidget GetGcodeTerminalControl() { FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Margin = new BorderDouble(0, 4); Agg.Image.ImageBuffer terminalSettingsImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "terminal-24x24.png")); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(terminalSettingsImage); } ImageWidget terminalIcon = new ImageWidget(terminalSettingsImage); terminalIcon.Margin = new BorderDouble(right: 6, bottom: 6); TextWidget gcodeTerminalLabel = new TextWidget("Gcode Terminal"); gcodeTerminalLabel.AutoExpandBoundsToText = true; gcodeTerminalLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; gcodeTerminalLabel.VAnchor = VAnchor.ParentCenter; openGcodeTerminalButton = textImageButtonFactory.Generate("Show Terminal".Localize().ToUpper()); openGcodeTerminalButton.Name = "Show Terminal Button"; openGcodeTerminalButton.Click += new EventHandler(openGcodeTerminalButton_Click); buttonRow.AddChild(terminalIcon); buttonRow.AddChild(gcodeTerminalLabel); buttonRow.AddChild(new HorizontalSpacer()); buttonRow.AddChild(openGcodeTerminalButton); return(buttonRow); }
private FlowLayoutWidget GetEEPromControl() { FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Margin = new BorderDouble(0, 4); TextWidget notificationSettingsLabel = new TextWidget("EEProm Settings".Localize()); notificationSettingsLabel.AutoExpandBoundsToText = true; notificationSettingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsLabel.VAnchor = VAnchor.ParentCenter; Agg.Image.ImageBuffer eePromImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "leveling-24x24.png")); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(eePromImage); } ImageWidget eePromIcon = new ImageWidget(eePromImage); eePromIcon.Margin = new BorderDouble(right: 6); Button configureEePromButton = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); configureEePromButton.Click += new EventHandler(configureEePromButton_Click); //buttonRow.AddChild(eePromIcon); buttonRow.AddChild(notificationSettingsLabel); buttonRow.AddChild(new HorizontalSpacer()); buttonRow.AddChild(configureEePromButton); return(buttonRow); }
private FlowLayoutWidget GetCloudMonitorControls() { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentLeftRight; buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonBar.Margin = new BorderDouble(0, 0, 0, 0); buttonBar.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Agg.Image.ImageBuffer cloudMonitorImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "cloud-24x24.png")); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(cloudMonitorImage); } ImageWidget cloudMonitoringIcon = new ImageWidget(cloudMonitorImage); cloudMonitoringIcon.Margin = new BorderDouble(right: 6); enableCloudMonitorButton = textImageButtonFactory.Generate("Enable".Localize().ToUpper()); enableCloudMonitorButton.Margin = new BorderDouble(left: 6); enableCloudMonitorButton.VAnchor = VAnchor.ParentCenter; enableCloudMonitorButton.Click += new EventHandler(enableCloudMonitor_Click); disableCloudMonitorButton = textImageButtonFactory.Generate("Disable".Localize().ToUpper()); disableCloudMonitorButton.Margin = new BorderDouble(left: 6); disableCloudMonitorButton.VAnchor = VAnchor.ParentCenter; disableCloudMonitorButton.Click += new EventHandler(disableCloudMonitor_Click); cloudMonitorInstructionsLink = linkButtonFactory.Generate("More Info".Localize().ToUpper()); cloudMonitorInstructionsLink.VAnchor = VAnchor.ParentCenter; cloudMonitorInstructionsLink.Click += new EventHandler(goCloudMonitoringInstructionsButton_Click); cloudMonitorInstructionsLink.Margin = new BorderDouble(left: 6); goCloudMonitoringWebPageButton = linkButtonFactory.Generate("View Status".Localize().ToUpper()); goCloudMonitoringWebPageButton.VAnchor = VAnchor.ParentCenter; goCloudMonitoringWebPageButton.Click += new EventHandler(goCloudMonitoringWebPageButton_Click); goCloudMonitoringWebPageButton.Margin = new BorderDouble(left: 6); cloudMonitorStatusLabel = new TextWidget(""); cloudMonitorStatusLabel.AutoExpandBoundsToText = true; cloudMonitorStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; cloudMonitorStatusLabel.VAnchor = VAnchor.ParentCenter; GuiWidget hSpacer = new GuiWidget(); hSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBar.AddChild(cloudMonitoringIcon); buttonBar.AddChild(cloudMonitorStatusLabel); buttonBar.AddChild(cloudMonitorInstructionsLink); buttonBar.AddChild(goCloudMonitoringWebPageButton); buttonBar.AddChild(hSpacer); buttonBar.AddChild(enableCloudMonitorButton); buttonBar.AddChild(disableCloudMonitorButton); return(buttonBar); }
public RadioButton GenerateRadioButton(string label, string iconImageName = null) { ImageBuffer iconImage = null; if (iconImageName != null) { iconImage = StaticData.Instance.LoadIcon(iconImageName); if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) { InvertLightness.DoInvertLightness(iconImage); } } BorderDouble internalMargin = new BorderDouble(0); TextImageWidget nomalState = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true); TextImageWidget hoverState = new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true); TextImageWidget checkingState = new TextImageWidget(label, hoverFillColor, checkedBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true); TextImageWidget checkedState = new TextImageWidget(label, pressedFillColor, checkedBorderColor, pressedTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true); TextImageWidget disabledState = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true); RadioButtonViewStates checkBoxButtonViewWidget = new RadioButtonViewStates(nomalState, hoverState, checkingState, checkedState, disabledState); RadioButton radioButton = new RadioButton(checkBoxButtonViewWidget); radioButton.Margin = Margin; return(radioButton); }
private ButtonViewStates getButtonView(string label, ImageBuffer normalImage = null, ImageBuffer hoverImage = null, ImageBuffer pressedImage = null, ImageBuffer disabledImage = null, bool centerText = false) { if (hoverImage == null && normalImage != null) { hoverImage = new ImageBuffer(normalImage); } if (pressedImage == null && hoverImage != null) { pressedImage = new ImageBuffer(hoverImage); } if (disabledImage == null && normalImage != null) { disabledImage = new ImageBuffer(normalImage); } if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) { if (normalImage != null) { InvertLightness.DoInvertLightness(normalImage); } if (pressedImage != null) { InvertLightness.DoInvertLightness(pressedImage); } if (hoverImage != null) { InvertLightness.DoInvertLightness(hoverImage); } if (disabledImage != null) { InvertLightness.DoInvertLightness(disabledImage); } } if (invertImageLocation) { flowDirection = FlowDirection.RightToLeft; } else { flowDirection = FlowDirection.LeftToRight; } //Create the multi-state button view ButtonViewStates buttonViewWidget = new ButtonViewStates( new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing), new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, Margin, hoverImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing), new TextImageWidget(label, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing), new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, disabledImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing) ); return(buttonViewWidget); }
private FlowLayoutWidget GetNotificationControls() { FlowLayoutWidget notificationSettingsContainer = new FlowLayoutWidget(); notificationSettingsContainer.HAnchor |= HAnchor.ParentLeftRight; notificationSettingsContainer.VAnchor |= Agg.UI.VAnchor.ParentCenter; notificationSettingsContainer.Margin = new BorderDouble(0, 0, 0, 0); notificationSettingsContainer.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Agg.Image.ImageBuffer notificationSettingsImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "notify-24x24.png")); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(notificationSettingsImage); } ImageWidget notificationSettingsIcon = new ImageWidget(notificationSettingsImage); notificationSettingsIcon.Margin = new BorderDouble(right: 6, bottom: 6); configureNotificationSettingsButton = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); configureNotificationSettingsButton.Name = "Configure Notification Settings Button"; configureNotificationSettingsButton.Margin = new BorderDouble(left: 6); configureNotificationSettingsButton.VAnchor = VAnchor.ParentCenter; configureNotificationSettingsButton.Click += new EventHandler(configureNotificationSettingsButton_Click); notificationSettingsLabel = new TextWidget(LocalizedString.Get("Notification Settings")); notificationSettingsLabel.AutoExpandBoundsToText = true; notificationSettingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsLabel.VAnchor = VAnchor.ParentCenter; GuiWidget printNotificationsSwitchContainer = new FlowLayoutWidget(); printNotificationsSwitchContainer.VAnchor = VAnchor.ParentCenter; printNotificationsSwitchContainer.Margin = new BorderDouble(left: 16); CheckBox enablePrintNotificationsSwitch = ImageButtonFactory.CreateToggleSwitch(UserSettings.Instance.get("PrintNotificationsEnabled") == "true"); enablePrintNotificationsSwitch.VAnchor = VAnchor.ParentCenter; enablePrintNotificationsSwitch.CheckedStateChanged += (sender, e) => { UserSettings.Instance.set("PrintNotificationsEnabled", enablePrintNotificationsSwitch.Checked ? "true" : "false"); }; printNotificationsSwitchContainer.AddChild(enablePrintNotificationsSwitch); printNotificationsSwitchContainer.SetBoundsToEncloseChildren(); notificationSettingsContainer.AddChild(notificationSettingsIcon); notificationSettingsContainer.AddChild(notificationSettingsLabel); notificationSettingsContainer.AddChild(new HorizontalSpacer()); notificationSettingsContainer.AddChild(configureNotificationSettingsButton); notificationSettingsContainer.AddChild(printNotificationsSwitchContainer); return(notificationSettingsContainer); }
private ImageBuffer LoadUpButtonImage(string imageName) { ImageBuffer buffer = new ImageBuffer(10, 10, 32, new BlenderBGRA()); StaticData.Instance.LoadIcon(imageName, buffer); if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) { InvertLightness.DoInvertLightness(buffer); } return(buffer); }
ImageBuffer LoadUpButtonImage(string imageName) { string path = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, imageName); ImageBuffer buffer = new ImageBuffer(10, 10, 32, new BlenderBGRA()); ImageIO.LoadImageData(path, buffer); if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) { InvertLightness.DoInvertLightness(buffer); } return(buffer); }
private FlowLayoutWidget GetCameraControl() { FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Margin = new BorderDouble(0, 4); Agg.Image.ImageBuffer cameraIconImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "camera-24x24.png")); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(cameraIconImage); } ImageWidget cameraIcon = new ImageWidget(cameraIconImage); cameraIcon.Margin = new BorderDouble(right: 6); TextWidget cameraLabel = new TextWidget("Camera Monitoring"); cameraLabel.AutoExpandBoundsToText = true; cameraLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; cameraLabel.VAnchor = VAnchor.ParentCenter; openCameraButton = textImageButtonFactory.Generate("Preview".Localize().ToUpper()); openCameraButton.Click += new EventHandler(openCameraPreview_Click); openCameraButton.Margin = new BorderDouble(left: 6); buttonRow.AddChild(cameraIcon); buttonRow.AddChild(cameraLabel); buttonRow.AddChild(new HorizontalSpacer()); buttonRow.AddChild(openCameraButton); #if __ANDROID__ GuiWidget publishImageSwitchContainer = new FlowLayoutWidget(); publishImageSwitchContainer.VAnchor = VAnchor.ParentCenter; publishImageSwitchContainer.Margin = new BorderDouble(left: 16); CheckBox toggleSwitch = ImageButtonFactory.CreateToggleSwitch(PrinterSettings.Instance.get("PublishBedImage") == "true"); toggleSwitch.CheckedStateChanged += (sender, e) => { CheckBox thisControl = sender as CheckBox; PrinterSettings.Instance.set("PublishBedImage", thisControl.Checked ? "true" : "false"); }; publishImageSwitchContainer.AddChild(toggleSwitch); publishImageSwitchContainer.SetBoundsToEncloseChildren(); buttonRow.AddChild(publishImageSwitchContainer); #endif return(buttonRow); }
public Button Generate(string normalImageName, string hoverImageName, string pressedImageName = null, string disabledImageName = null) { if (pressedImageName == null) { pressedImageName = hoverImageName; } if (disabledImageName == null) { disabledImageName = normalImageName; } Agg.Image.ImageBuffer normalImage = new Agg.Image.ImageBuffer(); Agg.Image.ImageBuffer pressedImage = new Agg.Image.ImageBuffer(); Agg.Image.ImageBuffer hoverImage = new Agg.Image.ImageBuffer(); Agg.Image.ImageBuffer disabledImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(this.GetImageLocation(normalImageName), normalImage); ImageIO.LoadImageData(this.GetImageLocation(pressedImageName), pressedImage); ImageIO.LoadImageData(this.GetImageLocation(hoverImageName), hoverImage); ImageIO.LoadImageData(this.GetImageLocation(disabledImageName), disabledImage); if (!ActiveTheme.Instance.IsDarkTheme && invertImageColor) { InvertLightness.DoInvertLightness(normalImage); InvertLightness.DoInvertLightness(pressedImage); InvertLightness.DoInvertLightness(hoverImage); InvertLightness.DoInvertLightness(disabledImage); } //normalImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet); //pressedImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet); ButtonViewStates buttonViewWidget = new ButtonViewStates( new ImageWidget(normalImage), new ImageWidget(hoverImage), new ImageWidget(pressedImage), new ImageWidget(disabledImage) ); //Create button based on view container widget Button imageButton = new Button(0, 0, buttonViewWidget); imageButton.Margin = new BorderDouble(0); imageButton.Padding = new BorderDouble(0); return(imageButton); }
public Button Generate(string normalImageName, string hoverImageName, string pressedImageName = null, string disabledImageName = null) { if (pressedImageName == null) { pressedImageName = hoverImageName; } if (disabledImageName == null) { disabledImageName = normalImageName; } Agg.Image.ImageBuffer normalImage = StaticData.Instance.LoadIcon(normalImageName); Agg.Image.ImageBuffer pressedImage = StaticData.Instance.LoadIcon(pressedImageName); Agg.Image.ImageBuffer hoverImage = StaticData.Instance.LoadIcon(hoverImageName); Agg.Image.ImageBuffer disabledImage = StaticData.Instance.LoadIcon(disabledImageName); if (!ActiveTheme.Instance.IsDarkTheme && invertImageColor) { InvertLightness.DoInvertLightness(normalImage); InvertLightness.DoInvertLightness(pressedImage); InvertLightness.DoInvertLightness(hoverImage); InvertLightness.DoInvertLightness(disabledImage); } if (ActiveTheme.Instance.IsTouchScreen) { //normalImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet); RoundedRect rect = new RoundedRect(pressedImage.GetBounds(), 0); pressedImage.NewGraphics2D().Render(new Stroke(rect, 3), ActiveTheme.Instance.PrimaryTextColor); } ButtonViewStates buttonViewWidget = new ButtonViewStates( new ImageWidget(normalImage), new ImageWidget(hoverImage), new ImageWidget(pressedImage), new ImageWidget(disabledImage) ); //Create button based on view container widget Button imageButton = new Button(0, 0, buttonViewWidget); imageButton.Margin = new BorderDouble(0); imageButton.Padding = new BorderDouble(0); return(imageButton); }
private FlowLayoutWidget GetCloudMonitorControls() { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentLeftRight; buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonBar.Margin = new BorderDouble(0, 0, 0, 0); buttonBar.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Agg.Image.ImageBuffer cloudMonitorImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "cloud-24x24.png")); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(cloudMonitorImage); } return(buttonBar); }
private void AddText(string tabText, GuiWidget widgetState, RGBA_Bytes textColor, RGBA_Bytes backgroundColor, double pointSize) { leftToRight = new FlowLayoutWidget(); tabTitle = new TextWidget(tabText, pointSize: pointSize, textColor: textColor); tabTitle.AutoExpandBoundsToText = true; leftToRight.AddChild(tabTitle); ImageBuffer popOutImageClick = StaticData.Instance.LoadIcon(Path.Combine("icon_pop_out_32x32.png")); if (ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(popOutImageClick); } ImageBuffer popOutImage = new ImageBuffer(popOutImageClick); byte[] buffer = popOutImage.GetBuffer(); for (int i = 0; i < buffer.Length; i++) { if ((i & 3) != 3) { buffer[i] = textColor.red; } } Button popOut = new Button(0, 0, new ButtonViewStates(new ImageWidget(popOutImage), new ImageWidget(popOutImage), new ImageWidget(popOutImageClick), new ImageWidget(popOutImageClick))); popOut.ToolTipText = "Pop This Tab out into its own Window".Localize(); popOut.Click += (sender, e) => { popOutManager.ShowContentInWindow(); }; popOut.Margin = new BorderDouble(3, 0); popOut.VAnchor = VAnchor.ParentTop; leftToRight.AddChild(popOut); widgetState.AddChild(leftToRight); widgetState.SetBoundsToEncloseChildren(); widgetState.BackgroundColor = backgroundColor; }
public Button Generate(string normalImageName, string hoverImageName, string pressedImageName = null, string disabledImageName = null) { if (pressedImageName == null) { pressedImageName = hoverImageName; } if (disabledImageName == null) { disabledImageName = normalImageName; } Agg.Image.ImageBuffer normalImage = StaticData.Instance.LoadIcon(normalImageName); Agg.Image.ImageBuffer pressedImage = StaticData.Instance.LoadIcon(pressedImageName); Agg.Image.ImageBuffer hoverImage = StaticData.Instance.LoadIcon(hoverImageName); Agg.Image.ImageBuffer disabledImage = StaticData.Instance.LoadIcon(disabledImageName); if (!ActiveTheme.Instance.IsDarkTheme && invertImageColor) { InvertLightness.DoInvertLightness(normalImage); InvertLightness.DoInvertLightness(pressedImage); InvertLightness.DoInvertLightness(hoverImage); InvertLightness.DoInvertLightness(disabledImage); } ButtonViewStates buttonViewWidget = new ButtonViewStates( new ImageWidget(normalImage), new ImageWidget(hoverImage), new ImageWidget(pressedImage), new ImageWidget(disabledImage) ); //Create button based on view container widget Button imageButton = new Button(0, 0, buttonViewWidget); imageButton.Margin = new BorderDouble(0); imageButton.Padding = new BorderDouble(0); return(imageButton); }
private FlowLayoutWidget GetCloudSyncDashboardControls() { FlowLayoutWidget cloudSyncContainer = new FlowLayoutWidget(); cloudSyncContainer.HAnchor |= HAnchor.ParentLeftRight; cloudSyncContainer.VAnchor |= Agg.UI.VAnchor.ParentCenter; cloudSyncContainer.Margin = new BorderDouble(0, 0, 0, 0); cloudSyncContainer.Padding = new BorderDouble(0); Agg.Image.ImageBuffer cloudMonitorImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "cloud-24x24.png")); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(cloudMonitorImage); } ImageWidget cloudSyncIcon = new ImageWidget(cloudMonitorImage); cloudSyncIcon.Margin = new BorderDouble(right: 6, bottom: 6); TextWidget cloudSyncLabel = new TextWidget(LocalizedString.Get("Cloud Sync")); cloudSyncLabel.AutoExpandBoundsToText = true; cloudSyncLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; cloudSyncLabel.VAnchor = VAnchor.ParentCenter; linkButtonFactory.fontSize = 10; Button cloudSyncGoLink = linkButtonFactory.Generate("GO TO DASHBOARD"); cloudSyncGoLink.ToolTipText = "Open cloud sync dashboard in web browser"; cloudSyncGoLink.Click += new EventHandler(cloudSyncGoButton_Click); cloudSyncContainer.AddChild(cloudSyncIcon); cloudSyncContainer.AddChild(cloudSyncLabel); cloudSyncContainer.AddChild(new HorizontalSpacer()); cloudSyncContainer.AddChild(cloudSyncGoLink); return(cloudSyncContainer); }
private FlowLayoutWidget GetNotificationControls() { FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor |= HAnchor.ParentLeftRight; buttonRow.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonRow.Margin = new BorderDouble(0, 0, 0, 0); buttonRow.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Agg.Image.ImageBuffer notificationSettingsImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "PrintStatusControls", "notify-24x24.png"), notificationSettingsImage); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(notificationSettingsImage); } ImageWidget levelingIcon = new ImageWidget(notificationSettingsImage); levelingIcon.Margin = new BorderDouble(right: 6, bottom: 6); configureNotificationSettingsButton = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); configureNotificationSettingsButton.Margin = new BorderDouble(left: 6); configureNotificationSettingsButton.VAnchor = VAnchor.ParentCenter; configureNotificationSettingsButton.Click += new EventHandler(configureNotificationSettingsButton_Click); notificationSettingsLabel = new TextWidget(LocalizedString.Get("Notification Settings")); notificationSettingsLabel.AutoExpandBoundsToText = true; notificationSettingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsLabel.VAnchor = VAnchor.ParentCenter; buttonRow.AddChild(levelingIcon); buttonRow.AddChild(notificationSettingsLabel); buttonRow.AddChild(new HorizontalSpacer()); buttonRow.AddChild(configureNotificationSettingsButton); return(buttonRow); }
private FlowLayoutWidget GetAutoLevelControl() { FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Margin = new BorderDouble(0, 4); TextWidget notificationSettingsLabel = new TextWidget("Software Print Leveling"); notificationSettingsLabel.AutoExpandBoundsToText = true; notificationSettingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsLabel.VAnchor = VAnchor.ParentCenter; Button editButton = textImageButtonFactory.GenerateEditButton(); editButton.VAnchor = Agg.UI.VAnchor.ParentCenter; editButton.Click += (sender, e) => { UiThread.RunOnIdle(() => { if (editLevelingSettingsWindow == null) { editLevelingSettingsWindow = new EditLevelingSettingsWindow(); editLevelingSettingsWindow.Closed += (sender2, e2) => { editLevelingSettingsWindow = null; }; } else { editLevelingSettingsWindow.BringToFront(); } }); }; Button runPrintLevelingButton = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); runPrintLevelingButton.Margin = new BorderDouble(left: 6); runPrintLevelingButton.VAnchor = VAnchor.ParentCenter; runPrintLevelingButton.Click += (sender, e) => { UiThread.RunOnIdle(() => { LevelWizardBase.ShowPrintLevelWizard(LevelWizardBase.RuningState.UserRequestedCalibration); }); }; Agg.Image.ImageBuffer levelingImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "leveling-24x24.png")); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(levelingImage); } ImageWidget levelingIcon = new ImageWidget(levelingImage); levelingIcon.Margin = new BorderDouble(right: 6); CheckBox printLevelingSwitch = ImageButtonFactory.CreateToggleSwitch(ActivePrinterProfile.Instance.DoPrintLeveling); printLevelingSwitch.VAnchor = VAnchor.ParentCenter; printLevelingSwitch.Margin = new BorderDouble(left: 16); printLevelingSwitch.CheckedStateChanged += (sender, e) => { ActivePrinterProfile.Instance.DoPrintLeveling = printLevelingSwitch.Checked; }; printLevelingStatusLabel = new TextWidget(""); printLevelingStatusLabel.AutoExpandBoundsToText = true; printLevelingStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingStatusLabel.VAnchor = VAnchor.ParentCenter; GuiWidget hSpacer = new GuiWidget(); hSpacer.HAnchor = HAnchor.ParentLeftRight; ActivePrinterProfile.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) => { SetPrintLevelButtonVisiblity(); printLevelingSwitch.Checked = ActivePrinterProfile.Instance.DoPrintLeveling; }, ref unregisterEvents); buttonRow.AddChild(levelingIcon); buttonRow.AddChild(printLevelingStatusLabel); buttonRow.AddChild(editButton); buttonRow.AddChild(new HorizontalSpacer()); buttonRow.AddChild(runPrintLevelingButton); buttonRow.AddChild(printLevelingSwitch); SetPrintLevelButtonVisiblity(); return(buttonRow); }
private CheckBoxViewStates getCheckBoxButtonView(string label, string normalImageName = null, string normalToPressedImageName = null, string pressedImageName = null, string pressedToNormalImageName = null, string pressedLabel = null) { ImageBuffer normalImage = new ImageBuffer(); ImageBuffer pressedImage = new ImageBuffer(); ImageBuffer normalToPressedImage = new ImageBuffer(); ImageBuffer pressedToNormalImage = new ImageBuffer(); string pressedText = pressedLabel; if (pressedLabel == null) { pressedText = label; } if (normalToPressedImageName == null) { normalToPressedImageName = pressedImageName; } if (pressedImageName == null) { pressedImageName = normalToPressedImageName; } if (pressedToNormalImageName == null) { pressedToNormalImageName = normalImageName; } if (normalImageName != null) { StaticData.Instance.LoadIcon(normalImageName, normalImage); if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) { InvertLightness.DoInvertLightness(normalImage); } } if (pressedImageName != null) { StaticData.Instance.LoadIcon(pressedImageName, pressedImage); if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) { InvertLightness.DoInvertLightness(pressedImage); } } if (normalToPressedImageName != null) { StaticData.Instance.LoadIcon(normalToPressedImageName, normalToPressedImage); if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) { InvertLightness.DoInvertLightness(normalToPressedImage); } } if (pressedToNormalImageName != null) { StaticData.Instance.LoadIcon(pressedToNormalImageName, pressedToNormalImage); if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) { InvertLightness.DoInvertLightness(pressedToNormalImage); } } if (invertImageLocation) { flowDirection = FlowDirection.RightToLeft; } else { flowDirection = FlowDirection.LeftToRight; } //Create the multi-state button view GuiWidget normal = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); GuiWidget normalHover = new TextImageWidget(label, hoverFillColor, normalBorderColor, hoverTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); GuiWidget switchNormalToPressed = new TextImageWidget(label, pressedFillColor, normalBorderColor, pressedTextColor, borderWidth, Margin, normalToPressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); GuiWidget pressed = new TextImageWidget(pressedText, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); GuiWidget pressedHover = new TextImageWidget(label, hoverFillColor, pressedBorderColor, hoverTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); GuiWidget switchPressedToNormal = new TextImageWidget(label, normalFillColor, pressedBorderColor, normalTextColor, borderWidth, Margin, pressedToNormalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); GuiWidget disabled = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); CheckBoxViewStates checkBoxButtonViewWidget = new CheckBoxViewStates(normal, normalHover, switchNormalToPressed, pressed, pressedHover, switchPressedToNormal, disabled); return(checkBoxButtonViewWidget); }
private GuiWidget CreatePrintLevelingControlsContainer() { Button editButton; GroupBox printLevelingControlsContainer = new GroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(LocalizedString.Get("Automatic Calibration"), out editButton)); editButton.Click += (sender, e) => { if (editLevelingSettingsWindow == null) { editLevelingSettingsWindow = new EditLevelingSettingsWindow(); editLevelingSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editLevelingSettingsWindow = null; }; } else { editLevelingSettingsWindow.BringToFront(); } }; printLevelingControlsContainer.Margin = new BorderDouble(0); printLevelingControlsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingControlsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingControlsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; printLevelingControlsContainer.Height = 68; { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentLeftRight; buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonBar.Margin = new BorderDouble(0, 0, 0, 0); buttonBar.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Button runPrintLevelingButton = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); runPrintLevelingButton.Margin = new BorderDouble(left: 6); runPrintLevelingButton.VAnchor = VAnchor.ParentCenter; runPrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(runPrintLeveling_Click); Agg.Image.ImageBuffer levelingImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "PrintStatusControls", "leveling-24x24.png"), levelingImage); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(levelingImage); } ImageWidget levelingIcon = new ImageWidget(levelingImage); levelingIcon.Margin = new BorderDouble(right: 6); enablePrintLevelingButton = textImageButtonFactory.Generate("Enable".Localize().ToUpper()); enablePrintLevelingButton.Margin = new BorderDouble(left: 6); enablePrintLevelingButton.VAnchor = VAnchor.ParentCenter; enablePrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(enablePrintLeveling_Click); disablePrintLevelingButton = textImageButtonFactory.Generate("Disable".Localize().ToUpper()); disablePrintLevelingButton.Margin = new BorderDouble(left: 6); disablePrintLevelingButton.VAnchor = VAnchor.ParentCenter; disablePrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(disablePrintLeveling_Click); CheckBox doLevelingCheckBox = new CheckBox(LocalizedString.Get("Enable Automatic Print Leveling")); doLevelingCheckBox.Margin = new BorderDouble(left: 3); doLevelingCheckBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; doLevelingCheckBox.VAnchor = VAnchor.ParentCenter; doLevelingCheckBox.Checked = ActivePrinterProfile.Instance.DoPrintLeveling; printLevelingStatusLabel = new TextWidget(""); printLevelingStatusLabel.AutoExpandBoundsToText = true; printLevelingStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; printLevelingStatusLabel.VAnchor = VAnchor.ParentCenter; GuiWidget hSpacer = new GuiWidget(); hSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBar.AddChild(levelingIcon); //buttonBar.AddChild(doLevelingCheckBox); buttonBar.AddChild(printLevelingStatusLabel); buttonBar.AddChild(hSpacer); buttonBar.AddChild(enablePrintLevelingButton); buttonBar.AddChild(disablePrintLevelingButton); buttonBar.AddChild(runPrintLevelingButton); doLevelingCheckBox.CheckedStateChanged += (sender, e) => { ActivePrinterProfile.Instance.DoPrintLeveling = doLevelingCheckBox.Checked; }; ActivePrinterProfile.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) => { SetPrintLevelButtonVisiblity(); }, ref unregisterEvents); printLevelingControlsContainer.AddChild(buttonBar); } SetPrintLevelButtonVisiblity(); return(printLevelingControlsContainer); }