Ejemplo n.º 1
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);
		}
        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);
        }
Ejemplo n.º 3
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
            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);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        void LoadColumnTwo(object state = null)
        {
            ColumnTwo.CloseAndRemoveAllChildren();

            double buildHeight = ActiveSliceSettings.Instance.BuildHeight;
            part3DView = new View3DTransformPart(PrinterConnectionAndCommunication.Instance.ActivePrintItem, 
                new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), 
                ActiveSliceSettings.Instance.BedCenter,
                ActiveSliceSettings.Instance.BedShape, 
                View3DTransformPart.WindowType.Embeded, 
                View3DTransformPart.AutoRotate.Enabled);
            part3DView.Margin = new BorderDouble(bottom: 4);
            part3DView.AnchorAll();

            partGcodeView = new ViewGcodeBasic(PrinterConnectionAndCommunication.Instance.ActivePrintItem, 
                new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),
                ActiveSliceSettings.Instance.BedCenter, 
                ActiveSliceSettings.Instance.BedShape, 
                false);
            partGcodeView.AnchorAll();

            ColumnTwo.AddChild(part3DView);
            ColumnTwo.AddChild(partGcodeView);
            ColumnTwo.AnchorAll();
        }
        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();
            }
        }