コード例 #1
0
        public SetupOptionsPage()
            : base("Done")
        {
            headerLabel.Text = "Setup Options".Localize();

            textImageButtonFactory.borderWidth       = 1;
            textImageButtonFactory.normalBorderColor = RGBA_Bytes.White;

            contentRow.AddChild(new SetupPrinterView(this.textImageButtonFactory)
            {
                WizardPage = this
            });
            contentRow.AddChild(new SetupAccountView(this.textImageButtonFactory));

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

            cancelButton.Text = "Back".Localize();

#if ANDROID_T7X
            headerRow.AddChild(new HorizontalSpacer());
            var powerImage  = StaticData.Instance.LoadIcon("power.png", 32, 32);
            var powerButton = new TextImageButtonFactory()
            {
                FixedHeight = 42, Margin = new BorderDouble(0, 0, 10, 0), borderWidth = 0
            }.GenerateTooltipButton("", powerImage);
            powerButton.Click   += (s, e) => MatterControlApplication.Instance.RequestPowerShutDown();
            powerButton.VAnchor |= VAnchor.ParentCenter;
            headerRow.AddChild(powerButton);
#endif
        }
コード例 #2
0
        public CompactSlidePanel(QueueDataView queueDataView) : base(2)
        {
            this.queueDataView = queueDataView;

            // do the front panel stuff
            {
                // first add the print progress bar
                this.LeftPanel.AddChild(new PrintProgressBar());

                // construct the main controls tab control
                mainControlsTabControl = new FirstPanelTabView(queueDataView);

                var advancedControlsButtonFactory = new TextImageButtonFactory()
                {
                    normalTextColor  = ActiveTheme.Instance.PrimaryTextColor,
                    hoverTextColor   = ActiveTheme.Instance.PrimaryTextColor,
                    pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
                    fontSize         = 10,

                    disabledTextColor   = RGBA_Bytes.LightGray,
                    disabledFillColor   = ActiveTheme.Instance.PrimaryBackgroundColor,
                    disabledBorderColor = ActiveTheme.Instance.PrimaryBackgroundColor,

                    invertImageLocation = true
                };

                Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Settings\n& Controls"),
                                                                                           StaticData.Instance.LoadIcon("icon_arrow_right_32x32.png", 32, 32));
                advancedControlsLinkButton.Name        = "SettingsAndControls";
                advancedControlsLinkButton.ToolTipText = "Switch to Settings, Controls and Options".Localize();
                advancedControlsLinkButton.Margin      = new BorderDouble(right: 3);
                advancedControlsLinkButton.VAnchor     = VAnchor.ParentBottom;
                advancedControlsLinkButton.Cursor      = Cursors.Hand;
                advancedControlsLinkButton.Click      += ToggleActivePanel_Click;

                mainControlsTabControl.TabBar.AddChild(new HorizontalSpacer());
                mainControlsTabControl.TabBar.AddChild(advancedControlsLinkButton);
                mainControlsTabControl.TabBar.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
                mainControlsTabControl.HAnchor        = HAnchor.Max_FitToChildren_ParentWidth;

                this.LeftPanel.AddChild(mainControlsTabControl);
            }

            // Right panel
            this.RightPanel.AddChild(new PrintProgressBar());

            var advancedControlsPanel = new AdvancedControlsPanel()
            {
                Name = "For - CompactSlidePanel"
            };

            advancedControlsPanel.BackClicked += ToggleActivePanel_Click;

            this.RightPanel.AddChild(advancedControlsPanel);

            WidescreenPanel.PreChangePanels.RegisterEvent(SaveCurrentPanelIndex, ref unregisterEvents);

            SetPanelIndexImmediate(lastPanelIndexBeforeReload);
        }
コード例 #3
0
		public CompactSlidePanel(QueueDataView queueDataView) : base(2)
		{
			this.queueDataView = queueDataView;

			// do the front panel stuff
			{
				// first add the print progress bar
				this.LeftPanel.AddChild(new PrintProgressBar());

				// construct the main controls tab control
				mainControlsTabControl = new FirstPanelTabView(queueDataView);

				var advancedControlsButtonFactory = new TextImageButtonFactory()
				{
					normalTextColor = ActiveTheme.Instance.PrimaryTextColor,
					hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
					pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
					fontSize = 10,

					disabledTextColor = RGBA_Bytes.LightGray,
					disabledFillColor = ActiveTheme.Instance.PrimaryBackgroundColor,
					disabledBorderColor = ActiveTheme.Instance.PrimaryBackgroundColor,

					invertImageLocation = true
				};

				Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Settings\n& Controls"), 
					StaticData.Instance.LoadIcon("icon_arrow_right_32x32.png", 32,32));
				advancedControlsLinkButton.Name = "SettingsAndControls";
				advancedControlsLinkButton.ToolTipText = "Switch to Settings, Controls and Options".Localize();
				advancedControlsLinkButton.Margin = new BorderDouble(right: 3);
				advancedControlsLinkButton.VAnchor = VAnchor.ParentBottom;
				advancedControlsLinkButton.Cursor = Cursors.Hand;
				advancedControlsLinkButton.Click += ToggleActivePanel_Click;

				mainControlsTabControl.TabBar.AddChild(new HorizontalSpacer());
				mainControlsTabControl.TabBar.AddChild(advancedControlsLinkButton);
				mainControlsTabControl.TabBar.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
				mainControlsTabControl.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;

				this.LeftPanel.AddChild(mainControlsTabControl);
			}

			// Right panel
			this.RightPanel.AddChild(new PrintProgressBar());

			var advancedControlsPanel = new AdvancedControlsPanel()
			{
				Name = "For - CompactSlidePanel"
			};
			advancedControlsPanel.BackClicked += ToggleActivePanel_Click;

			this.RightPanel.AddChild(advancedControlsPanel);

			WidescreenPanel.PreChangePanels.RegisterEvent(SaveCurrentPanelIndex, ref unregisterEvents);

			SetPanelIndexImmediate(lastPanelIndexBeforeReload);
		}
コード例 #4
0
		public CompactSlidePanel(QueueDataView queueDataView)
			: base(2)
		{
			this.queueDataView = queueDataView;

			// do the front panel stuff
			{
				// first add the print progress bar
				this.LeftPanel.AddChild(new PrintProgressBar());

				// construct the main controls tab control
				mainControlsTabControl = new FirstPanelTabView(queueDataView);

				TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
				advancedControlsButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
				advancedControlsButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
				advancedControlsButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
				advancedControlsButtonFactory.fontSize = 10;

				advancedControlsButtonFactory.disabledTextColor = RGBA_Bytes.LightGray;
				advancedControlsButtonFactory.disabledFillColor = ActiveTheme.Instance.PrimaryBackgroundColor;
				advancedControlsButtonFactory.disabledBorderColor = ActiveTheme.Instance.PrimaryBackgroundColor;

				advancedControlsButtonFactory.invertImageLocation = true;
				Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Settings\n& Controls"), "icon_arrow_right_32x32.png");
                advancedControlsLinkButton.Name = "SettingsAndControls";
                advancedControlsLinkButton.ToolTipText = "Switch to Settings, Controls and Options".Localize();
                advancedControlsLinkButton.Margin = new BorderDouble(right: 3);
				advancedControlsLinkButton.VAnchor = VAnchor.ParentBottom;
				advancedControlsLinkButton.Cursor = Cursors.Hand;
				advancedControlsLinkButton.Click += new EventHandler(AdvancedControlsButton_Click);
				advancedControlsLinkButton.MouseEnterBounds += new EventHandler(onMouseEnterBoundsAdvancedControlsLink);
				advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsAdvancedControlsLink);

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

				mainControlsTabControl.TabBar.AddChild(hSpacer);
				mainControlsTabControl.TabBar.AddChild(advancedControlsLinkButton);
				mainControlsTabControl.TabBar.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
				mainControlsTabControl.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;

				this.LeftPanel.AddChild(mainControlsTabControl);
			}

			// do the right panel
			{
				this.RightPanel.AddChild(new PrintProgressBar());
				ThirdPanelTabView thirdPanelTabView = new ThirdPanelTabView(AdvancedControlsButton_Click, onMouseEnterBoundsPrintQueueLink, onMouseLeaveBoundsPrintQueueLink);
				thirdPanelTabView.Name = "For - CompactSlidePanel";
				this.RightPanel.AddChild(thirdPanelTabView);
			}

			WidescreenPanel.PreChangePanels.RegisterEvent(SaveCurrentPanelIndex, ref unregisterEvents);

			SetPanelIndexImediate(lastPanelIndexBeforeReload);
		}
コード例 #5
0
        public CompactSlidePanel(QueueDataView queueDataView)
            : base(2)
        {
            this.queueDataView = queueDataView;

            // do the front panel stuff
            {
                // first add the print progress bar
                this.LeftPanel.AddChild(new PrintProgressBar());

                // construct the main controls tab control
                mainControlsTabControl = new FirstPanelTabView(queueDataView);

                TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
                advancedControlsButtonFactory.normalTextColor  = ActiveTheme.Instance.PrimaryTextColor;
                advancedControlsButtonFactory.hoverTextColor   = ActiveTheme.Instance.PrimaryTextColor;
                advancedControlsButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
                advancedControlsButtonFactory.fontSize         = 10;

                advancedControlsButtonFactory.disabledTextColor   = RGBA_Bytes.LightGray;
                advancedControlsButtonFactory.disabledFillColor   = ActiveTheme.Instance.PrimaryBackgroundColor;
                advancedControlsButtonFactory.disabledBorderColor = ActiveTheme.Instance.PrimaryBackgroundColor;

                advancedControlsButtonFactory.invertImageLocation = true;
                Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Settings\n& Controls"), "icon_arrow_right_32x32.png");
                advancedControlsLinkButton.Name              = "SettingsAndControls";
                advancedControlsLinkButton.ToolTipText       = "Switch to Settings, Controls and Options".Localize();
                advancedControlsLinkButton.Margin            = new BorderDouble(right: 3);
                advancedControlsLinkButton.VAnchor           = VAnchor.ParentBottom;
                advancedControlsLinkButton.Cursor            = Cursors.Hand;
                advancedControlsLinkButton.Click            += new EventHandler(AdvancedControlsButton_Click);
                advancedControlsLinkButton.MouseEnterBounds += new EventHandler(onMouseEnterBoundsAdvancedControlsLink);
                advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsAdvancedControlsLink);

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

                mainControlsTabControl.TabBar.AddChild(hSpacer);
                mainControlsTabControl.TabBar.AddChild(advancedControlsLinkButton);
                mainControlsTabControl.TabBar.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
                mainControlsTabControl.HAnchor        = HAnchor.Max_FitToChildren_ParentWidth;

                this.LeftPanel.AddChild(mainControlsTabControl);
            }

            // do the right panel
            {
                this.RightPanel.AddChild(new PrintProgressBar());
                ThirdPanelTabView thirdPanelTabView = new ThirdPanelTabView(AdvancedControlsButton_Click, onMouseEnterBoundsPrintQueueLink, onMouseLeaveBoundsPrintQueueLink);
                thirdPanelTabView.Name = "For - CompactSlidePanel";
                this.RightPanel.AddChild(thirdPanelTabView);
            }

            WidescreenPanel.PreChangePanels.RegisterEvent(SaveCurrentPanelIndex, ref unregisterEvents);

            SetPanelIndexImediate(lastPanelIndexBeforeReload);
        }
コード例 #6
0
        public SetupAccountView(TextImageButtonFactory textImageButtonFactory)
            : base("My Account")
        {
            this.textImageButtonFactory = textImageButtonFactory;

            bool   signedIn = true;
            string username = AuthenticationData.Instance.ActiveSessionUsername;

            if (username == null)
            {
                signedIn = false;
                username = "******";
            }

            mainContainer.AddChild(new TextWidget(username, pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor));

            FlowLayoutWidget buttonContainer = new FlowLayoutWidget();

            buttonContainer.HAnchor = HAnchor.ParentLeftRight;
            buttonContainer.Margin  = new BorderDouble(0, 14);

            signInButton         = textImageButtonFactory.Generate("Sign In");
            signInButton.Margin  = new BorderDouble(left: 0);
            signInButton.VAnchor = VAnchor.ParentCenter;
            signInButton.Visible = !signedIn;
            signInButton.Click  += (s, e) => UiThread.RunOnIdle(() =>
            {
                signInButton.Visible  = false;
                signOutButton.Visible = false;
                statusMessage.Visible = true;
                ApplicationController.Instance.StartSignIn();
            });
            buttonContainer.AddChild(signInButton);

            signOutButton         = textImageButtonFactory.Generate("Sign Out");
            signOutButton.Margin  = new BorderDouble(left: 0);
            signOutButton.VAnchor = VAnchor.ParentCenter;
            signOutButton.Visible = signedIn;
            signOutButton.Click  += (s, e) => UiThread.RunOnIdle(() =>
            {
                signInButton.Visible  = false;
                signOutButton.Visible = false;
                statusMessage.Visible = true;
                ApplicationController.Instance.StartSignOut();
            });
            buttonContainer.AddChild(signOutButton);

            statusMessage         = new TextWidget("Please wait...", pointSize: 12, textColor: ActiveTheme.Instance.SecondaryAccentColor);
            statusMessage.Visible = false;
            buttonContainer.AddChild(statusMessage);

            mainContainer.AddChild(buttonContainer);

            ApplicationController.Instance.DoneReloadingAll.RegisterEvent(RemoveAndNewControl, ref unregisterEvents);
        }
コード例 #7
0
            public CriteriaRow(string itemText, string fixitText, string errorText, bool succeeded, Action fixAction)
                : base(FlowDirection.LeftToRight)
            {
                HAnchor = HAnchor.ParentLeftRight;
                VAnchor = VAnchor.AbsolutePosition;
                TextImageButtonFactory buttonFactory = new TextImageButtonFactory();

                ErrorText = errorText;

                base.Height = 40;

                base.AddChild(new TextWidget(string.Format("  {0}. {1}", criteriaCount + 1, itemText))
                {
                    TextColor = stillSuccessful ? RGBA_Bytes.White : disabledTextColor,
                    VAnchor   = VAnchor.ParentCenter
                });

                if (stillSuccessful && !succeeded)
                {
                    ActiveErrorItem = this;
                }

                base.AddChild(new HorizontalSpacer());

                if (stillSuccessful)
                {
                    if (succeeded)
                    {
                        // Add checkmark image
                        AddSuccessIcon();
                    }
                    else
                    {
                        // Add Fix button
                        Button button = buttonFactory.Generate(LocalizedString.Get(fixitText), centerText: true);
                        button.VAnchor = VAnchor.ParentCenter;
                        button.Padding = new BorderDouble(3, 8);
                        button.Click  += (sender, e) => fixAction();
                        base.AddChild(button);
                    }
                }

                if (stillSuccessful)
                {
                    this.BackgroundColor = (criteriaCount % 2 == 0) ? RGBA_Bytes.Gray : toggleColor;
                }
                else
                {
                    this.BackgroundColor = disabledBackColor;
                }

                stillSuccessful &= succeeded;

                criteriaCount++;
            }
コード例 #8
0
        private GuiWidget CreateContentForEmptyControl()
        {
            GuiWidget allContent = new GuiWidget()
            {
                HAnchor = HAnchor.ParentLeftRight,
                VAnchor = VAnchor.ParentBottomTop,
            };

            allContent.Padding = new BorderDouble(5, 10, 5, 10);

            FlowLayoutWidget flowWidget = new FlowLayoutWidget();

            flowWidget.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
            flowWidget.HAnchor         = HAnchor.ParentLeftRight;
            flowWidget.VAnchor         = VAnchor.ParentTop;
            flowWidget.Padding         = new BorderDouble(10, 0);
            flowWidget.Height          = 60;

            TextImageButtonFactory bringBackButtonFactory = new TextImageButtonFactory();

            bringBackButtonFactory.normalFillColor = RGBA_Bytes.Gray;
            bringBackButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;

            Button bringBackToTabButton = bringBackButtonFactory.Generate("Restore".Localize());

            bringBackToTabButton.ToolTipText = "Bring the Window back into this Tab".Localize();
            bringBackToTabButton.VAnchor     = VAnchor.ParentCenter;
            bringBackToTabButton.Cursor      = Cursors.Hand;
            bringBackToTabButton.Click      += (sender, e) =>
            {
                UiThread.RunOnIdle(() =>
                {
                    SaveWindowShouldStartClosed();
                    SystemWindow temp = systemWindowWithPopContent;
                    SystemWindow_Closing(null, null);
                    temp.Close();
                });
            };

            TextWidget windowedModeMessage = new TextWidget("WINDOWED MODE: This tab has been moved to a separate window.".Localize(),
                                                            pointSize: 10, textColor: ActiveTheme.Instance.PrimaryTextColor);

            windowedModeMessage.VAnchor = VAnchor.ParentCenter;

            flowWidget.AddChild(windowedModeMessage);
            flowWidget.AddChild(new HorizontalSpacer());
            flowWidget.AddChild(bringBackToTabButton);

            allContent.AddChild(flowWidget);

            return(allContent);
        }
コード例 #9
0
        public SetupPrinterView(TextImageButtonFactory textImageButtonFactory)
            : base("Printer Profile")
        {
            this.textImageButtonFactory = textImageButtonFactory;

            var buttonContainer = new FlowLayoutWidget()
            {
                HAnchor = HAnchor.ParentLeftRight,
                Margin  = new BorderDouble(0, 14)
            };

            mainContainer.AddChild(buttonContainer);

            var printerSelectorAndEditButton = new FlowLayoutWidget()
            {
                HAnchor = HAnchor.ParentLeftRight,
            };

            buttonContainer.AddChild(printerSelectorAndEditButton);

            var printerSelector = new PrinterSelector();

            printerSelector.AddPrinter += (s, e) => WizardPage.WizardWindow.ChangeToSetupPrinterForm(true);
            printerSelectorAndEditButton.AddChild(printerSelector);

            var editButton = TextImageButtonFactory.GetThemedEditButton();

            editButton.ToolTipText = "Edit Selected Setting".Localize();
            editButton.VAnchor     = VAnchor.ParentCenter;
            editButton.Click      += UiNavigation.OpenEditPrinterWizard_Click;
            printerSelectorAndEditButton.AddChild(editButton);

            disconnectButton         = textImageButtonFactory.Generate("Disconnect");
            disconnectButton.Margin  = new BorderDouble(left: 12);
            disconnectButton.VAnchor = VAnchor.ParentCenter;
            disconnectButton.Click  += (sender, e) =>
            {
                PrinterConnectionAndCommunication.Instance.Disable();
                UiThread.RunOnIdle(WizardPage.WizardWindow.ChangeToPage <SetupOptionsPage>);
            };
            buttonContainer.AddChild(disconnectButton);

            connectionStatus = new TextWidget("Status:", pointSize: 12, textColor: ActiveTheme.Instance.PrimaryTextColor)
            {
                HAnchor = HAnchor.ParentLeftRight
            };
            mainContainer.AddChild(connectionStatus);

            PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(updateConnectedState, ref unregisterEvents);
            updateConnectedState(null, null);
        }
コード例 #10
0
		private Button CreateDefaultButton(string buttonText)
		{
			TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
			buttonFactory.FixedHeight = 30 * TextWidget.GlobalPointSizeScaleRatio;
			buttonFactory.normalFillColor = RGBA_Bytes.White;
			buttonFactory.normalTextColor = RGBA_Bytes.Black;
			buttonFactory.hoverTextColor = RGBA_Bytes.Black;
			buttonFactory.hoverFillColor = new RGBA_Bytes(255, 255, 255, 200);
			buttonFactory.borderWidth = 1;
			buttonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);
			buttonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);

			return buttonFactory.Generate(buttonText, centerText: true);
		}
コード例 #11
0
        private Button CreateDefaultButton(string buttonText)
        {
            TextImageButtonFactory buttonFactory = new TextImageButtonFactory();

            buttonFactory.FixedHeight       = 30 * GuiWidget.DeviceScale;
            buttonFactory.normalFillColor   = RGBA_Bytes.White;
            buttonFactory.normalTextColor   = RGBA_Bytes.Black;
            buttonFactory.hoverTextColor    = RGBA_Bytes.Black;
            buttonFactory.hoverFillColor    = new RGBA_Bytes(255, 255, 255, 200);
            buttonFactory.borderWidth       = 1;
            buttonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);
            buttonFactory.hoverBorderColor  = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);

            return(buttonFactory.Generate(buttonText, centerText: true));
        }
コード例 #12
0
		public SetupPrinterView(TextImageButtonFactory textImageButtonFactory)
			: base("Printer Profile")
		{
			this.textImageButtonFactory = textImageButtonFactory;

			var buttonContainer = new FlowLayoutWidget()
			{
				HAnchor = HAnchor.ParentLeftRight,
				Margin = new BorderDouble (0, 14)
			};
			mainContainer.AddChild(buttonContainer);

			var printerSelectorAndEditButton = new FlowLayoutWidget()
			{
				HAnchor = HAnchor.ParentLeftRight,
			};
			buttonContainer.AddChild(printerSelectorAndEditButton);

			var printerSelector = new PrinterSelector();
			printerSelector.AddPrinter += (s, e) => WizardPage.WizardWindow.ChangeToSetupPrinterForm(true);
			printerSelectorAndEditButton.AddChild(printerSelector);

			var editButton = TextImageButtonFactory.GetThemedEditButton();
			editButton.ToolTipText = "Edit Selected Setting".Localize();
			editButton.VAnchor = VAnchor.ParentCenter;
			editButton.Click += UiNavigation.OpenEditPrinterWizard_Click;
			printerSelectorAndEditButton.AddChild(editButton);

			disconnectButton = textImageButtonFactory.Generate("Disconnect");
			disconnectButton.Margin = new BorderDouble(left: 12);
			disconnectButton.VAnchor = VAnchor.ParentCenter;
			disconnectButton.Click += (sender, e) =>
			{
				PrinterConnectionAndCommunication.Instance.Disable();
				UiThread.RunOnIdle(WizardPage.WizardWindow.ChangeToPage<SetupOptionsPage>);
			};
			buttonContainer.AddChild(disconnectButton);

			connectionStatus = new TextWidget("Status:", pointSize: 12, textColor: ActiveTheme.Instance.PrimaryTextColor)
			{
				HAnchor = HAnchor.ParentLeftRight
			};
			mainContainer.AddChild(connectionStatus);

			PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(updateConnectedState, ref unregisterEvents);
			updateConnectedState(null, null);
		}
コード例 #13
0
        private Button CreateButton(Tuple <string, Func <bool> > buttonInfo)
        {
            TextImageButtonFactory buttonFactory = new TextImageButtonFactory();

            buttonFactory.FixedHeight       = this.FixedHeight;
            buttonFactory.normalFillColor   = this.normalFillColor;
            buttonFactory.normalTextColor   = this.normalTextColor;
            buttonFactory.hoverTextColor    = this.hoverTextColor;
            buttonFactory.hoverFillColor    = this.hoverFillColor;
            buttonFactory.borderWidth       = 1;
            buttonFactory.normalBorderColor = this.normalBorderColor;
            buttonFactory.hoverBorderColor  = this.hoverBorderColor;

            Button button = buttonFactory.Generate(buttonInfo.Item1, normalImageName: imageName, centerText: true);

            button.Click += (s, e) => buttonInfo.Item2();

            return(button);
        }
コード例 #14
0
        private FlowLayoutWidget GetHotkeyControlContainer()
        {
            TextImageButtonFactory hotKeyButtonFactory = new TextImageButtonFactory();

            hotKeyButtonFactory.FixedHeight = 20 * GuiWidget.DeviceScale;
            hotKeyButtonFactory.FixedWidth  = 30 * GuiWidget.DeviceScale;
            hotKeyButtonFactory.fontSize    = 8;

            hotKeyButtonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor;

            FlowLayoutWidget hotkeyControlContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            hotkeyControlContainer.HAnchor     = HAnchor.FitToChildren;
            hotkeyControlContainer.VAnchor     = VAnchor.ParentBottomTop;
            hotkeyControlContainer.ToolTipText = "Enable cursor keys for movement".Localize();
            hotkeyControlContainer.Margin      = new BorderDouble(left: 10);

            RadioButton hotKeyButton = hotKeyButtonFactory.GenerateRadioButton("", StaticData.Instance.LoadIcon("hot_key_small_white.png", 19, 12).InvertLightness());

            hotKeyButton.Margin        = new BorderDouble(5);
            hotKeyButton.FocusChanged += (sender, e) =>
            {
                if ((sender as GuiWidget).Focused)
                {
                    hotKeyButton.Checked         = false;
                    hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
                    hotKeysEnabled = false;
                }
                else
                {
                    hotKeyButton.Checked         = true;
                    hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
                    hotKeysEnabled = true;
                }
            };

            hotkeyControlContainer.AddChild(hotKeyButton);

            return(hotkeyControlContainer);
        }
コード例 #15
0
        private FlowLayoutWidget GetHotkeyControlContainer()
        {
            TextImageButtonFactory hotKeyButtonFactory = new TextImageButtonFactory();

            hotKeyButtonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio;
            hotKeyButtonFactory.FixedWidth  = 30 * TextWidget.GlobalPointSizeScaleRatio;
            hotKeyButtonFactory.fontSize    = 8;

            hotKeyButtonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor;

            FlowLayoutWidget hotkeyControlContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            hotkeyControlContainer.HAnchor     = HAnchor.FitToChildren;
            hotkeyControlContainer.VAnchor     = VAnchor.ParentBottomTop;
            hotkeyControlContainer.ToolTipText = "Enable cursor keys for movement";
            hotkeyControlContainer.Margin      = new BorderDouble(left: 10);

            RadioButton hotKeyButton = hotKeyButtonFactory.GenerateRadioButton("", "hot_key_small.png");

            hotKeyButton.Margin = new BorderDouble(5);
            hotKeyButton.Click += (sender, e) =>
            {
                if (hotKeysEnabled)
                {
                    hotKeysEnabled = false;
                    hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
                    hotKeyButton.Checked         = false;
                }
                else if (!hotKeysEnabled)
                {
                    hotKeysEnabled = true;
                    hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
                    hotKeyButton.Checked         = true;
                }
            };

            hotkeyControlContainer.AddChild(hotKeyButton);

            return(hotkeyControlContainer);
        }
コード例 #16
0
		private Button CreateButton(Tuple<string, Func<bool>> buttonInfo)
		{
			TextImageButtonFactory buttonFactory = new TextImageButtonFactory();

			buttonFactory.FixedHeight = this.FixedHeight;
			buttonFactory.normalFillColor = this.normalFillColor;
			buttonFactory.normalTextColor = this.normalTextColor;
			buttonFactory.hoverTextColor = this.hoverTextColor;
			buttonFactory.hoverFillColor = this.hoverFillColor;
			buttonFactory.borderWidth = 1;
			buttonFactory.normalBorderColor = this.normalBorderColor;
			buttonFactory.hoverBorderColor = this.hoverBorderColor;

			Button button = buttonFactory.Generate(buttonInfo.Item1, normalImageName: imageName, centerText: true);

			button.Click += (object sender, EventArgs e) =>
			{
				buttonInfo.Item2();
			};

			return button;
		}
コード例 #17
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;
			}

		}
コード例 #18
0
        public EnterCodesView(TextImageButtonFactory textImageButtonFactory) : base("")
        {
            this.textImageButtonFactory = textImageButtonFactory;
            FlowLayoutWidget buttonContainer = new FlowLayoutWidget()
            {
                HAnchor = HAnchor.ParentLeftRight,
                Margin  = new BorderDouble(0, 14)
            };

            mainContainer.AddChild(buttonContainer);

            if (UserSettings.Instance.IsTouchScreen)
            {
                // the redeem design code button
                Button redeemPurchaseButton = textImageButtonFactory.Generate("Redeem Purchase".Localize());
                redeemPurchaseButton.Enabled = true;                 // The library selector (the first library selected) is protected so we can't add to it.
                redeemPurchaseButton.Name    = "Redeem Code Button";
                redeemPurchaseButton.Margin  = new BorderDouble(0, 0, 10, 0);
                redeemPurchaseButton.Click  += (sender, e) =>
                {
                    RedeemDesignCode?.Invoke(this, null);
                };
                buttonContainer.AddChild(redeemPurchaseButton);

                // the redeem a share code button
                Button redeemShareButton = textImageButtonFactory.Generate("Enter Share Code".Localize());
                redeemShareButton.Enabled = true;                 // The library selector (the first library selected) is protected so we can't add to it.
                redeemShareButton.Name    = "Enter Share Code";
                redeemShareButton.Margin  = new BorderDouble(0, 0, 3, 0);
                redeemShareButton.Click  += (sender, e) =>
                {
                    EnterShareCode?.Invoke(this, null);
                };

                buttonContainer.AddChild(redeemShareButton);
            }
        }
コード例 #19
0
		public EnterCodesView(TextImageButtonFactory textImageButtonFactory) : base("")
		{
			this.textImageButtonFactory = textImageButtonFactory;
			FlowLayoutWidget buttonContainer = new FlowLayoutWidget()
			{
				HAnchor = HAnchor.ParentLeftRight,
				Margin = new BorderDouble(0, 14)
			};
			mainContainer.AddChild(buttonContainer);

			if (UserSettings.Instance.IsTouchScreen)
			{
				// the redeem design code button
				Button redeemPurchaseButton = textImageButtonFactory.Generate("Redeem Purchase".Localize());
				redeemPurchaseButton.Enabled = true; // The library selector (the first library selected) is protected so we can't add to it.
				redeemPurchaseButton.Name = "Redeem Code Button";
				redeemPurchaseButton.Margin = new BorderDouble(0, 0, 10, 0);
				redeemPurchaseButton.Click += (sender, e) =>
				{
					RedeemDesignCode?.Invoke(this, null);
				};
				buttonContainer.AddChild(redeemPurchaseButton);

				// the redeem a share code button
				Button redeemShareButton = textImageButtonFactory.Generate("Enter Share Code".Localize());
				redeemShareButton.Enabled = true; // The library selector (the first library selected) is protected so we can't add to it.
				redeemShareButton.Name = "Enter Share Code";
				redeemShareButton.Margin = new BorderDouble(0, 0, 3, 0);
				redeemShareButton.Click += (sender, e) =>
				{
					EnterShareCode?.Invoke(this, null);
				};

				buttonContainer.AddChild(redeemShareButton);
			}
		}
コード例 #20
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;
        }
コード例 #21
0
		private FlowLayoutWidget GetHotkeyControlContainer()
		{

			TextImageButtonFactory hotKeyButtonFactory = new TextImageButtonFactory();
			hotKeyButtonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio;
			hotKeyButtonFactory.FixedWidth = 30 * TextWidget.GlobalPointSizeScaleRatio;
			hotKeyButtonFactory.fontSize = 8;

			hotKeyButtonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor;

			FlowLayoutWidget hotkeyControlContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			hotkeyControlContainer.HAnchor = HAnchor.FitToChildren;
			hotkeyControlContainer.VAnchor = VAnchor.ParentBottomTop;
			hotkeyControlContainer.ToolTipText = "Enable cursor keys for movement";
			hotkeyControlContainer.Margin = new BorderDouble(left: 10);

			RadioButton hotKeyButton = hotKeyButtonFactory.GenerateRadioButton("", "hot_key_small.png");
			hotKeyButton.Margin = new BorderDouble(5);
			hotKeyButton.Click += (sender, e) =>
			{
				if (hotKeysEnabled)
				{
					hotKeysEnabled = false;
					hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
					hotKeyButton.Checked = false;
				}
				else if (!hotKeysEnabled)
				{
					hotKeysEnabled = true;
					hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
					hotKeyButton.Checked = true;
				}

			};

			hotkeyControlContainer.AddChild(hotKeyButton);

			return hotkeyControlContainer;

		}
コード例 #22
0
		public SetupAccountView(TextImageButtonFactory textImageButtonFactory)
			: base("My Account")
		{
			this.textImageButtonFactory = textImageButtonFactory;

			bool signedIn = true;
			string username = AuthenticationData.Instance.ActiveSessionUsername;
			if (username == null)
			{
				signedIn = false;
				username = "******";
			}

			FlowLayoutWidget nameAndStatus = new FlowLayoutWidget();
			nameAndStatus.AddChild(new TextWidget(username, pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor));

			connectionStatus = new TextWidget(AuthenticationString, pointSize: 8, textColor: ActiveTheme.Instance.SecondaryTextColor)
			{
				Margin = new BorderDouble(5, 0, 0, 0),
				AutoExpandBoundsToText = true,
			};

			if (signedIn)
			{
				nameAndStatus.AddChild(connectionStatus);
			}


			mainContainer.AddChild(nameAndStatus);

			RefreshStatus();

			FlowLayoutWidget buttonContainer = new FlowLayoutWidget();
			buttonContainer.HAnchor = HAnchor.ParentLeftRight;
			buttonContainer.Margin = new BorderDouble(0, 14);

			signInButton = textImageButtonFactory.Generate("Sign In");
			signInButton.Margin = new BorderDouble(left: 0);
			signInButton.VAnchor = VAnchor.ParentCenter;
			signInButton.Visible = !signedIn;
			signInButton.Click += (s, e) => UiThread.RunOnIdle(() =>
			{
				signInButton.Visible = false;
				signOutButton.Visible = false;
				statusMessage.Visible = true;
				ApplicationController.Instance.StartSignIn();
			});
			buttonContainer.AddChild(signInButton);

			signOutButton = textImageButtonFactory.Generate("Sign Out");
			signOutButton.Margin = new BorderDouble(left: 0);
			signOutButton.VAnchor = VAnchor.ParentCenter;
			signOutButton.Visible = signedIn;
			signOutButton.Click += (s, e) => UiThread.RunOnIdle(() =>
			{
				signInButton.Visible = false;
				signOutButton.Visible = false;
				statusMessage.Visible = true;
				ApplicationController.Instance.StartSignOut();
			});
			buttonContainer.AddChild(signOutButton);

			buttonContainer.AddChild(new HorizontalSpacer());

			// the redeem design code button
			textImageButtonFactory.disabledTextColor = new RGBA_Bytes(textImageButtonFactory.normalTextColor, 100);
			Button redeemPurchaseButton = textImageButtonFactory.Generate("Redeem Purchase".Localize());
			redeemPurchaseButton.Enabled = true; // The library selector (the first library selected) is protected so we can't add to it.
			redeemPurchaseButton.Name = "Redeem Code Button";
			redeemPurchaseButton.Margin = new BorderDouble(0, 0, 10, 0);
			redeemPurchaseButton.Click += (sender, e) =>
			{
				ApplicationController.Instance.RedeemDesignCode?.Invoke();
			};
			buttonContainer.AddChild(redeemPurchaseButton);

			// the redeem a share code button
			Button redeemShareButton = textImageButtonFactory.Generate("Enter Share Code".Localize());
			redeemShareButton.Enabled = true; // The library selector (the first library selected) is protected so we can't add to it.
			redeemShareButton.Name = "Enter Share Code";
			redeemShareButton.Margin = new BorderDouble(0, 0, 10, 0);
			redeemShareButton.Click += (sender, e) =>
			{
				ApplicationController.Instance.EnterShareCode?.Invoke();
			};

			if (!signedIn)
			{
				redeemPurchaseButton.Enabled = false;
				redeemShareButton.Enabled = false;
			}

			buttonContainer.AddChild(redeemShareButton);

			statusMessage = new TextWidget("Please wait...", pointSize: 12, textColor: ActiveTheme.Instance.SecondaryAccentColor);
			statusMessage.Visible = false;
			buttonContainer.AddChild(statusMessage);

			mainContainer.AddChild(buttonContainer);

			ApplicationController.Instance.DoneReloadingAll.RegisterEvent(RemoveAndNewControl, ref unregisterEvents);
		}
コード例 #23
0
        private TabControl CreateNewAdvancedControls(EventHandler AdvancedControlsButton_Click, EventHandler onMouseEnterBoundsPrintQueueLink, EventHandler onMouseLeaveBoundsPrintQueueLink)
        {
            TabControl advancedControls = new TabControl();

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
            advancedControls.TabBar.Margin      = new BorderDouble(0, 0);
            advancedControls.TabBar.Padding     = new BorderDouble(0, 2);

            int textSize = 16;

            if (AdvancedControlsButton_Click != null)
            {
                // this means we are in compact view and so we will make the tabs text a bit smaller
                textSize = 14;
                TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
                advancedControlsButtonFactory.invertImageLocation = false;
                advancedControlsLinkButton                   = advancedControlsButtonFactory.Generate(LocalizedString.Get("Print\nQueue"), "icon_arrow_left_32x32.png");
                advancedControlsLinkButton.Margin            = new BorderDouble(right: 3);
                advancedControlsLinkButton.VAnchor           = VAnchor.ParentBottom;
                advancedControlsLinkButton.Cursor            = Cursors.Hand;
                advancedControlsLinkButton.Click            += new EventHandler(AdvancedControlsButton_Click);
                advancedControlsLinkButton.MouseEnterBounds += new EventHandler(onMouseEnterBoundsPrintQueueLink);
                advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsPrintQueueLink);

                advancedControls.TabBar.AddChild(advancedControlsLinkButton);
            }

            GuiWidget hSpacer = new GuiWidget();

            hSpacer.HAnchor = HAnchor.ParentLeftRight;

            advancedControls.TabBar.AddChild(hSpacer);

            GuiWidget        manualPrinterControls           = new ManualPrinterControls();
            ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);

            manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            manualPrinterControlsScrollArea.AnchorAll();
            manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

            RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;

            //Add the tab contents for 'Advanced Controls'
            string printerControlsLabel = LocalizedString.Get("Controls").ToUpper();

            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), "Controls Tab", textSize,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            string sliceSettingsLabel = LocalizedString.Get("Slice Settings").ToUpper();

            sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), "Slice Settings Tab", textSize,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            string           configurationLabel    = LocalizedString.Get("Configuration").ToUpper();
            ScrollableWidget configurationControls = new PrinterConfigurationScrollWidget();

            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), "Configuration Tab", textSize,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            advancedControls.SelectedTabIndex = lastAdvanceControlsIndex;

            return(advancedControls);
        }
コード例 #24
0
		private GuiWidget CreateContentForEmptyControl()
		{
			GuiWidget allContent = new GuiWidget(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop);
			allContent.Padding = new BorderDouble(5, 10, 5, 10);

			FlowLayoutWidget flowWidget = new FlowLayoutWidget();
			flowWidget.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
			flowWidget.HAnchor = HAnchor.ParentLeftRight;
			flowWidget.VAnchor = VAnchor.ParentTop;
			flowWidget.Padding = new BorderDouble(10, 0);
			flowWidget.Height = 60;

			TextImageButtonFactory bringBackButtonFactory = new TextImageButtonFactory();
			bringBackButtonFactory.normalFillColor = RGBA_Bytes.Gray;
			bringBackButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;

			Button bringBackToTabButton = bringBackButtonFactory.Generate(LocalizedString.Get("Restore"));
			bringBackToTabButton.ToolTipText = "Bring the Window back into this Tab".Localize();
			bringBackToTabButton.VAnchor = VAnchor.ParentCenter;
			bringBackToTabButton.Cursor = Cursors.Hand;
			bringBackToTabButton.Click += (sender, e) =>
			{
				UiThread.RunOnIdle(() =>
				{
					SaveWindowShouldStartClosed();
					SystemWindow temp = systemWindowWithPopContent;
					SystemWindow_Closing(null, null);
					temp.Close();
				});
			};

			TextWidget windowedModeMessage = new TextWidget(LocalizedString.Get("WINDOWED MODE: This tab has been moved to a separate window."),
				pointSize: 10, textColor: ActiveTheme.Instance.PrimaryTextColor);
			windowedModeMessage.VAnchor = VAnchor.ParentCenter;

			flowWidget.AddChild(windowedModeMessage);
			flowWidget.AddChild(new HorizontalSpacer());
			flowWidget.AddChild(bringBackToTabButton);

			allContent.AddChild(flowWidget);

			return allContent;
		}
コード例 #25
0
		public WizardPage(string unlocalizedTextForCancelButton = "Cancel", string unlocalizedTextForTitle = "Setup Wizard")
		{
			whiteImageButtonFactory = new TextImageButtonFactory()
			{
				normalFillColor = RGBA_Bytes.White,
				disabledFillColor = RGBA_Bytes.White,
				fontSize = 16,
				borderWidth = 1,

				normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
				hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),

				disabledTextColor = RGBA_Bytes.DarkGray,
				hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
				normalTextColor = RGBA_Bytes.Black,
				pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
				FixedWidth = 200
			};

			if (!UserSettings.Instance.IsTouchScreen)
			{
				textImageButtonFactory = new TextImageButtonFactory()
				{
					normalTextColor = ActiveTheme.Instance.PrimaryTextColor,
					hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
					disabledTextColor = ActiveTheme.Instance.PrimaryTextColor,
					pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
					borderWidth = 0
				};

				linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor;
				linkButtonFactory.fontSize = 10;

				this.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
				this.Padding = new BorderDouble(0); //To be re-enabled once native borders are turned off
			}

			this.AnchorAll();

			cancelButton = textImageButtonFactory.Generate(unlocalizedTextForCancelButton.Localize());
			cancelButton.Name = "Cancel Wizard Button";
			cancelButton.Click += (s, e) =>
			{
				UiThread.RunOnIdle(() => WizardWindow?.Close());
			};

			// Create the main container
			mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
			{
				Padding = new BorderDouble(12, 12, 12, 0),
				BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor
			};
			mainContainer.AnchorAll();

			// Create the header row for the widget
			headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight)
			{
				Margin = new BorderDouble(0, 3, 0, 0),
				Padding = new BorderDouble(0, 12),
				HAnchor = HAnchor.ParentLeftRight
			};

			headerLabel = new TextWidget(unlocalizedTextForTitle.Localize(), pointSize: 24, textColor: ActiveTheme.Instance.SecondaryAccentColor)
			{
				AutoExpandBoundsToText = true
			};
			headerRow.AddChild(headerLabel);

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

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

			mainContainer.AddChild(headerRow);
			mainContainer.AddChild(contentRow);
			mainContainer.AddChild(footerRow);

			if (!UserSettings.Instance.IsTouchScreen)
			{
				mainContainer.Padding = new BorderDouble(3, 5, 3, 5);
				headerRow.Padding = new BorderDouble(0, 3, 0, 3);

				headerLabel.PointSize = 14;
				headerLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				contentRow.Padding = new BorderDouble(5);
				footerRow.Margin = new BorderDouble(0, 3);
			}

			this.AddChild(mainContainer);
		}
コード例 #26
0
		private TabControl CreateNewAdvancedControls(EventHandler AdvancedControlsButton_Click)
		{
			TabControl advancedControls = new TabControl();

			BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
			advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
			advancedControls.TabBar.Margin = new BorderDouble(0, 0);
			advancedControls.TabBar.Padding = new BorderDouble(0, 2);

			int textSize = 16;

			if (AdvancedControlsButton_Click != null)
			{
				// this means we are in compact view and so we will make the tabs text a bit smaller
				textSize = 14;
				TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
				advancedControlsButtonFactory.fontSize = 14;
				advancedControlsButtonFactory.invertImageLocation = false;
				advancedControlsBackButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Back"), "icon_arrow_left_32x32.png");
				advancedControlsBackButton.ToolTipText = "Switch to Queue, Library and History".Localize();
				advancedControlsBackButton.Margin = new BorderDouble(right: 3);
				advancedControlsBackButton.VAnchor = VAnchor.ParentBottom;
				advancedControlsBackButton.Cursor = Cursors.Hand;
				advancedControlsBackButton.Click += new EventHandler(AdvancedControlsButton_Click);

				advancedControls.TabBar.AddChild(advancedControlsBackButton);
			}

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

			advancedControls.TabBar.AddChild(hSpacer);

			GuiWidget manualPrinterControls = new ManualPrinterControls();
			ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);
			manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
			manualPrinterControlsScrollArea.AnchorAll();
			manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

			RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;

			//Add the tab contents for 'Advanced Controls'
			string sliceSettingsLabel = LocalizedString.Get("Settings").ToUpper();
			string printerControlsLabel = LocalizedString.Get("Controls").ToUpper();
			sliceSettingsWidget = new SliceSettingsWidget();

			TabPage sliceSettingsTabPage = new TabPage(sliceSettingsWidget, sliceSettingsLabel);
			PopOutTextTabWidget sliceSettingPopOut = new PopOutTextTabWidget(sliceSettingsTabPage, SliceSettingsTabName, new Vector2(590, 400), textSize);
			advancedControls.AddTab(sliceSettingPopOut);
			
			TabPage controlsTabPage = new TabPage(manualPrinterControlsScrollArea, printerControlsLabel);
			PopOutTextTabWidget controlsPopOut = new PopOutTextTabWidget(controlsTabPage, ControlsTabName, new Vector2(400, 300), textSize);
			advancedControls.AddTab(controlsPopOut);

#if !__ANDROID__
			MenuOptionSettings.sliceSettingsPopOut = sliceSettingPopOut;
			MenuOptionSettings.controlsPopOut = controlsPopOut;
#endif

			string optionsLabel = LocalizedString.Get("Options").ToUpper();
			ScrollableWidget configurationControls = new PrinterConfigurationScrollWidget();
			advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, optionsLabel), "Configuration Tab", textSize,
						ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

			// Make sure we are on the right tab when we create this view
			{
				string selectedTab = UserSettings.Instance.get(ThirdPanelTabView_AdvancedControls_CurrentTab);
				advancedControls.SelectTab(selectedTab);

				advancedControls.TabBar.TabIndexChanged += (object sender, EventArgs e) =>
				{
					UserSettings.Instance.set(ThirdPanelTabView_AdvancedControls_CurrentTab, advancedControls.TabBar.SelectedTabName);
				};
			}

			return advancedControls;
		}
コード例 #27
0
        private FlowLayoutWidget CreateEButtons(double buttonSeparationDistance)
        {
            FlowLayoutWidget eButtons = new FlowLayoutWidget(FlowDirection.TopToBottom);
            {
                FlowLayoutWidget eMinusButtonAndText = new FlowLayoutWidget();
                eMinusControl = moveButtonFactory.Generate("E-", PrinterCommunication.Axis.E, ManualPrinterControls.EFeedRate(0));
                eMinusControl.Margin = new BorderDouble(0, 0, 5, 0);
                eMinusButtonAndText.AddChild(eMinusControl);
				TextWidget eMinusControlLabel = new TextWidget(new LocalizedString("Retract").Translated);
                eMinusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                eMinusControlLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
                eMinusButtonAndText.AddChild(eMinusControlLabel);
                eMinusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft;
                eButtons.AddChild(eMinusButtonAndText);

                eMinusButtonAndText.HAnchor = HAnchor.FitToChildren;
                eMinusButtonAndText.VAnchor = VAnchor.FitToChildren;

                GuiWidget eSpacer = new GuiWidget(2, buttonSeparationDistance);
                eSpacer.HAnchor = Agg.UI.HAnchor.ParentLeft;
                eSpacer.Margin = new BorderDouble(eMinusControl.Width / 2, 0, 0, 0);
                eSpacer.BackgroundColor = XYZColors.eColor;
                eButtons.AddChild(eSpacer);

                FlowLayoutWidget ePlusButtonAndText = new FlowLayoutWidget();
                ePlusControl = moveButtonFactory.Generate("E+", PrinterCommunication.Axis.E, ManualPrinterControls.EFeedRate(0));
                ePlusControl.Margin = new BorderDouble(0, 0, 5, 0);
                ePlusButtonAndText.AddChild(ePlusControl);
				TextWidget ePlusControlLabel = new TextWidget(new LocalizedString("Extrude").Translated);
                ePlusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                ePlusControlLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
                ePlusButtonAndText.AddChild(ePlusControlLabel);
                ePlusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft;
                eButtons.AddChild(ePlusButtonAndText);
                ePlusButtonAndText.HAnchor = HAnchor.FitToChildren;
                ePlusButtonAndText.VAnchor = VAnchor.FitToChildren;
            }

            eButtons.AddChild(new GuiWidget(10, 6));

            // add in some movement radio buttons
            FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget();
            TextWidget buttonsLabel = new TextWidget("Distance:", textColor: RGBA_Bytes.White);
            buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
            //setMoveDistanceControl.AddChild(buttonsLabel);

            {
                TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
                buttonFactory.FixedHeight = 20;
                buttonFactory.FixedWidth = 30;
                buttonFactory.fontSize = 10;
                buttonFactory.Margin = new BorderDouble(0);

                FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget();
                RadioButton oneButton = buttonFactory.GenerateRadioButton("1");
                oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
                oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(1); };
                moveRadioButtons.AddChild(oneButton);
                RadioButton tenButton = buttonFactory.GenerateRadioButton("10");
                tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
                tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(10); };
                moveRadioButtons.AddChild(tenButton);
                RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100");
                oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
                oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(100); };
                moveRadioButtons.AddChild(oneHundredButton);
                tenButton.Checked = true;
                moveRadioButtons.Margin = new BorderDouble(0,3);
                setMoveDistanceControl.AddChild(moveRadioButtons);
            }

            TextWidget mmLabel = new TextWidget("mm", textColor: RGBA_Bytes.White, pointSize:10);
            mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
            setMoveDistanceControl.AddChild(mmLabel);
            setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft;
            eButtons.AddChild(setMoveDistanceControl);

            eButtons.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
            eButtons.VAnchor = VAnchor.FitToChildren | VAnchor.ParentBottom;

            return eButtons;
        }
コード例 #28
0
        private FlowLayoutWidget CreateEButtons(double buttonSeparationDistance)
        {
            int extruderCount = ActiveSliceSettings.Instance.ExtruderCount;

            FlowLayoutWidget eButtons = new FlowLayoutWidget(FlowDirection.TopToBottom);

            {
                FlowLayoutWidget eMinusButtonAndText = new FlowLayoutWidget();
                BorderDouble     extrusionMargin     = new BorderDouble(4, 0, 4, 0);

                if (extruderCount == 1)
                {
                    ExtrudeButton eMinusControl = moveButtonFactory.Generate("E-", MovementControls.EFeedRate(0), 0);
                    eMinusControl.Margin = extrusionMargin;
                    eMinusButtonAndText.AddChild(eMinusControl);
                    eMinusButtons.Add(eMinusControl);
                }
                else
                {
                    for (int i = 0; i < extruderCount; i++)
                    {
                        ExtrudeButton eMinusControl = moveButtonFactory.Generate(string.Format("E{0}-", i + 1), MovementControls.EFeedRate(0), i);
                        eMinusControl.Margin = extrusionMargin;
                        eMinusButtonAndText.AddChild(eMinusControl);
                        eMinusButtons.Add(eMinusControl);
                    }
                }

                TextWidget eMinusControlLabel = new TextWidget(LocalizedString.Get("Retract"), pointSize: 11);
                eMinusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                eMinusControlLabel.VAnchor   = Agg.UI.VAnchor.ParentCenter;
                eMinusButtonAndText.AddChild(eMinusControlLabel);
                eMinusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft;
                eButtons.AddChild(eMinusButtonAndText);

                eMinusButtonAndText.HAnchor = HAnchor.FitToChildren;
                eMinusButtonAndText.VAnchor = VAnchor.FitToChildren;


                FlowLayoutWidget buttonSpacerContainer = new FlowLayoutWidget();
                for (int i = 0; i < extruderCount; i++)
                {
                    GuiWidget eSpacer     = new GuiWidget(2, buttonSeparationDistance);
                    double    buttonWidth = eMinusButtons[i].Width + 6;

                    eSpacer.Margin          = new BorderDouble((buttonWidth / 2), 0, ((buttonWidth) / 2), 0);
                    eSpacer.BackgroundColor = XYZColors.eColor;
                    buttonSpacerContainer.AddChild(eSpacer);
                }
                buttonSpacerContainer.HAnchor = Agg.UI.HAnchor.ParentLeft;
                eButtons.AddChild(buttonSpacerContainer);

                buttonSpacerContainer.HAnchor = HAnchor.FitToChildren;
                buttonSpacerContainer.VAnchor = VAnchor.FitToChildren;

                FlowLayoutWidget ePlusButtonAndText = new FlowLayoutWidget();
                if (extruderCount == 1)
                {
                    ExtrudeButton ePlusControl = moveButtonFactory.Generate("E+", MovementControls.EFeedRate(0), 0);
                    ePlusControl.Margin = extrusionMargin;
                    ePlusButtonAndText.AddChild(ePlusControl);
                    ePlusButtons.Add(ePlusControl);
                }
                else
                {
                    for (int i = 0; i < extruderCount; i++)
                    {
                        ExtrudeButton ePlusControl = moveButtonFactory.Generate(string.Format("E{0}+", i + 1), MovementControls.EFeedRate(0), i);
                        ePlusControl.Margin = extrusionMargin;
                        ePlusButtonAndText.AddChild(ePlusControl);
                        ePlusButtons.Add(ePlusControl);
                    }
                }

                TextWidget ePlusControlLabel = new TextWidget(LocalizedString.Get("Extrude"), pointSize: 11);
                ePlusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                ePlusControlLabel.VAnchor   = Agg.UI.VAnchor.ParentCenter;
                ePlusButtonAndText.AddChild(ePlusControlLabel);
                ePlusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft;
                eButtons.AddChild(ePlusButtonAndText);
                ePlusButtonAndText.HAnchor = HAnchor.FitToChildren;
                ePlusButtonAndText.VAnchor = VAnchor.FitToChildren;
            }

            eButtons.AddChild(new GuiWidget(10, 6));

            // add in some movement radio buttons
            FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget();
            TextWidget       buttonsLabel           = new TextWidget("Distance:", textColor: RGBA_Bytes.White);

            buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
            //setMoveDistanceControl.AddChild(buttonsLabel);

            {
                TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
                buttonFactory.FixedHeight        = 20 * TextWidget.GlobalPointSizeScaleRatio;
                buttonFactory.FixedWidth         = 30 * TextWidget.GlobalPointSizeScaleRatio;
                buttonFactory.fontSize           = 8;
                buttonFactory.Margin             = new BorderDouble(0);
                buttonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor;

                FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget();
                RadioButton      oneButton        = buttonFactory.GenerateRadioButton("1");
                oneButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                  {
                                                                      SetEMoveAmount(1);
                                                                  }
                };
                moveRadioButtons.AddChild(oneButton);
                RadioButton tenButton = buttonFactory.GenerateRadioButton("10");
                tenButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                  {
                                                                      SetEMoveAmount(10);
                                                                  }
                };
                moveRadioButtons.AddChild(tenButton);
                RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100");
                oneHundredButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                         {
                                                                             SetEMoveAmount(100);
                                                                         }
                };
                moveRadioButtons.AddChild(oneHundredButton);
                tenButton.Checked       = true;
                moveRadioButtons.Margin = new BorderDouble(0, 3);
                setMoveDistanceControl.AddChild(moveRadioButtons);
            }

            TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8);

            mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
            setMoveDistanceControl.AddChild(mmLabel);
            setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft;
            eButtons.AddChild(setMoveDistanceControl);

            eButtons.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
            eButtons.VAnchor = VAnchor.FitToChildren | VAnchor.ParentBottom;

            return(eButtons);
        }
コード例 #29
0
        private TabControl CreateNewAdvancedControls(EventHandler AdvancedControlsButton_Click)
        {
            TabControl advancedControls = new TabControl();

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
            advancedControls.TabBar.Margin      = new BorderDouble(0, 0);
            advancedControls.TabBar.Padding     = new BorderDouble(0, 2);

            int textSize = 16;

            if (AdvancedControlsButton_Click != null)
            {
                // this means we are in compact view and so we will make the tabs text a bit smaller
                textSize = 14;
                TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
                advancedControlsButtonFactory.fontSize            = 14;
                advancedControlsButtonFactory.invertImageLocation = false;
                advancedControlsBackButton             = advancedControlsButtonFactory.Generate(LocalizedString.Get("Back"), "icon_arrow_left_32x32.png");
                advancedControlsBackButton.ToolTipText = "Switch to Queue, Library and History".Localize();
                advancedControlsBackButton.Margin      = new BorderDouble(right: 3);
                advancedControlsBackButton.VAnchor     = VAnchor.ParentBottom;
                advancedControlsBackButton.Cursor      = Cursors.Hand;
                advancedControlsBackButton.Click      += new EventHandler(AdvancedControlsButton_Click);

                advancedControls.TabBar.AddChild(advancedControlsBackButton);
            }

            GuiWidget hSpacer = new GuiWidget();

            hSpacer.HAnchor = HAnchor.ParentLeftRight;

            advancedControls.TabBar.AddChild(hSpacer);

            GuiWidget        manualPrinterControls           = new ManualPrinterControls();
            ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);

            manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            manualPrinterControlsScrollArea.AnchorAll();
            manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

            RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;

            //Add the tab contents for 'Advanced Controls'
            string sliceSettingsLabel   = LocalizedString.Get("Settings").ToUpper();
            string printerControlsLabel = LocalizedString.Get("Controls").ToUpper();

            sliceSettingsWidget = new SliceSettingsWidget();

            TabPage             sliceSettingsTabPage = new TabPage(sliceSettingsWidget, sliceSettingsLabel);
            PopOutTextTabWidget sliceSettingPopOut   = new PopOutTextTabWidget(sliceSettingsTabPage, SliceSettingsTabName, new Vector2(590, 400), textSize);

            advancedControls.AddTab(sliceSettingPopOut);

            TabPage             controlsTabPage = new TabPage(manualPrinterControlsScrollArea, printerControlsLabel);
            PopOutTextTabWidget controlsPopOut  = new PopOutTextTabWidget(controlsTabPage, ControlsTabName, new Vector2(400, 300), textSize);

            advancedControls.AddTab(controlsPopOut);

#if !__ANDROID__
            MenuOptionSettings.sliceSettingsPopOut = sliceSettingPopOut;
            MenuOptionSettings.controlsPopOut      = controlsPopOut;
#endif

            string           optionsLabel    = LocalizedString.Get("Options").ToUpper();
            ScrollableWidget optionsControls = new PrinterConfigurationScrollWidget();
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(optionsControls, optionsLabel), "Options Tab", textSize,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            // Make sure we are on the right tab when we create this view
            {
                string selectedTab = UserSettings.Instance.get(ThirdPanelTabView_AdvancedControls_CurrentTab);
                advancedControls.SelectTab(selectedTab);

                advancedControls.TabBar.TabIndexChanged += (object sender, EventArgs e) =>
                {
                    UserSettings.Instance.set(ThirdPanelTabView_AdvancedControls_CurrentTab, advancedControls.TabBar.SelectedTabName);
                };
            }

            return(advancedControls);
        }
コード例 #30
0
        public EditableNumberDisplay(TextImageButtonFactory textImageButtonFactory, string startingValue, string largestPossibleValue)
            : base(Agg.UI.FlowDirection.LeftToRight)
        {
            this.Margin   = new BorderDouble(3, 0);
            this.VAnchor |= VAnchor.ParentBottomTop;

            clickableValueContainer             = new ClickWidget();
            clickableValueContainer.VAnchor     = VAnchor.ParentBottomTop;
            clickableValueContainer.Cursor      = Cursors.Hand;
            clickableValueContainer.BorderWidth = 1;
            clickableValueContainer.BorderColor = new RGBA_Bytes(255, 255, 255, 140);


            clickableValueContainer.MouseEnterBounds += (sender, e) =>
            {
                clickableValueContainer.BorderWidth = 2;
                clickableValueContainer.BorderColor = new RGBA_Bytes(255, 255, 255, 255);
            };

            clickableValueContainer.MouseLeaveBounds += (sender, e) =>
            {
                clickableValueContainer.BorderWidth = 1;
                clickableValueContainer.BorderColor = new RGBA_Bytes(255, 255, 255, 140);
            };

            valueDisplay           = new TextWidget(largestPossibleValue, pointSize: 12);
            valueDisplay.VAnchor   = VAnchor.ParentCenter;
            valueDisplay.HAnchor   = HAnchor.ParentLeft;
            valueDisplay.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            valueDisplay.Margin    = new BorderDouble(6);

            clickableValueContainer.Click += new EventHandler(editField_Click);

            clickableValueContainer.AddChild(valueDisplay);
            clickableValueContainer.SetBoundsToEncloseChildren();
            valueDisplay.Text = startingValue;

            numberInputField         = new MHNumberEdit(0, pixelWidth: 40, allowDecimals: true);
            numberInputField.VAnchor = VAnchor.ParentCenter;
            numberInputField.Margin  = new BorderDouble(left: 6);
            numberInputField.Visible = false;

            // This is a hack to make sure the control is tall enough.
            // TODO: This hack needs a unit test and then pass and then remove this line.
            this.MinimumSize = new VectorMath.Vector2(0, numberInputField.Height);

            setButton         = textImageButtonFactory.Generate("SET");
            setButton.VAnchor = VAnchor.ParentCenter;
            setButton.Margin  = new BorderDouble(left: 6);
            setButton.Visible = false;

            numberInputField.ActuallNumberEdit.EnterPressed += new KeyEventHandler(ActuallNumberEdit_EnterPressed);

            numberInputField.KeyDown += (sender, e) =>
            {
                if (e.KeyCode == Keys.Escape)
                {
                    clickableValueContainer.Visible = true;
                    numberInputField.Visible        = false;
                    setButton.Visible = false;
                }
            };

            setButton.Click += new EventHandler(setButton_Click);

            this.AddChild(clickableValueContainer);
            this.AddChild(numberInputField);
            this.AddChild(setButton);
        }
コード例 #31
0
        private FlowLayoutWidget CreateEButtons(double buttonSeparationDistance)
        {
            FlowLayoutWidget eButtons = new FlowLayoutWidget(FlowDirection.TopToBottom);

            {
                FlowLayoutWidget eMinusButtonAndText = new FlowLayoutWidget();
                eMinusControl        = moveButtonFactory.Generate("E-", PrinterCommunication.Axis.E, ManualPrinterControls.EFeedRate(0));
                eMinusControl.Margin = new BorderDouble(0, 0, 5, 0);
                eMinusButtonAndText.AddChild(eMinusControl);
                TextWidget eMinusControlLabel = new TextWidget(LocalizedString.Get("Retract"), pointSize: 11);
                eMinusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                eMinusControlLabel.VAnchor   = Agg.UI.VAnchor.ParentCenter;
                eMinusButtonAndText.AddChild(eMinusControlLabel);
                eMinusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft;
                eButtons.AddChild(eMinusButtonAndText);

                eMinusButtonAndText.HAnchor = HAnchor.FitToChildren;
                eMinusButtonAndText.VAnchor = VAnchor.FitToChildren;

                GuiWidget eSpacer = new GuiWidget(2, buttonSeparationDistance);
                eSpacer.HAnchor         = Agg.UI.HAnchor.ParentLeft;
                eSpacer.Margin          = new BorderDouble(eMinusControl.Width / 2, 0, 0, 0);
                eSpacer.BackgroundColor = XYZColors.eColor;
                eButtons.AddChild(eSpacer);

                FlowLayoutWidget ePlusButtonAndText = new FlowLayoutWidget();
                ePlusControl        = moveButtonFactory.Generate("E+", PrinterCommunication.Axis.E, ManualPrinterControls.EFeedRate(0));
                ePlusControl.Margin = new BorderDouble(0, 0, 5, 0);
                ePlusButtonAndText.AddChild(ePlusControl);
                TextWidget ePlusControlLabel = new TextWidget(LocalizedString.Get("Extrude"), pointSize: 11);
                ePlusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                ePlusControlLabel.VAnchor   = Agg.UI.VAnchor.ParentCenter;
                ePlusButtonAndText.AddChild(ePlusControlLabel);
                ePlusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft;
                eButtons.AddChild(ePlusButtonAndText);
                ePlusButtonAndText.HAnchor = HAnchor.FitToChildren;
                ePlusButtonAndText.VAnchor = VAnchor.FitToChildren;
            }

            eButtons.AddChild(new GuiWidget(10, 6));

            // add in some movement radio buttons
            FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget();
            TextWidget       buttonsLabel           = new TextWidget("Distance:", textColor: RGBA_Bytes.White);

            buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
            //setMoveDistanceControl.AddChild(buttonsLabel);

            {
                TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
                buttonFactory.FixedHeight = 20;
                buttonFactory.FixedWidth  = 30;
                buttonFactory.fontSize    = 10;
                buttonFactory.Margin      = new BorderDouble(0);

                FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget();
                RadioButton      oneButton        = buttonFactory.GenerateRadioButton("1");
                oneButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                  {
                                                                      SetEMoveAmount(1);
                                                                  }
                };
                moveRadioButtons.AddChild(oneButton);
                RadioButton tenButton = buttonFactory.GenerateRadioButton("10");
                tenButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                  {
                                                                      SetEMoveAmount(10);
                                                                  }
                };
                moveRadioButtons.AddChild(tenButton);
                RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100");
                oneHundredButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                         {
                                                                             SetEMoveAmount(100);
                                                                         }
                };
                moveRadioButtons.AddChild(oneHundredButton);
                tenButton.Checked       = true;
                moveRadioButtons.Margin = new BorderDouble(0, 3);
                setMoveDistanceControl.AddChild(moveRadioButtons);
            }

            TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10);

            mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
            setMoveDistanceControl.AddChild(mmLabel);
            setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft;
            eButtons.AddChild(setMoveDistanceControl);

            eButtons.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
            eButtons.VAnchor = VAnchor.FitToChildren | VAnchor.ParentBottom;

            return(eButtons);
        }
コード例 #32
0
			public CriteriaRow (string itemText, string fixitText, string errorText, bool succeeded, Action fixAction) :base(FlowDirection.LeftToRight, HAnchor.ParentLeftRight, VAnchor.AbsolutePosition)
			{
				TextImageButtonFactory buttonFactory = new TextImageButtonFactory();

				ErrorText = errorText;

				base.Height = 40;

				base.AddChild(new TextWidget (string.Format("  {0}. {1}", criteriaCount + 1, itemText)){
					TextColor = stillSuccessful ? RGBA_Bytes.White : disabledTextColor,
					VAnchor = VAnchor.ParentCenter
				});

				if(stillSuccessful && !succeeded)
				{
					ActiveErrorItem = this;
				}

				base.AddChild(new HorizontalSpacer());

				if(stillSuccessful) {
					if(succeeded)
					{
						// Add checkmark image
						AddSuccessIcon();
					} else {
						// Add Fix button
						Button button  = buttonFactory.Generate(LocalizedString.Get(fixitText),centerText:true);
						button.VAnchor = VAnchor.ParentCenter;
						button.Padding = new BorderDouble(3, 8);
						button.Click += (sender, e) => fixAction();
						base.AddChild(button);
					}
				}

				if(stillSuccessful) 
				{
					this.BackgroundColor = (criteriaCount % 2 == 0) ? RGBA_Bytes.Gray : toggleColor;
				}
				else
				{
					this.BackgroundColor = disabledBackColor;
				}

				stillSuccessful &= succeeded;

				criteriaCount++;
			}
コード例 #33
0
		private FlowLayoutWidget CreateEButtons(double buttonSeparationDistance)
		{
			int extruderCount = ActiveSliceSettings.Instance.ExtruderCount;

			FlowLayoutWidget eButtons = new FlowLayoutWidget(FlowDirection.TopToBottom);
			{
				FlowLayoutWidget eMinusButtonAndText = new FlowLayoutWidget();
				BorderDouble extrusionMargin = new BorderDouble(4, 0, 4, 0);

				if (extruderCount == 1)
				{
					ExtrudeButton eMinusControl = moveButtonFactory.Generate("E-", MovementControls.EFeedRate(0), 0);
					eMinusControl.Margin = extrusionMargin;
					eMinusControl.ToolTipText = "Retract filament";
					eMinusButtonAndText.AddChild(eMinusControl);
					eMinusButtons.Add(eMinusControl);
				}
				else
				{
					for (int i = 0; i < extruderCount; i++)
					{
						ExtrudeButton eMinusControl = moveButtonFactory.Generate(string.Format("E{0}-", i + 1), MovementControls.EFeedRate(0), i);
						eMinusControl.ToolTipText = "Retract filament";
						eMinusControl.Margin = extrusionMargin;
						eMinusButtonAndText.AddChild(eMinusControl);
						eMinusButtons.Add(eMinusControl);
					}
				}

				TextWidget eMinusControlLabel = new TextWidget(LocalizedString.Get("Retract"), pointSize: 11);
				eMinusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				eMinusControlLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
				eMinusButtonAndText.AddChild(eMinusControlLabel);
				eButtons.AddChild(eMinusButtonAndText);

				eMinusButtonAndText.HAnchor = HAnchor.FitToChildren;
				eMinusButtonAndText.VAnchor = VAnchor.FitToChildren;

				FlowLayoutWidget buttonSpacerContainer = new FlowLayoutWidget();
				for (int i = 0; i < extruderCount; i++)
				{
					GuiWidget eSpacer = new GuiWidget(2, buttonSeparationDistance);
					double buttonWidth = eMinusButtons[i].Width + 6;

					eSpacer.Margin = new BorderDouble((buttonWidth / 2), 0, ((buttonWidth) / 2), 0);
					eSpacer.BackgroundColor = XYZColors.eColor;
					buttonSpacerContainer.AddChild(eSpacer);
				}

				eButtons.AddChild(buttonSpacerContainer);

				buttonSpacerContainer.HAnchor = HAnchor.FitToChildren;
				buttonSpacerContainer.VAnchor = VAnchor.FitToChildren;

				FlowLayoutWidget ePlusButtonAndText = new FlowLayoutWidget();
				if (extruderCount == 1)
				{
					ExtrudeButton ePlusControl = moveButtonFactory.Generate("E+", MovementControls.EFeedRate(0), 0);
					ePlusControl.Margin = extrusionMargin;
					ePlusControl.ToolTipText = "Extrude filament";
					ePlusButtonAndText.AddChild(ePlusControl);
					ePlusButtons.Add(ePlusControl);
				}
				else
				{
					for (int i = 0; i < extruderCount; i++)
					{
						ExtrudeButton ePlusControl = moveButtonFactory.Generate(string.Format("E{0}+", i + 1), MovementControls.EFeedRate(0), i);
						ePlusControl.Margin = extrusionMargin;
						ePlusControl.ToolTipText = "Extrude filament";
						ePlusButtonAndText.AddChild(ePlusControl);
						ePlusButtons.Add(ePlusControl);
					}
				}

				TextWidget ePlusControlLabel = new TextWidget(LocalizedString.Get("Extrude"), pointSize: 11);
				ePlusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				ePlusControlLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
				ePlusButtonAndText.AddChild(ePlusControlLabel);
				eButtons.AddChild(ePlusButtonAndText);
				ePlusButtonAndText.HAnchor = HAnchor.FitToChildren;
				ePlusButtonAndText.VAnchor = VAnchor.FitToChildren;
			}

			eButtons.AddChild(new GuiWidget(10, 6));

			// add in some movement radio buttons
			FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget();
			TextWidget buttonsLabel = new TextWidget("Distance:", textColor: RGBA_Bytes.White);
			buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
			//setMoveDistanceControl.AddChild(buttonsLabel);

			{
				TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
				buttonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio;
				buttonFactory.FixedWidth = 30 * TextWidget.GlobalPointSizeScaleRatio;
				buttonFactory.fontSize = 8;
				buttonFactory.Margin = new BorderDouble(0);
				buttonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor;

				FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget();
				RadioButton oneButton = buttonFactory.GenerateRadioButton("1");
				oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
				oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(1); };
				moveRadioButtons.AddChild(oneButton);
				RadioButton tenButton = buttonFactory.GenerateRadioButton("10");
				tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
				tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(10); };
				moveRadioButtons.AddChild(tenButton);
				RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100");
				oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
				oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(100); };
				moveRadioButtons.AddChild(oneHundredButton);
				tenButton.Checked = true;
				moveRadioButtons.Margin = new BorderDouble(0, 3);
				setMoveDistanceControl.AddChild(moveRadioButtons);
			}

			TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8);
			mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
			setMoveDistanceControl.AddChild(mmLabel);
			setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft;
			eButtons.AddChild(setMoveDistanceControl);

			eButtons.HAnchor = HAnchor.FitToChildren;
			eButtons.VAnchor = VAnchor.FitToChildren | VAnchor.ParentBottom;

			return eButtons;
		}
コード例 #34
0
        private TabControl CreateNewAdvancedControls(ButtonBase.ButtonEventHandler AdvancedControlsButton_Click, EventHandler onMouseEnterBoundsPrintQueueLink, EventHandler onMouseLeaveBoundsPrintQueueLink)
        {
            TabControl advancedControls = new TabControl();

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
            advancedControls.TabBar.Margin = new BorderDouble(0, 0);
            advancedControls.TabBar.Padding = new BorderDouble(0, 2);

            int textSize = 16;

            if (AdvancedControlsButton_Click != null)
            {
                // this means we are in compact view and so we will make the tabs text a bit smaller
                textSize = 14;
                TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
                advancedControlsButtonFactory.invertImageLocation = false;
                advancedControlsLinkButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Print\nQueue"), "icon_arrow_left_32x32.png");
                advancedControlsLinkButton.Margin = new BorderDouble(right: 3);
                advancedControlsLinkButton.VAnchor = VAnchor.ParentBottom;
                advancedControlsLinkButton.Cursor = Cursors.Hand;
                advancedControlsLinkButton.Click += new ButtonBase.ButtonEventHandler(AdvancedControlsButton_Click);
                advancedControlsLinkButton.MouseEnterBounds += new EventHandler(onMouseEnterBoundsPrintQueueLink);
                advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsPrintQueueLink);

                advancedControls.TabBar.AddChild(advancedControlsLinkButton);
            }

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

            advancedControls.TabBar.AddChild(hSpacer);

            GuiWidget manualPrinterControls = new ManualPrinterControls();
            ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);
            manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            manualPrinterControlsScrollArea.AnchorAll();
            manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

            RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;

            //Add the tab contents for 'Advanced Controls'
            string printerControlsLabel = LocalizedString.Get("Controls").ToUpper();
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), "Controls Tab", textSize,
            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            string sliceSettingsLabel = LocalizedString.Get("Slice Settings").ToUpper();
            sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), "Slice Settings Tab", textSize,
                        ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            string configurationLabel = LocalizedString.Get("Configuration").ToUpper();
            ScrollableWidget configurationControls = new PrinterConfigurationPage();
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), "Configuration Tab", textSize,
                        ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            advancedControls.SelectedTabIndex = lastAdvanceControlsIndex;

            return advancedControls;
        }
コード例 #35
0
		public JogControls(XYZColors colors)
		{
			moveButtonFactory.normalTextColor = RGBA_Bytes.Black;

			double distanceBetweenControls = 12;
			double buttonSeparationDistance = 10;

			FlowLayoutWidget allControlsTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);

			allControlsTopToBottom.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;

			{
				FlowLayoutWidget allControlsLeftToRight = new FlowLayoutWidget();

				FlowLayoutWidget xYZWithDistance = new FlowLayoutWidget(FlowDirection.TopToBottom);
				{
					FlowLayoutWidget xYZControls = new FlowLayoutWidget();
					{
						GuiWidget xyGrid = CreateXYGridControl(colors, distanceBetweenControls, buttonSeparationDistance);
						xYZControls.AddChild(xyGrid);

						FlowLayoutWidget zButtons = CreateZButtons(XYZColors.zColor, buttonSeparationDistance, out zPlusControl, out zMinusControl);
						zButtons.VAnchor = Agg.UI.VAnchor.ParentBottom;
						xYZControls.AddChild(zButtons);
						xYZWithDistance.AddChild(xYZControls);
					}

					this.KeyDown += (sender, e) =>
				{

					double moveAmountPositive = AxisMoveAmount;
					double moveAmountNegative = -AxisMoveAmount;
					int eMoveAmountPositive = EAxisMoveAmount;
					int eMoveAmountNegative = -EAxisMoveAmount;


					if (e.KeyCode == Keys.Home && hotKeysEnabled)
					{
						PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ);
					}
					else if (e.KeyCode == Keys.Z && hotKeysEnabled)
					{
						PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Z);
					}
					else if (e.KeyCode == Keys.Y && hotKeysEnabled)
					{
						PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Y);
					}
					else if (e.KeyCode == Keys.X && hotKeysEnabled)
					{
						PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.X);
					}
					else if (e.KeyCode == Keys.Left && hotKeysEnabled)
					{
						PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountNegative, MovementControls.XSpeed);
					}
					else if (e.KeyCode == Keys.Right && hotKeysEnabled)
					{
						PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountPositive, MovementControls.XSpeed);
					}
					else if (e.KeyCode == Keys.Up && hotKeysEnabled)
					{
						PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountPositive, MovementControls.YSpeed);
					}
					else if (e.KeyCode == Keys.Down && hotKeysEnabled)
					{
						PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountNegative, MovementControls.YSpeed);
					}
					else if (e.KeyCode == Keys.PageUp && hotKeysEnabled)
					{
						PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountPositive, MovementControls.ZSpeed);
					}
					else if (e.KeyCode == Keys.PageDown && hotKeysEnabled)
					{
						PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountNegative, MovementControls.ZSpeed);
					}
					else if (e.KeyCode == Keys.E && hotKeysEnabled)
					{
						PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountPositive, MovementControls.EFeedRate(0));

					}
					else if (e.KeyCode == Keys.R && hotKeysEnabled)
					{
						PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountNegative, MovementControls.EFeedRate(0));
					}
				};

					// add in some movement radio buttons
					FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget();
					TextWidget buttonsLabel = new TextWidget("Distance:", textColor: RGBA_Bytes.White);
					buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
					//setMoveDistanceControl.AddChild(buttonsLabel);

					{
						TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
						buttonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio;
						buttonFactory.FixedWidth = 30 * TextWidget.GlobalPointSizeScaleRatio;
						buttonFactory.fontSize = 8;
						buttonFactory.Margin = new BorderDouble(0);
						buttonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor;

						FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget();

						RadioButton pointOneButton = buttonFactory.GenerateRadioButton("0.1");
						pointOneButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
						pointOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(.1); };
						moveRadioButtons.AddChild(pointOneButton);

						RadioButton oneButton = buttonFactory.GenerateRadioButton("1");
						oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
						oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(1); };
						moveRadioButtons.AddChild(oneButton);

						RadioButton tenButton = buttonFactory.GenerateRadioButton("10");
						tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
						tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(10); };
						moveRadioButtons.AddChild(tenButton);

						RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100");
						oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
						oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(100); };
						moveRadioButtons.AddChild(oneHundredButton);

						tenButton.Checked = true;
						moveRadioButtons.Margin = new BorderDouble(0, 3);
						setMoveDistanceControl.AddChild(moveRadioButtons);
					}

					TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8);
					mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
					setMoveDistanceControl.AddChild(mmLabel);
					setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft;
					xYZWithDistance.AddChild(setMoveDistanceControl);
				}
				
				allControlsLeftToRight.AddChild(xYZWithDistance);

#if !__ANDROID__

				allControlsLeftToRight.AddChild(GetHotkeyControlContainer());

#endif
				GuiWidget barBetweenZAndE = new GuiWidget(2, 2);
				barBetweenZAndE.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
				barBetweenZAndE.BackgroundColor = RGBA_Bytes.White;
				barBetweenZAndE.Margin = new BorderDouble(distanceBetweenControls, 5);
				allControlsLeftToRight.AddChild(barBetweenZAndE);

				//moveButtonFactory.normalFillColor = XYZColors.eColor;

				FlowLayoutWidget eButtons = CreateEButtons(buttonSeparationDistance);
				eButtons.VAnchor |= Agg.UI.VAnchor.ParentTop;
				allControlsLeftToRight.AddChild(eButtons);

			
				allControlsTopToBottom.AddChild(allControlsLeftToRight);

			}
			
			this.AddChild(allControlsTopToBottom);
			this.HAnchor = HAnchor.FitToChildren;
			this.VAnchor = VAnchor.FitToChildren;

			Margin = new BorderDouble(3);

			// this.HAnchor |= HAnchor.ParentLeftRight;

		}
コード例 #36
0
        public void doLayout()
        {
            this.RemoveAllChildren();
            TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
            FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
            topToBottom.Padding = new BorderDouble(10);
            topToBottom.AnchorAll();

			string exportLblTxt = new LocalizedString ("File export options").Translated;
			string exportLblTxtFull = string.Format ("{0}:", exportLblTxt);
			TextWidget exportLabel = new TextWidget(exportLblTxtFull);
            exportLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            topToBottom.AddChild(exportLabel);

            GuiWidget dividerLine = new GuiWidget();
            dividerLine.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
            dividerLine.Height = 1;
            dividerLine.Margin = new BorderDouble(0, 3);
            dividerLine.BackgroundColor = RGBA_Bytes.White;
            topToBottom.AddChild(dividerLine);

            if (!partIsGCode)
            {
				string exportStlTxt = new LocalizedString("Export as").Translated;
				string exportStlTxtFull = string.Format("{0} STL", exportStlTxt);

				Button exportAsStlButton = textImageButtonFactory.Generate(exportStlTxtFull);
                exportAsStlButton.Click += new ButtonBase.ButtonEventHandler(exportSTL_Click);
                //exportSTL.HAnchor = Agg.UI.HAnchor.ParentCenter;
                topToBottom.AddChild(exportAsStlButton);
            }

            bool showExportGCodeButton = ActivePrinterProfile.Instance.ActivePrinter != null || partIsGCode;

            if(showExportGCodeButton)
            {
				string exportGCodeText = new LocalizedString("Export as").Translated;
				string exportGCodeTextFull = string.Format("{0} GCode", exportGCodeText);

				Button exportGCode = textImageButtonFactory.Generate(exportGCodeTextFull);

                //exportGCode.HAnchor = Agg.UI.HAnchor.ParentCenter;
				exportGCode.Click += new ButtonBase.ButtonEventHandler(exportGCode_Click);
				topToBottom.AddChild(exportGCode);
            }

            GuiWidget vSpacer = new GuiWidget();
            vSpacer.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
            topToBottom.AddChild(vSpacer);

            if (!showExportGCodeButton)
            {
				string noGCodeMessageTxtBeg = new LocalizedString("Note").Translated;
				string noGCodeMessageTxtEnd = new LocalizedString ("To enable GCode export, select a printer profile.").Translated;
				string noGCodeMessageTxtFull = string.Format ("{0}: {1}", noGCodeMessageTxtBeg, noGCodeMessageTxtEnd);
				TextWidget noGCodeMessage = new TextWidget(noGCodeMessageTxtFull, textColor: RGBA_Bytes.White, pointSize: 10);
                topToBottom.AddChild(noGCodeMessage);
			}

            // TODO: make this work on the mac and then delete this if
           	if (MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType() == WindowsFormsAbstract.OSType.Windows)
            {
				showInFolderAfterSave = new CheckBox(new LocalizedString("Show file in folder after save").Translated, RGBA_Bytes.White, 10);
                showInFolderAfterSave.Margin = new BorderDouble(top: 10);
                topToBottom.AddChild(showInFolderAfterSave);
            }

            this.AddChild(topToBottom);
        }
コード例 #37
0
        public JogControls(XYZColors colors)
        {
            moveButtonFactory.normalTextColor = RGBA_Bytes.Black;

            

            double distanceBetweenControls = 20;
            double buttonSeparationDistance = 10;

            FlowLayoutWidget allControlsTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);

            allControlsTopToBottom.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;

            {
                FlowLayoutWidget allControlsLeftToRight = new FlowLayoutWidget();

                FlowLayoutWidget xYZWithDistance = new FlowLayoutWidget(FlowDirection.TopToBottom);
                {
                    FlowLayoutWidget xYZControls = new FlowLayoutWidget();
                    {
                        GuiWidget xyGrid = CreateXYGridControl(colors, distanceBetweenControls, buttonSeparationDistance);
                        xYZControls.AddChild(xyGrid);

                        FlowLayoutWidget zButtons = CreateZButtons(XYZColors.zColor, buttonSeparationDistance, out zPlusControl, out zMinusControl);
                        zButtons.VAnchor = Agg.UI.VAnchor.ParentBottom;
                        xYZControls.AddChild(zButtons);
                        xYZWithDistance.AddChild(xYZControls);
                    }

                    // add in some movement radio buttons
                    FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget();
                    TextWidget buttonsLabel = new TextWidget("Distance:", textColor: RGBA_Bytes.White);
                    buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
                    //setMoveDistanceControl.AddChild(buttonsLabel);

                    {
                        TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
                        buttonFactory.FixedHeight = 20;
                        buttonFactory.FixedWidth = 30;
                        buttonFactory.fontSize = 10;
                        buttonFactory.Margin = new BorderDouble(0);

                        FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget();
                        
                        RadioButton pointOneButton = buttonFactory.GenerateRadioButton(".1");
                        pointOneButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
                        pointOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(.1); };
                        moveRadioButtons.AddChild(pointOneButton);
                        
                        RadioButton oneButton = buttonFactory.GenerateRadioButton("1");
                        oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
                        oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(1); };
                        moveRadioButtons.AddChild(oneButton);

                        RadioButton tenButton = buttonFactory.GenerateRadioButton("10");
                        tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
                        tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(10); };
                        moveRadioButtons.AddChild(tenButton);

                        RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100");
                        oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
                        oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(100); };
                        moveRadioButtons.AddChild(oneHundredButton);

                        tenButton.Checked = true;
                        moveRadioButtons.Margin = new BorderDouble(0,3);
                        setMoveDistanceControl.AddChild(moveRadioButtons);
                    }

                    TextWidget mmLabel = new TextWidget("mm", textColor: RGBA_Bytes.White, pointSize:10);
                    mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
                    setMoveDistanceControl.AddChild(mmLabel);
                    setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft;
                    xYZWithDistance.AddChild(setMoveDistanceControl);
                }

                allControlsLeftToRight.AddChild(xYZWithDistance);

                GuiWidget barBetweenZAndE = new GuiWidget(2, 2);
                barBetweenZAndE.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
                barBetweenZAndE.BackgroundColor = RGBA_Bytes.White;
                barBetweenZAndE.Margin = new BorderDouble(distanceBetweenControls, 5);
                allControlsLeftToRight.AddChild(barBetweenZAndE);

                moveButtonFactory.normalFillColor = XYZColors.eColor;

                FlowLayoutWidget eButtons = CreateEButtons(buttonSeparationDistance);
                eButtons.VAnchor |= Agg.UI.VAnchor.ParentTop;
                allControlsLeftToRight.AddChild(eButtons);

                allControlsTopToBottom.AddChild(allControlsLeftToRight);
            }

            this.AddChild(allControlsTopToBottom);
            HAnchor = HAnchor.FitToChildren;
            VAnchor = VAnchor.FitToChildren;

            Margin = new BorderDouble(3);

            this.HAnchor |= HAnchor.ParentLeftRight;
        }
コード例 #38
0
        public void RebuildTheme(IThemeColors colors)
        {
            int size = (int)(16 * GuiWidget.DeviceScale);

            if (AggContext.OperatingSystem == OSType.Android)
            {
                RestoreNormal = ColorCircle(size, new Color(200, 0, 0));
            }
            else
            {
                RestoreNormal = ColorCircle(size, Color.Transparent);
            }

            RestoreHover   = ColorCircle(size, new Color("#DB4437"));
            restorePressed = ColorCircle(size, new Color(255, 0, 0));

            this.Colors = colors;

            this.GeneratingThumbnailIcon = AggContext.StaticData.LoadIcon("building_thumbnail_40x40.png", 40, 40, this.InvertIcons);

            DefaultThumbView.ThumbColor = new Color(colors.PrimaryTextColor, 30);

            var commonOptions = new ButtonFactoryOptions();

            commonOptions.NormalTextColor   = colors.PrimaryTextColor;
            commonOptions.HoverTextColor    = colors.PrimaryTextColor;
            commonOptions.PressedTextColor  = colors.PrimaryTextColor;
            commonOptions.DisabledTextColor = colors.TertiaryBackgroundColor;
            commonOptions.Margin            = this.TextButtonPadding;
            commonOptions.FontSize          = this.DefaultFontSize;
            commonOptions.ImageSpacing      = 8;
            commonOptions.BorderWidth       = 0;
            commonOptions.FixedHeight       = this.ButtonHeight;

            this.TabBodyBackground = this.ResolveColor(
                colors.TertiaryBackgroundColor,
                new Color(
                    Color.White,
                    (colors.IsDarkTheme) ? 3 : 25));

            this.ActiveTabColor       = this.TabBodyBackground;
            this.TabBarBackground     = this.ActiveTabColor.AdjustLightness(0.85).ToColor();
            this.ThumbnailBackground  = this.MinimalShade;
            this.AccentMimimalOverlay = new Color(this.Colors.PrimaryAccentColor, 50);

            // Active tab color with slight transparency
            this.InteractionLayerOverlayColor = new Color(this.ActiveTabColor, 240);

            float alpha0to1 = (colors.IsDarkTheme ? 20 : 60) / 255.0f;

            this.InactiveTabColor = ResolveColor(colors.PrimaryBackgroundColor, new Color(Color.White, this.SlightShade.alpha));

            this.SplitterBackground = this.ActiveTabColor.AdjustLightness(0.87).ToColor();

            this.ButtonFactory = new TextImageButtonFactory(commonOptions);

            var commonGray = new ButtonFactoryOptions(commonOptions)
            {
                NormalTextColor  = Color.Black,
                NormalFillColor  = Color.LightGray,
                HoverTextColor   = Color.Black,
                PressedTextColor = Color.Black,
                PressedFillColor = Color.LightGray,
            };

            #region PartPreviewWidget

            WhiteButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
            {
                FixedWidth  = sideBarButtonWidth,
                FixedHeight = TabButtonHeight,

                NormalTextColor   = Color.Black,
                NormalFillColor   = Color.White,
                NormalBorderColor = new Color(colors.PrimaryTextColor, 200),

                HoverTextColor   = Color.Black,
                HoverFillColor   = new Color(255, 255, 255, 200),
                HoverBorderColor = new Color(colors.PrimaryTextColor, 200),

                BorderWidth = 1,
            });
            #endregion

            this.LinkButtonFactory = new LinkButtonFactory()
            {
                fontSize  = FontSize11,
                textColor = colors.PrimaryTextColor
            };
        }
コード例 #39
0
		private FlowLayoutWidget GetHotkeyControlContainer()
		{
			TextImageButtonFactory hotKeyButtonFactory = new TextImageButtonFactory();
			hotKeyButtonFactory.FixedHeight = 20 * GuiWidget.DeviceScale;
			hotKeyButtonFactory.FixedWidth = 30 * GuiWidget.DeviceScale;
			hotKeyButtonFactory.fontSize = 8;

			hotKeyButtonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor;

			FlowLayoutWidget hotkeyControlContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			hotkeyControlContainer.HAnchor = HAnchor.FitToChildren;
			hotkeyControlContainer.VAnchor = VAnchor.ParentBottomTop;
			hotkeyControlContainer.ToolTipText = "Enable cursor keys for movement";
			hotkeyControlContainer.Margin = new BorderDouble(left: 10);

            RadioButton hotKeyButton = hotKeyButtonFactory.GenerateRadioButton("", StaticData.Instance.LoadIcon("hot_key_small_white.png", 19, 12).InvertLightness());
			hotKeyButton.Margin = new BorderDouble(5);
            hotKeyButton.FocusChanged += (sender, e) =>
            {
				if ((sender as GuiWidget).Focused)
				{
					hotKeyButton.Checked = false;
					hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
					hotKeysEnabled = false;
				}
				else
				{
					hotKeyButton.Checked = true;
					hotKeyButton.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
					hotKeysEnabled = true;
				}
			};

			hotkeyControlContainer.AddChild(hotKeyButton);

			return hotkeyControlContainer;

		}
コード例 #40
0
ファイル: WizardPage.cs プロジェクト: IceForgTW/MatterControl
        public WizardPage(string unlocalizedTextForCancelButton = "Cancel", string unlocalizedTextForTitle = "Setup Wizard")
        {
            whiteImageButtonFactory = new TextImageButtonFactory()
            {
                normalFillColor   = RGBA_Bytes.White,
                disabledFillColor = RGBA_Bytes.White,
                fontSize          = 16,
                borderWidth       = 1,

                normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
                hoverBorderColor  = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),

                disabledTextColor = RGBA_Bytes.DarkGray,
                hoverTextColor    = ActiveTheme.Instance.PrimaryTextColor,
                normalTextColor   = RGBA_Bytes.Black,
                pressedTextColor  = ActiveTheme.Instance.PrimaryTextColor,
                FixedWidth        = 200
            };

            if (!UserSettings.Instance.IsTouchScreen)
            {
                textImageButtonFactory = new TextImageButtonFactory()
                {
                    normalTextColor   = ActiveTheme.Instance.PrimaryTextColor,
                    hoverTextColor    = ActiveTheme.Instance.PrimaryTextColor,
                    disabledTextColor = ActiveTheme.Instance.PrimaryTextColor,
                    pressedTextColor  = ActiveTheme.Instance.PrimaryTextColor,
                    borderWidth       = 0
                };

                linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor;
                linkButtonFactory.fontSize  = 10;

                this.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
                this.Padding         = new BorderDouble(0);         //To be re-enabled once native borders are turned off
            }

            this.AnchorAll();

            cancelButton        = textImageButtonFactory.Generate(unlocalizedTextForCancelButton.Localize());
            cancelButton.Name   = unlocalizedTextForCancelButton;
            cancelButton.Click += (s, e) =>
            {
                UiThread.RunOnIdle(() => WizardWindow?.Close());
            };

            // Create the main container
            mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                Padding         = new BorderDouble(12, 12, 12, 0),
                BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor
            };
            mainContainer.AnchorAll();

            // Create the header row for the widget
            headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight)
            {
                Margin  = new BorderDouble(0, 3, 0, 0),
                Padding = new BorderDouble(0, 12),
                HAnchor = HAnchor.ParentLeftRight
            };

            headerLabel = new TextWidget(unlocalizedTextForTitle.Localize(), pointSize: 24, textColor: ActiveTheme.Instance.SecondaryAccentColor)
            {
                AutoExpandBoundsToText = true
            };
            headerRow.AddChild(headerLabel);

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

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

            mainContainer.AddChild(headerRow);
            mainContainer.AddChild(contentRow);
            mainContainer.AddChild(footerRow);

            if (!UserSettings.Instance.IsTouchScreen)
            {
                mainContainer.Padding = new BorderDouble(3, 5, 3, 5);
                headerRow.Padding     = new BorderDouble(0, 3, 0, 3);

                headerLabel.PointSize = 14;
                headerLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                contentRow.Padding    = new BorderDouble(5);
                footerRow.Margin      = new BorderDouble(0, 3);
            }

            this.AddChild(mainContainer);
        }
コード例 #41
0
		public void CreateWindowContent()
		{
			this.RemoveAllChildren();
			TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
			FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
			topToBottom.Padding = new BorderDouble(3, 0, 3, 5);
			topToBottom.AnchorAll();

			// Creates Header
			FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
			headerRow.HAnchor = HAnchor.ParentLeftRight;
			headerRow.Margin = new BorderDouble(0, 3, 0, 0);
			headerRow.Padding = new BorderDouble(0, 3, 0, 3);
			BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			//Creates Text and adds into header
			{
				TextWidget elementHeader = new TextWidget("File export options:".Localize(), pointSize: 14);
				elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				elementHeader.HAnchor = HAnchor.ParentLeftRight;
				elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom;

				headerRow.AddChild(elementHeader);
				topToBottom.AddChild(headerRow);
			}

			// Creates container in the middle of window
			FlowLayoutWidget middleRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			{
				middleRowContainer.HAnchor = HAnchor.ParentLeftRight;
				middleRowContainer.VAnchor = VAnchor.ParentBottomTop;
				middleRowContainer.Padding = new BorderDouble(5);
				middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
			}

			if (!partIsGCode)
			{
				string exportStlText = LocalizedString.Get("Export as");
				string exportStlTextFull = string.Format("{0} STL", exportStlText);

				Button exportAsStlButton = textImageButtonFactory.Generate(exportStlTextFull);
				exportAsStlButton.HAnchor = HAnchor.ParentLeft;
				exportAsStlButton.Cursor = Cursors.Hand;
				exportAsStlButton.Click += new EventHandler(exportSTL_Click);
				middleRowContainer.AddChild(exportAsStlButton);
			}

			if (!partIsGCode)
			{
				string exportAmfText = LocalizedString.Get("Export as");
				string exportAmfTextFull = string.Format("{0} AMF", exportAmfText);

				Button exportAsAmfButton = textImageButtonFactory.Generate(exportAmfTextFull);
				exportAsAmfButton.HAnchor = HAnchor.ParentLeft;
				exportAsAmfButton.Cursor = Cursors.Hand;
				exportAsAmfButton.Click += new EventHandler(exportAMF_Click);
				middleRowContainer.AddChild(exportAsAmfButton);
			}

			bool showExportGCodeButton = ActivePrinterProfile.Instance.ActivePrinter != null || partIsGCode;

			if (showExportGCodeButton)
			{
				string exportGCodeText = LocalizedString.Get("Export as");
				string exportGCodeTextFull = string.Format("{0} GCode", exportGCodeText);
				Button exportGCode = textImageButtonFactory.Generate(exportGCodeTextFull);
				exportGCode.HAnchor = HAnchor.ParentLeft;
				exportGCode.Cursor = Cursors.Hand;
				exportGCode.Click += new EventHandler((object sender, EventArgs e) =>
				{
					UiThread.RunOnIdle(ExportGCode_Click);
				});
				middleRowContainer.AddChild(exportGCode);

				bool showExportX3GButton = ActiveSliceSettings.Instance.IsMakerbotGCodeFlavor();
				if (showExportX3GButton)
				{
					string exportAsX3GText = "Export as X3G".Localize();
					Button exportAsX3G = textImageButtonFactory.Generate(exportAsX3GText);
					exportAsX3G.HAnchor = HAnchor.ParentLeft;
					exportAsX3G.Cursor = Cursors.Hand;
					exportAsX3G.Click += new EventHandler((object sender, EventArgs e) =>
						{
							UiThread.RunOnIdle(ExportX3G_Click);
						});
					middleRowContainer.AddChild(exportAsX3G);
				}
			}

			middleRowContainer.AddChild(new VerticalSpacer());

			// If print leveling is enabled then add in a check box 'Apply Leveling During Export' and default checked.
			if (showExportGCodeButton && ActivePrinterProfile.Instance.DoPrintLeveling)
			{
				applyLeveling = new CheckBox(LocalizedString.Get(applyLevelingDuringExportString), ActiveTheme.Instance.PrimaryTextColor, 10);
				applyLeveling.Checked = true;
				applyLeveling.HAnchor = HAnchor.ParentLeft;
				applyLeveling.Cursor = Cursors.Hand;
				//applyLeveling.Margin = new BorderDouble(top: 10);
				middleRowContainer.AddChild(applyLeveling);
			}

			// TODO: make this work on the mac and then delete this if
			if (OsInformation.OperatingSystem == OSType.Windows
				|| OsInformation.OperatingSystem == OSType.X11)
			{
				showInFolderAfterSave = new CheckBox(LocalizedString.Get("Show file in folder after save"), ActiveTheme.Instance.PrimaryTextColor, 10);
				showInFolderAfterSave.HAnchor = HAnchor.ParentLeft;
				showInFolderAfterSave.Cursor = Cursors.Hand;
				//showInFolderAfterSave.Margin = new BorderDouble(top: 10);
				middleRowContainer.AddChild(showInFolderAfterSave);
			}

			if (!showExportGCodeButton)
			{
				string noGCodeMessageTextBeg = LocalizedString.Get("Note");
				string noGCodeMessageTextEnd = LocalizedString.Get("To enable GCode export, select a printer profile.");
				string noGCodeMessageTextFull = string.Format("{0}: {1}", noGCodeMessageTextBeg, noGCodeMessageTextEnd);
				TextWidget noGCodeMessage = new TextWidget(noGCodeMessageTextFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10);
				noGCodeMessage.HAnchor = HAnchor.ParentLeft;
				middleRowContainer.AddChild(noGCodeMessage);
			}

			//Creates button container on the bottom of window
			FlowLayoutWidget buttonRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
			{
				BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
				buttonRow.HAnchor = HAnchor.ParentLeftRight;
				buttonRow.Padding = new BorderDouble(0, 3);
			}

			Button cancelButton = textImageButtonFactory.Generate("Cancel");
			cancelButton.Cursor = Cursors.Hand;
			cancelButton.Click += (sender, e) =>
			{
				CloseOnIdle();
			};

			buttonRow.AddChild(new HorizontalSpacer());
			buttonRow.AddChild(cancelButton);
			topToBottom.AddChild(middleRowContainer);
			topToBottom.AddChild(buttonRow);

			this.AddChild(topToBottom);
		}
コード例 #42
0
		private TabControl CreateAdvancedControlsTab()
		{
			TabControl advancedControls = new TabControl();

			BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
			advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
			advancedControls.TabBar.Margin = new BorderDouble(0, 0);
			advancedControls.TabBar.Padding = new BorderDouble(0, 2);

			int textSize = 16;

			// this means we are in compact view and so we will make the tabs text a bit smaller
			textSize = 14;
			TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
			advancedControlsButtonFactory.fontSize = 14;
			advancedControlsButtonFactory.invertImageLocation = false;
			backButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Back"), StaticData.Instance.LoadIcon("icon_arrow_left_32x32.png", 32,32));
			backButton.ToolTipText = "Switch to Queue, Library and History".Localize();
			backButton.Margin = new BorderDouble(right: 3);
			backButton.VAnchor = VAnchor.ParentBottom;
			backButton.Cursor = Cursors.Hand;
			backButton.Click += (s, e) => BackClicked?.Invoke(this, null);

			advancedControls.TabBar.AddChild(backButton);

			advancedControls.TabBar.AddChild(new HorizontalSpacer());

			GuiWidget manualPrinterControls = new ManualPrinterControls();

			ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);
			manualPrinterControlsScrollArea.ScrollArea.HAnchor |= HAnchor.ParentLeftRight;
			manualPrinterControlsScrollArea.AnchorAll();
			manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

			RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;

			if (ActiveSliceSettings.Instance.PrinterSelected)
			{
				sliceSettingsWidget = new SliceSettingsWidget();
			}
			else
			{
				sliceSettingsWidget = new NoSettingsWidget();
			}

			var sliceSettingsTabPage = new TabPage(sliceSettingsWidget, "Settings".Localize().ToUpper());
			var sliceSettingPopOut = new PopOutTextTabWidget(sliceSettingsTabPage, SliceSettingsTabName, new Vector2(590, 400), textSize);
			advancedControls.AddTab(sliceSettingPopOut);
			
			var controlsTabPage = new TabPage(manualPrinterControlsScrollArea, "Controls".Localize().ToUpper());
			var controlsPopOut = new PopOutTextTabWidget(controlsTabPage, ControlsTabName, new Vector2(400, 300), textSize);
			advancedControls.AddTab(controlsPopOut);

#if !__ANDROID__
			MenuOptionSettings.sliceSettingsPopOut = sliceSettingPopOut;
			MenuOptionSettings.controlsPopOut = controlsPopOut;
#endif

			var optionsControls = new PrinterConfigurationScrollWidget();
			advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(optionsControls, "Options".Localize().ToUpper()), "Options Tab", textSize,
						ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

			// Make sure we are on the right tab when we create this view
			{
				string selectedTab = UserSettings.Instance.get(ThirdPanelTabView_AdvancedControls_CurrentTab);
				advancedControls.SelectTab(selectedTab);

				advancedControls.TabBar.TabIndexChanged += (sender, e) =>
				{
					string selectedTabName = advancedControls.TabBar.SelectedTabName;
					if (!string.IsNullOrEmpty(selectedTabName))
					{
						UserSettings.Instance.set(ThirdPanelTabView_AdvancedControls_CurrentTab, selectedTabName);
					}
				};
			}

			return advancedControls;
		}
コード例 #43
0
        public void CreateWindowContent()
        {
            this.RemoveAllChildren();
            TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
            FlowLayoutWidget       topToBottom            = new FlowLayoutWidget(FlowDirection.TopToBottom);

            topToBottom.Padding = new BorderDouble(3, 0, 3, 5);
            topToBottom.AnchorAll();

            // Creates Header
            FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);

            headerRow.HAnchor = HAnchor.ParentLeftRight;
            headerRow.Margin  = new BorderDouble(0, 3, 0, 0);
            headerRow.Padding = new BorderDouble(0, 3, 0, 3);
            BackgroundColor   = ActiveTheme.Instance.PrimaryBackgroundColor;

            //Creates Text and adds into header
            {
                TextWidget elementHeader = new TextWidget("File export options:".Localize(), pointSize: 14);
                elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                elementHeader.HAnchor   = HAnchor.ParentLeftRight;
                elementHeader.VAnchor   = Agg.UI.VAnchor.ParentBottom;

                headerRow.AddChild(elementHeader);
                topToBottom.AddChild(headerRow);
            }

            // Creates container in the middle of window
            FlowLayoutWidget middleRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            {
                middleRowContainer.HAnchor         = HAnchor.ParentLeftRight;
                middleRowContainer.VAnchor         = VAnchor.ParentBottomTop;
                middleRowContainer.Padding         = new BorderDouble(5);
                middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
            }

            if (!partIsGCode)
            {
                string exportStlText     = LocalizedString.Get("Export as");
                string exportStlTextFull = string.Format("{0} STL", exportStlText);

                Button exportAsStlButton = textImageButtonFactory.Generate(exportStlTextFull);
                exportAsStlButton.HAnchor = HAnchor.ParentLeft;
                exportAsStlButton.Cursor  = Cursors.Hand;
                exportAsStlButton.Click  += new EventHandler(exportSTL_Click);
                middleRowContainer.AddChild(exportAsStlButton);
            }

            if (!partIsGCode)
            {
                string exportAmfText     = LocalizedString.Get("Export as");
                string exportAmfTextFull = string.Format("{0} AMF", exportAmfText);

                Button exportAsAmfButton = textImageButtonFactory.Generate(exportAmfTextFull);
                exportAsAmfButton.HAnchor = HAnchor.ParentLeft;
                exportAsAmfButton.Cursor  = Cursors.Hand;
                exportAsAmfButton.Click  += new EventHandler(exportAMF_Click);
                middleRowContainer.AddChild(exportAsAmfButton);
            }

            bool showExportGCodeButton = ActivePrinterProfile.Instance.ActivePrinter != null || partIsGCode;

            if (showExportGCodeButton)
            {
                string exportGCodeText     = LocalizedString.Get("Export as");
                string exportGCodeTextFull = string.Format("{0} GCode", exportGCodeText);
                Button exportGCode         = textImageButtonFactory.Generate(exportGCodeTextFull);
                exportGCode.HAnchor = HAnchor.ParentLeft;
                exportGCode.Cursor  = Cursors.Hand;
                exportGCode.Click  += new EventHandler((object sender, EventArgs e) =>
                {
                    UiThread.RunOnIdle(ExportGCode_Click);
                });
                middleRowContainer.AddChild(exportGCode);

                bool showExportX3GButton = ActiveSliceSettings.Instance.IsMakerbotGCodeFlavor();
                if (showExportX3GButton)
                {
                    string exportAsX3GText = "Export as X3G".Localize();
                    Button exportAsX3G     = textImageButtonFactory.Generate(exportAsX3GText);
                    exportAsX3G.HAnchor = HAnchor.ParentLeft;
                    exportAsX3G.Cursor  = Cursors.Hand;
                    exportAsX3G.Click  += new EventHandler((object sender, EventArgs e) =>
                    {
                        UiThread.RunOnIdle(ExportX3G_Click);
                    });
                    middleRowContainer.AddChild(exportAsX3G);
                }
            }

            middleRowContainer.AddChild(new VerticalSpacer());

            // If print leveling is enabled then add in a check box 'Apply Leveling During Export' and default checked.
            if (showExportGCodeButton && ActivePrinterProfile.Instance.DoPrintLeveling)
            {
                applyLeveling         = new CheckBox(LocalizedString.Get(applyLevelingDuringExportString), ActiveTheme.Instance.PrimaryTextColor, 10);
                applyLeveling.Checked = true;
                applyLeveling.HAnchor = HAnchor.ParentLeft;
                applyLeveling.Cursor  = Cursors.Hand;
                //applyLeveling.Margin = new BorderDouble(top: 10);
                middleRowContainer.AddChild(applyLeveling);
            }

            // TODO: make this work on the mac and then delete this if
            if (OsInformation.OperatingSystem == OSType.Windows ||
                OsInformation.OperatingSystem == OSType.X11)
            {
                showInFolderAfterSave         = new CheckBox(LocalizedString.Get("Show file in folder after save"), ActiveTheme.Instance.PrimaryTextColor, 10);
                showInFolderAfterSave.HAnchor = HAnchor.ParentLeft;
                showInFolderAfterSave.Cursor  = Cursors.Hand;
                //showInFolderAfterSave.Margin = new BorderDouble(top: 10);
                middleRowContainer.AddChild(showInFolderAfterSave);
            }

            if (!showExportGCodeButton)
            {
                string     noGCodeMessageTextBeg  = LocalizedString.Get("Note");
                string     noGCodeMessageTextEnd  = LocalizedString.Get("To enable GCode export, select a printer profile.");
                string     noGCodeMessageTextFull = string.Format("{0}: {1}", noGCodeMessageTextBeg, noGCodeMessageTextEnd);
                TextWidget noGCodeMessage         = new TextWidget(noGCodeMessageTextFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10);
                noGCodeMessage.HAnchor = HAnchor.ParentLeft;
                middleRowContainer.AddChild(noGCodeMessage);
            }

            //Creates button container on the bottom of window
            FlowLayoutWidget buttonRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
            {
                BackgroundColor   = ActiveTheme.Instance.PrimaryBackgroundColor;
                buttonRow.HAnchor = HAnchor.ParentLeftRight;
                buttonRow.Padding = new BorderDouble(0, 3);
            }

            Button cancelButton = textImageButtonFactory.Generate("Cancel");

            cancelButton.Cursor = Cursors.Hand;
            cancelButton.Click += (sender, e) =>
            {
                CloseOnIdle();
            };

            buttonRow.AddChild(new HorizontalSpacer());
            buttonRow.AddChild(cancelButton);
            topToBottom.AddChild(middleRowContainer);
            topToBottom.AddChild(buttonRow);

            this.AddChild(topToBottom);
        }
コード例 #44
0
		public SetupAccountView(TextImageButtonFactory textImageButtonFactory)
			: base("My Account")
		{
			this.textImageButtonFactory = textImageButtonFactory;

			bool signedIn = true;
			string username = AuthenticationData.Instance.ActiveSessionUsername;
			if (username == null)
			{
				signedIn = false;
				username = "******";
			}

			mainContainer.AddChild(new TextWidget(username, pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor));

			FlowLayoutWidget buttonContainer = new FlowLayoutWidget();
			buttonContainer.HAnchor = HAnchor.ParentLeftRight;
			buttonContainer.Margin = new BorderDouble(0, 14);

			signInButton = textImageButtonFactory.Generate("Sign In");
			signInButton.Margin = new BorderDouble(left: 0);
			signInButton.VAnchor = VAnchor.ParentCenter;
			signInButton.Visible = !signedIn;
			signInButton.Click +=  (s, e) => UiThread.RunOnIdle(() =>
			{
				signInButton.Visible = false;
				signOutButton.Visible = false;
				statusMessage.Visible = true;
				ApplicationController.Instance.StartSignIn();
			});
			buttonContainer.AddChild(signInButton);

			signOutButton = textImageButtonFactory.Generate("Sign Out");
			signOutButton.Margin = new BorderDouble(left: 0);
			signOutButton.VAnchor = VAnchor.ParentCenter;
			signOutButton.Visible = signedIn;
			signOutButton.Click += (s, e) => UiThread.RunOnIdle(() =>
			{
				signInButton.Visible = false;
				signOutButton.Visible = false;
				statusMessage.Visible = true;
				ApplicationController.Instance.StartSignOut();
			});
			buttonContainer.AddChild(signOutButton);

			statusMessage = new TextWidget("Please wait...", pointSize: 12, textColor: ActiveTheme.Instance.SecondaryAccentColor);
			statusMessage.Visible = false;
			buttonContainer.AddChild(statusMessage);

			mainContainer.AddChild(buttonContainer);

			ApplicationController.Instance.DoneReloadingAll.RegisterEvent(RemoveAndNewControl, ref unregisterEvents);
		}
コード例 #45
0
        public SetupAccountView(TextImageButtonFactory textImageButtonFactory)
            : base("My Account")
        {
            this.textImageButtonFactory = textImageButtonFactory;

            bool   signedIn = true;
            string username = AuthenticationData.Instance.ActiveSessionUsername;

            if (username == null)
            {
                signedIn = false;
                username = "******";
            }

            FlowLayoutWidget nameAndStatus = new FlowLayoutWidget();

            nameAndStatus.AddChild(new TextWidget(username, pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor));

            connectionStatus = new TextWidget(AuthenticationString, pointSize: 8, textColor: ActiveTheme.Instance.SecondaryTextColor)
            {
                Margin = new BorderDouble(5, 0, 0, 0),
                AutoExpandBoundsToText = true,
            };

            if (signedIn)
            {
                nameAndStatus.AddChild(connectionStatus);
            }


            mainContainer.AddChild(nameAndStatus);

            RefreshStatus();

            FlowLayoutWidget buttonContainer = new FlowLayoutWidget();

            buttonContainer.HAnchor = HAnchor.ParentLeftRight;
            buttonContainer.Margin  = new BorderDouble(0, 14);

            signInButton         = textImageButtonFactory.Generate("Sign In".Localize());
            signInButton.Margin  = new BorderDouble(left: 0);
            signInButton.VAnchor = VAnchor.ParentCenter;
            signInButton.Visible = !signedIn;
            signInButton.Click  += (s, e) =>
            {
#if __ANDROID__
                if (MatterControlApplication.Instance.IsNetworkConnected() &&
                    AuthenticationData.Instance.IsConnected)
                {
                    UiThread.RunOnIdle(ApplicationController.Instance.StartSignIn);
                }
                else
                {
                    WizardWindow.Show <NetworkTroubleshooting>("/networktroubleshooting", "Network Troubleshooting");
                }
#else
                UiThread.RunOnIdle(ApplicationController.Instance.StartSignIn);
#endif
            };
            buttonContainer.AddChild(signInButton);

            signOutButton         = textImageButtonFactory.Generate("Sign Out".Localize());
            signOutButton.Margin  = new BorderDouble(left: 0);
            signOutButton.VAnchor = VAnchor.ParentCenter;
            signOutButton.Visible = signedIn;
            signOutButton.Click  += (s, e) => UiThread.RunOnIdle(ApplicationController.Instance.StartSignOut);
            buttonContainer.AddChild(signOutButton);

            buttonContainer.AddChild(new HorizontalSpacer());

            // the redeem design code button
            textImageButtonFactory.disabledTextColor = new RGBA_Bytes(textImageButtonFactory.normalTextColor, 100);
            Button redeemPurchaseButton = textImageButtonFactory.Generate("Redeem Purchase".Localize());
            redeemPurchaseButton.Enabled = true;             // The library selector (the first library selected) is protected so we can't add to it.
            redeemPurchaseButton.Name    = "Redeem Code Button";
            redeemPurchaseButton.Margin  = new BorderDouble(0, 0, 10, 0);
            redeemPurchaseButton.Click  += (sender, e) =>
            {
                ApplicationController.Instance.RedeemDesignCode?.Invoke();
            };
            buttonContainer.AddChild(redeemPurchaseButton);

            // the redeem a share code button
            Button redeemShareButton = textImageButtonFactory.Generate("Enter Share Code".Localize());
            redeemShareButton.Enabled = true;             // The library selector (the first library selected) is protected so we can't add to it.
            redeemShareButton.Name    = "Enter Share Code";
            redeemShareButton.Margin  = new BorderDouble(0, 0, 10, 0);
            redeemShareButton.Click  += (sender, e) =>
            {
                ApplicationController.Instance.EnterShareCode?.Invoke();
            };

            if (!signedIn)
            {
                redeemPurchaseButton.Enabled = false;
                redeemShareButton.Enabled    = false;
            }

            buttonContainer.AddChild(redeemShareButton);

            statusMessage         = new TextWidget("Please wait...", pointSize: 12, textColor: ActiveTheme.Instance.SecondaryAccentColor);
            statusMessage.Visible = false;
            buttonContainer.AddChild(statusMessage);

            mainContainer.AddChild(buttonContainer);

            ApplicationController.Instance.DoneReloadingAll.RegisterEvent(RemoveAndNewControl, ref unregisterEvents);
        }
コード例 #46
0
        public void doLayout()
        {
            this.RemoveAllChildren();
            TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
            FlowLayoutWidget       topToBottom            = new FlowLayoutWidget(FlowDirection.TopToBottom);

            topToBottom.Padding = new BorderDouble(3, 0, 3, 5);
            topToBottom.AnchorAll();

            FlowLayoutWidget headerContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);

            headerContainer.HAnchor         = HAnchor.ParentLeftRight;
            headerContainer.Padding         = new BorderDouble(0, 3, 0, 3);
            headerContainer.Margin          = new BorderDouble(0, 3, 0, 0);
            headerContainer.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            string     exportLabelText     = LocalizedString.Get("File export options");
            string     exportLabelTextFull = string.Format("{0}:", exportLabelText);
            TextWidget exportLabel         = new TextWidget(exportLabelTextFull);

            exportLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            headerContainer.AddChild(exportLabel);
            topToBottom.AddChild(headerContainer);

            FlowLayoutWidget exportSTLGCodeButtonsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            exportSTLGCodeButtonsContainer.HAnchor         = HAnchor.ParentLeftRight;
            exportSTLGCodeButtonsContainer.VAnchor         = VAnchor.ParentBottomTop;
            exportSTLGCodeButtonsContainer.Padding         = new BorderDouble(5);
            exportSTLGCodeButtonsContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;

            Button cancelButton = textImageButtonFactory.Generate("Cancel");

            cancelButton.Padding = new BorderDouble(0);
            cancelButton.Click  += (sender, e) => {
                CloseOnIdle();
            };

            GuiWidget gDSpacer = new GuiWidget();

            gDSpacer.HAnchor = HAnchor.ParentLeftRight;

            if (!partIsGCode)
            {
                string exportStlText     = LocalizedString.Get("Export as");
                string exportStlTextFull = string.Format("{0} STL", exportStlText);

                Button exportAsStlButton = textImageButtonFactory.Generate(exportStlTextFull);
                exportAsStlButton.Click += new ButtonBase.ButtonEventHandler(exportSTL_Click);
                exportSTLGCodeButtonsContainer.AddChild(exportAsStlButton);
            }

            bool showExportGCodeButton = ActivePrinterProfile.Instance.ActivePrinter != null || partIsGCode;

            if (showExportGCodeButton)
            {
                string exportGCodeText     = LocalizedString.Get("Export as");
                string exportGCodeTextFull = string.Format("{0} GCode", exportGCodeText);

                Button exportGCode = textImageButtonFactory.Generate(exportGCodeTextFull);
                exportGCode.Click += new ButtonBase.ButtonEventHandler(exportGCode_Click);
                exportSTLGCodeButtonsContainer.AddChild(exportGCode);
            }

            GuiWidget vSpacer = new GuiWidget();

            vSpacer.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
            exportSTLGCodeButtonsContainer.AddChild(vSpacer);

            if (!showExportGCodeButton)
            {
                string     noGCodeMessageTextBeg  = LocalizedString.Get("Note");
                string     noGCodeMessageTextEnd  = LocalizedString.Get("To enable GCode export, select a printer profile.");
                string     noGCodeMessageTextFull = string.Format("{0}: {1}", noGCodeMessageTextBeg, noGCodeMessageTextEnd);
                TextWidget noGCodeMessage         = new TextWidget(noGCodeMessageTextFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10);
                exportSTLGCodeButtonsContainer.AddChild(noGCodeMessage);
            }

            FlowLayoutWidget buttonRow = new FlowLayoutWidget(FlowDirection.LeftToRight);

            buttonRow.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            buttonRow.HAnchor         = HAnchor.ParentLeftRight;
            buttonRow.Padding         = new BorderDouble(0);

            // TODO: make this work on the mac and then delete this if
            if (MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType() == WindowsFormsAbstract.OSType.Windows)
            {
                showInFolderAfterSave        = new CheckBox(LocalizedString.Get("Show file in folder after save"), ActiveTheme.Instance.PrimaryTextColor, 10);
                showInFolderAfterSave.Margin = new BorderDouble(top: 10);
                exportSTLGCodeButtonsContainer.AddChild(showInFolderAfterSave);
                buttonRow.AddChild(gDSpacer);
                buttonRow.AddChild(cancelButton);
                topToBottom.AddChild(exportSTLGCodeButtonsContainer);
                topToBottom.AddChild(buttonRow);
            }

            this.AddChild(topToBottom);
        }
コード例 #47
0
		public void CreateWindowContent()
		{
			this.RemoveAllChildren();
			TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
			FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
			topToBottom.Padding = new BorderDouble(3, 0, 3, 5);
			topToBottom.AnchorAll();

			// Creates Header
			FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
			headerRow.HAnchor = HAnchor.ParentLeftRight;
			headerRow.Margin = new BorderDouble(0, 3, 0, 0);
			headerRow.Padding = new BorderDouble(0, 3, 0, 3);
			BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			//Creates Text and adds into header
			{
				TextWidget elementHeader = new TextWidget("File export options:".Localize(), pointSize: 14);
				elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
				elementHeader.HAnchor = HAnchor.ParentLeftRight;
				elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom;

				headerRow.AddChild(elementHeader);
				topToBottom.AddChild(headerRow);
			}

			// Creates container in the middle of window
			FlowLayoutWidget middleRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			{
				middleRowContainer.HAnchor = HAnchor.ParentLeftRight;
				middleRowContainer.VAnchor = VAnchor.ParentBottomTop;
				middleRowContainer.Padding = new BorderDouble(5);
				middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
			}

			if (!partIsGCode)
			{
				string exportStlText = LocalizedString.Get("Export as");
				string exportStlTextFull = string.Format("{0} STL", exportStlText);

				Button exportAsStlButton = textImageButtonFactory.Generate(exportStlTextFull);
				exportAsStlButton.HAnchor = HAnchor.ParentLeft;
				exportAsStlButton.Cursor = Cursors.Hand;
				exportAsStlButton.Click += new EventHandler(exportSTL_Click);
				middleRowContainer.AddChild(exportAsStlButton);
			}

			if (!partIsGCode)
			{
				string exportAmfText = LocalizedString.Get("Export as");
				string exportAmfTextFull = string.Format("{0} AMF", exportAmfText);

				Button exportAsAmfButton = textImageButtonFactory.Generate(exportAmfTextFull);
				exportAsAmfButton.HAnchor = HAnchor.ParentLeft;
				exportAsAmfButton.Cursor = Cursors.Hand;
				exportAsAmfButton.Click += new EventHandler(exportAMF_Click);
				middleRowContainer.AddChild(exportAsAmfButton);
			}

			bool showExportGCodeButton = ActiveSliceSettings.Instance != null || partIsGCode;
			if (showExportGCodeButton)
			{
				string exportGCodeTextFull = string.Format("{0} G-Code", "Export as".Localize());
				Button exportGCode = textImageButtonFactory.Generate(exportGCodeTextFull);
				exportGCode.Name = "Export as GCode Button";
				exportGCode.HAnchor = HAnchor.ParentLeft;
				exportGCode.Cursor = Cursors.Hand;
				exportGCode.Click += new EventHandler((object sender, EventArgs e) =>
				{
					UiThread.RunOnIdle(ExportGCode_Click);
				});
				middleRowContainer.AddChild(exportGCode);

				PluginFinder<ExportGcodePlugin> exportPluginFinder = new PluginFinder<ExportGcodePlugin>();

				foreach (ExportGcodePlugin plugin in exportPluginFinder.Plugins)
				{
					//Create export button for each Plugin found

					string exportButtonText = plugin.GetButtonText().Localize();

					Button exportButton = textImageButtonFactory.Generate(exportButtonText);
					exportButton.HAnchor = HAnchor.ParentLeft;
					exportButton.Cursor = Cursors.Hand;
					exportButton.Click += (object sender, EventArgs e) =>
					{
						UiThread.RunOnIdle(() =>
						{
							// Close the export window
							Close();

							// Open a SaveFileDialog. If Save is clicked, slice the part if needed and pass the plugin the 
							// path to the gcode file and the target save path
							FileDialog.SaveFileDialog(
								new SaveFileDialogParams(plugin.GetExtensionFilter())
								{
									Title = "MatterControl: Export File",
									FileName = printItemWrapper.Name,
									ActionButtonLabel = "Export"
								},
								(SaveFileDialogParams saveParam) =>
								{
									string extension = Path.GetExtension(saveParam.FileName);
									if (extension == "")
									{
										saveParam.FileName += plugin.GetFileExtension();
									}

									if (partIsGCode)
									{
										plugin.Generate(printItemWrapper.FileLocation, saveParam.FileName);
									}
									else
									{
										SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper);

										printItemWrapper.SlicingDone += (printItem, eventArgs) =>
										{
											PrintItemWrapper sliceItem = (PrintItemWrapper)printItem;
											if (File.Exists(sliceItem.GetGCodePathAndFileName()))
											{
												plugin.Generate(sliceItem.GetGCodePathAndFileName(), saveParam.FileName);
											}
										};
									}
								});
						});
					}; // End exportButton Click handler

					middleRowContainer.AddChild(exportButton);
				}
			}

			middleRowContainer.AddChild(new VerticalSpacer());

			// If print leveling is enabled then add in a check box 'Apply Leveling During Export' and default checked.
			if (showExportGCodeButton && ActiveSliceSettings.Instance.DoPrintLeveling)
			{
				applyLeveling = new CheckBox(LocalizedString.Get(applyLevelingDuringExportString), ActiveTheme.Instance.PrimaryTextColor, 10);
				applyLeveling.Checked = true;
				applyLeveling.HAnchor = HAnchor.ParentLeft;
				applyLeveling.Cursor = Cursors.Hand;
				//applyLeveling.Margin = new BorderDouble(top: 10);
				middleRowContainer.AddChild(applyLeveling);
			}

			// TODO: make this work on the mac and then delete this if
			if (OsInformation.OperatingSystem == OSType.Windows
				|| OsInformation.OperatingSystem == OSType.X11)
			{
				showInFolderAfterSave = new CheckBox(LocalizedString.Get("Show file in folder after save"), ActiveTheme.Instance.PrimaryTextColor, 10);
				showInFolderAfterSave.HAnchor = HAnchor.ParentLeft;
				showInFolderAfterSave.Cursor = Cursors.Hand;
				//showInFolderAfterSave.Margin = new BorderDouble(top: 10);
				middleRowContainer.AddChild(showInFolderAfterSave);
			}

			if (!showExportGCodeButton)
			{
				string noGCodeMessageTextBeg = LocalizedString.Get("Note");
				string noGCodeMessageTextEnd = LocalizedString.Get("To enable GCode export, select a printer profile.");
				string noGCodeMessageTextFull = string.Format("{0}: {1}", noGCodeMessageTextBeg, noGCodeMessageTextEnd);
				TextWidget noGCodeMessage = new TextWidget(noGCodeMessageTextFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10);
				noGCodeMessage.HAnchor = HAnchor.ParentLeft;
				middleRowContainer.AddChild(noGCodeMessage);
			}

			//Creates button container on the bottom of window
			FlowLayoutWidget buttonRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
			{
				BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
				buttonRow.HAnchor = HAnchor.ParentLeftRight;
				buttonRow.Padding = new BorderDouble(0, 3);
			}

			Button cancelButton = textImageButtonFactory.Generate("Cancel");
			cancelButton.Name = "Export Item Window Cancel Button";
			cancelButton.Cursor = Cursors.Hand;
			cancelButton.Click += (sender, e) =>
			{
				CloseOnIdle();
			};

			buttonRow.AddChild(new HorizontalSpacer());
			buttonRow.AddChild(cancelButton);
			topToBottom.AddChild(middleRowContainer);
			topToBottom.AddChild(buttonRow);

			this.AddChild(topToBottom);
		}
コード例 #48
0
        public EditableNumberDisplay(TextImageButtonFactory textImageButtonFactory, string startingValue, string largestPossibleValue)
            : base(Agg.UI.FlowDirection.LeftToRight)
        {
            this.Margin = new BorderDouble(3, 0);
            this.VAnchor |= VAnchor.ParentBottomTop;

            clickableValueContainer = new ClickWidget();
            clickableValueContainer.VAnchor = VAnchor.ParentBottomTop;
            clickableValueContainer.Cursor = Cursors.Hand;
            clickableValueContainer.BorderWidth = 1;
            clickableValueContainer.BorderColor = new RGBA_Bytes(255, 255, 255, 140);


            clickableValueContainer.MouseEnterBounds += (sender, e) =>
            {
                clickableValueContainer.BorderWidth = 2;
                clickableValueContainer.BorderColor = new RGBA_Bytes(255, 255, 255, 255);
            };

            clickableValueContainer.MouseLeaveBounds += (sender, e) =>
            {
                clickableValueContainer.BorderWidth = 1;
                clickableValueContainer.BorderColor = new RGBA_Bytes(255, 255, 255, 140);
            };

            valueDisplay = new TextWidget(largestPossibleValue, pointSize: 12);
            valueDisplay.VAnchor = VAnchor.ParentCenter;
            valueDisplay.HAnchor = HAnchor.ParentLeft;
            valueDisplay.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            valueDisplay.Margin = new BorderDouble(6);

            clickableValueContainer.Click += new ClickWidget.ButtonEventHandler(editField_Click);

            clickableValueContainer.AddChild(valueDisplay);
            clickableValueContainer.SetBoundsToEncloseChildren();
            valueDisplay.Text = startingValue;

            numberInputField = new MHNumberEdit(0, pixelWidth: 40, allowDecimals: true);
            numberInputField.VAnchor = VAnchor.ParentCenter;
            numberInputField.Margin = new BorderDouble(left: 6);
            numberInputField.Visible = false;

            // This is a hack to make sure the control is tall enough. 
            // TODO: This hack needs a unit test and then pass and then remove this line.
            this.MinimumSize = new VectorMath.Vector2(0, numberInputField.Height);

			setButton = textImageButtonFactory.Generate("SET");
            setButton.VAnchor = VAnchor.ParentCenter;
            setButton.Margin = new BorderDouble(left: 6);
            setButton.Visible = false;

            numberInputField.ActuallNumberEdit.EnterPressed += new KeyEventHandler(ActuallNumberEdit_EnterPressed);

            numberInputField.KeyDown += (sender, e) =>
            {
                if (e.KeyCode == Keys.Escape)
                {
                    clickableValueContainer.Visible = true;
                    numberInputField.Visible = false;
                    setButton.Visible = false;
                }
            };

            setButton.Click += new ButtonBase.ButtonEventHandler(setButton_Click);

            this.AddChild(clickableValueContainer);
            this.AddChild(numberInputField);
            this.AddChild(setButton);
        }
コード例 #49
0
        public JogControls(XYZColors colors)
        {
            moveButtonFactory.normalTextColor = RGBA_Bytes.Black;

            double distanceBetweenControls  = 12;
            double buttonSeparationDistance = 10;

            FlowLayoutWidget allControlsTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);

            allControlsTopToBottom.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;

            {
                FlowLayoutWidget allControlsLeftToRight = new FlowLayoutWidget();

                FlowLayoutWidget xYZWithDistance = new FlowLayoutWidget(FlowDirection.TopToBottom);
                {
                    FlowLayoutWidget xYZControls = new FlowLayoutWidget();
                    {
                        GuiWidget xyGrid = CreateXYGridControl(colors, distanceBetweenControls, buttonSeparationDistance);
                        xYZControls.AddChild(xyGrid);

                        FlowLayoutWidget zButtons = CreateZButtons(XYZColors.zColor, buttonSeparationDistance, out zPlusControl, out zMinusControl);
                        zButtons.VAnchor = Agg.UI.VAnchor.ParentBottom;
                        xYZControls.AddChild(zButtons);
                        xYZWithDistance.AddChild(xYZControls);
                    }

                    this.KeyDown += (sender, e) =>
                    {
                        double moveAmountPositive  = AxisMoveAmount;
                        double moveAmountNegative  = -AxisMoveAmount;
                        int    eMoveAmountPositive = EAxisMoveAmount;
                        int    eMoveAmountNegative = -EAxisMoveAmount;

                        if (OsInformation.OperatingSystem == OSType.Windows)
                        {
                            if (e.KeyCode == Keys.Home && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ);
                            }
                            else if (e.KeyCode == Keys.Z && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Z);
                            }
                            else if (e.KeyCode == Keys.Y && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Y);
                            }
                            else if (e.KeyCode == Keys.X && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.X);
                            }
                            else if (e.KeyCode == Keys.Left && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountNegative, MovementControls.XSpeed);
                            }
                            else if (e.KeyCode == Keys.Right && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountPositive, MovementControls.XSpeed);
                            }
                            else if (e.KeyCode == Keys.Up && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountPositive, MovementControls.YSpeed);
                            }
                            else if (e.KeyCode == Keys.Down && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountNegative, MovementControls.YSpeed);
                            }
                            else if (e.KeyCode == Keys.PageUp && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountPositive, MovementControls.ZSpeed);
                            }
                            else if (e.KeyCode == Keys.PageDown && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountNegative, MovementControls.ZSpeed);
                            }
                            else if (e.KeyCode == Keys.E && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountPositive, MovementControls.EFeedRate(0));
                            }
                            else if (e.KeyCode == Keys.R && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountNegative, MovementControls.EFeedRate(0));
                            }
                        }
                        else if (OsInformation.OperatingSystem == OSType.Mac)
                        {
                            if (e.KeyCode == Keys.LButton && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ);
                            }
                            else if (e.KeyCode == Keys.Z && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Z);
                            }
                            else if (e.KeyCode == Keys.Y && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Y);
                            }
                            else if (e.KeyCode == Keys.X && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.X);
                            }
                            else if (e.KeyCode == Keys.Left && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountNegative, MovementControls.XSpeed);
                            }
                            else if (e.KeyCode == Keys.Right && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountPositive, MovementControls.XSpeed);
                            }
                            else if (e.KeyCode == Keys.Up && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountPositive, MovementControls.YSpeed);
                            }
                            else if (e.KeyCode == Keys.Down && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountNegative, MovementControls.YSpeed);
                            }
                            else if (e.KeyCode == (Keys.Back | Keys.Cancel) && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountPositive, MovementControls.ZSpeed);
                            }
                            else if (e.KeyCode == Keys.Clear && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountNegative, MovementControls.ZSpeed);
                            }
                            else if (e.KeyCode == Keys.E && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountPositive, MovementControls.EFeedRate(0));
                            }
                            else if (e.KeyCode == Keys.R && hotKeysEnabled)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountNegative, MovementControls.EFeedRate(0));
                            }
                        }
                    };

                    // add in some movement radio buttons
                    FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget();
                    TextWidget       buttonsLabel           = new TextWidget("Distance:", textColor: RGBA_Bytes.White);
                    buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
                    //setMoveDistanceControl.AddChild(buttonsLabel);

                    {
                        TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
                        buttonFactory.FixedHeight        = 20 * TextWidget.GlobalPointSizeScaleRatio;
                        buttonFactory.FixedWidth         = 30 * TextWidget.GlobalPointSizeScaleRatio;
                        buttonFactory.fontSize           = 8;
                        buttonFactory.Margin             = new BorderDouble(0);
                        buttonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor;

                        FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget();

                        RadioButton pointOneButton = buttonFactory.GenerateRadioButton("0.1");
                        pointOneButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        pointOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                               {
                                                                                   SetXYZMoveAmount(.1);
                                                                               }
                        };
                        moveRadioButtons.AddChild(pointOneButton);

                        RadioButton oneButton = buttonFactory.GenerateRadioButton("1");
                        oneButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                          {
                                                                              SetXYZMoveAmount(1);
                                                                          }
                        };
                        moveRadioButtons.AddChild(oneButton);

                        RadioButton tenButton = buttonFactory.GenerateRadioButton("10");
                        tenButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                          {
                                                                              SetXYZMoveAmount(10);
                                                                          }
                        };
                        moveRadioButtons.AddChild(tenButton);

                        RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100");
                        oneHundredButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                                 {
                                                                                     SetXYZMoveAmount(100);
                                                                                 }
                        };
                        moveRadioButtons.AddChild(oneHundredButton);

                        tenButton.Checked       = true;
                        moveRadioButtons.Margin = new BorderDouble(0, 3);
                        setMoveDistanceControl.AddChild(moveRadioButtons);
                    }

                    TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8);
                    mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
                    setMoveDistanceControl.AddChild(mmLabel);
                    setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft;
                    xYZWithDistance.AddChild(setMoveDistanceControl);
                }

                allControlsLeftToRight.AddChild(xYZWithDistance);

#if !__ANDROID__
                allControlsLeftToRight.AddChild(GetHotkeyControlContainer());
#endif
                GuiWidget barBetweenZAndE = new GuiWidget(2, 2);
                barBetweenZAndE.VAnchor         = Agg.UI.VAnchor.ParentBottomTop;
                barBetweenZAndE.BackgroundColor = RGBA_Bytes.White;
                barBetweenZAndE.Margin          = new BorderDouble(distanceBetweenControls, 5);
                allControlsLeftToRight.AddChild(barBetweenZAndE);

                //moveButtonFactory.normalFillColor = XYZColors.eColor;

                FlowLayoutWidget eButtons = CreateEButtons(buttonSeparationDistance);
                eButtons.VAnchor |= Agg.UI.VAnchor.ParentTop;
                allControlsLeftToRight.AddChild(eButtons);


                allControlsTopToBottom.AddChild(allControlsLeftToRight);
            }

            this.AddChild(allControlsTopToBottom);
            this.HAnchor = HAnchor.FitToChildren;
            this.VAnchor = VAnchor.FitToChildren;

            Margin = new BorderDouble(3);

            // this.HAnchor |= HAnchor.ParentLeftRight;
        }
コード例 #50
0
        void AddViewControls()
        {
            TextImageButtonFactory iconTextImageButtonFactory = new TextImageButtonFactory();

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

            string translateIconPath = Path.Combine("Icons", "ViewTransformControls", "translate.png");
            RadioButton translateButton = iconTextImageButtonFactory.GenerateRadioButton("", translateIconPath);
            translateButton.Margin = new BorderDouble(3);
            transformTypeSelector.AddChild(translateButton);
            translateButton.Click += (sender, e) =>
            {
                gcodeViewWidget.TransformState = GCodeViewWidget.ETransformState.Move;
            };

            string scaleIconPath = Path.Combine("Icons", "ViewTransformControls", "scale.png");
            RadioButton scaleButton = iconTextImageButtonFactory.GenerateRadioButton("", scaleIconPath);
            scaleButton.Margin = new BorderDouble(3);
            transformTypeSelector.AddChild(scaleButton);
            scaleButton.Click += (sender, e) =>
            {
                gcodeViewWidget.TransformState = GCodeViewWidget.ETransformState.Scale;
            };

            transformTypeSelector.Margin = new BorderDouble(5);
            transformTypeSelector.HAnchor |= Agg.UI.HAnchor.ParentLeft;
            transformTypeSelector.VAnchor = Agg.UI.VAnchor.ParentTop;
            AddChild(transformTypeSelector);
            translateButton.Checked = true;
        }
コード例 #51
0
        public JogControls(XYZColors colors)
        {
            moveButtonFactory.Colors.Text.Normal = RGBA_Bytes.Black;

            double distanceBetweenControls  = 12;
            double buttonSeparationDistance = 10;

            FlowLayoutWidget allControlsTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);

            allControlsTopToBottom.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;

            {
                FlowLayoutWidget allControlsLeftToRight = new FlowLayoutWidget();

                FlowLayoutWidget xYZWithDistance = new FlowLayoutWidget(FlowDirection.TopToBottom);
                {
                    FlowLayoutWidget xYZControls = new FlowLayoutWidget();
                    {
                        GuiWidget xyGrid = CreateXYGridControl(colors, distanceBetweenControls, buttonSeparationDistance);
                        xYZControls.AddChild(xyGrid);

                        FlowLayoutWidget zButtons = CreateZButtons(XYZColors.zColor, buttonSeparationDistance, out zPlusControl, out zMinusControl);
                        zButtons.VAnchor = Agg.UI.VAnchor.ParentBottom;
                        xYZControls.AddChild(zButtons);
                        xYZWithDistance.AddChild(xYZControls);
                    }

                    this.KeyDown += (sender, e) =>
                    {
                        if (!hotKeyButton.Checked)
                        {
                            return;
                        }

                        double moveAmountPositive  = AxisMoveAmount;
                        double moveAmountNegative  = -AxisMoveAmount;
                        int    eMoveAmountPositive = EAxisMoveAmount;
                        int    eMoveAmountNegative = -EAxisMoveAmount;

                        if (OsInformation.OperatingSystem == OSType.Windows ||
                            OsInformation.OperatingSystem == OSType.Mac)
                        {
                            if (e.KeyCode == Keys.Z)
                            {
                                PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Z);
                            }
                            else if (e.KeyCode == Keys.Y)
                            {
                                PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Y);
                            }
                            else if (e.KeyCode == Keys.X)
                            {
                                PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.X);
                            }
                            else if (e.KeyCode == Keys.Left)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountNegative, MovementControls.XSpeed);
                            }
                            else if (e.KeyCode == Keys.Right)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountPositive, MovementControls.XSpeed);
                            }
                            else if (e.KeyCode == Keys.Up)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountPositive, MovementControls.YSpeed);
                            }
                            else if (e.KeyCode == Keys.Down)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountNegative, MovementControls.YSpeed);
                            }
                            else if (e.KeyCode == Keys.E)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountPositive, MovementControls.EFeedRate(0));
                            }
                            else if (e.KeyCode == Keys.R)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountNegative, MovementControls.EFeedRate(0));
                            }
                        }

                        if (OsInformation.OperatingSystem == OSType.Windows)
                        {
                            if (e.KeyCode == Keys.Home)
                            {
                                PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ);
                            }
                            else if (e.KeyCode == Keys.PageUp)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountPositive, MovementControls.ZSpeed);
                            }
                            else if (e.KeyCode == Keys.PageDown)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountNegative, MovementControls.ZSpeed);
                            }
                        }
                        else if (OsInformation.OperatingSystem == OSType.Mac)
                        {
                            if (e.KeyCode == (Keys.Back | Keys.Cancel))
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountPositive, MovementControls.ZSpeed);
                            }
                            else if (e.KeyCode == Keys.Clear)
                            {
                                PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountNegative, MovementControls.ZSpeed);
                            }
                        }
                    };

                    // add in some movement radio buttons
                    FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget();
                    TextWidget       buttonsLabel           = new TextWidget("Distance:", textColor: RGBA_Bytes.White);
                    buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
                    //setMoveDistanceControl.AddChild(buttonsLabel);

                    {
                        TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
                        buttonFactory.FixedHeight        = 20 * GuiWidget.DeviceScale;
                        buttonFactory.FixedWidth         = 30 * GuiWidget.DeviceScale;
                        buttonFactory.fontSize           = 8;
                        buttonFactory.Margin             = new BorderDouble(0);
                        buttonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor;

                        FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget();

                        var radioList = new ObservableCollection <GuiWidget>();

                        movePointZeroTwoMmButton                      = buttonFactory.GenerateRadioButton("0.02");
                        movePointZeroTwoMmButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        movePointZeroTwoMmButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                                         {
                                                                                             SetXYZMoveAmount(.02);
                                                                                         }
                        };
                        movePointZeroTwoMmButton.SiblingRadioButtonList = radioList;
                        moveRadioButtons.AddChild(movePointZeroTwoMmButton);

                        RadioButton pointOneButton = buttonFactory.GenerateRadioButton("0.1");
                        pointOneButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        pointOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                               {
                                                                                   SetXYZMoveAmount(.1);
                                                                               }
                        };
                        pointOneButton.SiblingRadioButtonList = radioList;
                        moveRadioButtons.AddChild(pointOneButton);

                        moveOneMmButton                      = buttonFactory.GenerateRadioButton("1");
                        moveOneMmButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        moveOneMmButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                                {
                                                                                    SetXYZMoveAmount(1);
                                                                                }
                        };
                        moveOneMmButton.SiblingRadioButtonList = radioList;
                        moveRadioButtons.AddChild(moveOneMmButton);

                        tooBigForBabyStepping = new DisableableWidget()
                        {
                            VAnchor = VAnchor.FitToChildren,
                            HAnchor = HAnchor.FitToChildren
                        };

                        var tooBigFlowLayout = new FlowLayoutWidget();
                        tooBigForBabyStepping.AddChild(tooBigFlowLayout);

                        tenButton                      = buttonFactory.GenerateRadioButton("10");
                        tenButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                          {
                                                                              SetXYZMoveAmount(10);
                                                                          }
                        };
                        tenButton.SiblingRadioButtonList = radioList;
                        tooBigFlowLayout.AddChild(tenButton);

                        oneHundredButton                      = buttonFactory.GenerateRadioButton("100");
                        oneHundredButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                                 {
                                                                                     SetXYZMoveAmount(100);
                                                                                 }
                        };
                        oneHundredButton.SiblingRadioButtonList = radioList;
                        tooBigFlowLayout.AddChild(oneHundredButton);

                        moveRadioButtons.AddChild(tooBigForBabyStepping);

                        tenButton.Checked       = true;
                        moveRadioButtons.Margin = new BorderDouble(0, 3);

                        setMoveDistanceControl.AddChild(moveRadioButtons);

                        TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8);
                        mmLabel.Margin  = new BorderDouble(left: 10);
                        mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;

                        tooBigFlowLayout.AddChild(mmLabel);
                    }

                    setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft;
                    xYZWithDistance.AddChild(setMoveDistanceControl);
                }

                allControlsLeftToRight.AddChild(xYZWithDistance);

#if !__ANDROID__
                allControlsLeftToRight.AddChild(GetHotkeyControlContainer());
#endif
                GuiWidget barBetweenZAndE = new GuiWidget(2, 2);
                barBetweenZAndE.VAnchor         = Agg.UI.VAnchor.ParentBottomTop;
                barBetweenZAndE.BackgroundColor = RGBA_Bytes.White;
                barBetweenZAndE.Margin          = new BorderDouble(distanceBetweenControls, 5);
                allControlsLeftToRight.AddChild(barBetweenZAndE);

                FlowLayoutWidget eButtons = CreateEButtons(buttonSeparationDistance);
                disableableEButtons = new DisableableWidget()
                {
                    HAnchor = HAnchor.FitToChildren,
                    VAnchor = VAnchor.FitToChildren | VAnchor.ParentTop,
                };
                disableableEButtons.AddChild(eButtons);

                allControlsLeftToRight.AddChild(disableableEButtons);
                allControlsTopToBottom.AddChild(allControlsLeftToRight);
            }

            this.AddChild(allControlsTopToBottom);
            this.HAnchor = HAnchor.FitToChildren;
            this.VAnchor = VAnchor.FitToChildren;

            Margin = new BorderDouble(3);

            // this.HAnchor |= HAnchor.ParentLeftRight;
        }
コード例 #52
0
        private TabControl CreateAdvancedControlsTab()
        {
            TabControl advancedControls = new TabControl();

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
            advancedControls.TabBar.Margin      = new BorderDouble(0, 0);
            advancedControls.TabBar.Padding     = new BorderDouble(0, 2);

            int textSize = 16;

            // this means we are in compact view and so we will make the tabs text a bit smaller
            textSize = 14;
            TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();

            advancedControlsButtonFactory.fontSize            = 14;
            advancedControlsButtonFactory.invertImageLocation = false;
            backButton             = advancedControlsButtonFactory.Generate(LocalizedString.Get("Back"), StaticData.Instance.LoadIcon("icon_arrow_left_32x32.png", 32, 32));
            backButton.ToolTipText = "Switch to Queue, Library and History".Localize();
            backButton.Margin      = new BorderDouble(right: 3);
            backButton.VAnchor     = VAnchor.ParentBottom;
            backButton.Cursor      = Cursors.Hand;
            backButton.Click      += (s, e) => BackClicked?.Invoke(this, null);

            advancedControls.TabBar.AddChild(backButton);

            advancedControls.TabBar.AddChild(new HorizontalSpacer());

            GuiWidget manualPrinterControls = new ManualPrinterControls();

            ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);

            manualPrinterControlsScrollArea.ScrollArea.HAnchor |= HAnchor.ParentLeftRight;
            manualPrinterControlsScrollArea.AnchorAll();
            manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

            RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;

            if (ActiveSliceSettings.Instance.PrinterSelected)
            {
                sliceSettingsWidget = new SliceSettingsWidget();
            }
            else
            {
                sliceSettingsWidget = new NoSettingsWidget();
            }

            var sliceSettingsTabPage = new TabPage(sliceSettingsWidget, "Settings".Localize().ToUpper());
            var sliceSettingPopOut   = new PopOutTextTabWidget(sliceSettingsTabPage, SliceSettingsTabName, new Vector2(590, 400), textSize);

            advancedControls.AddTab(sliceSettingPopOut);

            var controlsTabPage = new TabPage(manualPrinterControlsScrollArea, "Controls".Localize().ToUpper());
            var controlsPopOut  = new PopOutTextTabWidget(controlsTabPage, ControlsTabName, new Vector2(400, 300), textSize);

            advancedControls.AddTab(controlsPopOut);

#if !__ANDROID__
            MenuOptionSettings.sliceSettingsPopOut = sliceSettingPopOut;
            MenuOptionSettings.controlsPopOut      = controlsPopOut;
#endif

            var optionsControls = new PrinterConfigurationScrollWidget();
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(optionsControls, "Options".Localize().ToUpper()), "Options Tab", textSize,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            // Make sure we are on the right tab when we create this view
            {
                string selectedTab = UserSettings.Instance.get(ThirdPanelTabView_AdvancedControls_CurrentTab);
                advancedControls.SelectTab(selectedTab);

                advancedControls.TabBar.TabIndexChanged += (sender, e) =>
                {
                    string selectedTabName = advancedControls.TabBar.SelectedTabName;
                    if (!string.IsNullOrEmpty(selectedTabName))
                    {
                        UserSettings.Instance.set(ThirdPanelTabView_AdvancedControls_CurrentTab, selectedTabName);
                    }
                };
            }

            return(advancedControls);
        }
コード例 #53
0
        public JogControls(XYZColors colors)
        {
            moveButtonFactory.normalTextColor = RGBA_Bytes.Black;

            double distanceBetweenControls  = 12;
            double buttonSeparationDistance = 10;

            FlowLayoutWidget allControlsTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);

            allControlsTopToBottom.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;

            {
                FlowLayoutWidget allControlsLeftToRight = new FlowLayoutWidget();

                FlowLayoutWidget xYZWithDistance = new FlowLayoutWidget(FlowDirection.TopToBottom);
                {
                    FlowLayoutWidget xYZControls = new FlowLayoutWidget();
                    {
                        GuiWidget xyGrid = CreateXYGridControl(colors, distanceBetweenControls, buttonSeparationDistance);
                        xYZControls.AddChild(xyGrid);

                        FlowLayoutWidget zButtons = CreateZButtons(XYZColors.zColor, buttonSeparationDistance, out zPlusControl, out zMinusControl);
                        zButtons.VAnchor = Agg.UI.VAnchor.ParentBottom;
                        xYZControls.AddChild(zButtons);
                        xYZWithDistance.AddChild(xYZControls);
                    }

                    // add in some movement radio buttons
                    FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget();
                    TextWidget       buttonsLabel           = new TextWidget("Distance:", textColor: RGBA_Bytes.White);
                    buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
                    //setMoveDistanceControl.AddChild(buttonsLabel);

                    {
                        TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
                        buttonFactory.FixedHeight        = 20 * TextWidget.GlobalPointSizeScaleRatio;
                        buttonFactory.FixedWidth         = 30 * TextWidget.GlobalPointSizeScaleRatio;
                        buttonFactory.fontSize           = 8;
                        buttonFactory.Margin             = new BorderDouble(0);
                        buttonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor;

                        FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget();

                        RadioButton pointOneButton = buttonFactory.GenerateRadioButton("0.1");
                        pointOneButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        pointOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                               {
                                                                                   SetXYZMoveAmount(.1);
                                                                               }
                        };
                        moveRadioButtons.AddChild(pointOneButton);

                        RadioButton oneButton = buttonFactory.GenerateRadioButton("1");
                        oneButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                          {
                                                                              SetXYZMoveAmount(1);
                                                                          }
                        };
                        moveRadioButtons.AddChild(oneButton);

                        RadioButton tenButton = buttonFactory.GenerateRadioButton("10");
                        tenButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                          {
                                                                              SetXYZMoveAmount(10);
                                                                          }
                        };
                        moveRadioButtons.AddChild(tenButton);

                        RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100");
                        oneHundredButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                        oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                                 {
                                                                                     SetXYZMoveAmount(100);
                                                                                 }
                        };
                        moveRadioButtons.AddChild(oneHundredButton);

                        tenButton.Checked       = true;
                        moveRadioButtons.Margin = new BorderDouble(0, 3);
                        setMoveDistanceControl.AddChild(moveRadioButtons);
                    }

                    TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8);
                    mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
                    setMoveDistanceControl.AddChild(mmLabel);
                    setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft;
                    xYZWithDistance.AddChild(setMoveDistanceControl);
                }

                allControlsLeftToRight.AddChild(xYZWithDistance);

                GuiWidget barBetweenZAndE = new GuiWidget(2, 2);
                barBetweenZAndE.VAnchor         = Agg.UI.VAnchor.ParentBottomTop;
                barBetweenZAndE.BackgroundColor = RGBA_Bytes.White;
                barBetweenZAndE.Margin          = new BorderDouble(distanceBetweenControls, 5);
                allControlsLeftToRight.AddChild(barBetweenZAndE);

                moveButtonFactory.normalFillColor = XYZColors.eColor;

                FlowLayoutWidget eButtons = CreateEButtons(buttonSeparationDistance);
                eButtons.VAnchor |= Agg.UI.VAnchor.ParentTop;
                allControlsLeftToRight.AddChild(eButtons);

                allControlsTopToBottom.AddChild(allControlsLeftToRight);
            }

            this.AddChild(allControlsTopToBottom);
            HAnchor = HAnchor.FitToChildren;
            VAnchor = VAnchor.FitToChildren;

            Margin = new BorderDouble(3);

            this.HAnchor |= HAnchor.ParentLeftRight;
        }
コード例 #54
0
        public void doLayout()
        {
            this.RemoveAllChildren();
            TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
            FlowLayoutWidget       topToBottom            = new FlowLayoutWidget(FlowDirection.TopToBottom);

            topToBottom.Padding = new BorderDouble(10);
            topToBottom.AnchorAll();

            string     exportLblTxt     = new LocalizedString("File export options").Translated;
            string     exportLblTxtFull = string.Format("{0}:", exportLblTxt);
            TextWidget exportLabel      = new TextWidget(exportLblTxtFull);

            exportLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            topToBottom.AddChild(exportLabel);

            GuiWidget dividerLine = new GuiWidget();

            dividerLine.HAnchor         = Agg.UI.HAnchor.ParentLeftRight;
            dividerLine.Height          = 1;
            dividerLine.Margin          = new BorderDouble(0, 3);
            dividerLine.BackgroundColor = RGBA_Bytes.White;
            topToBottom.AddChild(dividerLine);

            if (!partIsGCode)
            {
                string exportStlTxt     = new LocalizedString("Export as").Translated;
                string exportStlTxtFull = string.Format("{0} STL", exportStlTxt);

                Button exportAsStlButton = textImageButtonFactory.Generate(exportStlTxtFull);
                exportAsStlButton.Click += new ButtonBase.ButtonEventHandler(exportSTL_Click);
                //exportSTL.HAnchor = Agg.UI.HAnchor.ParentCenter;
                topToBottom.AddChild(exportAsStlButton);
            }

            bool showExportGCodeButton = ActivePrinterProfile.Instance.ActivePrinter != null || partIsGCode;

            if (showExportGCodeButton)
            {
                string exportGCodeText     = new LocalizedString("Export as").Translated;
                string exportGCodeTextFull = string.Format("{0} GCode", exportGCodeText);

                Button exportGCode = textImageButtonFactory.Generate(exportGCodeTextFull);

                //exportGCode.HAnchor = Agg.UI.HAnchor.ParentCenter;
                exportGCode.Click += new ButtonBase.ButtonEventHandler(exportGCode_Click);
                topToBottom.AddChild(exportGCode);
            }

            GuiWidget vSpacer = new GuiWidget();

            vSpacer.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
            topToBottom.AddChild(vSpacer);

            if (!showExportGCodeButton)
            {
                string     noGCodeMessageTxtBeg  = new LocalizedString("Note").Translated;
                string     noGCodeMessageTxtEnd  = new LocalizedString("To enable GCode export, select a printer profile.").Translated;
                string     noGCodeMessageTxtFull = string.Format("{0}: {1}", noGCodeMessageTxtBeg, noGCodeMessageTxtEnd);
                TextWidget noGCodeMessage        = new TextWidget(noGCodeMessageTxtFull, textColor: RGBA_Bytes.White, pointSize: 10);
                topToBottom.AddChild(noGCodeMessage);
            }

            // TODO: make this work on the mac and then delete this if
            if (MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType() == WindowsFormsAbstract.OSType.Windows)
            {
                showInFolderAfterSave        = new CheckBox(new LocalizedString("Show file in folder after save").Translated, RGBA_Bytes.White, 10);
                showInFolderAfterSave.Margin = new BorderDouble(top: 10);
                topToBottom.AddChild(showInFolderAfterSave);
            }

            this.AddChild(topToBottom);
        }
コード例 #55
0
        public void CreateWindowContent()
        {
            this.RemoveAllChildren();
            TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
            FlowLayoutWidget       topToBottom            = new FlowLayoutWidget(FlowDirection.TopToBottom);

            topToBottom.Padding = new BorderDouble(3, 0, 3, 5);
            topToBottom.AnchorAll();

            // Creates Header
            FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);

            headerRow.HAnchor = HAnchor.ParentLeftRight;
            headerRow.Margin  = new BorderDouble(0, 3, 0, 0);
            headerRow.Padding = new BorderDouble(0, 3, 0, 3);
            BackgroundColor   = ActiveTheme.Instance.PrimaryBackgroundColor;

            //Creates Text and adds into header
            {
                TextWidget elementHeader = new TextWidget("File export options:".Localize(), pointSize: 14);
                elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                elementHeader.HAnchor   = HAnchor.ParentLeftRight;
                elementHeader.VAnchor   = Agg.UI.VAnchor.ParentBottom;

                headerRow.AddChild(elementHeader);
                topToBottom.AddChild(headerRow);
            }

            // Creates container in the middle of window
            FlowLayoutWidget middleRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            {
                middleRowContainer.HAnchor         = HAnchor.ParentLeftRight;
                middleRowContainer.VAnchor         = VAnchor.ParentBottomTop;
                middleRowContainer.Padding         = new BorderDouble(5);
                middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
            }

            if (!partIsGCode)
            {
                string exportStlText     = LocalizedString.Get("Export as");
                string exportStlTextFull = string.Format("{0} STL", exportStlText);

                Button exportAsStlButton = textImageButtonFactory.Generate(exportStlTextFull);
                exportAsStlButton.HAnchor = HAnchor.ParentLeft;
                exportAsStlButton.Cursor  = Cursors.Hand;
                exportAsStlButton.Click  += new EventHandler(exportSTL_Click);
                middleRowContainer.AddChild(exportAsStlButton);
            }

            if (!partIsGCode)
            {
                string exportAmfText     = LocalizedString.Get("Export as");
                string exportAmfTextFull = string.Format("{0} AMF", exportAmfText);

                Button exportAsAmfButton = textImageButtonFactory.Generate(exportAmfTextFull);
                exportAsAmfButton.HAnchor = HAnchor.ParentLeft;
                exportAsAmfButton.Cursor  = Cursors.Hand;
                exportAsAmfButton.Click  += new EventHandler(exportAMF_Click);
                middleRowContainer.AddChild(exportAsAmfButton);
            }

            bool showExportGCodeButton = ActiveSliceSettings.Instance != null || partIsGCode;

            if (showExportGCodeButton)
            {
                string exportGCodeTextFull = string.Format("{0} G-Code", "Export as".Localize());
                Button exportGCode         = textImageButtonFactory.Generate(exportGCodeTextFull);
                exportGCode.Name    = "Export as GCode Button";
                exportGCode.HAnchor = HAnchor.ParentLeft;
                exportGCode.Cursor  = Cursors.Hand;
                exportGCode.Click  += new EventHandler((object sender, EventArgs e) =>
                {
                    UiThread.RunOnIdle(ExportGCode_Click);
                });
                middleRowContainer.AddChild(exportGCode);

                PluginFinder <ExportGcodePlugin> exportPluginFinder = new PluginFinder <ExportGcodePlugin>();

                foreach (ExportGcodePlugin plugin in exportPluginFinder.Plugins)
                {
                    //Create export button for each Plugin found

                    string exportButtonText = plugin.GetButtonText().Localize();

                    Button exportButton = textImageButtonFactory.Generate(exportButtonText);
                    exportButton.HAnchor = HAnchor.ParentLeft;
                    exportButton.Cursor  = Cursors.Hand;
                    exportButton.Click  += (object sender, EventArgs e) =>
                    {
                        UiThread.RunOnIdle(() =>
                        {
                            // Close the export window
                            Close();

                            // Open a SaveFileDialog. If Save is clicked, slice the part if needed and pass the plugin the
                            // path to the gcode file and the target save path
                            FileDialog.SaveFileDialog(
                                new SaveFileDialogParams(plugin.GetExtensionFilter())
                            {
                                Title             = "MatterControl: Export File",
                                FileName          = printItemWrapper.Name,
                                ActionButtonLabel = "Export"
                            },
                                (SaveFileDialogParams saveParam) =>
                            {
                                string extension = Path.GetExtension(saveParam.FileName);
                                if (extension == "")
                                {
                                    saveParam.FileName += plugin.GetFileExtension();
                                }

                                if (partIsGCode)
                                {
                                    plugin.Generate(printItemWrapper.FileLocation, saveParam.FileName);
                                }
                                else
                                {
                                    SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper);

                                    printItemWrapper.SlicingDone += (printItem, eventArgs) =>
                                    {
                                        PrintItemWrapper sliceItem = (PrintItemWrapper)printItem;
                                        if (File.Exists(sliceItem.GetGCodePathAndFileName()))
                                        {
                                            plugin.Generate(sliceItem.GetGCodePathAndFileName(), saveParam.FileName);
                                        }
                                    };
                                }
                            });
                        });
                    };                     // End exportButton Click handler

                    middleRowContainer.AddChild(exportButton);
                }
            }

            middleRowContainer.AddChild(new VerticalSpacer());

            // If print leveling is enabled then add in a check box 'Apply Leveling During Export' and default checked.
            if (showExportGCodeButton && ActiveSliceSettings.Instance.GetValue <bool>(SettingsKey.print_leveling_enabled))
            {
                applyLeveling         = new CheckBox(LocalizedString.Get(applyLevelingDuringExportString), ActiveTheme.Instance.PrimaryTextColor, 10);
                applyLeveling.Checked = true;
                applyLeveling.HAnchor = HAnchor.ParentLeft;
                applyLeveling.Cursor  = Cursors.Hand;
                //applyLeveling.Margin = new BorderDouble(top: 10);
                middleRowContainer.AddChild(applyLeveling);
            }

            // TODO: make this work on the mac and then delete this if
            if (OsInformation.OperatingSystem == OSType.Windows ||
                OsInformation.OperatingSystem == OSType.X11)
            {
                showInFolderAfterSave         = new CheckBox(LocalizedString.Get("Show file in folder after save"), ActiveTheme.Instance.PrimaryTextColor, 10);
                showInFolderAfterSave.HAnchor = HAnchor.ParentLeft;
                showInFolderAfterSave.Cursor  = Cursors.Hand;
                //showInFolderAfterSave.Margin = new BorderDouble(top: 10);
                middleRowContainer.AddChild(showInFolderAfterSave);
            }

            if (!showExportGCodeButton)
            {
                string     noGCodeMessageTextBeg  = LocalizedString.Get("Note");
                string     noGCodeMessageTextEnd  = LocalizedString.Get("To enable GCode export, select a printer profile.");
                string     noGCodeMessageTextFull = string.Format("{0}: {1}", noGCodeMessageTextBeg, noGCodeMessageTextEnd);
                TextWidget noGCodeMessage         = new TextWidget(noGCodeMessageTextFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10);
                noGCodeMessage.HAnchor = HAnchor.ParentLeft;
                middleRowContainer.AddChild(noGCodeMessage);
            }

            //Creates button container on the bottom of window
            FlowLayoutWidget buttonRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
            {
                BackgroundColor   = ActiveTheme.Instance.PrimaryBackgroundColor;
                buttonRow.HAnchor = HAnchor.ParentLeftRight;
                buttonRow.Padding = new BorderDouble(0, 3);
            }

            Button cancelButton = textImageButtonFactory.Generate("Cancel");

            cancelButton.Name   = "Export Item Window Cancel Button";
            cancelButton.Cursor = Cursors.Hand;
            cancelButton.Click += (sender, e) =>
            {
                CloseOnIdle();
            };

            buttonRow.AddChild(new HorizontalSpacer());
            buttonRow.AddChild(cancelButton);
            topToBottom.AddChild(middleRowContainer);
            topToBottom.AddChild(buttonRow);

            this.AddChild(topToBottom);
        }
コード例 #56
0
        public ViewControls3D(MeshViewerWidget meshViewerWidget)
        {
            this.meshViewerWidget = meshViewerWidget;
            TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();

            textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
            textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
            textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor;
            textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;

            BackgroundColor = new RGBA_Bytes(0, 0, 0, 120);
            textImageButtonFactory.FixedHeight = 20;
            textImageButtonFactory.FixedWidth = 20;
            textImageButtonFactory.AllowThemeToAdjustImage = false;

            string rotateIconPath = Path.Combine("ViewTransformControls", "rotate.png");
            rotateButton = textImageButtonFactory.GenerateRadioButton("", rotateIconPath);
            rotateButton.Margin = new BorderDouble(3);
            AddChild(rotateButton);
            rotateButton.Click += (sender, e) =>
            {
                meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation;
            };

            string translateIconPath = Path.Combine("ViewTransformControls", "translate.png");
            translateButton = textImageButtonFactory.GenerateRadioButton("", translateIconPath);
            translateButton.Margin = new BorderDouble(3);
            AddChild(translateButton);
            translateButton.Click += (sender, e) =>
            {
                meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Translation;
            };

            string scaleIconPath = Path.Combine("ViewTransformControls", "scale.png");
            RadioButton scaleButton = textImageButtonFactory.GenerateRadioButton("", scaleIconPath);
            scaleButton.Margin = new BorderDouble(3);
            AddChild(scaleButton);
            scaleButton.Click += (sender, e) =>
            {
                meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Scale;
            };

            partSelectSeparator = new GuiWidget(2, 32);
            partSelectSeparator.BackgroundColor = RGBA_Bytes.White;
            partSelectSeparator.Margin = new BorderDouble(3);
            AddChild(partSelectSeparator);

            string partSelectIconPath = Path.Combine("ViewTransformControls", "partSelect.png");
            partSelectButton = textImageButtonFactory.GenerateRadioButton("", partSelectIconPath);
            partSelectButton.Margin = new BorderDouble(3);
            AddChild(partSelectButton);
            partSelectButton.Click += (sender, e) =>
            {
                meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.None;
            };

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

            SetMeshViewerDisplayTheme();
            partSelectButton.CheckedStateChanged += SetMeshViewerDisplayTheme;

            ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents);
        }