From 64e15b5fecaa86277b2fd80bc7af469fe7c2e7eb Mon Sep 17 00:00:00 2001 From: Nathan Wreggit Date: Tue, 28 Mar 2023 19:11:05 -0700 Subject: [PATCH] Add details pane, add revert selected rows button (#11) --- FindAndReplaceCAD/CADUtil.cs | 20 +-- FindAndReplaceCAD/FindAndReplaceCAD.csproj | 7 + .../FindAndReplaceCAD.csproj.user | 2 +- FindAndReplaceCAD/MainWindow.xaml | 17 ++- FindAndReplaceCAD/MainWindow.xaml.cs | 44 ++++++- FindAndReplaceCAD/ObjectInformation.cs | 23 +++- .../UserControl/DetailsDialog.xaml | 120 ++++++++++++++++++ .../UserControl/DetailsDialog.xaml.cs | 16 +++ FindAndReplaceCAD/Util/DBTextUtil.cs | 4 +- FindAndReplaceCAD/Util/MLeaderUtil.cs | 8 +- FindAndReplaceCAD/Util/MTextUtil.cs | 2 +- 11 files changed, 231 insertions(+), 32 deletions(-) create mode 100644 FindAndReplaceCAD/UserControl/DetailsDialog.xaml create mode 100644 FindAndReplaceCAD/UserControl/DetailsDialog.xaml.cs diff --git a/FindAndReplaceCAD/CADUtil.cs b/FindAndReplaceCAD/CADUtil.cs index 7d2c87d..7929d5f 100644 --- a/FindAndReplaceCAD/CADUtil.cs +++ b/FindAndReplaceCAD/CADUtil.cs @@ -24,12 +24,12 @@ public static void WriteCADItems(IEnumerable items) TypeUtil.TypeInformation typeInfo = TypeUtil.GetTypeInformation(obj.Id); ITypeUtil typeUtil = typeInfo.TypeUtil; - if (typeUtil.CanTextBeEdited(obj)) + if (typeUtil.CanTextBeEdited(obj) && objInfo.HasTextChanged) { typeUtil.WriteText(obj, objInfo.NewText, myT); } - if (typeUtil.CanMaskBeEdited(obj)) + if (typeUtil.CanMaskBeEdited(obj) && objInfo.HasMaskChanged) { typeUtil.WriteMask(obj, objInfo.NewMask); } @@ -78,14 +78,14 @@ public static IList ReadCADItems() /// /// Text for a single element /// String with all characters escaped for AutoCAD - public static string ReplaceWithCADEscapeCharacters(string data) - { - data = data.Replace(@"\", @"\\"); // Must come first - data = data.Replace("\r\n", @"\P"); - data = data.Replace(@"{", @"\{"); - data = data.Replace(@"}", @"\}"); - return data; - } + //public static string ReplaceWithCADEscapeCharacters(string data) + //{ + // data = data.Replace(@"\", @"\\"); // Must come first + // data = data.Replace("\r\n", @"\P"); + // data = data.Replace(@"{", @"\{"); + // data = data.Replace(@"}", @"\}"); + // return data; + //} /// /// Moves and scales the viewport to center on the CAD element specified by its object ID diff --git a/FindAndReplaceCAD/FindAndReplaceCAD.csproj b/FindAndReplaceCAD/FindAndReplaceCAD.csproj index 64fdff9..a8877a1 100644 --- a/FindAndReplaceCAD/FindAndReplaceCAD.csproj +++ b/FindAndReplaceCAD/FindAndReplaceCAD.csproj @@ -70,6 +70,9 @@ + + DetailsDialog.xaml + FindAndReplace.xaml @@ -85,6 +88,10 @@ + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/FindAndReplaceCAD/FindAndReplaceCAD.csproj.user b/FindAndReplaceCAD/FindAndReplaceCAD.csproj.user index 581e742..a1532db 100644 --- a/FindAndReplaceCAD/FindAndReplaceCAD.csproj.user +++ b/FindAndReplaceCAD/FindAndReplaceCAD.csproj.user @@ -18,7 +18,7 @@ C:\Program Files\Autodesk\AutoCAD 2022\acad.exe - "C:\Users\natha\OneDrive\Desktop\CI-001 - Standard\CI-001.dwg" /b C:\Users\natha\OneDrive\Projects\AutoCAD\FindAndReplaceCAD\config\script.scr /nologo + C:\Users\natha\OneDrive\Projects\AutoCAD\FindAndReplaceCAD\config\Drawing1.dwg /b C:\Users\natha\OneDrive\Projects\AutoCAD\FindAndReplaceCAD\config\script.scr /nologo Program diff --git a/FindAndReplaceCAD/MainWindow.xaml b/FindAndReplaceCAD/MainWindow.xaml index ce7cfec..ddda6fe 100644 --- a/FindAndReplaceCAD/MainWindow.xaml +++ b/FindAndReplaceCAD/MainWindow.xaml @@ -7,7 +7,7 @@ mc:Ignorable="d" Title="Find and Replace" Height="800" - Width="918" + Width="1000" Name="MainControlWindow"> @@ -41,6 +41,7 @@