Merge remote-tracking branch 'origin/development' into development

Conflicts:
	MatterControl.sln
This commit is contained in:
larsbrubaker 2014-04-28 08:10:24 -07:00
commit 401d054c71
12 changed files with 346 additions and 50 deletions

View file

@ -110,7 +110,7 @@ namespace MatterHackers.MatterControl.ActionBar
protected double borderWidth;
protected double borderRadius;
protected double padding;
protected double statusTextHeight = 10;
protected double statusTextHeight = 8;
TextWidget printerStatusText;
TextWidget printerNameText;
@ -133,7 +133,7 @@ namespace MatterHackers.MatterControl.ActionBar
this.fillColor = fillColor;
this.borderColor = borderColor;
this.padding = padding;
this.Padding = new BorderDouble(10, 5);
this.Padding = new BorderDouble(10, 3);
this.HAnchor = HAnchor.ParentLeftRight;
FlowLayoutWidget textContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
@ -240,10 +240,10 @@ namespace MatterHackers.MatterControl.ActionBar
public class PrinterSelectButton : Button
{
double width = 180;
double height = 48;
double height = 40;
double borderRadius = 0;
double borderWidth = 1;
double fontSize = 16;
double fontSize = 14;
double padding = 3;
BorderDouble margin = new BorderDouble(0, 0);

View file

@ -48,14 +48,14 @@ namespace MatterHackers.MatterControl.ActionBar
actionBarButtonFactory.invertImageLocation = false;
string connectString = "Connect".Localize().ToUpper();
connectPrinterButton = actionBarButtonFactory.Generate(connectString, "icon_power_32x32.png");
connectPrinterButton.Margin = new BorderDouble(0, 0, 3);
connectPrinterButton.VAnchor = VAnchor.ParentCenter;
connectPrinterButton.Margin = new BorderDouble(0, 0, 3, 3);
connectPrinterButton.VAnchor = VAnchor.ParentTop;
connectPrinterButton.Cursor = Cursors.Hand;
string disconnectString = "Disconnect".Localize().ToUpper();
disconnectPrinterButton = actionBarButtonFactory.Generate(disconnectString, "icon_power_32x32.png");
disconnectPrinterButton.Margin = new BorderDouble(0, 0, 3);
disconnectPrinterButton.VAnchor = VAnchor.ParentCenter;
disconnectPrinterButton.Margin = new BorderDouble(0, 0, 3, 3);
disconnectPrinterButton.VAnchor = VAnchor.ParentTop;
disconnectPrinterButton.Visible = false;
disconnectPrinterButton.Cursor = Cursors.Hand;
@ -64,11 +64,11 @@ namespace MatterHackers.MatterControl.ActionBar
selectActivePrinterButton.Cursor = Cursors.Hand;
if (ApplicationWidget.Instance.WidescreenMode)
{
selectActivePrinterButton.Margin = new BorderDouble(0, 6);
selectActivePrinterButton.Margin = new BorderDouble(0, 6,0,3);
}
else
{
selectActivePrinterButton.Margin = new BorderDouble(0, 6, 6, 6);
selectActivePrinterButton.Margin = new BorderDouble(0, 6, 6, 3);
}
@ -80,33 +80,6 @@ namespace MatterHackers.MatterControl.ActionBar
//this.AddChild(CreateOptionsMenu());
}
GuiWidget CreateOptionsMenu()
{
ImageBuffer gearImage = new ImageBuffer();
string imagePathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "gear_icon.png");
ImageIO.LoadImageData(imagePathAndFile, gearImage);
FlowLayoutWidget leftToRight = new FlowLayoutWidget();
leftToRight.Margin = new BorderDouble(5, 0);
string optionsString = "Options".Localize().ToUpper();
TextWidget optionsText = new TextWidget(optionsString, textColor: ActiveTheme.Instance.PrimaryTextColor);
optionsText.VAnchor = Agg.UI.VAnchor.ParentCenter;
optionsText.Margin = new BorderDouble(0, 0, 3, 0);
leftToRight.AddChild(optionsText);
GuiWidget gearWidget = new ImageWidget(gearImage);
gearWidget.VAnchor = Agg.UI.VAnchor.ParentCenter;
leftToRight.AddChild(gearWidget);
leftToRight.HAnchor = HAnchor.FitToChildren;
leftToRight.VAnchor = VAnchor.FitToChildren;
Menu optionMenu = new Menu(leftToRight);
optionMenu.OpenOffset = new Vector2(-2, -10);
optionMenu.VAnchor = Agg.UI.VAnchor.ParentCenter;
optionMenu.MenuItems.Add(new MenuItem(new ThemeColorSelectorWidget()));
return optionMenu;
}
event EventHandler unregisterEvents;
protected override void AddHandlers()
{

View file

@ -0,0 +1,266 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using MatterHackers.Agg;
using MatterHackers.Agg.Transform;
using MatterHackers.Agg.Image;
using MatterHackers.Agg.VertexSource;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.Font;
using MatterHackers.VectorMath;
using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl
{
public class ApplicationMenuRow : FlowLayoutWidget
{
static FlowLayoutWidget rightElement;
public ApplicationMenuRow()
:base(FlowDirection.LeftToRight)
{
LinkButtonFactory linkButtonFactory = new LinkButtonFactory();
linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor;
linkButtonFactory.fontSize = 8;
Button signInLink = linkButtonFactory.Generate("(Sign Out)");
signInLink.VAnchor = Agg.UI.VAnchor.ParentCenter;
signInLink.Margin = new BorderDouble(top: 0);
this.HAnchor = HAnchor.ParentLeftRight;
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
MenuOptionFile menuOptionFile = new MenuOptionFile();
//TextWidget menuOptionFile = new TextWidget("FILE", pointSize: 10);
//menuOptionFile.TextColor = ActiveTheme.Instance.PrimaryTextColor;
MenuOptionHelp menuOptionHelp = new MenuOptionHelp();
rightElement = new FlowLayoutWidget(FlowDirection.LeftToRight);
rightElement.Height = 24;
rightElement.Margin = new BorderDouble(bottom: 4);
//rightElement.VAnchor = Agg.UI.VAnchor.ParentCenter;
this.AddChild(menuOptionFile);
this.AddChild(menuOptionHelp);
this.AddChild(new HorizontalSpacer());
this.AddChild(rightElement);
this.Padding = new BorderDouble(0, 0, 6, 0);
if (privateAddRightElement != null)
{
privateAddRightElement(rightElement);
}
}
public delegate void AddRightElementDelegate(GuiWidget iconContainer);
private static event AddRightElementDelegate privateAddRightElement;
public static event AddRightElementDelegate AddRightElement
{
add
{
privateAddRightElement += value;
// and call it right away
value(rightElement);
}
remove
{
privateAddRightElement -= value;
}
}
}
public class MenuOptionFile : GuiWidget
{
public DropDownMenu MenuDropList;
private TupleList<string, Func<bool>> menuItems;
public MenuOptionFile()
{
MenuDropList = new DropDownMenu("File".Localize().ToUpper(), Direction.Down,pointSize:10);
MenuDropList.MenuItemsPadding = new BorderDouble(0);
MenuDropList.Margin = new BorderDouble(0);
MenuDropList.Padding = new BorderDouble(0);
SetMenuItems();
AddChild(MenuDropList);
this.Width = 44;
this.Height = 22;
this.Margin = new BorderDouble(0);
this.Padding = new BorderDouble(0);
this.VAnchor = Agg.UI.VAnchor.ParentCenter;
this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged);
this.MenuDropList.OpenOffset = new Vector2(0, 0);
}
void MenuDropList_SelectionChanged(object sender, EventArgs e)
{
string menuSelection = ((DropDownMenu)sender).SelectedValue;
foreach (Tuple<string, Func<bool>> item in menuItems)
{
if (item.Item1 == menuSelection)
{
if (item.Item2 != null)
{
item.Item2();
}
}
}
}
void SetMenuItems()
{
menuItems = new TupleList<string, Func<bool>>
{
{LocalizedString.Get("Import File"), importFile_Click},
{LocalizedString.Get("Exit"), exit_Click},
};
BorderDouble padding = MenuDropList.MenuItemsPadding;
//Add the menu items to the menu itself
foreach (Tuple<string, Func<bool>> item in menuItems)
{
MenuDropList.MenuItemsPadding = new BorderDouble(8,4,8,4);
MenuDropList.AddItem(item.Item1,pointSize:10);
}
MenuDropList.Padding = padding;
}
bool importFile_Click()
{
UiThread.RunOnIdle((state) =>
{
OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file, Select a GCODE file|*.stl;*.gcode", multiSelect: true);
openParams.ActionButtonLabel = "Add to Queue";
openParams.Title = "MatterControl: Select A File";
FileDialog.OpenFileDialog(ref openParams);
if (openParams.FileNames != null)
{
foreach (string loadedFileName in openParams.FileNames)
{
QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(loadedFileName), Path.GetFullPath(loadedFileName))));
}
}
});
return true;
}
bool exit_Click()
{
UiThread.RunOnIdle((state) =>
{
GuiWidget parent = this;
while (parent as MatterControlApplication == null)
{
parent = parent.Parent;
}
MatterControlApplication app = parent as MatterControlApplication;
app.RestartOnClose = false;
app.Close();
});
return true;
}
}
public class MenuOptionHelp : GuiWidget
{
public DropDownMenu MenuDropList;
private TupleList<string, Func<bool>> menuItems;
public MenuOptionHelp()
{
MenuDropList = new DropDownMenu("Help".Localize().ToUpper(), Direction.Down, pointSize: 10);
MenuDropList.MenuItemsPadding = new BorderDouble(0);
MenuDropList.Margin = new BorderDouble(0);
MenuDropList.Padding = new BorderDouble(0);
SetMenuItems();
AddChild(MenuDropList);
this.Width = 48;
this.Height = 22;
this.Margin = new BorderDouble(0);
this.Padding = new BorderDouble(0);
this.VAnchor = Agg.UI.VAnchor.ParentCenter;
this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged);
this.MenuDropList.OpenOffset = new Vector2(0, 0);
}
void MenuDropList_SelectionChanged(object sender, EventArgs e)
{
string menuSelection = ((DropDownMenu)sender).SelectedValue;
foreach (Tuple<string, Func<bool>> item in menuItems)
{
if (item.Item1 == menuSelection)
{
if (item.Item2 != null)
{
item.Item2();
}
}
}
}
void SetMenuItems()
{
menuItems = new TupleList<string, Func<bool>>
{
{LocalizedString.Get("Getting Started"), gettingStarted_Click},
{LocalizedString.Get("View Help"), help_Click},
{LocalizedString.Get("About"), about_Click},
};
BorderDouble padding = MenuDropList.MenuItemsPadding;
//Add the menu items to the menu itself
foreach (Tuple<string, Func<bool>> item in menuItems)
{
MenuDropList.MenuItemsPadding = new BorderDouble(8, 4, 8, 4);
MenuDropList.AddItem(item.Item1, pointSize: 10);
}
MenuDropList.Padding = padding;
}
bool help_Click()
{
UiThread.RunOnIdle((state) =>
{
System.Diagnostics.Process.Start("http://www.mattercontrol.com/articles");
});
return true;
}
bool about_Click()
{
UiThread.RunOnIdle((state) =>
{
System.Diagnostics.Process.Start("http://www.mattercontrol.com/");
});
return true;
}
bool gettingStarted_Click()
{
UiThread.RunOnIdle((state) =>
{
System.Diagnostics.Process.Start("http://www.mattercontrol.com/articles/mattercontrol-getting-started");
});
return true;
}
}
}

View file

@ -45,6 +45,7 @@ using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.PrintLibrary;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl
@ -68,13 +69,30 @@ namespace MatterHackers.MatterControl
}
WidescreenPanel widescreenPanel;
public void AddElements()
void AddElements()
{
//this.AddChild(new CompactSlidePanel());
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
container.AnchorAll();
ApplicationMenuRow menuRow = new ApplicationMenuRow();
container.AddChild(menuRow);
GuiWidget menuSeparator = new GuiWidget();
menuSeparator.BackgroundColor = new RGBA_Bytes(200, 200, 200);
menuSeparator.Height = 2;
menuSeparator.HAnchor = HAnchor.ParentLeftRight;
menuSeparator.Margin = new BorderDouble(3, 0);
container.AddChild(menuSeparator);
widescreenPanel = new WidescreenPanel();
this.AddChild(widescreenPanel);
this.AnchorAll();
SetUpdateNotification(this, null);
container.AddChild(widescreenPanel);
this.AddChild(container);
}
public void ReloadAll(object sender, EventArgs e)
@ -82,19 +100,25 @@ namespace MatterHackers.MatterControl
UiThread.RunOnIdle((state) =>
{
this.RemoveAllChildren();
widescreenPanel = new WidescreenPanel();
this.AddChild(widescreenPanel);
AddElements();
});
}
void Initialize()
{
this.AnchorAll();
SetUpdateNotification(this, null);
}
public static ApplicationWidget Instance
{
get
{
if (globalInstance == null)
{
globalInstance = new ApplicationWidget();
globalInstance = new ApplicationWidget();
globalInstance.AddElements();
globalInstance.Initialize();
}
return globalInstance;
}

View file

@ -92,6 +92,7 @@
<Compile Include="ActionBar\PrintStatusRow.cs" />
<Compile Include="ActionBar\TemperatureWidgetBase.cs" />
<Compile Include="ActionBar\TemperatureWidgetExtruder.cs" />
<Compile Include="ApplicationView\ApplicationMenuRow.cs" />
<Compile Include="ApplicationView\CompactSlidePanel.cs" />
<Compile Include="ApplicationView\MainScreenTabView.cs" />
<Compile Include="ConfigurationPage\LanguageSelector.cs" />
@ -105,7 +106,7 @@
<Compile Include="CustomWidgets\DisableableWidget.cs" />
<Compile Include="CustomWidgets\ExportPrintItemWindow.cs" />
<Compile Include="PrintLibrary\LibraryData.cs" />
<Compile Include="PrintQueue\OptionsMenue\ExportToFolderFeedbackWindow.cs" />
<Compile Include="PrintQueue\OptionsMenu\ExportToFolderFeedbackWindow.cs" />
<Compile Include="EeProm\EePromMarlinSettings.cs" />
<Compile Include="PrinterControls\EditLevelingSettingsWindow.cs" />
<Compile Include="PrintHistory\PrintHistoryListControl.cs" />
@ -151,7 +152,7 @@
<Compile Include="ControlElements\ImageButtonFactory.cs" />
<Compile Include="ControlElements\LinkButtonFactory.cs" />
<Compile Include="CustomWidgets\PrintProgressBarWidget.cs" />
<Compile Include="PrintQueue\OptionsMenue\ExportToSdCardFeedbackWindow.cs" />
<Compile Include="PrintQueue\OptionsMenu\ExportToSdCardFeedbackWindow.cs" />
<Compile Include="CustomWidgets\SlidePanelWidget.cs" />
<Compile Include="CustomWidgets\StyledDropDownList.cs" />
<Compile Include="ControlElements\StyledMessageBoxWindow.cs" />
@ -170,7 +171,7 @@
<Compile Include="ControlElements\MHTextEditWidget.cs" />
<Compile Include="PartPreviewWindow\GcodeViewBasic.cs" />
<Compile Include="PartPreviewWindow\PartPreviewMainWindow.cs" />
<Compile Include="PrintQueue\OptionsMenue\PartsSheetCreator.cs" />
<Compile Include="PrintQueue\OptionsMenu\PartsSheetCreator.cs" />
<Compile Include="Utilities\WebUtilities\JsonResponseDictionary.cs" />
<Compile Include="PrinterCommunication\PrinterCommunication.cs" />
<Compile Include="PrinterControls\PrintLeveling.cs" />
@ -195,13 +196,13 @@
<Compile Include="PrintLibrary\LibraryDataView.cs" />
<Compile Include="PrintLibrary\LibraryRowItem.cs" />
<Compile Include="PrintLibrary\PrintLibraryWidget.cs" />
<Compile Include="PrintQueue\OptionsMenue\ExportToFolderProcess.cs" />
<Compile Include="PrintQueue\OptionsMenu\ExportToFolderProcess.cs" />
<Compile Include="CustomWidgets\PartThumbnailWidget.cs" />
<Compile Include="PrintQueue\PrintItemWrapper.cs" />
<Compile Include="PrintQueue\QueueRowItem.cs" />
<Compile Include="MatterControlApplication.cs" />
<Compile Include="PrintQueue\QueueDataView.cs" />
<Compile Include="PrintQueue\OptionsMenue\QueueOptionsMenu.cs" />
<Compile Include="PrintQueue\OptionsMenu\QueueOptionsMenu.cs" />
<Compile Include="Utilities\ProjectFileHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utilities\WebUtilities\RequestManager.cs" />

View file

@ -58,6 +58,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatterSlice", "..\MatterSli
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher", "Launcher\Launcher.csproj", "{3DF4CB3D-9A03-4256-9A81-70523AAD828B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatterControlAuth", "..\MatterControlAuth\MatterControlAuth\MatterControlAuth.csproj", "{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -410,6 +412,18 @@ Global
{3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Release64|x64.ActiveCfg = Release64|Any CPU
{3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Release64|x64.Build.0 = Release64|Any CPU
{3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Release64|x86.ActiveCfg = Release64|Any CPU
{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Debug|x64.ActiveCfg = Debug|Any CPU
{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Debug|x86.ActiveCfg = Debug|Any CPU
{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release|Any CPU.Build.0 = Release|Any CPU
{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release|x64.ActiveCfg = Release|Any CPU
{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release|x86.ActiveCfg = Release|Any CPU
{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release64|Any CPU.ActiveCfg = Release|Any CPU
{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release64|Any CPU.Build.0 = Release|Any CPU
{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release64|x64.ActiveCfg = Release|Any CPU
{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release64|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -2052,3 +2052,21 @@ Translated:Build:
English:Update Feed
Translated:Update Feed
English:File
Translated:File
English:Import File
Translated:Import File
English:Exit
Translated:Exit
English:Help
Translated:Help
English:Getting Started
Translated:Getting Started
English:View Help
Translated:View Help