Merge pull request #3201 from larsbrubaker/design_tools

Design tools
This commit is contained in:
Lars Brubaker 2018-04-18 17:12:02 -07:00 committed by GitHub
commit d8aff254a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 292 additions and 56 deletions

View file

@ -65,6 +65,7 @@ namespace MatterHackers.MatterControl
using MatterHackers.MatterControl.PartPreviewWindow;
using MatterHackers.MatterControl.PartPreviewWindow.View3D;
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
using MatterHackers.MatterControl.SetupWizard;
using MatterHackers.PolygonMesh;
using MatterHackers.RenderOpenGl;
using MatterHackers.SerialPortCommunication;
@ -904,7 +905,7 @@ namespace MatterHackers.MatterControl
var printer = ApplicationController.Instance.ActivePrinters.Where(p => p.Connection == s).FirstOrDefault();
if (printer != null)
{
ApplicationController.Instance.RunAnyRequiredCalibration(printer, this.Theme);
ApplicationController.Instance.RunAnyRequiredPrinterSetup(printer, this.Theme);
}
}, ref unregisterEvents);
@ -926,7 +927,7 @@ namespace MatterHackers.MatterControl
}
}
public bool RunAnyRequiredCalibration(PrinterConfig printer, ThemeConfig theme)
public bool RunAnyRequiredPrinterSetup(PrinterConfig printer, ThemeConfig theme)
{
if (PrintLevelingData.NeedsToBeRun(printer))
{
@ -948,6 +949,23 @@ namespace MatterHackers.MatterControl
return true;
}
// tell the user about loading filament if they have not already been told
if(UserSettings.Instance.get(UserSettingsKey.DisplayedTip_LoadFilament) != "1")
{
var widgetName = "Hotend 0";
string extruder0TipMessage = "Extruder Controls can be fonud here.".Localize() + "\n"
+ " • " + "Select Material".Localize() + "\n"
+ " • " + "Set Temperature".Localize() + "\n"
+ " • " + "Move Print Head".Localize() + "\n"
+ " • " + "Load and Unload Filament".Localize() + "\n";
HelpSystemManager.Instance.ShowTip(AppContext.RootSystemWindow, widgetName, extruder0TipMessage);
UserSettings.Instance.set(UserSettingsKey.DisplayedTip_LoadFilament, "1");
return true;
}
return false;
}
@ -1267,7 +1285,7 @@ namespace MatterHackers.MatterControl
if (AggContext.OperatingSystem == OSType.Android)
{
// show this last so it is on top
if (UserSettings.Instance.get("SoftwareLicenseAccepted") != "true")
if (UserSettings.Instance.get(UserSettingsKey.SoftwareLicenseAccepted) != "true")
{
UiThread.RunOnIdle(() => DialogWindow.Show<LicenseAgreementPage>());
}
@ -1550,7 +1568,7 @@ namespace MatterHackers.MatterControl
try
{
// If leveling is required or is currently on
if(ApplicationController.Instance.RunAnyRequiredCalibration(printer, this.Theme))
if(ApplicationController.Instance.RunAnyRequiredPrinterSetup(printer, this.Theme))
{
// We need to calibrate. So, don't print this part.
return;

View file

@ -919,7 +919,7 @@ namespace MatterHackers.MatterControl
{
get
{
string value = UserSettings.Instance.get("GcodeViewerRenderGrid");
string value = UserSettings.Instance.get(UserSettingsKey.GcodeViewerRenderGrid);
if (value == null)
{
return true;
@ -930,7 +930,7 @@ namespace MatterHackers.MatterControl
{
if (this.RenderBed != value)
{
UserSettings.Instance.set("GcodeViewerRenderGrid", value.ToString());
UserSettings.Instance.set(UserSettingsKey.GcodeViewerRenderGrid, value.ToString());
this.IsDirty = true;
this.OnPropertyChanged(nameof(RenderBed));
}
@ -939,12 +939,12 @@ namespace MatterHackers.MatterControl
public bool RenderMoves
{
get => UserSettings.Instance.get("GcodeViewerRenderMoves") == "True";
get => UserSettings.Instance.get(UserSettingsKey.GcodeViewerRenderMoves) == "True";
set
{
if (this.RenderMoves != value)
{
UserSettings.Instance.set("GcodeViewerRenderMoves", value.ToString());
UserSettings.Instance.set(UserSettingsKey.GcodeViewerRenderMoves, value.ToString());
this.IsDirty = true;
this.OnPropertyChanged(nameof(RenderMoves));
}
@ -953,12 +953,12 @@ namespace MatterHackers.MatterControl
public bool RenderRetractions
{
get => UserSettings.Instance.get("GcodeViewerRenderRetractions") == "True";
get => UserSettings.Instance.get(UserSettingsKey.GcodeViewerRenderRetractions) == "True";
set
{
if (this.RenderRetractions != value)
{
UserSettings.Instance.set("GcodeViewerRenderRetractions", value.ToString());
UserSettings.Instance.set(UserSettingsKey.GcodeViewerRenderRetractions, value.ToString());
this.IsDirty = true;
this.OnPropertyChanged(nameof(RenderRetractions));
}
@ -967,12 +967,12 @@ namespace MatterHackers.MatterControl
public string GCodeModelView
{
get => UserSettings.Instance.get("GcodeModelView");
get => UserSettings.Instance.get(UserSettingsKey.GcodeModelView);
set
{
if (this.GCodeModelView != value)
{
UserSettings.Instance.set("GcodeModelView", value);
UserSettings.Instance.set(UserSettingsKey.GcodeModelView, value);
this.IsDirty = true;
this.OnPropertyChanged(nameof(GCodeModelView));
}
@ -981,12 +981,12 @@ namespace MatterHackers.MatterControl
public string GCodeLineColorStyle
{
get => UserSettings.Instance.get("GCodeLineColorStyle");
get => UserSettings.Instance.get(UserSettingsKey.GCodeLineColorStyle);
set
{
if (this.GCodeLineColorStyle != value)
{
UserSettings.Instance.set("GCodeLineColorStyle", value);
UserSettings.Instance.set(UserSettingsKey.GCodeLineColorStyle, value);
this.IsDirty = true;
this.OnPropertyChanged(nameof(GCodeLineColorStyle));
}
@ -995,12 +995,12 @@ namespace MatterHackers.MatterControl
public bool SimulateExtrusion
{
get => UserSettings.Instance.get("GcodeViewerSimulateExtrusion") == "True";
get => UserSettings.Instance.get(UserSettingsKey.GcodeViewerSimulateExtrusion) == "True";
set
{
if (this.SimulateExtrusion != value)
{
UserSettings.Instance.set("GcodeViewerSimulateExtrusion", value.ToString());
UserSettings.Instance.set(UserSettingsKey.GcodeViewerSimulateExtrusion, value.ToString());
this.IsDirty = true;
this.OnPropertyChanged(nameof(SimulateExtrusion));
}
@ -1009,12 +1009,12 @@ namespace MatterHackers.MatterControl
public bool TransparentExtrusion
{
get => UserSettings.Instance.get("GcodeViewerTransparentExtrusion") == "True";
get => UserSettings.Instance.get(UserSettingsKey.GcodeViewerTransparentExtrusion) == "True";
set
{
if (this.TransparentExtrusion != value)
{
UserSettings.Instance.set("GcodeViewerTransparentExtrusion", value.ToString());
UserSettings.Instance.set(UserSettingsKey.GcodeViewerTransparentExtrusion, value.ToString());
this.IsDirty = true;
this.OnPropertyChanged(nameof(TransparentExtrusion));
}
@ -1025,7 +1025,7 @@ namespace MatterHackers.MatterControl
{
get
{
string value = UserSettings.Instance.get("GcodeViewerHideExtruderOffsets");
string value = UserSettings.Instance.get(UserSettingsKey.GcodeViewerHideExtruderOffsets);
if (value == null)
{
return true;
@ -1036,7 +1036,7 @@ namespace MatterHackers.MatterControl
{
if (this.HideExtruderOffsets != value)
{
UserSettings.Instance.set("GcodeViewerHideExtruderOffsets", value.ToString());
UserSettings.Instance.set(UserSettingsKey.GcodeViewerHideExtruderOffsets, value.ToString());
this.IsDirty = true;
this.OnPropertyChanged(nameof(HideExtruderOffsets));
}
@ -1045,12 +1045,12 @@ namespace MatterHackers.MatterControl
public bool SyncToPrint
{
get => UserSettings.Instance.get("LayerViewSyncToPrint") == "True";
get => UserSettings.Instance.get(UserSettingsKey.LayerViewSyncToPrint) == "True";
set
{
if (this.SyncToPrint != value)
{
UserSettings.Instance.set("LayerViewSyncToPrint", value.ToString());
UserSettings.Instance.set(UserSettingsKey.LayerViewSyncToPrint, value.ToString());
this.IsDirty = true;
this.OnPropertyChanged(nameof(SyncToPrint));
}

View file

@ -109,10 +109,10 @@ namespace MatterHackers.MatterControl.ConfigurationPage
theme,
new SettingsItem.ToggleSwitchConfig()
{
Checked = UserSettings.Instance.get("PrintNotificationsEnabled") == "true",
Checked = UserSettings.Instance.get(UserSettingsKey.PrintNotificationsEnabled) == "true",
ToggleAction = (itemChecked) =>
{
UserSettings.Instance.set("PrintNotificationsEnabled", itemChecked ? "true" : "false");
UserSettings.Instance.set(UserSettingsKey.PrintNotificationsEnabled, itemChecked ? "true" : "false");
}
},
configureNotificationsButton,
@ -144,9 +144,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage
UiThread.RunOnIdle(() =>
{
string languageCode = languageSelector.SelectedValue;
if (languageCode != UserSettings.Instance.get("Language"))
if (languageCode != UserSettings.Instance.get(UserSettingsKey.Language))
{
UserSettings.Instance.set("Language", languageCode);
UserSettings.Instance.set(UserSettingsKey.Language, languageCode);
if (languageCode == "L10N")
{

View file

@ -21,7 +21,7 @@ namespace MatterHackers.MatterControl
AddItem(entry.Key, entry.Value);
}
string languageCode = UserSettings.Instance.get("Language");
string languageCode = UserSettings.Instance.get(UserSettingsKey.Language);
foreach (KeyValuePair<string, string> entry in languageDict)
{
if (languageCode == entry.Value)

View file

@ -66,7 +66,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
Closed += (s, e) =>
{
// move from this wizard to the print leveling wizard if needed
ApplicationController.Instance.RunAnyRequiredCalibration(printer, theme);
ApplicationController.Instance.RunAnyRequiredPrinterSetup(printer, theme);
};
base.PageIsBecomingActive();

View file

@ -40,10 +40,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
protected WizardControl container;
private List<ProbePosition> probePositions;
private ThemeConfig theme;
public LastPagelInstructions(PrinterConfig printer, WizardControl container, string pageDescription, string instructionsText, List<ProbePosition> probePositions, ThemeConfig theme)
: base(printer, pageDescription, instructionsText, theme)
{
this.theme = theme;
this.probePositions = probePositions;
this.container = container;
}
@ -78,6 +80,13 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
// Make sure when the wizard is done we turn off the bed heating
printer.Connection.TurnOffBedAndExtruders(TurnOff.AfterDelay);
Closed += (s, e) =>
{
// give instruction about how to load filament if the user has not gotten them
ApplicationController.Instance.RunAnyRequiredPrinterSetup(printer, theme);
};
base.PageIsBecomingActive();
}
}

View file

@ -116,7 +116,7 @@ namespace MatterHackers.MatterControl.PrintHistory
public IEnumerable<DataStorage.PrintTask> GetHistoryItems(int recordCount)
{
string query;
if (UserSettings.Instance.get("PrintHistoryFilterShowCompleted") == "true")
if (UserSettings.Instance.get(UserSettingsKey.PrintHistoryFilterShowCompleted) == "true")
{
query = string.Format("SELECT * FROM PrintTask WHERE PrintComplete = 1 ORDER BY PrintStart DESC LIMIT {0};", recordCount);
}

View file

@ -75,7 +75,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
{
Name = "LibraryView",
// Drop containers if ShowContainers != 1
ContainerFilter = (container) => UserSettings.Instance.get("ShowContainers") == "1",
ContainerFilter = (container) => UserSettings.Instance.get(UserSettingsKey.ShowContainers) == "1",
BackgroundColor = theme.ActiveTabColor,
//BorderColor = theme.MinimalShade,
Border = new BorderDouble(top: 1)
@ -164,12 +164,12 @@ namespace MatterHackers.MatterControl.PrintLibrary
VAnchor = VAnchor.Fit,
Padding = new BorderDouble(left: 2, bottom: 2, top: 6), // Same padding as toolbar above
Name = "Show Folders Toggle",
Checked = UserSettings.Instance.get("ShowContainers") == "1",
Checked = UserSettings.Instance.get(UserSettingsKey.ShowContainers) == "1",
MinimumSize = new Vector2(0, theme.ButtonHeight)
};
showFolders.CheckedStateChanged += async (s, e) =>
{
UserSettings.Instance.set("ShowContainers", showFolders.Checked ? "1" : "0");
UserSettings.Instance.set(UserSettingsKey.ShowContainers, showFolders.Checked ? "1" : "0");
await libraryView.Reload();
};
toolbar.AddChild(showFolders);

View file

@ -74,7 +74,7 @@
<Compile Include="AboutPage\CacheDirectory.cs" />
<Compile Include="AboutPage\CheckForUpdatesPage.cs" />
<Compile Include="ApplicationView\LogoSpinner.cs" />
<Compile Include="ConfigurationPage\CalibrationSettings\CalibrationControls.cs" />
<Compile Include="PrinterControls\ControlWidgets\CalibrationControls.cs" />
<Compile Include="ConfigurationPage\PrintLeveling\LevelingFunctions.cs" />
<Compile Include="ConfigurationPage\PrintLeveling\LevelWizard3x3Mesh.cs" />
<Compile Include="ConfigurationPage\PrintLeveling\LevelWizard5x5Mesh.cs" />
@ -229,6 +229,7 @@
<Compile Include="PrinterControls\PrinterConnections\PrinterSetup.cs" />
<Compile Include="RootSystemWindow.cs" />
<Compile Include="SetupWizard\DialogWindow.cs" />
<Compile Include="SetupWizard\HelpSystemManager.cs" />
<Compile Include="SlicerConfiguration\SettingsOrganizer.cs" />
<Compile Include="SlicerConfiguration\SettingsRow.cs" />
<Compile Include="SlicerConfiguration\UIFields\IpAddessField.cs" />

View file

@ -77,6 +77,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab
// TODO: implement panel for case of having no printer selected
//var explorerBar = new ExplorerBar("testing", theme);
//topToBottom.AddChild(explorerBar);
// for now just show
topToBottom.AddChild(
new PrinterBar(partPreviewContent, lastProfile, theme));
}
topToBottom.AddChild(new PartsBar(partPreviewContent, theme)

View file

@ -79,7 +79,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab
private PrinterInfo printerInfo;
public PrinterBar(PartPreviewContent partPreviewContent, PrinterInfo printerInfo, ThemeConfig theme)
: base(printerInfo.Name, theme)
: base(printerInfo?.Name ?? "", theme)
{
headingBar.CloseAllChildren();
headingBar.AddChild(new PrinterSelector(theme)

View file

@ -250,12 +250,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
switch (viewMode)
{
case PartViewMode.Layers2D:
UserSettings.Instance.set("LayerViewDefault", "2D Layer");
UserSettings.Instance.set(UserSettingsKey.LayerViewDefault, "2D Layer");
gcode2DWidget.Visible = true;
break;
case PartViewMode.Layers3D:
UserSettings.Instance.set("LayerViewDefault", "3D Layer");
UserSettings.Instance.set(UserSettingsKey.LayerViewDefault, "3D Layer");
break;
case PartViewMode.Model:

View file

@ -6,29 +6,52 @@ namespace MatterHackers.MatterControl
{
public static class UserSettingsKey
{
public const string UpdateFeedType = nameof(UpdateFeedType);
public const string AfterPrintFinishedPlaySound = nameof(AfterPrintFinishedPlaySound);
public const string AfterPrintFinishedSendEmail = nameof(AfterPrintFinishedSendEmail);
public const string AfterPrintFinishedSendTextMessage = nameof(AfterPrintFinishedSendTextMessage);
public const string ApplicationDisplayMode = nameof(ApplicationDisplayMode);
public const string ApplicationTextSize = nameof(ApplicationTextSize);
public const string defaultRenderSetting = nameof(defaultRenderSetting);
public const string ThumbnailRenderingMode = nameof(ThumbnailRenderingMode);
public const string CredentialsInvalid = nameof(CredentialsInvalid);
public const string CredentialsInvalidReason = nameof(CredentialsInvalidReason);
public const string TerminalFilterOutput = nameof(TerminalFilterOutput);
public const string TerminalAutoUppercase = nameof(TerminalAutoUppercase);
public const string SliceSettingsTabPinned = nameof(SliceSettingsTabPinned);
public const string SliceSettingsTabIndex = nameof(SliceSettingsTabIndex);
public const string SliceSettingsWidth = nameof(SliceSettingsWidth);
public const string SliceSettingsWidget_CurrentTab = nameof(SliceSettingsWidget_CurrentTab);
public const string OpenScadPath = nameof(OpenScadPath);
public const string LibraryViewWidth = nameof(LibraryViewWidth);
public const string SelectedObjectPanelWidth = nameof(SelectedObjectPanelWidth);
public const string ColorPanelExpanded = nameof(ColorPanelExpanded);
public const string ConfigurePrinter_CurrentTab = nameof(ConfigurePrinter_CurrentTab);
public const string ConfigurePrinterTabVisible = nameof(ConfigurePrinterTabVisible);
public const string MirrorPanelExpanded = nameof(MirrorPanelExpanded);
public const string MaterialsPanelExpanded = nameof(MaterialsPanelExpanded);
public const string ColorPanelExpanded = nameof(ColorPanelExpanded);
public const string ScalePanelExpanded = nameof(ScalePanelExpanded);
public const string CredentialsInvalid = nameof(CredentialsInvalid);
public const string CredentialsInvalidReason = nameof(CredentialsInvalidReason);
public const string defaultRenderSetting = nameof(defaultRenderSetting);
public const string DisplayedTip_LoadFilament = nameof(DisplayedTip_LoadFilament);
public const string EditorPanelExpanded = nameof(EditorPanelExpanded);
public const string GCodeLineColorStyle = nameof(GCodeLineColorStyle);
public const string GcodeModelView = nameof(GcodeModelView);
public const string GcodeViewerHideExtruderOffsets = nameof(GcodeViewerHideExtruderOffsets);
public const string GcodeViewerRenderGrid = nameof(GcodeViewerRenderGrid);
public const string GcodeViewerRenderMoves = nameof(GcodeViewerRenderMoves);
public const string GcodeViewerRenderRetractions = nameof(GcodeViewerRenderRetractions);
public const string GcodeViewerSimulateExtrusion = nameof(GcodeViewerSimulateExtrusion);
public const string GcodeViewerTransparentExtrusion = nameof(GcodeViewerTransparentExtrusion);
public const string Language = nameof(Language);
public const string LayerViewDefault = nameof(LayerViewDefault);
public const string LayerViewSyncToPrint = nameof(LayerViewSyncToPrint);
public const string LibraryViewWidth = nameof(LibraryViewWidth);
public const string MaterialsPanelExpanded = nameof(MaterialsPanelExpanded);
public const string MirrorPanelExpanded = nameof(MirrorPanelExpanded);
public const string NotificationEmailAddress = nameof(NotificationEmailAddress);
public const string NotificationPhoneNumber = nameof(NotificationPhoneNumber);
public const string OpenScadPath = nameof(OpenScadPath);
public const string PrintHistoryFilterShowCompleted = nameof(PrintHistoryFilterShowCompleted);
public const string PrintNotificationsEnabled = nameof(PrintNotificationsEnabled);
public const string PrintNotificationsIncludeImage = nameof(PrintNotificationsIncludeImage);
public const string PublicProfilesSha = nameof(PublicProfilesSha);
public const string ScalePanelExpanded = nameof(ScalePanelExpanded);
public const string SelectedObjectPanelWidth = nameof(SelectedObjectPanelWidth);
public const string ShowContainers = nameof(ShowContainers);
public const string SliceSettingsTabIndex = nameof(SliceSettingsTabIndex);
public const string SliceSettingsTabPinned = nameof(SliceSettingsTabPinned);
public const string SliceSettingsWidget_CurrentTab = nameof(SliceSettingsWidget_CurrentTab);
public const string SliceSettingsWidth = nameof(SliceSettingsWidth);
public const string SoftwareLicenseAccepted = nameof(SoftwareLicenseAccepted);
public const string TerminalAutoUppercase = nameof(TerminalAutoUppercase);
public const string TerminalFilterOutput = nameof(TerminalFilterOutput);
public const string ThumbnailRenderingMode = nameof(ThumbnailRenderingMode);
public const string UpdateFeedType = nameof(UpdateFeedType);
}
public class UserSettings

View file

@ -0,0 +1,181 @@
/*
Copyright (c) 2017, Lars Brubaker, John Lewin
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.Font;
using MatterHackers.Agg.Transform;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.VertexSource;
using System;
using System.Linq;
namespace MatterHackers.MatterControl.SetupWizard
{
public class HelpOverlay : GuiWidget
{
private double animationRatio = 0;
private bool DoneAnimating => animationRatio >= 1;
private GuiWidget target;
private string message;
Animation showAnimation;
public HelpOverlay(GuiWidget target, string message)
{
this.target = target;
this.message = message;
HAnchor = HAnchor.Stretch;
VAnchor = VAnchor.Stretch;
showAnimation = new Animation()
{
DrawTarget = this,
};
showAnimation.Update += (s, timePassed) =>
{
animationRatio += timePassed;
if(animationRatio >= 1)
{
showAnimation?.Stop();
showAnimation = null;
}
};
}
public override void OnClick(MouseEventArgs mouseEvent)
{
if (DoneAnimating)
{
CloseOnIdle();
}
base.OnClick(mouseEvent);
}
public override void OnDraw(Graphics2D graphics2D)
{
if(showAnimation != null
&& !showAnimation.IsRunning)
{
showAnimation.Start();
}
var backgroundColor = new Color(Color.Black, 100);
BackgroundColor = Color.Transparent;
var childBounds = target.TransformToParentSpace(this, target.LocalBounds);
VertexStorage dimRegion = new VertexStorage();
dimRegion.MoveTo(LocalBounds.Left, LocalBounds.Bottom);
dimRegion.LineTo(LocalBounds.Right, LocalBounds.Bottom);
dimRegion.LineTo(LocalBounds.Right, LocalBounds.Top);
dimRegion.LineTo(LocalBounds.Left, LocalBounds.Top);
var ratio = Easing.Quadratic.InOut(Math.Min(animationRatio, 1));
double closingLeft = LocalBounds.Left + (childBounds.Left - LocalBounds.Left) * ratio;
double closingRight = LocalBounds.Right - (LocalBounds.Right - childBounds.Right) * ratio;
double closingBottom = LocalBounds.Bottom + (childBounds.Bottom - LocalBounds.Bottom) * ratio;
double closingTop = LocalBounds.Top - (LocalBounds.Top - childBounds.Top) * ratio;
dimRegion.MoveTo(closingRight, closingBottom);
dimRegion.LineTo(closingLeft, closingBottom);
dimRegion.LineTo(closingLeft, closingTop);
dimRegion.LineTo(closingRight, closingTop);
graphics2D.Render(dimRegion, backgroundColor);
BorderDouble margin = new BorderDouble(5);
if (ratio >= 1)
{
TypeFacePrinter stringPrinter = new TypeFacePrinter(message);
var textBounds = stringPrinter.GetBounds();
var translated = new VertexSourceApplyTransform(stringPrinter,
Affine.NewTranslation(childBounds.Right - textBounds.Width - margin.Right,
childBounds.Bottom - stringPrinter.TypeFaceStyle.AscentInPixels - margin.Top));// - textBounds.Height));
graphics2D.Render(translated, Color.White);
}
base.OnDraw(graphics2D);
}
}
public class HelpSystemManager
{
private SystemWindow SystemWindow { get; set; }
private string message;
private GuiWidget target;
private static HelpSystemManager _instance;
public static HelpSystemManager Instance
{
get
{
if (_instance == null)
{
_instance = new HelpSystemManager();
}
return _instance;
}
}
private HelpSystemManager()
{
}
public void ShowTip(SystemWindow systemWindow, string widgetName, string message)
{
this.SystemWindow = systemWindow;
this.message = message;
target = systemWindow.Descendants().Where((w) => w.Name == widgetName).FirstOrDefault();
if (target != null)
{
target.AfterDraw -= DoShowTip;
}
// hook the widget draw and wait for it to draw so that we know it is visible
target.AfterDraw += DoShowTip;
target.Invalidate();
}
private void DoShowTip(object sender, DrawEventArgs drawEvent)
{
if (target != null)
{
target.AfterDraw -= DoShowTip;
SystemWindow.AddChild(new HelpOverlay(target, message));
}
}
}
}

View file

@ -57,7 +57,7 @@ public class LicenseAgreementPage : DialogPage
var acceptButton = theme.CreateDialogButton("Accept".Localize());
acceptButton.Click += (s, e) =>
{
UserSettings.Instance.set("SoftwareLicenseAccepted", "true");
UserSettings.Instance.set(UserSettingsKey.SoftwareLicenseAccepted, "true");
UiThread.RunOnIdle(WizardWindow.Close);
};

@ -1 +1 @@
Subproject commit cbdb78f11e8074123cbf99c45ff1f858fa05b4e2
Subproject commit cdbb27b3f5335acae7fc143fa9f0019113bf929b