Ejemplo n.º 1
0
        private void AddMovementControls(FlowLayoutWidget controlsTopToBottomLayout)
        {
            Button   editButton;
            GroupBox movementControlsGroupBox = new GroupBox(textImageButtonFactory.GenerateGroupBoxLableWithEdit(new LocalizedString("Movement Controls").Translated, out editButton));

            editButton.Click += (sender, e) =>
            {
                if (editSettingsWindow == null)
                {
                    editSettingsWindow         = new EditManualMovementSpeedsWindow("Movement Speeds", GetMovementSpeedsString(), SetMovementSpeeds);
                    editSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editSettingsWindow = null; };
                }
                else
                {
                    editSettingsWindow.BringToFront();
                }
            };

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

            {
                FlowLayoutWidget manualControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
                manualControlsLayout.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                manualControlsLayout.VAnchor = Agg.UI.VAnchor.FitToChildren;
                manualControlsLayout.Padding = new BorderDouble(3, 5, 3, 0);
                {
                    manualControlsLayout.AddChild(GetHomeButtonBar());

                    manualControlsLayout.AddChild(CreateSeparatorLine());

                    manualControlsLayout.AddChild(new JogControls(new XYZColors()));

                    manualControlsLayout.AddChild(CreateSeparatorLine());

                    //manualControlsLayout.AddChild(GetManualMoveBar());
                }

                movementControlsGroupBox.AddChild(manualControlsLayout);
            }

            movementControlsContainer = new DisablablableWidget();
            movementControlsContainer.AddChild(movementControlsGroupBox);
            controlsTopToBottomLayout.AddChild(movementControlsContainer);
        }
Ejemplo n.º 2
0
        void AddChildElements()
        {
            Button   editButton;
            GroupBox groupBox = new GroupBox(textImageButtonFactory.GenerateGroupBoxLableWithEdit(new LocalizedString("Macros").Translated, out editButton));

            editButton.Click += (sender, e) =>
            {
                if (editSettingsWindow == null)
                {
                    editSettingsWindow         = new EditMacrosWindow(GetMacros(), ReloadMacros);
                    editSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editSettingsWindow = null; };
                }
                else
                {
                    editSettingsWindow.BringToFront();
                }
            };

            groupBox.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
            groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
            groupBox.HAnchor    |= Agg.UI.HAnchor.ParentLeftRight;
            // make sure the client area will get smaller when the contents get smaller
            groupBox.ClientArea.VAnchor = Agg.UI.VAnchor.FitToChildren;

            FlowLayoutWidget controlRow = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom);

            controlRow.Margin   = new BorderDouble(top: 5);
            controlRow.HAnchor |= HAnchor.ParentLeftRight;
            {
                {
                    this.presetButtonsContainer = GetMacroButtonContainer();
                    controlRow.AddChild(this.presetButtonsContainer);
                }
            }

            groupBox.AddChild(controlRow);
            this.AddChild(groupBox);
        }
Ejemplo n.º 3
0
        void AddChildElements()
        {
            Button   editButton;
            GroupBox groupBox = new GroupBox(textImageButtonFactory.GenerateGroupBoxLableWithEdit(label, out editButton));

            editButton.Click += (sender, e) =>
            {
                if (editSettingsWindow == null)
                {
                    editSettingsWindow         = new EditTemperaturePresetsWindow(editWindowLabel, GetTemperaturePresets(), SetTemperaturePresets);
                    editSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editSettingsWindow = null; };
                }
                else
                {
                    editSettingsWindow.BringToFront();
                }
            };

            groupBox.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
            groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
            groupBox.HAnchor    |= Agg.UI.HAnchor.ParentLeftRight;
            // make sure the client area will get smaller when the contents get smaller
            groupBox.ClientArea.VAnchor = Agg.UI.VAnchor.FitToChildren;

            FlowLayoutWidget controlRow = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom);

            controlRow.Margin   = new BorderDouble(top: 5);
            controlRow.HAnchor |= HAnchor.ParentLeftRight;
            {
                // put in the temperature slider and preset buttons

                tempSliderContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom);

                {
                    GuiWidget sliderLabels = GetSliderLabels();

                    tempSliderContainer.HAnchor = HAnchor.ParentLeftRight;
                    tempSliderContainer.AddChild(sliderLabels);
                    tempSliderContainer.Visible = false;
                }
                GuiWidget spacer = new GuiWidget(0, 10);
                spacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;


                // put in the temperature indicators
                {
                    FlowLayoutWidget temperatureIndicator = new FlowLayoutWidget();
                    temperatureIndicator.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                    temperatureIndicator.Margin  = new BorderDouble(bottom: 6);
                    temperatureIndicator.Padding = new BorderDouble(0, 3);

                    // put in the actual temperature controls
                    {
                        FlowLayoutWidget extruderActualIndicator = new FlowLayoutWidget(Agg.UI.FlowDirection.LeftToRight);

                        extruderActualIndicator.Margin = new BorderDouble(3, 0);
                        string     extruderActualLabelTxt     = new LocalizedString("Actual").Translated;
                        string     extruderActualLabelTxtFull = string.Format("{0}: ", extruderActualLabelTxt);
                        TextWidget extruderActualLabel        = new TextWidget(extruderActualLabelTxtFull, pointSize: 10);
                        extruderActualLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        extruderActualLabel.VAnchor   = VAnchor.ParentCenter;

                        actualTempIndicator = new TextWidget(string.Format("{0:0.0}°C", GetActualTemperature()), pointSize: 12);
                        actualTempIndicator.AutoExpandBoundsToText = true;
                        actualTempIndicator.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        actualTempIndicator.VAnchor   = VAnchor.ParentCenter;

                        extruderActualIndicator.AddChild(extruderActualLabel);
                        extruderActualIndicator.AddChild(actualTempIndicator);

                        string extruderAboutLabelTxt     = new LocalizedString("Target").Translated;
                        string extruderAboutLabelTxtFull = string.Format("{0}: ", extruderAboutLabelTxt);

                        TextWidget extruderTargetLabel = new TextWidget(extruderAboutLabelTxtFull, pointSize: 10);
                        extruderTargetLabel.Margin    = new BorderDouble(left: 10);
                        extruderTargetLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        extruderTargetLabel.VAnchor   = VAnchor.ParentCenter;

                        extruderActualIndicator.AddChild(extruderTargetLabel);
                        temperatureIndicator.AddChild(extruderActualIndicator);
                    }

                    // put in the target temperature controls
                    temperatureIndicator.AddChild(GetTargetTemperatureDisplay());

                    FlowLayoutWidget helperTextWidget = GetHelpTextWidget();


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

                    LinkButtonFactory linkFactory = new LinkButtonFactory();
                    linkFactory.textColor = ActiveTheme.Instance.PrimaryTextColor;
                    linkFactory.fontSize  = 10;

                    Button helpTextLink = linkFactory.Generate("?");

                    helpTextLink.Click += (sender, e) =>
                    {
                        helperTextWidget.Visible = !helperTextWidget.Visible;
                    };

                    //temperatureIndicator.AddChild(hspacer);
                    //temperatureIndicator.AddChild(helpTextLink);

                    this.presetButtonsContainer = GetPresetsContainer();

                    controlRow.AddChild(temperatureIndicator);
                    //controlRow.AddChild(helperTextWidget);
                    controlRow.AddChild(this.presetButtonsContainer);
                    //controlRow.AddChild(tempSliderContainer);
                }
            }

            groupBox.AddChild(controlRow);

            this.AddChild(groupBox);
        }