コード例 #1
0
        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);
        }
コード例 #2
0
		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);
		}
コード例 #3
0
		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;
		}
コード例 #4
0
		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;
		}
コード例 #5
0
		public ViewControls2D()
		{
			if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen)
			{
				buttonHeight = 40;
			}
			else
			{
				buttonHeight = 20;
			}

			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 translateIconPath = Path.Combine("ViewTransformControls", "translate.png");
			translateButton = iconTextImageButtonFactory.GenerateRadioButton("", translateIconPath);
			translateButton.Margin = new BorderDouble(3);
			AddChild(translateButton);

			string scaleIconPath = Path.Combine("ViewTransformControls", "scale.png");
			scaleButton = iconTextImageButtonFactory.GenerateRadioButton("", scaleIconPath);
			scaleButton.Margin = new BorderDouble(3);
			AddChild(scaleButton);

			Margin = new BorderDouble(5);
			HAnchor |= Agg.UI.HAnchor.ParentLeft;
			VAnchor = Agg.UI.VAnchor.ParentTop;
			translateButton.Checked = true;
		}
コード例 #6
0
		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;
		}
コード例 #7
0
ファイル: TextScrolBar.cs プロジェクト: fuding/MatterControl
		public TextScrollBar(TextScrollWidget textScrollWidget, int width)
			: base(width, ScrollBar.ScrollBarWidth)
		{
			this.textScrollWidget = textScrollWidget;
			Margin = new BorderDouble(0, 5);
			VAnchor = Agg.UI.VAnchor.ParentBottomTop;
			BackgroundColor = RGBA_Bytes.LightGray;
		}
コード例 #8
0
ファイル: AboutPage.cs プロジェクト: rubenkar/MatterControl
        public UpdateControl()
        {
            textImageButtonFactory.normalFillColor = ActiveTheme.Instance.PrimaryTextColor;
            textImageButtonFactory.normalTextColor = RGBA_Bytes.Black;

            HAnchor = HAnchor.ParentLeftRight;
            BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
            Padding = new BorderDouble(6, 5);
            {
                updateStatusText = new TextWidget(string.Format(""), textColor: offWhite);
                updateStatusText.AutoExpandBoundsToText = true;
                updateStatusText.VAnchor = VAnchor.ParentCenter;

                GuiWidget horizontalSpacer = new GuiWidget();
                horizontalSpacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

				checkUpdateLink = textImageButtonFactory.Generate(new LocalizedString("Check for Update").Translated);
                checkUpdateLink.VAnchor = VAnchor.ParentCenter;
                checkUpdateLink.Click += CheckForUpdate;
                checkUpdateLink.Visible = false;

				downloadUpdateLink = textImageButtonFactory.Generate(new LocalizedString("Download Update").Translated);
                downloadUpdateLink.VAnchor = VAnchor.ParentCenter;
                downloadUpdateLink.Click += DownloadUpdate;
                downloadUpdateLink.Visible = false;


				installUpdateLink = textImageButtonFactory.Generate(new LocalizedString("Install Update").Translated);
                installUpdateLink.VAnchor = VAnchor.ParentCenter;
                installUpdateLink.Click += InstallUpdate;
                installUpdateLink.Visible = false;

                AddChild(updateStatusText);
                AddChild(horizontalSpacer);
                AddChild(checkUpdateLink);
                AddChild(downloadUpdateLink);
                AddChild(installUpdateLink);
            }

            CheckVersionStatus();
            if (ApplicationSettings.Instance.get("ClientToken") != null)
            {
                //If we have already requested an update once, check on load
                CheckForUpdate(this, null);
            }
            else
            {
                DataStorage.ApplicationSession firstSession;
                firstSession = DataStorage.Datastore.Instance.dbSQLite.Table<DataStorage.ApplicationSession>().OrderBy(v => v.SessionStart).Take(1).FirstOrDefault();
                if (firstSession != null
                    && DateTime.Compare(firstSession.SessionStart.AddDays(7), DateTime.Now) < 0)
                {
                    NeedToCheckForUpdateFirstTimeEver = true;
                }
            }
        }
コード例 #9
0
ファイル: SplitterPage.cs プロジェクト: glocklueng/agg-sharp
		public SplitterPage()
			: base("Nested Splitters")
		{
			Padding = new BorderDouble(10);

			Splitter splitter1 = new Splitter();
			splitter1.Panel1.AddChild(new TextWidget("left"));
			splitter1.Panel2.AddChild(new TextWidget("right"));
			AddChild(splitter1);
		}
コード例 #10
0
		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;
		}
コード例 #11
0
		public WidescreenPanel()
			: base(FlowDirection.LeftToRight)
		{
			Name = "WidescreenPanel";
			AnchorAll();
			BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
			Padding = new BorderDouble(4);

			PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
			ApplicationController.Instance.AdvancedControlsPanelReloading.RegisterEvent((s, e) => UiThread.RunOnIdle(ReloadAdvancedControlsPanel), ref unregisterEvents);
		}
コード例 #12
0
ファイル: TabPagesPage.cs プロジェクト: glocklueng/agg-sharp
		public TabPagesPage()
			: base("Nested Tabs")
		{
			Padding = new BorderDouble(10);

			TabControl control1 = CreatePopulatedTabControl(Orientation.Vertical);
			TabControl control2 = CreatePopulatedTabControl(Orientation.Horizontal);
			control1.GetTabPage(0).AddChild(control2);
			TabControl control3 = CreatePopulatedTabControl(Orientation.Vertical);
			control2.GetTabPage(0).AddChild(control3);
			AddChild(control1);
		}
コード例 #13
0
		public WidescreenPanel()
			: base(FlowDirection.LeftToRight)
		{
			Name = "WidescreenPanel";
			AnchorAll();
			BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
			Padding = new BorderDouble(4);

			ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(LoadSettingsOnPrinterChanged, ref unregisterEvents);
			PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
			ApplicationController.Instance.ReloadAdvancedControlsPanelTrigger.RegisterEvent(ReloadAdvancedControlsPanelTrigger, ref unregisterEvents);
			this.BoundsChanged += new EventHandler(onBoundsChanges);
		}
コード例 #14
0
		public WidescreenPanel()
			: base(FlowDirection.LeftToRight)
		{
			Name = "WidescreenPanel";
			AnchorAll();
			BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
			Padding = new BorderDouble(4);

			// TODO: This hooks seems to invalidate most of the other ActivePrinterChanged subscribers as this destroys and recreates everything
			ActiveSliceSettings.ActivePrinterChanged.RegisterEvent((s, e) => ApplicationController.Instance.ReloadAll(null, null), ref unregisterEvents);

			PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
			ApplicationController.Instance.ReloadAdvancedControlsPanelTrigger.RegisterEvent((s, e) => UiThread.RunOnIdle(ReloadAdvancedControlsPanel), ref unregisterEvents);
			this.BoundsChanged += onBoundsChanges;
		}
コード例 #15
0
        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 = this.defaultTextColor;
            comPortLabel.Margin = new BorderDouble(0, 0, 0, 10);
            comPortLabel.HAnchor = HAnchor.ParentLeftRight;

            FlowLayoutWidget comPortWidget = GetComPortWidget();
            comPortWidget.HAnchor = HAnchor.ParentLeftRight;

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

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

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

			printerComPortHelpMessage = new TextWidget(LocalizedString.Get("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."), 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(comPortWidget);
            container.AddChild(comPortMessageContainer);
            container.AddChild(printerComPortHelpMessage);


            container.HAnchor = HAnchor.ParentLeftRight;
            return container;
        }
コード例 #16
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;
        }
コード例 #17
0
        public FlowLayoutWidget createPrinterConnectionMessageContainer()
        {

            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
            container.VAnchor = VAnchor.ParentBottomTop;
            container.Margin = new BorderDouble(5);            
            BorderDouble elementMargin = new BorderDouble(top: 5);

			TextWidget printerMessageOne = new TextWidget(new LocalizedString("MatterControl will now attempt to auto-detect printer.").Translated, 0, 0, 10);
            printerMessageOne.Margin = new BorderDouble(0, 10, 0,5);
            printerMessageOne.TextColor = RGBA_Bytes.White;
            printerMessageOne.HAnchor = HAnchor.ParentLeftRight;
            printerMessageOne.Margin = elementMargin;

			string printerMessageTwoTxt = new LocalizedString("Disconnect printer").Translated;
			string printerMessageTwoTxtEnd = new LocalizedString("if currently connected").Translated;
			string printerMessageTwoTxtFull = string.Format ("1.) {0} ({1}).", printerMessageTwoTxt, printerMessageTwoTxtEnd);
			TextWidget printerMessageTwo = new TextWidget(printerMessageTwoTxtFull, 0, 0, 12);
            printerMessageTwo.TextColor = RGBA_Bytes.White;
            printerMessageTwo.HAnchor = HAnchor.ParentLeftRight;
            printerMessageTwo.Margin = elementMargin;

			string printerMessageThreeTxt = new LocalizedString("Press").Translated;
			string printerMessageThreeTxtEnd = new LocalizedString ("Continue").Translated;
			string printerMessageThreeFull = string.Format ("2.) {0} '{1}'.", printerMessageThreeTxt, printerMessageThreeTxtEnd);
			TextWidget printerMessageThree = new TextWidget(printerMessageThreeFull, 0, 0, 12);
            printerMessageThree.TextColor = RGBA_Bytes.White;
            printerMessageThree.HAnchor = HAnchor.ParentLeftRight;
            printerMessageThree.Margin = elementMargin;

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

			Button manualLink = linkButtonFactory.Generate(new LocalizedString("Manual Configuration").Translated);
            manualLink.Margin = new BorderDouble(0, 5);
            manualLink.Click += new ButtonBase.ButtonEventHandler(ManualLink_Click);

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

            container.HAnchor = HAnchor.ParentLeftRight;
            return container;            
        }
コード例 #18
0
		public MHTextEditWidget(string text = "", double x = 0, double y = 0, double pointSize = 12, double pixelWidth = 0, double pixelHeight = 0, bool multiLine = false, int tabIndex = 0, string messageWhenEmptyAndNotSelected = "")
		{
			Padding = new BorderDouble(3);
			actuallTextEditWidget = new TextEditWidget(text, x, y, pointSize, pixelWidth, pixelHeight, multiLine, tabIndex: tabIndex);
			actuallTextEditWidget.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			actuallTextEditWidget.MinimumSize = new Vector2(Math.Max(actuallTextEditWidget.MinimumSize.x, pixelWidth), Math.Max(actuallTextEditWidget.MinimumSize.y, pixelHeight));
			actuallTextEditWidget.VAnchor = Agg.UI.VAnchor.ParentBottom;
			AddChild(actuallTextEditWidget);
			BackgroundColor = RGBA_Bytes.White;
			HAnchor = HAnchor.FitToChildren;
			VAnchor = VAnchor.FitToChildren;

			noContentFieldDescription = new TextWidget(messageWhenEmptyAndNotSelected, textColor: RGBA_Bytes.Gray);
			noContentFieldDescription.VAnchor = VAnchor.ParentBottom;
			noContentFieldDescription.AutoExpandBoundsToText = true;
			AddChild(noContentFieldDescription);
			SetNoContentFieldDescriptionVisibility();
		}
コード例 #19
0
		public UpdateControlView()
		{
			textImageButtonFactory.normalFillColor = RGBA_Bytes.Gray;
			textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;

			HAnchor = HAnchor.ParentLeftRight;
			BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
			Padding = new BorderDouble(6, 5);
			{
				updateStatusText = new TextWidget(string.Format(""), textColor: ActiveTheme.Instance.PrimaryTextColor);
				updateStatusText.AutoExpandBoundsToText = true;
				updateStatusText.VAnchor = VAnchor.ParentCenter;

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

				checkUpdateLink = textImageButtonFactory.Generate("Check for Update".Localize());
				checkUpdateLink.VAnchor = VAnchor.ParentCenter;
				checkUpdateLink.Click += CheckForUpdate;
				checkUpdateLink.Visible = false;

				downloadUpdateLink = textImageButtonFactory.Generate("Download Update".Localize());
				downloadUpdateLink.VAnchor = VAnchor.ParentCenter;
				downloadUpdateLink.Click += DownloadUpdate;
				downloadUpdateLink.Visible = false;

				installUpdateLink = textImageButtonFactory.Generate("Install Update".Localize());
				installUpdateLink.VAnchor = VAnchor.ParentCenter;
				installUpdateLink.Click += InstallUpdate;
				installUpdateLink.Visible = false;

				AddChild(updateStatusText);
				AddChild(horizontalSpacer);
				AddChild(checkUpdateLink);
				AddChild(downloadUpdateLink);
				AddChild(installUpdateLink);
			}

			UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(UpdateStatusChanged, ref unregisterEvents);

			MinimumSize = new VectorMath.Vector2(0, 50);

			UpdateStatusChanged(null, null);
		}
コード例 #20
0
		public SetupStepConfigureConnection(ConnectionWizard connectionWizard) : base(connectionWizard)
		{
			BorderDouble elementMargin = new BorderDouble(top: 5);

			var 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;

			var 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;

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

			var container = new FlowLayoutWidget(FlowDirection.TopToBottom);
			container.Margin = new BorderDouble(5);
			container.AddChild(continueMessage);
			container.AddChild(continueMessageTwo);
			container.AddChild(printerErrorMessage);
			container.HAnchor = HAnchor.ParentLeftRight;

			//Construct buttons
			var nextButton = textImageButtonFactory.Generate("Connect");
			nextButton.Click += (s, e) => base.connectionWizard.ChangeToSetupBaudOrComPortOne();

			var skipButton = textImageButtonFactory.Generate("Skip");
			skipButton.Click += (s, e) => SaveAndExit();

			//Add buttons to buttonContainer
			footerRow.AddChild(nextButton);
			footerRow.AddChild(skipButton);
			footerRow.AddChild(new HorizontalSpacer());
			footerRow.AddChild(cancelButton);
		}
コード例 #21
0
		private FlowLayoutWidget createPrinterDriverContainer()
		{
			FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
			container.Margin = new BorderDouble(0, 5);
			BorderDouble elementMargin = new BorderDouble(top: 3);

			printerDriverMessage = new TextWidget(LocalizedString.Get("This printer requires a driver for communication."), 0, 0, 10);
			printerDriverMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			printerDriverMessage.HAnchor = HAnchor.ParentLeftRight;
			printerDriverMessage.Margin = elementMargin;

			TextWidget printerDriverMessageTwo = new TextWidget(LocalizedString.Get("Driver located. Would you like to install?"), 0, 0, 10);
			printerDriverMessageTwo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			printerDriverMessageTwo.HAnchor = HAnchor.ParentLeftRight;
			printerDriverMessageTwo.Margin = elementMargin;

			container.AddChild(printerDriverMessage);
			container.AddChild(printerDriverMessageTwo);

			container.HAnchor = HAnchor.ParentLeftRight;
			return container;
		}
コード例 #22
0
		public ViewControlsToggle()
		{
			TextImageButtonFactory iconTextImageButtonFactory = new TextImageButtonFactory();
			iconTextImageButtonFactory.AllowThemeToAdjustImage = false;

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

			string translateIconPath = Path.Combine("ViewTransformControls", "2d.png");
			twoDimensionButton = iconTextImageButtonFactory.GenerateRadioButton("", translateIconPath);
			twoDimensionButton.Margin = new BorderDouble(3);
			AddChild(twoDimensionButton);

			string scaleIconPath = Path.Combine("ViewTransformControls", "3d.png");
			threeDimensionButton = iconTextImageButtonFactory.GenerateRadioButton("", scaleIconPath);
			threeDimensionButton.Margin = new BorderDouble(3);
			AddChild(threeDimensionButton);

			Margin = new BorderDouble(5,5,195,5);
			HAnchor |= Agg.UI.HAnchor.ParentRight;
			VAnchor = Agg.UI.VAnchor.ParentTop;
			string defaultView = UserSettings.Instance.get ("LayerViewDefault");

			if (defaultView == null) 
			{
				UserSettings.Instance.set ("LayerViewDefault", "2D Layer");
			}

			if (defaultView == "2D Layer") {
				twoDimensionButton.Checked = true;
			} else if (defaultView == "3D Layer") {
				threeDimensionButton.Checked = true;
			} else {
				twoDimensionButton.Checked = true;
			}

		}
コード例 #23
0
        public ViewControls2D()
        {
            TextImageButtonFactory iconTextImageButtonFactory = new TextImageButtonFactory();
            iconTextImageButtonFactory.AllowThemeToAdjustImage = false;

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

            string translateIconPath = Path.Combine("ViewTransformControls", "translate.png");
            translateButton = iconTextImageButtonFactory.GenerateRadioButton("", translateIconPath);
            translateButton.Margin = new BorderDouble(3);
            AddChild(translateButton);

            string scaleIconPath = Path.Combine("ViewTransformControls", "scale.png");
            scaleButton = iconTextImageButtonFactory.GenerateRadioButton("", scaleIconPath);
            scaleButton.Margin = new BorderDouble(3);
            AddChild(scaleButton);

            Margin = new BorderDouble(5);
            HAnchor |= Agg.UI.HAnchor.ParentLeft;
            VAnchor = Agg.UI.VAnchor.ParentTop;
            translateButton.Checked = true;
        }
コード例 #24
0
		//Set Defaults
		public DropDownButtonBase(string label, RGBA_Bytes fillColor, RGBA_Bytes borderColor, RGBA_Bytes textColor, double borderWidth, BorderDouble margin, int fontSize = 12, FlowDirection flowDirection = FlowDirection.LeftToRight, double height = 40)
		{
			FlowLayoutWidget container = new FlowLayoutWidget();
			container.Padding = new BorderDouble(0);
			container.Margin = new BorderDouble(0);
			if (label != "")
			{
				TextWidget text = new TextWidget(label, pointSize: fontSize, textColor: textColor);
				text.VAnchor = VAnchor.ParentCenter;
				text.Padding = new BorderDouble(0, 0);
				container.AddChild(text);
			}

			GuiWidget arrow = new GuiWidget(20, height);
			arrow.VAnchor = VAnchor.ParentCenter;
			container.AddChild(arrow);
			this.AddChild(container);

			this.Padding = new BorderDouble(0, 0);
			this.fillColor = fillColor;
			this.borderColor = borderColor;
			this.borderWidth = borderWidth;
			this.HAnchor = HAnchor.FitToChildren;
		}
コード例 #25
0
        public WizardControl()
        {
            Padding = new BorderDouble(10);
            textImageButtonFactory.normalTextColor = RGBA_Bytes.White;
            textImageButtonFactory.hoverTextColor = RGBA_Bytes.White;
            textImageButtonFactory.disabledTextColor = new RGBA_Bytes(200, 200, 200);
            textImageButtonFactory.disabledFillColor = new RGBA_Bytes(0, 0, 0, 0);
            textImageButtonFactory.pressedTextColor = RGBA_Bytes.White;

            AnchorAll();
            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            bottomToTopLayout = new FlowLayoutWidget(FlowDirection.BottomToTop);
            FlowLayoutWidget buttonBar = new FlowLayoutWidget();

            textImageButtonFactory.FixedWidth = 60;
			backButton = textImageButtonFactory.Generate(new LocalizedString("Back").Translated, centerText: true);
            backButton.Click += new ButtonBase.ButtonEventHandler(back_Click);

			nextButton = textImageButtonFactory.Generate(new LocalizedString("Next").Translated, centerText: true);
            nextButton.Click += new ButtonBase.ButtonEventHandler(next_Click);

			doneButton = textImageButtonFactory.Generate(new LocalizedString("Done").Translated, centerText: true);
            doneButton.Click += new ButtonBase.ButtonEventHandler(done_Click);

            textImageButtonFactory.FixedWidth = 0;

            buttonBar.AddChild(backButton);
            buttonBar.AddChild(nextButton);
            buttonBar.AddChild(doneButton);

            bottomToTopLayout.AddChild(buttonBar);
            bottomToTopLayout.AnchorAll();

            AddChild(bottomToTopLayout);
        }
コード例 #26
0
		public RadioButton GenerateRadioButton(string label, string iconImageName = null)
		{
			ImageBuffer iconImage = null;

			if (iconImageName != null)
			{
				iconImage = StaticData.Instance.LoadIcon(iconImageName);
				if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
				{
					InvertLightness.DoInvertLightness(iconImage);
				}
			}

			BorderDouble internalMargin = new BorderDouble(0);
			TextImageWidget nomalState = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
			TextImageWidget hoverState = new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
			TextImageWidget checkingState = new TextImageWidget(label, hoverFillColor, checkedBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
			TextImageWidget checkedState = new TextImageWidget(label, pressedFillColor, checkedBorderColor, pressedTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
			TextImageWidget disabledState = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
			RadioButtonViewStates checkBoxButtonViewWidget = new RadioButtonViewStates(nomalState, hoverState, checkingState, checkedState, disabledState);
			RadioButton radioButton = new RadioButton(checkBoxButtonViewWidget);
			radioButton.Margin = Margin;
			return radioButton;
		}
コード例 #27
0
		private void SetColumnVisibility(object state = null)
		{
			int numberOfPanels = NumberOfVisiblePanels();

			switch (numberOfPanels)
			{
				case 1:
					{
						ColumnTwo.Visible = false;
						ColumnOne.Visible = true;

						Padding = new BorderDouble(0);

						leftBorderLine.Visible = false;
					}
					break;

				case 2:
					Padding = new BorderDouble(4);
					ColumnOne.Visible = true;
					ColumnTwo.Visible = true;
					ColumnOne.HAnchor = HAnchor.AbsolutePosition;
					ColumnOne.Width = ColumnOneFixedWidth; // it can hold the slice settings so it needs to be bigger.
					ColumnOne.MinimumSize = new Vector2(Math.Max(compactSlidePanel.TabBarWidth, ColumnOneFixedWidth), 0); //Ordering here matters - must go after children are added
					break;
			}
		}
コード例 #28
0
		public GuiWidget GetBaudRateWidget()
		{
			FlowLayoutWidget baudRateContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			baudRateContainer.Margin = new BorderDouble(0);

			List<string> baudRates = new List<string> { "115200", "250000" };
			BorderDouble baudRateMargin = new BorderDouble(3, 3, 5, 0);

			foreach (string baudRate in baudRates)
			{
				BaudRateRadioButton baudOption = new BaudRateRadioButton(baudRate);
				BaudRateButtonsList.Add(baudOption);
				baudOption.Margin = baudRateMargin;
				baudOption.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				if (this.ActivePrinter.BaudRate == baudRate)
				{
					baudOption.Checked = true;
				}
				baudRateContainer.AddChild(baudOption);
			}

			otherBaudRateRadioButton = new RadioButton(LocalizedString.Get("Other"));
			otherBaudRateRadioButton.Margin = baudRateMargin;
			otherBaudRateRadioButton.TextColor = ActiveTheme.Instance.PrimaryTextColor;

			baudRateContainer.AddChild(otherBaudRateRadioButton);

			//See if the baud rate of the current print is in the list of displayed rates,
			//flag the 'other' option if it is not and prefill the rate.
			otherBaudRateInput = new MHTextEditWidget("");
			otherBaudRateInput.Visible = false;
			otherBaudRateInput.HAnchor = HAnchor.ParentLeftRight;

			if (this.ActivePrinter.BaudRate != null)
			{
				if (!baudRates.Contains(this.ActivePrinter.BaudRate.ToString()))
				{
					otherBaudRateRadioButton.Checked = true;
					otherBaudRateInput.Text = this.ActivePrinter.BaudRate.ToString();
					otherBaudRateInput.Visible = true;
				}
			}

			baudRateContainer.AddChild(otherBaudRateInput);
			return baudRateContainer;
		}
コード例 #29
0
		private FlowLayoutWidget CreateRightButtonPanel(double buildHeight)
		{
			FlowLayoutWidget buttonRightPanel = new FlowLayoutWidget(FlowDirection.TopToBottom);
			buttonRightPanel.Width = 200;
			{
				BorderDouble buttonMargin = new BorderDouble(top: 3);

				expandRotateOptions = expandMenuOptionFactory.GenerateCheckBoxButton(LocalizedString.Get("Rotate"), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png");
				expandRotateOptions.Margin = new BorderDouble(bottom: 2);
				buttonRightPanel.AddChild(expandRotateOptions);

				rotateOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
				rotateOptionContainer.HAnchor = HAnchor.ParentLeftRight;
				rotateOptionContainer.Visible = false;
				buttonRightPanel.AddChild(rotateOptionContainer);

				expandScaleOptions = expandMenuOptionFactory.GenerateCheckBoxButton(LocalizedString.Get("Scale"), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png");
				expandScaleOptions.Margin = new BorderDouble(bottom: 2);
				buttonRightPanel.AddChild(expandScaleOptions);

				scaleOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
				scaleOptionContainer.HAnchor = HAnchor.ParentLeftRight;
				scaleOptionContainer.Visible = false;
				buttonRightPanel.AddChild(scaleOptionContainer);

				// put in the mirror options
				{
					expandMirrorOptions = expandMenuOptionFactory.GenerateCheckBoxButton(LocalizedString.Get("Mirror"), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png");
					expandMirrorOptions.Margin = new BorderDouble(bottom: 2);
					buttonRightPanel.AddChild(expandMirrorOptions);

					mirrorOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
					mirrorOptionContainer.HAnchor = HAnchor.ParentLeftRight;
					mirrorOptionContainer.Visible = false;
					buttonRightPanel.AddChild(mirrorOptionContainer);

					AddMirrorControls(mirrorOptionContainer);
				}

				// put in the material options
				int numberOfExtruders = ActiveSliceSettings.Instance.ExtruderCount;

				expandMaterialOptions = expandMenuOptionFactory.GenerateCheckBoxButton(LocalizedString.Get("Material"), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png");
				expandMaterialOptions.Margin = new BorderDouble(bottom: 2);

				if (numberOfExtruders > 1)
				{
					buttonRightPanel.AddChild(expandMaterialOptions);

					materialOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
					materialOptionContainer.HAnchor = HAnchor.ParentLeftRight;
					materialOptionContainer.Visible = false;

					buttonRightPanel.AddChild(materialOptionContainer);
					AddMaterialControls(materialOptionContainer);
				}

				// put in the view options
				{
					expandViewOptions = expandMenuOptionFactory.GenerateCheckBoxButton(LocalizedString.Get("Display"), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png");
					expandViewOptions.Margin = new BorderDouble(bottom: 2);
					buttonRightPanel.AddChild(expandViewOptions);

					viewOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
					viewOptionContainer.HAnchor = HAnchor.ParentLeftRight;
					viewOptionContainer.Padding = new BorderDouble(left: 4);
					viewOptionContainer.Visible = false;
					{
						CheckBox showBedCheckBox = new CheckBox(LocalizedString.Get("Show Print Bed"), textColor: ActiveTheme.Instance.PrimaryTextColor);
						showBedCheckBox.Checked = true;
						showBedCheckBox.CheckedStateChanged += (sender, e) =>
						{
							meshViewerWidget.RenderBed = showBedCheckBox.Checked;
						};
						viewOptionContainer.AddChild(showBedCheckBox);

						if (buildHeight > 0)
						{
							CheckBox showBuildVolumeCheckBox = new CheckBox(LocalizedString.Get("Show Print Area"), textColor: ActiveTheme.Instance.PrimaryTextColor);
							showBuildVolumeCheckBox.Checked = false;
							showBuildVolumeCheckBox.Margin = new BorderDouble(bottom: 5);
							showBuildVolumeCheckBox.CheckedStateChanged += (sender, e) =>
							{
								meshViewerWidget.RenderBuildVolume = showBuildVolumeCheckBox.Checked;
							};
							viewOptionContainer.AddChild(showBuildVolumeCheckBox);
						}

						if (ActiveTheme.Instance.IsTouchScreen)
						{
							UserSettings.Instance.set("defaultRenderSetting", RenderTypes.Shaded.ToString());
						}
						else
						{
							CreateRenderTypeRadioButtons(viewOptionContainer);
						}
					}
					buttonRightPanel.AddChild(viewOptionContainer);
				}

				GuiWidget verticalSpacer = new GuiWidget();
				verticalSpacer.VAnchor = VAnchor.ParentBottomTop;
				buttonRightPanel.AddChild(verticalSpacer);
			}

			buttonRightPanel.Padding = new BorderDouble(6, 6);
			buttonRightPanel.Margin = new BorderDouble(0, 1);
			buttonRightPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
			buttonRightPanel.VAnchor = VAnchor.ParentBottomTop;

			return buttonRightPanel;
		}
コード例 #30
0
 public static BorderDouble Clone(this BorderDouble source, double left = double.MinValue, double bottom = double.MinValue, double right = double.MinValue, double top = double.MinValue)
 {
     return(new BorderDouble(source, left, bottom, right, top));
 }
コード例 #31
0
		private FlowLayoutWidget createPrinterModelContainer(string make = "Other")
		{
			FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
			container.Margin = new BorderDouble(0, 5);
			BorderDouble elementMargin = new BorderDouble(top: 3);

			string printerModelLabelTxt = LocalizedString.Get("Select Model");
			string printerModelLabelTxtFull = string.Format("{0}:", printerModelLabelTxt);
			TextWidget printerModelLabel = new TextWidget(printerModelLabelTxtFull, 0, 0, 12);
			printerModelLabel.TextColor = this.defaultTextColor;
			printerModelLabel.HAnchor = HAnchor.ParentLeftRight;
			printerModelLabel.Margin = elementMargin;

			ModelChooser printerModelSelector = new ModelChooser(make);
			printerModelSelector.HAnchor = HAnchor.ParentLeftRight;
			printerModelSelector.Margin = elementMargin;
			printerModelSelector.ModelDropList.SelectionChanged += new EventHandler(ModelDropList_SelectionChanged);
			printerModelSelector.SelectIfOnlyOneModel();

			printerModelError = new TextWidget(LocalizedString.Get("Select the printer model"), 0, 0, 10);
			printerModelError.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			printerModelError.HAnchor = HAnchor.ParentLeftRight;
			printerModelError.Margin = elementMargin;

			container.AddChild(printerModelLabel);
			container.AddChild(printerModelSelector);
			container.AddChild(printerModelError);

			container.HAnchor = HAnchor.ParentLeftRight;
			return container;
		}