Ejemplo n.º 1
0
        private void LoadCompactView()
        {
            queueDataView = new QueueDataView();

            ColumnOne.RemoveAllChildren();
            ColumnOne.AddChild(new ActionBarPlus(queueDataView));
            compactSlidePanel = new CompactSlidePanel(queueDataView);
            ColumnOne.AddChild(compactSlidePanel);
            ColumnOne.AnchorAll();
        }
Ejemplo n.º 2
0
        void LoadColumnOne()
        {
            queueDataView = new QueueDataView();

            ColumnOne.VAnchor = VAnchor.ParentBottomTop;
            ColumnOne.AddChild(new ActionBarPlus(queueDataView));
            ColumnOne.AddChild(new PrintProgressBar());
            ColumnOne.AddChild(new FirstPanelTabView(queueDataView));
            ColumnOne.Width = ColumnOneFixedWidth; //Ordering here matters - must go after children are added
        }
Ejemplo n.º 3
0
        public CompactSlidePanel(QueueDataView queueDataView)
            : base(2)
        {
            this.queueDataView = queueDataView;

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

                // construct the main controls tab control
                mainControlsTabControl = new FirstPanelTabView(queueDataView);

                TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
                advancedControlsButtonFactory.normalTextColor  = ActiveTheme.Instance.PrimaryTextColor;
                advancedControlsButtonFactory.hoverTextColor   = ActiveTheme.Instance.PrimaryTextColor;
                advancedControlsButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
                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(LocalizedString.Get("Settings\n& Controls"), "icon_arrow_right_32x32.png");
                advancedControlsLinkButton.Name        = "SettingsAndControls";
                advancedControlsLinkButton.ToolTipText = "Switch to Settings, Controls and Options".Localize();
                advancedControlsLinkButton.Margin      = new BorderDouble(right: 3);
                advancedControlsLinkButton.VAnchor     = VAnchor.ParentBottom;
                advancedControlsLinkButton.Cursor      = Cursors.Hand;
                advancedControlsLinkButton.Click      += new EventHandler(AdvancedControlsButton_Click);

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

                mainControlsTabControl.TabBar.AddChild(hSpacer);
                mainControlsTabControl.TabBar.AddChild(advancedControlsLinkButton);
                mainControlsTabControl.TabBar.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
                mainControlsTabControl.HAnchor        = HAnchor.Max_FitToChildren_ParentWidth;

                this.LeftPanel.AddChild(mainControlsTabControl);
            }

            // do the right panel
            {
                this.RightPanel.AddChild(new PrintProgressBar());
                ThirdPanelTabView thirdPanelTabView = new ThirdPanelTabView(AdvancedControlsButton_Click);
                thirdPanelTabView.Name = "For - CompactSlidePanel";
                this.RightPanel.AddChild(thirdPanelTabView);
            }

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

            SetPanelIndexImediate(lastPanelIndexBeforeReload);
        }
Ejemplo n.º 4
0
 public static GuiWidget Create(QueueDataView queueDataView)
 {
     if (UserSettings.Instance.IsTouchScreen)
     {
         return(new TouchScreenPrintStatusRow(queueDataView));
     }
     else
     {
         return(new DesktopPrintStatusRow(queueDataView));
     }
 }
Ejemplo n.º 5
0
        public CompactSlidePanel(QueueDataView queueDataView, SliceSettingsWidget.UiState sliceSettingsUiState)
            : base(2)
        {
            this.queueDataView = queueDataView;

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

                // construct the main controls tab control
                mainControlsTabControl = new MainScreenTabView(queueDataView);

                advancedControlsButtonFactory.normalTextColor  = ActiveTheme.Instance.PrimaryTextColor;
                advancedControlsButtonFactory.hoverTextColor   = ActiveTheme.Instance.PrimaryTextColor;
                advancedControlsButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
                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(LocalizedString.Get("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);

                this.LeftPanel.AddChild(mainControlsTabControl);
            }

            // do the back panel
            {
                CreateNewAdvancedControlsTab(sliceSettingsUiState);

                this.RightPanel.AddChild(new PrintProgressBar());
                this.RightPanel.AddChild(advancedControlsTabControl);
            }
            AddHandlers();

            SetPanelIndexImediate(lastPanelIndexOnClose);
            advancedControlsTabControl.SelectedTabIndex = lastAdvanceControlsIndex;
        }
Ejemplo n.º 6
0
        public DesktopPrintStatusRow(QueueDataView queueDataView)
        {
            Initialize();

            this.HAnchor = HAnchor.ParentLeftRight;

            this.queueDataView = queueDataView;

            AddChildElements();
            AddHandlers();

            onActivePrintItemChanged(null, null);
        }
Ejemplo n.º 7
0
        public PrintStatusRow(QueueDataView queueDataView)
        {
            Initialize();

            this.HAnchor = HAnchor.ParentLeftRight;

            this.queueDataView = queueDataView;

            AddChildElements();
            AddHandlers();

            onActivePrintItemChanged(null, null);

            if (privateAddIconToPrintStatusRow != null)
            {
                privateAddIconToPrintStatusRow(iconContainer);
            }
        }
Ejemplo n.º 8
0
        public ActionBarPlus(QueueDataView queueDataView)
            : base(FlowDirection.TopToBottom)
        {
            this.HAnchor         = HAnchor.ParentLeftRight;
            this.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;

            if (UserSettings.Instance.IsTouchScreen)
            {
                this.AddChild(new TouchScreenPrintStatusRow(queueDataView));
            }
            else
            {
                this.AddChild(new PrinterConnectAndSelectControl());
                this.AddChild(new PrintStatusRow(queueDataView));
            }

            this.Padding = new BorderDouble(bottom: 6);
        }
Ejemplo n.º 9
0
        public override void AddElements()
        {
            topIsHidden          = false;
            this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);

            container.AnchorAll();

            TopContainer         = new TopContainerWidget();
            TopContainer.HAnchor = HAnchor.ParentLeftRight;

            ApplicationMenuRow menuRow = new ApplicationMenuRow();

#if !__ANDROID__
            TopContainer.AddChild(menuRow);
#endif

            menuSeparator             = new GuiWidget();
            menuSeparator.Height      = 12;
            menuSeparator.HAnchor     = HAnchor.ParentLeftRight;
            menuSeparator.MinimumSize = new Vector2(0, 12);
            menuSeparator.Visible     = false;

            queueDataView = new QueueDataView();
            TopContainer.AddChild(new ActionBarPlus(queueDataView));
            TopContainer.SetOriginalHeight();

            container.AddChild(TopContainer);

            progressBar = new PrintProgressBar();

            container.AddChild(progressBar);
            container.AddChild(menuSeparator);
            compactTabView = new CompactTabView(queueDataView);

            BottomOverlay bottomOverlay = new BottomOverlay();
            bottomOverlay.AddChild(compactTabView);

            container.AddChild(bottomOverlay);

            this.AddChild(container);
        }
Ejemplo n.º 10
0
        public override void CreateAndAddChildren()
        {
            topIsHidden          = false;
            this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);

            container.AnchorAll();

            TopContainer         = new FlowLayoutWidget(FlowDirection.TopToBottom);
            TopContainer.HAnchor = HAnchor.ParentLeftRight;

            if (!UserSettings.Instance.IsTouchScreen)
            {
#if !__ANDROID__
                // The application menu bar, which is suppressed on Android
                ApplicationMenuRow menuRow = new ApplicationMenuRow();
                TopContainer.AddChild(menuRow);
#endif
            }

            menuSeparator             = new GuiWidget();
            menuSeparator.Height      = 12;
            menuSeparator.HAnchor     = HAnchor.ParentLeftRight;
            menuSeparator.MinimumSize = new Vector2(0, 12);
            menuSeparator.Visible     = false;

            queueDataView = new QueueDataView();
            TopContainer.AddChild(new ActionBarPlus(queueDataView));

            container.AddChild(TopContainer);

            progressBar = new PrintProgressBar();

            container.AddChild(progressBar);
            container.AddChild(menuSeparator);
            touchscreenTabView = new TouchscreenTabView(queueDataView);

            container.AddChild(touchscreenTabView);
            this.AddChild(container);
        }
Ejemplo n.º 11
0
        public PrintActionRow(QueueDataView queueDataView)
        {
            this.HAnchor = HAnchor.ParentLeftRight;

            textImageButtonFactory.normalTextColor         = RGBA_Bytes.White;
            textImageButtonFactory.disabledTextColor       = RGBA_Bytes.LightGray;
            textImageButtonFactory.hoverTextColor          = RGBA_Bytes.White;
            textImageButtonFactory.pressedTextColor        = RGBA_Bytes.White;
            textImageButtonFactory.AllowThemeToAdjustImage = false;

            textImageButtonFactory.borderWidth       = 1;
            textImageButtonFactory.FixedHeight       = 52 * GuiWidget.DeviceScale;
            textImageButtonFactory.fontSize          = 14;
            textImageButtonFactory.normalBorderColor = new RGBA_Bytes(255, 255, 255, 100);
            textImageButtonFactory.hoverBorderColor  = new RGBA_Bytes(255, 255, 255, 100);

            this.queueDataView = queueDataView;

            AddChildElements();
            AddHandlers();
        }
Ejemplo n.º 12
0
        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;
        }
Ejemplo n.º 13
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);
                    }
                };
            }
        }
Ejemplo n.º 14
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);
            }

            this.AddTab(
                "Part Preview Tab",
                "Preview".Localize().ToUpper(),
                generator: () =>
            {
                partPreviewContainer = new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, View3DWidget.WindowMode.Embeded, View3DWidget.AutoRotate.Enabled, View3DWidget.OpenMode.Viewing);
                return(partPreviewContainer);
            });

            this.AddTab(
                "Slice Settings Tab",
                "Settings".Localize().ToUpper(),
                generator: () =>
            {
                // sliceSettingsWidget = (ActiveSliceSettings.Instance.PrinterSelected) ? new SliceSettingsWidget() : new NoSettingsWidget();
                if (ActiveSliceSettings.Instance.PrinterSelected)
                {
                    sliceSettingsWidget = new SliceSettingsWidget();
                }
                else
                {
                    sliceSettingsWidget = new NoSettingsWidget();
                }

                return(sliceSettingsWidget);
            });

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

            this.AddTab(
                "Controls Tab",
                "Controls".Localize().ToUpper(),
                () => new ManualPrinterControls());

            // TODO: How to handle reload? Create .Reload on LazyTab? Create accessor for tabs["Controls Tab"].Reload()?
            //manualControlsPage = new TabPage(, printerControlsLabel);

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

            this.AddTab(
                "Queue Tab",
                "Queue".Localize().ToUpper(),
                () => new QueueDataWidget(queueDataView));

            QueueTabPage = this.GetTabPage("Queue Tab");

            this.AddTab(
                "Library Tab",
                "Library".Localize().ToUpper(),
                () => new PrintLibraryWidget());

            if (!simpleMode)
            {
                this.AddTab(
                    "History Tab",
                    "History".Localize().ToUpper(),
                    () => new PrintHistoryWidget());
            }

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

            // 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);
             *      };
             * } */

            this.AddTab(
                "Options Tab",
                "Options".Localize().ToUpper(),
                () => new PrinterConfigurationScrollWidget());

            if (!simpleMode)
            {
                this.AddTab(
                    "Terminal Tab",
                    "Console".Localize().ToUpper(),
                    () => new TerminalWidget(false));
            }

            this.AddTab(
                "About Tab",
                "About".Localize().ToUpper(),
                () => new AboutWidget());

            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);
                    }
                };
            }
        }
Ejemplo n.º 15
0
 public ActionBarPlus(QueueDataView queueDataView)
     : base(FlowDirection.TopToBottom)
 {
     this.queueDataView = queueDataView;
     this.Create();
 }
Ejemplo n.º 16
0
 public PrintActionRow(QueueDataView queueDataView)
 {
     this.queueDataView = queueDataView;
 }
Ejemplo n.º 17
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;
        }