TabControl CreateNewAdvancedControlsTab(SliceSettingsWidget.UiState sliceSettingsUiState)
        {
            advancedControls = new TabControl();
            advancedControls.BackgroundColor    = ActiveTheme.Instance.PrimaryAccentColor;
            advancedControls.TabBar.BorderColor = RGBA_Bytes.White;
            advancedControls.TabBar.Margin      = new BorderDouble(0, 0);
            advancedControls.TabBar.Padding     = new BorderDouble(0, 2);

            advancedControlsButtonFactory.invertImageLocation = false;
            Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate("Print\nQueue", "icon_arrow_left_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(onMouseEnterBoundsPrintQueueLink);
            advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsPrintQueueLink);

            //advancedControls.TabBar.AddChild(advancedControlsLinkButton);

            GuiWidget        manualPrinterControls           = new ManualPrinterControls();
            ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);

            manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            manualPrinterControlsScrollArea.AnchorAll();
            manualPrinterControlsScrollArea.AddChild(manualPrinterControls);
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, "Printer Controls"), 18,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, "Slice Settings"), 18,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            return(advancedControls);
        }
Beispiel #2
0
        void reloadControlsWidget()
        {
            GuiWidget manualPrinterControls = new ManualPrinterControls();

            //ScrollableWidget manualPrinterControlsWidget = new ScrollableWidget(true);
            //manualPrinterControlsWidget.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            //manualPrinterControlsWidget.AnchorAll();
            //manualPrinterControlsWidget.AddChild(manualPrinterControls);

            manualControlsPage.RemoveAllChildren();
            manualControlsPage.AddChild(manualPrinterControls);
        }
        void CreateNewAdvancedControlsTab(SliceSettingsWidget.UiState sliceSettingsUiState)
        {
            advancedControlsTabControl = new TabControl();
            advancedControlsTabControl.BackgroundColor    = ActiveTheme.Instance.PrimaryBackgroundColor;
            advancedControlsTabControl.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
            advancedControlsTabControl.TabBar.Margin      = new BorderDouble(0, 0);
            advancedControlsTabControl.TabBar.Padding     = new BorderDouble(0, 2);

            advancedControlsButtonFactory.invertImageLocation = false;
            Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Print\nQueue"), "icon_arrow_left_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(onMouseEnterBoundsPrintQueueLink);
            advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsPrintQueueLink);

            advancedControlsTabControl.TabBar.AddChild(advancedControlsLinkButton);

            GuiWidget hSpacer = new GuiWidget();

            hSpacer.HAnchor = HAnchor.ParentLeftRight;

            advancedControlsTabControl.TabBar.AddChild(hSpacer);

            GuiWidget        manualPrinterControls           = new ManualPrinterControls();
            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();

            advancedControlsTabControl.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), 14,
                                                                      ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

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

            sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
            advancedControlsTabControl.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), 14,
                                                                      ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            string           configurationLabel    = LocalizedString.Get("Configuration").ToUpper();
            ScrollableWidget configurationControls = new ConfigurationPage();

            advancedControlsTabControl.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), 14,
                                                                      ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
        }
        TabControl CreateNewAdvancedControlsTab(SliceSettingsWidget.UiState sliceSettingsUiState)
        {
            StoreUiState();

            advancedControls = new TabControl();
            advancedControls.AnchorAll();
            advancedControls.BackgroundColor    = ActiveTheme.Instance.PrimaryBackgroundColor;
            advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
            advancedControls.TabBar.Margin      = new BorderDouble(0, 0);
            advancedControls.TabBar.Padding     = new BorderDouble(0, 2);

            advancedControlsButtonFactory.invertImageLocation = false;

            GuiWidget        manualPrinterControls           = new ManualPrinterControls();
            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();

            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), 16,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

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

            sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), 16,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            string           configurationLabel    = LocalizedString.Get("Configuration").ToUpper();
            ScrollableWidget configurationControls = new ConfigurationPage();

            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), 16,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            RestoreUiState();

            return(advancedControls);
        }
        private TabControl CreateNewAdvancedControls(EventHandler AdvancedControlsButton_Click)
        {
            TabControl advancedControls = new TabControl();

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
            advancedControls.TabBar.Margin      = new BorderDouble(0, 0);
            advancedControls.TabBar.Padding     = new BorderDouble(0, 2);

            int textSize = 16;

            if (AdvancedControlsButton_Click != null)
            {
                // this means we are in compact view and so we will make the tabs text a bit smaller
                textSize = 14;
                TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
                advancedControlsButtonFactory.fontSize            = 14;
                advancedControlsButtonFactory.invertImageLocation = false;
                advancedControlsBackButton             = advancedControlsButtonFactory.Generate(LocalizedString.Get("Back"), "icon_arrow_left_32x32.png");
                advancedControlsBackButton.ToolTipText = "Switch to Queue, Library and History".Localize();
                advancedControlsBackButton.Margin      = new BorderDouble(right: 3);
                advancedControlsBackButton.VAnchor     = VAnchor.ParentBottom;
                advancedControlsBackButton.Cursor      = Cursors.Hand;
                advancedControlsBackButton.Click      += new EventHandler(AdvancedControlsButton_Click);

                advancedControls.TabBar.AddChild(advancedControlsBackButton);
            }

            GuiWidget hSpacer = new GuiWidget();

            hSpacer.HAnchor = HAnchor.ParentLeftRight;

            advancedControls.TabBar.AddChild(hSpacer);

            GuiWidget        manualPrinterControls           = new ManualPrinterControls();
            ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);

            manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            manualPrinterControlsScrollArea.AnchorAll();
            manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

            RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;

            //Add the tab contents for 'Advanced Controls'
            string sliceSettingsLabel   = LocalizedString.Get("Settings").ToUpper();
            string printerControlsLabel = LocalizedString.Get("Controls").ToUpper();

            sliceSettingsWidget = new SliceSettingsWidget();

            TabPage             sliceSettingsTabPage = new TabPage(sliceSettingsWidget, sliceSettingsLabel);
            PopOutTextTabWidget sliceSettingPopOut   = new PopOutTextTabWidget(sliceSettingsTabPage, SliceSettingsTabName, new Vector2(590, 400), textSize);

            advancedControls.AddTab(sliceSettingPopOut);

            TabPage             controlsTabPage = new TabPage(manualPrinterControlsScrollArea, printerControlsLabel);
            PopOutTextTabWidget controlsPopOut  = new PopOutTextTabWidget(controlsTabPage, ControlsTabName, new Vector2(400, 300), textSize);

            advancedControls.AddTab(controlsPopOut);

#if !__ANDROID__
            MenuOptionSettings.sliceSettingsPopOut = sliceSettingPopOut;
            MenuOptionSettings.controlsPopOut      = controlsPopOut;
#endif

            string           optionsLabel    = LocalizedString.Get("Options").ToUpper();
            ScrollableWidget optionsControls = new PrinterConfigurationScrollWidget();
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(optionsControls, optionsLabel), "Options Tab", textSize,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

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

                advancedControls.TabBar.TabIndexChanged += (object sender, EventArgs e) =>
                {
                    UserSettings.Instance.set(ThirdPanelTabView_AdvancedControls_CurrentTab, advancedControls.TabBar.SelectedTabName);
                };
            }

            return(advancedControls);
        }
Beispiel #6
0
        private TabControl CreateNewAdvancedControls(EventHandler AdvancedControlsButton_Click, EventHandler onMouseEnterBoundsPrintQueueLink, EventHandler onMouseLeaveBoundsPrintQueueLink)
        {
            TabControl advancedControls = new TabControl();

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
            advancedControls.TabBar.Margin      = new BorderDouble(0, 0);
            advancedControls.TabBar.Padding     = new BorderDouble(0, 2);

            int textSize = 16;

            if (AdvancedControlsButton_Click != null)
            {
                // this means we are in compact view and so we will make the tabs text a bit smaller
                textSize = 14;
                TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
                advancedControlsButtonFactory.invertImageLocation = false;
                advancedControlsLinkButton                   = advancedControlsButtonFactory.Generate(LocalizedString.Get("Print\nQueue"), "icon_arrow_left_32x32.png");
                advancedControlsLinkButton.Margin            = new BorderDouble(right: 3);
                advancedControlsLinkButton.VAnchor           = VAnchor.ParentBottom;
                advancedControlsLinkButton.Cursor            = Cursors.Hand;
                advancedControlsLinkButton.Click            += new EventHandler(AdvancedControlsButton_Click);
                advancedControlsLinkButton.MouseEnterBounds += new EventHandler(onMouseEnterBoundsPrintQueueLink);
                advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsPrintQueueLink);

                advancedControls.TabBar.AddChild(advancedControlsLinkButton);
            }

            GuiWidget hSpacer = new GuiWidget();

            hSpacer.HAnchor = HAnchor.ParentLeftRight;

            advancedControls.TabBar.AddChild(hSpacer);

            GuiWidget        manualPrinterControls           = new ManualPrinterControls();
            ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);

            manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            manualPrinterControlsScrollArea.AnchorAll();
            manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

            RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;

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

            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), "Controls Tab", textSize,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

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

            sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), "Slice Settings Tab", textSize,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

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

            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), "Configuration Tab", textSize,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            advancedControls.SelectedTabIndex = lastAdvanceControlsIndex;

            return(advancedControls);
        }
Beispiel #7
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 TabControl CreateNewAdvancedControls(EventHandler AdvancedControlsButton_Click)
		{
			TabControl advancedControls = new TabControl();

			BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
			advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
			advancedControls.TabBar.Margin = new BorderDouble(0, 0);
			advancedControls.TabBar.Padding = new BorderDouble(0, 2);

			int textSize = 16;

			if (AdvancedControlsButton_Click != null)
			{
				// this means we are in compact view and so we will make the tabs text a bit smaller
				textSize = 14;
				TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
				advancedControlsButtonFactory.fontSize = 14;
				advancedControlsButtonFactory.invertImageLocation = false;
				advancedControlsBackButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Back"), "icon_arrow_left_32x32.png");
				advancedControlsBackButton.ToolTipText = "Switch to Queue, Library and History".Localize();
				advancedControlsBackButton.Margin = new BorderDouble(right: 3);
				advancedControlsBackButton.VAnchor = VAnchor.ParentBottom;
				advancedControlsBackButton.Cursor = Cursors.Hand;
				advancedControlsBackButton.Click += new EventHandler(AdvancedControlsButton_Click);

				advancedControls.TabBar.AddChild(advancedControlsBackButton);
			}

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

			advancedControls.TabBar.AddChild(hSpacer);

			GuiWidget manualPrinterControls = new ManualPrinterControls();
			ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);
			manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
			manualPrinterControlsScrollArea.AnchorAll();
			manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

			RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;

			//Add the tab contents for 'Advanced Controls'
			string sliceSettingsLabel = LocalizedString.Get("Settings").ToUpper();
			string printerControlsLabel = LocalizedString.Get("Controls").ToUpper();
			sliceSettingsWidget = new SliceSettingsWidget();

			TabPage sliceSettingsTabPage = new TabPage(sliceSettingsWidget, sliceSettingsLabel);
			PopOutTextTabWidget sliceSettingPopOut = new PopOutTextTabWidget(sliceSettingsTabPage, SliceSettingsTabName, new Vector2(590, 400), textSize);
			advancedControls.AddTab(sliceSettingPopOut);
			
			TabPage controlsTabPage = new TabPage(manualPrinterControlsScrollArea, printerControlsLabel);
			PopOutTextTabWidget controlsPopOut = new PopOutTextTabWidget(controlsTabPage, ControlsTabName, new Vector2(400, 300), textSize);
			advancedControls.AddTab(controlsPopOut);

#if !__ANDROID__
			MenuOptionSettings.sliceSettingsPopOut = sliceSettingPopOut;
			MenuOptionSettings.controlsPopOut = controlsPopOut;
#endif

			string optionsLabel = LocalizedString.Get("Options").ToUpper();
			ScrollableWidget configurationControls = new PrinterConfigurationScrollWidget();
			advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, optionsLabel), "Configuration Tab", textSize,
						ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

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

				advancedControls.TabBar.TabIndexChanged += (object sender, EventArgs e) =>
				{
					UserSettings.Instance.set(ThirdPanelTabView_AdvancedControls_CurrentTab, advancedControls.TabBar.SelectedTabName);
				};
			}

			return advancedControls;
		}
        private TabControl CreateAdvancedControlsTab()
        {
            TabControl advancedControls = new TabControl();

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
            advancedControls.TabBar.Margin      = new BorderDouble(0, 0);
            advancedControls.TabBar.Padding     = new BorderDouble(0, 2);

            int textSize = 16;

            // this means we are in compact view and so we will make the tabs text a bit smaller
            textSize = 14;
            TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();

            advancedControlsButtonFactory.fontSize            = 14;
            advancedControlsButtonFactory.invertImageLocation = false;
            backButton             = advancedControlsButtonFactory.Generate(LocalizedString.Get("Back"), StaticData.Instance.LoadIcon("icon_arrow_left_32x32.png", 32, 32));
            backButton.ToolTipText = "Switch to Queue, Library and History".Localize();
            backButton.Margin      = new BorderDouble(right: 3);
            backButton.VAnchor     = VAnchor.ParentBottom;
            backButton.Cursor      = Cursors.Hand;
            backButton.Click      += (s, e) => BackClicked?.Invoke(this, null);

            advancedControls.TabBar.AddChild(backButton);

            advancedControls.TabBar.AddChild(new HorizontalSpacer());

            GuiWidget manualPrinterControls = new ManualPrinterControls();

            ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);

            manualPrinterControlsScrollArea.ScrollArea.HAnchor |= HAnchor.ParentLeftRight;
            manualPrinterControlsScrollArea.AnchorAll();
            manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

            RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;

            if (ActiveSliceSettings.Instance.PrinterSelected)
            {
                sliceSettingsWidget = new SliceSettingsWidget();
            }
            else
            {
                sliceSettingsWidget = new NoSettingsWidget();
            }

            var sliceSettingsTabPage = new TabPage(sliceSettingsWidget, "Settings".Localize().ToUpper());
            var sliceSettingPopOut   = new PopOutTextTabWidget(sliceSettingsTabPage, SliceSettingsTabName, new Vector2(590, 400), textSize);

            advancedControls.AddTab(sliceSettingPopOut);

            var controlsTabPage = new TabPage(manualPrinterControlsScrollArea, "Controls".Localize().ToUpper());
            var controlsPopOut  = new PopOutTextTabWidget(controlsTabPage, ControlsTabName, new Vector2(400, 300), textSize);

            advancedControls.AddTab(controlsPopOut);

#if !__ANDROID__
            MenuOptionSettings.sliceSettingsPopOut = sliceSettingPopOut;
            MenuOptionSettings.controlsPopOut      = controlsPopOut;
#endif

            var optionsControls = new PrinterConfigurationScrollWidget();
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(optionsControls, "Options".Localize().ToUpper()), "Options Tab", textSize,
                                                            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

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

                advancedControls.TabBar.TabIndexChanged += (sender, e) =>
                {
                    string selectedTabName = advancedControls.TabBar.SelectedTabName;
                    if (!string.IsNullOrEmpty(selectedTabName))
                    {
                        UserSettings.Instance.set(ThirdPanelTabView_AdvancedControls_CurrentTab, selectedTabName);
                    }
                };
            }

            return(advancedControls);
        }
Beispiel #10
0
        private FlowLayoutWidget CreateEButtons(double buttonSeparationDistance)
        {
            FlowLayoutWidget eButtons = new FlowLayoutWidget(FlowDirection.TopToBottom);

            {
                FlowLayoutWidget eMinusButtonAndText = new FlowLayoutWidget();
                eMinusControl        = moveButtonFactory.Generate("E-", PrinterCommunication.Axis.E, ManualPrinterControls.EFeedRate(0));
                eMinusControl.Margin = new BorderDouble(0, 0, 5, 0);
                eMinusButtonAndText.AddChild(eMinusControl);
                TextWidget eMinusControlLabel = new TextWidget(LocalizedString.Get("Retract"), pointSize: 11);
                eMinusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                eMinusControlLabel.VAnchor   = Agg.UI.VAnchor.ParentCenter;
                eMinusButtonAndText.AddChild(eMinusControlLabel);
                eMinusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft;
                eButtons.AddChild(eMinusButtonAndText);

                eMinusButtonAndText.HAnchor = HAnchor.FitToChildren;
                eMinusButtonAndText.VAnchor = VAnchor.FitToChildren;

                GuiWidget eSpacer = new GuiWidget(2, buttonSeparationDistance);
                eSpacer.HAnchor         = Agg.UI.HAnchor.ParentLeft;
                eSpacer.Margin          = new BorderDouble(eMinusControl.Width / 2, 0, 0, 0);
                eSpacer.BackgroundColor = XYZColors.eColor;
                eButtons.AddChild(eSpacer);

                FlowLayoutWidget ePlusButtonAndText = new FlowLayoutWidget();
                ePlusControl        = moveButtonFactory.Generate("E+", PrinterCommunication.Axis.E, ManualPrinterControls.EFeedRate(0));
                ePlusControl.Margin = new BorderDouble(0, 0, 5, 0);
                ePlusButtonAndText.AddChild(ePlusControl);
                TextWidget ePlusControlLabel = new TextWidget(LocalizedString.Get("Extrude"), pointSize: 11);
                ePlusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                ePlusControlLabel.VAnchor   = Agg.UI.VAnchor.ParentCenter;
                ePlusButtonAndText.AddChild(ePlusControlLabel);
                ePlusButtonAndText.HAnchor = Agg.UI.HAnchor.ParentLeft;
                eButtons.AddChild(ePlusButtonAndText);
                ePlusButtonAndText.HAnchor = HAnchor.FitToChildren;
                ePlusButtonAndText.VAnchor = VAnchor.FitToChildren;
            }

            eButtons.AddChild(new GuiWidget(10, 6));

            // add in some movement radio buttons
            FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget();
            TextWidget       buttonsLabel           = new TextWidget("Distance:", textColor: RGBA_Bytes.White);

            buttonsLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
            //setMoveDistanceControl.AddChild(buttonsLabel);

            {
                TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
                buttonFactory.FixedHeight = 20;
                buttonFactory.FixedWidth  = 30;
                buttonFactory.fontSize    = 10;
                buttonFactory.Margin      = new BorderDouble(0);

                FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget();
                RadioButton      oneButton        = buttonFactory.GenerateRadioButton("1");
                oneButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                  {
                                                                      SetEMoveAmount(1);
                                                                  }
                };
                moveRadioButtons.AddChild(oneButton);
                RadioButton tenButton = buttonFactory.GenerateRadioButton("10");
                tenButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                  {
                                                                      SetEMoveAmount(10);
                                                                  }
                };
                moveRadioButtons.AddChild(tenButton);
                RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100");
                oneHundredButton.VAnchor              = Agg.UI.VAnchor.ParentCenter;
                oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked)
                                                                         {
                                                                             SetEMoveAmount(100);
                                                                         }
                };
                moveRadioButtons.AddChild(oneHundredButton);
                tenButton.Checked       = true;
                moveRadioButtons.Margin = new BorderDouble(0, 3);
                setMoveDistanceControl.AddChild(moveRadioButtons);
            }

            TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10);

            mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
            setMoveDistanceControl.AddChild(mmLabel);
            setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft;
            eButtons.AddChild(setMoveDistanceControl);

            eButtons.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
            eButtons.VAnchor = VAnchor.FitToChildren | VAnchor.ParentBottom;

            return(eButtons);
        }
		private TabControl CreateAdvancedControlsTab()
		{
			TabControl advancedControls = new TabControl();

			BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
			advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
			advancedControls.TabBar.Margin = new BorderDouble(0, 0);
			advancedControls.TabBar.Padding = new BorderDouble(0, 2);

			int textSize = 16;

			// this means we are in compact view and so we will make the tabs text a bit smaller
			textSize = 14;
			TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
			advancedControlsButtonFactory.fontSize = 14;
			advancedControlsButtonFactory.invertImageLocation = false;
			backButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Back"), StaticData.Instance.LoadIcon("icon_arrow_left_32x32.png", 32,32));
			backButton.ToolTipText = "Switch to Queue, Library and History".Localize();
			backButton.Margin = new BorderDouble(right: 3);
			backButton.VAnchor = VAnchor.ParentBottom;
			backButton.Cursor = Cursors.Hand;
			backButton.Click += (s, e) => BackClicked?.Invoke(this, null);

			advancedControls.TabBar.AddChild(backButton);

			advancedControls.TabBar.AddChild(new HorizontalSpacer());

			GuiWidget manualPrinterControls = new ManualPrinterControls();

			ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);
			manualPrinterControlsScrollArea.ScrollArea.HAnchor |= HAnchor.ParentLeftRight;
			manualPrinterControlsScrollArea.AnchorAll();
			manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

			RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;

			if (ActiveSliceSettings.Instance.PrinterSelected)
			{
				sliceSettingsWidget = new SliceSettingsWidget();
			}
			else
			{
				sliceSettingsWidget = new NoSettingsWidget();
			}

			var sliceSettingsTabPage = new TabPage(sliceSettingsWidget, "Settings".Localize().ToUpper());
			var sliceSettingPopOut = new PopOutTextTabWidget(sliceSettingsTabPage, SliceSettingsTabName, new Vector2(590, 400), textSize);
			advancedControls.AddTab(sliceSettingPopOut);
			
			var controlsTabPage = new TabPage(manualPrinterControlsScrollArea, "Controls".Localize().ToUpper());
			var controlsPopOut = new PopOutTextTabWidget(controlsTabPage, ControlsTabName, new Vector2(400, 300), textSize);
			advancedControls.AddTab(controlsPopOut);

#if !__ANDROID__
			MenuOptionSettings.sliceSettingsPopOut = sliceSettingPopOut;
			MenuOptionSettings.controlsPopOut = controlsPopOut;
#endif

			var optionsControls = new PrinterConfigurationScrollWidget();
			advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(optionsControls, "Options".Localize().ToUpper()), "Options Tab", textSize,
						ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

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

				advancedControls.TabBar.TabIndexChanged += (sender, e) =>
				{
					string selectedTabName = advancedControls.TabBar.SelectedTabName;
					if (!string.IsNullOrEmpty(selectedTabName))
					{
						UserSettings.Instance.set(ThirdPanelTabView_AdvancedControls_CurrentTab, selectedTabName);
					}
				};
			}

			return advancedControls;
		}
        TabControl CreateNewAdvancedControlsTab(SliceSettingsWidget.UiState sliceSettingsUiState)
        {
            advancedControls = new TabControl();
            advancedControls.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
            advancedControls.TabBar.BorderColor = RGBA_Bytes.White;
            advancedControls.TabBar.Margin = new BorderDouble(0, 0);
            advancedControls.TabBar.Padding = new BorderDouble(0, 2);

            advancedControlsButtonFactory.invertImageLocation = false;
            Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate("Print\nQueue", "icon_arrow_left_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(onMouseEnterBoundsPrintQueueLink);
            advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsPrintQueueLink);

            //advancedControls.TabBar.AddChild(advancedControlsLinkButton);

            GuiWidget manualPrinterControls = new ManualPrinterControls();
            ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);
            manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            manualPrinterControlsScrollArea.AnchorAll();
            manualPrinterControlsScrollArea.AddChild(manualPrinterControls);
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, "Printer Controls"), 18,
                        ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, "Slice Settings"), 18,
                        ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            return advancedControls;
        }
        private TabControl CreateNewAdvancedControls(ButtonBase.ButtonEventHandler AdvancedControlsButton_Click, EventHandler onMouseEnterBoundsPrintQueueLink, EventHandler onMouseLeaveBoundsPrintQueueLink)
        {
            TabControl advancedControls = new TabControl();

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
            advancedControls.TabBar.Margin = new BorderDouble(0, 0);
            advancedControls.TabBar.Padding = new BorderDouble(0, 2);

            int textSize = 16;

            if (AdvancedControlsButton_Click != null)
            {
                // this means we are in compact view and so we will make the tabs text a bit smaller
                textSize = 14;
                TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
                advancedControlsButtonFactory.invertImageLocation = false;
                advancedControlsLinkButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Print\nQueue"), "icon_arrow_left_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(onMouseEnterBoundsPrintQueueLink);
                advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsPrintQueueLink);

                advancedControls.TabBar.AddChild(advancedControlsLinkButton);
            }

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

            advancedControls.TabBar.AddChild(hSpacer);

            GuiWidget manualPrinterControls = new ManualPrinterControls();
            ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);
            manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            manualPrinterControlsScrollArea.AnchorAll();
            manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

            RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;

            //Add the tab contents for 'Advanced Controls'
            string printerControlsLabel = LocalizedString.Get("Controls").ToUpper();
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), "Controls Tab", textSize,
            ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            string sliceSettingsLabel = LocalizedString.Get("Slice Settings").ToUpper();
            sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), "Slice Settings Tab", textSize,
                        ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            string configurationLabel = LocalizedString.Get("Configuration").ToUpper();
            ScrollableWidget configurationControls = new PrinterConfigurationPage();
            advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), "Configuration Tab", textSize,
                        ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            advancedControls.SelectedTabIndex = lastAdvanceControlsIndex;

            return advancedControls;
        }