Exemplo n.º 1
0
		public CompactTabView(QueueDataView queueDataView)
			: base(Orientation.Vertical)
		{
			this.queueDataView = queueDataView;
			this.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
			this.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0);
			this.TabBar.Margin = new BorderDouble(4, 0, 0, 0);
			this.TabBar.Padding = new BorderDouble(0, 8);

			this.Margin = new BorderDouble(top: 0);
			this.TabTextSize = 18;

			string simpleModeString = UserSettings.Instance.get("IsSimpleMode");

			if (simpleModeString == null)
			{
				simpleMode = true;
				UserSettings.Instance.set("IsSimpleMode", "true");
			}
			else
			{
				simpleMode = Convert.ToBoolean(simpleModeString);
			}

			QueueTabPage = new TabPage(new QueueDataWidget(queueDataView), LocalizedString.Get("Queue").ToUpper());
			SimpleTextTabWidget queueTabWidget = new SimpleTextTabWidget(QueueTabPage, "Queue Tab", TabTextSize,
				ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());

			partPreviewContainer = new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, View3DWidget.WindowMode.Embeded, View3DWidget.AutoRotate.Enabled, View3DWidget.OpenMode.Viewing);

			string partPreviewLabel = LocalizedString.Get("Preview").ToUpper();

			this.AddTab(new SimpleTextTabWidget(new TabPage(partPreviewContainer, partPreviewLabel), "Part Preview Tab", TabTextSize,
				ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

			string sliceSettingsLabel = LocalizedString.Get("Settings").ToUpper();
			sliceSettingsWidget = new SliceSettingsWidget();
			sliceTabPage = new TabPage(sliceSettingsWidget, sliceSettingsLabel);

			this.AddTab(new SimpleTextTabWidget(sliceTabPage, "Slice Settings Tab", TabTextSize,
				ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

			HorizontalLine lineSpacerZero = new HorizontalLine();
			lineSpacerZero.Margin = new BorderDouble(4, 10);
			this.TabBar.AddChild(lineSpacerZero);

			GuiWidget manualPrinterControls = new ManualControlsWidget();

#if __ANDROID__
            //Add the tab contents for 'Advanced Controls'
            string printerControlsLabel = LocalizedString.Get("Controls").ToUpper();
            manualControlsPage = new TabPage(manualPrinterControls, printerControlsLabel);
            this.AddTab(new SimpleTextTabWidget(manualControlsPage, "Controls Tab", TabTextSize,
				ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
#else
            ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);
            manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            manualPrinterControlsScrollArea.AnchorAll();
            manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

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

            this.AddTab(new SimpleTextTabWidget(manualControlsPage, "Controls Tab", TabTextSize,
				ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
#endif

			HorizontalLine lineSpacerOne = new HorizontalLine();
			lineSpacerOne.Margin = new BorderDouble(4, 10);
			this.TabBar.AddChild(lineSpacerOne);

			this.AddTab(queueTabWidget);

			LibraryTabPage = new TabPage(new PrintLibraryWidget(), LocalizedString.Get("Library").ToUpper());
			this.AddTab(new SimpleTextTabWidget(LibraryTabPage, "Library Tab", TabTextSize,
				ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

			HistoryTabPage = new TabPage(new PrintHistoryWidget(), LocalizedString.Get("History").ToUpper());
			SimpleTextTabWidget historyTabWidget = new SimpleTextTabWidget(HistoryTabPage, "History Tab", TabTextSize,
				ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());

			if (!simpleMode)
			{
				this.AddTab(historyTabWidget);
			}

			HorizontalLine lineSpacerTwo = new HorizontalLine();
			lineSpacerTwo.Margin = new BorderDouble(4, 10);
			this.TabBar.AddChild(lineSpacerTwo);

			string configurationLabel = LocalizedString.Get("Options").ToUpper();
			PrinterConfigurationScrollWidget printerConfigurationWidget = new PrinterConfigurationScrollWidget();

			// Make sure we have the right scroll position when we create this view
			// This is not working well enough. So, I disabled it until it can be fixed.
			// Specifically, it has the wronge position on the app restarting.
			if(false) 
			{
				UiThread.RunOnIdle(() => 
				{
					int scrollPosition = UserSettings.Instance.Fields.GetInt(CompactTabView_Options_ScrollPosition, -100000);
					if (scrollPosition != -100000)
					{
						printerConfigurationWidget.ScrollPosition = new Vector2(0, scrollPosition);
					}
				});

				printerConfigurationWidget.ScrollPositionChanged += (object sender, EventArgs e) =>
				{
					UserSettings.Instance.Fields.SetInt(CompactTabView_Options_ScrollPosition, (int)printerConfigurationWidget.ScrollPosition.y);
				};
			}

			optionsPage = new TabPage(printerConfigurationWidget, configurationLabel);
			this.AddTab(new SimpleTextTabWidget(optionsPage, "Options Tab", TabTextSize,
				ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

			TerminalTabPage = new TabPage(new TerminalWidget(false), LocalizedString.Get("Console").ToUpper());
			SimpleTextTabWidget terminalTabWidget = new SimpleTextTabWidget(TerminalTabPage, "Terminal Tab", TabTextSize,
													   ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());
			if (!simpleMode)
			{
				this.AddTab(terminalTabWidget);
			}

			AboutTabPage = new TabPage(new AboutWidget(), LocalizedString.Get("About").ToUpper());
			aboutTabWidget = new SimpleTextTabWidget(AboutTabPage, "About Tab", TabTextSize,
				ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());
			this.AddTab(aboutTabWidget);

			NumQueueItemsChanged(this, null);
			SetUpdateNotification(this, null);

			QueueData.Instance.ItemAdded.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);
			QueueData.Instance.ItemRemoved.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);

			ActiveSliceSettings.ActivePrinterChanged.RegisterEvent((s, e) => ApplicationController.Instance.ReloadAdvancedControlsPanel(), ref unregisterEvents);
			PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent((s, e) => UiThread.RunOnIdle(ReloadPartPreview, null, 1), ref unregisterEvents);
			ApplicationController.Instance.ReloadAdvancedControlsPanelTrigger.RegisterEvent((s, e) => UiThread.RunOnIdle(LoadAdvancedControls), ref unregisterEvents);
			UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents);

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

				TabBar.TabIndexChanged += (object sender, EventArgs e) =>
				{
					UserSettings.Instance.set(CompactTabView_CurrentTab, TabBar.SelectedTabName);
				};
			}
		}
        void AddChildElements()
        {
            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;            
            {
                GuiWidget indicator = new GuiWidget();
                indicator.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
                indicator.Width = 15;
                if (printTask.PrintComplete)
                {
                    indicator.BackgroundColor = new RGBA_Bytes(38, 147, 51, 180);
                }
                else
                {
                    indicator.BackgroundColor = new RGBA_Bytes(252, 209, 22, 180);
                }

                FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                middleColumn.Padding = new BorderDouble(6,3);
                {
                    FlowLayoutWidget labelContainer = new FlowLayoutWidget();
                    labelContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

                    string labelName = textInfo.ToTitleCase(printTask.PrintName);
                    labelName = labelName.Replace('_', ' ');
                    partLabel = new TextWidget(labelName, pointSize: 15);
                    partLabel.TextColor = WidgetTextColor;

                    labelContainer.AddChild(partLabel);


                    middleColumn.AddChild(labelContainer);
                }

                RGBA_Bytes timeTextColor = RGBA_Bytes.Gray;

                buttonContainer = new FlowLayoutWidget();
                buttonContainer.Margin = new BorderDouble(0);
                buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                {
                    TextWidget statusIndicator = new TextWidget("Status: Completed".Localize(), pointSize:8);
                    statusIndicator.Margin = new BorderDouble(right: 3);
                    //buttonContainer.AddChild(statusIndicator);

                    string printTimeLabel = "Time".Localize().ToUpper();
                    string printTimeLabelFull = string.Format("{0}: ", printTimeLabel);
                    TextWidget timeLabel = new TextWidget(printTimeLabelFull, pointSize: 8);
                    timeLabel.TextColor = timeTextColor;

                    TextWidget timeIndicator;
                    int minutes = printTask.PrintTimeMinutes;
                    if (minutes < 0)
                    {
                        timeIndicator = new TextWidget("Unknown".Localize());
                    }
                    else if (minutes > 60)
                    {
                        timeIndicator = new TextWidget("{0}hrs {1}min".FormatWith(printTask.PrintTimeMinutes / 60, printTask.PrintTimeMinutes % 60), pointSize: 12);
                    }
                    else
                    {
                        timeIndicator = new TextWidget(string.Format("{0}min", printTask.PrintTimeMinutes), pointSize: 12);
                    }
                    
                    timeIndicator.Margin = new BorderDouble(right: 6);
                    timeIndicator.TextColor = timeTextColor;

                    buttonContainer.AddChild(timeLabel);
                    buttonContainer.AddChild(timeIndicator);
                    
                    printAgainLink = linkButtonFactory.Generate("Reprint".Localize());
                    printAgainLink.Margin = new BorderDouble(left: 0, right: 0);
                    printAgainLink.VAnchor = VAnchor.ParentCenter;

                    printAgainLink.Click += (sender, e) =>
                    {
                        QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId));
                    };

                    buttonContainer.AddChild(new HorizontalSpacer());
                    buttonContainer.AddChild(printAgainLink);
                    middleColumn.AddChild(buttonContainer);
                }

                this.AddChild(indicator);
                this.AddChild(middleColumn);

                
                if (showTimestamp)
                {
                    FlowLayoutWidget rightColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                    rightColumn.BackgroundColor = RGBA_Bytes.LightGray;
                    rightColumn.Padding = new BorderDouble(6, 0);
                    
                    FlowLayoutWidget startTimeContainer = new FlowLayoutWidget();
                    startTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                    startTimeContainer.Padding = new BorderDouble(0, 3);

                    string startLabelFull = "{0}:".FormatWith("Start".Localize().ToUpper());
                    TextWidget startLabel = new TextWidget(startLabelFull, pointSize: 8);
                    startLabel.TextColor = timeTextColor;

                    string startTimeString = printTask.PrintStart.ToString("MMM d yyyy h:mm ") + printTask.PrintStart.ToString("tt").ToLower();
                    TextWidget startDate = new TextWidget(startTimeString, pointSize: 12);
                    startDate.TextColor = timeTextColor;

                    startTimeContainer.AddChild(startLabel);
                    startTimeContainer.AddChild(new HorizontalSpacer());
                    startTimeContainer.AddChild(startDate);


                    FlowLayoutWidget endTimeContainer = new FlowLayoutWidget();
                    endTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                    endTimeContainer.Padding = new BorderDouble(0, 3);

                    string endLabelFull = "{0}:".FormatWith("End".Localize().ToUpper());
                    TextWidget endLabel = new TextWidget(endLabelFull, pointSize: 8);
                    endLabel.TextColor = timeTextColor;

                    string endTimeString;
                    if (printTask.PrintEnd != DateTime.MinValue)
                    {
                        endTimeString = printTask.PrintEnd.ToString("MMM d yyyy h:mm ") + printTask.PrintEnd.ToString("tt").ToLower();
                    }
                    else
                    {
                        endTimeString = "Unknown".Localize();
                    }

                    TextWidget endDate = new TextWidget(endTimeString, pointSize: 12);
                    endDate.TextColor = timeTextColor;

                    endTimeContainer.AddChild(endLabel);
                    endTimeContainer.AddChild(new HorizontalSpacer());
                    endTimeContainer.AddChild(endDate);

                    HorizontalLine horizontalLine = new HorizontalLine();
                    horizontalLine.BackgroundColor = RGBA_Bytes.Gray;

                    rightColumn.AddChild(endTimeContainer);
                    rightColumn.AddChild(horizontalLine);
                    rightColumn.AddChild(startTimeContainer);

                    rightColumn.Width = 220;
                    this.AddChild(rightColumn);
                }
                
                
            }
        }
		private void LoadSettingsRows()
		{
			settingsRowContainer.RemoveScrollChildren();
			UiThread.RunOnIdle(() =>
			{
				foreach (KeyValuePair<String, DataStorage.SliceSetting> item in this.windowController.ActivePresetLayer.settingsDictionary)
				{
					OrganizerSettingsData settingData = SliceSettingsOrganizer.Instance.GetSettingsData(item.Key);

					// Dont add row if there is no entry
					if (settingData != null && ActivePrinterProfile.Instance.ActiveSliceEngine.MapContains(settingData.SlicerConfigName))
					{
						FlowLayoutWidget row = GetSettingsRow(settingData, item.Value.Value);
						row.Padding = new BorderDouble(3, 3, 3, 6);
						settingsRowContainer.AddChild(row);
						HorizontalLine horizontalLine = new HorizontalLine();
						horizontalLine.BackgroundColor = ActiveTheme.Instance.SecondaryTextColor;
						settingsRowContainer.AddChild(horizontalLine);
					}
				}
			});
		}
		private void AddChildElements()
		{
			GuiWidget mainContainer = new GuiWidget();
			mainContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			mainContainer.VAnchor = VAnchor.ParentBottomTop;

			TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
			{
				GuiWidget indicator = new GuiWidget();
				indicator.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
				indicator.Width = 15;
				if (printTask.PrintComplete)
				{
					indicator.BackgroundColor = new RGBA_Bytes(38, 147, 51, 180);
				}
				else
				{
					indicator.BackgroundColor = new RGBA_Bytes(252, 209, 22, 180);
				}

				FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
				middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
				middleColumn.Padding = new BorderDouble(6, 3);
				{
					FlowLayoutWidget labelContainer = new FlowLayoutWidget();
					labelContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

					string labelName = textInfo.ToTitleCase(printTask.PrintName);
					labelName = labelName.Replace('_', ' ');
					partLabel = new TextWidget(labelName, pointSize: 15 * pointSizeFactor);
					partLabel.TextColor = WidgetTextColor;

					labelContainer.AddChild(partLabel);

					middleColumn.AddChild(labelContainer);
				}

				RGBA_Bytes timeTextColor = new RGBA_Bytes(34, 34, 34);

				FlowLayoutWidget buttonContainer = new FlowLayoutWidget();
				buttonContainer.Margin = new BorderDouble(0);
				buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
				{
					TextWidget statusIndicator = new TextWidget("Status: Completed".Localize(), pointSize: 8 * pointSizeFactor);
					statusIndicator.Margin = new BorderDouble(right: 3);
					//buttonContainer.AddChild(statusIndicator);

					string printTimeLabel = "Time".Localize().ToUpper();
					string printTimeLabelFull = string.Format("{0}: ", printTimeLabel);
					TextWidget timeLabel = new TextWidget(printTimeLabelFull, pointSize: 8 * pointSizeFactor);
					timeLabel.TextColor = timeTextColor;

					TextWidget timeIndicator;
					int minutes = printTask.PrintTimeMinutes;
					if (minutes < 0)
					{
						timeIndicator = new TextWidget("Unknown".Localize());
					}
					else if (minutes > 60)
					{
						timeIndicator = new TextWidget("{0}hrs {1}min".FormatWith(printTask.PrintTimeMinutes / 60, printTask.PrintTimeMinutes % 60), pointSize: 12 * pointSizeFactor);
					}
					else
					{
						timeIndicator = new TextWidget(string.Format("{0}min", printTask.PrintTimeMinutes), pointSize: 12 * pointSizeFactor);
					}

					if (printTask.PercentDone > 0)
					{
						timeIndicator.AutoExpandBoundsToText = true;
						timeIndicator.Text += " ({0:0.0}%)".FormatWith(printTask.PercentDone);
					}

					timeIndicator.Margin = new BorderDouble(right: 6);
					timeIndicator.TextColor = timeTextColor;

					buttonContainer.AddChild(timeLabel);
					buttonContainer.AddChild(timeIndicator);
					buttonContainer.AddChild(new HorizontalSpacer());
					middleColumn.AddChild(buttonContainer);
				}

				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;

				primaryFlow.AddChild(indicator);
				primaryFlow.AddChild(middleColumn);

				primaryContainer.AddChild(primaryFlow);

				rightButtonOverlay = new SlideWidget();
				rightButtonOverlay.VAnchor = VAnchor.ParentBottomTop;
				rightButtonOverlay.HAnchor = Agg.UI.HAnchor.ParentRight;
				rightButtonOverlay.Width = rightOverlayWidth;
				rightButtonOverlay.Visible = false;

				FlowLayoutWidget rightMiddleColumnContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
				rightMiddleColumnContainer.VAnchor = VAnchor.ParentBottomTop;
				{
					TextWidget viewLabel = new TextWidget("View".Localize());
					viewLabel.TextColor = RGBA_Bytes.White;
					viewLabel.VAnchor = VAnchor.ParentCenter;
					viewLabel.HAnchor = HAnchor.ParentCenter;

					FatFlatClickWidget viewButton = new FatFlatClickWidget(viewLabel);
					viewButton.VAnchor = VAnchor.ParentBottomTop;
					viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
					viewButton.Width = actionButtonSize;
					viewButton.Click += ViewButton_Click;
					rightMiddleColumnContainer.AddChild(viewButton);

					TextWidget printLabel = new TextWidget("Print".Localize());
					printLabel.TextColor = RGBA_Bytes.White;
					printLabel.VAnchor = VAnchor.ParentCenter;
					printLabel.HAnchor = HAnchor.ParentCenter;

					FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel);
					printButton.VAnchor = VAnchor.ParentBottomTop;
					printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
					printButton.Width = actionButtonSize;
					printButton.Click += (sender, e) =>
					{
						UiThread.RunOnIdle(() =>
						{
							if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive)
							{
								QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId), 0);
								QueueData.Instance.SelectedIndex = 0;
								PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible();
							}
							else
							{
								QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId));
							}
							rightButtonOverlay.SlideOut();
						});
					};
					rightMiddleColumnContainer.AddChild(printButton);
				}
				rightButtonOverlay.AddChild(rightMiddleColumnContainer);

				if (showTimestamp)
				{
					FlowLayoutWidget timestampColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
					timestampColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
					timestampColumn.BackgroundColor = RGBA_Bytes.LightGray;
					timestampColumn.Padding = new BorderDouble(6, 0);

					FlowLayoutWidget startTimeContainer = new FlowLayoutWidget();
					startTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
					startTimeContainer.Padding = new BorderDouble(0, 3);

					string startLabelFull = "{0}:".FormatWith("Start".Localize().ToUpper());
					TextWidget startLabel = new TextWidget(startLabelFull, pointSize: 8 * pointSizeFactor);
					startLabel.TextColor = timeTextColor;

					string startTimeString = printTask.PrintStart.ToString("MMM d yyyy h:mm ") + printTask.PrintStart.ToString("tt").ToLower();
					TextWidget startDate = new TextWidget(startTimeString, pointSize: 12 * pointSizeFactor);
					startDate.TextColor = timeTextColor;

					startTimeContainer.AddChild(startLabel);
					startTimeContainer.AddChild(new HorizontalSpacer());
					startTimeContainer.AddChild(startDate);

					FlowLayoutWidget endTimeContainer = new FlowLayoutWidget();
					endTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
					endTimeContainer.Padding = new BorderDouble(0, 3);

					string endLabelFull = "{0}:".FormatWith("End".Localize().ToUpper());
					TextWidget endLabel = new TextWidget(endLabelFull, pointSize: 8 * pointSizeFactor);
					endLabel.TextColor = timeTextColor;

					string endTimeString;
					if (printTask.PrintEnd != DateTime.MinValue)
					{
						endTimeString = printTask.PrintEnd.ToString("MMM d yyyy h:mm ") + printTask.PrintEnd.ToString("tt").ToLower();
					}
					else
					{
						endTimeString = "Unknown".Localize();
					}

					TextWidget endDate = new TextWidget(endTimeString, pointSize: 12 * pointSizeFactor);
					endDate.TextColor = timeTextColor;

					endTimeContainer.AddChild(endLabel);
					endTimeContainer.AddChild(new HorizontalSpacer());
					endTimeContainer.AddChild(endDate);

					HorizontalLine horizontalLine = new HorizontalLine();
					horizontalLine.BackgroundColor = RGBA_Bytes.Gray;

					timestampColumn.AddChild(endTimeContainer);
					timestampColumn.AddChild(horizontalLine);
					timestampColumn.AddChild(startTimeContainer);

					timestampColumn.HAnchor = HAnchor.ParentLeftRight;
					timestampColumn.Padding = new BorderDouble(5, 0, 15, 0);

					primaryFlow.AddChild(timestampColumn);
				}

				mainContainer.AddChild(primaryContainer);
				mainContainer.AddChild(rightButtonOverlay);

				this.AddChild(mainContainer);
			}
		}
		protected override void AddChildElements()
		{
			AltGroupBox adjustmentControlsGroupBox = new AltGroupBox(new TextWidget("Tuning Adjustment".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor));
			adjustmentControlsGroupBox.Margin = new BorderDouble(0);
			adjustmentControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
			adjustmentControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

			{
				FlowLayoutWidget tuningRatiosLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
				tuningRatiosLayout.Margin = new BorderDouble(0, 0, 0, 0) * TextWidget.GlobalPointSizeScaleRatio;
				tuningRatiosLayout.HAnchor = HAnchor.ParentLeftRight;
				tuningRatiosLayout.Padding = new BorderDouble(3, 0, 3, 0) * TextWidget.GlobalPointSizeScaleRatio;

				double sliderWidth = 300;
				double sliderThumbWidth = 10;
				if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen)
				{
					sliderWidth = 280;
					sliderThumbWidth = 20;
				}

				TextWidget subheader = new TextWidget("Fine-tune adjustment while actively printing", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor);
				subheader.Margin = new BorderDouble(bottom: 6);
				tuningRatiosLayout.AddChild(subheader);
				TextWidget feedRateDescription;
				{
					FlowLayoutWidget feedRateLeftToRight;
					{
						feedRateValue = new NumberEdit(0, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40 * TextWidget.GlobalPointSizeScaleRatio);
						feedRateValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.FeedRateRatio * 100 + .5)) / 100.0;

						feedRateLeftToRight = new FlowLayoutWidget();
						feedRateLeftToRight.HAnchor = HAnchor.ParentLeftRight;

						feedRateDescription = new TextWidget(LocalizedString.Get("Speed Multiplier"));
						feedRateDescription.MinimumSize = new Vector2(140, 0) * TextWidget.GlobalPointSizeScaleRatio;
						feedRateDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor;
						feedRateDescription.VAnchor = VAnchor.ParentCenter;
						feedRateLeftToRight.AddChild(feedRateDescription);
						feedRateRatioSlider = new SolidSlider(new Vector2(), sliderThumbWidth, minFeedRateRatio, maxFeedRateRatio);
						feedRateRatioSlider.Margin = new BorderDouble(5, 0);
						feedRateRatioSlider.Value = PrinterConnectionAndCommunication.Instance.FeedRateRatio;
						feedRateRatioSlider.TotalWidthInPixels = sliderWidth;
						feedRateRatioSlider.View.BackgroundColor = new RGBA_Bytes();
						feedRateRatioSlider.ValueChanged += (sender, e) =>
						{
							PrinterConnectionAndCommunication.Instance.FeedRateRatio = feedRateRatioSlider.Value;
						};
						PrinterConnectionAndCommunication.Instance.FeedRateRatioChanged.RegisterEvent(FeedRateRatioChanged_Event, ref unregisterEvents);
						feedRateValue.EditComplete += (sender, e) =>
						{
							feedRateRatioSlider.Value = feedRateValue.Value;
						};
						feedRateLeftToRight.AddChild(feedRateRatioSlider);
						tuningRatiosLayout.AddChild(feedRateLeftToRight);

						feedRateLeftToRight.AddChild(feedRateValue);
						feedRateValue.Margin = new BorderDouble(0, 0, 5, 0);
						feedRateValue.VAnchor = VAnchor.ParentCenter;
						textImageButtonFactory.FixedHeight = (int)feedRateValue.Height + 1;
						textImageButtonFactory.borderWidth = 1;
						textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);
						textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);

						Button setFeedRateButton = textImageButtonFactory.Generate(LocalizedString.Get("Set"));
						setFeedRateButton.VAnchor = VAnchor.ParentCenter;

						feedRateLeftToRight.AddChild(setFeedRateButton);
					}

					TextWidget extrusionDescription;
					{
						extrusionValue = new NumberEdit(0, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40 * TextWidget.GlobalPointSizeScaleRatio);
						extrusionValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.ExtrusionRatio * 100 + .5)) / 100.0;

						FlowLayoutWidget leftToRight = new FlowLayoutWidget();
						leftToRight.HAnchor = HAnchor.ParentLeftRight;
						leftToRight.Margin = new BorderDouble(top: 10) * TextWidget.GlobalPointSizeScaleRatio;

						extrusionDescription = new TextWidget(LocalizedString.Get("Extrusion Multiplier"));
						extrusionDescription.MinimumSize = new Vector2(140, 0) * TextWidget.GlobalPointSizeScaleRatio;
						extrusionDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor;
						extrusionDescription.VAnchor = VAnchor.ParentCenter;
						leftToRight.AddChild(extrusionDescription);
						extrusionRatioSlider = new SolidSlider(new Vector2(), sliderThumbWidth, minExtrutionRatio, maxExtrusionRatio, Orientation.Horizontal);
						extrusionRatioSlider.TotalWidthInPixels = sliderWidth;
						extrusionRatioSlider.Margin = new BorderDouble(5, 0);
						extrusionRatioSlider.Value = PrinterConnectionAndCommunication.Instance.ExtrusionRatio;
						extrusionRatioSlider.View.BackgroundColor = new RGBA_Bytes();
						extrusionRatioSlider.ValueChanged += (sender, e) =>
						{
							PrinterConnectionAndCommunication.Instance.ExtrusionRatio = extrusionRatioSlider.Value;
						};
						PrinterConnectionAndCommunication.Instance.ExtrusionRatioChanged.RegisterEvent(ExtrusionRatioChanged_Event, ref unregisterEvents);
						extrusionValue.EditComplete += (sender, e) =>
						{
							extrusionRatioSlider.Value = extrusionValue.Value;
						};
						leftToRight.AddChild(extrusionRatioSlider);
						tuningRatiosLayout.AddChild(leftToRight);
						leftToRight.AddChild(extrusionValue);
						extrusionValue.Margin = new BorderDouble(0, 0, 5, 0);
						extrusionValue.VAnchor = VAnchor.ParentCenter;
						textImageButtonFactory.FixedHeight = (int)extrusionValue.Height + 1;
						Button setExtrusionButton = textImageButtonFactory.Generate(LocalizedString.Get("Set"));
						setExtrusionButton.VAnchor = VAnchor.ParentCenter;
						leftToRight.AddChild(setExtrusionButton);
					}
					feedRateLeftToRight.VAnchor = VAnchor.FitToChildren;
				}

				adjustmentControlsGroupBox.AddChild(tuningRatiosLayout);

				if (false)
				{
					HorizontalLine line = new HorizontalLine();
					line.Margin = new BorderDouble(0, 10);
					tuningRatiosLayout.AddChild(line);
					TextWidget subheader2 = new TextWidget("Fine-tune z-height, while actively printing", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor);
					subheader2.Margin = new BorderDouble(bottom: 6);
					tuningRatiosLayout.AddChild(subheader2);

					ImageBuffer togetherBig;
					ImageBuffer appartBig;

					CreateButtonImages(out togetherBig, out appartBig);

					textImageButtonFactory.FixedHeight = 0;
					Button togetherALot = textImageButtonFactory.GenerateFromImages("", togetherBig);
					Button appartALot = textImageButtonFactory.GenerateFromImages("", appartBig);

					FlowLayoutWidget leftToRigth = new FlowLayoutWidget();
					leftToRigth.AddChild(togetherALot);
					leftToRigth.AddChild(appartALot);

					tuningRatiosLayout.AddChild(leftToRigth);
				}
			}

			this.AddChild(adjustmentControlsGroupBox);
		}
        void LoadSettingsRows()
        {
            settingsRowContainer.RemoveScrollChildren();
            UiThread.RunOnIdle((state) =>
            {
                foreach (KeyValuePair<String, DataStorage.SliceSetting> item in this.windowController.ActivePresetLayer.settingsDictionary)
                {
                    OrganizerSettingsData settingData = SliceSettingsOrganizer.Instance.GetSettingsData(item.Key);
                    FlowLayoutWidget row = GetSettingsRow(settingData, item.Value.Value);
                    row.Padding = new BorderDouble(3, 3, 3, 6);

                    settingsRowContainer.AddChild(row);
                    HorizontalLine horizontalLine = new HorizontalLine();
                    horizontalLine.BackgroundColor = ActiveTheme.Instance.SecondaryTextColor;
                    settingsRowContainer.AddChild(horizontalLine);
                }
            });
        }