示例#1
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);
                    }
                };
            }
        }
        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);
        }
示例#3
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);
				};
			}
		}
示例#4
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);
        }
示例#5
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);
        }
		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;
		}