Make the bed image stay when the bed is not rotating.

Make the print history not crash when rebuilding from separate thread.
This commit is contained in:
larsbrubaker 2014-11-11 17:15:35 -08:00
parent 44ea3fa1ae
commit 239ecbd36d
4 changed files with 12 additions and 7 deletions

View file

@ -52,7 +52,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
protected static readonly int DefaultScrollBarWidth = 120;
protected bool autoRotateEnabled = false;
protected bool autoRotating = false;
protected bool allowAutoRotate = false;
public MeshViewerWidget meshViewerWidget;
event EventHandler unregisterEvents;
@ -90,7 +91,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
// this is to add an image to the bed
string imagePathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "OEMSettings", "bedimage.png");
if (autoRotateEnabled && File.Exists(imagePathAndFile))
if (allowAutoRotate && File.Exists(imagePathAndFile))
{
ImageBuffer wattermarkImage = new ImageBuffer();
ImageIO.LoadImageData(imagePathAndFile, wattermarkImage);

View file

@ -180,7 +180,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
MeshSelectInfo meshSelectInfo;
public override void OnMouseDown(MouseEventArgs mouseEvent)
{
autoRotateEnabled = false;
autoRotating = false;
base.OnMouseDown(mouseEvent);
if (meshViewerWidget.TrackballTumbleWidget.UnderMouseState == Agg.UI.UnderMouseState.FirstUnderMouse)
{
@ -273,7 +273,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public View3DWidget(PrintItemWrapper printItemWrapper, Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape, WindowType windowType, AutoRotate autoRotate, bool openInEditMode = false)
{
this.windowType = windowType;
autoRotateEnabled = (autoRotate == AutoRotate.Enabled);
allowAutoRotate = (autoRotate == AutoRotate.Enabled);
autoRotating = allowAutoRotate;
MeshGroupExtraData = new List<PlatingMeshGroupData>();
MeshGroupExtraData.Add(new PlatingMeshGroupData());
@ -594,7 +595,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Stopwatch timeSinceLastSpin = new Stopwatch();
void AutoSpin(object state)
{
if (!WidgetHasBeenClosed && autoRotateEnabled)
if (!WidgetHasBeenClosed && autoRotating)
{
// add it back in to keep it running.
UiThread.RunOnIdle(AutoSpin);

View file

@ -127,10 +127,10 @@ namespace MatterHackers.MatterControl.PrintHistory
void ReloadData(object sender, EventArgs e)
{
using (TimedLock.Lock(this, "ReloadData PrintHistory"))
UiThread.RunOnIdle((state) =>
{
LoadHistoryItems(Count);
}
});
}
event EventHandler unregisterEvents;

View file

@ -2846,3 +2846,6 @@ Translated:Save to EEProm
English:{0} is not available
Translated:{0} is not available
English:Invalid printer response
Translated:Invalid printer response