Switch to GCode view on load if is GCode content
This commit is contained in:
parent
e46737072e
commit
9a43326fd5
3 changed files with 14 additions and 4 deletions
|
|
@ -84,6 +84,12 @@ namespace MatterHackers.MatterControl
|
|||
// Store
|
||||
this.EditContext = editContext;
|
||||
|
||||
var contentInfo = editContext.SourceItem as ILibraryAsset;
|
||||
if (contentInfo != null)
|
||||
{
|
||||
this.ContentType = contentInfo.ContentType;
|
||||
}
|
||||
|
||||
// Load
|
||||
if (editContext.SourceItem is ILibraryAssetStream contentStream
|
||||
&& contentStream.ContentType == "gcode")
|
||||
|
|
@ -351,6 +357,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public bool EditableScene { get; private set; }
|
||||
|
||||
public string ContentType { get; private set; }
|
||||
|
||||
internal void RenderGCode3D(DrawEventArgs e)
|
||||
{
|
||||
if (this.RenderInfo != null)
|
||||
|
|
|
|||
|
|
@ -240,6 +240,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (printerTabPage?.printerActionsBar?.modelViewButton is GuiWidget button)
|
||||
{
|
||||
button.Enabled = sceneContext.EditableScene;
|
||||
|
||||
if (sceneContext.ContentType == "gcode"
|
||||
&& printerTabPage?.printerActionsBar?.layers3DButton is GuiWidget gcodeButton)
|
||||
{
|
||||
gcodeButton.InvokeClick();
|
||||
}
|
||||
}
|
||||
|
||||
this.Invalidate();
|
||||
|
|
|
|||
|
|
@ -30,13 +30,10 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.ImageProcessing;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
|
|
@ -44,7 +41,6 @@ using MatterHackers.Localizations;
|
|||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.Library;
|
||||
using MatterHackers.MeshVisualizer;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue