public MeshViewerWidget(Vector3 displayVolume, Vector2 bedCenter, BedShape bedShape, string startingTextMessage = "") { Scene.SelectionChanged += (sender, e) => { Invalidate(); }; RenderType = RenderTypes.Shaded; RenderBed = true; RenderBuildVolume = false; //SetMaterialColor(1, RGBA_Bytes.LightGray, RGBA_Bytes.White); BedColor = new ColorF(.8, .8, .8, .7).ToColor(); BuildVolumeColor = new ColorF(.2, .8, .3, .2).ToColor(); trackballTumbleWidget = new TrackballTumbleWidget(this.World, this); trackballTumbleWidget.TransformState = TrackBallTransformType.Rotation; AddChild(trackballTumbleWidget); CreatePrintBed(displayVolume, bedCenter, bedShape); trackballTumbleWidget.AnchorAll(); partProcessingInfo = new PartProcessingInfo(startingTextMessage); GuiWidget labelContainer = new GuiWidget(); labelContainer.AnchorAll(); labelContainer.AddChild(partProcessingInfo); labelContainer.Selectable = false; SetMaterialColor(1, accentColor); this.AddChild(labelContainer); }
public override void OnParentChanged(EventArgs e) { base.OnParentChanged(e); clientArea.Margin = new BorderDouble(0, 0, 0, dragBar.Height); clientArea.AnchorAll(); }
public MeshViewerWidget(Vector3 displayVolume, Vector2 bedCenter, BedShape bedShape, string startingTextMessage = "") { RenderType = RenderTypes.Shaded; RenderBed = true; RenderBuildVolume = false; //SetMaterialColor(1, RGBA_Bytes.LightGray, RGBA_Bytes.White); BedColor = new RGBA_Floats(.8, .8, .8, .7).GetAsRGBA_Bytes(); BuildVolumeColor = new RGBA_Floats(.2, .8, .3, .2).GetAsRGBA_Bytes(); trackballTumbleWidget = new TrackballTumbleWidget(); trackballTumbleWidget.DrawRotationHelperCircle = false; trackballTumbleWidget.DrawGlContent += trackballTumbleWidget_DrawGlContent; trackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation; AddChild(trackballTumbleWidget); CreatePrintBed(displayVolume, bedCenter, bedShape); trackballTumbleWidget.AnchorAll(); partProcessingInfo = new PartProcessingInfo(startingTextMessage); GuiWidget labelContainer = new GuiWidget(); labelContainer.AnchorAll(); labelContainer.AddChild(partProcessingInfo); labelContainer.Selectable = false; this.AddChild(labelContainer); }
private void SetProcessingMessage(string message) { if (gcodeProcessingStateInfoText == null) { gcodeProcessingStateInfoText = new TextWidget(message); gcodeProcessingStateInfoText.HAnchor = HAnchor.ParentCenter; gcodeProcessingStateInfoText.VAnchor = VAnchor.ParentCenter; gcodeProcessingStateInfoText.AutoExpandBoundsToText = true; GuiWidget labelContainer = new GuiWidget(); labelContainer.AnchorAll(); labelContainer.AddChild(gcodeProcessingStateInfoText); labelContainer.Selectable = false; gcodeDisplayWidget.AddChild(labelContainer); } if (message == "") { gcodeProcessingStateInfoText.BackgroundColor = new RGBA_Bytes(); } else { gcodeProcessingStateInfoText.BackgroundColor = RGBA_Bytes.White; } gcodeProcessingStateInfoText.Text = message; }
public void LoadMesh(string meshPathAndFileName) { backgroundWorker = new BackgroundWorker(); backgroundWorker.WorkerReportsProgress = true; backgroundWorker.WorkerSupportsCancellation = true; backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted); bool loadingMeshFile = false; switch (Path.GetExtension(meshPathAndFileName).ToUpper()) { case ".STL": { StlProcessing stlLoader = new StlProcessing(); stlLoader.LoadInBackground(backgroundWorker, meshPathAndFileName); loadingMeshFile = true; } break; case ".AMF": { AmfProcessing amfLoader = new AmfProcessing(); amfLoader.LoadInBackground(backgroundWorker, meshPathAndFileName); loadingMeshFile = true; } break; default: loadingMeshFile = false; break; } if (loadingMeshFile) { meshLoadingStateInfoText = new TextWidget("Loading Mesh..."); meshLoadingStateInfoText.HAnchor = HAnchor.ParentCenter; meshLoadingStateInfoText.VAnchor = VAnchor.ParentCenter; meshLoadingStateInfoText.AutoExpandBoundsToText = true; GuiWidget labelContainer = new GuiWidget(); labelContainer.AnchorAll(); labelContainer.AddChild(meshLoadingStateInfoText); labelContainer.Selectable = false; this.AddChild(labelContainer); } else { TextWidget no3DView = new TextWidget(string.Format("No 3D view for this file type '{0}'.", Path.GetExtension(meshPathAndFileName).ToUpper())); no3DView.Margin = new BorderDouble(0, 0, 0, 0); no3DView.VAnchor = Agg.UI.VAnchor.ParentCenter; no3DView.HAnchor = Agg.UI.HAnchor.ParentCenter; this.AddChild(no3DView); } }
public SoftKeyboardContentOffset(GuiWidget content) { this.content = content; AnchorAll(); contentOffsetHolder = new GuiWidget(Width, Height); contentOffsetHolder.AnchorAll(); contentOffsetHolder.AddChild(content); AddChild(contentOffsetHolder); TextEditWidget.ShowSoftwareKeyboard += EnsureEditControlIsVisible; TextEditWidget.KeyboardCollapsed += MoveContentBackDown; }
public FatFlatClickWidget(TextWidget textWidget) { overlay = new GuiWidget(); overlay.AnchorAll(); overlay.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; overlay.Visible = false; this.GetChildClicks = true; this.AddChild(textWidget); this.AddChild(overlay); }
public TabControl(Orientation orientation = Orientation.Horizontal) { AnchorAll(); GuiWidget tabPageArea = new GuiWidget(); tabBar = new TabBar(FlowDirection.LeftToRight, tabPageArea); //tabBar.LocalBounds = new RectangleDouble(0, 0, 20, 20); base.AddChild(tabBar); //tabPageArea.BackgroundColor = new RGBA_Bytes(0, 255, 0, 50); base.AddChild(tabPageArea); tabPageArea.AnchorAll(); this.Orientation = orientation; }
public TabControl(Orientation orientation = Orientation.Horizontal) { AnchorAll(); GuiWidget tabPageArea = new GuiWidget(); tabBar = new TabBar(FlowDirection.LeftToRight, tabPageArea); base.AddChild(tabBar); base.AddChild(tabPageArea); tabPageArea.AnchorAll(); this.Orientation = orientation; }
private void AddProcessingMessage(string message) { gcodeProcessingStateInfoText = new TextWidget(message); gcodeProcessingStateInfoText.HAnchor = HAnchor.ParentCenter; gcodeProcessingStateInfoText.VAnchor = VAnchor.ParentCenter; gcodeProcessingStateInfoText.AutoExpandBoundsToText = true; GuiWidget labelContainer = new GuiWidget(); labelContainer.AnchorAll(); labelContainer.AddChild(gcodeProcessingStateInfoText); labelContainer.Selectable = false; gcodeDispalyWidget.AddChild(labelContainer); }
public SlicePresetsWindow(PresetsContext presetsContext) : base(641, 481) { this.presetsContext = presetsContext; this.AlwaysOnTopOfMain = true; this.Title = LocalizedString.Get("Slice Presets Editor"); this.MinimumSize = new Vector2(640, 480); this.AnchorAll(); var linkButtonFactory = new LinkButtonFactory() { fontSize = 8, textColor = ActiveTheme.Instance.SecondaryAccentColor }; var buttonFactory = new TextImageButtonFactory() { normalTextColor = ActiveTheme.Instance.PrimaryTextColor, hoverTextColor = ActiveTheme.Instance.PrimaryTextColor, disabledTextColor = ActiveTheme.Instance.PrimaryTextColor, pressedTextColor = ActiveTheme.Instance.PrimaryTextColor, borderWidth = 0 }; FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom) { Padding = new BorderDouble(3) }; mainContainer.AnchorAll(); middleRow = new GuiWidget(); middleRow.AnchorAll(); middleRow.AddChild(CreateSliceSettingsWidget(presetsContext.PersistenceLayer)); mainContainer.AddChild(GetTopRow()); mainContainer.AddChild(middleRow); mainContainer.AddChild(GetBottomRow(buttonFactory)); this.AddChild(mainContainer); BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; }
public View3DTextCreator(Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape) { boldTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "LiberationSans-Bold.svg"))); MeshGroupExtraData = new List <PlatingMeshGroupData>(); FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight; FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight); centerPartPreviewAndControls.AnchorAll(); GuiWidget viewArea = new GuiWidget(); viewArea.AnchorAll(); { meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape); meshViewerWidget.AllowBedRenderingWhenEmpty = true; meshViewerWidget.AnchorAll(); } viewArea.AddChild(meshViewerWidget); centerPartPreviewAndControls.AddChild(viewArea); mainContainerTopToBottom.AddChild(centerPartPreviewAndControls); FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.Padding = new BorderDouble(3, 3); buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel = CreateRightButtonPanel(viewerVolume.y); // add in the plater tools { FlowLayoutWidget editToolBar = new FlowLayoutWidget(); processingProgressControl = new ProgressControl("Finding Parts:".Localize(), ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor); processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter; editToolBar.AddChild(processingProgressControl); editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; editPlateButtonsContainer = new FlowLayoutWidget(); textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter Text Here".Localize()); textToAddWidget.VAnchor = VAnchor.ParentCenter; textToAddWidget.Margin = new BorderDouble(5); editPlateButtonsContainer.AddChild(textToAddWidget); textToAddWidget.ActualTextEditWidget.EnterPressed += (object sender, KeyEventArgs keyEvent) => { InsertTextNow(textToAddWidget.Text); }; Button insertTextButton = textImageButtonFactory.Generate("Insert".Localize()); editPlateButtonsContainer.AddChild(insertTextButton); insertTextButton.Click += (sender, e) => { InsertTextNow(textToAddWidget.Text); }; KeyDown += (sender, e) => { KeyEventArgs keyEvent = e as KeyEventArgs; if (keyEvent != null && !keyEvent.Handled) { if (keyEvent.KeyCode == Keys.Escape) { if (meshSelectInfo.downOnPart) { meshSelectInfo.downOnPart = false; ScaleRotateTranslate translated = SelectedMeshTransform; translated.translation *= transformOnMouseDown; SelectedMeshTransform = translated; Invalidate(); } } } }; editToolBar.AddChild(editPlateButtonsContainer); buttonBottomPanel.AddChild(editToolBar); } GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop); centerPartPreviewAndControls.AddChild(buttonRightPanelHolder); buttonRightPanelHolder.AddChild(buttonRightPanel); viewControls3D = new ViewControls3D(meshViewerWidget); viewControls3D.ResetView += (sender, e) => { SetDefaultView(); }; buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop); buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150); buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover); LockEditControls(); GuiWidget leftRightSpacer = new GuiWidget(); leftRightSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.AddChild(leftRightSpacer); closeButton = textImageButtonFactory.Generate("Close".Localize()); buttonBottomPanel.AddChild(closeButton); mainContainerTopToBottom.AddChild(buttonBottomPanel); this.AddChild(mainContainerTopToBottom); this.AnchorAll(); meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation; AddChild(viewControls3D); SetDefaultView(); AddHandlers(); UnlockEditControls(); // but make sure we can't use the right panel yet buttonRightPanelDisabledCover.Visible = true; }
public View3DBrailleBuilder(Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape) { boldTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "LiberationMono.svg"))); brailTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "Braille.svg"))); MeshGroupExtraData = new List <PlatingMeshGroupData>(); FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight; FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight); centerPartPreviewAndControls.AnchorAll(); GuiWidget viewArea = new GuiWidget(); viewArea.AnchorAll(); { meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape); meshViewerWidget.AllowBedRenderingWhenEmpty = true; meshViewerWidget.AnchorAll(); } viewArea.AddChild(meshViewerWidget); centerPartPreviewAndControls.AddChild(viewArea); mainContainerTopToBottom.AddChild(centerPartPreviewAndControls); FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.Padding = new BorderDouble(3, 3); buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel = CreateRightButtonPanel(viewerVolume.y); // add in the plater tools { FlowLayoutWidget editToolBar = new FlowLayoutWidget(); processingProgressControl = new ProgressControl("Finding Parts:".Localize(), ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor); processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter; editToolBar.AddChild(processingProgressControl); editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; editPlateButtonsContainer = new FlowLayoutWidget(); textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter Text Here".Localize()); textToAddWidget.VAnchor = VAnchor.ParentCenter; textToAddWidget.Margin = new BorderDouble(5); editPlateButtonsContainer.AddChild(textToAddWidget); textToAddWidget.ActualTextEditWidget.EnterPressed += (object sender, KeyEventArgs keyEvent) => { InsertTextNow(textToAddWidget.Text); }; Button insertTextButton = textImageButtonFactory.Generate("Insert".Localize()); editPlateButtonsContainer.AddChild(insertTextButton); insertTextButton.Click += (sender, e) => { InsertTextNow(textToAddWidget.Text); }; editToolBar.AddChild(editPlateButtonsContainer); buttonBottomPanel.AddChild(editToolBar); } GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop); centerPartPreviewAndControls.AddChild(buttonRightPanelHolder); buttonRightPanelHolder.AddChild(buttonRightPanel); viewControls3D = new ViewControls3D(meshViewerWidget); buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop); buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150); buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover); LockEditControls(); GuiWidget leftRightSpacer = new GuiWidget(); leftRightSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.AddChild(leftRightSpacer); closeButton = textImageButtonFactory.Generate("Close".Localize()); buttonBottomPanel.AddChild(closeButton); mainContainerTopToBottom.AddChild(buttonBottomPanel); this.AddChild(mainContainerTopToBottom); this.AnchorAll(); meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation; AddChild(viewControls3D); // set the view to be a good angle and distance meshViewerWidget.TrackballTumbleWidget.TrackBallController.Scale = .06; meshViewerWidget.TrackballTumbleWidget.TrackBallController.Rotate(Quaternion.FromEulerAngles(new Vector3(-MathHelper.Tau * .02, 0, 0))); meshViewerWidget.TrackballTumbleWidget.TrackBallController.Translate(-new Vector3(bedCenter)); AddHandlers(); UnlockEditControls(); // but make sure we can't use the right panel yet buttonRightPanelDisabledCover.Visible = true; //meshViewerWidget.RenderType = RenderTypes.Outlines; viewControls3D.PartSelectVisible = false; }
public PluginChooserWindow() : base(360, 300) { Title = new LocalizedString("Installed Plugins").Translated; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); 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); { string elementHeaderLblBeg = new LocalizedString("Select a Design Tool").Translated; string elementHeaderLblFull = string.Format("{0}:", elementHeaderLblBeg); string elementHeaderLbl = elementHeaderLblFull; TextWidget elementHeader = new TextWidget(string.Format(elementHeaderLbl), pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); } topToBottom.AddChild(headerRow); GuiWidget presetsFormContainer = new GuiWidget(); //ListBox printerListContainer = new ListBox(); { presetsFormContainer.HAnchor = HAnchor.ParentLeftRight; presetsFormContainer.VAnchor = VAnchor.ParentBottomTop; presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } FlowLayoutWidget pluginRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); pluginRowContainer.AnchorAll(); presetsFormContainer.AddChild(pluginRowContainer); foreach (CreatorInformation creatorInfo in RegisteredCreators.Instance.Creators) { ClickWidget pluginRow = new ClickWidget(); pluginRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight; pluginRow.Height = 38; pluginRow.BackgroundColor = RGBA_Bytes.White; pluginRow.Padding = new BorderDouble(3); pluginRow.Margin = new BorderDouble(6, 0, 6, 6); GuiWidget overlay = new GuiWidget(); overlay.AnchorAll(); overlay.Cursor = Cursors.Hand; FlowLayoutWidget macroRow = new FlowLayoutWidget(); macroRow.AnchorAll(); macroRow.BackgroundColor = RGBA_Bytes.White; if (creatorInfo.iconPath != "") { ImageBuffer imageBuffer = LoadImage(creatorInfo.iconPath); ImageWidget imageWidget = new ImageWidget(imageBuffer); macroRow.AddChild(imageWidget); } TextWidget buttonLabel = new TextWidget(creatorInfo.description, pointSize: 14); buttonLabel.Margin = new BorderDouble(left: 10); buttonLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; macroRow.AddChild(buttonLabel); FlowLayoutWidget hSpacer = new FlowLayoutWidget(); hSpacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.AddChild(hSpacer); CreatorInformation callCorrectFunctionHold = creatorInfo; pluginRow.Click += (sender, e) => { if (RegisteredCreators.Instance.Creators.Count > 0) { callCorrectFunctionHold.functionToLaunchCreator(null, null); } UiThread.RunOnIdle(CloseOnIdle); }; pluginRow.AddChild(macroRow); pluginRow.AddChild(overlay); pluginRowContainer.AddChild(pluginRow); } topToBottom.AddChild(presetsFormContainer); BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; //ShowAsSystemWindow(); Button cancelPresetsButton = textImageButtonFactory.Generate(new LocalizedString("Cancel").Translated); cancelPresetsButton.Click += (sender, e) => { Close(); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); GuiWidget hButtonSpacer = new GuiWidget(); hButtonSpacer.HAnchor = HAnchor.ParentLeftRight; buttonRow.AddChild(hButtonSpacer); buttonRow.AddChild(cancelPresetsButton); topToBottom.AddChild(buttonRow); AddChild(topToBottom); }
public MatterCadGuiWidget() { //rootUnion.Add(DemoProjects.PowerSupply()); //works but cutout is not working rootUnion.Add(SimplePartTester.Assembly()); //rootUnion.Add(new BoxPrimitive(8, 20, 10)); //rootUnion.Add(new LinearExtrude(new double[] { 1.1, 2.2, 3.3, 6.3 }, 7)); //rootUnion.Add( // new Difference (new Translate(new Cylinder(10, 40), 5, 10, 5), new Translate(new BoxPrimitive(10, 10, 20,"test",true), 5, 20, 5))); SuspendLayout(); verticleSpliter = new Splitter(); // pannel 1 stuff textSide = new FlowLayoutWidget(FlowDirection.TopToBottom); objectEditorView = new GuiWidget(300, 500); objectEditorList = new FlowLayoutWidget(); textEdit = new TextEditWidget("test", 300, 400); textEdit.HAnchor = HAnchor.ParentLeftRight; // textEdit.MinimumSize = new Vector2(Math.Max(textEdit.MinimumSize.x, pixelWidth), Math.Max(textEdit.MinimumSize.y, pixelHeight)); textEdit.VAnchor = VAnchor.ParentBottomTop; textEdit.Multiline = true; textEdit.BackgroundColor = RGBA_Bytes.Yellow; // objectEditorList.AddChild(textEdit);//CsgEditorBase.CreateEditorForCsg(rootUnion)); // objectEditorView.AddChild(objectEditorList); // objectEditorView.BackgroundColor = RGBA_Bytes.Orange; // objectEditorView.Text = "Hello World!"; objectEditorView.LocalBounds = new RectangleDouble(0, 0, 200, 300); textSide.LocalBounds = new RectangleDouble(0, 0, 200, 300); // objectEditorView.DebugShowBounds = true; textSide.AddChild(textEdit); textSide.BoundsChanged += new EventHandler(textSide_BoundsChanged); FlowLayoutWidget topButtonBar = new FlowLayoutWidget(); Button loadMatterScript = new Button("Load Matter Script"); loadMatterScript.Click += loadMatterScript_Click; topButtonBar.AddChild(loadMatterScript); outputScad = new Button("Output SCAD"); outputScad.Click += OutputScad_Click; topButtonBar.AddChild(outputScad); textSide.AddChild(topButtonBar); FlowLayoutWidget bottomButtonBar = new FlowLayoutWidget(); Button loadStl = new Button("Load STL"); loadStl.Click += LoadStl_Click; bottomButtonBar.AddChild(loadStl); textSide.AddChild(bottomButtonBar); // // pannel 2 stuff FlowLayoutWidget renderSide = new FlowLayoutWidget(FlowDirection.TopToBottom); renderSide.AnchorAll(); trackBallWidget = new TrackballTumbleWidget(); trackBallWidget.DrawGlContent += new EventHandler(glLightedView_DrawGlContent); renderSide.AddChild(trackBallWidget); verticleSpliter.Panel2.AddChild(renderSide); verticleSpliter.Panel1.AddChild(textSide); ResumeLayout(); objectEditorView.AnchorAll(); AnchorAll(); verticleSpliter.AnchorAll(); textSide.AnchorAll(); trackBallWidget.AnchorAll(); AddChild(verticleSpliter); BackgroundColor = RGBA_Bytes.White; }
public ManualPrinterControlsTouchScreen() : base(Orientation.Vertical) { RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected; this.TabBar.BackgroundColor = ActiveTheme.Instance.TransparentLightOverlay; this.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0); this.TabBar.Margin = new BorderDouble(0); this.TabBar.Padding = new BorderDouble(4, 4); this.AnchorAll(); this.VAnchor |= VAnchor.FitToChildren; this.Margin = new BorderDouble(0); this.TabTextSize = 13; // add action tab { GuiWidget actionContainerContainer = new GuiWidget(); actionContainerContainer.Padding = new BorderDouble(6); actionContainerContainer.AnchorAll(); actionControlsContainer = new ActionControls(); actionControlsContainer.VAnchor = VAnchor.ParentTop; if (ActiveSliceSettings.Instance.ActionMacros().Any()) { actionContainerContainer.AddChild(actionControlsContainer); } if (ActiveSliceSettings.Instance.ActionMacros().Any()) { TabPage actionTabPage = new TabPage(actionContainerContainer, "Actions".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(actionTabPage, "Actions Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } } // add temperature tab { GuiWidget temperatureContainerContainer = new GuiWidget(); temperatureContainerContainer.Padding = new BorderDouble(6); temperatureContainerContainer.AnchorAll(); temperatureControlsContainer = new TemperatureControls(); temperatureControlsContainer.VAnchor |= VAnchor.ParentTop; temperatureContainerContainer.AddChild(temperatureControlsContainer); TabPage temperatureTabPage = new TabPage(temperatureContainerContainer, "Temperature".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(temperatureTabPage, "Temperature Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } // add movement tab { GuiWidget movementContainerContainer = new GuiWidget(); movementContainerContainer.Padding = new BorderDouble(6); movementContainerContainer.AnchorAll(); movementControlsContainer = new MovementControls(); movementControlsContainer.VAnchor = VAnchor.ParentTop; movementContainerContainer.AddChild(movementControlsContainer); TabPage movementTabPage = new TabPage(movementContainerContainer, "Movement".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(movementTabPage, "Movement Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } // add macro tab { GuiWidget macrosContainerContainer = new GuiWidget(); macrosContainerContainer.Padding = new BorderDouble(6); macrosContainerContainer.AnchorAll(); macroControlsContainer = new MacroControls(); macroControlsContainer.VAnchor |= VAnchor.ParentTop; macrosContainerContainer.AddChild(macroControlsContainer); TabPage macrosTabPage = new TabPage(macrosContainerContainer, "Macros".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(macrosTabPage, "Macros Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } if (ActiveSliceSettings.Instance.GetValue <bool>("has_fan")) { // add fan tab GuiWidget fanContainerContainer = new GuiWidget(); fanContainerContainer.Padding = new BorderDouble(6); fanContainerContainer.AnchorAll(); fanControlsContainer = new FanControls(); fanControlsContainer.VAnchor = VAnchor.ParentTop; fanContainerContainer.AddChild(fanControlsContainer); TabPage fanTabPage = new TabPage(fanContainerContainer, "Fan Controls".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(fanTabPage, "Fan Controls Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } // add tunning tab { GuiWidget tuningContainerContainer = new GuiWidget(); tuningContainerContainer.Padding = new BorderDouble(6); tuningContainerContainer.AnchorAll(); tuningAdjustmentControlsContainer = new AdjustmentControls(); tuningAdjustmentControlsContainer.VAnchor = VAnchor.ParentTop; tuningContainerContainer.AddChild(tuningAdjustmentControlsContainer); TabPage tuningTabPage = new TabPage(tuningContainerContainer, "Tuning Adjust".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(tuningTabPage, "Tuning Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } // add terminal tab { GuiWidget terminalContainerContainer = new GuiWidget(); terminalContainerContainer.Padding = new BorderDouble(6); terminalContainerContainer.AnchorAll(); terminalControlsContainer = new TerminalControls(); terminalControlsContainer.VAnchor |= VAnchor.ParentBottomTop; terminalContainerContainer.AddChild(terminalControlsContainer); TabPage terminalTabPage = new TabPage(terminalContainerContainer, "Terminal".Localize().ToUpper()); this.AddTab(new SimpleTextTabWidget(terminalTabPage, "Terminal Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); } PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); SetVisibleControls(); }
public EePromMarlinWindow() : base(650 * GuiWidget.DeviceScale, 480 * GuiWidget.DeviceScale) { AlwaysOnTopOfMain = true; Title = "Marlin Firmware EEPROM Settings".Localize(); currentEePromSettings = new EePromMarlinSettings(); currentEePromSettings.eventAdded += SetUiToPrinterSettings; GuiWidget mainContainer = new GuiWidget(); mainContainer.AnchorAll(); mainContainer.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; mainContainer.Padding = new BorderDouble(3, 0); // space filling color GuiWidget spaceFiller = new GuiWidget(0, 500); spaceFiller.VAnchor = VAnchor.ParentBottom; spaceFiller.HAnchor = HAnchor.ParentLeftRight; spaceFiller.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; spaceFiller.Padding = new BorderDouble(top: 3); mainContainer.AddChild(spaceFiller); double topBarHeight = 0; // the top button bar { FlowLayoutWidget topButtonBar = new FlowLayoutWidget(); topButtonBar.HAnchor = HAnchor.ParentLeftRight; topButtonBar.VAnchor = VAnchor.FitToChildren | VAnchor.ParentTop; topButtonBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; topButtonBar.Margin = new BorderDouble(0, 3); Button buttonSetToFactorySettings = textImageButtonFactory.Generate("Reset to Factory Defaults".Localize()); topButtonBar.AddChild(buttonSetToFactorySettings); buttonSetToFactorySettings.Click += (sender, e) => { currentEePromSettings.SetPrinterToFactorySettings(); currentEePromSettings.Update(); }; mainContainer.AddChild(topButtonBar); topBarHeight = topButtonBar.Height; } // the center content FlowLayoutWidget conterContent = new FlowLayoutWidget(FlowDirection.TopToBottom); conterContent.VAnchor = VAnchor.FitToChildren | VAnchor.ParentTop; conterContent.HAnchor = HAnchor.ParentLeftRight; conterContent.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; conterContent.Padding = new BorderDouble(top: 3); conterContent.Margin = new BorderDouble(top: topBarHeight); conterContent.AddChild(Create4FieldSet("Steps per mm:".Localize(), "X:", ref stepsPerMmX, "Y:", ref stepsPerMmY, "Z:", ref stepsPerMmZ, "E:", ref stepsPerMmE)); conterContent.AddChild(Create4FieldSet("Maximum feedrates [mm/s]:".Localize(), "X:", ref maxFeedrateMmPerSX, "Y:", ref maxFeedrateMmPerSY, "Z:", ref maxFeedrateMmPerSZ, "E:", ref maxFeedrateMmPerSE)); conterContent.AddChild(Create4FieldSet("Maximum Acceleration [mm/s²]:".Localize(), "X:", ref maxAccelerationMmPerSSqrdX, "Y:", ref maxAccelerationMmPerSSqrdY, "Z:", ref maxAccelerationMmPerSSqrdZ, "E:", ref maxAccelerationMmPerSSqrdE)); conterContent.AddChild(CreateField("Acceleration:".Localize(), ref acceleration)); conterContent.AddChild(CreateField("Retract Acceleration:".Localize(), ref retractAcceleration)); conterContent.AddChild(Create3FieldSet("PID settings:".Localize(), "P:", ref pidP, "I:", ref pidI, "D:", ref pidD)); conterContent.AddChild(Create3FieldSet("Homing Offset:".Localize(), "X:", ref homingOffsetX, "Y:", ref homingOffsetY, "Z:", ref homingOffsetZ)); conterContent.AddChild(CreateField("Min feedrate [mm/s]:".Localize(), ref minFeedrate)); conterContent.AddChild(CreateField("Min travel feedrate [mm/s]:".Localize(), ref minTravelFeedrate)); conterContent.AddChild(CreateField("Minimum segment time [ms]:".Localize(), ref minSegmentTime)); conterContent.AddChild(CreateField("Maximum X-Y jerk [mm/s]:".Localize(), ref maxXYJerk)); conterContent.AddChild(CreateField("Maximum Z jerk [mm/s]:".Localize(), ref maxZJerk)); GuiWidget topBottomSpacer = new GuiWidget(1, 1); topBottomSpacer.VAnchor = VAnchor.ParentBottomTop; conterContent.AddChild(topBottomSpacer); mainContainer.AddChild(conterContent); // the bottom button bar { FlowLayoutWidget bottomButtonBar = new FlowLayoutWidget(); bottomButtonBar.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; bottomButtonBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; bottomButtonBar.Margin = new BorderDouble(0, 3); Button buttonSave = textImageButtonFactory.Generate("Save to EEProm".Localize()); bottomButtonBar.AddChild(buttonSave); buttonSave.Click += (sender, e) => { UiThread.RunOnIdle(() => { SaveSettingsToActive(); currentEePromSettings.SaveToEeProm(); Close(); }); }; CreateSpacer(bottomButtonBar); // put in the import button #if true { Button buttonImport = textImageButtonFactory.Generate("Import".Localize() + "..."); buttonImport.Margin = new BorderDouble(0, 3); buttonImport.Click += (sender, e) => { UiThread.RunOnIdle(() => { FileDialog.OpenFileDialog( new OpenFileDialogParams("EEPROM Settings|*.ini") { ActionButtonLabel = "Import EEPROM Settings".Localize(), Title = "Import EEPROM".Localize(), }, (openParams) => { if (!string.IsNullOrEmpty(openParams.FileName)) { currentEePromSettings.Import(openParams.FileName); SetUiToPrinterSettings(null, null); } }); }); }; bottomButtonBar.AddChild(buttonImport); } // put in the export button { Button buttonExport = textImageButtonFactory.Generate("Export".Localize() + "..."); buttonExport.Margin = new BorderDouble(0, 3); buttonExport.Click += (sender, e) => { UiThread.RunOnIdle(() => { string defaultFileNameNoPath = "eeprom_settings.ini"; FileDialog.SaveFileDialog( new SaveFileDialogParams("EEPROM Settings|*.ini") { ActionButtonLabel = "Export EEPROM Settings".Localize(), Title = "Export EEPROM".Localize(), FileName = defaultFileNameNoPath }, (saveParams) => { if (!string.IsNullOrEmpty(saveParams.FileName) && saveParams.FileName != defaultFileNameNoPath) { currentEePromSettings.Export(saveParams.FileName); } }); }); }; bottomButtonBar.AddChild(buttonExport); } #endif Button buttonAbort = textImageButtonFactory.Generate("Close".Localize()); bottomButtonBar.AddChild(buttonAbort); buttonAbort.Click += buttonAbort_Click; mainContainer.AddChild(bottomButtonBar); } PrinterConnectionAndCommunication.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(currentEePromSettings.Add, ref unregisterEvents); AddChild(mainContainer); ShowAsSystemWindow(); // and ask the printer to send the settings currentEePromSettings.Update(); foreach (GuiWidget widget in leftStuffToSize) { widget.Width = maxWidthOfLeftStuff; } }
public CompactTabView(QueueDataView queueDataView) : base(Orientation.Vertical) { this.queueDataView = queueDataView; this.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; this.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0); this.TabBar.Margin = new BorderDouble(0, 0); this.TabBar.Padding = new BorderDouble(0, 4); this.Margin = new BorderDouble(top: 0); this.TabTextSize = 15; ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(LoadSettingsOnPrinterChanged, ref unregisterEvents); PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents); ApplicationController.Instance.ReloadAdvancedControlsPanelTrigger.RegisterEvent(ReloadAdvancedControlsPanelTrigger, ref unregisterEvents); PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents); QueueTabPage = new TabPage(new QueueDataWidget(queueDataView), LocalizedString.Get("Queue").ToUpper()); this.AddTab(new SimpleTextTabWidget(QueueTabPage, "Queue Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); LibraryTabPage = new TabPage(new PrintLibraryWidget(), LocalizedString.Get("Library").ToUpper()); this.AddTab(new SimpleTextTabWidget(LibraryTabPage, "Library Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); HistoryTabPage = new TabPage(new PrintHistoryWidget(), LocalizedString.Get("History").ToUpper()); this.AddTab(new SimpleTextTabWidget(HistoryTabPage, "History Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); GuiWidget manualPrinterControls = new ManualPrinterControls(); part3DViewContainer = new GuiWidget(); part3DViewContainer.AnchorAll(); partGcodeViewContainer = new GuiWidget(); partGcodeViewContainer.AnchorAll(); GeneratePartViews(); string partPreviewLabel = LocalizedString.Get("Part Preview").ToUpper(); this.AddTab(new SimpleTextTabWidget(new TabPage(part3DViewContainer, partPreviewLabel), "Part Preview Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); string layerPreviewLabel = LocalizedString.Get("Layer Preview").ToUpper(); this.AddTab(new SimpleTextTabWidget(new TabPage(partGcodeViewContainer, layerPreviewLabel), "Layer Preview Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); //Add the tab contents for 'Advanced Controls' string printerControlsLabel = LocalizedString.Get("Controls").ToUpper(); manualControlsPage = new TabPage(manualPrinterControls, printerControlsLabel); this.AddTab(new SimpleTextTabWidget(manualControlsPage, "Controls Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); string sliceSettingsLabel = LocalizedString.Get("Slice Settings").ToUpper(); sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState); sliceTabPage = new TabPage(sliceSettingsWidget, sliceSettingsLabel); this.AddTab(new SimpleTextTabWidget(sliceTabPage, "Slice Settings Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); string configurationLabel = LocalizedString.Get("Configuration").ToUpper(); PrinterConfigurationScrollWidget printerConfigurationWidget = new PrinterConfigurationScrollWidget(); configurationPage = new TabPage(printerConfigurationWidget, configurationLabel); this.AddTab(new SimpleTextTabWidget(configurationPage, "Configuration Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); AboutTabPage = new TabPage(new AboutPage(), LocalizedString.Get("About").ToUpper()); aboutTabWidget = new SimpleTextTabWidget(AboutTabPage, "About Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()); this.AddTab(aboutTabWidget); NumQueueItemsChanged(this, null); SetUpdateNotification(this, null); QueueData.Instance.ItemAdded.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents); QueueData.Instance.ItemRemoved.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents); UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents); //WidescreenPanel.PreChangePanels.RegisterEvent(SaveCurrentTab, ref unregisterEvents); SelectedTabIndex = firstPanelCurrentTab; }
public WizardPage(string unlocalizedTextForCancelButton = "Cancel", string unlocalizedTextForTitle = "Setup Wizard") { whiteImageButtonFactory = new TextImageButtonFactory() { normalFillColor = RGBA_Bytes.White, disabledFillColor = RGBA_Bytes.White, fontSize = 16, borderWidth = 1, normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200), hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200), disabledTextColor = RGBA_Bytes.DarkGray, hoverTextColor = ActiveTheme.Instance.PrimaryTextColor, normalTextColor = RGBA_Bytes.Black, pressedTextColor = ActiveTheme.Instance.PrimaryTextColor, FixedWidth = 200 }; if (!UserSettings.Instance.IsTouchScreen) { textImageButtonFactory = new TextImageButtonFactory() { normalTextColor = ActiveTheme.Instance.PrimaryTextColor, hoverTextColor = ActiveTheme.Instance.PrimaryTextColor, disabledTextColor = ActiveTheme.Instance.PrimaryTextColor, pressedTextColor = ActiveTheme.Instance.PrimaryTextColor, borderWidth = 0 }; linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor; linkButtonFactory.fontSize = 10; this.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; this.Padding = new BorderDouble(0); //To be re-enabled once native borders are turned off } this.AnchorAll(); cancelButton = textImageButtonFactory.Generate(unlocalizedTextForCancelButton.Localize()); cancelButton.Name = unlocalizedTextForCancelButton; cancelButton.Click += (s, e) => { UiThread.RunOnIdle(() => WizardWindow?.Close()); }; // Create the main container mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom) { Padding = new BorderDouble(12, 12, 12, 0), BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor }; mainContainer.AnchorAll(); // Create the header row for the widget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight) { Margin = new BorderDouble(0, 3, 0, 0), Padding = new BorderDouble(0, 12), HAnchor = HAnchor.ParentLeftRight }; headerLabel = new TextWidget(unlocalizedTextForTitle.Localize(), pointSize: 24, textColor: ActiveTheme.Instance.SecondaryAccentColor) { AutoExpandBoundsToText = true }; headerRow.AddChild(headerLabel); // Create the main control container contentRow = new FlowLayoutWidget(FlowDirection.TopToBottom) { Padding = new BorderDouble(10), BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor, HAnchor = HAnchor.ParentLeftRight, VAnchor = VAnchor.ParentBottomTop }; // Create the footer (button) container footerRow = new FlowLayoutWidget(FlowDirection.LeftToRight) { HAnchor = HAnchor.ParentLeft | HAnchor.ParentRight, Margin = new BorderDouble(0, 6) }; mainContainer.AddChild(headerRow); mainContainer.AddChild(contentRow); mainContainer.AddChild(footerRow); if (!UserSettings.Instance.IsTouchScreen) { mainContainer.Padding = new BorderDouble(3, 5, 3, 5); headerRow.Padding = new BorderDouble(0, 3, 0, 3); headerLabel.PointSize = 14; headerLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; contentRow.Padding = new BorderDouble(5); footerRow.Margin = new BorderDouble(0, 3); } this.AddChild(mainContainer); }
public void AddElements() { Title = LocalizedString.Get("Design Add-ons"); FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); 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); { string elementHeaderLabelBeg = LocalizedString.Get("Select a Design Tool"); string elementHeaderLabelFull = string.Format("{0}:", elementHeaderLabelBeg); string elementHeaderLabel = elementHeaderLabelFull; TextWidget elementHeader = new TextWidget(string.Format(elementHeaderLabel), pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); } topToBottom.AddChild(headerRow); GuiWidget presetsFormContainer = new GuiWidget(); { presetsFormContainer.HAnchor = HAnchor.ParentLeftRight; presetsFormContainer.VAnchor = VAnchor.ParentBottomTop; presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } FlowLayoutWidget pluginRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); pluginRowContainer.AnchorAll(); presetsFormContainer.AddChild(pluginRowContainer); unlockButtonFactory.Margin = new BorderDouble(10, 0); if (ActiveTheme.Instance.IsDarkTheme) { unlockButtonFactory.normalFillColor = new RGBA_Bytes(0, 0, 0, 100); unlockButtonFactory.normalBorderColor = new RGBA_Bytes(0, 0, 0, 100); unlockButtonFactory.hoverFillColor = new RGBA_Bytes(0, 0, 0, 50); unlockButtonFactory.hoverBorderColor = new RGBA_Bytes(0, 0, 0, 50); } else { unlockButtonFactory.normalFillColor = new RGBA_Bytes(0, 0, 0, 50); unlockButtonFactory.normalBorderColor = new RGBA_Bytes(0, 0, 0, 50); unlockButtonFactory.hoverFillColor = new RGBA_Bytes(0, 0, 0, 100); unlockButtonFactory.hoverBorderColor = new RGBA_Bytes(0, 0, 0, 100); } foreach (CreatorInformation creatorInfo in RegisteredCreators.Instance.Creators) { FlowLayoutWidget pluginListingContainer = new FlowLayoutWidget(); pluginListingContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; pluginListingContainer.BackgroundColor = RGBA_Bytes.White; pluginListingContainer.Padding = new BorderDouble(0); pluginListingContainer.Margin = new BorderDouble(6, 0, 6, 6); ClickWidget pluginRow = new ClickWidget(); pluginRow.Margin = new BorderDouble(6, 0, 6, 0); pluginRow.Height = 38; pluginRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight; GuiWidget overlay = new GuiWidget(); overlay.AnchorAll(); overlay.Cursor = Cursors.Hand; FlowLayoutWidget macroRow = new FlowLayoutWidget(); macroRow.AnchorAll(); macroRow.BackgroundColor = RGBA_Bytes.White; if (creatorInfo.iconPath != "") { ImageBuffer imageBuffer = LoadImage(creatorInfo.iconPath); ImageWidget imageWidget = new ImageWidget(imageBuffer); imageWidget.VAnchor = Agg.UI.VAnchor.ParentCenter; macroRow.AddChild(imageWidget); } bool userHasPermission; if (!creatorInfo.paidAddOnFlag) { userHasPermission = true; } else { userHasPermission = creatorInfo.permissionFunction(); } string addOnDescription; addOnDescription = creatorInfo.description; TextWidget buttonLabel = new TextWidget(addOnDescription, pointSize: 14); buttonLabel.Margin = new BorderDouble(left: 10); buttonLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; macroRow.AddChild(buttonLabel); if (!userHasPermission) { TextWidget demoLabel = new TextWidget("(demo)", pointSize: 10); demoLabel.Margin = new BorderDouble(left: 4); demoLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; macroRow.AddChild(demoLabel); } FlowLayoutWidget hSpacer = new FlowLayoutWidget(); hSpacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.AddChild(hSpacer); CreatorInformation callCorrectFunctionHold = creatorInfo; pluginRow.Click += (sender, e) => { if (RegisteredCreators.Instance.Creators.Count > 0) { callCorrectFunctionHold.functionToLaunchCreator(null, null); } UiThread.RunOnIdle(CloseOnIdle); }; pluginRow.AddChild(macroRow); pluginRow.AddChild(overlay); pluginListingContainer.AddChild(pluginRow); if (!userHasPermission) { Button unlockButton = unlockButtonFactory.Generate("Unlock"); unlockButton.Margin = new BorderDouble(0); unlockButton.Cursor = Cursors.Hand; unlockButton.Click += (sender, e) => { callCorrectFunctionHold.unlockFunction(); }; pluginListingContainer.AddChild(unlockButton); } pluginRowContainer.AddChild(pluginListingContainer); if (callCorrectFunctionHold.unlockRegisterFunction != null) { callCorrectFunctionHold.unlockRegisterFunction(TriggerReload, ref unregisterEvents); } } topToBottom.AddChild(presetsFormContainer); BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; Button cancelPresetsButton = textImageButtonFactory.Generate(LocalizedString.Get("Cancel")); cancelPresetsButton.Click += (sender, e) => { UiThread.RunOnIdle(CloseOnIdle); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); GuiWidget hButtonSpacer = new GuiWidget(); hButtonSpacer.HAnchor = HAnchor.ParentLeftRight; buttonRow.AddChild(hButtonSpacer); buttonRow.AddChild(cancelPresetsButton); topToBottom.AddChild(buttonRow); AddChild(topToBottom); }
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); }
public CSGOpenGLApplication(string meshFileToLoad = "") : base(800, 600) { MinimumSize = new VectorMath.Vector2(200, 200); Title = "MatterHackers MeshViewr"; UseOpenGL = true; StencilBufferDepth = 8; BitDepth = ValidDepthVaules.Depth24; FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainer.AnchorAll(); viewArea = new GuiWidget(); viewArea.AnchorAll(); double bedXSize = 200; double bedYSize = 200; double scale = 1; meshViewerWidget = new MeshViewerWidget(bedXSize, bedYSize, scale); MeshViewWidget.AnchorAll(); viewArea.AddChild(MeshViewWidget); mainContainer.AddChild(viewArea); FlowLayoutWidget buttonPanel = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonPanel.HAnchor = HAnchor.ParentLeftRight; buttonPanel.Padding = new BorderDouble(3, 3); buttonPanel.BackgroundColor = RGBA_Bytes.DarkGray; if (meshFileToLoad != "") { MeshViewWidget.LoadMesh(meshFileToLoad); } else { openFileButton = new Button("Open 3D File", 0, 0); openFileButton.Click += new Button.ButtonEventHandler(openFileButton_ButtonClick); buttonPanel.AddChild(openFileButton); } bedCheckBox = new CheckBox("Bed"); bedCheckBox.Checked = true; buttonPanel.AddChild(bedCheckBox); wireframeCheckBox = new CheckBox("Wireframe"); buttonPanel.AddChild(wireframeCheckBox); GuiWidget leftRightSpacer = new GuiWidget(); leftRightSpacer.HAnchor = HAnchor.ParentLeftRight; buttonPanel.AddChild(leftRightSpacer); mainContainer.AddChild(buttonPanel); this.AddChild(mainContainer); this.AnchorAll(); bedCheckBox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(bedCheckBox_CheckedStateChanged); wireframeCheckBox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(wireframeCheckBox_CheckedStateChanged); }
public ThemePreviewButton(IThemeColors theme, bool isActive) { this.Padding = 8; this.BackgroundColor = theme.PrimaryBackgroundColor; this.Cursor = Cursors.Hand; secondaryBackground = new GuiWidget() { HAnchor = HAnchor.Absolute | HAnchor.Left, VAnchor = VAnchor.Stretch, Margin = new BorderDouble(0), Width = 20, BackgroundColor = theme.SecondaryBackgroundColor, }; this.AddChild(secondaryBackground); accentColor = new GuiWidget() { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Absolute | VAnchor.Top, Height = 6, Margin = new BorderDouble(left: 25), BackgroundColor = theme.PrimaryAccentColor, }; this.AddChild(accentColor); icon1 = new GuiWidget() { HAnchor = HAnchor.Absolute | HAnchor.Left, VAnchor = VAnchor.Absolute | VAnchor.Top, Height = 8, Width = 8, Margin = new BorderDouble(left: 6, top: 6), BackgroundColor = theme.PrimaryAccentColor, }; this.AddChild(icon1); icon2 = new GuiWidget() { HAnchor = HAnchor.Absolute | HAnchor.Left, VAnchor = VAnchor.Absolute | VAnchor.Top, Height = 8, Width = 8, Margin = new BorderDouble(left: 6, top: 20), BackgroundColor = theme.PrimaryAccentColor, }; this.AddChild(icon2); icon3 = new GuiWidget() { HAnchor = HAnchor.Absolute | HAnchor.Left, VAnchor = VAnchor.Absolute | VAnchor.Top, Height = 8, Width = 8, Margin = new BorderDouble(left: 6, top: 34), BackgroundColor = theme.PrimaryAccentColor, }; this.AddChild(icon3); tertiaryBackground = new GuiWidget() { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Absolute | VAnchor.Top, Height = 37, Margin = new BorderDouble(left: 25, top: 12), BackgroundColor = theme.TertiaryBackgroundColor, }; this.AddChild(tertiaryBackground); if (isActive) { this.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon("426.png", 16, 16, invertImage: true)) { HAnchor = HAnchor.Absolute, VAnchor = VAnchor.Absolute, OriginRelativeParent = new Vector2(45, 20) }); } var overlay = new GuiWidget(); overlay.AnchorAll(); overlay.Cursor = Cursors.Hand; overlay.Click += (s, e) => { ThemeColorSelectorWidget.SetTheme(this.themeName); }; this.AddChild(overlay); }
public TemperatureWidgetBase(string textValue) : base(52, 52) { whiteButtonFactory.FixedHeight = 18; whiteButtonFactory.fontSize = 7; whiteButtonFactory.normalFillColor = RGBA_Bytes.White; whiteButtonFactory.normalTextColor = RGBA_Bytes.DarkGray; FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom); container.AnchorAll(); this.BackgroundColor = new RGBA_Bytes(255, 255, 255, 200); this.Margin = new BorderDouble(0, 2); GuiWidget labelContainer = new GuiWidget(); labelContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; labelContainer.Height = 18; labelTextWidget = new TextWidget("", pointSize: 8); labelTextWidget.AutoExpandBoundsToText = true; labelTextWidget.HAnchor = HAnchor.ParentCenter; labelTextWidget.VAnchor = VAnchor.ParentCenter; labelTextWidget.TextColor = ActiveTheme.Instance.SecondaryAccentColor; labelTextWidget.Visible = false; labelContainer.AddChild(labelTextWidget); GuiWidget indicatorContainer = new GuiWidget(); indicatorContainer.AnchorAll(); indicatorTextWidget = new TextWidget(textValue, pointSize: 11); indicatorTextWidget.TextColor = ActiveTheme.Instance.PrimaryAccentColor; indicatorTextWidget.HAnchor = HAnchor.ParentCenter; indicatorTextWidget.VAnchor = VAnchor.ParentCenter; indicatorTextWidget.AutoExpandBoundsToText = true; indicatorContainer.AddChild(indicatorTextWidget); GuiWidget buttonContainer = new GuiWidget(); buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; buttonContainer.Height = 18; preheatButton = whiteButtonFactory.Generate("PREHEAT"); preheatButton.Cursor = Cursors.Hand; preheatButton.Visible = false; buttonContainer.AddChild(preheatButton); container.AddChild(labelContainer); container.AddChild(indicatorContainer); container.AddChild(buttonContainer); this.AddChild(container); ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents); this.MouseEnterBounds += onEnterBounds; this.MouseLeaveBounds += onLeaveBounds; this.preheatButton.Click += onPreheatButtonClick; }
private void DoLayout(string subjectText, string bodyText) { FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainer.AnchorAll(); GuiWidget labelContainer = new GuiWidget(); labelContainer.HAnchor = HAnchor.ParentLeftRight; labelContainer.Height = 30; TextWidget formLabel = new TextWidget(new LocalizedString("How can we help?").Translated, pointSize: 16); formLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; formLabel.VAnchor = VAnchor.ParentTop; formLabel.HAnchor = HAnchor.ParentLeft; formLabel.Margin = new BorderDouble(10, 10); labelContainer.AddChild(formLabel); mainContainer.AddChild(labelContainer); centerContainer = new GuiWidget(); centerContainer.AnchorAll(); centerContainer.Padding = new BorderDouble(10); messageContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); messageContainer.AnchorAll(); messageContainer.Visible = false; messageContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; messageContainer.Padding = new BorderDouble(10); submissionStatus = new TextWidget(new LocalizedString("Submitting your information...").Translated, pointSize: 13); submissionStatus.AutoExpandBoundsToText = true; submissionStatus.Margin = new BorderDouble(0, 5); submissionStatus.TextColor = RGBA_Bytes.White; submissionStatus.HAnchor = HAnchor.ParentLeft; messageContainer.AddChild(submissionStatus); formContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); formContainer.AnchorAll(); formContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; formContainer.Padding = new BorderDouble(10); formContainer.AddChild(LabelGenerator(new LocalizedString("Question*").Translated)); formContainer.AddChild(LabelGenerator(new LocalizedString("Briefly describe your question").Translated, 9, 14)); questionInput = new MHTextEditWidget(subjectText); questionInput.HAnchor = HAnchor.ParentLeftRight; formContainer.AddChild(questionInput); questionErrorMessage = ErrorMessageGenerator(); formContainer.AddChild(questionErrorMessage); formContainer.AddChild(LabelGenerator(new LocalizedString("Details*").Translated)); formContainer.AddChild(LabelGenerator(new LocalizedString("Fill in the details here").Translated, 9, 14)); detailInput = new MHTextEditWidget(bodyText, pixelHeight: 120, multiLine: true); detailInput.HAnchor = HAnchor.ParentLeftRight; formContainer.AddChild(detailInput); detailErrorMessage = ErrorMessageGenerator(); formContainer.AddChild(detailErrorMessage); formContainer.AddChild(LabelGenerator(new LocalizedString("Your Email Address*").Translated)); emailInput = new MHTextEditWidget(); emailInput.HAnchor = HAnchor.ParentLeftRight; formContainer.AddChild(emailInput); emailErrorMessage = ErrorMessageGenerator(); formContainer.AddChild(emailErrorMessage); formContainer.AddChild(LabelGenerator(new LocalizedString("Your Name*").Translated)); nameInput = new MHTextEditWidget(); nameInput.HAnchor = HAnchor.ParentLeftRight; formContainer.AddChild(nameInput); nameErrorMessage = ErrorMessageGenerator(); formContainer.AddChild(nameErrorMessage); centerContainer.AddChild(formContainer); mainContainer.AddChild(centerContainer); FlowLayoutWidget buttonBottomPanel = GetButtonButtonPanel(); buttonBottomPanel.AddChild(submitButton); buttonBottomPanel.AddChild(cancelButton); buttonBottomPanel.AddChild(doneButton); mainContainer.AddChild(buttonBottomPanel); this.AddChild(mainContainer); }
public TabPage(GuiWidget widgetToAddToPage, string tabTitle) : this(tabTitle) { widgetToAddToPage.AnchorAll(); AddChild(widgetToAddToPage); }
public MeshViewerApplication(string meshFileToLoad = "") : base(800, 600) { BackgroundColor = Color.White; MinimumSize = new VectorMath.Vector2(200, 200); Title = "MatterHackers MeshViewr"; UseOpenGL = true; FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainer.AnchorAll(); viewArea = new GuiWidget(); viewArea.AnchorAll(); Vector3 viewerVolume = new Vector3(200, 200, 200); meshViewerWidget = new MeshViewerWidget(viewerVolume, new Vector2(100, 100), BedShape.Rectangular, "No Part Loaded"); meshViewerWidget.AnchorAll(); viewArea.AddChild(meshViewerWidget); mainContainer.AddChild(viewArea); FlowLayoutWidget buttonPanel = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonPanel.HAnchor = HAnchor.Stretch; buttonPanel.Padding = new BorderDouble(3, 3); buttonPanel.BackgroundColor = Color.DarkGray; if (meshFileToLoad != "") { meshViewerWidget.LoadItemIntoScene(meshFileToLoad); } else { openFileButton = new Button("Open 3D File", 0, 0); openFileButton.Click += openFileButton_ButtonClick; buttonPanel.AddChild(openFileButton); } bedCheckBox = new CheckBox("Bed"); bedCheckBox.Checked = true; buttonPanel.AddChild(bedCheckBox); wireframeCheckBox = new CheckBox("Wireframe"); buttonPanel.AddChild(wireframeCheckBox); GuiWidget leftRightSpacer = new GuiWidget(); leftRightSpacer.HAnchor = HAnchor.Stretch; buttonPanel.AddChild(leftRightSpacer); mainContainer.AddChild(buttonPanel); this.AddChild(mainContainer); this.AnchorAll(); AddHandlers(); }
public static SystemWindow LoadRootWindow(int width, int height) { timer = Stopwatch.StartNew(); if (false) { // set the default font AggContext.DefaultFont = ApplicationController.GetTypeFace(NamedTypeFace.Nunito_Regular); AggContext.DefaultFontBold = ApplicationController.GetTypeFace(NamedTypeFace.Nunito_Bold); AggContext.DefaultFontItalic = ApplicationController.GetTypeFace(NamedTypeFace.Nunito_Italic); AggContext.DefaultFontBoldItalic = ApplicationController.GetTypeFace(NamedTypeFace.Nunito_Bold_Italic); } var systemWindow = new RootSystemWindow(width, height); var overlay = new GuiWidget() { BackgroundColor = AppContext.Theme.BackgroundColor, }; overlay.AnchorAll(); systemWindow.AddChild(overlay); var mutedAccentColor = AppContext.Theme.SplashAccentColor; var spinner = new LogoSpinner(overlay, rotateX: -0.05) { MeshColor = mutedAccentColor }; progressPanel = new FlowLayoutWidget(FlowDirection.TopToBottom) { Position = new Vector2(0, height * .25), HAnchor = HAnchor.Center | HAnchor.Fit, VAnchor = VAnchor.Fit, MinimumSize = new Vector2(400, 100), Margin = new BorderDouble(0, 0, 0, 200) }; overlay.AddChild(progressPanel); progressPanel.AddChild(statusText = new TextWidget("", textColor: AppContext.Theme.TextColor) { MinimumSize = new Vector2(200, 30), HAnchor = HAnchor.Center, AutoExpandBoundsToText = true }); progressPanel.AddChild(progressBar = new ProgressBar() { FillColor = mutedAccentColor, BorderColor = Color.Gray, // theme.BorderColor75, Height = 11, Width = 230, HAnchor = HAnchor.Center, VAnchor = VAnchor.Absolute }); AppContext.RootSystemWindow = systemWindow; // hook up a keyboard watcher to rout keys when not handled by children systemWindow.KeyPressed += SystemWindow_KeyPressed; systemWindow.KeyDown += (s, keyEvent) => { var view3D = systemWindow.Descendants <View3DWidget>().Where((v) => v.ActuallyVisibleOnScreen()).FirstOrDefault(); var printerTabPage = systemWindow.Descendants <PrinterTabPage>().Where((v) => v.ActuallyVisibleOnScreen()).FirstOrDefault(); var offsetDist = 50; var arrowKeyOperation = keyEvent.Shift ? TrackBallTransformType.Translation : TrackBallTransformType.Rotation; var gcode2D = systemWindow.Descendants <GCode2DWidget>().Where((v) => v.ActuallyVisibleOnScreen()).FirstOrDefault(); if (keyEvent.KeyCode == Keys.F1) { ApplicationController.Instance.ActivateHelpTab(); } if (EnableF5Collect && keyEvent.KeyCode == Keys.F5) { GC.Collect(); systemWindow.Invalidate(); } if (!keyEvent.Handled && gcode2D != null) { switch (keyEvent.KeyCode) { case Keys.Oemplus: case Keys.Add: if (keyEvent.Control) { // Zoom out gcode2D.Zoom(1.2); keyEvent.Handled = true; } break; case Keys.OemMinus: case Keys.Subtract: if (keyEvent.Control) { // Zoom in gcode2D.Zoom(.8); keyEvent.Handled = true; } break; } } if (!keyEvent.Handled && view3D != null) { switch (keyEvent.KeyCode) { case Keys.C: if (keyEvent.Control) { view3D.Scene.Copy(); keyEvent.Handled = true; } break; case Keys.P: if (keyEvent.Control) { view3D.PushToPrinterAndPrint(); } break; case Keys.X: if (keyEvent.Control) { view3D.Scene.Cut(); keyEvent.Handled = true; } break; case Keys.Y: if (keyEvent.Control) { view3D.Scene.UndoBuffer.Redo(); keyEvent.Handled = true; } break; case Keys.A: if (keyEvent.Control) { view3D.SelectAll(); keyEvent.Handled = true; } break; case Keys.S: if (keyEvent.Control) { view3D.Save(); keyEvent.Handled = true; } break; case Keys.V: if (keyEvent.Control) { view3D.sceneContext.Paste(); keyEvent.Handled = true; } break; case Keys.Oemplus: case Keys.Add: if (keyEvent.Control) { // Zoom out Offset3DView(view3D, new Vector2(0, offsetDist), TrackBallTransformType.Scale); keyEvent.Handled = true; } break; case Keys.OemMinus: case Keys.Subtract: if (keyEvent.Control) { // Zoom in Offset3DView(view3D, new Vector2(0, -offsetDist), TrackBallTransformType.Scale); keyEvent.Handled = true; } break; case Keys.Z: if (keyEvent.Control) { if (keyEvent.Shift) { view3D.Scene.Redo(); } else { // undo last operation view3D.Scene.Undo(); } keyEvent.Handled = true; } break; case Keys.Insert: if (keyEvent.Shift) { view3D.sceneContext.Paste(); keyEvent.Handled = true; } break; case Keys.Delete: case Keys.Back: view3D.Scene.DeleteSelection(); keyEvent.Handled = true; keyEvent.SuppressKeyPress = true; break; case Keys.Escape: if (view3D.CurrentSelectInfo.DownOnPart) { view3D.CurrentSelectInfo.DownOnPart = false; view3D.Scene.SelectedItem.Matrix = view3D.TransformOnMouseDown; keyEvent.Handled = true; keyEvent.SuppressKeyPress = true; } foreach (var interactionVolume in view3D.InteractionLayer.InteractionVolumes) { interactionVolume.CancelOperation(); } break; case Keys.Left: if (keyEvent.Control && printerTabPage != null && !printerTabPage.sceneContext.ViewState.ModelView) { // Decrement slider printerTabPage.LayerFeaturesIndex -= 1; } else { if (view3D.sceneContext.Scene.SelectedItem is IObject3D object3D) { NudgeItem(view3D, object3D, ArrowDirection.Left, keyEvent); } else { // move or rotate view left Offset3DView(view3D, new Vector2(-offsetDist, 0), arrowKeyOperation); } } keyEvent.Handled = true; keyEvent.SuppressKeyPress = true; break; case Keys.Right: if (keyEvent.Control && printerTabPage != null && !printerTabPage.sceneContext.ViewState.ModelView) { // Increment slider printerTabPage.LayerFeaturesIndex += 1; } else { if (view3D.sceneContext.Scene.SelectedItem is IObject3D object3D) { NudgeItem(view3D, object3D, ArrowDirection.Right, keyEvent); } else { // move or rotate view right Offset3DView(view3D, new Vector2(offsetDist, 0), arrowKeyOperation); } } keyEvent.Handled = true; keyEvent.SuppressKeyPress = true; break; case Keys.Up: if (view3D.Printer != null && printerTabPage != null && view3D.Printer.ViewState.ViewMode != PartViewMode.Model) { printerTabPage.LayerScrollbar.Value += 1; } else { if (view3D.sceneContext.Scene.SelectedItem is IObject3D object3D) { NudgeItem(view3D, object3D, ArrowDirection.Up, keyEvent); } else { Offset3DView(view3D, new Vector2(0, offsetDist), arrowKeyOperation); } } keyEvent.Handled = true; keyEvent.SuppressKeyPress = true; break; case Keys.Down: if (view3D.Printer != null && printerTabPage != null && view3D.Printer.ViewState.ViewMode != PartViewMode.Model) { printerTabPage.LayerScrollbar.Value -= 1; } else { if (view3D.sceneContext.Scene.SelectedItem is IObject3D object3D) { NudgeItem(view3D, object3D, ArrowDirection.Down, keyEvent); } else { Offset3DView(view3D, new Vector2(0, -offsetDist), arrowKeyOperation); } } keyEvent.Handled = true; keyEvent.SuppressKeyPress = true; break; } } }; // Hook SystemWindow load and spin up MatterControl once we've hit first draw systemWindow.Load += (s, e) => { // Show the End User License Agreement if it has not been shown (on windows it is shown in the installer) if (AggContext.OperatingSystem != OSType.Windows && UserSettings.Instance.get(UserSettingsKey.SoftwareLicenseAccepted) != "true") { var eula = new LicenseAgreementPage(LoadMC) { Margin = new BorderDouble(5) }; systemWindow.AddChild(eula); } else { LoadMC(); } }; void LoadMC() { ReportStartupProgress(0.02, "First draw->RunOnIdle"); // UiThread.RunOnIdle(() => Task.Run(async() => { try { ReportStartupProgress(0.15, "MatterControlApplication.Initialize"); ApplicationController.LoadTranslationMap(); var mainView = await Initialize(systemWindow, (progress0To1, status) => { ReportStartupProgress(0.2 + progress0To1 * 0.7, status); }); ReportStartupProgress(0.9, "AddChild->MainView"); systemWindow.AddChild(mainView, 0); ReportStartupProgress(1, ""); systemWindow.BackgroundColor = Color.Transparent; overlay.Close(); } catch (Exception ex) { UiThread.RunOnIdle(() => { statusText.Visible = false; var errorTextColor = Color.White; progressPanel.Margin = 0; progressPanel.VAnchor = VAnchor.Center | VAnchor.Fit; progressPanel.BackgroundColor = Color.DarkGray; progressPanel.Padding = 20; progressPanel.Border = 1; progressPanel.BorderColor = Color.Red; var theme = new ThemeConfig(); progressPanel.AddChild( new TextWidget("Startup Failure".Localize() + ":", pointSize: theme.DefaultFontSize, textColor: errorTextColor)); progressPanel.AddChild( new TextWidget(ex.Message, pointSize: theme.FontSize9, textColor: errorTextColor)); var closeButton = new TextButton("Close", theme) { BackgroundColor = theme.SlightShade, HAnchor = HAnchor.Right, VAnchor = VAnchor.Absolute }; closeButton.Click += (s1, e1) => { systemWindow.Close(); }; spinner.SpinLogo = false; progressBar.Visible = false; progressPanel.AddChild(closeButton); }); } AppContext.IsLoading = false; }); } ReportStartupProgress(0, "ShowAsSystemWindow"); return(systemWindow); }
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 void DoLayout(string subjectText, string bodyText) { FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainer.AnchorAll(); GuiWidget labelContainer = new GuiWidget(); labelContainer.HAnchor = HAnchor.ParentLeftRight; labelContainer.Height = 30; TextWidget formLabel = new TextWidget("How can we improve?".Localize(), pointSize: 16); formLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; formLabel.VAnchor = VAnchor.ParentTop; formLabel.HAnchor = HAnchor.ParentLeft; formLabel.Margin = new BorderDouble(6, 3, 6, 6); labelContainer.AddChild(formLabel); mainContainer.AddChild(labelContainer); centerContainer = new GuiWidget(); centerContainer.AnchorAll(); centerContainer.Padding = new BorderDouble(3, 0, 3, 3); messageContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); messageContainer.AnchorAll(); messageContainer.Visible = false; messageContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; messageContainer.Padding = new BorderDouble(10); submissionStatus = new TextWidget("Submitting your information...".Localize(), pointSize: 13); submissionStatus.AutoExpandBoundsToText = true; submissionStatus.Margin = new BorderDouble(0, 5); submissionStatus.TextColor = ActiveTheme.Instance.PrimaryTextColor; submissionStatus.HAnchor = HAnchor.ParentLeft; messageContainer.AddChild(submissionStatus); formContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); formContainer.AnchorAll(); formContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; formContainer.Padding = new BorderDouble(10); formContainer.AddChild(LabelGenerator("Subject*".Localize())); questionInput = new MHTextEditWidget(subjectText); questionInput.HAnchor = HAnchor.ParentLeftRight; formContainer.AddChild(questionInput); questionErrorMessage = ErrorMessageGenerator(); formContainer.AddChild(questionErrorMessage); formContainer.AddChild(LabelGenerator("Message*".Localize())); detailInput = new MHTextEditWidget(bodyText, pixelHeight: 120, multiLine: true); detailInput.HAnchor = HAnchor.ParentLeftRight; formContainer.AddChild(detailInput); detailErrorMessage = ErrorMessageGenerator(); formContainer.AddChild(detailErrorMessage); formContainer.AddChild(LabelGenerator("Email Address*".Localize())); emailInput = new MHTextEditWidget(); emailInput.HAnchor = HAnchor.ParentLeftRight; formContainer.AddChild(emailInput); emailErrorMessage = ErrorMessageGenerator(); formContainer.AddChild(emailErrorMessage); formContainer.AddChild(LabelGenerator("Name*".Localize())); nameInput = new MHTextEditWidget(); nameInput.HAnchor = HAnchor.ParentLeftRight; formContainer.AddChild(nameInput); nameErrorMessage = ErrorMessageGenerator(); formContainer.AddChild(nameErrorMessage); centerContainer.AddChild(formContainer); mainContainer.AddChild(centerContainer); FlowLayoutWidget buttonBottomPanel = GetButtonButtonPanel(); buttonBottomPanel.AddChild(submitButton); buttonBottomPanel.AddChild(cancelButton); buttonBottomPanel.AddChild(doneButton); mainContainer.AddChild(buttonBottomPanel); this.AddChild(mainContainer); }