public trans_curve1_application() { AnchorAll(); m_poly = new PolygonEditWidget(6, 5); on_init(); m_poly.Changed += NeedsRedraw; AddChild(m_poly); m_num_points = new MatterHackers.Agg.UI.Slider(5, 5, 340, 12); m_num_points.ValueChanged += new EventHandler(NeedsRedraw); AddChild(m_num_points); m_num_points.Text = "Number of intermediate Points = {0:F3}"; m_num_points.SetRange(10, 400); m_num_points.Value = 200; m_close = new CheckBox(350, 5.0, "Close"); m_close.CheckedStateChanged += NeedsRedraw; AddChild(m_close); m_preserve_x_scale = new CheckBox(460, 5, "Preserve X scale"); m_preserve_x_scale.CheckedStateChanged += NeedsRedraw; AddChild(m_preserve_x_scale); m_fixed_len = new CheckBox(350, 25, "Fixed Length"); m_fixed_len.CheckedStateChanged += NeedsRedraw; AddChild(m_fixed_len); m_animate = new CheckBox(460, 25, "Animate"); m_animate.CheckedStateChanged += m_animate_CheckedStateChanged; AddChild(m_animate); }
private void CreateGraphs() { int FrameRateOffset = -15; ColorF FrameRateControlColor = new ColorF(1, 1, 1, 1); potentialDrawsBudgetPosition = new Vector2(10, (double)Height + FrameRateOffset); showPotentialDrawsBudgetGraph = new MatterHackers.Agg.UI.CheckBox(potentialDrawsBudgetPosition.X, potentialDrawsBudgetPosition.Y, "D:000.000"); showPotentialDrawsBudgetGraph.TextColor = FrameRateControlColor.ToColor(); //showPotentialDrawsBudgetGraph.inactive_color(FrameRateControlColor); AddChild(showPotentialDrawsBudgetGraph); potentialDrawsBudgetGraph = new DataViewGraph(potentialDrawsBudgetPosition, 100, 100); potentialUpdatesBudgetPosition = new Vector2(115, (double)Height + FrameRateOffset); showPotentialUpdatesBudgetGraph = new MatterHackers.Agg.UI.CheckBox(potentialUpdatesBudgetPosition.X, potentialUpdatesBudgetPosition.Y, "U:000.000"); showPotentialUpdatesBudgetGraph.TextColor = FrameRateControlColor.ToColor(); //showPotentialUpdatesBudgetGraph.inactive_color(FrameRateControlColor); AddChild(showPotentialUpdatesBudgetGraph); potentialUpdatesBudgetGraph = new DataViewGraph(potentialUpdatesBudgetPosition, 100, 100); actualDrawsBudgetPosition = new Vector2(220, (double)Height + FrameRateOffset); showActualDrawsBudgetGraph = new MatterHackers.Agg.UI.CheckBox(actualDrawsBudgetPosition.X, actualDrawsBudgetPosition.Y, "A:000.000"); showActualDrawsBudgetGraph.TextColor = FrameRateControlColor.ToColor(); //showActualDrawsBudgetGraph.inactive_color(FrameRateControlColor); AddChild(showActualDrawsBudgetGraph); actualDrawsBudgetGraph = new DataViewGraph(actualDrawsBudgetPosition, 100, 100); }
public PowerControls() { AltGroupBox fanControlsGroupBox = new AltGroupBox(new TextWidget("ATX Power Control".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); fanControlsGroupBox.Margin = new BorderDouble(0); fanControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; fanControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; this.AddChild(fanControlsGroupBox); atxPowertoggleSwitch = ImageButtonFactory.CreateToggleSwitch(false); atxPowertoggleSwitch.Margin = new BorderDouble(6, 0, 6, 6); atxPowertoggleSwitch.CheckedStateChanged += (sender, e) => { PrinterConnectionAndCommunication.Instance.AtxPowerEnabled = atxPowertoggleSwitch.Checked; }; FlowLayoutWidget paddingContainer = new FlowLayoutWidget(); paddingContainer.Padding = new BorderDouble(3, 5, 3, 0); { paddingContainer.AddChild(atxPowertoggleSwitch); } fanControlsGroupBox.AddChild(paddingContainer); UpdateControlVisibility(null, null); PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(this.UpdateControlVisibility, ref unregisterEvents); PrinterConnectionAndCommunication.Instance.AtxPowerStateChanged.RegisterEvent(this.UpdatePowerSwitch, ref unregisterEvents); this.HAnchor = Agg.UI.HAnchor.ParentLeftRight; this.HAnchor = HAnchor.ParentLeftRight; this.VAnchor = VAnchor.ParentBottomTop; }
void CreateGraphs() { int FrameRateOffset = -15; RGBA_Floats FrameRateControlColor = new RGBA_Floats(1, 1, 1, 1); m_PotentialDrawsBudgetPosition = new Vector2(10, (double)Height + FrameRateOffset); m_ShowPotentialDrawsBudgetGraph = new MatterHackers.Agg.UI.CheckBox(m_PotentialDrawsBudgetPosition.x, m_PotentialDrawsBudgetPosition.y, "D:000.000"); m_ShowPotentialDrawsBudgetGraph.TextColor = FrameRateControlColor.GetAsRGBA_Bytes(); //m_ShowPotentialDrawsBudgetGraph.inactive_color(FrameRateControlColor); AddChild(m_ShowPotentialDrawsBudgetGraph); m_PotentialDrawsBudgetGraph = new DataViewGraph(m_PotentialDrawsBudgetPosition, 100, 100); m_PotentialUpdatesBudgetPosition = new Vector2(115, (double)Height + FrameRateOffset); m_ShowPotentialUpdatesBudgetGraph = new MatterHackers.Agg.UI.CheckBox(m_PotentialUpdatesBudgetPosition.x, m_PotentialUpdatesBudgetPosition.y, "U:000.000"); m_ShowPotentialUpdatesBudgetGraph.TextColor = FrameRateControlColor.GetAsRGBA_Bytes(); //m_ShowPotentialUpdatesBudgetGraph.inactive_color(FrameRateControlColor); AddChild(m_ShowPotentialUpdatesBudgetGraph); m_PotentialUpdatesBudgetGraph = new DataViewGraph(m_PotentialUpdatesBudgetPosition, 100, 100); m_ActualDrawsBudgetPosition = new Vector2(220, (double)Height + FrameRateOffset); m_ShowActualDrawsBudgetGraph = new MatterHackers.Agg.UI.CheckBox(m_ActualDrawsBudgetPosition.x, m_ActualDrawsBudgetPosition.y, "A:000.000"); m_ShowActualDrawsBudgetGraph.TextColor = FrameRateControlColor.GetAsRGBA_Bytes(); //m_ShowActualDrawsBudgetGraph.inactive_color(FrameRateControlColor); AddChild(m_ShowActualDrawsBudgetGraph); m_ActualDrawsBudgetGraph = new DataViewGraph(m_ActualDrawsBudgetPosition, 100, 100); }
public blur() { m_rbuf2 = new ImageBuffer(); m_shape_bounds = new RectangleDouble(); m_method = new RadioButtonGroup(new Vector2(10.0, 10.0), new Vector2(130.0, 60.0)); m_radius = new Slider(new Vector2(130 + 10.0, 10.0 + 4.0), new Vector2(290, 8.0)); m_shadow_ctrl = new PolygonEditWidget(4); m_channel_r = new CheckBox(10.0, 80.0, "Red"); m_channel_g = new CheckBox(10.0, 95.0, "Green"); m_channel_b = new CheckBox(10.0, 110.0, "Blue"); m_FlattenCurves = new CheckBox(10, 315, "Convert And Flatten Curves"); m_FlattenCurves.Checked = true; AddChild(m_method); m_method.AddRadioButton("Stack Blur"); m_method.AddRadioButton("Recursive Blur"); m_method.AddRadioButton("Channels"); m_method.SelectedIndex = 1; AddChild(m_radius); m_radius.SetRange(0.0, 40.0); m_radius.Value = 15.0; m_radius.Text = "Blur Radius={0:F2}"; AddChild(m_shadow_ctrl); AddChild(m_channel_r); AddChild(m_channel_g); AddChild(m_channel_b); AddChild(m_FlattenCurves); m_channel_g.Checked = true; m_sl = new ScanlineCachePacked8(); StyledTypeFace typeFaceForLargeA = new StyledTypeFace(LiberationSansFont.Instance, 300, flatenCurves: false); m_path = typeFaceForLargeA.GetGlyphForCharacter('a'); Affine shape_mtx = Affine.NewIdentity(); shape_mtx *= Affine.NewTranslation(150, 100); m_path = new VertexSourceApplyTransform(m_path, shape_mtx); m_shape = new FlattenCurves(m_path); bounding_rect.bounding_rect_single(m_shape, 0, ref m_shape_bounds); m_shadow_ctrl.SetXN(0, m_shape_bounds.Left); m_shadow_ctrl.SetYN(0, m_shape_bounds.Bottom); m_shadow_ctrl.SetXN(1, m_shape_bounds.Right); m_shadow_ctrl.SetYN(1, m_shape_bounds.Bottom); m_shadow_ctrl.SetXN(2, m_shape_bounds.Right); m_shadow_ctrl.SetYN(2, m_shape_bounds.Top); m_shadow_ctrl.SetXN(3, m_shape_bounds.Left); m_shadow_ctrl.SetYN(3, m_shape_bounds.Top); m_shadow_ctrl.line_color(new RGBA_Floats(0, 0.3, 0.5, 0.3)); }
public static CheckBox CreateToggleSwitch(bool initialState) { ToggleSwitchView toggleView = new ToggleSwitchView("On".Localize(), "Off".Localize(), 60, 24, ActiveTheme.Instance.PrimaryBackgroundColor, new RGBA_Bytes(220, 220, 220), ActiveTheme.Instance.PrimaryAccentColor, ActiveTheme.Instance.PrimaryTextColor); CheckBox toggleBox = new CheckBox(toggleView); toggleBox.Checked = initialState; return toggleBox; }
public ComponentRendering() : base(320, 320) { alphaSlider = new Slider(new Vector2(5, 30), 310, 0, 255); alphaSlider.ValueChanged += new EventHandler(NeedInvalidate); alphaSlider.Text = "Alpha={0:F0}"; alphaSlider.Value = 255; alphaSlider.View.TextColor = new RGBA_Bytes(127, 127, 127); AddChild(alphaSlider); useBlackBackgroundCheckbox = new UI.CheckBox(5, 30 + 12, "Draw Black Background"); useBlackBackgroundCheckbox.CheckedStateChanged += NeedInvalidate; useBlackBackgroundCheckbox.TextColor = new RGBA_Bytes(127, 127, 127); AddChild(useBlackBackgroundCheckbox); }
private void AddMinimumError() { GuiWidget thingToHide; { FlowLayoutWidget twoColumns = new FlowLayoutWidget(); twoColumns.Name = "twoColumns"; { FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); leftColumn.Name = "leftColumn"; { FlowLayoutWidget topLeftStuff = new FlowLayoutWidget(FlowDirection.TopToBottom); topLeftStuff.Name = "topLeftStuff"; topLeftStuff.AddChild(new TextWidget("Top of Top Stuff")); thingToHide = new Button("thing to hide"); topLeftStuff.AddChild(thingToHide); topLeftStuff.AddChild(new TextWidget("Bottom of Top Stuff")); leftColumn.AddChild(topLeftStuff); //leftColumn.DebugShowBounds = true; } twoColumns.AddChild(leftColumn); } { FlowLayoutWidget rightColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); rightColumn.Name = "rightColumn"; CheckBox hideCheckBox = new CheckBox("Hide Stuff"); rightColumn.AddChild(hideCheckBox); hideCheckBox.CheckedStateChanged += (sender, e) => { if (hideCheckBox.Checked) { thingToHide.Visible = false; } else { thingToHide.Visible = true; } }; twoColumns.AddChild(rightColumn); } this.AddChild(twoColumns); } }
public SliderControlsPage() : base("Slider Widget") { horizontalSlider = new Slider(new Vector2(20, 60), 100); AddChild(horizontalSlider); horizontalSlider.Text = "{0:0.0}"; changeSliderText = new CheckBox(10, 200, "Show Text"); changeSliderText.Checked = true; AddChild(changeSliderText); changeSliderText.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(changeSliderText_CheckedStateChanged); verticalSlider = new Slider(new Vector2(320, 60), 100, orientation: Orientation.Vertical); AddChild(verticalSlider); verticalSlider.Text = "{0:0.0}"; }
public static CheckBox CreateToggleSwitch(bool initialState) { string on = "On"; string off = "Off"; if (StaticData.Instance != null) { on = on.Localize(); off = off.Localize(); } ToggleSwitchView toggleView = new ToggleSwitchView(on, off, 60, 24, ActiveTheme.Instance.PrimaryBackgroundColor, new RGBA_Bytes(220, 220, 220), ActiveTheme.Instance.PrimaryAccentColor, ActiveTheme.Instance.PrimaryTextColor); CheckBox toggleBox = new CheckBox(toggleView); toggleBox.Checked = initialState; return toggleBox; }
public lion_outline() { widthSlider = new MatterHackers.Agg.UI.Slider(new Vector2(5, 5), 498); renderAsScanlineCheckBox = new MatterHackers.Agg.UI.CheckBox(160, 5, "Use Scanline Rasterizer"); renderAsScanlineCheckBox.Checked = false; widthSlider.ValueChanged += new EventHandler(NeedsRedraw); renderAsScanlineCheckBox.CheckedStateChanged += NeedsRedraw; AddChild(widthSlider); widthSlider.OriginRelativeParent = Vector2.Zero; widthSlider.SetRange(0.0, 4.0); widthSlider.Value = 1.0; widthSlider.Text = "Width {0:F2}"; AddChild(renderAsScanlineCheckBox); //renderAsScanlineCheckBox.Transform = Affine.NewIdentity(); renderAccurateJoinsCheckBox = new CheckBox(200 + 10.0, 10.0 + 4.0 + 16.0, "Accurate Joins"); AddChild(renderAccurateJoinsCheckBox); }
public override void OnDraw(Graphics2D graphics2D) { ImageBuffer widgetsSubImage = ImageBuffer.NewSubImageReference(graphics2D.DestImage, graphics2D.GetClippingRect()); IImageByte backBuffer = widgetsSubImage; if (firstTime) { firstTime = false; m_SuperFast = new MatterHackers.Agg.UI.CheckBox(10, 10, "Run Super Fast"); AddChild(m_SuperFast); m_Controller = new CController(backBuffer, 30, 40, .1, .7, .3, 4, 1, 2000); } graphics2D.Clear(new RGBA_Floats(1, 1, 1, 1)); graphics2D.Rasterizer.SetVectorClipBox(0, 0, (int)Width, (int)Height); m_Controller.FastRender(m_SuperFast.Checked); m_Controller.Render(graphics2D); //m_SuperFast.Render(graphics2D); base.OnDraw(graphics2D); }
public ScaleControls(View3DWidget view3DWidget) : base(FlowDirection.TopToBottom) { this.view3DWidget = view3DWidget; { expandScaleOptions = view3DWidget.ExpandMenuOptionFactory.GenerateCheckBoxButton("Scale".Localize().ToUpper(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); expandScaleOptions.Margin = new BorderDouble(bottom: 2); this.AddChild(expandScaleOptions); scaleOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); scaleOptionContainer.HAnchor = HAnchor.ParentLeftRight; scaleOptionContainer.Visible = false; this.AddChild(scaleOptionContainer); AddScaleControls(scaleOptionContainer); } expandScaleOptions.CheckedStateChanged += expandScaleOptions_CheckedStateChanged; view3DWidget.SelectedTransformChanged += OnSelectedTransformChanged; }
public MirrorControls(View3DWidget view3DWidget) : base(FlowDirection.TopToBottom) { this.view3DWidget = view3DWidget; // put in the mirror options { expandMirrorOptions = view3DWidget.ExpandMenuOptionFactory.GenerateCheckBoxButton("Mirror".Localize().ToUpper(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); expandMirrorOptions.Margin = new BorderDouble(bottom: 2); this.AddChild(expandMirrorOptions); mirrorOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); mirrorOptionContainer.HAnchor = HAnchor.ParentLeftRight; mirrorOptionContainer.Visible = false; this.AddChild(mirrorOptionContainer); AddMirrorControls(mirrorOptionContainer); } expandMirrorOptions.CheckedStateChanged += expandMirrorOptions_CheckedStateChanged; }
public void TopToBottomContainerAppliesExpectedMarginToToggleView() { TestContext.CurrentContext.SetCompatibleWorkingDirectory(); int marginSize = 40; int dimensions = 300; GuiWidget outerContainer = new GuiWidget(dimensions, dimensions); FlowLayoutWidget topToBottomContainer = new FlowLayoutWidget(FlowDirection.TopToBottom) { HAnchor = HAnchor.ParentLeftRight, VAnchor = VAnchor.ParentBottomTop, }; outerContainer.AddChild(topToBottomContainer); CheckBox toggleBox = new CheckBox("test"); toggleBox.HAnchor = HAnchor.ParentLeftRight; toggleBox.VAnchor = VAnchor.ParentBottomTop; toggleBox.Margin = new BorderDouble(marginSize); toggleBox.BackgroundColor = RGBA_Bytes.Red; toggleBox.DebugShowBounds = true; topToBottomContainer.AddChild(toggleBox); topToBottomContainer.AnchorAll(); topToBottomContainer.PerformLayout(); outerContainer.DoubleBuffer = true; outerContainer.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White); outerContainer.OnDraw(outerContainer.NewGraphics2D()); // For troubleshooting or visual validation OutputImages(outerContainer, outerContainer); var bounds = toggleBox.BoundsRelativeToParent; Assert.IsTrue(bounds.Left == marginSize, "Left margin is incorrect"); Assert.IsTrue(bounds.Right == dimensions - marginSize, "Right margin is incorrect"); Assert.IsTrue(bounds.Top == dimensions - marginSize, "Top margin is incorrect"); Assert.IsTrue(bounds.Bottom == marginSize, "Bottom margin is incorrect"); }
public rounded_rect_application() { AnchorAll(); m_idx = (-1); m_radius = new MatterHackers.Agg.UI.Slider(new Vector2(10, 10), new Vector2(580, 9)); m_gamma = new MatterHackers.Agg.UI.Slider(new Vector2(10, 10 + 40), new Vector2(580, 9)); m_offset = new MatterHackers.Agg.UI.Slider(new Vector2(10, 10 + 80), new Vector2(580, 9)); m_white_on_black = new CheckBox(10, 10+60, "White on black"); m_DrawAsOutlineCheckBox = new CheckBox(10 + 180, 10 + 60, "Fill Rounded Rect"); m_radius.ValueChanged += new EventHandler(NeedsRedraw); m_gamma.ValueChanged += new EventHandler(NeedsRedraw); m_offset.ValueChanged += new EventHandler(NeedsRedraw); m_white_on_black.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(NeedsRedraw); m_DrawAsOutlineCheckBox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(NeedsRedraw); m_x[0] = 100; m_y[0] = 100; m_x[1] = 500; m_y[1] = 350; AddChild(m_radius); AddChild(m_gamma); AddChild(m_offset); AddChild(m_white_on_black); AddChild(m_DrawAsOutlineCheckBox); m_gamma.Text = "gamma={0:F3}"; m_gamma.SetRange(0.0, 3.0); m_gamma.Value = 1.8; m_radius.Text = "radius={0:F3}"; m_radius.SetRange(0.0, 50.0); m_radius.Value = 25.0; m_offset.Text = "subpixel offset={0:F3}"; m_offset.SetRange(-2.0, 3.0); m_white_on_black.TextColor = new RGBA_Bytes(127, 127, 127); //m_white_on_black.inactive_color(new RGBA_Bytes(127, 127, 127)); m_DrawAsOutlineCheckBox.TextColor = new RGBA_Floats(.5, .5, .5).GetAsRGBA_Bytes(); //m_DrawAsOutlineCheckBox.inactive_color(new RGBA_Bytes(127, 127, 127)); }
public rounded_rect_application() { AnchorAll(); m_idx = (-1); m_radius = new MatterHackers.Agg.UI.Slider(new Vector2(10, 10), new Vector2(580, 9)); m_gamma = new MatterHackers.Agg.UI.Slider(new Vector2(10, 10 + 40), new Vector2(580, 9)); m_offset = new MatterHackers.Agg.UI.Slider(new Vector2(10, 10 + 80), new Vector2(580, 9)); m_white_on_black = new CheckBox(10, 10 + 60, "White on black"); m_DrawAsOutlineCheckBox = new CheckBox(10 + 180, 10 + 60, "Fill Rounded Rect"); m_radius.ValueChanged += new EventHandler(NeedsRedraw); m_gamma.ValueChanged += new EventHandler(NeedsRedraw); m_offset.ValueChanged += new EventHandler(NeedsRedraw); m_white_on_black.CheckedStateChanged += NeedsRedraw; m_DrawAsOutlineCheckBox.CheckedStateChanged += NeedsRedraw; m_x[0] = 100; m_y[0] = 100; m_x[1] = 500; m_y[1] = 350; AddChild(m_radius); AddChild(m_gamma); AddChild(m_offset); AddChild(m_white_on_black); AddChild(m_DrawAsOutlineCheckBox); m_gamma.Text = "gamma={0:F3}"; m_gamma.SetRange(0.0, 3.0); m_gamma.Value = 1.8; m_radius.Text = "radius={0:F3}"; m_radius.SetRange(0.0, 50.0); m_radius.Value = 25.0; m_offset.Text = "subpixel offset={0:F3}"; m_offset.SetRange(-2.0, 3.0); m_white_on_black.TextColor = new Color(127, 127, 127); //m_white_on_black.inactive_color(new RGBA_Bytes(127, 127, 127)); m_DrawAsOutlineCheckBox.TextColor = new ColorF(.5, .5, .5).ToColor(); //m_DrawAsOutlineCheckBox.inactive_color(new RGBA_Bytes(127, 127, 127)); }
protected override void AddChildElements() { AltGroupBox fanControlsGroupBox = new AltGroupBox(new TextWidget("ATX Power Control".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); fanControlsGroupBox.Margin = new BorderDouble(0); fanControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; fanControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; this.AddChild(fanControlsGroupBox); atxPowertoggleSwitch = ImageButtonFactory.CreateToggleSwitch(false); atxPowertoggleSwitch.Margin = new BorderDouble(6, 0, 6, 6); atxPowertoggleSwitch.CheckedStateChanged += (sender, e) => { PrinterConnectionAndCommunication.Instance.AtxPowerEnabled = atxPowertoggleSwitch.Checked; }; FlowLayoutWidget paddingContainer = new FlowLayoutWidget(); paddingContainer.Padding = new BorderDouble(3, 5, 3, 0) * TextWidget.GlobalPointSizeScaleRatio; { paddingContainer.AddChild(atxPowertoggleSwitch); } fanControlsGroupBox.AddChild(paddingContainer); UpdateControlVisibility(null, null); }
public SliceSettingsDetailControl() { showHelpBox = new CheckBox(0, 0, "Show Help".Localize(), textSize: 10); showHelpBox.Checked = UserSettings.Instance.get(SliceSettingsShowHelpEntry) == "true"; // add in the ability to turn on and off help text showHelpBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; showHelpBox.Margin = new BorderDouble(right: 3); showHelpBox.VAnchor = VAnchor.ParentCenter; showHelpBox.Cursor = Cursors.Hand; showHelpBox.CheckedStateChanged += (s, e) => { UserSettings.Instance.set(SliceSettingsShowHelpEntry, showHelpBox.Checked.ToString().ToLower()); ShowHelpChanged?.Invoke(this, null); }; this.AddChild(showHelpBox); settingsDetailSelector = new StyledDropDownList("Basic", maxHeight: 200); settingsDetailSelector.Name = "User Level Dropdown"; settingsDetailSelector.AddItem("Basic".Localize(), "Simple"); settingsDetailSelector.AddItem("Standard".Localize(), "Intermediate"); settingsDetailSelector.AddItem("Advanced".Localize(), "Advanced"); if (UserSettings.Instance.get(SliceSettingsLevelEntry) != null && SliceSettingsOrganizer.Instance.UserLevels.ContainsKey(UserSettings.Instance.get(SliceSettingsLevelEntry))) { settingsDetailSelector.SelectedValue = UserSettings.Instance.get(SliceSettingsLevelEntry); } settingsDetailSelector.SelectionChanged += new EventHandler(SettingsDetail_SelectionChanged); settingsDetailSelector.VAnchor = VAnchor.ParentCenter; settingsDetailSelector.Margin = new BorderDouble(5, 3); settingsDetailSelector.BorderColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100); this.AddChild(settingsDetailSelector); this.AddChild(GetSliceOptionsMenuDropList()); }
protected void CreateGuiElements() { this.Cursor = Cursors.Hand; linkButtonFactory.fontSize = 10; linkButtonFactory.textColor = RGBA_Bytes.White; WidgetTextColor = RGBA_Bytes.Black; WidgetBackgroundColor = RGBA_Bytes.White; TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; SetDisplayAttributes(); FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); mainContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; mainContainer.VAnchor = VAnchor.ParentBottomTop; { partLabel = new TextWidget(this.ItemName.Replace('_', ' '), pointSize: 14); GuiWidget primaryContainer = new GuiWidget(); primaryContainer.HAnchor = HAnchor.ParentLeftRight; primaryContainer.VAnchor = VAnchor.ParentBottomTop; primaryContainer.Name = "Row Item " + partLabel.Text; FlowLayoutWidget primaryFlow = new FlowLayoutWidget(FlowDirection.LeftToRight); primaryFlow.HAnchor = HAnchor.ParentLeftRight; primaryFlow.VAnchor = VAnchor.ParentBottomTop; selectionCheckBoxContainer = new GuiWidget(); selectionCheckBoxContainer.VAnchor = VAnchor.ParentBottomTop; selectionCheckBoxContainer.Width = 40; selectionCheckBoxContainer.Visible = false; selectionCheckBoxContainer.Margin = new BorderDouble(left: 6); selectionCheckBox = new CheckBox(""); selectionCheckBox.Click += selectionCheckBox_Click; selectionCheckBox.Name = "Row Item Select Checkbox"; selectionCheckBox.VAnchor = VAnchor.ParentCenter; selectionCheckBox.HAnchor = HAnchor.ParentCenter; selectionCheckBoxContainer.AddChild(selectionCheckBox); middleColumn = new GuiWidget(0.0, 0.0); middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight; middleColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop; middleColumn.Margin = new BorderDouble(10, 3); { partLabel.TextColor = WidgetTextColor; partLabel.MinimumSize = new Vector2(1, 18); partLabel.VAnchor = VAnchor.ParentCenter; middleColumn.AddChild(partLabel); bool mouseDownOnMiddle = false; middleColumn.MouseDown += (sender, e) => { // Abort normal processing for view helpers if (this.IsViewHelperItem) { return; } mouseDownOnMiddle = true; }; middleColumn.MouseUp += (sender, e) => { if (mouseDownOnMiddle & middleColumn.LocalBounds.Contains(e.Position)) { if (this.libraryDataView.EditMode) { if (this.IsSelectedItem) { libraryDataView.SelectedItems.Remove(this); } else { libraryDataView.SelectedItems.Add(this); } Invalidate(); } else { // we only have single selection if (this.IsSelectedItem) { // It is already selected, do nothing. } else { libraryDataView.ClearSelectedItems(); libraryDataView.SelectedItems.Add(this); Invalidate(); } } } mouseDownOnMiddle = false; }; } primaryFlow.AddChild(selectionCheckBoxContainer); primaryFlow.AddChild(thumbnailWidget); primaryFlow.AddChild(middleColumn); primaryContainer.AddChild(primaryFlow); rightButtonOverlay = GetItemActionButtons(); rightButtonOverlay.Visible = false; mainContainer.AddChild(primaryContainer); mainContainer.AddChild(rightButtonOverlay); } this.AddChild(mainContainer); AddHandlers(); }
private static CheckBox CreateCheckboxFromToggleSwitchView() { ToggleSwitchView toggleView = new ToggleSwitchView("On", "Off", 60, 24, ActiveTheme.Instance.PrimaryBackgroundColor, new RGBA_Bytes(220, 220, 220), ActiveTheme.Instance.PrimaryAccentColor, ActiveTheme.Instance.PrimaryTextColor); CheckBox toggleBox = new CheckBox(toggleView); toggleBox.Checked = true; return toggleBox; }
public void PrintActivePart() { try { // If leveling is required or is currently on if (ActiveSliceSettings.Instance.LevelingRequiredToPrint || ActivePrinterProfile.Instance.DoPrintLeveling) { LevelWizardBase.RuningState runningState = LevelWizardBase.RuningState.UserRequestedCalibration; if(ActiveSliceSettings.Instance.LevelingRequiredToPrint) { // run in the first run state runningState = LevelWizardBase.RuningState.InitialStartupCalibration; } PrintLevelingData levelingData = PrintLevelingData.GetForPrinter(ActivePrinterProfile.Instance.ActivePrinter); switch (levelingData.CurrentPrinterLevelingSystem) { case PrintLevelingData.LevelingSystem.Probe2Points: case PrintLevelingData.LevelingSystem.Probe3Points: if (levelingData.SampledPosition0.z == 0 && levelingData.SampledPosition1.z == 0 && levelingData.SampledPosition2.z == 0) { // leveling is not set up so we need to run it LevelWizardBase.ShowPrintLevelWizard(runningState); return; } break; case PrintLevelingData.LevelingSystem.Probe7PointRadial: if (levelingData.SampledPositions.Count != 7) // different criteria for what is not initialized { LevelWizardBase.ShowPrintLevelWizard(runningState); return; } break; case PrintLevelingData.LevelingSystem.Probe13PointRadial: if (levelingData.SampledPositions.Count != 13) // different criteria for what is not initialized { LevelWizardBase.ShowPrintLevelWizard(runningState); return; } break; default: throw new NotImplementedException(); } } if (PrinterConnectionAndCommunication.Instance.ActivePrintItem != null) { string pathAndFile = PrinterConnectionAndCommunication.Instance.ActivePrintItem.FileLocation; if (ActiveSliceSettings.Instance.HasSdCardReader() && pathAndFile == QueueData.SdCardFileName) { PrinterConnectionAndCommunication.Instance.StartSdCardPrint(); } else if (ActiveSliceSettings.Instance.IsValid()) { if (File.Exists(pathAndFile)) { // clear the output cache prior to starting a print PrinterOutputCache.Instance.Clear(); string hideGCodeWarning = ApplicationSettings.Instance.get("HideGCodeWarning"); if (Path.GetExtension(pathAndFile).ToUpper() == ".GCODE" && hideGCodeWarning == null) { CheckBox hideGCodeWarningCheckBox = new CheckBox(doNotShowAgainMessage); hideGCodeWarningCheckBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; hideGCodeWarningCheckBox.Margin = new BorderDouble(top: 6, left: 6); hideGCodeWarningCheckBox.HAnchor = Agg.UI.HAnchor.ParentLeft; hideGCodeWarningCheckBox.Click += (sender, e) => { if (hideGCodeWarningCheckBox.Checked) { ApplicationSettings.Instance.set("HideGCodeWarning", "true"); } else { ApplicationSettings.Instance.set("HideGCodeWarning", null); } }; StyledMessageBox.ShowMessageBox(onConfirmPrint, gcodeWarningMessage, "Warning - GCode file".Localize(), new GuiWidget[] { new VerticalSpacer(), hideGCodeWarningCheckBox }, StyledMessageBox.MessageType.YES_NO); } else { PrinterConnectionAndCommunication.Instance.CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint; PrintItemWrapper partToPrint = PrinterConnectionAndCommunication.Instance.ActivePrintItem; SlicingQueue.Instance.QueuePartForSlicing(partToPrint); partToPrint.SlicingDone += partToPrint_SliceDone; } } else { string message = String.Format(removeFromQueueMessage, pathAndFile); StyledMessageBox.ShowMessageBox(onRemoveMessageConfirm, message, itemNotFoundMessage, StyledMessageBox.MessageType.YES_NO); } } } } catch (Exception e) { Debug.Print(e.Message); GuiWidget.BreakInDebugger(); // Let's track this issue if possible. MatterControlApplication.Instance.ReportException(e, this.GetType().Name, MethodBase.GetCurrentMethod().Name); } }
public CheckBox GenerateCheckBoxButton(string label, string normalImageName = null, string normalToPressedImageName = null, string pressedImageName = null, string pressedToNormalImageName = null, string pressedLabel = null) { CheckBoxViewStates checkBoxButtonViewWidget = getCheckBoxButtonView(label, normalImageName, normalToPressedImageName, pressedImageName, pressedToNormalImageName, pressedLabel); //Override the width if requested if (this.FixedWidth != 0) { checkBoxButtonViewWidget.Width = this.FixedWidth; } CheckBox textImageCheckBoxButton = new CheckBox(0, 0, checkBoxButtonViewWidget); textImageCheckBoxButton.Margin = new BorderDouble(0); textImageCheckBoxButton.Padding = new BorderDouble(0); return textImageCheckBoxButton; }
private FlowLayoutWidget CreateRightButtonPanel(double buildHeight) { FlowLayoutWidget buttonRightPanel = new FlowLayoutWidget(FlowDirection.TopToBottom); buttonRightPanel.Width = 200; { BorderDouble buttonMargin = new BorderDouble(top: 3); expandRotateOptions = expandMenuOptionFactory.GenerateCheckBoxButton(LocalizedString.Get("Rotate"), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); expandRotateOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandRotateOptions); rotateOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); rotateOptionContainer.HAnchor = HAnchor.ParentLeftRight; rotateOptionContainer.Visible = false; buttonRightPanel.AddChild(rotateOptionContainer); expandScaleOptions = expandMenuOptionFactory.GenerateCheckBoxButton(LocalizedString.Get("Scale"), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); expandScaleOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandScaleOptions); scaleOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); scaleOptionContainer.HAnchor = HAnchor.ParentLeftRight; scaleOptionContainer.Visible = false; buttonRightPanel.AddChild(scaleOptionContainer); // put in the mirror options { expandMirrorOptions = expandMenuOptionFactory.GenerateCheckBoxButton(LocalizedString.Get("Mirror"), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); expandMirrorOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandMirrorOptions); mirrorOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); mirrorOptionContainer.HAnchor = HAnchor.ParentLeftRight; mirrorOptionContainer.Visible = false; buttonRightPanel.AddChild(mirrorOptionContainer); AddMirrorControls(mirrorOptionContainer); } // put in the material options int numberOfExtruders = ActiveSliceSettings.Instance.ExtruderCount; expandMaterialOptions = expandMenuOptionFactory.GenerateCheckBoxButton(LocalizedString.Get("Material"), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); expandMaterialOptions.Margin = new BorderDouble(bottom: 2); if (numberOfExtruders > 1) { buttonRightPanel.AddChild(expandMaterialOptions); materialOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); materialOptionContainer.HAnchor = HAnchor.ParentLeftRight; materialOptionContainer.Visible = false; buttonRightPanel.AddChild(materialOptionContainer); AddMaterialControls(materialOptionContainer); } // put in the view options { expandViewOptions = expandMenuOptionFactory.GenerateCheckBoxButton(LocalizedString.Get("Display"), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); expandViewOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandViewOptions); viewOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); viewOptionContainer.HAnchor = HAnchor.ParentLeftRight; viewOptionContainer.Padding = new BorderDouble(left: 4); viewOptionContainer.Visible = false; { CheckBox showBedCheckBox = new CheckBox(LocalizedString.Get("Show Print Bed"), textColor: ActiveTheme.Instance.PrimaryTextColor); showBedCheckBox.Checked = true; showBedCheckBox.CheckedStateChanged += (sender, e) => { meshViewerWidget.RenderBed = showBedCheckBox.Checked; }; viewOptionContainer.AddChild(showBedCheckBox); if (buildHeight > 0) { CheckBox showBuildVolumeCheckBox = new CheckBox(LocalizedString.Get("Show Print Area"), textColor: ActiveTheme.Instance.PrimaryTextColor); showBuildVolumeCheckBox.Checked = false; showBuildVolumeCheckBox.Margin = new BorderDouble(bottom: 5); showBuildVolumeCheckBox.CheckedStateChanged += (sender, e) => { meshViewerWidget.RenderBuildVolume = showBuildVolumeCheckBox.Checked; }; viewOptionContainer.AddChild(showBuildVolumeCheckBox); } if (ActiveTheme.Instance.IsTouchScreen) { UserSettings.Instance.set("defaultRenderSetting", RenderTypes.Shaded.ToString()); } else { CreateRenderTypeRadioButtons(viewOptionContainer); } } buttonRightPanel.AddChild(viewOptionContainer); } GuiWidget verticalSpacer = new GuiWidget(); verticalSpacer.VAnchor = VAnchor.ParentBottomTop; buttonRightPanel.AddChild(verticalSpacer); } buttonRightPanel.Padding = new BorderDouble(6, 6); buttonRightPanel.Margin = new BorderDouble(0, 1); buttonRightPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel.VAnchor = VAnchor.ParentBottomTop; return buttonRightPanel; }
private void AddScaleControls(FlowLayoutWidget buttonPanel) { List<GuiWidget> scaleControls = new List<GuiWidget>(); transformControls.Add("Scale", scaleControls); // Put in the scale ratio edit field { FlowLayoutWidget scaleRatioContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); scaleRatioContainer.HAnchor = HAnchor.ParentLeftRight; scaleRatioContainer.Padding = new BorderDouble(5); string scaleRatioLabelText = "Ratio".Localize(); string scaleRatioLabelTextFull = "{0}:".FormatWith(scaleRatioLabelText); TextWidget scaleRatioLabel = new TextWidget(scaleRatioLabelTextFull, textColor: ActiveTheme.Instance.PrimaryTextColor); scaleRatioLabel.Margin = new BorderDouble(0, 0, 3, 0); scaleRatioLabel.VAnchor = VAnchor.ParentCenter; scaleRatioContainer.AddChild(scaleRatioLabel); scaleRatioContainer.AddChild(new HorizontalSpacer()); scaleRatioControl = new MHNumberEdit(1, pixelWidth: 50 * TextWidget.GlobalPointSizeScaleRatio, allowDecimals: true, increment: .05); scaleRatioControl.SelectAllOnFocus = true; scaleRatioControl.VAnchor = VAnchor.ParentCenter; scaleRatioContainer.AddChild(scaleRatioControl); scaleRatioControl.ActuallNumberEdit.KeyPressed += (sender, e) => { SetApplyScaleVisability(this, null); }; scaleRatioControl.ActuallNumberEdit.KeyDown += (sender, e) => { SetApplyScaleVisability(this, null); }; scaleRatioControl.ActuallNumberEdit.EnterPressed += (object sender, KeyEventArgs keyEvent) => { ApplyScaleFromEditField(); }; scaleRatioContainer.AddChild(CreateScaleDropDownMenu()); buttonPanel.AddChild(scaleRatioContainer); scaleControls.Add(scaleRatioControl); } applyScaleButton = whiteButtonFactory.Generate("Apply Scale".Localize(), centerText: true); applyScaleButton.Visible = false; applyScaleButton.Cursor = Cursors.Hand; buttonPanel.AddChild(applyScaleButton); scaleControls.Add(applyScaleButton); applyScaleButton.Click += (object sender, EventArgs mouseEvent) => { ApplyScaleFromEditField(); }; // add in the dimensions { buttonPanel.AddChild(createAxisScalingControl("x", 0)); buttonPanel.AddChild(createAxisScalingControl("y", 1)); buttonPanel.AddChild(createAxisScalingControl("z", 2)); uniformScale = new CheckBox("Lock Ratio".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor); uniformScale.Checked = true; FlowLayoutWidget leftToRight = new FlowLayoutWidget(); leftToRight.Padding = new BorderDouble(5, 3); leftToRight.AddChild(uniformScale); buttonPanel.AddChild(leftToRight); } buttonPanel.AddChild(generateHorizontalRule()); }
private void AddDisplayControls(FlowLayoutWidget buttonPanel) { buttonPanel.CloseAllChildren(); double oldWidth = textImageButtonFactory.FixedWidth; textImageButtonFactory.FixedWidth = 44 * TextWidget.GlobalPointSizeScaleRatio; FlowLayoutWidget layerInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); layerInfoContainer.HAnchor = HAnchor.ParentLeftRight; layerInfoContainer.Padding = new BorderDouble(5); // put in a show grid check box { CheckBox showGrid = new CheckBox(LocalizedString.Get("Print Bed"), textColor: ActiveTheme.Instance.PrimaryTextColor); showGrid.Checked = gcodeViewWidget.RenderGrid; meshViewerWidget.RenderBed = showGrid.Checked; showGrid.CheckedStateChanged += (sender, e) => { gcodeViewWidget.RenderGrid = showGrid.Checked; meshViewerWidget.RenderBed = showGrid.Checked; }; layerInfoContainer.AddChild(showGrid); } // put in a show moves checkbox { CheckBox showMoves = new CheckBox(LocalizedString.Get("Moves"), textColor: ActiveTheme.Instance.PrimaryTextColor); showMoves.Checked = gcodeViewWidget.RenderMoves; showMoves.CheckedStateChanged += (sender, e) => { gcodeViewWidget.RenderMoves = showMoves.Checked; }; layerInfoContainer.AddChild(showMoves); } // put in a show Retractions checkbox { CheckBox showRetractions = new CheckBox(LocalizedString.Get("Retractions"), textColor: ActiveTheme.Instance.PrimaryTextColor); showRetractions.Checked = gcodeViewWidget.RenderRetractions; showRetractions.CheckedStateChanged += (sender, e) => { gcodeViewWidget.RenderRetractions = showRetractions.Checked; }; layerInfoContainer.AddChild(showRetractions); } // put in a show speed checkbox { showSpeeds = new CheckBox(LocalizedString.Get("Speeds"), textColor: ActiveTheme.Instance.PrimaryTextColor); showSpeeds.Checked = gcodeViewWidget.RenderSpeeds; //showSpeeds.Checked = gradient.Visible; showSpeeds.CheckedStateChanged += (sender, e) => { /* if (!showSpeeds.Checked) { gradient.Visible = false; } else { gradient.Visible = true; }*/ gradientWidget.Visible = showSpeeds.Checked; gcodeViewWidget.RenderSpeeds = showSpeeds.Checked; }; layerInfoContainer.AddChild(showSpeeds); } // put in a simulate extrusion checkbox { CheckBox simulateExtrusion = new CheckBox(LocalizedString.Get("Extrusion"), textColor: ActiveTheme.Instance.PrimaryTextColor); simulateExtrusion.Checked = gcodeViewWidget.SimulateExtrusion; simulateExtrusion.CheckedStateChanged += (sender, e) => { gcodeViewWidget.SimulateExtrusion = simulateExtrusion.Checked; }; layerInfoContainer.AddChild(simulateExtrusion); } // put in a render extrusion transparent checkbox { CheckBox transparentExtrusion = new CheckBox(LocalizedString.Get("Transparent"), textColor: ActiveTheme.Instance.PrimaryTextColor) { Checked = gcodeViewWidget.TransparentExtrusion, Margin = new BorderDouble(5, 0, 0, 0) * TextWidget.GlobalPointSizeScaleRatio, HAnchor = HAnchor.ParentLeft, }; transparentExtrusion.CheckedStateChanged += (sender, e) => { gcodeViewWidget.TransparentExtrusion = transparentExtrusion.Checked; }; layerInfoContainer.AddChild(transparentExtrusion); } // put in a simulate extrusion checkbox if (ActiveSliceSettings.Instance.ExtruderCount > 1) { CheckBox hideExtruderOffsets = new CheckBox("Hide Offsets", textColor: ActiveTheme.Instance.PrimaryTextColor); hideExtruderOffsets.Checked = gcodeViewWidget.HideExtruderOffsets; hideExtruderOffsets.CheckedStateChanged += (sender, e) => { gcodeViewWidget.HideExtruderOffsets = hideExtruderOffsets.Checked; }; layerInfoContainer.AddChild(hideExtruderOffsets); } // put in a show 3D view checkbox { viewControlsToggle.twoDimensionButton.CheckedStateChanged += (sender, e) => { SetLayerViewType(); }; viewControlsToggle.threeDimensionButton.CheckedStateChanged += (sender, e) => { SetLayerViewType(); }; SetLayerViewType(); } // Put in the sync to print checkbox if (windowMode == WindowMode.Embeded) { syncToPrint = new CheckBox("Sync To Print".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor); syncToPrint.Checked = (UserSettings.Instance.get("LayerViewSyncToPrint") == "True"); syncToPrint.CheckedStateChanged += (sender, e) => { UserSettings.Instance.set("LayerViewSyncToPrint", syncToPrint.Checked.ToString()); SetSyncToPrintVisibility(); }; layerInfoContainer.AddChild(syncToPrint); // The idea here is we just got asked to rebuild the window (and it is being created now) // because the gcode finished creating for the print that is printing. // We don't want to be notified if any other updates happen to this gcode while it is printing. if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting && PrinterConnectionAndCommunication.Instance.ActivePrintItem == printItem) { printItem.SlicingOutputMessage -= sliceItem_SlicingOutputMessage; printItem.SlicingDone -= sliceItem_Done; generateGCodeButton.Visible = false; // However if the print finished or is canceled we are going to want to get updates again. So, hook the status event PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(HookUpGCodeMessagesWhenDonePrinting, ref unregisterEvents); UiThread.RunOnIdle(SetSyncToPrintVisibility); } } //layerInfoContainer.AddChild(new CheckBox("Show Retractions", textColor: ActiveTheme.Instance.PrimaryTextColor)); buttonPanel.AddChild(layerInfoContainer); textImageButtonFactory.FixedWidth = oldWidth; }
private FlowLayoutWidget CreateRightButtonPanel() { FlowLayoutWidget buttonRightPanel = new FlowLayoutWidget(FlowDirection.TopToBottom); buttonRightPanel.Width = 200; { string label = "Model".Localize().ToUpper(); expandModelOptions = expandMenuOptionFactory.GenerateCheckBoxButton(label, "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); expandModelOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandModelOptions); expandModelOptions.Checked = true; modelOptionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); modelOptionsContainer.HAnchor = HAnchor.ParentLeftRight; //modelOptionsContainer.Visible = false; buttonRightPanel.AddChild(modelOptionsContainer); expandDisplayOptions = expandMenuOptionFactory.GenerateCheckBoxButton("Display".Localize().ToUpper(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); expandDisplayOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandDisplayOptions); expandDisplayOptions.Checked = false; displayOptionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); displayOptionsContainer.HAnchor = HAnchor.ParentLeftRight; displayOptionsContainer.Padding = new BorderDouble(left: 6); displayOptionsContainer.Visible = false; buttonRightPanel.AddChild(displayOptionsContainer); GuiWidget verticalSpacer = new GuiWidget(); verticalSpacer.VAnchor = VAnchor.ParentBottomTop; buttonRightPanel.AddChild(verticalSpacer); } buttonRightPanel.Padding = new BorderDouble(6, 6); buttonRightPanel.Margin = new BorderDouble(0, 1); buttonRightPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel.VAnchor = VAnchor.ParentBottomTop; return buttonRightPanel; }
public void PrintActivePart(bool overrideAllowGCode = false) { try { // If leveling is required or is currently on if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.print_leveling_required_to_print) || ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.print_leveling_enabled)) { PrintLevelingData levelingData = ActiveSliceSettings.Instance.Helpers.GetPrintLevelingData(); if (levelingData?.HasBeenRunAndEnabled() != true) { LevelWizardBase.ShowPrintLevelWizard(); return; } } if (PrinterConnectionAndCommunication.Instance.ActivePrintItem != null) { string pathAndFile = PrinterConnectionAndCommunication.Instance.ActivePrintItem.FileLocation; if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_sd_card_reader) && pathAndFile == QueueData.SdCardFileName) { PrinterConnectionAndCommunication.Instance.StartSdCardPrint(); } else if (ActiveSliceSettings.Instance.IsValid()) { if (File.Exists(pathAndFile)) { // clear the output cache prior to starting a print PrinterOutputCache.Instance.Clear(); string hideGCodeWarning = ApplicationSettings.Instance.get(ApplicationSettingsKey.HideGCodeWarning); if (Path.GetExtension(pathAndFile).ToUpper() == ".GCODE" && hideGCodeWarning == null && !overrideAllowGCode) { CheckBox hideGCodeWarningCheckBox = new CheckBox(doNotAskAgainMessage); hideGCodeWarningCheckBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; hideGCodeWarningCheckBox.Margin = new BorderDouble(top: 6, left: 6); hideGCodeWarningCheckBox.HAnchor = Agg.UI.HAnchor.ParentLeft; hideGCodeWarningCheckBox.Click += (sender, e) => { if (hideGCodeWarningCheckBox.Checked) { ApplicationSettings.Instance.set(ApplicationSettingsKey.HideGCodeWarning, "true"); } else { ApplicationSettings.Instance.set(ApplicationSettingsKey.HideGCodeWarning, null); } }; UiThread.RunOnIdle(() => StyledMessageBox.ShowMessageBox(onConfirmPrint, gcodeWarningMessage, "Warning - GCode file".Localize(), new GuiWidget[] { new VerticalSpacer(), hideGCodeWarningCheckBox }, StyledMessageBox.MessageType.YES_NO)); } else { PrinterConnectionAndCommunication.Instance.CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint; PrintItemWrapper partToPrint = PrinterConnectionAndCommunication.Instance.ActivePrintItem; SlicingQueue.Instance.QueuePartForSlicing(partToPrint); partToPrint.SlicingDone += partToPrint_SliceDone; } } else { string message = String.Format(removeFromQueueMessage, pathAndFile); StyledMessageBox.ShowMessageBox(onRemoveMessageConfirm, message, itemNotFoundMessage, StyledMessageBox.MessageType.YES_NO, "Remove".Localize(), "Cancel".Localize()); } } } } catch (Exception e) { Debug.Print(e.Message); GuiWidget.BreakInDebugger(); // Let's track this issue if possible. MatterControlApplication.Instance.ReportException(e, this.GetType().Name, MethodBase.GetCurrentMethod().Name); } }
// private as you can't make one private OutputScrollWindow() : base(400, 300) { this.BackgroundColor = backgroundColor; this.Padding = new BorderDouble(5, 0); FlowLayoutWidget topLeftToRightLayout = new FlowLayoutWidget(); topLeftToRightLayout.AnchorAll(); { FlowLayoutWidget manualEntryTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); manualEntryTopToBottomLayout.VAnchor |= Agg.UI.VAnchor.ParentTop; manualEntryTopToBottomLayout.Padding = new BorderDouble(top:8); { FlowLayoutWidget topBarControls = new FlowLayoutWidget(FlowDirection.LeftToRight); topBarControls.HAnchor |= HAnchor.ParentLeft; string filterOutputChkTxt = LocalizedString.Get("Filter Output"); filterOutput = new CheckBox(filterOutputChkTxt); filterOutput.Margin = new BorderDouble(5, 5, 5, 2); filterOutput.Checked = false; filterOutput.TextColor = this.textColor; filterOutput.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(SetCorrectFilterOutputBehavior); filterOutput.VAnchor = Agg.UI.VAnchor.ParentBottom; topBarControls.AddChild(filterOutput); string autoUpperCaseChkTxt = LocalizedString.Get("Auto Uppercase"); autoUppercase = new CheckBox(autoUpperCaseChkTxt); autoUppercase.Margin = new BorderDouble(5, 5, 5, 2); autoUppercase.Checked = true; autoUppercase.TextColor = this.textColor; autoUppercase.VAnchor = Agg.UI.VAnchor.ParentBottom; topBarControls.AddChild(autoUppercase); manualEntryTopToBottomLayout.AddChild(topBarControls); } { outputScrollWidget = new OutputScroll(); //outputScrollWidget.Height = 100; outputScrollWidget.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; outputScrollWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor; outputScrollWidget.HAnchor = HAnchor.ParentLeftRight; outputScrollWidget.VAnchor = VAnchor.ParentBottomTop; outputScrollWidget.Margin = new BorderDouble(0,5); outputScrollWidget.Padding = new BorderDouble(3, 0); manualEntryTopToBottomLayout.AddChild(outputScrollWidget); } FlowLayoutWidget manualEntryLayout = new FlowLayoutWidget(FlowDirection.LeftToRight); manualEntryLayout.BackgroundColor = this.backgroundColor; manualEntryLayout.HAnchor = HAnchor.ParentLeftRight; { manualCommandTextEdit = new MHTextEditWidget(""); //manualCommandTextEdit.BackgroundColor = RGBA_Bytes.White; manualCommandTextEdit.Margin = new BorderDouble(right: 3); manualCommandTextEdit.HAnchor = HAnchor.ParentLeftRight; manualCommandTextEdit.VAnchor = VAnchor.ParentBottom; manualCommandTextEdit.ActualTextEditWidget.EnterPressed += new KeyEventHandler(manualCommandTextEdit_EnterPressed); manualCommandTextEdit.ActualTextEditWidget.KeyDown += new KeyEventHandler(manualCommandTextEdit_KeyDown); manualEntryLayout.AddChild(manualCommandTextEdit); } manualEntryTopToBottomLayout.AddChild(manualEntryLayout); Button clearConsoleButton = controlButtonFactory.Generate(LocalizedString.Get("Clear")); clearConsoleButton.Margin = new BorderDouble(0); clearConsoleButton.Click += (sender, e) => { outputScrollWidget.Clear(); }; Button closeButton = controlButtonFactory.Generate(LocalizedString.Get("Close")); closeButton.Click += (sender, e) => { UiThread.RunOnIdle(CloseWindow); }; sendCommand = controlButtonFactory.Generate(LocalizedString.Get("Send")); sendCommand.Click += new ButtonBase.ButtonEventHandler(sendManualCommandToPrinter_Click); FlowLayoutWidget bottomRowContainer = new FlowLayoutWidget(); bottomRowContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; bottomRowContainer.Margin = new BorderDouble(0, 3); bottomRowContainer.AddChild(sendCommand); bottomRowContainer.AddChild(clearConsoleButton); bottomRowContainer.AddChild(new HorizontalSpacer()); bottomRowContainer.AddChild(closeButton); manualEntryTopToBottomLayout.AddChild(bottomRowContainer); manualEntryTopToBottomLayout.AnchorAll(); topLeftToRightLayout.AddChild(manualEntryTopToBottomLayout); } AddHandlers(); AddChild(topLeftToRightLayout); SetCorrectFilterOutputBehavior(this, null); this.AnchorAll(); Title = LocalizedString.Get("MatterControl - Terminal"); this.ShowAsSystemWindow(); MinimumSize = new Vector2(Width, Height); }
public void CreateWindowContent() { this.RemoveAllChildren(); TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory(); FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); topToBottom.AnchorAll(); // Creates Header FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; //Creates Text and adds into header { TextWidget elementHeader = new TextWidget("File export options:".Localize(), pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); topToBottom.AddChild(headerRow); } // Creates container in the middle of window FlowLayoutWidget middleRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { middleRowContainer.HAnchor = HAnchor.ParentLeftRight; middleRowContainer.VAnchor = VAnchor.ParentBottomTop; middleRowContainer.Padding = new BorderDouble(5); middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } if (!partIsGCode) { string exportStlText = LocalizedString.Get("Export as"); string exportStlTextFull = string.Format("{0} STL", exportStlText); Button exportAsStlButton = textImageButtonFactory.Generate(exportStlTextFull); exportAsStlButton.HAnchor = HAnchor.ParentLeft; exportAsStlButton.Cursor = Cursors.Hand; exportAsStlButton.Click += new EventHandler(exportSTL_Click); middleRowContainer.AddChild(exportAsStlButton); } if (!partIsGCode) { string exportAmfText = LocalizedString.Get("Export as"); string exportAmfTextFull = string.Format("{0} AMF", exportAmfText); Button exportAsAmfButton = textImageButtonFactory.Generate(exportAmfTextFull); exportAsAmfButton.HAnchor = HAnchor.ParentLeft; exportAsAmfButton.Cursor = Cursors.Hand; exportAsAmfButton.Click += new EventHandler(exportAMF_Click); middleRowContainer.AddChild(exportAsAmfButton); } bool showExportGCodeButton = ActiveSliceSettings.Instance != null || partIsGCode; if (showExportGCodeButton) { string exportGCodeTextFull = string.Format("{0} G-Code", "Export as".Localize()); Button exportGCode = textImageButtonFactory.Generate(exportGCodeTextFull); exportGCode.Name = "Export as GCode Button"; exportGCode.HAnchor = HAnchor.ParentLeft; exportGCode.Cursor = Cursors.Hand; exportGCode.Click += new EventHandler((object sender, EventArgs e) => { UiThread.RunOnIdle(ExportGCode_Click); }); middleRowContainer.AddChild(exportGCode); PluginFinder<ExportGcodePlugin> exportPluginFinder = new PluginFinder<ExportGcodePlugin>(); foreach (ExportGcodePlugin plugin in exportPluginFinder.Plugins) { //Create export button for each Plugin found string exportButtonText = plugin.GetButtonText().Localize(); Button exportButton = textImageButtonFactory.Generate(exportButtonText); exportButton.HAnchor = HAnchor.ParentLeft; exportButton.Cursor = Cursors.Hand; exportButton.Click += (object sender, EventArgs e) => { UiThread.RunOnIdle(() => { // Close the export window Close(); // Open a SaveFileDialog. If Save is clicked, slice the part if needed and pass the plugin the // path to the gcode file and the target save path FileDialog.SaveFileDialog( new SaveFileDialogParams(plugin.GetExtensionFilter()) { Title = "MatterControl: Export File", FileName = printItemWrapper.Name, ActionButtonLabel = "Export" }, (SaveFileDialogParams saveParam) => { string extension = Path.GetExtension(saveParam.FileName); if (extension == "") { saveParam.FileName += plugin.GetFileExtension(); } if (partIsGCode) { plugin.Generate(printItemWrapper.FileLocation, saveParam.FileName); } else { SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper); printItemWrapper.SlicingDone += (printItem, eventArgs) => { PrintItemWrapper sliceItem = (PrintItemWrapper)printItem; if (File.Exists(sliceItem.GetGCodePathAndFileName())) { plugin.Generate(sliceItem.GetGCodePathAndFileName(), saveParam.FileName); } }; } }); }); }; // End exportButton Click handler middleRowContainer.AddChild(exportButton); } } middleRowContainer.AddChild(new VerticalSpacer()); // If print leveling is enabled then add in a check box 'Apply Leveling During Export' and default checked. if (showExportGCodeButton && ActiveSliceSettings.Instance.DoPrintLeveling) { applyLeveling = new CheckBox(LocalizedString.Get(applyLevelingDuringExportString), ActiveTheme.Instance.PrimaryTextColor, 10); applyLeveling.Checked = true; applyLeveling.HAnchor = HAnchor.ParentLeft; applyLeveling.Cursor = Cursors.Hand; //applyLeveling.Margin = new BorderDouble(top: 10); middleRowContainer.AddChild(applyLeveling); } // TODO: make this work on the mac and then delete this if if (OsInformation.OperatingSystem == OSType.Windows || OsInformation.OperatingSystem == OSType.X11) { showInFolderAfterSave = new CheckBox(LocalizedString.Get("Show file in folder after save"), ActiveTheme.Instance.PrimaryTextColor, 10); showInFolderAfterSave.HAnchor = HAnchor.ParentLeft; showInFolderAfterSave.Cursor = Cursors.Hand; //showInFolderAfterSave.Margin = new BorderDouble(top: 10); middleRowContainer.AddChild(showInFolderAfterSave); } if (!showExportGCodeButton) { string noGCodeMessageTextBeg = LocalizedString.Get("Note"); string noGCodeMessageTextEnd = LocalizedString.Get("To enable GCode export, select a printer profile."); string noGCodeMessageTextFull = string.Format("{0}: {1}", noGCodeMessageTextBeg, noGCodeMessageTextEnd); TextWidget noGCodeMessage = new TextWidget(noGCodeMessageTextFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10); noGCodeMessage.HAnchor = HAnchor.ParentLeft; middleRowContainer.AddChild(noGCodeMessage); } //Creates button container on the bottom of window FlowLayoutWidget buttonRow = new FlowLayoutWidget(FlowDirection.LeftToRight); { BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); } Button cancelButton = textImageButtonFactory.Generate("Cancel"); cancelButton.Name = "Export Item Window Cancel Button"; cancelButton.Cursor = Cursors.Hand; cancelButton.Click += (sender, e) => { CloseOnIdle(); }; buttonRow.AddChild(new HorizontalSpacer()); buttonRow.AddChild(cancelButton); topToBottom.AddChild(middleRowContainer); topToBottom.AddChild(buttonRow); this.AddChild(topToBottom); }
private void CreateGraphs() { int FrameRateOffset = -15; RGBA_Floats FrameRateControlColor = new RGBA_Floats(1, 1, 1, 1); m_PotentialDrawsBudgetPosition = new Vector2(10, (double)Height + FrameRateOffset); m_ShowPotentialDrawsBudgetGraph = new MatterHackers.Agg.UI.CheckBox(m_PotentialDrawsBudgetPosition.x, m_PotentialDrawsBudgetPosition.y, "D:000.000"); m_ShowPotentialDrawsBudgetGraph.TextColor = FrameRateControlColor.GetAsRGBA_Bytes(); //m_ShowPotentialDrawsBudgetGraph.inactive_color(FrameRateControlColor); AddChild(m_ShowPotentialDrawsBudgetGraph); m_PotentialDrawsBudgetGraph = new DataViewGraph(m_PotentialDrawsBudgetPosition, 100, 100); m_PotentialUpdatesBudgetPosition = new Vector2(115, (double)Height + FrameRateOffset); m_ShowPotentialUpdatesBudgetGraph = new MatterHackers.Agg.UI.CheckBox(m_PotentialUpdatesBudgetPosition.x, m_PotentialUpdatesBudgetPosition.y, "U:000.000"); m_ShowPotentialUpdatesBudgetGraph.TextColor = FrameRateControlColor.GetAsRGBA_Bytes(); //m_ShowPotentialUpdatesBudgetGraph.inactive_color(FrameRateControlColor); AddChild(m_ShowPotentialUpdatesBudgetGraph); m_PotentialUpdatesBudgetGraph = new DataViewGraph(m_PotentialUpdatesBudgetPosition, 100, 100); m_ActualDrawsBudgetPosition = new Vector2(220, (double)Height + FrameRateOffset); m_ShowActualDrawsBudgetGraph = new MatterHackers.Agg.UI.CheckBox(m_ActualDrawsBudgetPosition.x, m_ActualDrawsBudgetPosition.y, "A:000.000"); m_ShowActualDrawsBudgetGraph.TextColor = FrameRateControlColor.GetAsRGBA_Bytes(); //m_ShowActualDrawsBudgetGraph.inactive_color(FrameRateControlColor); AddChild(m_ShowActualDrawsBudgetGraph); m_ActualDrawsBudgetGraph = new DataViewGraph(m_ActualDrawsBudgetPosition, 100, 100); }
public TerminalWidget(bool showInWindow) { this.BackgroundColor = backgroundColor; this.Padding = new BorderDouble(5, 0); FlowLayoutWidget topLeftToRightLayout = new FlowLayoutWidget(); topLeftToRightLayout.AnchorAll(); { FlowLayoutWidget manualEntryTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); manualEntryTopToBottomLayout.VAnchor |= Agg.UI.VAnchor.ParentTop; manualEntryTopToBottomLayout.Padding = new BorderDouble(top: 8); { FlowLayoutWidget topBarControls = new FlowLayoutWidget(FlowDirection.LeftToRight); topBarControls.HAnchor |= HAnchor.ParentLeft; { string filterOutputChkTxt = LocalizedString.Get("Filter Output"); filterOutput = new CheckBox(filterOutputChkTxt); filterOutput.Margin = new BorderDouble(5, 5, 5, 2); filterOutput.TextColor = this.textColor; filterOutput.CheckedStateChanged += (object sender, EventArgs e) => { if (filterOutput.Checked) { textScrollWidget.SetLineStartFilter(new string[] { "<-wait", "<-ok", "->M105", "<-T" }); } else { textScrollWidget.SetLineStartFilter(null); } UserSettings.Instance.Fields.SetBool(TerminalFilterOutputKey, filterOutput.Checked); }; filterOutput.VAnchor = Agg.UI.VAnchor.ParentBottom; topBarControls.AddChild(filterOutput); } { string autoUpperCaseChkTxt = LocalizedString.Get("Auto Uppercase"); autoUppercase = new CheckBox(autoUpperCaseChkTxt); autoUppercase.Margin = new BorderDouble(5, 5, 5, 2); autoUppercase.Checked = UserSettings.Instance.Fields.GetBool(TerminalAutoUppercaseKey, true); autoUppercase.TextColor = this.textColor; autoUppercase.VAnchor = Agg.UI.VAnchor.ParentBottom; topBarControls.AddChild(autoUppercase); autoUppercase.CheckedStateChanged += (sender, e) => { UserSettings.Instance.Fields.SetBool(TerminalAutoUppercaseKey, autoUppercase.Checked); }; manualEntryTopToBottomLayout.AddChild(topBarControls); } } { FlowLayoutWidget leftToRight = new FlowLayoutWidget(); leftToRight.AnchorAll(); textScrollWidget = new TextScrollWidget(PrinterOutputCache.Instance.PrinterLines); //outputScrollWidget.Height = 100; textScrollWidget.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; textScrollWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor; textScrollWidget.HAnchor = HAnchor.ParentLeftRight; textScrollWidget.VAnchor = VAnchor.ParentBottomTop; textScrollWidget.Margin = new BorderDouble(0, 5); textScrollWidget.Padding = new BorderDouble(3, 0); leftToRight.AddChild(textScrollWidget); TextScrollBar textScrollBar = new TextScrollBar(textScrollWidget, 15); leftToRight.AddChild(textScrollBar); manualEntryTopToBottomLayout.AddChild(leftToRight); } FlowLayoutWidget manualEntryLayout = new FlowLayoutWidget(FlowDirection.LeftToRight); manualEntryLayout.BackgroundColor = this.backgroundColor; manualEntryLayout.HAnchor = HAnchor.ParentLeftRight; { manualCommandTextEdit = new MHTextEditWidget(""); //manualCommandTextEdit.BackgroundColor = RGBA_Bytes.White; manualCommandTextEdit.Margin = new BorderDouble(right: 3); manualCommandTextEdit.HAnchor = HAnchor.ParentLeftRight; manualCommandTextEdit.VAnchor = VAnchor.ParentBottom; manualCommandTextEdit.ActualTextEditWidget.EnterPressed += new KeyEventHandler(manualCommandTextEdit_EnterPressed); manualCommandTextEdit.ActualTextEditWidget.KeyDown += new KeyEventHandler(manualCommandTextEdit_KeyDown); manualEntryLayout.AddChild(manualCommandTextEdit); } manualEntryTopToBottomLayout.AddChild(manualEntryLayout); Button clearConsoleButton = controlButtonFactory.Generate(LocalizedString.Get("Clear")); clearConsoleButton.Margin = new BorderDouble(0); clearConsoleButton.Click += (sender, e) => { PrinterOutputCache.Instance.Clear(); }; //Output Console text to screen Button exportConsoleTextButton = controlButtonFactory.Generate(LocalizedString.Get("Export...")); exportConsoleTextButton.Click += (sender, mouseEvent) => { UiThread.RunOnIdle(DoExportExportLog_Click); }; Button closeButton = controlButtonFactory.Generate(LocalizedString.Get("Close")); closeButton.Click += (sender, e) => { UiThread.RunOnIdle(CloseWindow); }; sendCommand = controlButtonFactory.Generate(LocalizedString.Get("Send")); sendCommand.Click += new EventHandler(sendManualCommandToPrinter_Click); FlowLayoutWidget bottomRowContainer = new FlowLayoutWidget(); bottomRowContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; bottomRowContainer.Margin = new BorderDouble(0, 3); bottomRowContainer.AddChild(sendCommand); bottomRowContainer.AddChild(clearConsoleButton); bottomRowContainer.AddChild(exportConsoleTextButton); bottomRowContainer.AddChild(new HorizontalSpacer()); if (showInWindow) { bottomRowContainer.AddChild(closeButton); } manualEntryTopToBottomLayout.AddChild(bottomRowContainer); manualEntryTopToBottomLayout.AnchorAll(); topLeftToRightLayout.AddChild(manualEntryTopToBottomLayout); } AddChild(topLeftToRightLayout); this.AnchorAll(); }
public ShowAuthPanel() { WrappedTextWidget userSignInPromptLabel = new WrappedTextWidget("Sign in to access your cloud printer profiles.\n\nOnce signed in you will be able to access:".Localize()) { TextColor = ActiveTheme.Instance.PrimaryTextColor, }; contentRow.AddChild(userSignInPromptLabel); AddBulletPointAndDescription(contentRow, "Cloud Library".Localize(), "Save your designs to the cloud and access them from anywhere in the world. You can also share them any time with with anyone you want.".Localize()); AddBulletPointAndDescription(contentRow, "Cloud Printer Profiles".Localize(), "Create your machine settings once, and have them available anywhere you want to print. All your changes appear on all your devices.".Localize()); AddBulletPointAndDescription(contentRow, "Remote Monitoring".Localize(), "Check on your prints from anywhere. With cloud monitoring, you have access to your printer no matter where you go.".Localize()); contentRow.AddChild(new VerticalSpacer()); CheckBox rememberChoice = new CheckBox("Don't remind me again".Localize(), ActiveTheme.Instance.PrimaryTextColor); contentRow.AddChild(rememberChoice); rememberChoice.CheckedStateChanged += (s, e) => { ApplicationSettings.Instance.set(ApplicationSettingsKey.SuppressAuthPanel, rememberChoice.Checked.ToString()); }; var skipButton = textImageButtonFactory.Generate("Skip".Localize()); skipButton.Name = "Connection Wizard Skip Sign In Button"; skipButton.Click += (sender, e) => { if (!ProfileManager.Instance.ActiveProfiles.Any()) { WizardWindow.ChangeToPage<SetupStepMakeModelName>(); } else { UiThread.RunOnIdle(WizardWindow.Close); } }; var createAccountButton = textImageButtonFactory.Generate("Create Account".Localize()); createAccountButton.Name = "Create Account From Connection Wizard Button"; createAccountButton.Margin = new Agg.BorderDouble(right: 5); createAccountButton.Click += (s, e) => { WizardWindow.ChangeToAccountCreate(); UiThread.RunOnIdle(WizardWindow.Close); }; var signInButton = textImageButtonFactory.Generate("Sign In".Localize()); signInButton.Name = "Sign In From Connection Wizard Button"; signInButton.Click += (s, e) => { WizardWindow.ShowAuthDialog?.Invoke(); UiThread.RunOnIdle(WizardWindow.Close); }; footerRow.AddChild(skipButton); footerRow.AddChild(new HorizontalSpacer()); footerRow.AddChild(createAccountButton); footerRow.AddChild(signInButton); }