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
22 changes: 22 additions & 0 deletions Controls/TexturePicker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,29 @@
<ColumnDefinition Width="9*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<Button Grid.Column="1" Style="{StaticResource delete}" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:TexturePicker}}, Path=DataContext.Textures.RemoveCommand}" CommandParameter="{Binding}"/>

<Button HorizontalAlignment="Left" Width="20" Grid.Column="0" Margin="0,0,2,0" Command="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Window},Path=EditHostDevicesCommand}" CommandParameter="{Binding}">
<Button.Style>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource blank}">
<Setter Property="Content" >
<Setter.Value>
<Path Fill="Sienna" Data="{DynamicResource Geometry.HostDevices}" Style="{StaticResource DropShadow}"/>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Content">
<Setter.Value>
<Path Fill="LightGray" Data="{DynamicResource Geometry.HostDevices}" Style="{StaticResource DropShadow}"/>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</Grid>
<TextBox Grid.Row="1" Padding="2" Margin="1" HorizontalAlignment="Center" MinWidth="50" Text="{Binding TextureHash, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" BorderBrush="{Binding HashProperties.IsValid, Converter={StaticResource BoolToBrushConverter}}"/>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</MenuItem>
<MenuItem Header="_Edit">
<MenuItem Header="_Emulated Devices..." Name="EditEmulatedDevices" Click="EditEmulatedDevices_Click" Icon="{DynamicResource Icon.EmulatedDevices}"/>
<MenuItem Header="_Host Devices..." Name="EditHostDevices" Click="EditHostDevices_Click" Icon="{DynamicResource Icon.HostDevices}"/>
<MenuItem Header="_Host Devices..." Name="EditHostDevices" Click="EditDefaultHostDevices_Click" Icon="{DynamicResource Icon.HostDevices}"/>
<MenuItem Header="_Metadata..." Name="EditMetadata" Click="EditMetadata_Click" Icon="{DynamicResource Icon.Metadata}" />
<MenuItem Header="_Tags..." Name="EditTags" Click="EditTags_Click" Icon="{DynamicResource Icon.EditTags}" />
</MenuItem>
Expand Down
37 changes: 31 additions & 6 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ private DynamicInputPackViewModel InputPack
return;

value.CheckImagePaths();
_edit_host_devices_window?.Close();
DataContext = value;
((PanZoomViewModel)PanZoom.DataContext).InputPack = value;
UnsavedChanges = false;
Expand All @@ -39,6 +40,7 @@ private DynamicInputPackViewModel InputPack
private string _saved_document = null;

private Window _edit_emulated_devices_window;
private Window _edit_default_host_devices_window;
private Window _edit_host_devices_window;
private Window _edit_metadata_window;
private Window _edit_tags_window;
Expand All @@ -48,13 +50,13 @@ private void QuitProgram_Click(object sender, RoutedEventArgs e)
this.Close();
}

private void EditHostDevices_Click(object sender, RoutedEventArgs e)
private void EditDefaultHostDevices_Click(object sender, RoutedEventArgs e)
{
_edit_host_devices_window?.Close();
_edit_default_host_devices_window?.Close();

_edit_host_devices_window = new Window
_edit_default_host_devices_window = new Window
{
Title = "Editing Host Devices",
Title = "Editing Default Host Devices",
Icon = ResourceShapePathToImage("Icon.HostDevices"),
ResizeMode = ResizeMode.CanResize,
SizeToContent = SizeToContent.Manual,
Expand All @@ -64,6 +66,29 @@ private void EditHostDevices_Click(object sender, RoutedEventArgs e)
};

UpdateEditWindows();
_edit_default_host_devices_window.Show();
}

public ICommand EditHostDevicesCommand => new ViewModels.Commands.RelayCommand<DynamicInputTexture>(EditHostDevicesS);

private void EditHostDevicesS(DynamicInputTexture texture)
{
_edit_host_devices_window?.Close();

var user_control = new HostDeviceKeyViewModel { HostDevices = new ViewModels.Commands.UICollection<HostDevice>(texture.HostDevices) };
texture.HostDevices = user_control.HostDevices;

_edit_host_devices_window = new Window
{
Title = "Editing Host Devices of " + texture.TextureHash,
ResizeMode = ResizeMode.CanResize,
SizeToContent = SizeToContent.Manual,
Owner = Application.Current.MainWindow,
Top = this.Top + 50, Left = this.Left + 70,
Width = 620, Height = 550, MinWidth = 500, MinHeight = 400,
Content = new Controls.EditHostDevices { DataContext = user_control }
};

_edit_host_devices_window.Show();
}

Expand Down Expand Up @@ -237,10 +262,10 @@ private void UpdateEditWindows()
_edit_emulated_devices_window.Content = user_control;
}

if (_edit_host_devices_window != null)
if (_edit_default_host_devices_window != null)
{
var user_control = new Controls.EditHostDevices { DataContext = new HostDeviceKeyViewModel { HostDevices = InputPack.HostDevices, Tags = InputPack.Tags } };
_edit_host_devices_window.Content = user_control;
_edit_default_host_devices_window.Content = user_control;
}

if (_edit_metadata_window != null)
Expand Down