Skip to content
Draft
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ packages/

# JetBrains IDEs
.idea/

TEMP_WPF/
22 changes: 22 additions & 0 deletions DarkUI/DarkUI.WPF/Converters/HtmlToUIColorConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Drawing;
using System.Globalization;
using System.Windows.Data;

namespace DarkUI.WPF.Converters;

public class HtmlToUIColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var colString = (string)value;
var col = ColorTranslator.FromHtml(colString);
return System.Windows.Media.Color.FromArgb(col.A, col.R, col.G, col.B);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
var col = (System.Windows.Media.Color)value;
return ColorTranslator.ToHtml(Color.FromArgb(col.A, col.R, col.G, col.B));
}
}
27 changes: 27 additions & 0 deletions DarkUI/DarkUI.WPF/Converters/VectorToBrushConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Globalization;
using System.Numerics;
using System.Windows.Data;
using System.Windows.Media;

namespace DarkUI.WPF.Converters;

public class VectorToBrushConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var vec = (Vector4)value;
byte r = (byte)(Math.Clamp(vec.X, 0.0f, 1.0f) * 255.0f);
byte g = (byte)(Math.Clamp(vec.Y, 0.0f, 1.0f) * 255.0f);
byte b = (byte)(Math.Clamp(vec.Z, 0.0f, 1.0f) * 255.0f);
byte a = (byte)(Math.Clamp(vec.W, 0.0f, 1.0f) * 255.0f);

return new SolidColorBrush(Color.FromArgb(a, r, g, b));
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
Color col = ((SolidColorBrush)value).Color;
return new Vector4(col.R / 255.0f, col.G / 255.0f, col.B / 255.0f, col.A / 255.0f);
}
}
26 changes: 26 additions & 0 deletions DarkUI/DarkUI.WPF/Converters/VectorToUIColorConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Globalization;
using System.Numerics;
using System.Windows.Data;
using System.Windows.Media;

namespace DarkUI.WPF.Converters;

public class VectorToUIColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var vec = (Vector4)value;
byte r = (byte)(Math.Clamp(vec.X, 0.0f, 1.0f) * 255.0f);
byte g = (byte)(Math.Clamp(vec.Y, 0.0f, 1.0f) * 255.0f);
byte b = (byte)(Math.Clamp(vec.Z, 0.0f, 1.0f) * 255.0f);
byte a = (byte)(Math.Clamp(vec.W, 0.0f, 1.0f) * 255.0f);
return Color.FromArgb(a, r, g, b);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
var col = (Color)value;
return new Vector4(col.R / 255.0f, col.G / 255.0f, col.B / 255.0f, col.A / 255.0f);
}
}
1 change: 1 addition & 0 deletions DarkUI/DarkUI.WPF/Styles/NumericUpDown.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<!-- Brushes -->
<Setter Property="BorderBrush" Value="{DynamicResource Brush_Border}" />
<Setter Property="Foreground" Value="{DynamicResource Brush_Text}" />

<!-- Thicknesses -->
<Setter Property="BorderThickness" Value="{x:Static local:Defaults.BorderThickness}" />
Expand Down
45 changes: 35 additions & 10 deletions TombEditor/Command.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using DarkUI.Controls;
using DarkUI.Forms;
using NLog;
using System;
using System.Collections.Generic;
Expand All @@ -7,20 +9,28 @@
using System.Numerics;
using System.Text;
using System.Windows.Forms;
using DarkUI.Controls;
using DarkUI.Forms;
using TombEditor.Controls;
using TombEditor.Features.DockableViews.ContentBrowser;
using TombEditor.Features.DockableViews.ImportedGeometryBrowser;
using TombEditor.Features.DockableViews.ItemBrowser;
using TombEditor.Features.DockableViews.LightingPanel;
using TombEditor.Features.DockableViews.ObjectList;
using TombEditor.Features.DockableViews.PalettePanel;
using TombEditor.Features.DockableViews.RoomOptionsPanel;
using TombEditor.Features.DockableViews.SectorOptionsPanel;
using TombEditor.Features.DockableViews.TexturePanel;
using TombEditor.Features.DockableViews.TriggerList;
using TombEditor.Features.Panel3D.ToolPalette;
using TombEditor.Forms;
using TombEditor.ToolWindows;
using TombLib;
using TombLib.Controls;
using TombLib.Forms;
using TombLib.LevelData;
using TombLib.Wad;
using TombLib.Wad.Catalog;
using TombLib.Utils;
using TombLib.LevelData.SectorEnums;
using TombLib.LevelData.SectorEnums.Extensions;
using TombEditor.Controls;
using TombLib.Utils;
using TombLib.Wad;
using TombLib.Wad.Catalog;

namespace TombEditor
{
Expand Down Expand Up @@ -53,6 +63,14 @@ public class CommandArgs
public Editor Editor;
public IWin32Window Window;
public Keys KeyData = Keys.None;

public CommandArgs() { }

public CommandArgs(IWin32Window window, Editor editor)
{
Window = window;
Editor = editor;
}
}

public static class CommandHandler
Expand All @@ -69,6 +87,13 @@ public static CommandObj GetCommand(string name)
return command;
}

public static System.Windows.Input.ICommand GetCommand(string name, CommandArgs args)
{
var command = GetCommand(name);
return new CommunityToolkit.Mvvm.Input.RelayCommand(
() => command.Execute?.Invoke(args));
}

public static void ExecuteHotkey(CommandArgs args)
{
var hotkeyForCommands = args.Editor.Configuration.UI_Hotkeys.Where(set => set.Value.Contains(args.KeyData));
Expand Down Expand Up @@ -1795,7 +1820,7 @@ static CommandHandler()
args.Editor.ConfigurationChange();
});

AddCommand("DrawWhiteTextureLightingOnly", "Draw untextured in Lighting Mode", CommandType.View, delegate (CommandArgs args)
AddCommand("DrawWhiteTextureLightingOnly", "Draw untextured in Lighting Mode", CommandType.View, delegate (CommandArgs args)
{
args.Editor.Configuration.Rendering3D_ShowLightingWhiteTextureOnly = !args.Editor.Configuration.Rendering3D_ShowLightingWhiteTextureOnly;
args.Editor.ConfigurationChange();
Expand Down Expand Up @@ -2244,7 +2269,7 @@ static CommandHandler()
args.Editor.ActivateDefaultControl(nameof(FormMain));
});

AddCommand("DeleteAllLights", "Delete lights in selected rooms", CommandType.Edit, delegate (CommandArgs args)
AddCommand("DeleteAllLights", "Delete lights in selected rooms", CommandType.Edit, delegate (CommandArgs args)
{
if (DarkMessageBox.Show(args.Window, "Do you want to delete all lights in level? This action can't be undone.",
"Delete all lights", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
Expand All @@ -2263,7 +2288,7 @@ static CommandHandler()
}
});

AddCommand("GetObjectStatistics", "Copy object statistics into clipboard", CommandType.Objects, delegate (CommandArgs args)
AddCommand("GetObjectStatistics", "Copy object statistics into clipboard", CommandType.Objects, delegate (CommandArgs args)
{
SortedDictionary<WadMoveableId,uint> moveablesCount = new SortedDictionary<WadMoveableId, uint>();
SortedDictionary<WadStaticId,uint> staticsCount = new SortedDictionary<WadStaticId, uint>();
Expand Down
16 changes: 0 additions & 16 deletions TombEditor/Controls/ObjectBrush/ObjectBrushConstants.cs

This file was deleted.

46 changes: 0 additions & 46 deletions TombEditor/Controls/ObjectBrush/ObjectBrushToolbox.cs

This file was deleted.

Loading