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); }
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); }
public PanelSeparator() : base(4, 1) { AddHandlers(); defaultBackgroundColor = new RGBA_Bytes(200, 200, 200); hoverBackgroundColor = new RGBA_Bytes(100, 100, 100); Agg.Image.ImageBuffer arrowImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "icon_arrow_left_16x16.png"), arrowImage); arrowIndicator = new ImageWidget(arrowImage); arrowIndicator.HAnchor = Agg.UI.HAnchor.ParentCenter; arrowIndicator.VAnchor = Agg.UI.VAnchor.ParentCenter; arrowIndicator.Visible = true; this.AddChild(arrowIndicator); this.Hidden = false; this.BackgroundColor = defaultBackgroundColor; this.VAnchor = VAnchor.ParentBottomTop; this.Margin = new BorderDouble(8, 0); this.Cursor = Cursors.Hand; SetDisplayState(); }
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); }
public PanelSeparator() : base(4, 1) { AddHandlers(); defaultBackgroundColor = new RGBA_Bytes(200, 200, 200); hoverBackgroundColor = new RGBA_Bytes(100, 100, 100); Agg.Image.ImageBuffer arrowImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "icon_arrow_left_16x16.png"), arrowImage); arrowIndicator = new ImageWidget(arrowImage); arrowIndicator.HAnchor = Agg.UI.HAnchor.ParentCenter; arrowIndicator.VAnchor = Agg.UI.VAnchor.ParentCenter; arrowIndicator.Visible = true; this.AddChild(arrowIndicator); this.Hidden = false; this.BackgroundColor = defaultBackgroundColor; this.VAnchor = VAnchor.ParentBottomTop; this.Margin = new BorderDouble(8, 0); this.Cursor = Cursors.Hand; SetDisplayState(); }
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 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 = 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 void AddTerminalControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox terminalControlsContainer; terminalControlsContainer = new GroupBox(LocalizedString.Get("Communications")); terminalControlsContainer.Margin = new BorderDouble(0); terminalControlsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; terminalControlsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; terminalControlsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; terminalControlsContainer.Height = 68; OutputScrollWindow.HookupPrinterOutput(); { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentCenter; buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonBar.Margin = new BorderDouble(3, 0, 3, 6); buttonBar.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Agg.Image.ImageBuffer terminalImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "PrintStatusControls", "terminal-24x24.png"), terminalImage); ImageWidget terminalIcon = new ImageWidget(terminalImage); terminalIcon.Margin = new BorderDouble(right: 6); Button showTerminal = textImageButtonFactory.Generate("Show Terminal".Localize().ToUpper()); showTerminal.Margin = new BorderDouble(0); showTerminal.Click += (sender, e) => { OutputScrollWindow.Show(); }; //buttonBar.AddChild(terminalIcon); buttonBar.AddChild(showTerminal); terminalControlsContainer.AddChild(buttonBar); } terminalCommunicationsContainer = new DisableableWidget(); terminalCommunicationsContainer.AddChild(terminalControlsContainer); controlsTopToBottomLayout.AddChild(terminalCommunicationsContainer); }
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); }
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); }
public PrintProgressBar(bool widgetIsExtended = true) { MinimumSize = new Vector2(0, 24); HAnchor = HAnchor.ParentLeftRight; BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; Margin = new BorderDouble(0); FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.LeftToRight); container.AnchorAll(); container.Padding = new BorderDouble(6, 0); printTimeElapsed = new TextWidget("", pointSize: 11); printTimeElapsed.Printer.DrawFromHintedCache = true; printTimeElapsed.AutoExpandBoundsToText = true; printTimeElapsed.VAnchor = Agg.UI.VAnchor.ParentCenter; printTimeRemaining = new TextWidget("", pointSize: 11); printTimeRemaining.Printer.DrawFromHintedCache = true; printTimeRemaining.AutoExpandBoundsToText = true; printTimeRemaining.VAnchor = Agg.UI.VAnchor.ParentCenter; GuiWidget spacer = new GuiWidget(); spacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; container.AddChild(printTimeElapsed); container.AddChild(spacer); container.AddChild(printTimeRemaining); AddChild(container); if (ActiveTheme.Instance.IsTouchScreen) { upImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_up_32x24.png"); downImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_down_32x24.png"); indicatorWidget = new ImageWidget(upImageBuffer); indicatorWidget.HAnchor = HAnchor.ParentCenter; indicatorWidget.VAnchor = VAnchor.ParentCenter; WidgetIsExtended = widgetIsExtended; GuiWidget indicatorOverlay = new GuiWidget(); indicatorOverlay.AnchorAll(); indicatorOverlay.AddChild(indicatorWidget); AddChild(indicatorOverlay); } ClickWidget clickOverlay = new ClickWidget(); clickOverlay.AnchorAll(); clickOverlay.Click += onProgressBarClick; AddChild(clickOverlay); AddHandlers(); SetThemedColors(); UpdatePrintStatus(); UiThread.RunOnIdle(OnIdle); }
private GuiWidget CreateTerminalControlsContainer() { GroupBox terminalControlsContainer; terminalControlsContainer = new GroupBox(new LocalizedString("Communications").Translated); terminalControlsContainer.Margin = new BorderDouble(0); terminalControlsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; terminalControlsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; terminalControlsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; terminalControlsContainer.Height = 68; OutputScrollWindow.HookupPrinterOutput(); { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentLeftRight; buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; buttonBar.Margin = new BorderDouble(3, 0, 3, 6); buttonBar.Padding = new BorderDouble(0); this.textImageButtonFactory.FixedHeight = TallButtonHeight; Agg.Image.ImageBuffer terminalImage = new Agg.Image.ImageBuffer(); ImageBMPIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "terminal-24x24.png"), terminalImage); ImageWidget terminalIcon = new ImageWidget(terminalImage); terminalIcon.Margin = new BorderDouble (right: 6); Button showTerminal = textImageButtonFactory.Generate(new LocalizedString("SHOW TERMINAL").Translated); showTerminal.Margin = new BorderDouble(0); showTerminal.Click += (sender, e) => { OutputScrollWindow.Show(); }; //buttonBar.AddChild(terminalIcon); buttonBar.AddChild(showTerminal); terminalControlsContainer.AddChild(buttonBar); } return terminalControlsContainer; }
private GuiWidget CreatePrintLevelingControlsContainer() { GroupBox printLevelingControlsContainer; printLevelingControlsContainer = new GroupBox(new LocalizedString("Automatic Calibration").Translated); 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(new LocalizedString("CONFIGURE").Translated); 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(); ImageBMPIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "leveling-24x24.png"), levelingImage); ImageWidget levelingIcon = new ImageWidget(levelingImage); levelingIcon.Margin = new BorderDouble (right: 6); enablePrintLevelingButton = textImageButtonFactory.Generate(new LocalizedString("ENABLE").Translated); enablePrintLevelingButton.Margin = new BorderDouble(left:6); enablePrintLevelingButton.VAnchor = VAnchor.ParentCenter; enablePrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(enablePrintLeveling_Click); disablePrintLevelingButton = textImageButtonFactory.Generate(new LocalizedString("DISABLE").Translated); disablePrintLevelingButton.Margin = new BorderDouble(left:6); disablePrintLevelingButton.VAnchor = VAnchor.ParentCenter; disablePrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(disablePrintLeveling_Click); CheckBox doLevelingCheckBox = new CheckBox(new LocalizedString("Enable Automatic Print Leveling").Translated); 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; }
private void AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox eePromControlsGroupBox = new GroupBox(new LocalizedString("EEProm Settings").Translated); eePromControlsGroupBox.Margin = new BorderDouble(0); eePromControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; eePromControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; eePromControlsGroupBox.Height = 68; { FlowLayoutWidget eePromControlsLayout = new FlowLayoutWidget(); eePromControlsLayout.HAnchor |= HAnchor.ParentLeftRight; eePromControlsLayout.VAnchor |= Agg.UI.VAnchor.ParentCenter; eePromControlsLayout.Margin = new BorderDouble(3, 0, 3, 6); eePromControlsLayout.Padding = new BorderDouble(0); { Agg.Image.ImageBuffer eePromImage = new Agg.Image.ImageBuffer(); ImageBMPIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "leveling-24x24.png"), eePromImage); ImageWidget eePromIcon = new ImageWidget(eePromImage); eePromIcon.Margin = new BorderDouble (right: 6); Button openEePromWindow = textImageButtonFactory.Generate(new LocalizedString("CONFIGURE").Translated); openEePromWindow.Click += (sender, e) => { #if false // This is to force the creation of the repetier window for testing when we don't have repetier firmware. new MatterHackers.MatterControl.EeProm.EePromRepetierWidget(); #else switch(PrinterCommunication.Instance.FirmwareType) { case PrinterCommunication.FirmwareTypes.Repetier: new MatterHackers.MatterControl.EeProm.EePromRepetierWidget(); break; case PrinterCommunication.FirmwareTypes.Marlin: new MatterHackers.MatterControl.EeProm.EePromMarlinWidget(); break; default: UiThread.RunOnIdle((state) => { string message = new LocalizedString("Oops! There is no eeprom mapping for your printer's firmware.").Translated; StyledMessageBox.ShowMessageBox(message, "Warning no eeprom mapping", StyledMessageBox.MessageType.OK); } ); break; } #endif }; //eePromControlsLayout.AddChild(eePromIcon); eePromControlsLayout.AddChild(openEePromWindow); } eePromControlsGroupBox.AddChild(eePromControlsLayout); } eePromControlsContainer = new DisableableWidget(); eePromControlsContainer.AddChild(eePromControlsGroupBox); controlsTopToBottomLayout.AddChild(eePromControlsContainer); }
public PrintProgressBar(bool widgetIsExtended = true) { MinimumSize = new Vector2(0, 24); HAnchor = HAnchor.ParentLeftRight; BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; Margin = new BorderDouble(0); FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.LeftToRight); container.AnchorAll(); container.Padding = new BorderDouble(6, 0); printTimeElapsed = new TextWidget("", pointSize: 11); printTimeElapsed.Printer.DrawFromHintedCache = true; printTimeElapsed.AutoExpandBoundsToText = true; printTimeElapsed.VAnchor = VAnchor.ParentCenter; printTimeRemaining = new TextWidget("", pointSize: 11); printTimeRemaining.Printer.DrawFromHintedCache = true; printTimeRemaining.AutoExpandBoundsToText = true; printTimeRemaining.VAnchor = VAnchor.ParentCenter; container.AddChild(printTimeElapsed); container.AddChild(new HorizontalSpacer()); container.AddChild(printTimeRemaining); AddChild(container); if (UserSettings.Instance.IsTouchScreen) { upImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_up_32x24.png"); downImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_down_32x24.png"); indicatorWidget = new ImageWidget(upImageBuffer); indicatorWidget.HAnchor = HAnchor.ParentCenter; indicatorWidget.VAnchor = VAnchor.ParentCenter; WidgetIsExtended = widgetIsExtended; GuiWidget indicatorOverlay = new GuiWidget(); indicatorOverlay.AnchorAll(); indicatorOverlay.AddChild(indicatorWidget); AddChild(indicatorOverlay); } var clickOverlay = new GuiWidget(); clickOverlay.AnchorAll(); clickOverlay.Click += (s, e) => { // In touchscreen mode, expand or collapse the print status row when clicked ApplicationView mainView = ApplicationController.Instance.MainView; if(mainView is TouchscreenView) { ((TouchscreenView)mainView).ToggleTopContainer(); } }; AddChild(clickOverlay); PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents); PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents); SetThemedColors(); UpdatePrintStatus(); UiThread.RunOnIdle(OnIdle); }
private GuiWidget CreateCloudMonitorControls() { GroupBox cloudMonitorContainer = new GroupBox(LocalizedString.Get("Cloud Services")); cloudMonitorContainer.Margin = new BorderDouble(0); cloudMonitorContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; cloudMonitorContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; cloudMonitorContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; cloudMonitorContainer.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; Agg.Image.ImageBuffer cloudMonitorImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "PrintStatusControls", "cloud-24x24.png"), cloudMonitorImage); 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 ButtonBase.ButtonEventHandler(enableCloudMonitor_Click); disableCloudMonitorButton = textImageButtonFactory.Generate("Disable".Localize().ToUpper()); disableCloudMonitorButton.Margin = new BorderDouble(left: 6); disableCloudMonitorButton.VAnchor = VAnchor.ParentCenter; disableCloudMonitorButton.Click += new ButtonBase.ButtonEventHandler(disableCloudMonitor_Click); cloudMonitorInstructionsLink = linkButtonFactory.Generate("More Info".Localize().ToUpper()); cloudMonitorInstructionsLink.VAnchor = VAnchor.ParentCenter; cloudMonitorInstructionsLink.Click += new ButtonBase.ButtonEventHandler(goCloudMonitoringInstructionsButton_Click); cloudMonitorInstructionsLink.Margin = new BorderDouble (left: 6); goCloudMonitoringWebPageButton = linkButtonFactory.Generate("View Status".Localize().ToUpper()); goCloudMonitoringWebPageButton.VAnchor = VAnchor.ParentCenter; goCloudMonitoringWebPageButton.Click += new ButtonBase.ButtonEventHandler(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); cloudMonitorContainer.AddChild(buttonBar); } SetCloudButtonVisiblity(); return cloudMonitorContainer; }
private void AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox eePromControlsGroupBox = new GroupBox(LocalizedString.Get("EEProm Settings")); eePromControlsGroupBox.Margin = new BorderDouble(0); eePromControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; eePromControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; eePromControlsGroupBox.Height = 68; { FlowLayoutWidget eePromControlsLayout = new FlowLayoutWidget(); eePromControlsLayout.HAnchor |= HAnchor.ParentCenter; eePromControlsLayout.VAnchor |= Agg.UI.VAnchor.ParentCenter; eePromControlsLayout.Margin = new BorderDouble(3, 0, 3, 6); eePromControlsLayout.Padding = new BorderDouble(0); { Agg.Image.ImageBuffer eePromImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "PrintStatusControls", "leveling-24x24.png"), eePromImage); ImageWidget eePromIcon = new ImageWidget(eePromImage); eePromIcon.Margin = new BorderDouble(right: 6); Button openEePromWindow = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); openEePromWindow.Click += (sender, e) => { #if false // This is to force the creation of the repetier window for testing when we don't have repetier firmware. new MatterHackers.MatterControl.EeProm.EePromRepetierWidget(); #else switch (PrinterCommunication.Instance.FirmwareType) { case PrinterCommunication.FirmwareTypes.Repetier: new MatterHackers.MatterControl.EeProm.EePromRepetierWidget(); break; case PrinterCommunication.FirmwareTypes.Marlin: new MatterHackers.MatterControl.EeProm.EePromMarlinWidget(); break; default: UiThread.RunOnIdle((state) => { string message = LocalizedString.Get("Oops! There is no eeprom mapping for your printer's firmware."); StyledMessageBox.ShowMessageBox(message, "Warning no eeprom mapping", StyledMessageBox.MessageType.OK); } ); break; } #endif }; //eePromControlsLayout.AddChild(eePromIcon); eePromControlsLayout.AddChild(openEePromWindow); } eePromControlsGroupBox.AddChild(eePromControlsLayout); } eePromControlsContainer = new DisableableWidget(); eePromControlsContainer.AddChild(eePromControlsGroupBox); controlsTopToBottomLayout.AddChild(eePromControlsContainer); }
private GuiWidget CreatePrintLevelingControlsContainer() { Button editButton; GroupBox printLevelingControlsContainer = new GroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(LocalizedString.Get("Automatic Calibration"), out editButton)); editButton.Click += (sender, e) => { UiThread.RunOnIdle((state) => { if (editLevelingSettingsWindow == null) { editLevelingSettingsWindow = new EditLevelingSettingsWindow(); editLevelingSettingsWindow.Closed += (sender2, e2) => { 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 += (sender, e) => { UiThread.RunOnIdle((state) => { LevelWizardBase.ShowPrintLevelWizard(LevelWizardBase.RuningState.UserRequestedCalibration); }); }; 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); 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 (printLevelingStatusLabel); buttonBar.AddChild (hSpacer); buttonBar.AddChild(enablePrintLevelingButton); buttonBar.AddChild(disablePrintLevelingButton); buttonBar.AddChild(runPrintLevelingButton); ActivePrinterProfile.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) => { SetPrintLevelButtonVisiblity(); }, ref unregisterEvents); printLevelingControlsContainer.AddChild(buttonBar); } SetPrintLevelButtonVisiblity (); return printLevelingControlsContainer; }
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); }
public PrintProgressBar(bool widgetIsExtended = true) { MinimumSize = new Vector2(0, 24); HAnchor = HAnchor.ParentLeftRight; BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; Margin = new BorderDouble(0); FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.LeftToRight); container.AnchorAll(); container.Padding = new BorderDouble(6, 0); printTimeElapsed = new TextWidget("", pointSize: 11); printTimeElapsed.Printer.DrawFromHintedCache = true; printTimeElapsed.AutoExpandBoundsToText = true; printTimeElapsed.VAnchor = VAnchor.ParentCenter; printTimeRemaining = new TextWidget("", pointSize: 11); printTimeRemaining.Printer.DrawFromHintedCache = true; printTimeRemaining.AutoExpandBoundsToText = true; printTimeRemaining.VAnchor = VAnchor.ParentCenter; container.AddChild(printTimeElapsed); container.AddChild(new HorizontalSpacer()); container.AddChild(printTimeRemaining); AddChild(container); if (UserSettings.Instance.IsTouchScreen) { upImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_up_32x24.png"); downImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_down_32x24.png"); indicatorWidget = new ImageWidget(upImageBuffer); indicatorWidget.HAnchor = HAnchor.ParentCenter; indicatorWidget.VAnchor = VAnchor.ParentCenter; WidgetIsExtended = widgetIsExtended; GuiWidget indicatorOverlay = new GuiWidget(); indicatorOverlay.AnchorAll(); indicatorOverlay.AddChild(indicatorWidget); AddChild(indicatorOverlay); } var clickOverlay = new GuiWidget(); clickOverlay.AnchorAll(); clickOverlay.Click += (s, e) => { // In touchscreen mode, expand or collapse the print status row when clicked ApplicationView mainView = ApplicationController.Instance.MainView; if (mainView is TouchscreenView) { ((TouchscreenView)mainView).ToggleTopContainer(); } }; AddChild(clickOverlay); PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents); PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents); ActiveTheme.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents); SetThemedColors(); UpdatePrintStatus(); UiThread.RunOnIdle(OnIdle); }
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); }
private void AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox eePromControlsGroupBox = new GroupBox(groupBoxTitle); eePromControlsGroupBox.Margin = new BorderDouble(0); eePromControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; eePromControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; eePromControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren; eePromControlsGroupBox.Height = 68; { FlowLayoutWidget eePromControlsLayout = new FlowLayoutWidget(); eePromControlsLayout.HAnchor |= HAnchor.ParentCenter; eePromControlsLayout.VAnchor |= Agg.UI.VAnchor.ParentCenter; eePromControlsLayout.Margin = new BorderDouble(3, 0, 3, 6); eePromControlsLayout.Padding = new BorderDouble(0); { Agg.Image.ImageBuffer eePromImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "leveling-24x24.png"), eePromImage); ImageWidget eePromIcon = new ImageWidget(eePromImage); eePromIcon.Margin = new BorderDouble (right: 6); Button openEePromWindow = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); openEePromWindow.Click += (sender, e) => { #if false // This is to force the creation of the repetier window for testing when we don't have repetier firmware. new MatterHackers.MatterControl.EeProm.EePromRepetierWidget(); #else switch (PrinterConnectionAndCommunication.Instance.FirmwareType) { case PrinterConnectionAndCommunication.FirmwareTypes.Repetier: if (openEePromRepetierWidget != null) { openEePromRepetierWidget.BringToFront(); } else { openEePromRepetierWidget = new EePromRepetierWidget(); openEePromRepetierWidget.Closed += (RepetierWidget, RepetierEvent) => { openEePromRepetierWidget = null; }; } break; case PrinterConnectionAndCommunication.FirmwareTypes.Marlin: if (openEePromMarlinWidget != null) { openEePromMarlinWidget.BringToFront(); } else { openEePromMarlinWidget = new EePromMarlinWidget(); openEePromMarlinWidget.Closed += (marlinWidget, marlinEvent) => { openEePromMarlinWidget = null; }; } break; default: UiThread.RunOnIdle((state) => { StyledMessageBox.ShowMessageBox(noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK); } ); break; } #endif }; //eePromControlsLayout.AddChild(eePromIcon); eePromControlsLayout.AddChild(openEePromWindow); } eePromControlsGroupBox.AddChild(eePromControlsLayout); } eePromControlsContainer = new DisableableWidget(); eePromControlsContainer.AddChild(eePromControlsGroupBox); controlsTopToBottomLayout.AddChild(eePromControlsContainer); }
private void CreateEditNotificationControls(FlowLayoutWidget controlsTopToBottom) { DisableableWidget container = new DisableableWidget(); GroupBox notificationSettingsContainer = new GroupBox(LocalizedString.Get("Notification Settings")); notificationSettingsContainer.Margin = new BorderDouble(0); notificationSettingsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; notificationSettingsContainer.Height = 68; { 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 ButtonBase.ButtonEventHandler(configureNotificationSettingsButton_Click); notificationSettingsLabel = new TextWidget ("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); notificationSettingsContainer.AddChild (buttonRow); controlsTopToBottom.AddChild (notificationSettingsContainer); } }