public virtual FlowLayoutWidget GetPulldownContainer()
        {
            DropDownList = CreateDropdown();

            FlowLayoutWidget container = new FlowLayoutWidget();

            container.HAnchor = HAnchor.ParentLeftRight;
            container.Padding = new BorderDouble(6, 0);

            editButton = imageButtonFactory.Generate("icon_edit_white.png", "icon_edit_gray.png");

            editButton.VAnchor = VAnchor.ParentCenter;
            editButton.Margin  = new BorderDouble(right: 6);
            editButton.Click  += (sender, e) =>
            {
#if DO_IN_PLACE_EDIT
                if (filterTag == "quality")
                {
                    SliceSettingsWidget.SettingsIndexBeingEdited = 2;
                }
                else
                {
                    SliceSettingsWidget.SettingsIndexBeingEdited = 3;
                }
                // If there is a setting selected then reload the silce setting widget with the presetIndex to edit.
                ApplicationController.Instance.ReloadAdvancedControlsPanel();
                // If no setting selected then call onNewItemSelect(object sender, EventArgs e)
#else
                if (filterTag == "material")
                {
                    if (ApplicationController.Instance.EditMaterialPresetsWindow == null)
                    {
                        ApplicationController.Instance.EditMaterialPresetsWindow         = new SlicePresetsWindow(ReloadOptions, filterLabel, filterTag);
                        ApplicationController.Instance.EditMaterialPresetsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { ApplicationController.Instance.EditMaterialPresetsWindow = null; };
                    }
                    else
                    {
                        ApplicationController.Instance.EditMaterialPresetsWindow.BringToFront();
                    }
                }

                if (filterTag == "quality")
                {
                    if (ApplicationController.Instance.EditQualityPresetsWindow == null)
                    {
                        ApplicationController.Instance.EditQualityPresetsWindow         = new SlicePresetsWindow(ReloadOptions, filterLabel, filterTag);
                        ApplicationController.Instance.EditQualityPresetsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { ApplicationController.Instance.EditQualityPresetsWindow = null; };
                    }
                    else
                    {
                        ApplicationController.Instance.EditQualityPresetsWindow.BringToFront();
                    }
                }
#endif
            };

            container.AddChild(editButton);
            container.AddChild(DropDownList);
            return(container);
        }
        private Button GetAutoLevelIndicator()
        {
            ImageButtonFactory imageButtonFactory = new ImageButtonFactory();

            imageButtonFactory.InvertImageColor = false;
            string notifyIconPath      = Path.Combine("PrintStatusControls", "leveling-16x16.png");
            string notifyHoverIconPath = Path.Combine("PrintStatusControls", "leveling-16x16.png");
            Button autoLevelButton     = imageButtonFactory.Generate(notifyIconPath, notifyHoverIconPath);

            autoLevelButton.Cursor      = Cursors.Hand;
            autoLevelButton.Margin      = new Agg.BorderDouble(top: 3);
            autoLevelButton.ToolTipText = "Print leveling is enabled.".Localize();
            autoLevelButton.Visible     = ActivePrinterProfile.Instance.DoPrintLeveling;

            ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent((sender, e) =>
            {
                autoLevelButton.Visible = ActivePrinterProfile.Instance.DoPrintLeveling;
            }, ref unregisterEvents);

            ActivePrinterProfile.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) =>
            {
                autoLevelButton.Visible = ActivePrinterProfile.Instance.DoPrintLeveling;
            }, ref unregisterEvents);

            return(autoLevelButton);
        }
Example #3
0
        private Button GetAutoLevelIndicator()
        {
            ImageButtonFactory imageButtonFactory = new ImageButtonFactory();

            imageButtonFactory.invertImageColor = false;
            string notifyIconPath      = Path.Combine("PrintStatusControls", "leveling-16x16.png");
            string notifyHoverIconPath = Path.Combine("PrintStatusControls", "leveling-16x16.png");
            Button autoLevelButton     = imageButtonFactory.Generate(notifyIconPath, notifyHoverIconPath);

            autoLevelButton.Cursor            = Cursors.Hand;
            autoLevelButton.Margin            = new Agg.BorderDouble(top: 3);
            autoLevelButton.MouseEnterBounds += (sender, mouseEvent) => { HelpTextWidget.Instance.ShowHoverText("Print leveling is enabled."); };
            autoLevelButton.MouseLeaveBounds += (sender, mouseEvent) => { HelpTextWidget.Instance.HideHoverText(); };
            autoLevelButton.Visible           = ActivePrinterProfile.Instance.DoPrintLeveling;

            ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent((sender, e) =>
            {
                autoLevelButton.Visible = ActivePrinterProfile.Instance.DoPrintLeveling;
            }, ref unregisterEvents);

            ActivePrinterProfile.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) =>
            {
                autoLevelButton.Visible = ActivePrinterProfile.Instance.DoPrintLeveling;
            }, ref unregisterEvents);

            return(autoLevelButton);
        }
        private static void AddNotificationButton(GuiWidget iconContainer)
        {
            ImageButtonFactory imageButtonFactory = new ImageButtonFactory();
            imageButtonFactory.invertImageColor = false;
            string notifyIconPath = Path.Combine("PrintStatusControls", "notify.png");
            string notifyHoverIconPath = Path.Combine("PrintStatusControls", "notify-hover.png");
            Button notifyButton = imageButtonFactory.Generate(notifyIconPath, notifyHoverIconPath);
            notifyButton.Cursor = Cursors.Hand;
            notifyButton.Margin = new Agg.BorderDouble(top: 3);
            notifyButton.Click += (sender, mouseEvent) => { 
                UiThread.RunOnIdle((state) =>
                {
                    NotificationFormWindow.Open();
                });
            };
            notifyButton.MouseEnterBounds += (sender, mouseEvent) => {
                UiThread.RunOnIdle((state) =>
                {
                    HelpTextWidget.Instance.ShowHoverText("Edit notification settings");
                }); 
            };
            notifyButton.MouseLeaveBounds += (sender, mouseEvent) => {
                UiThread.RunOnIdle((state) =>
                {
                    HelpTextWidget.Instance.HideHoverText();
                }); 
            };

            iconContainer.AddChild(notifyButton);
        }
        private Button GetAutoLevelIndicator()
        {
            ImageButtonFactory imageButtonFactory = new ImageButtonFactory();

            imageButtonFactory.InvertImageColor = false;
            ImageBuffer levelingImage   = StaticData.Instance.LoadIcon("leveling_32x32.png", 16, 16).InvertLightness();
            Button      autoLevelButton = imageButtonFactory.Generate(levelingImage, levelingImage);

            autoLevelButton.Margin      = new Agg.BorderDouble(top: 3);
            autoLevelButton.ToolTipText = "Print leveling is enabled.".Localize();
            autoLevelButton.Cursor      = Cursors.Hand;
            autoLevelButton.Visible     = ActiveSliceSettings.Instance.GetValue <bool>("print_leveling_enabled");

            ActiveSliceSettings.ActivePrinterChanged.RegisterEvent((sender, e) =>
            {
                autoLevelButton.Visible = ActiveSliceSettings.Instance.GetValue <bool>("print_leveling_enabled");
            }, ref unregisterEvents);

            ActiveSliceSettings.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) =>
            {
                autoLevelButton.Visible = ActiveSliceSettings.Instance.GetValue <bool>("print_leveling_enabled");
            }, ref unregisterEvents);

            return(autoLevelButton);
        }
        public virtual FlowLayoutWidget GetPulldownContainer()
        {
            DropDownList = CreateDropdown();

            FlowLayoutWidget container = new FlowLayoutWidget();

            container.HAnchor = HAnchor.ParentLeftRight;
            container.Padding = new BorderDouble(6, 0);

            editButton = imageButtonFactory.Generate("icon_edit_white.png", "icon_edit_gray.png");

            editButton.VAnchor = VAnchor.ParentCenter;
            editButton.Margin  = new BorderDouble(right: 6);
            editButton.Click  += (sender, e) =>
            {
                if (ApplicationWidget.Instance.EditSlicePresetsWindow == null)
                {
                    ApplicationWidget.Instance.EditSlicePresetsWindow         = new SlicePresetsWindow(ReloadOptions, filterLabel, filterTag);
                    ApplicationWidget.Instance.EditSlicePresetsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { ApplicationWidget.Instance.EditSlicePresetsWindow = null; };
                }
                else
                {
                    ApplicationWidget.Instance.EditSlicePresetsWindow.BringToFront();
                }
            };

            container.AddChild(editButton);
            container.AddChild(DropDownList);
            return(container);
        }
Example #7
0
        private void AddChildElements()
        {
            FlowLayoutWidget tempWidgets = new FlowLayoutWidget();

            tempWidgets.VAnchor = VAnchor.ParentBottomTop;

            tempWidgets.Width = 120;

            extruderTemperatureWidget = new TemperatureWidgetExtruder();
            //extruderTemperatureWidget.Margin = new BorderDouble(right: 6);
            extruderTemperatureWidget.VAnchor = VAnchor.ParentTop;

            bedTemperatureWidget         = new TemperatureWidgetBed();
            bedTemperatureWidget.VAnchor = VAnchor.ParentTop;

            tempWidgets.AddChild(extruderTemperatureWidget);
            tempWidgets.AddChild(new GuiWidget(6, 6));
            if (ActiveSliceSettings.Instance.GetValue <bool>(SettingsKey.has_heated_bed))
            {
                tempWidgets.AddChild(bedTemperatureWidget);
            }
            tempWidgets.AddChild(new GuiWidget(6, 6));

            FlowLayoutWidget printStatusContainer = CreateActivePrinterInfoWidget();

            PrintActionRow printActionRow = new PrintActionRow(queueDataView);

            printActionRow.VAnchor = VAnchor.ParentTop;

            ImageButtonFactory factory = new ImageButtonFactory();

            factory.InvertImageColor = false;

            setupButton         = factory.Generate(StaticData.Instance.LoadIcon("icon_gear_dot.png").InvertLightness(), null);
            setupButton.Margin  = new BorderDouble(left: 6);
            setupButton.VAnchor = VAnchor.ParentCenter;
            setupButton.Click  += (sender, e) =>
            {
                WizardWindow.Show <SetupOptionsPage>("/SetupOptions", "Setup Wizard");
                //WizardWindow.Show(true);
            };

            this.AddChild(printStatusContainer);
            this.AddChild(printActionRow);
            this.AddChild(tempWidgets);
            this.AddChild(setupButton);
            this.Height = 80;

            UpdatePrintStatus();
            UpdatePrintItemName();
        }
		private Button GetAutoLevelIndicator()
		{
			ImageButtonFactory imageButtonFactory = new ImageButtonFactory();
			imageButtonFactory.InvertImageColor = false;
			string notifyIconPath = Path.Combine("PrintStatusControls", "leveling-16x16.png");
			string notifyHoverIconPath = Path.Combine("PrintStatusControls", "leveling-16x16.png");
			Button autoLevelButton = imageButtonFactory.Generate(notifyIconPath, notifyHoverIconPath);
			autoLevelButton.Cursor = Cursors.Hand;
			autoLevelButton.Margin = new Agg.BorderDouble(top: 3);
			autoLevelButton.ToolTipText = "Print leveling is enabled.".Localize();
			autoLevelButton.Visible = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.print_leveling_enabled);

			PrinterSettings.PrintLevelingEnabledChanged.RegisterEvent((sender, e) =>
			{
				autoLevelButton.Visible = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.print_leveling_enabled);
			}, ref unregisterEvents);

			return autoLevelButton;
		}
		private void AddChildElements()
		{
			FlowLayoutWidget tempWidgets = new FlowLayoutWidget();
			tempWidgets.VAnchor = VAnchor.ParentBottomTop;

			tempWidgets.Width = 120;

			extruderTemperatureWidget = new TemperatureWidgetExtruder();
			//extruderTemperatureWidget.Margin = new BorderDouble(right: 6);
			extruderTemperatureWidget.VAnchor = VAnchor.ParentTop;

			bedTemperatureWidget = new TemperatureWidgetBed();
			bedTemperatureWidget.VAnchor = VAnchor.ParentTop;

			tempWidgets.AddChild(extruderTemperatureWidget);
			tempWidgets.AddChild(new GuiWidget(6, 6));
			if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_heated_bed))
			{
				tempWidgets.AddChild(bedTemperatureWidget);
			}
			tempWidgets.AddChild(new GuiWidget(6, 6));

			FlowLayoutWidget printStatusContainer = CreateActivePrinterInfoWidget();

			PrintActionRow printActionRow = new PrintActionRow(queueDataView);
			printActionRow.VAnchor = VAnchor.ParentTop;

			ImageButtonFactory factory = new ImageButtonFactory();
			factory.InvertImageColor = false;

			setupButton = factory.Generate(StaticData.Instance.LoadIcon("icon_gear_dot.png").InvertLightness(), null);
			setupButton.Margin = new BorderDouble(left: 6);
			setupButton.VAnchor = VAnchor.ParentCenter;
			setupButton.Click += (sender, e) =>
			{
				WizardWindow.Show<SetupOptionsPage>("/SetupOptions", "Setup Wizard");
				//WizardWindow.Show(true);
			};

			this.AddChild(printStatusContainer);
			this.AddChild(printActionRow);
			this.AddChild(tempWidgets);
			this.AddChild(setupButton);
			this.Height = 80;

			UpdatePrintStatus();
			UpdatePrintItemName();
		}
		private Button GetAutoLevelIndicator()
		{
			ImageButtonFactory imageButtonFactory = new ImageButtonFactory();
			imageButtonFactory.InvertImageColor = false;
			ImageBuffer levelingImage = StaticData.Instance.LoadIcon("leveling_32x32.png", 16, 16).InvertLightness();
			Button autoLevelButton = imageButtonFactory.Generate(levelingImage, levelingImage);
			autoLevelButton.Margin = new Agg.BorderDouble(top: 3);
			autoLevelButton.ToolTipText = "Print leveling is enabled.".Localize();
			autoLevelButton.Cursor = Cursors.Hand;
			autoLevelButton.Visible = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.print_leveling_enabled);

			PrinterSettings.PrintLevelingEnabledChanged.RegisterEvent((sender, e) =>
			{
				autoLevelButton.Visible = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.print_leveling_enabled);
			}, ref unregisterEvents);

			return autoLevelButton;
		}
		private Button GetAutoLevelIndicator()
		{
			ImageButtonFactory imageButtonFactory = new ImageButtonFactory();
			imageButtonFactory.invertImageColor = false;
			string notifyIconPath = Path.Combine("PrintStatusControls", "leveling-16x16.png");
			string notifyHoverIconPath = Path.Combine("PrintStatusControls", "leveling-16x16.png");
			Button autoLevelButton = imageButtonFactory.Generate(notifyIconPath, notifyHoverIconPath);
			autoLevelButton.Cursor = Cursors.Hand;
			autoLevelButton.Margin = new Agg.BorderDouble(top: 3);
			autoLevelButton.MouseEnterBounds += (sender, mouseEvent) => { HelpTextWidget.Instance.ShowHoverText("Print leveling is enabled."); };
			autoLevelButton.MouseLeaveBounds += (sender, mouseEvent) => { HelpTextWidget.Instance.HideHoverText(); };
			autoLevelButton.Visible = ActivePrinterProfile.Instance.DoPrintLeveling;

			ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent((sender, e) =>
			{
				autoLevelButton.Visible = ActivePrinterProfile.Instance.DoPrintLeveling;
			}, ref unregisterEvents);

			ActivePrinterProfile.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) =>
			{
				autoLevelButton.Visible = ActivePrinterProfile.Instance.DoPrintLeveling;
			}, ref unregisterEvents);

			return autoLevelButton;
		}