public SetupStepInstallDriver(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
            : base(windowController, containerWindowToClose, setupPrinterStatus)
        {
            this.printerDriverFilePath = this.PrinterSetupStatus.DriverFilePath;

			headerLabel.Text = string.Format(new LocalizedString("Install Communication Driver").Translated);
            printerDriverContainer = createPrinterDriverContainer();
            contentRow.AddChild(printerDriverContainer);
            {
                //Construct buttons
				installButton = textImageButtonFactory.Generate(new LocalizedString("Install Driver").Translated);
                installButton.Click += new ButtonBase.ButtonEventHandler(installButton_Click);

				skipButton = textImageButtonFactory.Generate(new LocalizedString("Skip").Translated);
                skipButton.Click += new ButtonBase.ButtonEventHandler(skipButton_Click);

                GuiWidget hSpacer = new GuiWidget();
                hSpacer.HAnchor = HAnchor.ParentLeftRight;

                //Add buttons to buttonContainer
                footerRow.AddChild(installButton);
                footerRow.AddChild(skipButton);
                footerRow.AddChild(hSpacer);

                footerRow.AddChild(cancelButton);
            }
        }
		public ManualPrinterControls()
		{
			SetDisplayAttributes();

			FlowLayoutWidget controlsTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
			controlsTopToBottomLayout.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
			controlsTopToBottomLayout.VAnchor = Agg.UI.VAnchor.FitToChildren;
			controlsTopToBottomLayout.Name = "ManualPrinterControls.ControlsContainer";
			controlsTopToBottomLayout.Margin = new BorderDouble(0);

			AddTemperatureControls(controlsTopToBottomLayout);
			AddMovementControls(controlsTopToBottomLayout);

			FlowLayoutWidget linearPanel = new FlowLayoutWidget();
			linearPanel.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			controlsTopToBottomLayout.AddChild(linearPanel);

			AddFanControls(linearPanel);
			AddAtxPowerControls(linearPanel);

			AddMacroControls(controlsTopToBottomLayout);
			AddAdjustmentControls(controlsTopToBottomLayout);

			AddChild(controlsTopToBottomLayout);
			AddHandlers();
			SetVisibleControls();

			if (!pluginsQueuedToAdd)
			{
				UiThread.RunOnIdle(AddPlugins);
				pluginsQueuedToAdd = true;
			}
		}
Example #3
0
		internal OpenMenuContents(ObservableCollection<MenuItem> MenuItems, GuiWidget widgetRelativeTo, Vector2 openOffset, Direction direction, RGBA_Bytes backgroundColor, RGBA_Bytes borderColor, int borderWidth, double maxHeight, bool alignToRightEdge)
		{
			this.MenuItems = new List<MenuItem>();
			this.MenuItems.AddRange(MenuItems);
			this.alignToRightEdge = alignToRightEdge;
			this.openOffset = openOffset;
			this.borderWidth = borderWidth;
			this.borderColor = borderColor;
			this.BackgroundColor = backgroundColor;

			this.direction = direction;
			this.widgetRelativeTo = widgetRelativeTo;
			scrollingWindow = new ScrollableWidget(true);
			{
				FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
				foreach (MenuItem menu in MenuItems)
				{
					menu.ClearRemovedFlag();
					topToBottom.AddChild(menu);
					menu.DoClickFunction = AllowClickingItems;
				}

				topToBottom.HAnchor = UI.HAnchor.ParentLeft | UI.HAnchor.FitToChildren;
				topToBottom.VAnchor = UI.VAnchor.ParentBottom;
				Width = topToBottom.Width;
				Height = topToBottom.Height;

				scrollingWindow.AddChild(topToBottom);
			}

			scrollingWindow.HAnchor = HAnchor.ParentLeftRight;
			scrollingWindow.VAnchor = VAnchor.ParentBottomTop;
			if (maxHeight > 0 && Height > maxHeight)
			{
				MakeMenuHaveScroll(maxHeight);
			}
			AddChild(scrollingWindow);

			LostFocus += new EventHandler(DropListItems_LostFocus);

			GuiWidget topParent = widgetRelativeTo.Parent;
			while (topParent.Parent != null)
			{
				// Regretably we don't know who it is that is the window that will actually think it is moving relative to its parent
				// but we need to know anytime our widgetRelativeTo has been moved by any change, so we hook them all.

				if (!widgetRefList.Contains(topParent))
				{
					widgetRefList.Add(topParent);
					topParent.PositionChanged += new EventHandler(widgetRelativeTo_PositionChanged);
					topParent.BoundsChanged += new EventHandler(widgetRelativeTo_PositionChanged);
				}

				topParent = topParent.Parent;
			}
			topParent.AddChild(this);

			widgetRelativeTo_PositionChanged(widgetRelativeTo, null);
			widgetRelativeTo.Closed += widgetRelativeTo_Closed;
		}
		public PrinterConfigurationWidget()
		{
			SetDisplayAttributes();

			HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			VAnchor = Agg.UI.VAnchor.FitToChildren;

			FlowLayoutWidget mainLayoutContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			mainLayoutContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			mainLayoutContainer.VAnchor = Agg.UI.VAnchor.FitToChildren;
			mainLayoutContainer.Padding = new BorderDouble(top: 10);

			if (!ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_hardware_leveling))
			{
				mainLayoutContainer.AddChild(new CalibrationSettingsWidget());
			}

			mainLayoutContainer.AddChild(new HardwareSettingsWidget());

			CloudSettingsWidget cloudGroupbox = new CloudSettingsWidget();
			mainLayoutContainer.AddChild(cloudGroupbox);

			ApplicationSettingsWidget applicationGroupbox = new ApplicationSettingsWidget();
			mainLayoutContainer.AddChild(applicationGroupbox);

			AddChild(mainLayoutContainer);

			AddHandlers();
			//SetVisibleControls();
		}
		protected override void AddChildElements()
		{
			AltGroupBox fanControlsGroupBox = new AltGroupBox(new TextWidget("Fan".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor));

			fanControlsGroupBox.Margin = new BorderDouble(0);
			fanControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
			fanControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
			fanControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren;

			this.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			this.AddChild(fanControlsGroupBox);

			FlowLayoutWidget leftToRight = new FlowLayoutWidget();

			FlowLayoutWidget fanControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
			fanControlsLayout.Padding = new BorderDouble(3, 5, 3, 0);
			{
				fanControlsLayout.AddChild(CreateFanControls());
			}

			leftToRight.AddChild(fanControlsLayout);
			SetDisplayAttributes();

			fanSpeedDisplay = new EditableNumberDisplay(textImageButtonFactory, "{0}%".FormatWith(PrinterConnectionAndCommunication.Instance.FanSpeed0To255.ToString()), "100%");
			fanSpeedDisplay.EditComplete += (sender, e) =>
			{
				PrinterConnectionAndCommunication.Instance.FanSpeed0To255 = (int)(fanSpeedDisplay.GetValue() * 255.5 / 100);
			};
			leftToRight.AddChild(fanSpeedDisplay);

			fanControlsGroupBox.AddChild(leftToRight);
		}
        public SetupStepMakeModelName(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinter = null)
            : base(windowController, containerWindowToClose, setupPrinter)
        {
            //Construct inputs
            printerNameContainer = createPrinterNameContainer();
            printerMakeContainer = createPrinterMakeContainer();
            printerModelContainer = createPrinterModelContainer();

            //Add inputs to main container
            contentRow.AddChild(printerNameContainer);
            contentRow.AddChild(printerMakeContainer);
            contentRow.AddChild(printerModelContainer);

            //Construct buttons
			nextButton = textImageButtonFactory.Generate(new LocalizedString("Save & Continue").Translated);
            nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click);

            GuiWidget hSpacer = new GuiWidget();
            hSpacer.HAnchor = HAnchor.ParentLeftRight;

            //Add buttons to buttonContainer
            footerRow.AddChild(nextButton);
            footerRow.AddChild(hSpacer);
            footerRow.AddChild(cancelButton);

            SetElementState();
        }
		public ThemeColorSelectorWidget(GuiWidget colorToChangeTo)
		{
			this.Padding = new BorderDouble(2, 0);
			this.colorToChangeTo = colorToChangeTo;
			int themeCount = ActiveTheme.AvailableThemes.Count;

			var allThemes = ActiveTheme.AvailableThemes;

			int index = 0;
			for (int x = 0; x < themeCount / 2; x++)
			{
				var columnContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom)
				{
					Width = containerHeight
				};
				columnContainer.AddChild(CreateThemeButton(allThemes[index]));

				int secondRowIndex = index + themeCount / 2;
				columnContainer.AddChild(CreateThemeButton(allThemes[secondRowIndex]));

				this.AddChild(columnContainer);

				index++;
			}
			this.BackgroundColor = RGBA_Bytes.White;
			this.Width = containerHeight * (themeCount / 2);
		}
		private FlowLayoutWidget GetCloudSyncDashboardControls()
		{
			FlowLayoutWidget cloudSyncContainer = new FlowLayoutWidget();
			cloudSyncContainer.HAnchor |= HAnchor.ParentLeftRight;
			cloudSyncContainer.VAnchor |= Agg.UI.VAnchor.ParentCenter;
			cloudSyncContainer.Margin = new BorderDouble(0, 0, 0, 0);
			cloudSyncContainer.Padding = new BorderDouble(0);

			Agg.Image.ImageBuffer cloudMonitorImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "cloud-24x24.png"));
			if (!ActiveTheme.Instance.IsDarkTheme)
			{
				InvertLightness.DoInvertLightness(cloudMonitorImage);
			}

            ImageWidget cloudSyncIcon = new ImageWidget(cloudMonitorImage);
            cloudSyncIcon.Margin = new BorderDouble(right: 6, bottom: 6);

            TextWidget cloudSyncLabel = new TextWidget(LocalizedString.Get("Cloud Sync"));
            cloudSyncLabel.AutoExpandBoundsToText = true;
            cloudSyncLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            cloudSyncLabel.VAnchor = VAnchor.ParentCenter;

            linkButtonFactory.fontSize = 10;
            Button cloudSyncGoLink = linkButtonFactory.Generate("GO TO DASHBOARD");
            cloudSyncGoLink.ToolTipText = "Open cloud sync dashboard in web browser";
            cloudSyncGoLink.Click += new EventHandler(cloudSyncGoButton_Click);

            cloudSyncContainer.AddChild(cloudSyncIcon);
            cloudSyncContainer.AddChild(cloudSyncLabel);
            cloudSyncContainer.AddChild(new HorizontalSpacer());
            cloudSyncContainer.AddChild(cloudSyncGoLink);

			return cloudSyncContainer;
		}
Example #9
0
        private SDCardManager()
            : base(400, 300)
        {
            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            this.AnchorAll();

            Title = "MatterControl - SD Card Manager";
            this.ShowAsSystemWindow();
            MinimumSize = new Vector2(Width, Height);

            FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
            FlowLayoutWidget topButtons = new FlowLayoutWidget();

            topButtons.AddChild(textImageButtonFactory.Generate("Upload"));
            topButtons.AddChild(textImageButtonFactory.Generate("Delete"));
            topButtons.AddChild(textImageButtonFactory.Generate("New Folder"));
            topButtons.AddChild(textImageButtonFactory.Generate("Print"));
            topButtons.AddChild(textImageButtonFactory.Generate("Stop"));
            topButtons.AddChild(textImageButtonFactory.Generate("Mount"));
            topButtons.AddChild(textImageButtonFactory.Generate("Unmount"));

            topToBottom.AddChild(topButtons);

            this.AddChild(topToBottom);
        }
		public FlowLayoutWidget createPrinterConnectionMessageContainer()
		{
			FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
			container.Margin = new BorderDouble(5);
			BorderDouble elementMargin = new BorderDouble(top: 5);

			TextWidget continueMessage = new TextWidget("Would you like to connect to this printer now?", 0, 0, 12);
			continueMessage.AutoExpandBoundsToText = true;
			continueMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			continueMessage.HAnchor = HAnchor.ParentLeftRight;
			continueMessage.Margin = elementMargin;

			TextWidget continueMessageTwo = new TextWidget("You can always configure this later.", 0, 0, 10);
			continueMessageTwo.AutoExpandBoundsToText = true;
			continueMessageTwo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			continueMessageTwo.HAnchor = HAnchor.ParentLeftRight;
			continueMessageTwo.Margin = elementMargin;

			printerErrorMessage = new TextWidget("", 0, 0, 10);
			printerErrorMessage.AutoExpandBoundsToText = true;
			printerErrorMessage.TextColor = RGBA_Bytes.Red;
			printerErrorMessage.HAnchor = HAnchor.ParentLeftRight;
			printerErrorMessage.Margin = elementMargin;

			container.AddChild(continueMessage);
			container.AddChild(continueMessageTwo);
			container.AddChild(printerErrorMessage);

			container.HAnchor = HAnchor.ParentLeftRight;
			return container;
		}
		public PrinterConfigurationWidget()
		{
			SetDisplayAttributes();

			HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			VAnchor = Agg.UI.VAnchor.FitToChildren;

			FlowLayoutWidget mainLayoutContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			mainLayoutContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			mainLayoutContainer.VAnchor = Agg.UI.VAnchor.FitToChildren;
			mainLayoutContainer.Padding = new BorderDouble(top: 10);

			HardwareSettingsWidget hardwareGroupbox = new HardwareSettingsWidget();
			mainLayoutContainer.AddChild(hardwareGroupbox);

			CloudSettingsWidget cloudGroupbox = new CloudSettingsWidget();
			mainLayoutContainer.AddChild(cloudGroupbox);

			ApplicationSettingsWidget applicationGroupbox = new ApplicationSettingsWidget();
			mainLayoutContainer.AddChild(applicationGroupbox);

			AddChild(mainLayoutContainer);

			AddHandlers();
			//SetVisibleControls();
		}
		public SetupStepInstallDriver(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
			: base(windowController, containerWindowToClose, setupPrinterStatus)
		{
			this.driversToInstall = this.currentPrinterSetupStatus.DriversToInstall;

			headerLabel.Text = string.Format(LocalizedString.Get("Install Communication Driver"));
			printerDriverContainer = createPrinterDriverContainer();
			contentRow.AddChild(printerDriverContainer);
			{
				//Construct buttons
				installButton = textImageButtonFactory.Generate(LocalizedString.Get("Install Driver"));
				installButton.Click += (sender, e) =>
				{
					UiThread.RunOnIdle(installButton_Click);
				};

				skipButton = textImageButtonFactory.Generate(LocalizedString.Get("Skip"));
				skipButton.Click += new EventHandler(skipButton_Click);

				GuiWidget hSpacer = new GuiWidget();
				hSpacer.HAnchor = HAnchor.ParentLeftRight;

				//Add buttons to buttonContainer
				footerRow.AddChild(installButton);
				footerRow.AddChild(skipButton);
				footerRow.AddChild(hSpacer);

				footerRow.AddChild(cancelButton);
			}
		}
		public LibraryDataView()
		{
			// let the application controler know about this window so it can use it to switch library providers if it needs to.
			ApplicationController.Instance.CurrentLibraryDataView = this;

			currentLibraryProvider = new LibraryProviderSelector(SetCurrentLibraryProvider, false);
			currentLibraryProvider.DataReloaded += LibraryDataReloaded;

			if (libraryDataViewInstance != null)
			{
#if !__ANDROID__ // this is really just for debugging
				throw new Exception("There should only ever be one of these, Lars.");
#endif
			}
			libraryDataViewInstance = this;

			// set the display attributes
			{
				this.AnchorAll();
				this.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
				this.ScrollArea.Padding = new BorderDouble(3);
			}

			ScrollArea.HAnchor = HAnchor.ParentLeftRight;

			AutoScroll = true;
			topToBottomItemList = new FlowLayoutWidget(FlowDirection.TopToBottom);
			topToBottomItemList.HAnchor = HAnchor.ParentLeftRight;
			AddChild(topToBottomItemList);

			AddAllItems();
		}
		public SetupStepInstallDriver(ConnectionWizard windowController)
			: base(windowController)
		{
			headerLabel.Text = string.Format(LocalizedString.Get("Install Communication Driver"));
			printerDriverContainer = createPrinterDriverContainer();
			contentRow.AddChild(printerDriverContainer);
			{
				//Construct buttons
				installButton = textImageButtonFactory.Generate(LocalizedString.Get("Install Driver"));
				installButton.Click += (sender, e) =>
				{
					UiThread.RunOnIdle(() =>
					{
						bool canContinue = this.InstallDriver();
						if (canContinue)
						{
							connectionWizard.ChangeToSetupBaudOrComPortOne();
						}
					});
				};

				skipButton = textImageButtonFactory.Generate(LocalizedString.Get("Skip"));
				skipButton.Click += (s, e) => connectionWizard.ChangeToSetupBaudOrComPortOne();

				//Add buttons to buttonContainer
				footerRow.AddChild(installButton);
				footerRow.AddChild(skipButton);
				footerRow.AddChild(new HorizontalSpacer());
				footerRow.AddChild(cancelButton);
			}
		}
		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;
		}
        GuiWidget CreateOptionsMenu()
        {
            ImageBuffer gearImage = new ImageBuffer();
            string imagePathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "gear_icon.png");
            ImageBMPIO.LoadImageData(imagePathAndFile, gearImage);

            FlowLayoutWidget leftToRight = new FlowLayoutWidget();
            leftToRight.Margin = new BorderDouble(5, 0);
            string optionsString = new LocalizedString("Options").Translated;
            TextWidget optionsText = new TextWidget(optionsString, textColor: RGBA_Bytes.White);
            optionsText.VAnchor = Agg.UI.VAnchor.ParentCenter;
            optionsText.Margin = new BorderDouble(0, 0, 3, 0);
            leftToRight.AddChild(optionsText);
            GuiWidget gearWidget = new ImageWidget(gearImage);
            gearWidget.VAnchor = Agg.UI.VAnchor.ParentCenter;
            leftToRight.AddChild(gearWidget);
            leftToRight.HAnchor = HAnchor.FitToChildren;
            leftToRight.VAnchor = VAnchor.FitToChildren;

            Menu optionMenu = new Menu(leftToRight);
            optionMenu.OpenOffset = new Vector2(-2, -10);
            optionMenu.VAnchor = Agg.UI.VAnchor.ParentCenter;
            optionMenu.MenuItems.Add(new MenuItem(new ThemeColorSelectorWidget()));

            return optionMenu;
        }
		private FlowLayoutWidget createPrinterNameContainer()
		{
			FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
			container.Margin = new BorderDouble(0, 5);
			BorderDouble elementMargin = new BorderDouble(top: 3);

			string printerNameLabelTxt = LocalizedString.Get("Printer Name");
			string printerNameLabelTxtFull = string.Format("{0}:", printerNameLabelTxt);
			TextWidget printerNameLabel = new TextWidget(printerNameLabelTxtFull, 0, 0, 12);
			printerNameLabel.TextColor = this.defaultTextColor;
			printerNameLabel.HAnchor = HAnchor.ParentLeftRight;
			printerNameLabel.Margin = new BorderDouble(0, 0, 0, 1);

			printerNameInput = new MHTextEditWidget(this.ActivePrinter.Name);
			printerNameInput.HAnchor = HAnchor.ParentLeftRight;
			printerNameInput.KeyPressed += PrinterNameInput_KeyPressed;

			printerNameError = new TextWidget(LocalizedString.Get("Give your printer a name."), 0, 0, 10);
			printerNameError.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			printerNameError.HAnchor = HAnchor.ParentLeftRight;
			printerNameError.Margin = elementMargin;

			container.AddChild(printerNameLabel);
			container.AddChild(printerNameInput);
			container.AddChild(printerNameError);
			container.HAnchor = HAnchor.ParentLeftRight;
			return container;
		}
Example #18
0
		public RayTracerWindow(int width, int height)
			: base(width, height)
		{
			//CalculateIntersectCostsAndSaveToFile();

			FlowLayoutWidget leftToRight = new FlowLayoutWidget();
			leftToRight.HAnchor |= HAnchor.ParentLeftRight;
			leftToRight.VAnchor |= VAnchor.ParentBottomTop;

			previewWindowRayTrace = new RayTraceWidget();
			AnchorAll();
			previewWindowRayTrace.AnchorAll();

			leftToRight.AddChild(previewWindowRayTrace);

			GuiWidget zBuffer = new GuiWidget(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop);
			zBuffer.BackgroundColor = RGBA_Bytes.Blue;
			leftToRight.AddChild(zBuffer);

			AddChild(leftToRight);

			BackgroundColor = RGBA_Bytes.Black;

			ShowAsSystemWindow();
		}
		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 PrintProgressBar()
        {
            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.AutoExpandBoundsToText = true;
            printTimeElapsed.VAnchor = Agg.UI.VAnchor.ParentCenter;


            printTimeRemaining = new TextWidget("", pointSize: 11);
            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);
            AddHandlers();
            SetThemedColors();
            UpdatePrintStatus();            
            UiThread.RunOnIdle(OnIdle);
        }
        public CameraCalibrationWidget()
        {
            SuspendLayout();

            FlowLayoutWidget TopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
            {
                FlowLayoutWidget TopButtons = new FlowLayoutWidget(FlowDirection.LeftToRight);
                {
                    connectButton = new Button("Connect");
                    connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click);

                    TopButtons.AddChild(connectButton);
                }
                TopToBottomLayout.AddChild(TopButtons);

                xyJogControls = new XYJogControls();
                TopToBottomLayout.AddChild(xyJogControls);

                disableMotors = new Button("Disable Motors");
                disableMotors.Click += new ButtonBase.ButtonEventHandler(disableMotors_Click);
                TopToBottomLayout.AddChild(disableMotors);
            }

            AddChild(TopToBottomLayout);

            ResumeLayout();
        }
Example #22
0
        public MeshViewerApplication(string meshFileToLoad = "")
            : base(800, 600)
        {
            BackgroundColor = RGBA_Bytes.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);
            double scale = 1;
            meshViewerWidget = new MeshViewerWidget(viewerVolume, scale, MeshViewerWidget.BedShape.Rectangular, "No Part Loaded");

            meshViewerWidget.AnchorAll();

            viewArea.AddChild(meshViewerWidget);

            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 != "")
            {
                meshViewerWidget.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();

            AddHandlers();
        }
		public TemperatureWidgetBase(string textValue)
			: base(52 * TextWidget.GlobalPointSizeScaleRatio, 52 * TextWidget.GlobalPointSizeScaleRatio)
		{
			whiteButtonFactory.FixedHeight = 18 * TextWidget.GlobalPointSizeScaleRatio;
			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) * TextWidget.GlobalPointSizeScaleRatio;

			GuiWidget labelContainer = new GuiWidget();
			labelContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			labelContainer.Height = 18 * TextWidget.GlobalPointSizeScaleRatio;

			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 * TextWidget.GlobalPointSizeScaleRatio;

			preheatButton = whiteButtonFactory.Generate("Preheat".Localize().ToUpper());
			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(ThemeChanged, ref unregisterEvents);

			this.MouseEnterBounds += onEnterBounds;
			this.MouseLeaveBounds += onLeaveBounds;
			this.preheatButton.Click += onPreheatButtonClick;
		}
		public FlowLayoutWidget createPrinterConnectionMessageContainer()
		{
			FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
			container.VAnchor = VAnchor.ParentBottomTop;
			container.Margin = new BorderDouble(5);
			BorderDouble elementMargin = new BorderDouble(top: 5);

			string printerMessageOneText = "MatterControl will now attempt to auto-detect printer.".Localize();
			TextWidget printerMessageOne = new TextWidget(printerMessageOneText, 0, 0, 10);
			printerMessageOne.Margin = new BorderDouble(0, 10, 0, 5);
			printerMessageOne.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			printerMessageOne.HAnchor = HAnchor.ParentLeftRight;
			printerMessageOne.Margin = elementMargin;

			string disconnectMessage = string.Format("1.) {0} ({1}).", "Disconnect printer".Localize(), "if currently connected".Localize());
			TextWidget printerMessageTwo = new TextWidget(disconnectMessage, 0, 0, 12);
			printerMessageTwo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			printerMessageTwo.HAnchor = HAnchor.ParentLeftRight;
			printerMessageTwo.Margin = elementMargin;

			string printerMessageThreeBeg = "Power on and connect printer".Localize();
			string printerMessageThreeFull = string.Format("2.) {0}.", printerMessageThreeBeg);
			TextWidget printerMessageThree = new TextWidget(printerMessageThreeFull, 0, 0, 12);
            printerMessageThree.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            printerMessageThree.HAnchor = HAnchor.ParentLeftRight;
            printerMessageThree.Margin = elementMargin;

			string printerMessageFourTxtBeg = "Press".Localize();
			string printerMessageFourTxtEnd = "Connect".Localize();
			string printerMessageFourTxtFull = string.Format("3.) {0} '{1}'.", printerMessageFourTxtBeg, printerMessageFourTxtEnd);
			TextWidget printerMessageFour = new TextWidget(printerMessageFourTxtFull, 0, 0, 12);
            printerMessageFour.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            printerMessageFour.HAnchor = HAnchor.ParentLeftRight;
            printerMessageFour.Margin = elementMargin;

			GuiWidget vSpacer = new GuiWidget();
			vSpacer.VAnchor = VAnchor.ParentBottomTop;

			Button manualLink = linkButtonFactory.Generate("Manual Configuration".Localize());
			manualLink.Margin = new BorderDouble(0, 5);
			manualLink.Click += (s, e) => WizardWindow.ChangeToPage<SetupStepComPortManual>();

			printerErrorMessage = new TextWidget("", 0, 0, 10);
			printerErrorMessage.AutoExpandBoundsToText = true;
			printerErrorMessage.TextColor = RGBA_Bytes.Red;
			printerErrorMessage.HAnchor = HAnchor.ParentLeftRight;
			printerErrorMessage.Margin = elementMargin;

			container.AddChild(printerMessageOne);
			container.AddChild(printerMessageTwo);
			container.AddChild(printerMessageThree);
			container.AddChild(printerMessageFour);
			container.AddChild(printerErrorMessage);
			container.AddChild(vSpacer);
			container.AddChild(manualLink);

			container.HAnchor = HAnchor.ParentLeftRight;
			return container;
		}
		private void AddNameSetting(string sliceSettingsKey, FlowLayoutWidget contentRow, ref int tabIndex)
		{
			GuiWidget control = SliceSettingsWidget.CreateSettingControl(sliceSettingsKey, ref tabIndex);
			if (control != null)
			{
				contentRow.AddChild(control);
			}
		}
		public SettingsViewBase(string title)
			: base(new TextWidget(title, pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor))
		{
			SetDisplayAttributes();
			mainContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom);
			mainContainer.HAnchor = HAnchor.ParentLeftRight;
			mainContainer.Margin = new BorderDouble(left: 6);
		}
		public RunningMacroPage(string message, bool showOkButton, bool showMaterialSelector, double expectedSeconds, double expectedTemperature)
					: base("Close", "Macro Feedback")
		{
			TextWidget syncingText = new TextWidget(message, textColor: ActiveTheme.Instance.PrimaryTextColor);
			contentRow.AddChild(syncingText);

			footerRow.AddChild(new HorizontalSpacer());
			footerRow.AddChild(cancelButton);

			if (showMaterialSelector)
			{
				int extruderIndex = 0;
				contentRow.AddChild(new PresetSelectorWidget(string.Format($"{"Material".Localize()} {extruderIndex + 1}"), RGBA_Bytes.Orange, NamedSettingsLayers.Material, extruderIndex));
			}

			var holder = new FlowLayoutWidget();
			progressBar = new ProgressBar((int)(150 * GuiWidget.DeviceScale), (int)(15 * GuiWidget.DeviceScale))
			{
				FillColor = ActiveTheme.Instance.PrimaryAccentColor,
				BorderColor = ActiveTheme.Instance.PrimaryTextColor,
				//HAnchor = HAnchor.ParentCenter,
				Margin = new BorderDouble(3, 0, 0, 10),
			};
			progressBarText = new TextWidget("", pointSize: 10, textColor: ActiveTheme.Instance.PrimaryTextColor)
			{
				AutoExpandBoundsToText = true,
				Margin = new BorderDouble(5, 0, 0, 0),
			};
			holder.AddChild(progressBar);
			holder.AddChild(progressBarText);
			contentRow.AddChild(holder);
			progressBar.Visible = false;

			if (expectedSeconds > 0)
			{
				timeToWaitMs = (long)(expectedSeconds * 1000);
				endTimeMs = UiThread.CurrentTimerMs + timeToWaitMs;
				UiThread.RunOnIdle(CountDownTime, 1);
				progressBar.Visible = true;
			}

			PrinterConnectionAndCommunication.Instance.WroteLine.RegisterEvent(LookForTempRequest, ref unregisterEvents);

			if (showOkButton)
			{
				Button okButton = textImageButtonFactory.Generate("Continue".Localize());
				okButton.Margin = new BorderDouble(0, 0, 0, 25);
				okButton.HAnchor = HAnchor.ParentCenter;

				okButton.Click += (s, e) =>
				{
					PrinterConnectionAndCommunication.Instance.MacroContinue();
					UiThread.RunOnIdle(() => WizardWindow?.Close());
				};

				contentRow.AddChild(okButton);
			}
		}
Example #28
0
		private void AddLotsOfStuff()
		{
			{
				FlowLayoutWidget twoColumns = new FlowLayoutWidget();
				twoColumns.VAnchor = UI.VAnchor.ParentTop;

				List<GuiWidget> stuffToHide = new List<GuiWidget>();

				{
					FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);

					{
						FlowLayoutWidget topLeftStuff = new FlowLayoutWidget(FlowDirection.TopToBottom);
						topLeftStuff.AddChild(new TextWidget("Top of Top Stuff"));
						topLeftStuff.AddChild(new Button("Button 1"));
						stuffToHide.Add(new Button("Button hide 1"));
						topLeftStuff.AddChild(stuffToHide[0]);
						topLeftStuff.AddChild(new Button("Button 2"));
						stuffToHide.Add(new Button("Button hide 2"));
						topLeftStuff.AddChild(stuffToHide[1]);
						topLeftStuff.AddChild(new Button("Button 3"));
						topLeftStuff.AddChild(new TextWidget("Bottom of Top Stuff"));

						leftColumn.AddChild(topLeftStuff);
					}

					{
						FlowLayoutWidget bottomLeftStuff = new FlowLayoutWidget(FlowDirection.TopToBottom);
						bottomLeftStuff.AddChild(new TextWidget("Top of Bottom Stuff"));
						bottomLeftStuff.AddChild(new TextWidget("Bottom of Bottom Stuff"));

						leftColumn.AddChild(bottomLeftStuff);
					}

					twoColumns.AddChild(leftColumn);
				}

				{
					FlowLayoutWidget rightColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
					CheckBox hideCheckBox = new CheckBox("Hide Stuff");
					rightColumn.AddChild(hideCheckBox);
					hideCheckBox.CheckedStateChanged += (sender, e) =>
					{
						if (hideCheckBox.Checked)
						{
						}
						else
						{
						}
					};

					twoColumns.AddChild(rightColumn);
				}

				this.AddChild(twoColumns);
			}
		}
		public TextImageWidget(string label, RGBA_Bytes fillColor, RGBA_Bytes borderColor, RGBA_Bytes textColor, double borderWidth, BorderDouble margin, ImageBuffer image = null, double fontSize = 12, FlowDirection flowDirection = FlowDirection.LeftToRight, double height = 40, double width = 0, bool centerText = false, double imageSpacing = 0)
			: base()
		{
			this.image = image;
			this.fillColor = fillColor;
			this.borderColor = borderColor;
			this.borderWidth = borderWidth;
			this.Margin = new BorderDouble(0);
			this.Padding = new BorderDouble(0);

			TextWidget textWidget = new TextWidget(label, pointSize: fontSize);
			ImageWidget imageWidget;

			FlowLayoutWidget container = new FlowLayoutWidget(flowDirection);

			if (centerText)
			{
				// make sure the contents are centered
				GuiWidget leftSpace = new GuiWidget(0, 1);
				leftSpace.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
				container.AddChild(leftSpace);
			}

			if (image != null && image.Width > 0)
			{
				imageWidget = new ImageWidget(image);
				imageWidget.VAnchor = VAnchor.ParentCenter;
				imageWidget.Margin = new BorderDouble(right: imageSpacing);
				container.AddChild(imageWidget);
			}

			if (label != "")
			{
				textWidget.VAnchor = VAnchor.ParentCenter;
				textWidget.TextColor = textColor;
				textWidget.Padding = new BorderDouble(3, 0);
				container.AddChild(textWidget);
			}

			if (centerText)
			{
				GuiWidget rightSpace = new GuiWidget(0, 1);
				rightSpace.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
				container.AddChild(rightSpace);

				container.HAnchor = Agg.UI.HAnchor.ParentLeftRight | Agg.UI.HAnchor.FitToChildren;
			}
			container.VAnchor = Agg.UI.VAnchor.ParentCenter;

			container.MinimumSize = new Vector2(width, height);
			container.Margin = margin;
			this.AddChild(container);
			HAnchor = HAnchor.ParentLeftRight | HAnchor.FitToChildren;
			VAnchor = VAnchor.ParentCenter | Agg.UI.VAnchor.FitToChildren;
		}
Example #30
0
		private void AddMirrorControls(FlowLayoutWidget buttonPanel)
		{
			List<GuiWidget> mirrorControls = new List<GuiWidget>();

			double oldFixedWidth = view3DWidget.textImageButtonFactory.FixedWidth;
			view3DWidget.textImageButtonFactory.FixedWidth = view3DWidget.EditButtonHeight;

			FlowLayoutWidget buttonContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
			buttonContainer.HAnchor = HAnchor.ParentLeftRight;

			Button mirrorXButton = view3DWidget.textImageButtonFactory.Generate("X", centerText: true);
			buttonContainer.AddChild(mirrorXButton);
			mirrorControls.Add(mirrorXButton);
			mirrorXButton.Click += (object sender, EventArgs mouseEvent) =>
			{
				if (view3DWidget.SelectedMeshGroupIndex != -1)
				{
					view3DWidget.SelectedMeshGroup.ReverseFaceEdges();
					view3DWidget.SelectedMeshGroupTransform = PlatingHelper.ApplyAtCenter(view3DWidget.SelectedMeshGroup, view3DWidget.SelectedMeshGroupTransform, Matrix4X4.CreateScale(-1, 1, 1));
					view3DWidget.PartHasBeenChanged();
					Invalidate();
				}
			};

			Button mirrorYButton = view3DWidget.textImageButtonFactory.Generate("Y", centerText: true);
			buttonContainer.AddChild(mirrorYButton);
			mirrorControls.Add(mirrorYButton);
			mirrorYButton.Click += (object sender, EventArgs mouseEvent) =>
			{
				if (view3DWidget.SelectedMeshGroupIndex != -1)
				{
					view3DWidget.SelectedMeshGroup.ReverseFaceEdges();
					view3DWidget.SelectedMeshGroupTransform = PlatingHelper.ApplyAtCenter(view3DWidget.SelectedMeshGroup, view3DWidget.SelectedMeshGroupTransform, Matrix4X4.CreateScale(1, -1, 1));
					view3DWidget.PartHasBeenChanged();
					Invalidate();
				}
			};

			Button mirrorZButton = view3DWidget.textImageButtonFactory.Generate("Z", centerText: true);
			buttonContainer.AddChild(mirrorZButton);
			mirrorControls.Add(mirrorZButton);
			mirrorZButton.Click += (object sender, EventArgs mouseEvent) =>
			{
				if (view3DWidget.SelectedMeshGroupIndex != -1)
				{
					view3DWidget.SelectedMeshGroup.ReverseFaceEdges();
					view3DWidget.SelectedMeshGroupTransform = PlatingHelper.ApplyAtCenter(view3DWidget.SelectedMeshGroup, view3DWidget.SelectedMeshGroupTransform, Matrix4X4.CreateScale(1, 1, -1));
					view3DWidget.PartHasBeenChanged();
					Invalidate();
				}
			};
			buttonPanel.AddChild(buttonContainer);
			buttonPanel.AddChild(view3DWidget.GenerateHorizontalRule());
			view3DWidget.textImageButtonFactory.FixedWidth = oldFixedWidth;
		}