Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,4 @@ Test/Test - Backup.csproj
UndertaleModLib/UndertaleModLib - Backup.csproj
UndertaleModTests/UndertaleModTests - Backup.csproj
UndertaleModLib/gitversion.txt
/UndertaleModTool/Localization/Strings.Designer.cs
21 changes: 11 additions & 10 deletions UndertaleModTool/Controls/AudioFileReference.xaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<UserControl x:Class="UndertaleModTool.AudioFileReference"
<UserControl x:Class="UndertaleModTool.AudioFileReference"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:UndertaleModTool"
mc:Ignorable="d"
xmlns:loc="clr-namespace:UndertaleModTool.Localization"
mc:Ignorable="d"
d:DesignHeight="20" d:DesignWidth="300">
<UserControl.Resources>
<local:ContextMenuDark x:Key="contextMenu">
<local:MenuItemDark Header="Open in new tab" Click="OpenInNewTabItem_Click"/>
<local:MenuItemDark Header="{loc:Loc Common_OpenInNewTab}" Click="OpenInNewTabItem_Click"/>
</local:ContextMenuDark>
</UserControl.Resources>
<Grid>
Expand All @@ -32,7 +33,7 @@
</TextBox.Style>
</local:TextBoxDark>
<local:TextBoxDark Grid.Column="1" x:Name="ObjectText" IsReadOnly="True" Cursor="Arrow" AllowDrop="True"
ToolTip="This is an object reference. Drag and drop an object of matching type from the tree on the left to change it!"
ToolTip="{loc:Loc Ctrl_ObjRefToolTip}"
ToolTipService.InitialShowDelay="250"
PreviewDragOver="TextBox_DragOver" PreviewDrop="TextBox_Drop" PreviewMouseDoubleClick="TextBox_MouseDoubleClick" PreviewMouseDown="Details_MouseDown">
<TextBox.Style>
Expand Down Expand Up @@ -60,14 +61,14 @@
</DataTrigger>
<DataTrigger Binding="{Binding AudioID, RelativeSource={RelativeSource AncestorType=UserControl}}" Value="-1">
<DataTrigger.Setters>
<Setter Property="Text" Value="(null)"/>
<Setter Property="Text" Value="{loc:Loc Common_Null}"/>
</DataTrigger.Setters>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</local:TextBoxDark>
<local:ButtonDark Grid.Column="2" Click="Details_Click" MouseDown="Details_MouseDown" Content=" ... " ToolTip="Open referenced object">
<local:ButtonDark Grid.Column="2" Click="Details_Click" MouseDown="Details_MouseDown" Content=" ... " ToolTip="{loc:Loc Ctrl_OpenReferencedObject}">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
Expand All @@ -78,7 +79,7 @@
</Style>
</Button.Style>
</local:ButtonDark>
<local:ButtonDark Grid.Column="3" Click="Remove_Click" Content=" X " ToolTip="Remove reference">
<local:ButtonDark Grid.Column="3" Click="Remove_Click" Content=" X " ToolTip="{loc:Loc Ctrl_RemoveReference}">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
Expand All @@ -92,4 +93,4 @@
</Button.Style>
</local:ButtonDark>
</Grid>
</UserControl>
</UserControl>
11 changes: 6 additions & 5 deletions UndertaleModTool/Controls/ColorPicker.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
Expand All @@ -14,6 +14,7 @@
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using UndertaleModTool.Localization;

namespace UndertaleModTool
{
Expand Down Expand Up @@ -59,7 +60,7 @@ public ColorPicker()
ColorText.SetBinding(TextBox.TextProperty, binding);

ColorText.MaxLength = HasAlpha ? 9 : 7;
ColorText.ToolTip = $"#{(HasAlpha ? "AA" : "")}BBGGRR";
ColorText.ToolTip = string.Format(LocalizationSource.GetString("Msg_ColorFormatHint"), HasAlpha ? "AA" : "");
ToolTipService.SetInitialShowDelay(ColorText, 250);
}

Expand All @@ -78,7 +79,7 @@ private static void OnHasAlphaChanged(DependencyObject dependencyObject, Depende
colorPicker.ColorText.SetBinding(TextBox.TextProperty, binding);

colorPicker.ColorText.MaxLength = hasAlpha ? 9 : 7;
colorPicker.ColorText.ToolTip = $"#{(hasAlpha ? "AA" : "")}BBGGRR";
colorPicker.ColorText.ToolTip = string.Format(LocalizationSource.GetString("Msg_ColorFormatHint"), hasAlpha ? "AA" : "");
}
}

Expand Down Expand Up @@ -123,11 +124,11 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
bool hasAlpha = bool.Parse((string)parameter);

if (val[0] != '#')
return new ValidationResult(false, "Invalid color string");
return new ValidationResult(false, LocalizationSource.GetString("Msg_InvalidColorString"));

val = val[1..];
if (val.Length != (hasAlpha ? 8 : 6))
return new ValidationResult(false, "Invalid color string");
return new ValidationResult(false, LocalizationSource.GetString("Msg_InvalidColorString"));

if (!hasAlpha)
val = "FF" + val; // add alpha (255)
Expand Down
7 changes: 4 additions & 3 deletions UndertaleModTool/Controls/FlagsBox.xaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<UserControl x:Class="UndertaleModTool.FlagsBox"
<UserControl x:Class="UndertaleModTool.FlagsBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:UndertaleModTool"
xmlns:loc="clr-namespace:UndertaleModTool.Localization"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
x:Name="flagsBox">
Expand All @@ -12,7 +13,7 @@
</UserControl.Resources>
<StackPanel>
<TextBox Text="{Binding Value, ElementName=flagsBox}" />
<Expander Header="Flags">
<Expander Header="{loc:Loc Common_Flags}">
<ItemsControl ItemsSource="{Binding Value, ElementName=flagsBox, Converter={StaticResource enumToValuesConverter}}">
<ItemsControl.ItemTemplate>
<DataTemplate>
Expand All @@ -35,4 +36,4 @@
</ItemsControl>
</Expander>
</StackPanel>
</UserControl>
</UserControl>
20 changes: 9 additions & 11 deletions UndertaleModTool/Controls/ResourceListTreeViewItem.xaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
<TreeViewItem x:Class="UndertaleModTool.ResourceListTreeViewItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:UndertaleModTool"
xmlns:undertalelib="clr-namespace:UndertaleModLib;assembly=UndertaleModLib"
xmlns:loc="clr-namespace:UndertaleModTool.Localization"
mc:Ignorable="d">

<TreeViewItem.Resources>
<DataTemplate x:Key="DefaultNullItemTemplate">
<TextBlock Text="(null)"/>
<TextBlock Text="{loc:Loc Common_Null}"/>
</DataTemplate>

<local:ImplementsInterfaceConverter x:Key="ImplementsInterfaceConverter"/>

<local:ContextMenuDark x:Key="UndertaleResourceMenu" Opened="MenuItem_ContextMenuOpened">
<MenuItem Header="Open in new tab" Click="MenuItem_OpenInNewTab_Click"/>
<MenuItem Header="Find all references" Click="MenuItem_FindAllReferences_Click" Name="FindAllReferences"/>
<MenuItem Header="Copy name to clipboard" Click="MenuItem_CopyName_Click"/>
<MenuItem Header="Delete" Click="MenuItem_Delete_Click"/>
<MenuItem Header="{loc:Loc Common_OpenInNewTab}" Click="MenuItem_OpenInNewTab_Click"/>
<MenuItem Header="{loc:Loc FindRef_FindAllReferences}" Click="MenuItem_FindAllReferences_Click" Name="FindAllReferences"/>
<MenuItem Header="{loc:Loc FindRef_CopyNameToClipboard}" Click="MenuItem_CopyName_Click"/>
<MenuItem Header="{loc:Loc Common_Delete}" Click="MenuItem_Delete_Click"/>
</local:ContextMenuDark>

<!-- TODO: Would need some way to know the ID, IndexOf won't be reliable -->
<local:ContextMenuDark x:Key="NullItemReplaceMenu" Opened="MenuItem_NullDataContext_ContextMenuOpened">
<!--<MenuItem IsEnabled="False" Header="ID: " Name="ObjectIdLabel" />
<Separator />-->
<MenuItem IsEnabled="False" Header="Add in place (unimplemented)" />
<MenuItem IsEnabled="False" Header="{loc:Loc Ctrl_AddInPlaceUnimplemented}" />
</local:ContextMenuDark>

<Style x:Key="UndertaleModTool.ResourceListTreeViewItem.ItemContainerStyle" TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource {x:Type TreeViewItem}}">
Expand Down
6 changes: 3 additions & 3 deletions UndertaleModTool/Controls/ResourceListTreeViewItem.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Windows;
using System.Windows.Controls;
using UndertaleModLib;
using UndertaleModTool.Localization;
using UndertaleModTool.Windows;
using System.Linq;

Expand Down Expand Up @@ -96,7 +97,7 @@ private void MenuItem_FindAllReferences_Click(object sender, RoutedEventArgs e)
{
if ((sender as FrameworkElement)?.DataContext is not UndertaleResource obj)
{
mainWindow.ShowError("The selected object is not an \"UndertaleResource\".");
mainWindow.ShowError(LocalizationSource.GetString("Msg_SelectedObjectNotUndertaleResource"));
return;
}

Expand All @@ -108,8 +109,7 @@ private void MenuItem_FindAllReferences_Click(object sender, RoutedEventArgs e)
}
catch (Exception ex)
{
mainWindow.ShowError("An error occured in the object references related window.\n" +
$"Please report this on GitHub.\n\n{ex}");
mainWindow.ShowError(string.Format(LocalizationSource.GetString("Msg_ObjectReferencesWindowError"), ex));
}
finally
{
Expand Down
23 changes: 12 additions & 11 deletions UndertaleModTool/Controls/UndertaleObjectReference.xaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<UserControl x:Class="UndertaleModTool.UndertaleObjectReference"
<UserControl x:Class="UndertaleModTool.UndertaleObjectReference"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:UndertaleModTool"
xmlns:undertale="clr-namespace:UndertaleModLib.Models;assembly=UndertaleModLib"
mc:Ignorable="d"
xmlns:loc="clr-namespace:UndertaleModTool.Localization"
mc:Ignorable="d"
d:DesignHeight="20" d:DesignWidth="300"
Name="objectReference">
<UserControl.Resources>
<local:ContextMenuDark x:Key="contextMenu" Opened="MenuItem_ContextMenuOpened">
<MenuItem Header="Open in new tab" Click="OpenInNewTabItem_Click"/>
<MenuItem Header="Find all references" Click="FindAllReferencesItem_Click"/>
<MenuItem Header="{loc:Loc Common_OpenInNewTab}" Click="OpenInNewTabItem_Click"/>
<MenuItem Header="{loc:Loc FindRef_FindAllReferences}" Click="FindAllReferencesItem_Click"/>
</local:ContextMenuDark>
<Label x:Key="emptyReferenceLabel" Foreground="Gray" FontStyle="Italic" />
</UserControl.Resources>
Expand All @@ -28,7 +29,7 @@
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding CanChange, ElementName=objectReference}" Value="True">
<Setter Property="ToolTip" Value="This is an object reference. Drag and drop an object of matching type from the tree on the left to change it!" />
<Setter Property="ToolTip" Value="{loc:Loc Ctrl_ObjRefToolTip}" />
<Setter Property="ToolTipService.InitialShowDelay" Value="250" />
</DataTrigger>
<DataTrigger Binding="{Binding ObjectReference, ElementName=objectReference}" Value="{x:Null}">
Expand All @@ -48,7 +49,7 @@
<Button.Style>
<Style TargetType="{x:Type Button}">
<Setter Property="Content" Value=" ... " />
<Setter Property="ToolTip" Value="Open referenced object" />
<Setter Property="ToolTip" Value="{loc:Loc Ctrl_OpenReferencedObject}" />
<Style.Triggers>
<DataTrigger Binding="{Binding ObjectReference, ElementName=objectReference}" Value="{x:Null}">
<Setter Property="IsEnabled" Value="False"/>
Expand All @@ -60,14 +61,14 @@
<Condition Binding="{Binding ObjectReference, ElementName=objectReference}" Value="{x:Null}" />
</MultiDataTrigger.Conditions>
<Setter Property="Content" Value=" + "/>
<Setter Property="ToolTip" Value="Create new code entry" />
<Setter Property="ToolTip" Value="{loc:Loc Ctrl_CreateNewCode}" />
<Setter Property="IsEnabled" Value="True"/>
</MultiDataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</local:ButtonDark>
<local:ButtonDark Grid.Column="2" x:Name="RemoveButton" Click="Remove_Click" Content=" X " ToolTip="Remove reference">
<local:ButtonDark Grid.Column="2" x:Name="RemoveButton" Click="Remove_Click" Content=" X " ToolTip="{loc:Loc Ctrl_RemoveReference}">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
Expand All @@ -86,4 +87,4 @@
</Button.Style>
</local:ButtonDark>
</Grid>
</UserControl>
</UserControl>
12 changes: 6 additions & 6 deletions UndertaleModTool/Controls/UndertaleObjectReference.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
Expand All @@ -18,6 +18,7 @@
using UndertaleModLib;
using UndertaleModLib.Models;
using UndertaleModLib.Scripting;
using UndertaleModTool.Localization;
using UndertaleModTool.Windows;

namespace UndertaleModTool
Expand Down Expand Up @@ -198,9 +199,9 @@ private void UndertaleObjectReference_Loaded(object sender, RoutedEventArgs e)
n = "n";

if (CanChange)
label.Content = $"(drag & drop a{n} {typeName})";
label.Content = string.Format(LocalizationSource.GetString("Msg_DragDropAType"), n, typeName);
else
label.Content = $"(empty {typeName} reference)";
label.Content = string.Format(LocalizationSource.GetString("Msg_EmptyTypeReference"), typeName);
}

public void ClearRemoveClickHandler()
Expand Down Expand Up @@ -310,7 +311,7 @@ private void FindAllReferencesItem_Click(object sender, RoutedEventArgs e)
var obj = (sender as FrameworkElement)?.DataContext;
if (obj is not UndertaleResource res)
{
mainWindow.ShowError("The selected object is not an \"UndertaleResource\".");
mainWindow.ShowError(LocalizationSource.GetString("Msg_SelectedObjectNotUndertaleResource"));
return;
}

Expand All @@ -322,8 +323,7 @@ private void FindAllReferencesItem_Click(object sender, RoutedEventArgs e)
}
catch (Exception ex)
{
mainWindow.ShowError("An error occurred in the object references related window.\n" +
$"Please report this on GitHub.\n\n{ex}");
mainWindow.ShowError(string.Format(LocalizationSource.GetString("Msg_ObjectReferencesWindowError"), ex));
}
finally
{
Expand Down
5 changes: 3 additions & 2 deletions UndertaleModTool/Controls/UndertaleRoomRenderer.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
Expand All @@ -19,6 +19,7 @@
using System.Windows.Threading;
using UndertaleModLib.Models;
using static UndertaleModLib.Models.UndertaleRoom;
using UndertaleModTool.Localization;

namespace UndertaleModTool
{
Expand Down Expand Up @@ -128,7 +129,7 @@ public class RoomCaptionConverter : IValueConverter
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
UndertaleRoom room = value as UndertaleRoom;
return room is not null ? $"{room.Name.Content}: {room.Width}x{room.Height}" : "null";
return room is not null ? string.Format(LocalizationSource.GetString("Msg_RoomCaptionFormat"), room.Name.Content, room.Width, room.Height) : "null";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand Down
Loading