private void AddChildElements()
		{
			activePrintPreviewImage = new PartThumbnailWidget(null, "part_icon_transparent_100x100.png", "building_thumbnail_100x100.png", PartThumbnailWidget.ImageSizes.Size115x115);
			activePrintPreviewImage.VAnchor = VAnchor.ParentTop;
			activePrintPreviewImage.Padding = new BorderDouble(0);
			activePrintPreviewImage.HoverBackgroundColor = new RGBA_Bytes();
			activePrintPreviewImage.BorderWidth = 3;

			FlowLayoutWidget temperatureWidgets = new FlowLayoutWidget(FlowDirection.TopToBottom);
			{
				extruderTemperatureWidget = new TemperatureWidgetExtruder();
				temperatureWidgets.AddChild(extruderTemperatureWidget);

				bedTemperatureWidget = new TemperatureWidgetBed();
				if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_heated_bed))
				{
					temperatureWidgets.AddChild(bedTemperatureWidget);
				}
			}
			temperatureWidgets.VAnchor |= VAnchor.ParentTop;
			temperatureWidgets.Margin = new BorderDouble(left: 6);

			FlowLayoutWidget printStatusContainer = CreateActivePrinterInfoWidget();
			printStatusContainer.VAnchor |= VAnchor.ParentTop;

			iconContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			iconContainer.Name = "PrintStatusRow.IconContainer";
			iconContainer.VAnchor |= VAnchor.ParentTop;
			iconContainer.Margin = new BorderDouble(top: 3);
			iconContainer.AddChild(GetAutoLevelIndicator());

			this.AddChild(activePrintPreviewImage);
			this.AddChild(printStatusContainer);
			this.AddChild(iconContainer);
			this.AddChild(temperatureWidgets);

			UpdatePrintStatus();
			UpdatePrintItemName();
		}
		private FlowLayoutWidget CreateActivePrinterInfoWidget()
		{
			FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
			container.Margin = new BorderDouble(6, 0, 6, 0);
			container.HAnchor = HAnchor.ParentLeftRight;
			container.VAnchor = VAnchor.ParentCenter;
			container.Height = 80;

			FlowLayoutWidget topRow = new FlowLayoutWidget();
			topRow.Name = "PrintStatusRow.ActivePrinterInfo.TopRow";
			topRow.HAnchor = HAnchor.ParentLeftRight;

			string nextPrintLabel = LocalizedString.Get("Next Print");
			string nextPrintLabelFull = string.Format("{0}:", nextPrintLabel);
			activePrintLabel = getPrintStatusLabel(nextPrintLabelFull, pointSize: 11);
			activePrintLabel.VAnchor = VAnchor.ParentTop;

			topRow.AddChild(activePrintLabel);

			FlowLayoutWidget bottomRow = new FlowLayoutWidget();

			activePrintPreviewImage = new PartThumbnailWidget(null, "part_icon_transparent_100x100.png", "building_thumbnail_100x100.png", PartThumbnailWidget.ImageSizes.Size50x50);
			activePrintPreviewImage.VAnchor = VAnchor.ParentTop;
			activePrintPreviewImage.Padding = new BorderDouble(0);
			activePrintPreviewImage.HoverBackgroundColor = new RGBA_Bytes();
			activePrintPreviewImage.BorderWidth = 3;

			FlowLayoutWidget labelContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			labelContainer.VAnchor |= VAnchor.ParentTop;
			labelContainer.Margin = new BorderDouble(8, 0, 0, 4);
			{
				activePrintName = getPrintStatusLabel("this is the biggest name we will allow", pointSize: 14);
				activePrintName.AutoExpandBoundsToText = false;

				activePrintStatus = getPrintStatusLabel("this is the biggest label we will allow - bigger", pointSize: 11);
				activePrintStatus.AutoExpandBoundsToText = false;
				activePrintStatus.Text = "";
				activePrintStatus.Margin = new BorderDouble(top: 3);

				activePrintInfo = getPrintStatusLabel("", pointSize: 11);
				activePrintInfo.AutoExpandBoundsToText = true;

				labelContainer.AddChild(activePrintName);
				labelContainer.AddChild(activePrintStatus);
			}

			bottomRow.AddChild(activePrintPreviewImage);
			bottomRow.AddChild(labelContainer);

			//PrintActionRow printActionRow = new PrintActionRow(queueDataView);

			container.AddChild(topRow);
			container.AddChild(bottomRow);
			//container.AddChild(activePrintInfo);
			//container.AddChild(printActionRow);
			//container.AddChild(new VerticalSpacer());
			//container.AddChild(new MessageActionRow());

			return container;
		}
Exemple #3
0
		public void ConstructPrintQueueItem()
		{
			linkButtonFactory.fontSize = 10;
			linkButtonFactory.textColor = RGBA_Bytes.Black;

			WidgetTextColor = RGBA_Bytes.Black;
			WidgetBackgroundColor = RGBA_Bytes.White;

			TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;

			SetDisplayAttributes();

			FlowLayoutWidget topToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
			topToBottomLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;

			FlowLayoutWidget topContentsFlowLayout = new FlowLayoutWidget(FlowDirection.LeftToRight);
			topContentsFlowLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
			{
				FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.LeftToRight);
				leftColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren;
				{
					selectionCheckBoxContainer = new GuiWidget();
					selectionCheckBoxContainer.VAnchor = VAnchor.ParentBottomTop;
					selectionCheckBoxContainer.Width = 40;
					selectionCheckBoxContainer.Visible = false;
					selectionCheckBoxContainer.Margin = new BorderDouble(left: 6);
					selectionCheckBox = new CheckBox("");
					selectionCheckBox.VAnchor = VAnchor.ParentCenter;
					selectionCheckBox.HAnchor = HAnchor.ParentCenter;
					selectionCheckBoxContainer.AddChild(selectionCheckBox);

					PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(PrintItemWrapper, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50);
					leftColumn.AddChild(selectionCheckBoxContainer);

					leftColumn.AddChild(thumbnailWidget);
				}

				FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
				middleColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren;
				middleColumn.HAnchor = HAnchor.ParentLeftRight;// | Agg.UI.HAnchor.FitToChildren;
				middleColumn.Padding = new BorderDouble(8);
				middleColumn.Margin = new BorderDouble(10, 0);
				{
					string labelName = textInfo.ToTitleCase(PrintItemWrapper.Name);
					labelName = labelName.Replace('_', ' ');
					partLabel = new TextWidget(labelName, pointSize: 14);
					partLabel.TextColor = WidgetTextColor;
					partLabel.MinimumSize = new Vector2(1, 16);

					string partStatusLabelTxt = LocalizedString.Get("Status").ToUpper();
					string partStatusLabelTxtTest = LocalizedString.Get("Queued to Print");
					string partStatusLabelTxtFull = "{0}: {1}".FormatWith(partStatusLabelTxt, partStatusLabelTxtTest);

					partStatus = new TextWidget(partStatusLabelTxtFull, pointSize: 10);
					partStatus.AutoExpandBoundsToText = true;
					partStatus.TextColor = WidgetTextColor;
					partStatus.MinimumSize = new Vector2(50, 12);

					middleColumn.AddChild(partLabel);
					middleColumn.AddChild(partStatus);
				}

				CreateEditControls();

				topContentsFlowLayout.AddChild(leftColumn);
				topContentsFlowLayout.AddChild(middleColumn);
				//topContentsFlowLayout.AddChild(editControls);

				editControls.Visible = false;
			}

			// The ConditionalClickWidget supplies a user driven Enabled property based on a delegate of your choosing
			conditionalClickContainer = new ConditionalClickWidget(() => queueDataView.EditMode);
			conditionalClickContainer.HAnchor = HAnchor.ParentLeftRight;
			conditionalClickContainer.VAnchor = VAnchor.ParentBottomTop;
			conditionalClickContainer.Click += onLibraryItemClick;

			topToBottomLayout.AddChild(topContentsFlowLayout);
			this.AddChild(topToBottomLayout);

			actionButtonContainer = getItemActionButtons();
			actionButtonContainer.Visible = false;
			this.AddChild(conditionalClickContainer);

			this.AddChild(actionButtonContainer);

			AddHandlers();
		}
        public void ConstructPrintQueueItem()
        {
            linkButtonFactory.fontSize = 10;
            linkButtonFactory.textColor = RGBA_Bytes.Black;

            WidgetTextColor = RGBA_Bytes.Black;
            WidgetBackgroundColor = RGBA_Bytes.White;

            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;

            SetDisplayAttributes();

            FlowLayoutWidget topToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
            topToBottomLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;

            FlowLayoutWidget topContentsFlowLayout = new FlowLayoutWidget(FlowDirection.LeftToRight);
            topContentsFlowLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            {
                FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                leftColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren;
                {
                    PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(PrintItemWrapper, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50);
                    leftColumn.AddChild(thumbnailWidget);
                }

                FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                middleColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren;
                middleColumn.HAnchor = HAnchor.ParentLeftRight;// | Agg.UI.HAnchor.FitToChildren;
                middleColumn.Padding = new BorderDouble(8);
                middleColumn.Margin = new BorderDouble(10,0);
                {
                    string labelName = textInfo.ToTitleCase(PrintItemWrapper.Name);
                    labelName = labelName.Replace('_', ' ');
                    partLabel = new TextWidget(labelName, pointSize: 14);
                    partLabel.TextColor = WidgetTextColor;
                    partLabel.MinimumSize = new Vector2(1, 16);

					string partStatusLabelTxt = LocalizedString.Get ("Status").ToUpper();     
					string partStatusLabelTxtTest = LocalizedString.Get ("Queued to Print");
					string partStatusLabelTxtFull = "{0}: {1}".FormatWith(partStatusLabelTxt,partStatusLabelTxtTest);

					partStatus = new TextWidget(partStatusLabelTxtFull, pointSize: 10);
                    partStatus.AutoExpandBoundsToText = true;
                    partStatus.TextColor = WidgetTextColor;
                    partStatus.MinimumSize = new Vector2(50, 12);

					middleColumn.AddChild(partLabel);
                    middleColumn.AddChild(partStatus);
                }

                CreateEditControls();

                topContentsFlowLayout.AddChild(leftColumn);
                topContentsFlowLayout.AddChild(middleColumn);
                topContentsFlowLayout.AddChild(editControls);

                editControls.Visible = false;
            }

            topToBottomLayout.AddChild(topContentsFlowLayout);
            this.AddChild(topToBottomLayout);

            AddHandlers();
        }
        public PrintingWindow(Action onCloseCallback, bool mockMode = false)
            : base(1280, 750)
        {
            this.BackgroundColor = new RGBA_Bytes(35, 40, 49);
            this.onCloseCallback = onCloseCallback;
            this.Title           = "Print Monitor".Localize();

            var topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                VAnchor = VAnchor.ParentBottomTop,
                HAnchor = HAnchor.ParentLeftRight
            };

            this.AddChild(topToBottom);

            var actionBar = new FlowLayoutWidget(FlowDirection.LeftToRight)
            {
                VAnchor         = VAnchor.ParentTop | VAnchor.FitToChildren,
                HAnchor         = HAnchor.ParentLeftRight,
                BackgroundColor = new RGBA_Bytes(34, 38, 46),
                //DebugShowBounds = true
            };

            topToBottom.AddChild(actionBar);

            var logo = new ImageWidget(StaticData.Instance.LoadIcon(Path.Combine("Screensaver", "logo.png")));

            actionBar.AddChild(logo);

            actionBar.AddChild(new HorizontalSpacer());

            var pauseButton  = CreateButton("Pause".Localize().ToUpper());
            var resumeButton = CreateButton("Resume".Localize().ToUpper());

            pauseButton.Click += (s, e) =>
            {
                UiThread.RunOnIdle(() =>
                {
                    //PrinterConnectionAndCommunication.Instance.RequestPause();
                    pauseButton.Visible  = false;
                    resumeButton.Visible = true;
                });
            };
            actionBar.AddChild(pauseButton);

            resumeButton.Visible = false;
            resumeButton.Click  += (s, e) =>
            {
                UiThread.RunOnIdle(() =>
                {
                    //PrinterConnectionAndCommunication.Instance.Resume();
                    resumeButton.Visible = false;
                    pauseButton.Visible  = true;
                });
            };
            actionBar.AddChild(resumeButton);

            actionBar.AddChild(CreateVerticalLine());

            var cancelButton = CreateButton("Cancel".Localize().ToUpper());

            //cancelButton.Click += (sender, e) => UiThread.RunOnIdle(CancelButton_Click);
            actionBar.AddChild(cancelButton);

            actionBar.AddChild(CreateVerticalLine());

            var advancedButton = CreateButton("Advanced".Localize().ToUpper());

            actionBar.AddChild(advancedButton);

            var bodyContainer = new GuiWidget()
            {
                VAnchor         = VAnchor.ParentBottomTop,
                HAnchor         = HAnchor.ParentLeftRight,
                Padding         = new BorderDouble(50),
                BackgroundColor = new RGBA_Bytes(35, 40, 49),
            };

            topToBottom.AddChild(bodyContainer);

            var bodyRow = new FlowLayoutWidget(FlowDirection.LeftToRight)
            {
                VAnchor = VAnchor.ParentBottomTop,
                HAnchor = HAnchor.ParentLeftRight,
                //BackgroundColor = new RGBA_Bytes(125, 255, 46, 20),
            };

            bodyContainer.AddChild(bodyRow);

            // Thumbnail section
            {
                ImageBuffer imageBuffer = null;

                string stlHashCode = PrinterConnectionAndCommunication.Instance.ActivePrintItem?.FileHashCode.ToString();
                if (!string.IsNullOrEmpty(stlHashCode) && stlHashCode != "0")
                {
                    imageBuffer = PartThumbnailWidget.LoadImageFromDisk(stlHashCode);
                    if (imageBuffer != null)
                    {
                        imageBuffer = ImageBuffer.CreateScaledImage(imageBuffer, 500, 500);
                    }
                }

                if (imageBuffer == null)
                {
                    imageBuffer = StaticData.Instance.LoadIcon(Path.Combine("Screensaver", "part_thumbnail.png"));
                }

                var partThumbnail = new ImageWidget(imageBuffer)
                {
                    VAnchor = VAnchor.ParentCenter,
                    Margin  = new BorderDouble(right: 50)
                };
                bodyRow.AddChild(partThumbnail);
            }

            bodyRow.AddChild(CreateVerticalLine());

            // Progress section
            {
                var expandingContainer = new HorizontalSpacer()
                {
                    VAnchor = VAnchor.FitToChildren | VAnchor.ParentCenter
                };
                bodyRow.AddChild(expandingContainer);

                var progressContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
                {
                    Margin  = new BorderDouble(50, 0),
                    VAnchor = VAnchor.ParentCenter | VAnchor.FitToChildren,
                    HAnchor = HAnchor.ParentCenter | HAnchor.FitToChildren,
                    //BackgroundColor = new RGBA_Bytes(125, 255, 46, 20),
                };
                expandingContainer.AddChild(progressContainer);

                progressDial = new ProgressDial()
                {
                    HAnchor = HAnchor.ParentCenter,
                    Height  = 200,
                    Width   = 200
                };
                progressContainer.AddChild(progressDial);

                var timeContainer = new FlowLayoutWidget()
                {
                    HAnchor = HAnchor.ParentLeftRight,
                    Margin  = new BorderDouble(50, 3)
                };
                progressContainer.AddChild(timeContainer);

                var timeImage = new ImageWidget(StaticData.Instance.LoadIcon(Path.Combine("Screensaver", "time.png")));
                timeContainer.AddChild(timeImage);

                timeWidget = new TextWidget("", pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor)
                {
                    AutoExpandBoundsToText = true,
                    Margin = new BorderDouble(10, 0)
                };

                timeContainer.AddChild(timeWidget);

                printerName = new TextWidget(ActiveSliceSettings.Instance.GetValue(SettingsKey.printer_name), pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor)
                {
                    AutoExpandBoundsToText = true,
                    HAnchor = HAnchor.ParentLeftRight,
                    Margin  = new BorderDouble(50, 3)
                };

                progressContainer.AddChild(printerName);

                partName = new TextWidget(PrinterConnectionAndCommunication.Instance.ActivePrintItem.GetFriendlyName(), pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor)
                {
                    AutoExpandBoundsToText = true,
                    HAnchor = HAnchor.ParentLeftRight,
                    Margin  = new BorderDouble(50, 3)
                };
                progressContainer.AddChild(partName);
            }

            bodyRow.AddChild(CreateVerticalLine());

            // ZControls
            {
                var widget = new ZAxisControls()
                {
                    Margin  = new BorderDouble(left: 50),
                    VAnchor = VAnchor.ParentCenter,
                    Width   = 120
                };
                bodyRow.AddChild(widget);
            }

            var footerBar = new FlowLayoutWidget(FlowDirection.LeftToRight)
            {
                VAnchor         = VAnchor.ParentBottom | VAnchor.FitToChildren,
                HAnchor         = HAnchor.ParentCenter | HAnchor.FitToChildren,
                BackgroundColor = new RGBA_Bytes(35, 40, 49),
                Margin          = new BorderDouble(bottom: 30)
            };

            topToBottom.AddChild(footerBar);

            int extruderCount = mockMode ? 3 : ActiveSliceSettings.Instance.GetValue <int>(SettingsKey.extruder_count);

            var borderColor = bodyContainer.BackgroundColor.AdjustLightness(1.5).GetAsRGBA_Bytes();

            extruderStatusWidgets = Enumerable.Range(0, extruderCount).Select((i) => new ExtruderStatusWidget(i)
            {
                BorderColor = borderColor
            }).ToList();

            if (extruderCount == 1)
            {
                footerBar.AddChild(extruderStatusWidgets[0]);
            }
            else
            {
                var columnA = new FlowLayoutWidget(FlowDirection.TopToBottom);
                footerBar.AddChild(columnA);

                var columnB = new FlowLayoutWidget(FlowDirection.TopToBottom);
                footerBar.AddChild(columnB);

                // Add each status widget into the scene, placing into the appropriate column
                for (var i = 0; i < extruderCount; i++)
                {
                    var widget = extruderStatusWidgets[i];
                    if (i % 2 == 0)
                    {
                        widget.Margin = new BorderDouble(right: 20);
                        columnA.AddChild(widget);
                    }
                    else
                    {
                        columnB.AddChild(widget);
                    }
                }
            }

            UiThread.RunOnIdle(() =>
            {
                if (mockMode)
                {
                    MockProgress();
                }
                else
                {
                    CheckOnPrinter();
                }
            });

            PrinterConnectionAndCommunication.Instance.ExtruderTemperatureRead.RegisterEvent((s, e) =>
            {
                var eventArgs = e as TemperatureEventArgs;
                if (eventArgs != null && eventArgs.Index0Based < extruderStatusWidgets.Count)
                {
                    extruderStatusWidgets[eventArgs.Index0Based].UpdateTemperatures();
                }
            }, ref unregisterEvents);
        }
        private FlowLayoutWidget GetThumbnailRenderingControl()
        {
            FlowLayoutWidget buttonRow = new FlowLayoutWidget();

            buttonRow.HAnchor = HAnchor.ParentLeftRight;
            buttonRow.Margin  = new BorderDouble(top: 4);

            TextWidget settingsLabel = new TextWidget("Thumbnail Rendering".Localize());

            settingsLabel.AutoExpandBoundsToText = true;
            settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            settingsLabel.VAnchor   = VAnchor.ParentTop;

            FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            optionsContainer.Margin = new BorderDouble(bottom: 6);

            StyledDropDownList interfaceOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);

            interfaceOptionsDropList.HAnchor = HAnchor.ParentLeftRight;

            optionsContainer.AddChild(interfaceOptionsDropList);
            optionsContainer.Width = 200;

            interfaceOptionsDropList.AddItem("Flat".Localize(), "orthographic");
            interfaceOptionsDropList.AddItem("3D".Localize(), "raytraced");

            List <string> acceptableUpdateFeedTypeValues = new List <string>()
            {
                "orthographic", "raytraced"
            };
            string currentThumbnailRenderingMode = UserSettings.Instance.get("ThumbnailRenderingMode");

            if (acceptableUpdateFeedTypeValues.IndexOf(currentThumbnailRenderingMode) == -1)
            {
                UserSettings.Instance.set("ThumbnailRenderingMode", "orthographic");
            }

            interfaceOptionsDropList.SelectedValue     = UserSettings.Instance.get("ThumbnailRenderingMode");
            interfaceOptionsDropList.SelectionChanged += (sender, e) =>
            {
                string thumbnailRenderingMode = ((StyledDropDownList)sender).SelectedValue;
                if (thumbnailRenderingMode != UserSettings.Instance.get("ThumbnailRenderingMode"))
                {
                    UserSettings.Instance.set("ThumbnailRenderingMode", thumbnailRenderingMode);

                    // Ask if the user would like to rebuild all their thumbnails
                    Action <bool> removeThumbnails = (bool shouldRebuildThumbnails) =>
                    {
                        if (shouldRebuildThumbnails)
                        {
                            string directoryToRemove = PartThumbnailWidget.ThumbnailPath();
                            try
                            {
                                if (Directory.Exists(directoryToRemove))
                                {
                                    Directory.Delete(directoryToRemove, true);
                                }
                            }
                            catch (Exception)
                            {
                                GuiWidget.BreakInDebugger();
                            }
                        }

                        ApplicationController.Instance.ReloadAll(null, null);
                    };

                    UiThread.RunOnIdle(() =>
                    {
                        StyledMessageBox.ShowMessageBox(removeThumbnails, rebuildThumbnailsMessage, rebuildThumbnailsTitle, StyledMessageBox.MessageType.YES_NO, "Rebuild".Localize());
                    });
                }
            };

            buttonRow.AddChild(settingsLabel);
            buttonRow.AddChild(new HorizontalSpacer());
            buttonRow.AddChild(optionsContainer);
            return(buttonRow);
        }
        public LibraryRowItem(PrintItemWrapper printItem, LibraryDataView libraryDataView)
        {
            this.libraryDataView  = libraryDataView;
            this.printItemWrapper = printItem;
            this.Cursor           = Cursors.Hand;

            linkButtonFactory.fontSize  = 10;
            linkButtonFactory.textColor = RGBA_Bytes.White;

            WidgetTextColor       = RGBA_Bytes.Black;
            WidgetBackgroundColor = RGBA_Bytes.White;

            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;

            SetDisplayAttributes();

            FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);

            mainContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
            mainContainer.VAnchor = VAnchor.ParentBottomTop;
            {
                GuiWidget primaryContainer = new GuiWidget();
                primaryContainer.HAnchor = HAnchor.ParentLeftRight;
                primaryContainer.VAnchor = VAnchor.ParentBottomTop;

                FlowLayoutWidget primaryFlow = new FlowLayoutWidget(FlowDirection.LeftToRight);
                primaryFlow.HAnchor = HAnchor.ParentLeftRight;
                primaryFlow.VAnchor = VAnchor.ParentBottomTop;

                PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(printItem, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50);

                selectionCheckBoxContainer         = new GuiWidget();
                selectionCheckBoxContainer.VAnchor = VAnchor.ParentBottomTop;
                selectionCheckBoxContainer.Width   = 40;
                selectionCheckBoxContainer.Visible = false;
                selectionCheckBoxContainer.Margin  = new BorderDouble(left: 6);
                selectionCheckBox         = new CheckBox("");
                selectionCheckBox.VAnchor = VAnchor.ParentCenter;
                selectionCheckBox.HAnchor = HAnchor.ParentCenter;
                selectionCheckBoxContainer.AddChild(selectionCheckBox);

                GuiWidget middleColumn = new GuiWidget(0.0, 0.0);
                middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                middleColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
                middleColumn.Margin  = new BorderDouble(10, 6);
                {
                    string labelName = textInfo.ToTitleCase(printItem.Name);
                    labelName             = labelName.Replace('_', ' ');
                    partLabel             = new TextWidget(labelName, pointSize: 14);
                    partLabel.TextColor   = WidgetTextColor;
                    partLabel.MinimumSize = new Vector2(1, 18);
                    partLabel.VAnchor     = VAnchor.ParentCenter;
                    middleColumn.AddChild(partLabel);
                }
                primaryFlow.AddChild(selectionCheckBoxContainer);
                primaryFlow.AddChild(thumbnailWidget);
                primaryFlow.AddChild(middleColumn);

                primaryContainer.AddChild(primaryFlow);

                // The ConditionalClickWidget supplies a user driven Enabled property based on a delegate of your choosing
                primaryClickContainer         = new ConditionalClickWidget(() => libraryDataView.EditMode);
                primaryClickContainer.HAnchor = HAnchor.ParentLeftRight;
                primaryClickContainer.VAnchor = VAnchor.ParentBottomTop;

                primaryContainer.AddChild(primaryClickContainer);

                rightButtonOverlay         = getItemActionButtons();
                rightButtonOverlay.Visible = false;

                mainContainer.AddChild(primaryContainer);
                mainContainer.AddChild(rightButtonOverlay);
            }
            this.AddChild(mainContainer);
            AddHandlers();
        }
Exemple #8
0
        public override void OnLoad(EventArgs args)
        {
            base.OnLoad(args);

            bool smallScreen = Parent.Width <= 1180;

            Padding = smallScreen ? new BorderDouble(20, 5) : new BorderDouble(50, 30);

            var topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                VAnchor = VAnchor.ParentBottomTop,
                HAnchor = HAnchor.ParentLeftRight
            };

            AddChild(topToBottom);

            var bodyRow = new FlowLayoutWidget(FlowDirection.LeftToRight)
            {
                VAnchor = VAnchor.ParentBottomTop,
                HAnchor = HAnchor.ParentLeftRight,
                Margin  = smallScreen ? new BorderDouble(30, 5, 30, 0) : new BorderDouble(30, 20, 30, 0),               // the -12 is to take out the top bar
            };

            topToBottom.AddChild(bodyRow);

            // Thumbnail section
            {
                int         imageSize   = smallScreen ? 300 : 500;
                ImageBuffer imageBuffer = PartThumbnailWidget.GetImageForItem(PrinterConnectionAndCommunication.Instance.ActivePrintItem, imageSize, imageSize);

                if (imageBuffer == null)
                {
                    imageBuffer = StaticData.Instance.LoadImage(Path.Combine("Images", "Screensaver", "part_thumbnail.png"));
                }

                WhiteToColor.DoWhiteToColor(imageBuffer, ActiveTheme.Instance.PrimaryAccentColor);

                var partThumbnail = new ImageWidget(imageBuffer)
                {
                    VAnchor = VAnchor.ParentCenter,
                    Margin  = smallScreen ? new BorderDouble(right: 20) : new BorderDouble(right: 50),
                };
                bodyRow.AddChild(partThumbnail);
            }

            bodyRow.AddChild(PrintingWindow.CreateVerticalLine());

            // Progress section
            {
                var expandingContainer = new HorizontalSpacer()
                {
                    VAnchor = VAnchor.FitToChildren | VAnchor.ParentCenter
                };
                bodyRow.AddChild(expandingContainer);

                var progressContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
                {
                    Margin  = new BorderDouble(50, 0),
                    VAnchor = VAnchor.ParentCenter | VAnchor.FitToChildren,
                    HAnchor = HAnchor.ParentCenter | HAnchor.FitToChildren,
                };
                expandingContainer.AddChild(progressContainer);

                progressDial = new ProgressDial()
                {
                    HAnchor = HAnchor.ParentCenter,
                    Height  = 200 * DeviceScale,
                    Width   = 200 * DeviceScale
                };
                progressContainer.AddChild(progressDial);

                var timeContainer = new FlowLayoutWidget()
                {
                    HAnchor = HAnchor.ParentCenter | HAnchor.FitToChildren,
                    Margin  = 3
                };
                progressContainer.AddChild(timeContainer);

                var timeImage = StaticData.Instance.LoadImage(Path.Combine("Images", "Screensaver", "time.png"));
                if (!ActiveTheme.Instance.IsDarkTheme)
                {
                    timeImage.InvertLightness();
                }

                timeContainer.AddChild(new ImageWidget(timeImage));

                timeWidget = new TextWidget("", pointSize: 22, textColor: ActiveTheme.Instance.PrimaryTextColor)
                {
                    AutoExpandBoundsToText = true,
                    Margin  = new BorderDouble(10, 0, 0, 0),
                    VAnchor = VAnchor.ParentCenter,
                };

                timeContainer.AddChild(timeWidget);

                int maxTextWidth = 350;
                printerName = new TextWidget(ActiveSliceSettings.Instance.GetValue(SettingsKey.printer_name), pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor)
                {
                    HAnchor     = HAnchor.ParentCenter,
                    MinimumSize = new Vector2(maxTextWidth, MinimumSize.y),
                    Width       = maxTextWidth,
                    Margin      = new BorderDouble(0, 3),
                };

                progressContainer.AddChild(printerName);

                partName = new TextWidget(PrinterConnectionAndCommunication.Instance.ActivePrintItem.GetFriendlyName(), pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor)
                {
                    HAnchor     = HAnchor.ParentCenter,
                    MinimumSize = new Vector2(maxTextWidth, MinimumSize.y),
                    Width       = maxTextWidth,
                    Margin      = new BorderDouble(0, 3)
                };
                progressContainer.AddChild(partName);
            }

            bodyRow.AddChild(PrintingWindow.CreateVerticalLine());

            // ZControls
            {
                var widget = new ZAxisControls(smallScreen)
                {
                    Margin  = new BorderDouble(left: 50),
                    VAnchor = VAnchor.ParentCenter,
                    Width   = 135
                };
                bodyRow.AddChild(widget);
            }

            var footerBar = new FlowLayoutWidget(FlowDirection.LeftToRight)
            {
                VAnchor = VAnchor.ParentBottom | VAnchor.FitToChildren,
                HAnchor = HAnchor.ParentCenter | HAnchor.FitToChildren,
                Margin  = new BorderDouble(bottom: 0),
            };

            topToBottom.AddChild(footerBar);

            int extruderCount = ActiveSliceSettings.Instance.GetValue <int>(SettingsKey.extruder_count);

            extruderStatusWidgets = Enumerable.Range(0, extruderCount).Select((i) => new ExtruderStatusWidget(i)).ToList();

            bool hasHeatedBed = ActiveSliceSettings.Instance.GetValue <bool>("has_heated_bed");

            if (hasHeatedBed)
            {
                var extruderColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                footerBar.AddChild(extruderColumn);

                // Add each status widget into the scene, placing into the appropriate column
                for (var i = 0; i < extruderCount; i++)
                {
                    var widget = extruderStatusWidgets[i];
                    widget.Margin = new BorderDouble(right: 20);
                    extruderColumn.AddChild(widget);
                }

                footerBar.AddChild(new BedStatusWidget(smallScreen)
                {
                    VAnchor = VAnchor.ParentCenter,
                });
            }
            else
            {
                if (extruderCount == 1)
                {
                    footerBar.AddChild(extruderStatusWidgets[0]);
                }
                else
                {
                    var columnA = new FlowLayoutWidget(FlowDirection.TopToBottom);
                    footerBar.AddChild(columnA);

                    var columnB = new FlowLayoutWidget(FlowDirection.TopToBottom);
                    footerBar.AddChild(columnB);

                    // Add each status widget into the scene, placing into the appropriate column
                    for (var i = 0; i < extruderCount; i++)
                    {
                        var widget = extruderStatusWidgets[i];
                        if (i % 2 == 0)
                        {
                            widget.Margin = new BorderDouble(right: 20);
                            columnA.AddChild(widget);
                        }
                        else
                        {
                            columnB.AddChild(widget);
                        }
                    }
                }
            }

            UiThread.RunOnIdle(() =>
            {
                CheckOnPrinter();
            });
        }
Exemple #9
0
        public void ConstructPrintQueueItem()
        {
            linkButtonFactory.fontSize  = 10;
            linkButtonFactory.textColor = RGBA_Bytes.Black;

            WidgetTextColor       = RGBA_Bytes.Black;
            WidgetBackgroundColor = RGBA_Bytes.White;

            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;

            SetDisplayAttributes();

            FlowLayoutWidget topToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);

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

            FlowLayoutWidget topContentsFlowLayout = new FlowLayoutWidget(FlowDirection.LeftToRight);

            topContentsFlowLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            {
                FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.LeftToRight);
                leftColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren;
                {
                    selectionCheckBoxContainer         = new GuiWidget();
                    selectionCheckBoxContainer.VAnchor = VAnchor.ParentBottomTop;
                    selectionCheckBoxContainer.Width   = 40;
                    selectionCheckBoxContainer.Visible = false;
                    selectionCheckBoxContainer.Margin  = new BorderDouble(left: 6);
                    selectionCheckBox         = new CheckBox("");
                    selectionCheckBox.VAnchor = VAnchor.ParentCenter;
                    selectionCheckBox.HAnchor = HAnchor.ParentCenter;
                    selectionCheckBoxContainer.AddChild(selectionCheckBox);

                    PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(PrintItemWrapper, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50);
                    leftColumn.AddChild(selectionCheckBoxContainer);

                    leftColumn.AddChild(thumbnailWidget);
                }

                FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                middleColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren;
                middleColumn.HAnchor = HAnchor.ParentLeftRight;// | Agg.UI.HAnchor.FitToChildren;
                middleColumn.Padding = new BorderDouble(8);
                middleColumn.Margin  = new BorderDouble(10, 0);
                {
                    string labelName = textInfo.ToTitleCase(PrintItemWrapper.Name);
                    labelName             = labelName.Replace('_', ' ');
                    partLabel             = new TextWidget(labelName, pointSize: 14);
                    partLabel.TextColor   = WidgetTextColor;
                    partLabel.MinimumSize = new Vector2(1, 16);

                    string partStatusLabelTxt     = LocalizedString.Get("Status").ToUpper();
                    string partStatusLabelTxtTest = LocalizedString.Get("Queued to Print");
                    string partStatusLabelTxtFull = "{0}: {1}".FormatWith(partStatusLabelTxt, partStatusLabelTxtTest);

                    partStatus = new TextWidget(partStatusLabelTxtFull, pointSize: 10);
                    partStatus.AutoExpandBoundsToText = true;
                    partStatus.TextColor   = WidgetTextColor;
                    partStatus.MinimumSize = new Vector2(50, 12);

                    middleColumn.AddChild(partLabel);
                    middleColumn.AddChild(partStatus);
                }

                CreateEditControls();

                topContentsFlowLayout.AddChild(leftColumn);
                topContentsFlowLayout.AddChild(middleColumn);
                //topContentsFlowLayout.AddChild(editControls);

                editControls.Visible = false;
            }

            // The ConditionalClickWidget supplies a user driven Enabled property based on a delegate of your choosing
            conditionalClickContainer         = new ConditionalClickWidget(() => queueDataView.EditMode);
            conditionalClickContainer.HAnchor = HAnchor.ParentLeftRight;
            conditionalClickContainer.VAnchor = VAnchor.ParentBottomTop;
            conditionalClickContainer.Click  += onLibraryItemClick;

            topToBottomLayout.AddChild(topContentsFlowLayout);
            this.AddChild(topToBottomLayout);

            actionButtonContainer         = getItemActionButtons();
            actionButtonContainer.Visible = false;
            this.AddChild(conditionalClickContainer);

            this.AddChild(actionButtonContainer);

            AddHandlers();
        }
Exemple #10
0
        private FlowLayoutWidget CreateActivePrinterInfoWidget()
        {
            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);

            container.Margin  = new BorderDouble(6, 0, 6, 0);
            container.HAnchor = HAnchor.ParentLeftRight;
            container.VAnchor = VAnchor.ParentCenter;
            container.Height  = 80;

            FlowLayoutWidget topRow = new FlowLayoutWidget();

            topRow.Name    = "PrintStatusRow.ActivePrinterInfo.TopRow";
            topRow.HAnchor = HAnchor.ParentLeftRight;

            string nextPrintLabel     = LocalizedString.Get("Next Print");
            string nextPrintLabelFull = string.Format("{0}:", nextPrintLabel);

            activePrintLabel         = getPrintStatusLabel(nextPrintLabelFull, pointSize: 11);
            activePrintLabel.VAnchor = VAnchor.ParentTop;

            topRow.AddChild(activePrintLabel);

            FlowLayoutWidget bottomRow = new FlowLayoutWidget();

            activePrintPreviewImage         = new PartThumbnailWidget(null, "part_icon_transparent_100x100.png", "building_thumbnail_100x100.png", PartThumbnailWidget.ImageSizes.Size50x50);
            activePrintPreviewImage.VAnchor = VAnchor.ParentTop;
            activePrintPreviewImage.Padding = new BorderDouble(0);
            activePrintPreviewImage.HoverBackgroundColor = new RGBA_Bytes();
            activePrintPreviewImage.BorderWidth          = 3;

            FlowLayoutWidget labelContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            labelContainer.VAnchor |= VAnchor.ParentTop;
            labelContainer.Margin   = new BorderDouble(8, 0, 0, 4);
            {
                activePrintName = getPrintStatusLabel("this is the biggest name we will allow", pointSize: 14);
                activePrintName.AutoExpandBoundsToText = false;

                activePrintStatus = getPrintStatusLabel("this is the biggest label we will allow - bigger", pointSize: 11);
                activePrintStatus.AutoExpandBoundsToText = false;
                activePrintStatus.Text   = "";
                activePrintStatus.Margin = new BorderDouble(top: 3);

                activePrintInfo = getPrintStatusLabel("", pointSize: 11);
                activePrintInfo.AutoExpandBoundsToText = true;

                labelContainer.AddChild(activePrintName);
                labelContainer.AddChild(activePrintStatus);
            }

            bottomRow.AddChild(activePrintPreviewImage);
            bottomRow.AddChild(labelContainer);

            //PrintActionRow printActionRow = new PrintActionRow(queueDataView);

            container.AddChild(topRow);
            container.AddChild(bottomRow);
            //container.AddChild(activePrintInfo);
            //container.AddChild(printActionRow);
            //container.AddChild(new VerticalSpacer());
            //container.AddChild(new MessageActionRow());

            return(container);
        }
		public LibraryRowItem(PrintItemWrapper printItem, LibraryDataView libraryDataView)
		{
			this.libraryDataView = libraryDataView;
			this.printItemWrapper = printItem;
			this.Cursor = Cursors.Hand;

			linkButtonFactory.fontSize = 10;
			linkButtonFactory.textColor = RGBA_Bytes.White;

			WidgetTextColor = RGBA_Bytes.Black;
			WidgetBackgroundColor = RGBA_Bytes.White;

			TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;

			SetDisplayAttributes();

			FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
			mainContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			mainContainer.VAnchor = VAnchor.ParentBottomTop;
			{
				GuiWidget primaryContainer = new GuiWidget();
				primaryContainer.HAnchor = HAnchor.ParentLeftRight;
				primaryContainer.VAnchor = VAnchor.ParentBottomTop;

				FlowLayoutWidget primaryFlow = new FlowLayoutWidget(FlowDirection.LeftToRight);
				primaryFlow.HAnchor = HAnchor.ParentLeftRight;
				primaryFlow.VAnchor = VAnchor.ParentBottomTop;

				PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(printItem, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50);

				selectionCheckBoxContainer = new GuiWidget();
				selectionCheckBoxContainer.VAnchor = VAnchor.ParentBottomTop;
				selectionCheckBoxContainer.Width = 40;
				selectionCheckBoxContainer.Visible = false;
				selectionCheckBoxContainer.Margin = new BorderDouble(left: 6);
				selectionCheckBox = new CheckBox("");
				selectionCheckBox.VAnchor = VAnchor.ParentCenter;
				selectionCheckBox.HAnchor = HAnchor.ParentCenter;
				selectionCheckBoxContainer.AddChild(selectionCheckBox);

				GuiWidget middleColumn = new GuiWidget(0.0, 0.0);
				middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
				middleColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
				middleColumn.Margin = new BorderDouble(10, 6);
				{
					string labelName = textInfo.ToTitleCase(printItem.Name);
					labelName = labelName.Replace('_', ' ');
					partLabel = new TextWidget(labelName, pointSize: 14);
					partLabel.TextColor = WidgetTextColor;
					partLabel.MinimumSize = new Vector2(1, 18);
					partLabel.VAnchor = VAnchor.ParentCenter;
					middleColumn.AddChild(partLabel);
				}
				primaryFlow.AddChild(selectionCheckBoxContainer);
				primaryFlow.AddChild(thumbnailWidget);
				primaryFlow.AddChild(middleColumn);

				primaryContainer.AddChild(primaryFlow);

				// The ConditionalClickWidget supplies a user driven Enabled property based on a delegate of your choosing
				primaryClickContainer = new ConditionalClickWidget(() => libraryDataView.EditMode);
				primaryClickContainer.HAnchor = HAnchor.ParentLeftRight;
				primaryClickContainer.VAnchor = VAnchor.ParentBottomTop;

				primaryContainer.AddChild(primaryClickContainer);

				rightButtonOverlay = getItemActionButtons();
				rightButtonOverlay.Visible = false;

				mainContainer.AddChild(primaryContainer);
				mainContainer.AddChild(rightButtonOverlay);
			}
			this.AddChild(mainContainer);
			AddHandlers();
		}
        public void ConstructPrintQueueItem()
        {
            linkButtonFactory.fontSize  = 10;
            linkButtonFactory.textColor = RGBA_Bytes.Black;

            WidgetTextColor       = RGBA_Bytes.Black;
            WidgetBackgroundColor = RGBA_Bytes.White;

            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;

            SetDisplayAttributes();

            FlowLayoutWidget topToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);

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

            FlowLayoutWidget topContentsFlowLayout = new FlowLayoutWidget(FlowDirection.LeftToRight);

            topContentsFlowLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            {
                FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                leftColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren;
                {
                    PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(PrintItemWrapper, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", new Vector2(50, 50));
                    leftColumn.AddChild(thumbnailWidget);
                }

                FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                middleColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren;
                middleColumn.HAnchor = HAnchor.ParentLeftRight;// | Agg.UI.HAnchor.FitToChildren;
                middleColumn.Padding = new BorderDouble(8);
                middleColumn.Margin  = new BorderDouble(10, 0);
                {
                    string labelName = textInfo.ToTitleCase(PrintItemWrapper.Name);
                    labelName             = labelName.Replace('_', ' ');
                    partLabel             = new TextWidget(labelName, pointSize: 14);
                    partLabel.TextColor   = WidgetTextColor;
                    partLabel.MinimumSize = new Vector2(1, 16);

                    string partStatusLblTxt     = new LocalizedString("Status").Translated;
                    string partStatusLblTxtTest = new LocalizedString("Queued to Print").Translated;
                    string partStatusLblTxtFull = string.Format("{0}: {1}", partStatusLblTxt, partStatusLblTxtTest);

                    partStatus = new TextWidget(partStatusLblTxtFull, pointSize: 10);
                    partStatus.AutoExpandBoundsToText = true;
                    partStatus.TextColor   = WidgetTextColor;
                    partStatus.MinimumSize = new Vector2(50, 12);

                    middleColumn.AddChild(partLabel);
                    middleColumn.AddChild(partStatus);
                }

                CreateEditControls();

                topContentsFlowLayout.AddChild(leftColumn);
                topContentsFlowLayout.AddChild(middleColumn);
                topContentsFlowLayout.AddChild(editControls);

                editControls.Visible = false;
            }

            topToBottomLayout.AddChild(topContentsFlowLayout);
            this.AddChild(topToBottomLayout);

            AddHandlers();
        }
		public virtual GuiWidget GetItemThumbnail(int printItemIndex)
		{
			PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(GetPrintItemWrapper(printItemIndex), "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50);
			return thumbnailWidget;
		}
        public PrintLibraryListItem(PrintItemWrapper printItem)
        {
            this.printItem              = printItem;
            linkButtonFactory.fontSize  = 10;
            linkButtonFactory.textColor = RGBA_Bytes.White;

            WidgetTextColor       = RGBA_Bytes.Black;
            WidgetBackgroundColor = RGBA_Bytes.White;

            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;

            SetDisplayAttributes();

            FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);

            mainContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
            {
                GuiWidget selectionCheckBoxContainer = new GuiWidget();
                selectionCheckBoxContainer.VAnchor = VAnchor.Max_FitToChildren_ParentHeight;
                selectionCheckBoxContainer.HAnchor = Agg.UI.HAnchor.FitToChildren;
                selectionCheckBoxContainer.Margin  = new BorderDouble(left: 6);
                selectionCheckBox         = new CheckBox("");
                selectionCheckBox.VAnchor = VAnchor.ParentCenter;
                selectionCheckBox.HAnchor = HAnchor.ParentCenter;
                selectionCheckBoxContainer.AddChild(selectionCheckBox);

                FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                leftColumn.VAnchor |= VAnchor.ParentTop;


                FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                middleColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
                middleColumn.Padding = new BorderDouble(0, 6);
                middleColumn.Margin  = new BorderDouble(10, 0);
                {
                    string labelName = textInfo.ToTitleCase(printItem.Name);
                    labelName             = labelName.Replace('_', ' ');
                    partLabel             = new TextWidget(labelName, pointSize: 12);
                    partLabel.TextColor   = WidgetTextColor;
                    partLabel.MinimumSize = new Vector2(1, 16);
                    middleColumn.AddChild(partLabel);
                }

                FlowLayoutWidget rightColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                rightColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop;

                buttonContainer         = new FlowLayoutWidget();
                buttonContainer.Margin  = new BorderDouble(0, 6);
                buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                {
                    addToQueueLink         = linkButtonFactory.Generate(new LocalizedString("Add to Queue").Translated);
                    addToQueueLink.Margin  = new BorderDouble(left: 0, right: 10);
                    addToQueueLink.VAnchor = VAnchor.ParentCenter;

                    addToQueueLink.Click += (sender, e) =>
                    {
                        PrintQueueItem queueItem = new PrintQueueItem(this.printItem.Name, this.printItem.FileLocation);
                        PrintQueueControl.Instance.AddChild(queueItem);
                    };

                    viewLink         = linkButtonFactory.Generate(new LocalizedString("View").Translated);
                    viewLink.Margin  = new BorderDouble(left: 0, right: 10);
                    viewLink.VAnchor = VAnchor.ParentCenter;

                    exportLink         = linkButtonFactory.Generate(new LocalizedString("Export").Translated);
                    exportLink.Margin  = new BorderDouble(left: 0, right: 10);
                    exportLink.VAnchor = VAnchor.ParentCenter;

                    exportLink.Click += (sender, e) =>
                    {
                        OpenExportWindow();
                    };

                    removeLink         = linkButtonFactory.Generate(new LocalizedString("Remove").Translated);
                    removeLink.Margin  = new BorderDouble(left: 10, right: 10);
                    removeLink.VAnchor = VAnchor.ParentCenter;

                    buttonContainer.AddChild(addToQueueLink);
                    buttonContainer.AddChild(viewLink);
                    buttonContainer.AddChild(exportLink);
                    buttonContainer.AddChild(removeLink);
                }
                middleColumn.AddChild(buttonContainer);
                //rightColumn.AddChild(buttonContainer);

                mainContainer.AddChild(selectionCheckBoxContainer);
                {
                    PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(printItem, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", new Vector2(50, 50));
                    mainContainer.AddChild(thumbnailWidget);
                }
                mainContainer.AddChild(leftColumn);
                mainContainer.AddChild(middleColumn);
                mainContainer.AddChild(rightColumn);
            }
            this.AddChild(mainContainer);
            AddHandlers();
        }
        public virtual GuiWidget GetItemThumbnail(int printItemIndex)
        {
            PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(GetPrintItemWrapper(printItemIndex), "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50);

            return(thumbnailWidget);
        }