void DoneLoadingGCode(object sender, EventArgs e)
        {
            gcodeProcessingStateInfoText.Text = "";
            if (gcodeViewWidget != null &&
                gcodeViewWidget.LoadedGCode != null &&
                gcodeViewWidget.LoadedGCode.GCodeCommandQueue.Count > 0 &&
                gcodeViewWidget.LoadedGCode.GCodeCommandQueue[0].secondsToEndFromHere > 0)
            {
                CreateOptionsContent();

                SetLayerWidget setLayerWidget = new SetLayerWidget(gcodeViewWidget);
                setLayerWidget.VAnchor = Agg.UI.VAnchor.ParentTop;
                layerSelectionButtonsPannel.AddChild(setLayerWidget);

                LayerNavigationWidget navigationWidget = new LayerNavigationWidget(gcodeViewWidget);
                navigationWidget.Margin = new BorderDouble(0, 0, 20, 0);
                layerSelectionButtonsPannel.AddChild(navigationWidget);


                selectLayerSlider = new Slider(new Vector2(), 10, 0, gcodeViewWidget.gCodeView.NumLayers - 1, Orientation.Vertical);
                selectLayerSlider.ValueChanged     += new EventHandler(selectLayerSlider_ValueChanged);
                gcodeViewWidget.ActiveLayerChanged += new EventHandler(gcodeViewWidget_ActiveLayerChanged);
                AddChild(selectLayerSlider);
                SetSliderSize();

                BoundsChanged += new EventHandler(PartPreviewGCode_BoundsChanged);
            }
        }
        void DoneLoadingGCode(object sender, EventArgs e)
        {
            SetProcessingMessage("");
            if (gcodeViewWidget != null &&
                gcodeViewWidget.LoadedGCode != null &&
                gcodeViewWidget.LoadedGCode.Count > 0)
            {
                CreateOptionsContent();
                buttonRightPanel.Visible   = true;
                viewControlsToggle.Visible = true;

                CloseIfNotNull(setLayerWidget);
                setLayerWidget         = new SetLayerWidget(gcodeViewWidget);
                setLayerWidget.VAnchor = Agg.UI.VAnchor.ParentTop;
                layerSelectionButtonsPanel.AddChild(setLayerWidget);

                CloseIfNotNull(navigationWidget);
                navigationWidget        = new LayerNavigationWidget(gcodeViewWidget);
                navigationWidget.Margin = new BorderDouble(0, 0, 20, 0);
                layerSelectionButtonsPanel.AddChild(navigationWidget);

                CloseIfNotNull(selectLayerSlider);
                selectLayerSlider = new SolidSlider(new Vector2(), sliderWidth, 0, gcodeViewWidget.LoadedGCode.NumChangesInZ - 1, Orientation.Vertical);
                selectLayerSlider.ValueChanged     += new EventHandler(selectLayerSlider_ValueChanged);
                gcodeViewWidget.ActiveLayerChanged += new EventHandler(gcodeViewWidget_ActiveLayerChanged);
                AddChild(selectLayerSlider);

                CloseIfNotNull(layerRenderRatioSlider);
                layerRenderRatioSlider                     = new DoubleSolidSlider(new Vector2(), sliderWidth);
                layerRenderRatioSlider.FirstValue          = 0;
                layerRenderRatioSlider.FirstValueChanged  += new EventHandler(layerStartRenderRatioSlider_ValueChanged);
                layerRenderRatioSlider.SecondValue         = 1;
                layerRenderRatioSlider.SecondValueChanged += new EventHandler(layerEndRenderRatioSlider_ValueChanged);
                AddChild(layerRenderRatioSlider);

                SetSliderSizes();

                // let's change the active layer so that it is set to the first layer with data
                gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex + 1;
                gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex - 1;

                BoundsChanged += new EventHandler(PartPreviewGCode_BoundsChanged);

                meshViewerWidget.partProcessingInfo.Visible = false;
            }
        }
Exemple #3
0
        void DoneLoadingGCode(object sender, EventArgs e)
        {
            SetProcessingMessage("");
            if (gcodeViewWidget != null &&
                gcodeViewWidget.LoadedGCode != null &&
                gcodeViewWidget.LoadedGCode.GCodeCommandQueue.Count > 0)
            {
                CreateOptionsContent();

                SetLayerWidget setLayerWidget = new SetLayerWidget(gcodeViewWidget);
                setLayerWidget.VAnchor = Agg.UI.VAnchor.ParentTop;
                layerSelectionButtonsPanel.AddChild(setLayerWidget);

                LayerNavigationWidget navigationWidget = new LayerNavigationWidget(gcodeViewWidget);
                navigationWidget.Margin = new BorderDouble(0, 0, 20, 0);
                layerSelectionButtonsPanel.AddChild(navigationWidget);

                selectLayerSlider = new Slider(new Vector2(), 10, 0, gcodeViewWidget.LoadedGCode.NumChangesInZ - 1, Orientation.Vertical);
                selectLayerSlider.ValueChanged     += new EventHandler(selectLayerSlider_ValueChanged);
                gcodeViewWidget.ActiveLayerChanged += new EventHandler(gcodeViewWidget_ActiveLayerChanged);
                AddChild(selectLayerSlider);

                AddChild(new TextWidget(LocalizedString.Get("start:"), 50, 77, 10, Agg.Font.Justification.Right));
                layerStartRenderRatioSlider = new Slider(new Vector2(), 10);
                layerStartRenderRatioSlider.ValueChanged += new EventHandler(layerStartRenderRatioSlider_ValueChanged);
                AddChild(layerStartRenderRatioSlider);

                AddChild(new TextWidget(LocalizedString.Get("end:"), 50, 57, 10, Agg.Font.Justification.Right));
                layerEndRenderRatioSlider               = new Slider(new Vector2(), 10);
                layerEndRenderRatioSlider.Value         = 1;
                layerEndRenderRatioSlider.ValueChanged += new EventHandler(layerEndRenderRatioSlider_ValueChanged);
                AddChild(layerEndRenderRatioSlider);

                SetSliderSizes();

                // let's change the active layer so that it is set to the first layer with data
                gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex + 1;
                gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex - 1;

                BoundsChanged += new EventHandler(PartPreviewGCode_BoundsChanged);
            }
        }
		private void DoneLoadingGCode(object sender, EventArgs e)
		{
			SetProcessingMessage("");
			if (gcodeViewWidget != null
				&& gcodeViewWidget.LoadedGCode == null)
			{
				// If we have finished loading the gcode and the source file exists but we don't have any loaded gcode it is because the loader decided to not load it.
				if (File.Exists(printItem.FileLocation))
				{
					SetProcessingMessage(string.Format(fileTooBigToLoad, printItem.Name));
				}
				else
				{
					SetProcessingMessage(string.Format("{0}\n'{1}'", fileNotFoundMessage, Path.GetFileName(printItem.FileLocation)));
				}
			}

			if (gcodeViewWidget != null
				&& gcodeViewWidget.LoadedGCode != null
				&& gcodeViewWidget.LoadedGCode.LineCount > 0)
			{
				CloseIfNotNull(gradientWidget);
				gradientWidget = new ColorGradientWidget(gcodeViewWidget.LoadedGCode);
				AddChild(gradientWidget);
				gradientWidget.Visible = false;

				CreateOptionsContent();
				setGradientVisibility();
				buttonRightPanel.Visible = true;
				viewControlsToggle.Visible = true;

				CloseIfNotNull(setLayerWidget);
				setLayerWidget = new SetLayerWidget(gcodeViewWidget);
				setLayerWidget.VAnchor = Agg.UI.VAnchor.ParentTop;
				layerSelectionButtonsPanel.AddChild(setLayerWidget);

				CloseIfNotNull(navigationWidget);
				navigationWidget = new LayerNavigationWidget(gcodeViewWidget);
				navigationWidget.Margin = new BorderDouble(0, 0, 20, 0);
				layerSelectionButtonsPanel.AddChild(navigationWidget);

				CloseIfNotNull(selectLayerSlider);
				selectLayerSlider = new SolidSlider(new Vector2(), sliderWidth, 0, gcodeViewWidget.LoadedGCode.NumChangesInZ - 1, Orientation.Vertical);
				selectLayerSlider.ValueChanged += new EventHandler(selectLayerSlider_ValueChanged);
				gcodeViewWidget.ActiveLayerChanged += new EventHandler(gcodeViewWidget_ActiveLayerChanged);
				AddChild(selectLayerSlider);

				CloseIfNotNull(layerRenderRatioSlider);
				layerRenderRatioSlider = new DoubleSolidSlider(new Vector2(), sliderWidth);
				layerRenderRatioSlider.FirstValue = 0;
				layerRenderRatioSlider.FirstValueChanged += new EventHandler(layerStartRenderRatioSlider_ValueChanged);
				layerRenderRatioSlider.SecondValue = 1;
				layerRenderRatioSlider.SecondValueChanged += new EventHandler(layerEndRenderRatioSlider_ValueChanged);
				AddChild(layerRenderRatioSlider);

				SetSliderSizes();

				// let's change the active layer so that it is set to the first layer with data
				gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex + 1;
				gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex - 1;

				BoundsChanged += new EventHandler(PartPreviewGCode_BoundsChanged);

				meshViewerWidget.partProcessingInfo.Visible = false;
			}
		}
        void DoneLoadingGCode(object sender, EventArgs e)
        {
            gcodeProcessingStateInfoText.Text = "";
            if (gcodeViewWidget != null
                && gcodeViewWidget.LoadedGCode != null
                && gcodeViewWidget.LoadedGCode.GCodeCommandQueue.Count > 0
                && gcodeViewWidget.LoadedGCode.GCodeCommandQueue[0].secondsToEndFromHere > 0)
            {
                CreateOptionsContent();

                SetLayerWidget setLayerWidget = new SetLayerWidget(gcodeViewWidget);
                setLayerWidget.VAnchor = Agg.UI.VAnchor.ParentTop;
                layerSelectionButtonsPannel.AddChild(setLayerWidget);

                LayerNavigationWidget navigationWidget = new LayerNavigationWidget(gcodeViewWidget);
                navigationWidget.Margin = new BorderDouble(0, 0, 20, 0);
                layerSelectionButtonsPannel.AddChild(navigationWidget);

                selectLayerSlider = new Slider(new Vector2(), 10, 0, gcodeViewWidget.LoadedGCode.NumChangesInZ - 1, Orientation.Vertical);
                selectLayerSlider.ValueChanged += new EventHandler(selectLayerSlider_ValueChanged);
                gcodeViewWidget.ActiveLayerChanged += new EventHandler(gcodeViewWidget_ActiveLayerChanged);
                AddChild(selectLayerSlider);
                SetSliderSize();

                // let's change the active layer so that it is set to the first layer with data
                gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex + 1;
                gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex - 1;

                BoundsChanged += new EventHandler(PartPreviewGCode_BoundsChanged);
            }
        }
        void DoneLoadingGCode(object sender, EventArgs e)
        {
            SetProcessingMessage("");
            if (gcodeViewWidget != null
                && gcodeViewWidget.LoadedGCode != null
                && gcodeViewWidget.LoadedGCode.Count > 0)
            {
                CreateOptionsContent();

                setLayerWidget = new SetLayerWidget(gcodeViewWidget);
                setLayerWidget.VAnchor = Agg.UI.VAnchor.ParentTop;
                layerSelectionButtonsPanel.AddChild(setLayerWidget);

                navigationWidget = new LayerNavigationWidget(gcodeViewWidget);
                navigationWidget.Margin = new BorderDouble(0, 0, 20, 0);
                layerSelectionButtonsPanel.AddChild(navigationWidget);

                selectLayerSlider = new Slider(new Vector2(), 10, 0, gcodeViewWidget.LoadedGCode.NumChangesInZ - 1, Orientation.Vertical);
                selectLayerSlider.ValueChanged += new EventHandler(selectLayerSlider_ValueChanged);
                gcodeViewWidget.ActiveLayerChanged += new EventHandler(gcodeViewWidget_ActiveLayerChanged);
                AddChild(selectLayerSlider);

                layerStartRenderRatioTitle = new TextWidget(LocalizedString.Get("start:"), 50, 77, 10, Agg.Font.Justification.Right);
                AddChild(layerStartRenderRatioTitle);
                layerStartRenderRatioSlider = new Slider(new Vector2(), 10);
                layerStartRenderRatioSlider.ValueChanged += new EventHandler(layerStartRenderRatioSlider_ValueChanged);
                AddChild(layerStartRenderRatioSlider);

                layerEndRenderRationTitle = new TextWidget(LocalizedString.Get("end:"), 50, 57, 10, Agg.Font.Justification.Right);
                AddChild(layerEndRenderRationTitle);
                layerEndRenderRatioSlider = new Slider(new Vector2(), 10);
                layerEndRenderRatioSlider.Value = 1;
                layerEndRenderRatioSlider.ValueChanged += new EventHandler(layerEndRenderRatioSlider_ValueChanged);
                AddChild(layerEndRenderRatioSlider);

                SetSliderSizes();

                // let's change the active layer so that it is set to the first layer with data
                gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex + 1;
                gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex - 1;

                BoundsChanged += new EventHandler(PartPreviewGCode_BoundsChanged);

                meshViewerWidget.partProcessingInfo.Visible = false;
            }
        }