private TabControl CreateExtraSettingsSideTabsAndPages(int minSettingNameWidth, TabControl categoryTabs, out int count)
        {
            count = 0;
            TabControl sideTabs = new TabControl(Orientation.Vertical);

            sideTabs.Margin             = new BorderDouble(0, 0, 0, 5);
            sideTabs.TabBar.BorderColor = RGBA_Bytes.White;
            {
                TabPage             groupTabPage   = new TabPage("Extra Settings");
                SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, 14,
                                                                             ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                sideTabs.AddTab(groupTabWidget);

                FlowLayoutWidget subGroupLayoutTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
                subGroupLayoutTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
                subGroupLayoutTopToBottom.VAnchor = VAnchor.FitToChildren;

                FlowLayoutWidget topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom);
                topToBottomSettings.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;

                foreach (KeyValuePair <string, DataStorage.SliceSetting> item in ActiveSliceSettings.Instance.DefaultSettings)
                {
                    if (!SliceSettingsOrganizer.Instance.Contains(UserLevel, item.Key))
                    {
                        OrganizerSettingsData settingInfo            = new OrganizerSettingsData(item.Key, item.Key, OrganizerSettingsData.DataEditTypes.STRING);
                        GuiWidget             controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, minSettingNameWidth);
                        topToBottomSettings.AddChild(controlsForThisSetting);
                        count++;
                    }
                }

                GroupBox groupBox = new GroupBox(LocalizedString.Get("Extra"));
                groupBox.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
                groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
                groupBox.AddChild(topToBottomSettings);
                groupBox.VAnchor = VAnchor.FitToChildren;
                groupBox.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;

                subGroupLayoutTopToBottom.AddChild(groupBox);

                SliceSettingListControl scrollOnGroupTab = new SliceSettingListControl();
                scrollOnGroupTab.AnchorAll();
                scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom);
                groupTabPage.AddChild(scrollOnGroupTab);
            }
            return(sideTabs);
        }
        public FirstPanelTabView(QueueDataView queueDataView)
        {
            this.queueDataView          = queueDataView;
            this.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            this.TabBar.BorderColor     = new RGBA_Bytes(0, 0, 0, 0);
            this.TabBar.Margin          = new BorderDouble(0, 0);
            this.TabBar.Padding         = new BorderDouble(0, 2);

            this.Margin = new BorderDouble(top: 4);

            QueueTabPage = new TabPage(new QueueDataWidget(queueDataView), LocalizedString.Get("Queue").ToUpper());
            this.AddTab(new SimpleTextTabWidget(QueueTabPage, "Queue Tab", 15,
                                                ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

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

            HistoryTabPage = new TabPage(new PrintHistoryWidget(), LocalizedString.Get("History").ToUpper());
            this.AddTab(new SimpleTextTabWidget(HistoryTabPage, "History Tab", 15,
                                                ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            AboutTabPage = new TabPage(new AboutPage(), LocalizedString.Get("About").ToUpper());
            AboutTabView = new SimpleTextTabWidget(AboutTabPage, "About Tab", 15,
                                                   ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());
            this.AddTab(AboutTabView);

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

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

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

            SelectedTabIndex = firstPanelCurrentTab;
        }
Beispiel #3
0
        public TouchscreenTabView(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) =>
            {
                // ReloadPartPreview
                UiThread.RunOnIdle(() =>
                {
                    partPreviewContainer.Reload(PrinterConnectionAndCommunication.Instance.ActivePrintItem);
                }, 1);
            }, ref unregisterEvents);

            ApplicationController.Instance.AdvancedControlsPanelReloading.RegisterEvent((s, e) => UiThread.RunOnIdle(ReloadAdvancedControls), 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) =>
                {
                    string selectedTabName = TabBar.SelectedTabName;
                    if (!string.IsNullOrEmpty(selectedTabName))
                    {
                        UserSettings.Instance.set(CompactTabView_CurrentTab, selectedTabName);
                    }
                };
            }
        }
Beispiel #4
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(0, 0);
            this.TabBar.Padding         = new BorderDouble(0, 4);

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

            ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(LoadSettingsOnPrinterChanged, ref unregisterEvents);
            PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
            ApplicationController.Instance.ReloadAdvancedControlsPanelTrigger.RegisterEvent(ReloadAdvancedControlsPanelTrigger, ref unregisterEvents);

            PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);

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

            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());
            this.AddTab(new SimpleTextTabWidget(HistoryTabPage, "History Tab", TabTextSize,
                                                ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));


            GuiWidget manualPrinterControls = new ManualPrinterControls();

            part3DViewContainer = new GuiWidget();
            part3DViewContainer.AnchorAll();

            partGcodeViewContainer = new GuiWidget();
            partGcodeViewContainer.AnchorAll();

            GeneratePartViews();

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

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

            string layerPreviewLabel = LocalizedString.Get("Layer Preview").ToUpper();

            this.AddTab(new SimpleTextTabWidget(new TabPage(partGcodeViewContainer, layerPreviewLabel), "Layer Preview Tab", TabTextSize,
                                                ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            //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()));

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

            sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
            sliceTabPage        = new TabPage(sliceSettingsWidget, sliceSettingsLabel);

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

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

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

            AboutTabPage   = new TabPage(new AboutPage(), 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);
            UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents);

            //WidescreenPanel.PreChangePanels.RegisterEvent(SaveCurrentTab, ref unregisterEvents);

            SelectedTabIndex = firstPanelCurrentTab;
        }
        private void Load(PrintItemWrapper printItem)
        {
            tabControl = new TabControl();
            tabControl.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0);

            tabControl.TabBar.Padding = new BorderDouble(top: 6);

            RGBA_Bytes selectedTabColor;

            if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Responsive)
            {
                tabControl.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
                selectedTabColor = ActiveTheme.Instance.TabLabelSelected;
            }
            else
            {
                tabControl.TabBar.BackgroundColor = ActiveTheme.Instance.TransparentLightOverlay;
                selectedTabColor = ActiveTheme.Instance.SecondaryAccentColor;
            }

            double buildHeight = ActiveSliceSettings.Instance.BuildHeight;

            // put in the 3D view
            string part3DViewLabelFull = string.Format("{0} {1} ", "3D", "View".Localize()).ToUpper();

            partPreviewView = new View3DWidget(printItem,
                                               new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),
                                               ActiveSliceSettings.Instance.BedCenter,
                                               ActiveSliceSettings.Instance.BedShape,
                                               windowMode,
                                               autoRotate3DView,
                                               openMode);

            TabPage partPreview3DView = new TabPage(partPreviewView, part3DViewLabelFull);

            // put in the gcode view
            ViewGcodeBasic.WindowMode gcodeWindowMode = ViewGcodeBasic.WindowMode.Embeded;
            if (windowMode == View3DWidget.WindowMode.StandAlone)
            {
                gcodeWindowMode = ViewGcodeBasic.WindowMode.StandAlone;
            }

            viewGcodeBasic = new ViewGcodeBasic(printItem,
                                                new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),
                                                ActiveSliceSettings.Instance.BedCenter,
                                                ActiveSliceSettings.Instance.BedShape, gcodeWindowMode);

            if (windowMode == View3DWidget.WindowMode.StandAlone)
            {
                partPreviewView.Closed += (sender, e) =>
                {
                    Close();
                };
                viewGcodeBasic.Closed += (sender, e) =>
                {
                    Close();
                };
            }

            layerView = new TabPage(viewGcodeBasic, LocalizedString.Get("Layer View").ToUpper());

            int tabPointSize = 16;
            // add the correct tabs based on wether we are stand alone or embeded
            Tab threeDViewTab;
            Tab layerViewTab;

            if (windowMode == View3DWidget.WindowMode.StandAlone || OsInformation.OperatingSystem == OSType.Android)
            {
                threeDViewTab = new SimpleTextTabWidget(partPreview3DView, "3D View Tab", tabPointSize,
                                                        selectedTabColor, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                tabControl.AddTab(threeDViewTab);
                layerViewTab = new SimpleTextTabWidget(layerView, "Layer View Tab", tabPointSize,
                                                       selectedTabColor, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                tabControl.AddTab(layerViewTab);
            }
            else
            {
                threeDViewTab = new PopOutTextTabWidget(partPreview3DView, "3D View Tab", new Vector2(590, 400), tabPointSize);
                tabControl.AddTab(threeDViewTab);
                layerViewTab = new PopOutTextTabWidget(layerView, "Layer View Tab", new Vector2(590, 400), tabPointSize);
                tabControl.AddTab(layerViewTab);
            }

            threeDViewTab.ToolTipText = "Preview 3D Design".Localize();
            layerViewTab.ToolTipText  = "Preview layer Tool Paths".Localize();

            this.AddChild(tabControl);
        }
        public SliceSettingsWidget(UiState uiState)
        {
            int minSettingNameWidth = 220;

            buttonFactory.FixedHeight     = 20;
            buttonFactory.fontSize        = 10;
            buttonFactory.normalFillColor = RGBA_Bytes.White;
            buttonFactory.normalTextColor = RGBA_Bytes.DarkGray;

            showHelpBox         = new CheckBox(0, 0, LocalizedString.Get("Show Help"), textSize: 10);
            showHelpBox.Checked = UserSettings.Instance.get(SliceSettingsShowHelpEntry) == "true";

            showAllDetails         = new CheckBox(0, 0, LocalizedString.Get("Show All Settings"), textSize: 10);
            showAllDetails.Checked = UserSettings.Instance.get(SliceSettingsLevelEntry) == "Advanced";

            FlowLayoutWidget pageTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom, vAnchor: Agg.UI.VAnchor.ParentTop);

            pageTopToBottomLayout.AnchorAll();
            pageTopToBottomLayout.Padding = new BorderDouble(3, 0);
            this.AddChild(pageTopToBottomLayout);

            settingsControlBar = new SettingsControlBar();
            pageTopToBottomLayout.AddChild(settingsControlBar);

            noConnectionMessageContainer             = new GroupBox(LocalizedString.Get("No Printer Selected"));
            noConnectionMessageContainer.Margin      = new BorderDouble(top: 10);
            noConnectionMessageContainer.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
            noConnectionMessageContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
            noConnectionMessageContainer.HAnchor     = Agg.UI.HAnchor.ParentLeftRight;
            noConnectionMessageContainer.Height      = 80;

            TextWidget noConnectionMessage = new TextWidget(LocalizedString.Get("No printer is currently selected. Select printer to edit slice settings."));

            noConnectionMessage.Margin    = new BorderDouble(5);
            noConnectionMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            noConnectionMessage.VAnchor   = VAnchor.ParentCenter;

            noConnectionMessageContainer.AddChild(noConnectionMessage);
            pageTopToBottomLayout.AddChild(noConnectionMessageContainer);

            categoryTabs = new TabControl();
            categoryTabs.TabBar.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
            categoryTabs.Margin             = new BorderDouble(top: 8);
            categoryTabs.AnchorAll();
            List <TabBar> sideTabBarsListForLayout = new List <TabBar>();

            for (int categoryIndex = 0; categoryIndex < SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList.Count; categoryIndex++)
            {
                OrganizerCategory   category          = SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList[categoryIndex];
                string              categoryPageLabel = LocalizedString.Get(category.Name);
                TabPage             categoryPage      = new TabPage(categoryPageLabel);
                SimpleTextTabWidget textTabWidget     = new SimpleTextTabWidget(categoryPage, 16,
                                                                                ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                categoryPage.AnchorAll();
                categoryTabs.AddTab(textTabWidget);

                TabControl sideTabs = CreateSideTabsAndPages(minSettingNameWidth, category, uiState);
                sideTabBarsListForLayout.Add(sideTabs.TabBar);

                categoryPage.AddChild(sideTabs);
            }

            if (showAllDetails.Checked && ActivePrinterProfile.Instance.ActiveSliceEngineType == ActivePrinterProfile.SlicingEngineTypes.Slic3r)
            {
                TabPage             extraSettingsPage          = new TabPage("Other");
                SimpleTextTabWidget extraSettingsTextTabWidget = new SimpleTextTabWidget(extraSettingsPage, 16,
                                                                                         ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                extraSettingsPage.AnchorAll();
                int        count;
                TabControl extraSettingsSideTabs = CreateExtraSettingsSideTabsAndPages(minSettingNameWidth, categoryTabs, out count);
                if (count > 0)
                {
                    categoryTabs.AddTab(extraSettingsTextTabWidget);
                    sideTabBarsListForLayout.Add(extraSettingsSideTabs.TabBar);
                    extraSettingsPage.AddChild(extraSettingsSideTabs);
                }
            }

            double sideTabBarsMinimumWidth = 0;

            foreach (TabBar tabBar in sideTabBarsListForLayout)
            {
                sideTabBarsMinimumWidth = Math.Max(sideTabBarsMinimumWidth, tabBar.Width);
            }
            foreach (TabBar tabBar in sideTabBarsListForLayout)
            {
                tabBar.MinimumSize = new Vector2(sideTabBarsMinimumWidth, tabBar.MinimumSize.y);
            }

            // space before checkboxes (hold the right aligned)
            {
                GuiWidget hSpacer = new GuiWidget();
                hSpacer.HAnchor = HAnchor.ParentLeftRight;

                categoryTabs.TabBar.AddChild(hSpacer);
            }

            // add in the ability to turn on and off all details settings
            {
                showAllDetails.TextColor            = ActiveTheme.Instance.PrimaryTextColor;
                showAllDetails.Margin               = new BorderDouble(right: 8);
                showAllDetails.VAnchor              = VAnchor.ParentCenter;
                showAllDetails.Cursor               = Cursors.Hand;
                showAllDetails.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(RebuildSlicerSettings);

                categoryTabs.TabBar.AddChild(showAllDetails);
            }

            // add in the ability to turn on and off help text
            {
                showHelpBox.TextColor            = ActiveTheme.Instance.PrimaryTextColor;
                showHelpBox.Margin               = new BorderDouble(right: 3);
                showHelpBox.VAnchor              = VAnchor.ParentCenter;
                showHelpBox.Cursor               = Cursors.Hand;
                showHelpBox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(RebuildSlicerSettings);

                categoryTabs.TabBar.AddChild(showHelpBox);
            }

            pageTopToBottomLayout.AddChild(categoryTabs);
            AddHandlers();
            SetVisibleControls();

            if (!categoryTabs.SelectTab(uiState.selectedCategory.name))
            {
                categoryTabs.SelectTab(uiState.selectedCategory.index);
            }
        }
        private TabControl CreateSideTabsAndPages(int minSettingNameWidth, OrganizerCategory category, UiState uiState)
        {
            TabControl groupTabs = new TabControl(Orientation.Vertical);

            groupTabs.Margin             = new BorderDouble(0, 0, 0, 5);
            groupTabs.TabBar.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
            foreach (OrganizerGroup group in category.GroupsList)
            {
                tabIndexForItem = 0;
                string  groupTabLabel = LocalizedString.Get(group.Name);
                TabPage groupTabPage  = new TabPage(groupTabLabel);
                groupTabPage.HAnchor = HAnchor.ParentLeftRight;

                SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, 14,
                                                                             ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                groupTabWidget.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

                FlowLayoutWidget subGroupLayoutTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
                subGroupLayoutTopToBottom.AnchorAll();

                bool needToAddSubGroup = false;
                foreach (OrganizerSubGroup subGroup in group.SubGroupsList)
                {
                    bool             addedSettingToSubGroup = false;
                    FlowLayoutWidget topToBottomSettings    = new FlowLayoutWidget(FlowDirection.TopToBottom);
                    topToBottomSettings.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

                    foreach (OrganizerSettingsData settingInfo in subGroup.SettingDataList)
                    {
                        if (ActivePrinterProfile.Instance.ActiveSliceEngine.MapContains(settingInfo.SlicerConfigName))
                        {
                            addedSettingToSubGroup = true;
                            GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, minSettingNameWidth);
                            topToBottomSettings.AddChild(controlsForThisSetting);

                            if (showHelpBox.Checked)
                            {
                                AddInHelpText(topToBottomSettings, settingInfo);
                            }
                        }
                    }

                    if (addedSettingToSubGroup)
                    {
                        needToAddSubGroup = true;
                        string   groupBoxLabel = LocalizedString.Get(subGroup.Name);
                        GroupBox groupBox      = new GroupBox(groupBoxLabel);
                        groupBox.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
                        groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
                        groupBox.AddChild(topToBottomSettings);
                        groupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

                        subGroupLayoutTopToBottom.AddChild(groupBox);
                    }
                }

                if (needToAddSubGroup)
                {
                    SliceSettingListControl scrollOnGroupTab = new SliceSettingListControl();

                    subGroupLayoutTopToBottom.VAnchor = VAnchor.FitToChildren;
                    subGroupLayoutTopToBottom.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

                    //subGroupLayoutTopToBottom.DebugShowBounds = true;
                    //scrollOnGroupTab.DebugShowBounds = true;
                    scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom);
                    groupTabPage.AddChild(scrollOnGroupTab);
                    groupTabs.AddTab(groupTabWidget);
                }
            }

            if (!groupTabs.SelectTab(uiState.selectedGroup.name))
            {
                groupTabs.SelectTab(uiState.selectedGroup.index);
            }
            return(groupTabs);
        }
        private void Load(PrintItemWrapper printItem)
        {
            tabControl = new TabControl();
            tabControl.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0);

            tabControl.TabBar.Padding = new BorderDouble(top: 6);

            RGBA_Bytes selectedTabColor;

            if (UserSettings.Instance.DisplayMode == ApplicationDisplayType.Responsive)
            {
                tabControl.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
                selectedTabColor = ActiveTheme.Instance.TabLabelSelected;
            }
            else
            {
                tabControl.TabBar.BackgroundColor = ActiveTheme.Instance.TransparentLightOverlay;
                selectedTabColor = ActiveTheme.Instance.SecondaryAccentColor;
            }

            double buildHeight = ActiveSliceSettings.Instance.GetValue <double>(SettingsKey.build_height);

            // put in the 3D view
            partPreviewView = new View3DWidget(printItem,
                                               new Vector3(ActiveSliceSettings.Instance.GetValue <Vector2>(SettingsKey.bed_size), buildHeight),
                                               ActiveSliceSettings.Instance.GetValue <Vector2>(SettingsKey.print_center),
                                               ActiveSliceSettings.Instance.GetValue <BedShape>(SettingsKey.bed_shape),
                                               windowMode,
                                               autoRotate3DView,
                                               openMode);

            TabPage partPreview3DView = new TabPage(partPreviewView, string.Format("3D {0} ", "View".Localize()).ToUpper());

            // put in the gcode view
            ViewGcodeBasic.WindowMode gcodeWindowMode = ViewGcodeBasic.WindowMode.Embeded;
            if (windowMode == View3DWidget.WindowMode.StandAlone)
            {
                gcodeWindowMode = ViewGcodeBasic.WindowMode.StandAlone;
            }

            viewGcodeBasic = new ViewGcodeBasic(printItem,
                                                new Vector3(ActiveSliceSettings.Instance.GetValue <Vector2>(SettingsKey.bed_size), buildHeight),
                                                ActiveSliceSettings.Instance.GetValue <Vector2>(SettingsKey.print_center),
                                                ActiveSliceSettings.Instance.GetValue <BedShape>(SettingsKey.bed_shape), gcodeWindowMode);

            if (windowMode == View3DWidget.WindowMode.StandAlone)
            {
                partPreviewView.Closed += (s, e) => Close();
                viewGcodeBasic.Closed  += (s, e) => Close();
            }

            TabPage layerView = new TabPage(viewGcodeBasic, "Layer View".Localize().ToUpper());

            int tabPointSize = 16;
            // add the correct tabs based on whether we are stand alone or embedded
            Tab threeDViewTab;

            if (windowMode == View3DWidget.WindowMode.StandAlone || UserSettings.Instance.IsTouchScreen)
            {
                threeDViewTab = new SimpleTextTabWidget(partPreview3DView, "3D View Tab", tabPointSize,
                                                        selectedTabColor, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                tabControl.AddTab(threeDViewTab);
                layerViewTab = new SimpleTextTabWidget(layerView, "Layer View Tab", tabPointSize,
                                                       selectedTabColor, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                tabControl.AddTab(layerViewTab);
            }
            else
            {
                threeDViewTab = new PopOutTextTabWidget(partPreview3DView, "3D View Tab", new Vector2(590, 400), tabPointSize);
                tabControl.AddTab(threeDViewTab);
                layerViewTab = new PopOutTextTabWidget(layerView, "Layer View Tab", new Vector2(590, 400), tabPointSize);
                tabControl.AddTab(layerViewTab);
            }

            threeDViewTab.ToolTipText = "Preview 3D Design".Localize();
            layerViewTab.ToolTipText  = "Preview layer Tool Paths".Localize();

            this.AddChild(tabControl);
        }
        public WidescreenPanel()
            : base()
        {
            PrinterCommunication.Instance.ActivePrinterChanged.RegisterEvent(LoadSettingsOnPrinterChanged, ref unregisterEvents);

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

                // construct the main controls tab control
                mainControlsTabControl = new TabControl();
                mainControlsTabControl.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
                mainControlsTabControl.TabBar.BorderColor     = new RGBA_Bytes(0, 0, 0, 0);
                mainControlsTabControl.TabBar.Margin          = new BorderDouble(0, 0);
                mainControlsTabControl.TabBar.Padding         = new BorderDouble(0, 2);

                QueueTabPage = new TabPage(new QueueControlsWidget(), "Queue");
                NumQueueItemsChanged(this, null);

                mainControlsTabControl.AddTab(new SimpleTextTabWidget(QueueTabPage, 18,
                                                                      ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
                //mainControlsTabControl.AddTab(new SimpleTextTabWidget(new TabPage(new GuiWidget(), "History"), 18,
                //        ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
                mainControlsTabControl.AddTab(new SimpleTextTabWidget(new TabPage(new PrintLibraryWidget(), "Library"), 18,
                                                                      ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

                AboutTabPage = new TabPage(new AboutPage(), "About");
                aboutTabView = new SimpleTextTabWidget(AboutTabPage, 18,
                                                       ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());
                mainControlsTabControl.AddTab(aboutTabView);


                advancedControlsButtonFactory.normalTextColor  = RGBA_Bytes.White;
                advancedControlsButtonFactory.hoverTextColor   = RGBA_Bytes.White;
                advancedControlsButtonFactory.pressedTextColor = RGBA_Bytes.White;
                advancedControlsButtonFactory.fontSize         = 10;

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

                advancedControlsButtonFactory.invertImageLocation = true;
                Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate("Advanced\nControls", "icon_arrow_right_32x32.png");
                advancedControlsLinkButton.Margin            = new BorderDouble(right: 3);
                advancedControlsLinkButton.VAnchor           = VAnchor.ParentBottom;
                advancedControlsLinkButton.Cursor            = Cursors.Hand;
                advancedControlsLinkButton.Click            += new ButtonBase.ButtonEventHandler(AdvancedControlsButton_Click);
                advancedControlsLinkButton.MouseEnterBounds += new EventHandler(onMouseEnterBoundsAdvancedControlsLink);
                advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsAdvancedControlsLink);

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

                mainControlsTabControl.TabBar.AddChild(hSpacer);
                //mainControlsTabControl.TabBar.AddChild(advancedControlsLinkButton);
                // and add it
                this.Panel1.AddChild(mainControlsTabControl);

                SetUpdateNotification(this, null);
            }

            // do the back panel
            {
                advancedControlsTabControl = CreateNewAdvancedControlsTab(new SliceSettingsWidget.UiState());
                this.Panel2.AddChild(advancedControlsTabControl);
                //this.Panel2.AddChild(new PrintProgressBar());
            }



            AddHandlers();
        }