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 Button getThemeButton(int index)
		{
			GuiWidget normal = new GuiWidget(colorSelectSize, colorSelectSize);
			normal.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].primaryAccentColor;
			GuiWidget hover = new GuiWidget(colorSelectSize, colorSelectSize);
			hover.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].secondaryAccentColor;
			GuiWidget pressed = new GuiWidget(colorSelectSize, colorSelectSize);
			pressed.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].secondaryAccentColor;
			GuiWidget disabled = new GuiWidget(colorSelectSize, colorSelectSize);

			Button colorButton = new Button(0, 0, new ButtonViewStates(normal, hover, pressed, disabled));
			colorButton.Name = index.ToString();
			colorButton.Click += (sender, mouseEvent) =>
			{
				UserSettings.Instance.set("ActiveThemeIndex", ((GuiWidget)sender).Name);
				ActiveTheme.Instance.LoadThemeSettings(int.Parse(((GuiWidget)sender).Name));
			};

			colorButton.MouseEnterBounds += (sender, mouseEvent) =>
			{
				colorToChangeTo.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].primaryAccentColor;
			};

			colorButton.MouseLeaveBounds += (sender, mouseEvent) =>
			{
				colorToChangeTo.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
			};

			return colorButton;
		}
		public SetupStepComPortManual()
		{
			FlowLayoutWidget printerComPortContainer = createComPortContainer();
			contentRow.AddChild(printerComPortContainer);

			//Construct buttons
			nextButton = textImageButtonFactory.Generate("Done".Localize());
			nextButton.Click += (s, e) => UiThread.RunOnIdle(Parent.Close);
			nextButton.Visible = false;

			connectButton = textImageButtonFactory.Generate("Connect".Localize());
			connectButton.Click += ConnectButton_Click;

			refreshButton = textImageButtonFactory.Generate("Refresh".Localize());
			refreshButton.Click += (s, e) => UiThread.RunOnIdle(WizardWindow.ChangeToPage<SetupStepComPortManual>);

			//Add buttons to buttonContainer
			footerRow.AddChild(nextButton);
			footerRow.AddChild(connectButton);
			footerRow.AddChild(refreshButton);
			footerRow.AddChild(new HorizontalSpacer());
			footerRow.AddChild(cancelButton);

			PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
		}
Esempio n. 4
0
        protected override void AddChildElements()
        {
            actionBarButtonFactory.invertImageLocation = false;
            string connectString = new LocalizedString("Connect").Translated;
            connectPrinterButton = actionBarButtonFactory.Generate(connectString, "icon_power_32x32.png");
            connectPrinterButton.Margin = new BorderDouble(3, 0);
            connectPrinterButton.VAnchor = VAnchor.ParentCenter;
            connectPrinterButton.Cursor = Cursors.Hand;

            string disconnectString = new LocalizedString("Disconnect").Translated;
            disconnectPrinterButton = actionBarButtonFactory.Generate(disconnectString, "icon_power_32x32.png");
            disconnectPrinterButton.Margin = new BorderDouble(3, 0);
            disconnectPrinterButton.VAnchor = VAnchor.ParentCenter;
            disconnectPrinterButton.Visible = false;
            disconnectPrinterButton.Cursor = Cursors.Hand;

            selectActivePrinterButton = new PrinterSelectButton();
            selectActivePrinterButton.HAnchor = HAnchor.ParentLeftRight;
            selectActivePrinterButton.Cursor = Cursors.Hand;

            actionBarButtonFactory.invertImageLocation = true;

            this.AddChild(connectPrinterButton);
            this.AddChild(disconnectPrinterButton);
            this.AddChild(selectActivePrinterButton);
            this.AddChild(CreateOptionsMenu());
        }
        public SetupStepComPortTwo(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
            : base(windowController, containerWindowToClose, setupPrinterStatus)
        {

            startingPortNames = SerialPort.GetPortNames();
            contentRow.AddChild(createPrinterConnectionMessageContainer());
            {
                //Construct buttons
				nextButton = textImageButtonFactory.Generate(new LocalizedString("Done").Translated);
                nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click);
                nextButton.Visible = false;

				connectButton = textImageButtonFactory.Generate(new LocalizedString("Connect").Translated);
                connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click);

                PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);

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

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

                footerRow.AddChild(cancelButton);
            }
        }
        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();
        }
        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 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 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 SetupStepComPortManual(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
			: base(windowController, containerWindowToClose, setupPrinterStatus)
		{
			linkButtonFactory.fontSize = 8;

			FlowLayoutWidget printerComPortContainer = createComPortContainer();
			contentRow.AddChild(printerComPortContainer);
			{
				//Construct buttons
				nextButton = textImageButtonFactory.Generate(LocalizedString.Get("Done"));
				nextButton.Click += new EventHandler(NextButton_Click);
				nextButton.Visible = false;

				connectButton = textImageButtonFactory.Generate(LocalizedString.Get("Connect"));
				connectButton.Click += new EventHandler(ConnectButton_Click);

				PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);

				refreshButton = textImageButtonFactory.Generate(LocalizedString.Get("Refresh"));
				refreshButton.Click += new EventHandler(RefreshButton_Click);

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

				//Add buttons to buttonContainer
				footerRow.AddChild(nextButton);
				footerRow.AddChild(connectButton);
				footerRow.AddChild(refreshButton);
				footerRow.AddChild(hSpacer);
				footerRow.AddChild(cancelButton);
			}
		}
Esempio n. 11
0
		private void CreateButton(HAnchor hAnchor, VAnchor vAnchor)
		{
			Button anchorButton = new Button(hAnchor.ToString() + " " + vAnchor.ToString());
			anchorButton.HAnchor = hAnchor;
			anchorButton.VAnchor = vAnchor;
			anchorButton.Margin = new BorderDouble(offset);
			AddChild(anchorButton);
		}
Esempio n. 12
0
        public PlayfieldView(RectangleDouble bounds)
        {
            BoundsRelativeToParent = bounds;

            GameImageSequence menuButtonSequence = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "MenuButtonFromGame");
            Button menuButton = new Button(400, 12, new ButtonViewThreeImage(menuButtonSequence.GetImageByIndex(0), menuButtonSequence.GetImageByIndex(1), menuButtonSequence.GetImageByIndex(2)));
            AddChild(menuButton);
            menuButton.Click += new Button.ButtonEventHandler(EscapeMenu);
        }
Esempio n. 13
0
		private void CreateButton(HAnchor hAnchor, VAnchor vAnchor)
		{
			Button anchorButton = new Button(hAnchor.ToString() + " - " + vAnchor.ToString());
			anchorButton.BackgroundColor = RGBA_Bytes.Red;
			anchorButton.HAnchor = hAnchor;
			anchorButton.VAnchor = vAnchor;
			anchorButton.Margin = new BorderDouble(offset);
			AddChild(anchorButton);
		}
Esempio n. 14
0
        public CreditsMenu(RectangleDouble bounds)
        {
            BoundsRelativeToParent = bounds;

            GameImageSequence cancelButtonSequence = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "NumPlayersCancelButton");
            Button cancelGameButton = new Button(400, 200, new ButtonViewThreeImage(cancelButtonSequence.GetImageByIndex(0), cancelButtonSequence.GetImageByIndex(1), cancelButtonSequence.GetImageByIndex(2)));
            AddChild(cancelGameButton);
            cancelGameButton.Click += new Button.ButtonEventHandler(OnCancelMenuButton);
        }
Esempio n. 15
0
		public SplitButton(string buttonText, Direction direction = Direction.Down)
			: base(FlowDirection.LeftToRight, HAnchor.FitToChildren, VAnchor.FitToChildren)
		{
			defaultButton = CreateDefaultButton(buttonText);
			altChoices = CreateDropDown(direction);

			defaultButton.VAnchor = VAnchor.ParentCenter;

			AddChild(defaultButton);
			AddChild(altChoices);
		}
		public SetupConnectionWidgetBase(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus printerSetupStatus = null)
			: base(windowController, containerWindowToClose)
		{
			SetDisplayAttributes();

			if (printerSetupStatus == null)
			{
				this.currentPrinterSetupStatus = new PrinterSetupStatus();
			}
			else
			{
				this.currentPrinterSetupStatus = printerSetupStatus;
			}

			cancelButton = textImageButtonFactory.Generate(LocalizedString.Get("Cancel"));
			cancelButton.Name = "Setup Connection Cancel Button";
			cancelButton.Click += new EventHandler(CancelButton_Click);

			//Create the main container
			GuiWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			mainContainer.AnchorAll();
			mainContainer.Padding = new BorderDouble(3, 5, 3, 5);
			mainContainer.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			//Create the header row for the widget
			headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
			headerRow.Margin = new BorderDouble(0, 3, 0, 0);
			headerRow.Padding = new BorderDouble(0, 3, 0, 3);
			headerRow.HAnchor = HAnchor.ParentLeftRight;
			{
				string defaultHeaderTitle = LocalizedString.Get("3D Printer Setup");
				headerLabel = new TextWidget(defaultHeaderTitle, pointSize: 14);
				headerLabel.AutoExpandBoundsToText = true;
				headerLabel.TextColor = this.defaultTextColor;
				headerRow.AddChild(headerLabel);
			}

			//Create the main control container
			contentRow = new FlowLayoutWidget(FlowDirection.TopToBottom);
			contentRow.Padding = new BorderDouble(5);
			contentRow.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
			contentRow.HAnchor = HAnchor.ParentLeftRight;
			contentRow.VAnchor = VAnchor.ParentBottomTop;

			//Create the footer (button) container
			footerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
			footerRow.HAnchor = HAnchor.ParentLeft | HAnchor.ParentRight;
			footerRow.Margin = new BorderDouble(0, 3);

			mainContainer.AddChild(headerRow);
			mainContainer.AddChild(contentRow);
			mainContainer.AddChild(footerRow);
			this.AddChild(mainContainer);
		}
Esempio n. 17
0
		public SplitButton(Button button, DynamicDropDownMenu menu)
			: base(FlowDirection.LeftToRight, HAnchor.FitToChildren, VAnchor.FitToChildren)
		{
			defaultButton = button;
			altChoices = menu;

			defaultButton.VAnchor = VAnchor.ParentCenter;

			AddChild(defaultButton);
			AddChild(altChoices);
		}
		private FlowLayoutWidget GetCameraControl()
		{
			FlowLayoutWidget buttonRow = new FlowLayoutWidget();
			buttonRow.HAnchor = HAnchor.ParentLeftRight;
			buttonRow.Margin = new BorderDouble(0, 4);

			ImageBuffer cameraIconImage = StaticData.Instance.LoadIcon("camera-24x24.png",24,24).InvertLightness();
			cameraIconImage.SetRecieveBlender(new BlenderPreMultBGRA());
			int iconSize = (int)(24 * GuiWidget.DeviceScale);

			if (!ActiveTheme.Instance.IsDarkTheme)
			{
				cameraIconImage.InvertLightness();
			}

			ImageWidget cameraIcon = new ImageWidget(cameraIconImage);
			cameraIcon.Margin = new BorderDouble(right: 6);

			TextWidget cameraLabel = new TextWidget("Camera Monitoring".Localize());
			cameraLabel.AutoExpandBoundsToText = true;
			cameraLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			cameraLabel.VAnchor = VAnchor.ParentCenter;

			openCameraButton = textImageButtonFactory.Generate("Preview".Localize().ToUpper());
			openCameraButton.Click += new EventHandler(openCameraPreview_Click);
			openCameraButton.Margin = new BorderDouble(left: 6);

			buttonRow.AddChild(cameraIcon);
			buttonRow.AddChild(cameraLabel);
			buttonRow.AddChild(new HorizontalSpacer());
			buttonRow.AddChild(openCameraButton);

			if (ApplicationSettings.Instance.get(ApplicationSettingsKey.HardwareHasCamera) == "true")
			{
				GuiWidget publishImageSwitchContainer = new FlowLayoutWidget();
				publishImageSwitchContainer.VAnchor = VAnchor.ParentCenter;
				publishImageSwitchContainer.Margin = new BorderDouble(left: 16);

				CheckBox toggleSwitch = ImageButtonFactory.CreateToggleSwitch(ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.publish_bed_image));
				toggleSwitch.CheckedStateChanged += (sender, e) =>
				{
					CheckBox thisControl = sender as CheckBox;
					ActiveSliceSettings.Instance.SetValue(SettingsKey.publish_bed_image, thisControl.Checked ? "1" : "0");
				};
				publishImageSwitchContainer.AddChild(toggleSwitch);

				publishImageSwitchContainer.SetBoundsToEncloseChildren();

				buttonRow.AddChild(publishImageSwitchContainer);
			}

			return buttonRow;
		}
Esempio n. 19
0
        public ContactFormWidget(string subjectText, string bodyText)
        {
            SetButtonAttributes();
            AnchorAll();

            cancelButton = textImageButtonFactory.Generate(LocalizedString.Get("Cancel"));
            submitButton = textImageButtonFactory.Generate(LocalizedString.Get("Submit"));
            doneButton = textImageButtonFactory.Generate(LocalizedString.Get("Done"));
            doneButton.Visible = false;

            DoLayout(subjectText, bodyText);
            AddButtonHandlers();
        }
		public SetupStepComPortOne()
		{
			contentRow.AddChild(createPrinterConnectionMessageContainer());
			{
				//Construct buttons
				nextButton = textImageButtonFactory.Generate("Continue".Localize());
				nextButton.Click += (s, e) => WizardWindow.ChangeToPage<SetupStepComPortTwo>();

				//Add buttons to buttonContainer
				footerRow.AddChild(nextButton);
				footerRow.AddChild(new HorizontalSpacer());
				footerRow.AddChild(cancelButton);
			}
		}
Esempio n. 21
0
        public MessageBox(String message, string windowTitle, MessageType messageType, double width, double height)
            : base(width, height)
        {
            BackgroundColor = new RGBA_Bytes(50, 50, 50, 240);
            FlowLayoutWidget topToBottomFlow = new FlowLayoutWidget(FlowDirection.TopToBottom);
            topToBottomFlow.HAnchor = Agg.UI.HAnchor.ParentCenter;
            topToBottomFlow.VAnchor = Agg.UI.VAnchor.ParentCenter;
            topToBottomFlow.AddChild(new TextWidget(message, textColor: RGBA_Bytes.White));

            Title = windowTitle;

            // add a spacer
            topToBottomFlow.AddChild(new GuiWidget(10, 10));

            switch (messageType)
            {
                case MessageType.YES_NO:
                    {
                        FlowLayoutWidget yesNoButtonsFlow = new FlowLayoutWidget();

                        Button yesButton = new Button("Yes");
                        yesButton.Click += new ButtonBase.ButtonEventHandler(okButton_Click);
                        yesNoButtonsFlow.AddChild(yesButton);

                        Button noButton = new Button("No");
                        noButton.Click += new ButtonBase.ButtonEventHandler(noButton_Click);
                        yesNoButtonsFlow.AddChild(noButton);

                        topToBottomFlow.AddChild(yesNoButtonsFlow);
                    }
                    break;

                case MessageType.OK:
                    {
                        Button okButton = new Button("Ok");
                        okButton.Click += new ButtonBase.ButtonEventHandler(okButton_Click);
                        topToBottomFlow.AddChild(okButton);
                    }
                    break;

                default:
                    throw new NotImplementedException();
            }

            topToBottomFlow.SetBoundsToEncloseChildren();

            AddChild(topToBottomFlow);

            IsModal = true;
        }
		private FlowLayoutWidget GetCameraControl()
		{
			FlowLayoutWidget buttonRow = new FlowLayoutWidget();
			buttonRow.HAnchor = HAnchor.ParentLeftRight;
			buttonRow.Margin = new BorderDouble(0, 4);

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

			ImageWidget cameraIcon = new ImageWidget(cameraIconImage);
			cameraIcon.Margin = new BorderDouble(right: 6);

			TextWidget cameraLabel = new TextWidget("Camera Monitoring");
			cameraLabel.AutoExpandBoundsToText = true;
			cameraLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			cameraLabel.VAnchor = VAnchor.ParentCenter;

			openCameraButton = textImageButtonFactory.Generate("Preview".Localize().ToUpper());
			openCameraButton.Click += new EventHandler(openCameraPreview_Click);
			openCameraButton.Margin = new BorderDouble(left: 6);

			buttonRow.AddChild(cameraIcon);
			buttonRow.AddChild(cameraLabel);
			buttonRow.AddChild(new HorizontalSpacer());
			buttonRow.AddChild(openCameraButton);
#if __ANDROID__

			GuiWidget publishImageSwitchContainer = new FlowLayoutWidget();
			publishImageSwitchContainer.VAnchor = VAnchor.ParentCenter;
			publishImageSwitchContainer.Margin = new BorderDouble(left: 16);

			CheckBox toggleSwitch = ImageButtonFactory.CreateToggleSwitch(PrinterSettings.Instance.get("PublishBedImage") == "true");
			toggleSwitch.CheckedStateChanged += (sender, e) =>
			{
				CheckBox thisControl = sender as CheckBox;
				PrinterSettings.Instance.set("PublishBedImage", thisControl.Checked ? "true" : "false");
			};
			publishImageSwitchContainer.AddChild(toggleSwitch);

			publishImageSwitchContainer.SetBoundsToEncloseChildren();

			buttonRow.AddChild(publishImageSwitchContainer);
#endif

			return buttonRow;
		}
		public SliceSettingsSaveBar()
		{
			textImageButtonFactory.FixedWidth = 80 * TextWidget.GlobalPointSizeScaleRatio;
			textImageButtonFactory.fontSize = (int)(10 * TextWidget.GlobalPointSizeScaleRatio);

			this.textImageButtonFactory.normalFillColor = RGBA_Bytes.Transparent;
			this.textImageButtonFactory.disabledFillColor = RGBA_Bytes.White;

			this.textImageButtonFactory.borderWidth = 1;
			this.textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 180);
			this.textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 180);

			this.textImageButtonFactory.disabledTextColor = RGBA_Bytes.DarkGray;
			this.textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
			this.textImageButtonFactory.normalTextColor = ActiveTheme.Instance.SecondaryTextColor;
			this.textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;

			this.Margin = new BorderDouble(left: 2);
			this.HAnchor = HAnchor.ParentLeftRight;
			this.BackgroundColor = ActiveTheme.Instance.TransparentLightOverlay;
			this.Padding = new BorderDouble(5);

			string unsavedMessageText = "Unsaved Changes".Localize();
			TextWidget unsavedMessage = new TextWidget("{0}:".FormatWith(unsavedMessageText), pointSize: 10 * TextWidget.GlobalPointSizeScaleRatio);
			unsavedMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			unsavedMessage.VAnchor = VAnchor.ParentCenter;

			revertbutton = textImageButtonFactory.Generate(LocalizedString.Get("Revert").ToUpper(), centerText: true);
			revertbutton.VAnchor = VAnchor.ParentCenter;
			revertbutton.Visible = true;
			revertbutton.Margin = new BorderDouble(5, 0, 0, 0);
			revertbutton.Click += new EventHandler(revertbutton_Click);

			this.textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 255);
			this.textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 255);
			this.textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;

			saveButton = textImageButtonFactory.Generate(LocalizedString.Get("Save").ToUpper(), centerText: true);
			saveButton.VAnchor = VAnchor.ParentCenter;
			saveButton.Visible = true;
			saveButton.Margin = new BorderDouble(5, 0, 5, 0);
			saveButton.Click += new EventHandler(saveButton_Click);

			this.AddChild(new HorizontalSpacer());
			this.AddChild(unsavedMessage);
			this.AddChild(saveButton);
			this.AddChild(revertbutton);
			this.AddChild(new HorizontalSpacer());
		}
		public SetupStepBaudRate()
		{
			printerBaudRateContainer = createPrinterBaudRateContainer();
			contentRow.AddChild(printerBaudRateContainer);
			{
				nextButton = textImageButtonFactory.Generate(LocalizedString.Get("Continue"));
				nextButton.Click += new EventHandler(NextButton_Click);

				//Add buttons to buttonContainer
				footerRow.AddChild(nextButton);
				footerRow.AddChild(new HorizontalSpacer());
				footerRow.AddChild(cancelButton);
			}
			BindBaudRateHandlers();
		}
Esempio n. 25
0
		private void AddMinimumError()
		{
			GuiWidget thingToHide;
			{
				FlowLayoutWidget twoColumns = new FlowLayoutWidget();
				twoColumns.Name = "twoColumns";
				{
					FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
					leftColumn.Name = "leftColumn";
					{
						FlowLayoutWidget topLeftStuff = new FlowLayoutWidget(FlowDirection.TopToBottom);
						topLeftStuff.Name = "topLeftStuff";

						topLeftStuff.AddChild(new TextWidget("Top of Top Stuff"));
						thingToHide = new Button("thing to hide");
						topLeftStuff.AddChild(thingToHide);
						topLeftStuff.AddChild(new TextWidget("Bottom of Top Stuff"));

						leftColumn.AddChild(topLeftStuff);
						//leftColumn.DebugShowBounds = true;
					}

					twoColumns.AddChild(leftColumn);
				}

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

					twoColumns.AddChild(rightColumn);
				}

				this.AddChild(twoColumns);
			}
		}
Esempio n. 26
0
        private FlowLayoutWidget createPrinterBaudRateContainer()
        {
            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
            container.Margin = new BorderDouble(0);
            container.VAnchor = VAnchor.ParentBottomTop;
            BorderDouble elementMargin = new BorderDouble(top: 3);

			string baudRateLabelText = new LocalizedString ("Baud Rate").Translated;
			string baudRateLabelTextFull = string.Format ("{0}:", baudRateLabelText);

			TextWidget baudRateLabel = new TextWidget(baudRateLabelTextFull, 0, 0, 12);
            baudRateLabel.TextColor = this.defaultTextColor;
            baudRateLabel.Margin = new BorderDouble(0, 0, 0, 10);
            baudRateLabel.HAnchor = HAnchor.ParentLeftRight;

            baudRateWidget = GetBaudRateWidget();
            baudRateWidget.HAnchor = HAnchor.ParentLeftRight;

            FlowLayoutWidget baudRateMessageContainer = new FlowLayoutWidget();
            baudRateMessageContainer.Margin = elementMargin;
            baudRateMessageContainer.HAnchor = HAnchor.ParentLeftRight;

			printerBaudRateError = new TextWidget(new LocalizedString("Select the baud rate.").Translated, 0, 0, 10);
            printerBaudRateError.TextColor = RGBA_Bytes.White;
            printerBaudRateError.AutoExpandBoundsToText = true;   

			printerBaudRateHelpLink = linkButtonFactory.Generate(new LocalizedString("What's this?").Translated);
            printerBaudRateHelpLink.Margin = new BorderDouble(left: 5);
            printerBaudRateHelpLink.VAnchor = VAnchor.ParentBottom;
            printerBaudRateHelpLink.Click += new ButtonBase.ButtonEventHandler(printerBaudRateHelp_Click);

			printerBaudRateHelpMessage = new TextWidget(new LocalizedString("The term 'Baud Rate' roughly means the speed at which\ndata is transmitted.  Baud rates may differ from printer to\nprinter. Refer to your printer manual for more info.\n\nTip: If you are uncertain - try 250000.").Translated, 0, 0, 10);
            printerBaudRateHelpMessage.TextColor = RGBA_Bytes.White;
            printerBaudRateHelpMessage.Margin = new BorderDouble(top: 10);
            printerBaudRateHelpMessage.Visible = false;

            baudRateMessageContainer.AddChild(printerBaudRateError);
            baudRateMessageContainer.AddChild(printerBaudRateHelpLink);

            container.AddChild(baudRateLabel);
            container.AddChild(baudRateWidget);
            container.AddChild(baudRateMessageContainer);
            container.AddChild(printerBaudRateHelpMessage);
            

            container.HAnchor = HAnchor.ParentLeftRight;
            return container;
        }
        public Button Generate(string normalImageName, string hoverImageName, string pressedImageName = null, string disabledImageName = null)
        {

            if (pressedImageName == null)
            {
                pressedImageName = hoverImageName;
            }

            if (disabledImageName == null)
            {
                disabledImageName = normalImageName;
            }

            Agg.Image.ImageBuffer normalImage = new Agg.Image.ImageBuffer();
            Agg.Image.ImageBuffer pressedImage = new Agg.Image.ImageBuffer();
            Agg.Image.ImageBuffer hoverImage = new Agg.Image.ImageBuffer();
            Agg.Image.ImageBuffer disabledImage = new Agg.Image.ImageBuffer();

            ImageIO.LoadImageData(this.GetImageLocation(normalImageName), normalImage);
            ImageIO.LoadImageData(this.GetImageLocation(pressedImageName), pressedImage);
            ImageIO.LoadImageData(this.GetImageLocation(hoverImageName), hoverImage);
            ImageIO.LoadImageData(this.GetImageLocation(disabledImageName), disabledImage);

            if (!ActiveTheme.Instance.IsDarkTheme && invertImageColor)
            {
                InvertLightness.DoInvertLightness(normalImage);
                InvertLightness.DoInvertLightness(pressedImage);
                InvertLightness.DoInvertLightness(hoverImage);
                InvertLightness.DoInvertLightness(disabledImage);
            }

            //normalImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet);
            //pressedImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet);

            ButtonViewStates buttonViewWidget = new ButtonViewStates(
                new ImageWidget(normalImage),
                new ImageWidget(hoverImage),
                new ImageWidget(pressedImage),
                new ImageWidget(disabledImage)
            );

            //Create button based on view container widget
            Button imageButton = new Button(0, 0, buttonViewWidget);
            imageButton.Margin = new BorderDouble(0);
            imageButton.Padding = new BorderDouble(0);
            return imageButton;
        }
		private FlowLayoutWidget createComPortContainer()
		{
			FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
			container.Margin = new BorderDouble(0);
			container.VAnchor = VAnchor.ParentBottomTop;
			BorderDouble elementMargin = new BorderDouble(top: 3);

			string serialPortLabel = LocalizedString.Get("Serial Port");
			string serialPortLabelFull = string.Format("{0}:", serialPortLabel);

			TextWidget comPortLabel = new TextWidget(serialPortLabelFull, 0, 0, 12);
			comPortLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			comPortLabel.Margin = new BorderDouble(0, 0, 0, 10);
			comPortLabel.HAnchor = HAnchor.ParentLeftRight;

			FlowLayoutWidget serialPortContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			CreateSerialPortControls(serialPortContainer, null);

			FlowLayoutWidget comPortMessageContainer = new FlowLayoutWidget();
			comPortMessageContainer.Margin = elementMargin;
			comPortMessageContainer.HAnchor = HAnchor.ParentLeftRight;

			printerComPortError = new TextWidget("Currently available serial ports.".Localize(), 0, 0, 10);
			printerComPortError.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			printerComPortError.AutoExpandBoundsToText = true;

			printerComPortHelpLink = linkButtonFactory.Generate("What's this?".Localize());
			printerComPortHelpLink.Margin = new BorderDouble(left: 5);
			printerComPortHelpLink.VAnchor = VAnchor.ParentBottom;
			printerComPortHelpLink.Click += (s, e) => printerComPortHelpMessage.Visible = !printerComPortHelpMessage.Visible;

			printerComPortHelpMessage = new TextWidget("The 'Serial Port' identifies which connected device is\nyour printer. Changing which usb plug you use may\nchange the associated serial port.\n\nTip: If you are uncertain, plug-in in your printer and hit\nrefresh. The new port that appears should be your\nprinter.".Localize(), 0, 0, 10);
			printerComPortHelpMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			printerComPortHelpMessage.Margin = new BorderDouble(top: 10);
			printerComPortHelpMessage.Visible = false;

			comPortMessageContainer.AddChild(printerComPortError);
			comPortMessageContainer.AddChild(printerComPortHelpLink);

			container.AddChild(comPortLabel);
			container.AddChild(serialPortContainer);
			container.AddChild(comPortMessageContainer);
			container.AddChild(printerComPortHelpMessage);

			container.HAnchor = HAnchor.ParentLeftRight;
			return container;
		}
		public SetupStepMakeModelName(ConnectionWizard windowController) : base(windowController)
		{
			//Construct inputs
			printerNameContainer = createPrinterNameContainer();
			printerMakeContainer = createPrinterMakeContainer();

			if (printerManufacturerSelector.CountOfMakes == 1)
			{
				ActivePrinter.Make = printerManufacturerSelector.ManufacturerDropList.SelectedValue;

				printerMakeContainer.Visible = false;
				printerModelContainer = createPrinterModelContainer(printerManufacturerSelector.ManufacturerDropList.SelectedValue);
				printerModelContainer.Visible = true;
			}
			else
			{
				printerModelContainer = createPrinterModelContainer();
			}

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

			//Construct buttons
			nextButton = textImageButtonFactory.Generate(LocalizedString.Get("Save & Continue"));
			nextButton.Name = "Save & Continue Button";
			nextButton.Click += (s, e) =>
			{
				bool canContinue = this.OnSave();
				if (canContinue)
				{
					UiThread.RunOnIdle(connectionWizard.Close);
				}
			};

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

			usingDefaultName = true;

			SetElementVisibility();
		}
		public ViewControls2D()
		{
			if (UserSettings.Instance.DisplayMode == ApplicationDisplayType.Touchscreen)
			{
				buttonHeight = 40;
			}
			else
			{
				buttonHeight = 0;
			}

			TextImageButtonFactory iconTextImageButtonFactory = new TextImageButtonFactory();
			iconTextImageButtonFactory.AllowThemeToAdjustImage = false;
			iconTextImageButtonFactory.checkedBorderColor = RGBA_Bytes.White;

			BackgroundColor = new RGBA_Bytes(0, 0, 0, 120);
			iconTextImageButtonFactory.FixedHeight = buttonHeight;
			iconTextImageButtonFactory.FixedWidth = buttonHeight;

			string resetViewIconPath = Path.Combine("ViewTransformControls", "reset.png");
			resetViewButton = iconTextImageButtonFactory.Generate("", StaticData.Instance.LoadIcon(resetViewIconPath,32,32).InvertLightness());
			resetViewButton.ToolTipText = "Reset View".Localize();
			AddChild(resetViewButton);
			resetViewButton.Click += (sender, e) =>
			{
				ResetView?.Invoke(this, null);
			};

			string translateIconPath = Path.Combine("ViewTransformControls", "translate.png");
			translateButton = iconTextImageButtonFactory.GenerateRadioButton("", StaticData.Instance.LoadIcon(translateIconPath,32,32));
            translateButton.ToolTipText = "Move".Localize();
            translateButton.Margin = new BorderDouble(3);
			AddChild(translateButton);

			string scaleIconPath = Path.Combine("ViewTransformControls", "scale.png");
			scaleButton = iconTextImageButtonFactory.GenerateRadioButton("", StaticData.Instance.LoadIcon(scaleIconPath,32,32));
            scaleButton.ToolTipText = "Zoom".Localize();
            scaleButton.Margin = new BorderDouble(3);
			AddChild(scaleButton);

			Margin = new BorderDouble(5);
			HAnchor |= Agg.UI.HAnchor.ParentLeft;
			VAnchor = Agg.UI.VAnchor.ParentTop;
			translateButton.Checked = true;
		}