mirror of
https://github.com/wagesj45/butterflow-ui.git
synced 2024-12-22 09:12:42 -06:00
Menu progress
This commit is contained in:
parent
9af3ad400b
commit
0ffd5c401b
7 changed files with 142 additions and 20 deletions
|
@ -21,6 +21,8 @@ namespace butterflow_ui
|
|||
private decimal value;
|
||||
/// <summary> True if the subregion runs to the end, false if not. </summary>
|
||||
private bool toEnd;
|
||||
/// <summary> A unique identifier used to locate this subregion withing a subregion collection. </summary>
|
||||
private Guid identifier = new Guid();
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -101,6 +103,16 @@ namespace butterflow_ui
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets a unique identifier used to locate this subregion withing a subregion collection. </summary>
|
||||
/// <value> The unique identifier. </value>
|
||||
public Guid Identifier
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.identifier;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
</ControlTemplate>
|
||||
<ControlTemplate x:Key="RadarIcon">
|
||||
<Viewbox>
|
||||
<Path Fill="#000000">
|
||||
<Path Fill="#FF1B7A16">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M12 0c6.623 0 12 5.377 12 12s-5.377 12-12 12-12-5.377-12-12 5.377-12 12-12zm6.363 18.363c-1.629 1.629-3.879 2.637-6.363 2.637-4.967 0-9-4.033-9-9 0-4.28 2.994-7.866 7-8.777v1.029c-3.449.889-6 4.023-6 7.748 0 4.415 3.585 8 8 8 2.208 0 4.208-.896 5.656-2.344l.707.707zm-2.475-2.475c-.995.996-2.37 1.612-3.888 1.612-3.036 0-5.5-2.464-5.5-5.5 0-2.33 1.452-4.324 3.5-5.124v1.092c-1.481.737-2.5 2.267-2.5 4.032 0 2.484 2.016 4.5 4.5 4.5 1.242 0 2.367-.504 3.181-1.319l.707.707zm-4.888-5.62v-7.268c0-.265.105-.52.293-.707.187-.188.442-.293.707-.293.265 0 .52.105.707.293.188.187.293.442.293.707v7.268c.598.346 1 .992 1 1.732 0 1.104-.896 2-2 2s-2-.896-2-2c0-.74.402-1.386 1-1.732z" FillRule="EvenOdd"/>
|
||||
</Path.Data>
|
||||
|
@ -159,7 +159,7 @@
|
|||
</ControlTemplate>
|
||||
<ControlTemplate x:Key="CancelIcon">
|
||||
<Viewbox>
|
||||
<Path Fill="#000000">
|
||||
<Path Fill="#FF5B0D0D">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M12 0c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm4.151 17.943l-4.143-4.102-4.117 4.159-1.833-1.833 4.104-4.157-4.162-4.119 1.833-1.833 4.155 4.102 4.106-4.16 1.849 1.849-4.1 4.141 4.157 4.104-1.849 1.849z" FillRule="NonZero"/>
|
||||
</Path.Data>
|
||||
|
|
27
butterflow-ui/Localization/Localization.Designer.cs
generated
27
butterflow-ui/Localization/Localization.Designer.cs
generated
|
@ -402,6 +402,15 @@ namespace butterflow_ui.Localization {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _Open....
|
||||
/// </summary>
|
||||
public static string OpenMenuItem {
|
||||
get {
|
||||
return ResourceManager.GetString("OpenMenuItem", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Pixel Neighborhood.
|
||||
/// </summary>
|
||||
|
@ -501,6 +510,24 @@ namespace butterflow_ui.Localization {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Save Configuration _As....
|
||||
/// </summary>
|
||||
public static string SaveAsMenuItem {
|
||||
get {
|
||||
return ResourceManager.GetString("SaveAsMenuItem", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _Save Configuration....
|
||||
/// </summary>
|
||||
public static string SaveMenuItem {
|
||||
get {
|
||||
return ResourceManager.GetString("SaveMenuItem", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Skip backward in the video..
|
||||
/// </summary>
|
||||
|
|
|
@ -273,6 +273,9 @@
|
|||
<data name="LevelsTooltip" xml:space="preserve">
|
||||
<value>The number of pyramid layers.</value>
|
||||
</data>
|
||||
<data name="OpenMenuItem" xml:space="preserve">
|
||||
<value>_Open...</value>
|
||||
</data>
|
||||
<data name="PixelNeighborhoodLabel" xml:space="preserve">
|
||||
<value>Pixel Neighborhood</value>
|
||||
</data>
|
||||
|
@ -291,6 +294,12 @@
|
|||
<data name="PyramidScaleTooltip" xml:space="preserve">
|
||||
<value />
|
||||
</data>
|
||||
<data name="SaveAsMenuItem" xml:space="preserve">
|
||||
<value>Save Configuration _As...</value>
|
||||
</data>
|
||||
<data name="SaveMenuItem" xml:space="preserve">
|
||||
<value>_Save Configuration...</value>
|
||||
</data>
|
||||
<data name="SmoothDerivativeLabel" xml:space="preserve">
|
||||
<value>Smooth Derivative</value>
|
||||
</data>
|
||||
|
|
|
@ -29,17 +29,17 @@
|
|||
<DockPanel>
|
||||
<Menu DockPanel.Dock="Top">
|
||||
<MenuItem Header="{x:Static loc:Localization.FileMenu}">
|
||||
<MenuItem Header="Open">
|
||||
<MenuItem Name="menuOpen" Header="{x:Static loc:Localization.OpenMenuItem}" Click="menuOpen_Click">
|
||||
<MenuItem.Icon>
|
||||
<ContentControl Template="{StaticResource OpenIcon}" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Save Configuration">
|
||||
<MenuItem Name="menuSaveConfiguration" Header="{x:Static loc:Localization.SaveMenuItem}" Click="menuSaveConfiguration_Click">
|
||||
<MenuItem.Icon>
|
||||
<ContentControl Template="{StaticResource SaveIcon}" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Save Configuration As...">
|
||||
<MenuItem Name="menuSaveConfigurationAs" Header="{x:Static loc:Localization.SaveAsMenuItem}" Click="menuSaveConfigurationAs_Click">
|
||||
<MenuItem.Icon>
|
||||
<ContentControl Template="{StaticResource SaveAsIcon}" />
|
||||
</MenuItem.Icon>
|
||||
|
@ -47,18 +47,18 @@
|
|||
</MenuItem>
|
||||
<MenuItem Header="{x:Static loc:Localization.EditMenu}" />
|
||||
<MenuItem Header="{x:Static loc:Localization.HelpMenu}">
|
||||
<MenuItem Header="{x:Static loc:Localization.AboutButterflowMenu}" >
|
||||
<MenuItem Name="menuButterflowGithub" Header="{x:Static loc:Localization.AboutButterflowMenu}" Click="menuButterflowGithub_Click" >
|
||||
<MenuItem.Icon>
|
||||
<ContentControl Template="{StaticResource LinkIcon}" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="{x:Static loc:Localization.AboutButterflowUIMenu}">
|
||||
<MenuItem Name="menuButterflowUIGithub" Header="{x:Static loc:Localization.AboutButterflowUIMenu}" Click="menuButterflowUIGithub_Click">
|
||||
<MenuItem.Icon>
|
||||
<ContentControl Template="{StaticResource LinkIcon}" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Header="{x:Static loc:Localization.AboutMenu}">
|
||||
<MenuItem Name="menuAboutButterflowUI" Header="{x:Static loc:Localization.AboutMenu}" Click="menuAboutButterflowUI_Click">
|
||||
<MenuItem.Icon>
|
||||
<ContentControl Template="{StaticResource QuestionIcon}" />
|
||||
</MenuItem.Icon>
|
||||
|
@ -222,16 +222,19 @@
|
|||
<ListView Name="listSubregions" MinHeight="25" ItemsSource="{Binding OptionsConfiguration.Subregions, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<WrapPanel>
|
||||
<TextBlock Text="{x:Static loc:Localization.StartLabel}" />
|
||||
<TextBlock Text="{Binding Start, Converter={x:Static gu:TimeSpanToStringConverter.Default}}" ToolTip="{Binding Start}"/>
|
||||
<TextBlock Text="{x:Static loc:Localization.EndLabel}" />
|
||||
<TextBlock Text="{Binding End, Converter={x:Static gu:TimeSpanToStringConverter.Default}}" ToolTip="{Binding End}"/>
|
||||
<ComboBox ItemsSource="{Binding Source={StaticResource enumRegionTypeDataProvider}}" SelectedItem="{Binding SubregionType, Mode=TwoWay}"/>
|
||||
<TextBox MinWidth="35" Text="{Binding Value, Mode=TwoWay}" />
|
||||
<TextBlock Text="{x:Static loc:Localization.ToEndLabel}" />
|
||||
<CheckBox IsChecked="{Binding ToEnd, Mode=TwoWay}" />
|
||||
</WrapPanel>
|
||||
<DockPanel MaxHeight="24">
|
||||
<TextBlock VerticalAlignment="Center" Text="{x:Static loc:Localization.StartLabel}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding Start, Converter={x:Static gu:TimeSpanToStringConverter.Default}}" ToolTip="{Binding Start}"/>
|
||||
<TextBlock VerticalAlignment="Center" Text="{x:Static loc:Localization.EndLabel}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding End, Converter={x:Static gu:TimeSpanToStringConverter.Default}}" ToolTip="{Binding End}"/>
|
||||
<ComboBox VerticalAlignment="Center" ItemsSource="{Binding Source={StaticResource enumRegionTypeDataProvider}}" SelectedItem="{Binding SubregionType, Mode=TwoWay}"/>
|
||||
<TextBox VerticalAlignment="Center" MinWidth="35" Text="{Binding Value, Mode=TwoWay}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{x:Static loc:Localization.ToEndLabel}" />
|
||||
<CheckBox VerticalAlignment="Center" IsChecked="{Binding ToEnd, Mode=TwoWay}" />
|
||||
<Button VerticalAlignment="Center" HorizontalAlignment="Right" Name="btnRemoveSubregion" Click="btnRemoveSubregion_Click" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Tag="{Binding Identifier}">
|
||||
<ContentControl Template="{StaticResource CancelIcon}" />
|
||||
</Button>
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -312,6 +313,76 @@ namespace butterflow_ui
|
|||
this.ButterflowWrapper.Run(this.OptionsConfiguration);
|
||||
}
|
||||
|
||||
/// <summary> Event handler. Called by btnRemoveSubregion for click events. </summary>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Routed event information. </param>
|
||||
private void btnRemoveSubregion_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
|
||||
if(button != null)
|
||||
{
|
||||
if (button.Tag.GetType() == typeof(Guid))
|
||||
{
|
||||
var identifier = (Guid)button.Tag;
|
||||
|
||||
if (this.OptionsConfiguration.Subregions.Any(sr => sr.Identifier == identifier))
|
||||
{
|
||||
var item = this.OptionsConfiguration.Subregions.Where(sr => sr.Identifier == identifier).First();
|
||||
this.OptionsConfiguration.Subregions.Remove(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Event handler. Called by menuOpen for click events. </summary>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Routed event information. </param>
|
||||
private void menuOpen_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary> Event handler. Called by menuSaveConfiguration for click events. </summary>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Routed event information. </param>
|
||||
private void menuSaveConfiguration_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary> Event handler. Called by menuSaveConfigurationAs for click events. </summary>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Routed event information. </param>
|
||||
private void menuSaveConfigurationAs_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary> Event handler. Called by menuButterflowGithub for click events. </summary>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Routed event information. </param>
|
||||
private void menuButterflowGithub_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Process.Start("https://github.com/dthpham/butterflow");
|
||||
}
|
||||
|
||||
/// <summary> Event handler. Called by menuButterflowUIGithub for click events. </summary>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Routed event information. </param>
|
||||
private void menuButterflowUIGithub_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Process.Start("https://github.com/wagesj45/butterflow-ui");
|
||||
}
|
||||
|
||||
/// <summary> Event handler. Called by menuAboutButterflowUI for click events. </summary>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Routed event information. </param>
|
||||
private void menuAboutButterflowUI_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -312,6 +312,7 @@ namespace butterflow_ui
|
|||
|
||||
/// <summary> Gets or sets the size of the pixel neighborhood. </summary>
|
||||
/// <value> The size of the pixel neighborhood. </value>
|
||||
/// <remarks> Per butterflow's documentation, the valid range for --poly-n is {5,7}. </remarks>
|
||||
public string PixelNeighborhood
|
||||
{
|
||||
get
|
||||
|
@ -322,8 +323,7 @@ namespace butterflow_ui
|
|||
{
|
||||
interpreter.Interpret(value);
|
||||
|
||||
// Per butterflow's documentation, the valid range for --poly-n is {5,7}
|
||||
if (interpreter.Int >= 5 || interpreter.Int <= 7)
|
||||
if (interpreter.Int >= 5 && interpreter.Int <= 7)
|
||||
{
|
||||
this.pixelNeighborhood = interpreter.Int;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue