-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #236 from lastbattle/staging
Staging - Image property grid + image filter editor
- Loading branch information
Showing
22 changed files
with
914 additions
and
567 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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using HaRepacker.GUI.Controls; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Drawing; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace HaRepacker.Converter { | ||
public class PointFConverter : TypeConverter { | ||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { | ||
return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType); | ||
} | ||
|
||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { | ||
if (value is string stringValue) { | ||
string[] parts = stringValue.Split(','); | ||
if (parts.Length == 2 && float.TryParse(parts[0], out float x) && float.TryParse(parts[1], out float y)) { | ||
return new NotifyPointF(x, y); | ||
} | ||
} | ||
return base.ConvertFrom(context, culture, value); | ||
} | ||
|
||
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { | ||
if (destinationType == typeof(string) && value is NotifyPointF point) { | ||
return $"{point.X},{point.Y}"; | ||
} | ||
return base.ConvertTo(context, culture, value, destinationType); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Data; | ||
|
||
namespace HaRepacker.Converter { | ||
public class PointFValueConverter : IValueConverter { | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { | ||
return value; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { | ||
return value; | ||
} | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace HaRepacker.GUI.Controls { | ||
/// <summary> | ||
/// Custom PointF struct that implements INotifyPropertyChanged for PropertyView | ||
/// </summary> | ||
public class NotifyPointF : INotifyPropertyChanged { | ||
private float _x; | ||
private float _y; | ||
|
||
public float X { | ||
get => _x; | ||
set { | ||
if (_x != value) { | ||
_x = value; | ||
OnPropertyChanged(nameof(X)); | ||
} | ||
} | ||
} | ||
|
||
public float Y { | ||
get => _y; | ||
set { | ||
if (_y != value) { | ||
_y = value; | ||
OnPropertyChanged(nameof(Y)); | ||
} | ||
} | ||
} | ||
|
||
public NotifyPointF(float x, float y) { | ||
_x = x; | ||
_y = y; | ||
} | ||
public NotifyPointF(PointF f) { | ||
_x = f.X; | ||
_y = f.Y; | ||
} | ||
|
||
public event PropertyChangedEventHandler PropertyChanged; | ||
|
||
private void OnPropertyChanged(string propertyName) { | ||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); | ||
} | ||
|
||
public static implicit operator PointF(NotifyPointF point) => new PointF(point.X, point.Y); | ||
public static implicit operator NotifyPointF(PointF point) => new NotifyPointF(point.X, point.Y); | ||
} | ||
} |
Oops, something went wrong.