2016-04-18 11:31:31 -07:00
|
|
|
|
/*
|
2014-03-17 14:41:26 -07:00
|
|
|
|
Copyright (c) 2014, Kevin Pope
|
|
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
2015-04-08 15:20:10 -07:00
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
2014-03-17 14:41:26 -07:00
|
|
|
|
|
|
|
|
|
|
1. Redistributions of source code must retain the above copyright notice, this
|
2015-04-08 15:20:10 -07:00
|
|
|
|
list of conditions and the following disclaimer.
|
2014-03-17 14:41:26 -07:00
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
|
|
this list of conditions and the following disclaimer in the documentation
|
2015-04-08 15:20:10 -07:00
|
|
|
|
and/or other materials provided with the distribution.
|
2014-03-17 14:41:26 -07:00
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
|
|
The views and conclusions contained in the software and documentation are those
|
2015-04-08 15:20:10 -07:00
|
|
|
|
of the authors and should not be interpreted as representing official policies,
|
2014-03-17 14:41:26 -07:00
|
|
|
|
either expressed or implied, of the FreeBSD Project.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2017-07-28 17:35:04 -07:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
2016-04-18 11:31:31 -07:00
|
|
|
|
using MatterHackers.Agg;
|
2017-08-08 17:49:26 -07:00
|
|
|
|
using MatterHackers.Agg.ImageProcessing;
|
2017-08-20 02:34:39 -07:00
|
|
|
|
using MatterHackers.Agg.Platform;
|
2016-04-18 11:31:31 -07:00
|
|
|
|
using MatterHackers.Agg.UI;
|
2017-08-04 15:42:23 -07:00
|
|
|
|
using MatterHackers.MatterControl.ConfigurationPage;
|
2017-07-28 17:35:04 -07:00
|
|
|
|
using MatterHackers.MatterControl.DataStorage;
|
2016-04-18 11:31:31 -07:00
|
|
|
|
using MatterHackers.MatterControl.PartPreviewWindow;
|
2017-06-16 22:03:42 -07:00
|
|
|
|
using MatterHackers.MatterControl.PrintLibrary;
|
2017-07-28 17:35:04 -07:00
|
|
|
|
using MatterHackers.MatterControl.PrintQueue;
|
2016-04-18 11:31:31 -07:00
|
|
|
|
|
2014-03-17 14:41:26 -07:00
|
|
|
|
namespace MatterHackers.MatterControl
|
2014-04-19 10:35:53 -07:00
|
|
|
|
{
|
2017-06-10 18:40:57 -07:00
|
|
|
|
public class WidescreenPanel : FlowLayoutWidget
|
2015-04-08 15:20:10 -07:00
|
|
|
|
{
|
|
|
|
|
|
public WidescreenPanel()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-06-10 18:40:57 -07:00
|
|
|
|
public override void Initialize()
|
2015-04-08 15:20:10 -07:00
|
|
|
|
{
|
2017-06-10 18:40:57 -07:00
|
|
|
|
base.Initialize();
|
2015-04-08 15:20:10 -07:00
|
|
|
|
|
2017-06-12 14:19:04 -07:00
|
|
|
|
this.AnchorAll();
|
|
|
|
|
|
this.Name = "WidescreenPanel";
|
2015-04-08 15:20:10 -07:00
|
|
|
|
|
2017-06-13 12:31:50 -07:00
|
|
|
|
// HACK: Long term we need a better solution which does not rely on ActivePrintItem/PrintItemWrapper
|
2017-06-16 18:04:47 -07:00
|
|
|
|
if (ApplicationController.Instance.ActivePrintItem == null)
|
2017-06-13 12:31:50 -07:00
|
|
|
|
{
|
2017-07-28 17:35:04 -07:00
|
|
|
|
// Find the last used bed plate mcx
|
|
|
|
|
|
var directoryInfo = new DirectoryInfo(ApplicationDataStorage.Instance.PlatingDirectory);
|
|
|
|
|
|
var firstFile = directoryInfo.GetFileSystemInfos("*.mcx").OrderByDescending(fl => fl.CreationTime).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
// Set as the current item - should be restored as the Active scene in the MeshViewer
|
2017-07-31 15:45:31 -07:00
|
|
|
|
if (firstFile != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
ApplicationController.Instance.ActivePrintItem = new PrintItemWrapper(new PrintItem(firstFile.Name, firstFile.FullName));
|
|
|
|
|
|
}
|
2017-06-13 12:31:50 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-07-31 16:07:45 -07:00
|
|
|
|
// Clear if not assigned above
|
|
|
|
|
|
if (ApplicationController.Instance.ActivePrintItem == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
ApplicationController.Instance.ClearPlate();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-06-12 14:19:04 -07:00
|
|
|
|
var library3DViewSplitter = new Splitter()
|
|
|
|
|
|
{
|
|
|
|
|
|
Padding = new BorderDouble(4),
|
2017-06-17 10:46:01 -07:00
|
|
|
|
SplitterDistance = 254,
|
2017-06-17 11:53:33 -07:00
|
|
|
|
SplitterWidth = ApplicationController.Instance.Theme.SplitterWidth,
|
2017-06-12 14:19:04 -07:00
|
|
|
|
SplitterBackground = ApplicationController.Instance.Theme.SplitterBackground
|
|
|
|
|
|
};
|
2017-06-10 18:40:57 -07:00
|
|
|
|
library3DViewSplitter.AnchorAll();
|
2017-06-13 13:43:51 -07:00
|
|
|
|
|
|
|
|
|
|
this.AddChild(library3DViewSplitter);
|
Move to new library model and view
- Add new listview control for library content
- Migrate library providers to containers
- Cloud, Sqlite, Directories, Queue, History
- Migrate SideBar components to containers
- Primatives, Text, Braille, ImageConverter
- Create new library container types
- Zip files, Calibration parts, Printer SDCards
- Reduce leftnav to Library, Settings, Controls, Options
- Add DragDrop support for image content
2017-05-19 22:33:55 -07:00
|
|
|
|
|
2017-08-04 15:42:23 -07:00
|
|
|
|
var leftNav = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
|
|
|
|
|
leftNav.AnchorAll();
|
|
|
|
|
|
|
|
|
|
|
|
leftNav.AddChild(new BrandMenuButton()
|
|
|
|
|
|
{
|
|
|
|
|
|
MinimumSize = new VectorMath.Vector2(0, 40),
|
2017-08-07 15:47:27 -07:00
|
|
|
|
HAnchor = HAnchor.Stretch,
|
|
|
|
|
|
VAnchor = VAnchor.Fit
|
2017-08-04 15:42:23 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
leftNav.AddChild(new PrintLibraryWidget());
|
|
|
|
|
|
|
2017-06-10 18:40:57 -07:00
|
|
|
|
// put in the left column
|
2017-08-04 15:42:23 -07:00
|
|
|
|
library3DViewSplitter.Panel1.AddChild(leftNav);
|
2017-06-09 14:42:16 -07:00
|
|
|
|
|
2017-06-10 18:40:57 -07:00
|
|
|
|
// put in the right column
|
2017-07-06 12:26:13 -07:00
|
|
|
|
library3DViewSplitter.Panel2.AddChild(new PartPreviewContent(ApplicationController.Instance.ActivePrintItem)
|
2017-06-10 18:40:57 -07:00
|
|
|
|
{
|
2017-08-07 15:47:27 -07:00
|
|
|
|
VAnchor = VAnchor.Bottom | VAnchor.Top,
|
|
|
|
|
|
HAnchor = HAnchor.Left | HAnchor.Right
|
2017-06-10 18:40:57 -07:00
|
|
|
|
});
|
2015-04-08 15:20:10 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-08-04 15:42:23 -07:00
|
|
|
|
public class BrandMenuButton : GuiWidget
|
|
|
|
|
|
{
|
|
|
|
|
|
public BrandMenuButton()
|
|
|
|
|
|
{
|
2017-08-30 13:41:49 -07:00
|
|
|
|
Name = "MatterControl BrandMenuButton";
|
2017-08-04 15:42:23 -07:00
|
|
|
|
var buttonView = new FlowLayoutWidget()
|
|
|
|
|
|
{
|
2017-08-07 15:47:27 -07:00
|
|
|
|
HAnchor = HAnchor.Stretch,
|
|
|
|
|
|
VAnchor = VAnchor.Fit,
|
2017-08-14 11:53:45 -07:00
|
|
|
|
Margin = 6
|
2017-08-04 15:42:23 -07:00
|
|
|
|
};
|
2017-08-12 12:26:34 -07:00
|
|
|
|
|
2017-08-20 02:34:39 -07:00
|
|
|
|
var icon = AggContext.StaticData.LoadImage(Path.Combine("Images", "mh-app-logo.png"));
|
2017-08-12 12:19:07 -07:00
|
|
|
|
if (ActiveTheme.Instance.IsDarkTheme)
|
2017-08-12 00:51:34 -07:00
|
|
|
|
{
|
|
|
|
|
|
icon = icon.InvertLightness();
|
|
|
|
|
|
}
|
|
|
|
|
|
buttonView.AddChild(new ImageWidget(icon));
|
2017-08-04 15:42:23 -07:00
|
|
|
|
|
2017-08-12 12:26:34 -07:00
|
|
|
|
buttonView.AddChild(new TextWidget("MatterControl", textColor: ActiveTheme.Instance.PrimaryTextColor)
|
2017-08-04 15:42:23 -07:00
|
|
|
|
{
|
2017-08-12 12:26:34 -07:00
|
|
|
|
Margin = new BorderDouble(left: 8),
|
2017-08-07 15:47:27 -07:00
|
|
|
|
VAnchor = VAnchor.Center
|
2017-08-04 15:42:23 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var popupButton = new PopupButton(buttonView)
|
|
|
|
|
|
{
|
2017-08-07 15:47:27 -07:00
|
|
|
|
VAnchor = VAnchor.Center,
|
|
|
|
|
|
HAnchor = HAnchor.Stretch,
|
2017-08-04 15:42:23 -07:00
|
|
|
|
Margin = 0
|
|
|
|
|
|
};
|
|
|
|
|
|
popupButton.PopupContent = new ApplicationSettingsWidget(ApplicationController.Instance.Theme.MenuButtonFactory)
|
|
|
|
|
|
{
|
2017-08-07 15:47:27 -07:00
|
|
|
|
HAnchor = HAnchor.Absolute,
|
|
|
|
|
|
VAnchor = VAnchor.Fit,
|
2017-08-04 15:42:23 -07:00
|
|
|
|
Width = 500,
|
|
|
|
|
|
BackgroundColor = RGBA_Bytes.White
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.AddChild(popupButton);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-07-02 14:36:04 -07:00
|
|
|
|
public class UpdateNotificationMark : GuiWidget
|
2015-04-08 15:20:10 -07:00
|
|
|
|
{
|
2015-06-15 09:55:38 -07:00
|
|
|
|
public UpdateNotificationMark()
|
2015-04-08 15:20:10 -07:00
|
|
|
|
: base(12, 12)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void OnDraw(Graphics2D graphics2D)
|
|
|
|
|
|
{
|
|
|
|
|
|
graphics2D.Circle(Width / 2, Height / 2, Width / 2, RGBA_Bytes.White);
|
|
|
|
|
|
graphics2D.Circle(Width / 2, Height / 2, Width / 2 - 1, RGBA_Bytes.Red);
|
|
|
|
|
|
graphics2D.FillRectangle(Width / 2 - 1, Height / 2 - 3, Width / 2 + 1, Height / 2 + 3, RGBA_Bytes.White);
|
|
|
|
|
|
base.OnDraw(graphics2D);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-08-20 02:34:39 -07:00
|
|
|
|
}
|