-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove save button fromadded ability to create curves on the fly from…
… python via the new CurveHelper added ability to generate python script for curve creation from the Curves Setting GUI add new button to save curves instead of relying on exit of Freepie to auto save. added some debugger display attributes to Point and Curve classes for easier debugging add Unit Tests for CurveHelper improve layout of Curve editor to flow instead of just using a single column
- Loading branch information
1 parent
5f948af
commit c4ef84f
Showing
14 changed files
with
298 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ obj | |
# built application files | ||
*.apk | ||
*.ap_ | ||
.vs | ||
|
||
# nuget packages | ||
packages | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
FreePIE.Core/ScriptEngine/Globals/ScriptHelpers/CurveHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using FreePIE.Core.Contracts; | ||
using FreePIE.Core.Model; | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace FreePIE.Core.ScriptEngine.Globals.ScriptHelpers | ||
{ | ||
[Global(Name = "curves")] | ||
public class CurveHelper : IScriptHelper | ||
{ | ||
public CurveHelper() | ||
{ | ||
|
||
} | ||
|
||
/// <summary> | ||
/// Create a curve from a list of points | ||
/// </summary> | ||
/// <param name="points">list of points in the format x,y,x,y,x,y,x,y...</param> | ||
/// <returns>a curve global</returns> | ||
public CurveGlobalProvider.CurveGlobal create(double minimum, double maximum, params double[] points) | ||
{ | ||
|
||
var pointz = new List<Point>() { new Point(minimum, minimum) }; | ||
|
||
// ensure that all of the points values are between the minimum and maximum | ||
|
||
if (points.Any(p => p < minimum || p > maximum)) | ||
throw new Exception("All points must be between the minimum and maximum values"); | ||
|
||
|
||
pointz.AddRange(points.Select((x, i) => new { x, i }).GroupBy(p => p.i / 2).Select(g => new Point(g.First().x, g.Last().x))); | ||
|
||
pointz.Add(new Point(maximum, maximum)); | ||
|
||
return new CurveGlobalProvider.CurveGlobal(new Curve(Guid.NewGuid().ToString(), pointz) { ValidateCurve = true }); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace FreePIE.GUI.Events | ||
{ | ||
internal class SaveSettingsEvent | ||
{ | ||
public SaveSettingsEvent() | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,41 @@ | ||
<Window x:Name="ThisView" x:Class="FreePIE.GUI.Shells.Curves.CurveSettingsView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:curves="clr-namespace:FreePIE.GUI.Views.Curves" | ||
Title="CurveSettingsView" Background="{DynamicResource WindowBackgroundBrush}" SizeToContent="WidthAndHeight" MinHeight="200" MinWidth="200" | ||
Width="{Binding ElementName=ThisView, Path=WindowWidth}" | ||
Height="{Binding ElementName=ThisView, Path=WindowHeight}" | ||
Icon="{StaticResource IconCurve}"> | ||
|
||
<Grid> | ||
<Grid Margin="10"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
<ScrollViewer> | ||
<ItemsControl x:Name="Curves" Grid.Row="0"></ItemsControl> | ||
<ItemsControl x:Name="Curves" Grid.Row="0"> | ||
<ItemsControl.ItemsPanel> | ||
<ItemsPanelTemplate> | ||
<WrapPanel /> | ||
</ItemsPanelTemplate> | ||
</ItemsControl.ItemsPanel> | ||
</ItemsControl> | ||
</ScrollViewer> | ||
<Button x:Name="AddCurve" Width="150" Grid.Row="1">Add new curve</Button> | ||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="1"> | ||
<Button x:Name="AddCurve" Width="150" > | ||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | ||
<Path Stretch="Fill" Width="8" Height="8" Margin="5,0,5,0" | ||
Fill="White" | ||
Data="M4.1561281,2.2702953 L4.8524521,2.2702954 4.8509674,3.963097 5.8969377,3.9630803 5.8969378,5.0916036 4.8524628,5.1061913 4.8524521,6.7843885 4.1561281,6.7843887 4.1559771,5.0877741 3.1116421,5.0916036 3.1116421,3.9630803 4.1556735,3.9654722 4.1561281,2.2702953 z"/> | ||
<TextBlock> Add curve</TextBlock> | ||
</StackPanel> | ||
</Button> | ||
<Button x:Name="Save" Margin="5,0,0,0" Background="Green"> | ||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | ||
<Image Source="/Resources/save-16.png" Width="10"/> | ||
<TextBlock Margin="5,0,0,0">Save</TextBlock> | ||
</StackPanel> | ||
</Button> | ||
</StackPanel> | ||
</Grid> | ||
|
||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.