forked from AnnoDesigner/anno-designer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalization doesn't move the viewport (AnnoDesigner#394)
- LayoutVersion is loaded when layout is loaded - Change of layout version is undoable and therefor counts toward unsaved changes - Star is shown in the window title when there are unsaved changes
- Loading branch information
Showing
12 changed files
with
269 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows; | ||
using System.Windows.Data; | ||
|
||
namespace AnnoDesigner.Core.Converters | ||
{ | ||
public sealed class UnsavedChangesConverter : IMultiValueConverter | ||
{ | ||
public string Format { get; set; } = "{0} *"; | ||
|
||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (values.Length < 1) | ||
{ | ||
return DependencyProperty.UnsetValue; | ||
} | ||
if (values.Length < 2 || values[1] is false) | ||
{ | ||
return values[0]; | ||
} | ||
|
||
return string.Format(Format, values[0] as string); | ||
} | ||
|
||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
AnnoDesigner.Core/Models/INotifyPropertyChangedWithValues.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,24 @@ | ||
using System.ComponentModel; | ||
|
||
namespace AnnoDesigner.Core.Models | ||
{ | ||
public class PropertyChangedWithValuesEventArgs<T> : PropertyChangedEventArgs | ||
{ | ||
public T OldValue { get; set; } | ||
|
||
public T NewValue { get; set; } | ||
|
||
public PropertyChangedWithValuesEventArgs(string propertyName, T oldValue, T newValue) : base(propertyName) | ||
{ | ||
OldValue = oldValue; | ||
NewValue = newValue; | ||
} | ||
} | ||
|
||
public delegate void PropertyChangedWithValuesEventHandler<T>(object sender, PropertyChangedWithValuesEventArgs<T> e); | ||
|
||
public interface INotifyPropertyChangedWithValues<T> | ||
{ | ||
event PropertyChangedWithValuesEventHandler<T> PropertyChangedWithValues; | ||
} | ||
} |
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
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
24 changes: 24 additions & 0 deletions
24
AnnoDesigner/Undo/Operations/ModifyLayoutVersionOperation.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,24 @@ | ||
using System; | ||
using AnnoDesigner.ViewModels; | ||
|
||
namespace AnnoDesigner.Undo.Operations | ||
{ | ||
public class ModifyLayoutVersionOperation : BaseOperation | ||
{ | ||
public LayoutSettingsViewModel LayoutSettingsViewModel { get; set; } | ||
|
||
public Version OldValue { get; set; } | ||
|
||
public Version NewValue { get; set; } | ||
|
||
protected override void UndoOperation() | ||
{ | ||
LayoutSettingsViewModel.LayoutVersion = OldValue; | ||
} | ||
|
||
protected override void RedoOperation() | ||
{ | ||
LayoutSettingsViewModel.LayoutVersion = NewValue; | ||
} | ||
} | ||
} |
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.