Merge branch 'development' of https://github.com/MatterHackers/MatterControl into color_gradient_work

This commit is contained in:
Gregory Diaz 2015-05-20 13:52:34 -07:00
commit b98120bcc1
14 changed files with 167 additions and 72 deletions

View file

@ -68,6 +68,7 @@ namespace MatterHackers.MatterControl
buttonRowContainer.AddChild(cancelButton);
this.Title = LocalizedString.Get("About MatterControl");
this.AlwaysOnTopOfMain = true;
this.ShowAsSystemWindow();
}

View file

@ -222,7 +222,7 @@ namespace MatterHackers.MatterControl.ActionBar
if (!PrinterConnectionAndCommunication.Instance.PrinterIsConnected
&& PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect)
{
if (UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen")
if (ActiveTheme.Instance.IsTouchScreen)
{
this.activePrintButtons.Add(connectButton);
}
@ -274,7 +274,7 @@ namespace MatterHackers.MatterControl.ActionBar
this.activePrintButtons.Add(pauseButton);
this.activePrintButtons.Add(cancelButton);
}
else if (UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen")
else if (ActiveTheme.Instance.IsTouchScreen)
{
this.activePrintButtons.Add(resetConnectionButton);
}
@ -302,7 +302,7 @@ namespace MatterHackers.MatterControl.ActionBar
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected
&& ActiveSliceSettings.Instance.ShowResetConnection()
&& UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen")
&& ActiveTheme.Instance.IsTouchScreen)
{
this.activePrintButtons.Add(resetConnectionButton);
ShowActiveButtons();

View file

@ -45,10 +45,7 @@ namespace MatterHackers.MatterControl
private TabPage QueueTabPage;
private TabPage LibraryTabPage;
private TabPage HistoryTabPage;
private TabPage AboutTabPage;
private SimpleTextTabWidget AboutTabView;
private RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;
private GuiWidget addedUpdateMark = null;
private QueueDataView queueDataView;
private event EventHandler unregisterEvents;
@ -75,17 +72,10 @@ namespace MatterHackers.MatterControl
this.AddTab(new SimpleTextTabWidget(HistoryTabPage, "History Tab", 15,
ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
AboutTabPage = new TabPage(new AboutWidget(), LocalizedString.Get("About").ToUpper());
AboutTabView = new SimpleTextTabWidget(AboutTabPage, "About Tab", 15,
ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());
this.AddTab(AboutTabView);
NumQueueItemsChanged(this, null);
SetUpdateNotification(this, null);
QueueData.Instance.ItemAdded.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);
QueueData.Instance.ItemRemoved.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);
UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents);
WidescreenPanel.PreChangePanels.RegisterEvent(SaveCurrentTab, ref unregisterEvents);
@ -111,35 +101,5 @@ namespace MatterHackers.MatterControl
unregisterEvents(this, null);
}
}
public void SetUpdateNotification(object sender, EventArgs widgetEvent)
{
switch (UpdateControlData.Instance.UpdateStatus)
{
case UpdateControlData.UpdateStatusStates.MayBeAvailable:
case UpdateControlData.UpdateStatusStates.ReadyToInstall:
case UpdateControlData.UpdateStatusStates.UpdateAvailable:
case UpdateControlData.UpdateStatusStates.UpdateDownloading:
if (addedUpdateMark == null)
{
addedUpdateMark = new NotificationWidget();
addedUpdateMark.OriginRelativeParent = new Vector2(AboutTabView.Width - 25, 7);
AboutTabView.AddChild(addedUpdateMark);
}
addedUpdateMark.Visible = true;
break;
case UpdateControlData.UpdateStatusStates.UpToDate:
case UpdateControlData.UpdateStatusStates.CheckingForUpdate:
if (addedUpdateMark != null)
{
addedUpdateMark.Visible = false;
}
break;
default:
throw new NotImplementedException();
}
}
}
}

View file

@ -1,17 +1,51 @@
using MatterHackers.Agg;
/*
Copyright (c) 2015, Kevin Pope
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
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
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.MatterControl.CustomWidgets;
using System;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl
{
public class ApplicationMenuRow : FlowLayoutWidget
{
private static FlowLayoutWidget rightElement;
private event EventHandler unregisterEvents;
LinkButtonFactory linkButtonFactory = new LinkButtonFactory();
GuiWidget popUpAboutPage;
public ApplicationMenuRow()
: base(FlowDirection.LeftToRight)
{
LinkButtonFactory linkButtonFactory = new LinkButtonFactory();
linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor;
linkButtonFactory.fontSize = 8;
@ -38,6 +72,26 @@ namespace MatterHackers.MatterControl
MenuOptionHelp menuOptionHelp = new MenuOptionHelp();
this.AddChild(menuOptionHelp);
linkButtonFactory.textColor = RGBA_Bytes.Red;
linkButtonFactory.fontSize = 10;
Button updateStatusMessage = linkButtonFactory.Generate("Update Available");
UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents);
popUpAboutPage = new GuiWidget();
popUpAboutPage.Margin = new BorderDouble(30, 0, 0, 0);
popUpAboutPage.HAnchor = HAnchor.FitToChildren;
popUpAboutPage.VAnchor = VAnchor.FitToChildren | VAnchor.ParentCenter;
popUpAboutPage.AddChild(updateStatusMessage);
updateStatusMessage.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
{
AboutWindow.Show();
});
};
this.AddChild(popUpAboutPage);
SetUpdateNotification(this, null);
// put in a spacer
this.AddChild(new HorizontalSpacer());
@ -55,6 +109,64 @@ namespace MatterHackers.MatterControl
}
}
public override void OnClosed(EventArgs e)
{
if (unregisterEvents != null)
{
unregisterEvents(this, null);
}
base.OnClosed(e);
}
public void SetUpdateNotification(object sender, EventArgs widgetEvent)
{
switch (UpdateControlData.Instance.UpdateStatus)
{
case UpdateControlData.UpdateStatusStates.MayBeAvailable:
{
popUpAboutPage.RemoveAllChildren();
Button updateStatusMessage = linkButtonFactory.Generate("Check For Update".Localize());
updateStatusMessage.Click += (sender2, e) =>
{
UiThread.RunOnIdle((state) =>
{
AboutWindow.Show();
});
};
popUpAboutPage.AddChild(updateStatusMessage);
popUpAboutPage.Visible = true;
}
break;
case UpdateControlData.UpdateStatusStates.ReadyToInstall:
case UpdateControlData.UpdateStatusStates.UpdateAvailable:
case UpdateControlData.UpdateStatusStates.UpdateDownloading:
{
popUpAboutPage.RemoveAllChildren();
Button updateStatusMessage = linkButtonFactory.Generate("Update Available".Localize());
updateStatusMessage.Click += (sender2, e) =>
{
UiThread.RunOnIdle((state) =>
{
AboutWindow.Show();
});
};
popUpAboutPage.AddChild(updateStatusMessage);
popUpAboutPage.Visible = true;
}
break;
case UpdateControlData.UpdateStatusStates.UpToDate:
case UpdateControlData.UpdateStatusStates.CheckingForUpdate:
popUpAboutPage.Visible = false;
break;
default:
throw new NotImplementedException();
}
}
public delegate void AddRightElementDelegate(GuiWidget iconContainer);
private static event AddRightElementDelegate privateAddRightElement;

View file

@ -63,7 +63,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
mainContainer.AddChild(new HorizontalLine(separatorLineColor));
#endif
if (UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen")
if (ActiveTheme.Instance.IsTouchScreen)
{
mainContainer.AddChild(GetModeControl());
mainContainer.AddChild(new HorizontalLine(separatorLineColor));
@ -201,9 +201,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage
MenuItem touchscreenOptionsDropDownItem = interfaceOptionsDropList.AddItem(LocalizedString.Get("Touchscreen"), "touchscreen");
List<string> acceptableUpdateFeedTypeValues = new List<string>() { "responsive", "touchscreen" };
string currentUpdateFeedType = UserSettings.Instance.get("ApplicationDisplayMode");
string currentDisplayModeType = UserSettings.Instance.get("ApplicationDisplayMode");
if (acceptableUpdateFeedTypeValues.IndexOf(currentUpdateFeedType) == -1)
if (acceptableUpdateFeedTypeValues.IndexOf(currentDisplayModeType) == -1)
{
UserSettings.Instance.set("ApplicationDisplayMode", "responsive");
}

View file

@ -78,7 +78,7 @@ namespace MatterHackers.MatterControl
InvertLightness.DoInvertLightness(disabledImage);
}
if (UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen")
if (ActiveTheme.Instance.IsTouchScreen)
{
//normalImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet);
RoundedRect rect = new RoundedRect(pressedImage.GetBounds(), 0);

View file

@ -287,6 +287,14 @@ namespace MatterHackers.MatterControl
return themeList;
}
public bool IsTouchScreen
{
get
{
return UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen";
}
}
}
public class Theme

View file

@ -105,7 +105,7 @@ namespace MatterHackers.MatterControl
AddChild(container);
if (UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen")
if (ActiveTheme.Instance.IsTouchScreen)
{
upImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_up_32x24.png");
downImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_down_32x24.png");

View file

@ -884,7 +884,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (gcodeViewWidget != null
&& gcodeViewWidget.LoadedGCode == null)
{
if (GCodeFile.FileTooBigToLoad(printItem.FileLocation))
// If we have finished loading the gcode and the source file exists but we don't have any loaded gcode it is because the loaded decided to not load it.
if (File.Exists(printItem.FileLocation))
{
SetProcessingMessage(string.Format(fileTooBigToLoad, printItem.Name));
}

View file

@ -181,7 +181,7 @@ namespace MatterHackers.MatterControl.PrintQueue
removeItemButton.Visible = false;
buttonPanel1.AddChild(removeItemButton);
bool touchScreenMode = UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen";
bool touchScreenMode = ActiveTheme.Instance.IsTouchScreen;
if (!touchScreenMode)
{

View file

@ -795,6 +795,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
foreach (KeyValuePair<String, DataStorage.SliceSetting> setting in this.DefaultSettings)
{
string activeValue = GetActiveValue(setting.Key);
activeValue = GCodeProcessing.ReplaceMacroValues(activeValue);
string settingString = string.Format("{0} = {1}", setting.Key, activeValue);
configFileAsList.Add(settingString);
}

View file

@ -835,21 +835,20 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
}
#endif
if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 3))
{
addMaterialOverlay = true;
}
else if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 2))
{
addQualityOverlay = true;
}
settingName.Width = minSettingNameWidth;
//settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y);
leftToRightLayout.AddChild(settingName);
}
if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 3))
{
addMaterialOverlay = true;
}
else if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 2))
{
addQualityOverlay = true;
}
switch (settingData.DataEditType)
{
case OrganizerSettingsData.DataEditTypes.INT:

View file

@ -248,16 +248,6 @@ Advanced
build_height
z_offset
bed_shape
Hardware
has_fan
has_hardware_leveling
has_heated_bed
has_sd_card_reader
has_power_control
show_reset_connection
extruder_count
heat_extruder_before_homing
extruders_share_temperature
Firmware
z_can_be_negative
gcode_flavor
@ -268,6 +258,17 @@ Advanced
Advanced
use_firmware_retraction
vibration_limit
Features
Hardware
has_fan
has_hardware_leveling
has_heated_bed
has_sd_card_reader
has_power_control
show_reset_connection
extruder_count
heat_extruder_before_homing
extruders_share_temperature
Custom G-Code
Start G-Code
start_gcode

View file

@ -3244,3 +3244,15 @@ Translated:The speed to move while printing the first layer. If expressed as a p
English:This gcode will sent to the printer immediately after connecting. It can be used to set settings specific to a given printer.
Translated:This gcode will sent to the printer immediately after connecting. It can be used to set settings specific to a given printer.
English:Features
Translated:Features
English:Update Available
Translated:Update Available
English:Check For Update
Translated:Check For Update
English:solid_shell
Translated:solid_shell