Esempio n. 1
0
        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);
        }
        public PageLocomotiveProperties(Locomotive locomotive)
        {
            this.locomotive = locomotive;

            StackPanel panel = new StackPanel(Orientation.Vertical);
            Child = panel;

            tabs = new TabControl();
            tabs.AddTab(CreateTabCommon());
            tabs.AddTab(CreateTabFunctions());
            panel.Children.Add(tabs);

            StackPanel panelBottom = new StackPanel(Orientation.Horizontal);
            panelBottom.HorizontalAlignment = HorizontalAlignment.Center;
            panel.Children.Add(panelBottom);

            Button btnSave = new Button(Program.FontRegular, "Сохранить", Resources.GetBitmap(Resources.BitmapResources.Save), Program.ButtonTextColor);
            btnSave.SetMargin(2);
            btnSave.VerticalAlignment = VerticalAlignment.Bottom;
            btnSave.HorizontalAlignment = HorizontalAlignment.Center;
            btnSave.Background = Program.ButtonBackground;
            btnSave.Clicked += new EventHandler(btnSave_Clicked);
            panelBottom.Children.Add(btnSave);

            tabs.Height = panel.Parent.Height - btnSave.Height - 8;

            ucWriteBlock writeBlock = new ucWriteBlock();
            writeBlock.VerticalAlignment = VerticalAlignment.Bottom;
            writeBlock.HorizontalAlignment = HorizontalAlignment.Center;
            writeBlock.SetMargin(5, 0, 0, 0);
            writeBlock.WriteClicked += new EventHandler(writeBlock_WriteClicked);
            panelBottom.Children.Add(writeBlock);

            LoadValues();
        }
        //PartPreview3DGcode part3DGcodeView;

        public PartPreviewMainWindow(PrintItemWrapper printItem)
            : base(690, 340)
        {
            string partPreviewTitle = new LocalizedString("MatterControl").Translated;

            Title = string.Format("{0}: ", partPreviewTitle) + Path.GetFileName(printItem.Name);

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            TabControl tabControl = new TabControl();

            tabControl.TabBar.BorderColor     = new RGBA_Bytes(0, 0, 0, 0);
            tabControl.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            double buildHeight = ActiveSliceSettings.Instance.BuildHeight;

            string part3DViewLblBeg  = ("3D");
            string part3DViewLblEnd  = new LocalizedString("View").Translated;
            string part3DViewLblFull = string.Format("{0} {1} ", part3DViewLblBeg, part3DViewLblEnd);

            part3DView = new View3DTransformPart(printItem, new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), ActiveSliceSettings.Instance.BedShape);
            TabPage partPreview3DView = new TabPage(part3DView, part3DViewLblFull);

            partGcodeView = new GcodeViewBasic(printItem, ActiveSliceSettings.Instance.GetBedSize, ActiveSliceSettings.Instance.GetBedCenter);
            TabPage layerView = new TabPage(partGcodeView, new LocalizedString("Layer View").Translated);

            //part3DGcodeView = new PartPreview3DGcode(printItem.FileLocation, bedXSize, bedYSize);

            tabControl.AddTab(new SimpleTextTabWidget(partPreview3DView, 16,
                                                      ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));

            tabControl.AddTab(new SimpleTextTabWidget(layerView, 16,
                                                      ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));

            this.AddChild(tabControl);
            this.AnchorAll();

            AddHandlers();

            Width  = 640;
            Height = 480;

            ShowAsSystemWindow();
            MinimumSize = new Vector2(400, 300);

            // We do this after showing the system window so that when we try and take fucus the parent window (the system window)
            // exists and can give the fucus to its child the gecode window.
            if (Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE")
            {
                tabControl.TabBar.SwitchToPage(layerView);
                partGcodeView.Focus();
            }
        }
Esempio n. 4
0
		private TabControl CreatePopulatedTabControl(Orientation orientation)
		{
			TabControl tabControl = new TabControl(orientation);
			{
				TabPage page1 = new TabPage("Page 1");
				page1.Padding = new BorderDouble(5);
				tabControl.AddTab(page1, "Page 1");
				tabControl.AddTab(new TabPage("Page 2"), "Page 2");
				tabControl.AddTab(new TabPage("Page 3"), "Page 3");
			}

			return tabControl;
		}
Esempio n. 5
0
        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()));
        }
Esempio n. 6
0
        TabControl CreatePopulatedTabControl(Orientation orientation)
        {
            TabControl tabControl = new TabControl(orientation);

            {
                TabPage page1 = new TabPage("Page 1");
                page1.Padding = new BorderDouble(5);
                tabControl.AddTab(page1, "Page 1");
                tabControl.AddTab(new TabPage("Page 2"), "Page 2");
                tabControl.AddTab(new TabPage("Page 3"), "Page 3");
            }

            return(tabControl);
        }
        //PartPreview3DGcode part3DGcodeView;

        public PartPreviewMainWindow(PrintItemWrapper printItem)
            : base(690, 340)
        {
			string partPreviewTitle = new LocalizedString ("MatterControl").Translated;
			Title = string.Format("{0}: ", partPreviewTitle) + Path.GetFileName(printItem.Name);

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            TabControl tabControl = new TabControl();
            tabControl.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0);
            tabControl.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            double buildHeight = ActiveSliceSettings.Instance.BuildHeight;

			string part3DViewLblBeg = ("3D");
			string part3DViewLblEnd = new LocalizedString ("View").Translated;
			string part3DViewLblFull = string.Format("{0} {1} ", part3DViewLblBeg, part3DViewLblEnd);
            part3DView = new View3DTransformPart(printItem, new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), ActiveSliceSettings.Instance.BedShape);
			TabPage partPreview3DView = new TabPage(part3DView, part3DViewLblFull);

            partGcodeView = new GcodeViewBasic(printItem, ActiveSliceSettings.Instance.GetBedSize, ActiveSliceSettings.Instance.GetBedCenter);
			TabPage layerView = new TabPage(partGcodeView, new LocalizedString("Layer View").Translated);

            //part3DGcodeView = new PartPreview3DGcode(printItem.FileLocation, bedXSize, bedYSize);

            tabControl.AddTab(new SimpleTextTabWidget(partPreview3DView , 16,
                        ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));

            tabControl.AddTab(new SimpleTextTabWidget(layerView, 16,
                        ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));       

            this.AddChild(tabControl);
            this.AnchorAll();

            AddHandlers();

            Width = 640;
            Height = 480;

            ShowAsSystemWindow();
            MinimumSize = new Vector2(400, 300);

            // We do this after showing the system window so that when we try and take fucus the parent window (the system window)
            // exists and can give the fucus to its child the gecode window.
            if (Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE")
            {
                tabControl.TabBar.SwitchToPage(layerView);
                partGcodeView.Focus();
            }
        }
Esempio n. 8
0
    public void OnAddFormationClick()
    {
        Formation newFormation = new Formation();

        // newFormation.CallSign = callSignDropDown.options[callSignDropDown.value].text;
        newFormation.formationName = formationName.text;
        newFormation.Color         = colorDropDown.options[colorDropDown.value].text;
        newFormation.Short         = shortFormation.text;
        currentFormation           = newFormation;

        if (SideAToggle.isOn)
        {
            sideA.Add(currentFormation);
            tabControlA.AddTab(currentFormation.formationName); //Replaced by formation name
            currentTab = tabControlA.tabs[tabControlA.tabs.Count - 1];
        }

        if (SideBToggle.isOn)
        {
            sideB.Add(currentFormation);
            tabControlB.AddTab(currentFormation.formationName); //Replaced by formation name
            currentTab = tabControlB.tabs[tabControlB.tabs.Count - 1];
        }
        // GameObject headings = Instantiate(headingPrefab, currentTab.tabContent.GetChild(0).GetChild(0).GetChild(0));
        ActivatePilotButton();
    }
Esempio n. 9
0
        public MainWindow()
        {
            InitializeComponent();

            DataContext = TabControl;


            // Default Test
            //TabControl.AddTab(new LoginPanel());
            TabControl.AddTab(CreateFixedSizeLabel("Alpha", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("Bravo", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("Charlie", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("Delta", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("Echo", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("Foxtrot", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("Hotel", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("Gemini", new Size(320, 240)));

            //// Aspect ratio test
            //TabControl.AddTab(CreateFixedSizeLabel("A", new Size(80, 60)));
            //TabControl.AddTab(CreateFixedSizeLabel("B", new Size(160, 120)));
            //TabControl.AddTab(CreateFixedSizeLabel("C", new Size(320, 240)));
            //TabControl.AddTab(CreateFixedSizeLabel("D", new Size(640, 480)));
            //TabControl.AddTab(CreateFixedSizeLabel("E", new Size(100, 200)));
            //TabControl.AddTab(CreateFixedSizeLabel("F", new Size(120, 300)));
            //TabControl.AddTab(CreateFixedSizeLabel("H", new Size(100, 100)));
            //TabControl.AddTab(CreateFixedSizeLabel("G", new Size(1024, 768)));
            //TabControl.NumberOfTabs = 8;

            TabControl.NumberOfTabs      = 4;
            TabControl.AnimationDuration = 2000;
        }
Esempio n. 10
0
        private void CreateTabs()
        {
            String baseString = "../../../../../";

            language = Flip.Local ? "en" : "ru";
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.01_2012-v.jpg", language), new Size(height, width)));//1
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.01_2013-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.01_2014-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.01_2015-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.01_2016-v.jpg", language), new Size(height, width)));//5
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.02_2012-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.02_2013-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.02_2014-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.02_2015-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.02_2016-v.jpg", language), new Size(height, width)));//10
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.03_2013-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.03_2014-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.03_2015-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.03_2016-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.04_2013-v.jpg", language), new Size(height, width)));//15
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.04_2015-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.04_2016-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.00_2017-v.jpg", language), new Size(height, width)));
            TabControl.AddTab(CreateFixedSizeLabel(string.Format(baseString + "Covers/ru.bigrussia.bgm{0}.01_2017-v.jpg", language), new Size(height, width)));
        }
Esempio n. 11
0
 /// <summary>
 ///		Adds the given tabs to the <see cref="TabControlUI{TWindow,TTabWrapper}"/> <see cref="TabControl"/>.
 /// </summary>
 /// <param name="tabs">A list that contains the names of each tab that will be added. </param>
 public virtual void AddTabs(params string[] tabs)
 {
     foreach (string tab in tabs)
     {
         TabControl.AddTab(tab, new TabUI(Monitor, tab, DefaultGridSize));
     }
 }
Esempio n. 12
0
        public DemoRunner()
        {
            string searchPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            // Load plugins from all assemblies the startup directory
            var dlls          = Directory.GetFiles(searchPath, "*.dll");
            var allAssemblies = dlls.Concat(Directory.GetFiles(searchPath, "*.exe"));

            foreach (var file in allAssemblies)
            {
                try
                {
                    PluginFinder.LoadTypesFromAssembly(Assembly.LoadFile(file));
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("Error loading assembly: " + ex.Message);
                }
            }

            var appWidgetFinder = PluginFinder.CreateInstancesOf <IDemoApp>().OrderBy(a => a.Title).ToList();

            TabControl tabControl = new TabControl(Orientation.Vertical);

            AddChild(tabControl);
            tabControl.AnchorAll();

            int count = appWidgetFinder.Count;

            for (int i = 0; i < count; i++)
            {
                TabPage tabPage = new TabPage(appWidgetFinder[i].Title);
                tabPage.AddChild(appWidgetFinder[i] as GuiWidget);
                tabControl.AddTab(tabPage, tabPage.Text);
            }

            // HACK: force width/height/color/position/spacing on default tab controls
            double maxWidth = tabControl.TabBar.Children.Select(c => c.Width).Max();

            foreach (var child in tabControl.TabBar.Children)
            {
                if (child is TextTab textTab)
                {
                    foreach (var viewWidget in textTab.Children)
                    {
                        viewWidget.BackgroundColor = new Color(viewWidget.BackgroundColor, 180);
                        viewWidget.HAnchor         = HAnchor.Absolute;
                        viewWidget.VAnchor         = VAnchor.Fit;
                        viewWidget.Margin          = 0;
                        viewWidget.Padding         = 6;
                        viewWidget.Position        = Vector2.Zero;
                        viewWidget.Width           = maxWidth;
                    }
                }
            }

            AnchorAll();
        }
Esempio n. 13
0
        private void Addbtn_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
        {
            var a_C = "This Tab is Closable";

            tabc.AddTab(new AuraTabItem()
            {
                Header = "AuraTabItem", Content = a_C
            }, true);
        }
Esempio n. 14
0
        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);
        }
Esempio n. 15
0
 private void CreateTabs()
 {
     TabControl.AddTab(CreateFixedSizeLabel("../../Images/CarouselCovers/Баскетбол.jpg", new Size(384, 160)));
     TabControl.AddTab(CreateFixedSizeLabel("../../Images/CarouselCovers/Большой теннис.jpg", new Size(384, 160)));
     TabControl.AddTab(CreateFixedSizeLabel("../../Images/CarouselCovers/Борьба.jpg", new Size(384, 160)));
     TabControl.AddTab(CreateFixedSizeLabel("../../Images/CarouselCovers/Волейбол.jpg", new Size(384, 160)));
     TabControl.AddTab(CreateFixedSizeLabel("../../Images/CarouselCovers/Плавание.jpg", new Size(384, 160)));
     TabControl.AddTab(CreateFixedSizeLabel("../../Images/CarouselCovers/Спортивная гимнастика.jpg", new Size(384, 160)));
     TabControl.AddTab(CreateFixedSizeLabel("../../Images/CarouselCovers/Танцы.jpg", new Size(384, 160)));
     TabControl.AddTab(CreateFixedSizeLabel("../../Images/CarouselCovers/Фигурное катание.jpg", new Size(384, 160)));
     TabControl.AddTab(CreateFixedSizeLabel("../../Images/CarouselCovers/Фитнес.jpg", new Size(384, 160)));
     TabControl.AddTab(CreateFixedSizeLabel("../../Images/CarouselCovers/Футбол.jpg", new Size(384, 160)));
 }
        public Document CreateNewDocument(TabControl WorkSpace)
        {
            var NewDoc   = new Document();
            var NewDocVw = new DocumentView();


            if (combo_.SelectedItem.ToString() == "Pulgadas")
            {
                NewDoc.Unit = UnitsOfMeasurement.Inches;
            }
            else if (combo_.SelectedItem.ToString() == "Centímetros")
            {
                NewDoc.Unit = UnitsOfMeasurement.Centimeters;
            }
            else if (combo_.SelectedItem.ToString() == "Píxeles")
            {
                NewDoc.Unit = UnitsOfMeasurement.Pixels;
            }
            NewDoc.NameOfDocument = textboxNameDoc.Text;
            // NewDoc.SetDocumentHeigthAndWidth(Int32.Parse(H_txt.Text),Int32.Parse(W_txt.Text));
            NewDoc.DocumentWidth  = Int32.Parse(W_txt.Text);
            NewDoc.DocumentHeight = Int32.Parse(H_txt.Text);

            NewDoc.Background = Brushes.White;
            switch (orientation1_.IsChecked)
            {
            case true:
                NewDoc.SwitchOrientation(Orientation.Vertical);
                break;

            default:
                NewDoc.SwitchOrientation(Orientation.Horizontal);
                break;
            }
            NewDoc.Content = new Button()
            {
                Content = "xd", FontSize = 30
            };
            NewDocVw.AddDocument(NewDoc);
            WorkSpace.AddTab(new AuraTabItem()
            {
                Header     = NewDoc.NameOfDocument,
                Content    = NewDocVw,
                IsSelected = true
            }, true);;

            return(NewDoc);
        }
Esempio n. 17
0
        private TabControl CreateExtraSettingsSideTabsAndPages(int minSettingNameWidth, TabControl categoryTabs, out int count)
        {
            count = 0;
            TabControl sideTabs = new TabControl(Orientation.Vertical);

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

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

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

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

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

                subGroupLayoutTopToBottom.AddChild(groupBox);

                SliceSettingListControl scrollOnGroupTab = new SliceSettingListControl();
                scrollOnGroupTab.AnchorAll();
                scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom);
                groupTabPage.AddChild(scrollOnGroupTab);
            }
            return(sideTabs);
        }
Esempio n. 18
0
        public DemoRunner()
        {
            TabControl tabControl = new TabControl(Orientation.Vertical);

            AddChild(tabControl);
            tabControl.AnchorAll();

            int count = appWidgetFinder.Plugins.Count;

            for (int i = 0; i < count; i++)
            {
                if (appWidgetFinder.Plugins[i].GetAppParameters().title != "Demo Runner")
                {
                    TabPage tabPage = new TabPage(appWidgetFinder.Plugins[i].GetAppParameters().title);
                    tabPage.AddChild(appWidgetFinder.Plugins[i].NewWidget());
                    tabControl.AddTab(tabPage, "Demo Runner");
                }
            }

            AnchorAll();
        }
Esempio n. 19
0
        public DemoRunner()
        {
            var appWidgetFinder = PluginFinder.CreateInstancesOf <IDemoApp>().OrderBy(a => a.Title).ToList();

            TabControl tabControl = new TabControl(Orientation.Vertical);

            AddChild(tabControl);
            tabControl.AnchorAll();

            int count = appWidgetFinder.Count;

            for (int i = 0; i < count; i++)
            {
                TabPage tabPage = new TabPage(appWidgetFinder[i].Title);
                tabPage.AddChild(appWidgetFinder[i] as GuiWidget);
                tabControl.AddTab(tabPage, tabPage.Text);
            }

            // HACK: force width/height/color/position/spacing on default tab controls
            double maxWidth = tabControl.TabBar.Children.Select(c => c.Width).Max();

            foreach (var child in tabControl.TabBar.Children)
            {
                if (child is TextTab textTab)
                {
                    foreach (var viewWidget in textTab.Children)
                    {
                        viewWidget.BackgroundColor = new Color(viewWidget.BackgroundColor, 180);
                        viewWidget.HAnchor         = HAnchor.Absolute;
                        viewWidget.VAnchor         = VAnchor.Fit;
                        viewWidget.Margin          = 0;
                        viewWidget.Padding         = 6;
                        viewWidget.Position        = Vector2.Zero;
                        viewWidget.Width           = maxWidth;
                    }
                }
            }

            AnchorAll();
        }
        public MainWindow()
        {
            InitializeComponent();

            DataContext = TabControl;


            // Default Test
            //TabControl.AddTab(new LoginPanel());
            TabControl.AddTab(CreateFixedSizeLabel("mainscreen.png", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("screen1.png", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("screen2.png", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("screen1.png", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("screen1.png", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("screen1.png", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("screen1.png", new Size(320, 240)));
            TabControl.AddTab(CreateFixedSizeLabel("screen1.png", new Size(320, 240)));


            TabControl.NumberOfTabs      = 4;
            TabControl.AnimationDuration = 2000;
        }
        private TabControl CreateSideTabsAndPages(int minSettingNameWidth, OrganizerCategory category, UiState uiState)
        {
            TabControl groupTabs = new TabControl(Orientation.Vertical);
            groupTabs.Margin = new BorderDouble(0, 0, 0, 5);
            groupTabs.TabBar.BorderColor = RGBA_Bytes.White;
            foreach (OrganizerGroup group in category.GroupsList)
            {
                tabIndexForItem = 0;
				string groupTabLbl = new LocalizedString (group.Name).Translated;
				TabPage groupTabPage = new TabPage(groupTabLbl);
                SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, 14,
                   ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());

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

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

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

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

                    if (addedSettingToSubGroup)
                    {
                        needToAddSubGroup = true;
						string groupBoxLbl = new LocalizedString (subGroup.Name).Translated;
						GroupBox groupBox = new GroupBox (groupBoxLbl);
                        groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                        groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
                        groupBox.AddChild(topToBottomSettings);

                        groupBox.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;

                        subGroupLayoutTopToBottom.AddChild(groupBox);
                    }
                }

                if (needToAddSubGroup)
                {
                    ScrollableWidget scrollOnGroupTab = new ScrollableWidget(true);
                    scrollOnGroupTab.AnchorAll();
                    subGroupLayoutTopToBottom.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
                    subGroupLayoutTopToBottom.VAnchor = VAnchor.FitToChildren;
                    //subGroupLayoutTopToBottom.DebugShowBounds = true;
                    //scrollOnGroupTab.DebugShowBounds = true;
                    scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom);
                    groupTabPage.AddChild(scrollOnGroupTab);
                    groupTabs.AddTab(groupTabWidget);
                }
            }

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

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

            RGBA_Bytes selectedTabColor;

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

            View3DWidget.WindowType viewType;
            bool showCloseButton;

            if (widgetIsEmbedded)
            {
                viewType        = View3DWidget.WindowType.Embeded;
                showCloseButton = false;
            }
            else
            {
                viewType        = View3DWidget.WindowType.StandAlone;
                showCloseButton = true;
            }

            double buildHeight = ActiveSliceSettings.Instance.BuildHeight;

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

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

                partPreviewView.Closed += (sender, e) =>
                {
                    Close();
                };

                TabPage partPreview3DView = new TabPage(partPreviewView, part3DViewLabelFull);
                tabControl.AddTab(new SimpleTextTabWidget(partPreview3DView, "3D View Tab", 16,
                                                          selectedTabColor, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));
            }

            // put in the 2d gcode view
            {
                viewGcodeBasic = new ViewGcodeBasic(printItem,
                                                    new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),
                                                    ActiveSliceSettings.Instance.BedCenter,
                                                    ActiveSliceSettings.Instance.BedShape, showCloseButton);

                viewGcodeBasic.Closed += (sender, e) =>
                {
                    Close();
                };

                layerView = new TabPage(viewGcodeBasic, LocalizedString.Get("Layer View").ToUpper());
                tabControl.AddTab(new SimpleTextTabWidget(layerView, "Layer View Tab", 16,
                                                          selectedTabColor, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));
            }

            this.AddChild(tabControl);
        }
Esempio n. 23
0
		private void Load(PrintItemWrapper printItem)
		{
			tabControl = new TabControl();
			tabControl.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0);

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

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

			double buildHeight = ActiveSliceSettings.Instance.BuildHeight;

			// put in the 3D view
			partPreviewView = new View3DWidget(printItem,
				new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),
				ActiveSliceSettings.Instance.BedCenter,
				ActiveSliceSettings.Instance.BedShape,
				windowMode,
				autoRotate3DView,
				openMode);

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

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

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

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

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

			int tabPointSize = 16;
            // add the correct tabs based on whether we are stand alone or embedded
            Tab threeDViewTab;
            Tab layerViewTab;
            if (windowMode == View3DWidget.WindowMode.StandAlone || OsInformation.OperatingSystem == OSType.Android)
			{
                threeDViewTab = new SimpleTextTabWidget(partPreview3DView, "3D View Tab", tabPointSize,
                    selectedTabColor, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                tabControl.AddTab(threeDViewTab);
                layerViewTab = new SimpleTextTabWidget(layerView, "Layer View Tab", tabPointSize,
                    selectedTabColor, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                tabControl.AddTab(layerViewTab);
			}
			else
			{
                threeDViewTab = new PopOutTextTabWidget(partPreview3DView, "3D View Tab", new Vector2(590, 400), tabPointSize);
                tabControl.AddTab(threeDViewTab);
				layerViewTab = new PopOutTextTabWidget(layerView, "Layer View Tab", new Vector2(590, 400), tabPointSize);
				tabControl.AddTab(layerViewTab);
			}

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

            this.AddChild(tabControl);
		}
		private TabControl CreateSideTabsAndPages(int minSettingNameWidth, OrganizerCategory category)
		{
			TabControl groupTabs = new TabControl(Orientation.Vertical);
			groupTabs.Margin = new BorderDouble(0, 0, 0, 5);
			groupTabs.TabBar.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
			foreach (OrganizerGroup group in category.GroupsList)
			{
				tabIndexForItem = 0;
				string groupTabLabel = LocalizedString.Get(group.Name);
				TabPage groupTabPage = new TabPage(groupTabLabel);
				groupTabPage.HAnchor = HAnchor.ParentLeftRight;

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

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

				bool needToAddSubGroup = false;
				foreach (OrganizerSubGroup subGroup in group.SubGroupsList)
				{
					string subGroupTitle = subGroup.Name;
					int numberOfCopies = 1;
					if (subGroup.Name == "Extruder X")
					{
						numberOfCopies = ActiveSliceSettings.Instance.ExtruderCount;
					}

					for (int copyIndex = 0; copyIndex < numberOfCopies; copyIndex++)
					{
						if (subGroup.Name == "Extruder X")
						{
							subGroupTitle = "{0} {1}".FormatWith("Extruder".Localize(), copyIndex + 1);
						}

						bool addedSettingToSubGroup = false;
						FlowLayoutWidget topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom);
						topToBottomSettings.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

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

								if (sliceSettingsDetailControl.ShowingHelp)
								{
									AddInHelpText(topToBottomSettings, settingInfo);
								}
							}
						}

						if (addedSettingToSubGroup)
						{
							needToAddSubGroup = true;
							string groupBoxLabel = subGroupTitle;
							AltGroupBox groupBox = new AltGroupBox(groupBoxLabel);
							groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
							groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
							groupBox.AddChild(topToBottomSettings);
							groupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
							groupBox.Margin = new BorderDouble(3, 3, 3, 0);

							subGroupLayoutTopToBottom.AddChild(groupBox);
						}
					}
				}

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

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

					scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom);
					groupTabPage.AddChild(scrollOnGroupTab);
					groupTabs.AddTab(groupTabWidget);


					// Make sure we have the right scroll position when we create this view
					// This code is not working yet. Scroll widgets get a scroll event when the tab becomes visible that is always reseting them.
					// So it is not usefull to enable this and in fact makes the tabs inconsistently scrolled. It is just here for reference. // 2015 04 16, LBB
					if(false) 
					{
						string settingsScrollPosition = "SliceSettingsWidget_{0}_{1}_ScrollPosition".FormatWith(category.Name, group.Name);

						UiThread.RunOnIdle(()=>
						{
							int scrollPosition = UserSettings.Instance.Fields.GetInt(settingsScrollPosition, -100000);
							if (scrollPosition != -100000)
							{
								scrollOnGroupTab.ScrollPosition = new Vector2(0, scrollPosition);
							}
						});

						scrollOnGroupTab.ScrollPositionChanged += (object sender, EventArgs e) =>
						{
							if (scrollOnGroupTab.CanSelect)
							{
								UserSettings.Instance.Fields.SetInt(settingsScrollPosition, (int)scrollOnGroupTab.ScrollPosition.y);
							}
						};
					}
				}
			}

			// Make sure we are on the right tab when we create this view
			{
				string settingsTypeName = "SliceSettingsWidget_{0}_CurrentTab".FormatWith(category.Name);
				string selectedTab = UserSettings.Instance.get(settingsTypeName);
				groupTabs.SelectTab(selectedTab);

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

			return groupTabs;
		}
		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;
		}
Esempio n. 26
0
        public GuiTester()
        {
            mainNavigationTabControl = new TabControl(Orientation.Vertical);

            mainNavigationTabControl.AddTab(new MenuPage(), "MenuPage");
#if true
            mainNavigationTabControl.AddTab(new TextEditPage(), "TextEditPage");
            mainNavigationTabControl.AddTab(new SplitterPage(), "SplitterPage");
            mainNavigationTabControl.AddTab(new LayoutPage(), "LayoutPage");
            mainNavigationTabControl.AddTab(new ButtonsPage(), "ButtonsPage");

            mainNavigationTabControl.AddTab(new ScrollableWidgetTestPage(), "ScrollableWidgetTestPage");
            mainNavigationTabControl.AddTab(new AnchorCenterButtonsTestPAge(), "AnchorCenterButtonsTestPAge");
            mainNavigationTabControl.AddTab(new TabPagesPage(), "TabPagesPage");
            mainNavigationTabControl.AddTab(new ListBoxPage(), "ListBoxPage");
            mainNavigationTabControl.AddTab(new ButtonAnchorTestPage(), "ButtonAnchorTestPage");

            
            mainNavigationTabControl.AddTab(new AnchorTestsPage(), "AnchorTestsPage");
            mainNavigationTabControl.AddTab(new WindowPage(), "WindowPage");

            mainNavigationTabControl.AddTab(new SliderControlsPage(), "SliderControlsPage");
            mainNavigationTabControl.AddTab(new TabPage(new FontInfoWidget(), "Fonts"), "Fonts");
#endif
            this.AddChild(mainNavigationTabControl);

            AnchorAll();
        }
        void AddControls(UiState uiState)
        {
            int minSettingNameWidth = 220;

			showHelpBox = new CheckBox(new LocalizedString("Show Help").Translated);
			showHelpBox.Checked = uiState.showHelp;

			showAllDetails = new CheckBox(new LocalizedString("Show All Settings").Translated);
            showAllDetails.Checked = uiState.userLevel == "Advanced";

            FlowLayoutWidget pageTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom, vAnchor: Agg.UI.VAnchor.ParentTop);
            pageTopToBottomLayout.AnchorAll();
            pageTopToBottomLayout.Padding = new BorderDouble(3, 0);
            this.AddChild(pageTopToBottomLayout);

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

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

			TextWidget noConnectionMessage = new TextWidget(new LocalizedString("No printer is currently selected. Select printer to edit slice settings.").Translated);
            noConnectionMessage.Margin = new BorderDouble(5);
            noConnectionMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            noConnectionMessage.VAnchor = VAnchor.ParentCenter;

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

            categoryTabs = new TabControl();
            categoryTabs.TabBar.BorderColor = RGBA_Bytes.White;
            categoryTabs.Margin = new BorderDouble(top: 8);
            categoryTabs.AnchorAll();
            List<TabBar> sideTabBarsListForLayout = new List<TabBar>();
            for (int categoryIndex = 0; categoryIndex < SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList.Count; categoryIndex++)
            {
                OrganizerCategory category = SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList[categoryIndex];
				string categoryPageLbl = new LocalizedString (category.Name).Translated;
				TabPage categoryPage = new TabPage(categoryPageLbl);
                SimpleTextTabWidget textTabWidget = new SimpleTextTabWidget(categoryPage, 16,
                        ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
                categoryPage.AnchorAll();
                categoryTabs.AddTab(textTabWidget);

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

                categoryPage.AddChild(sideTabs);
            }

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

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

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

                categoryTabs.TabBar.AddChild(hSpacer);
            }

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

                categoryTabs.TabBar.AddChild(showAllDetails);
            }

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

				categoryTabs.TabBar.AddChild(showHelpBox);
            }

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

            if (!categoryTabs.SelectTab(uiState.selectedCategory.name))
            {
                categoryTabs.SelectTab(uiState.selectedCategory.index);
            }
        }
        public PartPreviewMainWindow(PrintItemWrapper printItem, View3DTransformPart.AutoRotate autoRotate3DView)
            : base(690, 340)
        {
            string partPreviewTitle = LocalizedString.Get("MatterControl");
            Title = string.Format("{0}: ", partPreviewTitle) + Path.GetFileName(printItem.Name);

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            TabControl tabControl = new TabControl();
            tabControl.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0);
            tabControl.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            double buildHeight = ActiveSliceSettings.Instance.BuildHeight;

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

                view3DTransformPart = new View3DTransformPart(printItem,
                    new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),
                    ActiveSliceSettings.Instance.BedCenter,
                    ActiveSliceSettings.Instance.BedShape,
                    View3DTransformPart.WindowType.StandAlone,
                    autoRotate3DView);

                TabPage partPreview3DView = new TabPage(view3DTransformPart, part3DViewLabelFull);
                tabControl.AddTab(new SimpleTextTabWidget(partPreview3DView, "3D View Tab", 16,
                            ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));
            }

            // put in the 2d gcode view
            TabPage layerView;
            {
                viewGcodeBasic = new ViewGcodeBasic(printItem,
                    new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),
                    ActiveSliceSettings.Instance.BedCenter,
                    ActiveSliceSettings.Instance.BedShape,
                    true);
                layerView = new TabPage(viewGcodeBasic, LocalizedString.Get("Layer View"));
                tabControl.AddTab(new SimpleTextTabWidget(layerView, "Layer View Tab", 16,
                            ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));
            }

            this.AddChild(tabControl);
            this.AnchorAll();

            AddHandlers();

            Width = 640;
            Height = 480;

            MinimumSize = new Vector2(400, 300);
            ShowAsSystemWindow();

            // We do this after showing the system window so that when we try and take focus of the parent window (the system window)
            // it exists and can give the focus to its child the gcode window.
            if (Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE")
            {
                tabControl.TabBar.SwitchToPage(layerView);
                viewGcodeBasic.Focus();
            }
        }
        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);
        }
Esempio n. 30
0
        private void Load(PrintItemWrapper printItem)
        {
            tabControl = new TabControl();
            tabControl.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0);

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

            RGBA_Bytes selectedTabColor;

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

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

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

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

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

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

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

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

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

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

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

            this.AddChild(tabControl);
        }
		public SliceSettingsWidget(List<PrinterSettingsLayer> layerCascade = null, NamedSettingsLayers viewFilter = NamedSettingsLayers.All)
		{
			this.layerCascade = layerCascade;
			this.viewFilter = viewFilter;

			// The last layer of the layerFilters is the target persistence layer
			persistenceLayer = layerCascade?.First() ?? ActiveSliceSettings.Instance.UserLayer;

			textImageButtonFactory = new TextImageButtonFactory();
			textImageButtonFactory.normalFillColor = RGBA_Bytes.Transparent;
			textImageButtonFactory.FixedHeight = 15 * GuiWidget.DeviceScale;
			textImageButtonFactory.fontSize = 8;
			textImageButtonFactory.borderWidth = 1;
			textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);
			textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);

			this.textImageButtonFactory.disabledTextColor = RGBA_Bytes.Gray;
			this.textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
			this.textImageButtonFactory.normalTextColor = ActiveTheme.Instance.SecondaryTextColor;
			this.textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;

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

			FlowLayoutWidget pageTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom, vAnchor: Agg.UI.VAnchor.ParentTop);
			pageTopToBottomLayout.AnchorAll();
			pageTopToBottomLayout.Padding = new BorderDouble(3, 0);
			this.AddChild(pageTopToBottomLayout);

			settingsControlBar = new SettingsControlBar()
			{
				HAnchor = HAnchor.ParentLeftRight,
				BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay,
				Padding = new BorderDouble(8, 12, 8, 8)
			};

			pageTopToBottomLayout.AddChild(settingsControlBar);

			noConnectionMessageContainer = new AltGroupBox(new TextWidget("No Printer Selected".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor));
			noConnectionMessageContainer.Margin = new BorderDouble(top: 10);
			noConnectionMessageContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
			noConnectionMessageContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			noConnectionMessageContainer.Height = 90;

			string noConnectionString = "No printer is currently selected. Please select a printer to edit slice settings.".Localize();
			noConnectionString += "\n\n" + "NOTE: You need to select a printer, but do not need to connect to it.".Localize();
			TextWidget noConnectionMessage = new TextWidget(noConnectionString, pointSize: 10);
			noConnectionMessage.Margin = new BorderDouble(5);
			noConnectionMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			noConnectionMessage.VAnchor = VAnchor.ParentCenter;

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

			topCategoryTabs = new TabControl();
			topCategoryTabs.TabBar.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
			topCategoryTabs.Margin = new BorderDouble(top: 8);
			topCategoryTabs.AnchorAll();

			sliceSettingsDetailControl = new SliceSettingsDetailControl(layerCascade);

			List<TabBar> sideTabBarsListForLayout = new List<TabBar>();
			for (int topCategoryIndex = 0; topCategoryIndex < SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList.Count; topCategoryIndex++)
			{
				OrganizerCategory category = SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList[topCategoryIndex];
				string categoryPageLabel = category.Name.Localize();
				TabPage categoryPage = new TabPage(categoryPageLabel);
				SimpleTextTabWidget textTabWidget = new SimpleTextTabWidget(categoryPage, category.Name + " Tab", 16,
					ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
				categoryPage.AnchorAll();
				topCategoryTabs.AddTab(textTabWidget);

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

				categoryPage.AddChild(sideTabs);
			}

			topCategoryTabs.TabBar.AddChild(new HorizontalSpacer());
			topCategoryTabs.TabBar.AddChild(sliceSettingsDetailControl);

			if (sliceSettingsDetailControl.SelectedValue == "Advanced" && ActiveSliceSettings.Instance.Helpers.ActiveSliceEngineType() == SlicingEngineTypes.Slic3r)
			{
				TabPage extraSettingsPage = new TabPage("Other");
				SimpleTextTabWidget extraSettingsTextTabWidget = new SimpleTextTabWidget(extraSettingsPage, "Other Tab", 16,
						ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
				extraSettingsPage.AnchorAll();
				int count;
				TabControl extraSettingsSideTabs = CreateExtraSettingsSideTabsAndPages(topCategoryTabs, out count);
				if (count > 0)
				{
					topCategoryTabs.AddTab(extraSettingsTextTabWidget);
					sideTabBarsListForLayout.Add(extraSettingsSideTabs.TabBar);
					extraSettingsPage.AddChild(extraSettingsSideTabs);
				}
			}

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

			// check if there is only one left side tab. If so hide the left tabs and expand the content.
			foreach(var tabList in sideTabBarsListForLayout)
			{
				if(tabList.CountVisibleChildren() == 1)
				{
					tabList.MinimumSize = new Vector2(0, 0);
					tabList.Width = 0;
				}
			}

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

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

				topCategoryTabs.TabBar.TabIndexChanged += (object sender, EventArgs e) =>
				{
					string selectedTabName = topCategoryTabs.TabBar.SelectedTabName;
					if (!string.IsNullOrEmpty(selectedTabName))
					{
						if (layerCascade == null)
						{
							UserSettings.Instance.set(settingsName, selectedTabName);
						}
					}
				};
			}

			this.AnchorAll();
		}
		private TabControl CreateExtraSettingsSideTabsAndPages(TabControl categoryTabs, out int count)
		{
			int rightContentWidth = (int)(280 * GuiWidget.DeviceScale + .5);
			count = 0;
			TabControl leftSideGroupTabs = new TabControl(Orientation.Vertical);
			leftSideGroupTabs.Margin = new BorderDouble(0, 0, 0, 5);
			leftSideGroupTabs.TabBar.BorderColor = RGBA_Bytes.White;
			{
				TabPage groupTabPage = new TabPage("Extra Settings");
				SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, "Extra Settings Tab", 14,
				   ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
				leftSideGroupTabs.AddTab(groupTabWidget);

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

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

				this.HAnchor = HAnchor.ParentLeftRight;

				foreach (var keyValue in ActiveSliceSettings.Instance.BaseLayer)
				{
					if (!SliceSettingsOrganizer.Instance.Contains(UserLevel, keyValue.Key))
					{
						SliceSettingData settingData = new SliceSettingData(keyValue.Key, keyValue.Key, SliceSettingData.DataEditTypes.STRING);
						if (ActiveSliceSettings.Instance.Helpers.ActiveSliceEngine().MapContains(settingData.SlicerConfigName))
						{
							bool addControl;
							GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingData, layerCascade, persistenceLayer, viewFilter, 0, out addControl, ref tabIndexForItem);
							if (addControl)
							{
								topToBottomSettings.AddChild(controlsForThisSetting);
							}
							count++;
						}
					}
				}

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

				subGroupLayoutTopToBottom.AddChild(groupBox);

				SliceSettingListControl scrollOnGroupTab = new SliceSettingListControl();
				scrollOnGroupTab.AnchorAll();
				scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom);
				groupTabPage.AddChild(scrollOnGroupTab);
			}
			return leftSideGroupTabs;
		}
Esempio n. 33
0
        public WidescreenPanel()
            : base()
        {
            ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(LoadSettingsOnPrinterChanged, ref unregisterEvents);
            
            // do the front panel stuff
            {
                // first add the print progress bar                
                this.Panel1.AddChild(new PrintProgressBar());

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

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

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

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


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

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

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

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

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

                SetUpdateNotification(this, null);
            }

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

            

            AddHandlers();
        }
Esempio n. 34
0
        private TabControl CreateSideTabsAndPages(int minSettingNameWidth, OrganizerCategory category, UiState uiState)
        {
            TabControl groupTabs = new TabControl(Orientation.Vertical);

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

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

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

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

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

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

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

                        subGroupLayoutTopToBottom.AddChild(groupBox);
                    }
                }

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

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

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

            if (!groupTabs.SelectTab(uiState.selectedGroup.name))
            {
                groupTabs.SelectTab(uiState.selectedGroup.index);
            }
            return(groupTabs);
        }
		public SliceSettingsWidget()
		{
			int minSettingNameWidth = (int)(190 * TextWidget.GlobalPointSizeScaleRatio + .5);
			buttonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio;
			buttonFactory.fontSize = 10;
			buttonFactory.normalFillColor = RGBA_Bytes.White;
			buttonFactory.normalTextColor = RGBA_Bytes.DarkGray;

			FlowLayoutWidget pageTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom, vAnchor: Agg.UI.VAnchor.ParentTop);
			pageTopToBottomLayout.AnchorAll();
			pageTopToBottomLayout.Padding = new BorderDouble(3, 0);
			this.AddChild(pageTopToBottomLayout);

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

			settingsSaveBar = new SliceSettingsSaveBar();
			settingsSaveBar.Visible = false;
			pageTopToBottomLayout.AddChild(settingsSaveBar);

			noConnectionMessageContainer = new AltGroupBox(new TextWidget(LocalizedString.Get("No Printer Selected"), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor));
			noConnectionMessageContainer.Margin = new BorderDouble(top: 10);
			noConnectionMessageContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
			noConnectionMessageContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			noConnectionMessageContainer.Height = 90;

			string noConnectionString = LocalizedString.Get("No printer is currently selected. Please select a printer to edit slice settings.");
			noConnectionString += "\n\n" + LocalizedString.Get("NOTE: You need to select a printer, but do not need to connect to it.");
			TextWidget noConnectionMessage = new TextWidget(noConnectionString, pointSize: 10);
			noConnectionMessage.Margin = new BorderDouble(5);
			noConnectionMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			noConnectionMessage.VAnchor = VAnchor.ParentCenter;

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

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

			sliceSettingsDetailControl = new SliceSettingsDetailControl();

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

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

				categoryPage.AddChild(sideTabs);
			}

			categoryTabs.TabBar.AddChild(new HorizontalSpacer());
			categoryTabs.TabBar.AddChild(sliceSettingsDetailControl);

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

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

			if (sideTabBarsListForLayout.Count == 1)
			{
				sideTabBarsListForLayout[0].MinimumSize = new Vector2(0, 0);
				sideTabBarsListForLayout[0].Width = 0;
			}

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

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

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


			this.AnchorAll();
			SetStatusDisplay();
		}
        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);
        }
		private TabControl CreateExtraSettingsSideTabsAndPages(int minSettingNameWidth, TabControl categoryTabs, out int count)
		{
			count = 0;
			TabControl sideTabs = new TabControl(Orientation.Vertical);
			sideTabs.Margin = new BorderDouble(0, 0, 0, 5);
			sideTabs.TabBar.BorderColor = RGBA_Bytes.White;
			{
				TabPage groupTabPage = new TabPage("Extra Settings");
				SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, "Extra Settings Tab", 14,
				   ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
				sideTabs.AddTab(groupTabWidget);

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

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

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

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

				subGroupLayoutTopToBottom.AddChild(groupBox);

				SliceSettingListControl scrollOnGroupTab = new SliceSettingListControl();
				scrollOnGroupTab.AnchorAll();
				scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom);
				groupTabPage.AddChild(scrollOnGroupTab);
			}
			return sideTabs;
		}
Esempio n. 38
0
        public GuiTester()
        {
            mainNavigationTabControl = new TabControl(Orientation.Vertical);


            mainNavigationTabControl.AddTab(new GridControlPage(), "GridControl");
#if true
            mainNavigationTabControl.AddTab(new MenuPage(), "MenuPage");
            mainNavigationTabControl.AddTab(new TextEditPage(), "TextEditPage");
            mainNavigationTabControl.AddTab(new SplitterPage(), "SplitterPage");
            mainNavigationTabControl.AddTab(new LayoutPage(), "LayoutPage");
            mainNavigationTabControl.AddTab(new ButtonsPage(), "ButtonsPage");

            mainNavigationTabControl.AddTab(new ScrollableWidgetTestPage(), "ScrollableWidgetTestPage");
            mainNavigationTabControl.AddTab(new AnchorCenterButtonsTestPAge(), "AnchorCenterButtonsTestPAge");
            mainNavigationTabControl.AddTab(new TabPagesPage(), "TabPagesPage");
            mainNavigationTabControl.AddTab(new ListBoxPage(), "ListBoxPage");
            mainNavigationTabControl.AddTab(new ButtonAnchorTestPage(), "ButtonAnchorTestPage");

            mainNavigationTabControl.AddTab(new AnchorTestsPage(), "AnchorTestsPage");
            mainNavigationTabControl.AddTab(new WindowPage(), "WindowPage");

            mainNavigationTabControl.AddTab(new SliderControlsPage(), "SliderControlsPage");
            mainNavigationTabControl.AddTab(new TabPage(new FontInfoWidget(), "Fonts"), "Fonts");
            mainNavigationTabControl.AddTab(new TabPage(new FontHintWidget(), "Font Hinting"), "Font Hinting");
            mainNavigationTabControl.AddTab(new TabPage(new WebCamWidget(), "Web Cam"), "WebCam");
#endif
            this.AddChild(mainNavigationTabControl);

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

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

            RGBA_Bytes selectedTabColor;

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

            double buildHeight = ActiveSliceSettings.Instance.BuildHeight;

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

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

            TabPage partPreview3DView = new TabPage(partPreviewView, part3DViewLabelFull);

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

                SetUpdateNotification(this, null);
            }

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



            AddHandlers();
        }
Esempio n. 41
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);
        }
        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;
        }
Esempio n. 43
0
        public SliceSettingsWidget(UiState uiState)
        {
            int minSettingNameWidth = 220;

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

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

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

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

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

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

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

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

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

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

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

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

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

                categoryPage.AddChild(sideTabs);
            }

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

            double sideTabBarsMinimumWidth = 0;

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

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

                categoryTabs.TabBar.AddChild(hSpacer);
            }

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

                categoryTabs.TabBar.AddChild(showAllDetails);
            }

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

                categoryTabs.TabBar.AddChild(showHelpBox);
            }

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

            if (!categoryTabs.SelectTab(uiState.selectedCategory.name))
            {
                categoryTabs.SelectTab(uiState.selectedCategory.index);
            }
        }
Esempio n. 44
0
        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;
        }
Esempio n. 45
0
        public override void Initialize()
        {
            fnt       = new Font("msyh.ttc", 25);
            fntsmall  = new Font("msyh.ttc", 15);
            fntborder = new Font("msyh.ttc", 15)
            {
                EnableBorder = true,
                BorderColor  = Color.Black
            };

            spm = new ScrollPanel()
            {
                Margin = Origins.TopRight,
                Width  = 1000,
                Height = GraphicsDevice.Viewport.Height - 80,
                Top    = 80,
                Right  = 0
            };

            b = new Button()
            {
                Bottom = 10,
                Left   = 195,
                Width  = 165,
                Height = 40,
                Margin = Origins.BottomLeft,
            };

            breturn = new Button()
            {
                Bottom = 10,
                Left   = 10,
                Width  = 165,
                Height = 40,
                Margin = Origins.BottomLeft
            };


            combob = new ComboBox()
            {
                Top    = 120,
                Left   = 10,
                Width  = 350,
                Margin = Origins.TopLeft,
            };

            groupcb = new ComboBox()
            {
                Top        = 10,
                Right      = 300,
                Width      = 200,
                Margin     = Origins.TopRight,
                FocusColor = Color.CornflowerBlue,
            };

            sortcb = new ComboBox()
            {
                Top        = 10,
                Right      = 20,
                Width      = 200,
                Margin     = Origins.TopRight,
                FocusColor = Color.LightGreen,
            };

            tb = new TabControl()
            {
                Top       = 54,
                Right     = 10,
                Margin    = Origins.TopRight,
                Width     = GraphicsDevice.Viewport.Width,
                Height    = GraphicsDevice.Viewport.Height,
                TabMargin = Origins.TopRight
            };

            bg       = Sprite.CreateTextureFromFile(@"Content\menu-background-xmas-6.png");
            menu_osu = Sprite.CreateTextureFromFile(@"Content\010c0951.png");
            top      = Sprite.CreateTextureFromFile(@"Content\songselect-top.png");

            Controls.Add(spm);
            Controls.Add(b);
            Controls.Add(breturn);
            Controls.Add(tb);
            Controls.Add(combob);
            Controls.Add(groupcb);
            Controls.Add(sortcb);


            base.Initialize();

            CreateMap();
            p_Click((object)maps[0], null);

            spm.Controls.AddRange(maps.ToArray());

            spm.ScrollSpeed = 150;
            b.Text          = "开始颓废";
            breturn.Text    = "返回母港";
            breturn.Click  += Breturn_Click;

            combob.AddItem("地图信息");
            combob.AddItem("本地排行");
            combob.AddItem("在线排行");
            combob.AddItem("好友排行");
            combob.SelectedItem = "地图信息";
            groupcb.AddItem("不分组");
            groupcb.AddItem("作者");
            groupcb.AddItem("添加日期");
            groupcb.AddItem("长度");
            groupcb.AddItem("海域");
            groupcb.AddItem("地图名称");
            groupcb.AddItem("收藏夹");
            groupcb.AddItem("我做的图");
            groupcb.AddItem("最近玩过的");
            groupcb.SelectedItem = "不分组";

            sortcb.AddItem("海域编号");
            sortcb.AddItem("地图名称");
            sortcb.AddItem("作者");
            sortcb.AddItem("长度");
            sortcb.AddItem("添加日期");
            sortcb.SelectedItem = "海域编号";

            tb.AddTab(Control.Empty, "不分组");
            tb.AddTab(Control.Empty, "作者");
            tb.AddTab(Control.Empty, "最近玩过的");
            tb.AddTab(Control.Empty, "收藏夹");
            tb.SwitchTab(0);
            this.Show  += MapSelect_Show;
            this.Leave += MapSelect_Leave;
        }
		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;
		}