diff --git a/.github/workflows/Workflow.yml b/.github/workflows/Workflow.yml index 9f0147b..546981d 100644 --- a/.github/workflows/Workflow.yml +++ b/.github/workflows/Workflow.yml @@ -16,6 +16,6 @@ jobs: - name: Checkout uses: actions/checkout@v1 with: - submodules: true + submodules: false - name: Run Nuke Build run: ./.nuke/build.cmd --GitHubToken ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e903961..0000000 --- a/.gitmodules +++ /dev/null @@ -1,8 +0,0 @@ -[submodule "AutoCADLookup"] - path = AutoCADLookup - url = https://github.com/chuongmep/AutoCADLookup.git - ignore = dirty -[submodule "MgdDbg"] - path = MgdDbg - url = https://github.com/chuongmep/MgdDbg.git - ignore = dirty \ No newline at end of file diff --git a/AutoCADLookup b/AutoCADLookup deleted file mode 160000 index 4d52bb9..0000000 --- a/AutoCADLookup +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4d52bb9afb41e1489b80f62d0e3b1c901a8504b2 diff --git a/CADPythonShell.sln b/CADPythonShell.sln index 7857f83..078e858 100644 --- a/CADPythonShell.sln +++ b/CADPythonShell.sln @@ -13,7 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution CONTRIBUTING.md = CONTRIBUTING.md README.md = README.md RPS LICENSE.txt = RPS LICENSE.txt - .gitmodules = .gitmodules + .github\workflows\Workflow.yml = .github\workflows\Workflow.yml + CADPythonShell\PackageContents.xml = CADPythonShell\PackageContents.xml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CADPythonShell", "CADPythonShell\CADPythonShell.csproj", "{7E37F14E-D840-42F8-8CA6-90FFC5497972}" @@ -24,9 +25,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Build", "build\Build.csproj EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Installer", "Installer\Installer.csproj", "{51C417E1-279A-46C2-B3AE-1FDE56FEE5AB}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CADSnoop", "AutoCADLookup\CADSnoop.csproj", "{275C1B41-9089-4817-B48F-564A72A6D121}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MgdDbg", "MgdDbgLibrary\MgdDbg.csproj", "{A5639047-58FE-42F3-95D5-4ADC1F51F120}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MgdDbg", "MgdDbg\MgdDbg.csproj", "{C9B52572-4947-4AD7-86CE-EFB7A036FA9F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CADSnoop", "CadLookup\CADSnoop.csproj", "{19C935D2-8649-496F-ADD4-3D5E370B441A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -61,16 +62,18 @@ Global {51C417E1-279A-46C2-B3AE-1FDE56FEE5AB}.Installer|Any CPU.Build.0 = Release|Any CPU {51C417E1-279A-46C2-B3AE-1FDE56FEE5AB}.Release A23|Any CPU.ActiveCfg = Release|Any CPU {51C417E1-279A-46C2-B3AE-1FDE56FEE5AB}.Release A23|Any CPU.Build.0 = Release|Any CPU - {275C1B41-9089-4817-B48F-564A72A6D121}.Debug A23|Any CPU.ActiveCfg = Debug|Any CPU - {275C1B41-9089-4817-B48F-564A72A6D121}.Debug A23|Any CPU.Build.0 = Debug|Any CPU - {275C1B41-9089-4817-B48F-564A72A6D121}.Installer|Any CPU.ActiveCfg = Debug|Any CPU - {275C1B41-9089-4817-B48F-564A72A6D121}.Release A23|Any CPU.ActiveCfg = Release|Any CPU - {275C1B41-9089-4817-B48F-564A72A6D121}.Release A23|Any CPU.Build.0 = Release|Any CPU - {C9B52572-4947-4AD7-86CE-EFB7A036FA9F}.Debug A23|Any CPU.ActiveCfg = Debug|Any CPU - {C9B52572-4947-4AD7-86CE-EFB7A036FA9F}.Debug A23|Any CPU.Build.0 = Debug|Any CPU - {C9B52572-4947-4AD7-86CE-EFB7A036FA9F}.Installer|Any CPU.ActiveCfg = Debug|Any CPU - {C9B52572-4947-4AD7-86CE-EFB7A036FA9F}.Release A23|Any CPU.ActiveCfg = Debug|Any CPU - {C9B52572-4947-4AD7-86CE-EFB7A036FA9F}.Release A23|Any CPU.Build.0 = Debug|Any CPU + {A5639047-58FE-42F3-95D5-4ADC1F51F120}.Debug A23|Any CPU.ActiveCfg = Debug|Any CPU + {A5639047-58FE-42F3-95D5-4ADC1F51F120}.Debug A23|Any CPU.Build.0 = Debug|Any CPU + {A5639047-58FE-42F3-95D5-4ADC1F51F120}.Installer|Any CPU.ActiveCfg = Debug|Any CPU + {A5639047-58FE-42F3-95D5-4ADC1F51F120}.Installer|Any CPU.Build.0 = Debug|Any CPU + {A5639047-58FE-42F3-95D5-4ADC1F51F120}.Release A23|Any CPU.ActiveCfg = Debug|Any CPU + {A5639047-58FE-42F3-95D5-4ADC1F51F120}.Release A23|Any CPU.Build.0 = Debug|Any CPU + {19C935D2-8649-496F-ADD4-3D5E370B441A}.Debug A23|Any CPU.ActiveCfg = Debug|Any CPU + {19C935D2-8649-496F-ADD4-3D5E370B441A}.Debug A23|Any CPU.Build.0 = Debug|Any CPU + {19C935D2-8649-496F-ADD4-3D5E370B441A}.Installer|Any CPU.ActiveCfg = Debug|Any CPU + {19C935D2-8649-496F-ADD4-3D5E370B441A}.Installer|Any CPU.Build.0 = Debug|Any CPU + {19C935D2-8649-496F-ADD4-3D5E370B441A}.Release A23|Any CPU.ActiveCfg = Debug|Any CPU + {19C935D2-8649-496F-ADD4-3D5E370B441A}.Release A23|Any CPU.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CADPythonShell/App/CADPythonShellApplication.cs b/CADPythonShell/App/CADPythonShellApplication.cs index b4ba220..68fc05b 100644 --- a/CADPythonShell/App/CADPythonShellApplication.cs +++ b/CADPythonShell/App/CADPythonShellApplication.cs @@ -5,7 +5,7 @@ using System.Xml.Linq; using Forms = System.Windows.Forms; -namespace CADPythonShell +namespace CADPythonShell.App { internal static class CADPythonShellApplication { diff --git a/CADPythonShell/App/IronPythonConsoleApp.cs b/CADPythonShell/App/IronPythonConsoleApp.cs index 537c331..b43169e 100644 --- a/CADPythonShell/App/IronPythonConsoleApp.cs +++ b/CADPythonShell/App/IronPythonConsoleApp.cs @@ -1,9 +1,9 @@ using Autodesk.AutoCAD.Runtime; using Autodesk.Windows; -using MgdDbg; +using CADPythonShell.Command; using Orientation = System.Windows.Controls.Orientation; -namespace CADPythonShell +namespace CADPythonShell.App { public class IronPythonConsoleApp : ICadCommand { @@ -164,7 +164,7 @@ private static RibbonPanel AddPanelTwo() "CADPythonShell.Resources.handle-16.png"), LargeImage = CADPythonShellApplication.GetEmbeddedPng(addinAssembly, "CADPythonShell.Resources.handle-32.png"), - CommandHandler = new RelayCommand(new SnoopByHanderCommand().Execute), + CommandHandler = new RelayCommand(new SnoopByHandleCommand().Execute), AllowInToolBar = true, KeyTip = "Snoop By Handle", }; @@ -175,7 +175,7 @@ private static RibbonPanel AddPanelTwo() Size = RibbonItemSize.Large, Name = nameof(MgdDbgAction.SnoopEnts), ShowText = true, - Text ="Snoop\nEntities", + Text = "Snoop\nEntities", Description = $"Start snoop Snoop Entities inside Autocad \n Command: {nameof(MgdDbgAction.SnoopEnts)}", Image = CADPythonShellApplication.GetEmbeddedPng(addinAssembly, "CADPythonShell.Resources.snoopentities-16.png"), diff --git a/CADPythonShell/CADPythonShell.csproj b/CADPythonShell/CADPythonShell.csproj index 0caa312..417a3fb 100644 --- a/CADPythonShell/CADPythonShell.csproj +++ b/CADPythonShell/CADPythonShell.csproj @@ -7,15 +7,16 @@ false true true + x64 Debug A23 $(Configurations);Release A23 true - + true full @@ -26,7 +27,7 @@ none $(DefineConstants);RELEASE - + $(DefineConstants);A23 @@ -222,12 +223,12 @@ - - + + diff --git a/CADPythonShell/Command/CommandLoaderBase.cs b/CADPythonShell/Command/CommandLoaderBase.cs index 72bf848..e570ddf 100644 --- a/CADPythonShell/Command/CommandLoaderBase.cs +++ b/CADPythonShell/Command/CommandLoaderBase.cs @@ -1,7 +1,8 @@ -using CADRuntime; +using CADPythonShell.App; +using CADRuntime; using System.IO; -namespace CADPythonShell +namespace CADPythonShell.Command { /// /// Starts up a ScriptOutput window for a given canned command. diff --git a/CADPythonShell/Command/ConfigureCommand.cs b/CADPythonShell/Command/ConfigureCommand.cs index 318ad03..6427ac2 100644 --- a/CADPythonShell/Command/ConfigureCommand.cs +++ b/CADPythonShell/Command/ConfigureCommand.cs @@ -1,7 +1,8 @@ using Autodesk.AutoCAD.Runtime; +using CADPythonShell.App; using Application = Autodesk.AutoCAD.ApplicationServices.Core.Application; -namespace CADPythonShell +namespace CADPythonShell.Command { /// /// Open the configuration dialog. diff --git a/CADPythonShell/Command/ICadCommand.cs b/CADPythonShell/Command/ICadCommand.cs index 740e799..38630fe 100644 --- a/CADPythonShell/Command/ICadCommand.cs +++ b/CADPythonShell/Command/ICadCommand.cs @@ -1,4 +1,4 @@ -namespace CADPythonShell; +namespace CADPythonShell.Command; public abstract class ICadCommand { diff --git a/CADPythonShell/Command/IronPythonConsoleCommand.cs b/CADPythonShell/Command/IronPythonConsoleCommand.cs index 865a6bc..f23160c 100644 --- a/CADPythonShell/Command/IronPythonConsoleCommand.cs +++ b/CADPythonShell/Command/IronPythonConsoleCommand.cs @@ -1,5 +1,6 @@ using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.Runtime; +using CADPythonShell.App; using CADRuntime; using Microsoft.Scripting; using System.Windows; @@ -9,7 +10,7 @@ using Exception = System.Exception; using Forms = System.Windows.Forms; -namespace CADPythonShell +namespace CADPythonShell.Command { public class IronPythonConsoleCommand : ICadCommand { diff --git a/CADPythonShell/Command/SnoopByHandleCommand.cs b/CADPythonShell/Command/SnoopByHandleCommand.cs index ab62eaa..dfadf39 100644 --- a/CADPythonShell/Command/SnoopByHandleCommand.cs +++ b/CADPythonShell/Command/SnoopByHandleCommand.cs @@ -1,12 +1,12 @@ -using Application = Autodesk.AutoCAD.ApplicationServices.Application; +using MgdDbg.App; -namespace CADPythonShell; +namespace CADPythonShell.Command; -public class SnoopByHanderCommand : ICadCommand +public class SnoopByHandleCommand : ICadCommand { public override void Execute() { - string fullCmdLine = $"_{nameof(MgdDbgAction.SnoopByHandle)}\n"; - Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(fullCmdLine, false, false, true); + TestCmds testCmds = new TestCmds(); + testCmds.SnoopEntityByHandle(); } } \ No newline at end of file diff --git a/CADPythonShell/Command/SnoopCommand.cs b/CADPythonShell/Command/SnoopCommand.cs index dc316f7..e0638be 100644 --- a/CADPythonShell/Command/SnoopCommand.cs +++ b/CADPythonShell/Command/SnoopCommand.cs @@ -1,13 +1,13 @@ using Autodesk.AutoCAD.Runtime; -namespace CADPythonShell +namespace CADPythonShell.Command { public class SnoopCommand : ICadCommand { [CommandMethod("Snoop")] public override void Execute() { - new CADSnoop.SnoopCommand().Snoop(); + new CADSnoop.SnoopCommand().Snoop(); } } -} +} \ No newline at end of file diff --git a/CADPythonShell/Command/SnoopDBCommand.cs b/CADPythonShell/Command/SnoopDBCommand.cs index fe9cc02..94ff01b 100644 --- a/CADPythonShell/Command/SnoopDBCommand.cs +++ b/CADPythonShell/Command/SnoopDBCommand.cs @@ -1,12 +1,12 @@ -using Application = Autodesk.AutoCAD.ApplicationServices.Core.Application; +using MgdDbg.App; -namespace CADPythonShell; +namespace CADPythonShell.Command; public class SnoopDBCommand : ICadCommand { public override void Execute() { - string fullCmdLine = $"_{nameof(MgdDbgAction.SnoopDB)}\n"; - Application.DocumentManager.MdiActiveDocument.SendStringToExecute(fullCmdLine, false, false, true); + TestCmds cmd = new TestCmds(); + cmd.SnoopDatabase(); } } \ No newline at end of file diff --git a/CADPythonShell/Command/SnoopEditorCommand.cs b/CADPythonShell/Command/SnoopEditorCommand.cs index 0d74dca..34e34df 100644 --- a/CADPythonShell/Command/SnoopEditorCommand.cs +++ b/CADPythonShell/Command/SnoopEditorCommand.cs @@ -1,10 +1,12 @@ -namespace CADPythonShell; +using MgdDbg.App; + +namespace CADPythonShell.Command; public class SnoopEditorCommand : ICadCommand { public override void Execute() { - string fullCmdLine = $"_{nameof(MgdDbgAction.SnoopEd)}\n"; - Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(fullCmdLine, false, false, true); + TestCmds cmd = new TestCmds(); + cmd.SnoopEd(); } } \ No newline at end of file diff --git a/CADPythonShell/Command/SnoopEntitiesCommand.cs b/CADPythonShell/Command/SnoopEntitiesCommand.cs index 7b455a4..77993b4 100644 --- a/CADPythonShell/Command/SnoopEntitiesCommand.cs +++ b/CADPythonShell/Command/SnoopEntitiesCommand.cs @@ -1,10 +1,12 @@ -namespace CADPythonShell; +using MgdDbg.App; + +namespace CADPythonShell.Command; public class SnoopEntitiesCommand : ICadCommand { public override void Execute() { - string fullCmdLine = $"_{nameof(MgdDbgAction.SnoopEnts)}\n"; - Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(fullCmdLine, false, false, true); + TestCmds cmd = new TestCmds(); + cmd.SnoopEntity(); } } \ No newline at end of file diff --git a/CADPythonShell/Command/SnoopEntitiesNestedCommand.cs b/CADPythonShell/Command/SnoopEntitiesNestedCommand.cs index e3dcc2e..2223dfa 100644 --- a/CADPythonShell/Command/SnoopEntitiesNestedCommand.cs +++ b/CADPythonShell/Command/SnoopEntitiesNestedCommand.cs @@ -1,10 +1,12 @@ -namespace CADPythonShell; +using MgdDbg.App; + +namespace CADPythonShell.Command; public class SnoopEntitiesNestedCommand : ICadCommand { public override void Execute() { - string fullCmdLine = $"_{nameof(MgdDbgAction.SnoopNEnts)}\n"; - Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(fullCmdLine, false, false, true); + TestCmds cmd = new TestCmds(); + cmd.SnoopNestedEntity(); } } \ No newline at end of file diff --git a/CADPythonShell/Command/SnoopEventsCommand.cs b/CADPythonShell/Command/SnoopEventsCommand.cs index 5bba961..ec4656f 100644 --- a/CADPythonShell/Command/SnoopEventsCommand.cs +++ b/CADPythonShell/Command/SnoopEventsCommand.cs @@ -1,10 +1,12 @@ -namespace CADPythonShell; +using MgdDbg.App; + +namespace CADPythonShell.Command; public class SnoopEventsCommand : ICadCommand { public override void Execute() { - string fullCmdLine = $"_{nameof(MgdDbgAction.SnoopEvents)}\n"; - Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(fullCmdLine, false, false, true); + TestCmds cmd = new TestCmds(); + cmd.Events(); } } \ No newline at end of file diff --git a/CADPythonShell/Command/TestFrameworkCommand.cs b/CADPythonShell/Command/TestFrameworkCommand.cs index ab279a3..45562f7 100644 --- a/CADPythonShell/Command/TestFrameworkCommand.cs +++ b/CADPythonShell/Command/TestFrameworkCommand.cs @@ -1,10 +1,12 @@ -namespace CADPythonShell; +using MgdDbg.App; + +namespace CADPythonShell.Command; public class TestFrameworkCommand : ICadCommand { public override void Execute() { - string fullCmdLine = $"_{nameof(MgdDbgAction.SnoopTests)}\n"; - Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(fullCmdLine, false, false, true); + TestCmds cmd = new TestCmds(); + cmd.TestDb(); } } \ No newline at end of file diff --git a/CADPythonShell/ConfigureCommandsForm.cs b/CADPythonShell/ConfigureCommandsForm.cs index c6b5669..1359f72 100644 --- a/CADPythonShell/ConfigureCommandsForm.cs +++ b/CADPythonShell/ConfigureCommandsForm.cs @@ -1,10 +1,11 @@ -using System.IO; +using CADPythonShell.App; +using System.IO; namespace CADPythonShell { public partial class ConfigureCommandsForm : Form { - private List _commands; + private List _commands; private List _searchPaths; private List> _variables; @@ -50,7 +51,7 @@ private void ConfigureCommandsForm_Load(object sender, EventArgs e) /// private void lstCommands_SelectedIndexChanged(object sender, EventArgs e) { - var command = (Command)lstCommands.SelectedItem; + var command = (App.Command)lstCommands.SelectedItem; txtCommandName.Text = command.Name; txtCommandPath.Text = command.Source; txtCommandGroup.Text = command.Group; @@ -61,7 +62,7 @@ private void lstCommands_SelectedIndexChanged(object sender, EventArgs e) /// private void txtCommandName_TextChanged(object sender, EventArgs e) { - var command = (Command)lstCommands.SelectedItem; + var command = (App.Command)lstCommands.SelectedItem; command.Name = txtCommandName.Text; RefreshBindingContext(lstCommands, _commands); @@ -69,7 +70,7 @@ private void txtCommandName_TextChanged(object sender, EventArgs e) private void txtCommandGroup_TextChanged(object sender, EventArgs e) { - var command = (Command)lstCommands.SelectedItem; + var command = (App.Command)lstCommands.SelectedItem; command.Group = txtCommandGroup.Text; RefreshBindingContext(lstCommands, _commands); @@ -80,7 +81,7 @@ private void txtCommandGroup_TextChanged(object sender, EventArgs e) /// private void txtCommandPath_TextChanged(object sender, EventArgs e) { - var command = (Command)lstCommands.SelectedItem; + var command = (App.Command)lstCommands.SelectedItem; command.Source = txtCommandPath.Text; RefreshBindingContext(lstCommands, _commands); @@ -120,7 +121,7 @@ private void btnCommandAdd_Click(object sender, EventArgs e) if (dialog.ShowDialog(this) == DialogResult.OK) { - var command = new Command(); + var command = new App.Command(); command.Name = ""; command.Group = ""; command.Source = dialog.FileName; diff --git a/CADPythonShell/PackageContents.xml b/CADPythonShell/PackageContents.xml index 479e08f..77d42fc 100644 --- a/CADPythonShell/PackageContents.xml +++ b/CADPythonShell/PackageContents.xml @@ -26,5 +26,25 @@ AppDescription="a module snoop entities of CAD PythonShell" LoadOnAutoCADStartup="True"> + + + + + + + + \ No newline at end of file diff --git a/CADPythonShell/Properties/launchSettings.json b/CADPythonShell/Properties/launchSettings.json index 640621d..0c8962e 100644 --- a/CADPythonShell/Properties/launchSettings.json +++ b/CADPythonShell/Properties/launchSettings.json @@ -1,6 +1,6 @@ { "profiles": { - "CADPythonShell": { + "CAD23": { "commandName": "Executable", "executablePath": "C:\\Program Files\\Autodesk\\AutoCAD 2023\\acad.exe" } diff --git a/CADRuntime/CADRuntime.csproj b/CADRuntime/CADRuntime.csproj index 1019bfd..227cb22 100644 --- a/CADRuntime/CADRuntime.csproj +++ b/CADRuntime/CADRuntime.csproj @@ -54,6 +54,8 @@ + + @@ -62,6 +64,8 @@ + + @@ -69,6 +73,6 @@ - + \ No newline at end of file diff --git a/CADRuntime/Resources/IronPython.3.4.0.zip b/CADRuntime/Resources/IronPython.3.4.0.zip new file mode 100644 index 0000000..75452e6 Binary files /dev/null and b/CADRuntime/Resources/IronPython.3.4.0.zip differ diff --git a/CADRuntime/ScriptExecutor.cs b/CADRuntime/ScriptExecutor.cs index 42f3130..3cf9d4d 100644 --- a/CADRuntime/ScriptExecutor.cs +++ b/CADRuntime/ScriptExecutor.cs @@ -104,7 +104,7 @@ private void AddEmbeddedLib(ScriptEngine engine) // use embedded python lib var asm = this.GetType().Assembly; var resQuery = from name in asm.GetManifestResourceNames() - where name.ToLowerInvariant().EndsWith("python_27_lib.zip") + where name.ToLowerInvariant().EndsWith("ironpython.3.4.0.zip") select name; var resName = resQuery.Single(); var importer = new IronPython.Modules.ResourceMetaPathImporter(asm, resName); diff --git a/CADRuntime/SettingsDictionary.cs b/CADRuntime/SettingsDictionary.cs index 82f2464..e6365de 100644 --- a/CADRuntime/SettingsDictionary.cs +++ b/CADRuntime/SettingsDictionary.cs @@ -13,6 +13,7 @@ public class SettingsDictionary : IDictionary private readonly string _settingsPath; private XDocument _settings; private string nameVariable = "StringVariable"; + public SettingsDictionary(string settingsPath) { _settingsPath = settingsPath; diff --git a/CHANGELOG.md b/CHANGELOG.md index d64a875..a594481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,15 @@ # Changelog +- 2023-06-05 **1.1.3** + - Fix bug snoop selected instance with lock document. +- 2023-04-12 **1.1.2** + - Fix snoop selected instance + - Merge submodule +- 2022-12-17 **1.1.1** + - Fix code Autocomple List ironpython 3.4 +- 2022-12-17 **1.1.0** + - Fix Assembly Security from IronPython 3.4 [#6](https://github.com/chuongmep/CadPythonShell/issues/6) +- 2022-12-16 **1.0.9** + - Support IronPython 3.4 - 2022-05-12 **1.0.8** - Fix bug duplicate snoop [#4](https://github.com/chuongmep/CadPythonShell/issues/4) - 2022-04-12 **1.0.7** diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 309469f..d8d7e45 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,15 @@ - In the dev branch, implement and test you changes specific to the feature. - Build the project and make sure everything works. - Create well-documented commits of your changes. +- Update Submodule: + - git submodule update --remote +- Commit submodules in case change in submodule + - cd path/to/submodule + - git add + - git commit -m "comment" + - git push + - Create a pull request to submodules +- Update and commit submodule: git submodule update --remote - Submit a pull request to the origin:dev branch. #### Please avoid: diff --git a/CadLookup/.gitattributes b/CadLookup/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/CadLookup/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/CadLookup/App.config b/CadLookup/App.config new file mode 100644 index 0000000..ecdcf8a --- /dev/null +++ b/CadLookup/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/CadLookup/CADSnoop.csproj b/CadLookup/CADSnoop.csproj new file mode 100644 index 0000000..f9e49b8 --- /dev/null +++ b/CadLookup/CADSnoop.csproj @@ -0,0 +1,35 @@ + + + net48 + Library + false + true + true + true + + + + + + + None + + + + + ..\RefrencedAssemblies\accoremgd.dll + + + ..\RefrencedAssemblies\acdbmgd.dll + + + + + + + + + + + + \ No newline at end of file diff --git a/CadLookup/LICENSE b/CadLookup/LICENSE new file mode 100644 index 0000000..fdcdd08 --- /dev/null +++ b/CadLookup/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Long + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/CadLookup/Model/ObjectDetails.cs b/CadLookup/Model/ObjectDetails.cs new file mode 100644 index 0000000..c76e413 --- /dev/null +++ b/CadLookup/Model/ObjectDetails.cs @@ -0,0 +1,16 @@ +using System; + +namespace CADSnoop.Model +{ + /// + /// Information Of Object + /// + public class ObjectDetails + { + public string GroupName { get; set; } + public string PropName { get; set; } + public string Type { get; set; } + public string Value { get; set; } + public Object LinkObject { get; set; } + } +} diff --git a/CadLookup/Model/RelayCommand.cs b/CadLookup/Model/RelayCommand.cs new file mode 100644 index 0000000..0aa8db6 --- /dev/null +++ b/CadLookup/Model/RelayCommand.cs @@ -0,0 +1,41 @@ +using System; +using System.Windows.Input; + +namespace CADSnoop.Model +{ + public class RelayCommand : ICommand + { + readonly Action _execute; + readonly Func _canExecute; + + public RelayCommand(Action execute, Func canExecute) + { + if (execute == null) + throw new NullReferenceException("execute"); + + _execute = execute; + _canExecute = canExecute; + } + + public RelayCommand(Action execute) : this(execute, null) + { + + } + + public event EventHandler CanExecuteChanged + { + add => CommandManager.RequerySuggested += value; + remove => CommandManager.RequerySuggested -= value; + } + + public bool CanExecute(object parameter) + { + return _canExecute == null ? true : _canExecute(); + } + + public void Execute(object parameter) + { + _execute.Invoke(); + } + } +} diff --git a/CadLookup/Model/ViewModelBase.cs b/CadLookup/Model/ViewModelBase.cs new file mode 100644 index 0000000..badeec1 --- /dev/null +++ b/CadLookup/Model/ViewModelBase.cs @@ -0,0 +1,90 @@ +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.Reflection; +using System.Runtime.CompilerServices; + +namespace CADSnoop.Model +{ + public class ViewModelBase : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + + public virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + // + /// Called when the specified property has been changed. + /// + /// Name of the property. + /// The old value. + /// The new value. + protected virtual void OnPropertyChanged(string propertyName, object oldValue, object newValue) + { + this.OnPropertyChanged(propertyName); + } + + #region Can Optimize + /// + /// + /// + /// + /// + /// + /// + public void OnPropertyChanged(ref T property, T value, [CallerMemberName] string propertyName = "") + { + property = value; + var handler = PropertyChanged; + if (handler != null) + { + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + #endregion + + /// + /// Sets the property value. + /// + /// The type of the property. + /// The field. + /// The value. + /// Name of the property. + /// + /// True if the property was set. + /// + /// This method uses the CallerMemberNameAttribute to determine the property name. + protected bool SetValue(ref T field, T value, [System.Runtime.CompilerServices.CallerMemberName] string propertyName = "") + { + // ReSharper disable once RedundantNameQualifier + if (object.Equals(field, value)) + { + return false; + } + this.VerifyProperty(propertyName); + //// this.OnPropertyChanging(propertyName, field, value); + T oldValue = field; + field = value; + this.OnPropertyChanged(propertyName, oldValue, value); + return true; + } + + /// + /// Verifies the property name. + /// + /// Name of the property. + [Conditional("DEBUG")] + private void VerifyProperty(string propertyName) + { + var type = this.GetType(); + + // Look for a public property with the specified name. + var propertyInfo = type.GetTypeInfo().GetDeclaredProperty(propertyName); + + Debug.Assert(propertyInfo != null, string.Format(CultureInfo.InvariantCulture, "{0} is not a property of {1}", propertyName, type.FullName)); + } + } +} \ No newline at end of file diff --git a/CadLookup/Model/WindowHandle.cs b/CadLookup/Model/WindowHandle.cs new file mode 100644 index 0000000..ba52644 --- /dev/null +++ b/CadLookup/Model/WindowHandle.cs @@ -0,0 +1,68 @@ +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Windows; +using System.Windows.Interop; + +namespace CADSnoop.Model +{ + public static class WindowHandle + { + [DllImport("kernel32.dll")] + public static extern uint GetCurrentThreadId(); + + /// + /// Sets the given window's owner to Cad window. + /// + /// Target window. + public static void SetCadAsWindowOwner(this Window dialog) + { + if (null == dialog) { return; } + + WindowInteropHelper helper = new WindowInteropHelper(dialog); + helper.Owner = FindCadWindowHandle(); + } + + /// + /// Finds the Cad window handle. + /// + /// Revit window handle. + public static IntPtr FindCadWindowHandle() + { + try + { + IntPtr foundRevitHandle = IntPtr.Zero; + uint currentThreadID = GetCurrentThreadId(); + + // Search for the Revit process with current thread ID. + Process[] revitProcesses = Process.GetProcessesByName("acad"); + Process foundRevitProcess = null; + foreach (Process aRevitProcess in revitProcesses) + { + foreach (ProcessThread aThread in aRevitProcess.Threads) + { + if (aThread.Id == currentThreadID) + { + foundRevitProcess = aRevitProcess; + break; + } + } // For each thread in the process. + + // When we have found our Revit process, then stop searching. + if (null != foundRevitProcess) { break; } + } // For each revit process found + + if (null != foundRevitProcess) + { + foundRevitHandle = foundRevitProcess.MainWindowHandle; + } + + return foundRevitHandle; + } + catch (Exception) + { + return IntPtr.Zero; + } + } + } +} diff --git a/CadLookup/PackageContents.xml b/CadLookup/PackageContents.xml new file mode 100644 index 0000000..9096d79 --- /dev/null +++ b/CadLookup/PackageContents.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/CadLookup/Properties/AssemblyInfo.cs b/CadLookup/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0d0d053 --- /dev/null +++ b/CadLookup/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SnooAutoCADCSharp")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("HTL")] +[assembly: AssemblyProduct("SnooAutoCADCSharp")] +[assembly: AssemblyCopyright("Copyright © HTL 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CadLookup/Properties/Resources.Designer.cs b/CadLookup/Properties/Resources.Designer.cs new file mode 100644 index 0000000..95f5b85 --- /dev/null +++ b/CadLookup/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SnoopAutoCADCSharp.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SnoopAutoCADCSharp.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/CadLookup/Properties/Resources.resx b/CadLookup/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/CadLookup/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CadLookup/Properties/Settings.Designer.cs b/CadLookup/Properties/Settings.Designer.cs new file mode 100644 index 0000000..b8c5c75 --- /dev/null +++ b/CadLookup/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SnoopAutoCADCSharp.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/CadLookup/Properties/Settings.settings b/CadLookup/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/CadLookup/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/CadLookup/README.md b/CadLookup/README.md new file mode 100644 index 0000000..a3e57f6 --- /dev/null +++ b/CadLookup/README.md @@ -0,0 +1,49 @@ + +# AutoCADLookup + +![Autocad API](https://img.shields.io/badge/Autocad%20API-2022-blue.svg) +![Platform](https://img.shields.io/badge/platform-Windows-lightgray.svg) +![.NET](https://img.shields.io/badge/.NET6-blue.svg) +[![License](http://img.shields.io/:license-mit-blue.svg)](http://opensource.org/licenses/MIT) + +Interactive Autocad BIM database exploration tool to view and navigate element properties and relationships. + +### Setup + +Open the SnoopAutoCADCSharp.sln on Visual Studio 2022. All references should be ready for AutoCAD 2022 default install path, otherwise go to project properties >> References, then click on Reference Paths and adjust. Build the project in Release, the DLL should be placed at same folder. Copy the entire .bundle folder to C:\Program Files\Autodesk\Autodesk\ApplicationPlugins folder and launch Autocad. + +## Installation + +- Download last install stable(msi) from CadPythonShell [Release](https://github.com/chuongmep/CADPythonShell/releases/latest) +- Use command `Snoop` to open Window or use button Snoop from Ribbon +- See guide install detail at [How-to-Install-CadPythonShell](https://github.com/chuongmep/CadPythonShell/wiki/How-to-Install-CadPythonShell) + +Note : Support for 4 last version(2019-2022) Autocad or Civil 3D. Older versions can be used but will not guarantee the expected performance. + +# Usage + +- On AutoCAD , command the "Snoop" option, the main form should appear. At the left side is a list of the main collections on the active document. On the right side, the properties of the item selected on the left. + +- Can continue Snoop Database to check. + +![](Documents/_Image_bfad9808-fa10-4857-8d77-f1f0b161433f.png) + +### Author + +First Project write sypport Autocad and Civi3D with language VB.NET by Augusto Goncalves @augustomaia , member of the Autodesk Developer Technical Services team. + +Now project update in .NET C# by htlcnn and Hồ Văn Chương + +### Known Issues + +The tool may stop working on some properties that cannot be reflected (using .NET). + +### Demo + +![](Documents/SnoopCad.gif) + +### Release History + +1.0.0 : First Release + + diff --git a/CadLookup/SnoopAutoCADCSharp.sln b/CadLookup/SnoopAutoCADCSharp.sln new file mode 100644 index 0000000..b94ce74 --- /dev/null +++ b/CadLookup/SnoopAutoCADCSharp.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32317.152 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CADSnoop", "CADSnoop.csproj", "{4AB3C6E6-D513-461D-BA9A-6F081E50323A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4AB3C6E6-D513-461D-BA9A-6F081E50323A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4AB3C6E6-D513-461D-BA9A-6F081E50323A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4AB3C6E6-D513-461D-BA9A-6F081E50323A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4AB3C6E6-D513-461D-BA9A-6F081E50323A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7C89A58D-A042-49B9-8849-1DEF4397E06F} + EndGlobalSection +EndGlobal diff --git a/CadLookup/SnoopCommand.cs b/CadLookup/SnoopCommand.cs new file mode 100644 index 0000000..82284d2 --- /dev/null +++ b/CadLookup/SnoopCommand.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Runtime; +using CADSnoop.Model; +using CADSnoop.View; +using CADSnoop.ViewModel; +using Application = Autodesk.AutoCAD.ApplicationServices.Core.Application; +using Exception = System.Exception; + +namespace CADSnoop +{ + public class SnoopCommand + { + [CommandMethod("Snoop")] + public void Snoop() + { + Snoop(new List()); + } + /// + /// Snoop Snoop a object by id + /// + /// + public void Snoop(ObjectId objectId) + { + Snoop(new List(){objectId}); + } + /// + /// snoop by dbobject + /// + /// + /// + public void Snoop(DBObject dbObject) + { + if (dbObject == null) throw new ArgumentException(nameof(dbObject)); + Document doc = Application.DocumentManager.MdiActiveDocument; + Editor ed = doc.Editor; + Database db = doc.Database; + using (DocumentLock lockDoc = doc.LockDocument()) + { + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + { + SnoopViewModel vm = new SnoopViewModel(doc, db, dbObject); + MainWindow form = new MainWindow(vm); + form.SetCadAsWindowOwner(); + form.Show(); + } + tran.Commit(); + } + } + } + /// + /// Snoop snoop object by list object id + /// + /// + public void Snoop(List objectIds) + { + try + { + Document doc = Application.DocumentManager.MdiActiveDocument; + Editor ed = doc.Editor; + Database db = doc.Database; + using (DocumentLock lockDoc = doc.LockDocument()) + { + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + if (objectIds == null || objectIds.Count==0) objectIds = PickObjectBySelect(doc); + if (objectIds != null) + { + SnoopViewModel vm = new SnoopViewModel(doc, db, objectIds); + MainWindow form = new MainWindow(vm); + form.SetCadAsWindowOwner(); + form.Show(); + } + tran.Commit(); + } + } + } + catch (Exception ex) + { + MessageBox.Show(ex.ToString()); + } + } + List PickObjectBySelect(Document doc) + { + try + { + //PromptSelectionOptions poOptions = new PromptSelectionOptions(); + //poOptions.SingleOnly = true; + PromptSelectionResult promptSelectionResult = doc.Editor.GetSelection(); + if (promptSelectionResult.Status != PromptStatus.OK) return null; + SelectionSet selectionSet = promptSelectionResult.Value; + return selectionSet.GetObjectIds().ToList(); + } + catch (ArgumentNullException) { } + catch (NullReferenceException) { } + catch (Exception e) + { + MessageBox.Show(e.ToString()); + } + + return null; + } + + } +} diff --git a/CadLookup/View/MainWindow.xaml b/CadLookup/View/MainWindow.xaml new file mode 100644 index 0000000..a167af0 --- /dev/null +++ b/CadLookup/View/MainWindow.xaml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CadLookup/View/MainWindow.xaml.cs b/CadLookup/View/MainWindow.xaml.cs new file mode 100644 index 0000000..931c1dc --- /dev/null +++ b/CadLookup/View/MainWindow.xaml.cs @@ -0,0 +1,135 @@ +using System.Collections.Generic; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using Autodesk.AutoCAD.DatabaseServices; +using CADSnoop.Model; +using CADSnoop.ViewModel; +using Exception = System.Exception; + +namespace CADSnoop.View +{ + + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + private SnoopViewModel _viewModel; + + public MainWindow() + { + InitializeComponent(); + } + public MainWindow(SnoopViewModel vm) :this() + { + this._viewModel = vm; + this.DataContext = vm; + SnoopViewModel.FrmMain = this; + } + + private void Treeview_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs e) + { + try + { + + TreeViewCustomItem selected = e.NewValue as TreeViewCustomItem; + object obj = selected.Object; + DBObject dbObject = obj as DBObject; + if (dbObject != null) + { + foreach (KeyValuePair> pair in _viewModel.DataMethod) + { + if (pair.Key == dbObject.Id.ToString()) + { + _viewModel.LisViewItems = new List(); + _viewModel.LisViewItems = pair.Value; + } + } + + _viewModel.UpdateDataSource(_viewModel.LisViewItems); + } + + } + catch (Exception ex) + { + MessageBox.Show(ex.InnerException.StackTrace); + } + } + + private void ListViewItem_DoubleClick(object sender, MouseButtonEventArgs e) + { + if (this.listview.SelectedItems.Count != 1) + { + return; + } + ObjectDetails selectedItem = this.listview.SelectedItem as ObjectDetails; + object LinkObject = selectedItem.LinkObject; + if (LinkObject is null) + { + return; + } + if (_viewModel.IsEnumerable(LinkObject)) + { + using (_viewModel.doc.LockDocument()) + { + _viewModel.CollectionItemSelected(LinkObject); + } + + } + else if (LinkObject is ObjectId objectId) + { + if (!IsExcept(objectId)) + { + using (_viewModel.doc.LockDocument()) + { + _viewModel.ObjectIdItemSelected(objectId); + } + } + } + } + + + private void ContextMenu_MouseDown(object sender, RoutedEventArgs e) + { + MenuItem menuitem = sender as MenuItem; + if (menuitem != null) + { + ContextMenu parent_contextmenu = menuitem.CommandParameter as ContextMenu; + if (parent_contextmenu != null) + { + string clip = ""; + foreach (var item in this.listview.SelectedItems) + { + ObjectDetails objectDetails = item as ObjectDetails; + clip += objectDetails.PropName + "\t" + objectDetails.Type + "\t" + objectDetails.Value + "\n"; + } + Clipboard.SetText(clip); + } + } + } + + private void Window_PreviewKeyDown(object sender, KeyEventArgs e) + { + if (e.Key == Key.Escape) + { + Close(); + } + } + + + bool IsExcept(ObjectId objectId) + { + if (objectId.IsNull) return true; + if (objectId.ToString() == "0") return true; + if (objectId.ToString() == "(0)") return true; + return false; + } + + private void ButtonBase_OnClick(object sender, RoutedEventArgs e) + { + Close(); + } + } +} + diff --git a/CadLookup/ViewModel/SnoopViewModel.cs b/CadLookup/ViewModel/SnoopViewModel.cs new file mode 100644 index 0000000..9689745 --- /dev/null +++ b/CadLookup/ViewModel/SnoopViewModel.cs @@ -0,0 +1,403 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Linq; +using System.Reflection; +using System.Windows; +using System.Windows.Data; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using CADSnoop.Model; +using CADSnoop.View; +using Application = Autodesk.AutoCAD.ApplicationServices.Core.Application; +using Exception = System.Exception; + +namespace CADSnoop.ViewModel +{ + public class SnoopViewModel : ViewModelBase + + { + private Dictionary> dataMethod; + + public Dictionary> DataMethod + { + get => dataMethod; + set => dataMethod = value; + } + + private const string stringEmpty = "[Empty]"; + private const string stringEmptyCollection = "[Empty Collection]"; + private const string stringCollection = "[Collection]"; + public Editor Ed; + public Document doc; + public Database Database; + public static MainWindow FrmMain; + + public List ObjectIds; + + private List listviewitems; + + public List LisViewItems + { + get + { + if (listviewitems == null) + { + listviewitems = new List(); + } + return listviewitems; + } + set => OnPropertyChanged(ref listviewitems, value); + } + + private List treeViewItems; + + public List TreeViewItems + { + get + { + if (treeViewItems == null) + { + treeViewItems = new List(); + } + return treeViewItems; + } + set => OnPropertyChanged(ref treeViewItems, value); + } + + public SnoopViewModel(Document doc, Database db) + { + this.doc = doc; + this.Ed = doc.Editor; + this.Database = db; + this.dataMethod = new Dictionary>(); + + } + /// + /// Base Model + /// + /// + /// + public SnoopViewModel(Document doc, Database db, List objectIds) : this(doc,db) + { + this.ObjectIds = objectIds; + GetListViewItem(); + } + + public SnoopViewModel(Document doc, Database db, DBObject dbObject) :this(doc,db) + { + this.ObjectIds = new List(){ dbObject.Id}; + GetListViewItem(); + } + /// + /// Get list item of object + /// + void GetListViewItem() + { + try + { + listviewitems = new List(); + Transaction tran = Database.TransactionManager.StartTransaction(); + UpdateDataSource(listviewitems); + if (ObjectIds.Any()) + { + foreach (ObjectId objectId in ObjectIds) + { + DBObject obj = tran.GetObject(objectId, OpenMode.ForWrite, true); + AddToTreeView(obj); + ListObjectInformation(obj); + + } + } + + tran.Commit(); + } + catch (Exception e) + { + MessageBox.Show(e.ToString()); + } + } + + /// + /// Update Source Tree By Group Name + /// + /// + public void UpdateDataSource(List Items) + { + ICollectionView view = CollectionViewSource.GetDefaultView(Items); + view.GroupDescriptions.Clear(); + PropertyGroupDescription groupDescription = new PropertyGroupDescription("GroupName"); + view.GroupDescriptions.Add(groupDescription); + view.Refresh(); + } + + /// + /// Add Data object to tree view + /// + /// + public void AddToTreeView(DBObject obj) + { + try + { + string text = GetNameOrType(obj) + " " + obj.ObjectId; + TreeViewCustomItem item = new TreeViewCustomItem() { Title = text, Object = obj }; + TreeViewItems.Add(item); + } + catch (Exception e) + { + MessageBox.Show(e.ToString()); + } + } + + private string GetNameOrType(object obj) + { + PropertyInfo propName = obj.GetType().GetProperty("Name"); + if (propName != null && propName.CanRead) + return propName.GetValue(obj).ToString(); + else + return obj.GetType().Name; + } + + public void ListObjectInformation(DBObject obj) + { + try + { + LisViewItems.Clear(); + Type objType = obj.GetType(); + ListProperties(obj, objType); + ListMethods(obj, objType); + dataMethod.Add(obj.Id.ToString(), new List(listviewitems)); + ICollectionView view = CollectionViewSource.GetDefaultView(listviewitems); + view.Refresh(); + } + catch (Exception e) + { + MessageBox.Show(e.ToString()); + } + } + + /// + /// Get all properties objects + /// + /// + /// + public void ListProperties(object obj, Type objType) + { + PropertyInfo[] properties = objType.GetProperties(); + foreach (PropertyInfo prop in properties) + { + if ((IsBanned(objType, prop.Name))) + continue; + + string propName = prop.Name; + string propType = prop.PropertyType.Name; + string propValue = GetValueAsString(prop, obj); + object LinkObject = GetValue(prop, obj); + listviewitems.Add(new ObjectDetails() + { + GroupName = prop.DeclaringType.FullName, + PropName = propName, + Type = propType, + Value = propValue, + LinkObject = LinkObject + }); + + } + } + + /// + /// Get Value of method object + /// + /// + /// + /// + private object GetValue(MethodInfo method, object obj) + { + object methodValue = null; + try + { + methodValue = method.Invoke(obj, null); + } + catch + { + } + + if ((methodValue != null)) + return methodValue; + return stringEmpty; + } + + private object GetValue(PropertyInfo prop, object obj) + { + object propValue = null; + try + { + propValue = prop.GetValue(obj, null); + } + catch + { + } + + if ((propValue != null)) + return propValue; + return stringEmpty; + } + + private StringCollection _bannedList = new StringCollection(); + + /// + /// Check Tree View Is Expanded + /// + /// + /// + /// + private bool IsBanned(Type objectType, string propName) + { + return (_bannedList.Contains($"{objectType.Name}_{propName}")); + } + + + /// + /// Get All Method Object Name + /// + /// + /// + public void ListMethods(object obj, Type objType) + { + try + { + MethodInfo[] methods = objType.GetMethods(); + foreach (MethodInfo meth in methods) + { + if (meth.Name.Contains("Reactor")) + continue; // skip some unwanted methods... + if ((meth.GetParameters().Length == 0 & !meth.IsSpecialName & meth.ReturnType != typeof(void))) + { + object methodValue = GetValue(meth, obj); + if ((IsEnumerable(methodValue))) + { + string propName = meth.Name; + string propType = meth.ReturnType.Name; + string propValue = stringCollection; + object LinkObject = GetValue(meth, obj); + listviewitems.Add(new ObjectDetails() + { + GroupName = meth.DeclaringType.FullName, + PropName = propName, + Type = propType, + Value = propValue, + LinkObject = LinkObject + }); + } + } + } + } + catch (Exception) + { + // ignored + } + } + + public bool IsEnumerable(object obj) + { + string asString = obj as string; + if ((asString != null)) + return false; // strings are enumerable, but not collections + IEnumerable asEnum = obj as IEnumerable; + return (asEnum != null); + } + + /// + /// Get Value Object + /// + /// + /// + /// + private string GetValueAsString(PropertyInfo prop, object obj) + { + object propValue = null; + try + { + if (!(prop.CanRead)) + return "[Write-only]"; + + propValue = prop.GetValue(obj, null); + if (IsEnumerable(propValue)) + { + IEnumerable asEnum = propValue as IEnumerable; + foreach (object item in asEnum) + return stringCollection; // at least one, ok + return stringEmptyCollection; // empty collection then + } + } + catch + { + // ignored + } + + if ((propValue != null)) + return propValue.ToString(); + return stringEmpty; + } + + /// + /// Get Info Selected Object + /// + /// + public void ObjectIdItemSelected(object LinkObject) + { + List objectIds = new List(); + objectIds.Add((ObjectId)LinkObject); + try + { + SnoopViewModel viewModel = new SnoopViewModel(doc, Database, objectIds); + MainWindow form = new MainWindow(viewModel); + Application.ShowModalWindow(FrmMain.Owner, form); + } + catch (Exception ex) + { + MessageBox.Show(ex.ToString()); + } + + } + + /// + /// Get Info Item Select Object + /// + /// + public void CollectionItemSelected(object LinkObject) + { + List objectIds = new List(); + + foreach (var item in (IEnumerable)LinkObject) + { + if (item is ObjectId) + { + objectIds.Add((ObjectId)item); + } + } + + if (objectIds.Count > 0) + { + try + { + SnoopViewModel vm = new SnoopViewModel(doc, Database, objectIds); + MainWindow form = new MainWindow(vm); + form.WindowStartupLocation = WindowStartupLocation.Manual; + Application.ShowModalWindow(form); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + else + { + MessageBox.Show("No ObjectId inside this Collection"); + } + } + } +} diff --git a/CadLookup/ViewModel/TreeViewCustom.cs b/CadLookup/ViewModel/TreeViewCustom.cs new file mode 100644 index 0000000..54176cc --- /dev/null +++ b/CadLookup/ViewModel/TreeViewCustom.cs @@ -0,0 +1,17 @@ +using System.Collections.ObjectModel; +using Autodesk.AutoCAD.DatabaseServices; + +namespace CADSnoop.ViewModel +{ + public class TreeViewCustomItem + { + public TreeViewCustomItem() + { + this.ChildItems = new ObservableCollection(); + } + + public string Title { get; set; } + public DBObject Object { get; set; } + public ObservableCollection ChildItems { get; set; } + } +} diff --git a/Images/AlertDialogDemo.png b/Images/AlertDialogDemo.png new file mode 100644 index 0000000..6d64460 Binary files /dev/null and b/Images/AlertDialogDemo.png differ diff --git a/Images/CadPythonShell.png b/Images/CadPythonShell.png new file mode 100644 index 0000000..e695c6e Binary files /dev/null and b/Images/CadPythonShell.png differ diff --git a/Images/ConfigPythonShell.png b/Images/ConfigPythonShell.png deleted file mode 100644 index 5fab0e7..0000000 Binary files a/Images/ConfigPythonShell.png and /dev/null differ diff --git a/Images/cadpythonshell3.png b/Images/cadpythonshell3.png new file mode 100644 index 0000000..ce641aa Binary files /dev/null and b/Images/cadpythonshell3.png differ diff --git a/Images/configure.png b/Images/configure.png new file mode 100644 index 0000000..15e1ca9 Binary files /dev/null and b/Images/configure.png differ diff --git a/Installer/Installer.cs b/Installer/Installer.cs index 5449423..ce36ffe 100644 --- a/Installer/Installer.cs +++ b/Installer/Installer.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Text; using System.Text.RegularExpressions; using WixSharp; @@ -13,7 +12,7 @@ const string projectName = "CADPythonShell"; const string outputName = "CADPythonShell"; const string outputDir = "output"; -const string version = "1.0.8"; +const string version = "1.1.3"; var fileName = new StringBuilder().Append(outputName).Append("-").Append(version); var project = new Project diff --git a/MgdDbg b/MgdDbg deleted file mode 160000 index 0f5f550..0000000 --- a/MgdDbg +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0f5f550841b54be158f3201f6ccfe6207e52489e diff --git a/MgdDbgLibrary/App/App.cs b/MgdDbgLibrary/App/App.cs new file mode 100644 index 0000000..1ba1246 --- /dev/null +++ b/MgdDbgLibrary/App/App.cs @@ -0,0 +1,142 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.Runtime; +using MgdDbg.App; +using MgdDbg.ObjTests; +using MgdDbg.ObjTests.TestFramework; +using System.Collections; + +[assembly: ExtensionApplication(typeof(App))] +[assembly: CommandClass(typeof(TestCmds))] + +namespace MgdDbg.App +{ + public class App : IExtensionApplication + { + private ArrayList m_tests = new ArrayList(); + private AppDocReactor m_appDocReactor = null; + + public void + Initialize() + { + Utils.AcadUi.PrintToCmdLine("\nLoading MgdDbg..."); + + // register any Snoop Collector Extension objectsthat we have + Snoop.CollectorExts.Object extObj = new Snoop.CollectorExts.Object(); + Snoop.CollectorExts.RxObject extRxObj = new Snoop.CollectorExts.RxObject(); + Snoop.CollectorExts.DbObject extObjects = new Snoop.CollectorExts.DbObject(); + Snoop.CollectorExts.SymbolTable extSymTbl = new Snoop.CollectorExts.SymbolTable(); + Snoop.CollectorExts.Entity extEnts = new Snoop.CollectorExts.Entity(); + Snoop.CollectorExts.Color extColor = new Snoop.CollectorExts.Color(); + Snoop.CollectorExts.Geometry extGeom = new Snoop.CollectorExts.Geometry(); + Snoop.CollectorExts.GraphNodes extGraphNodes = new Snoop.CollectorExts.GraphNodes(); + Snoop.CollectorExts.DbMisc extDbMisc = new Snoop.CollectorExts.DbMisc(); + Snoop.CollectorExts.GraphicsInterface extGraphicsInterface = new Snoop.CollectorExts.GraphicsInterface(); + Snoop.CollectorExts.LayerManager extLayerMgr = new Snoop.CollectorExts.LayerManager(); + Snoop.CollectorExts.GraphicsSystem extGraphicsSystem = new Snoop.CollectorExts.GraphicsSystem(); + Snoop.CollectorExts.Publish extPublish = new Snoop.CollectorExts.Publish(); + Snoop.CollectorExts.Plotting extPlotting = new Snoop.CollectorExts.Plotting(); + Snoop.CollectorExts.EditorInput extEdInput = new Snoop.CollectorExts.EditorInput(); + + AppContextMenu.AddContextMenu(); // add our commands to the App right-click menu + + CreateAndAddTestFuncs(); // populate the TestFramework with our functions + + m_appDocReactor = new AppDocReactor(); + m_appDocReactor.EnableEvents(); + + AddFilterForSnoopClasses(); + } + + public void + Terminate() + { + AppContextMenu.RemoveContextMenu(); + RemoveAndFreeTestFuncs(); + + m_appDocReactor.DisableEvents(); + } + + /// + /// The TestFramework allows us to plug tests and sample functions into an existing + /// UI Framework. For each TestFuncs object we've created to house our individual + /// tests, we need to add them during App start up, and remove them during App shut down. + /// + + private void + CreateAndAddTestFuncs() + { + m_tests.Add(new DbTests()); + m_tests.Add(new MakeEntTests()); + m_tests.Add(new MakeSymTblRecTests()); + m_tests.Add(new ModifyEntTests()); + m_tests.Add(new QueryCurveTests()); + m_tests.Add(new QueryEntTests()); + m_tests.Add(new CategoryTests()); + + foreach (MgdDbgTestFuncs testFunc in m_tests) + { + MgdDbgTestFuncs.AddTestFuncsToFramework(testFunc); + } + } + + /// + /// Reverse of above. Nothing to do for each TestFunc object though + /// because we already know which ones were registered for this app. + /// + + private void + RemoveAndFreeTestFuncs() + { + foreach (MgdDbgTestFuncs testFunc in m_tests) + { + MgdDbgTestFuncs.RemoveTestFuncsFromFramework(testFunc); + } + } + + /// + /// This function adds the assemblies we are interested in having the Snoop.Editor + /// dialog get class information from. We don't want to display class info for every + /// assembly in .NET, just the ones we are responsible for. So, it acts as a filter. + /// + + private void + AddFilterForSnoopClasses() + { + ArrayList assembliesToLoad = new ArrayList(); + + assembliesToLoad.Add("mscorlib"); // for the base System.Object + assembliesToLoad.Add("acmgd"); + assembliesToLoad.Add("acdbmgd"); + + System.Reflection.AssemblyName[] assemblyNames = System.Reflection.Assembly.GetExecutingAssembly().GetReferencedAssemblies(); + foreach (System.Reflection.AssemblyName assemblyName in assemblyNames) + { + if (assembliesToLoad.Contains(assemblyName.Name)) + { + MgdDbg.Snoop.Forms.Editor.assemblyNamesToLoad.Add(assemblyName.FullName); + } + } + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/App/AppContextMenu.cs b/MgdDbgLibrary/App/AppContextMenu.cs new file mode 100644 index 0000000..7ba634d --- /dev/null +++ b/MgdDbgLibrary/App/AppContextMenu.cs @@ -0,0 +1,101 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.Windows; +using System; + +namespace MgdDbg.App +{ + /// + /// Simple derived MenuItem class to keep a command name so that we can have + /// a single generic callback function for the event. + /// + + public class AppContextMenuItem : Autodesk.AutoCAD.Windows.MenuItem + { + private string m_cmdName; + + public + AppContextMenuItem(string title, string cmdName) + : base(title) + { + m_cmdName = cmdName; + } + + public string + CommandName + { + get { return m_cmdName; } + set { m_cmdName = value; } + } + } + + /// + /// The AppContextMenu for our app. + /// + + public class AppContextMenu + { + private static ContextMenuExtension m_appMenu = null; + + public static void + AddContextMenu() + { + m_appMenu = new ContextMenuExtension(); + m_appMenu.Title = "MgdDbg"; + m_appMenu.MenuItems.Add(new AppContextMenuItem("Snoop Entities...", "SnoopEnts")); + m_appMenu.MenuItems.Add(new AppContextMenuItem("Snoop Entities (nested)...", "SnoopNEnts")); + m_appMenu.MenuItems.Add(new AppContextMenuItem("Snoop (by Handle)...", "SnoopByHandle")); + m_appMenu.MenuItems.Add(new AppContextMenuItem("Snoop Database...", "SnoopDB")); + m_appMenu.MenuItems.Add(new AppContextMenuItem("Snoop Editor...", "SnoopEd")); + m_appMenu.MenuItems.Add(new MenuItem("")); // separator + m_appMenu.MenuItems.Add(new AppContextMenuItem("Events...", "SnoopEvents")); + m_appMenu.MenuItems.Add(new MenuItem("")); // separator + m_appMenu.MenuItems.Add(new AppContextMenuItem("Test Framework...", "SnoopTests")); + + foreach (MenuItem mnuItem in m_appMenu.MenuItems) + { + AppContextMenuItem appContextMnuItem = mnuItem as AppContextMenuItem; + if (appContextMnuItem != null) + appContextMnuItem.Click += new EventHandler(ExecuteCommand); + } + + Application.AddDefaultContextMenuExtension(m_appMenu); + } + + private static void + ExecuteCommand(Object o, EventArgs e) + { + AppContextMenuItem mnuItem = (AppContextMenuItem)o; + + string fullCmdLine = string.Format("_{0}\n", mnuItem.CommandName); + Application.DocumentManager.MdiActiveDocument.SendStringToExecute(fullCmdLine, false, false, true); + } + + public static void + RemoveContextMenu() + { + Application.RemoveDefaultContextMenuExtension(m_appMenu); + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/App/AppDocReactor.cs b/MgdDbgLibrary/App/AppDocReactor.cs new file mode 100644 index 0000000..ad0cc50 --- /dev/null +++ b/MgdDbgLibrary/App/AppDocReactor.cs @@ -0,0 +1,114 @@ +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using AcApp = Autodesk.AutoCAD.ApplicationServices; + +namespace MgdDbg.App +{ + internal class AppDocReactor + { + public + AppDocReactor() + { + } + + public void + EnableEvents() + { + AcApp.DocumentCollection docs = AcApp.Application.DocumentManager; + + docs.DocumentCreated += new AcApp.DocumentCollectionEventHandler(event_DocumentCreated); + docs.DocumentToBeDestroyed += new AcApp.DocumentCollectionEventHandler(event_DocumentToBeDestroyed); + } + + public void + DisableEvents() + { + AcApp.DocumentCollection docs = AcApp.Application.DocumentManager; + + // Throws an assert when the SnoopEd command is used. Need to investigate this further. + //docs.DocumentCreated -= new AcApp.DocumentCollectionEventHandler(event_DocumentCreated); + + docs.DocumentToBeDestroyed -= new AcApp.DocumentCollectionEventHandler(event_DocumentToBeDestroyed); + } + + private void + event_DocumentCreated(object sender, AcApp.DocumentCollectionEventArgs e) + { + // if the reactor instance exists and if the relevant checkbox is ticked in the Reactors UI + if (MgdDbg.Reactors.Forms.EventsForm.m_dbEvents.AreEventsEnabled) + { + MgdDbg.Reactors.Forms.EventsForm.m_dbEvents.EnableEvents(e.Document.Database); // will turn on just for this new document + } + + if (MgdDbg.Reactors.Forms.EventsForm.m_dbObjEvents.AreEventsEnabled) + { + MgdDbg.Reactors.Forms.EventsForm.m_dbObjEvents.EnableEvents(e.Document.Database); // will turn on just for this new document + } + + if (MgdDbg.Reactors.Forms.EventsForm.m_docEvents.AreEventsEnabled) + { + MgdDbg.Reactors.Forms.EventsForm.m_docEvents.EnableEvents(e.Document); // will turn on just for this new document + } + + if (MgdDbg.Reactors.Forms.EventsForm.m_edEvents.AreEventsEnabled) + { + MgdDbg.Reactors.Forms.EventsForm.m_edEvents.EnableEvents(e.Document.Editor); // will turn on just for this new document + } + + if (MgdDbg.Reactors.Forms.EventsForm.m_gsEvents.AreEventsEnabled) + { + MgdDbg.Reactors.Forms.EventsForm.m_gsEvents.EnableEvents(e.Document.GraphicsManager); // will turn on just for this new document + } + } + + private void + event_DocumentToBeDestroyed(object sender, AcApp.DocumentCollectionEventArgs e) + { + // if the reactor instance exists and if the relevant checkbox is ticked in the Reactors UI + if (MgdDbg.Reactors.Forms.EventsForm.m_dbEvents.AreEventsEnabled) + { + MgdDbg.Reactors.Forms.EventsForm.m_dbEvents.DisableEvents(e.Document.Database); // will turn off just for this new document + } + + if (MgdDbg.Reactors.Forms.EventsForm.m_dbObjEvents.AreEventsEnabled) + { + MgdDbg.Reactors.Forms.EventsForm.m_dbObjEvents.DisableEvents(e.Document.Database); // will turn off just for this new document + } + + if (MgdDbg.Reactors.Forms.EventsForm.m_docEvents.AreEventsEnabled) + { + MgdDbg.Reactors.Forms.EventsForm.m_docEvents.DisableEvents(e.Document); // will turn off just for this new document + } + + if (MgdDbg.Reactors.Forms.EventsForm.m_edEvents.AreEventsEnabled) + { + MgdDbg.Reactors.Forms.EventsForm.m_edEvents.DisableEvents(e.Document.Editor); // will turn off just for this new document + } + + if (MgdDbg.Reactors.Forms.EventsForm.m_gsEvents.AreEventsEnabled) + { + MgdDbg.Reactors.Forms.EventsForm.m_gsEvents.DisableEvents(e.Document.GraphicsManager); // will turn off just for this new document + } + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/App/AssemblyInfo.cs b/MgdDbgLibrary/App/AssemblyInfo.cs new file mode 100644 index 0000000..d1adadd --- /dev/null +++ b/MgdDbgLibrary/App/AssemblyInfo.cs @@ -0,0 +1,81 @@ +// $Header: //Desktop/Source/TestTools/MgdDbg/App/AssemblyInfo.cs#1 $ +// $Author: fergusja $ $DateTime: 2007/03/16 08:08:08 $ $Change: 68854 $ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Reflection; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.0")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] \ No newline at end of file diff --git a/MgdDbgLibrary/App/TestCmds.cs b/MgdDbgLibrary/App/TestCmds.cs new file mode 100644 index 0000000..738af38 --- /dev/null +++ b/MgdDbgLibrary/App/TestCmds.cs @@ -0,0 +1,354 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.Runtime; +using MgdDbg.CompBuilder; +using MgdDbg.ObjTests.TestFramework; +using MgdDbg.Throwaway; +using MgdDbg.Utils; +using System; +using System.Windows.Forms; +using Autodesk.AutoCAD.ApplicationServices; +using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application; +using TestForm = MgdDbg.ObjTests.TestFramework.TestForm; + +namespace MgdDbg.App +{ + /// + /// Summary description for TestCmds. + /// + public class TestCmds + { + [CommandMethod("MgdDbgTestTrans1", CommandFlags.Modal)] + public void TestTrans1() + { + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptSelectionResult res = ed.GetSelection(); + if (res.Status != PromptStatus.OK) + return; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = Utils.Db.GetCurDwg().TransactionManager; + + ObjectId[] objIds = res.Value.GetObjectIds(); + foreach (ObjectId objId in objIds) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + DBObject tmpObj = tr.GetObject(objId, OpenMode.ForRead); + tr.Commit(); + } + } + } + + [CommandMethod("MgdDbgTestTrans2", CommandFlags.Modal)] + public void TestTrans2() + { + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptSelectionResult res = ed.GetSelection(); + if (res.Status != PromptStatus.OK) + return; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = Utils.Db.GetCurDwg().TransactionManager; + + ObjectId[] objIds = res.Value.GetObjectIds(); + foreach (ObjectId objId in objIds) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + DBObject tmpObj = tr.GetObject(objId, OpenMode.ForRead); + tr.Abort(); + } + } + } + + //[CommandMethod("MgdDbg", "MgdDbgSnoopEnts", "SnoopEnts", CommandFlags.Modal)] + [CommandMethod("SnoopEnts", CommandFlags.Modal)] + public void SnoopEntity() + { + var doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + Editor ed = doc.Editor; + + PromptSelectionResult res = ed.GetSelection(); + if (res.Status != PromptStatus.OK) + return; + + ObjectIdCollection selSet = new ObjectIdCollection(res.Value.GetObjectIds()); + using (DocumentLock lockDoc = doc.LockDocument()) + { + using (TransactionHelper trHlp = new TransactionHelper()) + { + trHlp.Start(); + + Snoop.Forms.DBObjects dbox = new Snoop.Forms.DBObjects(selSet, trHlp); + dbox.Text = "Selected Entities"; + AcadApp.ShowModalDialog(dbox); + + trHlp.Commit(); + } + } + + } + + //[CommandMethod("MgdDbg", "MgdDbgSnoopNEnts", "SnoopNEnts", CommandFlags.Modal)] + [CommandMethod("SnoopNEnts", CommandFlags.Modal)] + public void SnoopNestedEntity() + { + var doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + Editor ed = doc.Editor; + ObjectIdCollection selSet = new ObjectIdCollection(); + + while (true) + { + PromptNestedEntityOptions prOptNent = new PromptNestedEntityOptions("\nSelect nested entities or: "); + prOptNent.AppendKeywordsToMessage = true; + prOptNent.Keywords.Add("Done"); + + PromptNestedEntityResult res = ed.GetNestedEntity(prOptNent); + if (res.Status == PromptStatus.OK) + selSet.Add(res.ObjectId); + else if (res.Status == PromptStatus.Keyword) + break; + else + return; + } + using (DocumentLock lockDoc = doc.LockDocument()) + { + using (TransactionHelper trHlp = new TransactionHelper()) + { + trHlp.Start(); + + Snoop.Forms.DBObjects dbox = new Snoop.Forms.DBObjects(selSet, trHlp); + dbox.Text = "Selected Entities"; + AcadApp.ShowModalDialog(dbox); + + trHlp.Commit(); + } + } + + } + + //[CommandMethod("MgdDbg", "MgdDbgSnoopByHandle", "SnoopEnts", CommandFlags.Modal)] + [CommandMethod("SnoopByHandle", CommandFlags.Modal)] + public void SnoopEntityByHandle() + { + ObjectId id = ObjectId.Null; + ObjectIdCollection selSet = new ObjectIdCollection(); + + Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + PromptStringOptions options = new PromptStringOptions("Handle of database object"); + + String str = ed.GetString(options).StringResult; + + if (str != String.Empty) + { + Handle h = Utils.Db.StringToHandle(str); + + try + { + id = Utils.Db.HandleToObjectId(db, h); + + selSet.Add(id); + + using (TransactionHelper trHlp = new TransactionHelper()) + { + trHlp.Start(); + + Snoop.Forms.DBObjects dbox = new Snoop.Forms.DBObjects(selSet, trHlp); + dbox.Text = "Selected Entities"; + AcadApp.ShowModalDialog(dbox); + + trHlp.Commit(); + } + } + catch (Autodesk.AutoCAD.Runtime.Exception x) + { + AcadUi.PrintToCmdLine(string.Format("\nERROR: {0}", ((ErrorStatus)x.ErrorStatus).ToString())); + } + } + } + + //[CommandMethod("MgdDbg", "MgdDbgSnoopDb", "SnoopDb", CommandFlags.Modal)] + [CommandMethod("SnoopDB", CommandFlags.Modal)] + public void SnoopDatabase() + { + var doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + Database db = doc.Database; + + using (DocumentLock lockDoc = doc.LockDocument()) + { + using (TransactionHelper trHlp = new TransactionHelper(db)) + { + trHlp.Start(); + + Snoop.Forms.Database dbox = new Snoop.Forms.Database(db, trHlp); + dbox.Text = db.Filename; + AcadApp.ShowModalDialog(dbox); + + trHlp.Commit(); + } + } + + } + + //[CommandMethod("MgdDbg", "MgdDbgSnoopEd", "SnoopEd", CommandFlags.Modal)] + [CommandMethod("SnoopEd", CommandFlags.Modal)] + public void SnoopEd() + { + Snoop.Forms.Editor dbox = new Snoop.Forms.Editor(); + AcadApp.ShowModalDialog(dbox); + } + + //[CommandMethod("MgdDbg", "MgdDbgEvents", "Reactors", CommandFlags.Modal)] + [CommandMethod("SnoopEvents", CommandFlags.Modal)] + public void Events() + { + MgdDbg.Reactors.Forms.EventsForm dbox = new MgdDbg.Reactors.Forms.EventsForm(); + AcadApp.ShowModalDialog(dbox); + } + + //[CommandMethod("MgdDbg", "MgdDbgTests", "Tests", CommandFlags.Modal)] + [CommandMethod("SnoopTests", CommandFlags.Modal)] + public void TestDb() + { + TestForm dbox = new TestForm(MgdDbgTestFuncs.RegisteredTestFuncs()); + if (AcadApp.ShowModalDialog(dbox) == DialogResult.OK) + dbox.DoTest(); + } + + //[CommandMethod("MgdDbg", "MgdDbgTestTabForm", "TestTabForm", CommandFlags.Modal)] + [CommandMethod("SnoopTestTabForm", CommandFlags.Modal)] + public void TestTabForm() + { + TestTabForm dbox = new TestTabForm(); + AcadApp.ShowModalDialog(dbox); + } + + //[CommandMethod("MgdDbg", "MgdDbgTestSpeed1", "TestSpeed1", CommandFlags.Modal)] + [CommandMethod("MgdDbgTestSpeed1", CommandFlags.Modal)] + public void TestSpeed1() + { + Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; + //db.Usrtimer = true; + System.DateTime time1 = System.DateTime.Now; + + using (Transaction tr = db.TransactionManager.StartTransaction()) + { + BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite); + + double x = 0.0; + double y = 0.0; + int colorIndex = 0; + + for (int i = 0; i < 10; i++) + { + Line tmpLine = new Line(new Point3d(x, y, 0.0), new Point3d(x, y + 10.0, 0.0)); + tmpLine.ColorIndex = colorIndex++; + btr.AppendEntity(tmpLine); + tr.AddNewlyCreatedDBObject(tmpLine, true); + + x += 5.0; + if (x > 500.0) + { + x = 0.0; + y += 15.0; + } + + // wrap colorIndex when it reaches the limit + if (colorIndex > 255) + colorIndex = 0; + } + + tr.Commit(); + } + + //System.DateTime time = db.Tdusrtimer; + //Utils.AcadUi.PrintToCmdLine(string.Format("\nTIME: {0}", time.ToString())); + //db.Usrtimer = false; + + System.DateTime time2 = System.DateTime.Now; + System.TimeSpan elapsedTime = time2 - time1; + Utils.AcadUi.PrintToCmdLine(string.Format("\nTIME: {0}", elapsedTime.ToString())); + } + + [CommandMethod("MgdDbgTestAngle", CommandFlags.Modal)] + public void TestAngle() + { + Point3d pt1 = new Point3d(0.0, 0.0, 0.0); + Point3d pt2 = new Point3d(2.0, 2.0, 0.0); + + // METHOD 1: Make a vector by subtracting pt1 from pt2 and then figure + // out the angle to the XAxis + double angle1 = Vector3d.XAxis.GetAngleTo(pt2 - pt1); + + // METHOD 2: Same thing, but specify the Plane you want to measure on. + Plane xyPlane = new Plane(Point3d.Origin, Vector3d.ZAxis); + double angle2 = (pt2 - pt1).AngleOnPlane(xyPlane); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + ed.WriteMessage(string.Format("\nAngle 1: {0}", + Autodesk.AutoCAD.Runtime.Converter.AngleToString(angle1, AngularUnitFormat.Current, -1))); + ed.WriteMessage(string.Format("\nAngle 2: {0}", + Autodesk.AutoCAD.Runtime.Converter.AngleToString(angle2, AngularUnitFormat.Current, -1))); + } + + [CommandMethod("MgdDbgGetImageAngle", CommandFlags.Modal)] + public void TestImageAngle() + { + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptEntityOptions prOpts = new PromptEntityOptions("\nSelect an Image"); + prOpts.SetRejectMessage("\nSelected entity must by of type RasterImage"); + prOpts.AddAllowedClass(typeof(RasterImage), false); + + PromptEntityResult prRes = ed.GetEntity(prOpts); + if (prRes.Status == PromptStatus.OK) + { + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = prRes.ObjectId.Database.TransactionManager; + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + RasterImage imgObj = (RasterImage)tr.GetObject(prRes.ObjectId, OpenMode.ForRead); + + CoordinateSystem3d entEcs = imgObj.Orientation; + + Vector3d arbXAxis = Utils.Db.GetEcsXAxis(entEcs.Zaxis); // get AutoCAD's arbitrary X-Axis + double rotAngle1 = arbXAxis.GetAngleTo(entEcs.Xaxis, entEcs.Zaxis); + ed.WriteMessage(string.Format("\nECS rotation angle: {0}", + Autodesk.AutoCAD.Runtime.Converter.AngleToString(rotAngle1, AngularUnitFormat.Current, -1))); + + Plane ucsPlane = Utils.Db.GetUcsPlane(prRes.ObjectId.Database); + double rotAngle2 = entEcs.Xaxis.AngleOnPlane(ucsPlane); + ed.WriteMessage(string.Format("\nRotation angle relative to UCS: {0}", + Autodesk.AutoCAD.Runtime.Converter.AngleToString(rotAngle2, AngularUnitFormat.Current, -1))); + + tr.Commit(); + } + } + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/CompBuilder/CompBldr.cs b/MgdDbgLibrary/CompBuilder/CompBldr.cs new file mode 100644 index 0000000..de0a5b6 --- /dev/null +++ b/MgdDbgLibrary/CompBuilder/CompBldr.cs @@ -0,0 +1,406 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Geometry; +using System.Collections; +using System.Diagnostics; + +namespace MgdDbg.CompBuilder +{ + /// + /// This class is intended to ease the creation of multiple entities that + /// are supposed to represent a "Component". Basically, anything you would + /// normally use a BlockDef for. It will manage a transaction and some transforms + /// to make it easier to batch produce several related entities. + /// + + public abstract class CompBldr : TransactionHelper + { + // member variables + protected BlockTableRecord m_blkRec = null; + + protected ObjectId m_blkDefId; + protected ObjectIdCollection m_objIds = new ObjectIdCollection(); + protected Stack m_xformStack = new Stack(); + protected bool m_ignoreXform = false; + + public + CompBldr(Database db) + : base(db) + { + // init stack with identity matrix + m_xformStack.Push(Matrix3d.Identity); + } + + protected abstract void SetCurrentBlkTblRec(); + + public ObjectId + BlockDefId + { + get + { + Debug.Assert(m_blkDefId.IsNull == false); // shouldn't be calling this if things haven't been started! + return m_blkDefId; + } + } + + public override void + Start() + { + // call base class to start a transaction + base.Start(); + + // call derived class to supply the block that we are drawing into. + SetCurrentBlkTblRec(); + if (m_blkRec == null) + throw (new System.Exception("No BlockTableRecord was set up!")); + + m_blkDefId = m_blkRec.ObjectId; + } + + public virtual void + Reset() + { + // reset the stack of xforms + m_xformStack.Clear(); + + // init stack with identity matrix + m_xformStack.Push(Matrix3d.Identity); + + m_objIds.Clear(); + } + + public virtual void + AddToDb(Entity ent) + { + Debug.Assert((m_db != null) && (m_trans != null) && (m_blkRec != null)); + + // transform if not the identity matrix + if ((m_ignoreXform == false) && (m_xformStack.Count > 1)) + ent.TransformBy(CurrentXform()); + + // add to the current block tbl record and add to the transaction + m_blkRec.AppendEntity(ent); + + m_objIds.Add(ent.ObjectId); // keep track of everything we added just in case + m_trans.AddNewlyCreatedDBObject(ent, true); + } + + public virtual void + AddToDbNoXform(Entity ent) + { + m_ignoreXform = true; + AddToDb(ent); + m_ignoreXform = false; + } + + public virtual void + SetToDefaultProps(Entity ent) + { + ent.SetDatabaseDefaults(m_db); + } + + public void + PushXform(Matrix3d mat) + { + Debug.Assert(m_xformStack.Count != 0); + + m_xformStack.Push(mat * CurrentXform()); + } + + public void + PopXform() + { + Debug.Assert(m_xformStack.Count > 1); // this means that someone has popped to many times - bad bad bad + m_xformStack.Pop(); + } + + public Matrix3d + CurrentXform() + { + Debug.Assert(m_xformStack.Count != 0); + return (Matrix3d)m_xformStack.Peek(); + } + } +} + +/* +Acad::ErrorStatus +AecRcpCompBldr::addPolyline(AcDbPolyline* newPline, const AcGePoint2dArray& pts, bool isClosed) +{ + // has to be a new polyine! + if ((newPline == NULL) || (newPline->objectId().isNull() == false)) { + AEC_ASSERT(0); + return Acad::eInvalidInput; + } + + Acad::ErrorStatus es; + + int len = pts.length(); + for (int i=0; iaddVertexAt(i, pts[i]); + AEC_ASSERT(es == Acad::eOk); + } + newPline->setClosed(isClosed); + + return addToDb(newPline); +} + +Acad::ErrorStatus +AecRcpCompBldr::addPolyline(AcDbPolyline* newPline, const AcGePoint2dArray& pts, const AcGeDoubleArray& bulges, bool isClosed) +{ + // has to be a new polyine! + if ((newPline == NULL) || (newPline->objectId().isNull() == false)) { + AEC_ASSERT(0); + return Acad::eInvalidInput; + } + + AEC_ASSERT(pts.length() == bulges.length()); + + Acad::ErrorStatus es; + + int len = pts.length(); + for (int i=0; iaddVertexAt(i, pts[i], bulges[i]); + AEC_ASSERT(es == Acad::eOk); + } + newPline->setClosed(isClosed); + + return addToDb(newPline); +} + +Acad::ErrorStatus +AecRcpCompBldr::addHatchToPrevBoundary(AcDbHatch* newHatch, bool makeAssoc) +{ + // got to have a boundary to set + if ((newHatch == NULL) || (m_objIds.isEmpty() == true) || (newHatch->objectId().isNull() == false)) { + AEC_ASSERT(0); + return Acad::eInvalidInput; + } + + // need to xform the hatch to the right plane before it tries to evaluate + // the pattern. + if (m_xformStack.length() > 1) + newHatch->transformBy(*curXform()); + + // pline is added and has an objectId, now let's add the hatch + AcDbObjectIdArray loopIds; + loopIds.append(m_objIds.last()); + + Acad::ErrorStatus es; + es = newHatch->setAssociative(makeAssoc); + AEC_ASSERT(es == Acad::eOk); + + es = newHatch->appendLoop(AcDbHatch::kExternal, loopIds); + AEC_ASSERT(es == Acad::eOk); + + if (es == Acad::eOk) { + es = newHatch->evaluateHatch(); + + if (es == Acad::eOk) { + es = addToDbNoXform(newHatch); + if (es == Acad::eOk) { + if (makeAssoc) + establishAssociativity(newHatch, loopIds); + + sendToBack(newHatch->objectId(), loopIds); + } + } + } + + if (es != Acad::eOk) { + AecRmCString str, tmpStr; + str.LoadString(GetAecRcpBaseAppName(), AECRB_STR_ERROR_CREATE_HATCH); + acutPrintf(str, newHatch->patternName(), Aec::doubleToStr(newHatch->patternScale(), tmpStr, Aec::kDecimal)); + delete newHatch; + } + + return es; +} + +Acad::ErrorStatus +AecRcpCompBldr::addHatchToBoundaries(AcDbHatch* newHatch, const AcDbObjectIdArray& boundaryIds, + bool makeAssoc, AcDbHatch::HatchStyle hstyle) { + // got to have a boundary to set + if ((newHatch == NULL) || (boundaryIds.isEmpty() == true) || (newHatch->objectId().isNull() == false)) { + AEC_ASSERT(0); + return Acad::eInvalidInput; + } + + // need to xform the hatch to the right plane before it tries to evaluate + // the pattern. + if (m_xformStack.length() > 1) + newHatch->transformBy(*curXform()); + + Acad::ErrorStatus es; + es = newHatch->setAssociative(makeAssoc); + AEC_ASSERT(es == Acad::eOk); + + es = newHatch->setHatchStyle(hstyle); + AEC_ASSERT(es == Acad::eOk); + + // add each boundary as its own loop + AcDbObjectIdArray loopIds; + int len = boundaryIds.length(); + for (int i=0; iappendLoop(AcDbHatch::kDefault, loopIds); + AEC_ASSERT(es == Acad::eOk); + + loopIds.setLogicalLength(0); //clear array + } + + if (es == Acad::eOk) { + es = newHatch->evaluateHatch(); + + if (es == Acad::eOk) { + es = addToDbNoXform(newHatch); + if (es == Acad::eOk) { + if (makeAssoc) + establishAssociativity(newHatch, boundaryIds); + + sendToBack(newHatch->objectId(), boundaryIds); + } + } + } + + if (es != Acad::eOk) { + AecRmCString str, tmpStr; + str.LoadString(GetAecRcpBaseAppName(), AECRB_STR_ERROR_CREATE_HATCH); + acutPrintf(str, newHatch->patternName(), Aec::doubleToStr(newHatch->patternScale(), tmpStr, Aec::kDecimal)); + delete newHatch; + } + + return es; +} + +Acad::ErrorStatus +AecRcpCompBldr::addHatchWithBoundary(AcDbHatch* newHatch, const AcGePoint2dArray& pts, const AcGeDoubleArray& bulges) +{ + // got to have a boundary to set + if ((newHatch == NULL) || (newHatch->objectId().isNull() == false)) { + AEC_ASSERT(0); + return Acad::eInvalidInput; + } + + Acad::ErrorStatus es; + + es = newHatch->setAssociative(false); + AEC_ASSERT(es == Acad::eOk); + + es = newHatch->appendLoop(AcDbHatch::kDefault, pts, bulges); + AEC_ASSERT(es == Acad::eOk); + + if (es == Acad::eOk) { + es = newHatch->evaluateHatch(); + + if (es == Acad::eOk) { + es = addToDb(newHatch); + + AcDbObjectIdArray bogusBoundaryIds; + sendToBack(newHatch->objectId(), bogusBoundaryIds); + } + } + + if (es != Acad::eOk) { + AecRmCString str, tmpStr; + str.LoadString(GetAecRcpBaseAppName(), AECRB_STR_ERROR_CREATE_HATCH); + acutPrintf(str, newHatch->patternName(), Aec::doubleToStr(newHatch->patternScale(), tmpStr, Aec::kDecimal)); + delete newHatch; + } + + return es; +} + +Acad::ErrorStatus +AecRcpCompBldr::establishAssociativity(AcDbHatch* hatch, const AcDbObjectIdArray& boundaryIds) +{ + AEC_ASSERT(hatch->objectId().isNull() == false); // have to add to database first! + + AcDbObject* obj; + Acad::ErrorStatus es; + + int len = boundaryIds.length(); + for (int i=0; iaddPersistentReactor(hatch->objectId()); + } + else { + AecRmCString strMsg; + strMsg.LoadString(GetAecRcpBaseAppName(),AECRB_STR_ERROR_CREATE_HATCH_ASSOC); + acutPrintf(strMsg); + return es; + } + } + + return Acad::eOk; +} + +Acad::ErrorStatus +AecRcpCompBldr::sendToBack(const AcDbObjectId& backEntId, const AcDbObjectIdArray& topEntIds) +{ + if (AecRcpPreferences::useDrawOrder() == false) + return Acad::eOk; + + Acad::ErrorStatus es; + + AcDbSortentsTable* sortTbl; + es = m_blkRec->getSortentsTable(sortTbl, AcDb::kForWrite, true); + AEC_ASSERT(es == Acad::eOk); + + if (es == Acad::eOk) { + if (topEntIds.isEmpty()) { + AcDbObjectIdArray tmpIds; + tmpIds.append(backEntId); + es = sortTbl->moveToBottom(tmpIds); + AEC_ASSERT(es == Acad::eOk); + } + else { + es = sortTbl->moveAbove(topEntIds, backEntId); + AEC_ASSERT(es == Acad::eOk); + } + + sortTbl->close(); + + // if we aren't already putting this sortents table on the block record + // that this hatch belongs to, then we need to "wake up" the layout this + // block will eventually go into. Until there is a SORTENTS dictionary on the + // ModelSpace or PaperSpace block def, no Draworder events happen. + // TBD: doesn't appear to help the problem! + /*if (m_blkRec->isLayout() == false) { + AcDbBlockTableRecord* curSpace = Aec::openCurrentSpaceBlock(AcDb::kForWrite, backEntId.database()); + if (curSpace) { + es = curSpace->getSortentsTable(sortTbl, AcDb::kForWrite, true); + if (es == Acad::eOk) + sortTbl->close(); + + curSpace->close(); + } + }*/ +/* } + + return es; +} + } +}*/ \ No newline at end of file diff --git a/MgdDbgLibrary/CompBuilder/CompBldrAnonBlkDef.cs b/MgdDbgLibrary/CompBuilder/CompBldrAnonBlkDef.cs new file mode 100644 index 0000000..aa40c62 --- /dev/null +++ b/MgdDbgLibrary/CompBuilder/CompBldrAnonBlkDef.cs @@ -0,0 +1,92 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using System.Diagnostics; + +namespace MgdDbg.CompBuilder +{ + /// + /// Derived component builder to direct the made entities into an + /// Anonymous block def. + /// + + public class CompBldrAnonBlkDef : CompBldr + { + public + CompBldrAnonBlkDef(Database db) + : base(db) + { + } + + /// + /// Make the new Anonymous block table record to add our entities to. + /// + + protected override void + SetCurrentBlkTblRec() + { + Debug.Assert(m_trans != null); + + // if we've already been started before, then we don't want to create another + // anonymous block, so just re-use the existing one. + if (m_blkDefId.IsNull) + { + m_blkRec = DefineNewAnonymousBlockRec(); + } + else + { + m_blkRec = (BlockTableRecord)m_trans.GetObject(m_blkDefId, OpenMode.ForWrite); + } + } + + /// + /// If they are calling Reset, we need to end this block and start another one + /// + public override void + Reset() + { + base.Reset(); + + m_blkDefId = ObjectId.Null; // will force new block def + } + + /// + /// Default properties for entities within a block def should be: + /// Layer = 0; + /// Color = ByBlock; + /// Linetype = ByBlock; + /// + /// This allows the entities nested in the block def to be controlled by + /// the properties of the individual BlockReference. + /// + /// The Entity to set the properties for + + public override void + SetToDefaultProps(Entity ent) + { + ent.LayerId = m_db.LayerZero; + ent.ColorIndex = 0; // ByBlock + ent.LinetypeId = m_db.ByBlockLinetype; + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/CompBuilder/CompBldrCurSpace.cs b/MgdDbgLibrary/CompBuilder/CompBldrCurSpace.cs new file mode 100644 index 0000000..c0a7dd2 --- /dev/null +++ b/MgdDbgLibrary/CompBuilder/CompBldrCurSpace.cs @@ -0,0 +1,47 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using System.Diagnostics; + +namespace MgdDbg.CompBuilder +{ + /// + /// Derived component builder to direct the entities into the current + /// ModelSpace or PaperSpace block def. + /// + public class CompBldrCurSpace : CompBldr + { + public CompBldrCurSpace(Database db) + : base(db) + { + } + + protected override void + SetCurrentBlkTblRec() + { + Debug.Assert(m_trans != null); + + m_blkRec = (BlockTableRecord)m_trans.GetObject(m_db.CurrentSpaceId, OpenMode.ForWrite, false); + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/CompBuilder/CompBldrNamedBlkDef.cs b/MgdDbgLibrary/CompBuilder/CompBldrNamedBlkDef.cs new file mode 100644 index 0000000..1a6252d --- /dev/null +++ b/MgdDbgLibrary/CompBuilder/CompBldrNamedBlkDef.cs @@ -0,0 +1,95 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using System.Diagnostics; + +namespace MgdDbg.CompBuilder +{ + /// + /// Derived component builder to direct the made entities into a + /// Named block def. + /// + + public class CompBldrNamedBlkDef : CompBldr + { + protected string m_blkName; + + public + CompBldrNamedBlkDef(Database db, string blkName) + : base(db) + { + m_blkName = blkName; + } + + /// + /// Make the new Anonymous block table record to add our entities to. + /// + + protected override void + SetCurrentBlkTblRec() + { + Debug.Assert(m_trans != null); + + // if we've already been started before, then we don't want to create another + // anonymous block, so just re-use the existing one. + if (m_blkDefId.IsNull) + { + m_blkRec = DefineNewBlockRec(m_blkName); + } + else + { + m_blkRec = (BlockTableRecord)m_trans.GetObject(m_blkDefId, OpenMode.ForWrite); + } + } + + /// + /// If they are calling Reset, we need to end this block and start another one + /// + public override void + Reset() + { + base.Reset(); + + m_blkDefId = ObjectId.Null; // will force new block def + } + + /// + /// Default properties for entities within a block def should be: + /// Layer = 0; + /// Color = ByBlock; + /// Linetype = ByBlock; + /// + /// This allows the entities nested in the block def to be controlled by + /// the properties of the individual BlockReference. + /// + /// The Entity to set the properties for + + public override void + SetToDefaultProps(Entity ent) + { + ent.LayerId = m_db.LayerZero; + ent.ColorIndex = 0; // ByBlock + ent.LinetypeId = m_db.ByBlockLinetype; + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/CompBuilder/TransactionHelper.cs b/MgdDbgLibrary/CompBuilder/TransactionHelper.cs new file mode 100644 index 0000000..fd4f6a5 --- /dev/null +++ b/MgdDbgLibrary/CompBuilder/TransactionHelper.cs @@ -0,0 +1,309 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using System; +using System.Diagnostics; + +namespace MgdDbg.CompBuilder +{ + /// + /// With the removal of ObjectId.Open/Close, it means that you need to + /// have a Transaction active to do just about anything. This is the + /// base class for a number of Helper objects that help manage a Transaction + /// and a set of operations around them. For instance, when creating a + /// BlockTableRecord, its nice to have someone manage the containing block, + /// Xforms to the WCS, etc. + /// + + public class TransactionHelper : IDisposable + { + // member variables + protected Database m_db = null; + + protected Transaction m_trans = null; + + public + TransactionHelper() + { + m_db = Utils.Db.GetCurDwg(); + } + + public + TransactionHelper(Database db) + { + Debug.Assert(db != null); + + m_db = db; + } + + ~TransactionHelper() + { + Dispose(false); + } + + public void + Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void + Dispose(bool disposing) + { + if (disposing) + { + if (m_trans != null) + { + m_trans.Dispose(); + } + } + } + + public virtual void + Start() + { + Debug.Assert(m_trans == null); + + m_trans = m_db.TransactionManager.StartTransaction(); + } + + public virtual void + Commit() + { + Debug.Assert(m_trans != null); + + m_trans.Commit(); + m_trans = null; + } + + public virtual void + Abort() + { + Debug.Assert(m_trans != null); + + m_trans.Abort(); + m_trans = null; + } + + /// + /// return the underlying Transaction + /// + + public Autodesk.AutoCAD.DatabaseServices.Transaction + Transaction + { + get { return m_trans; } + } + + /// + /// return the Database that this TransactionHelper goes with + /// + + public Autodesk.AutoCAD.DatabaseServices.Database + Database + { + get { return m_db; } + } + + /// + /// See if a SymbolTableRecord of the given name already exists + /// + /// Type of the SymbolTableRecord (e.g., LayerTableRecord) + /// Name of the symbol + /// True if the symbol already exists, False if it doesn't + + public bool + SymbolTableRecExists(System.Type classType, string name) + { + ObjectId tblId = Utils.SymTbl.GetSymbolTableId(classType, m_db); + + SymbolTable tbl = (SymbolTable)m_trans.GetObject(tblId, OpenMode.ForRead); + return tbl.Has(name); + } + + /// + /// Add a new SymbolTableRecord to the database (and the current transaction) + /// + /// A newly allocated SymbolTableRecord which hasn't yet been added to the database + + public virtual void + AddNewSymbolRec(SymbolTableRecord newRec) + { + Debug.Assert(m_trans != null); + + ObjectId tblId = Utils.SymTbl.GetSymbolTableId(newRec.GetType(), m_db); + + SymbolTable tbl = (SymbolTable)m_trans.GetObject(tblId, OpenMode.ForWrite); + Debug.Assert(tbl.Has(newRec.Name) == false); + + tbl.Add(newRec); + m_trans.AddNewlyCreatedDBObject(newRec, true); + } + + /// + /// Define a new named block and add it to the BlockTable. If the block + /// definition already exists, its contents will be emptied out so that + /// the block can be re-defined. + /// + /// Name of the BlockDef + /// New or existing BlockTableRecord + /// Specific database we are using + + public BlockTableRecord + DefineNewBlockRec(string blkName) + { + Debug.Assert(m_trans != null); + + BlockTableRecord blkRec = null; + + BlockTable tbl = (BlockTable)m_trans.GetObject(m_db.BlockTableId, OpenMode.ForWrite); + // if it already exists, we are re-defining it and we need to + // erase all the existing entities + if (tbl.Has(blkName)) + { + blkRec = (BlockTableRecord)m_trans.GetObject(tbl[blkName], OpenMode.ForWrite); + + // erase all + DBObject tmpObj = null; + foreach (ObjectId objId in blkRec) + { + tmpObj = m_trans.GetObject(objId, OpenMode.ForWrite); + if (tmpObj != null) + { + tmpObj.Erase(true); + } + } + } + else + { + blkRec = new BlockTableRecord(); + blkRec.Name = blkName; + + tbl.Add(blkRec); + m_trans.AddNewlyCreatedDBObject(blkRec, true); + } + + return blkRec; + } + + /// + /// Define a new Anonymous block and add it to the BlockTable + /// + /// + /// an open BlockTableRecord, ready to add Entities to + + public BlockTableRecord + DefineNewAnonymousBlockRec() + { + Debug.Assert(m_trans != null); + + BlockTableRecord blkRec = null; + + BlockTable tbl = (BlockTable)m_trans.GetObject(m_db.BlockTableId, OpenMode.ForWrite); + blkRec = new BlockTableRecord(); + blkRec.Name = "*U"; + + tbl.Add(blkRec); + m_trans.AddNewlyCreatedDBObject(blkRec, true); + + return blkRec; + } + + /// + /// Given the ObjectId of a SymbolTableRecord, get its name + /// + /// ObjectId of the SymbolTableRecord + /// name of the SymbolTableRecord + + public string + SymbolIdToName(ObjectId symId) + { + Debug.Assert(m_trans != null); + + string str = null; + + DBObject tmpObj = m_trans.GetObject(symId, OpenMode.ForRead); + SymbolTableRecord rec = tmpObj as SymbolTableRecord; + if (rec != null) + str = rec.Name; + + return str; + } + + public bool + IsOnLockedLayer(Entity ent, bool printMsg) + { + Debug.Assert(m_trans != null); + + LayerTableRecord layer = (LayerTableRecord)m_trans.GetObject(ent.LayerId, OpenMode.ForRead); + + if (printMsg && layer.IsLocked) + { + Utils.AcadUi.PrintToCmdLine("\nSelected entity is on a locked layer."); + } + + return layer.IsLocked; + } + + public ObjectIdCollection + CollectBlockIds(bool excludeMsPs, bool excludeXref, bool excludeXrefDep, bool excludeAnonymous) + { + Debug.Assert(m_trans != null); + + BlockTable blkTbl = (BlockTable)m_trans.GetObject(m_db.BlockTableId, OpenMode.ForRead); + + // iterate over each BlockTableRecord in the BlockTable + ObjectIdCollection blkRecIds = new ObjectIdCollection(); + foreach (ObjectId tblRecId in blkTbl) + { + BlockTableRecord blkRec = (BlockTableRecord)m_trans.GetObject(tblRecId, OpenMode.ForRead); + + if (excludeMsPs && blkRec.IsLayout) + { + ; // do nothing + } + else if ((excludeXrefDep) && blkRec.IsDependent) + { + ; // do nothing + } + else if ((excludeXref) && + ((blkRec.IsFromExternalReference) || + (blkRec.IsFromOverlayReference))) + { + ; // do nothing + } + else if (excludeAnonymous && blkRec.IsAnonymous) + { + ; // do nothing + } + else + { + blkRecIds.Add(tblRecId); + } + } + + return blkRecIds; + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Documentation/MgdDbg.doc b/MgdDbgLibrary/Documentation/MgdDbg.doc new file mode 100644 index 0000000..a0a86e5 Binary files /dev/null and b/MgdDbgLibrary/Documentation/MgdDbg.doc differ diff --git a/MgdDbgLibrary/DwgStats/BlockCount.cs b/MgdDbgLibrary/DwgStats/BlockCount.cs new file mode 100644 index 0000000..63abfaa --- /dev/null +++ b/MgdDbgLibrary/DwgStats/BlockCount.cs @@ -0,0 +1,67 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using System.Collections; + +namespace MgdDbg.DwgStats +{ + /// + /// Summary description for BlockCount. + /// + public class BlockCount + { + // data members + public string m_blockName; + + public ObjectId m_blockDefId; + public ArrayList m_objCounts = new ArrayList(); + + public + BlockCount() + { + } + + public ObjCount + GetCount(string className, string displayName, bool addIfNotThere) + { + foreach (ObjCount tmpNode in m_objCounts) + { + if (tmpNode.m_className == className) + return tmpNode; + } + + if (addIfNotThere) + { + ObjCount tmpNode = new ObjCount(); + tmpNode.m_className = className; + tmpNode.m_displayName = displayName; + + m_objCounts.Add(tmpNode); + + return tmpNode; + } + + return null; // didn't find it + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/DwgStats/ObjCount.cs b/MgdDbgLibrary/DwgStats/ObjCount.cs new file mode 100644 index 0000000..82c9776 --- /dev/null +++ b/MgdDbgLibrary/DwgStats/ObjCount.cs @@ -0,0 +1,42 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.DwgStats +{ + /// + /// Summary description for ObjCount. + /// + public class ObjCount + { + // data members + public string m_className; // have to use class names to account for proxies + + public string m_displayName; + public long m_count; + + public + ObjCount() + { + m_count = 0L; + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/DwgStats/Report.cs b/MgdDbgLibrary/DwgStats/Report.cs new file mode 100644 index 0000000..edb528e --- /dev/null +++ b/MgdDbgLibrary/DwgStats/Report.cs @@ -0,0 +1,571 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using MgdDbg.CompBuilder; +using System.Collections; +using System.Diagnostics; +using System.Xml; + +namespace MgdDbg.DwgStats +{ + /// + /// Summary description for Report. + /// + public class Report + { + // data members + private ArrayList m_entities = new ArrayList(); + + private ArrayList m_objects = new ArrayList(); + private Database m_db = null; + private TransactionHelper m_trHlp = null; + private ObjectIdCollection m_extDictIds = new ObjectIdCollection(); + + public + Report() + { + } + + /// + /// Return the Count object for this block (or make a new one if + /// we haven't already seen it). + /// + /// The BlockTableRecord we are looking for + /// Add a new one if not there? + /// The count object for this BlockTableRecord + + private BlockCount + GetEntityNode(ObjectId blkRecId, bool addIfNotThere) + { + foreach (BlockCount tmpNode in m_entities) + { + if (tmpNode.m_blockDefId == blkRecId) + return tmpNode; + } + + if (addIfNotThere) + { + BlockCount tmpNode = new BlockCount(); + tmpNode.m_blockDefId = blkRecId; + tmpNode.m_blockName = m_trHlp.SymbolIdToName(blkRecId); + m_entities.Add(tmpNode); + + return tmpNode; + } + + return null; // didn't find it + } + + /// + /// Return the Count object for this class of object (or make a new one if + /// we haven't already seen it). + /// + /// Name of the class we're looking for + /// Add a new one if not there? + /// The count object for this class + + private SymbolCount + GetObjectNode(string className, string displayName, bool addIfNotThere) + { + foreach (SymbolCount tmpNode in m_objects) + { + if (tmpNode.m_className == className) + return tmpNode; + } + + if (addIfNotThere) + { + SymbolCount tmpNode = new SymbolCount(); + tmpNode.m_className = className; + tmpNode.m_displayName = displayName; + m_objects.Add(tmpNode); + + return tmpNode; + } + + return null; // didn't find it + } + + /// + /// Given an object, get its class name, even if it is currently + /// a proxy. + /// + /// The object in question + /// The name of the class that this object is an instance of + private string + GetObjClassName(DBObject obj) + { + // if this is a proxy we can't use the proxy class + // name because we would get duplicates on the list + // for each object. + if (obj.IsAProxy) + { + ProxyObject proxyObj = obj as ProxyObject; + if (proxyObj != null) + return proxyObj.OriginalClassName; + else + { + ProxyEntity proxyEnt = obj as ProxyEntity; + if (proxyEnt != null) + return proxyEnt.OriginalClassName; + else + { + Debug.Assert(false); + return obj.GetRXClass().Name; + } + } + } + else + return obj.GetRXClass().Name; + } + + /// + /// Walk through all the blocks in the drawing and process all the entities + /// + + private void + ProcessEntities() + { + // get all blocks that aren't from Xrefs + ObjectIdCollection blkRecIds = m_trHlp.CollectBlockIds(false, false, false, true); + + DwgStats.BlockCount tmpBlkCount = null; + DwgStats.ObjCount tmpObjCount = null; + + // walk through all the block defs and count entities within them + foreach (ObjectId blkRecId in blkRecIds) + { + tmpBlkCount = GetEntityNode(blkRecId, true); + if (tmpBlkCount != null) + { + BlockTableRecord blkRec = (BlockTableRecord)m_trHlp.Transaction.GetObject(blkRecId, OpenMode.ForRead); + foreach (ObjectId tmpEntId in blkRec) + { + Entity ent = (Entity)m_trHlp.Transaction.GetObject(tmpEntId, OpenMode.ForRead); + tmpObjCount = tmpBlkCount.GetCount(GetObjClassName(ent), ent.GetType().Name, true); + + // if it has an extension dictionary, record its id so we can process it later + ObjectId extDictId = ent.ExtensionDictionary; + if ((extDictId.IsNull == false) && (extDictId.IsErased == false)) + m_extDictIds.Add(extDictId); + + if (tmpObjCount != null) + tmpObjCount.m_count++; + } + } + } + } + + /// + /// Walk through all the Dictionaries and process them + /// + + private void + ProcessObjects() + { + ObjectIdCollection objIds = new ObjectIdCollection(); + ArrayList names = new ArrayList(); + + // get all the symbol table objects + GetSymbolTableEntries(m_db.BlockTableId, ref objIds, ref names); + GetSymbolTableEntries(m_db.DimStyleTableId, ref objIds, ref names); + GetSymbolTableEntries(m_db.LayerTableId, ref objIds, ref names); + GetSymbolTableEntries(m_db.LinetypeTableId, ref objIds, ref names); + GetSymbolTableEntries(m_db.RegAppTableId, ref objIds, ref names); + GetSymbolTableEntries(m_db.TextStyleTableId, ref objIds, ref names); + GetSymbolTableEntries(m_db.ViewTableId, ref objIds, ref names); + GetSymbolTableEntries(m_db.ViewportTableId, ref objIds, ref names); + GetSymbolTableEntries(m_db.UcsTableId, ref objIds, ref names); + + // get all the NamedObjectDictionary objects + GetRecursiveDictionaryEntries(m_db.NamedObjectsDictionaryId, ref objIds, ref names); + + // get all the Extension dictionary objects + foreach (ObjectId extDictId in m_extDictIds) + GetRecursiveDictionaryEntries(extDictId, ref objIds, ref names); + + int len = objIds.Count; + + // get reference count to these objects + int[] countArray = new int[len]; + for (int i = 0; i < len; i++) + countArray[i] = 0; // init count values; + + m_db.CountHardReferences(objIds, countArray); + + SymbolCount tmpCount = null; + for (int i = 0; i < len; i++) + { + DBObject tmpObj = m_trHlp.Transaction.GetObject(objIds[i], OpenMode.ForRead); + tmpCount = GetObjectNode(GetObjClassName(tmpObj), tmpObj.GetType().Name, true); + if (tmpCount != null) + { + tmpCount.m_count++; + tmpCount.m_symbolNames.Add(names[i]); + tmpCount.m_references.Add(countArray[i]); + } + } + } + + /// + /// Get all the entries in a given SymbolTable + /// + /// The ObjectId of the SymbolTable + /// The ObjectIds of all the entries + /// The names of all the entries + + private void + GetSymbolTableEntries(ObjectId tblId, ref ObjectIdCollection objIds, ref ArrayList names) + { + DBObject tmpObj = m_trHlp.Transaction.GetObject(tblId, OpenMode.ForRead); + SymbolTable tbl = tmpObj as SymbolTable; + if (tbl != null) + { + // iterate over each TblRec in the SymbolTable + foreach (ObjectId tblRecId in tbl) + { + names.Add(m_trHlp.SymbolIdToName(tblRecId)); + objIds.Add(tblRecId); + } + } + } + + /// + /// Recursively walk through all Dictionaries under the one passed in + /// + /// + /// + /// + /// + + private void + GetRecursiveDictionaryEntries(ObjectId dictId, ref ObjectIdCollection objIds, ref ArrayList names) + { + // NOTE: when recursively processing items in a dictionary + // we may encounter things that are not derived from DBDictionary. + // In that case, the cast to type DBDictionary will fail and + // we'll just return without adding any nested items. + DBObject tmpObj = m_trHlp.Transaction.GetObject(dictId, OpenMode.ForRead); + DBDictionary dbDict = tmpObj as DBDictionary; + if (dbDict != null) + { + foreach (DictionaryEntry curEntry in dbDict) + { + objIds.Add((ObjectId)curEntry.Value); + names.Add((string)curEntry.Key); + + // if this is a dictionary, it will recursively add + // all of its children to the tree + GetRecursiveDictionaryEntries((ObjectId)curEntry.Value, ref objIds, ref names); + } + } + } + + /// + /// Create the XML Report for this database + /// + /// + /// + + public void + XmlReport(string reportPath, Database db) + { + // make sure everything is cleaned out in case they run this twice + m_entities.Clear(); + m_objects.Clear(); + m_extDictIds.Clear(); + m_db = db; + + using (m_trHlp = new TransactionHelper(db)) + { + m_trHlp.Start(); + + ProcessEntities(); + ProcessObjects(); + + XmlTextWriter stream = new XmlTextWriter(reportPath, System.Text.Encoding.UTF8); + stream.Formatting = Formatting.Indented; + stream.IndentChar = '\t'; + stream.Indentation = 1; + + stream.WriteStartDocument(); + stream.WriteStartElement("Drawings"); + stream.WriteStartElement("Drawing"); + + stream.WriteAttributeString("path", db.Filename); + + stream.WriteStartElement("Entities"); + XmlReportRawEntityCount(stream); + XmlReportBlockDefs(stream); + stream.WriteEndElement(); // "Entities" + + stream.WriteStartElement("Symbols"); + XmlReportRawSymbolCount(stream); + XmlReportSymbolReferences(stream); + stream.WriteEndElement(); // "Symbols" + + stream.WriteEndElement(); // "Drawing" + stream.WriteEndElement(); // "Drawings" + stream.WriteEndDocument(); + + stream.Close(); + + m_trHlp.Commit(); + } + } + + /// + /// Create the XML report for a batch of drawings. + /// + /// The XML filename to use + /// Array of paths to drawing files + public void + XmlReport(string reportPath, string[] fnames) + { + XmlTextWriter stream = new XmlTextWriter(reportPath, System.Text.Encoding.UTF8); + stream.Formatting = Formatting.Indented; + stream.IndentChar = '\t'; + stream.Indentation = 1; + + stream.WriteStartDocument(); + stream.WriteStartElement("Drawings"); + + foreach (string dwgPath in fnames) + { + // make sure everything is cleaned out in case they run this twice + m_entities.Clear(); + m_objects.Clear(); + m_extDictIds.Clear(); + + Utils.AcadUi.PrintToCmdLine(string.Format("\nProcessing drawing file: {0} ...", dwgPath)); + using (m_db = new Database(false, true)) + { + m_db.ReadDwgFile(dwgPath, System.IO.FileShare.Read, true, null); + + using (m_trHlp = new TransactionHelper(m_db)) + { + m_trHlp.Start(); + + ProcessEntities(); + ProcessObjects(); + + stream.WriteStartElement("Drawing"); + + stream.WriteAttributeString("path", dwgPath); + + stream.WriteStartElement("Entities"); + XmlReportRawEntityCount(stream); + XmlReportBlockDefs(stream); + stream.WriteEndElement(); // "Entities" + + stream.WriteStartElement("Symbols"); + XmlReportRawSymbolCount(stream); + XmlReportSymbolReferences(stream); + stream.WriteEndElement(); // "Symbols" + + stream.WriteEndElement(); // "Drawing" + + m_trHlp.Commit(); + } + + m_db.Dispose(); + } + + m_db = null; + } + + stream.WriteEndElement(); // "Drawings" + stream.WriteEndDocument(); + stream.Close(); + } + + private void + XmlReportBlockDefs(XmlTextWriter stream) + { + DwgStats.BlockCount tmpBlockCount; + DwgStats.ObjCount tmpObjCount; + + stream.WriteStartElement("BlockDefs"); + + // walk through all the entries and file out the stats + int len = m_entities.Count; + for (int i = 0; i < len; i++) + { + tmpBlockCount = (DwgStats.BlockCount)m_entities[i]; + + int len2 = tmpBlockCount.m_objCounts.Count; + + // only output this if there are entities within the block + if (len2 > 0) + { + stream.WriteStartElement("BlockDef"); + stream.WriteAttributeString("name", tmpBlockCount.m_blockName); + + BlockTableRecord blkRec = (BlockTableRecord)m_trHlp.Transaction.GetObject(tmpBlockCount.m_blockDefId, OpenMode.ForRead); + stream.WriteAttributeString("isAnonymous", blkRec.IsAnonymous ? "1" : "0"); + stream.WriteAttributeString("isFromXref", (blkRec.IsFromExternalReference || blkRec.IsFromOverlayReference) ? "1" : "0"); + stream.WriteAttributeString("isLayout", blkRec.IsLayout ? "1" : "0"); + + for (int j = 0; j < len2; j++) + { + tmpObjCount = (DwgStats.ObjCount)tmpBlockCount.m_objCounts[j]; + + stream.WriteStartElement("ObjectType"); + stream.WriteAttributeString("class", tmpObjCount.m_className); + stream.WriteAttributeString("displayName", tmpObjCount.m_displayName); + stream.WriteAttributeString("count", tmpObjCount.m_count.ToString()); + stream.WriteEndElement(); + } + + stream.WriteEndElement(); + } + } + + stream.WriteEndElement(); + } + + private void + XmlReportRawEntityCount(XmlTextWriter stream) + { + BlockCount tmpBlockCount = null; + ObjCount tmpObjCount = null; + + stream.WriteStartElement("RawCount"); + + ArrayList classNames = new ArrayList(); + ArrayList displayNames = new ArrayList(); + ArrayList objCounts = new ArrayList(); ; + + // walk through all the entries and file out the stats + int len = m_entities.Count; + for (int i = 0; i < len; i++) + { + tmpBlockCount = (BlockCount)m_entities[i]; + + int len2 = tmpBlockCount.m_objCounts.Count; + for (int j = 0; j < len2; j++) + { + tmpObjCount = (ObjCount)tmpBlockCount.m_objCounts[j]; + + int index; + if (FindClassName(classNames, tmpObjCount.m_className, out index)) + { + objCounts[index] = ((long)objCounts[index]) + tmpObjCount.m_count; + } + else + { + classNames.Add(tmpObjCount.m_className); + displayNames.Add(tmpObjCount.m_displayName); + objCounts.Add(tmpObjCount.m_count); + } + } + } + + // now push out to XML + len = classNames.Count; + for (int i = 0; i < len; i++) + { + stream.WriteStartElement("ObjectType"); + stream.WriteAttributeString("class", (string)classNames[i]); + stream.WriteAttributeString("displayName", (string)displayNames[i]); + stream.WriteAttributeString("count", objCounts[i].ToString()); + stream.WriteEndElement(); + } + + stream.WriteEndElement(); + } + + private void + XmlReportRawSymbolCount(XmlTextWriter stream) + { + SymbolCount tmpObjCount; + + stream.WriteStartElement("RawCount"); + + // walk through all the entries and file out the stats + int len = m_objects.Count; + for (int i = 0; i < len; i++) + { + tmpObjCount = (SymbolCount)m_objects[i]; + + stream.WriteStartElement("ObjectType"); + stream.WriteAttributeString("class", tmpObjCount.m_className); + stream.WriteAttributeString("displayName", tmpObjCount.m_displayName); + stream.WriteAttributeString("count", tmpObjCount.m_count.ToString()); + stream.WriteEndElement(); + } + + stream.WriteEndElement(); + } + + private void + XmlReportSymbolReferences(XmlTextWriter stream) + { + SymbolCount tmpSymCount; + + stream.WriteStartElement("References"); + + // walk through all the entries and file out the stats + int len = m_objects.Count; + for (int i = 0; i < len; i++) + { + tmpSymCount = (SymbolCount)m_objects[i]; + + stream.WriteStartElement("ObjectType"); + stream.WriteAttributeString("class", tmpSymCount.m_className); + stream.WriteAttributeString("displayName", tmpSymCount.m_displayName); + stream.WriteAttributeString("count", tmpSymCount.m_count.ToString()); + + int len2 = tmpSymCount.m_symbolNames.Count; + for (int j = 0; j < len2; j++) + { + stream.WriteStartElement("Symbol"); + stream.WriteAttributeString("name", (string)tmpSymCount.m_symbolNames[j]); + stream.WriteAttributeString("references", tmpSymCount.m_references[j].ToString()); + stream.WriteEndElement(); + } + stream.WriteEndElement(); // "ObjectType" + } + + stream.WriteEndElement(); // "References" + } + + private bool + FindClassName(ArrayList strs, string matchStr, out int index) + { + index = 0; + int len = strs.Count; + + for (int i = 0; i < len; i++) + { + if (matchStr == (string)strs[i]) + { + index = i; + return true; + } + } + + return false; + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/DwgStats/SymbolCount.cs b/MgdDbgLibrary/DwgStats/SymbolCount.cs new file mode 100644 index 0000000..36a3bc2 --- /dev/null +++ b/MgdDbgLibrary/DwgStats/SymbolCount.cs @@ -0,0 +1,42 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Collections; + +namespace MgdDbg.DwgStats +{ + /// + /// Summary description for SymbolCount. + /// + public class SymbolCount : ObjCount + { + // data members + public ArrayList m_symbolNames = new ArrayList(); // individual names of the instances of this class + + public ArrayList m_references = new ArrayList(); // parallel array of reference counts + + public + SymbolCount() + { + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/LICENSE b/MgdDbgLibrary/LICENSE new file mode 100644 index 0000000..b233efa --- /dev/null +++ b/MgdDbgLibrary/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Autodesk Developer Network + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/MgdDbgLibrary/MgdDbg.csproj b/MgdDbgLibrary/MgdDbg.csproj new file mode 100644 index 0000000..c759fd1 --- /dev/null +++ b/MgdDbgLibrary/MgdDbg.csproj @@ -0,0 +1,107 @@ + + + net48 + Local + latest + net48 + JScript + Grid + IE50 + false + false + false + Library + OnBuildSuccess + + + false + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + false + true + true + true + + + 285212672 + 4096 + AllRules.ruleset + false + false + full + + + true + full + + + + None + + + + + System + + + 3.5 + + + System.Data + + + System.Drawing + + + System.XML + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + false + + + + + + + + + + \ No newline at end of file diff --git a/MgdDbgLibrary/MgdDbg.sln b/MgdDbgLibrary/MgdDbg.sln new file mode 100644 index 0000000..4489b31 --- /dev/null +++ b/MgdDbgLibrary/MgdDbg.sln @@ -0,0 +1,18 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MgdDbg", "MgdDbg.csproj", "{C9B52572-4947-4AD7-86CE-EFB7A036FA9F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C9B52572-4947-4AD7-86CE-EFB7A036FA9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C9B52572-4947-4AD7-86CE-EFB7A036FA9F}.Debug|Any CPU.Build.0 = Debug|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/MgdDbgLibrary/ObjTests/CategoryTests.cs b/MgdDbgLibrary/ObjTests/CategoryTests.cs new file mode 100644 index 0000000..2c9740f --- /dev/null +++ b/MgdDbgLibrary/ObjTests/CategoryTests.cs @@ -0,0 +1,311 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using MgdDbg.CompBuilder; +using MgdDbg.ObjTests.Forms; +using MgdDbg.ObjTests.TestFramework; +using System.Windows.Forms; +using AcadApp = Autodesk.AutoCAD.ApplicationServices; +using SelectionSet = MgdDbg.Prompts.SelectionSet; + +namespace MgdDbg.ObjTests +{ + /// + /// + /// + public class CategoryTests : MgdDbgTestFuncs + { + private Autodesk.AutoCAD.DatabaseServices.Database db = null; + + public + CategoryTests() + { + db = Utils.Db.GetCurDwg(); + + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Selection Set Options", + "Various combinations of getting selection sets", "Selection Set", + new MgdDbgTestFuncInfo.TestFunc(SelectionSet), MgdDbgTestFuncInfo.TestType.Other)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Select Red Circles Only", + "Use a filter to only allow selection of Red Circles", "Selection Set", + new MgdDbgTestFuncInfo.TestFunc(SelectRedCircles), MgdDbgTestFuncInfo.TestType.Other)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Select Circles or Arcs", + "Use a filter to only allow selection of Circles and Arcs", "Selection Set", + new MgdDbgTestFuncInfo.TestFunc(SelectCirclesAndArcs), MgdDbgTestFuncInfo.TestType.Other)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Diff Entities", + "Diff between two entities", "Reflection", + new MgdDbgTestFuncInfo.TestFunc(EntityDiff), MgdDbgTestFuncInfo.TestType.Other)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Diff Objects", + "Diff between two objects", "Reflection", + new MgdDbgTestFuncInfo.TestFunc(ObjectDiff), MgdDbgTestFuncInfo.TestType.Other)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Snoop XML Dom Document", + "Exercise XML Dom API", "Import/Export", + new MgdDbgTestFuncInfo.TestFunc(SnoopXml), MgdDbgTestFuncInfo.TestType.Other)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Test Prompts", + "Exercise prompt classes", "Prompts", + new MgdDbgTestFuncInfo.TestFunc(TestPrompts), MgdDbgTestFuncInfo.TestType.Other)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Drawing Stats", + "Export database stats to XML file", "Import/Export", + new MgdDbgTestFuncInfo.TestFunc(DwgStats), MgdDbgTestFuncInfo.TestType.Other)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Drawing Stats Batch", + "Export batch stats to XML file", "Import/Export", + new MgdDbgTestFuncInfo.TestFunc(DwgStatsBatch), MgdDbgTestFuncInfo.TestType.Other)); + } + + #region Tests + + /// + /// A test for every basic combination of SelectionSet options + /// + + public void + SelectionSet() + { + SelectionSet dbox = new SelectionSet(); + AcadApp.Application.ShowModalDialog(dbox); + } + + /// + /// Simple test to show how to do a filtered selection + /// + + public void + SelectRedCircles() + { + TypedValue[] filterPairs = { + new TypedValue((int)DxfCode.Start, "CIRCLE"), + new TypedValue((int)DxfCode.Color, 1), + }; + + SelectionFilter filter = new SelectionFilter(filterPairs); + + Editor editor = AcadApp.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptSelectionOptions selOpts = new PromptSelectionOptions(); + selOpts.MessageForAdding = "Select red circles"; + + PromptSelectionResult prRes = editor.GetSelection(filter); + ShowPromptResult("Select Red Circles", prRes); + } + + /// + /// Simple test to show how to do a filtered selection with a boolean operator + /// + + public void + SelectCirclesAndArcs() + { + TypedValue[] filterPairs = { + new TypedValue((int)DxfCode.Operator, ""), + }; + + SelectionFilter filter = new SelectionFilter(filterPairs); + + Editor editor = AcadApp.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptSelectionOptions selOpts = new PromptSelectionOptions(); + selOpts.MessageForAdding = "Select circles and arcs"; + + PromptSelectionResult prRes = editor.GetSelection(filter); + ShowPromptResult("Select Circles and Arcs", prRes); + } + + /// + /// Display the result of the Selection Prompt to the user for inspection + /// + /// + /// + + private void + ShowPromptResult(string dboxTitle, PromptSelectionResult result) + { + if (result.Status == PromptStatus.OK) + { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(result.Value); + dbox.Text = dboxTitle; + AcadApp.Application.ShowModalDialog(dbox); + } + else + { + MessageBox.Show(string.Format("Prompt status: {0}", result.Status.ToString()), "PromptSelectionResult", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + + /// + /// Compare two entities values using relection, and show the differences. + /// + + public void + EntityDiff() + { + Editor ed = AcadApp.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptEntityResult res = ed.GetEntity("\nSelect first entity"); + if (res.Status != PromptStatus.OK) + return; + ObjectId objId1 = res.ObjectId; + + res = ed.GetEntity("\nSelect second entity"); + if (res.Status != PromptStatus.OK) + return; + ObjectId objId2 = res.ObjectId; + + using (TransactionHelper trHlp = new TransactionHelper()) + { + trHlp.Start(); + + EntityDiff dbox = new EntityDiff(objId1, objId2, trHlp); + dbox.Text = "Diff Objects"; + AcadApp.Application.ShowModalDialog(dbox); + + trHlp.Commit(); + } + } + + /// + /// Compare two object's values using relection, and show the differences. + /// + + public void + ObjectDiff() + { + using (TransactionHelper trHlpr = new TransactionHelper()) + { + trHlpr.Start(); + + ObjectDiff diff = new ObjectDiff(trHlpr); + AcadApp.Application.ShowModalDialog(diff); + + trHlpr.Commit(); + } + } + + /// + /// Allow the user to snoop through an XML file and test/learn all the various functions + /// available from the XML DOM. + /// + + public void + SnoopXml() + { + System.Windows.Forms.OpenFileDialog dbox = new System.Windows.Forms.OpenFileDialog(); + dbox.CheckFileExists = true; + dbox.AddExtension = true; + dbox.DefaultExt = "xml"; + dbox.Filter = "XML Files (*.xml)|*.xml"; + dbox.Multiselect = false; + dbox.Title = "Select an XML file"; + + if (dbox.ShowDialog() == DialogResult.OK) + { + try + { + System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); + xmlDoc.Load(dbox.FileName); + + Xml.Forms.Dom form = new Xml.Forms.Dom(xmlDoc); + AcadApp.Application.ShowModalDialog(form); + } + catch (System.Xml.XmlException e) + { + MessageBox.Show(e.Message, "XML Exception"); + } + } + } + + /// + /// Test/Demonstrate every option for Prompting + /// + + public void + TestPrompts() + { + Prompts.PromptTestForm form = new Prompts.PromptTestForm(); + + while (AcadApp.Application.ShowModalDialog(form) == DialogResult.OK) + { + form.RunPrompt(); + } + } + + /// + /// Publish out DWG stats to an XML file (number of blocks, how many times a layer is + /// referenced, etc.). The XML file can then be displayed as HTML Browser reports. + /// After producing the XML file, double-click on the file: ../MgdDbg/ReportBrowser/ObjCountReport.html + /// and then load the XML file. + /// + + public void + DwgStats() + { + // get output file to save XML report to + System.Windows.Forms.SaveFileDialog dbox = new System.Windows.Forms.SaveFileDialog(); + dbox.CreatePrompt = false; + dbox.OverwritePrompt = true; + dbox.AddExtension = true; + dbox.DefaultExt = "xml"; + dbox.Filter = "XML Files (*.xml)|*.xml"; + dbox.Title = "XML file to save report as"; + + if (dbox.ShowDialog() == DialogResult.OK) + { + DwgStats.Report statReport = new DwgStats.Report(); + statReport.XmlReport(dbox.FileName, Utils.Db.GetCurDwg()); + } + } + + /// + /// Same thing as above except you can batch process several files at once + /// + + public void + DwgStatsBatch() + { + // get multiple files to batch process + Autodesk.AutoCAD.Windows.OpenFileDialog dwgsForm = new Autodesk.AutoCAD.Windows.OpenFileDialog("Drawing Files To Process", + null, "dwg", "DwgStatsBatch", Autodesk.AutoCAD.Windows.OpenFileDialog.OpenFileDialogFlags.AllowMultiple); + if (dwgsForm.ShowDialog() != DialogResult.OK) + return; + + // get output file to save XML report to + System.Windows.Forms.SaveFileDialog dbox = new System.Windows.Forms.SaveFileDialog(); + dbox.CreatePrompt = false; + dbox.OverwritePrompt = true; + dbox.AddExtension = true; + dbox.DefaultExt = "xml"; + dbox.Filter = "XML Files (*.xml)|*.xml"; + dbox.Title = "XML file to save report as"; + + if (dbox.ShowDialog() == DialogResult.OK) + { + DwgStats.Report statReport = new DwgStats.Report(); + statReport.XmlReport(dbox.FileName, dwgsForm.GetFilenames()); + } + } + + #endregion Tests + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/DbTests.cs b/MgdDbgLibrary/ObjTests/DbTests.cs new file mode 100644 index 0000000..a88411a --- /dev/null +++ b/MgdDbgLibrary/ObjTests/DbTests.cs @@ -0,0 +1,807 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Geometry; +using MgdDbg.CompBuilder; +using MgdDbg.ObjTests.Forms; +using MgdDbg.ObjTests.TestFramework; +using MgdDbg.Utils; +using System; +using System.Collections; +using System.Windows.Forms; +using AcadApp = Autodesk.AutoCAD.ApplicationServices; +using AcRx = Autodesk.AutoCAD.Runtime; + +namespace MgdDbg.ObjTests +{ + /// + /// Summary description for QueryDbTests. + /// + public class DbTests : MgdDbgTestFuncs + { + private Database m_db = null; + + public + DbTests() + { + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Xref graph (with ghosts)", "Display the graph of Xrefs for the current drawing", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(XrefGraphGhosts), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Xref graph (without ghosts)", "Display the graph of Xrefs for the current drawing", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(XrefGraphNoGhosts), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Count hard references", "See which objects have a hard reference to a selected object", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(CountHardReferences), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Attach xref", "Attaches an Xref file", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(AttachXref), MgdDbgTestFuncInfo.TestType.Modify)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Overlay xref", "Overlays an Xref file", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(OverlayXref), MgdDbgTestFuncInfo.TestType.Modify)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Detach xref", "Detaches an Xref file", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(DetachXref), MgdDbgTestFuncInfo.TestType.Modify)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Deep clone", "Deep clones selected objects with Model Space as owner", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(DeepClone), MgdDbgTestFuncInfo.TestType.Modify)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Insert (in block table)", "Creates a BlockTableRecord from external DWG's ModelSpace", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(InsertInBlockTable), MgdDbgTestFuncInfo.TestType.Modify)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Insert (explode into model space)", "Inserts entities from ModelSpace of external DWG (INSERT*)", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(InsertInModelSpace), MgdDbgTestFuncInfo.TestType.Modify)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Insert (copy block)", "Inserts contents of BlockTableRecord from one DWG to a new BlockTable Record in current DWG", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(InsertBlock), MgdDbgTestFuncInfo.TestType.Modify)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Purge", "Queries if an object is purgable", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(Purge), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Wblock entire database", "Creates new db; clones in everything referenced from Model_Space", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(Wblock), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Wblock objects1", "Creates a new db; clones in a block or objects", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(WblockObjects1), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Wblock objects2", "Clones in objects to an existing db's Model Space", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(WblockObjects2), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Wblock clone objects", "Clones in objects from source to dest db", typeof(Database), new MgdDbgTestFuncInfo.TestFunc(WblockCloneObjects), MgdDbgTestFuncInfo.TestType.Create)); + } + + #region Tests + + public void + XrefGraphGhosts() + { + m_db = Utils.Db.GetCurDwg(); + + XrefGraph xrefGraph = m_db.GetHostDwgXrefGraph(true); + + Snoop.Forms.XrefGraph form = new Snoop.Forms.XrefGraph(xrefGraph); + form.ShowDialog(); + } + + public void + XrefGraphNoGhosts() + { + m_db = Utils.Db.GetCurDwg(); + + XrefGraph xrefGraph = m_db.GetHostDwgXrefGraph(false); + + Snoop.Forms.XrefGraph form = new Snoop.Forms.XrefGraph(xrefGraph); + form.ShowDialog(); + } + + public void + CountHardReferences() + { + Snoop.ObjIdSet objSet = Snoop.Utils.GetSnoopSet(); + if (objSet == null) + return; + + int[] countArray = new int[objSet.Set.Count]; + + if (countArray.Length > 0) + { + objSet.Db.CountHardReferences(objSet.Set, countArray); + } + + for (int i = 0; i < objSet.Set.Count; i++) + { + AcadUi.PrintToCmdLine(string.Format("\n{0,-30}: {1:d}", AcadUi.ObjToTypeAndHandleStr(objSet.Set[i]), countArray[i])); + } + } + + /// + /// Note that this is not the same as the Xref command + /// The Xref command does some further work to put a + /// block ref instance in the model space + /// + + public void + AttachXref() + { + m_db = Utils.Db.GetCurDwg(); + if (m_db == null) + return; + + string fileName = Utils.Dialog.OpenFileDialog(".dwg", "Choose dwg to attach as Xref", "Dwg files (*.dwg)|*.dwg"); + if (fileName.Length == 0) + return; + string blockName = System.IO.Path.GetFileNameWithoutExtension(fileName); + if (blockName.Length == 0) + return; + if (blockName.ToLower() == System.IO.Path.GetFileNameWithoutExtension(Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Name).ToLower()) + { + MessageBox.Show("External file name used could lead to a circular reference.", "MgdDbg", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + ObjectId objId = m_db.AttachXref(fileName, blockName); + + using (TransactionHelper trHlp = new TransactionHelper(m_db)) + { + trHlp.Start(); + + BlockTableRecord btr = (BlockTableRecord)trHlp.Transaction.GetObject(objId, OpenMode.ForRead); + Database xrefDb = btr.GetXrefDatabase(true); + + BlockTable blkTbl = (BlockTable)trHlp.Transaction.GetObject(m_db.BlockTableId, OpenMode.ForRead); + + ObjectIdCollection blkRecIds = new ObjectIdCollection(); + blkRecIds.Add(btr.ObjectId); + + foreach (ObjectId tblRecId in blkTbl) + { + BlockTableRecord blkRec = (BlockTableRecord)trHlp.Transaction.GetObject(tblRecId, OpenMode.ForRead); + if (blkRec.Database == xrefDb) + blkRecIds.Add(tblRecId); + } + + Snoop.Forms.DBObjects form = new Snoop.Forms.DBObjects(blkRecIds, trHlp); + form.Text = "Xref Block Table Records"; + form.ShowDialog(); + trHlp.Commit(); + } + } + + /// + /// Note that this is not the same as the Xref command + /// The Xref command does some further work to put a + /// block ref instance in the model space + /// + + public void + OverlayXref() + { + m_db = Utils.Db.GetCurDwg(); + if (m_db == null) + return; + + string fileName = Utils.Dialog.OpenFileDialog(".dwg", "Choose dwg to overlay as Xref", "Dwg files (*.dwg)|*.dwg"); + if (fileName.Length == 0) + return; + + string blockName = System.IO.Path.GetFileNameWithoutExtension(fileName); + if (blockName.Length == 0) + return; + + ObjectId objId = m_db.OverlayXref(fileName, blockName); + using (TransactionHelper trHlp = new TransactionHelper(m_db)) + { + trHlp.Start(); + + ObjectIdCollection objIds = new ObjectIdCollection(); + objIds.Add(objId); + + Snoop.Forms.DBObjects objs = new Snoop.Forms.DBObjects(objIds, trHlp); + objs.Text = "Xrefd Block"; + objs.ShowDialog(); + + trHlp.Commit(); + } + } + + /// + /// + /// + public void + DetachXref() + { + m_db = Utils.Db.GetCurDwg(); + if (m_db == null) + return; + + ObjectIdCollection selSet = null; + if (Utils.AcadUi.GetSelSetFromUser(out selSet) == false) + return; + + using (TransactionHelper trHlp = new TransactionHelper(m_db)) + { + trHlp.Start(); + + foreach (ObjectId bRefId in selSet) + { + BlockReference bRef = trHlp.Transaction.GetObject(bRefId, OpenMode.ForRead) as BlockReference; + if (bRef == null) + continue; + ObjectId xrefId = bRef.BlockTableRecord; + BlockTableRecord btr = trHlp.Transaction.GetObject(xrefId, OpenMode.ForRead) as BlockTableRecord; + if (btr.XrefStatus == XrefStatus.Resolved) + m_db.DetachXref(xrefId); + } + + trHlp.Commit(); + } + } + + /// + /// + /// + public void + DeepClone() + { + m_db = Utils.Db.GetCurDwg(); + if (m_db == null) + return; + + ObjectIdCollection selSet = null; + if (Utils.AcadUi.GetSelSetFromUser(out selSet) == false) + return; + if (selSet.Count == 0) + return; + + ObjectId ownerId = new ObjectId(); + IdMapping idMap = new IdMapping(); + + /// check to make sure the objects all have same owner + /// if not set up as many objIdCollections + Hashtable ownerIdMap = new Hashtable(); + using (TransactionHelper trHlp = new TransactionHelper(m_db)) + { + trHlp.Start(); + + foreach (ObjectId tempId in selSet) + { + DBObject tempObj = trHlp.Transaction.GetObject(tempId, OpenMode.ForRead); + + if (ownerIdMap.ContainsKey(tempObj.OwnerId)) + { + ObjectIdCollection objIds = ownerIdMap[tempObj.OwnerId] as ObjectIdCollection; + objIds.Add(tempId); + } + else + { + /// if a new owner if found, stuff it in map + ObjectIdCollection objIds = new ObjectIdCollection(); + objIds.Add(tempId); + ownerIdMap.Add(tempObj.OwnerId, objIds); + } + } + /// make the model space the owner by default + BlockTable blkTbl = (BlockTable)trHlp.Transaction.GetObject(m_db.BlockTableId, OpenMode.ForRead); + ownerId = blkTbl["*MODEL_SPACE"]; + + trHlp.Commit(); + } + + ICollection keys = ownerIdMap.Keys; + int keyCount = ownerIdMap.Keys.Count; + int i = 0; + bool deferXlation = true; + + using (TransactionHelper trHlp = new TransactionHelper(m_db)) + { + trHlp.Start(); + + /// if objects to be cloned have different owners + /// DeepCloneObjects should be called with + /// deferXlation set to true for all except last time + foreach (object key in keys) + { + i++; + if (i == keyCount) + deferXlation = false; + ObjectIdCollection objectIds = ownerIdMap[key] as ObjectIdCollection; + m_db.DeepCloneObjects(objectIds, ownerId, idMap, deferXlation); + + Snoop.Forms.DBObjects objs = new Snoop.Forms.DBObjects(objectIds, trHlp); + objs.Text = "Deep cloned objects"; + objs.ShowDialog(); + } + trHlp.Commit(); + } + } + + /// + /// Select an external .dwg file. Then copy the contents of its MODEL_SPACE into a BlockTableRecord + /// in the current drawing. Equivalent to the INSERT command, but doesn't create the final BlockReference + /// + + public void + InsertInBlockTable() + { + m_db = Utils.Db.GetCurDwg(); + if (m_db == null) + return; + + string dwgName = Utils.Dialog.OpenFileDialog(".dwg", "Choose dwg to insert from", "Dwg files (*.dwg)|*.dwg"); + if (dwgName.Length == 0) + return; + + try + { + Database extDb = new Database(false, true); + extDb.ReadDwgFile(dwgName, System.IO.FileShare.Read, true, null); + + ObjectId objId = m_db.Insert("MgdDbg_InsertedBlock", extDb, true); // TBD: should allow user to name the destination block + using (TransactionHelper trHlp = new TransactionHelper(m_db)) + { + trHlp.Start(); + + ObjectIdCollection objIds = new ObjectIdCollection(); + objIds.Add(objId); + + Snoop.Forms.DBObjects objs = new Snoop.Forms.DBObjects(objIds, trHlp); + objs.Text = "Inserted Block"; + objs.ShowDialog(); + + trHlp.Commit(); + } + } + catch (AcRx.Exception e) + { + AcadUi.PrintToCmdLine(string.Format("\nERROR: {0}", ((AcRx.ErrorStatus)e.ErrorStatus).ToString())); + } + } + + /// + /// Insert contents of external dwg's model space into our model space. + /// + + public void + InsertInModelSpace() + { + m_db = Utils.Db.GetCurDwg(); + if (m_db == null) + return; + + string dwgName = Utils.Dialog.OpenFileDialog(".dwg", "Choose dwg to insert from", "Dwg files (*.dwg)|*.dwg"); + if (dwgName.Length == 0) + return; + + Database extDb = new Database(false, true); + extDb.ReadDwgFile(dwgName, System.IO.FileShare.Read, true, null); + + if (extDb == null) + return; + + try + { + m_db.Insert(Matrix3d.Identity, extDb, true); + } + catch (AcRx.Exception e) + { + AcadUi.PrintToCmdLine(string.Format("\nERROR: {0}", ((AcRx.ErrorStatus)e.ErrorStatus).ToString())); + } + } + + /// + /// Copy the contents of a selected block in external drawing and create/replace one + /// in the current drawing. + /// + + public void + InsertBlock() + { + m_db = Utils.Db.GetCurDwg(); + if (m_db == null) + return; + + string dwgName = Utils.Dialog.OpenFileDialog(".dwg", "Choose dwg to insert from", "Dwg files (*.dwg)|*.dwg"); + if (dwgName.Length == 0) + return; + + Database extDb = new Database(false, true); + extDb.ReadDwgFile(dwgName, System.IO.FileShare.Read, true, null); + + if (extDb == null) + return; + + // TBD: should allow user to select source block and name the destination block + + ObjectId objId = m_db.Insert("*Model_Space", "MgdDbg_InsertedBlock2", extDb, true); + using (TransactionHelper trHlp = new TransactionHelper(m_db)) + { + trHlp.Start(); + + ObjectIdCollection objIds = new ObjectIdCollection(); + objIds.Add(objId); + + Snoop.Forms.DBObjects objs = new Snoop.Forms.DBObjects(objIds, trHlp); + objs.Text = "Inserted Block"; + objs.ShowDialog(); + + trHlp.Commit(); + } + } + + /// + /// Test the Purge function. Collect a set of selectable entities and non-graphic + /// Objects. Then call Purge and see which ones we are allowed to erase. + /// + + public void + Purge() + { + m_db = Utils.Db.GetCurDwg(); + if (m_db == null) + return; + + Snoop.ObjIdSet objSet = Snoop.Utils.GetSnoopSet(); + if (objSet == null) + return; + + // set the purgeableIds to everything selected + ObjectIdCollection purgableIds = new ObjectIdCollection(); + foreach (ObjectId objId in objSet.Set) + purgableIds.Add(objId); + + ObjectIdCollection nonPurgableIds = new ObjectIdCollection(); + + try + { + m_db.Purge(purgableIds); + + // see which ones were non-purgeable by seeing which ones got taken out of the array + foreach (ObjectId objId in objSet.Set) + { + if (!purgableIds.Contains(objId)) + nonPurgableIds.Add(objId); + } + + using (TransactionHelper trHlp = new TransactionHelper(m_db)) + { + trHlp.Start(); + + if (purgableIds.Count == 0) + Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("No purgable objects"); + else + { + Snoop.Forms.DBObjects objs = new Snoop.Forms.DBObjects(purgableIds, trHlp); + objs.Text = "Purgable objects"; + objs.ShowDialog(); + } + + if (nonPurgableIds.Count == 0) + Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("No non-purgable objects"); + else + { + Snoop.Forms.DBObjects objs = new Snoop.Forms.DBObjects(nonPurgableIds, trHlp); + objs.Text = "Non-purgable objects"; + objs.ShowDialog(); + } + + trHlp.Commit(); + } + } + catch (AcRx.Exception e) + { + AcadUi.PrintToCmdLine(string.Format("\nERROR: {0}", ((AcRx.ErrorStatus)e.ErrorStatus).ToString())); + } + } + + /// + /// Wblock entire database + /// + + public void + Wblock() + { + m_db = Utils.Db.GetCurDwg(); + if (m_db == null) + return; + + try + { + Database db = m_db.Wblock(); + using (TransactionHelper trHlp = new TransactionHelper(db)) + { + trHlp.Start(); + + Snoop.Forms.Database dbForm = new MgdDbg.Snoop.Forms.Database(db, trHlp); + dbForm.Text = "Destination Database (In memory only)"; + dbForm.ShowDialog(); + + trHlp.Commit(); + } + } + catch (AcRx.Exception e) + { + AcadUi.PrintToCmdLine(string.Format("\nERROR: {0}", ((AcRx.ErrorStatus)e.ErrorStatus).ToString())); + } + } + + /// + /// + /// + + public void + WblockObjects1() + { + m_db = Utils.Db.GetCurDwg(); + if (m_db == null) + return; + + PromptKeywordOptions prOpts = new PromptKeywordOptions("\nWblock a block or objects"); + prOpts.Keywords.Add("Block", "Block", "Block", true, true); + prOpts.Keywords.Add("Objects", "Objects", "Objects", true, true); + + Editor ed = AcadApp.Application.DocumentManager.MdiActiveDocument.Editor; + PromptResult prRes = ed.GetKeywords(prOpts); + if (prRes.Status != PromptStatus.OK) + return; + + Database db = null; + + using (TransactionHelper trHlp = new TransactionHelper(m_db)) + { + trHlp.Start(); + + ObjectIdCollection objIds; + if (!Utils.AcadUi.GetSelSetFromUser(out objIds)) + return; + + if (prRes.StringResult == "Block") + { + if (objIds.Count > 1) + { + ed.WriteMessage("\nSelect only one block"); + return; + } + DBObject obj = trHlp.Transaction.GetObject(objIds[0], OpenMode.ForRead); + BlockReference bRef = obj as BlockReference; + if (bRef != null) + { + db = m_db.Wblock(bRef.BlockTableRecord); + } + } + + if (prRes.StringResult == "Objects") + { + db = m_db.Wblock(objIds, new Point3d(0, 0, 0)); + } + + trHlp.Commit(); + } + + if (db == null) + return; + + using (TransactionHelper trHlp = new TransactionHelper(db)) + { + trHlp.Start(); + + Snoop.Forms.Database dbForm = new MgdDbg.Snoop.Forms.Database(db, trHlp); + dbForm.Text = "Destination Database (In memory only)"; + dbForm.ShowDialog(); + + trHlp.Commit(); + } + } + + /// + /// + /// + public void + WblockObjects2() + { + m_db = Utils.Db.GetCurDwg(); + if (m_db == null) + return; + + ObjectIdCollection objIds; + if (!Utils.AcadUi.GetSelSetFromUser(out objIds)) + return; + + String message = "\nDuplicate Record Cloning Options:"; + Array enums = Enum.GetValues(typeof(DuplicateRecordCloning)); + foreach (int option in enums) + { + message += string.Format("\n{0} = {1}", option, + Enum.GetName(typeof(DuplicateRecordCloning), option)); + } + + PromptIntegerOptions prOpts = new PromptIntegerOptions(message); + prOpts.LowerLimit = 0; + prOpts.UpperLimit = enums.Length; + + Editor ed = AcadApp.Application.DocumentManager.MdiActiveDocument.Editor; + PromptIntegerResult prRes = ed.GetInteger(prOpts); + if (prRes.Status != PromptStatus.OK) + return; + + Database db = new Database(true, true); + + DuplicateRecordCloning drc = (DuplicateRecordCloning)prRes.Value; + if (drc == DuplicateRecordCloning.NotApplicable || + drc == DuplicateRecordCloning.RefMangleName) + { + ed.WriteMessage("Invalid Input"); + return; + } + + using (TransactionHelper trHlp = new TransactionHelper(m_db)) + { + trHlp.Start(); + + m_db.Wblock(db, objIds, new Point3d(0, 0, 0), drc); + + trHlp.Commit(); + } + + using (TransactionHelper trHlp = new TransactionHelper(db)) + { + trHlp.Start(); + + Snoop.Forms.Database dbForm = new MgdDbg.Snoop.Forms.Database(db, trHlp); + dbForm.Text = "Destination Database (In memory only)"; + dbForm.ShowDialog(); + + trHlp.Commit(); + } + } + + /// + /// + /// + public void + WblockCloneObjects() + { + try + { + m_db = Utils.Db.GetCurDwg(); + if (m_db == null) + return; + + using (TransactionHelper trHlpr = new TransactionHelper()) + { + trHlpr.Start(); + + /// get the object to clone + Objects objs = new Objects(trHlpr); + if (objs.ShowDialog() != DialogResult.OK) + { + trHlpr.Abort(); + return; + } + + DBObject objToClone = trHlpr.Transaction.GetObject(objs.ObjectId, OpenMode.ForRead); + + if (objToClone is DBDictionary) + throw new System.Exception("Please select a record in a dictionary"); + + AcadApp.Document activeDoc = AcadApp.Application.DocumentManager.MdiActiveDocument; + + /// get cloning options... + /// + + //String message = "\nDuplicate Record Cloning Options:"; + //Array enums = Enum.GetValues(typeof(DuplicateRecordCloning)); + //foreach (int option in enums) { + // message += string.Format("\n{0} = {1}", + // option, + // Enum.GetName(typeof(DuplicateRecordCloning), option)); + //} + + //PromptIntegerOptions prOpts = new PromptIntegerOptions(message); + //prOpts.LowerLimit = 0; + //prOpts.UpperLimit = enums.Length; + + //Editor ed = activeDoc.Editor; + //PromptIntegerResult prRes = ed.GetInteger(prOpts); + //if (prRes.Status != PromptStatus.OK) + // return; + + //DuplicateRecordCloning drc = (DuplicateRecordCloning)prRes.Value; + //if (drc == DuplicateRecordCloning.NotApplicable || + // drc == DuplicateRecordCloning.RefMangleName) { + // ed.WriteMessage("Invalid Input"); + // return; + //} + + /// .... or not + DuplicateRecordCloning drc = DuplicateRecordCloning.Ignore; + + if (objToClone.OwnerId == ObjectId.Null) /// object to clone is a root object, can't clone + return; + + /// get the destination db + Documents docs = new Documents(); + docs.Text = "Destination database"; + + if (docs.ShowDialog() != DialogResult.OK) + return; + + Database dbSrc = activeDoc.Database; + Database dbDest = docs.Document.Database; + + if (dbDest == dbSrc) + { + throw new System.Exception("Please pick a destination database other than the source"); + } + + /// find out parent dictionary + ObjectId owningDictId = objToClone.OwnerId; + DBDictionary owningDictSrc = trHlpr.Transaction.GetObject(owningDictId, OpenMode.ForRead) as DBDictionary; + + /// might be nested + Stack owningDictNames = new Stack(); + + while (owningDictSrc.OwnerId != ObjectId.Null) + { + owningDictSrc = trHlpr.Transaction.GetObject(owningDictSrc.OwnerId, OpenMode.ForRead) as DBDictionary; + String owningDictName = owningDictSrc.NameAt(owningDictId); + owningDictNames.Push(owningDictName); + + owningDictId = owningDictSrc.ObjectId; + } + + /// check if parent dictionary exists in dest. + DBDictionary owningDictDest = null; + + using (Transaction trDest = dbDest.TransactionManager.StartTransaction()) + { + AcadApp.Application.DocumentManager.GetDocument(dbDest).LockDocument(); + DBDictionary parentDictDest = trDest.GetObject(dbDest.NamedObjectsDictionaryId, OpenMode.ForRead) as DBDictionary; + + String owningDictName = owningDictNames.Peek().ToString(); + + if (parentDictDest.Contains(owningDictName)) + { + while (owningDictNames.Count != 0) + { + owningDictName = owningDictNames.Pop().ToString(); + owningDictDest = trDest.GetObject(parentDictDest.GetAt(owningDictName), OpenMode.ForRead) as DBDictionary; + parentDictDest = owningDictDest; + } + } + else + { + /// dest doesnt have same structure , create it + while (owningDictNames.Count != 0) + { + owningDictName = owningDictNames.Pop().ToString(); + parentDictDest.UpgradeOpen(); + owningDictDest = new DBDictionary(); + parentDictDest.SetAt(owningDictName, owningDictDest); + trDest.AddNewlyCreatedDBObject(owningDictDest, true); + parentDictDest = owningDictDest; + } + } + + trDest.Commit(); + } + + /// clone the objects over + ObjectIdCollection objIds = new ObjectIdCollection(); + objIds.Add(objToClone.ObjectId); + + IdMapping idMap = new IdMapping(); + idMap.DestinationDatabase = dbDest; + + m_db.WblockCloneObjects(objIds, owningDictDest.ObjectId, idMap, drc, false); + + trHlpr.Commit(); + } + } + catch (AcRx.Exception ex) + { + if (ex.ErrorStatus == AcRx.ErrorStatus.FileNotFound) + MessageBox.Show("No documents found in current session"); + else + MessageBox.Show(ex.Message); + } + catch (System.Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + #endregion Tests + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/Forms/Documents.Designer.cs b/MgdDbgLibrary/ObjTests/Forms/Documents.Designer.cs new file mode 100644 index 0000000..bb53959 --- /dev/null +++ b/MgdDbgLibrary/ObjTests/Forms/Documents.Designer.cs @@ -0,0 +1,80 @@ +namespace MgdDbg.ObjTests.Forms +{ + partial class Documents + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose (bool disposing) + { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent () + { + this.m_cmbBox = new System.Windows.Forms.ComboBox(); + this.m_btnOk = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // m_cmbBox + // + this.m_cmbBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_cmbBox.FormattingEnabled = true; + this.m_cmbBox.Location = new System.Drawing.Point(12, 12); + this.m_cmbBox.Name = "m_cmbBox"; + this.m_cmbBox.Size = new System.Drawing.Size(157, 21); + this.m_cmbBox.TabIndex = 0; + this.m_cmbBox.SelectedIndexChanged += new System.EventHandler(this.m_cmbBox_SelectedIndexChanged); + // + // m_btnOk + // + this.m_btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_btnOk.Location = new System.Drawing.Point(50, 41); + this.m_btnOk.Name = "m_btnOk"; + this.m_btnOk.Size = new System.Drawing.Size(75, 23); + this.m_btnOk.TabIndex = 1; + this.m_btnOk.Text = "OK"; + this.m_btnOk.UseVisualStyleBackColor = true; + // + // Documents + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(181, 76); + this.Controls.Add(this.m_btnOk); + this.Controls.Add(this.m_cmbBox); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Documents"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Documents in Session"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ComboBox m_cmbBox; + private System.Windows.Forms.Button m_btnOk; + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/Forms/Documents.cs b/MgdDbgLibrary/ObjTests/Forms/Documents.cs new file mode 100644 index 0000000..7bba2f9 --- /dev/null +++ b/MgdDbgLibrary/ObjTests/Forms/Documents.cs @@ -0,0 +1,122 @@ +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.ApplicationServices; +using System; +using System.Collections; +using System.IO; +using System.Windows.Forms; +using AcRx = Autodesk.AutoCAD.Runtime; + +namespace MgdDbg.ObjTests.Forms +{ + /// + /// + /// + public partial class Documents : Form + { + private DocumentCollection m_docs = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + private Document m_doc; + + /// + /// + /// + public Document + Document + { + get + { + return m_doc; + } + } + + /// + /// + /// + public Documents() + { + InitializeComponent(); + InitializeComboBox(); + } + + #region ComboBox Item + + /// + /// + /// + public class ComboBoxItem + { + private Document m_doc; + + public ComboBoxItem(Document doc) + { + m_doc = doc; + } + + public Document + Value + { + get + { + return m_doc; + } + } + + public override string ToString() + { + return Path.GetFileName(m_doc.Name); + } + } + + #endregion ComboBox Item + + /// + /// + /// + public void + InitializeComboBox() + { + IEnumerator iter = m_docs.GetEnumerator(); + + while (iter.MoveNext()) + { + Document doc = iter.Current as Document; + ComboBoxItem item = new ComboBoxItem(doc); + m_cmbBox.Items.Add(item); + } + + if (m_cmbBox.Items.Count == 0) + throw new AcRx.Exception(AcRx.ErrorStatus.FileNotFound); + m_cmbBox.SelectedIndex = 0; + } + + /// + /// + /// + /// + /// + private void m_cmbBox_SelectedIndexChanged(object sender, EventArgs e) + { + ComboBoxItem item = m_cmbBox.SelectedItem as ComboBoxItem; + m_doc = item.Value; + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/Forms/Documents.resx b/MgdDbgLibrary/ObjTests/Forms/Documents.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/MgdDbgLibrary/ObjTests/Forms/Documents.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/Forms/EntityDiff.cs b/MgdDbgLibrary/ObjTests/Forms/EntityDiff.cs new file mode 100644 index 0000000..1792f6a --- /dev/null +++ b/MgdDbgLibrary/ObjTests/Forms/EntityDiff.cs @@ -0,0 +1,346 @@ +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using MgdDbg.CompBuilder; +using MgdDbg.Utils; +using System; +using System.Collections; +using System.Diagnostics; +using System.Drawing; +using System.Windows.Forms; +using AcadApp = Autodesk.AutoCAD.ApplicationServices; + +using AcDb = Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.ObjTests.Forms +{ + /// + /// Summary description for ObjectCompare. + /// + public class EntityDiff : System.Windows.Forms.Form + { + // member vars + protected System.Windows.Forms.ListView m_lvData; + + protected System.Windows.Forms.Button m_bnOK; + protected System.Windows.Forms.ColumnHeader m_lvCol_label; + protected System.Windows.Forms.ColumnHeader m_lvCol_value1; + protected System.Windows.Forms.ColumnHeader m_lvCol_value2; + + private ObjectCompare m_compareObjs; + + /// + /// Required designer variable. + /// + protected System.ComponentModel.Container components = null; + + /// + /// + /// + /// + /// + /// + public + EntityDiff(AcDb.ObjectId objId1, AcDb.ObjectId objId2, TransactionHelper tr) + { + // Required for Windows Form Designer support + InitializeComponent(); + + Object obj1 = tr.Transaction.GetObject(objId1, OpenMode.ForRead); + Object obj2 = tr.Transaction.GetObject(objId2, OpenMode.ForRead); + + m_compareObjs = new ObjectCompare(obj1, obj2); + Initialise(); + } + + /// + /// + /// + /// + /// + public + EntityDiff(Object obj1, Object obj2) + { + // Required for Windows Form Designer support + InitializeComponent(); + + m_compareObjs = new ObjectCompare(obj1, obj2); + Initialise(); + } + + /// + /// Clean up any resources being used. + /// + protected override void + Dispose(bool disposing) + { + if (disposing) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + protected void + InitializeComponent() + { + this.m_lvData = new System.Windows.Forms.ListView(); + this.m_lvCol_label = new System.Windows.Forms.ColumnHeader(); + this.m_lvCol_value1 = new System.Windows.Forms.ColumnHeader(); + this.m_lvCol_value2 = new System.Windows.Forms.ColumnHeader(); + this.m_bnOK = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // m_lvData + // + this.m_lvData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_lvData.AutoArrange = false; + this.m_lvData.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvCol_label, + this.m_lvCol_value1, + this.m_lvCol_value2}); + this.m_lvData.Cursor = System.Windows.Forms.Cursors.Default; + this.m_lvData.FullRowSelect = true; + this.m_lvData.GridLines = true; + this.m_lvData.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvData.HideSelection = false; + this.m_lvData.Location = new System.Drawing.Point(12, 16); + this.m_lvData.MultiSelect = false; + this.m_lvData.Name = "m_lvData"; + this.m_lvData.ShowItemToolTips = true; + this.m_lvData.Size = new System.Drawing.Size(553, 471); + this.m_lvData.TabIndex = 1; + this.m_lvData.UseCompatibleStateImageBehavior = false; + this.m_lvData.View = System.Windows.Forms.View.Details; + this.m_lvData.DoubleClick += new System.EventHandler(this.DataItemSelected); + this.m_lvData.Click += new System.EventHandler(this.DataItemSelected); + // + // m_lvCol_label + // + this.m_lvCol_label.Text = "Field"; + this.m_lvCol_label.Width = 150; + // + // m_lvCol_value1 + // + this.m_lvCol_value1.Text = "Value 1"; + this.m_lvCol_value1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.m_lvCol_value1.Width = 200; + // + // m_lvCol_value2 + // + this.m_lvCol_value2.Text = "Value 2"; + this.m_lvCol_value2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.m_lvCol_value2.Width = 200; + // + // m_bnOK + // + this.m_bnOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnOK.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOK.Location = new System.Drawing.Point(247, 500); + this.m_bnOK.Name = "m_bnOK"; + this.m_bnOK.Size = new System.Drawing.Size(75, 23); + this.m_bnOK.TabIndex = 2; + this.m_bnOK.Text = "OK"; + // + // EntityDiff + // + this.AcceptButton = this.m_bnOK; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.CancelButton = this.m_bnOK; + this.ClientSize = new System.Drawing.Size(577, 535); + this.Controls.Add(this.m_bnOK); + this.Controls.Add(this.m_lvData); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(575, 225); + this.Name = "EntityDiff"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Diff Objects"; + this.ResumeLayout(false); + } + + #endregion Windows Form Designer generated code + + /// + /// Get the common hierarchy of the 2 objects + /// and then get the properties at each level + /// + private void + Initialise() + { + ArrayList hierarchy = m_compareObjs.CommonHierarchy; + + foreach (Object typeObj in hierarchy) + { + Type type = typeObj as Type; + Hashtable propsTable = m_compareObjs.GetPropsAtLevel(type); + /// display it + DisplayDiff(type.Name, propsTable); + } + } + + /// + /// Drill down + /// + /// + /// + protected void + DataItemSelected(object sender, System.EventArgs e) + { + Debug.Assert((m_lvData.SelectedItems.Count > 1) == false); + + if (m_lvData.SelectedItems.Count != 0) + { + ListViewItem item = m_lvData.SelectedItems[0]; + if (item.SubItems.Count != 3) + return; + + Object[] objs = new Object[2]; + objs[0] = item.SubItems[1].Tag; + objs[1] = item.SubItems[2].Tag; + if (objs[0] == null || objs[1] == null) + return; + + EntityDiff dbox = new EntityDiff(objs[0], objs[1]); + AcadApp.Application.ShowModalDialog(dbox); + } + } + + /// + /// Display the diff between the properties + /// of the two objects + /// + /// class separator string + /// + /// key --> property name + /// value --> an arraylist of 2 items, each item containing + /// the value of the current property for the respective object + /// + public void + DisplayDiff(string listViewItem, Hashtable propTable) + { + if (propTable == null) + return; + + m_lvData.BeginUpdate(); + + System.Drawing.Font boldFont = new System.Drawing.Font(m_lvData.Font, System.Drawing.FontStyle.Bold); + string text = string.Format("--- {0} ---", listViewItem); + ListViewItem lvItemSeparator = new ListViewItem(text); + /// show class separator + lvItemSeparator.BackColor = Color.LightBlue; + + m_lvData.Items.Add(lvItemSeparator); + + IDictionaryEnumerator iDictEnum = propTable.GetEnumerator(); + + while (iDictEnum.MoveNext()) + { + DictionaryEntry dictEntry = (DictionaryEntry)iDictEnum.Current; + string key = dictEntry.Key as string; + ArrayList arrList = dictEntry.Value as ArrayList; + object obj1 = arrList[0]; + object obj2 = arrList[1]; + + ListViewItem lvItem = new ListViewItem(key); + + ListViewItem.ListViewSubItem lvsItem1 = new ListViewItem.ListViewSubItem(); + lvsItem1.Text = obj1.ToString(); + + ListViewItem.ListViewSubItem lvsItem2 = new ListViewItem.ListViewSubItem(); + lvsItem2.Text = obj2.ToString(); + + lvItem.SubItems.Add(lvsItem1); + lvItem.SubItems.Add(lvsItem2); + + Type type = null; + if (obj1.GetType() == typeof(System.DBNull)) + { + type = obj2.GetType(); + } + else + type = obj1.GetType(); + + /// provide a drill down only on worthwhile data + if (IsDrillDown(type)) + { + lvsItem1.Tag = obj1; + lvsItem2.Tag = obj2; + + /// visual cue to drill down + lvItem.Font = boldFont; + } + + /// this may happen when there is a collection object comparison + if (obj1.GetType() != obj2.GetType()) + { + /// we know this is diff., so highlight it + lvItem.BackColor = Color.Red; + } + else + { + /// regular occurence of unequal objects + if (!obj1.Equals(obj2)) + { + /// we know this is diff., so highlight it + lvItem.BackColor = Color.Red; + } + } + + m_lvData.Items.Add(lvItem); + } + + m_lvData.EndUpdate(); + } + + /// + /// + /// + /// + /// + private Boolean + IsDrillDown(Type type) + { + if (type.IsPrimitive == false && + type.IsEnum == false && + type != typeof(String) && + type != typeof(DBNull)) + { + return true; + } + return false; + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/Forms/EntityDiff.resx b/MgdDbgLibrary/ObjTests/Forms/EntityDiff.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/MgdDbgLibrary/ObjTests/Forms/EntityDiff.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/Forms/ObjectDiff.Designer.cs b/MgdDbgLibrary/ObjTests/Forms/ObjectDiff.Designer.cs new file mode 100644 index 0000000..295ad9d --- /dev/null +++ b/MgdDbgLibrary/ObjTests/Forms/ObjectDiff.Designer.cs @@ -0,0 +1,280 @@ +namespace MgdDbg.ObjTests.Forms +{ + partial class ObjectDiff + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose (bool disposing) + { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent () + { + this.components = new System.ComponentModel.Container(); + this.m_treeView = new System.Windows.Forms.TreeView(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.addAsComparerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addAsCompareeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.m_gpBxDiff = new System.Windows.Forms.GroupBox(); + this.m_compareBx2 = new System.Windows.Forms.ListBox(); + this.m_labelVs = new System.Windows.Forms.Label(); + this.m_compareBx1 = new System.Windows.Forms.ListBox(); + this.m_btmCompare = new System.Windows.Forms.Button(); + this.m_listView = new System.Windows.Forms.ListView(); + this.m_lvCol_label = new System.Windows.Forms.ColumnHeader(); + this.m_lvCol_value1 = new System.Windows.Forms.ColumnHeader(); + this.m_lvCol_value2 = new System.Windows.Forms.ColumnHeader(); + this.m_btnEntChoose = new System.Windows.Forms.Button(); + this.m_labelObjs = new System.Windows.Forms.Label(); + this.m_gpBxSelect = new System.Windows.Forms.GroupBox(); + this.m_labelOr = new System.Windows.Forms.Label(); + this.contextMenuStrip1.SuspendLayout(); + this.m_gpBxDiff.SuspendLayout(); + this.m_gpBxSelect.SuspendLayout(); + this.SuspendLayout(); + // + // m_treeView + // + this.m_treeView.AllowDrop = true; + this.m_treeView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.m_treeView.ContextMenuStrip = this.contextMenuStrip1; + this.m_treeView.Location = new System.Drawing.Point(41, 26); + this.m_treeView.Name = "m_treeView"; + this.m_treeView.Size = new System.Drawing.Size(275, 445); + this.m_treeView.TabIndex = 0; + this.m_treeView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.m_treeView_MouseClick); + this.m_treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.m_treeView_AfterSelect); + this.m_treeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.m_treeView_ItemDrag); + // + // contextMenuStrip1 + // + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addAsComparerToolStripMenuItem, + this.addAsCompareeToolStripMenuItem}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(160, 48); + // + // addAsComparerToolStripMenuItem + // + this.addAsComparerToolStripMenuItem.Name = "addAsComparerToolStripMenuItem"; + this.addAsComparerToolStripMenuItem.Size = new System.Drawing.Size(159, 22); + this.addAsComparerToolStripMenuItem.Text = "Add as Comparer"; + this.addAsComparerToolStripMenuItem.Click += new System.EventHandler(this.addAsComparerToolStripMenuItem_Click); + // + // addAsCompareeToolStripMenuItem + // + this.addAsCompareeToolStripMenuItem.Name = "addAsCompareeToolStripMenuItem"; + this.addAsCompareeToolStripMenuItem.Size = new System.Drawing.Size(159, 22); + this.addAsCompareeToolStripMenuItem.Text = "Add as Comparee"; + this.addAsCompareeToolStripMenuItem.Click += new System.EventHandler(this.addAsCompareeToolStripMenuItem_Click); + // + // m_gpBxDiff + // + this.m_gpBxDiff.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.m_gpBxDiff.Controls.Add(this.m_compareBx2); + this.m_gpBxDiff.Controls.Add(this.m_labelVs); + this.m_gpBxDiff.Controls.Add(this.m_compareBx1); + this.m_gpBxDiff.Location = new System.Drawing.Point(12, 534); + this.m_gpBxDiff.Name = "m_gpBxDiff"; + this.m_gpBxDiff.Size = new System.Drawing.Size(338, 73); + this.m_gpBxDiff.TabIndex = 4; + this.m_gpBxDiff.TabStop = false; + this.m_gpBxDiff.Text = "Diff"; + // + // m_compareBx2 + // + this.m_compareBx2.AllowDrop = true; + this.m_compareBx2.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.m_compareBx2.FormattingEnabled = true; + this.m_compareBx2.ItemHeight = 12; + this.m_compareBx2.Location = new System.Drawing.Point(192, 15); + this.m_compareBx2.Name = "m_compareBx2"; + this.m_compareBx2.Size = new System.Drawing.Size(122, 52); + this.m_compareBx2.TabIndex = 9; + this.m_compareBx2.DragEnter += new System.Windows.Forms.DragEventHandler(this.m_compareBx2_DragEnter); + this.m_compareBx2.DragDrop += new System.Windows.Forms.DragEventHandler(this.m_compareBx2_DragDrop); + // + // m_labelVs + // + this.m_labelVs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.m_labelVs.AutoSize = true; + this.m_labelVs.Location = new System.Drawing.Point(160, 42); + this.m_labelVs.Name = "m_labelVs"; + this.m_labelVs.Size = new System.Drawing.Size(22, 13); + this.m_labelVs.TabIndex = 5; + this.m_labelVs.Text = "Vs."; + // + // m_compareBx1 + // + this.m_compareBx1.AllowDrop = true; + this.m_compareBx1.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.m_compareBx1.FormattingEnabled = true; + this.m_compareBx1.ItemHeight = 12; + this.m_compareBx1.Location = new System.Drawing.Point(39, 15); + this.m_compareBx1.Name = "m_compareBx1"; + this.m_compareBx1.Size = new System.Drawing.Size(115, 52); + this.m_compareBx1.TabIndex = 8; + this.m_compareBx1.DragEnter += new System.Windows.Forms.DragEventHandler(this.m_compareBx1_DragEnter); + this.m_compareBx1.DragDrop += new System.Windows.Forms.DragEventHandler(this.m_compareBx1_DragDrop); + // + // m_btmCompare + // + this.m_btmCompare.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_btmCompare.Location = new System.Drawing.Point(668, 586); + this.m_btmCompare.Name = "m_btmCompare"; + this.m_btmCompare.Size = new System.Drawing.Size(75, 23); + this.m_btmCompare.TabIndex = 5; + this.m_btmCompare.Text = "Compare"; + this.m_btmCompare.UseVisualStyleBackColor = true; + this.m_btmCompare.Click += new System.EventHandler(this.m_btmCompare_Click); + // + // m_listView + // + this.m_listView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_listView.AutoArrange = false; + this.m_listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvCol_label, + this.m_lvCol_value1, + this.m_lvCol_value2}); + this.m_listView.Cursor = System.Windows.Forms.Cursors.Default; + this.m_listView.FullRowSelect = true; + this.m_listView.GridLines = true; + this.m_listView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_listView.HideSelection = false; + this.m_listView.Location = new System.Drawing.Point(379, 12); + this.m_listView.MultiSelect = false; + this.m_listView.Name = "m_listView"; + this.m_listView.ShowItemToolTips = true; + this.m_listView.Size = new System.Drawing.Size(646, 568); + this.m_listView.TabIndex = 6; + this.m_listView.UseCompatibleStateImageBehavior = false; + this.m_listView.View = System.Windows.Forms.View.Details; + this.m_listView.Click += new System.EventHandler(this.DataItemSelected); + // + // m_lvCol_label + // + this.m_lvCol_label.Text = "Field"; + this.m_lvCol_label.Width = 148; + // + // m_lvCol_value1 + // + this.m_lvCol_value1.Text = "Value 1"; + this.m_lvCol_value1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.m_lvCol_value1.Width = 253; + // + // m_lvCol_value2 + // + this.m_lvCol_value2.Text = "Value 2"; + this.m_lvCol_value2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.m_lvCol_value2.Width = 273; + // + // m_btnEntChoose + // + this.m_btnEntChoose.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_btnEntChoose.Location = new System.Drawing.Point(63, 491); + this.m_btnEntChoose.Name = "m_btnEntChoose"; + this.m_btnEntChoose.Size = new System.Drawing.Size(229, 23); + this.m_btnEntChoose.TabIndex = 7; + this.m_btnEntChoose.Text = "Entities..."; + this.m_btnEntChoose.UseVisualStyleBackColor = true; + this.m_btnEntChoose.Click += new System.EventHandler(this.m_btnEntChoose_Click); + // + // m_labelObjs + // + this.m_labelObjs.AutoSize = true; + this.m_labelObjs.Location = new System.Drawing.Point(104, 10); + this.m_labelObjs.Name = "m_labelObjs"; + this.m_labelObjs.Size = new System.Drawing.Size(46, 13); + this.m_labelObjs.TabIndex = 8; + this.m_labelObjs.Text = "Objects:"; + // + // m_gpBxSelect + // + this.m_gpBxSelect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.m_gpBxSelect.Controls.Add(this.m_labelOr); + this.m_gpBxSelect.Controls.Add(this.m_treeView); + this.m_gpBxSelect.Controls.Add(this.m_btnEntChoose); + this.m_gpBxSelect.Controls.Add(this.m_labelObjs); + this.m_gpBxSelect.Location = new System.Drawing.Point(10, 3); + this.m_gpBxSelect.Name = "m_gpBxSelect"; + this.m_gpBxSelect.Size = new System.Drawing.Size(340, 525); + this.m_gpBxSelect.TabIndex = 10; + this.m_gpBxSelect.TabStop = false; + this.m_gpBxSelect.Text = "Select"; + // + // m_labelOr + // + this.m_labelOr.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.m_labelOr.AutoSize = true; + this.m_labelOr.Location = new System.Drawing.Point(162, 475); + this.m_labelOr.Name = "m_labelOr"; + this.m_labelOr.Size = new System.Drawing.Size(18, 13); + this.m_labelOr.TabIndex = 10; + this.m_labelOr.Text = "Or"; + // + // ObjectDiff + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1060, 619); + this.Controls.Add(this.m_gpBxSelect); + this.Controls.Add(this.m_listView); + this.Controls.Add(this.m_gpBxDiff); + this.Controls.Add(this.m_btmCompare); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(575, 225); + this.Name = "ObjectDiff"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "ObjectDiff"; + this.contextMenuStrip1.ResumeLayout(false); + this.m_gpBxDiff.ResumeLayout(false); + this.m_gpBxDiff.PerformLayout(); + this.m_gpBxSelect.ResumeLayout(false); + this.m_gpBxSelect.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TreeView m_treeView; + private System.Windows.Forms.GroupBox m_gpBxDiff; + private System.Windows.Forms.Label m_labelVs; + private System.Windows.Forms.Button m_btmCompare; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; + private System.Windows.Forms.ToolStripMenuItem addAsComparerToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addAsCompareeToolStripMenuItem; + protected System.Windows.Forms.ListView m_listView; + protected System.Windows.Forms.ColumnHeader m_lvCol_label; + protected System.Windows.Forms.ColumnHeader m_lvCol_value1; + protected System.Windows.Forms.ColumnHeader m_lvCol_value2; + private System.Windows.Forms.Button m_btnEntChoose; + private System.Windows.Forms.ListBox m_compareBx1; + private System.Windows.Forms.ListBox m_compareBx2; + private System.Windows.Forms.Label m_labelObjs; + private System.Windows.Forms.GroupBox m_gpBxSelect; + private System.Windows.Forms.Label m_labelOr; + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/Forms/ObjectDiff.cs b/MgdDbgLibrary/ObjTests/Forms/ObjectDiff.cs new file mode 100644 index 0000000..b8aa963 --- /dev/null +++ b/MgdDbgLibrary/ObjTests/Forms/ObjectDiff.cs @@ -0,0 +1,502 @@ +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using MgdDbg.CompBuilder; +using MgdDbg.Utils; +using System; +using System.Collections; +using System.Diagnostics; +using System.Drawing; +using System.Windows.Forms; +using AcadApp = Autodesk.AutoCAD.ApplicationServices; + +namespace MgdDbg.ObjTests.Forms +{ + public partial class ObjectDiff : Form + { + private Database m_db = null; + private TransactionHelper m_trHlpr = null; + private Object m_tmpObj = null; + private Object m_obj1 = null; + private Object m_obj2 = null; + private ObjectCompare m_compareObjs; + + public ObjectDiff(TransactionHelper trHlpr) + { + InitializeComponent(); + + m_db = MgdDbg.Utils.Db.GetCurDwg(); + m_trHlpr = trHlpr; + + InitializeTreeView(); + } + + /// + /// Initialise tree with all symbol tables and NOD + /// + private void InitializeTreeView() + { + m_treeView.BeginUpdate(); + + AddSymbolTableToTree("Block Table", m_db.BlockTableId); + AddSymbolTableToTree("Dimension Style Table", m_db.DimStyleTableId); + AddSymbolTableToTree("Layer Table", m_db.LayerTableId); + AddSymbolTableToTree("Linetype Table", m_db.LinetypeTableId); + AddSymbolTableToTree("Reg App Table", m_db.RegAppTableId); + AddSymbolTableToTree("Text Style Table", m_db.TextStyleTableId); + AddSymbolTableToTree("View Table", m_db.ViewTableId); + AddSymbolTableToTree("Viewport Table", m_db.ViewportTableId); + AddSymbolTableToTree("UCS Table", m_db.UcsTableId); + + TreeNode rootNode = new TreeNode("Named Objects Dictionary"); + rootNode.Tag = m_db.NamedObjectsDictionaryId; + m_treeView.Nodes.Add(rootNode); + AddDictionaryToTree(m_db.NamedObjectsDictionaryId, rootNode, m_trHlpr.Transaction); + + m_treeView.Sorted = true; + + m_treeView.EndUpdate(); + } + + /// + /// Add a single Symbol Table to the tree and iterate over all its SymbolTableRecords, + /// adding each one of them as a sub-node + /// + /// Name of the table + /// ObjectId of the table + + private void + AddSymbolTableToTree(string tblName, ObjectId tblId) + { + DBObject tmpObj = m_trHlpr.Transaction.GetObject(tblId, OpenMode.ForRead); + SymbolTable tbl = tmpObj as SymbolTable; + if (tbl != null) + { + TreeNode mainTblNode = new TreeNode(tblName); + mainTblNode.Tag = tblId; + m_treeView.Nodes.Add(mainTblNode); + + // iterate over each TblRec in the SymbolTable + foreach (ObjectId tblRecId in tbl) + { + TreeNode recNode = new TreeNode(m_trHlpr.SymbolIdToName(tblRecId)); + recNode.Tag = tblRecId; + mainTblNode.Nodes.Add(recNode); + } + } + } + + private void + AddDictionaryToTree(ObjectId dictId, TreeNode parentNode, Transaction tr) + { + // NOTE: when recursively processing items in a dictionary + // we may encounter things that are not derived from DBDictionary. + // In that case, the cast to type DBDictionary will fail and + // we'll just return without adding any nested items. + DBObject tmpObj = tr.GetObject(dictId, OpenMode.ForRead); + DBDictionary dbDict = tmpObj as DBDictionary; + if (dbDict != null) + { + foreach (DictionaryEntry curEntry in dbDict) + { + TreeNode newNode = new TreeNode((string)curEntry.Key); + newNode.Tag = curEntry.Value; + parentNode.Nodes.Add(newNode); + + // if this is a dictionary, it will recursively add + // all of its children to the tree + AddDictionaryToTree((ObjectId)curEntry.Value, newNode, tr); + } + } + } + + /// + /// + /// + /// + /// + private void + m_treeView_AfterSelect(object sender, TreeViewEventArgs e) + { + if (e.Node.Tag != null) + { + m_tmpObj = m_trHlpr.Transaction.GetObject((ObjectId)e.Node.Tag, OpenMode.ForRead); + } + } + + /// + /// + /// + /// + /// + private void + addAsComparerToolStripMenuItem_Click(object sender, EventArgs e) + { + m_obj1 = m_tmpObj; + PopulateCompareBox(m_compareBx1, (ObjectId)m_treeView.SelectedNode.Tag, m_treeView.SelectedNode.Text); + } + + /// + /// + /// + /// + /// + private void + addAsCompareeToolStripMenuItem_Click(object sender, EventArgs e) + { + m_obj2 = m_tmpObj; + PopulateCompareBox(m_compareBx2, (ObjectId)m_treeView.SelectedNode.Tag, m_treeView.SelectedNode.Text); + } + + /// + /// + /// + /// + /// + private void + m_btmCompare_Click(object sender, EventArgs e) + { + if (m_obj1 == null || m_obj2 == null) + { + MessageBox.Show("Please choose two objects to compare"); + return; + } + Compare(); + } + + /// + /// + /// + private void + Compare() + { + m_compareObjs = new ObjectCompare(m_obj1, m_obj2); + PopulateListView(); + } + + /// + /// Get the common hierarchy of the 2 objects + /// and then get the properties at each level + /// + private void + PopulateListView() + { + m_listView.Items.Clear(); + + ArrayList hierarchy = m_compareObjs.CommonHierarchy; + + foreach (Object typeObj in hierarchy) + { + Type type = typeObj as Type; + Hashtable propsTable = m_compareObjs.GetPropsAtLevel(type); + /// display it + DisplayDiff(type.Name, propsTable); + } + } + + /// + /// Drill down + /// + /// + /// + protected void + DataItemSelected(object sender, System.EventArgs e) + { + Debug.Assert((m_listView.SelectedItems.Count > 1) == false); + + if (m_listView.SelectedItems.Count != 0) + { + ListViewItem item = m_listView.SelectedItems[0]; + if (item.SubItems.Count != 3) + return; + + Object[] objs = new Object[2]; + objs[0] = item.SubItems[1].Tag; + objs[1] = item.SubItems[2].Tag; + if (objs[0] == null || objs[1] == null) + return; + + EntityDiff dbox = new EntityDiff(objs[0], objs[1]); + AcadApp.Application.ShowModalDialog(dbox); + } + } + + /// + /// Display the diff between the properties + /// of the two objects + /// + /// class separator string + /// + /// key --> property name + /// value --> an arraylist of 2 items, each item containing + /// the value of the current property for the respective object + /// + public void + DisplayDiff(string listViewItem, Hashtable propTable) + { + if (propTable == null) + return; + + m_listView.BeginUpdate(); + + System.Drawing.Font boldFont = new System.Drawing.Font(m_listView.Font, System.Drawing.FontStyle.Bold); + string text = string.Format("--- {0} ---", listViewItem); + ListViewItem lvItemSeparator = new ListViewItem(text); + /// show class separator + lvItemSeparator.BackColor = Color.LightBlue; + + m_listView.Items.Add(lvItemSeparator); + + IDictionaryEnumerator iDictEnum = propTable.GetEnumerator(); + + while (iDictEnum.MoveNext()) + { + DictionaryEntry dictEntry = (DictionaryEntry)iDictEnum.Current; + string key = dictEntry.Key as string; + ArrayList arrList = dictEntry.Value as ArrayList; + object obj1 = arrList[0]; + object obj2 = arrList[1]; + + ListViewItem lvItem = new ListViewItem(key); + + ListViewItem.ListViewSubItem lvsItem1 = new ListViewItem.ListViewSubItem(); + lvsItem1.Text = obj1.ToString(); + + ListViewItem.ListViewSubItem lvsItem2 = new ListViewItem.ListViewSubItem(); + lvsItem2.Text = obj2.ToString(); + + lvItem.SubItems.Add(lvsItem1); + lvItem.SubItems.Add(lvsItem2); + + Type type = null; + if (obj1.GetType() == typeof(System.DBNull)) + { + type = obj2.GetType(); + } + else + type = obj1.GetType(); + + /// provide a drill down only on worthwhile data + if (IsDrillDown(type)) + { + lvsItem1.Tag = obj1; + lvsItem2.Tag = obj2; + + /// visual cue to drill down + lvItem.Font = boldFont; + } + + /// this may happen when there is a collection object comparison + if (obj1.GetType() != obj2.GetType()) + { + /// we know this is diff., so highlight it + lvItem.BackColor = Color.Red; + } + else + { + /// regular occurence of unequal objects + if (!obj1.Equals(obj2)) + { + /// we know this is diff., so highlight it + lvItem.BackColor = Color.Red; + } + } + + m_listView.Items.Add(lvItem); + } + + m_listView.EndUpdate(); + } + + /// + /// + /// + /// + /// + private Boolean + IsDrillDown(Type type) + { + if (type.IsPrimitive == false && + type.IsEnum == false && + type != typeof(String) && + type != typeof(DBNull)) + { + return true; + } + return false; + } + + /// + /// + /// + /// + /// + private void + m_btnEntChoose_Click(object sender, EventArgs e) + { + Editor ed = AcadApp.Application.DocumentManager.MdiActiveDocument.Editor; + + EditorUserInteraction userInteraction = ed.StartUserInteraction(this); + + try + { + PromptEntityResult res = ed.GetEntity("\nSelect first entity"); + if (res.Status != PromptStatus.OK) + return; + ObjectId objId1 = res.ObjectId; + + res = ed.GetEntity("\nSelect second entity"); + if (res.Status != PromptStatus.OK) + return; + ObjectId objId2 = res.ObjectId; + + m_obj1 = m_trHlpr.Transaction.GetObject(objId1, OpenMode.ForRead); + m_obj2 = m_trHlpr.Transaction.GetObject(objId2, OpenMode.ForRead); + + PopulateCompareBox(m_compareBx1, objId1, string.Empty); + PopulateCompareBox(m_compareBx2, objId2, string.Empty); + + Compare(); + } + /// dont leave editor paralysed if user cancels out + finally + { + userInteraction.End(); + } + } + + /// + /// + /// + /// + /// + private void + m_treeView_ItemDrag(object sender, ItemDragEventArgs e) + { + DoDragDrop(e.Item, DragDropEffects.Move); + } + + /// + /// + /// + /// + /// + private void + m_compareBx1_DragEnter(object sender, DragEventArgs e) + { + e.Effect = DragDropEffects.Move; + } + + /// + /// + /// + /// + /// + private void + m_compareBx1_DragDrop(object sender, DragEventArgs e) + { + TreeNode treeNode = e.Data.GetData(typeof(TreeNode)) as TreeNode; + if (treeNode != null) + { + m_obj1 = m_trHlpr.Transaction.GetObject((ObjectId)treeNode.Tag, OpenMode.ForRead); + PopulateCompareBox(m_compareBx1, (ObjectId)treeNode.Tag, treeNode.Text); + } + } + + /// + /// + /// + /// + /// + private void + m_compareBx2_DragEnter(object sender, DragEventArgs e) + { + e.Effect = DragDropEffects.Move; + } + + /// + /// + /// + /// + /// + private void + m_compareBx2_DragDrop(object sender, DragEventArgs e) + { + TreeNode treeNode = e.Data.GetData(typeof(TreeNode)) as TreeNode; + if (treeNode != null) + { + m_obj2 = m_trHlpr.Transaction.GetObject((ObjectId)treeNode.Tag, OpenMode.ForRead); + PopulateCompareBox(m_compareBx2, (ObjectId)treeNode.Tag, treeNode.Text); + } + } + + /// + /// + /// + /// + /// + private void + m_treeView_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + TreeNode treeNode = m_treeView.GetNodeAt(e.Location); + if (treeNode.Tag != null) + { + m_treeView.SelectedNode = treeNode; + } + } + } + + /// + /// + /// + /// + /// + /// + private void + PopulateCompareBox(object compareBox, ObjectId objId, string name) + { + DBObject tempObj = m_trHlpr.Transaction.GetObject(objId, OpenMode.ForRead); + + String type = String.Format("Type : {0}", tempObj.GetType().Name); + String id = String.Format("ObjectId : {0}", objId.ToString()); + + if (compareBox == m_compareBx1) + { + m_compareBx1.Items.Clear(); + m_compareBx1.Items.Add(name); + m_compareBx1.Items.Add(type); + m_compareBx1.Items.Add(id); + } + + if (compareBox == m_compareBx2) + { + m_compareBx2.Items.Clear(); + m_compareBx2.Items.Add(name); + m_compareBx2.Items.Add(type); + m_compareBx2.Items.Add(id); + } + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/Forms/ObjectDiff.resx b/MgdDbgLibrary/ObjTests/Forms/ObjectDiff.resx new file mode 100644 index 0000000..6fab886 --- /dev/null +++ b/MgdDbgLibrary/ObjTests/Forms/ObjectDiff.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/Forms/Objects.Designer.cs b/MgdDbgLibrary/ObjTests/Forms/Objects.Designer.cs new file mode 100644 index 0000000..1dcbaa7 --- /dev/null +++ b/MgdDbgLibrary/ObjTests/Forms/Objects.Designer.cs @@ -0,0 +1,79 @@ +namespace MgdDbg.ObjTests.Forms +{ + partial class Objects + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose (bool disposing) + { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent () + { + this.m_treeView = new System.Windows.Forms.TreeView(); + this.m_btnOk = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // m_treeView + // + this.m_treeView.AllowDrop = true; + this.m_treeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_treeView.Location = new System.Drawing.Point(9, 12); + this.m_treeView.Name = "m_treeView"; + this.m_treeView.Size = new System.Drawing.Size(256, 323); + this.m_treeView.TabIndex = 1; + this.m_treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.m_treeView_AfterSelect); + // + // m_btnOk + // + this.m_btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_btnOk.Location = new System.Drawing.Point(101, 361); + this.m_btnOk.Name = "m_btnOk"; + this.m_btnOk.Size = new System.Drawing.Size(56, 23); + this.m_btnOk.TabIndex = 6; + this.m_btnOk.Text = "OK"; + this.m_btnOk.UseVisualStyleBackColor = true; + // + // Objects + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(273, 408); + this.Controls.Add(this.m_btnOk); + this.Controls.Add(this.m_treeView); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Objects"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Objects"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TreeView m_treeView; + private System.Windows.Forms.Button m_btnOk; + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/Forms/Objects.cs b/MgdDbgLibrary/ObjTests/Forms/Objects.cs new file mode 100644 index 0000000..b72b7a2 --- /dev/null +++ b/MgdDbgLibrary/ObjTests/Forms/Objects.cs @@ -0,0 +1,162 @@ +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using MgdDbg.CompBuilder; +using System.Collections; +using System.Windows.Forms; + +namespace MgdDbg.ObjTests.Forms +{ + /// + /// + /// + public partial class Objects : Form + { + private Database m_db = null; + private TransactionHelper m_trHlpr = null; + private ObjectId m_objectId = ObjectId.Null; + + /// + /// + /// + public ObjectId + ObjectId + { + get + { + return m_objectId; + } + } + + /// + /// + /// + /// + public Objects(TransactionHelper trHlpr) + { + InitializeComponent(); + + m_db = MgdDbg.Utils.Db.GetCurDwg(); + m_trHlpr = trHlpr; + + InitializeTreeView(); + } + + /// + /// Initialise tree with all symbol tables and NOD + /// + private void InitializeTreeView() + { + m_treeView.BeginUpdate(); + + //AddSymbolTableToTree("Block Table", m_db.BlockTableId); + //AddSymbolTableToTree("Dimension Style Table", m_db.DimStyleTableId); + //AddSymbolTableToTree("Layer Table", m_db.LayerTableId); + //AddSymbolTableToTree("Linetype Table", m_db.LinetypeTableId); + //AddSymbolTableToTree("Reg App Table", m_db.RegAppTableId); + //AddSymbolTableToTree("Text Style Table", m_db.TextStyleTableId); + //AddSymbolTableToTree("View Table", m_db.ViewTableId); + //AddSymbolTableToTree("Viewport Table", m_db.ViewportTableId); + //AddSymbolTableToTree("UCS Table", m_db.UcsTableId); + + TreeNode rootNode = new TreeNode("Named Objects Dictionary"); + rootNode.Tag = m_db.NamedObjectsDictionaryId; + m_treeView.Nodes.Add(rootNode); + AddDictionaryToTree(m_db.NamedObjectsDictionaryId, rootNode, m_trHlpr.Transaction); + + m_treeView.Sorted = true; + + m_treeView.EndUpdate(); + } + + /// + /// Add a single Symbol Table to the tree and iterate over all its SymbolTableRecords, + /// adding each one of them as a sub-node + /// + /// Name of the table + /// ObjectId of the table + + private void + AddSymbolTableToTree(string tblName, ObjectId tblId) + { + DBObject tmpObj = m_trHlpr.Transaction.GetObject(tblId, OpenMode.ForRead); + SymbolTable tbl = tmpObj as SymbolTable; + if (tbl != null) + { + TreeNode mainTblNode = new TreeNode(tblName); + mainTblNode.Tag = tblId; + m_treeView.Nodes.Add(mainTblNode); + + // iterate over each TblRec in the SymbolTable + foreach (ObjectId tblRecId in tbl) + { + TreeNode recNode = new TreeNode(m_trHlpr.SymbolIdToName(tblRecId)); + recNode.Tag = tblRecId; + mainTblNode.Nodes.Add(recNode); + } + } + } + + /// + /// + /// + /// + /// + /// + private void + AddDictionaryToTree(ObjectId dictId, TreeNode parentNode, Transaction tr) + { + // NOTE: when recursively processing items in a dictionary + // we may encounter things that are not derived from DBDictionary. + // In that case, the cast to type DBDictionary will fail and + // we'll just return without adding any nested items. + DBObject tmpObj = tr.GetObject(dictId, OpenMode.ForRead); + DBDictionary dbDict = tmpObj as DBDictionary; + if (dbDict != null) + { + foreach (DictionaryEntry curEntry in dbDict) + { + TreeNode newNode = new TreeNode((string)curEntry.Key); + newNode.Tag = curEntry.Value; + parentNode.Nodes.Add(newNode); + + // if this is a dictionary, it will recursively add + // all of its children to the tree + AddDictionaryToTree((ObjectId)curEntry.Value, newNode, tr); + } + } + } + + /// + /// + /// + /// + /// + private void m_treeView_AfterSelect(object sender, TreeViewEventArgs e) + { + if (e.Node.Tag != null) + { + m_objectId = (ObjectId)e.Node.Tag; + } + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/Forms/Objects.resx b/MgdDbgLibrary/ObjTests/Forms/Objects.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/MgdDbgLibrary/ObjTests/Forms/Objects.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/MakeEntTests.cs b/MgdDbgLibrary/ObjTests/MakeEntTests.cs new file mode 100644 index 0000000..0cf6dcd --- /dev/null +++ b/MgdDbgLibrary/ObjTests/MakeEntTests.cs @@ -0,0 +1,934 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.Colors; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Geometry; +using MgdDbg.CompBuilder; +using MgdDbg.ObjTests.TestFramework; +using System; + +namespace MgdDbg.ObjTests +{ + /// + /// The entmake functions in this module are designed to show how to create + /// entities based on user input. Therefore, things like the current UCS are + /// of concern because points input by the user are in UCS, but points in the + /// database must be in WCS. The general strategy is: + /// + /// 1) acquire points from the user in UCS without translating them to WCS. + /// 2) do not set the Normal for any entity explicitly. Instead, let it + /// default to (0, 0, 1). + /// 3) transform the entity from the UCS to WCS to get the correct points, + /// normals, and angles that the database will expect. + /// + /// This method allows you to "pretend" that everything is in WCS and you don't + /// have to bother with trasforming individual points and reverse engineering + /// any angles input by the user. + /// + /// Also, I try to demonstrate several different "styles" of handling errors and + /// exceptions. I'm still experimenting with things myself, so bear with me a bit + /// until I can come to grips with the best practices. (jma - 04/28/04) + /// + + public class MakeEntTests : MgdDbgTestFuncs + { + private Database m_db = null; + + public + MakeEntTests() + { + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Line", "Hardwired line from (0,0) to (50, 50)", typeof(Line), new MgdDbgTestFuncInfo.TestFunc(LineHardwired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Circle (WCS-only)", "Hardwired circle [Center=(10,10) Radius=(6)]. Will not be relative to currnt UCS.", typeof(Circle), new MgdDbgTestFuncInfo.TestFunc(CircleHardwiredWcsOnly), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Circle", "Hardwired circle [Center=(10,10) Radius=(6)]", typeof(Circle), new MgdDbgTestFuncInfo.TestFunc(CircleHardwired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Solid", "Hardwired solid [Triangle with thickness]", typeof(Solid), new MgdDbgTestFuncInfo.TestFunc(SolidHardwired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Arc", "Hardwired arc [Center=(12,12) Radius=(6)]", typeof(Arc), new MgdDbgTestFuncInfo.TestFunc(ArcHardwired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Polyline (light weight)", "Hardwired Polyline [Rectangle=(15 x 8)]", typeof(Polyline), new MgdDbgTestFuncInfo.TestFunc(PolylineHardwired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Polyline 2d", "Hardwired Polyline 2d [Rectangle=(15 x 8)]", typeof(Polyline2d), new MgdDbgTestFuncInfo.TestFunc(Polyline2dHardwired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Polyline 3d", "Hardwired Polyline 3d [Rectangle=(15 x 8)]", typeof(Polyline3d), new MgdDbgTestFuncInfo.TestFunc(Polyline3dHardwired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Polyline (width & bulge)", "Hardwired Polyline [Rectangle=(15 x 8), Width=1, Filleted]", typeof(Polyline), new MgdDbgTestFuncInfo.TestFunc(PolylineWidthFillet), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Hatch", "Hardwired triangle with fill", typeof(Hatch), new MgdDbgTestFuncInfo.TestFunc(HatchHardwired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Assoc Hatch", "Hardwired triangle with void, and boundaries are associative", typeof(Hatch), new MgdDbgTestFuncInfo.TestFunc(HatchAssoc), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("3D Face", "Hardwired 3D Face", typeof(Face), new MgdDbgTestFuncInfo.TestFunc(FaceHardwired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Point", "User picked point", typeof(DBPoint), new MgdDbgTestFuncInfo.TestFunc(Point), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Aligned Dimension", "Aligned dim based on two points", typeof(Dimension), new MgdDbgTestFuncInfo.TestFunc(DimAligned), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Comp Builder (Current Space)", "Test of the CompBldr object", typeof(Entity), new MgdDbgTestFuncInfo.TestFunc(CompBldrCurSpace), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Lineweight test", "Test of each lineweight", typeof(Line), new MgdDbgTestFuncInfo.TestFunc(Lineweights), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Ray", "Hardwired Ray [From=(0,0) To=(50,50)]", typeof(Ray), new MgdDbgTestFuncInfo.TestFunc(RayHardWired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Leader", "Hardwired Leader [From=(0,0) Through=(50,50) To=(100,50)]", typeof(Leader), new MgdDbgTestFuncInfo.TestFunc(LeaderHardWired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Ellipse", "Hardwired Ellipse [Center=(50,50)]", typeof(Ellipse), new MgdDbgTestFuncInfo.TestFunc(EllipseHardWired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Spline", "Hardwired Spline", typeof(Spline), new MgdDbgTestFuncInfo.TestFunc(SplineHardWired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Helix", "Hardwired Helix", typeof(Helix), new MgdDbgTestFuncInfo.TestFunc(HelixHardWired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Xline", "Hardwired Xline", typeof(Xline), new MgdDbgTestFuncInfo.TestFunc(XlineHardWired), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Simple Table", "Hardwired Table", typeof(Table), new MgdDbgTestFuncInfo.TestFunc(TableHardWired), MgdDbgTestFuncInfo.TestType.Create)); + } + + #region Tests + + public void + LineHardwired() + { + // This shows the style that C++ programmers are used to. In this + // simple case, it is probably OK because it is very unlikely that + // any exceptions will be thrown between the time the Line object + // is instantiated and the time it gets (safely) added to the database + // by AddToCurrentSpaceAndClose(). Technically, an exception could be + // thrown in a function like TransformToWcs(). Would that be bad? + // When an exception is thrown we want to cleanly return to the command + // line and leave the database/system in the same state it was before + // we started. In this case, we wouldn't leave any messes behind because + // we only have a single entity that never got added. + // So, for this simple case, the only drawback is that we left the new + // Line entity around for garbage collection to deal with. This isn't + // so bad in a pure .NET environment, but we need to remember that the Line + // object is really a managed wrapper that points to an unmanaged resource + // in C++. So, having alot of these guys around will trick the garbage + // collector into thinking there isn't as much pressure to clean up + // as there really is. Therefore, for anything but super-trivial cases, + // it is advised to use one of the techniques demonstrated below + // (a using statement, transactions, Component builders, etc.) + m_db = Utils.Db.GetCurDwg(); + + Line line = new Line(); + line.StartPoint = new Point3d(0.0, 0.0, 0.0); + line.EndPoint = new Point3d(50.0, 50.0, 0.0); + line.ColorIndex = 1; + + Utils.Db.TransformToWcs(line, m_db); + Utils.SymTbl.AddToCurrentSpaceAndClose(line, m_db); + } + + public void + CircleHardwired() + { + // To be exception safe, we need to keep things in a + // try/catch/finally block. Any error that happens + // within the try block will be caught and we will + // clean up our new Circle. However, it is painful + // to write all this housekeeping code each time we + // want to use an object. The other methods of creating + // objects makes the process a bit less tedious. + + m_db = Utils.Db.GetCurDwg(); + + Circle circ = null; + try + { + circ = new Circle(); + circ.ColorIndex = 4; + circ.Center = new Point3d(10.0, 10.0, 0.0); + circ.Radius = 6.0; + + Utils.Db.TransformToWcs(circ, m_db); + Utils.SymTbl.AddToCurrentSpaceAndClose(circ, m_db); + } + catch (System.Exception e) + { + // maybe we want to do something here, maybe not? + throw e; + } + finally + { + if (circ != null) + circ.Dispose(); + } + } + + public void + SolidHardwired() + { + // To be exception safe, we need to keep things in a + // try/catch/finally block. Any error that happens + // within the try block will be caught and we will + // clean up our new Circle. However, it is painful + // to write all this housekeeping code each time we + // want to use an object. The other methods of creating + // objects makes the process a bit less tedious. + + m_db = Utils.Db.GetCurDwg(); + + Solid solid = null; + try + { + solid = new Solid(); + solid.ColorIndex = 4; + solid.SetPointAt(0, new Point3d(0.0, 0.0, 0.0)); + solid.SetPointAt(1, new Point3d(0.0, 100.0, 0.0)); + solid.SetPointAt(2, new Point3d(100.0, 0.0, 0.0)); + solid.SetPointAt(3, new Point3d(0.0, 0.0, 0.0)); + solid.Thickness = 20.0; + + Utils.Db.TransformToWcs(solid, m_db); + Utils.SymTbl.AddToCurrentSpaceAndClose(solid, m_db); + } + catch (System.Exception e) + { + // maybe we want to do something here, maybe not? + throw e; + } + finally + { + if (solid != null) + solid.Dispose(); + } + } + + public void + CircleHardwiredWcsOnly() + { + m_db = Utils.Db.GetCurDwg(); + + // The using statement is equivalent to the try/catch/finally + // block in the above example. The finally clause will call + // Dispose() on the Circle and release the underlying unmanaged + // C++ object (AcDbCircle). + using (Circle circ = new Circle()) + { + circ.ColorIndex = 3; + circ.Center = new Point3d(10.0, 10.0, 0.0); + circ.Radius = 6.0; + + // NOTE: we are specifically not transforming from UCS, so everything + // is expressed directly in WCS space. This is to demonstrate what + // happens if you don't do it the way we are doing all the others. + + //Utils.Db.TransformToWcs(circ, m_db); // without this call, it won't be relative to the current UCS + + Utils.SymTbl.AddToCurrentSpaceAndClose(circ, m_db); + } + } + + public void + ArcHardwired() + { + m_db = Utils.Db.GetCurDwg(); + + using (Arc arc = new Arc()) + { + arc.ColorIndex = 4; + arc.Center = new Point3d(12.0, 12.0, 0.0); + arc.Radius = 6.0; + arc.StartAngle = Utils.Ge.DegreesToRadians(30.0); + arc.EndAngle = Utils.Ge.kRad90; + + Utils.Db.TransformToWcs(arc, m_db); + Utils.SymTbl.AddToCurrentSpaceAndClose(arc, m_db); + } + } + + public void + PolylineHardwired() + { + m_db = Utils.Db.GetCurDwg(); + + using (Polyline pline = new Polyline()) + { + pline.Color = Color.FromRgb(42, 184, 185); + + Point2d[] pts = new Point2d[4]; + pts[0] = new Point2d(0.0, 0.0); + pts[1] = new Point2d(15.0, 0.0); + pts[2] = new Point2d(15.0, 8.0); + pts[3] = new Point2d(0.0, 8.0); + + for (int i = 0; i < pts.Length; i++) + pline.AddVertexAt(i, pts[i], 0.0, 0.0, 0.0); + + pline.Closed = true; + + Utils.Db.TransformToWcs(pline, m_db); + Utils.SymTbl.AddToCurrentSpaceAndClose(pline, m_db); + } + } + + public void + PolylineWidthFillet() + { + m_db = Utils.Db.GetCurDwg(); + + // set up the input parameters for width/depth/filletRad + double xLen = 15.0; + double yLen = 8.0; + double filletDist = 2.0; + Point2d tmpPt = new Point2d(5.0, 5.0); // "origin" + + // we'll make a filleted Rectangle + Point2d[] pts = new Point2d[8]; + double[] bulges = new double[8]; + + // start at bottom left (after fillet) + tmpPt = new Point2d(tmpPt.X + filletDist, tmpPt.Y); + pts[0] = tmpPt; + + // bottom right (going into fillet) + tmpPt = new Point2d(tmpPt.X + (xLen - filletDist), tmpPt.Y); + pts[1] = tmpPt; + + // bottom right (after fillet) + tmpPt = new Point2d(tmpPt.X + filletDist, tmpPt.Y + filletDist); + pts[2] = tmpPt; + + // top right (going into fillet) + tmpPt = new Point2d(tmpPt.X, tmpPt.Y + (yLen - filletDist)); + pts[3] = tmpPt; + + // top right (after fillet) + tmpPt = new Point2d(tmpPt.X - filletDist, tmpPt.Y + filletDist); + pts[4] = tmpPt; + + // top left (going into fillet) + tmpPt = new Point2d(tmpPt.X - (xLen - filletDist), tmpPt.Y); + pts[5] = tmpPt; + + // top left (after fillet) + tmpPt = new Point2d(tmpPt.X - filletDist, tmpPt.Y - filletDist); + pts[6] = tmpPt; + + // bottom left (going into fillet) + tmpPt = new Point2d(tmpPt.X, tmpPt.Y - (yLen - filletDist)); + pts[7] = tmpPt; + + double bulge = Math.Tan(Utils.Ge.kRad90 / 4.0); // the bulge factor is tangent of a 4th of the included angle, here 90 degrees. + bulges[0] = bulges[2] = bulges[4] = bulges[6] = 0.0; + bulges[1] = bulges[3] = bulges[5] = bulges[7] = bulge; + + // now make the polyline entity + using (Polyline pline = new Polyline()) + { + pline.ColorIndex = 4; + for (int i = 0; i < pts.Length; i++) + pline.AddVertexAt(i, pts[i], bulges[i], 0.0, 0.0); + + pline.ConstantWidth = 1.0; + pline.Closed = true; + + Utils.Db.TransformToWcs(pline, m_db); + Utils.SymTbl.AddToCurrentSpaceAndClose(pline, m_db); + } + } + + public void + HatchHardwired() + { + m_db = Utils.Db.GetCurDwg(); + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + // make boundary triangle + Polyline pline = new Polyline(); + pline.ColorIndex = 1; + pline.AddVertexAt(0, new Point2d(0.0, 0.0), 0.0, 0.0, 0.0); + pline.AddVertexAt(0, new Point2d(30.0, 0.0), 0.0, 0.0, 0.0); + pline.AddVertexAt(0, new Point2d(15.0, 30.0), 0.0, 0.0, 0.0); + pline.Closed = true; + + Utils.Db.TransformToWcs(pline, m_db); + Utils.SymTbl.AddToCurrentSpace(pline, m_db, tr); + + ObjectIdCollection boundaryIds = new ObjectIdCollection(); + boundaryIds.Add(pline.ObjectId); + + Hatch hatch = new Hatch(); + hatch.ColorIndex = 4; + + Utils.Db.TransformToWcs(hatch, m_db); // NOTE: need to transform to correct plane *BEFORE* setting pattern and boundary info + + hatch.PatternAngle = Utils.Ge.kRad45; + hatch.PatternScale = 4.0; + hatch.SetHatchPattern(HatchPatternType.PreDefined, "ESCHER"); + + hatch.Associative = false; // not in this sample + + hatch.AppendLoop(HatchLoopTypes.Default, boundaryIds); + hatch.EvaluateHatch(false); + + Utils.SymTbl.AddToCurrentSpace(hatch, m_db, tr); + + tr.Commit(); + } + } + + public void + HatchAssoc() + { + m_db = Utils.Db.GetCurDwg(); + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + // make boundary triangle + Polyline pline1 = new Polyline(); + pline1.ColorIndex = 211; + pline1.AddVertexAt(0, new Point2d(0.0, 0.0), 0.0, 0.0, 0.0); + pline1.AddVertexAt(0, new Point2d(30.0, 0.0), 0.0, 0.0, 0.0); + pline1.AddVertexAt(0, new Point2d(15.0, 30.0), 0.0, 0.0, 0.0); + pline1.Closed = true; + Utils.Db.TransformToWcs(pline1, m_db); + Utils.SymTbl.AddToCurrentSpace(pline1, m_db, tr); + + // offset the triangle and add those entities to the db + DBObjectCollection offsetCurves = pline1.GetOffsetCurves(5.0); + Utils.SymTbl.AddToCurrentSpace(offsetCurves, m_db, tr); + + ObjectIdCollection boundaryIds1 = new ObjectIdCollection(); + boundaryIds1.Add(pline1.ObjectId); + + ObjectIdCollection boundaryIds2 = new ObjectIdCollection(); + foreach (Entity tmpEnt in offsetCurves) + { + boundaryIds2.Add(tmpEnt.ObjectId); + } + + Hatch hatch = new Hatch(); + hatch.ColorIndex = 141; + + Utils.Db.TransformToWcs(hatch, m_db); // NOTE: need to transform to correct plane *BEFORE* setting pattern and boundary info + + hatch.PatternAngle = Utils.Ge.kRad0; + hatch.PatternScale = 4.0; + hatch.SetHatchPattern(HatchPatternType.PreDefined, "STARS"); + + hatch.HatchStyle = HatchStyle.Normal; + Utils.SymTbl.AddToCurrentSpace(hatch, m_db, tr); + + // To make an associative hatch we have to first add it to the database (above). + // When we call AppendLoop(), it will add the Persistent Reactor that keeps the + // boundary associative. + hatch.Associative = true; + hatch.AppendLoop(HatchLoopTypes.Default, boundaryIds1); + if (boundaryIds2.Count > 0) + hatch.AppendLoop(HatchLoopTypes.Default, boundaryIds2); + + hatch.EvaluateHatch(false); + + tr.Commit(); + } + } + + public void + FaceHardwired() + { + m_db = Utils.Db.GetCurDwg(); + + using (Face face = new Face()) + { + face.ColorIndex = 1; + + double sqSize = 10.0; + + // make a 10 x 10 square face + Point3d tmpPt = new Point3d(0.0, 0.0, 0.0); + face.SetVertexAt(0, tmpPt); + + tmpPt = new Point3d(tmpPt.X + sqSize, tmpPt.Y, tmpPt.Z); + face.SetVertexAt(1, tmpPt); + + tmpPt = new Point3d(tmpPt.X, tmpPt.Y + sqSize, tmpPt.Z); + face.SetVertexAt(2, tmpPt); + + tmpPt = new Point3d(tmpPt.X - sqSize, tmpPt.Y, tmpPt.Z); + face.SetVertexAt(3, tmpPt); + + Utils.Db.TransformToWcs(face, m_db); + Utils.SymTbl.AddToCurrentSpaceAndClose(face, m_db); + } + } + + public void + DimAligned() + { + m_db = Utils.Db.GetCurDwg(); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Point3d pt1, pt2; + + // get end points and angle for extension lines + if (GetLineOrTwoPoints(out pt1, out pt2) != PromptStatus.OK) + return; + + PromptPointOptions prTextPtOpts = new PromptPointOptions("\nText point"); + prTextPtOpts.UseBasePoint = true; + prTextPtOpts.BasePoint = Utils.Ge.Midpoint(pt1, pt2); + PromptPointResult prTextPtRes = ed.GetPoint(prTextPtOpts); + if (prTextPtRes.Status != PromptStatus.OK) + return; + + using (AlignedDimension dim = new AlignedDimension()) + { + dim.XLine1Point = pt1; + dim.XLine2Point = pt2; + + // TBD: dimLinePt is supposed automatically set from where + // text was placed, unless you deliberately set the dimLinePt (and DIMFIT != 4) + // However, it doesn't seem to work unless you set to the same as TextPosition + // anyway. + dim.HorizontalRotation = GetDimHorizRotation(); + dim.UsingDefaultTextPosition = true; // make text go where user picked + dim.TextPosition = prTextPtRes.Value; + dim.DimLinePoint = prTextPtRes.Value; + + Utils.Db.TransformToWcs(dim, m_db); + Utils.SymTbl.AddToCurrentSpaceAndClose(dim, m_db); + } + } + + public void + Point() + { + m_db = Utils.Db.GetCurDwg(); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptPointOptions prPtOpt = new PromptPointOptions("\nPoint"); + PromptPointResult prPtRes = ed.GetPoint(prPtOpt); + if (prPtRes.Status != PromptStatus.OK) + return; + + using (DBPoint point = new DBPoint()) + { + point.Position = prPtRes.Value; + Utils.Db.TransformToWcs(point, m_db); + + // TBD: not sure why, but the call to set the EcsRotation must come + // after we do the TransformToWcs(). Need to investigate whether that + // is a bug or intended behavior. + point.EcsRotation = GetDimHorizRotation(); + Utils.SymTbl.AddToCurrentSpaceAndClose(point, m_db); + } + } + + /// + /// This will demonstrate how to use the CompBldr to manage alot of the low + /// level details of creating new entities. It's not quite ready yet, so this + /// example will come at a later date (but will probably be the way you want + /// to create entities in the future). + /// + /// TBD: finish this off and provide several examples. (jma - 04/28/04) + /// + public void + CompBldrCurSpace() + { + m_db = Utils.Db.GetCurDwg(); + + using (CompBldrCurSpace compBldr = new CompBldrCurSpace(m_db)) + { + compBldr.Start(); + + double tmpRadius = 1.0; + + Circle tmpCirc = null; + for (int i = 0; i < 10; i++) + { + tmpCirc = new Circle(); + tmpCirc.Radius = tmpRadius; + tmpCirc.ColorIndex = i; + + Utils.Db.TransformToWcs(tmpCirc, m_db); + compBldr.AddToDb(tmpCirc); + + tmpRadius += 1.0; + } + + Matrix3d mat = Matrix3d.Displacement(new Vector3d(10.0, 10.0, 0.0)); + compBldr.PushXform(mat); + + tmpCirc = new Circle(); + tmpCirc.Radius = 2.0; + Utils.Db.TransformToWcs(tmpCirc, m_db); + compBldr.AddToDb(tmpCirc); + + compBldr.PopXform(); + + compBldr.Commit(); + } + } + + public void + Lineweights() + { + m_db = Utils.Db.GetCurDwg(); + + using (CompBldrCurSpace compBldr = new CompBldrCurSpace(m_db)) + { + compBldr.Start(); + compBldr.PushXform(Utils.Db.GetUcsMatrix(m_db)); + + Point3d startPt = new Point3d(0.0, 0.0, 0.0); + Point3d endPt = new Point3d(100.0, 0.0, 0.0); + + Vector3d offset = new Vector3d(0.0, 10.0, 0.0); + + foreach (Autodesk.AutoCAD.DatabaseServices.LineWeight lw in System.Enum.GetValues(typeof(LineWeight))) + { + Line line = new Line(startPt, endPt); + line.LineWeight = lw; + + compBldr.AddToDb(line); + + DBText text = new DBText(); + text.Height = 5.0; + text.Position = endPt; + text.TextString = lw.ToString(); + + compBldr.AddToDb(text); + + startPt += offset; + endPt += offset; + } + + compBldr.Commit(); + } + } + + public void + RayHardWired() + { + m_db = Utils.Db.GetCurDwg(); + + using (CompBldrCurSpace compBldr = new CompBldrCurSpace(m_db)) + { + compBldr.Start(); + compBldr.PushXform(Utils.Db.GetUcsMatrix(m_db)); + + Point3d basePoint = new Point3d(0.0, 0.0, 0.0); + Vector3d unitDir = new Vector3d(10.0, 10.0, 0.0); + + Ray ray = new Ray(); + ray.BasePoint = basePoint; + ray.UnitDir = unitDir; + + compBldr.AddToDb(ray); + compBldr.Commit(); + } + } + + public void + LeaderHardWired() + { + m_db = Utils.Db.GetCurDwg(); + + using (CompBldrCurSpace compBldr = new CompBldrCurSpace(m_db)) + { + compBldr.Start(); + compBldr.PushXform(Utils.Db.GetUcsMatrix(m_db)); + + Point3d startPoint = new Point3d(0.0, 0.0, 0.0); + Point3d midPoint = new Point3d(50.0, 50.0, 0.0); + Point3d endPoint = new Point3d(100.0, 50.0, 0.0); + + Point3dCollection pts = new Point3dCollection(); + pts.Add(startPoint); + pts.Add(midPoint); + pts.Add(endPoint); + + Leader leader = new Leader(); + foreach (Point3d pt in pts) + { + leader.AppendVertex(pt); + } + compBldr.AddToDb(leader); + compBldr.Commit(); + } + } + + public void + EllipseHardWired() + { + m_db = Utils.Db.GetCurDwg(); + + using (CompBldrCurSpace compBldr = new CompBldrCurSpace(m_db)) + { + compBldr.Start(); + compBldr.PushXform(Utils.Db.GetUcsMatrix(m_db)); + + Point3d center = new Point3d(50.0, 50.0, 0.0); + // laid out on the XY plane, with normal in Z + Vector3d uNormal = new Vector3d(0.0, 0.0, 10.0); + Vector3d majAxis = new Vector3d(10.0, 0.0, 0.0); + // default values + double rRatio = .5; + double startAngle = 0.0; + double endAngle = 6.28318530717958647692; + Ellipse ellipse = new Ellipse(center, uNormal, majAxis, rRatio, startAngle, endAngle); + compBldr.AddToDb(ellipse); + compBldr.Commit(); + } + } + + public void + SplineHardWired() + { + m_db = Utils.Db.GetCurDwg(); + + using (CompBldrCurSpace compBldr = new CompBldrCurSpace(m_db)) + { + compBldr.Start(); + compBldr.PushXform(Utils.Db.GetUcsMatrix(m_db)); + + Point3dCollection pts = new Point3dCollection(); + pts.Add(new Point3d(0.0, 0.0, 0.0)); + pts.Add(new Point3d(50.0, 50.0, 50.0)); + pts.Add(new Point3d(100.0, 50.0, 100.0)); + pts.Add(new Point3d(150.0, 100.0, 100.0)); + + // order of the curve can be between 2 and 26 + int order = 6; + // determines extent of interpolation through all the points + double fitTolerance = .5; + + Spline spline = new Spline(pts, order, fitTolerance); + compBldr.AddToDb(spline); + compBldr.Commit(); + } + } + + public void + HelixHardWired() + { + m_db = Utils.Db.GetCurDwg(); + + using (CompBldrCurSpace compBldr = new CompBldrCurSpace(m_db)) + { + compBldr.Start(); + compBldr.PushXform(Utils.Db.GetUcsMatrix(m_db)); + + Helix helix = new Helix(); + helix.Turns = 10.0; + helix.Twist = true; + helix.BaseRadius = 20.0; + //creates the helix geometry based on the values set in prior function calls + helix.CreateHelix(); + compBldr.AddToDb(helix); + compBldr.Commit(); + } + } + + public void + XlineHardWired() + { + m_db = Utils.Db.GetCurDwg(); + + using (CompBldrCurSpace compBldr = new CompBldrCurSpace(m_db)) + { + compBldr.Start(); + compBldr.PushXform(Utils.Db.GetUcsMatrix(m_db)); + + Xline xline = new Xline(); + xline.UnitDir = new Vector3d(1.0, 1.0, 0.0); + compBldr.AddToDb(xline); + compBldr.Commit(); + } + } + + public void + Polyline2dHardwired() + { + m_db = Utils.Db.GetCurDwg(); + + using (CompBldrCurSpace compBldr = new CompBldrCurSpace(m_db)) + { + compBldr.Start(); + compBldr.PushXform(Utils.Db.GetUcsMatrix(m_db)); + + Polyline2d pline2d = new Polyline2d(); + pline2d.Color = Color.FromRgb(42, 184, 185); + // polyline2d needs to be in database before the vertices + // can be added to it. The polyline2d owns the vertices. + compBldr.AddToDb(pline2d); + + Point3d[] pts = new Point3d[4]; + pts[0] = new Point3d(0.0, 0.0, 0.0); + pts[1] = new Point3d(15.0, 0.0, 0.0); + pts[2] = new Point3d(15.0, 8.0, 0.0); + pts[3] = new Point3d(0.0, 8.0, 0.0); + + Vertex2d vertX2d; + + for (int i = 0; i < pts.Length; i++) + { + vertX2d = new Vertex2d(pts[i], 0.0, 0.0, 0.0, 0.0); + pline2d.AppendVertex(vertX2d); + compBldr.Transaction.AddNewlyCreatedDBObject(vertX2d, true); + } + + pline2d.Closed = true; + compBldr.Commit(); + } + } + + public void + Polyline3dHardwired() + { + m_db = Utils.Db.GetCurDwg(); + + using (CompBldrCurSpace compBldr = new CompBldrCurSpace(m_db)) + { + compBldr.Start(); + compBldr.PushXform(Utils.Db.GetUcsMatrix(m_db)); + + Point3d[] pts = new Point3d[4]; + pts[0] = new Point3d(0.0, 0.0, 0.0); + pts[1] = new Point3d(15.0, 0.0, 15.0); + pts[2] = new Point3d(15.0, 8.0, 15.0); + pts[3] = new Point3d(0.0, 8.0, 0.0); + Point3dCollection ptsColl = new Point3dCollection(pts); + + Polyline3d pline3d = new Polyline3d(Poly3dType.SimplePoly, ptsColl, true); + pline3d.Color = Color.FromRgb(42, 184, 185); + + compBldr.AddToDb(pline3d); + compBldr.Commit(); + } + } + + public void + TableHardWired() + { + /* m_db = Utils.Db.GetCurDwg(); + + using (CompBldrCurSpace compBldr = new CompBldrCurSpace(m_db)) { + compBldr.Start(); + compBldr.PushXform(Utils.Db.GetUcsMatrix(m_db)); + + Table table = new Table(); + table.NumColumns = 5; + table.NumRows = 5; + table.Height = 50; + table.Width = 15; + + for(int row=0; row + /// Find out the rotational difference between the current UCS XAxis + /// and the ECS XAxis. Dimensions need to know this to know which way + /// was horizontal when the dimension text was created. + /// + /// angle of ECS rotation + + public double + GetDimHorizRotation() + { + m_db = Utils.Db.GetCurDwg(); + + Matrix3d m = Utils.Db.GetUcsMatrix(m_db); + + Vector3d entXAxis = Utils.Db.GetEcsXAxis(m.CoordinateSystem3d.Zaxis); // get AutoCAD's arbitrary X-Axis + + return m.CoordinateSystem3d.Xaxis.GetAngleTo(entXAxis, m.CoordinateSystem3d.Zaxis); // get rotation from one to the other + } + + /// + /// Helper function for acquiring Dimension parameters from the user. It will return + /// two points, either from the user directly picking two points, or from them selecting + /// a line entity. + /// + /// First point + /// Second point + /// + + public PromptStatus + GetLineOrTwoPoints(out Point3d pt1, out Point3d pt2) + { + m_db = Utils.Db.GetCurDwg(); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + pt1 = pt2 = Utils.Ge.kOrigin; // initialize to make compiler happy + + PromptPointOptions prOpts = new PromptPointOptions("\nFirst extension line origin or RETURN to select"); + prOpts.AllowNone = true; + + PromptPointResult prPt1Res = ed.GetPoint(prOpts); + + // user wants to select a line to specify both points + if (prPt1Res.Status == PromptStatus.None) + { + PromptEntityOptions prEntOpts = new PromptEntityOptions("\nSelect a LINE"); + prEntOpts.SetRejectMessage("\nSelected entity must be of type Line"); + prEntOpts.AddAllowedClass(typeof(Line), false); + + PromptEntityResult prEntRes = ed.GetEntity(prEntOpts); + if (prEntRes.Status != PromptStatus.OK) + return prEntRes.Status; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Line line = (Line)tr.GetObject(prEntRes.ObjectId, OpenMode.ForRead); + + pt1 = Utils.Db.WcsToUcs(line.StartPoint); + pt2 = Utils.Db.WcsToUcs(line.EndPoint); + tr.Commit(); + + return PromptStatus.OK; + } + } + else if (prPt1Res.Status == PromptStatus.OK) + { + PromptPointOptions prPt2Opts = new PromptPointOptions("\nSecond extension line origin"); + prPt2Opts.UseBasePoint = true; + prPt2Opts.BasePoint = prPt1Res.Value; + PromptPointResult prPt2Res = ed.GetPoint(prPt2Opts); + if (prPt2Res.Status != PromptStatus.OK) + return PromptStatus.Cancel; + + pt1 = prPt1Res.Value; + pt2 = prPt2Res.Value; + return prPt1Res.Status; + } + + return prPt1Res.Status; + } + + #endregion User Input Utils + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/MakeSymTblRecTests.cs b/MgdDbgLibrary/ObjTests/MakeSymTblRecTests.cs new file mode 100644 index 0000000..409ba51 --- /dev/null +++ b/MgdDbgLibrary/ObjTests/MakeSymTblRecTests.cs @@ -0,0 +1,149 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.Colors; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Geometry; +using MgdDbg.CompBuilder; +using MgdDbg.ObjTests.TestFramework; + +namespace MgdDbg.ObjTests +{ + /// + /// Summary description for MakeSymTblRecTests. + /// + public class MakeSymTblRecTests : MgdDbgTestFuncs + { + private Database m_db = null; + + public + MakeSymTblRecTests() + { + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Block", "Hardwired block", typeof(BlockTableRecord), new MgdDbgTestFuncInfo.TestFunc(Block), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Block (CompBldr)", "Hardwired block (Using CompBldr)", typeof(BlockTableRecord), new MgdDbgTestFuncInfo.TestFunc(BlockCompBldr), MgdDbgTestFuncInfo.TestType.Create)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Layer", "Hardwired layer", typeof(LayerTableRecord), new MgdDbgTestFuncInfo.TestFunc(Layer), MgdDbgTestFuncInfo.TestType.Create)); + } + + #region Tests + + public void + Block() + { + m_db = Utils.Db.GetCurDwg(); + string symName = "Jimbo"; + + if (Utils.SymTbl.SymbolTableRecExists(typeof(BlockTableRecord), symName, m_db)) + { + bool answer; + PromptStatus stat = Utils.AcadUi.PromptYesNo(string.Format("\nBlock \"{0}\"already exists. Replace?", symName), false, out answer); + if ((stat != PromptStatus.OK) || (answer == false)) + return; + } + + using (TransactionHelper tr = new TransactionHelper(m_db)) + { + tr.Start(); + + BlockTableRecord blkRec = tr.DefineNewBlockRec(symName); + + Line line = new Line(new Point3d(0.0, 0.0, 0.0), new Point3d(10.0, 10.0, 0.0)); + blkRec.AppendEntity(line); + tr.Transaction.AddNewlyCreatedDBObject(line, true); + + Circle circ = new Circle(); + circ.Center = new Point3d(0.0, 0.0, 0.0); + circ.Radius = 5.0; + blkRec.AppendEntity(circ); + tr.Transaction.AddNewlyCreatedDBObject(circ, true); + + tr.Commit(); + Utils.AcadUi.PrintToCmdLine(string.Format("\nCreated block \"{0}\".", symName)); + } + } + + public void + BlockCompBldr() + { + m_db = Utils.Db.GetCurDwg(); + string symName = "Sophie"; + + if (Utils.SymTbl.SymbolTableRecExists(typeof(BlockTableRecord), symName, m_db)) + { + bool answer; + PromptStatus stat = Utils.AcadUi.PromptYesNo(string.Format("\nBlock \"{0}\"already exists. Replace?", symName), false, out answer); + if ((stat != PromptStatus.OK) || (answer == false)) + return; + } + + using (CompBldrNamedBlkDef compBldr = new CompBldrNamedBlkDef(m_db, symName)) + { + compBldr.Start(); + + Line line = new Line(new Point3d(0.0, 0.0, 0.0), new Point3d(-10.0, -10.0, 0.0)); + compBldr.SetToDefaultProps(line); + compBldr.AddToDb(line); + + Circle circ = new Circle(); + circ.Center = new Point3d(0.0, 0.0, 0.0); + circ.Radius = 5.0; + compBldr.SetToDefaultProps(circ); + compBldr.AddToDb(circ); + + compBldr.Commit(); + Utils.AcadUi.PrintToCmdLine(string.Format("\nCreated block \"{0}\".", symName)); + } + } + + public void + Layer() + { + m_db = Utils.Db.GetCurDwg(); + string symName = "Jimbo"; + + using (TransactionHelper tr = new TransactionHelper(m_db)) + { + tr.Start(); + + if (tr.SymbolTableRecExists(typeof(LayerTableRecord), symName)) + { + Utils.AcadUi.PrintToCmdLine(string.Format("\nLayer \"{0}\" already exists.", symName)); + return; + } + + LayerTableRecord lyr = new LayerTableRecord(); + lyr.Name = symName; + lyr.LinetypeObjectId = Utils.SymTbl.GetOrLoadLinetypeId("ZIGZAG", m_db); + //lyr.Description = "Layer created programmatically by MgdDbg"; // Can't set until after its added to the database! + + lyr.Color = Color.FromRgb(0, 130, 160); + + tr.AddNewSymbolRec(lyr); + + tr.Commit(); + Utils.AcadUi.PrintToCmdLine(string.Format("\nCreated layer \"{0}\".", symName)); + } + } + + #endregion Tests + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/ModifyEntTests.cs b/MgdDbgLibrary/ObjTests/ModifyEntTests.cs new file mode 100644 index 0000000..a471ad1 --- /dev/null +++ b/MgdDbgLibrary/ObjTests/ModifyEntTests.cs @@ -0,0 +1,289 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Geometry; +using MgdDbg.ObjTests.TestFramework; +using System; +using System.Windows.Forms; + +namespace MgdDbg.ObjTests +{ + /// + /// Summary description for ModifyEntTests. + /// + public class ModifyEntTests : MgdDbgTestFuncs + { + private Database m_db = null; + + public ModifyEntTests() + { + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Xform - Move", "Move selected objects", typeof(Entity), new MgdDbgTestFuncInfo.TestFunc(XformMove), MgdDbgTestFuncInfo.TestType.Modify)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Xform - Rotate", "Rotate selected objects", typeof(Entity), new MgdDbgTestFuncInfo.TestFunc(XformRotate), MgdDbgTestFuncInfo.TestType.Modify)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Xform - Scale", "Scale selected objects", typeof(Entity), new MgdDbgTestFuncInfo.TestFunc(XformScale), MgdDbgTestFuncInfo.TestType.Modify)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Xform - Mirror", "Mirror selected objects", typeof(Entity), new MgdDbgTestFuncInfo.TestFunc(XformMirror), MgdDbgTestFuncInfo.TestType.Modify)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Xform - WCS Origin", "Transform selected objects to WCS origin (needed when making a block out of a set of entities)", typeof(Entity), new MgdDbgTestFuncInfo.TestFunc(XformWcsOrigin), MgdDbgTestFuncInfo.TestType.Modify)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Highlight Entity", "Higlight entity using handle", typeof(Entity), new MgdDbgTestFuncInfo.TestFunc(HighlightEntityFromHandle), MgdDbgTestFuncInfo.TestType.Modify)); + } + + #region Tests + + public void + XformMove() + { + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + ObjectIdCollection selSet = null; + if (Utils.AcadUi.GetSelSetFromUser(out selSet) == false) + return; + + PromptPointOptions prBasePtOpts = new PromptPointOptions("\nBase point or displacement"); + PromptPointResult prBasePtRes = ed.GetPoint(prBasePtOpts); + if (prBasePtRes.Status != PromptStatus.OK) + return; + + Vector3d transVec = new Vector3d(); + + PromptPointOptions prToPtOpts = new PromptPointOptions("\nTo point or "); + prToPtOpts.UseBasePoint = true; + prToPtOpts.BasePoint = prBasePtRes.Value; + prToPtOpts.AllowNone = true; + + PromptPointResult prToPtRes = ed.GetPoint(prToPtOpts); + if (prToPtRes.Status == PromptStatus.OK) + transVec = prToPtRes.Value - prBasePtRes.Value; + else if (prToPtRes.Status == PromptStatus.None) + transVec = prBasePtRes.Value.GetAsVector(); + else + return; // was a cancel + + DoXform(selSet, Matrix3d.Displacement(Utils.Db.UcsToWcs(transVec))); + } + + public void + XformRotate() + { + ObjectIdCollection selSet = null; + if (Utils.AcadUi.GetSelSetFromUser(out selSet) == false) + return; + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptPointResult prBasePtRes = ed.GetPoint("\nBase point"); + if (prBasePtRes.Status == PromptStatus.OK) + { + PromptDoubleResult prRotAngRes = ed.GetAngle("\nRotation angle"); + if (prRotAngRes.Status == PromptStatus.OK) + { + Vector3d axis = Utils.Db.GetUcsZAxis(Utils.Db.GetCurDwg()); + DoXform(selSet, Matrix3d.Rotation(prRotAngRes.Value, axis, Utils.Db.UcsToWcs(prBasePtRes.Value))); + } + } + } + + public void + XformScale() + { + ObjectIdCollection selSet = null; + if (Utils.AcadUi.GetSelSetFromUser(out selSet) == false) + return; + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptPointResult prBasePtRes = ed.GetPoint("\nBase point"); + if (prBasePtRes.Status == PromptStatus.OK) + { + PromptDistanceOptions prScaleOpts = new PromptDistanceOptions("\nScale factor"); + prScaleOpts.AllowZero = false; + prScaleOpts.AllowNegative = false; + + PromptDoubleResult prScaleRes = ed.GetDistance(prScaleOpts); + + if (prScaleRes.Status == PromptStatus.OK) + { + DoXform(selSet, Matrix3d.Scaling(prScaleRes.Value, Utils.Db.UcsToWcs(prBasePtRes.Value))); + } + } + } + + public void + XformMirror() + { + m_db = Utils.Db.GetCurDwg(); + ObjectIdCollection selSet = null; + + if (Utils.AcadUi.GetSelSetFromUser(out selSet) == false) + return; + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptPointResult prFirstPtRes = ed.GetPoint("\nFirst point on mirror line"); + if (prFirstPtRes.Status != PromptStatus.OK) + return; + + PromptPointOptions prSecondPtOpts = new PromptPointOptions("\nSecond point on mirror line"); + prSecondPtOpts.UseBasePoint = true; + prSecondPtOpts.BasePoint = prFirstPtRes.Value; + + PromptPointResult prSecondPtRes = ed.GetPoint(prSecondPtOpts); + if (prSecondPtRes.Status != PromptStatus.OK) + return; + + Line3d mirrorLine = new Line3d(Utils.Db.UcsToWcs(prFirstPtRes.Value), Utils.Db.UcsToWcs(prSecondPtRes.Value)); + + bool doCopy; + if (Utils.AcadUi.PromptYesNo("\nCopy the original entities", true, out doCopy) != PromptStatus.OK) + return; + + if (doCopy) + Utils.Db.CloneAndXformObjects(m_db, selSet, m_db.CurrentSpaceId, Matrix3d.Mirroring(mirrorLine)); + else + DoXform(selSet, Matrix3d.Mirroring(mirrorLine)); + } + + public void + XformWcsOrigin() + { + ObjectIdCollection selSet = null; + if (Utils.AcadUi.GetSelSetFromUser(out selSet) == false) + return; + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptPointResult prBasePtRes = ed.GetPoint("\nBase point"); + if (prBasePtRes.Status != PromptStatus.OK) + return; + + Matrix3d xform = Utils.Db.GetUcsToWcsOriginMatrix(Utils.Db.UcsToWcs(prBasePtRes.Value), Utils.Db.GetCurDwg()); + DoXform(selSet, xform); + } + + private void + DoXform(ObjectIdCollection objIds, Matrix3d m) + { + if (objIds.Count == 0) + return; + + Database db = objIds[0].Database; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager; + + using (Transaction tr = tm.StartTransaction()) + { + Entity tmpEnt; + foreach (ObjectId tmpId in objIds) + { + tmpEnt = (Entity)tr.GetObject(tmpId, OpenMode.ForWrite); + tmpEnt.TransformBy(m); + } + + tr.Commit(); + } + } + + public void + HighlightEntityFromHandle() + { + ObjectId id = ObjectId.Null; + DialogResult dlgResult; + + Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager; + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + PromptStringOptions options = new PromptStringOptions("Enter Handle"); + + String str = ed.GetString(options).StringResult; + + if (str != String.Empty) + { + Handle h = Utils.Db.StringToHandle(str); + + try + { + id = Utils.Db.HandleToObjectId(db, h); + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Entity ent = tr.GetObject(id, OpenMode.ForWrite) as Entity; + + if (ent != null) + { + ent.Highlight(); + } + else + { + Utils.AcadUi.PrintToCmdLine((tr.GetObject(id, OpenMode.ForWrite)).GetType().FullName); + } + tr.Commit(); + } + + dlgResult = MessageBox.Show("Do you want to continue?", "MgdDbg", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (dlgResult == DialogResult.Yes) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Entity ent = tr.GetObject(id, OpenMode.ForWrite) as Entity; + + if (ent != null) + { + ent.Unhighlight(); + } + else + { + Utils.AcadUi.PrintToCmdLine((tr.GetObject(id, OpenMode.ForWrite)).GetType().FullName); + } + tr.Commit(); + } + } + } + catch (Autodesk.AutoCAD.Runtime.Exception x) + { + if (x.ErrorStatus != Autodesk.AutoCAD.Runtime.ErrorStatus.UnknownHandle) + { + throw x; + } + } + } + } + + public static Handle + StringToHandle(String strHandle) + { + Handle handle = new Handle(); + + try + { + Int64 nHandle = Convert.ToInt64(strHandle, 16); + handle = new Handle(nHandle); + } + catch (System.FormatException) + { + } + return handle; + } + + #endregion Tests + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/QueryCurveTests.cs b/MgdDbgLibrary/ObjTests/QueryCurveTests.cs new file mode 100644 index 0000000..354538e --- /dev/null +++ b/MgdDbgLibrary/ObjTests/QueryCurveTests.cs @@ -0,0 +1,1182 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.Runtime; +using MgdDbg.ObjTests.TestFramework; +using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application; + +namespace MgdDbg.ObjTests +{ + /// + /// Summary description for QueryCurveTests. + /// + public class QueryCurveTests : MgdDbgTestFuncs + { + private Database m_db = null; + private Editor m_ed = null; + + public + QueryCurveTests() + { + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Area", "Get the area of the curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(Area), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Is closed", "Test whether the curve is closed", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(IsClosed), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Is periodic", "Test whether the curve is periodic", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(IsPeriodic), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get start/end points", "Add Point entity where the start and end points are", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(StartEndPoints), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get start/end params", "Get start and end params of the curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(StartEndParams), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get point at param", "Get point at a given parameter of the curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(PointAtParam), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get param at point", "Get param at a given point on the curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(ParamAtPoint), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get distance at param", "Get distance at a given param of the curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(DistanceAtParam), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get param at distance", "Get param at a given distance along the curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(ParamAtDistance), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get distance at point", "Get distance at a given point on the curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(DistanceAtPoint), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get point at distance", "Get point at a given distance along the curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(PointAtDistance), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get derivatives at param", "Get first and second derivatives", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(DerivativesAtParam), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get derivatives at point", "Get first and second derivatives", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(DerivativesAtPoint), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get closest point", "Get point on the curve closest to point picked", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(ClosestPointTo), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get closest point using direction", "Get point on the curve closest to point picked (in the direction specified)", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(ClosestPointToDirection), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get offset curves", "Get the offset of the given curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(OffsetCurves), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get offset curves given plane normal", "Get the offset of the given curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(OffsetCurvesGivenPlaneNormal), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get projected curve", "Get the projected curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(ProjectedCurve), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get ortho projected curve", "Get the projected curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(OrthoProjectedCurve), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get split curves from params", "Get the sub-curves given certain params", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(SplitCurvesParams), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get split curves from points", "Get the sub-curves given certain points", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(SplitCurvesPoints), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Spline", "Get a Spline entity representing the curve", typeof(Curve), new MgdDbgTestFuncInfo.TestFunc(Spline), MgdDbgTestFuncInfo.TestType.Query)); + } + + #region Tests + + public void + Area() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + m_ed.WriteMessage(string.Format("\nAREA: {0}", Converter.DistanceToString(curve.Area, DistanceUnitFormat.Decimal, -1))); + + tr.Commit(); + } + } + } + + public void + IsClosed() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + m_ed.WriteMessage(string.Format("\nCLOSED: {0}", curve.Closed.ToString())); + + tr.Commit(); + } + } + } + + public void + IsPeriodic() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + m_ed.WriteMessage(string.Format("\nPERIODIC: {0}", curve.IsPeriodic.ToString())); + + tr.Commit(); + } + } + } + + public void + StartEndPoints() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + // get StartPoint (if appliacable) and make a point entity in Red + // to graphically depict it. + try + { + Point3d startPt = curve.StartPoint; + m_ed.WriteMessage(string.Format("\nSTART POINT: {0}", Utils.AcadUi.PtToStr(startPt))); + Utils.Db.MakePointEnt(startPt, 1, tr, m_db); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + m_ed.WriteMessage("\nSTART POINT: Not Applicable"); + else + throw e; + } + + // get EndPoint (if appliacable) and make a point entity in Yellow + // to graphically depict it. + try + { + Point3d endPt = curve.EndPoint; + m_ed.WriteMessage(string.Format("\nEND POINT: {0}", Utils.AcadUi.PtToStr(endPt))); + Utils.Db.MakePointEnt(endPt, 2, tr, m_db); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + m_ed.WriteMessage("\nEND POINT: Not Applicable"); + else + throw e; + } + + tr.Commit(); + } + } + } + + public void + StartEndParams() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + try + { + double startParam = curve.StartParam; + m_ed.WriteMessage(string.Format("\nSTART PARAM (as double): {0}", Converter.DistanceToString(startParam))); + m_ed.WriteMessage(string.Format("\nSTART PARAM (as angle): {0}", Converter.AngleToString(startParam))); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + m_ed.WriteMessage("\nSTART PARAM: Not Applicable"); + else + throw e; + } + + try + { + double endParam = curve.EndParam; + m_ed.WriteMessage(string.Format("\nEND PARAM (as double): {0}", Converter.DistanceToString(endParam))); + m_ed.WriteMessage(string.Format("\nEND PARAM (as angle): {0}", Converter.AngleToString(endParam))); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + m_ed.WriteMessage("\nEND PARAM: Not Applicable"); + else + throw e; + } + + tr.Commit(); + } + } + } + + public void + PointAtParam() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + PrintParamInterval(curve); + + double param; + if (GetCurveParam(out param)) + { + try + { + Point3d pt = curve.GetPointAtParameter(param); + m_ed.WriteMessage(string.Format("\nPOINT: {0}", Utils.AcadUi.PtToStr(pt))); + Utils.Db.MakePointEnt(pt, 3, tr, m_db); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + } + + tr.Commit(); + } + } + } + + public void + ParamAtPoint() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + try + { + // the point picked is not necessarily on the curve (unless we used + // an OSNAP that forced it on the curve). We will first get the closest + // point on the curve from the picked point and then use that. + Point3d ptOnCurve = curve.GetClosestPointTo(Utils.Db.UcsToWcs(pickPt), false); + double param = curve.GetParameterAtPoint(ptOnCurve); + + m_ed.WriteMessage(string.Format("\nPARAM (as double): {0}", Converter.DistanceToString(param))); + m_ed.WriteMessage(string.Format("\nPARAM (as angle): {0}", Converter.AngleToString(param))); + Utils.Db.MakePointEnt(ptOnCurve, 3, tr, m_db); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + tr.Commit(); + } + } + } + + public void + DistanceAtParam() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + PrintParamInterval(curve); + + double param; + if (GetCurveParam(out param)) + { + try + { + double dist = curve.GetDistanceAtParameter(param); + m_ed.WriteMessage(string.Format("\nDISTANCE: {0}", Converter.DistanceToString(dist))); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + } + + tr.Commit(); + } + } + } + + public void + ParamAtDistance() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + // first prompt for distance along the curve + PromptDoubleResult res = m_ed.GetDistance("\nDistance along curve"); + if (res.Status != PromptStatus.OK) + { + return; + } + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + try + { + double param = curve.GetParameterAtDistance(res.Value); + m_ed.WriteMessage(string.Format("\nPARAM (as double): {0}", Converter.DistanceToString(param))); + m_ed.WriteMessage(string.Format("\nPARAM (as angle): {0}", Converter.AngleToString(param))); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + tr.Commit(); + } + } + } + + public void + DistanceAtPoint() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + try + { + // the point picked is not necessarily on the curve (unless we used + // an OSNAP that forced it on the curve). We will first get the closest + // point on the curve from the picked point and then use that. + Point3d ptOnCurve = curve.GetClosestPointTo(Utils.Db.UcsToWcs(pickPt), false); + double dist = curve.GetDistAtPoint(ptOnCurve); // TBD: function should be called GetDistanceAtPoint() + + m_ed.WriteMessage(string.Format("\nDISTANCE: {0}", Converter.DistanceToString(dist))); + Utils.Db.MakePointEnt(ptOnCurve, 3, tr, m_db); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + tr.Commit(); + } + } + } + + public void + PointAtDistance() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + // first prompt for distance along the curve + PromptDoubleResult res = m_ed.GetDistance("\nDistance along curve"); + if (res.Status != PromptStatus.OK) + { + return; + } + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + try + { + Point3d ptOnCurve = curve.GetPointAtDist(res.Value); // TBD: function should be called GetPointAtDistance() + m_ed.WriteMessage(string.Format("\nPOINT: {0}", Utils.AcadUi.PtToStr(ptOnCurve))); + Utils.Db.MakePointEnt(ptOnCurve, 3, tr, m_db); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + tr.Commit(); + } + } + } + + public void + DerivativesAtParam() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + PrintParamInterval(curve); + + double param; + if (GetCurveParam(out param)) + { + // We need a point on the curve to create the Ray entities we will + // use to mark the two axes. If the user gives us an invalid param, + // we aren't catching it here, so it will throw an exception. Under + // normal circumstances, we could just put this in the try/catch block + // below. Here, we want to demonstrate each possible error. + try + { + Point3d ptOnCurve = curve.GetPointAtParameter(param); + try + { + Vector3d firstDeriv = curve.GetFirstDerivative(param); + m_ed.WriteMessage(string.Format("\nFIRST DERIV: {0}", Utils.AcadUi.VecToStr(firstDeriv))); + Utils.Db.MakeRayEnt(ptOnCurve, firstDeriv, 1, tr, m_db); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nFirst Derivative ERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + try + { + Vector3d secondDeriv = curve.GetSecondDerivative(param); + m_ed.WriteMessage(string.Format("\nSECOND DERIV: {0}", Utils.AcadUi.VecToStr(secondDeriv))); + Utils.Db.MakeRayEnt(ptOnCurve, secondDeriv, 2, tr, m_db); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nSecond Derivative ERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nParameter is not on curve: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + return; + } + } + + tr.Commit(); + } + } + } + + public void + DerivativesAtPoint() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + // Again, we could put these all in a single try/catch block, but we + // want to catch all errors individually so we can demonstrate how the + // functions behave. + try + { + // the point picked is not necessarily on the curve (unless we used + // an OSNAP that forced it on the curve). We will first get the closest + // point on the curve from the picked point and then use that. + Point3d ptOnCurve = curve.GetClosestPointTo(Utils.Db.UcsToWcs(pickPt), false); + Utils.Db.MakePointEnt(ptOnCurve, 3, tr, m_db); + + try + { + Vector3d firstDeriv = curve.GetFirstDerivative(ptOnCurve); + m_ed.WriteMessage(string.Format("\nFIRST DERIV: {0}", Utils.AcadUi.VecToStr(firstDeriv))); + Utils.Db.MakeRayEnt(ptOnCurve, firstDeriv, 1, tr, m_db); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nFirst Derivative ERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + try + { + Vector3d secondDeriv = curve.GetSecondDerivative(ptOnCurve); + m_ed.WriteMessage(string.Format("\nSECOND DERIV: {0}", Utils.AcadUi.VecToStr(secondDeriv))); + Utils.Db.MakeRayEnt(ptOnCurve, secondDeriv, 2, tr, m_db); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nSecond Derivative ERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nPoint is not on curve: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + return; + } + + tr.Commit(); + } + } + } + + public void + ClosestPointTo() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + // let user pick an arbitrary point + PromptPointResult prPtRes = m_ed.GetPoint("\nEnter a point"); + if (prPtRes.Status != PromptStatus.OK) + return; + + bool allowExtend = false; + if (Utils.AcadUi.PromptYesNo("\nExtend curve?", allowExtend, out allowExtend) != PromptStatus.OK) + return; + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + try + { + Point3d ptOnCurve = curve.GetClosestPointTo(Utils.Db.UcsToWcs(prPtRes.Value), allowExtend); + + m_ed.WriteMessage(string.Format("\nCLOSEST PT: {0}", Utils.AcadUi.PtToStr(ptOnCurve))); + Utils.Db.MakePointEnt(Utils.Db.UcsToWcs(prPtRes.Value), 4, tr, m_db); + Utils.Db.MakePointEnt(ptOnCurve, 3, tr, m_db); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + tr.Commit(); + } + } + } + + public void + ClosestPointToDirection() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + // let user pick an arbitrary point + PromptPointResult prPtRes = m_ed.GetPoint("\nEnter a point"); + if (prPtRes.Status != PromptStatus.OK) + return; + + // find out which direction they want to go + PromptPointOptions prDirPtOpts = new PromptPointOptions("\nDirection"); + prDirPtOpts.BasePoint = prPtRes.Value; + prDirPtOpts.UseBasePoint = true; + + PromptPointResult prDirPtRes = m_ed.GetPoint(prDirPtOpts); + if (prDirPtRes.Status != PromptStatus.OK) + return; + + Vector3d dirVec = Utils.Db.UcsToWcs(prPtRes.Value - prDirPtRes.Value); + if (dirVec.IsZeroLength()) + { + m_ed.WriteMessage("\nDirection vector is zero-length!"); + return; + } + + bool allowExtend = false; + if (Utils.AcadUi.PromptYesNo("\nExtend curve?", allowExtend, out allowExtend) != PromptStatus.OK) + return; + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + try + { + Point3d ptOnCurve = curve.GetClosestPointTo(Utils.Db.UcsToWcs(prPtRes.Value), dirVec, allowExtend); + + m_ed.WriteMessage(string.Format("\nCLOSEST PT: {0}", Utils.AcadUi.PtToStr(ptOnCurve))); + Utils.Db.MakePointEnt(Utils.Db.UcsToWcs(prPtRes.Value), 4, tr, m_db); + Utils.Db.MakePointEnt(ptOnCurve, 3, tr, m_db); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + tr.Commit(); + } + } + } + + public void + OffsetCurves() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + // first prompt for offset distance (can be negative to go other direction) + PromptDoubleResult res = m_ed.GetDistance("\nOffset distance"); + if (res.Status != PromptStatus.OK) + { + return; + } + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + try + { + DBObjectCollection newCurves = curve.GetOffsetCurves(res.Value); + // bump the color index of each curve returned so we can see how + // many there are. + int colorIndex = 1; + foreach (Entity ent in newCurves) + ent.ColorIndex = colorIndex++; + + Utils.SymTbl.AddToCurrentSpace(newCurves, m_db, tr); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + tr.Commit(); + } + } + } + + /// + /// TBD: this one doesn't seem to work too well (or else I don't understand it) + /// + public void + OffsetCurvesGivenPlaneNormal() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + // first prompt for offset distance (can be negative to go other direction) + PromptDoubleResult res = m_ed.GetDistance("\nOffset distance"); + if (res.Status != PromptStatus.OK) + { + return; + } + + Vector3d planeVec = new Vector3d(1.0, 1.0, 1.0); // arbitrary plane normal + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + try + { + DBObjectCollection newCurves = curve.GetOffsetCurvesGivenPlaneNormal(planeVec, res.Value); + // bump the color index of each curve returned so we can see how + // many there are. + int colorIndex = 1; + foreach (Entity ent in newCurves) + ent.ColorIndex = colorIndex++; + + Utils.SymTbl.AddToCurrentSpace(newCurves, m_db, tr); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + tr.Commit(); + } + } + } + + /// + /// To see how this one works, do the following: + /// 1) Draw curves in WCS + /// 2) Create a new UCS with X, Y, and Z axes rotated 45 degrees each + /// 3) Go to PLAN view in the new UCS + /// 4) Run the test. You should see red curves overlap the originals + /// 5) Do command UCS,World + /// 6) Go to PLAN view in the now established WCS + /// 7) The red projected curves should now be in a totally different plane + /// + + public void + ProjectedCurve() + { + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + m_db = Utils.Db.GetCurDwg(); + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + m_ed.WriteMessage("\nProjecting onto current UCS plane with VIEWDIR as projection direction..."); + + Plane planeToProjectOn = Utils.Db.GetUcsPlane(m_db); + Point3d tmpPt = (Point3d)AcadApp.GetSystemVariable("viewdir"); + Vector3d projDir = Utils.Db.UcsToWcs(tmpPt.GetAsVector()); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + try + { + Curve projCurve = curve.GetProjectedCurve(planeToProjectOn, projDir); + projCurve.ColorIndex = 1; + + Utils.SymTbl.AddToCurrentSpace(projCurve, m_db, tr); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + tr.Commit(); + } + } + } + + /// + /// See notes for ProjecteCurve() for how to demonstrate this. + /// + + public void + OrthoProjectedCurve() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + Plane planeToProjectOn = Utils.Db.GetUcsPlane(m_db); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + try + { + Curve projCurve = curve.GetOrthoProjectedCurve(planeToProjectOn); + projCurve.ColorIndex = 1; + + Utils.SymTbl.AddToCurrentSpace(projCurve, m_db, tr); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + tr.Commit(); + } + } + } + + public void + SplitCurvesParams() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + PrintParamInterval(curve); + + DoubleCollection paramVals; + if (GetCurveParams(out paramVals) == false) + return; + + try + { + DBObjectCollection splitCurves = curve.GetSplitCurves(paramVals); + + int colorIndex = 1; + foreach (Entity ent in splitCurves) + ent.ColorIndex = colorIndex++; + + Utils.SymTbl.AddToCurrentSpace(splitCurves, m_db, tr); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + tr.Commit(); + } + } + } + + public void + SplitCurvesPoints() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + Point3dCollection pts; + if (GetCurvePoints(curve, out pts) == false) + return; + + try + { + DBObjectCollection splitCurves = curve.GetSplitCurves(pts); + + int colorIndex = 1; + foreach (Entity ent in splitCurves) + ent.ColorIndex = colorIndex++; + + Utils.SymTbl.AddToCurrentSpace(splitCurves, m_db, tr); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nERROR: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + + tr.Commit(); + } + } + } + + public void + Spline() + { + m_db = Utils.Db.GetCurDwg(); + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + ObjectId curveId = ObjectId.Null; + Point3d pickPt = new Point3d(); + + while (GetCurveEntity(ref curveId, ref pickPt)) + { + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + Curve curve = (Curve)tr.GetObject(curveId, OpenMode.ForRead); + + try + { + Spline newSpline = curve.Spline; + newSpline.ColorIndex = 1; + Utils.SymTbl.AddToCurrentSpace(newSpline, m_db, tr); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + m_ed.WriteMessage("\nSPLINE: Not Applicable"); + else + throw e; + } + + tr.Commit(); + } + } + } + + #endregion Tests + + #region Utils + + private bool + GetCurveEntity(ref ObjectId curveId, ref Point3d pickPt) + { + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptEntityOptions prCurveOpts = new PromptEntityOptions("\nSelect a Curve"); + prCurveOpts.SetRejectMessage("\nSelected entity must be of type Curve."); + prCurveOpts.AddAllowedClass(typeof(Curve), false); + + PromptEntityResult prCurveRes = ed.GetEntity(prCurveOpts); + if (prCurveRes.Status == PromptStatus.OK) + { + curveId = prCurveRes.ObjectId; + pickPt = prCurveRes.PickedPoint; + return true; + } + else + { + curveId = ObjectId.Null; + pickPt = Point3d.Origin; + return false; + } + } + + /// + /// Print the curve's param interval so that the user knows the range of valid values to input. + /// + /// The curve in question + + public void + PrintParamInterval(Curve curve) + { + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + try + { + double startParam = curve.StartParam; + double endParam = curve.EndParam; + + m_ed.WriteMessage("\nParam interval (as double): ({0} --> {1})", + Converter.DistanceToString(startParam), + Converter.DistanceToString(endParam)); + m_ed.WriteMessage("\nParam interval (as angle): ({0} --> {1})", + Converter.AngleToString(startParam), + Converter.AngleToString(endParam)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + m_ed.WriteMessage("\nParam Interval: Not Applicable"); + else + throw e; + } + } + + private bool + GetCurveParam(out double param) + { + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + param = 0.0; + + bool asAngles; + if (Utils.AcadUi.PromptYesNo("\nInput param as angle", true, out asAngles) != PromptStatus.OK) + return false; + + if (asAngles) + { + PromptDoubleResult res = m_ed.GetAngle("\nParam angle of curve"); + if (res.Status == PromptStatus.OK) + { + param = res.Value; + return true; + } + } + else + { + PromptDoubleResult res = m_ed.GetDistance("\nParam of curve"); + if (res.Status == PromptStatus.OK) + { + param = res.Value; + return true; + } + } + return false; + } + + private bool + GetCurveParams(out DoubleCollection paramVals) + { + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + paramVals = new DoubleCollection(); + + bool asAngles; + if (Utils.AcadUi.PromptYesNo("\nInput params as angle", true, out asAngles) != PromptStatus.OK) + return false; + + if (asAngles) + { + PromptAngleOptions prAngOpts = new PromptAngleOptions("\nParam angle of curve"); + prAngOpts.AllowNone = true; + + while (true) + { + PromptDoubleResult prRes = m_ed.GetAngle(prAngOpts); + if (prRes.Status == PromptStatus.OK) + paramVals.Add(prRes.Value); + else if (prRes.Status == PromptStatus.None) + return true; // done inputting values + else + return false; // canceled + } + } + else + { + PromptDistanceOptions prDistOpts = new PromptDistanceOptions("\nParam of curve"); + prDistOpts.AllowNone = true; + + while (true) + { + PromptDoubleResult prRes = m_ed.GetDistance(prDistOpts); + if (prRes.Status == PromptStatus.OK) + paramVals.Add(prRes.Value); + else if (prRes.Status == PromptStatus.None) + return true; // done inputting values + else + return false; // canceled + } + } + } + + private bool + GetCurvePoints(Curve curve, out Point3dCollection pts) + { + m_ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + pts = new Point3dCollection(); + + PromptPointOptions prPtOpts = new PromptPointOptions("\nPoint on curve"); + prPtOpts.AllowNone = true; + + while (true) + { + PromptPointResult prRes = m_ed.GetPoint(prPtOpts); + if (prRes.Status == PromptStatus.OK) + { + try + { + Point3d ptOnCurve = curve.GetClosestPointTo(Utils.Db.UcsToWcs(prRes.Value), false); + pts.Add(ptOnCurve); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + m_ed.WriteMessage("\nClosest point not on curve: {0}", ((ErrorStatus)e.ErrorStatus).ToString()); + } + } + else if (prRes.Status == PromptStatus.None) + return true; // done inputting values + else + return false; // canceled + } + } + + #endregion Utils + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/QueryEntTests.cs b/MgdDbgLibrary/ObjTests/QueryEntTests.cs new file mode 100644 index 0000000..15fa346 --- /dev/null +++ b/MgdDbgLibrary/ObjTests/QueryEntTests.cs @@ -0,0 +1,435 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Geometry; +using MgdDbg.CompBuilder; +using MgdDbg.ObjTests.TestFramework; +using System; +using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application; + +using AcDb = Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.ObjTests +{ + /// + /// Summary description for QueryEntTests. + /// + public class QueryEntTests : MgdDbgTestFuncs + { + private Database m_db = null; + + public + QueryEntTests() + { + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get Stretch Points", "Add Point entities where stretch points are", typeof(Entity), new MgdDbgTestFuncInfo.TestFunc(StretchPoints), MgdDbgTestFuncInfo.TestType.Query)); + //m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get Grip Points", "Add Point entities where grip points are", typeof(Entity), new MgdDbgTestFuncInfo.TestFunc(GripPoints), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Get Geometry Extents", "Add a block of Faces equal to extents cube", typeof(Entity), new MgdDbgTestFuncInfo.TestFunc(Extents), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Intersect With", "Add Point entities where intersection points are", typeof(Entity), new MgdDbgTestFuncInfo.TestFunc(IntersectWith), MgdDbgTestFuncInfo.TestType.Query)); + m_testFrameworkFuncs.Add(new MgdDbgTestFuncInfo("Bounding Box Intersect With", "Add Point entities where intersection points are", typeof(Entity), new MgdDbgTestFuncInfo.TestFunc(BoundingBoxIntersectWith), MgdDbgTestFuncInfo.TestType.Query)); + } + + #region Tests + + /// + /// Add Point entities where stretch points are + /// + public void + StretchPoints() + { + m_db = Utils.Db.GetCurDwg(); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Point3dCollection pts = new Point3dCollection(); + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + while (true) + { + PromptEntityResult prEntRes = ed.GetEntity("\nSelect entity to show stretch points"); + if (prEntRes.Status != PromptStatus.OK) + break; + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + AcDb.Entity ent = (AcDb.Entity)tr.GetObject(prEntRes.ObjectId, OpenMode.ForRead); + + pts.Clear(); // reset to no points each time through loop + ent.GetStretchPoints(pts); + + if (pts.Count == 0) + Utils.AcadUi.PrintToCmdLine("\nNo stretch points specified!"); + else + { + for (int i = 0; i < pts.Count; i++) + { + Utils.AcadUi.PrintToCmdLine(string.Format("\nSTRETCH[{0:d}]: {1}", i, Utils.AcadUi.PtToStr(pts[i]))); + MakePointEnt(pts[i], 1, tr); + } + } + + tr.Commit(); + } + } + } + + /// + /// Add Point entities where grip points are + /// + public void + GripPoints() + { + m_db = Utils.Db.GetCurDwg(); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Point3dCollection pts = new Point3dCollection(); + IntegerCollection osnapModes = new IntegerCollection(); + IntegerCollection geomIds = new IntegerCollection(); + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + while (true) + { + PromptEntityResult prEntRes = ed.GetEntity("\nSelect entity to show grip points"); + if (prEntRes.Status != PromptStatus.OK) + break; + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + AcDb.Entity ent = (AcDb.Entity)tr.GetObject(prEntRes.ObjectId, OpenMode.ForRead); + + pts.Clear(); // reset to no points each time through loop + osnapModes.Clear(); + geomIds.Clear(); + + //TBD: Throws a "Value cannot be null exception" + ent.GetGripPoints(pts, osnapModes, geomIds); + + if (pts.Count == 0) + Utils.AcadUi.PrintToCmdLine("\nNo grip points specified!"); + else + { + for (int i = 0; i < pts.Count; i++) + { + Utils.AcadUi.PrintToCmdLine(string.Format("\nGRIP[{0:d}]: {1}", i, Utils.AcadUi.PtToStr(pts[i]))); + MakePointEnt(pts[i], 2, tr); + } + } + + if (osnapModes.Count == 0) + Utils.AcadUi.PrintToCmdLine("\nNo osnap modes specified!"); + else + { + for (int i = 0; i < osnapModes.Count; i++) + { + Utils.AcadUi.PrintToCmdLine(string.Format("\nOSNAP MODE[{0:d}]: {1}", i, osnapModes[i])); + } + } + + if (geomIds.Count == 0) + Utils.AcadUi.PrintToCmdLine("\nNo geometry IDs specified!"); + else + { + for (int i = 0; i < geomIds.Count; i++) + { + Utils.AcadUi.PrintToCmdLine(string.Format("\nGEOM ID[{0:d}]: {1}", i, geomIds[i].ToString())); + } + } + + tr.Commit(); + } + } + } + + /// + /// Add a block of Faces equal to extents cube + /// + public void + Extents() + { + m_db = Utils.Db.GetCurDwg(); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + while (true) + { + PromptEntityResult prEntRes = ed.GetEntity("\nSelect entity to show extents"); + if (prEntRes.Status != PromptStatus.OK) + break; + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + AcDb.Entity ent = (AcDb.Entity)tr.GetObject(prEntRes.ObjectId, OpenMode.ForRead); + + Extents3d ext = ent.GeometricExtents; + Point3d centerPt = Utils.Ge.Midpoint(ext.MinPoint, ext.MaxPoint); + + Utils.AcadUi.PrintToCmdLine(string.Format("\nEXTMIN: {0}", Utils.AcadUi.PtToStr(ext.MinPoint))); + Utils.AcadUi.PrintToCmdLine(string.Format("\nEXTMAX: {0}", Utils.AcadUi.PtToStr(ext.MaxPoint))); + Utils.AcadUi.PrintToCmdLine(string.Format("\nCENTER PT: {0}", Utils.AcadUi.PtToStr(centerPt))); + + tr.Commit(); + + MakeExtentsBlock(ext); + } + } + } + + /// + /// + /// + /// + public void + MakeExtentsBlock(Extents3d ext) + { + m_db = Utils.Db.GetCurDwg(); + + double deltaX = Math.Abs(ext.MaxPoint.X - ext.MinPoint.X); + double deltaY = Math.Abs(ext.MaxPoint.Y - ext.MinPoint.Y); + double deltaZ = Math.Abs(ext.MaxPoint.Z - ext.MinPoint.Z); + + Point3d[] pts = new Point3d[8]; + + pts[0] = ext.MinPoint; + pts[6] = ext.MaxPoint; + + // make bottom face + pts[1] = new Point3d(pts[0].X + deltaX, pts[0].Y, pts[0].Z); + pts[2] = new Point3d(pts[1].X, pts[1].Y + deltaY, pts[1].Z); + pts[3] = new Point3d(pts[0].X, pts[0].Y + deltaY, pts[0].Z); + + // project up by Z + pts[4] = new Point3d(pts[0].X, pts[0].Y, pts[0].Z + deltaZ); + pts[5] = new Point3d(pts[1].X, pts[1].Y, pts[1].Z + deltaZ); + pts[7] = new Point3d(pts[3].X, pts[3].Y, pts[3].Z + deltaZ); + + Vector3d offset = ext.MinPoint.GetAsVector(); + + // move points so that they are centered at WCS origin + // for block creation. Express everything in WCS since + // that is what Entity.Extents works in. + for (int i = 0; i < pts.Length; i++) + { + pts[i] -= offset; + } + + DBObjectCollection faceEnts = new DBObjectCollection(); + faceEnts.Add(new Face(pts[0], pts[1], pts[2], pts[3], true, true, true, true)); // bottom face + faceEnts.Add(new Face(pts[4], pts[5], pts[6], pts[7], true, true, true, true)); // top face + faceEnts.Add(new Face(pts[0], pts[1], pts[5], pts[4], true, true, true, true)); // front face + faceEnts.Add(new Face(pts[1], pts[2], pts[6], pts[5], true, true, true, true)); // right side face + faceEnts.Add(new Face(pts[2], pts[3], pts[7], pts[6], true, true, true, true)); // back side face + faceEnts.Add(new Face(pts[3], pts[0], pts[4], pts[7], true, true, true, true)); // left side face + + CompBldrAnonBlkDef compBldr = new CompBldrAnonBlkDef(m_db); + compBldr.Start(); + + foreach (Entity ent in faceEnts) + { + compBldr.SetToDefaultProps(ent); + compBldr.AddToDb(ent); + } + + compBldr.Commit(); + + BlockReference blkRef = new BlockReference(ext.MinPoint, compBldr.BlockDefId); + blkRef.ColorIndex = 4; + Utils.SymTbl.AddToCurrentSpaceAndClose(blkRef, compBldr.Database); + } + + /// + /// Add Point entities where intersection points are + /// + public void + IntersectWith() + { + m_db = Utils.Db.GetCurDwg(); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + // get intersection type from user + PromptKeywordOptions prIntType = new PromptKeywordOptions("\nExtend objects"); + prIntType.Keywords.Add("None"); + prIntType.Keywords.Add("First"); + prIntType.Keywords.Add("Second"); + prIntType.Keywords.Add("Both"); + + PromptResult prIntTypeRes = ed.GetKeywords(prIntType); + if (prIntTypeRes.Status != PromptStatus.OK) + return; + + //Intersect intType = Intersect.ExtendBoth; + //if (prIntTypeRes.StringResult == "None") + // intType = Intersect.OnBothOperands; + //else if (prIntTypeRes.StringResult == "First") + // intType = Intersect.ExtendThis; + //else if (prIntTypeRes.StringResult == "Second") + // intType = Intersect.ExtendArgument; + //else + // intType = Intersect.ExtendBoth; + + PromptEntityOptions prEnt1 = new PromptEntityOptions("\nSelect first entity"); + PromptEntityOptions prEnt2 = new PromptEntityOptions("\nSelect intersecting entity"); + Point3dCollection pts = new Point3dCollection(); + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + while (true) + { + PromptEntityResult prEnt1Res = ed.GetEntity(prEnt1); + if (prEnt1Res.Status != PromptStatus.OK) + return; + + PromptEntityResult prEnt2Res = ed.GetEntity(prEnt2); + if (prEnt2Res.Status != PromptStatus.OK) + return; + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + AcDb.Entity ent1 = (AcDb.Entity)tr.GetObject(prEnt1Res.ObjectId, OpenMode.ForRead); + AcDb.Entity ent2 = (AcDb.Entity)tr.GetObject(prEnt2Res.ObjectId, OpenMode.ForRead); + + pts.Clear(); + //ent1.IntersectWith(ent2, intType, pts, 0, 0); // TBD: Fix JMA + if (pts.Count == 0) + Utils.AcadUi.PrintToCmdLine("\nObjects do not intersect!"); + else + { + for (int i = 0; i < pts.Count; i++) + { + Utils.AcadUi.PrintToCmdLine(string.Format("\nINTERSECT PT: {0}", Utils.AcadUi.PtToStr(pts[i]))); + MakePointEnt(pts[i], 3, tr); + } + } + + tr.Commit(); + } + } + } + + /// + /// Add Point entities where intersection points are + /// + public void + BoundingBoxIntersectWith() + { + m_db = Utils.Db.GetCurDwg(); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + // get intersection type from user + PromptKeywordOptions prIntType = new PromptKeywordOptions("\nExtend objects"); + prIntType.Keywords.Add("None"); + prIntType.Keywords.Add("First"); + prIntType.Keywords.Add("Second"); + prIntType.Keywords.Add("Both"); + + PromptResult prIntTypeRes = ed.GetKeywords(prIntType); + if (prIntTypeRes.Status != PromptStatus.OK) + return; + + //Intersect intType = Intersect.ExtendBoth; + //if (prIntTypeRes.StringResult == "None") + // intType = Intersect.OnBothOperands; + //else if (prIntTypeRes.StringResult == "First") + // intType = Intersect.ExtendThis; + //else if (prIntTypeRes.StringResult == "Second") + // intType = Intersect.ExtendArgument; + //else + // intType = Intersect.ExtendBoth; + + PromptEntityOptions prEnt1 = new PromptEntityOptions("\nSelect first entity"); + PromptEntityOptions prEnt2 = new PromptEntityOptions("\nSelect intersecting entity"); + Point3dCollection pts = new Point3dCollection(); + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = m_db.TransactionManager; + + while (true) + { + PromptEntityResult prEnt1Res = ed.GetEntity(prEnt1); + if (prEnt1Res.Status != PromptStatus.OK) + return; + + PromptEntityResult prEnt2Res = ed.GetEntity(prEnt2); + if (prEnt2Res.Status != PromptStatus.OK) + return; + + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) + { + AcDb.Entity ent1 = (AcDb.Entity)tr.GetObject(prEnt1Res.ObjectId, OpenMode.ForRead); + AcDb.Entity ent2 = (AcDb.Entity)tr.GetObject(prEnt2Res.ObjectId, OpenMode.ForRead); + + MakeExtentsBlock(ent1.GeometricExtents); + + pts.Clear(); + //ent1.BoundingBoxIntersectWith(ent2, intType, pts, 0, 0); // TBD: Fix JMA + if (pts.Count == 0) + Utils.AcadUi.PrintToCmdLine("\nObjects do not intersect!"); + else + { + for (int i = 0; i < pts.Count; i++) + { + Utils.AcadUi.PrintToCmdLine(string.Format("\nINTERSECT PT: {0}", Utils.AcadUi.PtToStr(pts[i]))); + MakePointEnt(pts[i], 3, tr); + } + } + + tr.Commit(); + } + } + } + + #endregion Tests + + #region Utils + + /// + /// + /// + /// + /// + /// + private void + MakePointEnt(Point3d pt, int colorIndex, Transaction tr) + { + m_db = Utils.Db.GetCurDwg(); + + short mode = (short)AcadApp.GetSystemVariable("pdmode"); + if (mode == 0) + AcadApp.SetSystemVariable("pdmode", 99); + + using (DBPoint dbPt = new DBPoint(Utils.Db.WcsToUcs(pt))) + { + dbPt.ColorIndex = colorIndex; + Utils.Db.TransformToWcs(dbPt, m_db); + Utils.SymTbl.AddToCurrentSpace(dbPt, m_db, tr); + } + } + + #endregion Utils + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/TestFramework/MgdDbgTestForm.cs b/MgdDbgLibrary/ObjTests/TestFramework/MgdDbgTestForm.cs new file mode 100644 index 0000000..04ba7ed --- /dev/null +++ b/MgdDbgLibrary/ObjTests/TestFramework/MgdDbgTestForm.cs @@ -0,0 +1,766 @@ +// +// (C) Copyright 2005 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using System.Collections; +using System.Diagnostics; +using System.Windows.Forms; + +namespace MgdDbg.ObjTests.TestFramework +{ + /// + /// This is a generic Test "Shell" that allows you to easily add new test functions and organize + /// them without much effort. The Tests are divided into two basic categories, those that are + /// organized by class hierarchy (e.g., this test applies to all objects at this level of the + /// class hierarchy), and Categorized tests (e.g., this test falls into the Category of "Data Extraction"). + /// The test funcs are collected and sorted into buckets that are then displayed in the correct + /// location in the tree. + /// + + public class TestForm : System.Windows.Forms.Form + { + private enum ImageIconList + { // indicies of images to use in the tree control + Test = 0, + Category = 1, + Class = 2, + }; + + private System.Windows.Forms.Label m_txtDesc; + private System.Windows.Forms.Button m_bnOk; + private System.Windows.Forms.Button m_bnCancel; + private System.Windows.Forms.ImageList m_imageList; + + private System.ComponentModel.IContainer components; + + private ArrayList m_treeNodes = new ArrayList(); + private ArrayList m_classTypes = new ArrayList(); + private ArrayList m_funcBuckets = new ArrayList(); // The original list of TestFuncs sorted into their Tree location + private ArrayList m_curFuncBucket = new ArrayList(); + private ArrayList m_placedClasses = new ArrayList(); + private ArrayList m_treeItems = new ArrayList(); + + private SplitContainer m_splitContainer; + private ListView m_lvData; + private ColumnHeader m_testName; + private ColumnHeader m_categoryName; + private ColumnHeader m_type; + private ColumnHeader m_description; + + private MgdDbgTestFuncInfo m_pickedTestFunc = null; + //private Rvt.Utils.Controls.TreeViewWithSearch m_treeViewWithSearch; + + private MgdDbg.Utils.ListViewColumnSorter m_colSorter; + private TreeView m_treeView; + private CheckBox m_checkBxBaseTestsInclude; + + // tree node to remember last selected node + private static TreeNode m_memoryNode = null; + + // list view item key to remember last selected test + private static string m_itemKey = string.Empty; + + // to remember last option + private static bool m_includeBaseTests = true; + + /// + /// Generic dialog that will display and organize a set of test functions + /// + /// Array of TestFuncInfo objects + + public + TestForm(ArrayList testFuncs) + { + InitializeComponent(); + + // Set the column sorter for the list view + m_colSorter = new MgdDbg.Utils.ListViewColumnSorter(); + m_lvData.ListViewItemSorter = m_colSorter; + + m_treeView.BeginUpdate(); + + // sort the TestFuncInfo objects into buckets + foreach (MgdDbgTestFuncs testFuncGroup in testFuncs) + { + foreach (MgdDbgTestFuncInfo testFuncInfo in testFuncGroup.m_testFrameworkFuncs) + { + AddFuncToBucket(testFuncInfo); + } + } + + BuildTree(); + + m_treeView.ExpandAll(); + m_treeView.EndUpdate(); + + m_treeView.AfterSelect += new TreeViewEventHandler(TreeView_AfterSelect); + + RestoreDialogState(); + } + + /// + /// Remember the last position selected in the tree + /// + + private void + RestoreDialogState() + { + // if we can remember the last selected node then select it + if (m_memoryNode != null) + { + TreeNode[] foundNodes = m_treeView.Nodes.Find(m_memoryNode.Name, true); + if (foundNodes.Length != 0) + m_treeView.SelectedNode = foundNodes[0]; + } + + // set to last selected option + m_checkBxBaseTestsInclude.Checked = m_includeBaseTests; + } + + /// + /// Clean up any resources being used. + /// + protected override void + Dispose(bool disposing) + { + if (disposing) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestForm)); + this.m_imageList = new System.Windows.Forms.ImageList(this.components); + this.m_txtDesc = new System.Windows.Forms.Label(); + this.m_bnOk = new System.Windows.Forms.Button(); + this.m_bnCancel = new System.Windows.Forms.Button(); + this.m_splitContainer = new System.Windows.Forms.SplitContainer(); + this.m_treeView = new System.Windows.Forms.TreeView(); + this.m_lvData = new System.Windows.Forms.ListView(); + this.m_testName = new System.Windows.Forms.ColumnHeader(); + this.m_categoryName = new System.Windows.Forms.ColumnHeader(); + this.m_type = new System.Windows.Forms.ColumnHeader(); + this.m_description = new System.Windows.Forms.ColumnHeader(); + this.m_checkBxBaseTestsInclude = new System.Windows.Forms.CheckBox(); + this.m_splitContainer.Panel1.SuspendLayout(); + this.m_splitContainer.Panel2.SuspendLayout(); + this.m_splitContainer.SuspendLayout(); + this.SuspendLayout(); + // + // m_imageList + // + this.m_imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("m_imageList.ImageStream"))); + this.m_imageList.TransparentColor = System.Drawing.Color.Transparent; + this.m_imageList.Images.SetKeyName(0, "ImageTreeTest.bmp"); + this.m_imageList.Images.SetKeyName(1, "ImageTreeCategory.bmp"); + this.m_imageList.Images.SetKeyName(2, "ImageTreeClass.bmp"); + // + // m_txtDesc + // + this.m_txtDesc.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_txtDesc.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.m_txtDesc.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_txtDesc.Location = new System.Drawing.Point(292, 408); + this.m_txtDesc.Name = "m_txtDesc"; + this.m_txtDesc.Size = new System.Drawing.Size(621, 23); + this.m_txtDesc.TabIndex = 1; + // + // m_bnOk + // + this.m_bnOk.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnOk.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOk.Location = new System.Drawing.Point(420, 447); + this.m_bnOk.Name = "m_bnOk"; + this.m_bnOk.Size = new System.Drawing.Size(75, 23); + this.m_bnOk.TabIndex = 2; + this.m_bnOk.Text = "OK"; + // + // m_bnCancel + // + this.m_bnCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnCancel.Location = new System.Drawing.Point(511, 447); + this.m_bnCancel.Name = "m_bnCancel"; + this.m_bnCancel.Size = new System.Drawing.Size(75, 23); + this.m_bnCancel.TabIndex = 3; + this.m_bnCancel.Text = "Cancel"; + // + // m_splitContainer + // + this.m_splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_splitContainer.Location = new System.Drawing.Point(24, 12); + this.m_splitContainer.Name = "m_splitContainer"; + // + // m_splitContainer.Panel1 + // + this.m_splitContainer.Panel1.Controls.Add(this.m_treeView); + // + // m_splitContainer.Panel2 + // + this.m_splitContainer.Panel2.Controls.Add(this.m_lvData); + this.m_splitContainer.Size = new System.Drawing.Size(897, 352); + this.m_splitContainer.SplitterDistance = 257; + this.m_splitContainer.TabIndex = 4; + // + // m_treeView + // + this.m_treeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_treeView.HideSelection = false; + this.m_treeView.ImageIndex = 0; + this.m_treeView.ImageList = this.m_imageList; + this.m_treeView.Location = new System.Drawing.Point(3, 3); + this.m_treeView.Name = "m_treeView"; + this.m_treeView.SelectedImageIndex = 0; + this.m_treeView.ShowNodeToolTips = true; + this.m_treeView.Size = new System.Drawing.Size(251, 346); + this.m_treeView.TabIndex = 0; + // + // m_lvData + // + this.m_lvData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_lvData.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_testName, + this.m_categoryName, + this.m_type, + this.m_description}); + this.m_lvData.FullRowSelect = true; + this.m_lvData.GridLines = true; + this.m_lvData.HideSelection = false; + this.m_lvData.Location = new System.Drawing.Point(-1, 3); + this.m_lvData.Name = "m_lvData"; + this.m_lvData.Size = new System.Drawing.Size(638, 346); + this.m_lvData.TabIndex = 0; + this.m_lvData.UseCompatibleStateImageBehavior = false; + this.m_lvData.View = System.Windows.Forms.View.Details; + this.m_lvData.SelectedIndexChanged += new System.EventHandler(this.ItemSelected); + this.m_lvData.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.OnColumnClick); + // + // m_testName + // + this.m_testName.Text = "Test Name"; + this.m_testName.Width = 180; + // + // m_categoryName + // + this.m_categoryName.Text = "Category/Class"; + this.m_categoryName.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.m_categoryName.Width = 101; + // + // m_type + // + this.m_type.Text = "Type"; + this.m_type.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.m_type.Width = 96; + // + // m_description + // + this.m_description.Text = "Description"; + this.m_description.Width = 367; + // + // m_checkBxBaseTestsInclude + // + this.m_checkBxBaseTestsInclude.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_checkBxBaseTestsInclude.AutoSize = true; + this.m_checkBxBaseTestsInclude.Checked = true; + this.m_checkBxBaseTestsInclude.CheckState = System.Windows.Forms.CheckState.Checked; + this.m_checkBxBaseTestsInclude.Location = new System.Drawing.Point(293, 378); + this.m_checkBxBaseTestsInclude.Name = "m_checkBxBaseTestsInclude"; + this.m_checkBxBaseTestsInclude.Size = new System.Drawing.Size(137, 17); + this.m_checkBxBaseTestsInclude.TabIndex = 6; + this.m_checkBxBaseTestsInclude.Text = "Show Base Class Tests"; + this.m_checkBxBaseTestsInclude.UseVisualStyleBackColor = true; + this.m_checkBxBaseTestsInclude.CheckedChanged += new System.EventHandler(this.OnCheckChanged_IncludeBaseClass); + // + // TestForm + // + this.AcceptButton = this.m_bnOk; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.CancelButton = this.m_bnCancel; + this.ClientSize = new System.Drawing.Size(937, 478); + this.Controls.Add(this.m_checkBxBaseTestsInclude); + this.Controls.Add(this.m_splitContainer); + this.Controls.Add(this.m_bnCancel); + this.Controls.Add(this.m_bnOk); + this.Controls.Add(this.m_txtDesc); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(600, 225); + this.Name = "TestForm"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Tests"; + this.m_splitContainer.Panel1.ResumeLayout(false); + this.m_splitContainer.Panel2.ResumeLayout(false); + this.m_splitContainer.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + } + + #endregion Windows Form Designer generated code + + #region Tree + + /// + /// The functions have been sorted. Walk the list of buckets and add them to the appropriate + /// location in the TreeControl + /// + + private void + BuildTree() + { + TreeNode categoryItem, objHierItem; + + // extablish the two basic roots of the tree + categoryItem = AddTreeItem("Categories", null, null, ImageIconList.Test); + objHierItem = AddTreeItem("Object Hierarchy", null, null, ImageIconList.Test); + + // For the Object Hierarchy section of the tree, we need to add in the root + // type to anchor us (for us, the root only makes sense as APIObject) + System.Type rootType = typeof(Autodesk.AutoCAD.Runtime.RXObject); + + TreeNode rootNode = new TreeNode(rootType.Name); + rootNode.ImageIndex = (int)ImageIconList.Class; + rootNode.SelectedImageIndex = (int)ImageIconList.Class; + rootNode.Tag = rootType.Name; + rootNode.Tag = rootType; + objHierItem.Nodes.Add(rootNode); + + // Add to our cached items of what we've visited + m_classTypes.Add(rootType); + m_treeNodes.Add(rootNode); + m_placedClasses.Add(rootType); + m_treeItems.Add(rootNode); + + // walk through all the TestFunc buckets and place each function + // in the appropriate spot in the tree (sorted by class hierarchy). + // NOTE: they've already been sorted into unique buckets so we + // don't have to look for duplicates. + MgdDbgTestFuncInfo tmpTestFuncInfo = null; + ArrayList tmpBucket = null; + + int len = m_funcBuckets.Count; + for (int i = 0; i < len; i++) + { + tmpBucket = (ArrayList)m_funcBuckets[i]; + tmpTestFuncInfo = (MgdDbgTestFuncInfo)tmpBucket[0]; + + if (tmpTestFuncInfo.IsCategoryBased) + { + // just add the new Category to the tree + AddTreeItem(tmpTestFuncInfo.Category, tmpTestFuncInfo.Category, categoryItem, ImageIconList.Category); + } + else + { + // add an entry for this classType and any intermediate type in the hierarchy + AddNodeForClassType(tmpTestFuncInfo.ClassType); + } + } + } + + /// + /// This is the simple case of adding a root node to the tree or a simple Category-based node. + /// Category and ParentNode can be null. + /// + /// Text to display + /// Display string for the category + /// Parent node to add to + /// Which image to display for the TreeNode + /// The newly added node + + private TreeNode + AddTreeItem(string nodeName, string category, TreeNode parentNode, ImageIconList imageIndex) + { + TreeNode node = new TreeNode(nodeName); + node.Name = nodeName; + node.Tag = category; // can be null + + node.ImageIndex = (int)imageIndex; + node.SelectedImageIndex = (int)imageIndex; + + if (parentNode == null) + m_treeView.Nodes.Add(node); + else + parentNode.Nodes.Add(node); + + return node; + } + + /// + /// Given a classType, add a node to the tree in the correct spot to house + /// the tests from this level of the hierarchy. + /// + /// + /// + + private TreeNode + AddNodeForClassType(System.Type classType) + { + // if we've already placed this guy, then we already have + // a tree node available + int indexFoundAt = m_classTypes.IndexOf(classType); + if (indexFoundAt >= 0) + return (TreeNode)m_treeItems[indexFoundAt]; + + // we haven't placed it, so we need to generate all the nodes + // (if they haven't been yet) between us and the root. First + // collect all the base classes (including ourselves) + System.Type rootType = typeof(Autodesk.AutoCAD.Runtime.RXObject); + ArrayList familyTree = new ArrayList(); + do + { + familyTree.Add(classType); + classType = classType.BaseType; + } while (classType != rootType); + + // now add them to the tree in reverse order + int lastParentIndex = 0; // Root type + TreeNode tmpNode = null; + System.Type tmpType = null; + + int len = familyTree.Count; + for (int i = len - 1; i >= 0; i--) + { // no need to compare against Autodesk.Revit.APIObject + indexFoundAt = m_placedClasses.IndexOf(familyTree[i]); + if (indexFoundAt < 0) + { // we haven't seen this one yet, add it + tmpType = (System.Type)familyTree[i]; + + TreeNode newNode = new TreeNode(tmpType.Name); + tmpNode = (TreeNode)m_treeItems[lastParentIndex]; + newNode.Name = tmpType.Name; + newNode.Tag = tmpType; + newNode.ImageIndex = (int)ImageIconList.Class; + newNode.SelectedImageIndex = (int)ImageIconList.Class; + tmpNode.Nodes.Add(newNode); + + m_placedClasses.Add(tmpType); + m_treeItems.Add(newNode); + + lastParentIndex = m_placedClasses.Count - 1; + } + else + { + lastParentIndex = indexFoundAt; + } + } + return (TreeNode)m_treeItems[lastParentIndex]; + } + + /// + /// + /// + /// + /// + + private void + TreeView_AfterSelect(object sender, TreeViewEventArgs e) + { + ProcessAfterSelect(e.Node); + } + + /// + /// + /// + /// + + void + ProcessAfterSelect(TreeNode treeNode) + { + if (treeNode != null) + { + // remember this node for later + m_memoryNode = treeNode; + + // don't sort initially, just insert according to the hierarchy + m_colSorter.Order = SortOrder.None; + m_txtDesc.Text = string.Empty; + + if (treeNode.Tag == null) + { + m_pickedTestFunc = null; + m_curFuncBucket.Clear(); + } + else + { // see if it is Category based or Hierarchy based + string categoryStr = treeNode.Tag as string; + if (categoryStr == null) // if tag is a class type + GetTests((System.Type)treeNode.Tag, m_checkBxBaseTestsInclude.Checked); + else + GetTests(categoryStr); + } + DisplayCurrent(); + } + } + + /// + /// Recursive function to get tests from a type and its base types + /// + /// the type to get tests from + /// switch to turn ON for including base classes + + private void + GetTests(Type type, bool includeBaseType) + { + if (type == null) + return; + + foreach (ArrayList tmpBucket in m_funcBuckets) + { + foreach (MgdDbgTestFuncInfo tempInfo in tmpBucket) + { + if (tempInfo.IsCategoryBased == false) + { + if (tempInfo.ClassType.FullName == type.FullName) + { + // base classes should appear before derived, + // so manipulate the order + m_curFuncBucket.Insert(0, tempInfo); + } + } + } + } + + if (includeBaseType) + { + GetTests(type.BaseType, true); + } + } + + /// + /// Walk the list of Function Buckets and collect all the functions in this bucket + /// + /// Category to get tests for + + private void + GetTests(string categoryStr) + { + foreach (ArrayList tmpBucket in m_funcBuckets) + { + foreach (MgdDbgTestFuncInfo tempInfo in tmpBucket) + { + if (tempInfo.IsCategoryBased && (tempInfo.Category == categoryStr)) + { + m_curFuncBucket.Insert(0, tempInfo); + } + } + } + } + + #endregion Tree + + /// + /// Sort the in-coming collection of tests in to like-buckets. + /// + /// the test to find a bucket for + + private void + AddFuncToBucket(MgdDbgTestFuncInfo newTestFuncInfo) + { + MgdDbgTestFuncInfo tempFuncInfo = null; + ArrayList tmpBucket = null; + + // walk the list of buckets. If we see one already there that we belong + // to, just add ourselves. If not, then add a new bucket with the passed + // in testFuncInfo as the first member. + int len = m_funcBuckets.Count; + for (int i = 0; i < len; i++) + { + tmpBucket = (ArrayList)m_funcBuckets[i]; + tempFuncInfo = (MgdDbgTestFuncInfo)tmpBucket[0]; // get the first element to compare against + + if (newTestFuncInfo.IsCategoryBased) + { + if ((tempFuncInfo.IsCategoryBased) && (tempFuncInfo.Category.CompareTo(newTestFuncInfo.Category) == 0)) + { + tmpBucket.Add(newTestFuncInfo); + return; + } + } + else + { + if (!(tempFuncInfo.IsCategoryBased) && (tempFuncInfo.ClassType == newTestFuncInfo.ClassType)) + { + tmpBucket.Add(newTestFuncInfo); + return; + } + } + } + + // we didn't find an existing bucket, so make a new one and add this as the first item + ArrayList newBucket = new ArrayList(); + newBucket.Add(newTestFuncInfo); + m_funcBuckets.Add(newBucket); + } + + #region List + + /// + /// User has selected a node in the tree, update the ListCtrl with the appropriate tests + /// + + private void + DisplayCurrent() + { + m_lvData.BeginUpdate(); + m_lvData.Items.Clear(); + + int len = m_curFuncBucket.Count; + for (int i = 0; i < len; i++) + { + MgdDbgTestFuncInfo tmpTestFuncInfo = (MgdDbgTestFuncInfo)m_curFuncBucket[i]; + ListViewItem lvItem = new ListViewItem(tmpTestFuncInfo.Label); + lvItem.Name = tmpTestFuncInfo.Label; + + if (tmpTestFuncInfo.IsCategoryBased) + { + lvItem.SubItems.Add(tmpTestFuncInfo.Category); + } + else + { + lvItem.SubItems.Add(tmpTestFuncInfo.ClassType.Name); + } + lvItem.SubItems.Add(tmpTestFuncInfo.GetTestType().ToString()); + lvItem.SubItems.Add(tmpTestFuncInfo.Description); + lvItem.Tag = tmpTestFuncInfo; + m_lvData.Items.Add(lvItem); + } + m_lvData.EndUpdate(); + + // if we can remember the last selected test then select it + if (m_itemKey.Length != 0) + { + if (m_lvData.Items[m_itemKey] != null) + { + m_lvData.FocusedItem = m_lvData.Items[m_itemKey]; + m_lvData.Items[m_itemKey].Selected = true; + } + } + + // remove all from current bucket for next selection + m_curFuncBucket.Clear(); + } + + /// + /// + /// + /// + /// + + private void + ItemSelected(object sender, System.EventArgs e) + { + Debug.Assert((m_lvData.SelectedItems.Count > 1) == false); + + if (m_lvData.SelectedItems.Count != 0) + { + m_pickedTestFunc = (MgdDbgTestFuncInfo)m_lvData.SelectedItems[0].Tag; + m_txtDesc.Text = m_pickedTestFunc.Description; + + // remember the key of the last selected test + m_itemKey = m_lvData.SelectedItems[0].Name; + } + else + { + m_pickedTestFunc = null; + } + } + + /// + /// Sort the columns according to the column sorter object mandate + /// + /// + /// + + private void + OnColumnClick(object sender, ColumnClickEventArgs e) + { + // Determine if clicked column is already the column that is being sorted. + if (e.Column == m_colSorter.SortColumn) + { + // Reverse the current sort direction for this column. + if (m_colSorter.Order == SortOrder.Ascending) + { + m_colSorter.Order = SortOrder.Descending; + } + else + { + m_colSorter.Order = SortOrder.Ascending; + } + } + else + { + // Set the column number that is to be sorted; default to ascending. + m_colSorter.SortColumn = e.Column; + m_colSorter.Order = SortOrder.Ascending; + } + + // Perform the sort with these new sort options. + m_lvData.Sort(); + } + + #endregion List + + /// + /// Run the Test function + /// + + public void + DoTest() + { + if (m_pickedTestFunc != null) + { + m_pickedTestFunc.RunTest(); + } + } + + private void + OnCheckChanged_IncludeBaseClass(object sender, EventArgs e) + { + ProcessAfterSelect(m_treeView.SelectedNode); + m_includeBaseTests = m_checkBxBaseTestsInclude.Checked; + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/TestFramework/MgdDbgTestForm.resx b/MgdDbgLibrary/ObjTests/TestFramework/MgdDbgTestForm.resx new file mode 100644 index 0000000..b5756b1 --- /dev/null +++ b/MgdDbgLibrary/ObjTests/TestFramework/MgdDbgTestForm.resx @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADa + AwAAAk1TRnQBSQFMAgEBAwEAAQQBAAEEAQABEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA + AwABEAMAAQEBAAEYBgABDBIAkP8wAJD/MAAkwAz/AYACAAGAAgABgAIAAYACAAGAAgABgAIAAYACAAGA + AgABgAIAAYACAAGAAgABgAIAAYACAAn/JAAM/zAAD8AB/wIAAf8CABLACf8BgAIAAYACAAGAAgABgAIA + AYACAAGAAgABgAIAAYACAAGAAgABgAIAAYACAAGAAgABgAIAAYACAAb/JwAJ/zAADMAB/wIAAf8CAAH/ + AgAVwAb/AYACAAGAAgABgAIAAYACAAGAAgABgAIAAYACAAGAAgABgAIAAYACAAGAAgABgAIAAYACAAGA + AgABgAIAA/8qAAb/MAAGwAH/AgAB/wIAAf8CAAPAAf8CAAH/AgAVwAP/AYACAAGAAgABgAIABv8BgAIA + A/8BgAIAA/8BgAIAAYACAAP/AYACAAGAAgABgAIAAYAIAAb/BgAJ/wMACf8GAAP/MAAVwAH/AgAB/wIA + FcABgAIAAYACAAP/AYACAAGAAgABgAIAA/8BgAIAA/8BgAIAAYACAAP/AYACAAGAAgABgAIAAYAFAAP/ + BgAD/wMAA/8SAAP/NgAYwAH/AgAVwAGAAgABgAIAA/8BgAIAAYACAAGAAgAJ/wGAAgABgAIAA/8BgAIA + AYACAAGAAgABgAUAA/8MAAP/DAAG/zkAGMAB/wIAAf8CABLAAYACAAGAAgAD/wGAAgABgAIAAYACAAP/ + AYACAAP/AYACAAGAAgAD/wGAAgABgAIAAYACAAGABQAD/wYAA/8DAAP/CQAD/z8AG8AB/wIAAf8CAAzA + A/8BgAIAAYACAAGAAgAG/wGAAgABgAIAA/8BgAIAAYACAAn/AYACAAGAAgABgAgABv8GAAP/DAAJ/wMA + A/8wAB7AAf8CAAH/AgAGwAb/AYACAAGAAgABgAIAAYACAAGAAgABgAIAAYACAAGAAgABgAIAAYACAAGA + AgABgAIAAYACAAGAAgABgAIAA/8qAAb/MAAnwAn/AYACAAGAAgABgAIAAYACAAGAAgABgAIAAYACAAGA + AgABgAIAAYACAAGAAgABgAIAAYACAAGAAgAG/ycACf8wACTADP8BgAIAAYACAAGAAgABgAIAAYACAAGA + AgABgAIAAYACAAGAAgABgAIAAYACAAGAAgABgAIACf8kAAz/MACQ/zAAkP8wAJD/MAABQgFNAT4HAAE+ + AwABKAMAAUADAAEQAwABAQEAAQEFAAGAFwAD/4EACw== + + + \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/TestFramework/MgdDbgTestFuncInfo.cs b/MgdDbgLibrary/ObjTests/TestFramework/MgdDbgTestFuncInfo.cs new file mode 100644 index 0000000..6b3a6f2 --- /dev/null +++ b/MgdDbgLibrary/ObjTests/TestFramework/MgdDbgTestFuncInfo.cs @@ -0,0 +1,124 @@ +// +// (C) Copyright 2005 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; + +namespace MgdDbg.ObjTests.TestFramework +{ + /// + /// This is a simple package of data about a given Test function. Create new instances + /// of this object and add it to a MgdDbgTestFuncInfo-derived class. + /// + + public class MgdDbgTestFuncInfo + { + public enum TestType + { + Create, + Modify, + Query, + Other + } + + public delegate void TestFunc(); + + private string m_label = null; // label that will appear as the Test name. E.g., "Rotate Elements 45 degrees" + private string m_desc = null; // Description string (if you want something longer than the Label to explain it) + private System.Type m_classType = null; // What point of the class hierarchy does it test (E.g., only Walls or any Element) + private TestFunc m_testFunc = null; // The actual function to call to perform the test + private string m_categoryStr = null; + private Boolean m_isCategoryBased = false; + private TestType m_testType; + + public + MgdDbgTestFuncInfo(string label, string desc, System.Type classType, TestFunc func, TestType tType) + { + m_label = label; + m_desc = desc; + m_classType = classType; + m_isCategoryBased = false; + m_testFunc = func; + m_testType = tType; + } + + public + MgdDbgTestFuncInfo(string label, string desc, string categoryStr, TestFunc func, TestType tType) + { + m_label = label; + m_desc = desc; + m_isCategoryBased = true; + m_categoryStr = categoryStr; + m_testFunc = func; + m_testType = tType; + } + + public string + Label + { + get { return m_label; } + set { m_label = value; } + } + + public string + Description + { + get { return m_desc; } + set { m_desc = value; } + } + + public System.Type + ClassType + { + get { return m_classType; } + set { m_classType = value; } + } + + public void + RunTest() + { + if (m_testFunc != null) + { + m_testFunc(); + } + } + + public string + Category + { + get { return m_categoryStr; } + set { m_categoryStr = value; } + } + + public Boolean + IsCategoryBased + { + get { return m_isCategoryBased; } + set { m_isCategoryBased = value; } + } + + public TestType + GetTestType() + { + return m_testType; + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/ObjTests/TestFramework/MgdDbgTestFuncs.cs b/MgdDbgLibrary/ObjTests/TestFramework/MgdDbgTestFuncs.cs new file mode 100644 index 0000000..3778d1a --- /dev/null +++ b/MgdDbgLibrary/ObjTests/TestFramework/MgdDbgTestFuncs.cs @@ -0,0 +1,64 @@ +// +// (C) Copyright 2005 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Collections; + +namespace MgdDbg.ObjTests.TestFramework +{ + /// + /// Summary description for MgdDbgTestFuncs. + /// + public abstract class MgdDbgTestFuncs + { + // TBD: public for now + public ArrayList m_testFrameworkFuncs = new ArrayList(); + + private static ArrayList m_testFuncs = new ArrayList(); + + // other modules can extend the tests available to the Test Framework UI + // by adding groups of TestFuncs here. Allocate them in your app's constructor + // and register them with this class. In your app's destructor, remove them + // from here and delete them. + public static void + AddTestFuncsToFramework(MgdDbgTestFuncs testFuncs) + { + m_testFuncs.Add(testFuncs); + } + + public static void + RemoveTestFuncsFromFramework(MgdDbgTestFuncs testFuncs) + { + m_testFuncs.Remove(testFuncs); + } + + protected + MgdDbgTestFuncs() + { + } + + public static ArrayList + RegisteredTestFuncs() + { + return m_testFuncs; + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Prompts/KeywordsForm.cs b/MgdDbgLibrary/Prompts/KeywordsForm.cs new file mode 100644 index 0000000..f23e171 --- /dev/null +++ b/MgdDbgLibrary/Prompts/KeywordsForm.cs @@ -0,0 +1,230 @@ +// $Header: //Desktop/Source/TestTools/MgdDbg/Prompts/KeywordsForm.cs#1 $ +// $Author: fergusja $ $DateTime: 2007/03/16 08:08:08 $ $Change: 68854 $ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.EditorInput; + +namespace MgdDbg.Prompts +{ + /// + /// Summary description for KeywordsForm. + /// + public class KeywordsForm : System.Windows.Forms.Form + { + private System.Windows.Forms.Button m_bnOK; + private System.Windows.Forms.Button m_bnCancel; + private System.Windows.Forms.Label m_label1; + private System.Windows.Forms.TextBox m_ebGlobal; + private System.Windows.Forms.Label m_label2; + private System.Windows.Forms.Label m_label3; + private System.Windows.Forms.TextBox m_ebLocal; + private System.Windows.Forms.TextBox m_ebDisplay; + private System.Windows.Forms.CheckBox m_cbEnabled; + private System.Windows.Forms.CheckBox m_cbVisible; + + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + private Keyword m_kword = null; + + public + KeywordsForm(Keyword kword) + { + m_kword = kword; + + InitializeComponent(); + + m_ebGlobal.Text = kword.GlobalName; + m_ebLocal.Text = kword.LocalName; + m_ebDisplay.Text = kword.DisplayName; + m_cbEnabled.Checked = kword.Enabled; + m_cbVisible.Checked = kword.Visible; + } + + /// + /// Clean up any resources being used. + /// + protected override void + Dispose(bool disposing) + { + if (disposing) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.m_bnOK = new System.Windows.Forms.Button(); + this.m_bnCancel = new System.Windows.Forms.Button(); + this.m_label1 = new System.Windows.Forms.Label(); + this.m_ebGlobal = new System.Windows.Forms.TextBox(); + this.m_label2 = new System.Windows.Forms.Label(); + this.m_label3 = new System.Windows.Forms.Label(); + this.m_ebLocal = new System.Windows.Forms.TextBox(); + this.m_ebDisplay = new System.Windows.Forms.TextBox(); + this.m_cbEnabled = new System.Windows.Forms.CheckBox(); + this.m_cbVisible = new System.Windows.Forms.CheckBox(); + this.SuspendLayout(); + // + // m_bnOK + // + this.m_bnOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnOK.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOK.Location = new System.Drawing.Point(83, 128); + this.m_bnOK.Name = "m_bnOK"; + this.m_bnOK.TabIndex = 0; + this.m_bnOK.Text = "OK"; + this.m_bnOK.Click += new System.EventHandler(this.OnOk); + // + // m_bnCancel + // + this.m_bnCancel.CausesValidation = false; + this.m_bnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnCancel.Location = new System.Drawing.Point(171, 128); + this.m_bnCancel.Name = "m_bnCancel"; + this.m_bnCancel.TabIndex = 1; + this.m_bnCancel.Text = "Cancel"; + // + // m_label1 + // + this.m_label1.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_label1.Location = new System.Drawing.Point(24, 24); + this.m_label1.Name = "m_label1"; + this.m_label1.Size = new System.Drawing.Size(48, 23); + this.m_label1.TabIndex = 2; + this.m_label1.Text = "Global"; + // + // m_ebGlobal + // + this.m_ebGlobal.Location = new System.Drawing.Point(88, 24); + this.m_ebGlobal.Name = "m_ebGlobal"; + this.m_ebGlobal.Size = new System.Drawing.Size(120, 20); + this.m_ebGlobal.TabIndex = 3; + this.m_ebGlobal.Text = ""; + // + // m_label2 + // + this.m_label2.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_label2.Location = new System.Drawing.Point(24, 48); + this.m_label2.Name = "m_label2"; + this.m_label2.Size = new System.Drawing.Size(48, 23); + this.m_label2.TabIndex = 4; + this.m_label2.Text = "Local"; + // + // m_label3 + // + this.m_label3.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_label3.Location = new System.Drawing.Point(24, 72); + this.m_label3.Name = "m_label3"; + this.m_label3.Size = new System.Drawing.Size(48, 23); + this.m_label3.TabIndex = 5; + this.m_label3.Text = "Display"; + // + // m_ebLocal + // + this.m_ebLocal.Location = new System.Drawing.Point(88, 48); + this.m_ebLocal.Name = "m_ebLocal"; + this.m_ebLocal.Size = new System.Drawing.Size(120, 20); + this.m_ebLocal.TabIndex = 6; + this.m_ebLocal.Text = ""; + // + // m_ebDisplay + // + this.m_ebDisplay.Location = new System.Drawing.Point(88, 72); + this.m_ebDisplay.Name = "m_ebDisplay"; + this.m_ebDisplay.Size = new System.Drawing.Size(120, 20); + this.m_ebDisplay.TabIndex = 7; + this.m_ebDisplay.Text = ""; + // + // m_cbEnabled + // + this.m_cbEnabled.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbEnabled.Location = new System.Drawing.Point(240, 24); + this.m_cbEnabled.Name = "m_cbEnabled"; + this.m_cbEnabled.Size = new System.Drawing.Size(72, 24); + this.m_cbEnabled.TabIndex = 8; + this.m_cbEnabled.Text = "Enabled"; + // + // m_cbVisible + // + this.m_cbVisible.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbVisible.Location = new System.Drawing.Point(240, 48); + this.m_cbVisible.Name = "m_cbVisible"; + this.m_cbVisible.Size = new System.Drawing.Size(64, 24); + this.m_cbVisible.TabIndex = 9; + this.m_cbVisible.Text = "Visible"; + // + // KeywordsForm + // + this.AcceptButton = this.m_bnOK; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_bnCancel; + this.ClientSize = new System.Drawing.Size(328, 166); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_cbVisible, + this.m_cbEnabled, + this.m_ebDisplay, + this.m_ebLocal, + this.m_label3, + this.m_label2, + this.m_ebGlobal, + this.m_label1, + this.m_bnCancel, + this.m_bnOK}); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "KeywordsForm"; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Key Word Settings"; + this.ResumeLayout(false); + } + + #endregion Windows Form Designer generated code + + private void + OnOk(object sender, System.EventArgs e) + { + m_kword.GlobalName = m_ebGlobal.Text; + m_kword.LocalName = m_ebLocal.Text; + m_kword.DisplayName = m_ebDisplay.Text; + m_kword.Enabled = m_cbEnabled.Checked; + m_kword.Visible = m_cbVisible.Checked; + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Prompts/KeywordsForm.resx b/MgdDbgLibrary/Prompts/KeywordsForm.resx new file mode 100644 index 0000000..c8c0d8a --- /dev/null +++ b/MgdDbgLibrary/Prompts/KeywordsForm.resx @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + KeywordsForm + + \ No newline at end of file diff --git a/MgdDbgLibrary/Prompts/PromptTestForm.cs b/MgdDbgLibrary/Prompts/PromptTestForm.cs new file mode 100644 index 0000000..5b94056 --- /dev/null +++ b/MgdDbgLibrary/Prompts/PromptTestForm.cs @@ -0,0 +1,3216 @@ +// $Header: //Desktop/Source/TestTools/MgdDbg/Prompts/PromptTestForm.cs#1 $ +// $Author: fergusja $ $DateTime: 2007/03/16 08:08:08 $ $Change: 68854 $ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Geometry; +using System.Diagnostics; +using System.Windows.Forms; + +namespace MgdDbg.Prompts +{ + /// + /// Summary description for PromptTestForm. + /// + public class PromptTestForm : System.Windows.Forms.Form + { + // Tab page for each type of prompt + private System.Windows.Forms.TabControl m_tcMain; + + private System.Windows.Forms.TabPage m_tpInteger; + private System.Windows.Forms.TabPage m_tpDouble; + private System.Windows.Forms.TabPage m_tpDistance; + private System.Windows.Forms.TabPage m_tpAngle; + private System.Windows.Forms.TabPage m_tpCorner; + private System.Windows.Forms.TabPage m_tpPoint; + private System.Windows.Forms.TabPage m_tpString; + private System.Windows.Forms.TabPage m_tpKeyword; + private System.Windows.Forms.TabPage m_tpEntity; + private System.Windows.Forms.TabPage m_tpNested; + + // controls for each page + private System.Windows.Forms.GroupBox m_gbOptionsInt; + + private System.Windows.Forms.Label m_txtMessage; + private System.Windows.Forms.CheckBox m_cbIntAllowArbitraryInput; + private System.Windows.Forms.CheckBox m_cbIntAllowNone; + private System.Windows.Forms.CheckBox m_cbIntAllowZero; + private System.Windows.Forms.CheckBox m_cbIntAllowNegative; + private System.Windows.Forms.TextBox m_ebIntMessage; + private System.Windows.Forms.CheckBox m_cbIntUseDefault; + private System.Windows.Forms.TextBox m_ebIntDefault; + private System.Windows.Forms.Label m_txtIntDefault; + private System.Windows.Forms.Button m_bnRunTest; + private System.Windows.Forms.Button m_bnCancel; + private System.Windows.Forms.GroupBox m_gbKeywords; + private System.Windows.Forms.ListView m_lvIntKeywords; + private System.Windows.Forms.ColumnHeader m_lvColKwordGlobal; + private System.Windows.Forms.ColumnHeader m_lvColKwordLocal; + private System.Windows.Forms.ColumnHeader m_lvColKwordDisplay; + private System.Windows.Forms.ColumnHeader m_lvColKwordEnabled; + private System.Windows.Forms.ColumnHeader m_lvColKwordVisible; + private System.Windows.Forms.Button m_bnIntKwordHardwire; + private System.Windows.Forms.Button m_bnIntKwordAdd; + private System.Windows.Forms.Button m_bnIntKwordEdit; + private System.Windows.Forms.Button m_bnIntKwordClear; + private System.Windows.Forms.Label m_txtIntKwordDef; + private System.Windows.Forms.TextBox m_ebIntKwordDef; + + private System.Windows.Forms.GroupBox m_gbDblOpts; + private System.Windows.Forms.TextBox m_ebDblDefault; + private System.Windows.Forms.Label m_txtDblDefault; + private System.Windows.Forms.CheckBox m_cbDblUseDefault; + private System.Windows.Forms.CheckBox m_cbDblAllowNegative; + private System.Windows.Forms.CheckBox m_cbDblAllowZero; + private System.Windows.Forms.CheckBox m_cbDblAllowNone; + private System.Windows.Forms.CheckBox m_cbDblAllowArbitraryInput; + private System.Windows.Forms.Label m_txtDblMessage; + private System.Windows.Forms.TextBox m_ebDblMessage; + private System.Windows.Forms.GroupBox m_gbDblKwords; + private System.Windows.Forms.Button m_bnDblKwordClear; + private System.Windows.Forms.Button m_bnDblKwordEdit; + private System.Windows.Forms.Button m_bnDblKwordAdd; + private System.Windows.Forms.ListView m_lvDblKwords; + private System.Windows.Forms.ColumnHeader m_lvColDblGlobal; + private System.Windows.Forms.ColumnHeader m_lvColDblLocal; + private System.Windows.Forms.ColumnHeader m_lvColDblDisplay; + private System.Windows.Forms.ColumnHeader m_lvColDblEnabled; + private System.Windows.Forms.ColumnHeader m_lvColDblVisible; + private System.Windows.Forms.TextBox m_ebDblKwordDef; + private System.Windows.Forms.Label m_txtDblKwordDef; + private System.Windows.Forms.Button m_bnDblKwordHardwire; + + private System.Windows.Forms.GroupBox m_gbDistKwords; + private System.Windows.Forms.Button m_bnDistKwordClear; + private System.Windows.Forms.Button m_bnDistKwordEdit; + private System.Windows.Forms.Button m_bnDistKwordAdd; + private System.Windows.Forms.ListView m_lvDistKwords; + private System.Windows.Forms.ColumnHeader m_lvColDistGlobal; + private System.Windows.Forms.ColumnHeader m_lvColDistLocal; + private System.Windows.Forms.ColumnHeader m_lvColDistDisplay; + private System.Windows.Forms.ColumnHeader m_lvColDistEnabled; + private System.Windows.Forms.ColumnHeader m_lvColDistVisible; + private System.Windows.Forms.GroupBox m_gbDistOptions; + private System.Windows.Forms.TextBox m_ebDistDefault; + private System.Windows.Forms.Label m_txtDistDefault; + private System.Windows.Forms.CheckBox m_cbDistUseDefault; + private System.Windows.Forms.CheckBox m_cbDistAllowNegative; + private System.Windows.Forms.CheckBox m_cbDistAllowZero; + private System.Windows.Forms.CheckBox m_cbDistAllowNone; + private System.Windows.Forms.CheckBox m_cbDistAllowArbitraryInput; + private System.Windows.Forms.CheckBox m_cbDistUseDashedLine; + private System.Windows.Forms.CheckBox m_cbDistUseBasePt; + private System.Windows.Forms.CheckBox m_cbDistOnly2d; + private System.Windows.Forms.Label m_txtDistMessage; + private System.Windows.Forms.TextBox m_ebDistMessage; + private System.Windows.Forms.Button m_bnDistKwordHardwire; + private System.Windows.Forms.TextBox m_ebDistKwordDef; + private System.Windows.Forms.Label m_txtDistKwordDef; + + private System.Windows.Forms.Label m_txtAngMessage; + private System.Windows.Forms.TextBox m_ebAngMessage; + private System.Windows.Forms.GroupBox m_gbAngOptions; + private System.Windows.Forms.ColumnHeader m_lvColAngGlobal; + private System.Windows.Forms.ColumnHeader m_lvColAngLocal; + private System.Windows.Forms.ColumnHeader m_lvColAngDisplay; + private System.Windows.Forms.ColumnHeader m_lvColAngEnabled; + private System.Windows.Forms.ColumnHeader m_lvColAngVisible; + private System.Windows.Forms.GroupBox m_gbAngKwords; + private System.Windows.Forms.Button m_bnAngKwordClear; + private System.Windows.Forms.Button m_bnAngKwordEdit; + private System.Windows.Forms.Button m_bnAngKwordAdd; + private System.Windows.Forms.ListView m_lvAngKwords; + private System.Windows.Forms.CheckBox m_cbAngUseBasePt; + private System.Windows.Forms.CheckBox m_cbAngAllowZero; + private System.Windows.Forms.CheckBox m_cbAngAllowNone; + private System.Windows.Forms.CheckBox m_cbAngAllowArbitraryInput; + private System.Windows.Forms.TextBox m_ebAngDefault; + private System.Windows.Forms.Label m_txtAngDefault; + private System.Windows.Forms.CheckBox m_cbAngUseDashedLine; + private System.Windows.Forms.CheckBox m_cbAngUseDefault; + private System.Windows.Forms.Button m_bnAngKwordHardwire; + private System.Windows.Forms.TextBox m_ebAngKwordDef; + private System.Windows.Forms.Label m_txtAngKwordDef; + + private System.Windows.Forms.GroupBox m_gbCrnOptions; + private System.Windows.Forms.CheckBox m_cbCrnUseDashedLine; + private System.Windows.Forms.CheckBox m_cbCrnAllowNone; + private System.Windows.Forms.CheckBox m_cbCrnAllowArbitraryInput; + private System.Windows.Forms.ColumnHeader m_lvColCrnGlobal; + private System.Windows.Forms.ColumnHeader m_lvColCrnLocal; + private System.Windows.Forms.ColumnHeader m_lvColCrnDisplay; + private System.Windows.Forms.ColumnHeader m_lvColCrnEnabled; + private System.Windows.Forms.ColumnHeader m_lvColCrnVisible; + private System.Windows.Forms.GroupBox m_gbCrnKwords; + private System.Windows.Forms.Button m_bnCrnKwordClear; + private System.Windows.Forms.Button m_bnCrnKwordEdit; + private System.Windows.Forms.Button m_bnCrnKwordAdd; + private System.Windows.Forms.ListView m_lvCrnKwords; + private System.Windows.Forms.TextBox m_ebCrnMessage; + private System.Windows.Forms.Label m_txtCrnMessage; + private System.Windows.Forms.CheckBox m_cbCrnLimitsChecked; + private System.Windows.Forms.Button m_bnCrnKwordHardwire; + private System.Windows.Forms.TextBox m_ebCrnKwordDef; + private System.Windows.Forms.Label m_txtCrnKwordDef; + + private System.Windows.Forms.GroupBox m_gbPtOptions; + private System.Windows.Forms.CheckBox m_cbPtUseDashedLine; + private System.Windows.Forms.CheckBox m_cbPtLimitsChecked; + private System.Windows.Forms.CheckBox m_cbPtAllowNone; + private System.Windows.Forms.CheckBox m_cbPtAllowArbitraryInput; + private System.Windows.Forms.GroupBox m_gbPtKwords; + private System.Windows.Forms.Button m_bnPtKwordClear; + private System.Windows.Forms.Button m_bnPtKwordEdit; + private System.Windows.Forms.Button m_bnPtKwordAdd; + private System.Windows.Forms.ListView m_lvPtKwords; + private System.Windows.Forms.ColumnHeader m_lvColPtGlobal; + private System.Windows.Forms.ColumnHeader m_lvColPtLocal; + private System.Windows.Forms.ColumnHeader m_lvColPtDisplay; + private System.Windows.Forms.ColumnHeader m_lvColPtEnabled; + private System.Windows.Forms.ColumnHeader m_lvColPtVisible; + private System.Windows.Forms.TextBox m_ebPtMessage; + private System.Windows.Forms.Label m_txtPtMessage; + private System.Windows.Forms.CheckBox m_cbPtUseBasePt; + private System.Windows.Forms.Button m_bnPtKwordHardwire; + private System.Windows.Forms.TextBox m_ebPtKwordDef; + private System.Windows.Forms.Label m_txtPtKwordDef; + + private System.Windows.Forms.GroupBox m_gbStrOptions; + private System.Windows.Forms.CheckBox m_cbStrAllowSpaces; + private System.Windows.Forms.TextBox m_ebStrMessage; + private System.Windows.Forms.Label m_txtStrMessage; + + private System.Windows.Forms.GroupBox m_gbKwdOptions; + private System.Windows.Forms.CheckBox m_cbKwdAllowArbitraryInput; + private System.Windows.Forms.CheckBox m_cbKwdAllowNone; + private System.Windows.Forms.GroupBox m_gbKwdKwords; + private System.Windows.Forms.Button m_bnKwdKwordClear; + private System.Windows.Forms.Button m_bnKwdKwordEdit; + private System.Windows.Forms.Button m_bnKwdKwordAdd; + private System.Windows.Forms.ListView m_lvKwdKwords; + private System.Windows.Forms.ColumnHeader m_lvColKwdGlobal; + private System.Windows.Forms.ColumnHeader m_lvColKwdLocal; + private System.Windows.Forms.ColumnHeader m_lvColKwdDisplay; + private System.Windows.Forms.ColumnHeader m_lvColKwdEnabled; + private System.Windows.Forms.ColumnHeader m_lvColKwdVisible; + private System.Windows.Forms.TextBox m_ebKwdMessage; + private System.Windows.Forms.Label m_txtKwdMessage; + private System.Windows.Forms.Button m_bnKwdKwordHardwire; + private System.Windows.Forms.TextBox m_ebKwdKwordDef; + private System.Windows.Forms.Label m_txtKwdKwordDef; + + private System.Windows.Forms.GroupBox m_gbEntOptions; + private System.Windows.Forms.CheckBox m_cbEntAllowNone; + private System.Windows.Forms.TextBox m_ebEntMessage; + private System.Windows.Forms.Label m_txtEntMessage; + private System.Windows.Forms.GroupBox m_gbEntKwords; + private System.Windows.Forms.Button m_bnEntKwordClear; + private System.Windows.Forms.Button m_bnEntKwordEdit; + private System.Windows.Forms.Button m_bnEntKwordAdd; + private System.Windows.Forms.ListView m_lvEntKwords; + private System.Windows.Forms.ColumnHeader m_lvColEntKwordGlobal; + private System.Windows.Forms.ColumnHeader m_lvColEntKwordLocal; + private System.Windows.Forms.ColumnHeader m_lvColEntKwordDisplay; + private System.Windows.Forms.ColumnHeader m_lvColEntKwordEnabled; + private System.Windows.Forms.ColumnHeader m_lvColEntKwordVisible; + private System.Windows.Forms.Button m_bnEntKwordHardwire; + private System.Windows.Forms.TextBox m_ebEntKwordDef; + private System.Windows.Forms.Label m_txtEntKwordDef; + private System.Windows.Forms.GroupBox m_gbEntFilterClasses; + private System.Windows.Forms.CheckBox m_ebEntDoIsATest; + private System.Windows.Forms.CheckBox m_cbEntAllowCircles; + private System.Windows.Forms.CheckBox m_cbEntAllowLines; + private System.Windows.Forms.TextBox m_ebEntRejectMessage; + private System.Windows.Forms.Label m_txtEntRejectMessage; + private System.Windows.Forms.Label m_txtEntSampleFilter; + private System.Windows.Forms.CheckBox m_cbEntAllowCurves; + private System.Windows.Forms.CheckBox m_cbEntAllowLockedLayer; + + private System.Windows.Forms.GroupBox m_gbNentKwords; + private System.Windows.Forms.Button m_bnNentKwordHardwire; + private System.Windows.Forms.TextBox m_ebNentKwordDef; + private System.Windows.Forms.Label m_txtNentKwordDef; + private System.Windows.Forms.Button m_bnNentKwordClear; + private System.Windows.Forms.Button m_bnNentKwordEdit; + private System.Windows.Forms.Button m_bnNentKwordAdd; + private System.Windows.Forms.ListView m_lvNentKwords; + private System.Windows.Forms.ColumnHeader m_lvColNentKwordsGlobal; + private System.Windows.Forms.ColumnHeader m_lvColNentKwordsLocal; + private System.Windows.Forms.ColumnHeader m_lvColNentKwordsDisplay; + private System.Windows.Forms.ColumnHeader m_lvColNentKwordsEnabled; + private System.Windows.Forms.ColumnHeader m_lvColNentKwordsVisible; + private System.Windows.Forms.GroupBox m_gbNentOptions; + private System.Windows.Forms.CheckBox m_cbNentAllowNone; + private System.Windows.Forms.TextBox m_ebNentMessage; + private System.Windows.Forms.Label m_txtNentMessage; + private System.Windows.Forms.CheckBox m_cbNentNonInterPickPt; + + private System.ComponentModel.Container components = null; + + // we're keeping a separate keyword collection for each page. + // Not sure I had to, but I wanted each prompt to be easy and + // quick to test. + private KeywordCollection m_kwordsInt = new KeywordCollection(); + + private KeywordCollection m_kwordsDbl = new KeywordCollection(); + private KeywordCollection m_kwordsDist = new KeywordCollection(); + private KeywordCollection m_kwordsAng = new KeywordCollection(); + private KeywordCollection m_kwordsCrn = new KeywordCollection(); + private KeywordCollection m_kwordsPt = new KeywordCollection(); + private KeywordCollection m_kwordsKwd = new KeywordCollection(); + private KeywordCollection m_kwordsEnt = new KeywordCollection(); + private KeywordCollection m_kwordsNent = new KeywordCollection(); + + public + PromptTestForm() + { + InitializeComponent(); + + // hook up the backing data with controls so that we + // can deal with them generically later when we get + // event notification for the keywords on each page. + m_lvIntKeywords.Tag = m_kwordsInt; + m_bnIntKwordAdd.Tag = m_lvIntKeywords; + m_bnIntKwordEdit.Tag = m_lvIntKeywords; + m_bnIntKwordClear.Tag = m_lvIntKeywords; + m_bnIntKwordHardwire.Tag = m_lvIntKeywords; + + m_lvDblKwords.Tag = m_kwordsDbl; + m_bnDblKwordAdd.Tag = m_lvDblKwords; + m_bnDblKwordEdit.Tag = m_lvDblKwords; + m_bnDblKwordClear.Tag = m_lvDblKwords; + m_bnDblKwordHardwire.Tag = m_lvDblKwords; + + m_lvDistKwords.Tag = m_kwordsDist; + m_bnDistKwordAdd.Tag = m_lvDistKwords; + m_bnDistKwordEdit.Tag = m_lvDistKwords; + m_bnDistKwordClear.Tag = m_lvDistKwords; + m_bnDistKwordHardwire.Tag = m_lvDistKwords; + + m_lvAngKwords.Tag = m_kwordsAng; + m_bnAngKwordAdd.Tag = m_lvAngKwords; + m_bnAngKwordEdit.Tag = m_lvAngKwords; + m_bnAngKwordClear.Tag = m_lvAngKwords; + m_bnAngKwordHardwire.Tag = m_lvAngKwords; + + m_lvCrnKwords.Tag = m_kwordsCrn; + m_bnCrnKwordAdd.Tag = m_lvCrnKwords; + m_bnCrnKwordEdit.Tag = m_lvCrnKwords; + m_bnCrnKwordClear.Tag = m_lvCrnKwords; + m_bnCrnKwordHardwire.Tag = m_lvCrnKwords; + + m_lvPtKwords.Tag = m_kwordsPt; + m_bnPtKwordAdd.Tag = m_lvPtKwords; + m_bnPtKwordEdit.Tag = m_lvPtKwords; + m_bnPtKwordClear.Tag = m_lvPtKwords; + m_bnPtKwordHardwire.Tag = m_lvPtKwords; + + m_lvKwdKwords.Tag = m_kwordsKwd; + m_bnKwdKwordAdd.Tag = m_lvKwdKwords; + m_bnKwdKwordEdit.Tag = m_lvKwdKwords; + m_bnKwdKwordClear.Tag = m_lvKwdKwords; + m_bnKwdKwordHardwire.Tag = m_lvKwdKwords; + + m_lvEntKwords.Tag = m_kwordsEnt; + m_bnEntKwordAdd.Tag = m_lvEntKwords; + m_bnEntKwordEdit.Tag = m_lvEntKwords; + m_bnEntKwordClear.Tag = m_lvEntKwords; + m_bnEntKwordHardwire.Tag = m_lvEntKwords; + + m_lvNentKwords.Tag = m_kwordsNent; + m_bnNentKwordAdd.Tag = m_lvNentKwords; + m_bnNentKwordEdit.Tag = m_lvNentKwords; + m_bnNentKwordClear.Tag = m_lvNentKwords; + m_bnNentKwordHardwire.Tag = m_lvNentKwords; + + // allocate a new PromptOptions and set the initial dialog + // state to these values. This way, we can see what the defaults + // are if you don't change any of the standard settings. + + // PromptInteger + PromptIntegerOptions prOptInt = new PromptIntegerOptions(""); + m_cbIntAllowArbitraryInput.Checked = prOptInt.AllowArbitraryInput; + m_cbIntAllowNone.Checked = prOptInt.AllowNone; + m_cbIntAllowZero.Checked = prOptInt.AllowZero; + m_cbIntAllowNegative.Checked = prOptInt.AllowNegative; + m_cbIntUseDefault.Checked = prOptInt.UseDefaultValue; + m_ebIntDefault.Enabled = prOptInt.UseDefaultValue; + m_ebIntDefault.Text = 0.ToString(); + + // PromptDouble + PromptDoubleOptions prOptDbl = new PromptDoubleOptions(""); + m_cbDblAllowArbitraryInput.Checked = prOptDbl.AllowArbitraryInput; + m_cbDblAllowNone.Checked = prOptDbl.AllowNone; + m_cbDblAllowZero.Checked = prOptDbl.AllowZero; + m_cbDblAllowNegative.Checked = prOptDbl.AllowNegative; + m_cbDblUseDefault.Checked = prOptDbl.UseDefaultValue; + m_ebDblDefault.Enabled = prOptDbl.UseDefaultValue; + m_ebDblDefault.Text = 0.0.ToString(); + + // PromptDistance + PromptDistanceOptions prOptDist = new PromptDistanceOptions(""); + m_cbDistAllowArbitraryInput.Checked = prOptDist.AllowArbitraryInput; + m_cbDistAllowNone.Checked = prOptDist.AllowNone; + m_cbDistAllowZero.Checked = prOptDist.AllowZero; + m_cbDistAllowNegative.Checked = prOptDist.AllowNegative; + m_cbDistUseBasePt.Checked = prOptDist.UseBasePoint; + m_cbDistUseDashedLine.Checked = prOptDist.UseDashedLine; + m_cbDistOnly2d.Checked = prOptDist.Only2d; + m_cbDistUseDefault.Checked = prOptDist.UseDefaultValue; + m_ebDistDefault.Enabled = prOptDist.UseDefaultValue; + m_ebDistDefault.Text = 0.0.ToString(); + + // PromptAngle + PromptAngleOptions prOptAng = new PromptAngleOptions(""); + m_cbAngAllowArbitraryInput.Checked = prOptAng.AllowArbitraryInput; + m_cbAngAllowNone.Checked = prOptAng.AllowNone; + m_cbAngAllowZero.Checked = prOptAng.AllowZero; + m_cbAngUseBasePt.Checked = prOptAng.UseBasePoint; + m_cbAngUseDashedLine.Checked = prOptAng.UseDashedLine; + m_cbAngUseDefault.Checked = prOptAng.UseDefaultValue; + m_ebAngDefault.Enabled = prOptAng.UseDefaultValue; + m_ebAngDefault.Text = 0.0.ToString(); + + // PromptCorner + PromptCornerOptions prOptCrn = new PromptCornerOptions("", new Point3d(0.0, 0.0, 0.0)); + m_cbCrnAllowArbitraryInput.Checked = prOptCrn.AllowArbitraryInput; + m_cbCrnAllowNone.Checked = prOptCrn.AllowNone; + m_cbCrnLimitsChecked.Checked = prOptCrn.LimitsChecked; + m_cbCrnUseDashedLine.Checked = prOptCrn.UseDashedLine; + + // PromptPoint + PromptPointOptions prOptPt = new PromptPointOptions(""); + m_cbPtAllowArbitraryInput.Checked = prOptPt.AllowArbitraryInput; + m_cbPtAllowNone.Checked = prOptPt.AllowNone; + m_cbPtLimitsChecked.Checked = prOptPt.LimitsChecked; + m_cbPtUseDashedLine.Checked = prOptPt.UseDashedLine; + m_cbPtUseBasePt.Checked = prOptPt.UseBasePoint; + + // PromptString + PromptStringOptions prOptStr = new PromptStringOptions(""); + m_cbStrAllowSpaces.Checked = prOptStr.AllowSpaces; + + // PromptKeyword + PromptKeywordOptions prOptKwd = new PromptKeywordOptions(""); + m_cbKwdAllowArbitraryInput.Checked = prOptKwd.AllowArbitraryInput; + m_cbKwdAllowNone.Checked = prOptKwd.AllowNone; + + // PromptEntity + PromptEntityOptions prOptEnt = new PromptEntityOptions(""); + m_cbEntAllowNone.Checked = prOptEnt.AllowNone; + + // PromptNestedEntity + PromptNestedEntityOptions prOptNent = new PromptNestedEntityOptions(""); + m_cbNentAllowNone.Checked = prOptNent.AllowNone; + m_cbNentNonInterPickPt.Checked = prOptNent.UseNonInteractivePickPoint; + } + + /// + /// Clean up any resources being used. + /// + protected override void + Dispose(bool disposing) + { + if (disposing) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.m_tcMain = new System.Windows.Forms.TabControl(); + this.m_tpInteger = new System.Windows.Forms.TabPage(); + this.m_gbKeywords = new System.Windows.Forms.GroupBox(); + this.m_ebIntKwordDef = new System.Windows.Forms.TextBox(); + this.m_txtIntKwordDef = new System.Windows.Forms.Label(); + this.m_bnIntKwordHardwire = new System.Windows.Forms.Button(); + this.m_bnIntKwordClear = new System.Windows.Forms.Button(); + this.m_bnIntKwordEdit = new System.Windows.Forms.Button(); + this.m_bnIntKwordAdd = new System.Windows.Forms.Button(); + this.m_lvIntKeywords = new System.Windows.Forms.ListView(); + this.m_lvColKwordGlobal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColKwordLocal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColKwordDisplay = new System.Windows.Forms.ColumnHeader(); + this.m_lvColKwordEnabled = new System.Windows.Forms.ColumnHeader(); + this.m_lvColKwordVisible = new System.Windows.Forms.ColumnHeader(); + this.m_gbOptionsInt = new System.Windows.Forms.GroupBox(); + this.m_ebIntDefault = new System.Windows.Forms.TextBox(); + this.m_txtIntDefault = new System.Windows.Forms.Label(); + this.m_cbIntUseDefault = new System.Windows.Forms.CheckBox(); + this.m_cbIntAllowNegative = new System.Windows.Forms.CheckBox(); + this.m_cbIntAllowZero = new System.Windows.Forms.CheckBox(); + this.m_cbIntAllowNone = new System.Windows.Forms.CheckBox(); + this.m_cbIntAllowArbitraryInput = new System.Windows.Forms.CheckBox(); + this.m_txtMessage = new System.Windows.Forms.Label(); + this.m_ebIntMessage = new System.Windows.Forms.TextBox(); + this.m_tpDouble = new System.Windows.Forms.TabPage(); + this.m_gbDblKwords = new System.Windows.Forms.GroupBox(); + this.m_bnDblKwordHardwire = new System.Windows.Forms.Button(); + this.m_ebDblKwordDef = new System.Windows.Forms.TextBox(); + this.m_txtDblKwordDef = new System.Windows.Forms.Label(); + this.m_bnDblKwordClear = new System.Windows.Forms.Button(); + this.m_bnDblKwordEdit = new System.Windows.Forms.Button(); + this.m_bnDblKwordAdd = new System.Windows.Forms.Button(); + this.m_lvDblKwords = new System.Windows.Forms.ListView(); + this.m_lvColDblGlobal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColDblLocal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColDblDisplay = new System.Windows.Forms.ColumnHeader(); + this.m_lvColDblEnabled = new System.Windows.Forms.ColumnHeader(); + this.m_lvColDblVisible = new System.Windows.Forms.ColumnHeader(); + this.m_gbDblOpts = new System.Windows.Forms.GroupBox(); + this.m_ebDblDefault = new System.Windows.Forms.TextBox(); + this.m_txtDblDefault = new System.Windows.Forms.Label(); + this.m_cbDblUseDefault = new System.Windows.Forms.CheckBox(); + this.m_cbDblAllowNegative = new System.Windows.Forms.CheckBox(); + this.m_cbDblAllowZero = new System.Windows.Forms.CheckBox(); + this.m_cbDblAllowNone = new System.Windows.Forms.CheckBox(); + this.m_cbDblAllowArbitraryInput = new System.Windows.Forms.CheckBox(); + this.m_txtDblMessage = new System.Windows.Forms.Label(); + this.m_ebDblMessage = new System.Windows.Forms.TextBox(); + this.m_tpDistance = new System.Windows.Forms.TabPage(); + this.m_gbDistKwords = new System.Windows.Forms.GroupBox(); + this.m_bnDistKwordHardwire = new System.Windows.Forms.Button(); + this.m_ebDistKwordDef = new System.Windows.Forms.TextBox(); + this.m_txtDistKwordDef = new System.Windows.Forms.Label(); + this.m_bnDistKwordClear = new System.Windows.Forms.Button(); + this.m_bnDistKwordEdit = new System.Windows.Forms.Button(); + this.m_bnDistKwordAdd = new System.Windows.Forms.Button(); + this.m_lvDistKwords = new System.Windows.Forms.ListView(); + this.m_lvColDistGlobal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColDistLocal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColDistDisplay = new System.Windows.Forms.ColumnHeader(); + this.m_lvColDistEnabled = new System.Windows.Forms.ColumnHeader(); + this.m_lvColDistVisible = new System.Windows.Forms.ColumnHeader(); + this.m_gbDistOptions = new System.Windows.Forms.GroupBox(); + this.m_cbDistOnly2d = new System.Windows.Forms.CheckBox(); + this.m_cbDistUseDashedLine = new System.Windows.Forms.CheckBox(); + this.m_cbDistUseBasePt = new System.Windows.Forms.CheckBox(); + this.m_ebDistDefault = new System.Windows.Forms.TextBox(); + this.m_txtDistDefault = new System.Windows.Forms.Label(); + this.m_cbDistUseDefault = new System.Windows.Forms.CheckBox(); + this.m_cbDistAllowNegative = new System.Windows.Forms.CheckBox(); + this.m_cbDistAllowZero = new System.Windows.Forms.CheckBox(); + this.m_cbDistAllowNone = new System.Windows.Forms.CheckBox(); + this.m_cbDistAllowArbitraryInput = new System.Windows.Forms.CheckBox(); + this.m_txtDistMessage = new System.Windows.Forms.Label(); + this.m_ebDistMessage = new System.Windows.Forms.TextBox(); + this.m_tpAngle = new System.Windows.Forms.TabPage(); + this.m_txtAngMessage = new System.Windows.Forms.Label(); + this.m_ebAngMessage = new System.Windows.Forms.TextBox(); + this.m_gbAngOptions = new System.Windows.Forms.GroupBox(); + this.m_cbAngUseDefault = new System.Windows.Forms.CheckBox(); + this.m_cbAngUseDashedLine = new System.Windows.Forms.CheckBox(); + this.m_ebAngDefault = new System.Windows.Forms.TextBox(); + this.m_txtAngDefault = new System.Windows.Forms.Label(); + this.m_cbAngUseBasePt = new System.Windows.Forms.CheckBox(); + this.m_cbAngAllowZero = new System.Windows.Forms.CheckBox(); + this.m_cbAngAllowNone = new System.Windows.Forms.CheckBox(); + this.m_cbAngAllowArbitraryInput = new System.Windows.Forms.CheckBox(); + this.m_gbAngKwords = new System.Windows.Forms.GroupBox(); + this.m_bnAngKwordHardwire = new System.Windows.Forms.Button(); + this.m_ebAngKwordDef = new System.Windows.Forms.TextBox(); + this.m_txtAngKwordDef = new System.Windows.Forms.Label(); + this.m_bnAngKwordClear = new System.Windows.Forms.Button(); + this.m_bnAngKwordEdit = new System.Windows.Forms.Button(); + this.m_bnAngKwordAdd = new System.Windows.Forms.Button(); + this.m_lvAngKwords = new System.Windows.Forms.ListView(); + this.m_lvColAngGlobal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColAngLocal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColAngDisplay = new System.Windows.Forms.ColumnHeader(); + this.m_lvColAngEnabled = new System.Windows.Forms.ColumnHeader(); + this.m_lvColAngVisible = new System.Windows.Forms.ColumnHeader(); + this.m_tpCorner = new System.Windows.Forms.TabPage(); + this.m_gbCrnOptions = new System.Windows.Forms.GroupBox(); + this.m_cbCrnUseDashedLine = new System.Windows.Forms.CheckBox(); + this.m_cbCrnLimitsChecked = new System.Windows.Forms.CheckBox(); + this.m_cbCrnAllowNone = new System.Windows.Forms.CheckBox(); + this.m_cbCrnAllowArbitraryInput = new System.Windows.Forms.CheckBox(); + this.m_gbCrnKwords = new System.Windows.Forms.GroupBox(); + this.m_bnCrnKwordHardwire = new System.Windows.Forms.Button(); + this.m_ebCrnKwordDef = new System.Windows.Forms.TextBox(); + this.m_txtCrnKwordDef = new System.Windows.Forms.Label(); + this.m_bnCrnKwordClear = new System.Windows.Forms.Button(); + this.m_bnCrnKwordEdit = new System.Windows.Forms.Button(); + this.m_bnCrnKwordAdd = new System.Windows.Forms.Button(); + this.m_lvCrnKwords = new System.Windows.Forms.ListView(); + this.m_lvColCrnGlobal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColCrnLocal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColCrnDisplay = new System.Windows.Forms.ColumnHeader(); + this.m_lvColCrnEnabled = new System.Windows.Forms.ColumnHeader(); + this.m_lvColCrnVisible = new System.Windows.Forms.ColumnHeader(); + this.m_ebCrnMessage = new System.Windows.Forms.TextBox(); + this.m_txtCrnMessage = new System.Windows.Forms.Label(); + this.m_tpPoint = new System.Windows.Forms.TabPage(); + this.m_gbPtOptions = new System.Windows.Forms.GroupBox(); + this.m_cbPtUseBasePt = new System.Windows.Forms.CheckBox(); + this.m_cbPtUseDashedLine = new System.Windows.Forms.CheckBox(); + this.m_cbPtLimitsChecked = new System.Windows.Forms.CheckBox(); + this.m_cbPtAllowNone = new System.Windows.Forms.CheckBox(); + this.m_cbPtAllowArbitraryInput = new System.Windows.Forms.CheckBox(); + this.m_gbPtKwords = new System.Windows.Forms.GroupBox(); + this.m_bnPtKwordHardwire = new System.Windows.Forms.Button(); + this.m_ebPtKwordDef = new System.Windows.Forms.TextBox(); + this.m_txtPtKwordDef = new System.Windows.Forms.Label(); + this.m_bnPtKwordClear = new System.Windows.Forms.Button(); + this.m_bnPtKwordEdit = new System.Windows.Forms.Button(); + this.m_bnPtKwordAdd = new System.Windows.Forms.Button(); + this.m_lvPtKwords = new System.Windows.Forms.ListView(); + this.m_lvColPtGlobal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColPtLocal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColPtDisplay = new System.Windows.Forms.ColumnHeader(); + this.m_lvColPtEnabled = new System.Windows.Forms.ColumnHeader(); + this.m_lvColPtVisible = new System.Windows.Forms.ColumnHeader(); + this.m_ebPtMessage = new System.Windows.Forms.TextBox(); + this.m_txtPtMessage = new System.Windows.Forms.Label(); + this.m_tpString = new System.Windows.Forms.TabPage(); + this.m_gbStrOptions = new System.Windows.Forms.GroupBox(); + this.m_cbStrAllowSpaces = new System.Windows.Forms.CheckBox(); + this.m_ebStrMessage = new System.Windows.Forms.TextBox(); + this.m_txtStrMessage = new System.Windows.Forms.Label(); + this.m_tpKeyword = new System.Windows.Forms.TabPage(); + this.m_gbKwdOptions = new System.Windows.Forms.GroupBox(); + this.m_cbKwdAllowArbitraryInput = new System.Windows.Forms.CheckBox(); + this.m_cbKwdAllowNone = new System.Windows.Forms.CheckBox(); + this.m_gbKwdKwords = new System.Windows.Forms.GroupBox(); + this.m_bnKwdKwordHardwire = new System.Windows.Forms.Button(); + this.m_ebKwdKwordDef = new System.Windows.Forms.TextBox(); + this.m_txtKwdKwordDef = new System.Windows.Forms.Label(); + this.m_bnKwdKwordClear = new System.Windows.Forms.Button(); + this.m_bnKwdKwordEdit = new System.Windows.Forms.Button(); + this.m_bnKwdKwordAdd = new System.Windows.Forms.Button(); + this.m_lvKwdKwords = new System.Windows.Forms.ListView(); + this.m_lvColKwdGlobal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColKwdLocal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColKwdDisplay = new System.Windows.Forms.ColumnHeader(); + this.m_lvColKwdEnabled = new System.Windows.Forms.ColumnHeader(); + this.m_lvColKwdVisible = new System.Windows.Forms.ColumnHeader(); + this.m_ebKwdMessage = new System.Windows.Forms.TextBox(); + this.m_txtKwdMessage = new System.Windows.Forms.Label(); + this.m_tpEntity = new System.Windows.Forms.TabPage(); + this.m_gbEntFilterClasses = new System.Windows.Forms.GroupBox(); + this.m_cbEntAllowCurves = new System.Windows.Forms.CheckBox(); + this.m_txtEntSampleFilter = new System.Windows.Forms.Label(); + this.m_ebEntDoIsATest = new System.Windows.Forms.CheckBox(); + this.m_cbEntAllowCircles = new System.Windows.Forms.CheckBox(); + this.m_cbEntAllowLines = new System.Windows.Forms.CheckBox(); + this.m_ebEntRejectMessage = new System.Windows.Forms.TextBox(); + this.m_txtEntRejectMessage = new System.Windows.Forms.Label(); + this.m_gbEntKwords = new System.Windows.Forms.GroupBox(); + this.m_bnEntKwordHardwire = new System.Windows.Forms.Button(); + this.m_ebEntKwordDef = new System.Windows.Forms.TextBox(); + this.m_txtEntKwordDef = new System.Windows.Forms.Label(); + this.m_bnEntKwordClear = new System.Windows.Forms.Button(); + this.m_bnEntKwordEdit = new System.Windows.Forms.Button(); + this.m_bnEntKwordAdd = new System.Windows.Forms.Button(); + this.m_lvEntKwords = new System.Windows.Forms.ListView(); + this.m_lvColEntKwordGlobal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColEntKwordLocal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColEntKwordDisplay = new System.Windows.Forms.ColumnHeader(); + this.m_lvColEntKwordEnabled = new System.Windows.Forms.ColumnHeader(); + this.m_lvColEntKwordVisible = new System.Windows.Forms.ColumnHeader(); + this.m_gbEntOptions = new System.Windows.Forms.GroupBox(); + this.m_cbEntAllowLockedLayer = new System.Windows.Forms.CheckBox(); + this.m_cbEntAllowNone = new System.Windows.Forms.CheckBox(); + this.m_ebEntMessage = new System.Windows.Forms.TextBox(); + this.m_txtEntMessage = new System.Windows.Forms.Label(); + this.m_tpNested = new System.Windows.Forms.TabPage(); + this.m_gbNentKwords = new System.Windows.Forms.GroupBox(); + this.m_bnNentKwordHardwire = new System.Windows.Forms.Button(); + this.m_ebNentKwordDef = new System.Windows.Forms.TextBox(); + this.m_txtNentKwordDef = new System.Windows.Forms.Label(); + this.m_bnNentKwordClear = new System.Windows.Forms.Button(); + this.m_bnNentKwordEdit = new System.Windows.Forms.Button(); + this.m_bnNentKwordAdd = new System.Windows.Forms.Button(); + this.m_lvNentKwords = new System.Windows.Forms.ListView(); + this.m_lvColNentKwordsGlobal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColNentKwordsLocal = new System.Windows.Forms.ColumnHeader(); + this.m_lvColNentKwordsDisplay = new System.Windows.Forms.ColumnHeader(); + this.m_lvColNentKwordsEnabled = new System.Windows.Forms.ColumnHeader(); + this.m_lvColNentKwordsVisible = new System.Windows.Forms.ColumnHeader(); + this.m_gbNentOptions = new System.Windows.Forms.GroupBox(); + this.m_cbNentNonInterPickPt = new System.Windows.Forms.CheckBox(); + this.m_cbNentAllowNone = new System.Windows.Forms.CheckBox(); + this.m_ebNentMessage = new System.Windows.Forms.TextBox(); + this.m_txtNentMessage = new System.Windows.Forms.Label(); + this.m_bnRunTest = new System.Windows.Forms.Button(); + this.m_bnCancel = new System.Windows.Forms.Button(); + this.m_tcMain.SuspendLayout(); + this.m_tpInteger.SuspendLayout(); + this.m_gbKeywords.SuspendLayout(); + this.m_gbOptionsInt.SuspendLayout(); + this.m_tpDouble.SuspendLayout(); + this.m_gbDblKwords.SuspendLayout(); + this.m_gbDblOpts.SuspendLayout(); + this.m_tpDistance.SuspendLayout(); + this.m_gbDistKwords.SuspendLayout(); + this.m_gbDistOptions.SuspendLayout(); + this.m_tpAngle.SuspendLayout(); + this.m_gbAngOptions.SuspendLayout(); + this.m_gbAngKwords.SuspendLayout(); + this.m_tpCorner.SuspendLayout(); + this.m_gbCrnOptions.SuspendLayout(); + this.m_gbCrnKwords.SuspendLayout(); + this.m_tpPoint.SuspendLayout(); + this.m_gbPtOptions.SuspendLayout(); + this.m_gbPtKwords.SuspendLayout(); + this.m_tpString.SuspendLayout(); + this.m_gbStrOptions.SuspendLayout(); + this.m_tpKeyword.SuspendLayout(); + this.m_gbKwdOptions.SuspendLayout(); + this.m_gbKwdKwords.SuspendLayout(); + this.m_tpEntity.SuspendLayout(); + this.m_gbEntFilterClasses.SuspendLayout(); + this.m_gbEntKwords.SuspendLayout(); + this.m_gbEntOptions.SuspendLayout(); + this.m_tpNested.SuspendLayout(); + this.m_gbNentKwords.SuspendLayout(); + this.m_gbNentOptions.SuspendLayout(); + this.SuspendLayout(); + // + // m_tcMain + // + this.m_tcMain.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_tpInteger, + this.m_tpDouble, + this.m_tpDistance, + this.m_tpAngle, + this.m_tpCorner, + this.m_tpPoint, + this.m_tpString, + this.m_tpKeyword, + this.m_tpEntity, + this.m_tpNested}); + this.m_tcMain.Location = new System.Drawing.Point(16, 16); + this.m_tcMain.Name = "m_tcMain"; + this.m_tcMain.SelectedIndex = 0; + this.m_tcMain.Size = new System.Drawing.Size(616, 344); + this.m_tcMain.TabIndex = 0; + this.m_tcMain.Click += new System.EventHandler(this.OnEntAllowLines); + // + // m_tpInteger + // + this.m_tpInteger.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_gbKeywords, + this.m_gbOptionsInt, + this.m_txtMessage, + this.m_ebIntMessage}); + this.m_tpInteger.Location = new System.Drawing.Point(4, 22); + this.m_tpInteger.Name = "m_tpInteger"; + this.m_tpInteger.Size = new System.Drawing.Size(608, 318); + this.m_tpInteger.TabIndex = 0; + this.m_tpInteger.Text = "Integer"; + // + // m_gbKeywords + // + this.m_gbKeywords.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_ebIntKwordDef, + this.m_txtIntKwordDef, + this.m_bnIntKwordHardwire, + this.m_bnIntKwordClear, + this.m_bnIntKwordEdit, + this.m_bnIntKwordAdd, + this.m_lvIntKeywords}); + this.m_gbKeywords.Location = new System.Drawing.Point(200, 48); + this.m_gbKeywords.Name = "m_gbKeywords"; + this.m_gbKeywords.Size = new System.Drawing.Size(392, 264); + this.m_gbKeywords.TabIndex = 2; + this.m_gbKeywords.TabStop = false; + this.m_gbKeywords.Text = "Key Words"; + // + // m_ebIntKwordDef + // + this.m_ebIntKwordDef.Location = new System.Drawing.Point(272, 232); + this.m_ebIntKwordDef.Name = "m_ebIntKwordDef"; + this.m_ebIntKwordDef.Size = new System.Drawing.Size(96, 20); + this.m_ebIntKwordDef.TabIndex = 6; + this.m_ebIntKwordDef.Text = ""; + // + // m_txtIntKwordDef + // + this.m_txtIntKwordDef.Location = new System.Drawing.Point(216, 232); + this.m_txtIntKwordDef.Name = "m_txtIntKwordDef"; + this.m_txtIntKwordDef.Size = new System.Drawing.Size(48, 23); + this.m_txtIntKwordDef.TabIndex = 5; + this.m_txtIntKwordDef.Text = "Default"; + // + // m_bnIntKwordHardwire + // + this.m_bnIntKwordHardwire.Location = new System.Drawing.Point(24, 200); + this.m_bnIntKwordHardwire.Name = "m_bnIntKwordHardwire"; + this.m_bnIntKwordHardwire.Size = new System.Drawing.Size(88, 23); + this.m_bnIntKwordHardwire.TabIndex = 4; + this.m_bnIntKwordHardwire.Text = "Hardwire"; + this.m_bnIntKwordHardwire.Click += new System.EventHandler(this.OnKwordHardwire); + // + // m_bnIntKwordClear + // + this.m_bnIntKwordClear.Location = new System.Drawing.Point(296, 200); + this.m_bnIntKwordClear.Name = "m_bnIntKwordClear"; + this.m_bnIntKwordClear.TabIndex = 3; + this.m_bnIntKwordClear.Text = "Clear"; + this.m_bnIntKwordClear.Click += new System.EventHandler(this.OnKwordClear); + // + // m_bnIntKwordEdit + // + this.m_bnIntKwordEdit.Location = new System.Drawing.Point(208, 200); + this.m_bnIntKwordEdit.Name = "m_bnIntKwordEdit"; + this.m_bnIntKwordEdit.TabIndex = 2; + this.m_bnIntKwordEdit.Text = "Edit..."; + this.m_bnIntKwordEdit.Click += new System.EventHandler(this.OnKwordEdit); + // + // m_bnIntKwordAdd + // + this.m_bnIntKwordAdd.Location = new System.Drawing.Point(120, 200); + this.m_bnIntKwordAdd.Name = "m_bnIntKwordAdd"; + this.m_bnIntKwordAdd.TabIndex = 1; + this.m_bnIntKwordAdd.Text = "Add..."; + this.m_bnIntKwordAdd.Click += new System.EventHandler(this.OnKwordAdd); + // + // m_lvIntKeywords + // + this.m_lvIntKeywords.CausesValidation = false; + this.m_lvIntKeywords.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvColKwordGlobal, + this.m_lvColKwordLocal, + this.m_lvColKwordDisplay, + this.m_lvColKwordEnabled, + this.m_lvColKwordVisible}); + this.m_lvIntKeywords.FullRowSelect = true; + this.m_lvIntKeywords.GridLines = true; + this.m_lvIntKeywords.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvIntKeywords.HideSelection = false; + this.m_lvIntKeywords.Location = new System.Drawing.Point(16, 24); + this.m_lvIntKeywords.MultiSelect = false; + this.m_lvIntKeywords.Name = "m_lvIntKeywords"; + this.m_lvIntKeywords.Size = new System.Drawing.Size(360, 168); + this.m_lvIntKeywords.TabIndex = 0; + this.m_lvIntKeywords.View = System.Windows.Forms.View.Details; + // + // m_lvColKwordGlobal + // + this.m_lvColKwordGlobal.Text = "Global"; + this.m_lvColKwordGlobal.Width = 80; + // + // m_lvColKwordLocal + // + this.m_lvColKwordLocal.Text = "Local"; + this.m_lvColKwordLocal.Width = 80; + // + // m_lvColKwordDisplay + // + this.m_lvColKwordDisplay.Text = "Display"; + this.m_lvColKwordDisplay.Width = 80; + // + // m_lvColKwordEnabled + // + this.m_lvColKwordEnabled.Text = "Enabled"; + // + // m_lvColKwordVisible + // + this.m_lvColKwordVisible.Text = "Visible"; + // + // m_gbOptionsInt + // + this.m_gbOptionsInt.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_ebIntDefault, + this.m_txtIntDefault, + this.m_cbIntUseDefault, + this.m_cbIntAllowNegative, + this.m_cbIntAllowZero, + this.m_cbIntAllowNone, + this.m_cbIntAllowArbitraryInput}); + this.m_gbOptionsInt.Location = new System.Drawing.Point(16, 48); + this.m_gbOptionsInt.Name = "m_gbOptionsInt"; + this.m_gbOptionsInt.Size = new System.Drawing.Size(168, 264); + this.m_gbOptionsInt.TabIndex = 0; + this.m_gbOptionsInt.TabStop = false; + this.m_gbOptionsInt.Text = "Options"; + // + // m_ebIntDefault + // + this.m_ebIntDefault.Location = new System.Drawing.Point(64, 152); + this.m_ebIntDefault.Name = "m_ebIntDefault"; + this.m_ebIntDefault.Size = new System.Drawing.Size(88, 20); + this.m_ebIntDefault.TabIndex = 6; + this.m_ebIntDefault.Text = ""; + // + // m_txtIntDefault + // + this.m_txtIntDefault.Location = new System.Drawing.Point(8, 152); + this.m_txtIntDefault.Name = "m_txtIntDefault"; + this.m_txtIntDefault.Size = new System.Drawing.Size(56, 23); + this.m_txtIntDefault.TabIndex = 5; + this.m_txtIntDefault.Text = "Default"; + // + // m_cbIntUseDefault + // + this.m_cbIntUseDefault.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbIntUseDefault.Location = new System.Drawing.Point(8, 120); + this.m_cbIntUseDefault.Name = "m_cbIntUseDefault"; + this.m_cbIntUseDefault.Size = new System.Drawing.Size(144, 24); + this.m_cbIntUseDefault.TabIndex = 4; + this.m_cbIntUseDefault.Text = "Use Default Value"; + this.m_cbIntUseDefault.Click += new System.EventHandler(this.OnIntUseDefaultValue); + // + // m_cbIntAllowNegative + // + this.m_cbIntAllowNegative.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbIntAllowNegative.Location = new System.Drawing.Point(8, 96); + this.m_cbIntAllowNegative.Name = "m_cbIntAllowNegative"; + this.m_cbIntAllowNegative.TabIndex = 3; + this.m_cbIntAllowNegative.Text = "Allow Negative"; + // + // m_cbIntAllowZero + // + this.m_cbIntAllowZero.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbIntAllowZero.Location = new System.Drawing.Point(8, 72); + this.m_cbIntAllowZero.Name = "m_cbIntAllowZero"; + this.m_cbIntAllowZero.TabIndex = 2; + this.m_cbIntAllowZero.Text = "Allow Zero"; + // + // m_cbIntAllowNone + // + this.m_cbIntAllowNone.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbIntAllowNone.Location = new System.Drawing.Point(8, 48); + this.m_cbIntAllowNone.Name = "m_cbIntAllowNone"; + this.m_cbIntAllowNone.Size = new System.Drawing.Size(128, 24); + this.m_cbIntAllowNone.TabIndex = 1; + this.m_cbIntAllowNone.Text = "Allow None"; + // + // m_cbIntAllowArbitraryInput + // + this.m_cbIntAllowArbitraryInput.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbIntAllowArbitraryInput.Location = new System.Drawing.Point(8, 24); + this.m_cbIntAllowArbitraryInput.Name = "m_cbIntAllowArbitraryInput"; + this.m_cbIntAllowArbitraryInput.Size = new System.Drawing.Size(136, 24); + this.m_cbIntAllowArbitraryInput.TabIndex = 0; + this.m_cbIntAllowArbitraryInput.Text = "Allow Arbitrary Input"; + // + // m_txtMessage + // + this.m_txtMessage.Location = new System.Drawing.Point(16, 16); + this.m_txtMessage.Name = "m_txtMessage"; + this.m_txtMessage.Size = new System.Drawing.Size(56, 23); + this.m_txtMessage.TabIndex = 1; + this.m_txtMessage.Text = "Message"; + // + // m_ebIntMessage + // + this.m_ebIntMessage.Location = new System.Drawing.Point(88, 16); + this.m_ebIntMessage.Name = "m_ebIntMessage"; + this.m_ebIntMessage.Size = new System.Drawing.Size(504, 20); + this.m_ebIntMessage.TabIndex = 0; + this.m_ebIntMessage.Text = "Enter an integer"; + // + // m_tpDouble + // + this.m_tpDouble.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_gbDblKwords, + this.m_gbDblOpts, + this.m_txtDblMessage, + this.m_ebDblMessage}); + this.m_tpDouble.Location = new System.Drawing.Point(4, 22); + this.m_tpDouble.Name = "m_tpDouble"; + this.m_tpDouble.Size = new System.Drawing.Size(608, 318); + this.m_tpDouble.TabIndex = 1; + this.m_tpDouble.Text = "Double"; + // + // m_gbDblKwords + // + this.m_gbDblKwords.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnDblKwordHardwire, + this.m_ebDblKwordDef, + this.m_txtDblKwordDef, + this.m_bnDblKwordClear, + this.m_bnDblKwordEdit, + this.m_bnDblKwordAdd, + this.m_lvDblKwords}); + this.m_gbDblKwords.Location = new System.Drawing.Point(200, 48); + this.m_gbDblKwords.Name = "m_gbDblKwords"; + this.m_gbDblKwords.Size = new System.Drawing.Size(392, 264); + this.m_gbDblKwords.TabIndex = 5; + this.m_gbDblKwords.TabStop = false; + this.m_gbDblKwords.Text = "Key Words"; + // + // m_bnDblKwordHardwire + // + this.m_bnDblKwordHardwire.Location = new System.Drawing.Point(24, 200); + this.m_bnDblKwordHardwire.Name = "m_bnDblKwordHardwire"; + this.m_bnDblKwordHardwire.Size = new System.Drawing.Size(88, 23); + this.m_bnDblKwordHardwire.TabIndex = 9; + this.m_bnDblKwordHardwire.Text = "Hardwire"; + this.m_bnDblKwordHardwire.Click += new System.EventHandler(this.OnKwordHardwire); + // + // m_ebDblKwordDef + // + this.m_ebDblKwordDef.Location = new System.Drawing.Point(272, 232); + this.m_ebDblKwordDef.Name = "m_ebDblKwordDef"; + this.m_ebDblKwordDef.Size = new System.Drawing.Size(96, 20); + this.m_ebDblKwordDef.TabIndex = 8; + this.m_ebDblKwordDef.Text = ""; + // + // m_txtDblKwordDef + // + this.m_txtDblKwordDef.Location = new System.Drawing.Point(216, 232); + this.m_txtDblKwordDef.Name = "m_txtDblKwordDef"; + this.m_txtDblKwordDef.Size = new System.Drawing.Size(48, 23); + this.m_txtDblKwordDef.TabIndex = 7; + this.m_txtDblKwordDef.Text = "Default"; + // + // m_bnDblKwordClear + // + this.m_bnDblKwordClear.Location = new System.Drawing.Point(296, 200); + this.m_bnDblKwordClear.Name = "m_bnDblKwordClear"; + this.m_bnDblKwordClear.TabIndex = 3; + this.m_bnDblKwordClear.Text = "Clear"; + this.m_bnDblKwordClear.Click += new System.EventHandler(this.OnKwordClear); + // + // m_bnDblKwordEdit + // + this.m_bnDblKwordEdit.Location = new System.Drawing.Point(208, 200); + this.m_bnDblKwordEdit.Name = "m_bnDblKwordEdit"; + this.m_bnDblKwordEdit.TabIndex = 2; + this.m_bnDblKwordEdit.Text = "Edit..."; + this.m_bnDblKwordEdit.Click += new System.EventHandler(this.OnKwordEdit); + // + // m_bnDblKwordAdd + // + this.m_bnDblKwordAdd.Location = new System.Drawing.Point(120, 200); + this.m_bnDblKwordAdd.Name = "m_bnDblKwordAdd"; + this.m_bnDblKwordAdd.TabIndex = 1; + this.m_bnDblKwordAdd.Text = "Add..."; + this.m_bnDblKwordAdd.Click += new System.EventHandler(this.OnKwordAdd); + // + // m_lvDblKwords + // + this.m_lvDblKwords.CausesValidation = false; + this.m_lvDblKwords.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvColDblGlobal, + this.m_lvColDblLocal, + this.m_lvColDblDisplay, + this.m_lvColDblEnabled, + this.m_lvColDblVisible}); + this.m_lvDblKwords.FullRowSelect = true; + this.m_lvDblKwords.GridLines = true; + this.m_lvDblKwords.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvDblKwords.HideSelection = false; + this.m_lvDblKwords.Location = new System.Drawing.Point(16, 24); + this.m_lvDblKwords.MultiSelect = false; + this.m_lvDblKwords.Name = "m_lvDblKwords"; + this.m_lvDblKwords.Size = new System.Drawing.Size(360, 168); + this.m_lvDblKwords.TabIndex = 0; + this.m_lvDblKwords.View = System.Windows.Forms.View.Details; + // + // m_lvColDblGlobal + // + this.m_lvColDblGlobal.Text = "Global"; + this.m_lvColDblGlobal.Width = 80; + // + // m_lvColDblLocal + // + this.m_lvColDblLocal.Text = "Local"; + this.m_lvColDblLocal.Width = 80; + // + // m_lvColDblDisplay + // + this.m_lvColDblDisplay.Text = "Display"; + this.m_lvColDblDisplay.Width = 80; + // + // m_lvColDblEnabled + // + this.m_lvColDblEnabled.Text = "Enabled"; + // + // m_lvColDblVisible + // + this.m_lvColDblVisible.Text = "Visible"; + // + // m_gbDblOpts + // + this.m_gbDblOpts.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_ebDblDefault, + this.m_txtDblDefault, + this.m_cbDblUseDefault, + this.m_cbDblAllowNegative, + this.m_cbDblAllowZero, + this.m_cbDblAllowNone, + this.m_cbDblAllowArbitraryInput}); + this.m_gbDblOpts.Location = new System.Drawing.Point(16, 48); + this.m_gbDblOpts.Name = "m_gbDblOpts"; + this.m_gbDblOpts.Size = new System.Drawing.Size(168, 264); + this.m_gbDblOpts.TabIndex = 3; + this.m_gbDblOpts.TabStop = false; + this.m_gbDblOpts.Text = "Options"; + // + // m_ebDblDefault + // + this.m_ebDblDefault.Location = new System.Drawing.Point(64, 152); + this.m_ebDblDefault.Name = "m_ebDblDefault"; + this.m_ebDblDefault.Size = new System.Drawing.Size(88, 20); + this.m_ebDblDefault.TabIndex = 6; + this.m_ebDblDefault.Text = ""; + // + // m_txtDblDefault + // + this.m_txtDblDefault.Location = new System.Drawing.Point(8, 152); + this.m_txtDblDefault.Name = "m_txtDblDefault"; + this.m_txtDblDefault.Size = new System.Drawing.Size(56, 23); + this.m_txtDblDefault.TabIndex = 5; + this.m_txtDblDefault.Text = "Default"; + // + // m_cbDblUseDefault + // + this.m_cbDblUseDefault.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDblUseDefault.Location = new System.Drawing.Point(8, 120); + this.m_cbDblUseDefault.Name = "m_cbDblUseDefault"; + this.m_cbDblUseDefault.Size = new System.Drawing.Size(144, 24); + this.m_cbDblUseDefault.TabIndex = 4; + this.m_cbDblUseDefault.Text = "Use Default Value"; + this.m_cbDblUseDefault.Click += new System.EventHandler(this.OnDblUseDefaultValue); + // + // m_cbDblAllowNegative + // + this.m_cbDblAllowNegative.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDblAllowNegative.Location = new System.Drawing.Point(8, 96); + this.m_cbDblAllowNegative.Name = "m_cbDblAllowNegative"; + this.m_cbDblAllowNegative.TabIndex = 3; + this.m_cbDblAllowNegative.Text = "Allow Negative"; + // + // m_cbDblAllowZero + // + this.m_cbDblAllowZero.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDblAllowZero.Location = new System.Drawing.Point(8, 72); + this.m_cbDblAllowZero.Name = "m_cbDblAllowZero"; + this.m_cbDblAllowZero.TabIndex = 2; + this.m_cbDblAllowZero.Text = "Allow Zero"; + // + // m_cbDblAllowNone + // + this.m_cbDblAllowNone.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDblAllowNone.Location = new System.Drawing.Point(8, 48); + this.m_cbDblAllowNone.Name = "m_cbDblAllowNone"; + this.m_cbDblAllowNone.Size = new System.Drawing.Size(128, 24); + this.m_cbDblAllowNone.TabIndex = 1; + this.m_cbDblAllowNone.Text = "Allow None"; + // + // m_cbDblAllowArbitraryInput + // + this.m_cbDblAllowArbitraryInput.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDblAllowArbitraryInput.Location = new System.Drawing.Point(8, 24); + this.m_cbDblAllowArbitraryInput.Name = "m_cbDblAllowArbitraryInput"; + this.m_cbDblAllowArbitraryInput.Size = new System.Drawing.Size(136, 24); + this.m_cbDblAllowArbitraryInput.TabIndex = 0; + this.m_cbDblAllowArbitraryInput.Text = "Allow Arbitrary Input"; + // + // m_txtDblMessage + // + this.m_txtDblMessage.Location = new System.Drawing.Point(16, 16); + this.m_txtDblMessage.Name = "m_txtDblMessage"; + this.m_txtDblMessage.Size = new System.Drawing.Size(56, 23); + this.m_txtDblMessage.TabIndex = 4; + this.m_txtDblMessage.Text = "Message"; + // + // m_ebDblMessage + // + this.m_ebDblMessage.Location = new System.Drawing.Point(88, 16); + this.m_ebDblMessage.Name = "m_ebDblMessage"; + this.m_ebDblMessage.Size = new System.Drawing.Size(504, 20); + this.m_ebDblMessage.TabIndex = 2; + this.m_ebDblMessage.Text = "Enter a double"; + // + // m_tpDistance + // + this.m_tpDistance.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_gbDistKwords, + this.m_gbDistOptions, + this.m_txtDistMessage, + this.m_ebDistMessage}); + this.m_tpDistance.Location = new System.Drawing.Point(4, 22); + this.m_tpDistance.Name = "m_tpDistance"; + this.m_tpDistance.Size = new System.Drawing.Size(608, 318); + this.m_tpDistance.TabIndex = 2; + this.m_tpDistance.Text = "Distance"; + // + // m_gbDistKwords + // + this.m_gbDistKwords.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnDistKwordHardwire, + this.m_ebDistKwordDef, + this.m_txtDistKwordDef, + this.m_bnDistKwordClear, + this.m_bnDistKwordEdit, + this.m_bnDistKwordAdd, + this.m_lvDistKwords}); + this.m_gbDistKwords.Location = new System.Drawing.Point(200, 48); + this.m_gbDistKwords.Name = "m_gbDistKwords"; + this.m_gbDistKwords.Size = new System.Drawing.Size(392, 264); + this.m_gbDistKwords.TabIndex = 6; + this.m_gbDistKwords.TabStop = false; + this.m_gbDistKwords.Text = "Key Words"; + // + // m_bnDistKwordHardwire + // + this.m_bnDistKwordHardwire.Location = new System.Drawing.Point(24, 200); + this.m_bnDistKwordHardwire.Name = "m_bnDistKwordHardwire"; + this.m_bnDistKwordHardwire.Size = new System.Drawing.Size(88, 23); + this.m_bnDistKwordHardwire.TabIndex = 12; + this.m_bnDistKwordHardwire.Text = "Hardwire"; + this.m_bnDistKwordHardwire.Click += new System.EventHandler(this.OnKwordHardwire); + // + // m_ebDistKwordDef + // + this.m_ebDistKwordDef.Location = new System.Drawing.Point(272, 232); + this.m_ebDistKwordDef.Name = "m_ebDistKwordDef"; + this.m_ebDistKwordDef.Size = new System.Drawing.Size(96, 20); + this.m_ebDistKwordDef.TabIndex = 11; + this.m_ebDistKwordDef.Text = ""; + // + // m_txtDistKwordDef + // + this.m_txtDistKwordDef.Location = new System.Drawing.Point(216, 232); + this.m_txtDistKwordDef.Name = "m_txtDistKwordDef"; + this.m_txtDistKwordDef.Size = new System.Drawing.Size(48, 23); + this.m_txtDistKwordDef.TabIndex = 10; + this.m_txtDistKwordDef.Text = "Default"; + // + // m_bnDistKwordClear + // + this.m_bnDistKwordClear.Location = new System.Drawing.Point(296, 200); + this.m_bnDistKwordClear.Name = "m_bnDistKwordClear"; + this.m_bnDistKwordClear.TabIndex = 3; + this.m_bnDistKwordClear.Text = "Clear"; + this.m_bnDistKwordClear.Click += new System.EventHandler(this.OnKwordClear); + // + // m_bnDistKwordEdit + // + this.m_bnDistKwordEdit.Location = new System.Drawing.Point(208, 200); + this.m_bnDistKwordEdit.Name = "m_bnDistKwordEdit"; + this.m_bnDistKwordEdit.TabIndex = 2; + this.m_bnDistKwordEdit.Text = "Edit..."; + this.m_bnDistKwordEdit.Click += new System.EventHandler(this.OnKwordEdit); + // + // m_bnDistKwordAdd + // + this.m_bnDistKwordAdd.Location = new System.Drawing.Point(120, 200); + this.m_bnDistKwordAdd.Name = "m_bnDistKwordAdd"; + this.m_bnDistKwordAdd.TabIndex = 1; + this.m_bnDistKwordAdd.Text = "Add..."; + this.m_bnDistKwordAdd.Click += new System.EventHandler(this.OnKwordAdd); + // + // m_lvDistKwords + // + this.m_lvDistKwords.CausesValidation = false; + this.m_lvDistKwords.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvColDistGlobal, + this.m_lvColDistLocal, + this.m_lvColDistDisplay, + this.m_lvColDistEnabled, + this.m_lvColDistVisible}); + this.m_lvDistKwords.FullRowSelect = true; + this.m_lvDistKwords.GridLines = true; + this.m_lvDistKwords.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvDistKwords.HideSelection = false; + this.m_lvDistKwords.Location = new System.Drawing.Point(16, 24); + this.m_lvDistKwords.MultiSelect = false; + this.m_lvDistKwords.Name = "m_lvDistKwords"; + this.m_lvDistKwords.Size = new System.Drawing.Size(360, 168); + this.m_lvDistKwords.TabIndex = 0; + this.m_lvDistKwords.View = System.Windows.Forms.View.Details; + // + // m_lvColDistGlobal + // + this.m_lvColDistGlobal.Text = "Global"; + this.m_lvColDistGlobal.Width = 80; + // + // m_lvColDistLocal + // + this.m_lvColDistLocal.Text = "Local"; + this.m_lvColDistLocal.Width = 80; + // + // m_lvColDistDisplay + // + this.m_lvColDistDisplay.Text = "Display"; + this.m_lvColDistDisplay.Width = 80; + // + // m_lvColDistEnabled + // + this.m_lvColDistEnabled.Text = "Enabled"; + // + // m_lvColDistVisible + // + this.m_lvColDistVisible.Text = "Visible"; + // + // m_gbDistOptions + // + this.m_gbDistOptions.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_cbDistOnly2d, + this.m_cbDistUseDashedLine, + this.m_cbDistUseBasePt, + this.m_ebDistDefault, + this.m_txtDistDefault, + this.m_cbDistUseDefault, + this.m_cbDistAllowNegative, + this.m_cbDistAllowZero, + this.m_cbDistAllowNone, + this.m_cbDistAllowArbitraryInput}); + this.m_gbDistOptions.Location = new System.Drawing.Point(16, 48); + this.m_gbDistOptions.Name = "m_gbDistOptions"; + this.m_gbDistOptions.Size = new System.Drawing.Size(168, 264); + this.m_gbDistOptions.TabIndex = 4; + this.m_gbDistOptions.TabStop = false; + this.m_gbDistOptions.Text = "Options"; + // + // m_cbDistOnly2d + // + this.m_cbDistOnly2d.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDistOnly2d.Location = new System.Drawing.Point(8, 168); + this.m_cbDistOnly2d.Name = "m_cbDistOnly2d"; + this.m_cbDistOnly2d.TabIndex = 10; + this.m_cbDistOnly2d.Text = "Only 2D"; + // + // m_cbDistUseDashedLine + // + this.m_cbDistUseDashedLine.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDistUseDashedLine.Location = new System.Drawing.Point(8, 144); + this.m_cbDistUseDashedLine.Name = "m_cbDistUseDashedLine"; + this.m_cbDistUseDashedLine.Size = new System.Drawing.Size(144, 24); + this.m_cbDistUseDashedLine.TabIndex = 9; + this.m_cbDistUseDashedLine.Text = "Use Dashed Line"; + // + // m_cbDistUseBasePt + // + this.m_cbDistUseBasePt.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDistUseBasePt.Location = new System.Drawing.Point(8, 120); + this.m_cbDistUseBasePt.Name = "m_cbDistUseBasePt"; + this.m_cbDistUseBasePt.Size = new System.Drawing.Size(144, 24); + this.m_cbDistUseBasePt.TabIndex = 8; + this.m_cbDistUseBasePt.Text = "Use Base Point"; + // + // m_ebDistDefault + // + this.m_ebDistDefault.Location = new System.Drawing.Point(64, 224); + this.m_ebDistDefault.Name = "m_ebDistDefault"; + this.m_ebDistDefault.Size = new System.Drawing.Size(88, 20); + this.m_ebDistDefault.TabIndex = 6; + this.m_ebDistDefault.Text = ""; + // + // m_txtDistDefault + // + this.m_txtDistDefault.Location = new System.Drawing.Point(8, 224); + this.m_txtDistDefault.Name = "m_txtDistDefault"; + this.m_txtDistDefault.Size = new System.Drawing.Size(56, 23); + this.m_txtDistDefault.TabIndex = 5; + this.m_txtDistDefault.Text = "Default"; + // + // m_cbDistUseDefault + // + this.m_cbDistUseDefault.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDistUseDefault.Location = new System.Drawing.Point(8, 192); + this.m_cbDistUseDefault.Name = "m_cbDistUseDefault"; + this.m_cbDistUseDefault.Size = new System.Drawing.Size(144, 24); + this.m_cbDistUseDefault.TabIndex = 4; + this.m_cbDistUseDefault.Text = "Use Default Value"; + this.m_cbDistUseDefault.Click += new System.EventHandler(this.OnDistUseDefaultValue); + // + // m_cbDistAllowNegative + // + this.m_cbDistAllowNegative.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDistAllowNegative.Location = new System.Drawing.Point(8, 96); + this.m_cbDistAllowNegative.Name = "m_cbDistAllowNegative"; + this.m_cbDistAllowNegative.TabIndex = 3; + this.m_cbDistAllowNegative.Text = "Allow Negative"; + // + // m_cbDistAllowZero + // + this.m_cbDistAllowZero.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDistAllowZero.Location = new System.Drawing.Point(8, 72); + this.m_cbDistAllowZero.Name = "m_cbDistAllowZero"; + this.m_cbDistAllowZero.TabIndex = 2; + this.m_cbDistAllowZero.Text = "Allow Zero"; + // + // m_cbDistAllowNone + // + this.m_cbDistAllowNone.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDistAllowNone.Location = new System.Drawing.Point(8, 48); + this.m_cbDistAllowNone.Name = "m_cbDistAllowNone"; + this.m_cbDistAllowNone.Size = new System.Drawing.Size(128, 24); + this.m_cbDistAllowNone.TabIndex = 1; + this.m_cbDistAllowNone.Text = "Allow None"; + // + // m_cbDistAllowArbitraryInput + // + this.m_cbDistAllowArbitraryInput.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbDistAllowArbitraryInput.Location = new System.Drawing.Point(8, 24); + this.m_cbDistAllowArbitraryInput.Name = "m_cbDistAllowArbitraryInput"; + this.m_cbDistAllowArbitraryInput.Size = new System.Drawing.Size(136, 24); + this.m_cbDistAllowArbitraryInput.TabIndex = 0; + this.m_cbDistAllowArbitraryInput.Text = "Allow Arbitrary Input"; + // + // m_txtDistMessage + // + this.m_txtDistMessage.Location = new System.Drawing.Point(16, 16); + this.m_txtDistMessage.Name = "m_txtDistMessage"; + this.m_txtDistMessage.Size = new System.Drawing.Size(56, 23); + this.m_txtDistMessage.TabIndex = 5; + this.m_txtDistMessage.Text = "Message"; + // + // m_ebDistMessage + // + this.m_ebDistMessage.Location = new System.Drawing.Point(88, 16); + this.m_ebDistMessage.Name = "m_ebDistMessage"; + this.m_ebDistMessage.Size = new System.Drawing.Size(504, 20); + this.m_ebDistMessage.TabIndex = 3; + this.m_ebDistMessage.Text = "Enter a distance"; + // + // m_tpAngle + // + this.m_tpAngle.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_txtAngMessage, + this.m_ebAngMessage, + this.m_gbAngOptions, + this.m_gbAngKwords}); + this.m_tpAngle.Location = new System.Drawing.Point(4, 22); + this.m_tpAngle.Name = "m_tpAngle"; + this.m_tpAngle.Size = new System.Drawing.Size(608, 318); + this.m_tpAngle.TabIndex = 7; + this.m_tpAngle.Text = "Angle"; + // + // m_txtAngMessage + // + this.m_txtAngMessage.Location = new System.Drawing.Point(16, 16); + this.m_txtAngMessage.Name = "m_txtAngMessage"; + this.m_txtAngMessage.Size = new System.Drawing.Size(56, 23); + this.m_txtAngMessage.TabIndex = 9; + this.m_txtAngMessage.Text = "Message"; + // + // m_ebAngMessage + // + this.m_ebAngMessage.Location = new System.Drawing.Point(88, 16); + this.m_ebAngMessage.Name = "m_ebAngMessage"; + this.m_ebAngMessage.Size = new System.Drawing.Size(504, 20); + this.m_ebAngMessage.TabIndex = 7; + this.m_ebAngMessage.Text = "Enter an angle"; + // + // m_gbAngOptions + // + this.m_gbAngOptions.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_cbAngUseDefault, + this.m_cbAngUseDashedLine, + this.m_ebAngDefault, + this.m_txtAngDefault, + this.m_cbAngUseBasePt, + this.m_cbAngAllowZero, + this.m_cbAngAllowNone, + this.m_cbAngAllowArbitraryInput}); + this.m_gbAngOptions.Location = new System.Drawing.Point(16, 48); + this.m_gbAngOptions.Name = "m_gbAngOptions"; + this.m_gbAngOptions.Size = new System.Drawing.Size(168, 264); + this.m_gbAngOptions.TabIndex = 8; + this.m_gbAngOptions.TabStop = false; + this.m_gbAngOptions.Text = "Options"; + // + // m_cbAngUseDefault + // + this.m_cbAngUseDefault.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbAngUseDefault.Location = new System.Drawing.Point(8, 144); + this.m_cbAngUseDefault.Name = "m_cbAngUseDefault"; + this.m_cbAngUseDefault.Size = new System.Drawing.Size(120, 24); + this.m_cbAngUseDefault.TabIndex = 8; + this.m_cbAngUseDefault.Text = "Use Default"; + this.m_cbAngUseDefault.Click += new System.EventHandler(this.OnAngUseDefaultValue); + // + // m_cbAngUseDashedLine + // + this.m_cbAngUseDashedLine.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbAngUseDashedLine.Location = new System.Drawing.Point(8, 120); + this.m_cbAngUseDashedLine.Name = "m_cbAngUseDashedLine"; + this.m_cbAngUseDashedLine.Size = new System.Drawing.Size(144, 24); + this.m_cbAngUseDashedLine.TabIndex = 7; + this.m_cbAngUseDashedLine.Text = "Use Dashed Line"; + // + // m_ebAngDefault + // + this.m_ebAngDefault.Location = new System.Drawing.Point(64, 176); + this.m_ebAngDefault.Name = "m_ebAngDefault"; + this.m_ebAngDefault.Size = new System.Drawing.Size(88, 20); + this.m_ebAngDefault.TabIndex = 6; + this.m_ebAngDefault.Text = ""; + // + // m_txtAngDefault + // + this.m_txtAngDefault.Location = new System.Drawing.Point(8, 176); + this.m_txtAngDefault.Name = "m_txtAngDefault"; + this.m_txtAngDefault.Size = new System.Drawing.Size(56, 23); + this.m_txtAngDefault.TabIndex = 5; + this.m_txtAngDefault.Text = "Default"; + // + // m_cbAngUseBasePt + // + this.m_cbAngUseBasePt.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbAngUseBasePt.Location = new System.Drawing.Point(8, 96); + this.m_cbAngUseBasePt.Name = "m_cbAngUseBasePt"; + this.m_cbAngUseBasePt.Size = new System.Drawing.Size(144, 24); + this.m_cbAngUseBasePt.TabIndex = 4; + this.m_cbAngUseBasePt.Text = "Use Base Point"; + // + // m_cbAngAllowZero + // + this.m_cbAngAllowZero.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbAngAllowZero.Location = new System.Drawing.Point(8, 72); + this.m_cbAngAllowZero.Name = "m_cbAngAllowZero"; + this.m_cbAngAllowZero.TabIndex = 2; + this.m_cbAngAllowZero.Text = "Allow Zero"; + // + // m_cbAngAllowNone + // + this.m_cbAngAllowNone.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbAngAllowNone.Location = new System.Drawing.Point(8, 48); + this.m_cbAngAllowNone.Name = "m_cbAngAllowNone"; + this.m_cbAngAllowNone.Size = new System.Drawing.Size(128, 24); + this.m_cbAngAllowNone.TabIndex = 1; + this.m_cbAngAllowNone.Text = "Allow None"; + // + // m_cbAngAllowArbitraryInput + // + this.m_cbAngAllowArbitraryInput.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbAngAllowArbitraryInput.Location = new System.Drawing.Point(8, 24); + this.m_cbAngAllowArbitraryInput.Name = "m_cbAngAllowArbitraryInput"; + this.m_cbAngAllowArbitraryInput.Size = new System.Drawing.Size(136, 24); + this.m_cbAngAllowArbitraryInput.TabIndex = 0; + this.m_cbAngAllowArbitraryInput.Text = "Allow Arbitrary Input"; + // + // m_gbAngKwords + // + this.m_gbAngKwords.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnAngKwordHardwire, + this.m_ebAngKwordDef, + this.m_txtAngKwordDef, + this.m_bnAngKwordClear, + this.m_bnAngKwordEdit, + this.m_bnAngKwordAdd, + this.m_lvAngKwords}); + this.m_gbAngKwords.Location = new System.Drawing.Point(200, 48); + this.m_gbAngKwords.Name = "m_gbAngKwords"; + this.m_gbAngKwords.Size = new System.Drawing.Size(392, 264); + this.m_gbAngKwords.TabIndex = 10; + this.m_gbAngKwords.TabStop = false; + this.m_gbAngKwords.Text = "Key Words"; + // + // m_bnAngKwordHardwire + // + this.m_bnAngKwordHardwire.Location = new System.Drawing.Point(24, 200); + this.m_bnAngKwordHardwire.Name = "m_bnAngKwordHardwire"; + this.m_bnAngKwordHardwire.Size = new System.Drawing.Size(88, 23); + this.m_bnAngKwordHardwire.TabIndex = 15; + this.m_bnAngKwordHardwire.Text = "Hardwire"; + this.m_bnAngKwordHardwire.Click += new System.EventHandler(this.OnKwordHardwire); + // + // m_ebAngKwordDef + // + this.m_ebAngKwordDef.Location = new System.Drawing.Point(272, 232); + this.m_ebAngKwordDef.Name = "m_ebAngKwordDef"; + this.m_ebAngKwordDef.Size = new System.Drawing.Size(96, 20); + this.m_ebAngKwordDef.TabIndex = 14; + this.m_ebAngKwordDef.Text = ""; + // + // m_txtAngKwordDef + // + this.m_txtAngKwordDef.Location = new System.Drawing.Point(216, 232); + this.m_txtAngKwordDef.Name = "m_txtAngKwordDef"; + this.m_txtAngKwordDef.Size = new System.Drawing.Size(48, 23); + this.m_txtAngKwordDef.TabIndex = 13; + this.m_txtAngKwordDef.Text = "Default"; + // + // m_bnAngKwordClear + // + this.m_bnAngKwordClear.Location = new System.Drawing.Point(296, 200); + this.m_bnAngKwordClear.Name = "m_bnAngKwordClear"; + this.m_bnAngKwordClear.TabIndex = 3; + this.m_bnAngKwordClear.Text = "Clear"; + this.m_bnAngKwordClear.Click += new System.EventHandler(this.OnKwordClear); + // + // m_bnAngKwordEdit + // + this.m_bnAngKwordEdit.Location = new System.Drawing.Point(208, 200); + this.m_bnAngKwordEdit.Name = "m_bnAngKwordEdit"; + this.m_bnAngKwordEdit.TabIndex = 2; + this.m_bnAngKwordEdit.Text = "Edit..."; + this.m_bnAngKwordEdit.Click += new System.EventHandler(this.OnKwordEdit); + // + // m_bnAngKwordAdd + // + this.m_bnAngKwordAdd.Location = new System.Drawing.Point(120, 200); + this.m_bnAngKwordAdd.Name = "m_bnAngKwordAdd"; + this.m_bnAngKwordAdd.TabIndex = 1; + this.m_bnAngKwordAdd.Text = "Add..."; + this.m_bnAngKwordAdd.Click += new System.EventHandler(this.OnKwordAdd); + // + // m_lvAngKwords + // + this.m_lvAngKwords.CausesValidation = false; + this.m_lvAngKwords.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvColAngGlobal, + this.m_lvColAngLocal, + this.m_lvColAngDisplay, + this.m_lvColAngEnabled, + this.m_lvColAngVisible}); + this.m_lvAngKwords.FullRowSelect = true; + this.m_lvAngKwords.GridLines = true; + this.m_lvAngKwords.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvAngKwords.HideSelection = false; + this.m_lvAngKwords.Location = new System.Drawing.Point(16, 24); + this.m_lvAngKwords.MultiSelect = false; + this.m_lvAngKwords.Name = "m_lvAngKwords"; + this.m_lvAngKwords.Size = new System.Drawing.Size(360, 168); + this.m_lvAngKwords.TabIndex = 0; + this.m_lvAngKwords.View = System.Windows.Forms.View.Details; + // + // m_lvColAngGlobal + // + this.m_lvColAngGlobal.Text = "Global"; + this.m_lvColAngGlobal.Width = 80; + // + // m_lvColAngLocal + // + this.m_lvColAngLocal.Text = "Local"; + this.m_lvColAngLocal.Width = 80; + // + // m_lvColAngDisplay + // + this.m_lvColAngDisplay.Text = "Display"; + this.m_lvColAngDisplay.Width = 80; + // + // m_lvColAngEnabled + // + this.m_lvColAngEnabled.Text = "Enabled"; + // + // m_lvColAngVisible + // + this.m_lvColAngVisible.Text = "Visible"; + // + // m_tpCorner + // + this.m_tpCorner.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_gbCrnOptions, + this.m_gbCrnKwords, + this.m_ebCrnMessage, + this.m_txtCrnMessage}); + this.m_tpCorner.Location = new System.Drawing.Point(4, 22); + this.m_tpCorner.Name = "m_tpCorner"; + this.m_tpCorner.Size = new System.Drawing.Size(608, 318); + this.m_tpCorner.TabIndex = 3; + this.m_tpCorner.Text = "Corner"; + // + // m_gbCrnOptions + // + this.m_gbCrnOptions.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_cbCrnUseDashedLine, + this.m_cbCrnLimitsChecked, + this.m_cbCrnAllowNone, + this.m_cbCrnAllowArbitraryInput}); + this.m_gbCrnOptions.Location = new System.Drawing.Point(16, 48); + this.m_gbCrnOptions.Name = "m_gbCrnOptions"; + this.m_gbCrnOptions.Size = new System.Drawing.Size(168, 264); + this.m_gbCrnOptions.TabIndex = 12; + this.m_gbCrnOptions.TabStop = false; + this.m_gbCrnOptions.Text = "Options"; + // + // m_cbCrnUseDashedLine + // + this.m_cbCrnUseDashedLine.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbCrnUseDashedLine.Location = new System.Drawing.Point(8, 96); + this.m_cbCrnUseDashedLine.Name = "m_cbCrnUseDashedLine"; + this.m_cbCrnUseDashedLine.Size = new System.Drawing.Size(144, 24); + this.m_cbCrnUseDashedLine.TabIndex = 7; + this.m_cbCrnUseDashedLine.Text = "Use Dashed Line"; + // + // m_cbCrnLimitsChecked + // + this.m_cbCrnLimitsChecked.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbCrnLimitsChecked.Location = new System.Drawing.Point(8, 72); + this.m_cbCrnLimitsChecked.Name = "m_cbCrnLimitsChecked"; + this.m_cbCrnLimitsChecked.TabIndex = 2; + this.m_cbCrnLimitsChecked.Text = "Limits Checked"; + // + // m_cbCrnAllowNone + // + this.m_cbCrnAllowNone.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbCrnAllowNone.Location = new System.Drawing.Point(8, 48); + this.m_cbCrnAllowNone.Name = "m_cbCrnAllowNone"; + this.m_cbCrnAllowNone.Size = new System.Drawing.Size(128, 24); + this.m_cbCrnAllowNone.TabIndex = 1; + this.m_cbCrnAllowNone.Text = "Allow None"; + // + // m_cbCrnAllowArbitraryInput + // + this.m_cbCrnAllowArbitraryInput.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbCrnAllowArbitraryInput.Location = new System.Drawing.Point(8, 24); + this.m_cbCrnAllowArbitraryInput.Name = "m_cbCrnAllowArbitraryInput"; + this.m_cbCrnAllowArbitraryInput.Size = new System.Drawing.Size(136, 24); + this.m_cbCrnAllowArbitraryInput.TabIndex = 0; + this.m_cbCrnAllowArbitraryInput.Text = "Allow Arbitrary Input"; + // + // m_gbCrnKwords + // + this.m_gbCrnKwords.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnCrnKwordHardwire, + this.m_ebCrnKwordDef, + this.m_txtCrnKwordDef, + this.m_bnCrnKwordClear, + this.m_bnCrnKwordEdit, + this.m_bnCrnKwordAdd, + this.m_lvCrnKwords}); + this.m_gbCrnKwords.Location = new System.Drawing.Point(200, 48); + this.m_gbCrnKwords.Name = "m_gbCrnKwords"; + this.m_gbCrnKwords.Size = new System.Drawing.Size(392, 264); + this.m_gbCrnKwords.TabIndex = 14; + this.m_gbCrnKwords.TabStop = false; + this.m_gbCrnKwords.Text = "Key Words"; + // + // m_bnCrnKwordHardwire + // + this.m_bnCrnKwordHardwire.Location = new System.Drawing.Point(24, 200); + this.m_bnCrnKwordHardwire.Name = "m_bnCrnKwordHardwire"; + this.m_bnCrnKwordHardwire.Size = new System.Drawing.Size(88, 23); + this.m_bnCrnKwordHardwire.TabIndex = 18; + this.m_bnCrnKwordHardwire.Text = "Hardwire"; + this.m_bnCrnKwordHardwire.Click += new System.EventHandler(this.OnKwordHardwire); + // + // m_ebCrnKwordDef + // + this.m_ebCrnKwordDef.Location = new System.Drawing.Point(272, 232); + this.m_ebCrnKwordDef.Name = "m_ebCrnKwordDef"; + this.m_ebCrnKwordDef.Size = new System.Drawing.Size(96, 20); + this.m_ebCrnKwordDef.TabIndex = 17; + this.m_ebCrnKwordDef.Text = ""; + // + // m_txtCrnKwordDef + // + this.m_txtCrnKwordDef.Location = new System.Drawing.Point(216, 232); + this.m_txtCrnKwordDef.Name = "m_txtCrnKwordDef"; + this.m_txtCrnKwordDef.Size = new System.Drawing.Size(48, 23); + this.m_txtCrnKwordDef.TabIndex = 16; + this.m_txtCrnKwordDef.Text = "Default"; + // + // m_bnCrnKwordClear + // + this.m_bnCrnKwordClear.Location = new System.Drawing.Point(296, 200); + this.m_bnCrnKwordClear.Name = "m_bnCrnKwordClear"; + this.m_bnCrnKwordClear.TabIndex = 3; + this.m_bnCrnKwordClear.Text = "Clear"; + this.m_bnCrnKwordClear.Click += new System.EventHandler(this.OnKwordClear); + // + // m_bnCrnKwordEdit + // + this.m_bnCrnKwordEdit.Location = new System.Drawing.Point(208, 200); + this.m_bnCrnKwordEdit.Name = "m_bnCrnKwordEdit"; + this.m_bnCrnKwordEdit.TabIndex = 2; + this.m_bnCrnKwordEdit.Text = "Edit..."; + this.m_bnCrnKwordEdit.Click += new System.EventHandler(this.OnKwordEdit); + // + // m_bnCrnKwordAdd + // + this.m_bnCrnKwordAdd.Location = new System.Drawing.Point(120, 200); + this.m_bnCrnKwordAdd.Name = "m_bnCrnKwordAdd"; + this.m_bnCrnKwordAdd.TabIndex = 1; + this.m_bnCrnKwordAdd.Text = "Add..."; + this.m_bnCrnKwordAdd.Click += new System.EventHandler(this.OnKwordAdd); + // + // m_lvCrnKwords + // + this.m_lvCrnKwords.CausesValidation = false; + this.m_lvCrnKwords.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvColCrnGlobal, + this.m_lvColCrnLocal, + this.m_lvColCrnDisplay, + this.m_lvColCrnEnabled, + this.m_lvColCrnVisible}); + this.m_lvCrnKwords.FullRowSelect = true; + this.m_lvCrnKwords.GridLines = true; + this.m_lvCrnKwords.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvCrnKwords.HideSelection = false; + this.m_lvCrnKwords.Location = new System.Drawing.Point(16, 24); + this.m_lvCrnKwords.MultiSelect = false; + this.m_lvCrnKwords.Name = "m_lvCrnKwords"; + this.m_lvCrnKwords.Size = new System.Drawing.Size(360, 168); + this.m_lvCrnKwords.TabIndex = 0; + this.m_lvCrnKwords.View = System.Windows.Forms.View.Details; + // + // m_lvColCrnGlobal + // + this.m_lvColCrnGlobal.Text = "Global"; + this.m_lvColCrnGlobal.Width = 80; + // + // m_lvColCrnLocal + // + this.m_lvColCrnLocal.Text = "Local"; + this.m_lvColCrnLocal.Width = 80; + // + // m_lvColCrnDisplay + // + this.m_lvColCrnDisplay.Text = "Display"; + this.m_lvColCrnDisplay.Width = 80; + // + // m_lvColCrnEnabled + // + this.m_lvColCrnEnabled.Text = "Enabled"; + // + // m_lvColCrnVisible + // + this.m_lvColCrnVisible.Text = "Visible"; + // + // m_ebCrnMessage + // + this.m_ebCrnMessage.Location = new System.Drawing.Point(88, 16); + this.m_ebCrnMessage.Name = "m_ebCrnMessage"; + this.m_ebCrnMessage.Size = new System.Drawing.Size(504, 20); + this.m_ebCrnMessage.TabIndex = 11; + this.m_ebCrnMessage.Text = "Enter other corner"; + // + // m_txtCrnMessage + // + this.m_txtCrnMessage.Location = new System.Drawing.Point(16, 16); + this.m_txtCrnMessage.Name = "m_txtCrnMessage"; + this.m_txtCrnMessage.Size = new System.Drawing.Size(56, 23); + this.m_txtCrnMessage.TabIndex = 13; + this.m_txtCrnMessage.Text = "Message"; + // + // m_tpPoint + // + this.m_tpPoint.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_gbPtOptions, + this.m_gbPtKwords, + this.m_ebPtMessage, + this.m_txtPtMessage}); + this.m_tpPoint.Location = new System.Drawing.Point(4, 22); + this.m_tpPoint.Name = "m_tpPoint"; + this.m_tpPoint.Size = new System.Drawing.Size(608, 318); + this.m_tpPoint.TabIndex = 4; + this.m_tpPoint.Text = "Point"; + // + // m_gbPtOptions + // + this.m_gbPtOptions.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_cbPtUseBasePt, + this.m_cbPtUseDashedLine, + this.m_cbPtLimitsChecked, + this.m_cbPtAllowNone, + this.m_cbPtAllowArbitraryInput}); + this.m_gbPtOptions.Location = new System.Drawing.Point(16, 48); + this.m_gbPtOptions.Name = "m_gbPtOptions"; + this.m_gbPtOptions.Size = new System.Drawing.Size(168, 264); + this.m_gbPtOptions.TabIndex = 16; + this.m_gbPtOptions.TabStop = false; + this.m_gbPtOptions.Text = "Options"; + // + // m_cbPtUseBasePt + // + this.m_cbPtUseBasePt.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbPtUseBasePt.Location = new System.Drawing.Point(8, 120); + this.m_cbPtUseBasePt.Name = "m_cbPtUseBasePt"; + this.m_cbPtUseBasePt.Size = new System.Drawing.Size(128, 24); + this.m_cbPtUseBasePt.TabIndex = 8; + this.m_cbPtUseBasePt.Text = "Use Base Point"; + // + // m_cbPtUseDashedLine + // + this.m_cbPtUseDashedLine.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbPtUseDashedLine.Location = new System.Drawing.Point(8, 96); + this.m_cbPtUseDashedLine.Name = "m_cbPtUseDashedLine"; + this.m_cbPtUseDashedLine.Size = new System.Drawing.Size(144, 24); + this.m_cbPtUseDashedLine.TabIndex = 7; + this.m_cbPtUseDashedLine.Text = "Use Dashed Line"; + // + // m_cbPtLimitsChecked + // + this.m_cbPtLimitsChecked.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbPtLimitsChecked.Location = new System.Drawing.Point(8, 72); + this.m_cbPtLimitsChecked.Name = "m_cbPtLimitsChecked"; + this.m_cbPtLimitsChecked.TabIndex = 2; + this.m_cbPtLimitsChecked.Text = "Limits Checked"; + // + // m_cbPtAllowNone + // + this.m_cbPtAllowNone.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbPtAllowNone.Location = new System.Drawing.Point(8, 48); + this.m_cbPtAllowNone.Name = "m_cbPtAllowNone"; + this.m_cbPtAllowNone.Size = new System.Drawing.Size(128, 24); + this.m_cbPtAllowNone.TabIndex = 1; + this.m_cbPtAllowNone.Text = "Allow None"; + // + // m_cbPtAllowArbitraryInput + // + this.m_cbPtAllowArbitraryInput.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbPtAllowArbitraryInput.Location = new System.Drawing.Point(8, 24); + this.m_cbPtAllowArbitraryInput.Name = "m_cbPtAllowArbitraryInput"; + this.m_cbPtAllowArbitraryInput.Size = new System.Drawing.Size(136, 24); + this.m_cbPtAllowArbitraryInput.TabIndex = 0; + this.m_cbPtAllowArbitraryInput.Text = "Allow Arbitrary Input"; + // + // m_gbPtKwords + // + this.m_gbPtKwords.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnPtKwordHardwire, + this.m_ebPtKwordDef, + this.m_txtPtKwordDef, + this.m_bnPtKwordClear, + this.m_bnPtKwordEdit, + this.m_bnPtKwordAdd, + this.m_lvPtKwords}); + this.m_gbPtKwords.Location = new System.Drawing.Point(200, 48); + this.m_gbPtKwords.Name = "m_gbPtKwords"; + this.m_gbPtKwords.Size = new System.Drawing.Size(392, 264); + this.m_gbPtKwords.TabIndex = 18; + this.m_gbPtKwords.TabStop = false; + this.m_gbPtKwords.Text = "Key Words"; + // + // m_bnPtKwordHardwire + // + this.m_bnPtKwordHardwire.Location = new System.Drawing.Point(24, 200); + this.m_bnPtKwordHardwire.Name = "m_bnPtKwordHardwire"; + this.m_bnPtKwordHardwire.Size = new System.Drawing.Size(88, 23); + this.m_bnPtKwordHardwire.TabIndex = 21; + this.m_bnPtKwordHardwire.Text = "Hardwire"; + this.m_bnPtKwordHardwire.Click += new System.EventHandler(this.OnKwordHardwire); + // + // m_ebPtKwordDef + // + this.m_ebPtKwordDef.Location = new System.Drawing.Point(272, 232); + this.m_ebPtKwordDef.Name = "m_ebPtKwordDef"; + this.m_ebPtKwordDef.Size = new System.Drawing.Size(96, 20); + this.m_ebPtKwordDef.TabIndex = 20; + this.m_ebPtKwordDef.Text = ""; + // + // m_txtPtKwordDef + // + this.m_txtPtKwordDef.Location = new System.Drawing.Point(216, 232); + this.m_txtPtKwordDef.Name = "m_txtPtKwordDef"; + this.m_txtPtKwordDef.Size = new System.Drawing.Size(48, 23); + this.m_txtPtKwordDef.TabIndex = 19; + this.m_txtPtKwordDef.Text = "Default"; + // + // m_bnPtKwordClear + // + this.m_bnPtKwordClear.Location = new System.Drawing.Point(296, 200); + this.m_bnPtKwordClear.Name = "m_bnPtKwordClear"; + this.m_bnPtKwordClear.TabIndex = 3; + this.m_bnPtKwordClear.Text = "Clear"; + this.m_bnPtKwordClear.Click += new System.EventHandler(this.OnKwordClear); + // + // m_bnPtKwordEdit + // + this.m_bnPtKwordEdit.Location = new System.Drawing.Point(208, 200); + this.m_bnPtKwordEdit.Name = "m_bnPtKwordEdit"; + this.m_bnPtKwordEdit.TabIndex = 2; + this.m_bnPtKwordEdit.Text = "Edit..."; + this.m_bnPtKwordEdit.Click += new System.EventHandler(this.OnKwordEdit); + // + // m_bnPtKwordAdd + // + this.m_bnPtKwordAdd.Location = new System.Drawing.Point(120, 200); + this.m_bnPtKwordAdd.Name = "m_bnPtKwordAdd"; + this.m_bnPtKwordAdd.TabIndex = 1; + this.m_bnPtKwordAdd.Text = "Add..."; + this.m_bnPtKwordAdd.Click += new System.EventHandler(this.OnKwordAdd); + // + // m_lvPtKwords + // + this.m_lvPtKwords.CausesValidation = false; + this.m_lvPtKwords.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvColPtGlobal, + this.m_lvColPtLocal, + this.m_lvColPtDisplay, + this.m_lvColPtEnabled, + this.m_lvColPtVisible}); + this.m_lvPtKwords.FullRowSelect = true; + this.m_lvPtKwords.GridLines = true; + this.m_lvPtKwords.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvPtKwords.HideSelection = false; + this.m_lvPtKwords.Location = new System.Drawing.Point(16, 24); + this.m_lvPtKwords.MultiSelect = false; + this.m_lvPtKwords.Name = "m_lvPtKwords"; + this.m_lvPtKwords.Size = new System.Drawing.Size(360, 168); + this.m_lvPtKwords.TabIndex = 0; + this.m_lvPtKwords.View = System.Windows.Forms.View.Details; + // + // m_lvColPtGlobal + // + this.m_lvColPtGlobal.Text = "Global"; + this.m_lvColPtGlobal.Width = 80; + // + // m_lvColPtLocal + // + this.m_lvColPtLocal.Text = "Local"; + this.m_lvColPtLocal.Width = 80; + // + // m_lvColPtDisplay + // + this.m_lvColPtDisplay.Text = "Display"; + this.m_lvColPtDisplay.Width = 80; + // + // m_lvColPtEnabled + // + this.m_lvColPtEnabled.Text = "Enabled"; + // + // m_lvColPtVisible + // + this.m_lvColPtVisible.Text = "Visible"; + // + // m_ebPtMessage + // + this.m_ebPtMessage.Location = new System.Drawing.Point(88, 16); + this.m_ebPtMessage.Name = "m_ebPtMessage"; + this.m_ebPtMessage.Size = new System.Drawing.Size(504, 20); + this.m_ebPtMessage.TabIndex = 15; + this.m_ebPtMessage.Text = "Enter a point"; + // + // m_txtPtMessage + // + this.m_txtPtMessage.Location = new System.Drawing.Point(16, 16); + this.m_txtPtMessage.Name = "m_txtPtMessage"; + this.m_txtPtMessage.Size = new System.Drawing.Size(56, 23); + this.m_txtPtMessage.TabIndex = 17; + this.m_txtPtMessage.Text = "Message"; + // + // m_tpString + // + this.m_tpString.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_gbStrOptions, + this.m_ebStrMessage, + this.m_txtStrMessage}); + this.m_tpString.Location = new System.Drawing.Point(4, 22); + this.m_tpString.Name = "m_tpString"; + this.m_tpString.Size = new System.Drawing.Size(608, 318); + this.m_tpString.TabIndex = 5; + this.m_tpString.Text = "String"; + // + // m_gbStrOptions + // + this.m_gbStrOptions.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_cbStrAllowSpaces}); + this.m_gbStrOptions.Location = new System.Drawing.Point(16, 48); + this.m_gbStrOptions.Name = "m_gbStrOptions"; + this.m_gbStrOptions.Size = new System.Drawing.Size(168, 232); + this.m_gbStrOptions.TabIndex = 20; + this.m_gbStrOptions.TabStop = false; + this.m_gbStrOptions.Text = "Options"; + // + // m_cbStrAllowSpaces + // + this.m_cbStrAllowSpaces.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbStrAllowSpaces.Location = new System.Drawing.Point(8, 24); + this.m_cbStrAllowSpaces.Name = "m_cbStrAllowSpaces"; + this.m_cbStrAllowSpaces.Size = new System.Drawing.Size(136, 24); + this.m_cbStrAllowSpaces.TabIndex = 0; + this.m_cbStrAllowSpaces.Text = "Allow Spaces"; + // + // m_ebStrMessage + // + this.m_ebStrMessage.Location = new System.Drawing.Point(88, 16); + this.m_ebStrMessage.Name = "m_ebStrMessage"; + this.m_ebStrMessage.Size = new System.Drawing.Size(504, 20); + this.m_ebStrMessage.TabIndex = 19; + this.m_ebStrMessage.Text = "Enter a string"; + // + // m_txtStrMessage + // + this.m_txtStrMessage.Location = new System.Drawing.Point(16, 16); + this.m_txtStrMessage.Name = "m_txtStrMessage"; + this.m_txtStrMessage.Size = new System.Drawing.Size(56, 23); + this.m_txtStrMessage.TabIndex = 21; + this.m_txtStrMessage.Text = "Message"; + // + // m_tpKeyword + // + this.m_tpKeyword.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_gbKwdOptions, + this.m_gbKwdKwords, + this.m_ebKwdMessage, + this.m_txtKwdMessage}); + this.m_tpKeyword.Location = new System.Drawing.Point(4, 22); + this.m_tpKeyword.Name = "m_tpKeyword"; + this.m_tpKeyword.Size = new System.Drawing.Size(608, 318); + this.m_tpKeyword.TabIndex = 8; + this.m_tpKeyword.Text = "Keyword"; + // + // m_gbKwdOptions + // + this.m_gbKwdOptions.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_cbKwdAllowArbitraryInput, + this.m_cbKwdAllowNone}); + this.m_gbKwdOptions.Location = new System.Drawing.Point(16, 48); + this.m_gbKwdOptions.Name = "m_gbKwdOptions"; + this.m_gbKwdOptions.Size = new System.Drawing.Size(168, 264); + this.m_gbKwdOptions.TabIndex = 20; + this.m_gbKwdOptions.TabStop = false; + this.m_gbKwdOptions.Text = "Options"; + // + // m_cbKwdAllowArbitraryInput + // + this.m_cbKwdAllowArbitraryInput.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbKwdAllowArbitraryInput.Location = new System.Drawing.Point(8, 24); + this.m_cbKwdAllowArbitraryInput.Name = "m_cbKwdAllowArbitraryInput"; + this.m_cbKwdAllowArbitraryInput.Size = new System.Drawing.Size(136, 24); + this.m_cbKwdAllowArbitraryInput.TabIndex = 2; + this.m_cbKwdAllowArbitraryInput.Text = "Allow Arbitrary Input"; + // + // m_cbKwdAllowNone + // + this.m_cbKwdAllowNone.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbKwdAllowNone.Location = new System.Drawing.Point(8, 48); + this.m_cbKwdAllowNone.Name = "m_cbKwdAllowNone"; + this.m_cbKwdAllowNone.Size = new System.Drawing.Size(128, 24); + this.m_cbKwdAllowNone.TabIndex = 1; + this.m_cbKwdAllowNone.Text = "Allow None"; + // + // m_gbKwdKwords + // + this.m_gbKwdKwords.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnKwdKwordHardwire, + this.m_ebKwdKwordDef, + this.m_txtKwdKwordDef, + this.m_bnKwdKwordClear, + this.m_bnKwdKwordEdit, + this.m_bnKwdKwordAdd, + this.m_lvKwdKwords}); + this.m_gbKwdKwords.Location = new System.Drawing.Point(200, 48); + this.m_gbKwdKwords.Name = "m_gbKwdKwords"; + this.m_gbKwdKwords.Size = new System.Drawing.Size(392, 264); + this.m_gbKwdKwords.TabIndex = 22; + this.m_gbKwdKwords.TabStop = false; + this.m_gbKwdKwords.Text = "Key Words"; + // + // m_bnKwdKwordHardwire + // + this.m_bnKwdKwordHardwire.Location = new System.Drawing.Point(24, 200); + this.m_bnKwdKwordHardwire.Name = "m_bnKwdKwordHardwire"; + this.m_bnKwdKwordHardwire.Size = new System.Drawing.Size(88, 23); + this.m_bnKwdKwordHardwire.TabIndex = 24; + this.m_bnKwdKwordHardwire.Text = "Hardwire"; + this.m_bnKwdKwordHardwire.Click += new System.EventHandler(this.OnKwordHardwire); + // + // m_ebKwdKwordDef + // + this.m_ebKwdKwordDef.Location = new System.Drawing.Point(272, 232); + this.m_ebKwdKwordDef.Name = "m_ebKwdKwordDef"; + this.m_ebKwdKwordDef.Size = new System.Drawing.Size(96, 20); + this.m_ebKwdKwordDef.TabIndex = 23; + this.m_ebKwdKwordDef.Text = ""; + // + // m_txtKwdKwordDef + // + this.m_txtKwdKwordDef.Location = new System.Drawing.Point(216, 232); + this.m_txtKwdKwordDef.Name = "m_txtKwdKwordDef"; + this.m_txtKwdKwordDef.Size = new System.Drawing.Size(48, 23); + this.m_txtKwdKwordDef.TabIndex = 22; + this.m_txtKwdKwordDef.Text = "Default"; + // + // m_bnKwdKwordClear + // + this.m_bnKwdKwordClear.Location = new System.Drawing.Point(296, 200); + this.m_bnKwdKwordClear.Name = "m_bnKwdKwordClear"; + this.m_bnKwdKwordClear.TabIndex = 3; + this.m_bnKwdKwordClear.Text = "Clear"; + this.m_bnKwdKwordClear.Click += new System.EventHandler(this.OnKwordClear); + // + // m_bnKwdKwordEdit + // + this.m_bnKwdKwordEdit.Location = new System.Drawing.Point(208, 200); + this.m_bnKwdKwordEdit.Name = "m_bnKwdKwordEdit"; + this.m_bnKwdKwordEdit.TabIndex = 2; + this.m_bnKwdKwordEdit.Text = "Edit..."; + this.m_bnKwdKwordEdit.Click += new System.EventHandler(this.OnKwordEdit); + // + // m_bnKwdKwordAdd + // + this.m_bnKwdKwordAdd.Location = new System.Drawing.Point(120, 200); + this.m_bnKwdKwordAdd.Name = "m_bnKwdKwordAdd"; + this.m_bnKwdKwordAdd.TabIndex = 1; + this.m_bnKwdKwordAdd.Text = "Add..."; + this.m_bnKwdKwordAdd.Click += new System.EventHandler(this.OnKwordAdd); + // + // m_lvKwdKwords + // + this.m_lvKwdKwords.CausesValidation = false; + this.m_lvKwdKwords.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvColKwdGlobal, + this.m_lvColKwdLocal, + this.m_lvColKwdDisplay, + this.m_lvColKwdEnabled, + this.m_lvColKwdVisible}); + this.m_lvKwdKwords.FullRowSelect = true; + this.m_lvKwdKwords.GridLines = true; + this.m_lvKwdKwords.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvKwdKwords.HideSelection = false; + this.m_lvKwdKwords.Location = new System.Drawing.Point(16, 24); + this.m_lvKwdKwords.MultiSelect = false; + this.m_lvKwdKwords.Name = "m_lvKwdKwords"; + this.m_lvKwdKwords.Size = new System.Drawing.Size(360, 168); + this.m_lvKwdKwords.TabIndex = 0; + this.m_lvKwdKwords.View = System.Windows.Forms.View.Details; + // + // m_lvColKwdGlobal + // + this.m_lvColKwdGlobal.Text = "Global"; + this.m_lvColKwdGlobal.Width = 80; + // + // m_lvColKwdLocal + // + this.m_lvColKwdLocal.Text = "Local"; + this.m_lvColKwdLocal.Width = 80; + // + // m_lvColKwdDisplay + // + this.m_lvColKwdDisplay.Text = "Display"; + this.m_lvColKwdDisplay.Width = 80; + // + // m_lvColKwdEnabled + // + this.m_lvColKwdEnabled.Text = "Enabled"; + // + // m_lvColKwdVisible + // + this.m_lvColKwdVisible.Text = "Visible"; + // + // m_ebKwdMessage + // + this.m_ebKwdMessage.Location = new System.Drawing.Point(88, 16); + this.m_ebKwdMessage.Name = "m_ebKwdMessage"; + this.m_ebKwdMessage.Size = new System.Drawing.Size(504, 20); + this.m_ebKwdMessage.TabIndex = 19; + this.m_ebKwdMessage.Text = "Enter a keyword"; + // + // m_txtKwdMessage + // + this.m_txtKwdMessage.Location = new System.Drawing.Point(16, 16); + this.m_txtKwdMessage.Name = "m_txtKwdMessage"; + this.m_txtKwdMessage.Size = new System.Drawing.Size(56, 23); + this.m_txtKwdMessage.TabIndex = 21; + this.m_txtKwdMessage.Text = "Message"; + // + // m_tpEntity + // + this.m_tpEntity.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_gbEntFilterClasses, + this.m_gbEntKwords, + this.m_gbEntOptions, + this.m_ebEntMessage, + this.m_txtEntMessage}); + this.m_tpEntity.Location = new System.Drawing.Point(4, 22); + this.m_tpEntity.Name = "m_tpEntity"; + this.m_tpEntity.Size = new System.Drawing.Size(608, 318); + this.m_tpEntity.TabIndex = 6; + this.m_tpEntity.Text = "Entity"; + // + // m_gbEntFilterClasses + // + this.m_gbEntFilterClasses.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_cbEntAllowCurves, + this.m_txtEntSampleFilter, + this.m_ebEntDoIsATest, + this.m_cbEntAllowCircles, + this.m_cbEntAllowLines, + this.m_ebEntRejectMessage, + this.m_txtEntRejectMessage}); + this.m_gbEntFilterClasses.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_gbEntFilterClasses.Location = new System.Drawing.Point(16, 136); + this.m_gbEntFilterClasses.Name = "m_gbEntFilterClasses"; + this.m_gbEntFilterClasses.Size = new System.Drawing.Size(168, 176); + this.m_gbEntFilterClasses.TabIndex = 26; + this.m_gbEntFilterClasses.TabStop = false; + this.m_gbEntFilterClasses.Text = "Filter Classes"; + // + // m_cbEntAllowCurves + // + this.m_cbEntAllowCurves.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbEntAllowCurves.Location = new System.Drawing.Point(8, 72); + this.m_cbEntAllowCurves.Name = "m_cbEntAllowCurves"; + this.m_cbEntAllowCurves.Size = new System.Drawing.Size(144, 24); + this.m_cbEntAllowCurves.TabIndex = 13; + this.m_cbEntAllowCurves.Text = "Allow Curves"; + this.m_cbEntAllowCurves.Click += new System.EventHandler(this.OnEntAllowLines); + // + // m_txtEntSampleFilter + // + this.m_txtEntSampleFilter.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_txtEntSampleFilter.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + this.m_txtEntSampleFilter.ForeColor = System.Drawing.Color.MediumBlue; + this.m_txtEntSampleFilter.Location = new System.Drawing.Point(80, 0); + this.m_txtEntSampleFilter.Name = "m_txtEntSampleFilter"; + this.m_txtEntSampleFilter.TabIndex = 12; + this.m_txtEntSampleFilter.Text = "(Sample)"; + // + // m_ebEntDoIsATest + // + this.m_ebEntDoIsATest.Enabled = false; + this.m_ebEntDoIsATest.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_ebEntDoIsATest.Location = new System.Drawing.Point(8, 96); + this.m_ebEntDoIsATest.Name = "m_ebEntDoIsATest"; + this.m_ebEntDoIsATest.Size = new System.Drawing.Size(128, 24); + this.m_ebEntDoIsATest.TabIndex = 11; + this.m_ebEntDoIsATest.Text = "Exact Class Match"; + // + // m_cbEntAllowCircles + // + this.m_cbEntAllowCircles.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbEntAllowCircles.Location = new System.Drawing.Point(8, 48); + this.m_cbEntAllowCircles.Name = "m_cbEntAllowCircles"; + this.m_cbEntAllowCircles.Size = new System.Drawing.Size(144, 24); + this.m_cbEntAllowCircles.TabIndex = 10; + this.m_cbEntAllowCircles.Text = "Allow Circles"; + this.m_cbEntAllowCircles.Click += new System.EventHandler(this.OnEntAllowLines); + // + // m_cbEntAllowLines + // + this.m_cbEntAllowLines.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbEntAllowLines.Location = new System.Drawing.Point(8, 24); + this.m_cbEntAllowLines.Name = "m_cbEntAllowLines"; + this.m_cbEntAllowLines.Size = new System.Drawing.Size(144, 24); + this.m_cbEntAllowLines.TabIndex = 9; + this.m_cbEntAllowLines.Text = "Allow Lines"; + this.m_cbEntAllowLines.Click += new System.EventHandler(this.OnEntAllowLines); + // + // m_ebEntRejectMessage + // + this.m_ebEntRejectMessage.Enabled = false; + this.m_ebEntRejectMessage.Location = new System.Drawing.Point(8, 144); + this.m_ebEntRejectMessage.Name = "m_ebEntRejectMessage"; + this.m_ebEntRejectMessage.Size = new System.Drawing.Size(152, 20); + this.m_ebEntRejectMessage.TabIndex = 8; + this.m_ebEntRejectMessage.Text = "Wrong type of entity selected!"; + // + // m_txtEntRejectMessage + // + this.m_txtEntRejectMessage.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_txtEntRejectMessage.Location = new System.Drawing.Point(8, 120); + this.m_txtEntRejectMessage.Name = "m_txtEntRejectMessage"; + this.m_txtEntRejectMessage.Size = new System.Drawing.Size(96, 23); + this.m_txtEntRejectMessage.TabIndex = 7; + this.m_txtEntRejectMessage.Text = "Reject Message"; + // + // m_gbEntKwords + // + this.m_gbEntKwords.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnEntKwordHardwire, + this.m_ebEntKwordDef, + this.m_txtEntKwordDef, + this.m_bnEntKwordClear, + this.m_bnEntKwordEdit, + this.m_bnEntKwordAdd, + this.m_lvEntKwords}); + this.m_gbEntKwords.Location = new System.Drawing.Point(200, 48); + this.m_gbEntKwords.Name = "m_gbEntKwords"; + this.m_gbEntKwords.Size = new System.Drawing.Size(392, 264); + this.m_gbEntKwords.TabIndex = 25; + this.m_gbEntKwords.TabStop = false; + this.m_gbEntKwords.Text = "Key Words"; + // + // m_bnEntKwordHardwire + // + this.m_bnEntKwordHardwire.Location = new System.Drawing.Point(24, 200); + this.m_bnEntKwordHardwire.Name = "m_bnEntKwordHardwire"; + this.m_bnEntKwordHardwire.Size = new System.Drawing.Size(88, 23); + this.m_bnEntKwordHardwire.TabIndex = 27; + this.m_bnEntKwordHardwire.Text = "Hardwire"; + this.m_bnEntKwordHardwire.Click += new System.EventHandler(this.OnKwordHardwire); + // + // m_ebEntKwordDef + // + this.m_ebEntKwordDef.Location = new System.Drawing.Point(272, 232); + this.m_ebEntKwordDef.Name = "m_ebEntKwordDef"; + this.m_ebEntKwordDef.Size = new System.Drawing.Size(96, 20); + this.m_ebEntKwordDef.TabIndex = 26; + this.m_ebEntKwordDef.Text = ""; + // + // m_txtEntKwordDef + // + this.m_txtEntKwordDef.Location = new System.Drawing.Point(216, 232); + this.m_txtEntKwordDef.Name = "m_txtEntKwordDef"; + this.m_txtEntKwordDef.Size = new System.Drawing.Size(48, 23); + this.m_txtEntKwordDef.TabIndex = 25; + this.m_txtEntKwordDef.Text = "Default"; + // + // m_bnEntKwordClear + // + this.m_bnEntKwordClear.Location = new System.Drawing.Point(296, 200); + this.m_bnEntKwordClear.Name = "m_bnEntKwordClear"; + this.m_bnEntKwordClear.TabIndex = 3; + this.m_bnEntKwordClear.Text = "Clear"; + this.m_bnEntKwordClear.Click += new System.EventHandler(this.OnKwordClear); + // + // m_bnEntKwordEdit + // + this.m_bnEntKwordEdit.Location = new System.Drawing.Point(208, 200); + this.m_bnEntKwordEdit.Name = "m_bnEntKwordEdit"; + this.m_bnEntKwordEdit.TabIndex = 2; + this.m_bnEntKwordEdit.Text = "Edit..."; + this.m_bnEntKwordEdit.Click += new System.EventHandler(this.OnKwordEdit); + // + // m_bnEntKwordAdd + // + this.m_bnEntKwordAdd.Location = new System.Drawing.Point(120, 200); + this.m_bnEntKwordAdd.Name = "m_bnEntKwordAdd"; + this.m_bnEntKwordAdd.TabIndex = 1; + this.m_bnEntKwordAdd.Text = "Add..."; + this.m_bnEntKwordAdd.Click += new System.EventHandler(this.OnKwordAdd); + // + // m_lvEntKwords + // + this.m_lvEntKwords.CausesValidation = false; + this.m_lvEntKwords.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvColEntKwordGlobal, + this.m_lvColEntKwordLocal, + this.m_lvColEntKwordDisplay, + this.m_lvColEntKwordEnabled, + this.m_lvColEntKwordVisible}); + this.m_lvEntKwords.FullRowSelect = true; + this.m_lvEntKwords.GridLines = true; + this.m_lvEntKwords.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvEntKwords.HideSelection = false; + this.m_lvEntKwords.Location = new System.Drawing.Point(16, 24); + this.m_lvEntKwords.MultiSelect = false; + this.m_lvEntKwords.Name = "m_lvEntKwords"; + this.m_lvEntKwords.Size = new System.Drawing.Size(360, 168); + this.m_lvEntKwords.TabIndex = 0; + this.m_lvEntKwords.View = System.Windows.Forms.View.Details; + // + // m_lvColEntKwordGlobal + // + this.m_lvColEntKwordGlobal.Text = "Global"; + this.m_lvColEntKwordGlobal.Width = 80; + // + // m_lvColEntKwordLocal + // + this.m_lvColEntKwordLocal.Text = "Local"; + this.m_lvColEntKwordLocal.Width = 80; + // + // m_lvColEntKwordDisplay + // + this.m_lvColEntKwordDisplay.Text = "Display"; + this.m_lvColEntKwordDisplay.Width = 80; + // + // m_lvColEntKwordEnabled + // + this.m_lvColEntKwordEnabled.Text = "Enabled"; + // + // m_lvColEntKwordVisible + // + this.m_lvColEntKwordVisible.Text = "Visible"; + // + // m_gbEntOptions + // + this.m_gbEntOptions.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_cbEntAllowLockedLayer, + this.m_cbEntAllowNone}); + this.m_gbEntOptions.Location = new System.Drawing.Point(16, 48); + this.m_gbEntOptions.Name = "m_gbEntOptions"; + this.m_gbEntOptions.Size = new System.Drawing.Size(168, 80); + this.m_gbEntOptions.TabIndex = 23; + this.m_gbEntOptions.TabStop = false; + this.m_gbEntOptions.Text = "Options"; + // + // m_cbEntAllowLockedLayer + // + this.m_cbEntAllowLockedLayer.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbEntAllowLockedLayer.Location = new System.Drawing.Point(8, 48); + this.m_cbEntAllowLockedLayer.Name = "m_cbEntAllowLockedLayer"; + this.m_cbEntAllowLockedLayer.Size = new System.Drawing.Size(144, 24); + this.m_cbEntAllowLockedLayer.TabIndex = 2; + this.m_cbEntAllowLockedLayer.Text = "Allow Locked Layer"; + // + // m_cbEntAllowNone + // + this.m_cbEntAllowNone.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbEntAllowNone.Location = new System.Drawing.Point(8, 24); + this.m_cbEntAllowNone.Name = "m_cbEntAllowNone"; + this.m_cbEntAllowNone.Size = new System.Drawing.Size(128, 24); + this.m_cbEntAllowNone.TabIndex = 1; + this.m_cbEntAllowNone.Text = "Allow None"; + // + // m_ebEntMessage + // + this.m_ebEntMessage.Location = new System.Drawing.Point(88, 16); + this.m_ebEntMessage.Name = "m_ebEntMessage"; + this.m_ebEntMessage.Size = new System.Drawing.Size(504, 20); + this.m_ebEntMessage.TabIndex = 22; + this.m_ebEntMessage.Text = "Select entity"; + // + // m_txtEntMessage + // + this.m_txtEntMessage.Location = new System.Drawing.Point(16, 16); + this.m_txtEntMessage.Name = "m_txtEntMessage"; + this.m_txtEntMessage.Size = new System.Drawing.Size(56, 23); + this.m_txtEntMessage.TabIndex = 24; + this.m_txtEntMessage.Text = "Message"; + // + // m_tpNested + // + this.m_tpNested.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_gbNentKwords, + this.m_gbNentOptions, + this.m_ebNentMessage, + this.m_txtNentMessage}); + this.m_tpNested.Location = new System.Drawing.Point(4, 22); + this.m_tpNested.Name = "m_tpNested"; + this.m_tpNested.Size = new System.Drawing.Size(608, 318); + this.m_tpNested.TabIndex = 9; + this.m_tpNested.Text = "Nested Entity"; + // + // m_gbNentKwords + // + this.m_gbNentKwords.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnNentKwordHardwire, + this.m_ebNentKwordDef, + this.m_txtNentKwordDef, + this.m_bnNentKwordClear, + this.m_bnNentKwordEdit, + this.m_bnNentKwordAdd, + this.m_lvNentKwords}); + this.m_gbNentKwords.Location = new System.Drawing.Point(200, 48); + this.m_gbNentKwords.Name = "m_gbNentKwords"; + this.m_gbNentKwords.Size = new System.Drawing.Size(392, 264); + this.m_gbNentKwords.TabIndex = 29; + this.m_gbNentKwords.TabStop = false; + this.m_gbNentKwords.Text = "Key Words"; + // + // m_bnNentKwordHardwire + // + this.m_bnNentKwordHardwire.Location = new System.Drawing.Point(24, 200); + this.m_bnNentKwordHardwire.Name = "m_bnNentKwordHardwire"; + this.m_bnNentKwordHardwire.Size = new System.Drawing.Size(88, 23); + this.m_bnNentKwordHardwire.TabIndex = 27; + this.m_bnNentKwordHardwire.Text = "Hardwire"; + this.m_bnNentKwordHardwire.Click += new System.EventHandler(this.OnKwordHardwire); + // + // m_ebNentKwordDef + // + this.m_ebNentKwordDef.Location = new System.Drawing.Point(272, 232); + this.m_ebNentKwordDef.Name = "m_ebNentKwordDef"; + this.m_ebNentKwordDef.Size = new System.Drawing.Size(96, 20); + this.m_ebNentKwordDef.TabIndex = 26; + this.m_ebNentKwordDef.Text = ""; + // + // m_txtNentKwordDef + // + this.m_txtNentKwordDef.Location = new System.Drawing.Point(216, 232); + this.m_txtNentKwordDef.Name = "m_txtNentKwordDef"; + this.m_txtNentKwordDef.Size = new System.Drawing.Size(48, 23); + this.m_txtNentKwordDef.TabIndex = 25; + this.m_txtNentKwordDef.Text = "Default"; + // + // m_bnNentKwordClear + // + this.m_bnNentKwordClear.Location = new System.Drawing.Point(296, 200); + this.m_bnNentKwordClear.Name = "m_bnNentKwordClear"; + this.m_bnNentKwordClear.TabIndex = 3; + this.m_bnNentKwordClear.Text = "Clear"; + this.m_bnNentKwordClear.Click += new System.EventHandler(this.OnKwordClear); + // + // m_bnNentKwordEdit + // + this.m_bnNentKwordEdit.Location = new System.Drawing.Point(208, 200); + this.m_bnNentKwordEdit.Name = "m_bnNentKwordEdit"; + this.m_bnNentKwordEdit.TabIndex = 2; + this.m_bnNentKwordEdit.Text = "Edit..."; + this.m_bnNentKwordEdit.Click += new System.EventHandler(this.OnKwordEdit); + // + // m_bnNentKwordAdd + // + this.m_bnNentKwordAdd.Location = new System.Drawing.Point(120, 200); + this.m_bnNentKwordAdd.Name = "m_bnNentKwordAdd"; + this.m_bnNentKwordAdd.TabIndex = 1; + this.m_bnNentKwordAdd.Text = "Add..."; + this.m_bnNentKwordAdd.Click += new System.EventHandler(this.OnKwordAdd); + // + // m_lvNentKwords + // + this.m_lvNentKwords.CausesValidation = false; + this.m_lvNentKwords.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvColNentKwordsGlobal, + this.m_lvColNentKwordsLocal, + this.m_lvColNentKwordsDisplay, + this.m_lvColNentKwordsEnabled, + this.m_lvColNentKwordsVisible}); + this.m_lvNentKwords.FullRowSelect = true; + this.m_lvNentKwords.GridLines = true; + this.m_lvNentKwords.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvNentKwords.HideSelection = false; + this.m_lvNentKwords.Location = new System.Drawing.Point(16, 24); + this.m_lvNentKwords.MultiSelect = false; + this.m_lvNentKwords.Name = "m_lvNentKwords"; + this.m_lvNentKwords.Size = new System.Drawing.Size(360, 168); + this.m_lvNentKwords.TabIndex = 0; + this.m_lvNentKwords.View = System.Windows.Forms.View.Details; + // + // m_lvColNentKwordsGlobal + // + this.m_lvColNentKwordsGlobal.Text = "Global"; + this.m_lvColNentKwordsGlobal.Width = 80; + // + // m_lvColNentKwordsLocal + // + this.m_lvColNentKwordsLocal.Text = "Local"; + this.m_lvColNentKwordsLocal.Width = 80; + // + // m_lvColNentKwordsDisplay + // + this.m_lvColNentKwordsDisplay.Text = "Display"; + this.m_lvColNentKwordsDisplay.Width = 80; + // + // m_lvColNentKwordsEnabled + // + this.m_lvColNentKwordsEnabled.Text = "Enabled"; + // + // m_lvColNentKwordsVisible + // + this.m_lvColNentKwordsVisible.Text = "Visible"; + // + // m_gbNentOptions + // + this.m_gbNentOptions.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_cbNentNonInterPickPt, + this.m_cbNentAllowNone}); + this.m_gbNentOptions.Location = new System.Drawing.Point(16, 48); + this.m_gbNentOptions.Name = "m_gbNentOptions"; + this.m_gbNentOptions.Size = new System.Drawing.Size(168, 264); + this.m_gbNentOptions.TabIndex = 27; + this.m_gbNentOptions.TabStop = false; + this.m_gbNentOptions.Text = "Options"; + // + // m_cbNentNonInterPickPt + // + this.m_cbNentNonInterPickPt.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbNentNonInterPickPt.Location = new System.Drawing.Point(8, 48); + this.m_cbNentNonInterPickPt.Name = "m_cbNentNonInterPickPt"; + this.m_cbNentNonInterPickPt.Size = new System.Drawing.Size(136, 24); + this.m_cbNentNonInterPickPt.TabIndex = 2; + this.m_cbNentNonInterPickPt.Text = "Use Non-Interactive Pick Point"; + // + // m_cbNentAllowNone + // + this.m_cbNentAllowNone.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbNentAllowNone.Location = new System.Drawing.Point(8, 24); + this.m_cbNentAllowNone.Name = "m_cbNentAllowNone"; + this.m_cbNentAllowNone.Size = new System.Drawing.Size(128, 24); + this.m_cbNentAllowNone.TabIndex = 1; + this.m_cbNentAllowNone.Text = "Allow None"; + // + // m_ebNentMessage + // + this.m_ebNentMessage.Location = new System.Drawing.Point(88, 16); + this.m_ebNentMessage.Name = "m_ebNentMessage"; + this.m_ebNentMessage.Size = new System.Drawing.Size(504, 20); + this.m_ebNentMessage.TabIndex = 26; + this.m_ebNentMessage.Text = "Select nested entity"; + // + // m_txtNentMessage + // + this.m_txtNentMessage.Location = new System.Drawing.Point(16, 16); + this.m_txtNentMessage.Name = "m_txtNentMessage"; + this.m_txtNentMessage.Size = new System.Drawing.Size(56, 23); + this.m_txtNentMessage.TabIndex = 28; + this.m_txtNentMessage.Text = "Message"; + // + // m_bnRunTest + // + this.m_bnRunTest.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnRunTest.Location = new System.Drawing.Point(464, 368); + this.m_bnRunTest.Name = "m_bnRunTest"; + this.m_bnRunTest.TabIndex = 1; + this.m_bnRunTest.Text = "< Run Test"; + // + // m_bnCancel + // + this.m_bnCancel.CausesValidation = false; + this.m_bnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnCancel.Location = new System.Drawing.Point(552, 368); + this.m_bnCancel.Name = "m_bnCancel"; + this.m_bnCancel.TabIndex = 2; + this.m_bnCancel.Text = "Cancel"; + // + // PromptTestForm + // + this.AcceptButton = this.m_bnRunTest; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_bnCancel; + this.ClientSize = new System.Drawing.Size(648, 398); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnCancel, + this.m_bnRunTest, + this.m_tcMain}); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "PromptTestForm"; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Prompts"; + this.m_tcMain.ResumeLayout(false); + this.m_tpInteger.ResumeLayout(false); + this.m_gbKeywords.ResumeLayout(false); + this.m_gbOptionsInt.ResumeLayout(false); + this.m_tpDouble.ResumeLayout(false); + this.m_gbDblKwords.ResumeLayout(false); + this.m_gbDblOpts.ResumeLayout(false); + this.m_tpDistance.ResumeLayout(false); + this.m_gbDistKwords.ResumeLayout(false); + this.m_gbDistOptions.ResumeLayout(false); + this.m_tpAngle.ResumeLayout(false); + this.m_gbAngOptions.ResumeLayout(false); + this.m_gbAngKwords.ResumeLayout(false); + this.m_tpCorner.ResumeLayout(false); + this.m_gbCrnOptions.ResumeLayout(false); + this.m_gbCrnKwords.ResumeLayout(false); + this.m_tpPoint.ResumeLayout(false); + this.m_gbPtOptions.ResumeLayout(false); + this.m_gbPtKwords.ResumeLayout(false); + this.m_tpString.ResumeLayout(false); + this.m_gbStrOptions.ResumeLayout(false); + this.m_tpKeyword.ResumeLayout(false); + this.m_gbKwdOptions.ResumeLayout(false); + this.m_gbKwdKwords.ResumeLayout(false); + this.m_tpEntity.ResumeLayout(false); + this.m_gbEntFilterClasses.ResumeLayout(false); + this.m_gbEntKwords.ResumeLayout(false); + this.m_gbEntOptions.ResumeLayout(false); + this.m_tpNested.ResumeLayout(false); + this.m_gbNentKwords.ResumeLayout(false); + this.m_gbNentOptions.ResumeLayout(false); + this.ResumeLayout(false); + } + + #endregion Windows Form Designer generated code + + /// + /// Disable the default value if they aren't going to use it + /// + + private void + OnIntUseDefaultValue(object sender, System.EventArgs e) + { + m_ebIntDefault.Enabled = m_cbIntUseDefault.Checked; + } + + private void + OnDblUseDefaultValue(object sender, System.EventArgs e) + { + m_ebDblDefault.Enabled = m_cbDblUseDefault.Checked; + } + + private void + OnDistUseDefaultValue(object sender, System.EventArgs e) + { + m_ebDistDefault.Enabled = m_cbDistUseDefault.Checked; + } + + private void + OnAngUseDefaultValue(object sender, System.EventArgs e) + { + m_ebAngDefault.Enabled = m_cbAngUseDefault.Checked; + } + + /// + /// After the form has been dismissed, figure out which page + /// was active and run that specific prompt. + /// + + public void + RunPrompt() + { + if (m_tcMain.SelectedTab == m_tpInteger) + { + RunIntegerPrompt(); + } + else if (m_tcMain.SelectedTab == m_tpDouble) + { + RunDoublePrompt(); + } + else if (m_tcMain.SelectedTab == m_tpDistance) + { + RunDistancePrompt(); + } + else if (m_tcMain.SelectedTab == m_tpAngle) + { + RunAnglePrompt(); + } + else if (m_tcMain.SelectedTab == m_tpCorner) + { + RunCornerPrompt(); + } + else if (m_tcMain.SelectedTab == m_tpPoint) + { + RunPointPrompt(); + } + else if (m_tcMain.SelectedTab == m_tpString) + { + RunStringPrompt(); + } + else if (m_tcMain.SelectedTab == m_tpKeyword) + { + RunKeywordPrompt(); + } + else if (m_tcMain.SelectedTab == m_tpEntity) + { + RunEntityPrompt(); + } + else if (m_tcMain.SelectedTab == m_tpNested) + { + RunNestedEntityPrompt(); + } + else + { + Debug.Assert(false, "Not a tab!"); + } + } + + private void + RunIntegerPrompt() + { + PromptIntegerOptions prOpts = new PromptIntegerOptions(string.Format("\n{0}", m_ebIntMessage.Text)); + prOpts.AllowArbitraryInput = m_cbIntAllowArbitraryInput.Checked; + prOpts.AllowNone = m_cbIntAllowNone.Checked; + prOpts.AllowZero = m_cbIntAllowZero.Checked; + prOpts.AllowNegative = m_cbIntAllowNegative.Checked; + prOpts.UseDefaultValue = m_cbIntUseDefault.Checked; + if (m_cbIntUseDefault.Checked) + prOpts.DefaultValue = int.Parse(m_ebIntDefault.Text); // TBD: need a validating EditBoxInteger + + AddKeywordsToPrompt(prOpts, m_kwordsInt, m_ebIntKwordDef.Text); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptIntegerResult prRes = ed.GetInteger(prOpts); + + ShowPromptResult(prRes); + } + + private void + RunDoublePrompt() + { + PromptDoubleOptions prOpts = new PromptDoubleOptions(string.Format("\n{0}", m_ebDblMessage.Text)); + prOpts.AllowArbitraryInput = m_cbDblAllowArbitraryInput.Checked; + prOpts.AllowNone = m_cbDblAllowNone.Checked; + prOpts.AllowZero = m_cbDblAllowZero.Checked; + prOpts.AllowNegative = m_cbDblAllowNegative.Checked; + prOpts.UseDefaultValue = m_cbDblUseDefault.Checked; + if (m_cbDblUseDefault.Checked) + prOpts.DefaultValue = double.Parse(m_ebDblDefault.Text); // TBD: need a validating EditBoxDbleger + + AddKeywordsToPrompt(prOpts, m_kwordsDbl, m_ebDblKwordDef.Text); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptDoubleResult prRes = ed.GetDouble(prOpts); + + ShowPromptResult(prRes); + } + + private void + RunDistancePrompt() + { + PromptDistanceOptions prOpts = new PromptDistanceOptions(string.Format("\n{0}", m_ebDistMessage.Text)); + prOpts.AllowArbitraryInput = m_cbDistAllowArbitraryInput.Checked; + prOpts.AllowNone = m_cbDistAllowNone.Checked; + prOpts.AllowZero = m_cbDistAllowZero.Checked; + prOpts.AllowNegative = m_cbDistAllowNegative.Checked; + prOpts.UseBasePoint = m_cbDistUseBasePt.Checked; + prOpts.UseDashedLine = m_cbDistUseDashedLine.Checked; + prOpts.Only2d = m_cbDistOnly2d.Checked; + prOpts.UseDefaultValue = m_cbDistUseDefault.Checked; + if (m_cbDistUseDefault.Checked) + prOpts.DefaultValue = double.Parse(m_ebDistDefault.Text); // TBD: need a validating EditBoxDbleger + + AddKeywordsToPrompt(prOpts, m_kwordsDist, m_ebDistKwordDef.Text); + + if (m_cbDistUseBasePt.Checked) + prOpts.BasePoint = GetBasePt(); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptDoubleResult prRes = ed.GetDistance(prOpts); + + ShowPromptResult(prRes); + } + + private void + RunAnglePrompt() + { + PromptAngleOptions prOpts = new PromptAngleOptions(string.Format("\n{0}", m_ebAngMessage.Text)); + prOpts.AllowArbitraryInput = m_cbAngAllowArbitraryInput.Checked; + prOpts.AllowNone = m_cbAngAllowNone.Checked; + prOpts.AllowZero = m_cbAngAllowZero.Checked; + prOpts.UseBasePoint = m_cbAngUseBasePt.Checked; + prOpts.UseDashedLine = m_cbAngUseDashedLine.Checked; + prOpts.UseDefaultValue = m_cbAngUseDefault.Checked; + if (m_cbAngUseDefault.Checked) + prOpts.DefaultValue = MgdDbg.Utils.Ge.DegreesToRadians(double.Parse(m_ebAngDefault.Text)); // TBD: need a validating EditBoxDbleger + + AddKeywordsToPrompt(prOpts, m_kwordsAng, m_ebAngKwordDef.Text); + + if (m_cbAngUseBasePt.Checked) + prOpts.BasePoint = GetBasePt(); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptDoubleResult prRes = ed.GetAngle(prOpts); + + ShowPromptResult(prRes); + } + + private void + RunCornerPrompt() + { + Point3d basePt = GetBasePt(); // nees a base point to corner from + + PromptCornerOptions prOpts = new PromptCornerOptions(string.Format("\n{0}", m_ebCrnMessage.Text), basePt); + prOpts.AllowArbitraryInput = m_cbCrnAllowArbitraryInput.Checked; + prOpts.AllowNone = m_cbCrnAllowNone.Checked; + prOpts.LimitsChecked = m_cbCrnLimitsChecked.Checked; + prOpts.UseDashedLine = m_cbCrnUseDashedLine.Checked; + + AddKeywordsToPrompt(prOpts, m_kwordsCrn, m_ebCrnKwordDef.Text); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptPointResult prRes = ed.GetCorner(prOpts); + + ShowPromptResult(prRes); + } + + private void + RunPointPrompt() + { + PromptPointOptions prOpts = new PromptPointOptions(string.Format("\n{0}", m_ebPtMessage.Text)); + prOpts.AllowArbitraryInput = m_cbPtAllowArbitraryInput.Checked; + prOpts.AllowNone = m_cbPtAllowNone.Checked; + prOpts.LimitsChecked = m_cbPtLimitsChecked.Checked; + prOpts.UseDashedLine = m_cbPtUseDashedLine.Checked; + prOpts.UseBasePoint = m_cbPtUseBasePt.Checked; + if (m_cbPtUseBasePt.Checked) + prOpts.BasePoint = GetBasePt(); + + AddKeywordsToPrompt(prOpts, m_kwordsPt, m_ebPtKwordDef.Text); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptPointResult prRes = ed.GetPoint(prOpts); + + ShowPromptResult(prRes); + } + + private void + RunStringPrompt() + { + PromptStringOptions prOpts = new PromptStringOptions(string.Format("\n{0}", m_ebStrMessage.Text)); + prOpts.AllowSpaces = m_cbStrAllowSpaces.Checked; + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptResult prRes = ed.GetString(prOpts); + + ShowPromptResult(prRes); + } + + private void + RunKeywordPrompt() + { + PromptKeywordOptions prOpts = new PromptKeywordOptions(string.Format("\n{0}", m_ebKwdMessage.Text)); + prOpts.AllowArbitraryInput = m_cbKwdAllowArbitraryInput.Checked; + prOpts.AllowNone = m_cbKwdAllowNone.Checked; + + AddKeywordsToPrompt(prOpts, m_kwordsKwd, m_ebKwdKwordDef.Text); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptResult prRes = ed.GetKeywords(prOpts); + + ShowPromptResult(prRes); + } + + private void + RunEntityPrompt() + { + PromptEntityOptions prOpts = new PromptEntityOptions(string.Format("\n{0}", m_ebEntMessage.Text)); + prOpts.AllowNone = m_cbEntAllowNone.Checked; + + // You can add whatever classes you want to filter for, but you must + // first add a RejectMessage + if (m_cbEntAllowLines.Checked || m_cbEntAllowCircles.Checked || m_cbEntAllowCurves.Checked) + prOpts.SetRejectMessage(string.Format("\n{0}", m_ebEntRejectMessage.Text)); + + if (m_cbEntAllowLines.Checked) + prOpts.AddAllowedClass(typeof(Autodesk.AutoCAD.DatabaseServices.Line), m_ebEntDoIsATest.Checked); + + if (m_cbEntAllowCircles.Checked) + prOpts.AddAllowedClass(typeof(Autodesk.AutoCAD.DatabaseServices.Circle), m_ebEntDoIsATest.Checked); + + if (m_cbEntAllowCurves.Checked) + { + if (m_ebEntDoIsATest.Checked == true) + MessageBox.Show("There are no entities with an exact match of type Curve.\nYou should uncheck Exact Match to select any type of curve."); + prOpts.AddAllowedClass(typeof(Autodesk.AutoCAD.DatabaseServices.Curve), m_ebEntDoIsATest.Checked); + } + + if (m_cbEntAllowLockedLayer.Checked) + prOpts.AllowObjectOnLockedLayer = true; + + AddKeywordsToPrompt(prOpts, m_kwordsEnt, m_ebEntKwordDef.Text); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptEntityResult prRes = ed.GetEntity(prOpts); + + ShowPromptResult(prRes); + } + + private void + RunNestedEntityPrompt() + { + PromptNestedEntityOptions prOpts = new PromptNestedEntityOptions(string.Format("\n{0}", m_ebNentMessage.Text)); + prOpts.AllowNone = m_cbNentAllowNone.Checked; + prOpts.UseNonInteractivePickPoint = m_cbNentNonInterPickPt.Checked; + if (m_cbNentNonInterPickPt.Checked) + prOpts.NonInteractivePickPoint = GetPickPt(); + + AddKeywordsToPrompt(prOpts, m_kwordsNent, m_ebNentKwordDef.Text); + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptEntityResult prRes = ed.GetNestedEntity(prOpts); + + ShowPromptResult(prRes); + } + + /// + /// Some prompts have an optional base point to use. This just retrives that dynamically + /// before the actual prompt is issued (otherwise, we'd be typing in a point value in the + /// dialog, which would be no fun). + /// + /// the desired base point + + private Point3d + GetBasePt() + { + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + PromptPointResult prRes = ed.GetPoint("\nBase point to use for prompt"); + if (prRes.Status == PromptStatus.OK) + return prRes.Value; + else + return new Point3d(0.0, 0.0, 0.0); // TBD: should probably cancel prompt here + } + + private Point3d + GetPickPt() + { + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + PromptPointResult prRes = ed.GetPoint("\nPick point to use for prompt"); + if (prRes.Status == PromptStatus.OK) + return prRes.Value; + else + return new Point3d(0.0, 0.0, 0.0); // TBD: should probably cancel prompt here + } + + /// + /// Show all the values available from the PromptResult object + /// + /// the result of the prompt + + private void + ShowPromptResult(PromptResult prRes) + { + Snoop.Forms.Objects resForm = new Snoop.Forms.Objects(prRes); + resForm.ShowDialog(); + } + + /// + /// If any keywords were specified for the prompt, set those up here. + /// + /// The options that own the prompt keywords + /// The temporary collection of keywords the dialog collected + /// The default keyword (if any) to use. Pass string.Empty for no default + + private void + AddKeywordsToPrompt(PromptOptions prOpts, KeywordCollection kwords, string defKword) + { + foreach (Keyword kword in kwords) + prOpts.Keywords.Add(kword.GlobalName, kword.LocalName, kword.DisplayName, kword.Visible, kword.Enabled); + + if (defKword != string.Empty) + prOpts.Keywords.Default = defKword; + } + + /// + /// Add a new keyord to the collection. We add one with a default value and then + /// immediately go into Edit mode. + /// + /// + /// + + private void + OnKwordAdd(object sender, System.EventArgs e) + { + // we stashed away pointers to the relevant objects so that + // we wouldn't have to know which specific page was active. + // Retrieve the appropriate objects for the current page and + // do the common work. + Button bnClear = (Button)sender; + ListView lvKwords = (ListView)bnClear.Tag; + KeywordCollection kwords = (KeywordCollection)lvKwords.Tag; + + // add a new default kword to the collection and then + // immediately edit it. + kwords.Add("Global", "Local", "Display", true, true); + Keyword kword = kwords[kwords.Count - 1]; + + KeywordsForm kwordForm = new KeywordsForm(kword); + if (kwordForm.ShowDialog() == DialogResult.OK) + { + ListViewItem lvItem = new ListViewItem(kword.GlobalName); + lvItem.SubItems.Add(kword.LocalName); + lvItem.SubItems.Add(kword.DisplayName); + lvItem.SubItems.Add(kword.Enabled.ToString()); + lvItem.SubItems.Add(kword.Visible.ToString()); + lvItem.Selected = true; + + lvKwords.Items.Add(lvItem); + } + } + + /// + /// Edit the selected keyword values + /// + /// + /// + + private void + OnKwordEdit(object sender, System.EventArgs e) + { + // we stashed away pointers to the relevant objects so that + // we wouldn't have to know which specific page was active. + // Retrieve the appropriate objects for the current page and + // do the common work. + Button bnClear = (Button)sender; + ListView lvKwords = (ListView)bnClear.Tag; + KeywordCollection kwords = (KeywordCollection)lvKwords.Tag; + + if (lvKwords.SelectedItems.Count > 0) + { + ListViewItem lvItem = lvKwords.SelectedItems[0]; + Keyword kword = kwords[lvItem.Index]; + + KeywordsForm kwordForm = new KeywordsForm(kword); + + if (kwordForm.ShowDialog() == DialogResult.OK) + { + lvItem.Text = kword.GlobalName; + lvItem.SubItems[1].Text = kword.LocalName; + lvItem.SubItems[2].Text = kword.DisplayName; + lvItem.SubItems[3].Text = kword.Enabled.ToString(); + lvItem.SubItems[4].Text = kword.Visible.ToString(); + } + } + } + + /// + /// Remove all the keywords from the collection + /// + /// + /// + + private void + OnKwordClear(object sender, System.EventArgs e) + { + // we stashed away pointers to the relevant objects so that + // we wouldn't have to know which specific page was active. + // Retrieve the appropriate objects for the current page and + // do the common work. + Button bnClear = (Button)sender; + ListView lvKwords = (ListView)bnClear.Tag; + KeywordCollection kwords = (KeywordCollection)lvKwords.Tag; + + kwords.Clear(); + lvKwords.Items.Clear(); + } + + /// + /// Hardwire a set of test values so we don't have to go through + /// a bunch of steps when we don't really care what the atual keywords are. + /// + /// + /// + + private void + OnKwordHardwire(object sender, System.EventArgs e) + { + Button bnHardwire = (Button)sender; + ListView lvKwords = (ListView)bnHardwire.Tag; + KeywordCollection kwords = (KeywordCollection)lvKwords.Tag; + + // clear whatever is currently there + kwords.Clear(); + lvKwords.Items.Clear(); + + // hardwire some keywords so we don't have to do it for + // *EVERY* test case. + kwords.Add("Red", "Rojo", "Rojo", true, true); + kwords.Add("Green", "Verde", "Verde", true, true); + kwords.Add("Blue", "Azul", "Azul", true, true); + + foreach (Keyword kword in kwords) + { + ListViewItem lvItem = new ListViewItem(kword.GlobalName); + lvItem.SubItems.Add(kword.LocalName); + lvItem.SubItems.Add(kword.DisplayName); + lvItem.SubItems.Add(kword.Enabled.ToString()); + lvItem.SubItems.Add(kword.Visible.ToString()); + + lvKwords.Items.Add(lvItem); + } + } + + private void + OnEntAllowLines(object sender, System.EventArgs e) + { + if (m_cbEntAllowLines.Checked || m_cbEntAllowCircles.Checked || m_cbEntAllowCurves.Checked) + { + m_ebEntDoIsATest.Enabled = true; + m_ebEntRejectMessage.Enabled = true; + } + else + { + m_ebEntDoIsATest.Enabled = false; + m_ebEntRejectMessage.Enabled = false; + } + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Prompts/PromptTestForm.resx b/MgdDbgLibrary/Prompts/PromptTestForm.resx new file mode 100644 index 0000000..0bcff75 --- /dev/null +++ b/MgdDbgLibrary/Prompts/PromptTestForm.resx @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + PromptTestForm + + \ No newline at end of file diff --git a/MgdDbgLibrary/Prompts/SelectionSet.Designer.cs b/MgdDbgLibrary/Prompts/SelectionSet.Designer.cs new file mode 100644 index 0000000..c4eb036 --- /dev/null +++ b/MgdDbgLibrary/Prompts/SelectionSet.Designer.cs @@ -0,0 +1,417 @@ +namespace MgdDbg.Prompts { + partial class SelectionSet { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.m_bnCancel = new System.Windows.Forms.Button(); + this.m_bnOk = new System.Windows.Forms.Button(); + this.m_puMainSelectionMethod = new System.Windows.Forms.ComboBox(); + this.m_txtMainSelectionMethod = new System.Windows.Forms.Label(); + this.m_grpFlags = new System.Windows.Forms.GroupBox(); + this.m_cbSinglePickInSpace = new System.Windows.Forms.CheckBox(); + this.m_cbSingleOnly = new System.Windows.Forms.CheckBox(); + this.m_cbSelectEverythingInAperature = new System.Windows.Forms.CheckBox(); + this.m_cbRejectPaperSpaceViewport = new System.Windows.Forms.CheckBox(); + this.m_cbForceSubSelections = new System.Windows.Forms.CheckBox(); + this.m_cbAllowSubSelections = new System.Windows.Forms.CheckBox(); + this.m_cbAllowDuplicates = new System.Windows.Forms.CheckBox(); + this.m_cbRejectNonCurrentSpace = new System.Windows.Forms.CheckBox(); + this.m_cbFilterLockedLayers = new System.Windows.Forms.CheckBox(); + this.m_grpMessages = new System.Windows.Forms.GroupBox(); + this.m_cbMsgRemove = new System.Windows.Forms.CheckBox(); + this.m_cbMsgAdd = new System.Windows.Forms.CheckBox(); + this.m_ebMsgRemove = new System.Windows.Forms.TextBox(); + this.m_ebMsgAdd = new System.Windows.Forms.TextBox(); + this.m_grpFilter = new System.Windows.Forms.GroupBox(); + this.m_puClassType = new System.Windows.Forms.ComboBox(); + this.m_cbDoIsKindOfTest = new System.Windows.Forms.CheckBox(); + this.m_txtClassType = new System.Windows.Forms.Label(); + this.m_cbApplyFilter = new System.Windows.Forms.CheckBox(); + this.m_grpEvents = new System.Windows.Forms.GroupBox(); + this.m_cbUnknownEvent = new System.Windows.Forms.CheckBox(); + this.m_cbKeywordEvent = new System.Windows.Forms.CheckBox(); + this.m_grpFlags.SuspendLayout(); + this.m_grpMessages.SuspendLayout(); + this.m_grpFilter.SuspendLayout(); + this.m_grpEvents.SuspendLayout(); + this.SuspendLayout(); + // + // m_bnCancel + // + this.m_bnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnCancel.Location = new System.Drawing.Point(261, 345); + this.m_bnCancel.Name = "m_bnCancel"; + this.m_bnCancel.Size = new System.Drawing.Size(75, 23); + this.m_bnCancel.TabIndex = 1; + this.m_bnCancel.Text = "Cancel"; + this.m_bnCancel.UseVisualStyleBackColor = true; + // + // m_bnOk + // + this.m_bnOk.Location = new System.Drawing.Point(181, 345); + this.m_bnOk.Name = "m_bnOk"; + this.m_bnOk.Size = new System.Drawing.Size(75, 23); + this.m_bnOk.TabIndex = 0; + this.m_bnOk.Text = "< Run Test"; + this.m_bnOk.UseVisualStyleBackColor = true; + this.m_bnOk.Click += new System.EventHandler(this.OnRunTest); + // + // m_puMainSelectionMethod + // + this.m_puMainSelectionMethod.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.m_puMainSelectionMethod.FormattingEnabled = true; + this.m_puMainSelectionMethod.Items.AddRange(new object[] { + "User", + "All", + "Implied", + "Crossing", + "Crossing Polygon", + "Fence", + "Last", + "Previous", + "Window", + "Window Polygon"}); + this.m_puMainSelectionMethod.Location = new System.Drawing.Point(138, 23); + this.m_puMainSelectionMethod.MaxDropDownItems = 13; + this.m_puMainSelectionMethod.Name = "m_puMainSelectionMethod"; + this.m_puMainSelectionMethod.Size = new System.Drawing.Size(219, 21); + this.m_puMainSelectionMethod.TabIndex = 3; + this.m_puMainSelectionMethod.SelectedIndexChanged += new System.EventHandler(this.OnSelectionMethodChanged); + // + // m_txtMainSelectionMethod + // + this.m_txtMainSelectionMethod.AutoSize = true; + this.m_txtMainSelectionMethod.Location = new System.Drawing.Point(13, 26); + this.m_txtMainSelectionMethod.Name = "m_txtMainSelectionMethod"; + this.m_txtMainSelectionMethod.Size = new System.Drawing.Size(119, 13); + this.m_txtMainSelectionMethod.TabIndex = 2; + this.m_txtMainSelectionMethod.Text = "Main Selection Method:"; + // + // m_grpFlags + // + this.m_grpFlags.Controls.Add(this.m_cbSinglePickInSpace); + this.m_grpFlags.Controls.Add(this.m_cbSingleOnly); + this.m_grpFlags.Controls.Add(this.m_cbSelectEverythingInAperature); + this.m_grpFlags.Controls.Add(this.m_cbRejectPaperSpaceViewport); + this.m_grpFlags.Controls.Add(this.m_cbForceSubSelections); + this.m_grpFlags.Controls.Add(this.m_cbAllowSubSelections); + this.m_grpFlags.Controls.Add(this.m_cbAllowDuplicates); + this.m_grpFlags.Controls.Add(this.m_cbRejectNonCurrentSpace); + this.m_grpFlags.Controls.Add(this.m_cbFilterLockedLayers); + this.m_grpFlags.Location = new System.Drawing.Point(16, 64); + this.m_grpFlags.Name = "m_grpFlags"; + this.m_grpFlags.Size = new System.Drawing.Size(195, 259); + this.m_grpFlags.TabIndex = 4; + this.m_grpFlags.TabStop = false; + this.m_grpFlags.Text = "Options"; + // + // m_cbSinglePickInSpace + // + this.m_cbSinglePickInSpace.AutoSize = true; + this.m_cbSinglePickInSpace.Location = new System.Drawing.Point(7, 211); + this.m_cbSinglePickInSpace.Name = "m_cbSinglePickInSpace"; + this.m_cbSinglePickInSpace.Size = new System.Drawing.Size(125, 17); + this.m_cbSinglePickInSpace.TabIndex = 8; + this.m_cbSinglePickInSpace.Text = "Single Pick In Space"; + this.m_cbSinglePickInSpace.UseVisualStyleBackColor = true; + // + // m_cbSingleOnly + // + this.m_cbSingleOnly.AutoSize = true; + this.m_cbSingleOnly.Location = new System.Drawing.Point(7, 187); + this.m_cbSingleOnly.Name = "m_cbSingleOnly"; + this.m_cbSingleOnly.Size = new System.Drawing.Size(79, 17); + this.m_cbSingleOnly.TabIndex = 7; + this.m_cbSingleOnly.Text = "Single Only"; + this.m_cbSingleOnly.UseVisualStyleBackColor = true; + // + // m_cbSelectEverythingInAperature + // + this.m_cbSelectEverythingInAperature.AutoSize = true; + this.m_cbSelectEverythingInAperature.Location = new System.Drawing.Point(7, 163); + this.m_cbSelectEverythingInAperature.Name = "m_cbSelectEverythingInAperature"; + this.m_cbSelectEverythingInAperature.Size = new System.Drawing.Size(164, 17); + this.m_cbSelectEverythingInAperature.TabIndex = 6; + this.m_cbSelectEverythingInAperature.Text = "Select Everything In Aperture"; + this.m_cbSelectEverythingInAperature.UseVisualStyleBackColor = true; + // + // m_cbRejectPaperSpaceViewport + // + this.m_cbRejectPaperSpaceViewport.AutoSize = true; + this.m_cbRejectPaperSpaceViewport.Location = new System.Drawing.Point(7, 69); + this.m_cbRejectPaperSpaceViewport.Name = "m_cbRejectPaperSpaceViewport"; + this.m_cbRejectPaperSpaceViewport.Size = new System.Drawing.Size(166, 17); + this.m_cbRejectPaperSpaceViewport.TabIndex = 5; + this.m_cbRejectPaperSpaceViewport.Text = "Reject Paper Space Viewport"; + this.m_cbRejectPaperSpaceViewport.UseVisualStyleBackColor = true; + // + // m_cbForceSubSelections + // + this.m_cbForceSubSelections.AutoSize = true; + this.m_cbForceSubSelections.Location = new System.Drawing.Point(7, 140); + this.m_cbForceSubSelections.Name = "m_cbForceSubSelections"; + this.m_cbForceSubSelections.Size = new System.Drawing.Size(127, 17); + this.m_cbForceSubSelections.TabIndex = 4; + this.m_cbForceSubSelections.Text = "Force Sub-Selections"; + this.m_cbForceSubSelections.UseVisualStyleBackColor = true; + this.m_cbForceSubSelections.CheckedChanged += new System.EventHandler(this.OnAllowSubSelectionChecked); + // + // m_cbAllowSubSelections + // + this.m_cbAllowSubSelections.AutoSize = true; + this.m_cbAllowSubSelections.Location = new System.Drawing.Point(7, 116); + this.m_cbAllowSubSelections.Name = "m_cbAllowSubSelections"; + this.m_cbAllowSubSelections.Size = new System.Drawing.Size(125, 17); + this.m_cbAllowSubSelections.TabIndex = 3; + this.m_cbAllowSubSelections.Text = "Allow Sub-Selections"; + this.m_cbAllowSubSelections.UseVisualStyleBackColor = true; + this.m_cbAllowSubSelections.CheckedChanged += new System.EventHandler(this.OnAllowSubSelectionChecked); + // + // m_cbAllowDuplicates + // + this.m_cbAllowDuplicates.AutoSize = true; + this.m_cbAllowDuplicates.Location = new System.Drawing.Point(7, 92); + this.m_cbAllowDuplicates.Name = "m_cbAllowDuplicates"; + this.m_cbAllowDuplicates.Size = new System.Drawing.Size(104, 17); + this.m_cbAllowDuplicates.TabIndex = 2; + this.m_cbAllowDuplicates.Text = "Allow Duplicates"; + this.m_cbAllowDuplicates.UseVisualStyleBackColor = true; + // + // m_cbRejectNonCurrentSpace + // + this.m_cbRejectNonCurrentSpace.AutoSize = true; + this.m_cbRejectNonCurrentSpace.Location = new System.Drawing.Point(7, 44); + this.m_cbRejectNonCurrentSpace.Name = "m_cbRejectNonCurrentSpace"; + this.m_cbRejectNonCurrentSpace.Size = new System.Drawing.Size(151, 17); + this.m_cbRejectNonCurrentSpace.TabIndex = 1; + this.m_cbRejectNonCurrentSpace.Text = "Reject Non-Current Space"; + this.m_cbRejectNonCurrentSpace.UseVisualStyleBackColor = true; + // + // m_cbFilterLockedLayers + // + this.m_cbFilterLockedLayers.AutoSize = true; + this.m_cbFilterLockedLayers.Location = new System.Drawing.Point(7, 20); + this.m_cbFilterLockedLayers.Name = "m_cbFilterLockedLayers"; + this.m_cbFilterLockedLayers.Size = new System.Drawing.Size(121, 17); + this.m_cbFilterLockedLayers.TabIndex = 0; + this.m_cbFilterLockedLayers.Text = "Filter Locked Layers"; + this.m_cbFilterLockedLayers.UseVisualStyleBackColor = true; + // + // m_grpMessages + // + this.m_grpMessages.Controls.Add(this.m_cbMsgRemove); + this.m_grpMessages.Controls.Add(this.m_cbMsgAdd); + this.m_grpMessages.Controls.Add(this.m_ebMsgRemove); + this.m_grpMessages.Controls.Add(this.m_ebMsgAdd); + this.m_grpMessages.Location = new System.Drawing.Point(234, 64); + this.m_grpMessages.Name = "m_grpMessages"; + this.m_grpMessages.Size = new System.Drawing.Size(268, 77); + this.m_grpMessages.TabIndex = 5; + this.m_grpMessages.TabStop = false; + this.m_grpMessages.Text = "Messages"; + // + // m_cbMsgRemove + // + this.m_cbMsgRemove.AutoSize = true; + this.m_cbMsgRemove.Location = new System.Drawing.Point(6, 46); + this.m_cbMsgRemove.Name = "m_cbMsgRemove"; + this.m_cbMsgRemove.Size = new System.Drawing.Size(69, 17); + this.m_cbMsgRemove.TabIndex = 5; + this.m_cbMsgRemove.Text = "Remove:"; + this.m_cbMsgRemove.UseVisualStyleBackColor = true; + this.m_cbMsgRemove.CheckedChanged += new System.EventHandler(this.OnMessageRemoveChecked); + // + // m_cbMsgAdd + // + this.m_cbMsgAdd.AutoSize = true; + this.m_cbMsgAdd.Location = new System.Drawing.Point(7, 20); + this.m_cbMsgAdd.Name = "m_cbMsgAdd"; + this.m_cbMsgAdd.Size = new System.Drawing.Size(48, 17); + this.m_cbMsgAdd.TabIndex = 4; + this.m_cbMsgAdd.Text = "Add:"; + this.m_cbMsgAdd.UseVisualStyleBackColor = true; + this.m_cbMsgAdd.CheckedChanged += new System.EventHandler(this.OnMessageAddChecked); + // + // m_ebMsgRemove + // + this.m_ebMsgRemove.Location = new System.Drawing.Point(78, 46); + this.m_ebMsgRemove.Name = "m_ebMsgRemove"; + this.m_ebMsgRemove.Size = new System.Drawing.Size(172, 20); + this.m_ebMsgRemove.TabIndex = 3; + // + // m_ebMsgAdd + // + this.m_ebMsgAdd.Location = new System.Drawing.Point(78, 20); + this.m_ebMsgAdd.Name = "m_ebMsgAdd"; + this.m_ebMsgAdd.Size = new System.Drawing.Size(172, 20); + this.m_ebMsgAdd.TabIndex = 0; + // + // m_grpFilter + // + this.m_grpFilter.Controls.Add(this.m_puClassType); + this.m_grpFilter.Controls.Add(this.m_cbDoIsKindOfTest); + this.m_grpFilter.Controls.Add(this.m_txtClassType); + this.m_grpFilter.Controls.Add(this.m_cbApplyFilter); + this.m_grpFilter.Location = new System.Drawing.Point(234, 147); + this.m_grpFilter.Name = "m_grpFilter"; + this.m_grpFilter.Size = new System.Drawing.Size(268, 100); + this.m_grpFilter.TabIndex = 6; + this.m_grpFilter.TabStop = false; + this.m_grpFilter.Text = "Filter"; + // + // m_puClassType + // + this.m_puClassType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.m_puClassType.FormattingEnabled = true; + this.m_puClassType.Location = new System.Drawing.Point(78, 41); + this.m_puClassType.Name = "m_puClassType"; + this.m_puClassType.Size = new System.Drawing.Size(171, 21); + this.m_puClassType.TabIndex = 4; + // + // m_cbDoIsKindOfTest + // + this.m_cbDoIsKindOfTest.AutoSize = true; + this.m_cbDoIsKindOfTest.Location = new System.Drawing.Point(10, 71); + this.m_cbDoIsKindOfTest.Name = "m_cbDoIsKindOfTest"; + this.m_cbDoIsKindOfTest.Size = new System.Drawing.Size(140, 17); + this.m_cbDoIsKindOfTest.TabIndex = 3; + this.m_cbDoIsKindOfTest.Text = "Include Derived Classes"; + this.m_cbDoIsKindOfTest.UseVisualStyleBackColor = true; + // + // m_txtClassType + // + this.m_txtClassType.AutoSize = true; + this.m_txtClassType.Location = new System.Drawing.Point(10, 44); + this.m_txtClassType.Name = "m_txtClassType"; + this.m_txtClassType.Size = new System.Drawing.Size(62, 13); + this.m_txtClassType.TabIndex = 1; + this.m_txtClassType.Text = "Class Type:"; + // + // m_cbApplyFilter + // + this.m_cbApplyFilter.AutoSize = true; + this.m_cbApplyFilter.Location = new System.Drawing.Point(10, 20); + this.m_cbApplyFilter.Name = "m_cbApplyFilter"; + this.m_cbApplyFilter.Size = new System.Drawing.Size(77, 17); + this.m_cbApplyFilter.TabIndex = 0; + this.m_cbApplyFilter.Text = "Apply Filter"; + this.m_cbApplyFilter.UseVisualStyleBackColor = true; + this.m_cbApplyFilter.CheckedChanged += new System.EventHandler(this.OnApplyFilterChecked); + // + // m_grpEvents + // + this.m_grpEvents.Controls.Add(this.m_cbUnknownEvent); + this.m_grpEvents.Controls.Add(this.m_cbKeywordEvent); + this.m_grpEvents.Location = new System.Drawing.Point(234, 253); + this.m_grpEvents.Name = "m_grpEvents"; + this.m_grpEvents.Size = new System.Drawing.Size(268, 70); + this.m_grpEvents.TabIndex = 7; + this.m_grpEvents.TabStop = false; + this.m_grpEvents.Text = "Events"; + // + // m_cbUnknownEvent + // + this.m_cbUnknownEvent.AutoSize = true; + this.m_cbUnknownEvent.Location = new System.Drawing.Point(7, 44); + this.m_cbUnknownEvent.Name = "m_cbUnknownEvent"; + this.m_cbUnknownEvent.Size = new System.Drawing.Size(103, 17); + this.m_cbUnknownEvent.TabIndex = 1; + this.m_cbUnknownEvent.Text = "Unknown Event"; + this.m_cbUnknownEvent.UseVisualStyleBackColor = true; + // + // m_cbKeywordEvent + // + this.m_cbKeywordEvent.AutoSize = true; + this.m_cbKeywordEvent.Location = new System.Drawing.Point(7, 20); + this.m_cbKeywordEvent.Name = "m_cbKeywordEvent"; + this.m_cbKeywordEvent.Size = new System.Drawing.Size(239, 17); + this.m_cbKeywordEvent.TabIndex = 0; + this.m_cbKeywordEvent.Text = "Keyword Event (will use \"Red Green Blue\")"; + this.m_cbKeywordEvent.UseVisualStyleBackColor = true; + // + // SelectionSet + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.m_bnCancel; + this.ClientSize = new System.Drawing.Size(517, 380); + this.Controls.Add(this.m_grpEvents); + this.Controls.Add(this.m_grpFilter); + this.Controls.Add(this.m_grpMessages); + this.Controls.Add(this.m_grpFlags); + this.Controls.Add(this.m_txtMainSelectionMethod); + this.Controls.Add(this.m_puMainSelectionMethod); + this.Controls.Add(this.m_bnOk); + this.Controls.Add(this.m_bnCancel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "SelectionSet"; + this.Text = "SelectionSet"; + this.m_grpFlags.ResumeLayout(false); + this.m_grpFlags.PerformLayout(); + this.m_grpMessages.ResumeLayout(false); + this.m_grpMessages.PerformLayout(); + this.m_grpFilter.ResumeLayout(false); + this.m_grpFilter.PerformLayout(); + this.m_grpEvents.ResumeLayout(false); + this.m_grpEvents.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button m_bnCancel; + private System.Windows.Forms.Button m_bnOk; + private System.Windows.Forms.ComboBox m_puMainSelectionMethod; + private System.Windows.Forms.Label m_txtMainSelectionMethod; + private System.Windows.Forms.GroupBox m_grpFlags; + private System.Windows.Forms.CheckBox m_cbForceSubSelections; + private System.Windows.Forms.CheckBox m_cbAllowSubSelections; + private System.Windows.Forms.CheckBox m_cbAllowDuplicates; + private System.Windows.Forms.CheckBox m_cbRejectNonCurrentSpace; + private System.Windows.Forms.CheckBox m_cbFilterLockedLayers; + private System.Windows.Forms.GroupBox m_grpMessages; + private System.Windows.Forms.TextBox m_ebMsgAdd; + private System.Windows.Forms.TextBox m_ebMsgRemove; + private System.Windows.Forms.CheckBox m_cbSinglePickInSpace; + private System.Windows.Forms.CheckBox m_cbSingleOnly; + private System.Windows.Forms.CheckBox m_cbSelectEverythingInAperature; + private System.Windows.Forms.CheckBox m_cbRejectPaperSpaceViewport; + private System.Windows.Forms.GroupBox m_grpFilter; + private System.Windows.Forms.CheckBox m_cbDoIsKindOfTest; + private System.Windows.Forms.Label m_txtClassType; + private System.Windows.Forms.CheckBox m_cbApplyFilter; + private System.Windows.Forms.GroupBox m_grpEvents; + private System.Windows.Forms.CheckBox m_cbKeywordEvent; + private System.Windows.Forms.CheckBox m_cbUnknownEvent; + private System.Windows.Forms.ComboBox m_puClassType; + private System.Windows.Forms.CheckBox m_cbMsgRemove; + private System.Windows.Forms.CheckBox m_cbMsgAdd; + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Prompts/SelectionSet.cs b/MgdDbgLibrary/Prompts/SelectionSet.cs new file mode 100644 index 0000000..08de1b3 --- /dev/null +++ b/MgdDbgLibrary/Prompts/SelectionSet.cs @@ -0,0 +1,481 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using System.Collections; +using System.Diagnostics; +using System.Windows.Forms; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.Runtime; +using AcadApp = Autodesk.AutoCAD.ApplicationServices; + +namespace MgdDbg.Prompts { + + public partial class SelectionSet : Form { + + enum SelectionMethod { + kUser = 0, + kAll, + kImplied, + kCrossing, + kCrossingPolygon, + kFence, + kLast, + kPrevious, + kWindow, + kWindowPolygon, + }; + + private Editor m_editor; + private ArrayList m_entityClasses = new ArrayList(); + + public + SelectionSet() + { + m_editor = AcadApp.Application.DocumentManager.MdiActiveDocument.Editor; + + InitializeComponent(); + + m_puMainSelectionMethod.SelectedIndex = 0; // Select user mode by default + + GetClassesDerivedFrom((RXClass)SystemObjects.ClassDictionary["AcDbEntity"], m_entityClasses, true); + foreach (RXClass tmpClass in m_entityClasses) { + m_puClassType.Items.Add(tmpClass.Name); + } + + m_puClassType.SelectedItem = "AcDbEntity"; // have this be the default class + } + + private void + OnRunTest(object sender, EventArgs e) + { + /// start user interaction object so that this form + /// does not interfere with user selection in editor + EditorUserInteraction userInteraction = m_editor.StartUserInteraction(this); + + SelectionMethod selMethod = (SelectionMethod)m_puMainSelectionMethod.SelectedIndex; + + if (selMethod == SelectionMethod.kUser) + SelectionUser(); + else if (selMethod == SelectionMethod.kAll) + SelectionAll(); + else if (selMethod == SelectionMethod.kImplied) + SelectionImplied(); + else if (selMethod == SelectionMethod.kCrossing) + SelectionCrossing(); + else if (selMethod == SelectionMethod.kCrossingPolygon) + SelectionCrossingPolygon(); + else if (selMethod == SelectionMethod.kFence) + SelectionFence(); + else if (selMethod == SelectionMethod.kLast) + SelectionLast(); + else if (selMethod == SelectionMethod.kPrevious) + SelectionPrevious(); + else if (selMethod == SelectionMethod.kWindow) + SelectionWindow(); + else if (selMethod == SelectionMethod.kWindowPolygon) + SelectionWindowPolygon(); + else { + Debug.Assert(false); + } + + userInteraction.End(); + } + + #region Selection Methods + + private void + SelectionUser() + { + PromptSelectionOptions selOpts = new PromptSelectionOptions(); + + selOpts.AllowSubSelections = m_cbAllowSubSelections.Checked; + selOpts.ForceSubSelections = m_cbForceSubSelections.Checked; + if (m_cbAllowDuplicates.Checked) { // only if not in combination with the others + if ((selOpts.AllowSubSelections == false) && (selOpts.ForceSubSelections == false)) + selOpts.AllowDuplicates = true; + } + selOpts.RejectObjectsFromNonCurrentSpace = m_cbRejectNonCurrentSpace.Checked; + selOpts.RejectObjectsOnLockedLayers = m_cbFilterLockedLayers.Checked; + selOpts.RejectPaperspaceViewport = m_cbRejectPaperSpaceViewport.Checked; + selOpts.SelectEverythingInAperture = m_cbSelectEverythingInAperature.Checked; + selOpts.SingleOnly = m_cbSingleOnly.Checked; + selOpts.SinglePickInSpace = m_cbSinglePickInSpace.Checked; + + if (m_cbMsgAdd.Checked) + selOpts.MessageForAdding = m_ebMsgAdd.Text; + + if (m_cbMsgRemove.Checked) + selOpts.MessageForRemoval = m_ebMsgRemove.Text; + + if (m_cbKeywordEvent.Checked) { + selOpts.Keywords.Add("Red"); + selOpts.Keywords.Add("Green"); + selOpts.Keywords.Add("Blue"); + + selOpts.KeywordInput += new SelectionTextInputEventHandler(event_KeywordInput); + } + + if (m_cbUnknownEvent.Checked) { + selOpts.UnknownInput += new SelectionTextInputEventHandler(event_UnknownInput); + } + + selOpts.PrepareOptionalDetails = true; // always turn this on so we get all info available for the test + + PromptSelectionResult result; + if (m_cbApplyFilter.Checked) + result = m_editor.GetSelection(selOpts, GetSelectionFilter()); + else + result = m_editor.GetSelection(selOpts); + + ShowPromptResult("Select: User", result); + } + + /// + /// Callback function for our keywords + /// + /// + /// + + void + event_KeywordInput(object sender, SelectionTextInputEventArgs e) + { + MessageBox.Show(string.Format("Keyword event: {0}", e.Input), "KeywordInput Event"); + } + + /// + /// Callback function for when we get input that isn't recognized as anything else + /// + /// + /// + + void + event_UnknownInput(object sender, SelectionTextInputEventArgs e) + { + MessageBox.Show(string.Format("Unknown event: {0}", e.Input), "UnknownInput Event"); + } + + private void + SelectionImplied() + { + PromptSelectionResult result = m_editor.SelectImplied(); + + ShowPromptResult("Select: Implied", result); + } + + private void + SelectionCrossing() + { + Point3d pt1, pt2; + if (Utils.AcadUi.GetCorners(out pt1, out pt2)) { + PromptSelectionResult result; + if (m_cbApplyFilter.Checked) + result = m_editor.SelectCrossingWindow(pt1, pt2, GetSelectionFilter()); + else + result = m_editor.SelectCrossingWindow(pt1, pt2); + + ShowPromptResult("Select: Crossing Window", result); + } + } + + private void + SelectionCrossingPolygon() + { + Point3dCollection pts = new Point3dCollection(); + if (Utils.AcadUi.GetPline3dCollection(pts)) { + PromptSelectionResult result; + if (m_cbApplyFilter.Checked) + result = m_editor.SelectCrossingPolygon(pts, GetSelectionFilter()); + else + result = m_editor.SelectCrossingPolygon(pts); + + ShowPromptResult("Select: Crossing Polygon", result); + } + } + + private void + SelectionFence() + { + Point3dCollection pts = new Point3dCollection(); + if (Utils.AcadUi.GetPline3dCollection(pts)) { + PromptSelectionResult result; + if (m_cbApplyFilter.Checked) + result = m_editor.SelectFence(pts, GetSelectionFilter()); + else + result = m_editor.SelectFence(pts); + + ShowPromptResult("Select: Fence", result); + } + } + + private void + SelectionLast() + { + PromptSelectionResult result = m_editor.SelectLast(); + + ShowPromptResult("Select: Last", result); + } + + private void + SelectionPrevious() + { + PromptSelectionResult result = m_editor.SelectPrevious(); + + ShowPromptResult("Select: Previous", result); + } + + private void + SelectionWindow() + { + Point3d pt1, pt2; + if (Utils.AcadUi.GetCorners(out pt1, out pt2)) { + PromptSelectionResult result; + if (m_cbApplyFilter.Checked) + result = m_editor.SelectWindow(pt1, pt2, GetSelectionFilter()); + else + result = m_editor.SelectWindow(pt1, pt2); + + ShowPromptResult("Select: Window", result); + } + } + + private void + SelectionWindowPolygon() + { + Point3dCollection pts = new Point3dCollection(); + if (Utils.AcadUi.GetPline3dCollection(pts)) { + PromptSelectionResult result; + if (m_cbApplyFilter.Checked) + result = m_editor.SelectWindowPolygon(pts, GetSelectionFilter()); + else + result = m_editor.SelectWindowPolygon(pts); + + ShowPromptResult("Select: Window Polygon", result); + } + } + + private void + SelectionAll() + { + PromptSelectionResult result; + if (m_cbApplyFilter.Checked) + result = m_editor.SelectAll(GetSelectionFilter()); + else + result = m_editor.SelectAll(); + + ShowPromptResult("Select: All", result); + } + + #endregion + + private void + ShowPromptResult(string dboxTitle, PromptSelectionResult result) + { + if (result.Status == PromptStatus.OK) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(result.Value); + dbox.Text = dboxTitle; + AcadApp.Application.ShowModalDialog(dbox); + } + else { + MessageBox.Show(string.Format("Prompt status: {0}", result.Status.ToString()), "PromptSelectionResult"); + } + } + + private void + OnSelectionMethodChanged(object sender, EventArgs e) + { + SelectionMethod selMethod = (SelectionMethod)m_puMainSelectionMethod.SelectedIndex; + + if (selMethod == SelectionMethod.kUser) { + SetFlagModes(true); + SetKeywordModes(true); + SetPromptModes(true); + SetFilterModes(true); + } + else if ((selMethod == SelectionMethod.kLast) || + (selMethod == SelectionMethod.kImplied) || + (selMethod == SelectionMethod.kPrevious)) { + SetFlagModes(false); + SetKeywordModes(false); + SetPromptModes(false); + SetFilterModes(false); + } + else { + SetFlagModes(false); + SetKeywordModes(false); + SetPromptModes(false); + SetFilterModes(true); + } + } + + private void + SetFlagModes(bool allowed) + { + m_grpFlags.Enabled = allowed; + + if (allowed) { + if ((m_cbAllowSubSelections.Checked) || (m_cbForceSubSelections.Checked)) { + m_cbAllowDuplicates.Enabled = false; // can't combine Duplicates and sub-entity + } + } + } + + private void + SetKeywordModes(bool allowed) + { + m_grpEvents.Enabled = allowed; + } + + private void + SetPromptModes(bool allowed) + { + if (allowed == false) { + m_grpMessages.Enabled = false; + } + else { + m_grpMessages.Enabled = true; + m_cbMsgAdd.Enabled = true; + m_cbMsgRemove.Enabled = true; + + m_ebMsgAdd.Enabled = m_cbMsgAdd.Checked; + m_ebMsgRemove.Enabled = m_cbMsgRemove.Checked; + } + } + + private void + SetFilterModes(bool allowed) + { + if (allowed == false) { + m_grpFilter.Enabled = false; + } + else { + m_grpFilter.Enabled = true; + m_cbApplyFilter.Enabled = true; + + m_puClassType.Enabled = m_cbApplyFilter.Checked; + m_txtClassType.Enabled = m_cbApplyFilter.Checked; + m_cbDoIsKindOfTest.Enabled = m_cbApplyFilter.Checked; + } + } + + private void + OnApplyFilterChecked(object sender, EventArgs e) + { + m_puClassType.Enabled = m_cbApplyFilter.Checked; + m_txtClassType.Enabled = m_cbApplyFilter.Checked; + m_cbDoIsKindOfTest.Enabled = m_cbApplyFilter.Checked; + } + + private void + OnMessageAddChecked(object sender, EventArgs e) + { + m_ebMsgAdd.Enabled = m_cbMsgAdd.Checked; + } + + private void + OnMessageRemoveChecked(object sender, EventArgs e) + { + m_ebMsgRemove.Enabled = m_cbMsgRemove.Checked; + } + + private void + OnAllowSubSelectionChecked(object sender, EventArgs e) + { + if ((m_cbAllowSubSelections.Checked) || (m_cbForceSubSelections.Checked)) + m_cbAllowDuplicates.Enabled = false; // can't combine Duplicates and sub-entity + else + m_cbAllowDuplicates.Enabled = true; + } + + private void + GetClassesDerivedFrom(RXClass searchClassType, ArrayList derivedClasses, bool allowClassesWithoutDxfName) + { + Debug.Assert(derivedClasses != null); + + Dictionary dict = SystemObjects.ClassDictionary; + if (dict != null) { + IEnumerable enumerable = dict as IEnumerable; + if (enumerable != null) { + IEnumerator enumerator = enumerable.GetEnumerator(); + while (enumerator.MoveNext()) { + RXClass rxClass = (RXClass)((DictionaryEntry)enumerator.Current).Value; + if (rxClass.IsDerivedFrom(searchClassType)) { + if (!allowClassesWithoutDxfName && ((rxClass.DxfName == null) || (rxClass.DxfName == string.Empty))) { + // skip it + } + else { + if (derivedClasses.Contains(rxClass) == false) + derivedClasses.Add(rxClass); + } + } + } + } + } + } + + private SelectionFilter + GetSelectionFilter() + { + RXClass selectedClass = (RXClass)SystemObjects.ClassDictionary[(string)m_puClassType.SelectedItem]; + if (selectedClass != null) { + // see if they want this class plus all derived classes + if (m_cbDoIsKindOfTest.Checked == false) { + // just this class, use a simple filter + TypedValue[] fitlerPairs = { + new TypedValue((int)DxfCode.Start, selectedClass.DxfName), + }; + return new SelectionFilter(fitlerPairs); + } + else { + // look up all derived classes and use a big "OR" statement + ArrayList filterClasses = new ArrayList(); + GetClassesDerivedFrom(selectedClass, filterClasses, false /* don't allow classes without a DXF name*/); + + int i=0; + TypedValue[] values = new TypedValue[filterClasses.Count+2]; + + values[i++] = new TypedValue((int)DxfCode.Operator, ""); + + // in case you want to see what the filter looks like + //foreach (TypedValue tv in values) { + // m_editor.WriteMessage(string.Format("\nFilter Pair: {0}", tv.ToString())); + //} + + return new SelectionFilter(values); + } + } + + return null; + } + + + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Prompts/SelectionSet.resx b/MgdDbgLibrary/Prompts/SelectionSet.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/MgdDbgLibrary/Prompts/SelectionSet.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MgdDbgLibrary/Properties/Resources.Designer.cs b/MgdDbgLibrary/Properties/Resources.Designer.cs new file mode 100644 index 0000000..835d782 --- /dev/null +++ b/MgdDbgLibrary/Properties/Resources.Designer.cs @@ -0,0 +1,93 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace MgdDbg.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MgdDbg.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap COPY1 { + get { + object obj = ResourceManager.GetObject("COPY1", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Preview1 { + get { + object obj = ResourceManager.GetObject("Preview1", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Print1 { + get { + object obj = ResourceManager.GetObject("Print1", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/MgdDbgLibrary/Properties/Resources.resx b/MgdDbgLibrary/Properties/Resources.resx new file mode 100644 index 0000000..66d9b7a --- /dev/null +++ b/MgdDbgLibrary/Properties/Resources.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\res\Preview.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\Print.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\COPY.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/MgdDbgLibrary/README.md b/MgdDbgLibrary/README.md new file mode 100644 index 0000000..c1622d9 --- /dev/null +++ b/MgdDbgLibrary/README.md @@ -0,0 +1,9 @@ +# MgdDbg + +Inspection tool for AutoCAD Database (DWG) created with .NET. + +# Setup + +Open the MgdDbg.sln with Visual Studio (this version was tested with Visual Studio 2015). It should Build as is. If references are missing, go to project properties, Reference Path tab and adjust the AutoCAD install path. + +Start AutoCAD, type NETLOAD command, select the DLL under /bin/debug/MgdDbg.dll. Right click on the drawing area, the menu item MgdDbg should appear with the options. diff --git a/MgdDbgLibrary/Reactors/Events/ApplicationEvents.cs b/MgdDbgLibrary/Reactors/Events/ApplicationEvents.cs new file mode 100644 index 0000000..2cb10c4 --- /dev/null +++ b/MgdDbgLibrary/Reactors/Events/ApplicationEvents.cs @@ -0,0 +1,140 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using Autodesk.AutoCAD.ApplicationServices; + +namespace MgdDbg.Reactors.Events +{ + + public class ApplicationEvents : EventsBase + { + + public + ApplicationEvents() + { + } + + protected override void + EnableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nApplication Events Turned On ...\n"); + + Application.BeginQuit += Application_BeginQuit; + Application.DisplayingCustomizeDialog += new TabbedDialogEventHandler(event_DisplayingCustomizeDialog); + Application.DisplayingDraftingSettingsDialog += new TabbedDialogEventHandler(event_DisplayingDraftingSettingsDialog); + Application.DisplayingOptionDialog += new TabbedDialogEventHandler(event_DisplayingOptionDialog); + Application.QuitAborted += new EventHandler(event_QuitAborted); + Application.QuitWillStart += new EventHandler(event_QuitWillStart); + Application.SystemVariableChanged += new SystemVariableChangedEventHandler(event_SystemVariableChanged); + Application.SystemVariableChanging += new SystemVariableChangingEventHandler(event_SystemVariableChanging); + } + + private void Application_BeginQuit(object sender, BeginQuitEventArgs e) + { + PrintEventMessage("Begin Quit"); + } + + protected override void + DisableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nApplication Events Turned Off ...\n"); + + Application.BeginQuit -= Application_BeginQuit; + Application.DisplayingCustomizeDialog -= new TabbedDialogEventHandler(event_DisplayingCustomizeDialog); + Application.DisplayingDraftingSettingsDialog -= new TabbedDialogEventHandler(event_DisplayingDraftingSettingsDialog); + Application.DisplayingOptionDialog -= new TabbedDialogEventHandler(event_DisplayingOptionDialog); + Application.QuitAborted -= new EventHandler(event_QuitAborted); + Application.QuitWillStart -= new EventHandler(event_QuitWillStart); + Application.SystemVariableChanged -= new SystemVariableChangedEventHandler(event_SystemVariableChanged); + Application.SystemVariableChanging -= new SystemVariableChangingEventHandler(event_SystemVariableChanging); + } + + + private void + event_DisplayingCustomizeDialog(object sender, TabbedDialogEventArgs e) + { + PrintEventMessage("Displaying Customize Dialog"); + } + + private void + event_DisplayingDraftingSettingsDialog(object sender, TabbedDialogEventArgs e) + { + PrintEventMessage("Displaying Drafting Settings Dialog"); + } + + private void + event_DisplayingOptionDialog(object sender, TabbedDialogEventArgs e) + { + PrintEventMessage("Displaying Option Dialog"); + } + + private void + event_QuitAborted(object sender, EventArgs e) + { + PrintEventMessage("Quit Aborted"); + } + + private void + event_QuitWillStart(object sender, EventArgs e) + { + PrintEventMessage("Quit Will Start"); + } + + private void + event_SystemVariableChanged(object sender, SystemVariableChangedEventArgs e) + { + if (e.Changed) + PrintEventMessage("System Var Changed", e.Name); + else + PrintEventMessage("System Var Not Changed Successfully", e.Name); + } + + private void + event_SystemVariableChanging(object sender, SystemVariableChangingEventArgs e) + { + PrintEventMessage("System Var Changing", e.Name); + } + + + + #region Print Abstraction + + private void + PrintEventMessage(string eventStr) + { + string printString = string.Format("\n[App Event] : {0,-25}", eventStr); + Utils.AcadUi.PrintToCmdLine(printString); + } + + private void + PrintEventMessage(string eventStr, string msg) + { + string printString = string.Format("\n[App Event] : {0,-25} : {1}", eventStr, msg); + Utils.AcadUi.PrintToCmdLine(printString); + } + + #endregion + + } +} diff --git a/MgdDbgLibrary/Reactors/Events/DatabaseEvents.cs b/MgdDbgLibrary/Reactors/Events/DatabaseEvents.cs new file mode 100644 index 0000000..172b436 --- /dev/null +++ b/MgdDbgLibrary/Reactors/Events/DatabaseEvents.cs @@ -0,0 +1,596 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.ApplicationServices; +using MgdDbg.CompBuilder; +using MgdDbg.Utils; + +namespace MgdDbg.Reactors.Events { + + public class DatabaseEvents : EventsBase { + + public + DatabaseEvents() + { + } + + protected override void + EnableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nDatabase Events Turned On ...\n"); + + // attach event handlers to each database we know about + DocumentCollection docs = Application.DocumentManager; + foreach (Document doc in docs) { + EnableEvents(doc.Database); + } + } + + public void + EnableEvents(Database db) + { + db.AbortDxfIn += new EventHandler(event_AbortDxfIn); + db.AbortDxfOut += new EventHandler(event_AbortDxfOut); + db.AbortSave += new EventHandler(event_AbortSave); + db.BeginDeepClone += new IdMappingEventHandler(event_BeginDeepClone); + db.BeginDeepCloneTranslation += new IdMappingEventHandler(event_BeginDeepCloneTranslation); + db.BeginDxfIn += new EventHandler(event_BeginDxfIn); + db.BeginDxfOut += new EventHandler(event_BeginDxfOut); + db.BeginInsert += new BeginInsertEventHandler(event_BeginInsert); + db.BeginSave += new DatabaseIOEventHandler(event_BeginSave); + db.BeginWblockBlock += new BeginWblockBlockEventHandler(event_BeginWblockBlock); + db.BeginWblockEntireDatabase += new BeginWblockEntireDatabaseEventHandler(event_BeginWblockEntireDatabase); + db.BeginWblockObjects += new BeginWblockObjectsEventHandler(event_BeginWblockObjects); + db.BeginWblockSelectedObjects += new BeginWblockSelectedObjectsEventHandler(event_BeginWblockSelectedObjects); + # if !ACAD2007 + Database.DatabaseConstructed += new EventHandler(event_DatabaseConstructed); + # endif + db.DatabaseToBeDestroyed += new EventHandler(event_DatabaseToBeDestroyed); + db.DeepCloneAborted += new EventHandler(event_DeepCloneAborted); + db.DeepCloneEnded += new EventHandler(event_DeepCloneEnded); + db.DwgFileOpened += new DatabaseIOEventHandler(event_DwgFileOpened); + db.DxfInComplete += new EventHandler(event_DxfInComplete); + db.DxfOutComplete += new EventHandler(event_DxfOutComplete); + db.InitialDwgFileOpenComplete += new EventHandler(event_InitialDwgFileOpenComplete); + db.InsertAborted += new EventHandler(event_InsertAborted); + db.InsertEnded += new EventHandler(event_InsertEnded); + db.InsertMappingAvailable += new IdMappingEventHandler(event_InsertMappingAvailable); + db.PartialOpenNotice += new EventHandler(event_PartialOpenNotice); + db.ProxyResurrectionCompleted += new ProxyResurrectionCompletedEventHandler(event_ProxyResurrectionCompleted); + db.SaveComplete += new DatabaseIOEventHandler(event_SaveComplete); + db.SystemVariableChanged += new Autodesk.AutoCAD.DatabaseServices.SystemVariableChangedEventHandler(event_SystemVariableChanged); + db.SystemVariableWillChange += new Autodesk.AutoCAD.DatabaseServices.SystemVariableChangingEventHandler(event_SystemVariableWillChange); + db.WblockAborted += new EventHandler(event_WblockAborted); + db.WblockEnded += new EventHandler(event_WblockEnded); + db.WblockMappingAvailable += new IdMappingEventHandler(event_WblockMappingAvailable); + db.WblockNotice += new WblockNoticeEventHandler(event_WblockNotice); + # if !ACAD2007 + Database.XrefAttachAborted += new EventHandler(event_XrefAttachAborted); + #endif + db.XrefAttachEnded += new EventHandler(event_XrefAttachEnded); + db.XrefBeginAttached += new XrefBeginOperationEventHandler(event_XrefBeginAttached); + db.XrefBeginOtherAttached +=new XrefBeginOperationEventHandler(event_XrefBeginOtherAttached); + db.XrefBeginRestore += new XrefBeginOperationEventHandler(event_XrefBeginRestore); + db.XrefComandeered += new XrefComandeeredEventHandler(event_XrefComandeered); + db.XrefPreXrefLockFile += new XrefPreXrefLockFileEventHandler(event_XrefPreXrefLockFile); + db.XrefRedirected += new XrefRedirectedEventHandler(event_XrefRedirected); + db.XrefRestoreAborted += new EventHandler(event_XrefRestoreAborted); + db.XrefRestoreEnded += new EventHandler(event_XrefRestoreEnded); + db.XrefSubCommandAborted += new XrefSubCommandAbortedEventHandler(event_XrefSubCommandAborted); + //see why this is commented out below in the DisableNotifications() + //db.XrefSubCommandStart += new XrefSubCommandStartEventHandler(event_XrefSubCommandStart); + } + + protected override void + DisableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nDatabase Events Turned Off ...\n"); + + // detach event handlers from each doc + DocumentCollection docs = Application.DocumentManager; + foreach (Document doc in docs) { + DisableEvents(doc.Database); + } + } + + public void + DisableEvents(Database db) + { + db.AbortDxfIn -= new EventHandler(event_AbortDxfIn); + db.AbortDxfOut -= new EventHandler(event_AbortDxfOut); + db.AbortSave -= new EventHandler(event_AbortSave); + db.BeginDeepClone -= new IdMappingEventHandler(event_BeginDeepClone); + db.BeginDeepCloneTranslation -= new IdMappingEventHandler(event_BeginDeepCloneTranslation); + db.BeginDxfIn -= new EventHandler(event_BeginDxfIn); + db.BeginDxfOut -= new EventHandler(event_BeginDxfOut); + db.BeginInsert -= new BeginInsertEventHandler(event_BeginInsert); + db.BeginSave -= new DatabaseIOEventHandler(event_BeginSave); + db.BeginWblockBlock -= new BeginWblockBlockEventHandler(event_BeginWblockBlock); + db.BeginWblockEntireDatabase -= new BeginWblockEntireDatabaseEventHandler(event_BeginWblockEntireDatabase); + db.BeginWblockObjects -= new BeginWblockObjectsEventHandler(event_BeginWblockObjects); + db.BeginWblockSelectedObjects -= new BeginWblockSelectedObjectsEventHandler(event_BeginWblockSelectedObjects); + # if !ACAD2007 + Database.DatabaseConstructed -= new EventHandler(event_DatabaseConstructed); + #endif + db.DatabaseToBeDestroyed -= new EventHandler(event_DatabaseToBeDestroyed); + db.DeepCloneAborted -= new EventHandler(event_DeepCloneAborted); + db.DeepCloneEnded -= new EventHandler(event_DeepCloneEnded); + db.DwgFileOpened -= new DatabaseIOEventHandler(event_DwgFileOpened); + db.DxfInComplete -= new EventHandler(event_DxfInComplete); + db.DxfOutComplete -= new EventHandler(event_DxfOutComplete); + db.InitialDwgFileOpenComplete -= new EventHandler(event_InitialDwgFileOpenComplete); + db.InsertAborted -= new EventHandler(event_InsertAborted); + db.InsertEnded -= new EventHandler(event_InsertEnded); + db.InsertMappingAvailable -= new IdMappingEventHandler(event_InsertMappingAvailable); + db.PartialOpenNotice -= new EventHandler(event_PartialOpenNotice); + db.ProxyResurrectionCompleted -= new ProxyResurrectionCompletedEventHandler(event_ProxyResurrectionCompleted); + db.SaveComplete -= new DatabaseIOEventHandler(event_SaveComplete); + db.SystemVariableChanged -= new Autodesk.AutoCAD.DatabaseServices.SystemVariableChangedEventHandler(event_SystemVariableChanged); + db.SystemVariableWillChange -= new Autodesk.AutoCAD.DatabaseServices.SystemVariableChangingEventHandler(event_SystemVariableWillChange); + db.WblockAborted -= new EventHandler(event_WblockAborted); + db.WblockEnded -= new EventHandler(event_WblockEnded); + db.WblockMappingAvailable -= new IdMappingEventHandler(event_WblockMappingAvailable); + db.WblockNotice -= new WblockNoticeEventHandler(event_WblockNotice); + # if !ACAD2007 + Database.XrefAttachAborted -= new EventHandler(event_XrefAttachAborted); + #endif + db.XrefAttachEnded -= new EventHandler(event_XrefAttachEnded); + db.XrefBeginAttached -= new XrefBeginOperationEventHandler(event_XrefBeginAttached); + db.XrefBeginOtherAttached -=new XrefBeginOperationEventHandler(event_XrefBeginOtherAttached); + db.XrefBeginRestore -= new XrefBeginOperationEventHandler(event_XrefBeginRestore); + db.XrefComandeered -= new XrefComandeeredEventHandler(event_XrefComandeered); + db.XrefPreXrefLockFile -= new XrefPreXrefLockFileEventHandler(event_XrefPreXrefLockFile); + db.XrefRedirected -= new XrefRedirectedEventHandler(event_XrefRedirected); + db.XrefRestoreAborted -= new EventHandler(event_XrefRestoreAborted); + db.XrefRestoreEnded -= new EventHandler(event_XrefRestoreEnded); + db.XrefSubCommandAborted -= new XrefSubCommandAbortedEventHandler(event_XrefSubCommandAborted); + //see why this is commented out below in the DisableNotifications() + //db.XrefSubCommandStart -= new XrefSubCommandStartEventHandler(event_XrefSubCommandStart); + } + + #region Notifications + + private void + event_AbortDxfIn(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Abort Dxf In"); + } + + private void + event_AbortDxfOut(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Abort Dxf Out"); + } + + private void + event_AbortSave(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Abort Save"); + } + + private void + event_BeginDeepClone(object sender, IdMappingEventArgs e) + { + string str2 = string.Format("Context = {0}", e.IdMapping.DeepCloneContext.ToString()); + PrintEventMessage((Database)sender, "Begin Deep Clone", str2); + if (m_showDetails) { + MgdDbg.Reactors.Forms.Details details = new MgdDbg.Reactors.Forms.Details("Begin Deep Clone", e.IdMapping); + details.ShowDialog(); + } + } + + private void + event_BeginDeepCloneTranslation(object sender, IdMappingEventArgs e) + { + PrintEventMessage((Database)sender, "Begin Deep Clone Translation"); + if (m_showDetails) { + MgdDbg.Reactors.Forms.Details details = new MgdDbg.Reactors.Forms.Details("Begin Deep Clone Translation", e.IdMapping); + details.ShowDialog(); + } + } + + private void + event_BeginDxfIn(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Begin Dxf In"); + } + + private void + event_BeginDxfOut(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Begin Dxf Out"); + } + + private void + event_BeginInsert(object sender, BeginInsertEventArgs e) + { + PrintEventMessage((Database)sender, "Begin Insert", AcadUi.DbToStr(e.From)); + if (m_showDetails) { + using (TransactionHelper trHlp = new TransactionHelper(e.From)) { + trHlp.Start(); + + Snoop.Forms.Database dbox = new Snoop.Forms.Database(e.From, trHlp); + dbox.Text = "From Database"; + + trHlp.Commit(); + } + } + } + + private void + event_BeginSave(object sender, DatabaseIOEventArgs e) + { + string str2 = string.Format("Intended Name = \"{0}\"", e.FileName); + PrintEventMessage((Database)sender, "Begin Save", str2); + } + + private void + event_BeginWblockBlock(object sender, BeginWblockBlockEventArgs e) + { + string str2 = string.Format("Block Name = {0}, DB = {1}", AcadUi.ObjToTypeAndHandleStr(e.BlockId), AcadUi.DbToStr(e.From)); + PrintEventMessage((Database)sender, "Begin Wblock", str2); + if (m_showDetails) { + using (TransactionHelper trHlp = new TransactionHelper(e.From)) { + trHlp.Start(); + + Snoop.Forms.Database dbox = new Snoop.Forms.Database(e.From, trHlp); + dbox.Text = "From Database"; + + trHlp.Commit(); + } + } + } + + private void + event_BeginWblockEntireDatabase(object sender, BeginWblockEntireDatabaseEventArgs e) + { + string str2 = string.Format("DB = {0}", AcadUi.DbToStr(e.From)); + PrintEventMessage((Database)sender, "Begin Wblock Entire Database", str2); + if (m_showDetails) { + using (TransactionHelper trHlp = new TransactionHelper(e.From)) { + trHlp.Start(); + + Snoop.Forms.Database dbox = new Snoop.Forms.Database(e.From, trHlp); + dbox.Text = "From Database"; + + trHlp.Commit(); + } + } + } + + private void + event_BeginWblockObjects(object sender, BeginWblockObjectsEventArgs e) + { + string str2 = string.Format("DB = {0}", AcadUi.DbToStr(e.From)); + PrintEventMessage((Database)sender, "Begin Wblock Objects", str2); + if (m_showDetails) { + MgdDbg.Reactors.Forms.Details details = new MgdDbg.Reactors.Forms.Details("Begin Wblock Objects", e.IdMapping); + details.ShowDialog(); + } + } + + private void + event_BeginWblockSelectedObjects(object sender, BeginWblockSelectedObjectsEventArgs e) + { + string str2 = string.Format("Insert Pt. = {0}, {1}", AcadUi.PtToStr(e.InsertionPoint), AcadUi.DbToStr(e.From)); + PrintEventMessage((Database)sender, "Begin Wblock Selected Objects", str2); + } + + private void + event_DatabaseConstructed(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Database Constructed"); + } + + private void + event_DatabaseToBeDestroyed(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Database To Be Destroyed"); + } + + private void + event_DeepCloneAborted(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Deep Clone Aborted"); + } + + private void + event_DeepCloneEnded(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Deep Clone Ended"); + } + + private void + event_DwgFileOpened(object sender, DatabaseIOEventArgs e) + { + PrintEventMessage((Database)sender, "Dwg File Opened", e.FileName); + } + + private void + event_DxfInComplete(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Dxf In Complete"); + } + + private void + event_DxfOutComplete(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Dxf Out Complete"); + } + + private void + event_InitialDwgFileOpenComplete(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Initial Dwg File Open Complete"); + } + + private void + event_InsertAborted(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Insert Aborted"); + } + + private void + event_InsertEnded(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Insert Ended"); + } + + private void + event_InsertMappingAvailable(object sender, IdMappingEventArgs e) + { + PrintEventMessage((Database)sender, "Insert Mapping Available"); + if (m_showDetails) { + MgdDbg.Reactors.Forms.Details details = new MgdDbg.Reactors.Forms.Details("Insert Mapping Available", e.IdMapping); + details.ShowDialog(); + } + } + + private void + event_PartialOpenNotice(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Partial Open Notice"); + } + + private void + event_ProxyResurrectionCompleted(object sender, ProxyResurrectionCompletedEventArgs e) + { + PrintEventMessage((Database)sender, "Proxy Resurrection Completed", e.ApplicationName); + if (m_showDetails) { + using (TransactionHelper trHlp = new TransactionHelper(e.Ids[0].Database)) { + trHlp.Start(); + + Snoop.Forms.DBObjects form = new Snoop.Forms.DBObjects(e.Ids, trHlp); + form.ShowDialog(); + + trHlp.Commit(); + } + } + } + + private void + event_SaveComplete(object sender, DatabaseIOEventArgs e) + { + string str2 = string.Format("Actual Name = \"{0}\"", e.FileName); + PrintEventMessage((Database)sender, "Save Complete", str2); + } + + private void + event_SystemVariableChanged(object sender, Autodesk.AutoCAD.DatabaseServices.SystemVariableChangedEventArgs e) + { + if (e.Changed) + PrintEventMessage((Database)sender, "System Var Changed", e.Name); + else + PrintEventMessage((Database)sender, "System Var Not Changed Successfully", e.Name); + } + + private void + event_SystemVariableWillChange(object sender, Autodesk.AutoCAD.DatabaseServices.SystemVariableChangingEventArgs e) + { + PrintEventMessage((Database)sender, "System Var Will Change", e.Name); + } + + private void + event_WblockAborted(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Wblock Aborted"); + } + + private void + event_WblockEnded(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Wblock Ended"); + } + + private void + event_WblockMappingAvailable(object sender, IdMappingEventArgs e) + { + PrintEventMessage((Database)sender, "Wblock Mapping Available"); + + if (m_showDetails) { + MgdDbg.Reactors.Forms.Details details = new MgdDbg.Reactors.Forms.Details("Wblock Mapping Available", e.IdMapping); + details.ShowDialog(); + } + } + + private void + event_WblockNotice(object sender, WblockNoticeEventArgs e) + { + string str2 = string.Format("To = {0}", AcadUi.DbToStr(e.To)); + PrintEventMessage((Database)sender, "Wblock Notice", str2); + if (m_showDetails) { + using (TransactionHelper trHlp = new TransactionHelper(e.To)) { + trHlp.Start(); + + Snoop.Forms.Database dbox = new Snoop.Forms.Database(e.To, trHlp); + dbox.Text = "To Database"; + + trHlp.Commit(); + } + } + } + + private void + event_XrefAttachAborted(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Attach Aborted"); + } + + private void + event_XrefAttachEnded(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Attach Ended"); + } + + private void + event_XrefBeginAttached(object sender, XrefBeginOperationEventArgs e) + { + PrintEventMessage((Database)sender, "Begin Attached", AcadUi.DbToStr(e.From)); + if (m_showDetails) { + using (TransactionHelper trHlp = new TransactionHelper(e.From)) { + trHlp.Start(); + + Snoop.Forms.Database dbox = new Snoop.Forms.Database(e.From, trHlp); + dbox.Text = "From Database"; + + trHlp.Commit(); + } + } + } + + private void + event_XrefBeginOtherAttached(object sender, XrefBeginOperationEventArgs e) + { + PrintEventMessage((Database)sender, "Begin Other Attached", AcadUi.DbToStr(e.From)); + if (m_showDetails) { + using (TransactionHelper trHlp = new TransactionHelper(e.From)) { + trHlp.Start(); + + Snoop.Forms.Database dbox = new Snoop.Forms.Database(e.From, trHlp); + dbox.Text = "From Database"; + + trHlp.Commit(); + } + } + } + + private void + event_XrefBeginRestore(object sender, XrefBeginOperationEventArgs e) + { + PrintEventMessage((Database)sender, "BeginRestore", AcadUi.DbToStr(e.From)); + if (m_showDetails) { + using (TransactionHelper trHlp = new TransactionHelper(e.From)) { + trHlp.Start(); + + Snoop.Forms.Database dbox = new Snoop.Forms.Database(e.From, trHlp); + dbox.Text = "From Database"; + + trHlp.Commit(); + } + } + } + + private void + event_XrefComandeered(object sender, XrefComandeeredEventArgs e) + { + string str2 = string.Format("{0} {1}", AcadUi.ObjToTypeAndHandleStr(e.Id), AcadUi.DbToStr(e.From)); + PrintEventMessage((Database)sender, "Comandeered", str2); + } + + private void + event_XrefPreXrefLockFile(object sender, XrefPreXrefLockFileEventArgs e) + { + PrintEventMessage((Database)sender, "Xref Pre Xref Lock File", AcadUi.ObjToTypeAndHandleStr(e.btrId)); + } + + private void + event_XrefRedirected(object sender, XrefRedirectedEventArgs e) + { + string str2 = string.Format("From = {0} , To = {1}", AcadUi.ObjToTypeAndHandleStr(e.OldId), AcadUi.ObjToTypeAndHandleStr(e.NewId)); + PrintEventMessage((Database)sender, "Redirected", str2); + } + + private void + event_XrefRestoreAborted(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Restore Aborted"); + } + + private void + event_XrefRestoreEnded(object sender, EventArgs e) + { + PrintEventMessage((Database)sender, "Restore Ended"); + } + + private void + event_XrefSubCommandAborted(object sender, XrefSubCommandEventArgs e) + { + PrintEventMessage((Database)sender, "Xref Sub-Command Aborted"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "XrefSubCommandAborted"; + dbox.ShowDialog(); + } + } + + private void + event_XrefSubCommandStart(object sender, XrefVetoableSubCommandEventArgs e) + { + PrintEventMessage((Database)sender, "Xref Sub-Command Start"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "XrefSubCommandStart"; + dbox.ShowDialog(); + } + } + + #endregion + + + # region Print Abstraction + + private void + PrintEventMessage(Database db, string eventStr) + { + string printString = string.Format("\n[DB Event : {0}] : {1}", DbToStr(db), eventStr); + Utils.AcadUi.PrintToCmdLine(printString); + } + + private void + PrintEventMessage(Database db, string eventStr, string str2) + { + string printString = string.Format("\n[DB Event : {0}] : {1,-25} : {2}", DbToStr(db), eventStr, str2); + Utils.AcadUi.PrintToCmdLine(printString); + } + + private string + DbToStr(Database db) + { + return db.GetHashCode().ToString(); + } + + #endregion + } +} diff --git a/MgdDbgLibrary/Reactors/Events/DatabaseObjEvents.cs b/MgdDbgLibrary/Reactors/Events/DatabaseObjEvents.cs new file mode 100644 index 0000000..a778d9b --- /dev/null +++ b/MgdDbgLibrary/Reactors/Events/DatabaseObjEvents.cs @@ -0,0 +1,154 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Diagnostics; + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.ApplicationServices; + +namespace MgdDbg.Reactors.Events { + + public class DatabaseObjEvents : EventsBase { + + public + DatabaseObjEvents() + { + } + + protected override void + EnableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nDatabase Object Events Turned On ...\n"); + + // attach event handlers to each database we know about + DocumentCollection docs = Application.DocumentManager; + foreach (Document doc in docs) { + EnableEvents(doc.Database); + } + } + + public void + EnableEvents(Database db) + { + db.ObjectAppended += new ObjectEventHandler(event_ObjectAppended); + db.ObjectErased += new ObjectErasedEventHandler(event_ObjectErased); + db.ObjectModified += new ObjectEventHandler(event_ObjectModified); + db.ObjectOpenedForModify += new ObjectEventHandler(event_ObjectOpenedForModify); + db.ObjectReappended += new ObjectEventHandler(event_ObjectReappended); + db.ObjectUnappended += new ObjectEventHandler(event_ObjectUnappended); + } + + protected override void + DisableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nDatabase Object Events Turned Off ...\n"); + + // detach event handlers from each doc + DocumentCollection docs = Application.DocumentManager; + foreach (Document doc in docs) { + DisableEvents(doc.Database); + } + } + + public void + DisableEvents(Database db) + { + db.ObjectAppended -= new ObjectEventHandler(event_ObjectAppended); + db.ObjectErased -= new ObjectErasedEventHandler(event_ObjectErased); + db.ObjectModified -= new ObjectEventHandler(event_ObjectModified); + db.ObjectOpenedForModify -= new ObjectEventHandler(event_ObjectOpenedForModify); + db.ObjectReappended -= new ObjectEventHandler(event_ObjectReappended); + db.ObjectUnappended -= new ObjectEventHandler(event_ObjectUnappended); + } + + #region Notifications + + private void + event_ObjectAppended(object sender, ObjectEventArgs e) + { + PrintEventMessage((Database)sender, "Object Appended", e.DBObject); + } + + private void + event_ObjectErased(object sender, ObjectErasedEventArgs e) + { + if (e.Erased) + PrintEventMessage((Database)sender, "Object Erased", e.DBObject); + else + PrintEventMessage((Database)sender, "Object Un-Erased", e.DBObject); + } + + private void + event_ObjectModified(object sender, ObjectEventArgs e) + { + PrintEventMessage((Database)sender, "Object Modified", e.DBObject); + } + + private void + event_ObjectOpenedForModify(object sender, ObjectEventArgs e) + { + PrintEventMessage((Database)sender, "Object Opened For Modify", e.DBObject); + } + + private void + event_ObjectReappended(object sender, ObjectEventArgs e) + { + PrintEventMessage((Database)sender, "Object Reappended", e.DBObject); + } + + private void + event_ObjectUnappended(object sender, ObjectEventArgs e) + { + PrintEventMessage((Database)sender, "Object Unappended", e.DBObject); + } + + #endregion + + + # region Print Abstraction + + private void + PrintEventMessage(Database db, string eventStr, DBObject dbObj) + { + string printString = string.Format("\n[DB Event : {0}] : {1,-25} : {2}", DbToStr(db), eventStr, ObjToTypeAndHandleStr(dbObj)); + Utils.AcadUi.PrintToCmdLine(printString); + } + + private string + DbToStr(Database db) + { + return db.GetHashCode().ToString(); + } + + private string + ObjToTypeAndHandleStr(DBObject dbObj) + { + Debug.Assert(dbObj != null); + return string.Format("<{0}, {1}>", dbObj.GetType().Name, dbObj.Handle.ToString()); + } + + + #endregion + } +} + diff --git a/MgdDbgLibrary/Reactors/Events/DocumentEvents.cs b/MgdDbgLibrary/Reactors/Events/DocumentEvents.cs new file mode 100644 index 0000000..064cc70 --- /dev/null +++ b/MgdDbgLibrary/Reactors/Events/DocumentEvents.cs @@ -0,0 +1,183 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using Autodesk.AutoCAD.ApplicationServices; + +namespace MgdDbg.Reactors.Events { + + public class DocumentEvents : EventsBase { + + public + DocumentEvents() + { + } + + protected override void + EnableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nDocument Events Turned On ...\n"); + + DocumentCollection docs = Application.DocumentManager; + foreach (Document doc in docs) { + EnableEvents(doc); + } + } + + public void + EnableEvents(Document doc) + { + doc.BeginDocumentClose += new DocumentBeginCloseEventHandler(event_BeginDocumentClose); + doc.CloseAborted += new EventHandler(event_CloseAborted); + doc.CloseWillStart += new EventHandler(event_CloseWillStart); + doc.CommandCancelled += new CommandEventHandler(event_CommandCancelled); + doc.CommandEnded += new CommandEventHandler(event_CommandEnded); + doc.CommandFailed += new CommandEventHandler(event_CommandFailed); + doc.CommandWillStart += new CommandEventHandler(event_CommandWillStart); + doc.ImpliedSelectionChanged += new EventHandler(event_ImpliedSelectionChanged); + doc.LispCancelled += new EventHandler(event_LispCancelled); + doc.LispEnded += new EventHandler(event_LispEnded); + doc.LispWillStart += new LispWillStartEventHandler(event_LispWillStart); + doc.UnknownCommand += new UnknownCommandEventHandler(event_UnknownCommand); + } + + protected override void + DisableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nDocument Events Turned Off ...\n"); + + DocumentCollection docs = Application.DocumentManager; + foreach (Document doc in docs) { + DisableEvents(doc); + } + } + + public void + DisableEvents(Document doc) + { + doc.BeginDocumentClose -= new DocumentBeginCloseEventHandler(event_BeginDocumentClose); + doc.CloseAborted -= new EventHandler(event_CloseAborted); + doc.CloseWillStart -= new EventHandler(event_CloseWillStart); + doc.CommandCancelled -= new CommandEventHandler(event_CommandCancelled); + doc.CommandEnded -= new CommandEventHandler(event_CommandEnded); + doc.CommandFailed -= new CommandEventHandler(event_CommandFailed); + doc.CommandWillStart -= new CommandEventHandler(event_CommandWillStart); + doc.ImpliedSelectionChanged -= new EventHandler(event_ImpliedSelectionChanged); + doc.LispCancelled -= new EventHandler(event_LispCancelled); + doc.LispEnded -= new EventHandler(event_LispEnded); + doc.LispWillStart -= new LispWillStartEventHandler(event_LispWillStart); + doc.UnknownCommand -= new UnknownCommandEventHandler(event_UnknownCommand); + } + + private void + event_BeginDocumentClose(object sender, DocumentBeginCloseEventArgs e) + { + PrintEventMessage("Begin Document Close"); + } + + private void + event_CloseAborted(object sender, EventArgs e) + { + PrintEventMessage("Close Aborted"); + } + + private void + event_CloseWillStart(object sender, EventArgs e) + { + PrintEventMessage("Close will Start"); + } + + private void + event_CommandCancelled(object sender, CommandEventArgs e) + { + PrintEventMessage("Command Cancelled", e.GlobalCommandName); + } + + private void + event_CommandEnded(object sender, CommandEventArgs e) + { + PrintEventMessage("Command Ended", e.GlobalCommandName); + } + + private void + event_CommandFailed(object sender, CommandEventArgs e) + { + PrintEventMessage("Command Failed", e.GlobalCommandName); + } + + private void + event_CommandWillStart(object sender, CommandEventArgs e) + { + PrintEventMessage("Command will Start", e.GlobalCommandName); + } + + private void + event_ImpliedSelectionChanged(object sender, EventArgs e) + { + PrintEventMessage("Implied Selection Changed"); + } + + private void + event_LispCancelled(object sender, EventArgs e) + { + PrintEventMessage("Lisp Cancelled"); + } + + private void + event_LispEnded(object sender, EventArgs e) + { + PrintEventMessage("Lisp ended"); + } + + private void + event_LispWillStart(object sender, LispWillStartEventArgs e) + { + PrintEventMessage("Lisp will Start", e.FirstLine); + } + + private void + event_UnknownCommand(object sender, UnknownCommandEventArgs e) + { + PrintEventMessage("Unknown Command", e.GlobalCommandName); + } + + #region Print Abstraction + + private void + PrintEventMessage(string eventStr) + { + string printString = string.Format("\n[Doc Event] : {0,-25}", eventStr); + Utils.AcadUi.PrintToCmdLine(printString); + } + + private void + PrintEventMessage(string eventStr, string msg) + { + string printString = string.Format("\n[Doc Event] : {0,-25} : {1}", eventStr, msg); + Utils.AcadUi.PrintToCmdLine(printString); + } + + #endregion + + } +} diff --git a/MgdDbgLibrary/Reactors/Events/DocumentMgrEvents.cs b/MgdDbgLibrary/Reactors/Events/DocumentMgrEvents.cs new file mode 100644 index 0000000..31dcf7e --- /dev/null +++ b/MgdDbgLibrary/Reactors/Events/DocumentMgrEvents.cs @@ -0,0 +1,205 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using AcApp = Autodesk.AutoCAD.ApplicationServices; + +namespace MgdDbg.Reactors.Events { + + public class DocumentMgrEvents : EventsBase { + + public + DocumentMgrEvents() + { + } + + protected override void + EnableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nDocument Manager Events Turned On ...\n"); + + AcApp.DocumentCollection docs = AcApp.Application.DocumentManager; + + docs.DocumentActivated += new AcApp.DocumentCollectionEventHandler(event_DocumentActivated); + docs.DocumentActivationChanged += new AcApp.DocumentActivationChangedEventHandler(event_DocumentActivationChanged); + docs.DocumentBecameCurrent += new AcApp.DocumentCollectionEventHandler(event_DocumentBecameCurrent); + docs.DocumentCreated += new AcApp.DocumentCollectionEventHandler(event_DocumentCreated); + docs.DocumentCreateStarted += new AcApp.DocumentCollectionEventHandler(event_DocumentCreateStarted); + docs.DocumentCreationCanceled += new AcApp.DocumentCollectionEventHandler(event_DocumentCreationCanceled); + docs.DocumentDestroyed += new AcApp.DocumentDestroyedEventHandler(event_DocumentDestroyed); + docs.DocumentLockModeChanged += new AcApp.DocumentLockModeChangedEventHandler(event_DocumentLockModeChanged); + docs.DocumentLockModeChangeVetoed += new AcApp.DocumentLockModeChangeVetoedEventHandler(event_DocumentLockModeChangeVetoed); + docs.DocumentLockModeWillChange += new AcApp.DocumentLockModeWillChangeEventHandler(event_DocumentLockModeWillChange); + docs.DocumentToBeActivated += new AcApp.DocumentCollectionEventHandler(event_DocumentToBeActivated); + docs.DocumentToBeDeactivated += new AcApp.DocumentCollectionEventHandler(event_DocumentToBeDeactivated); + docs.DocumentToBeDestroyed += new AcApp.DocumentCollectionEventHandler(event_DocumentToBeDestroyed); + } + + protected override void + DisableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nDocument Manager Events Turned Off ...\n"); + + AcApp.DocumentCollection docs = AcApp.Application.DocumentManager; + + docs.DocumentActivated -= new AcApp.DocumentCollectionEventHandler(event_DocumentActivated); + docs.DocumentActivationChanged -= new AcApp.DocumentActivationChangedEventHandler(event_DocumentActivationChanged); + docs.DocumentBecameCurrent -= new AcApp.DocumentCollectionEventHandler(event_DocumentBecameCurrent); + docs.DocumentCreated -= new AcApp.DocumentCollectionEventHandler(event_DocumentCreated); + docs.DocumentCreateStarted -= new AcApp.DocumentCollectionEventHandler(event_DocumentCreateStarted); + docs.DocumentCreationCanceled -= new AcApp.DocumentCollectionEventHandler(event_DocumentCreationCanceled); + docs.DocumentDestroyed -= new AcApp.DocumentDestroyedEventHandler(event_DocumentDestroyed); + docs.DocumentLockModeChanged -= new AcApp.DocumentLockModeChangedEventHandler(event_DocumentLockModeChanged); + docs.DocumentLockModeChangeVetoed -= new AcApp.DocumentLockModeChangeVetoedEventHandler(event_DocumentLockModeChangeVetoed); + docs.DocumentLockModeWillChange -= new AcApp.DocumentLockModeWillChangeEventHandler(event_DocumentLockModeWillChange); + docs.DocumentToBeActivated -= new AcApp.DocumentCollectionEventHandler(event_DocumentToBeActivated); + docs.DocumentToBeDeactivated -= new AcApp.DocumentCollectionEventHandler(event_DocumentToBeDeactivated); + docs.DocumentToBeDestroyed -= new AcApp.DocumentCollectionEventHandler(event_DocumentToBeDestroyed); + } + + private void + event_DocumentToBeDestroyed(object sender, AcApp.DocumentCollectionEventArgs e) + { + PrintEventMessage("Document To Be Destroyed", e.Document); + } + + private void + event_DocumentToBeDeactivated(object sender, AcApp.DocumentCollectionEventArgs e) + { + PrintEventMessage("Document To Be Deactivated", e.Document); + } + + private void + event_DocumentToBeActivated(object sender, AcApp.DocumentCollectionEventArgs e) + { + PrintEventMessage("Document To Be Activated", e.Document); + } + + private void + event_DocumentLockModeWillChange(object sender, AcApp.DocumentLockModeWillChangeEventArgs e) + { + PrintEventMessage("Document Lock Mode Will Change", e.Document); + if (m_showDetails) { + PrintSubEventMessage("Global Command Name", e.GlobalCommandName); + PrintSubEventMessage("Current Mode", e.CurrentMode.ToString()); + PrintSubEventMessage("My Current Mode", e.MyCurrentMode.ToString()); + PrintSubEventMessage("My New Mode", e.MyNewMode.ToString()); + } + } + + private void + event_DocumentLockModeChangeVetoed(object sender, AcApp.DocumentLockModeChangeVetoedEventArgs e) + { + PrintEventMessage("Document Lock Mode Change Vetoed", e.Document); + if (m_showDetails) { + PrintSubEventMessage("Global Command Name", e.GlobalCommandName); + } + } + + private void + event_DocumentLockModeChanged(object sender, AcApp.DocumentLockModeChangedEventArgs e) + { + PrintEventMessage("Document Lock Mode Changed", e.Document); + if (m_showDetails) { + PrintSubEventMessage("Global Command Name", e.GlobalCommandName); + PrintSubEventMessage("Current Mode", e.CurrentMode.ToString()); + PrintSubEventMessage("My Current Mode", e.MyCurrentMode.ToString()); + PrintSubEventMessage("My Previous Mode", e.MyPreviousMode.ToString()); + } + } + + private void + event_DocumentDestroyed(object sender, AcApp.DocumentDestroyedEventArgs e) + { + PrintEventMessage("Document Destroyed", e.FileName); + } + + private void + event_DocumentCreationCanceled(object sender, AcApp.DocumentCollectionEventArgs e) + { + PrintEventMessage("Document Creation Canceled", e.Document); + } + + private void + event_DocumentCreateStarted(object sender, AcApp.DocumentCollectionEventArgs e) + { + PrintEventMessage("Document Create Started", e.Document); + } + + private void + event_DocumentCreated(object sender, AcApp.DocumentCollectionEventArgs e) + { + PrintEventMessage("Document Created", e.Document); + } + + private void + event_DocumentBecameCurrent(object sender, AcApp.DocumentCollectionEventArgs e) + { + PrintEventMessage("Document Became Current", e.Document); + } + + private void + event_DocumentActivationChanged(object sender, AcApp.DocumentActivationChangedEventArgs e) + { + PrintEventMessage("Document Activation Changed", e.NewValue.ToString()); + } + + private void + event_DocumentActivated(object sender, AcApp.DocumentCollectionEventArgs e) + { + PrintEventMessage("Document Activated", e.Document); + } + + #region Print Abstraction + + private void + PrintEventMessage(string eventStr) + { + string printString = string.Format("\n[Doc Mgr Event] : {0,-25}", eventStr); + Utils.AcadUi.PrintToCmdLine(printString); + } + + private void + PrintEventMessage(string eventStr, AcApp.Document doc) + { + string printString = string.Format("\n[Doc Mgr Event] : {0,-25} : {1}", eventStr, doc.Name); + Utils.AcadUi.PrintToCmdLine(printString); + } + + private void + PrintEventMessage(string eventStr, string msg) + { + string printString = string.Format("\n[Doc Mgr Event] : {0,-25} : {1}", eventStr, msg); + Utils.AcadUi.PrintToCmdLine(printString); + } + + private void + PrintSubEventMessage(string eventStr, string msg) + { + string printString = string.Format("\n {0,-20} : {1}", eventStr, msg); + Utils.AcadUi.PrintToCmdLine(printString); + } + + + #endregion + } +} diff --git a/MgdDbgLibrary/Reactors/Events/DynamicLinkerEvents.cs b/MgdDbgLibrary/Reactors/Events/DynamicLinkerEvents.cs new file mode 100644 index 0000000..5c7d967 --- /dev/null +++ b/MgdDbgLibrary/Reactors/Events/DynamicLinkerEvents.cs @@ -0,0 +1,112 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.Runtime; + +namespace MgdDbg.Reactors.Events { + + public class DynamicLinkerEvents : EventsBase { + + public + DynamicLinkerEvents() + { + } + + protected override void + EnableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nDynamic Linker Events Turned On ...\n"); + + DynamicLinker dLinker = SystemObjects.DynamicLinker; + + dLinker.ModuleLoadAborted += new ModuleLoadAbortedEventHandler(event_ModuleLoadAborted); + dLinker.ModuleLoaded += new ModuleLoadedEventHandler(event_ModuleLoaded); + dLinker.ModuleLoading += new ModuleLoadingEventHandler(event_ModuleLoading); + dLinker.ModuleUnloadAborted += new ModuleUnloadAbortedEventHandler(event_ModuleUnloadAborted); + dLinker.ModuleUnloaded += new ModuleUnloadedEventHandler(event_ModuleUnloaded); + dLinker.ModuleUnloading += new ModuleUnloadingEventHandler(event_ModuleUnloading); + } + + protected override void + DisableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nDynamic Linker Events Turned Off ...\n"); + + DynamicLinker dLinker = SystemObjects.DynamicLinker; + + dLinker.ModuleLoadAborted -= new ModuleLoadAbortedEventHandler(event_ModuleLoadAborted); + dLinker.ModuleLoaded -= new ModuleLoadedEventHandler(event_ModuleLoaded); + dLinker.ModuleLoading -= new ModuleLoadingEventHandler(event_ModuleLoading); + dLinker.ModuleUnloadAborted -= new ModuleUnloadAbortedEventHandler(event_ModuleUnloadAborted); + dLinker.ModuleUnloaded -= new ModuleUnloadedEventHandler(event_ModuleUnloaded); + dLinker.ModuleUnloading -= new ModuleUnloadingEventHandler(event_ModuleUnloading); + } + + private void + event_ModuleUnloading(object sender, DynamicLinkerEventArgs e) + { + PrintEventMessage("Module Unloading", e.FileName); + } + + private void + event_ModuleUnloaded(object sender, DynamicLinkerEventArgs e) + { + PrintEventMessage("Module Unloaded", e.FileName); + } + + private void + event_ModuleUnloadAborted(object sender, DynamicLinkerEventArgs e) + { + PrintEventMessage("Module Unload Aborted", e.FileName); + } + + private void + event_ModuleLoading(object sender, DynamicLinkerEventArgs e) + { + PrintEventMessage("Module Loading", e.FileName); + } + + private void + event_ModuleLoaded(object sender, DynamicLinkerEventArgs e) + { + PrintEventMessage("Module Loaded", e.FileName); + } + + private void + event_ModuleLoadAborted(object sender, DynamicLinkerEventArgs e) + { + PrintEventMessage("Module Load Aborted", e.FileName); + } + + #region Print Abstraction + + private void + PrintEventMessage(string eventStr, string fileName) + { + string printString = string.Format("\n[Dynamic Linker Event] : {0,-25} : {1}", eventStr, fileName); + Utils.AcadUi.PrintToCmdLine(printString); + } + + #endregion + } +} diff --git a/MgdDbgLibrary/Reactors/Events/EditorEvents.cs b/MgdDbgLibrary/Reactors/Events/EditorEvents.cs new file mode 100644 index 0000000..1a764af --- /dev/null +++ b/MgdDbgLibrary/Reactors/Events/EditorEvents.cs @@ -0,0 +1,464 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; + +namespace MgdDbg.Reactors.Events { + + public class EditorEvents : EventsBase { + + public bool m_suppressDuringDrag = true; + + public + EditorEvents() + { + } + + protected override void + EnableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nEditor Events Turned On ...\n"); + + DocumentCollection docs = Application.DocumentManager; + foreach (Document doc in docs) { + EnableEvents(doc.Editor); + } + } + + public void + EnableEvents(Editor ed) + { + ed.EnteringQuiescentState += new EventHandler(event_EnteringQuiescentState); + ed.LeavingQuiescentState += new EventHandler(event_LeavingQuiescentState); + + ed.PointFilter += new PointFilterEventHandler(event_PointFilter); + ed.PointMonitor += new PointMonitorEventHandler(event_PointMonitor); + + ed.PromptingForAngle += new PromptAngleOptionsEventHandler(event_PromptingForAngle); + ed.PromptedForAngle += new PromptDoubleResultEventHandler(event_PromptedForAngle); + + ed.PromptingForCorner += new PromptPointOptionsEventHandler(event_PromptingForCorner); + ed.PromptedForCorner += new PromptPointResultEventHandler(event_PromptedForCorner); + + ed.PromptingForDistance += new PromptDistanceOptionsEventHandler(event_PromptingForDistance); + ed.PromptedForDistance += new PromptDoubleResultEventHandler(event_PromptedForDistance); + + ed.PromptingForDouble += new PromptDoubleOptionsEventHandler(event_PromptingForDouble); + ed.PromptedForDouble += new PromptDoubleResultEventHandler(event_PromptedForDouble); + + ed.PromptingForEntity += new PromptEntityOptionsEventHandler(event_PromptingForEntity); + ed.PromptedForEntity += new PromptEntityResultEventHandler(event_PromptedForEntity); + ed.PromptForEntityEnding += new PromptForEntityEndingEventHandler(event_PromptForEntityEnding); + + ed.PromptingForInteger += new PromptIntegerOptionsEventHandler(event_PromptingForInteger); + ed.PromptedForInteger += new PromptIntegerResultEventHandler(event_PromptedForInteger); + + ed.PromptingForKeyword += new PromptKeywordOptionsEventHandler(event_PromptingForKeyword); + ed.PromptedForKeyword += new PromptStringResultEventHandler(event_PromptedForKeyword); + + ed.PromptingForNestedEntity += new PromptNestedEntityOptionsEventHandler(event_PromptingForNestedEntity); + ed.PromptedForNestedEntity += new PromptNestedEntityResultEventHandler(event_PromptedForNestedEntity); + + ed.PromptingForPoint += new PromptPointOptionsEventHandler(event_PromptingForPoint); + ed.PromptedForPoint += new PromptPointResultEventHandler(event_PromptedForPoint); + + ed.PromptingForSelection += new PromptSelectionOptionsEventHandler(event_PromptingForSelection); + ed.PromptedForSelection += new PromptSelectionResultEventHandler(event_PromptedForSelection); + ed.PromptForSelectionEnding += new PromptForSelectionEndingEventHandler(event_PromptForSelectionEnding); + ed.SelectionAdded += new SelectionAddedEventHandler(event_SelectionAdded); + ed.SelectionRemoved += new SelectionRemovedEventHandler(event_SelectionRemoved); + + ed.PromptingForString += new PromptStringOptionsEventHandler(event_PromptingForString); + ed.PromptedForString += new PromptStringResultEventHandler(event_PromptedForString); + } + + protected override void + DisableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nEditor Events Turned Off ...\n"); + + DocumentCollection docs = Application.DocumentManager; + foreach (Document doc in docs) { + DisableEvents(doc.Editor); + } + } + + public void + DisableEvents(Editor ed) + { + ed.EnteringQuiescentState -= new EventHandler(event_EnteringQuiescentState); + ed.LeavingQuiescentState -= new EventHandler(event_LeavingQuiescentState); + + ed.PointFilter -= new PointFilterEventHandler(event_PointFilter); + ed.PointMonitor -= new PointMonitorEventHandler(event_PointMonitor); + + ed.PromptingForAngle -= new PromptAngleOptionsEventHandler(event_PromptingForAngle); + ed.PromptedForAngle -= new PromptDoubleResultEventHandler(event_PromptedForAngle); + + ed.PromptingForCorner -= new PromptPointOptionsEventHandler(event_PromptingForCorner); + ed.PromptedForCorner -= new PromptPointResultEventHandler(event_PromptedForCorner); + + ed.PromptingForDistance -= new PromptDistanceOptionsEventHandler(event_PromptingForDistance); + ed.PromptedForDistance -= new PromptDoubleResultEventHandler(event_PromptedForDistance); + + ed.PromptingForDouble -= new PromptDoubleOptionsEventHandler(event_PromptingForDouble); + ed.PromptedForDouble -= new PromptDoubleResultEventHandler(event_PromptedForDouble); + + ed.PromptingForEntity -= new PromptEntityOptionsEventHandler(event_PromptingForEntity); + ed.PromptedForEntity -= new PromptEntityResultEventHandler(event_PromptedForEntity); + ed.PromptForEntityEnding -= new PromptForEntityEndingEventHandler(event_PromptForEntityEnding); + + ed.PromptingForInteger -= new PromptIntegerOptionsEventHandler(event_PromptingForInteger); + ed.PromptedForInteger -= new PromptIntegerResultEventHandler(event_PromptedForInteger); + + ed.PromptingForKeyword -= new PromptKeywordOptionsEventHandler(event_PromptingForKeyword); + ed.PromptedForKeyword -= new PromptStringResultEventHandler(event_PromptedForKeyword); + + ed.PromptingForNestedEntity -= new PromptNestedEntityOptionsEventHandler(event_PromptingForNestedEntity); + ed.PromptedForNestedEntity -= new PromptNestedEntityResultEventHandler(event_PromptedForNestedEntity); + + ed.PromptingForPoint -= new PromptPointOptionsEventHandler(event_PromptingForPoint); + ed.PromptedForPoint -= new PromptPointResultEventHandler(event_PromptedForPoint); + + ed.PromptingForSelection -= new PromptSelectionOptionsEventHandler(event_PromptingForSelection); + ed.PromptedForSelection -= new PromptSelectionResultEventHandler(event_PromptedForSelection); + ed.PromptForSelectionEnding -= new PromptForSelectionEndingEventHandler(event_PromptForSelectionEnding); + ed.SelectionAdded -= new SelectionAddedEventHandler(event_SelectionAdded); + ed.SelectionRemoved -= new SelectionRemovedEventHandler(event_SelectionRemoved); + + ed.PromptingForString -= new PromptStringOptionsEventHandler(event_PromptingForString); + ed.PromptedForString -= new PromptStringResultEventHandler(event_PromptedForString); + } + + private void + event_SelectionRemoved(object sender, SelectionRemovedEventArgs e) + { + PrintEventMessage(sender, "Selection Removed"); + /*if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "SelectionRemoved"; + dbox.ShowDialog(); + }*/ + } + + private void + event_SelectionAdded(object sender, SelectionAddedEventArgs e) + { + PrintEventMessage(sender, "Selection Added"); + /*if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "SelectionAdded"; + dbox.ShowDialog(); + }*/ + } + + private void + event_PromptingForString(object sender, PromptStringOptionsEventArgs e) + { + PrintEventMessage(sender, "Prompting For String"); + /*if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "PromptingForString"; + dbox.ShowDialog(); + }*/ + } + + private void + event_PromptingForSelection(object sender, PromptSelectionOptionsEventArgs e) + { + PrintEventMessage(sender, "Prompting For Selection"); + /*if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "PromptingForSelection"; + dbox.ShowDialog(); + }*/ + } + + private void + event_PromptingForPoint(object sender, PromptPointOptionsEventArgs e) + { + PrintEventMessage(sender, "Prompting For Point"); + /*if (PrintDetails(sender)) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "PromptingForPoint"; + dbox.ShowDialog(); + }*/ + } + + private void + event_PromptingForNestedEntity(object sender, PromptNestedEntityOptionsEventArgs e) + { + PrintEventMessage(sender, "Prompting For Nested Entity"); + /*if (PrintDetails(sender)) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "PromptingForNestedEntity"; + dbox.ShowDialog(); + }*/ + } + + private void + event_PromptingForKeyword(object sender, PromptKeywordOptionsEventArgs e) + { + PrintEventMessage(sender, "Prompting For Keyword"); + /*if (PrintDetails(sender)) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "PromptingForKeyword"; + dbox.ShowDialog(); + }*/ + } + + private void + event_PromptingForInteger(object sender, PromptIntegerOptionsEventArgs e) + { + PrintEventMessage(sender, "Prompting For Integer"); + /*if (PrintDetails(sender)) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "PromptingForInteger"; + dbox.ShowDialog(); + }*/ + } + + private void + event_PromptingForEntity(object sender, PromptEntityOptionsEventArgs e) + { + PrintEventMessage(sender, "Prompting For Entity"); + /*if (PrintDetails(sender)) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "PromptingForEntity"; + dbox.ShowDialog(); + }*/ + } + + private void + event_PromptingForDouble(object sender, PromptDoubleOptionsEventArgs e) + { + PrintEventMessage(sender, "Prompting For Double"); + /*if (PrintDetails(sender)) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "PromptingForDouble"; + dbox.ShowDialog(); + }*/ + } + + private void + event_PromptingForDistance(object sender, PromptDistanceOptionsEventArgs e) + { + PrintEventMessage(sender, "Prompting For Distance"); + /*if (PrintDetails(sender)) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "PromptingForDistance"; + dbox.ShowDialog(); + }*/ + } + + private void + event_PromptingForCorner(object sender, PromptPointOptionsEventArgs e) + { + PrintEventMessage(sender, "Prompting For Corner"); + /*if (PrintDetails(sender)) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "PromptingForCorner"; + dbox.ShowDialog(); + }*/ + } + + private void + event_PromptingForAngle(object sender, PromptAngleOptionsEventArgs e) + { + PrintEventMessage(sender, "Prompting For Angle"); + /*if (PrintDetails(sender)) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "PromptingForAngle"; + dbox.ShowDialog(); + }*/ + } + + private void + event_PromptForSelectionEnding(object sender, PromptForSelectionEndingEventArgs e) + { + PrintEventMessage(sender, "Prompt For Selection Ending"); + if (m_showDetails) { + } + } + + private void + event_PromptForEntityEnding(object sender, PromptForEntityEndingEventArgs e) + { + PrintEventMessage(sender, "Prompt For Entity Ending"); + if (m_showDetails) { + } + } + + private void + event_PromptedForString(object sender, PromptStringResultEventArgs e) + { + PrintEventMessage(sender, "Prompted For String"); + if (m_showDetails) { + } + } + + private void + event_PromptedForSelection(object sender, PromptSelectionResultEventArgs e) + { + PrintEventMessage(sender, "Prompted For Selection"); + if (m_showDetails) { + } + } + + private void + event_PromptedForPoint(object sender, PromptPointResultEventArgs e) + { + PrintEventMessage(sender, "Prompted For Point"); + if (m_showDetails) { + } + } + + private void + event_PromptedForNestedEntity(object sender, PromptNestedEntityResultEventArgs e) + { + PrintEventMessage(sender, "Prompted For Nested Entity"); + if (m_showDetails) { + } + } + + private void + event_PromptedForKeyword(object sender, PromptStringResultEventArgs e) + { + PrintEventMessage(sender, "Prompted For Keyword"); + if (m_showDetails) { + } + } + + private void + event_PromptedForInteger(object sender, PromptIntegerResultEventArgs e) + { + PrintEventMessage(sender, "Prompted For Integer"); + if (m_showDetails) { + } + } + + private void + event_PromptedForEntity(object sender, PromptEntityResultEventArgs e) + { + PrintEventMessage(sender, "Prompted For Entity"); + if (m_showDetails) { + } + } + + private void + event_PromptedForDouble(object sender, PromptDoubleResultEventArgs e) + { + PrintEventMessage(sender, "Prompted For Double"); + if (m_showDetails) { + } + } + + private void + event_PromptedForDistance(object sender, PromptDoubleResultEventArgs e) + { + PrintEventMessage(sender, "Prompted For Distance"); + if (m_showDetails) { + } + } + + private void + event_PromptedForCorner(object sender, PromptPointResultEventArgs e) + { + PrintEventMessage(sender, "Prompted For Corner"); + if (m_showDetails) { + } + } + + private void + event_PromptedForAngle(object sender, PromptDoubleResultEventArgs e) + { + PrintEventMessage(sender, "Prompted For Angle"); + if (m_showDetails) { + } + } + + private void + event_PointMonitor(object sender, PointMonitorEventArgs e) + { + PrintEventMessage(sender, "Point Monitor"); + if (m_showDetails) { + } + } + + private void + event_PointFilter(object sender, PointFilterEventArgs e) + { + PrintEventMessage(sender, "Point Filter"); + if (m_showDetails) { + } + } + + private void + event_LeavingQuiescentState(object sender, EventArgs e) + { + PrintEventMessage(sender, "Leaving Quiescent State"); + } + + private void + event_EnteringQuiescentState(object sender, EventArgs e) + { + PrintEventMessage(sender, "Entering Quiescent State"); + } + + #region Print Abstraction + + private void + PrintEventMessage(object obj, string eventStr) + { + //Editor ed = (Editor)obj; + //if (!(ed.IsDragging && m_suppressDuringDrag)) { + string printString = string.Format("\n[Editor Event] : {0,-20} ", eventStr); + Utils.AcadUi.PrintToCmdLine(printString); + //} + } + + private bool + PrintDetails(object obj) + { + // TBD: getting so many messages during drag that they become worthless. On C++ side + // there was a beginDragSequence() event that allowed us to filter the extras out. Can't + // find a way to do that on .NET side (jma - 09/08/06) + Editor ed = (Editor)obj; + if (ed.IsDragging) { + // print the first drag message, but suppress the rest until the + // end of the drag sequence + //if (m_dragJustStarted) { + // m_dragJustStarted = false; + // return true; + return false; + } + else { + return m_showDetails; + } + } + + #endregion + } +} diff --git a/MgdDbgLibrary/Reactors/Events/EventsBase.cs b/MgdDbgLibrary/Reactors/Events/EventsBase.cs new file mode 100644 index 0000000..7ab4306 --- /dev/null +++ b/MgdDbgLibrary/Reactors/Events/EventsBase.cs @@ -0,0 +1,75 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Diagnostics; + +namespace MgdDbg.Reactors.Events { + + public abstract class EventsBase { + + protected bool m_showDetails = false; + protected bool m_areEventsEnabled = false; + + protected + EventsBase() + { + } + + public bool + ShowDetails + { + get { return m_showDetails; } + set { m_showDetails = value; } + } + + + public bool + AreEventsEnabled + { + get { return m_areEventsEnabled; } + } + + public void + EnableEvents() + { + Debug.Assert(m_areEventsEnabled == false); + + EnableEventsImp(); + m_areEventsEnabled = true; + } + + public void + DisableEvents() + { + Debug.Assert(m_areEventsEnabled == true); + + DisableEventsImp(); + m_areEventsEnabled = false; + } + + // override these to enable and diable events in derived classes + protected abstract void EnableEventsImp(); + protected abstract void DisableEventsImp(); + + } +} diff --git a/MgdDbgLibrary/Reactors/Events/GraphicsSystemEvents.cs b/MgdDbgLibrary/Reactors/Events/GraphicsSystemEvents.cs new file mode 100644 index 0000000..4620c18 --- /dev/null +++ b/MgdDbgLibrary/Reactors/Events/GraphicsSystemEvents.cs @@ -0,0 +1,139 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using Autodesk.AutoCAD.ApplicationServices; + + +namespace MgdDbg.Reactors.Events { + + public class GraphicsSystemEvents : EventsBase { + + public + GraphicsSystemEvents() + { + } + + protected override void + EnableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nGraphics System Events Turned On ...\n"); + + DocumentCollection docs = Application.DocumentManager; + + foreach (Document doc in docs) { + EnableEvents(doc.GraphicsManager); + } + } + + public void + EnableEvents(Autodesk.AutoCAD.GraphicsSystem.Manager mgr) + { + mgr.ConfigWasModified += new Autodesk.AutoCAD.GraphicsSystem.ConfigWasModifiedEventHandler(event_ConfigWasModified); + mgr.GsToBeUnloaded += new Autodesk.AutoCAD.GraphicsSystem.GsToBeUnloadedEventHandler(event_GsToBeUnloaded); + mgr.ViewToBeDestroyed += new Autodesk.AutoCAD.GraphicsSystem.ViewToBeDestroyedEventHandler(event_ViewToBeDestroyed); + mgr.ViewWasCreated += new Autodesk.AutoCAD.GraphicsSystem.ViewWasCreatedEventHandler(event_ViewWasCreated); + } + + protected override void + DisableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nGraphics System Events Turned Off ...\n"); + + DocumentCollection docs = Application.DocumentManager; + + foreach (Document doc in docs) { + DisableEvents(doc.GraphicsManager); + } + } + + public void + DisableEvents(Autodesk.AutoCAD.GraphicsSystem.Manager mgr) + { + mgr.ConfigWasModified -= new Autodesk.AutoCAD.GraphicsSystem.ConfigWasModifiedEventHandler(event_ConfigWasModified); + mgr.GsToBeUnloaded -= new Autodesk.AutoCAD.GraphicsSystem.GsToBeUnloadedEventHandler(event_GsToBeUnloaded); + mgr.ViewToBeDestroyed -= new Autodesk.AutoCAD.GraphicsSystem.ViewToBeDestroyedEventHandler(event_ViewToBeDestroyed); + mgr.ViewWasCreated -= new Autodesk.AutoCAD.GraphicsSystem.ViewWasCreatedEventHandler(event_ViewWasCreated); + } + + + private void + event_ViewWasCreated(object sender, Autodesk.AutoCAD.GraphicsSystem.ViewEventArgs e) + { +#if(AC2012) +#else + PrintReactorMessage("View Was Created", e.View.ViewportExtents.ToString()); +#endif + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "ViewWasCreated"; + dbox.ShowDialog(); + } + } + + private void + event_ViewToBeDestroyed(object sender, Autodesk.AutoCAD.GraphicsSystem.ViewEventArgs e) + { +#if(AC2012) +#else + PrintReactorMessage("View To Be Destroyed", e.View.ViewportExtents.ToString()); +#endif + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "ViewToBeDestroyed"; + dbox.ShowDialog(); + } + } + + private void + event_GsToBeUnloaded(object sender, EventArgs e) + { + PrintReactorMessage("Gs To Be Unloaded"); + } + + private void + event_ConfigWasModified(object sender, EventArgs e) + { + PrintReactorMessage("Config Was Modified"); + } + + #region Print Abstraction + + private void + PrintReactorMessage(string eventStr) + { + string printString = string.Format("\n[Graphics System Event] : {0,-20} ", eventStr); + Utils.AcadUi.PrintToCmdLine(printString); + } + + private void + PrintReactorMessage(string eventStr, string viewName) + { + string printString = string.Format("\n[Graphics System Event] : {0,-20} : {1}", eventStr, viewName); + Utils.AcadUi.PrintToCmdLine(printString); + } + + #endregion + + } +} diff --git a/MgdDbgLibrary/Reactors/Events/LayoutManagerEvents.cs b/MgdDbgLibrary/Reactors/Events/LayoutManagerEvents.cs new file mode 100644 index 0000000..ee5dfc9 --- /dev/null +++ b/MgdDbgLibrary/Reactors/Events/LayoutManagerEvents.cs @@ -0,0 +1,230 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using AcDb = Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.Reactors.Events { + + public class LayoutManagerEvents : EventsBase { + + private AcDb.LayoutManager m_lMgr; + + public + LayoutManagerEvents() + { + m_lMgr = null; + } + + protected override void + EnableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nLayout Manager Events Turned On ...\n"); + + m_lMgr = AcDb.LayoutManager.Current; + + m_lMgr.AbortLayoutCopied += new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_AbortLayoutCopied); + m_lMgr.AbortLayoutRemoved += new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_AbortLayoutRemoved); + m_lMgr.AbortLayoutRename += new Autodesk.AutoCAD.DatabaseServices.LayoutRenamedEventHandler(event_AbortLayoutRename); + m_lMgr.LayoutCopied += new Autodesk.AutoCAD.DatabaseServices.LayoutCopiedEventHandler(event_LayoutCopied); + m_lMgr.LayoutCreated += new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_LayoutCreated); + m_lMgr.LayoutRemoved += new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_LayoutRemoved); + m_lMgr.LayoutRenamed += new Autodesk.AutoCAD.DatabaseServices.LayoutRenamedEventHandler(event_LayoutRenamed); + m_lMgr.LayoutsReordered += new EventHandler(event_LayoutsReordered); + m_lMgr.LayoutSwitched += new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_LayoutSwitched); + m_lMgr.LayoutToBeCopied += new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_LayoutToBeCopied); + m_lMgr.LayoutToBeRemoved += new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_LayoutToBeRemoved); + m_lMgr.LayoutToBeRenamed += new Autodesk.AutoCAD.DatabaseServices.LayoutRenamedEventHandler(event_LayoutToBeRenamed); + m_lMgr.PlotStyleTableChanged += new Autodesk.AutoCAD.DatabaseServices.PlotStyleTableChangedEventHandler(event_PlotStyleTableChanged); + } + + protected override void + DisableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nLayout Manager Events Turned Off ...\n"); + + m_lMgr.AbortLayoutCopied -= new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_AbortLayoutCopied); + m_lMgr.AbortLayoutRemoved -= new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_AbortLayoutRemoved); + m_lMgr.AbortLayoutRename -= new Autodesk.AutoCAD.DatabaseServices.LayoutRenamedEventHandler(event_AbortLayoutRename); + m_lMgr.LayoutCopied -= new Autodesk.AutoCAD.DatabaseServices.LayoutCopiedEventHandler(event_LayoutCopied); + m_lMgr.LayoutCreated -= new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_LayoutCreated); + m_lMgr.LayoutRemoved -= new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_LayoutRemoved); + m_lMgr.LayoutRenamed -= new Autodesk.AutoCAD.DatabaseServices.LayoutRenamedEventHandler(event_LayoutRenamed); + m_lMgr.LayoutsReordered -= new EventHandler(event_LayoutsReordered); + m_lMgr.LayoutSwitched -= new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_LayoutSwitched); + m_lMgr.LayoutToBeCopied -= new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_LayoutToBeCopied); + m_lMgr.LayoutToBeRemoved -= new Autodesk.AutoCAD.DatabaseServices.LayoutEventHandler(event_LayoutToBeRemoved); + m_lMgr.LayoutToBeRenamed -= new Autodesk.AutoCAD.DatabaseServices.LayoutRenamedEventHandler(event_LayoutToBeRenamed); + m_lMgr.PlotStyleTableChanged -= new Autodesk.AutoCAD.DatabaseServices.PlotStyleTableChangedEventHandler(event_PlotStyleTableChanged); + } + + private void + event_PlotStyleTableChanged(object sender, Autodesk.AutoCAD.DatabaseServices.PlotStyleTableChangedEventArgs e) + { + PrintReactorMessage("Plot Style Table Changed"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "PlotStyleTableChanged"; + dbox.ShowDialog(); + } + } + + private void + event_LayoutToBeRenamed(object sender, Autodesk.AutoCAD.DatabaseServices.LayoutRenamedEventArgs e) + { + PrintReactorMessage("Layout To Be Renamed"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "LayoutToBeRenamed"; + dbox.ShowDialog(); + } + } + + private void + event_LayoutToBeRemoved(object sender, Autodesk.AutoCAD.DatabaseServices.LayoutEventArgs e) + { + PrintReactorMessage("Layout To Be Removed"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "LayoutToBeRemoved"; + dbox.ShowDialog(); + } + } + + private void + event_LayoutToBeCopied(object sender, Autodesk.AutoCAD.DatabaseServices.LayoutEventArgs e) + { + PrintReactorMessage("Layout To Be Copied"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "LayoutToBeCopied"; + dbox.ShowDialog(); + } + } + + private void + event_LayoutSwitched(object sender, Autodesk.AutoCAD.DatabaseServices.LayoutEventArgs e) + { + PrintReactorMessage("Layout Switched"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "LayoutToBeSwitched"; + dbox.ShowDialog(); + } + } + + private void + event_LayoutsReordered(object sender, EventArgs e) + { + PrintReactorMessage("Layouts Reordered"); + } + + private void + event_LayoutRenamed(object sender, Autodesk.AutoCAD.DatabaseServices.LayoutRenamedEventArgs e) + { + PrintReactorMessage("Layout Renamed"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "LayoutRenamed"; + dbox.ShowDialog(); + } + } + + private void + event_LayoutRemoved(object sender, Autodesk.AutoCAD.DatabaseServices.LayoutEventArgs e) + { + PrintReactorMessage("Layout Removed"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "LayoutRemoved"; + dbox.ShowDialog(); + } + } + + private void + event_LayoutCreated(object sender, Autodesk.AutoCAD.DatabaseServices.LayoutEventArgs e) + { + PrintReactorMessage("Layout Created"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "LayoutCreated"; + dbox.ShowDialog(); + } + } + + private void + event_LayoutCopied(object sender, Autodesk.AutoCAD.DatabaseServices.LayoutCopiedEventArgs e) + { + PrintReactorMessage("Layout Copied"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "LayoutCopied"; + dbox.ShowDialog(); + } + } + + private void + event_AbortLayoutRename(object sender, Autodesk.AutoCAD.DatabaseServices.LayoutRenamedEventArgs e) + { + PrintReactorMessage("Abort Layout Rename"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "AbortLayoutRename"; + dbox.ShowDialog(); + } + } + + private void + event_AbortLayoutRemoved(object sender, Autodesk.AutoCAD.DatabaseServices.LayoutEventArgs e) + { + PrintReactorMessage("Abort Layout Removed"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "AbortLayoutRemoved"; + dbox.ShowDialog(); + } + } + + private void + event_AbortLayoutCopied(object sender, Autodesk.AutoCAD.DatabaseServices.LayoutEventArgs e) + { + PrintReactorMessage("Abort Layout Copied"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "AbortLayoutCopied"; + dbox.ShowDialog(); + } + } + + #region Print Abstraction + + private void + PrintReactorMessage(string eventStr) + { + string printString = string.Format("\n[Layout Manager Event] : {0,-20} ", eventStr); + Utils.AcadUi.PrintToCmdLine(printString); + } + + #endregion + } +} diff --git a/MgdDbgLibrary/Reactors/Events/PlotEvents.cs b/MgdDbgLibrary/Reactors/Events/PlotEvents.cs new file mode 100644 index 0000000..d6ff9cd --- /dev/null +++ b/MgdDbgLibrary/Reactors/Events/PlotEvents.cs @@ -0,0 +1,160 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using AcPl = Autodesk.AutoCAD.PlottingServices; +using AcApp = Autodesk.AutoCAD.ApplicationServices; + +namespace MgdDbg.Reactors.Events { + + public class PlotEvents : EventsBase { + + public + PlotEvents() + { + } + + protected override void + EnableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nPlot Events Turned On ...\n"); + + AcPl.PlotReactorManager plot = new AcPl.PlotReactorManager(); + + plot.BeginDocument += new Autodesk.AutoCAD.PlottingServices.BeginDocumentEventHandler(event_BeginDocument); + plot.BeginPage += new Autodesk.AutoCAD.PlottingServices.BeginPageEventHandler(event_BeginPage); + plot.BeginPlot += new Autodesk.AutoCAD.PlottingServices.BeginPlotEventHandler(event_BeginPlot); + plot.EndDocument += new Autodesk.AutoCAD.PlottingServices.EndDocumentEventHandler(event_EndDocument); + plot.EndPage += new Autodesk.AutoCAD.PlottingServices.EndPageEventHandler(event_EndPage); + plot.EndPlot += new Autodesk.AutoCAD.PlottingServices.EndPlotEventHandler(event_EndPlot); + plot.PageCancelled += new Autodesk.AutoCAD.PlottingServices.PageCancelledEventHandler(event_PageCancelled); + plot.PlotCancelled += new Autodesk.AutoCAD.PlottingServices.PlotCancelledEventHandler(event_PlotCancelled); + } + + protected override void + DisableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nPlot Events Turned Off ...\n"); + + AcPl.PlotReactorManager plot = new AcPl.PlotReactorManager(); + + plot.BeginDocument -= new Autodesk.AutoCAD.PlottingServices.BeginDocumentEventHandler(event_BeginDocument); + plot.BeginPage -= new Autodesk.AutoCAD.PlottingServices.BeginPageEventHandler(event_BeginPage); + plot.BeginPlot -= new Autodesk.AutoCAD.PlottingServices.BeginPlotEventHandler(event_BeginPlot); + plot.EndDocument -= new Autodesk.AutoCAD.PlottingServices.EndDocumentEventHandler(event_EndDocument); + plot.EndPage -= new Autodesk.AutoCAD.PlottingServices.EndPageEventHandler(event_EndPage); + plot.EndPlot -= new Autodesk.AutoCAD.PlottingServices.EndPlotEventHandler(event_EndPlot); + plot.PageCancelled -= new Autodesk.AutoCAD.PlottingServices.PageCancelledEventHandler(event_PageCancelled); + plot.PlotCancelled -= new Autodesk.AutoCAD.PlottingServices.PlotCancelledEventHandler(event_PlotCancelled); + } + + private void + event_PlotCancelled(object sender, EventArgs e) + { + PrintReactorMessage("Plot Cancelled"); + } + + private void + event_PageCancelled(object sender, EventArgs e) + { + PrintReactorMessage("Page Cancelled"); + } + + private void + event_EndPlot(object sender, Autodesk.AutoCAD.PlottingServices.EndPlotEventArgs e) + { + PrintReactorMessage("End Plot"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "EndPlot"; + dbox.ShowDialog(); + } + } + + private void + event_EndPage(object sender, Autodesk.AutoCAD.PlottingServices.EndPageEventArgs e) + { + PrintReactorMessage("Plot End Page"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "EndPage"; + dbox.ShowDialog(); + } + } + + private void + event_EndDocument(object sender, Autodesk.AutoCAD.PlottingServices.EndDocumentEventArgs e) + { + PrintReactorMessage("End Document"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "EndDocument"; + dbox.ShowDialog(); + } + } + + private void + event_BeginPlot(object sender, Autodesk.AutoCAD.PlottingServices.BeginPlotEventArgs e) + { + PrintReactorMessage("Begin Plot"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "BeginPlot"; + dbox.ShowDialog(); + } + } + + private void + event_BeginPage(object sender, Autodesk.AutoCAD.PlottingServices.BeginPageEventArgs e) + { + PrintReactorMessage("Begin Page"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "BeginPage"; + dbox.ShowDialog(); + } + } + + private void + event_BeginDocument(object sender, Autodesk.AutoCAD.PlottingServices.BeginDocumentEventArgs e) + { + PrintReactorMessage("Begin Document"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "BeginDocument"; + dbox.ShowDialog(); + } + } + + #region Print Abstraction + + private void + PrintReactorMessage(string eventStr) + { + string printString = string.Format("\n[Plot Event] : {0,-20} ", eventStr); + Utils.AcadUi.PrintToCmdLine(printString); + } + + #endregion + } +} diff --git a/MgdDbgLibrary/Reactors/Events/PublishEvents.cs b/MgdDbgLibrary/Reactors/Events/PublishEvents.cs new file mode 100644 index 0000000..6287b9c --- /dev/null +++ b/MgdDbgLibrary/Reactors/Events/PublishEvents.cs @@ -0,0 +1,396 @@ +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using AcPb = Autodesk.AutoCAD.Publishing; +using AcApp = Autodesk.AutoCAD.ApplicationServices; +using AcDb = Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.Reactors.Events { + + /// + /// Handle all the events exposed by the Publish namespace + /// + + public class PublishEvents : EventsBase { + + private bool m_publishProps; + + public + PublishEvents() + { + m_publishProps = false; + } + + protected override void + EnableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nPublish Events Turned On ...\n"); + + Autodesk.AutoCAD.Publishing.Publisher pub = AcApp.Application.Publisher; + + pub.AboutToBeginBackgroundPublishing += new Autodesk.AutoCAD.Publishing.AboutToBeginBackgroundPublishingEventHandler(event_AboutToBeginBackgroundPublishing); + pub.AboutToBeginPublishing += new Autodesk.AutoCAD.Publishing.AboutToBeginPublishingEventHandler(event_AboutToBeginPublishing); + pub.AboutToEndPublishing += new Autodesk.AutoCAD.Publishing.AboutToEndPublishingEventHandler(event_AboutToEndPublishing); + pub.AboutToMoveFile += new Autodesk.AutoCAD.Publishing.AboutToMoveFileEventHandler(event_AboutToMoveFile); + pub.BeginAggregation += new Autodesk.AutoCAD.Publishing.BeginAggregationEventHandler(event_BeginAggregation); + pub.BeginEntity += new Autodesk.AutoCAD.Publishing.BeginEntityEventHandler(event_BeginEntity); + pub.BeginPublishingSheet += new Autodesk.AutoCAD.Publishing.BeginPublishingSheetEventHandler(event_BeginPublishingSheet); + pub.BeginSheet += new Autodesk.AutoCAD.Publishing.BeginSheetEventHandler(event_BeginSheet); + pub.CancelledOrFailedPublishing += new Autodesk.AutoCAD.Publishing.CancelledOrFailedPublishingEventHandler(event_CancelledOrFailedPublishing); + pub.EndEntity += new Autodesk.AutoCAD.Publishing.EndEntityEventHandler(event_EndEntity); + pub.EndPublish += new Autodesk.AutoCAD.Publishing.EndPublishEventHandler(event_EndPublish); + pub.EndSheet += new Autodesk.AutoCAD.Publishing.EndSheetEventHandler(event_EndSheet); + pub.InitPublishOptionsDialog += new Autodesk.AutoCAD.Publishing.InitPublishOptionsDialogEventHandler(event_InitPublishOptionsDialog); + } + + protected override void + DisableEventsImp() + { + Utils.AcadUi.PrintToCmdLine("\nPublish Events Turned Off ...\n"); + + Autodesk.AutoCAD.Publishing.Publisher pub = AcApp.Application.Publisher; + + pub.AboutToBeginBackgroundPublishing -= new Autodesk.AutoCAD.Publishing.AboutToBeginBackgroundPublishingEventHandler(event_AboutToBeginBackgroundPublishing); + pub.AboutToBeginPublishing -= new Autodesk.AutoCAD.Publishing.AboutToBeginPublishingEventHandler(event_AboutToBeginPublishing); + pub.AboutToEndPublishing -= new Autodesk.AutoCAD.Publishing.AboutToEndPublishingEventHandler(event_AboutToEndPublishing); + pub.AboutToMoveFile -= new Autodesk.AutoCAD.Publishing.AboutToMoveFileEventHandler(event_AboutToMoveFile); + pub.BeginAggregation -= new Autodesk.AutoCAD.Publishing.BeginAggregationEventHandler(event_BeginAggregation); + pub.BeginEntity -= new Autodesk.AutoCAD.Publishing.BeginEntityEventHandler(event_BeginEntity); + pub.BeginPublishingSheet -= new Autodesk.AutoCAD.Publishing.BeginPublishingSheetEventHandler(event_BeginPublishingSheet); + pub.BeginSheet -= new Autodesk.AutoCAD.Publishing.BeginSheetEventHandler(event_BeginSheet); + pub.CancelledOrFailedPublishing -= new Autodesk.AutoCAD.Publishing.CancelledOrFailedPublishingEventHandler(event_CancelledOrFailedPublishing); + pub.EndEntity -= new Autodesk.AutoCAD.Publishing.EndEntityEventHandler(event_EndEntity); + pub.EndPublish -= new Autodesk.AutoCAD.Publishing.EndPublishEventHandler(event_EndPublish); + pub.EndSheet -= new Autodesk.AutoCAD.Publishing.EndSheetEventHandler(event_EndSheet); + pub.InitPublishOptionsDialog -= new Autodesk.AutoCAD.Publishing.InitPublishOptionsDialogEventHandler(event_InitPublishOptionsDialog); + } + + private void + event_AboutToBeginBackgroundPublishing(object sender, Autodesk.AutoCAD.Publishing.AboutToBeginBackgroundPublishingEventArgs e) + { + PrintReactorMessage("About To Begin Background Publishing"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "AboutToBeginBackgroundPublishing"; + dbox.ShowDialog(); + } + } + + private void + event_AboutToBeginPublishing(object sender, Autodesk.AutoCAD.Publishing.AboutToBeginPublishingEventArgs e) + { + PrintReactorMessage("About To Begin Publishing"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "AboutToBeginPublishing"; + dbox.ShowDialog(); + } + } + + private void + event_AboutToEndPublishing(object sender, Autodesk.AutoCAD.Publishing.PublishEventArgs e) + { + PrintReactorMessage("About To End Publishing"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "AboutToEndPublishing"; + dbox.ShowDialog(); + } + } + + private void + event_EndPublish(object sender, Autodesk.AutoCAD.Publishing.PublishEventArgs e) + { + PrintReactorMessage("End Publish"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "EndPublish"; + dbox.ShowDialog(); + } + } + + private void + event_CancelledOrFailedPublishing(object sender, Autodesk.AutoCAD.Publishing.PublishEventArgs e) + { + PrintReactorMessage("Cancelled Or Failed Publishing"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "CancelledOrFailedPublishing"; + dbox.ShowDialog(); + } + } + + private void + event_BeginPublishingSheet(object sender, Autodesk.AutoCAD.Publishing.BeginPublishingSheetEventArgs e) + { + PrintReactorMessage("Begin Publishing Sheet"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "BeginPublishingSheet"; + dbox.ShowDialog(); + } + } + + private void + event_BeginAggregation(object sender, Autodesk.AutoCAD.Publishing.BeginAggregationEventArgs e) + { + PrintReactorMessage("Begin Aggregation"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "BeginAggregation"; + dbox.ShowDialog(); + } + } + + private void + event_AboutToMoveFile(object sender, Autodesk.AutoCAD.Publishing.PublishEventArgs e) + { + PrintReactorMessage("About To Move File"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "AboutToMoveFile"; + dbox.ShowDialog(); + } + } + + private void + event_EndSheet(object sender, Autodesk.AutoCAD.Publishing.PublishSheetEventArgs e) + { + PrintReactorMessage("End Sheet"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "EndSheet"; + dbox.ShowDialog(); + } + } + + private void + event_EndEntity(object sender, Autodesk.AutoCAD.Publishing.PublishEntityEventArgs e) + { + PrintReactorMessage("End Entity"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "EndEntity"; + dbox.ShowDialog(); + } + } + + private void + event_BeginSheet(object sender, Autodesk.AutoCAD.Publishing.PublishSheetEventArgs e) + { + PrintReactorMessage("Begin Sheet"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "BeginSheet"; + dbox.ShowDialog(); + } + + if (m_publishProps) { + PublishSheetProperties(e); + } + } + + + private void + event_BeginEntity(object sender, Autodesk.AutoCAD.Publishing.PublishEntityEventArgs e) + { + PrintReactorMessage("Begin Entity"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "BeginEntity"; + dbox.ShowDialog(); + } + + if (m_publishProps) { + PublishEntityProperties(e); + } + } + + private void + event_InitPublishOptionsDialog(object sender, Autodesk.AutoCAD.Publishing.PublishUIEventArgs e) + { + PrintReactorMessage("Init Publish Options Dialog"); + if (m_showDetails) { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(e); + dbox.Text = "InitPublishOptionsDialog"; + dbox.ShowDialog(); + } + } + + private void + PublishEntityProperties (Autodesk.AutoCAD.Publishing.PublishEntityEventArgs e) + { + Int32 curNodeId = -1; + AcDb.ObjectIdCollection refPathIds; + + refPathIds = e.getEntityBlockRefPath(); + curNodeId = e.GetEntityNode(e.Entity.ObjectId, refPathIds); + + AcPb.EPlotPropertyBag propBag = new AcPb.EPlotPropertyBag(); + AcPb.EPlotProperty prop; + AcPb.EPlotAttribute attrib; + + //Add the property + // + prop = new AcPb.EPlotProperty(); + prop.Name = "Cast Shadows"; + prop.Category = "Entity Properties"; + prop.Value = e.Entity.CastShadows.ToString(); + + //Add the hidden attribute data to the property + // + attrib = new AcPb.EPlotAttribute(); + attrib.Ns = "MgdDbg"; + attrib.NsUrl = "http://adsk/MgdDbg.xsd"; + attrib.Name = "value"; + attrib.Value = System.Convert.ToInt32(e.Entity.CastShadows).ToString(); + + prop.Attributes.Add(attrib); + propBag.Properties.Add(prop); + + //Add the property + // + prop = new AcPb.EPlotProperty(); + prop.Name = "Clone Me For Dragging"; + prop.Category = "Entity Properties"; + prop.Value = e.Entity.CloneMeForDragging.ToString(); + + //Add the hidden attribute data to the property + // + attrib = new AcPb.EPlotAttribute(); + attrib.Ns = "MgdDbg"; + attrib.NsUrl = "http://adsk/MgdDbg.xsd"; + attrib.Name = "value"; + attrib.Value = System.Convert.ToInt32(e.Entity.CloneMeForDragging).ToString(); + + prop.Attributes.Add(attrib); + propBag.Properties.Add(prop); + + //Add the property + // + prop = new AcPb.EPlotProperty(); + prop.Name = "Collision Type"; + prop.Category = "Entity Properties"; + prop.Value = e.Entity.CollisionType.ToString(); + + //Add the hidden attribute data to the property + // + attrib = new AcPb.EPlotAttribute(); + attrib.Ns = "MgdDbg"; + attrib.NsUrl = "http://adsk/MgdDbg.xsd"; + attrib.Name = "value"; + attrib.Value = System.Convert.ToInt32(e.Entity.CollisionType).ToString(); + + prop.Attributes.Add(attrib); + propBag.Properties.Add(prop); + + //Add the property + // + prop = new AcPb.EPlotProperty(); + prop.Name = "Color"; + prop.Category = "Entity Properties"; + prop.Value = e.Entity.Color.ColorNameForDisplay; + + //Add the hidden attribute data to the property + // + attrib = new AcPb.EPlotAttribute(); + attrib.Ns = "MgdDbg"; + attrib.NsUrl = "http://adsk/MgdDbg.xsd"; + attrib.Name = "value"; + attrib.Value = e.Entity.ColorIndex.ToString(); + + prop.Attributes.Add(attrib); + propBag.Properties.Add(prop); + + //Now that all the properties have been setup, associate them with the node + // + AcPb.DwfNode dwfNode = null; + + if (curNodeId == -1) + { + curNodeId = e.GetNextAvailableNode(); + dwfNode = new AcPb.DwfNode(curNodeId, "MgdDbg"); + + e.AddNodeToMap(e.Entity.ObjectId, refPathIds, curNodeId); + } + else + { + dwfNode = e.GetNode(curNodeId); + } + + propBag.Id = "MGDDBG-" + e.UniqueEntityId; + propBag.References.Add(propBag.Id); + + e.AddPropertyBag(propBag); + e.AddPropertiesIds(propBag, dwfNode); + } + + private void + PublishSheetProperties (Autodesk.AutoCAD.Publishing.PublishSheetEventArgs e) + { + AcPb.EPlotProperty prop; + AcPb.EPlotProperty[] propArray = new AcPb.EPlotProperty[4]; + + //Get the linear units + // + prop = new AcPb.EPlotProperty(); + prop.Name = "_UnitLinear"; + prop.Value = "inch"; + propArray[0] = prop; + + //Get the angular units + // + prop = new AcPb.EPlotProperty(); + prop.Name = "_UnitAngular"; + prop.Value = "radian"; + propArray[1] = prop; + + //Get the area units. + // + prop = new AcPb.EPlotProperty(); + prop.Name = "_UnitArea"; + prop.Value = "square_foot"; + propArray[2] = prop; + + //Get the volume units + // + prop = new AcPb.EPlotProperty(); + prop.Name = "_UnitVolume"; + prop.Value = "cubic_foot"; + propArray[3] = prop; + + e.AddPagePropertyRange(propArray); + } + + # region Print Abstraction + + private void + PrintReactorMessage(string eventStr) + { + string printString = string.Format("\n[Publish Event] : {0,-20} ", eventStr); + Utils.AcadUi.PrintToCmdLine(printString); + } + + #endregion + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Reactors/Forms/Details.Designer.cs b/MgdDbgLibrary/Reactors/Forms/Details.Designer.cs new file mode 100644 index 0000000..f92b184 --- /dev/null +++ b/MgdDbgLibrary/Reactors/Forms/Details.Designer.cs @@ -0,0 +1,195 @@ +namespace MgdDbg.Reactors.Forms { + partial class Details { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.m_listViewMap = new System.Windows.Forms.ListView(); + this.m_idMapkeyCol = new System.Windows.Forms.ColumnHeader(); + this.m_idMapValCol = new System.Windows.Forms.ColumnHeader(); + this.m_listViewMapItem = new System.Windows.Forms.ListView(); + this.m_objCol = new System.Windows.Forms.ColumnHeader(); + this.m_keyCol = new System.Windows.Forms.ColumnHeader(); + this.m_valCol = new System.Windows.Forms.ColumnHeader(); + this.m_clonedCol = new System.Windows.Forms.ColumnHeader(); + this.m_primCol = new System.Windows.Forms.ColumnHeader(); + this.m_ownerCol = new System.Windows.Forms.ColumnHeader(); + this.m_bnOk = new System.Windows.Forms.Button(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.SuspendLayout(); + // + // tabControl1 + // + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Location = new System.Drawing.Point(12, 23); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(818, 353); + this.tabControl1.TabIndex = 0; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.m_listViewMap); + this.tabPage1.Controls.Add(this.m_listViewMapItem); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(810, 327); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Id Mapping"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // m_listViewMap + // + this.m_listViewMap.Alignment = System.Windows.Forms.ListViewAlignment.Left; + this.m_listViewMap.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_listViewMap.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_idMapkeyCol, + this.m_idMapValCol}); + this.m_listViewMap.FullRowSelect = true; + this.m_listViewMap.GridLines = true; + this.m_listViewMap.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_listViewMap.HideSelection = false; + this.m_listViewMap.LabelWrap = false; + this.m_listViewMap.Location = new System.Drawing.Point(6, 6); + this.m_listViewMap.Name = "m_listViewMap"; + this.m_listViewMap.Size = new System.Drawing.Size(242, 315); + this.m_listViewMap.TabIndex = 2; + this.m_listViewMap.UseCompatibleStateImageBehavior = false; + this.m_listViewMap.View = System.Windows.Forms.View.Details; + // + // m_idMapkeyCol + // + this.m_idMapkeyCol.Text = "Key"; + this.m_idMapkeyCol.Width = 150; + // + // m_idMapValCol + // + this.m_idMapValCol.Text = "Value"; + this.m_idMapValCol.Width = 300; + // + // m_listViewMapItem + // + this.m_listViewMapItem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_listViewMapItem.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_objCol, + this.m_keyCol, + this.m_valCol, + this.m_clonedCol, + this.m_primCol, + this.m_ownerCol}); + this.m_listViewMapItem.FullRowSelect = true; + this.m_listViewMapItem.GridLines = true; + this.m_listViewMapItem.Location = new System.Drawing.Point(266, 6); + this.m_listViewMapItem.Name = "m_listViewMapItem"; + this.m_listViewMapItem.Size = new System.Drawing.Size(538, 315); + this.m_listViewMapItem.TabIndex = 1; + this.m_listViewMapItem.UseCompatibleStateImageBehavior = false; + this.m_listViewMapItem.View = System.Windows.Forms.View.Details; + this.m_listViewMapItem.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.m_listViewMapItem_ColumnClick); + // + // m_objCol + // + this.m_objCol.Text = ""; + this.m_objCol.Width = 136; + // + // m_keyCol + // + this.m_keyCol.Text = "Key"; + this.m_keyCol.Width = 79; + // + // m_valCol + // + this.m_valCol.Text = "Value"; + this.m_valCol.Width = 116; + // + // m_clonedCol + // + this.m_clonedCol.Text = "Is Cloned"; + this.m_clonedCol.Width = 62; + // + // m_primCol + // + this.m_primCol.Text = "Is Primary"; + this.m_primCol.Width = 63; + // + // m_ownerCol + // + this.m_ownerCol.Text = "Is OwnerXlated"; + this.m_ownerCol.Width = 84; + // + // m_bnOk + // + this.m_bnOk.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnOk.Location = new System.Drawing.Point(371, 400); + this.m_bnOk.Name = "m_bnOk"; + this.m_bnOk.Size = new System.Drawing.Size(75, 23); + this.m_bnOk.TabIndex = 1; + this.m_bnOk.Text = "OK"; + this.m_bnOk.UseVisualStyleBackColor = true; + // + // Details + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(842, 444); + this.Controls.Add(this.m_bnOk); + this.Controls.Add(this.tabControl1); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Details"; + this.Text = "Details"; + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.Button m_bnOk; + private System.Windows.Forms.ListView m_listViewMapItem; + private System.Windows.Forms.ColumnHeader m_keyCol; + private System.Windows.Forms.ColumnHeader m_valCol; + private System.Windows.Forms.ColumnHeader m_clonedCol; + private System.Windows.Forms.ColumnHeader m_primCol; + private System.Windows.Forms.ColumnHeader m_ownerCol; + private System.Windows.Forms.ListView m_listViewMap; + private System.Windows.Forms.ColumnHeader m_idMapkeyCol; + private System.Windows.Forms.ColumnHeader m_idMapValCol; + private System.Windows.Forms.ColumnHeader m_objCol; + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Reactors/Forms/Details.cs b/MgdDbgLibrary/Reactors/Forms/Details.cs new file mode 100644 index 0000000..9073148 --- /dev/null +++ b/MgdDbgLibrary/Reactors/Forms/Details.cs @@ -0,0 +1,131 @@ +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Windows.Forms; +using AcDb = Autodesk.AutoCAD.DatabaseServices; +using MgdDbg.Utils; + +namespace MgdDbg.Reactors.Forms { + public partial class Details : Form { + private AcDb.IdMapping m_idMap; + private MgdDbg.Utils.ListViewColumnSorter m_colSorter; + + /// + /// + /// + /// + /// + public Details(string titleName, AcDb.IdMapping idMap) + { + InitializeComponent(); + this.Name = titleName; + this.Text = titleName; + m_idMap = idMap; + m_colSorter = new MgdDbg.Utils.ListViewColumnSorter(); + m_listViewMapItem.ListViewItemSorter = m_colSorter; + DisplayMapProps(); + DisplayMapItems(); + } + + /// + /// + /// + private void DisplayMapProps() + { + ListViewItem item = new ListViewItem(); + item.Text = "Destination Database"; + try { + item.SubItems.Add(AcadUi.DbToStr(m_idMap.DestinationDatabase)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + item.SubItems.Add(e.Message); + } + m_listViewMap.Items.Add(item); + + ListViewItem item1 = new ListViewItem(); + item1.Text = "Original Database"; + try { + item.SubItems.Add(AcadUi.DbToStr(m_idMap.OriginalDatabase)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + item.SubItems.Add(e.Message); + } + m_listViewMap.Items.Add(item1); + + ListViewItem item2 = new ListViewItem(); + item2.Text = "Deep Clone Context"; + item2.SubItems.Add(m_idMap.DeepCloneContext.ToString()); + m_listViewMap.Items.Add(item2); + + ListViewItem item3 = new ListViewItem(); + item3.Text = "Duplicate Record Cloning"; + item3.SubItems.Add(m_idMap.DuplicateRecordCloning.ToString()); + m_listViewMap.Items.Add(item3); + } + + /// + /// + /// + private void DisplayMapItems() + { + System.Collections.IEnumerator iter = m_idMap.GetEnumerator(); + while (iter.MoveNext()) { + AcDb.IdPair pair = (AcDb.IdPair)iter.Current; + + try { + ListViewItem item = new ListViewItem(AcadUi.ObjToTypeAndHandleStr(pair.Key)); + item.SubItems.Add(pair.Key.ToString()); + item.SubItems.Add(pair.Value.ToString()); + item.SubItems.Add(pair.IsCloned.ToString()); + item.SubItems.Add(pair.IsPrimary.ToString()); + item.SubItems.Add(pair.IsOwnerTranslated.ToString()); + item.Tag = pair; + m_listViewMapItem.Items.Add(item); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + MessageBox.Show("Couldn't add a pair from the map: " + e.Message); + } + } + } + + private void m_listViewMapItem_ColumnClick(object sender, ColumnClickEventArgs e) + { + // Determine if clicked column is already the column that is being sorted. + if (e.Column == m_colSorter.SortColumn) { + // Reverse the current sort direction for this column. + if (m_colSorter.Order == SortOrder.Ascending) { + m_colSorter.Order = SortOrder.Descending; + } + else { + m_colSorter.Order = SortOrder.Ascending; + } + } + else { + // Set the column number that is to be sorted; default to ascending. + m_colSorter.SortColumn = e.Column; + m_colSorter.Order = SortOrder.Ascending; + } + + // Perform the sort with these new sort options. + m_listViewMapItem.Sort(); + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Reactors/Forms/Details.resx b/MgdDbgLibrary/Reactors/Forms/Details.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/MgdDbgLibrary/Reactors/Forms/Details.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MgdDbgLibrary/Reactors/Forms/EventsForm.cs b/MgdDbgLibrary/Reactors/Forms/EventsForm.cs new file mode 100644 index 0000000..f96e758 --- /dev/null +++ b/MgdDbgLibrary/Reactors/Forms/EventsForm.cs @@ -0,0 +1,108 @@ +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// +using System; +using System.Windows.Forms; + +using AcApp = Autodesk.AutoCAD.ApplicationServices; + +namespace MgdDbg.Reactors.Forms { + + public partial class EventsForm : Form { + + public static Events.ApplicationEvents m_appEvents = new Events.ApplicationEvents(); + public static Events.DatabaseEvents m_dbEvents = new Events.DatabaseEvents(); + public static Events.DatabaseObjEvents m_dbObjEvents = new Events.DatabaseObjEvents(); + public static Events.DocumentEvents m_docEvents = new Events.DocumentEvents(); + public static Events.DocumentMgrEvents m_docMgrEvents = new Events.DocumentMgrEvents(); + public static Events.DynamicLinkerEvents m_dynLnkEvents = new Events.DynamicLinkerEvents(); + public static Events.EditorEvents m_edEvents = new Events.EditorEvents(); + public static Events.GraphicsSystemEvents m_gsEvents = new Events.GraphicsSystemEvents(); + public static Events.LayoutManagerEvents m_layoutMgrEvents = new Events.LayoutManagerEvents(); + public static Events.PlotEvents m_plotEvents = new Events.PlotEvents(); + public static Events.PublishEvents m_publishEvents = new Events.PublishEvents(); + + public + EventsForm() + { + InitializeComponent(); + + m_cbAppEventsOn.Checked = m_appEvents.AreEventsEnabled; + m_cbDbEventsOn.Checked = m_dbEvents.AreEventsEnabled; + m_cbDbObjEventsOn.Checked = m_dbObjEvents.AreEventsEnabled; + m_cbDocEventsOn.Checked = m_docEvents.AreEventsEnabled; + m_cbDocMgrEventsOn.Checked = m_docMgrEvents.AreEventsEnabled; + m_cbDynLinkerEventsOn.Checked = m_dynLnkEvents.AreEventsEnabled; + m_cbEdEventsOn.Checked = m_edEvents.AreEventsEnabled; + m_cbGsEventsOn.Checked = m_gsEvents.AreEventsEnabled; + m_cbLayoutMgrEventsOn.Checked = m_layoutMgrEvents.AreEventsEnabled; + m_cbPlotEventsOn.Checked = m_plotEvents.AreEventsEnabled; + m_cbPubEventsOn.Checked = m_publishEvents.AreEventsEnabled; + + m_cbShowDetailsDbEvents.Checked = m_dbEvents.ShowDetails; + m_cbShowDetailsDocMgrEvents.Checked = m_docMgrEvents.ShowDetails; + m_cbShowDetailsEdEvents.Checked = m_edEvents.ShowDetails; + m_cbShowDetailsGsEvents.Checked = m_gsEvents.ShowDetails; + m_cbShowDetailsLayoutMgrEvents.Checked = m_layoutMgrEvents.ShowDetails; + m_cbShowDetailsPlotEvents.Checked = m_plotEvents.ShowDetails; + m_cbShowDetailsPublishEvents.Checked = m_publishEvents.ShowDetails; + } + + private void + event_OnBnOkClick(object sender, EventArgs e) + { + SetEventsOnOff(m_appEvents, m_cbAppEventsOn.Checked, false); + SetEventsOnOff(m_dbEvents, m_cbDbEventsOn.Checked, m_cbShowDetailsDbEvents.Checked); + SetEventsOnOff(m_dbObjEvents, m_cbDbObjEventsOn.Checked, false); + SetEventsOnOff(m_docEvents, m_cbDocEventsOn.Checked, false); + SetEventsOnOff(m_docMgrEvents, m_cbDocMgrEventsOn.Checked, m_cbShowDetailsDocMgrEvents.Checked); + SetEventsOnOff(m_dynLnkEvents, m_cbDynLinkerEventsOn.Checked, false); + SetEventsOnOff(m_edEvents, m_cbEdEventsOn.Checked, m_cbShowDetailsEdEvents.Checked); + SetEventsOnOff(m_gsEvents, m_cbGsEventsOn.Checked, m_cbShowDetailsGsEvents.Checked); + SetEventsOnOff(m_layoutMgrEvents, m_cbLayoutMgrEventsOn.Checked, m_cbShowDetailsLayoutMgrEvents.Checked); + SetEventsOnOff(m_plotEvents, m_cbPlotEventsOn.Checked, m_cbShowDetailsPlotEvents.Checked); + SetEventsOnOff(m_publishEvents, m_cbPubEventsOn.Checked, m_cbShowDetailsPublishEvents.Checked); + + this.Close(); + } + + private void + SetEventsOnOff(Events.EventsBase eventGroup, bool onOff, bool showDetails) + { + if (onOff) { // on + if (eventGroup.AreEventsEnabled == false) { + eventGroup.EnableEvents(); + } + } + else { // off + if (eventGroup.AreEventsEnabled == true) { + eventGroup.DisableEvents(); + } + } + eventGroup.ShowDetails = showDetails; + } + + private void m_tabPageSys_Click(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Reactors/Forms/EventsForm.designer.cs b/MgdDbgLibrary/Reactors/Forms/EventsForm.designer.cs new file mode 100644 index 0000000..5c757df --- /dev/null +++ b/MgdDbgLibrary/Reactors/Forms/EventsForm.designer.cs @@ -0,0 +1,506 @@ +namespace MgdDbg.Reactors.Forms { + partial class EventsForm { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.m_grpAppEvents = new System.Windows.Forms.GroupBox(); + this.m_cbAppEventsOn = new System.Windows.Forms.CheckBox(); + this.m_grpDbEvents = new System.Windows.Forms.GroupBox(); + this.m_cbShowDetailsDbEvents = new System.Windows.Forms.CheckBox(); + this.m_cbDbEventsOn = new System.Windows.Forms.CheckBox(); + this.m_grpDocEvents = new System.Windows.Forms.GroupBox(); + this.m_cbDocEventsOn = new System.Windows.Forms.CheckBox(); + this.m_grpDocMgrEvents = new System.Windows.Forms.GroupBox(); + this.m_cbShowDetailsDocMgrEvents = new System.Windows.Forms.CheckBox(); + this.m_cbDocMgrEventsOn = new System.Windows.Forms.CheckBox(); + this.m_bnOk = new System.Windows.Forms.Button(); + this.m_tabCtrl = new System.Windows.Forms.TabControl(); + this.m_tabPageSys = new System.Windows.Forms.TabPage(); + this.m_grpLayoutMgrEvents = new System.Windows.Forms.GroupBox(); + this.m_cbShowDetailsLayoutMgrEvents = new System.Windows.Forms.CheckBox(); + this.m_cbLayoutMgrEventsOn = new System.Windows.Forms.CheckBox(); + this.m_grpDynLinkerEvents = new System.Windows.Forms.GroupBox(); + this.m_cbDynLinkerEventsOn = new System.Windows.Forms.CheckBox(); + this.m_grpPlotEvents = new System.Windows.Forms.GroupBox(); + this.m_cbShowDetailsPlotEvents = new System.Windows.Forms.CheckBox(); + this.m_cbPlotEventsOn = new System.Windows.Forms.CheckBox(); + this.m_grpPublishEvents = new System.Windows.Forms.GroupBox(); + this.m_cbShowDetailsPublishEvents = new System.Windows.Forms.CheckBox(); + this.m_cbPubEventsOn = new System.Windows.Forms.CheckBox(); + this.m_grpGsEvents = new System.Windows.Forms.GroupBox(); + this.m_cbShowDetailsGsEvents = new System.Windows.Forms.CheckBox(); + this.m_cbGsEventsOn = new System.Windows.Forms.CheckBox(); + this.m_grpEditorEvents = new System.Windows.Forms.GroupBox(); + this.m_cbShowDetailsEdEvents = new System.Windows.Forms.CheckBox(); + this.m_cbEdEventsOn = new System.Windows.Forms.CheckBox(); + this.m_bnCancel = new System.Windows.Forms.Button(); + this.m_grpDbObjEvents = new System.Windows.Forms.GroupBox(); + this.m_cbDbObjEventsOn = new System.Windows.Forms.CheckBox(); + this.m_grpAppEvents.SuspendLayout(); + this.m_grpDbEvents.SuspendLayout(); + this.m_grpDocEvents.SuspendLayout(); + this.m_grpDocMgrEvents.SuspendLayout(); + this.m_tabCtrl.SuspendLayout(); + this.m_tabPageSys.SuspendLayout(); + this.m_grpLayoutMgrEvents.SuspendLayout(); + this.m_grpDynLinkerEvents.SuspendLayout(); + this.m_grpPlotEvents.SuspendLayout(); + this.m_grpPublishEvents.SuspendLayout(); + this.m_grpGsEvents.SuspendLayout(); + this.m_grpEditorEvents.SuspendLayout(); + this.m_grpDbObjEvents.SuspendLayout(); + this.SuspendLayout(); + // + // m_grpAppEvents + // + this.m_grpAppEvents.Controls.Add(this.m_cbAppEventsOn); + this.m_grpAppEvents.Location = new System.Drawing.Point(201, 6); + this.m_grpAppEvents.Name = "m_grpAppEvents"; + this.m_grpAppEvents.Size = new System.Drawing.Size(158, 63); + this.m_grpAppEvents.TabIndex = 0; + this.m_grpAppEvents.TabStop = false; + this.m_grpAppEvents.Text = "Application Events"; + // + // m_cbAppEventsOn + // + this.m_cbAppEventsOn.AutoSize = true; + this.m_cbAppEventsOn.Location = new System.Drawing.Point(16, 19); + this.m_cbAppEventsOn.Name = "m_cbAppEventsOn"; + this.m_cbAppEventsOn.Size = new System.Drawing.Size(40, 17); + this.m_cbAppEventsOn.TabIndex = 1; + this.m_cbAppEventsOn.Text = "On"; + this.m_cbAppEventsOn.UseVisualStyleBackColor = true; + // + // m_grpDbEvents + // + this.m_grpDbEvents.Controls.Add(this.m_cbShowDetailsDbEvents); + this.m_grpDbEvents.Controls.Add(this.m_cbDbEventsOn); + this.m_grpDbEvents.Location = new System.Drawing.Point(17, 6); + this.m_grpDbEvents.Name = "m_grpDbEvents"; + this.m_grpDbEvents.Size = new System.Drawing.Size(158, 63); + this.m_grpDbEvents.TabIndex = 3; + this.m_grpDbEvents.TabStop = false; + this.m_grpDbEvents.Text = "Database Events"; + // + // m_cbShowDetailsDbEvents + // + this.m_cbShowDetailsDbEvents.AutoSize = true; + this.m_cbShowDetailsDbEvents.Location = new System.Drawing.Point(16, 37); + this.m_cbShowDetailsDbEvents.Name = "m_cbShowDetailsDbEvents"; + this.m_cbShowDetailsDbEvents.Size = new System.Drawing.Size(88, 17); + this.m_cbShowDetailsDbEvents.TabIndex = 2; + this.m_cbShowDetailsDbEvents.Text = "Show Details"; + this.m_cbShowDetailsDbEvents.UseVisualStyleBackColor = true; + // + // m_cbDbEventsOn + // + this.m_cbDbEventsOn.AutoSize = true; + this.m_cbDbEventsOn.Location = new System.Drawing.Point(16, 19); + this.m_cbDbEventsOn.Name = "m_cbDbEventsOn"; + this.m_cbDbEventsOn.Size = new System.Drawing.Size(40, 17); + this.m_cbDbEventsOn.TabIndex = 1; + this.m_cbDbEventsOn.Text = "On"; + this.m_cbDbEventsOn.UseVisualStyleBackColor = true; + // + // m_grpDocEvents + // + this.m_grpDocEvents.Controls.Add(this.m_cbDocEventsOn); + this.m_grpDocEvents.Location = new System.Drawing.Point(17, 217); + this.m_grpDocEvents.Name = "m_grpDocEvents"; + this.m_grpDocEvents.Size = new System.Drawing.Size(158, 63); + this.m_grpDocEvents.TabIndex = 4; + this.m_grpDocEvents.TabStop = false; + this.m_grpDocEvents.Text = "Document Events"; + // + // m_cbDocEventsOn + // + this.m_cbDocEventsOn.AutoSize = true; + this.m_cbDocEventsOn.Location = new System.Drawing.Point(16, 19); + this.m_cbDocEventsOn.Name = "m_cbDocEventsOn"; + this.m_cbDocEventsOn.Size = new System.Drawing.Size(40, 17); + this.m_cbDocEventsOn.TabIndex = 1; + this.m_cbDocEventsOn.Text = "On"; + this.m_cbDocEventsOn.UseVisualStyleBackColor = true; + // + // m_grpDocMgrEvents + // + this.m_grpDocMgrEvents.Controls.Add(this.m_cbShowDetailsDocMgrEvents); + this.m_grpDocMgrEvents.Controls.Add(this.m_cbDocMgrEventsOn); + this.m_grpDocMgrEvents.Location = new System.Drawing.Point(17, 148); + this.m_grpDocMgrEvents.Name = "m_grpDocMgrEvents"; + this.m_grpDocMgrEvents.Size = new System.Drawing.Size(158, 63); + this.m_grpDocMgrEvents.TabIndex = 3; + this.m_grpDocMgrEvents.TabStop = false; + this.m_grpDocMgrEvents.Text = "Document Manager Events"; + // + // m_cbShowDetailsDocMgrEvents + // + this.m_cbShowDetailsDocMgrEvents.AutoSize = true; + this.m_cbShowDetailsDocMgrEvents.Location = new System.Drawing.Point(16, 37); + this.m_cbShowDetailsDocMgrEvents.Name = "m_cbShowDetailsDocMgrEvents"; + this.m_cbShowDetailsDocMgrEvents.Size = new System.Drawing.Size(88, 17); + this.m_cbShowDetailsDocMgrEvents.TabIndex = 2; + this.m_cbShowDetailsDocMgrEvents.Text = "Show Details"; + this.m_cbShowDetailsDocMgrEvents.UseVisualStyleBackColor = true; + // + // m_cbDocMgrEventsOn + // + this.m_cbDocMgrEventsOn.AutoSize = true; + this.m_cbDocMgrEventsOn.Location = new System.Drawing.Point(16, 19); + this.m_cbDocMgrEventsOn.Name = "m_cbDocMgrEventsOn"; + this.m_cbDocMgrEventsOn.Size = new System.Drawing.Size(40, 17); + this.m_cbDocMgrEventsOn.TabIndex = 1; + this.m_cbDocMgrEventsOn.Text = "On"; + this.m_cbDocMgrEventsOn.UseVisualStyleBackColor = true; + // + // m_bnOk + // + this.m_bnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnOk.Location = new System.Drawing.Point(211, 373); + this.m_bnOk.Name = "m_bnOk"; + this.m_bnOk.Size = new System.Drawing.Size(75, 23); + this.m_bnOk.TabIndex = 5; + this.m_bnOk.Text = "OK"; + this.m_bnOk.UseVisualStyleBackColor = true; + this.m_bnOk.Click += new System.EventHandler(this.event_OnBnOkClick); + // + // m_tabCtrl + // + this.m_tabCtrl.Controls.Add(this.m_tabPageSys); + this.m_tabCtrl.Location = new System.Drawing.Point(12, 12); + this.m_tabCtrl.Name = "m_tabCtrl"; + this.m_tabCtrl.SelectedIndex = 0; + this.m_tabCtrl.Size = new System.Drawing.Size(558, 344); + this.m_tabCtrl.TabIndex = 6; + // + // m_tabPageSys + // + this.m_tabPageSys.Controls.Add(this.m_grpDbObjEvents); + this.m_tabPageSys.Controls.Add(this.m_grpLayoutMgrEvents); + this.m_tabPageSys.Controls.Add(this.m_grpDynLinkerEvents); + this.m_tabPageSys.Controls.Add(this.m_grpPlotEvents); + this.m_tabPageSys.Controls.Add(this.m_grpPublishEvents); + this.m_tabPageSys.Controls.Add(this.m_grpGsEvents); + this.m_tabPageSys.Controls.Add(this.m_grpEditorEvents); + this.m_tabPageSys.Controls.Add(this.m_grpAppEvents); + this.m_tabPageSys.Controls.Add(this.m_grpDbEvents); + this.m_tabPageSys.Controls.Add(this.m_grpDocMgrEvents); + this.m_tabPageSys.Controls.Add(this.m_grpDocEvents); + this.m_tabPageSys.Location = new System.Drawing.Point(4, 22); + this.m_tabPageSys.Name = "m_tabPageSys"; + this.m_tabPageSys.Padding = new System.Windows.Forms.Padding(3); + this.m_tabPageSys.Size = new System.Drawing.Size(550, 318); + this.m_tabPageSys.TabIndex = 0; + this.m_tabPageSys.Text = "System"; + this.m_tabPageSys.UseVisualStyleBackColor = true; + this.m_tabPageSys.Click += new System.EventHandler(this.m_tabPageSys_Click); + // + // m_grpLayoutMgrEvents + // + this.m_grpLayoutMgrEvents.Controls.Add(this.m_cbShowDetailsLayoutMgrEvents); + this.m_grpLayoutMgrEvents.Controls.Add(this.m_cbLayoutMgrEventsOn); + this.m_grpLayoutMgrEvents.Location = new System.Drawing.Point(201, 217); + this.m_grpLayoutMgrEvents.Name = "m_grpLayoutMgrEvents"; + this.m_grpLayoutMgrEvents.Size = new System.Drawing.Size(158, 63); + this.m_grpLayoutMgrEvents.TabIndex = 5; + this.m_grpLayoutMgrEvents.TabStop = false; + this.m_grpLayoutMgrEvents.Text = "Layout Manager Events"; + // + // m_cbShowDetailsLayoutMgrEvents + // + this.m_cbShowDetailsLayoutMgrEvents.AutoSize = true; + this.m_cbShowDetailsLayoutMgrEvents.Location = new System.Drawing.Point(16, 35); + this.m_cbShowDetailsLayoutMgrEvents.Name = "m_cbShowDetailsLayoutMgrEvents"; + this.m_cbShowDetailsLayoutMgrEvents.Size = new System.Drawing.Size(88, 17); + this.m_cbShowDetailsLayoutMgrEvents.TabIndex = 3; + this.m_cbShowDetailsLayoutMgrEvents.Text = "Show Details"; + this.m_cbShowDetailsLayoutMgrEvents.UseVisualStyleBackColor = true; + // + // m_cbLayoutMgrEventsOn + // + this.m_cbLayoutMgrEventsOn.AutoSize = true; + this.m_cbLayoutMgrEventsOn.Location = new System.Drawing.Point(16, 19); + this.m_cbLayoutMgrEventsOn.Name = "m_cbLayoutMgrEventsOn"; + this.m_cbLayoutMgrEventsOn.Size = new System.Drawing.Size(40, 17); + this.m_cbLayoutMgrEventsOn.TabIndex = 1; + this.m_cbLayoutMgrEventsOn.Text = "On"; + this.m_cbLayoutMgrEventsOn.UseVisualStyleBackColor = true; + // + // m_grpDynLinkerEvents + // + this.m_grpDynLinkerEvents.Controls.Add(this.m_cbDynLinkerEventsOn); + this.m_grpDynLinkerEvents.Location = new System.Drawing.Point(377, 6); + this.m_grpDynLinkerEvents.Name = "m_grpDynLinkerEvents"; + this.m_grpDynLinkerEvents.Size = new System.Drawing.Size(158, 63); + this.m_grpDynLinkerEvents.TabIndex = 5; + this.m_grpDynLinkerEvents.TabStop = false; + this.m_grpDynLinkerEvents.Text = "Dynamic Linker Events"; + // + // m_cbDynLinkerEventsOn + // + this.m_cbDynLinkerEventsOn.AutoSize = true; + this.m_cbDynLinkerEventsOn.Location = new System.Drawing.Point(16, 19); + this.m_cbDynLinkerEventsOn.Name = "m_cbDynLinkerEventsOn"; + this.m_cbDynLinkerEventsOn.Size = new System.Drawing.Size(40, 17); + this.m_cbDynLinkerEventsOn.TabIndex = 1; + this.m_cbDynLinkerEventsOn.Text = "On"; + this.m_cbDynLinkerEventsOn.UseVisualStyleBackColor = true; + // + // m_grpPlotEvents + // + this.m_grpPlotEvents.Controls.Add(this.m_cbShowDetailsPlotEvents); + this.m_grpPlotEvents.Controls.Add(this.m_cbPlotEventsOn); + this.m_grpPlotEvents.Location = new System.Drawing.Point(377, 76); + this.m_grpPlotEvents.Name = "m_grpPlotEvents"; + this.m_grpPlotEvents.Size = new System.Drawing.Size(158, 63); + this.m_grpPlotEvents.TabIndex = 6; + this.m_grpPlotEvents.TabStop = false; + this.m_grpPlotEvents.Text = "Plot Events"; + // + // m_cbShowDetailsPlotEvents + // + this.m_cbShowDetailsPlotEvents.AutoSize = true; + this.m_cbShowDetailsPlotEvents.Location = new System.Drawing.Point(16, 37); + this.m_cbShowDetailsPlotEvents.Name = "m_cbShowDetailsPlotEvents"; + this.m_cbShowDetailsPlotEvents.Size = new System.Drawing.Size(88, 17); + this.m_cbShowDetailsPlotEvents.TabIndex = 2; + this.m_cbShowDetailsPlotEvents.Text = "Show Details"; + this.m_cbShowDetailsPlotEvents.UseVisualStyleBackColor = true; + // + // m_cbPlotEventsOn + // + this.m_cbPlotEventsOn.AutoSize = true; + this.m_cbPlotEventsOn.Location = new System.Drawing.Point(16, 19); + this.m_cbPlotEventsOn.Name = "m_cbPlotEventsOn"; + this.m_cbPlotEventsOn.Size = new System.Drawing.Size(40, 17); + this.m_cbPlotEventsOn.TabIndex = 1; + this.m_cbPlotEventsOn.Text = "On"; + this.m_cbPlotEventsOn.UseVisualStyleBackColor = true; + // + // m_grpPublishEvents + // + this.m_grpPublishEvents.Controls.Add(this.m_cbShowDetailsPublishEvents); + this.m_grpPublishEvents.Controls.Add(this.m_cbPubEventsOn); + this.m_grpPublishEvents.Location = new System.Drawing.Point(377, 148); + this.m_grpPublishEvents.Name = "m_grpPublishEvents"; + this.m_grpPublishEvents.Size = new System.Drawing.Size(158, 63); + this.m_grpPublishEvents.TabIndex = 8; + this.m_grpPublishEvents.TabStop = false; + this.m_grpPublishEvents.Text = "Publish Events"; + // + // m_cbShowDetailsPublishEvents + // + this.m_cbShowDetailsPublishEvents.AutoSize = true; + this.m_cbShowDetailsPublishEvents.Location = new System.Drawing.Point(16, 37); + this.m_cbShowDetailsPublishEvents.Name = "m_cbShowDetailsPublishEvents"; + this.m_cbShowDetailsPublishEvents.Size = new System.Drawing.Size(88, 17); + this.m_cbShowDetailsPublishEvents.TabIndex = 2; + this.m_cbShowDetailsPublishEvents.Text = "Show Details"; + this.m_cbShowDetailsPublishEvents.UseVisualStyleBackColor = true; + // + // m_cbPubEventsOn + // + this.m_cbPubEventsOn.AutoSize = true; + this.m_cbPubEventsOn.Location = new System.Drawing.Point(16, 19); + this.m_cbPubEventsOn.Name = "m_cbPubEventsOn"; + this.m_cbPubEventsOn.Size = new System.Drawing.Size(40, 17); + this.m_cbPubEventsOn.TabIndex = 1; + this.m_cbPubEventsOn.Text = "On"; + this.m_cbPubEventsOn.UseVisualStyleBackColor = true; + // + // m_grpGsEvents + // + this.m_grpGsEvents.Controls.Add(this.m_cbShowDetailsGsEvents); + this.m_grpGsEvents.Controls.Add(this.m_cbGsEventsOn); + this.m_grpGsEvents.Location = new System.Drawing.Point(201, 148); + this.m_grpGsEvents.Name = "m_grpGsEvents"; + this.m_grpGsEvents.Size = new System.Drawing.Size(158, 63); + this.m_grpGsEvents.TabIndex = 6; + this.m_grpGsEvents.TabStop = false; + this.m_grpGsEvents.Text = "Graphics System Events"; + // + // m_cbShowDetailsGsEvents + // + this.m_cbShowDetailsGsEvents.AutoSize = true; + this.m_cbShowDetailsGsEvents.Location = new System.Drawing.Point(16, 37); + this.m_cbShowDetailsGsEvents.Name = "m_cbShowDetailsGsEvents"; + this.m_cbShowDetailsGsEvents.Size = new System.Drawing.Size(88, 17); + this.m_cbShowDetailsGsEvents.TabIndex = 3; + this.m_cbShowDetailsGsEvents.Text = "Show Details"; + this.m_cbShowDetailsGsEvents.UseVisualStyleBackColor = true; + // + // m_cbGsEventsOn + // + this.m_cbGsEventsOn.AutoSize = true; + this.m_cbGsEventsOn.Location = new System.Drawing.Point(16, 19); + this.m_cbGsEventsOn.Name = "m_cbGsEventsOn"; + this.m_cbGsEventsOn.Size = new System.Drawing.Size(40, 17); + this.m_cbGsEventsOn.TabIndex = 1; + this.m_cbGsEventsOn.Text = "On"; + this.m_cbGsEventsOn.UseVisualStyleBackColor = true; + // + // m_grpEditorEvents + // + this.m_grpEditorEvents.Controls.Add(this.m_cbShowDetailsEdEvents); + this.m_grpEditorEvents.Controls.Add(this.m_cbEdEventsOn); + this.m_grpEditorEvents.Location = new System.Drawing.Point(201, 76); + this.m_grpEditorEvents.Name = "m_grpEditorEvents"; + this.m_grpEditorEvents.Size = new System.Drawing.Size(158, 63); + this.m_grpEditorEvents.TabIndex = 8; + this.m_grpEditorEvents.TabStop = false; + this.m_grpEditorEvents.Text = "Editor Events"; + // + // m_cbShowDetailsEdEvents + // + this.m_cbShowDetailsEdEvents.AutoSize = true; + this.m_cbShowDetailsEdEvents.Location = new System.Drawing.Point(16, 37); + this.m_cbShowDetailsEdEvents.Name = "m_cbShowDetailsEdEvents"; + this.m_cbShowDetailsEdEvents.Size = new System.Drawing.Size(88, 17); + this.m_cbShowDetailsEdEvents.TabIndex = 2; + this.m_cbShowDetailsEdEvents.Text = "Show Details"; + this.m_cbShowDetailsEdEvents.UseVisualStyleBackColor = true; + // + // m_cbEdEventsOn + // + this.m_cbEdEventsOn.AutoSize = true; + this.m_cbEdEventsOn.Location = new System.Drawing.Point(16, 19); + this.m_cbEdEventsOn.Name = "m_cbEdEventsOn"; + this.m_cbEdEventsOn.Size = new System.Drawing.Size(40, 17); + this.m_cbEdEventsOn.TabIndex = 1; + this.m_cbEdEventsOn.Text = "On"; + this.m_cbEdEventsOn.UseVisualStyleBackColor = true; + // + // m_bnCancel + // + this.m_bnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnCancel.Location = new System.Drawing.Point(294, 373); + this.m_bnCancel.Name = "m_bnCancel"; + this.m_bnCancel.Size = new System.Drawing.Size(75, 23); + this.m_bnCancel.TabIndex = 7; + this.m_bnCancel.Text = "Cancel"; + this.m_bnCancel.UseVisualStyleBackColor = true; + // + // m_grpDbObjEvents + // + this.m_grpDbObjEvents.Controls.Add(this.m_cbDbObjEventsOn); + this.m_grpDbObjEvents.Location = new System.Drawing.Point(17, 76); + this.m_grpDbObjEvents.Name = "m_grpDbObjEvents"; + this.m_grpDbObjEvents.Size = new System.Drawing.Size(158, 63); + this.m_grpDbObjEvents.TabIndex = 9; + this.m_grpDbObjEvents.TabStop = false; + this.m_grpDbObjEvents.Text = "Database Obj Events"; + // + // m_cbDbObjEventsOn + // + this.m_cbDbObjEventsOn.AutoSize = true; + this.m_cbDbObjEventsOn.Location = new System.Drawing.Point(16, 19); + this.m_cbDbObjEventsOn.Name = "m_cbDbObjEventsOn"; + this.m_cbDbObjEventsOn.Size = new System.Drawing.Size(40, 17); + this.m_cbDbObjEventsOn.TabIndex = 0; + this.m_cbDbObjEventsOn.Text = "On"; + this.m_cbDbObjEventsOn.UseVisualStyleBackColor = true; + // + // EventsForm + // + this.AcceptButton = this.m_bnOk; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.m_bnCancel; + this.ClientSize = new System.Drawing.Size(581, 405); + this.Controls.Add(this.m_bnCancel); + this.Controls.Add(this.m_tabCtrl); + this.Controls.Add(this.m_bnOk); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "EventsForm"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Events"; + this.m_grpAppEvents.ResumeLayout(false); + this.m_grpAppEvents.PerformLayout(); + this.m_grpDbEvents.ResumeLayout(false); + this.m_grpDbEvents.PerformLayout(); + this.m_grpDocEvents.ResumeLayout(false); + this.m_grpDocEvents.PerformLayout(); + this.m_grpDocMgrEvents.ResumeLayout(false); + this.m_grpDocMgrEvents.PerformLayout(); + this.m_tabCtrl.ResumeLayout(false); + this.m_tabPageSys.ResumeLayout(false); + this.m_grpLayoutMgrEvents.ResumeLayout(false); + this.m_grpLayoutMgrEvents.PerformLayout(); + this.m_grpDynLinkerEvents.ResumeLayout(false); + this.m_grpDynLinkerEvents.PerformLayout(); + this.m_grpPlotEvents.ResumeLayout(false); + this.m_grpPlotEvents.PerformLayout(); + this.m_grpPublishEvents.ResumeLayout(false); + this.m_grpPublishEvents.PerformLayout(); + this.m_grpGsEvents.ResumeLayout(false); + this.m_grpGsEvents.PerformLayout(); + this.m_grpEditorEvents.ResumeLayout(false); + this.m_grpEditorEvents.PerformLayout(); + this.m_grpDbObjEvents.ResumeLayout(false); + this.m_grpDbObjEvents.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox m_grpAppEvents; + private System.Windows.Forms.CheckBox m_cbAppEventsOn; + private System.Windows.Forms.GroupBox m_grpDbEvents; + private System.Windows.Forms.CheckBox m_cbShowDetailsDbEvents; + private System.Windows.Forms.CheckBox m_cbDbEventsOn; + private System.Windows.Forms.GroupBox m_grpDocEvents; + private System.Windows.Forms.GroupBox m_grpDocMgrEvents; + private System.Windows.Forms.CheckBox m_cbShowDetailsDocMgrEvents; + private System.Windows.Forms.CheckBox m_cbDocMgrEventsOn; + private System.Windows.Forms.Button m_bnOk; + private System.Windows.Forms.TabControl m_tabCtrl; + private System.Windows.Forms.TabPage m_tabPageSys; + private System.Windows.Forms.GroupBox m_grpLayoutMgrEvents; + private System.Windows.Forms.CheckBox m_cbLayoutMgrEventsOn; + private System.Windows.Forms.GroupBox m_grpDynLinkerEvents; + private System.Windows.Forms.CheckBox m_cbDynLinkerEventsOn; + private System.Windows.Forms.GroupBox m_grpPlotEvents; + private System.Windows.Forms.CheckBox m_cbShowDetailsPlotEvents; + private System.Windows.Forms.GroupBox m_grpPublishEvents; + private System.Windows.Forms.CheckBox m_cbShowDetailsPublishEvents; + private System.Windows.Forms.CheckBox m_cbPubEventsOn; + private System.Windows.Forms.GroupBox m_grpGsEvents; + private System.Windows.Forms.GroupBox m_grpEditorEvents; + private System.Windows.Forms.CheckBox m_cbShowDetailsEdEvents; + private System.Windows.Forms.CheckBox m_cbShowDetailsGsEvents; + private System.Windows.Forms.CheckBox m_cbShowDetailsLayoutMgrEvents; + private System.Windows.Forms.CheckBox m_cbPlotEventsOn; + private System.Windows.Forms.CheckBox m_cbGsEventsOn; + private System.Windows.Forms.CheckBox m_cbEdEventsOn; + private System.Windows.Forms.CheckBox m_cbDocEventsOn; + private System.Windows.Forms.Button m_bnCancel; + private System.Windows.Forms.GroupBox m_grpDbObjEvents; + private System.Windows.Forms.CheckBox m_cbDbObjEventsOn; + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Reactors/Forms/EventsForm.resx b/MgdDbgLibrary/Reactors/Forms/EventsForm.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/MgdDbgLibrary/Reactors/Forms/EventsForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MgdDbgLibrary/ReportBrowser/ObjCountReport.html b/MgdDbgLibrary/ReportBrowser/ObjCountReport.html new file mode 100644 index 0000000..20fd80b --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/ObjCountReport.html @@ -0,0 +1,36 @@ + + + DWG Stats Report + + + + + + + + + Sorry, this page needs Frames on in order to display + + diff --git a/MgdDbgLibrary/ReportBrowser/css/ReportList.css b/MgdDbgLibrary/ReportBrowser/css/ReportList.css new file mode 100644 index 0000000..2008742 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/css/ReportList.css @@ -0,0 +1,14 @@ + + +a:link { color: Darkgreen; } +a:active { color: Darkgreen; } +a:visited { color: Darkgreen; } + + +BODY +{ + font-family:Arial, helvetica, sans-serif; font-size:12pt; + background-color:linen; +} + + diff --git a/MgdDbgLibrary/ReportBrowser/css/Reports.css b/MgdDbgLibrary/ReportBrowser/css/Reports.css new file mode 100644 index 0000000..c5418b9 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/css/Reports.css @@ -0,0 +1,20 @@ + + +a:link { color: #0000CC; } +a:active { color: #0000CC; } +a:visited { color: #990099; } + + +body { font-family:Arial, helvetica, sans-serif; font-size:12pt; } + +table.small { font-family:Arial, helvetica, sans-serif; font-size:10pt; } + +td.label { font-weight: bold } + +tr.aecobject { background-color: DarkSeaGreen; } +tr.nonaecobject { background-color: Whitesmoke; } +tr.drawing { background-color: Lightgoldenrodyellow; } +tr.styleheader { background-color: Skyblue; } + +p.reportDesc { font-style: italic; } + diff --git a/MgdDbgLibrary/ReportBrowser/js/ReportUtils_DwgStat.js b/MgdDbgLibrary/ReportBrowser/js/ReportUtils_DwgStat.js new file mode 100644 index 0000000..79ab9a5 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/js/ReportUtils_DwgStat.js @@ -0,0 +1,307 @@ + +////////////////////////////////////////////////////////////////////////// +// +// Functions to help implement various reports +// +// Jim Awe +// Autodesk, Inc. +// +////////////////////////////////////////////////////////////////////////// + + +/************************************************************************* +** +** createXmlDom +** do the repetative work of loading a DOM tree with all the right +** arguments. I'm not currently sure these are all the right settings, +** but it will do for now. +** +** **jma +** +*********************************/ + +function createXmlDom() +{ + var xmlDom = new ActiveXObject("MSXML2.DOMDocument"); + if (xmlDom == null) + return null; + + xmlDom.async = false; + xmlDom.setProperty("SelectionLanguage", "XPath"); + + return xmlDom; +} + +/************************************************************************* +** +** createFreeThreadedXmlDom +** do the repetative work of loading a DOM tree with all the right +** arguments. I'm not currently sure these are all the right settings, +** but it will do for now. +** +** **jma +** +*********************************/ + +function createFreeThreadedXmlDom() +{ + var xmlDom = new ActiveXObject("MSXML2.FreeThreadedDOMDocument"); + if (xmlDom == null) + return null; + + xmlDom.async = false; + xmlDom.setProperty("SelectionLanguage", "XPath"); + + return xmlDom; +} + +/************************************************************************* +** +** createXmlDomAndLoad +** do the repetative work of loading a DOM tree with all the right +** arguments. I'm not currently sure these are all the right settings, +** but it will do for now. +** +** **jma +** +*********************************/ + +function createXmlDomAndLoad(url) +{ + var xmlDom = new ActiveXObject("MSXML2.DOMDocument"); + if (xmlDom == null) + return null; + + xmlDom.async = false; + xmlDom.setProperty("SelectionLanguage", "XPath"); + + if (!xmlDom.load(url)) { + var msg = "Could not load file: " + url + "\n" + xmlDom.parseError.reason; + alert(msg); + return null; + } + else + return xmlDom; +} + +/************************************************************************* +** +** createFreeThreadedXmlDomAndLoad +** do the repetative work of loading a DOM tree with all the right +** arguments. I'm not currently sure these are all the right settings, +** but it will do for now. +** +** **jma +** +*********************************/ + +function createFreeThreadedXmlDomAndLoad(url) +{ + var xmlDom = new ActiveXObject("MSXML2.FreeThreadedDOMDocument"); + if (xmlDom == null) + return null; + + xmlDom.async = false; + xmlDom.setProperty("SelectionLanguage", "XPath"); + + if (!xmlDom.load(url)) { + var msg = "Could not load file: " + url + "\n" + xmlDom.parseError.reason; + alert(msg); + return null; + } + else + return xmlDom; +} + +/************************************************************************* +** +** createXslTemplateAndLoad +** +** **jma +** +*********************************/ + +function createXslTemplateAndLoad(url) +{ + var template = new ActiveXObject("MSXML2.XSLTemplate.3.0"); + template.stylesheet = createFreeThreadedXmlDomAndLoad(url); + return template; +} + +/************************************************************************* +** +** xformByXsl +** +** **jma +** +*********************************/ + +function xformByXsl(xmlDataSrcObj, xslUrl) +{ + var xslXform = createXmlDomAndLoad(xslUrl); + if (xslXform == null) { + window.status = "Could not load XSL transform!"; + return; + } + + if (xmlDataSrcObj != null) { + xslTarget.innerHTML = xmlDataSrcObj.transformNode(xslXform.documentElement); + } + else { + alert("No XML data source is loaded."); + document.write("No XML data source loaded."); + } +} + +/************************************************************************* +** +** writeDomElement +** +** **jma +** +*********************************/ + +function writeDomElement(xmlDoc, curNode, tagName) +{ + var newNode = xmlDoc.createElement(tagName); + + if (curNode == null) { + // not sure why this has to be special cased, but I couldn't + // get it to work any other way??? + var rootNode = xmlDoc.selectSingleNode("/"); + rootNode.appendChild(newNode); + } + else { + curNode.appendChild(newNode); + } + + return newNode; +} + +/************************************************************************* +** +** writeDomAttribute +** +** **jma +** +*********************************/ + +function writeDomAttribute(curNode, attName, attValue) +{ + //alert("about to add att: " + attName); + + curNode.setAttribute(attName, attValue); +} + +/************************************************************************* +** +** arrayHas +** see if this item exists in a string array already +** +** **jma +** +*********************************/ + +function arrayHas(strArray, strVal) +{ + for (var i=0;i + + Block Data + + + + + +

This report shows a count of the object types that appear in + the selected drawing files on a per-block basis. It is sorted by Count.

+
+ + diff --git a/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortClass.htm b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortClass.htm new file mode 100644 index 0000000..4bf46e8 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortClass.htm @@ -0,0 +1,19 @@ + + + Raw Data (Sort by Class) + + + + + +

This report is a raw overall count of the object types that + appear in the selected drawing files. It is sorted by Class type.

+
+ + diff --git a/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortClassByProject.htm b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortClassByProject.htm new file mode 100644 index 0000000..0d3beb2 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortClassByProject.htm @@ -0,0 +1,21 @@ + + + Project-wide Raw Data (Sort by Class) + + + + + +

This report is a raw overall count of the object types that + appear in the selected drawing files. It is sorted by Class type, on a + project-wide basis

+
+ + diff --git a/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortCount.htm b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortCount.htm new file mode 100644 index 0000000..6bc9537 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortCount.htm @@ -0,0 +1,19 @@ + + + Raw Data (Sort by Count) + + + + + +

This report is a raw overall count of the object types that + appear in the selected drawing files. It is sorted by Count.

+
+ + diff --git a/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortCountByProject.htm b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortCountByProject.htm new file mode 100644 index 0000000..5784de5 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortCountByProject.htm @@ -0,0 +1,21 @@ + + + Project-wide Raw Data (Sort by Count) + + + + + +

This report is a raw overall count of the object types that + appear in the selected drawing files. It is sorted by Count, on a project-wide + basis.

+
+ + diff --git a/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortDisplayName.htm b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortDisplayName.htm new file mode 100644 index 0000000..0cfd014 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSortDisplayName.htm @@ -0,0 +1,19 @@ + + + Raw Data (Sort by Display Name) + + + + + +

This report is a raw overall count of the object types that + appear in the selected drawing files. It is sorted by Display Name.

+
+ + diff --git a/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSymbolCount.htm b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSymbolCount.htm new file mode 100644 index 0000000..27dfcf5 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSymbolCount.htm @@ -0,0 +1,19 @@ + + + Raw Symbol Count + + + + + +

This report is a raw overall count of the symbol types that + appear in the selected drawing files. It is sorted by Count.

+
+ + diff --git a/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSymbolRefs.htm b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSymbolRefs.htm new file mode 100644 index 0000000..feff782 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/reports/Report_RawDataSymbolRefs.htm @@ -0,0 +1,19 @@ + + + Symbol References (Sort by Count) + + + + + +

This report is a raw overall count of the symbol types that + appear in the selected drawing files. It is sorted by Class type.

+
+ + diff --git a/MgdDbgLibrary/ReportBrowser/reports/Reports.htm b/MgdDbgLibrary/ReportBrowser/reports/Reports.htm new file mode 100644 index 0000000..242eb39 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/reports/Reports.htm @@ -0,0 +1,37 @@ + + + + DWG Stat Reports + + + + + Select data file to view: +

Reports

+
+

Raw Entity Count (Sort + by Count)

+

Raw Entity Count (Sort + by Class)

+

Raw Entity Count + (Sort by Display Name)

+
+

Entity Count Per Block

+
+

Raw Symbol Count

+

Symbol References

+
+

Project-wide + Raw Entity Count (Sort by Count)

+

Project-wide + Raw Entity Count (Sort by Class)

+ + diff --git a/MgdDbgLibrary/ReportBrowser/xsl/BlockData.xsl b/MgdDbgLibrary/ReportBrowser/xsl/BlockData.xsl new file mode 100644 index 0000000..5d8b0cb --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/xsl/BlockData.xsl @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
Drawing:
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Block:
Is Anonymous:
Is From Xref:
Is Layout:
+
+ + + + + + + + + + + + + + + + + + aecobject + nonaecobject + + + + + + + + + +
ClassDisplay NameCount
+ +
+
+
+ +
diff --git a/MgdDbgLibrary/ReportBrowser/xsl/RawDataSortClass.xsl b/MgdDbgLibrary/ReportBrowser/xsl/RawDataSortClass.xsl new file mode 100644 index 0000000..e5fa6e3 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/xsl/RawDataSortClass.xsl @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
Drawing:
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + aecobject + nonaecobject + + + + + + + + + +
Raw Count
ClassDisplay NameCount
+
+
+ +
diff --git a/MgdDbgLibrary/ReportBrowser/xsl/RawDataSortCount.xsl b/MgdDbgLibrary/ReportBrowser/xsl/RawDataSortCount.xsl new file mode 100644 index 0000000..615d5f9 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/xsl/RawDataSortCount.xsl @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
Drawing:
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + aecobject + nonaecobject + + + + + + + + + +
Raw Count
ClassDisplay NameCount
+
+
+ + + + + + + + +
diff --git a/MgdDbgLibrary/ReportBrowser/xsl/RawDataSortDisplayName.xsl b/MgdDbgLibrary/ReportBrowser/xsl/RawDataSortDisplayName.xsl new file mode 100644 index 0000000..c995f25 --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/xsl/RawDataSortDisplayName.xsl @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
Drawing:
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + aecobject + nonaecobject + + + + + + + + + +
Raw Count
Display NameClassCount
+
+
+ +
diff --git a/MgdDbgLibrary/ReportBrowser/xsl/RawDataSymbolCount.xsl b/MgdDbgLibrary/ReportBrowser/xsl/RawDataSymbolCount.xsl new file mode 100644 index 0000000..eaeb98b --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/xsl/RawDataSymbolCount.xsl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
Drawing:
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + aecobject + nonaecobject + + + + + + + + + +
Raw Count
ClassDisplay NameCount
+
+
+ +
diff --git a/MgdDbgLibrary/ReportBrowser/xsl/RawDataSymbolRefs.xsl b/MgdDbgLibrary/ReportBrowser/xsl/RawDataSymbolRefs.xsl new file mode 100644 index 0000000..60c23ff --- /dev/null +++ b/MgdDbgLibrary/ReportBrowser/xsl/RawDataSymbolRefs.xsl @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
Drawing:
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + +
References To Symbols
ClassNameReferences
+
+ +
+ + + + + + + + + + + + + + + + + aecobject + nonaecobject + + + + + + + + + + +
diff --git a/MgdDbgLibrary/Snoop/CollectorExts/CollectorExt.cs b/MgdDbgLibrary/Snoop/CollectorExts/CollectorExt.cs new file mode 100644 index 0000000..f3efd3f --- /dev/null +++ b/MgdDbgLibrary/Snoop/CollectorExts/CollectorExt.cs @@ -0,0 +1,43 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + + +namespace MgdDbg.Snoop.CollectorExts +{ + /// + /// Base class for CollectorExt objects. + /// + public abstract class CollectorExt + { + public + CollectorExt() + { + // add ourselves to the event list of all SnoopCollectors + Snoop.Collectors.Collector.OnCollectorExt += new Snoop.Collectors.Collector.CollectorExt(CollectEvent); + } + + protected abstract void + CollectEvent(object sender, Snoop.Collectors.CollectorEventArgs e); + + } +} diff --git a/MgdDbgLibrary/Snoop/CollectorExts/Colors.cs b/MgdDbgLibrary/Snoop/CollectorExts/Colors.cs new file mode 100644 index 0000000..0301e87 --- /dev/null +++ b/MgdDbgLibrary/Snoop/CollectorExts/Colors.cs @@ -0,0 +1,143 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + + +using System.Diagnostics; +using System.Collections; +using MgdDbg.Snoop.Collectors; + +namespace MgdDbg.Snoop.CollectorExts +{ + /// + /// This is a Snoop Collector Extension object to collect data from Color objects. + /// + public class Color : CollectorExt + { + public + Color() + { + } + + protected override void + CollectEvent(object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + // see if it is a type we are responsible for + Autodesk.AutoCAD.Colors.Color clr = e.ObjToSnoop as Autodesk.AutoCAD.Colors.Color; + if (clr != null) { + Stream(snoopCollector.Data(), clr); + return; + } + + // these are value types so we have to treat them a bit different + if (e.ObjToSnoop is Autodesk.AutoCAD.Colors.EntityColor) { + Stream(snoopCollector.Data(), (Autodesk.AutoCAD.Colors.EntityColor)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is Autodesk.AutoCAD.Colors.Transparency) { + Stream(snoopCollector.Data(), (Autodesk.AutoCAD.Colors.Transparency)e.ObjToSnoop); + return; + } + } + + + private void + Stream(ArrayList data, Autodesk.AutoCAD.Colors.Color clr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.Colors.Color))); + + data.Add(new Snoop.Data.Int("Red", clr.Red)); + data.Add(new Snoop.Data.Int("Green", clr.Green)); + data.Add(new Snoop.Data.Int("Blue", clr.Blue)); + data.Add(new Snoop.Data.Int("Color index", clr.ColorIndex)); + data.Add(new Snoop.Data.String("Color method", clr.ColorMethod.ToString())); + data.Add(new Snoop.Data.Bool("Has book name", clr.HasBookName)); + data.Add(new Snoop.Data.String("Book name", clr.BookName)); + data.Add(new Snoop.Data.Bool("Has color name", clr.HasColorName)); + data.Add(new Snoop.Data.String("Color name", clr.ColorName)); + data.Add(new Snoop.Data.String("Color name for display", clr.ColorNameForDisplay)); + data.Add(new Snoop.Data.String("Color value", clr.ColorValue.ToString())); + data.Add(new Snoop.Data.String("Description", clr.Description)); + data.Add(new Snoop.Data.String("Dictionary key", clr.DictionaryKey)); + data.Add(new Snoop.Data.Int("Dictionary key length", clr.DictionaryKeyLength)); + data.Add(new Snoop.Data.Object("Entity color", clr.EntityColor)); + data.Add(new Snoop.Data.String("Explanation", clr.Explanation)); + data.Add(new Snoop.Data.Bool("Is ByAci", clr.IsByAci)); + data.Add(new Snoop.Data.Bool("Is ByBlock", clr.IsByBlock)); + data.Add(new Snoop.Data.Bool("Is ByColor", clr.IsByColor)); + data.Add(new Snoop.Data.Bool("Is ByLayer", clr.IsByLayer)); + data.Add(new Snoop.Data.Bool("Is ByPen", clr.IsByPen)); + data.Add(new Snoop.Data.Bool("Is Foreground", clr.IsForeground)); + data.Add(new Snoop.Data.Bool("Is None", clr.IsNone)); + data.Add(new Snoop.Data.Int("Pen index", clr.PenIndex)); + } + + private void + Stream(ArrayList data, Autodesk.AutoCAD.Colors.EntityColor clr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.Colors.EntityColor))); + + data.Add(new Snoop.Data.Int("Red", clr.Red)); + data.Add(new Snoop.Data.Int("Green", clr.Green)); + data.Add(new Snoop.Data.Int("Blue", clr.Blue)); + data.Add(new Snoop.Data.Int("Color index", clr.ColorIndex)); + data.Add(new Snoop.Data.String("Color method", clr.ColorMethod.ToString())); + data.Add(new Snoop.Data.Bool("Is ByAci", clr.IsByAci)); + data.Add(new Snoop.Data.Bool("Is ByBlock", clr.IsByBlock)); + data.Add(new Snoop.Data.Bool("Is ByColor", clr.IsByColor)); + data.Add(new Snoop.Data.Bool("Is ByLayer", clr.IsByLayer)); + data.Add(new Snoop.Data.Bool("Is ByPen", clr.IsByPen)); + data.Add(new Snoop.Data.Bool("Is Foreground", clr.IsForeground)); + data.Add(new Snoop.Data.Bool("Is None", clr.IsNone)); + data.Add(new Snoop.Data.Bool("Is layer frozen", clr.IsLayerFrozen)); + data.Add(new Snoop.Data.Bool("Is layer off", clr.IsLayerOff)); + // sometimes this asserts ... figure out why?? + data.Add(new Snoop.Data.Bool("Is layer frozen or off", clr.IsLayerFrozenOrOff)); + data.Add(new Snoop.Data.Int("Layer index", clr.LayerIndex)); + data.Add(new Snoop.Data.Int("Pen index", clr.PenIndex)); + data.Add(new Snoop.Data.Int("True color", clr.TrueColor)); + } + + private void + Stream(ArrayList data, Autodesk.AutoCAD.Colors.Transparency transp) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.Colors.Transparency))); + + data.Add(new Snoop.Data.Bool("Is ByAlpha", transp.IsByAlpha)); + if (transp.IsByAlpha) { + data.Add(new Snoop.Data.Int("Alpha", transp.Alpha)); + data.Add(new Snoop.Data.Bool("Is clear", transp.IsClear)); + data.Add(new Snoop.Data.Bool("Is solid", transp.IsSolid)); + } + data.Add(new Snoop.Data.Bool("Is ByBlock", transp.IsByBlock)); + data.Add(new Snoop.Data.Bool("Is ByLayer", transp.IsByLayer)); + } + } +} diff --git a/MgdDbgLibrary/Snoop/CollectorExts/DbMisc.cs b/MgdDbgLibrary/Snoop/CollectorExts/DbMisc.cs new file mode 100644 index 0000000..c9ef0eb --- /dev/null +++ b/MgdDbgLibrary/Snoop/CollectorExts/DbMisc.cs @@ -0,0 +1,1465 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + + +using System.Diagnostics; +using System.Collections; + +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.DatabaseServices; + +using MgdDbg.Snoop.Collectors; + +namespace MgdDbg.Snoop.CollectorExts +{ + /// + /// This is a Snoop Collector Extension object to collect data from Color objects. + /// + public class DbMisc : CollectorExt + { + public + DbMisc() + { + } + + protected override void + CollectEvent(object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + // see if it is a type we are responsible for + ResultBuffer resBuf = e.ObjToSnoop as ResultBuffer; + if (resBuf != null) { + Stream(snoopCollector.Data(), resBuf); + return; + } + + BulgeVertex bulgeVert = e.ObjToSnoop as BulgeVertex; + if (bulgeVert != null) { + Stream(snoopCollector.Data(), bulgeVert); + return; + } + + LoftOptions loftOpt = e.ObjToSnoop as LoftOptions; + if (loftOpt != null) { + Stream(snoopCollector.Data(), loftOpt); + return; + } + + SweepOptions sweepOpt = e.ObjToSnoop as SweepOptions; + if (sweepOpt != null) { + Stream(snoopCollector.Data(), sweepOpt); + return; + } + + RevolveOptions revOpt = e.ObjToSnoop as RevolveOptions; + if (revOpt != null) { + Stream(snoopCollector.Data(), revOpt); + return; + } + + PlotStyleTableChangedEventArgs plotStyleTableChangedArgs = e.ObjToSnoop as PlotStyleTableChangedEventArgs; + if (plotStyleTableChangedArgs != null) { + Stream(snoopCollector.Data(), plotStyleTableChangedArgs); + return; + } + + LayoutCopiedEventArgs layoutCopiedArgs = e.ObjToSnoop as LayoutCopiedEventArgs; + if (layoutCopiedArgs != null) { + Stream(snoopCollector.Data(), layoutCopiedArgs); + return; + } + + LayoutRenamedEventArgs layoutRenamedArgs = e.ObjToSnoop as LayoutRenamedEventArgs; + if (layoutRenamedArgs != null) { + Stream(snoopCollector.Data(), layoutRenamedArgs); + return; + } + + LayoutEventArgs layoutArgs = e.ObjToSnoop as LayoutEventArgs; + if (layoutArgs != null) { + Stream(snoopCollector.Data(), layoutArgs); + return; + } + + XrefSubCommandEventArgs xrefSubCmdArgs = e.ObjToSnoop as XrefSubCommandEventArgs; + if (xrefSubCmdArgs != null) { + Stream(snoopCollector.Data(), xrefSubCmdArgs); + return; + } + + AuditInfo auditInfo = e.ObjToSnoop as AuditInfo; + if (auditInfo != null) { + Stream(snoopCollector.Data(), auditInfo); + return; + } + + CustomObjectSnapMode custObjSnapMode = e.ObjToSnoop as CustomObjectSnapMode; + if (custObjSnapMode != null) { + Stream(snoopCollector.Data(), custObjSnapMode); + return; + } + + // TBD: "DbHomeView" throws a nullReferenceException + // even as it is being checked for null !!! + //DbHomeView homeView = e.ObjToSnoop as DbHomeView; + //if (homeView != null) { + // Stream(snoopCollector.Data(), homeView); + // return; + //} + + UnderlayItem underlayItem = e.ObjToSnoop as UnderlayItem; + if (underlayItem != null) { + Stream(snoopCollector.Data(), underlayItem); + return; + } + + DynamicBlockReferenceProperty dynBlkRefProp = e.ObjToSnoop as DynamicBlockReferenceProperty; + if (dynBlkRefProp != null) { + Stream(snoopCollector.Data(), dynBlkRefProp); + return; + } + + DynamicDimensionChangedEventArgs dimChangeArgs = e.ObjToSnoop as DynamicDimensionChangedEventArgs; + if (dimChangeArgs != null) { + Stream(snoopCollector.Data(), dimChangeArgs); + return; + } + + DynamicDimensionData dimData = e.ObjToSnoop as DynamicDimensionData; + if (dimData != null) { + Stream(snoopCollector.Data(), dimData); + return; + } + + EntityAlignmentEventArgs entAlignArgs = e.ObjToSnoop as EntityAlignmentEventArgs; + if (entAlignArgs != null) { + Stream(snoopCollector.Data(), entAlignArgs); + return; + } + + IdMappingEventArgs idMapArgs = e.ObjToSnoop as IdMappingEventArgs; + if (idMapArgs != null) { + Stream(snoopCollector.Data(), idMapArgs); + return; + } + + LayerStateDeletedEventArgs layerStateDelArgs = e.ObjToSnoop as LayerStateDeletedEventArgs; + if (layerStateDelArgs != null) { + Stream(snoopCollector.Data(), layerStateDelArgs); + return; + } + + LayerStateEventArgs layerStateArgs = e.ObjToSnoop as LayerStateEventArgs; + if (layerStateArgs != null) { + Stream(snoopCollector.Data(), layerStateArgs); + return; + } + + LayerStateRenameEventArgs layerStateRenArgs = e.ObjToSnoop as LayerStateRenameEventArgs; + if (layerStateRenArgs != null) { + Stream(snoopCollector.Data(), layerStateRenArgs); + return; + } + + LayerViewportProperties layerViewportProps = e.ObjToSnoop as LayerViewportProperties; + if (layerViewportProps != null) { + Stream(snoopCollector.Data(), layerViewportProps); + return; + } + + MTextFragment mtextFrag = e.ObjToSnoop as MTextFragment; + if (mtextFrag != null) { + Stream(snoopCollector.Data(), mtextFrag); + return; + } + + ObjectClosedEventArgs objCloseArgs = e.ObjToSnoop as ObjectClosedEventArgs; + if (objCloseArgs != null) { + Stream(snoopCollector.Data(), objCloseArgs); + return; + } + + ObjectErasedEventArgs objEraseArgs = e.ObjToSnoop as ObjectErasedEventArgs; + if (objEraseArgs != null) { + Stream(snoopCollector.Data(), objEraseArgs); + return; + } + + ObjectSnapContext objSnapCtxt = e.ObjToSnoop as ObjectSnapContext; + if (objSnapCtxt != null) { + Stream(snoopCollector.Data(), objSnapCtxt); + return; + } + + ObjectSnapInfo objSnapInfo = e.ObjToSnoop as ObjectSnapInfo; + if (objSnapInfo != null) { + Stream(snoopCollector.Data(), objSnapInfo); + return; + } + + RevolveOptionsCheckRevolveCurveOut revOptsChkRevCurOut = e.ObjToSnoop as RevolveOptionsCheckRevolveCurveOut; + if (revOptsChkRevCurOut != null) { + Stream(snoopCollector.Data(), revOptsChkRevCurOut); + return; + } + + SweepOptionsCheckSweepCurveOut sweepOptsChkSweepCur = e.ObjToSnoop as SweepOptionsCheckSweepCurveOut; + if (sweepOptsChkSweepCur != null) { + Stream(snoopCollector.Data(), sweepOptsChkSweepCur); + return; + } + + UnderlayFile underlayFile = e.ObjToSnoop as UnderlayFile; + if (underlayFile != null) { + Stream(snoopCollector.Data(), underlayFile); + return; + } + + UnderlayLayer underlayLayer = e.ObjToSnoop as UnderlayLayer; + if (underlayLayer != null) { + Stream(snoopCollector.Data(), underlayLayer); + return; + } + + DataAdapter dataAdapt = e.ObjToSnoop as DataAdapter; + if (dataAdapt != null) { + Stream(snoopCollector.Data(), dataAdapt); + return; + } + + DataCell dataCell = e.ObjToSnoop as DataCell; + if (dataCell != null) { + Stream(snoopCollector.Data(), dataCell); + return; + } + + DataColumn dataColl = e.ObjToSnoop as DataColumn; + if (dataColl != null) { + Stream(snoopCollector.Data(), dataColl); + return; + } + + DataLinkManager dataLinkMan = e.ObjToSnoop as DataLinkManager; + if (dataLinkMan != null) { + Stream(snoopCollector.Data(), dataLinkMan); + return; + } + + DbDictionaryEnumerator dbDictEnum = e.ObjToSnoop as DbDictionaryEnumerator; + if (dbDictEnum != null) { + Stream(snoopCollector.Data(), dbDictEnum); + return; + } + + DwgFiler dwgFiler = e.ObjToSnoop as DwgFiler; + if (dwgFiler != null) { + Stream(snoopCollector.Data(), dwgFiler); + return; + } + + DxfFiler dxfFiler = e.ObjToSnoop as DxfFiler; + if (dxfFiler != null) { + Stream(snoopCollector.Data(), dxfFiler); + return; + } + + IdMapping idMap = e.ObjToSnoop as IdMapping; + if (idMap != null) { + Stream(snoopCollector.Data(), idMap); + return; + } + + LayerStateManager stateMgr = e.ObjToSnoop as LayerStateManager; + if (stateMgr != null) { + Stream(snoopCollector.Data(), stateMgr); + return; + } + + LayoutManager layoutMgr = e.ObjToSnoop as LayoutManager; + if (layoutMgr != null) { + Stream(snoopCollector.Data(), layoutMgr); + return; + } + + ObjectContext objContext = e.ObjToSnoop as ObjectContext; + if (objContext != null) { + Stream(snoopCollector.Data(), objContext); + return; + } + + // ValueTypes we have to treat a bit different + if (e.ObjToSnoop is ObjectId) { + Stream(snoopCollector.Data(), (ObjectId)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is Extents2d) { + Stream(snoopCollector.Data(), (Extents2d)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is Extents3d) { + Stream(snoopCollector.Data(), (Extents3d)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is HyperLink) { + Stream(snoopCollector.Data(), (HyperLink)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is Solid3dMassProperties) { + Stream(snoopCollector.Data(), (Solid3dMassProperties)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is FitData) { + Stream(snoopCollector.Data(), (FitData)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is NurbsData) { + Stream(snoopCollector.Data(), (NurbsData)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is PatternDefinition) { + Stream(snoopCollector.Data(), (PatternDefinition)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MlineStyleElement) { + Stream(snoopCollector.Data(), (MlineStyleElement)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is FieldEvaluationStatusResult) { + Stream(snoopCollector.Data(), (FieldEvaluationStatusResult)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is Rectangle3d) { + Stream(snoopCollector.Data(), (Rectangle3d)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is DatabaseSummaryInfo) { + Stream(snoopCollector.Data(), (DatabaseSummaryInfo)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is FullSubentityPath) { + Stream(snoopCollector.Data(), (FullSubentityPath)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is SubentityId) { + Stream(snoopCollector.Data(), (SubentityId)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is DataTypeParameter) { + Stream(snoopCollector.Data(), (DataTypeParameter)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is DBDictionaryEntry) { + Stream(snoopCollector.Data(), (DBDictionaryEntry)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is FullDwgVersion) { + Stream(snoopCollector.Data(), (FullDwgVersion)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is GridPropertyParameter) { + Stream(snoopCollector.Data(), (GridPropertyParameter)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MeshPointMap) { + Stream(snoopCollector.Data(), (MeshPointMap)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MeshPointMaps) { + Stream(snoopCollector.Data(), (MeshPointMaps)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is Autodesk.AutoCAD.DatabaseServices.Filters.SpatialFilterDefinition) { + Stream(snoopCollector.Data(), (Autodesk.AutoCAD.DatabaseServices.Filters.SpatialFilterDefinition)e.ObjToSnoop); + return; + } + + //if (e.ObjToSnoop is Autodesk.AutoCAD.DatabaseServices.Filters.SpatialFilterVolume) { + // Stream(snoopCollector.Data(), (Autodesk.AutoCAD.DatabaseServices.Filters.SpatialFilterVolume)e.ObjToSnoop); + // return; + //} + } + + private void + Stream(ArrayList data, ResultBuffer resbuf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ResultBuffer))); + + short typeCode; + TypedValue tmpVal; + + ResultBufferEnumerator iter = resbuf.GetEnumerator(); + while (iter.MoveNext()) { + tmpVal = (TypedValue)iter.Current; + typeCode = tmpVal.TypeCode; + string dxfCodeStr; + + // DXF codes + if (typeCode == 0) { + dxfCodeStr = string.Format("{0:d} (dxf classname/string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if (((typeCode >= 1) && (typeCode <= 4)) || + ((typeCode >= 6) && (typeCode <= 9))) { + dxfCodeStr = string.Format("{0:d} (string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if ((typeCode == 5) || (typeCode == 105)) { + dxfCodeStr = string.Format("{0:d} (handle/string", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if ((typeCode >= 10) && (typeCode <= 17)) { + dxfCodeStr = string.Format("{0:d} (3 reals)", typeCode); + data.Add(new Snoop.Data.Point3d(dxfCodeStr, (Point3d)tmpVal.Value)); + } + else if ((typeCode >= 38) && (typeCode <= 59)) { + dxfCodeStr = string.Format("{0:d} (double)", typeCode); + data.Add(new Snoop.Data.Double(dxfCodeStr, (double)tmpVal.Value)); + } + else if ((typeCode >= 60) && (typeCode <= 79)) { + dxfCodeStr = string.Format("{0:d} (short)", typeCode); + data.Add(new Snoop.Data.Int(dxfCodeStr, (short)tmpVal.Value)); + } + else if (typeCode == 90) + { + dxfCodeStr = string.Format("{0:d} (int)", typeCode); + data.Add(new Snoop.Data.Int(dxfCodeStr, (int)tmpVal.Value)); + } + else if ((typeCode > 90) && (typeCode <= 99)) { + dxfCodeStr = string.Format("{0:d} (long)", typeCode); + data.Add(new Snoop.Data.Int(dxfCodeStr, (int)(long)tmpVal.Value)); + } + else if (typeCode == 100) { + dxfCodeStr = string.Format("{0:d} (sub-class marker/string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if (typeCode == 101) { + dxfCodeStr = string.Format("{0:d} (embedded object start/string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if (typeCode == 102) { + dxfCodeStr = string.Format("{0:d} (control/string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if ((typeCode >= 110) && (typeCode <= 119)) { + dxfCodeStr = string.Format("{0:d} (3 reals)", typeCode); + data.Add(new Snoop.Data.Point3d(dxfCodeStr, (Point3d)tmpVal.Value)); + } + else if ((typeCode >= 140) && (typeCode <= 149)) { + dxfCodeStr = string.Format("{0:d} (double)", typeCode); + data.Add(new Snoop.Data.Double(dxfCodeStr, (double)tmpVal.Value)); + } + else if ((typeCode >= 170) && (typeCode <= 179)) { + dxfCodeStr = string.Format("{0:d} (short)", typeCode); + data.Add(new Snoop.Data.Int(dxfCodeStr, (short)tmpVal.Value)); + } + else if ((typeCode >= 210) && (typeCode <= 219)) { + dxfCodeStr = string.Format("{0:d} (3 reals)", typeCode); + data.Add(new Snoop.Data.Point3d(dxfCodeStr, (Point3d)tmpVal.Value)); + } + else if ((typeCode >= 270) && (typeCode <= 299)) { + dxfCodeStr = string.Format("{0:d} (short)", typeCode); + data.Add(new Snoop.Data.Int(dxfCodeStr, (short)tmpVal.Value)); + } + else if ((typeCode >= 300) && (typeCode <= 309)) { + dxfCodeStr = string.Format("{0:d} (string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if ((typeCode >= 310) && (typeCode <= 319)) { + dxfCodeStr = string.Format("{0:d} (binary chunk)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, Snoop.Utils.BytesToHexStr((byte[])tmpVal.Value))); + } + else if ((typeCode >= 320) && (typeCode <= 329)) { + dxfCodeStr = string.Format("{0:d} (handle/string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if ((typeCode >= 330) && (typeCode <= 339)) { + dxfCodeStr = string.Format("{0:d} (soft pointer)", typeCode); + data.Add(new Snoop.Data.ObjectId(dxfCodeStr, (ObjectId)tmpVal.Value)); + } + else if ((typeCode >= 340) && (typeCode <= 349)) { + dxfCodeStr = string.Format("{0:d} (hard pointer)", typeCode); + data.Add(new Snoop.Data.ObjectId(dxfCodeStr, (ObjectId)tmpVal.Value)); + } + else if ((typeCode >= 350) && (typeCode <= 359)) { + dxfCodeStr = string.Format("{0:d} (soft owner)", typeCode); + data.Add(new Snoop.Data.ObjectId(dxfCodeStr, (ObjectId)tmpVal.Value)); + } + else if ((typeCode >= 360) && (typeCode <= 369)) { + dxfCodeStr = string.Format("{0:d} (hard owner)", typeCode); + data.Add(new Snoop.Data.ObjectId(dxfCodeStr, (ObjectId)tmpVal.Value)); + } + else if ((typeCode >= 370) && (typeCode <= 379)) { + dxfCodeStr = string.Format("{0:d} (short)", typeCode); + data.Add(new Snoop.Data.Int(dxfCodeStr, (short)tmpVal.Value)); + } + else if ((typeCode >= 380) && (typeCode <= 389)) { + dxfCodeStr = string.Format("{0:d} (8-bit int)", typeCode); + data.Add(new Snoop.Data.Int(dxfCodeStr, (char)tmpVal.Value)); + } + else if ((typeCode >= 390) && (typeCode <= 399)) { + dxfCodeStr = string.Format("{0:d} (entity name)", typeCode); + data.Add(new Snoop.Data.ObjectId(dxfCodeStr, (ObjectId)tmpVal.Value)); + } + else if ((typeCode >= 400) && (typeCode <= 409)) { + dxfCodeStr = string.Format("{0:d} (short)", typeCode); + data.Add(new Snoop.Data.Int(dxfCodeStr, (short)tmpVal.Value)); + } + else if ((typeCode >= 410) && (typeCode <= 419)) { + dxfCodeStr = string.Format("{0:d} (string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if (typeCode == 999) { + dxfCodeStr = string.Format("{0:d} (comment/string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + + // Xdata codes + else if (typeCode == 1000) { + dxfCodeStr = string.Format("{0:d} (string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if (typeCode == 1001) { + dxfCodeStr = string.Format("{0:d} (appname/string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if (typeCode == 1002) { + dxfCodeStr = string.Format("{0:d} (control/string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if (typeCode == 1003) { + dxfCodeStr = string.Format("{0:d} (layername/string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if (typeCode == 1004) { + dxfCodeStr = string.Format("{0:d} (binary chunk)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, Snoop.Utils.BytesToHexStr((byte[])tmpVal.Value))); + } + else if (typeCode == 1005) { + dxfCodeStr = string.Format("{0:d} (handle/string)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if (typeCode == 1010) { + dxfCodeStr = string.Format("{0:d} (3 reals)", typeCode); + data.Add(new Snoop.Data.Point3d(dxfCodeStr, (Point3d)tmpVal.Value)); + } + else if (typeCode == 1011) { + dxfCodeStr = string.Format("{0:d} (World space position/3 reals)", typeCode); + data.Add(new Snoop.Data.Point3d(dxfCodeStr, (Point3d)tmpVal.Value)); + } + else if (typeCode == 1012) { + dxfCodeStr = string.Format("{0:d} (World space displacement/3 reals)", typeCode); + data.Add(new Snoop.Data.Point3d(dxfCodeStr, (Point3d)tmpVal.Value)); + } + else if (typeCode == 1013) { + dxfCodeStr = string.Format("{0:d} (World direction/3 reals)", typeCode); + data.Add(new Snoop.Data.Point3d(dxfCodeStr, (Point3d)tmpVal.Value)); + } + else if (typeCode == 1040) { + dxfCodeStr = string.Format("{0:d} (double)", typeCode); + data.Add(new Snoop.Data.Double(dxfCodeStr, (double)tmpVal.Value)); + } + else if (typeCode == 1041) { + dxfCodeStr = string.Format("{0:d} (distance/double)", typeCode); + data.Add(new Snoop.Data.Double(dxfCodeStr, (double)tmpVal.Value)); + } + else if (typeCode == 1042) { + dxfCodeStr = string.Format("{0:d} (scale factor/double)", typeCode); + data.Add(new Snoop.Data.Double(dxfCodeStr, (double)tmpVal.Value)); + } + else if (typeCode == 1070) { + dxfCodeStr = string.Format("{0:d} (short)", typeCode); + data.Add(new Snoop.Data.Int(dxfCodeStr, (short)tmpVal.Value)); + } + else if (typeCode == 1071) { + dxfCodeStr = string.Format("{0:d} (long)", typeCode); + data.Add(new Snoop.Data.Int(dxfCodeStr, (int)tmpVal.Value)); + } + // other control marker codes + else if (typeCode == -6) { + dxfCodeStr = string.Format("{0:d} (extension dictionary)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, "")); + } + else if (typeCode == -5) { + dxfCodeStr = string.Format("{0:d} (persistent reactors)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, "")); + } + else if (typeCode == -4) { + dxfCodeStr = string.Format("{0:d} (conditional operator)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, (string)tmpVal.Value)); + } + else if (typeCode == -3) { + dxfCodeStr = string.Format("{0:d} (start of xdata)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, "")); + } + else if (typeCode == -2) { + dxfCodeStr = string.Format("{0:d} (entity name reference)", typeCode); + data.Add(new Snoop.Data.ObjectId(dxfCodeStr, (ObjectId)tmpVal.Value)); + } + else if (typeCode == -1) { + dxfCodeStr = string.Format("{0:d} (entity name)", typeCode); + data.Add(new Snoop.Data.ObjectId(dxfCodeStr, (ObjectId)tmpVal.Value)); + } + else if (typeCode == (int)Autodesk.AutoCAD.Runtime.LispDataType.SelectionSet) { + dxfCodeStr = string.Format("{0:d} (picks)", typeCode); + //valueStr.Format("", rb->resval.rlname[0]); + //data.Add(new Snoop.Data.String(dxfCodeStr, valueStr)); + data.Add(new Snoop.Data.String(dxfCodeStr, "???")); // TBD: how to get SelectionSet displayed? + } + else if (typeCode == (int)Autodesk.AutoCAD.Runtime.LispDataType.ListBegin) { + dxfCodeStr = string.Format("{0:d} (list begin)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, "")); + } + else if (typeCode == (int)Autodesk.AutoCAD.Runtime.LispDataType.ListEnd) { + dxfCodeStr = string.Format("{0:d} (list end)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, "")); + } + else if (typeCode == (int)Autodesk.AutoCAD.Runtime.LispDataType.Nil) { + dxfCodeStr = string.Format("{0:d} (NIL)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, "")); + } + else if (typeCode == (int)Autodesk.AutoCAD.Runtime.LispDataType.T_atom) { + dxfCodeStr = string.Format("{0:d} (T)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, "")); + } + else { + Debug.Assert(false); + dxfCodeStr = string.Format("{0:d} (*Unknown*)", typeCode); + data.Add(new Snoop.Data.String(dxfCodeStr, "")); + } + } + } + + private void + Stream(ArrayList data, ObjectId objId) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ObjectId))); + + data.Add(new Snoop.Data.Database("Database", objId.Database)); + data.Add(new Snoop.Data.Database("Original database", objId.OriginalDatabase)); + data.Add(new Snoop.Data.String("Handle", objId.Handle.ToString())); + data.Add(new Snoop.Data.String("Non-forwarded handle", objId.NonForwardedHandle.ToString())); + data.Add(new Snoop.Data.Bool("Is erased", objId.IsErased)); + data.Add(new Snoop.Data.Bool("Is effectively erased", objId.IsEffectivelyErased)); + data.Add(new Snoop.Data.Bool("Is null", objId.IsNull)); + data.Add(new Snoop.Data.Bool("Is valid", objId.IsValid)); + data.Add(new Snoop.Data.Bool("Object left on disk", objId.ObjectLeftOnDisk)); + data.Add(new Snoop.Data.Int("Old ID", objId.OldIdPtr.ToInt32())); + } + + private void + Stream(ArrayList data, Extents3d ext) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Extents3d))); + + data.Add(new Snoop.Data.Point3d("Min point", ext.MinPoint)); + data.Add(new Snoop.Data.Point3d("Max point", ext.MaxPoint)); + } + + private void + Stream(ArrayList data, Extents2d ext) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Extents2d))); + + data.Add(new Snoop.Data.Point2d("Min point", ext.MinPoint)); + data.Add(new Snoop.Data.Point2d("Max point", ext.MaxPoint)); + } + + private void + Stream(ArrayList data, HyperLink hlink) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(HyperLink))); + + data.Add(new Snoop.Data.String("Name", hlink.Name)); + data.Add(new Snoop.Data.String("Description", hlink.Description)); + data.Add(new Snoop.Data.String("Display string", hlink.DisplayString)); + data.Add(new Snoop.Data.Bool("Is outermost container", hlink.IsOutermostContainer)); + data.Add(new Snoop.Data.Int("Nested level", hlink.NestedLevel)); + data.Add(new Snoop.Data.String("Sub location", hlink.SubLocation)); + } + + private void + Stream(ArrayList data, Solid3dMassProperties massProps) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Solid3dMassProperties))); + + data.Add(new Snoop.Data.Point3d("Centroid", massProps.Centroid)); + data.Add(new Snoop.Data.Vector3d("Moment of inertia", massProps.MomentsOfIntertia)); + data.Add(new Snoop.Data.Vector3d("Principal moments", massProps.PrincipalMoments)); + data.Add(new Snoop.Data.Vector3d("Products of inertia", massProps.ProductsOfIntertia)); + data.Add(new Snoop.Data.Vector3d("Radii of gyration", massProps.RadiiOfGyration)); + data.Add(new Snoop.Data.Double("Volume", massProps.Volume)); + data.Add(new Snoop.Data.Vector3d("Principle axis X", massProps[0])); + data.Add(new Snoop.Data.Vector3d("Principle axis Y", massProps[1])); + data.Add(new Snoop.Data.Vector3d("Principle axis Z", massProps[2])); + data.Add(new Snoop.Data.Object("Extents", massProps.Extents)); + } + + private void + Stream(ArrayList data, FitData fitData) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(FitData))); + + data.Add(new Snoop.Data.Int("Degree", fitData.Degree)); + data.Add(new Snoop.Data.Bool("Tangents exist", fitData.TangentsExist)); + data.Add(new Snoop.Data.Vector3d("Start tangent", fitData.StartTangent)); + data.Add(new Snoop.Data.Vector3d("End tangent", fitData.EndTangent)); + data.Add(new Snoop.Data.Double("Fit tolerance", fitData.FitTolerance)); + data.Add(new Snoop.Data.Object("Fit points", fitData.GetFitPoints())); + } + + private void + Stream(ArrayList data, NurbsData nurbsData) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(NurbsData))); + + data.Add(new Snoop.Data.Int("Degree", nurbsData.Degree)); + data.Add(new Snoop.Data.Double("Control point tolerance", nurbsData.ControlPointTolerance)); + data.Add(new Snoop.Data.Double("Knot tolerance", nurbsData.KnotTolerance)); + data.Add(new Snoop.Data.Bool("Closed", nurbsData.Closed)); + data.Add(new Snoop.Data.Bool("Periodic", nurbsData.Periodic)); + data.Add(new Snoop.Data.Bool("Rational", nurbsData.Rational)); + data.Add(new Snoop.Data.Object("Control points", nurbsData.GetControlPoints())); + data.Add(new Snoop.Data.Object("Knots", nurbsData.GetKnots())); + data.Add(new Snoop.Data.Object("Weights", nurbsData.GetWeights())); + } + + private void + Stream(ArrayList data, BulgeVertex bulgeVert) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(BulgeVertex))); + + data.Add(new Snoop.Data.Point2d("Vertex", bulgeVert.Vertex)); + data.Add(new Snoop.Data.Double("Bulge", bulgeVert.Bulge)); + + + //HatchLoop loop = bulgeVerts as HatchLoop; + //if (bulgeVerts != null) { + // Stream(data, bulgeVerts); + // return; + //} + } + + private void + Stream(ArrayList data, HatchLoop loop) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(HatchLoop))); + + data.Add(new Snoop.Data.String("Loop type", loop.LoopType.ToString())); + } + + private void + Stream(ArrayList data, PatternDefinition patternDef) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PatternDefinition))); + + data.Add(new Snoop.Data.Double("Angle", patternDef.Angle)); + data.Add(new Snoop.Data.Double("Base X", patternDef.BaseX)); + data.Add(new Snoop.Data.Double("Base Y", patternDef.BaseY)); + data.Add(new Snoop.Data.Double("Offset X", patternDef.OffsetX)); + data.Add(new Snoop.Data.Double("Offset Y", patternDef.OffsetY)); + data.Add(new Snoop.Data.Object("Dashes", patternDef.GetDashes())); + } + + private void + Stream(ArrayList data, MlineStyleElement mlStyleElem) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MlineStyleElement))); + + data.Add(new Snoop.Data.ObjectToString("Color", mlStyleElem.Color)); + data.Add(new Snoop.Data.ObjectId("Linetype ID", mlStyleElem.LinetypeId)); + data.Add(new Snoop.Data.Double("Offset", mlStyleElem.Offset)); + } + + private void + Stream(ArrayList data, LoftOptions opt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LoftOptions))); + + data.Add(new Snoop.Data.Bool("Align direction", opt.AlignDirection)); + data.Add(new Snoop.Data.Bool("Arc length param", opt.ArcLengthParam)); + data.Add(new Snoop.Data.Bool("Closed", opt.Closed)); + data.Add(new Snoop.Data.Double("Draft start", opt.DraftStart)); + data.Add(new Snoop.Data.Double("Draft start mag", opt.DraftStartMag)); + data.Add(new Snoop.Data.Double("Draft end", opt.DraftEnd)); + data.Add(new Snoop.Data.Double("Draft end mag", opt.DraftEndMag)); + data.Add(new Snoop.Data.String("Normal option", opt.NormalOption.ToString())); + data.Add(new Snoop.Data.Bool("No twist", opt.NoTwist)); + data.Add(new Snoop.Data.Bool("Ruled", opt.Ruled)); + data.Add(new Snoop.Data.Bool("Simplify", opt.Simplify)); + data.Add(new Snoop.Data.Bool("Virtual guide", opt.VirtualGuide)); + } + + private void + Stream(ArrayList data, SweepOptions opt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SweepOptions))); + + data.Add(new Snoop.Data.String("Align", opt.Align.ToString())); + data.Add(new Snoop.Data.Angle("Align angle", opt.AlignAngle)); + data.Add(new Snoop.Data.Bool("Align start", opt.AlignStart)); + data.Add(new Snoop.Data.Bool("Bank", opt.Bank)); + data.Add(new Snoop.Data.Point3d("Base point", opt.BasePoint)); + data.Add(new Snoop.Data.Bool("Check intersections", opt.CheckIntersections)); + data.Add(new Snoop.Data.Angle("Draft angle", opt.DraftAngle)); + data.Add(new Snoop.Data.Angle("Twist angle", opt.TwistAngle)); + data.Add(new Snoop.Data.Distance("Start draft distance", opt.StartDraftDist)); + data.Add(new Snoop.Data.Distance("End draft distance", opt.EndDraftDist)); + data.Add(new Snoop.Data.Object("Path entity transform", opt.PathEntityTransform)); + data.Add(new Snoop.Data.Object("Sweep entity transform", opt.SweepEntityTransform)); + data.Add(new Snoop.Data.Double("Scale factor", opt.ScaleFactor)); + } + + private void + Stream(ArrayList data, RevolveOptions opt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RevolveOptions))); + + data.Add(new Snoop.Data.Bool("Close to axis", opt.CloseToAxis)); + data.Add(new Snoop.Data.Angle("Draft angle", opt.DraftAngle)); + data.Add(new Snoop.Data.Angle("Twist angle", opt.TwistAngle)); + } + + + private void + Stream(ArrayList data, FieldEvaluationStatusResult stat) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(FieldEvaluationStatusResult))); + + data.Add(new Snoop.Data.Int("Error code", stat.ErrorCode)); + data.Add(new Snoop.Data.String("Error message", stat.ErrorMessage)); + data.Add(new Snoop.Data.String("Status", stat.Status.ToString())); + } + + private void + Stream(ArrayList data, Rectangle3d rect) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Rectangle3d))); + + data.Add(new Snoop.Data.Point3d("Lower left", rect.LowerLeft)); + data.Add(new Snoop.Data.Point3d("Lower right", rect.LowerRight)); + data.Add(new Snoop.Data.Point3d("Upper left", rect.UpperLeft)); + data.Add(new Snoop.Data.Point3d("Upper right", rect.UpperRight)); + } + + private void + Stream(ArrayList data, PlotStyleTableChangedEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PlotStyleTableChangedEventArgs))); + + data.Add(new Snoop.Data.ObjectId("ID", args.Id)); + data.Add(new Snoop.Data.String("New name", args.NewName)); + } + + private void + Stream(ArrayList data, LayoutCopiedEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayoutCopiedEventArgs))); + + data.Add(new Snoop.Data.ObjectId("ID", args.Id)); + data.Add(new Snoop.Data.String("Name", args.Name)); + data.Add(new Snoop.Data.ObjectId("New ID", args.NewId)); + data.Add(new Snoop.Data.String("New name", args.NewName)); + } + + private void + Stream(ArrayList data, LayoutRenamedEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayoutRenamedEventArgs))); + + data.Add(new Snoop.Data.ObjectId("ID", args.Id)); + data.Add(new Snoop.Data.String("Name", args.Name)); + data.Add(new Snoop.Data.String("New name", args.NewName)); + } + + private void + Stream(ArrayList data, LayoutEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayoutEventArgs))); + + data.Add(new Snoop.Data.ObjectId("ID", args.Id)); + data.Add(new Snoop.Data.String("Name", args.Name)); + } + + private void + Stream(ArrayList data, XrefSubCommandEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(XrefSubCommandEventArgs))); + + data.Add(new Snoop.Data.ObjectIdCollection("Block table record ID", args.btrIds)); + //data.Add(new Snoop.Data.String("Block table record names", args.btrNames)); // TBD: make a string array snoop + //data.Add(new Snoop.Data.String("Paths", args.paths)); + data.Add(new Snoop.Data.String("Xref op", args.xrefOp.ToString())); + + XrefVetoableSubCommandEventArgs xrefVetoCmdArgs = args as XrefVetoableSubCommandEventArgs; + if (xrefVetoCmdArgs != null) { + Stream(data, xrefVetoCmdArgs); + return; + } + + } + + private void + Stream(ArrayList data, XrefVetoableSubCommandEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(XrefVetoableSubCommandEventArgs))); + + data.Add(new Snoop.Data.Bool("Abort op", args.abortOp)); + } + + private void + Stream(ArrayList data, AuditInfo auditInfo) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AuditInfo))); + + data.Add(new Snoop.Data.String("Audit pass", auditInfo.AuditPass.ToString())); + data.Add(new Snoop.Data.Bool("Fix errors", auditInfo.FixErrors)); + data.Add(new Snoop.Data.Int("Number of entities", auditInfo.NumEntities)); + data.Add(new Snoop.Data.Int("Number of errors", auditInfo.NumErrors)); + data.Add(new Snoop.Data.Int("Number of fixes", auditInfo.NumFixes)); + } + + private void + Stream(ArrayList data, CustomObjectSnapMode custObjSnapMode) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CustomObjectSnapMode))); + + data.Add(new Snoop.Data.String("Global mode string", custObjSnapMode.GlobalModeString)); + data.Add(new Snoop.Data.Object("Glyph", custObjSnapMode.Glyph)); + data.Add(new Snoop.Data.String("Local mode string", custObjSnapMode.LocalModeString)); + data.Add(new Snoop.Data.String("Tool tip text", custObjSnapMode.ToolTipText)); + } + + + //TBD: This throws a null reference exception. Need to investigate. + + //private void + //Stream(ArrayList data, DbHomeView homeView) + //{ + // data.Add(new Snoop.Data.ClassSeparator(typeof(DbHomeView))); + + // data.Add(new Snoop.Data.Point3d("Center", homeView.Center)); + // data.Add(new Snoop.Data.Point3d("Eye", homeView.Eye)); + // data.Add(new Snoop.Data.Double("Height", homeView.Height)); + // data.Add(new Snoop.Data.Bool("Perspective", homeView.Perspective)); + // data.Add(new Snoop.Data.Vector3d("Up", homeView.Up)); + // data.Add(new Snoop.Data.Double("Width", homeView.Width)); + //} + + private void + Stream(ArrayList data, UnderlayItem underlayItem) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(UnderlayItem))); + + data.Add(new Snoop.Data.Object("Extents", underlayItem.Extents)); + data.Add(new Snoop.Data.String("Name", underlayItem.Name)); + data.Add(new Snoop.Data.String("Units", underlayItem.Units.ToString())); + data.Add(new Snoop.Data.Bool("Using partial content", underlayItem.UsingPartialContent)); + + DgnUnderlayItem dgnItem = underlayItem as DgnUnderlayItem; + if (dgnItem != null) { + Stream(data, dgnItem); + return; + } + } + + private void + Stream(ArrayList data, DgnUnderlayItem dgnItem) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DgnUnderlayItem))); + + data.Add(new Snoop.Data.Bool("Show raster ref", dgnItem.ShowRasterRef)); + data.Add(new Snoop.Data.Bool("Use master units", dgnItem.UseMasterUnits)); + } + + private void + Stream(ArrayList data, DynamicBlockReferenceProperty dynBlkRefProp) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DynamicBlockReferenceProperty))); + + data.Add(new Snoop.Data.ObjectId("Block Id", dynBlkRefProp.BlockId)); + data.Add(new Snoop.Data.String("Description", dynBlkRefProp.Description)); + data.Add(new Snoop.Data.String("Property name", dynBlkRefProp.PropertyName)); + data.Add(new Snoop.Data.Int("Property type code", dynBlkRefProp.PropertyTypeCode)); + data.Add(new Snoop.Data.String("Units type", dynBlkRefProp.UnitsType.ToString())); + } + + private void + Stream(ArrayList data, DynamicDimensionChangedEventArgs dimChangeArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DynamicDimensionChangedEventArgs))); + + data.Add(new Snoop.Data.Int("Index", dimChangeArgs.Index)); + data.Add(new Snoop.Data.Double("Value", dimChangeArgs.Value)); + } + + private void + Stream(ArrayList data, DynamicDimensionData dimData) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DynamicDimensionData))); + + data.Add(new Snoop.Data.Object("Dimension", dimData.Dimension)); + data.Add(new Snoop.Data.Bool("Editable", dimData.Editable)); + data.Add(new Snoop.Data.Bool("Focal", dimData.Focal)); + data.Add(new Snoop.Data.Bool("Hide if value is zero", dimData.HideIfValueIsZero)); + data.Add(new Snoop.Data.Bool("Visible", dimData.Visible)); + } + + private void + Stream(ArrayList data, EntityAlignmentEventArgs entAlignEventArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(EntityAlignmentEventArgs))); + + data.Add(new Snoop.Data.Point3d("Closest point", entAlignEventArgs.ClosestPoint)); + data.Add(new Snoop.Data.Vector3d("Direction", entAlignEventArgs.Direction)); + data.Add(new Snoop.Data.Object("Entity", entAlignEventArgs.Entity)); + data.Add(new Snoop.Data.Vector3d("Normal", entAlignEventArgs.Normal)); + data.Add(new Snoop.Data.Point3d("Pick point", entAlignEventArgs.PickPoint)); + } + + private void + Stream(ArrayList data, IdMappingEventArgs idMapArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(IdMappingEventArgs))); + + data.Add(new Snoop.Data.Object("Id mapping", idMapArgs.IdMapping)); + } + + private void + Stream(ArrayList data, LayerStateDeletedEventArgs layerStateDelArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayerStateDeletedEventArgs))); + + data.Add(new Snoop.Data.Object("Name", layerStateDelArgs.Name)); + } + + private void + Stream(ArrayList data, LayerStateEventArgs layerStateArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayerStateEventArgs))); + + data.Add(new Snoop.Data.ObjectId("Id", layerStateArgs.Id)); + data.Add(new Snoop.Data.String("Name", layerStateArgs.Name)); + } + + private void + Stream(ArrayList data, LayerStateRenameEventArgs layerStateRenArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayerStateRenameEventArgs))); + + data.Add(new Snoop.Data.String("Name", layerStateRenArgs.Name)); + data.Add(new Snoop.Data.String("New name", layerStateRenArgs.NewName)); + } + + private void + Stream(ArrayList data, LayerViewportProperties layerViewportProps) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayerViewportProperties))); + + data.Add(new Snoop.Data.Object("Color", layerViewportProps.Color)); + data.Add(new Snoop.Data.Bool("Is color overridden", layerViewportProps.IsColorOverridden)); + data.Add(new Snoop.Data.Bool("Is linetype overridden", layerViewportProps.IsLinetypeOverridden)); + data.Add(new Snoop.Data.Bool("Is line weight overridden", layerViewportProps.IsLineWeightOverridden)); + data.Add(new Snoop.Data.Bool("Is plot style overridden", layerViewportProps.IsPlotStyleOverridden)); + data.Add(new Snoop.Data.ObjectId("Linetype object Id", layerViewportProps.LinetypeObjectId)); + data.Add(new Snoop.Data.String("Line weight", layerViewportProps.LineWeight.ToString())); + data.Add(new Snoop.Data.String("Plot style name", layerViewportProps.PlotStyleName)); + data.Add(new Snoop.Data.ObjectId("Plot style name Id", layerViewportProps.PlotStyleNameId)); + } + + private void + Stream(ArrayList data, MTextFragment mtextFrag) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MTextFragment))); + + data.Add(new Snoop.Data.String("Big font", mtextFrag.BigFont)); + data.Add(new Snoop.Data.Bool("Bold", mtextFrag.Bold)); + data.Add(new Snoop.Data.Double("Caps height", mtextFrag.CapsHeight)); + data.Add(new Snoop.Data.Object("Color", mtextFrag.Color)); + data.Add(new Snoop.Data.Vector3d("Direction", mtextFrag.Direction)); + data.Add(new Snoop.Data.Point2d("Extents", mtextFrag.Extents)); + data.Add(new Snoop.Data.Point3d("Location", mtextFrag.Location)); + data.Add(new Snoop.Data.Bool("Italic", mtextFrag.Italic)); + data.Add(new Snoop.Data.Vector3d("Normal", mtextFrag.Normal)); + data.Add(new Snoop.Data.Double("Oblique angle", mtextFrag.ObliqueAngle)); + data.Add(new Snoop.Data.Bool("Overlined", mtextFrag.Overlined)); + data.Add(new Snoop.Data.String("Shx font", mtextFrag.ShxFont)); + data.Add(new Snoop.Data.Bool("Stack bottom", mtextFrag.StackBottom)); + data.Add(new Snoop.Data.Bool("Stack top", mtextFrag.StackTop)); + data.Add(new Snoop.Data.String("Text", mtextFrag.Text)); + data.Add(new Snoop.Data.Double("Tracking factor", mtextFrag.TrackingFactor)); + data.Add(new Snoop.Data.String("True type font", mtextFrag.TrueTypeFont)); + data.Add(new Snoop.Data.Bool("Underlined", mtextFrag.Underlined)); + data.Add(new Snoop.Data.Double("Width factor", mtextFrag.WidthFactor)); + } + + private void + Stream(ArrayList data, ObjectClosedEventArgs objClosedArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ObjectClosedEventArgs))); + + data.Add(new Snoop.Data.ObjectId("Id", objClosedArgs.Id)); + } + + private void + Stream(ArrayList data, ObjectErasedEventArgs objErasedArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ObjectErasedEventArgs))); + + data.Add(new Snoop.Data.Object("DBObject", objErasedArgs.DBObject)); + data.Add(new Snoop.Data.Bool("Erased", objErasedArgs.Erased)); + } + + private void + Stream(ArrayList data, ObjectSnapContext objSnapCtxt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ObjectSnapContext))); + + data.Add(new Snoop.Data.Int("Graphics system selection mark", objSnapCtxt.GraphicsSystemSelectionMark)); + data.Add(new Snoop.Data.Point3d("Last point", objSnapCtxt.LastPoint)); + data.Add(new Snoop.Data.Object("Picked object", objSnapCtxt.PickedObject)); + data.Add(new Snoop.Data.Point3d("Pick point", objSnapCtxt.PickPoint)); + data.Add(new Snoop.Data.Object("View transform", objSnapCtxt.ViewTransform)); + } + + private void + Stream(ArrayList data, ObjectSnapInfo objSnapInfo) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ObjectSnapInfo))); + + data.Add(new Snoop.Data.Enumerable("Snap curves", objSnapInfo.SnapCurves)); + data.Add(new Snoop.Data.Enumerable("Snap points", objSnapInfo.SnapPoints)); + } + + private void + Stream(ArrayList data, RevolveOptionsCheckRevolveCurveOut revOptsChkRevCurOut) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RevolveOptionsCheckRevolveCurveOut))); + + data.Add(new Snoop.Data.Bool("Closed", revOptsChkRevCurOut.Closed)); + data.Add(new Snoop.Data.Bool("End points on axis", revOptsChkRevCurOut.EndPointsOnAxis)); + data.Add(new Snoop.Data.Bool("Planar", revOptsChkRevCurOut.Planar)); + } + + private void + Stream(ArrayList data, SweepOptionsCheckSweepCurveOut sweepOptsChkSweepCur) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SweepOptionsCheckSweepCurveOut))); + + data.Add(new Snoop.Data.Double("Approximate arc length", sweepOptsChkSweepCur.ApproximateArcLength)); + data.Add(new Snoop.Data.Bool("Closed", sweepOptsChkSweepCur.Closed)); + data.Add(new Snoop.Data.Object("Planarity", sweepOptsChkSweepCur.Planarity)); + data.Add(new Snoop.Data.Point3d("Point", sweepOptsChkSweepCur.Point)); + data.Add(new Snoop.Data.Vector3d("Vector", sweepOptsChkSweepCur.Vector)); + } + + private void + Stream(ArrayList data, UnderlayFile underlayFile) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(UnderlayFile))); + + data.Add(new Snoop.Data.Enumerable("Items", underlayFile.Items)); + } + + private void + Stream(ArrayList data, UnderlayLayer underlayLayer) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(UnderlayLayer))); + + data.Add(new Snoop.Data.String("Name", underlayLayer.Name)); + data.Add(new Snoop.Data.String("State", underlayLayer.State.ToString())); + } + + private void + Stream(ArrayList data, DataAdapter dataAdapt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DataAdapter))); + + data.Add(new Snoop.Data.String("Data adapter Id", dataAdapt.DataAdapterId)); + data.Add(new Snoop.Data.String("Description", dataAdapt.Description)); + data.Add(new Snoop.Data.String("Name", dataAdapt.Name)); + } + + private void + Stream(ArrayList data, DataCell dataCell) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DataCell))); + + data.Add(new Snoop.Data.String("Cell type", dataCell.CellType.ToString())); + } + + private void + Stream(ArrayList data, DataColumn dataCol) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DataColumn))); + + data.Add(new Snoop.Data.String("Column name", dataCol.ColumnName)); + data.Add(new Snoop.Data.String("Column type", dataCol.ColumnType.ToString())); + data.Add(new Snoop.Data.Int("Number of cells", dataCol.NumCells)); + data.Add(new Snoop.Data.Int("Grow length", dataCol.GrowLength)); + data.Add(new Snoop.Data.Int("Physical length", dataCol.PhysicalLength)); + } + + private void + Stream(ArrayList data, DataLinkManager dataLinkMan) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DataLinkManager))); + + data.Add(new Snoop.Data.Int("Data link count", dataLinkMan.DataLinkCount)); + } + + private void + Stream(ArrayList data, DbDictionaryEnumerator dbDictEnum) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DbDictionaryEnumerator))); + + data.Add(new Snoop.Data.Object("Current", dbDictEnum.Current)); + data.Add(new Snoop.Data.Object("Entry", dbDictEnum.Entry)); + data.Add(new Snoop.Data.String("Key", dbDictEnum.Key)); + data.Add(new Snoop.Data.ObjectId("Value", dbDictEnum.Value)); + } + + private void + Stream(ArrayList data, DwgFiler dwgFiler) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DwgFiler))); + + data.Add(new Snoop.Data.Object("Dwg version", dwgFiler.DwgVersion)); + data.Add(new Snoop.Data.String("Filer status", dwgFiler.FilerStatus.ToString())); + data.Add(new Snoop.Data.String("Filer type", dwgFiler.FilerType.ToString())); + data.Add(new Snoop.Data.Long("Position", dwgFiler.Position)); + } + + private void + Stream(ArrayList data, DxfFiler dxfFiler) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DxfFiler))); + + data.Add(new Snoop.Data.Bool("At embedded object start", dxfFiler.AtEmbeddedObjectStart)); + data.Add(new Snoop.Data.Bool("At end of file", dxfFiler.AtEndOfFile)); + data.Add(new Snoop.Data.Bool("At end of object", dxfFiler.AtEndOfObject)); + data.Add(new Snoop.Data.Bool("At extended data", dxfFiler.AtExtendedData)); + data.Add(new Snoop.Data.Database("Database", dxfFiler.Database)); + data.Add(new Snoop.Data.Object("Dwg version", dxfFiler.DwgVersion)); + data.Add(new Snoop.Data.Double("Elevation", dxfFiler.Elevation)); + data.Add(new Snoop.Data.String("Error message", dxfFiler.ErrorMessage)); + data.Add(new Snoop.Data.String("Filer type", dxfFiler.FilerType.ToString())); + data.Add(new Snoop.Data.Bool("Includes default values", dxfFiler.IncludesDefaultValues)); + data.Add(new Snoop.Data.Bool("Is modifying existing object", dxfFiler.IsModifyingExistingObject)); + data.Add(new Snoop.Data.Int("Precision", dxfFiler.Precision)); + data.Add(new Snoop.Data.Double("Thickness", dxfFiler.Thickness)); + } + + private void + Stream(ArrayList data, IdMapping idMap) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(IdMapping))); + + data.Add(new Snoop.Data.String("Deep clone context", idMap.DeepCloneContext.ToString())); + data.Add(new Snoop.Data.Database("Destination database", idMap.DestinationDatabase)); + data.Add(new Snoop.Data.String("Duplicate record cloning", idMap.DuplicateRecordCloning.ToString())); + data.Add(new Snoop.Data.Database("Original database", idMap.OriginalDatabase)); + } + + private void + Stream(ArrayList data, LayerStateManager stateMgr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayerStateManager))); + + data.Add(new Snoop.Data.String("Last restored layer state", stateMgr.LastRestoredLayerState)); + } + + private void + Stream(ArrayList data, LayoutManager layoutMgr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayoutManager))); + + data.Add(new Snoop.Data.String("Current layout", layoutMgr.CurrentLayout)); + data.Add(new Snoop.Data.Int("Layout count", layoutMgr.LayoutCount)); + } + + private void + Stream(ArrayList data, ObjectContext objContext) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ObjectContext))); + + data.Add(new Snoop.Data.String("Collection name", objContext.CollectionName)); + data.Add(new Snoop.Data.String("Name", objContext.Name)); + } + + private void + Stream(ArrayList data, DatabaseSummaryInfo summaryInfo) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DatabaseSummaryInfo))); + + data.Add(new Snoop.Data.String("Title", summaryInfo.Title)); + data.Add(new Snoop.Data.String("Subject", summaryInfo.Subject)); + data.Add(new Snoop.Data.String("Author", summaryInfo.Author)); + data.Add(new Snoop.Data.String("Comments", summaryInfo.Comments)); + data.Add(new Snoop.Data.String("Keywords", summaryInfo.Keywords)); + data.Add(new Snoop.Data.String("Hyperlink base", summaryInfo.HyperlinkBase)); + data.Add(new Snoop.Data.String("Last saved by", summaryInfo.LastSavedBy)); + data.Add(new Snoop.Data.String("Revision number", summaryInfo.RevisionNumber)); + + System.Collections.IDictionaryEnumerator iter = summaryInfo.CustomProperties; + data.Add(new Snoop.Data.CategorySeparator("Custom Properties")); + while (iter.MoveNext()) { + data.Add(new Snoop.Data.String((string)iter.Key, (string)iter.Value)); + } + } + + private void + Stream(ArrayList data, FullSubentityPath subEntPath) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(FullSubentityPath))); + + data.Add(new Snoop.Data.Object("Subent ID", subEntPath.SubentId)); + data.Add(new Snoop.Data.ObjectIdCollection("Object IDs", subEntPath.GetObjectIds())); + } + + private void + Stream(ArrayList data, SubentityId subEntId) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SubentityId))); + + //data.Add(new Snoop.Data.Int("Index", subEntId.Index)); // TBD: fix JMA + data.Add(new Snoop.Data.String("Type", subEntId.Type.ToString())); + data.Add(new Snoop.Data.Object("Type class", subEntId.TypeClass)); + } + + private void + Stream(ArrayList data, DataTypeParameter dataTypeParam) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DataTypeParameter))); + + data.Add(new Snoop.Data.String("Data type", dataTypeParam.DataType.ToString())); + data.Add(new Snoop.Data.String("Unit type", dataTypeParam.UnitType.ToString())); + } + + private void + Stream(ArrayList data, DBDictionaryEntry dbDictEntry) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DBDictionaryEntry))); + + data.Add(new Snoop.Data.String("Key", dbDictEntry.Key)); + data.Add(new Snoop.Data.ObjectId("Value", dbDictEntry.Value)); + } + + private void + Stream(ArrayList data, FullDwgVersion dwgVer) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(FullDwgVersion))); + + data.Add(new Snoop.Data.Object("Major version", dwgVer.MajorVersion)); + data.Add(new Snoop.Data.Object("Minor version", dwgVer.MinorVersion)); + } + + private void + Stream(ArrayList data, GridPropertyParameter gridPropParam) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(GridPropertyParameter))); + + data.Add(new Snoop.Data.String("PropertyMask", gridPropParam.PropertyMask.ToString())); + data.Add(new Snoop.Data.String("Line style", gridPropParam.LineStyle.ToString())); + data.Add(new Snoop.Data.ObjectId("Line type", gridPropParam.Linetype)); + data.Add(new Snoop.Data.String("Line weight", gridPropParam.LineWeight.ToString())); + data.Add(new Snoop.Data.Object("Color", gridPropParam.Color)); + data.Add(new Snoop.Data.Object("Visibility", gridPropParam.Visibility)); + data.Add(new Snoop.Data.Double("Double line spacing", gridPropParam.DoubleLineSpacing)); + } + + private void + Stream(ArrayList data, MeshPointMap meshPtMap) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MeshPointMap))); + + data.Add(new Snoop.Data.Point2d("Destination point", meshPtMap.DestPoint)); + data.Add(new Snoop.Data.Point2d("Source point", meshPtMap.SourcePoint)); + } + + private void + Stream(ArrayList data, MeshPointMaps meshPtMaps) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MeshPointMaps))); + + data.Add(new Snoop.Data.Enumerable("Destination points", meshPtMaps.DestPonints)); + data.Add(new Snoop.Data.Enumerable("Source points", meshPtMaps.SourcePonints)); // TBD: Property spelt incorrectly + } + + private void + Stream(ArrayList data, Autodesk.AutoCAD.DatabaseServices.Filters.SpatialFilterDefinition spaceFiltDef) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.DatabaseServices.Filters.SpatialFilterDefinition))); + + data.Add(new Snoop.Data.Double("Back clip", spaceFiltDef.BackClip)); + data.Add(new Snoop.Data.Double("Elevation", spaceFiltDef.Elevation)); + data.Add(new Snoop.Data.Bool("Enabled", spaceFiltDef.Enabled)); + data.Add(new Snoop.Data.Double("Front clip", spaceFiltDef.FrontClip)); + data.Add(new Snoop.Data.Vector3d("Normal", spaceFiltDef.Normal)); + + Point2dCollection points = new Point2dCollection(); + points = spaceFiltDef.GetPoints(); + + data.Add(new Snoop.Data.CategorySeparator("Points")); + for (int i = 0; i < points.Count; i++) { + data.Add(new Snoop.Data.Point2d(string.Format("Color [{0}]", i), points[i])); + } + } + + private void + Stream(ArrayList data, Autodesk.AutoCAD.DatabaseServices.Filters.SpatialFilterVolume spaceFiltVol) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.DatabaseServices.Filters.SpatialFilterVolume))); + + data.Add(new Snoop.Data.Point3d("From point", spaceFiltVol.FromPoint)); + data.Add(new Snoop.Data.Point3d("To point", spaceFiltVol.ToPoint)); + data.Add(new Snoop.Data.Vector3d("Up direction", spaceFiltVol.UpDirection)); + data.Add(new Snoop.Data.Vector2d("View field", spaceFiltVol.ViewField)); + } + } +} diff --git a/MgdDbgLibrary/Snoop/CollectorExts/DbObject.cs b/MgdDbgLibrary/Snoop/CollectorExts/DbObject.cs new file mode 100644 index 0000000..651b5e5 --- /dev/null +++ b/MgdDbgLibrary/Snoop/CollectorExts/DbObject.cs @@ -0,0 +1,1211 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + + +using System; +using System.Diagnostics; +using System.Collections; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.DatabaseServices.Filters; + +using MgdDbg.Snoop.Collectors; + +using AcDb = Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.Snoop.CollectorExts { + + /// + /// This is a Snoop Collector Extension object to collect data from DBObjects objects. + /// + + public class DbObject : CollectorExt { + + public + DbObject() + { + } + + protected override void + CollectEvent(object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + // branch to all types we are concerned with + AcDb.DBObject obj = e.ObjToSnoop as AcDb.DBObject; + if (obj != null) { + Stream(snoopCollector.Data(), obj); + return; + } + } + + // main branch for anything derived from DBObject + private void + Stream(ArrayList data, Autodesk.AutoCAD.DatabaseServices.DBObject dbObj) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.DatabaseServices.DBObject))); + + //data.Add(new Snoop.Data.String("ID", dbObj.Id.ToString())); // TBD: Why ID and ObjectId ? + data.Add(new Snoop.Data.String("Object ID", dbObj.ObjectId.ToString())); + data.Add(new Snoop.Data.String("Handle", dbObj.Handle.ToString())); + data.Add(new Snoop.Data.String("Class ID", dbObj.ClassID.ToString())); + //data.Add(new Snoop.Data.ObjectUnknown("ActiveX object", dbObj.AcadObject)); + data.Add(new Snoop.Data.Database("Database", dbObj.Database)); + data.Add(new Snoop.Data.ObjectId("Owner ID", dbObj.OwnerId)); + data.Add(new Snoop.Data.Bool("Has save version override", dbObj.HasSaveVersionOverride)); + data.Add(new Snoop.Data.String("Object birth version", dbObj.ObjectBirthVersion.ToString())); + data.Add(new Snoop.Data.Bool("Is a proxy", dbObj.IsAProxy)); + data.Add(new Snoop.Data.String("Merge style", dbObj.MergeStyle.ToString())); + data.Add(new Snoop.Data.ExtDictId("Extension dictionary", dbObj.ExtensionDictionary)); + data.Add(new Snoop.Data.Object("Xdata", dbObj.XData)); + data.Add(new Snoop.Data.References("References to", dbObj.ObjectId)); + data.Add(new Snoop.Data.ReferencedBy("Referenced by", dbObj.ObjectId)); + //data.Add(new Snoop.Data.Object("Drawable", dbObj.Drawable)); // works but not interesting (just casts back to self) + //data.Add(new Snoop.Data.Object("Undo filer", dbObj.UndoFiler)); // works but always null for our cases + + data.Add(new Snoop.Data.Bool("Has fields", dbObj.HasFields)); + + //data.Add(new Snoop.Data.ObjectCollection("Transient reactors", dbObj.GetReactors())); + data.Add(new Snoop.Data.ObjectIdCollection("Persistent reactor IDs", dbObj.GetPersistentReactorIds())); + + // short-circuit if this is an Entity derived class + AcDb.Entity ent = dbObj as AcDb.Entity; + if (ent != null) + return; + + + DataTable dTable = dbObj as DataTable; + if (dTable != null) { + Stream(data, dTable); + return; + } + + DBDictionary dbDict = dbObj as DBDictionary; + if (dbDict != null) { + Stream(data, dbDict); + return; + } + + Autodesk.AutoCAD.DatabaseServices.Filters.Filter filter = dbObj as Autodesk.AutoCAD.DatabaseServices.Filters.Filter; + if (filter != null) { + Stream(data, filter); + return; + } + + Group group = dbObj as Group; + if (group != null) { + Stream(data, group); + return; + } + + Autodesk.AutoCAD.DatabaseServices.Filters.Index index = dbObj as Autodesk.AutoCAD.DatabaseServices.Filters.Index; + if (index != null) { + Stream(data, index); + return; + } + + PlotSettings ps = dbObj as PlotSettings; + if (ps != null) { + Stream(data, ps); + return; + } + + MlineStyle mlineStyle = dbObj as MlineStyle; + if (mlineStyle != null) { + Stream(data, mlineStyle); + return; + } + + PlaceHolder placeHolder = dbObj as PlaceHolder; + if (placeHolder != null) { + Stream(data, placeHolder); + return; + } + + ProxyObject proxyObj = dbObj as ProxyObject; + if (proxyObj != null) { + Stream(data, proxyObj); + return; + } + + DrawOrderTable drawOrderTbl = dbObj as DrawOrderTable; + if (drawOrderTbl != null) { + Stream(data, drawOrderTbl); + return; + } + + Xrecord xRec = dbObj as Xrecord; + if (xRec != null) { + Stream(data, xRec); + return; + } + + RasterImageDef rasterImgDef = dbObj as RasterImageDef; + if (rasterImgDef != null) { + Stream(data, rasterImgDef); + return; + } + + RasterVariables rasterVars = dbObj as RasterVariables; + if (rasterVars != null) { + Stream(data, rasterVars); + return; + } + + TableStyle tabStyle = dbObj as TableStyle; + if (tabStyle != null) { + Stream(data, tabStyle); + return; + } + + SectionSettings secSettings = dbObj as SectionSettings; + if (secSettings != null) { + Stream(data, secSettings); + return; + } + + SectionManager secMgr = dbObj as SectionManager; + if (secMgr != null) { + Stream(data, secMgr); + return; + } + + UnderlayDefinition ulayDef = dbObj as UnderlayDefinition; + if (ulayDef != null) { + Stream(data, ulayDef); + return; + } + + Background backGrnd = dbObj as Background; + if (backGrnd != null) { + Stream(data, backGrnd); + return; + } + + DBVisualStyle dbVisStyle = dbObj as DBVisualStyle; + if (dbVisStyle != null) { + Stream(data, dbVisStyle); + return; + } + + Sun sun = dbObj as Sun; + if (sun != null) { + Stream(data, sun); + return; + } + + RenderSettings rndrSetngs = dbObj as RenderSettings; + if (rndrSetngs != null) { + Stream(data, rndrSetngs); + return; + } + + RenderEnvironment rndrenv = dbObj as RenderEnvironment; + if (rndrenv != null) { + Stream(data, rndrenv); + return; + } + + RenderGlobal rndrGlobal = dbObj as RenderGlobal; + if (rndrGlobal != null) { + Stream(data, rndrGlobal); + return; + } + + Field field = dbObj as Field; + if (field != null) { + Stream(data, field); + return; + } + + Material mat = dbObj as Material; + if (mat != null) { + Stream(data, mat); + return; + } + + DataLink dataLink = dbObj as DataLink; + if (dataLink != null) { + Stream(data, dataLink); + return; + } + + GeoLocationData geoLocData = dbObj as GeoLocationData; + if (geoLocData != null) { + Stream(data, geoLocData); + return; + } + + MLeaderStyle mleaderStyle = dbObj as MLeaderStyle; + if (mleaderStyle != null) { + Stream(data, mleaderStyle); + return; + } + + LinkedData linkData = dbObj as LinkedData; + if (linkData != null) { + Stream(data, linkData); + return; + } + } + + private void + Stream(ArrayList data, DataTable dTable) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DataTable))); + + data.Add(new Snoop.Data.String("Table name", dTable.TableName)); + data.Add(new Snoop.Data.Int("Number of rows", dTable.NumRows)); + data.Add(new Snoop.Data.Int("Number of rows grow size", dTable.NumRowsGrowSize)); + data.Add(new Snoop.Data.Int("Number of rows physical size", dTable.NumRowsPhysicalSize)); + data.Add(new Snoop.Data.Int("Number of columns", dTable.NumColumns)); + data.Add(new Snoop.Data.Int("Number of columns grow size", dTable.NumColsGrowSize)); + data.Add(new Snoop.Data.Int("Number of columns physical size", dTable.NumColsPhysicalSize)); + + // add all the column objects + ArrayList cols = new ArrayList(); + for (int i = 0; i < dTable.NumColumns; i++) + cols.Add(dTable.GetColumnAt(i)); + data.Add(new Snoop.Data.ObjectCollection("Columns", cols)); + + // add all the row objects + ArrayList rows = new ArrayList(); + for (int i = 0; i < dTable.NumRows; i++) + rows.Add(dTable.GetRowAt(i)); + data.Add(new Snoop.Data.ObjectCollection("Rows", rows)); + } + + #region DBDictionary + private void + Stream(ArrayList data, DBDictionary dbDict) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DBDictionary))); + + data.Add(new Snoop.Data.Int("Count", dbDict.Count)); + + data.Add(new Snoop.Data.String("Merge style", dbDict.MergeStyle.ToString())); + data.Add(new Snoop.Data.Bool("Treat elements as hard", dbDict.TreatElementsAsHard)); + + DictionaryWithDefaultDictionary dict = dbDict as DictionaryWithDefaultDictionary; + if (dict != null) { + Stream(data, dict); + return; + } + } + + private void + Stream(ArrayList data, DictionaryWithDefaultDictionary dict) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DictionaryWithDefaultDictionary))); + + data.Add(new Snoop.Data.ObjectId("Default ID", dict.DefaultId)); + } + #endregion + + #region Filter + private void + Stream(ArrayList data, Autodesk.AutoCAD.DatabaseServices.Filters.Filter filter) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.DatabaseServices.Filters.Filter))); + + data.Add(new Snoop.Data.Object("Index Class", filter.IndexClass)); + + // branch to all known major sub-classes + SpatialFilter spatialFltr = filter as SpatialFilter; + if (spatialFltr != null) { + Stream(data, spatialFltr); + return; + } + + LayerFilter layerFltr = filter as LayerFilter; + if (layerFltr != null) { + Stream(data, layerFltr); + return; + } + } + + private void + Stream(ArrayList data, SpatialFilter spatialFltr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SpatialFilter))); + + data.Add(new Snoop.Data.Object("Definition", spatialFltr.Definition)); + data.Add(new Snoop.Data.Object("Index Class", spatialFltr.IndexClass)); + data.Add(new Snoop.Data.Bool("Has Perspective Camera", spatialFltr.HasPerspectiveCamera)); + data.Add(new Snoop.Data.Object("Extents", spatialFltr.GetQueryBounds())); + data.Add(new Snoop.Data.Object("Volume", spatialFltr.GetVolume())); + } + + private void + Stream(ArrayList data, LayerFilter layerFltr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayerFilter))); + + data.Add(new Snoop.Data.Bool("Is Valid", layerFltr.IsValid)); + data.Add(new Snoop.Data.Object("Index Class", layerFltr.IndexClass)); + data.Add(new Snoop.Data.Int("Layer Count", layerFltr.LayerCount)); + string tmpName = ""; + for (int i = 0; i < layerFltr.LayerCount; i++) { + layerFltr.GetAt(i, tmpName); + data.Add(new Snoop.Data.String(String.Format("Layer [{0}]", i), tmpName)); + } + + } + + #endregion + + private void + Stream(ArrayList data, DrawOrderTable drawOrderTbl) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DrawOrderTable))); + + data.Add(new Snoop.Data.ObjectId("Block ID", drawOrderTbl.BlockId)); + } + + private void + Stream(ArrayList data, Xrecord xRec) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Xrecord))); + + data.Add(new Snoop.Data.Object("Data", xRec.Data)); + data.Add(new Snoop.Data.Bool("Xlate references", xRec.XlateReferences)); + } + + private void + Stream(ArrayList data, Group group) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Group))); + + data.Add(new Snoop.Data.String("Name", group.Name)); + data.Add(new Snoop.Data.String("Description", group.Description)); + data.Add(new Snoop.Data.Bool("Is anonymous", group.IsAnonymous)); + data.Add(new Snoop.Data.Bool("Is not accessible", group.IsNotAccessible)); + data.Add(new Snoop.Data.Bool("Selectable", group.Selectable)); + data.Add(new Snoop.Data.Int("Number of entities", group.NumEntities)); + data.Add(new Snoop.Data.ObjectIdCollection("All entities", group.GetAllEntityIds())); + } + + #region Filters.Index + private void + Stream(ArrayList data, Autodesk.AutoCAD.DatabaseServices.Filters.Index index) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.DatabaseServices.Filters.Index))); + + data.Add(new Snoop.Data.Bool("Is up to date", index.IsUptoDate)); + data.Add(new Snoop.Data.Object("Last updated at", index.LastUpdatedAt)); + data.Add(new Snoop.Data.Object("Last updated at (Universal)", index.LastUpdatedAtU)); + data.Add(new Snoop.Data.ObjectId("Object being indexed", index.ObjectBeingIndexedId)); + + // branch to all known major sub-classes + SpatialIndex spatialIndex = index as SpatialIndex; + if (spatialIndex != null) { + Stream(data, spatialIndex); + return; + } + + LayerIndex layerIndex = index as LayerIndex; + if (layerIndex != null) { + Stream(data, layerIndex); + return; + } + } + + private void + Stream(ArrayList data, SpatialIndex spatialIndex) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SpatialIndex))); + + // no data at this level + } + + private void + Stream(ArrayList data, LayerIndex layerIndex) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayerIndex))); + + // no data at this level + } + #endregion + + #region PlotSettings + private void + Stream(ArrayList data, PlotSettings ps) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PlotSettings))); + + data.Add(new Snoop.Data.String("Canonical media name", ps.CanonicalMediaName)); + data.Add(new Snoop.Data.String("Current style sheet", ps.CurrentStyleSheet)); + data.Add(new Snoop.Data.String("Custom print scale", ps.CustomPrintScale.ToString())); + data.Add(new Snoop.Data.Bool("Draw viewports first", ps.DrawViewportsFirst)); + data.Add(new Snoop.Data.Bool("Model type", ps.ModelType)); + data.Add(new Snoop.Data.Bool("Plot centered", ps.PlotCentered)); + data.Add(new Snoop.Data.String("Plot configuration name", ps.PlotConfigurationName)); + data.Add(new Snoop.Data.Bool("Plot hidden", ps.PlotHidden)); + data.Add(new Snoop.Data.Point2d("Plot origin", ps.PlotOrigin)); + data.Add(new Snoop.Data.String("Plot paper margins", ps.PlotPaperMargins.ToString())); + data.Add(new Snoop.Data.Point2d("Plot paper size", ps.PlotPaperSize)); + data.Add(new Snoop.Data.String("Plot paper units", ps.PlotPaperUnits.ToString())); + data.Add(new Snoop.Data.Bool("Plot plot styles", ps.PlotPlotStyles)); + data.Add(new Snoop.Data.String("Plot rotation", ps.PlotRotation.ToString())); + data.Add(new Snoop.Data.String("Plot settings name", ps.PlotSettingsName)); + data.Add(new Snoop.Data.String("Plot type", ps.PlotType.ToString())); + data.Add(new Snoop.Data.String("Plot view name", ps.PlotViewName)); + data.Add(new Snoop.Data.Bool("Plot viewport borders", ps.PlotViewportBorders)); + data.Add(new Snoop.Data.String("Plot window area", ps.PlotWindowArea.ToString())); + data.Add(new Snoop.Data.Bool("Print lineweights", ps.PrintLineweights)); + data.Add(new Snoop.Data.Bool("Scale lineweights", ps.ScaleLineweights)); + data.Add(new Snoop.Data.String("Shade plot", ps.ShadePlot.ToString())); + data.Add(new Snoop.Data.Int("Shade plot custom dpi", ps.ShadePlotCustomDpi)); + data.Add(new Snoop.Data.String("Shade plot res level", ps.ShadePlotResLevel.ToString())); + data.Add(new Snoop.Data.Bool("Show plot styles", ps.ShowPlotStyles)); + data.Add(new Snoop.Data.Double("Standard scale", ps.StdScale)); + data.Add(new Snoop.Data.String("Standard scale type", ps.StdScaleType.ToString())); + data.Add(new Snoop.Data.Bool("Use standard scale", ps.UseStandardScale)); + + // branch to all known major sub-classes + Layout layout = ps as Layout; + if (layout != null) { + Stream(data, layout); + return; + } + } + + private void + Stream(ArrayList data, Layout layout) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Layout))); + + data.Add(new Snoop.Data.ObjectId("Block table record ID", layout.BlockTableRecordId)); + data.Add(new Snoop.Data.String("Layout name", layout.LayoutName)); + data.Add(new Snoop.Data.Int("Tab order", layout.TabOrder)); + data.Add(new Snoop.Data.Bool("Tab selected", layout.TabSelected)); + data.Add(new Snoop.Data.ObjectIdCollection("Viewports", layout.GetViewports())); + } + #endregion + + private void + Stream(ArrayList data, MlineStyle mlStyle) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MlineStyle))); + + data.Add(new Snoop.Data.String("Name", mlStyle.Name)); + data.Add(new Snoop.Data.String("Description", mlStyle.Description)); + data.Add(new Snoop.Data.Angle("Start angle", mlStyle.StartAngle)); + data.Add(new Snoop.Data.Bool("Start inner arcs", mlStyle.StartInnerArcs)); + data.Add(new Snoop.Data.Bool("Start round cap", mlStyle.StartRoundCap)); + data.Add(new Snoop.Data.Bool("Start square cap", mlStyle.StartSquareCap)); + data.Add(new Snoop.Data.Angle("End angle", mlStyle.EndAngle)); + data.Add(new Snoop.Data.Bool("End inner arcs", mlStyle.EndInnerArcs)); + data.Add(new Snoop.Data.Bool("End round cap", mlStyle.EndRoundCap)); + data.Add(new Snoop.Data.Bool("End square cap", mlStyle.EndSquareCap)); + data.Add(new Snoop.Data.Bool("Filled", mlStyle.Filled)); + data.Add(new Snoop.Data.ObjectToString("Fill color", mlStyle.FillColor)); + data.Add(new Snoop.Data.Bool("Show miters", mlStyle.ShowMiters)); + data.Add(new Snoop.Data.ObjectCollection("Elements", (System.Collections.ICollection)mlStyle.Elements)); + } + + private void + Stream(ArrayList data, PlaceHolder placeHolder) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PlaceHolder))); + + // no data here + } + + private void + Stream(ArrayList data, ProxyObject proxyObj) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ProxyObject))); + + data.Add(new Snoop.Data.String("Application description", proxyObj.ApplicationDescription)); + data.Add(new Snoop.Data.String("Original class name", proxyObj.OriginalClassName)); + data.Add(new Snoop.Data.String("Original DXF name", proxyObj.OriginalDxfName)); + data.Add(new Snoop.Data.Int("Proxy flags", proxyObj.ProxyFlags)); + data.Add(new Snoop.Data.ObjectCollection("References", proxyObj.GetReferences())); + } + + private void + Stream(ArrayList data, Material mat) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Material))); + + data.Add(new Snoop.Data.String("Name", mat.Name)); + data.Add(new Snoop.Data.String("Description", mat.Description)); + data.Add(new Snoop.Data.Object("Ambient", mat.Ambient)); + data.Add(new Snoop.Data.Object("Bump", mat.Bump)); + data.Add(new Snoop.Data.Object("Diffuse", mat.Diffuse)); + data.Add(new Snoop.Data.Object("Opacity", mat.Opacity)); + data.Add(new Snoop.Data.Object("Reflection", mat.Reflection)); + data.Add(new Snoop.Data.Double("Reflectivity", mat.Reflectivity)); + data.Add(new Snoop.Data.Object("Refraction", mat.Refraction)); + data.Add(new Snoop.Data.Object("Specular", mat.Specular)); + data.Add(new Snoop.Data.String("Channel flags", mat.ChannelFlags.ToString())); + data.Add(new Snoop.Data.String("Illumination model", mat.IlluminationModel.ToString())); + data.Add(new Snoop.Data.String("Mode", mat.Mode.ToString())); + data.Add(new Snoop.Data.Double("Self illumination", mat.SelfIllumination)); + data.Add(new Snoop.Data.Double("Translucence", mat.Translucence)); + } + + private void + Stream(ArrayList data, DataLink dataLink) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DataLink))); + + data.Add(new Snoop.Data.String("Connection string", dataLink.ConnectionString)); + data.Add(new Snoop.Data.String("Data adapter Id", dataLink.DataAdapterId)); + data.Add(new Snoop.Data.String("Data link option", dataLink.DataLinkOption.ToString())); + data.Add(new Snoop.Data.String("Description", dataLink.Description)); + data.Add(new Snoop.Data.Bool("Is valid", dataLink.IsValid)); + data.Add(new Snoop.Data.String("Name", dataLink.Name)); + data.Add(new Snoop.Data.String("Tool tip", dataLink.ToolTip)); + data.Add(new Snoop.Data.Int("Update option", dataLink.UpdateOption)); + } + + private void + Stream(ArrayList data, GeoLocationData geoLocData) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(GeoLocationData))); + + data.Add(new Snoop.Data.ObjectId("Block table record Id", geoLocData.BlockTableRecordId)); + data.Add(new Snoop.Data.Double("Coordinate projection radius", geoLocData.CoordinateProjectionRadius)); + data.Add(new Snoop.Data.String("Coordinate system", geoLocData.CoordinateSystem)); + data.Add(new Snoop.Data.Point3d("Design point", geoLocData.DesignPoint)); + data.Add(new Snoop.Data.Bool("Do sea level correction", geoLocData.DoSeaLevelCorrection)); + data.Add(new Snoop.Data.String("Geo RSS tag", geoLocData.GeoRSSTag)); + data.Add(new Snoop.Data.String("Horizontal units", geoLocData.HorizontalUnits.ToString())); + data.Add(new Snoop.Data.Double("North direction", geoLocData.NorthDirection)); + data.Add(new Snoop.Data.Vector2d("North direction vector", geoLocData.NorthDirectionVector)); + data.Add(new Snoop.Data.Int("Num mesh points", geoLocData.NumMeshPoints)); + data.Add(new Snoop.Data.Point3d("Reference point", geoLocData.ReferencePoint)); + data.Add(new Snoop.Data.String("Scale estimation method", geoLocData.ScaleEstimationMethod.ToString())); + data.Add(new Snoop.Data.Double("Scale factor", geoLocData.ScaleFactor)); + data.Add(new Snoop.Data.Distance("Sea level elevation", geoLocData.SeaLevelElevation)); + data.Add(new Snoop.Data.String("Type of coordinates", geoLocData.TypeOfCoordinates.ToString())); + data.Add(new Snoop.Data.String("Vertical units", geoLocData.VerticalUnits.ToString())); + data.Add(new Snoop.Data.Double("Vertical units scale", geoLocData.VerticalUnitsScale)); + } + + + private void + Stream(ArrayList data, DBVisualStyle viz) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DBVisualStyle))); + + data.Add(new Snoop.Data.String("Description", viz.Description)); + /*data.Add(new Snoop.Data.Object("Display style", viz.DisplayStyle)); + data.Add(new Snoop.Data.Object("Edge style", viz.EdgeStyle)); + data.Add(new Snoop.Data.Object("Face style", viz.FaceStyle));*/ // TBD: Fix JMA + data.Add(new Snoop.Data.String("Type", viz.Type.ToString())); + data.Add(new Snoop.Data.Bool("Internal use only", viz.InternalUseOnly)); + } + + private void + Stream(ArrayList data, UnderlayDefinition underlayDef) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(UnderlayDefinition))); + + data.Add(new Snoop.Data.String("Source file name", underlayDef.SourceFileName)); + data.Add(new Snoop.Data.String("Active file name", underlayDef.ActiveFileName)); + data.Add(new Snoop.Data.Bool("Loaded", underlayDef.Loaded)); + data.Add(new Snoop.Data.String("Item name", underlayDef.ItemName)); + data.Add(new Snoop.Data.Object("Underlay item", underlayDef.UnderlayItem)); + + DgnDefinition dgnDef = underlayDef as DgnDefinition; + if (dgnDef != null) { + Stream(data, dgnDef); + return; + } + + DwfDefinition dwfDef = underlayDef as DwfDefinition; + if (dwfDef != null) { + Stream(data, dwfDef); + return; + } + } + + private void + Stream(ArrayList data, DgnDefinition underlayDef) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DgnDefinition))); + + // no data at this level + } + + private void + Stream(ArrayList data, DwfDefinition underlayDef) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DwfDefinition))); + + // no data at this level + } + + + #region Background + private void + Stream(ArrayList data, Background backGrnd) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Background))); + + /// No data here!! + + SolidBackground solBackGrnd = backGrnd as SolidBackground; + if (solBackGrnd != null) { + Stream(data, solBackGrnd); + return; + } + + GradientBackground gradBackGrnd = backGrnd as GradientBackground; + if (gradBackGrnd != null) { + Stream(data, gradBackGrnd); + return; + } + + ImageBackground imgBackGrnd = backGrnd as ImageBackground; + if (imgBackGrnd != null) { + Stream(data, imgBackGrnd); + return; + } + + GroundPlaneBackground grndPlaneBackGrnd = backGrnd as GroundPlaneBackground; + if (grndPlaneBackGrnd != null) { + Stream(data, grndPlaneBackGrnd); + return; + } + + SkyBackground skyBackGrnd = backGrnd as SkyBackground; + if (skyBackGrnd != null) { + Stream(data, skyBackGrnd); + return; + } + } + + private void + Stream(ArrayList data, SolidBackground solBackGrnd) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SolidBackground))); + + data.Add(new Snoop.Data.Object("Color", solBackGrnd.Color)); + } + + private void + Stream(ArrayList data, GradientBackground gradBackGrnd) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(GradientBackground))); + + data.Add(new Snoop.Data.Object("Color bottom", gradBackGrnd.ColorBottom)); + data.Add(new Snoop.Data.Object("Color middle", gradBackGrnd.ColorMiddle)); + data.Add(new Snoop.Data.Object("Color top", gradBackGrnd.ColorTop)); + data.Add(new Snoop.Data.Distance("Height", gradBackGrnd.Height)); + data.Add(new Snoop.Data.Distance("Horizon", gradBackGrnd.Horizon)); + data.Add(new Snoop.Data.Angle("Rotation", gradBackGrnd.Rotation)); + } + + private void + Stream(ArrayList data, ImageBackground imgBackGrnd) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ImageBackground))); + + data.Add(new Snoop.Data.Bool("Fit to screen", imgBackGrnd.FitToScreen)); + data.Add(new Snoop.Data.String("Image file name", imgBackGrnd.ImageFileName)); + data.Add(new Snoop.Data.Bool("Maintain aspect ratio", imgBackGrnd.MaintainAspectRatio)); + data.Add(new Snoop.Data.Vector2d("Offset", imgBackGrnd.Offset)); + data.Add(new Snoop.Data.Scale2d("Scale", imgBackGrnd.Scale)); + data.Add(new Snoop.Data.Bool("Use tiling", imgBackGrnd.UseTiling)); + } + + private void + Stream(ArrayList data, GroundPlaneBackground grndPlaneBackGrnd) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(GroundPlaneBackground))); + + data.Add(new Snoop.Data.Object("Color ground plane far", grndPlaneBackGrnd.ColorGroundPlaneFar)); + data.Add(new Snoop.Data.Object("Color ground plane near", grndPlaneBackGrnd.ColorGroundPlaneNear)); + data.Add(new Snoop.Data.Object("Color sky horizon", grndPlaneBackGrnd.ColorSkyHorizon)); + data.Add(new Snoop.Data.Object("Color underground azimuth", grndPlaneBackGrnd.ColorUndergroundAzimuth)); + data.Add(new Snoop.Data.Object("Color underground horizon", grndPlaneBackGrnd.ColorUndergroundHorizon)); + } + + private void + Stream(ArrayList data, SkyBackground skyBackGrnd) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(GroundPlaneBackground))); + + data.Add(new Snoop.Data.ObjectId("Sun Id", skyBackGrnd.SunId)); + } + #endregion + + + private void + Stream(ArrayList data, Sun sun) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Sun))); + + data.Add(new Snoop.Data.Bool("Is on", sun.IsOn)); + data.Add(new Snoop.Data.Object("Date Time", sun.DateTime)); + data.Add(new Snoop.Data.Bool("Is daylight savings on", sun.IsDaylightSavingsOn)); + data.Add(new Snoop.Data.Double("Altitude", sun.Altitude)); + data.Add(new Snoop.Data.Double("Azimuth", sun.Azimuth)); + data.Add(new Snoop.Data.Double("Intensity", sun.Intensity)); + data.Add(new Snoop.Data.Object("Shadow parameters", sun.ShadowParameters)); + data.Add(new Snoop.Data.Object("Sun color", sun.SunColor)); + data.Add(new Snoop.Data.Vector3d("Sun direction", sun.SunDirection)); + } + + #region RenderSettings + private void + Stream(ArrayList data, RenderSettings rndrSetngs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RenderSettings))); + + data.Add(new Snoop.Data.String("Name", rndrSetngs.Name)); + data.Add(new Snoop.Data.String("Description", rndrSetngs.Description)); + data.Add(new Snoop.Data.String("Preview image filename", rndrSetngs.PreviewImageFileName)); + data.Add(new Snoop.Data.Int("Display index", rndrSetngs.DisplayIndex)); + data.Add(new Snoop.Data.Bool("Back faces enabled", rndrSetngs.BackFacesEnabled)); + data.Add(new Snoop.Data.Bool("Diagnostic background enabled", rndrSetngs.DiagnosticBackgroundEnabled)); + data.Add(new Snoop.Data.Bool("Materials enabled", rndrSetngs.MaterialsEnabled)); + data.Add(new Snoop.Data.Bool("Shadows enabled", rndrSetngs.ShadowsEnabled)); + data.Add(new Snoop.Data.Bool("Texture sampling", rndrSetngs.TextureSampling)); + + //MentalRayRenderSettings mRayRndrStngs = rndrSetngs as MentalRayRenderSettings; + //if (mRayRndrStngs != null) { + // Stream(data, mRayRndrStngs); + // return; + //} + } + + /* private void + Stream(ArrayList data, MentalRayRenderSettings mRayRndrStngs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MentalRayRenderSettings))); + + data.Add(new Snoop.Data.String("Diagnostic BSP mode", mRayRndrStngs.DiagnosticBSPMode.ToString())); + data.Add(new Snoop.Data.String("Diagnostic grid mode", mRayRndrStngs.DiagnosticGridMode.Mode.ToString())); + data.Add(new Snoop.Data.Double("Diagnostic grid mode size", mRayRndrStngs.DiagnosticGridMode.Size)); + data.Add(new Snoop.Data.String("Diagnostic mode", mRayRndrStngs.DiagnosticMode.ToString())); + data.Add(new Snoop.Data.String("Diagnostic photon mode", mRayRndrStngs.DiagnosticPhotonMode.ToString())); + data.Add(new Snoop.Data.Double("Energy multiplier", mRayRndrStngs.EnergyMultiplier)); + data.Add(new Snoop.Data.Bool("Export MI enabled", mRayRndrStngs.ExportMIEnabled)); + data.Add(new Snoop.Data.String("Export MI filename", mRayRndrStngs.ExportMIFileName)); + data.Add(new Snoop.Data.Int("FG ray count", mRayRndrStngs.FGRayCount)); + data.Add(new Snoop.Data.Double("FG sample radius (max)", mRayRndrStngs.FGSampleRadius.Max)); + data.Add(new Snoop.Data.Double("FG sample radius (min)", mRayRndrStngs.FGSampleRadius.Min)); + data.Add(new Snoop.Data.Bool("FG sample radius state (max)", mRayRndrStngs.FGSampleRadiusState.Max)); + data.Add(new Snoop.Data.Bool("FG sample radius state (min)", mRayRndrStngs.FGSampleRadiusState.Min)); + data.Add(new Snoop.Data.Bool("FG sample radius state (pixels)", mRayRndrStngs.FGSampleRadiusState.Pixels)); + data.Add(new Snoop.Data.Bool("Final gathering enabled", mRayRndrStngs.FinalGatheringEnabled)); + data.Add(new Snoop.Data.Int("GI photons per light", mRayRndrStngs.GIPhotonsPerLight)); + data.Add(new Snoop.Data.Int("GI sample count", mRayRndrStngs.GISampleCount)); + data.Add(new Snoop.Data.Double("GI sample radius", mRayRndrStngs.GISampleRadius)); + data.Add(new Snoop.Data.Bool("GI sample radius enabled", mRayRndrStngs.GISampleRadiusEnabled)); + data.Add(new Snoop.Data.Bool("Global illumination enabled", mRayRndrStngs.GlobalIlluminationEnabled)); + data.Add(new Snoop.Data.Int("Memory limit", mRayRndrStngs.MemoryLimit)); + data.Add(new Snoop.Data.Int("Photon trace depth (reflection)", mRayRndrStngs.PhotonTraceDepth.Reflection)); + data.Add(new Snoop.Data.Int("Photon trace depth (refraction)", mRayRndrStngs.PhotonTraceDepth.Refraction)); + data.Add(new Snoop.Data.Int("Photon trace depth (sum)", mRayRndrStngs.PhotonTraceDepth.Sum)); + data.Add(new Snoop.Data.Int("Ray trace depth (reflection)", mRayRndrStngs.RayTraceDepth.Reflection)); + data.Add(new Snoop.Data.Int("Ray trace depth (refraction)", mRayRndrStngs.RayTraceDepth.Refraction)); + data.Add(new Snoop.Data.Int("Ray trace depth (sum)", mRayRndrStngs.RayTraceDepth.Sum)); + data.Add(new Snoop.Data.Bool("Ray tracing Enabled", mRayRndrStngs.RayTracingEnabled)); + data.Add(new Snoop.Data.Int("Sampling (max)", mRayRndrStngs.Sampling.Max)); + data.Add(new Snoop.Data.Int("Sampling (min)", mRayRndrStngs.Sampling.Min)); + data.Add(new Snoop.Data.Double("Sampling contrast color (A)", mRayRndrStngs.SamplingContrastColor.A)); + data.Add(new Snoop.Data.Double("Sampling contrast color (B)", mRayRndrStngs.SamplingContrastColor.B)); + data.Add(new Snoop.Data.Double("Sampling contrast color (G)", mRayRndrStngs.SamplingContrastColor.G)); + data.Add(new Snoop.Data.Double("Sampling contrast color (R)", mRayRndrStngs.SamplingContrastColor.R)); + data.Add(new Snoop.Data.String("Sampling filter", mRayRndrStngs.SamplingFilter.Filter.ToString())); + data.Add(new Snoop.Data.Double("Sampling filter height", mRayRndrStngs.SamplingFilter.Height)); + data.Add(new Snoop.Data.Double("Sampling filter width", mRayRndrStngs.SamplingFilter.Width)); + data.Add(new Snoop.Data.Bool("Shadow maps enabled", mRayRndrStngs.ShadowMapsEnabled)); + data.Add(new Snoop.Data.String("Shadow mode", mRayRndrStngs.ShadowMode.ToString())); + data.Add(new Snoop.Data.String("Tile order", mRayRndrStngs.TileOrder.ToString())); + data.Add(new Snoop.Data.Int("Tile size", mRayRndrStngs.TileSize)); + }*/ + #endregion + + private void + Stream(ArrayList data, RenderEnvironment rndrEnv) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RenderEnvironment))); + + data.Add(new Snoop.Data.Double("Distances (near)", rndrEnv.Distances.Near)); + data.Add(new Snoop.Data.Double("Distances (far)", rndrEnv.Distances.Far)); + data.Add(new Snoop.Data.Bool("Environment image enabled", rndrEnv.EnvironmentImageEnabled)); + data.Add(new Snoop.Data.String("Environment image filename", rndrEnv.EnvironmentImageFileName)); + data.Add(new Snoop.Data.Bool("Fog background enabled", rndrEnv.FogBackgroundEnabled)); + data.Add(new Snoop.Data.Object("Fog color", rndrEnv.FogColor)); + data.Add(new Snoop.Data.Double("Fog density (near)", rndrEnv.FogDensity.Near)); + data.Add(new Snoop.Data.Double("Fog density (rar)", rndrEnv.FogDensity.Far)); + data.Add(new Snoop.Data.Bool("Fog enabled", rndrEnv.FogEnabled)); + } + + private void + Stream(ArrayList data, RenderGlobal rndrGlobal) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RenderGlobal))); + + data.Add(new Snoop.Data.Int("Dimensions (height)", rndrGlobal.Dimensions.Height)); + data.Add(new Snoop.Data.Int("Dimensions (width)", rndrGlobal.Dimensions.Width)); + data.Add(new Snoop.Data.Bool("High info level", rndrGlobal.HighInfoLevel)); + data.Add(new Snoop.Data.Bool("Predefined presets first", rndrGlobal.PredefinedPresetsFirst)); + data.Add(new Snoop.Data.String("Destination", rndrGlobal.ProcedureAndDestination.Destination.ToString())); + data.Add(new Snoop.Data.String("Procedure", rndrGlobal.ProcedureAndDestination.Procedure.ToString())); + data.Add(new Snoop.Data.Bool("Save enabled", rndrGlobal.SaveEnabled)); + data.Add(new Snoop.Data.String("Save filename", rndrGlobal.SaveFileName)); + } + + private void + Stream(ArrayList data, Field field) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Field))); + + data.Add(new Snoop.Data.String("Data type", field.DataType.ToString())); + data.Add(new Snoop.Data.String("Evaluation option", field.EvaluationOption.ToString())); + data.Add(new Snoop.Data.Object("Evaluation status", field.EvaluationStatus)); + data.Add(new Snoop.Data.String("Evaluator ID", field.EvaluatorId)); + data.Add(new Snoop.Data.String("Filing option", field.FilingOption.ToString())); + data.Add(new Snoop.Data.String("Format", field.Format)); + data.Add(new Snoop.Data.Object("Hyper Link", field.HyperLink)); + data.Add(new Snoop.Data.Bool("Is Text Field", field.IsTextField)); + data.Add(new Snoop.Data.String("State", field.State.ToString())); + data.Add(new Snoop.Data.Object("Value", field.Value)); + data.Add(new Snoop.Data.String("Field code", field.GetFieldCode())); + data.Add(new Snoop.Data.String("String value", field.GetStringValue())); + data.Add(new Snoop.Data.ObjectCollection("Children", field.GetChildren())); + } + + private void + Stream(ArrayList data, RasterImageDef rasterImgDef) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RasterImageDef))); + + data.Add(new Snoop.Data.String("Active file name", rasterImgDef.ActiveFileName)); + data.Add(new Snoop.Data.String("Source file name", rasterImgDef.SourceFileName)); + // Throws an Internal Error: eNotOpenForWrite and crashes + //data.Add(new Snoop.Data.String("Search for active path", rasterImgDef.SearchForActivePath)); + data.Add(new Snoop.Data.Int("Color depth", rasterImgDef.ColorDepth)); + data.Add(new Snoop.Data.String("File type", rasterImgDef.FileType)); + data.Add(new Snoop.Data.Bool("Image modified", rasterImgDef.ImageModified)); + data.Add(new Snoop.Data.Bool("Is embedded", rasterImgDef.IsEmbedded)); + data.Add(new Snoop.Data.Bool("Is loaded", rasterImgDef.IsLoaded)); + data.Add(new Snoop.Data.String("Organization", rasterImgDef.Organization.ToString())); + data.Add(new Snoop.Data.Vector2d("Resolution mm per pixel", rasterImgDef.ResolutionMMPerPixel)); + data.Add(new Snoop.Data.String("Resolution units", rasterImgDef.ResolutionUnits.ToString())); + data.Add(new Snoop.Data.Vector2d("Size", rasterImgDef.Size)); + data.Add(new Snoop.Data.Int("Undo store size", rasterImgDef.UndoStoreSize)); + } + + private void + Stream(ArrayList data, RasterVariables rasterVars) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RasterVariables))); + + data.Add(new Snoop.Data.String("Image frame", rasterVars.ImageFrame.ToString())); + data.Add(new Snoop.Data.String("Image quality", rasterVars.ImageQuality.ToString())); + data.Add(new Snoop.Data.String("User scale", rasterVars.UserScale.ToString())); + } + + private void + Stream(ArrayList data, TableStyle tabStyle) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(TableStyle))); + + data.Add(new Snoop.Data.Int("Bit flags", tabStyle.BitFlags)); + data.Add(new Snoop.Data.String("Description", tabStyle.Description)); + data.Add(new Snoop.Data.String("Flow eirection", tabStyle.FlowDirection.ToString())); + data.Add(new Snoop.Data.Double("Horizontal cell margin", tabStyle.HorizontalCellMargin)); + data.Add(new Snoop.Data.Double("Vertical cell margin", tabStyle.VerticalCellMargin)); + data.Add(new Snoop.Data.Bool("Is header suppressed", tabStyle.IsHeaderSuppressed)); + data.Add(new Snoop.Data.Bool("Is title suppressed", tabStyle.IsTitleSuppressed)); + + data.Add(new Snoop.Data.CategorySeparator("Data row")); + data.Add(new Snoop.Data.ObjectId("Text style", tabStyle.TextStyle(RowType.DataRow))); + data.Add(new Snoop.Data.Double("Text height", tabStyle.TextHeight(RowType.DataRow))); + data.Add(new Snoop.Data.String("Alignment", tabStyle.Alignment(RowType.DataRow).ToString())); + data.Add(new Snoop.Data.Object("Color", tabStyle.Color(RowType.DataRow))); + data.Add(new Snoop.Data.Object("Background color", tabStyle.BackgroundColor(RowType.DataRow))); + data.Add(new Snoop.Data.Bool("Is Background color None", tabStyle.IsBackgroundColorNone(RowType.DataRow))); + + data.Add(new Snoop.Data.CategorySeparator("Header row")); + data.Add(new Snoop.Data.ObjectId("Text style", tabStyle.TextStyle(RowType.HeaderRow))); + data.Add(new Snoop.Data.Double("Text height", tabStyle.TextHeight(RowType.HeaderRow))); + data.Add(new Snoop.Data.String("Alignment", tabStyle.Alignment(RowType.HeaderRow).ToString())); + data.Add(new Snoop.Data.Object("Color", tabStyle.Color(RowType.HeaderRow))); + data.Add(new Snoop.Data.Object("Background color", tabStyle.BackgroundColor(RowType.HeaderRow))); + data.Add(new Snoop.Data.Bool("Is Background color none", tabStyle.IsBackgroundColorNone(RowType.HeaderRow))); + + data.Add(new Snoop.Data.CategorySeparator("Title row")); + data.Add(new Snoop.Data.ObjectId("Text style", tabStyle.TextStyle(RowType.TitleRow))); + data.Add(new Snoop.Data.Double("Text height", tabStyle.TextHeight(RowType.TitleRow))); + data.Add(new Snoop.Data.String("Alignment", tabStyle.Alignment(RowType.TitleRow).ToString())); + data.Add(new Snoop.Data.Object("Color", tabStyle.Color(RowType.TitleRow))); + data.Add(new Snoop.Data.Object("Background color", tabStyle.BackgroundColor(RowType.TitleRow))); + data.Add(new Snoop.Data.Bool("Is background color none", tabStyle.IsBackgroundColorNone(RowType.TitleRow))); + + data.Add(new Snoop.Data.CategorySeparator("Gridline Colors")); + data.Add(new Snoop.Data.Object("Data Row - Horizontal Bottom", tabStyle.GridColor(GridLineType.HorizontalBottom, RowType.DataRow))); + data.Add(new Snoop.Data.Object("Data Row - Horizontal Inside", tabStyle.GridColor(GridLineType.HorizontalInside, RowType.DataRow))); + data.Add(new Snoop.Data.Object("Data Row - Horizontal Top", tabStyle.GridColor(GridLineType.HorizontalTop, RowType.DataRow))); + data.Add(new Snoop.Data.Object("Data Row - Vertical Inside", tabStyle.GridColor(GridLineType.VerticalInside, RowType.DataRow))); + data.Add(new Snoop.Data.Object("Data Row - Vertical Left", tabStyle.GridColor(GridLineType.VerticalLeft, RowType.DataRow))); + data.Add(new Snoop.Data.Object("Data Row - Vertical Right", tabStyle.GridColor(GridLineType.VerticalRight, RowType.DataRow))); + + data.Add(new Snoop.Data.Object("Header Row - Horizontal Bottom", tabStyle.GridColor(GridLineType.HorizontalBottom, RowType.HeaderRow))); + data.Add(new Snoop.Data.Object("Header Row - Horizontal Inside", tabStyle.GridColor(GridLineType.HorizontalInside, RowType.HeaderRow))); + data.Add(new Snoop.Data.Object("Header Row - Horizontal Top", tabStyle.GridColor(GridLineType.HorizontalTop, RowType.HeaderRow))); + data.Add(new Snoop.Data.Object("Header Row - Vertical Inside", tabStyle.GridColor(GridLineType.VerticalInside, RowType.HeaderRow))); + data.Add(new Snoop.Data.Object("Header Row - Vertical Left", tabStyle.GridColor(GridLineType.VerticalLeft, RowType.HeaderRow))); + data.Add(new Snoop.Data.Object("Header Row - Vertical Right", tabStyle.GridColor(GridLineType.VerticalRight, RowType.HeaderRow))); + + data.Add(new Snoop.Data.Object("TitleRow - Horizontal Bottom", tabStyle.GridColor(GridLineType.HorizontalBottom, RowType.TitleRow))); + data.Add(new Snoop.Data.Object("TitleRow - Horizontal Inside", tabStyle.GridColor(GridLineType.HorizontalInside, RowType.TitleRow))); + data.Add(new Snoop.Data.Object("TitleRow - Horizontal Top", tabStyle.GridColor(GridLineType.HorizontalTop, RowType.TitleRow))); + data.Add(new Snoop.Data.Object("TitleRow - Vertical Inside", tabStyle.GridColor(GridLineType.VerticalInside, RowType.TitleRow))); + data.Add(new Snoop.Data.Object("TitleRow - Vertical Left", tabStyle.GridColor(GridLineType.VerticalLeft, RowType.TitleRow))); + data.Add(new Snoop.Data.Object("TitleRow - Vertical Right", tabStyle.GridColor(GridLineType.VerticalRight, RowType.TitleRow))); + + data.Add(new Snoop.Data.CategorySeparator("Gridline Weight")); + data.Add(new Snoop.Data.Object("Data Row - Horizontal Bottom", tabStyle.GridLineWeight(GridLineType.HorizontalBottom, RowType.DataRow))); + data.Add(new Snoop.Data.Object("Data Row - Horizontal Inside", tabStyle.GridLineWeight(GridLineType.HorizontalInside, RowType.DataRow))); + data.Add(new Snoop.Data.Object("Data Row - Horizontal Top", tabStyle.GridLineWeight(GridLineType.HorizontalTop, RowType.DataRow))); + data.Add(new Snoop.Data.Object("Data Row - Vertical Inside", tabStyle.GridLineWeight(GridLineType.VerticalInside, RowType.DataRow))); + data.Add(new Snoop.Data.Object("Data Row - Vertical Left", tabStyle.GridLineWeight(GridLineType.VerticalLeft, RowType.DataRow))); + data.Add(new Snoop.Data.Object("Data Row - Vertical Right", tabStyle.GridLineWeight(GridLineType.VerticalRight, RowType.DataRow))); + + data.Add(new Snoop.Data.Object("Header Row - Horizontal Bottom", tabStyle.GridLineWeight(GridLineType.HorizontalBottom, RowType.HeaderRow))); + data.Add(new Snoop.Data.Object("Header Row - Horizontal Inside", tabStyle.GridLineWeight(GridLineType.HorizontalInside, RowType.HeaderRow))); + data.Add(new Snoop.Data.Object("Header Row - Horizontal Top", tabStyle.GridLineWeight(GridLineType.HorizontalTop, RowType.HeaderRow))); + data.Add(new Snoop.Data.Object("Header Row - Vertical Inside", tabStyle.GridLineWeight(GridLineType.VerticalInside, RowType.HeaderRow))); + data.Add(new Snoop.Data.Object("Header Row - Vertical Left", tabStyle.GridLineWeight(GridLineType.VerticalLeft, RowType.HeaderRow))); + data.Add(new Snoop.Data.Object("Header Row - Vertical Right", tabStyle.GridLineWeight(GridLineType.VerticalRight, RowType.HeaderRow))); + + data.Add(new Snoop.Data.Object("TitleRow - Horizontal Bottom", tabStyle.GridLineWeight(GridLineType.HorizontalBottom, RowType.TitleRow))); + data.Add(new Snoop.Data.Object("TitleRow - Horizontal Inside", tabStyle.GridLineWeight(GridLineType.HorizontalInside, RowType.TitleRow))); + data.Add(new Snoop.Data.Object("TitleRow - Horizontal Top", tabStyle.GridLineWeight(GridLineType.HorizontalTop, RowType.TitleRow))); + data.Add(new Snoop.Data.Object("TitleRow - Vertical Inside", tabStyle.GridLineWeight(GridLineType.VerticalInside, RowType.TitleRow))); + data.Add(new Snoop.Data.Object("TitleRow - Vertical Left", tabStyle.GridLineWeight(GridLineType.VerticalLeft, RowType.TitleRow))); + data.Add(new Snoop.Data.Object("TitleRow - Vertical Right", tabStyle.GridLineWeight(GridLineType.VerticalRight, RowType.TitleRow))); + + data.Add(new Snoop.Data.CategorySeparator("Gridline Visibility")); + data.Add(new Snoop.Data.Bool("Data Row - Horizontal Bottom", tabStyle.GridVisibility(GridLineType.HorizontalBottom, RowType.DataRow))); + data.Add(new Snoop.Data.Bool("Data Row - Horizontal Inside", tabStyle.GridVisibility(GridLineType.HorizontalInside, RowType.DataRow))); + data.Add(new Snoop.Data.Bool("Data Row - Horizontal Top", tabStyle.GridVisibility(GridLineType.HorizontalTop, RowType.DataRow))); + data.Add(new Snoop.Data.Bool("Data Row - Vertical Inside", tabStyle.GridVisibility(GridLineType.VerticalInside, RowType.DataRow))); + data.Add(new Snoop.Data.Bool("Data Row - Vertical Left", tabStyle.GridVisibility(GridLineType.VerticalLeft, RowType.DataRow))); + data.Add(new Snoop.Data.Bool("Data Row - Vertical Right", tabStyle.GridVisibility(GridLineType.VerticalRight, RowType.DataRow))); + + data.Add(new Snoop.Data.Bool("Header Row - Horizontal Bottom", tabStyle.GridVisibility(GridLineType.HorizontalBottom, RowType.HeaderRow))); + data.Add(new Snoop.Data.Bool("Header Row - Horizontal Inside", tabStyle.GridVisibility(GridLineType.HorizontalInside, RowType.HeaderRow))); + data.Add(new Snoop.Data.Bool("Header Row - Horizontal Top", tabStyle.GridVisibility(GridLineType.HorizontalTop, RowType.HeaderRow))); + data.Add(new Snoop.Data.Bool("Header Row - Vertical Inside", tabStyle.GridVisibility(GridLineType.VerticalInside, RowType.HeaderRow))); + data.Add(new Snoop.Data.Bool("Header Row - Vertical Left", tabStyle.GridVisibility(GridLineType.VerticalLeft, RowType.HeaderRow))); + data.Add(new Snoop.Data.Bool("Header Row - Vertical Right", tabStyle.GridVisibility(GridLineType.VerticalRight, RowType.HeaderRow))); + + data.Add(new Snoop.Data.Bool("TitleRow - Horizontal Bottom", tabStyle.GridVisibility(GridLineType.HorizontalBottom, RowType.TitleRow))); + data.Add(new Snoop.Data.Bool("TitleRow - Horizontal Inside", tabStyle.GridVisibility(GridLineType.HorizontalInside, RowType.TitleRow))); + data.Add(new Snoop.Data.Bool("TitleRow - Horizontal Top", tabStyle.GridVisibility(GridLineType.HorizontalTop, RowType.TitleRow))); + data.Add(new Snoop.Data.Bool("TitleRow - Vertical Inside", tabStyle.GridVisibility(GridLineType.VerticalInside, RowType.TitleRow))); + data.Add(new Snoop.Data.Bool("TitleRow - Vertical Left", tabStyle.GridVisibility(GridLineType.VerticalLeft, RowType.TitleRow))); + data.Add(new Snoop.Data.Bool("TitleRow - Vertical Right", tabStyle.GridVisibility(GridLineType.VerticalRight, RowType.TitleRow))); + } + + private void + Stream(ArrayList data, SectionSettings secSettings) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SectionSettings))); + + data.Add(new Snoop.Data.String("Current section type", secSettings.CurrentSectionType.ToString())); + + data.Add(new Snoop.Data.CategorySeparator("Section Type")); + SectionType secType = secSettings.CurrentSectionType; + data.Add(new Snoop.Data.ObjectId("Destination block", secSettings.DestinationBlock(secType))); + data.Add(new Snoop.Data.String("Destination file", secSettings.DestinationFile(secType))); + data.Add(new Snoop.Data.String("Generation options", secSettings.GenerationOptions(secType).ToString())); + + // TBD: More to do here... need to figure out how this works + } + + private void + Stream(ArrayList data, SectionManager secMgr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SectionManager))); + + data.Add(new Snoop.Data.ObjectId("Live section", secMgr.LiveSection)); + data.Add(new Snoop.Data.Int("Number of sections", secMgr.NumSections)); + + // TBD: need to enumerate section objects + } + + private void + Stream(ArrayList data, AttributeDefinition attdef) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AttributeDefinition))); + + data.Add(new Snoop.Data.Bool("Constant", attdef.Constant)); + data.Add(new Snoop.Data.Bool("Invisible", attdef.Invisible)); + data.Add(new Snoop.Data.Bool("Preset", attdef.Preset)); + data.Add(new Snoop.Data.Bool("Verifiable", attdef.Verifiable)); + data.Add(new Snoop.Data.String("Tag", attdef.Tag)); + data.Add(new Snoop.Data.String("Prompt", attdef.Prompt)); + data.Add(new Snoop.Data.Int("Field length", attdef.FieldLength)); + data.Add(new Snoop.Data.Bool("Lock position in block", attdef.LockPositionInBlock)); + } + + private void + Stream(ArrayList data, AttributeReference attref) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AttributeReference))); + + data.Add(new Snoop.Data.Bool("Is constant", attref.IsConstant)); + data.Add(new Snoop.Data.Bool("Invisible", attref.Invisible)); + data.Add(new Snoop.Data.Bool("Is preset", attref.IsPreset)); + data.Add(new Snoop.Data.Bool("Is verifiable", attref.IsVerifiable)); + data.Add(new Snoop.Data.String("Tag", attref.Tag)); + data.Add(new Snoop.Data.Int("Field length", attref.FieldLength)); + data.Add(new Snoop.Data.Bool("Lock position in block", attref.LockPositionInBlock)); + } + + private void + Stream(ArrayList data, Table tbl) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Table))); + + data.Add(new Snoop.Data.ObjectId("Table style", tbl.TableStyle)); + data.Add(new Snoop.Data.Vector3d("Direction", tbl.Direction)); + data.Add(new Snoop.Data.String("Flow direction", tbl.FlowDirection.ToString())); + data.Add(new Snoop.Data.Double("Width", tbl.Width)); + data.Add(new Snoop.Data.Double("Height", tbl.Height)); + /*data.Add(new Snoop.Data.Double("Horizontal cell margin", tbl.HorizontalCellMargin)); + data.Add(new Snoop.Data.Double("Vertical cell margin", tbl.VerticalCellMargin)); + data.Add(new Snoop.Data.Bool("Is header suppressed", tbl.IsHeaderSuppressed)); + data.Add(new Snoop.Data.Bool("Is title suppressed", tbl.IsTitleSuppressed)); + data.Add(new Snoop.Data.Double("Minimum table width", tbl.MinimumTableWidth)); + data.Add(new Snoop.Data.Double("Minimum table height", tbl.MinimumTableHeight)); + data.Add(new Snoop.Data.Int("Number of columns", tbl.NumColumns)); + data.Add(new Snoop.Data.Int("Number of rows", tbl.NumRows));*/ // TBD: Fix JMA + data.Add(new Snoop.Data.Bool("Has sub selection", tbl.HasSubSelection)); + if (tbl.HasSubSelection) + data.Add(new Snoop.Data.Object("Sub selection", tbl.SubSelection)); + + // TBD: more of the non-property functions to show? + } + + private void + Stream(ArrayList data, MLeaderStyle mleaderStyle) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MLeaderStyle))); + + data.Add(new Snoop.Data.Double("Arrow size", mleaderStyle.ArrowSize)); + data.Add(new Snoop.Data.ObjectId("Arrow symbol Id", mleaderStyle.ArrowSymbolId)); + data.Add(new Snoop.Data.Object("Block color", mleaderStyle.BlockColor)); + data.Add(new Snoop.Data.String("Block connection type", mleaderStyle.BlockConnectionType.ToString())); + data.Add(new Snoop.Data.ObjectId("Block content Id", mleaderStyle.BlockId)); + data.Add(new Snoop.Data.Double("Block rotation", mleaderStyle.BlockRotation)); + data.Add(new Snoop.Data.Scale3d("Block scale", mleaderStyle.BlockScale)); + data.Add(new Snoop.Data.Double("Break size", mleaderStyle.BreakSize)); + data.Add(new Snoop.Data.String("Content type", mleaderStyle.ContentType.ToString())); + data.Add(new Snoop.Data.Object("Default mtext", mleaderStyle.DefaultMText)); + data.Add(new Snoop.Data.Double("Dogleg length", mleaderStyle.DoglegLength)); + data.Add(new Snoop.Data.String("Draw leader order type", mleaderStyle.DrawLeaderOrderType.ToString())); + data.Add(new Snoop.Data.String("Draw mleader order type", mleaderStyle.DrawMLeaderOrderType.ToString())); + data.Add(new Snoop.Data.Bool("Enable block rotation", mleaderStyle.EnableBlockRotation)); + data.Add(new Snoop.Data.Bool("Enable dogleg", mleaderStyle.EnableDogleg)); + data.Add(new Snoop.Data.Bool("Enable block scale", mleaderStyle.EnableBlockScale)); + data.Add(new Snoop.Data.Bool("Enable frame text", mleaderStyle.EnableFrameText)); + data.Add(new Snoop.Data.Bool("Enable landing", mleaderStyle.EnableLanding)); + data.Add(new Snoop.Data.Object("First segment angle constraint", mleaderStyle.FirstSegmentAngleConstraint)); + data.Add(new Snoop.Data.Double("Landing gap", mleaderStyle.LandingGap)); + data.Add(new Snoop.Data.Object("Leader line color", mleaderStyle.LeaderLineColor)); + data.Add(new Snoop.Data.String("Leader line type", mleaderStyle.LeaderLineType.ToString())); + data.Add(new Snoop.Data.ObjectId("Leader line type Id", mleaderStyle.LeaderLineTypeId)); + data.Add(new Snoop.Data.String("Leader line weight", mleaderStyle.LeaderLineWeight.ToString())); + data.Add(new Snoop.Data.Int("Max leader segments points", mleaderStyle.MaxLeaderSegmentsPoints)); + data.Add(new Snoop.Data.String("Name", mleaderStyle.Name)); + data.Add(new Snoop.Data.Double("Scale", mleaderStyle.Scale)); + data.Add(new Snoop.Data.Object("Second segment angle constraint", mleaderStyle.SecondSegmentAngleConstraint)); + data.Add(new Snoop.Data.Bool("Text align always left", mleaderStyle.TextAlignAlwaysLeft)); + data.Add(new Snoop.Data.String("Text alignment type", mleaderStyle.TextAlignmentType.ToString())); + data.Add(new Snoop.Data.String("Text angle type", mleaderStyle.TextAngleType.ToString())); + data.Add(new Snoop.Data.String("Text attachment type", mleaderStyle.TextAttachmentType.ToString())); + data.Add(new Snoop.Data.Object("Text color", mleaderStyle.TextColor)); + data.Add(new Snoop.Data.Double("Text height", mleaderStyle.TextHeight)); + data.Add(new Snoop.Data.ObjectId("Text style Id", mleaderStyle.TextStyleId)); + } + + private void + Stream(ArrayList data, LinkedData linkData) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LinkedData))); + + data.Add(new Snoop.Data.Bool("Is empty", linkData.IsEmpty)); + data.Add(new Snoop.Data.String("Name", linkData.Name)); + + LinkedTableData linkTblData = linkData as LinkedTableData; + if (linkTblData != null) { + Stream(data, linkTblData); + return; + } + } + + private void + Stream(ArrayList data, LinkedTableData linkTblData) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LinkedTableData))); + + data.Add(new Snoop.Data.Int("Number of columns", linkTblData.NumberOfColumns)); + data.Add(new Snoop.Data.Int("Number of rows", linkTblData.NumberOfRows)); + + + FormattedTableData formatTblData = linkTblData as FormattedTableData; + if (formatTblData != null) { + Stream(data, formatTblData); + return; + } + } + + private void + Stream(ArrayList data, FormattedTableData formatTblData) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(FormattedTableData))); + + // no data at this level + + TableContent tblContent = formatTblData as TableContent; + if (tblContent != null) { + Stream(data, tblContent); + return; + } + } + + private void + Stream(ArrayList data, TableContent tblContent) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(TableContent))); + + data.Add(new Snoop.Data.ObjectId("Table style Id", tblContent.TableStyleId)); + } + } +} diff --git a/MgdDbgLibrary/Snoop/CollectorExts/EditorInput.cs b/MgdDbgLibrary/Snoop/CollectorExts/EditorInput.cs new file mode 100644 index 0000000..6956b9e --- /dev/null +++ b/MgdDbgLibrary/Snoop/CollectorExts/EditorInput.cs @@ -0,0 +1,1070 @@ +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Collections; +using System.Diagnostics; + +using Autodesk.AutoCAD.EditorInput; + +using MgdDbg.Snoop.Collectors; + +namespace MgdDbg.Snoop.CollectorExts { + class EditorInput : CollectorExt { + + public + EditorInput() + { + } + + protected override void + CollectEvent(object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + // see if it is a type we are responsible for + Editor editor = e.ObjToSnoop as Editor; + if (editor != null) { + Stream(snoopCollector.Data(), editor); + return; + } + + PromptOptions promptOpts = e.ObjToSnoop as PromptOptions; + if (promptOpts != null) { + Stream(snoopCollector.Data(), promptOpts); + return; + } + + PromptStringOptionsEventArgs promptStringArgs = e.ObjToSnoop as PromptStringOptionsEventArgs; + if (promptStringArgs != null) { + Stream(snoopCollector.Data(), promptStringArgs); + return; + } + + PromptSelectionOptionsEventArgs promptSelectionArgs = e.ObjToSnoop as PromptSelectionOptionsEventArgs; + if (promptSelectionArgs != null) { + Stream(snoopCollector.Data(), promptSelectionArgs); + return; + } + + PromptSelectionOptions promptSelectionOpts = e.ObjToSnoop as PromptSelectionOptions; + if (promptSelectionOpts != null) { + Stream(snoopCollector.Data(), promptSelectionOpts); + return; + } + + PromptPointOptionsEventArgs promptPointArgs = e.ObjToSnoop as PromptPointOptionsEventArgs; + if (promptPointArgs != null) { + Stream(snoopCollector.Data(), promptPointArgs); + return; + } + + PromptNestedEntityResultEventArgs promptNestResultArgs = e.ObjToSnoop as PromptNestedEntityResultEventArgs; + if (promptNestResultArgs != null) { + Stream(snoopCollector.Data(), promptNestResultArgs); + return; + } + + PromptResult promptResult = e.ObjToSnoop as PromptResult; + if (promptResult != null) { + Stream(snoopCollector.Data(), promptResult); + return; + } + + PromptKeywordOptionsEventArgs promptKeywordArgs = e.ObjToSnoop as PromptKeywordOptionsEventArgs; + if (promptKeywordArgs != null) { + Stream(snoopCollector.Data(), promptKeywordArgs); + return; + } + + PromptIntegerOptionsEventArgs promptIntArgs = e.ObjToSnoop as PromptIntegerOptionsEventArgs; + if (promptIntArgs != null) { + Stream(snoopCollector.Data(), promptIntArgs); + return; + } + + PromptEntityOptionsEventArgs promptEntArgs = e.ObjToSnoop as PromptEntityOptionsEventArgs; + if (promptEntArgs != null) { + Stream(snoopCollector.Data(), promptEntArgs); + return; + } + + PromptDoubleOptionsEventArgs promptDoubleArgs = e.ObjToSnoop as PromptDoubleOptionsEventArgs; + if (promptDoubleArgs != null) { + Stream(snoopCollector.Data(), promptDoubleArgs); + return; + } + + PromptSelectionResult prSelRes = e.ObjToSnoop as PromptSelectionResult; + if (prSelRes != null) { + Stream(snoopCollector.Data(), prSelRes); + return; + } + + SelectionSet selSet = e.ObjToSnoop as SelectionSet; + if (selSet != null) { + Stream(snoopCollector.Data(), selSet); + return; + } + + SelectedObject selObj = e.ObjToSnoop as SelectedObject; + if (selObj != null) { + Stream(snoopCollector.Data(), selObj); + return; + } + + SelectedSubObject selSubObj = e.ObjToSnoop as SelectedSubObject; + if (selSubObj != null) { + Stream(snoopCollector.Data(), selSubObj); + return; + } + + SelectionDetails selDetails = e.ObjToSnoop as SelectionDetails; + if (selDetails != null) { + Stream(snoopCollector.Data(), selDetails); + return; + } + + SelectionRemovedEventArgs selRemovedArgs = e.ObjToSnoop as SelectionRemovedEventArgs; + if (selRemovedArgs != null) { + Stream(snoopCollector.Data(), selRemovedArgs); + return; + } + + SelectionAddedEventArgs selAddedArgs = e.ObjToSnoop as SelectionAddedEventArgs; + if (selAddedArgs != null) { + Stream(snoopCollector.Data(), selAddedArgs); + return; + } + + DraggingEndedEventArgs dragEndArgs = e.ObjToSnoop as DraggingEndedEventArgs; + if (dragEndArgs != null) { + Stream(snoopCollector.Data(), dragEndArgs); + return; + } + + InputPointContext inputPtCntxt = e.ObjToSnoop as InputPointContext; + if (inputPtCntxt != null) { + Stream(snoopCollector.Data(), inputPtCntxt); + return; + } + + Keyword keyword = e.ObjToSnoop as Keyword; + if (keyword != null) { + Stream(snoopCollector.Data(), keyword); + return; + } + + PointFilterEventArgs ptFilterEventArgs = e.ObjToSnoop as PointFilterEventArgs; + if (ptFilterEventArgs != null) { + Stream(snoopCollector.Data(), ptFilterEventArgs); + return; + } + + PointFilterResult ptFilterRes = e.ObjToSnoop as PointFilterResult; + if (ptFilterRes != null) { + Stream(snoopCollector.Data(), ptFilterRes); + return; + } + + PointMonitorEventArgs ptMonitorArgs = e.ObjToSnoop as PointMonitorEventArgs; + if (ptMonitorArgs != null) { + Stream(snoopCollector.Data(), ptMonitorArgs); + return; + } + + PromptAngleOptionsEventArgs promptAngleOptsArgs = e.ObjToSnoop as PromptAngleOptionsEventArgs; + if (promptAngleOptsArgs != null) { + Stream(snoopCollector.Data(), promptAngleOptsArgs); + return; + } + + PromptDistanceOptionsEventArgs promptDistanceOptsArgs = e.ObjToSnoop as PromptDistanceOptionsEventArgs; + if (promptDistanceOptsArgs != null) { + Stream(snoopCollector.Data(), promptDistanceOptsArgs); + return; + } + + PromptDoubleResultEventArgs promptDoubleResArgs = e.ObjToSnoop as PromptDoubleResultEventArgs; + if (promptDoubleResArgs != null) { + Stream(snoopCollector.Data(), promptDoubleResArgs); + return; + } + + PromptFileOptions promptFileOpts = e.ObjToSnoop as PromptFileOptions; + if (promptFileOpts != null) { + Stream(snoopCollector.Data(), promptFileOpts); + return; + } + + PromptForEntityEndingEventArgs promptForEntEndArgs = e.ObjToSnoop as PromptForEntityEndingEventArgs; + if (promptForEntEndArgs != null) { + Stream(snoopCollector.Data(), promptForEntEndArgs); + return; + } + + PromptForSelectionEndingEventArgs promptForSelEndArgs = e.ObjToSnoop as PromptForSelectionEndingEventArgs; + if (promptForSelEndArgs != null) { + Stream(snoopCollector.Data(), promptForSelEndArgs); + return; + } + + PromptNestedEntityOptions promptNestEntOpts = e.ObjToSnoop as PromptNestedEntityOptions; + if (promptNestEntOpts != null) { + Stream(snoopCollector.Data(), promptNestEntOpts); + return; + } + + PromptNestedEntityOptionsEventArgs promptNestEntOptsArgs = e.ObjToSnoop as PromptNestedEntityOptionsEventArgs; + if (promptNestEntOptsArgs != null) { + Stream(snoopCollector.Data(), promptNestEntOptsArgs); + return; + } + + PromptSelectionResultEventArgs promptSelResArgs = e.ObjToSnoop as PromptSelectionResultEventArgs; + if (promptSelResArgs != null) { + Stream(snoopCollector.Data(), promptSelResArgs); + return; + } + + // ValueTypes we have to treat a bit different + if (e.ObjToSnoop is PickPointDescriptor) { + Stream(snoopCollector.Data(), (PickPointDescriptor)e.ObjToSnoop); + return; + } + } + + private void + Stream (ArrayList data, Editor editor) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Editor))); + + data.Add(new Snoop.Data.Object("Current User Coordinate System", editor.CurrentUserCoordinateSystem)); + data.Add(new Snoop.Data.ObjectId("Current Viewport ObjectId", editor.CurrentViewportObjectId)); + data.Add(new Snoop.Data.Object("Document", editor.Document)); + data.Add(new Snoop.Data.Bool("Is Dragging", editor.IsDragging)); + data.Add(new Snoop.Data.Bool("Is Quiescent", editor.IsQuiescent)); + data.Add(new Snoop.Data.Bool("Mouse Has Moved", editor.MouseHasMoved)); + // throws an assertion failure + //data.Add(new Snoop.Data.Object("Current View", editor.GetCurrentView())); + } + + + private void + Stream(ArrayList data, SelectionRemovedEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SelectionRemovedEventArgs))); + + data.Add(new Snoop.Data.String("Flags", args.Flags.ToString())); + data.Add(new Snoop.Data.SelectionSet("Selection", args.Selection)); + data.Add(new Snoop.Data.SelectionSet("Removed objects", args.RemovedObjects)); + } + + private void + Stream(ArrayList data, SelectionAddedEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SelectionAddedEventArgs))); + + data.Add(new Snoop.Data.String("Flags", args.Flags.ToString())); + data.Add(new Snoop.Data.SelectionSet("Selection", args.Selection)); + data.Add(new Snoop.Data.SelectionSet("Added objects", args.AddedObjects)); + } + + private void + Stream(ArrayList data, PromptOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptOptions))); + + data.Add(new Snoop.Data.String("Message", opts.Message)); + data.Add(new Snoop.Data.Bool("Append keywords to message", opts.AppendKeywordsToMessage)); + data.Add(new Snoop.Data.Bool("Is read-only", opts.IsReadOnly)); + data.Add(new Snoop.Data.Object("Keywords", opts.Keywords)); + + PromptEditorOptions promptEdOpts = opts as PromptEditorOptions; + if (promptEdOpts != null) { + Stream(data, promptEdOpts); + return; + } + + JigPromptOptions jigPromptOpts = opts as JigPromptOptions; + if (jigPromptOpts != null) { + Stream(data, jigPromptOpts); + return; + } + } + + private void + Stream(ArrayList data, PromptEditorOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptEditorOptions))); + + PromptCornerOptions promptCornerOpts = opts as PromptCornerOptions; + if (promptCornerOpts != null) { + Stream(data, promptCornerOpts); + return; + } + + PromptStringOptions promptStrOpts = opts as PromptStringOptions; + if (promptStrOpts != null) { + Stream(data, promptStrOpts); + return; + } + + PromptKeywordOptions promptKwordOpts = opts as PromptKeywordOptions; + if (promptKwordOpts != null) { + Stream(data, promptKwordOpts); + return; + } + + PromptNumericalOptions promptNumpericalOpts = opts as PromptNumericalOptions; + if (promptNumpericalOpts != null) { + Stream(data, promptNumpericalOpts); + return; + } + + PromptEntityOptions promptEntOpts = opts as PromptEntityOptions; + if (promptEntOpts != null) { + Stream(data, promptEntOpts); + return; + } + + PromptAngleOptions promptAngleOpts = opts as PromptAngleOptions; + if (promptAngleOpts != null) { + Stream(data, promptAngleOpts); + return; + } + + PromptDragOptions promptDragOpts = opts as PromptDragOptions; + if (promptDragOpts != null) { + Stream(data, promptDragOpts); + return; + } + } + + private void + Stream(ArrayList data, PromptCornerOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptCornerOptions))); + + data.Add(new Snoop.Data.Bool("Allow arbitrary input", opts.AllowArbitraryInput)); + data.Add(new Snoop.Data.Bool("Allow none", opts.AllowNone)); + data.Add(new Snoop.Data.Point3d("Base point", opts.BasePoint)); + data.Add(new Snoop.Data.Bool("Limits checked", opts.LimitsChecked)); + data.Add(new Snoop.Data.Bool("Use dashed line", opts.UseDashedLine)); + + PromptPointOptions promptPtOpts = opts as PromptPointOptions; + if (promptPtOpts != null) { + Stream(data, promptPtOpts); + return; + } + } + + private void + Stream(ArrayList data, PromptPointOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptPointOptions))); + + data.Add(new Snoop.Data.Bool("Use base point", opts.UseBasePoint)); + } + + private void + Stream(ArrayList data, PromptStringOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptStringOptions))); + + data.Add(new Snoop.Data.Bool("Allow spaces", opts.AllowSpaces)); + data.Add(new Snoop.Data.String("Default value", opts.DefaultValue)); + data.Add(new Snoop.Data.Bool("Use default value", opts.UseDefaultValue)); + } + + private void + Stream(ArrayList data, PromptKeywordOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptKeywordOptions))); + + data.Add(new Snoop.Data.Bool("Allow arbitrary input", opts.AllowArbitraryInput)); + data.Add(new Snoop.Data.Bool("Allow none", opts.AllowNone)); + } + + private void + Stream(ArrayList data, PromptNumericalOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptNumericalOptions))); + + data.Add(new Snoop.Data.Bool("Allow arbitrary input", opts.AllowArbitraryInput)); + data.Add(new Snoop.Data.Bool("Allow none", opts.AllowNone)); + data.Add(new Snoop.Data.Bool("Allow negative", opts.AllowNegative)); + data.Add(new Snoop.Data.Bool("Allow zero", opts.AllowZero)); + data.Add(new Snoop.Data.Bool("Use default value", opts.UseDefaultValue)); + + PromptIntegerOptions promptIntOpts = opts as PromptIntegerOptions; + if (promptIntOpts != null) { + Stream(data, promptIntOpts); + return; + } + + PromptDoubleOptions promptDoubleOpts = opts as PromptDoubleOptions; + if (promptDoubleOpts != null) { + Stream(data, promptDoubleOpts); + return; + } + + PromptDistanceOptions promptDistanceOpts = opts as PromptDistanceOptions; + if (promptDistanceOpts != null) { + Stream(data, promptDistanceOpts); + return; + } + } + + private void + Stream(ArrayList data, PromptIntegerOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptIntegerOptions))); + + data.Add(new Snoop.Data.Int("Default value", opts.DefaultValue)); + data.Add(new Snoop.Data.Int("Lower limit", opts.LowerLimit)); + data.Add(new Snoop.Data.Int("Upper limit", opts.UpperLimit)); + } + + private void + Stream(ArrayList data, PromptDoubleOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptDoubleOptions))); + + data.Add(new Snoop.Data.Double("Default value", opts.DefaultValue)); + } + + private void + Stream(ArrayList data, PromptDistanceOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptDistanceOptions))); + + data.Add(new Snoop.Data.Point3d("Base point", opts.BasePoint)); + data.Add(new Snoop.Data.Double("Default value", opts.DefaultValue)); + data.Add(new Snoop.Data.Bool("Only2d", opts.Only2d)); + data.Add(new Snoop.Data.Bool("Use base point", opts.UseBasePoint)); + data.Add(new Snoop.Data.Bool("Use dashed line", opts.UseDashedLine)); + } + + private void + Stream(ArrayList data, PromptEntityOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptEntityOptions))); + + data.Add(new Snoop.Data.Bool("Allow none", opts.AllowNone)); + data.Add(new Snoop.Data.Bool("Allow object on locked layer", opts.AllowObjectOnLockedLayer)); + } + + private void + Stream(ArrayList data, PromptAngleOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptAngleOptions))); + + data.Add(new Snoop.Data.Bool("Allow arbitrary input", opts.AllowArbitraryInput)); + data.Add(new Snoop.Data.Bool("Allow none", opts.AllowNone)); + data.Add(new Snoop.Data.Bool("Allow zero", opts.AllowZero)); + data.Add(new Snoop.Data.Point3d("Base point", opts.BasePoint)); + data.Add(new Snoop.Data.Double("Default value", opts.DefaultValue)); + data.Add(new Snoop.Data.Bool("Use angle base", opts.UseAngleBase)); + data.Add(new Snoop.Data.Bool("Use base point", opts.UseBasePoint)); + data.Add(new Snoop.Data.Bool("Use dashed line", opts.UseDashedLine)); + data.Add(new Snoop.Data.Bool("Use default value", opts.UseDefaultValue)); + } + + private void + Stream(ArrayList data, PromptDragOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptDragOptions))); + + data.Add(new Snoop.Data.Bool("Allow arbitrary input", opts.AllowArbitraryInput)); + data.Add(new Snoop.Data.Bool("Allow none", opts.AllowNone)); + data.Add(new Snoop.Data.Object("Callback", opts.Callback)); + data.Add(new Snoop.Data.String("Cursor", opts.Cursor.ToString())); + data.Add(new Snoop.Data.Object("Selection", opts.Selection)); + } + + private void + Stream(ArrayList data, PromptStringOptionsEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptStringOptionsEventArgs))); + + data.Add(new Snoop.Data.Object("Options", args.Options)); + } + + private void + Stream(ArrayList data, PromptSelectionOptionsEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptSelectionOptionsEventArgs))); + + data.Add(new Snoop.Data.Object("Options", args.Options)); + data.Add(new Snoop.Data.Object("Filter", args.Filter)); + } + + private void + Stream(ArrayList data, PromptSelectionOptions opts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptSelectionOptions))); + + data.Add(new Snoop.Data.Bool("Allow duplicates", opts.AllowDuplicates)); + data.Add(new Snoop.Data.Bool("Allow sub selections", opts.AllowSubSelections)); + data.Add(new Snoop.Data.Bool("Force sub selections", opts.ForceSubSelections)); + data.Add(new Snoop.Data.Object("Keywords", opts.Keywords)); + data.Add(new Snoop.Data.String("Message for adding", opts.MessageForAdding)); + data.Add(new Snoop.Data.String("Message for removal", opts.MessageForRemoval)); + data.Add(new Snoop.Data.Bool("Prepare optional details", opts.PrepareOptionalDetails)); + data.Add(new Snoop.Data.Bool("Reject objects from non-current space", opts.RejectObjectsFromNonCurrentSpace)); + data.Add(new Snoop.Data.Bool("Reject objects on locked layers", opts.RejectObjectsOnLockedLayers)); + data.Add(new Snoop.Data.Bool("Reject paper space viewport", opts.RejectPaperspaceViewport)); + data.Add(new Snoop.Data.Bool("Select everything in aperture", opts.SelectEverythingInAperture)); + data.Add(new Snoop.Data.Bool("Single only", opts.SingleOnly)); + data.Add(new Snoop.Data.Bool("Single pick in space", opts.SinglePickInSpace)); + } + + private void + Stream(ArrayList data, PromptPointOptionsEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptPointOptionsEventArgs))); + + data.Add(new Snoop.Data.Object("Options", args.Options)); + } + + private void + Stream(ArrayList data, PromptNestedEntityResultEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptNestedEntityResultEventArgs))); + + data.Add(new Snoop.Data.Object("Result", args.Result)); + } + + private void + Stream(ArrayList data, PromptResult res) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptResult))); + + data.Add(new Snoop.Data.String("Status", res.Status.ToString())); + data.Add(new Snoop.Data.String("String result", res.StringResult)); + data.Add(new Snoop.Data.String("ToString", res.ToString())); + + // just add the values directly + PromptIntegerResult prResInt = res as PromptIntegerResult; + if (prResInt != null) { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptIntegerResult))); + data.Add(new Snoop.Data.Int("Value", prResInt.Value)); + return; + } + // just add the values directly + PromptDoubleResult prResDbl = res as PromptDoubleResult; + if (prResDbl != null) { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptDoubleResult))); + data.Add(new Snoop.Data.Double("Value", prResDbl.Value)); + return; + } + // just add the values directly + PromptPointResult prResPt = res as PromptPointResult; + if (prResPt != null) { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptPointResult))); + data.Add(new Snoop.Data.Point3d("Value", prResPt.Value)); + return; + } + // branch to sub-classes + PromptEntityResult promptEntRes = res as PromptEntityResult; + if (promptEntRes != null) { + Stream(data, promptEntRes); + return; + } + } + + private void + Stream(ArrayList data, PromptEntityResult res) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptEntityResult))); + + data.Add(new Snoop.Data.ObjectId("Object ID", res.ObjectId)); + data.Add(new Snoop.Data.Point3d("Picked point", res.PickedPoint)); + + PromptNestedEntityResult promptNestedEntRes = res as PromptNestedEntityResult; + if (promptNestedEntRes != null) { + Stream(data, promptNestedEntRes); + return; + } + } + + private void + Stream(ArrayList data, PromptNestedEntityResult res) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptNestedEntityResult))); + + data.Add(new Snoop.Data.Object("Transform", res.Transform)); + data.Add(new Snoop.Data.ObjectIdCollection("Containers", res.GetContainers())); + } + + private void + Stream(ArrayList data, PromptKeywordOptionsEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptKeywordOptionsEventArgs))); + + data.Add(new Snoop.Data.Object("Options", args.Options)); + } + + private void + Stream(ArrayList data, PromptIntegerOptionsEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptIntegerOptionsEventArgs))); + + data.Add(new Snoop.Data.Object("Options", args.Options)); + } + + private void + Stream(ArrayList data, PromptEntityOptionsEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptEntityOptionsEventArgs))); + + data.Add(new Snoop.Data.Object("Options", args.Options)); + } + + private void + Stream(ArrayList data, PromptDoubleOptionsEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptDoubleOptionsEventArgs))); + + data.Add(new Snoop.Data.Object("Options", args.Options)); + } + + private void + Stream(ArrayList data, PromptSelectionResult prRes) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptSelectionResult))); + + data.Add(new Snoop.Data.String("Status", prRes.Status.ToString())); + data.Add(new Snoop.Data.Object("Value", prRes.Value)); + + } + + private void + Stream(ArrayList data, SelectionSet selSet) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SelectionSet))); + + data.Add(new Snoop.Data.ObjectIdCollection("Object IDs", selSet.GetObjectIds())); + data.Add(new Snoop.Data.Enumerable("Selected objects", selSet)); + } + + private void + Stream(ArrayList data, SelectedObject selObj) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SelectedObject))); + + data.Add(new Snoop.Data.String("Selection method", selObj.SelectionMethod.ToString())); + data.Add(new Snoop.Data.ObjectId("Object ID", selObj.ObjectId)); + //data.Add(new Snoop.Data.Int("Graphics system marker", selObj.GraphicsSystemMarker)); // TBD: Fix JMA + data.Add(new Snoop.Data.Object("Optional details", selObj.OptionalDetails)); + data.Add(new Snoop.Data.Enumerable("Sub-entities", selObj.GetSubentities())); + + CrossingOrWindowSelectedObject crossOrWindowSelObj = selObj as CrossingOrWindowSelectedObject; + if (crossOrWindowSelObj != null) { + Stream(data, crossOrWindowSelObj); + return; + } + + FenceSelectedObject fenceSelObj = selObj as FenceSelectedObject; + if (fenceSelObj != null) { + Stream(data, fenceSelObj); + return; + } + + PickPointSelectedObject pickPtSelObj = selObj as PickPointSelectedObject; + if (pickPtSelObj != null) { + Stream(data, pickPtSelObj); + return; + } + + } + + private void + Stream(ArrayList data, CrossingOrWindowSelectedObject selObj) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CrossingOrWindowSelectedObject))); + + data.Add(new Snoop.Data.Enumerable("Pick points", selObj.GetPickPoints())); + } + + private void + Stream(ArrayList data, FenceSelectedObject selObj) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(FenceSelectedObject))); + + data.Add(new Snoop.Data.Enumerable("Intersection points", selObj.GetIntersectionPoints())); + } + + private void + Stream(ArrayList data, PickPointSelectedObject selObj) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PickPointSelectedObject))); + + data.Add(new Snoop.Data.Object("Pick point", selObj.PickPoint)); + } + + private void + Stream(ArrayList data, SelectedSubObject selSubObj) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SelectedSubObject))); + + data.Add(new Snoop.Data.String("Selection method", selSubObj.SelectionMethod.ToString())); + data.Add(new Snoop.Data.Object("Full sub-entity path", selSubObj.FullSubentityPath)); + //data.Add(new Snoop.Data.Int("Graphics system marker", selSubObj.GraphicsSystemMarker)); // TBD: Fix JMA + data.Add(new Snoop.Data.Object("Optional details", selSubObj.OptionalDetails)); + + CrossingOrWindowSelectedSubObject crossOrWindowSelSubObj = selSubObj as CrossingOrWindowSelectedSubObject; + if (crossOrWindowSelSubObj != null) { + Stream(data, crossOrWindowSelSubObj); + return; + } + + FenceSelectedSubObject fenceSelSubObj = selSubObj as FenceSelectedSubObject; + if (fenceSelSubObj != null) { + Stream(data, fenceSelSubObj); + return; + } + + PickPointSelectedSubObject pickPtSelSubObj = selSubObj as PickPointSelectedSubObject; + if (pickPtSelSubObj != null) { + Stream(data, pickPtSelSubObj); + return; + } + + + } + + private void + Stream(ArrayList data, CrossingOrWindowSelectedSubObject selObj) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CrossingOrWindowSelectedSubObject))); + + data.Add(new Snoop.Data.Enumerable("Pick points", selObj.GetPickPoints())); + } + + private void + Stream(ArrayList data, FenceSelectedSubObject selObj) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(FenceSelectedSubObject))); + + data.Add(new Snoop.Data.Enumerable("Intersection points", selObj.GetIntersectionPoints())); + } + + private void + Stream(ArrayList data, PickPointSelectedSubObject selObj) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PickPointSelectedSubObject))); + + data.Add(new Snoop.Data.Object("Pick point", selObj.PickPoint)); + } + + private void + Stream(ArrayList data, DraggingEndedEventArgs dragEndArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DraggingEndedEventArgs))); + + data.Add(new Snoop.Data.Vector3d("Offset", dragEndArgs.Offset)); + data.Add(new Snoop.Data.Point3d("Pick point", dragEndArgs.PickPoint)); + data.Add(new Snoop.Data.String("Status", dragEndArgs.Status.ToString())); + } + + private void + Stream(ArrayList data, SelectionDetails selDetails) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SelectionDetails))); + + data.Add(new Snoop.Data.Object("Transform", selDetails.Transform)); + data.Add(new Snoop.Data.ObjectIdCollection("Containers", selDetails.GetContainers())); + } + + private void + Stream(ArrayList data, InputPointContext inputPtCntxt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(InputPointContext))); + + data.Add(new Snoop.Data.Point3d("Cartesian snapped point", inputPtCntxt.CartesianSnappedPoint)); + data.Add(new Snoop.Data.Point3d("Computed point", inputPtCntxt.ComputedPoint)); + data.Add(new Snoop.Data.Object("Document", inputPtCntxt.Document)); + data.Add(new Snoop.Data.Object("Draw context", inputPtCntxt.DrawContext)); + data.Add(new Snoop.Data.Point3d("Gripped point", inputPtCntxt.GrippedPoint)); + data.Add(new Snoop.Data.String("History", inputPtCntxt.History.ToString())); + data.Add(new Snoop.Data.Point3d("Last point", inputPtCntxt.LastPoint)); + data.Add(new Snoop.Data.Object("Object snap overrides", inputPtCntxt.ObjectSnapOverrides.ToString())); + data.Add(new Snoop.Data.Point3d("Object snapped point", inputPtCntxt.ObjectSnappedPoint)); + data.Add(new Snoop.Data.Bool("Point computed", inputPtCntxt.PointComputed)); + data.Add(new Snoop.Data.Point3d("Raw point", inputPtCntxt.RawPoint)); + data.Add(new Snoop.Data.String("Tooltip text", inputPtCntxt.ToolTipText)); + } + + private void + Stream(ArrayList data, JigPromptOptions jigPromptOpts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(JigPromptOptions))); + + data.Add(new Snoop.Data.String("Cursor", jigPromptOpts.Cursor.ToString())); + data.Add(new Snoop.Data.String("User input controls", jigPromptOpts.UserInputControls.ToString())); + + JigPromptGeometryOptions jigPromptGeoOpts = jigPromptOpts as JigPromptGeometryOptions; + if (jigPromptGeoOpts != null) { + Stream(data, jigPromptGeoOpts); + return; + } + + JigPromptStringOptions jigPromptStringOpts = jigPromptOpts as JigPromptStringOptions; + if (jigPromptStringOpts != null) { + Stream(data, jigPromptStringOpts); + return; + } + } + + private void + Stream(ArrayList data, JigPromptGeometryOptions jigPromptGeoOpts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(JigPromptGeometryOptions))); + + data.Add(new Snoop.Data.Point3d("Base point", jigPromptGeoOpts.BasePoint)); + data.Add(new Snoop.Data.Bool("Use base point", jigPromptGeoOpts.UseBasePoint)); + + JigPromptAngleOptions jigPromptAngleOpts = jigPromptGeoOpts as JigPromptAngleOptions; + if (jigPromptAngleOpts != null) { + Stream(data, jigPromptAngleOpts); + return; + } + + JigPromptDistanceOptions jigPromptDistanceOpts = jigPromptGeoOpts as JigPromptDistanceOptions; + if (jigPromptDistanceOpts != null) { + Stream(data, jigPromptDistanceOpts); + return; + } + + JigPromptPointOptions jigPromptPointOpts = jigPromptGeoOpts as JigPromptPointOptions; + if (jigPromptPointOpts != null) { + Stream(data, jigPromptPointOpts); + return; + } + } + + private void + Stream(ArrayList data, JigPromptAngleOptions jigPromptAngleOpts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(JigPromptAngleOptions))); + + data.Add(new Snoop.Data.Double("Default value", jigPromptAngleOpts.DefaultValue)); + } + + private void + Stream(ArrayList data, JigPromptDistanceOptions jigPromptDistanceOpts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(JigPromptDistanceOptions))); + + data.Add(new Snoop.Data.Double("Default value", jigPromptDistanceOpts.DefaultValue)); + } + + private void + Stream(ArrayList data, JigPromptPointOptions jigPromptPointOpts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(JigPromptPointOptions))); + + data.Add(new Snoop.Data.Point3d("Default value", jigPromptPointOpts.DefaultValue)); + } + + + private void + Stream(ArrayList data, JigPromptStringOptions jigPromptStringOpts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(JigPromptStringOptions))); + + data.Add(new Snoop.Data.String("Default value", jigPromptStringOpts.DefaultValue)); + } + + private void + Stream(ArrayList data, Keyword keyword) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Keyword))); + + data.Add(new Snoop.Data.String("Display name", keyword.DisplayName)); + data.Add(new Snoop.Data.Bool("Enabled", keyword.Enabled)); + data.Add(new Snoop.Data.String("Global name", keyword.GlobalName)); + data.Add(new Snoop.Data.Bool("Is read only", keyword.IsReadOnly)); + data.Add(new Snoop.Data.String("Local name", keyword.LocalName)); + data.Add(new Snoop.Data.Bool("Visible", keyword.Visible)); + } + + private void + Stream(ArrayList data, PointFilterEventArgs pointFilterArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PointFilterEventArgs))); + + data.Add(new Snoop.Data.Bool("Call next", pointFilterArgs.CallNext)); + data.Add(new Snoop.Data.Object("Context", pointFilterArgs.Context)); + data.Add(new Snoop.Data.Object("Result", pointFilterArgs.Result)); + } + + private void + Stream(ArrayList data, PointFilterResult pointFilterRes) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PointFilterResult))); + + data.Add(new Snoop.Data.Bool("Display object snap glyph", pointFilterRes.DisplayObjectSnapGlyph)); + data.Add(new Snoop.Data.Point3d("New point", pointFilterRes.NewPoint)); + data.Add(new Snoop.Data.Bool("Retry", pointFilterRes.Retry)); + data.Add(new Snoop.Data.String("Toolt tip text", pointFilterRes.ToolTipText)); + } + + private void + Stream(ArrayList data, PointMonitorEventArgs pointMonitorArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PointMonitorEventArgs))); + + data.Add(new Snoop.Data.Object("Context", pointMonitorArgs.Context)); + } + + private void + Stream(ArrayList data, PromptAngleOptionsEventArgs promptAngleOptsArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptAngleOptionsEventArgs))); + + data.Add(new Snoop.Data.Object("Options", promptAngleOptsArgs.Options)); + } + + private void + Stream(ArrayList data, PromptDistanceOptionsEventArgs promptDistanceOptsArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptDistanceOptionsEventArgs))); + + data.Add(new Snoop.Data.Object("Options", promptDistanceOptsArgs.Options)); + } + + private void + Stream(ArrayList data, PromptDoubleResultEventArgs promptDoubleResArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptDoubleResultEventArgs))); + + data.Add(new Snoop.Data.Object("Result", promptDoubleResArgs.Result)); + } + + private void + Stream(ArrayList data, PromptFileOptions promptFileOpts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptFileOptions))); + + data.Add(new Snoop.Data.Bool("AllowUrls", promptFileOpts.AllowUrls)); + data.Add(new Snoop.Data.String("Dialog caption", promptFileOpts.DialogCaption)); + data.Add(new Snoop.Data.String("Dialog name", promptFileOpts.DialogName)); + data.Add(new Snoop.Data.String("Filter", promptFileOpts.Filter)); + data.Add(new Snoop.Data.Int("Filter index", promptFileOpts.FilterIndex)); + data.Add(new Snoop.Data.String("Initial directory", promptFileOpts.InitialDirectory)); + data.Add(new Snoop.Data.String("Initial file name", promptFileOpts.InitialFileName)); + data.Add(new Snoop.Data.String("Message", promptFileOpts.Message)); + data.Add(new Snoop.Data.Bool("Prefer command line", promptFileOpts.PreferCommandLine)); + + PromptOpenFileOptions promptOpenFileOpts = promptFileOpts as PromptOpenFileOptions; + if (promptOpenFileOpts != null) { + Stream(data, promptOpenFileOpts); + return; + } + + PromptSaveFileOptions promptSaveFileOpts = promptFileOpts as PromptSaveFileOptions; + if (promptSaveFileOpts != null) { + Stream(data, promptSaveFileOpts); + return; + } + } + + private void + Stream(ArrayList data, PromptOpenFileOptions promptOpenFileOpts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptOpenFileOptions))); + + data.Add(new Snoop.Data.Bool("Search path", promptOpenFileOpts.SearchPath)); + data.Add(new Snoop.Data.Bool("Transfer remote files", promptOpenFileOpts.TransferRemoteFiles)); + } + + private void + Stream(ArrayList data, PromptSaveFileOptions promptSaveFileOpts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptSaveFileOptions))); + + data.Add(new Snoop.Data.Bool("Derive initial filename from drawing name", promptSaveFileOpts.DeriveInitialFilenameFromDrawingName)); + data.Add(new Snoop.Data.Bool("Display save options menu item", promptSaveFileOpts.DisplaySaveOptionsMenuItem)); + data.Add(new Snoop.Data.Bool("Force overwrite warning for scripts and lisp", promptSaveFileOpts.ForceOverwriteWarningForScriptsAndLisp)); + } + + private void + Stream(ArrayList data, PromptForEntityEndingEventArgs promptForEntEndArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptForEntityEndingEventArgs))); + + data.Add(new Snoop.Data.Object("Result", promptForEntEndArgs.Result)); + } + + private void + Stream(ArrayList data, PromptForSelectionEndingEventArgs promptForSelEndArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptForSelectionEndingEventArgs))); + + data.Add(new Snoop.Data.String("Flags", promptForSelEndArgs.Flags.ToString())); + data.Add(new Snoop.Data.Object("Selection", promptForSelEndArgs.Selection)); + } + + private void + Stream(ArrayList data, PromptNestedEntityOptions promptNestEntOpts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptNestedEntityOptions))); + + data.Add(new Snoop.Data.Bool("AllowNone", promptNestEntOpts.AllowNone)); + data.Add(new Snoop.Data.Point3d("Non interactive pick point", promptNestEntOpts.NonInteractivePickPoint)); + data.Add(new Snoop.Data.Bool("Use non interactive pick point", promptNestEntOpts.UseNonInteractivePickPoint)); + } + + private void + Stream(ArrayList data, PromptNestedEntityOptionsEventArgs promptNestEntOptsArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptNestedEntityOptionsEventArgs))); + + data.Add(new Snoop.Data.Object("Options", promptNestEntOptsArgs.Options)); + } + + private void + Stream(ArrayList data, PromptSelectionResultEventArgs promptSelResArgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PromptSelectionResultEventArgs))); + + data.Add(new Snoop.Data.Object("Result", promptSelResArgs.Result)); + } + + private void + Stream(ArrayList data, PickPointDescriptor pickPt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PickPointDescriptor))); + + data.Add(new Snoop.Data.String("Kind", pickPt.Kind.ToString())); + data.Add(new Snoop.Data.Vector3d("Direction", pickPt.Direction)); + data.Add(new Snoop.Data.Point3d("Point on line", pickPt.PointOnLine)); + } + } +} diff --git a/MgdDbgLibrary/Snoop/CollectorExts/Entity.cs b/MgdDbgLibrary/Snoop/CollectorExts/Entity.cs new file mode 100644 index 0000000..57a73b4 --- /dev/null +++ b/MgdDbgLibrary/Snoop/CollectorExts/Entity.cs @@ -0,0 +1,1940 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + + +using System.Diagnostics; +using System.Collections; +using Autodesk.AutoCAD.DatabaseServices; +using MgdDbg.Snoop.Collectors; + +using AcDb = Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.Snoop.CollectorExts { + + /// + /// This is a Snoop Collector Extension object to collect data from Entity objects. + /// + + public class Entity : CollectorExt + { + + public + Entity () + { + } + + protected override void + CollectEvent (object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + // branch to all types we are concerned with + AcDb.Entity ent = e.ObjToSnoop as AcDb.Entity; + if (ent != null) { + Stream(snoopCollector.Data(), ent); + } + } + + #region Entity + // main branch for anything derived from Entity (AcDbEntity) + + private void + Stream (ArrayList data, AcDb.Entity ent) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Entity))); + + data.Add(new Snoop.Data.ObjectId("Block ID", ent.BlockId)); + data.Add(new Snoop.Data.String("Layer", ent.Layer)); + data.Add(new Snoop.Data.ObjectId("Layer ID", ent.LayerId)); + data.Add(new Snoop.Data.ObjectToString("Color", ent.Color)); + data.Add(new Snoop.Data.Object("Entity color", ent.EntityColor)); + data.Add(new Snoop.Data.String("Color index", MgdDbg.Utils.AcadUi.ColorIndexToStr(ent.ColorIndex, true))); + data.Add(new Snoop.Data.String("Linetype", ent.Linetype)); + data.Add(new Snoop.Data.ObjectId("Linetype ID", ent.LinetypeId)); + data.Add(new Snoop.Data.Distance("Linetype scale", ent.LinetypeScale)); + data.Add(new Snoop.Data.String("Lineweight", ent.LineWeight.ToString())); + data.Add(new Snoop.Data.String("Plotstyle name", ent.PlotStyleName.ToString())); + data.Add(new Snoop.Data.String("Plotstyle name ID", ent.PlotStyleNameId.ToString())); + data.Add(new Snoop.Data.Bool("Visible", ent.Visible)); + data.Add(new Snoop.Data.Bool("Clone me for dragging", ent.CloneMeForDragging)); + data.Add(new Snoop.Data.Bool("Is planar", ent.IsPlanar)); + data.Add(new Snoop.Data.Object("ECS", ent.Ecs)); + data.Add(new Snoop.Data.ObjectCollection("Hyperlinks", (System.Collections.ICollection)ent.Hyperlinks)); + data.Add(new Snoop.Data.Object("Transparency", ent.Transparency)); + data.Add(new Snoop.Data.Bool("Cast shadows", ent.CastShadows)); + data.Add(new Snoop.Data.Bool("Recieve shadows", ent.ReceiveShadows)); + data.Add(new Snoop.Data.Object("Material mapper", ent.MaterialMapper)); + data.Add(new Snoop.Data.String("Material", ent.Material)); + data.Add(new Snoop.Data.ObjectId("Material ID", ent.MaterialId)); + data.Add(new Snoop.Data.String("Collision type", ent.CollisionType.ToString())); + + // the following functions only work in some cases + try { + data.Add(new Snoop.Data.Object("Geom extents", ent.GeometricExtents)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.InvalidExtents) + data.Add(new Snoop.Data.Exception("Geom extents", e)); + else if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NullExtents) + data.Add(new Snoop.Data.Exception("Geom extents", e)); + else + throw e; + } + + try { + data.Add(new Snoop.Data.Object("Compound object transform", ent.CompoundObjectTransform)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + data.Add(new Snoop.Data.Exception("Compound object transform", e)); + else + throw e; + } + + // branch to all known major sub-classes + + Autodesk.AutoCAD.EditorInput.Camera cam = ent as Autodesk.AutoCAD.EditorInput.Camera; + if (cam != null) { + Stream(data, cam); + return; + } + + DBText text = ent as DBText; + if (text != null) { + Stream(data, text); + return; + } + + Autodesk.AutoCAD.DatabaseServices.Viewport viewPort = ent as Autodesk.AutoCAD.DatabaseServices.Viewport; + if (viewPort != null) { + Stream(data, viewPort); + return; + } + + Curve crv = ent as Curve; + if (crv != null) { + Stream(data, crv); + return; + } + + Dimension dim = ent as Dimension; + if (dim != null) { + Stream(data, dim); + return; + } + + Vertex vert = ent as Vertex; + if (vert != null) { + Stream(data, vert); + return; + } + + Autodesk.AutoCAD.DatabaseServices.Surface surf = ent as Autodesk.AutoCAD.DatabaseServices.Surface; + if (surf != null) { + Stream(data, surf); + return; + } + + Solid3d sld3d = ent as Solid3d; + if (sld3d != null) { + Stream(data, sld3d); + return; + } + + BlockBegin blockBegin = ent as BlockBegin; + if (blockBegin != null) { + Stream(data, blockBegin); + return; + } + + BlockEnd blockEnd = ent as BlockEnd; + if (blockEnd != null) { + Stream(data, blockEnd); + return; + } + + BlockReference blkRef = ent as BlockReference; + if (blkRef != null) { + Stream(data, blkRef); + return; + } + + Body body = ent as Body; + if (body != null) { + Stream(data, body); + return; + } + + Face face = ent as Face; + if (face != null) { + Stream(data, face); + return; + } + + FeatureControlFrame fcf = ent as FeatureControlFrame; + if (fcf != null) { + Stream(data, fcf); + return; + } + + Ole2Frame ole2Frame = ent as Ole2Frame; + if (ole2Frame != null) { + Stream(data, ole2Frame); + return; + } + + Hatch hatch = ent as Hatch; + if (hatch != null) { + Stream(data, hatch); + return; + } + + Image img = ent as Image; + if (img != null) { + Stream(data, img); + return; + } + + DBPoint pt = ent as DBPoint; + if (pt != null) { + Stream(data, pt); + return; + } + + PolyFaceMesh pfaceMesh = ent as PolyFaceMesh; + if (pfaceMesh != null) { + Stream(data, pfaceMesh); + return; + } + + PolygonMesh mesh = ent as PolygonMesh; + if (mesh != null) { + Stream(data, mesh); + return; + } + + MText mtext = ent as MText; + if (mtext != null) { + Stream(data, mtext); + return; + } + + Mline mline = ent as Mline; + if (mline != null) { + Stream(data, mline); + return; + } + + MLeader mleader = ent as MLeader; + if (mleader != null) { + Stream(data, mleader); + return; + } + + ProxyEntity proxyEnt = ent as ProxyEntity; + if (proxyEnt != null) { + Stream(data, proxyEnt); + return; + } + + Region reg = ent as Region; + if (reg != null) { + Stream(data, reg); + return; + } + + SequenceEnd seqEnd = ent as SequenceEnd; + if (seqEnd != null) { + Stream(data, seqEnd); + return; + } + + Shape shp = ent as Shape; + if (img != null) { + Stream(data, shp); + return; + } + + Solid solid = ent as Solid; + if (solid != null) { + Stream(data, solid); + return; + } + + Autodesk.AutoCAD.DatabaseServices.Trace trace = ent as Autodesk.AutoCAD.DatabaseServices.Trace; + if (trace != null) { + Stream(data, trace); + return; + } + + Section sec = ent as Section; + if (sec != null) { + Stream(data, sec); + return; + } + + UnderlayReference ulayRef = ent as UnderlayReference; + if (ulayRef != null) { + Stream(data, ulayRef); + return; + } + + Light light = ent as Light; + if (light != null) { + Stream(data, light); + return; + } + + } + + #region Curves + // main branch for anything derived from Curve (AcDbCurve) + private void + Stream (ArrayList data, Curve crv) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Curve))); + + // MvPart throws an exception for Area + try { + data.Add(new Snoop.Data.Double("Area", crv.Area)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + data.Add(new Snoop.Data.Exception("Area", e)); + } + + data.Add(new Snoop.Data.Bool("Closed", crv.Closed)); + data.Add(new Snoop.Data.Double("Start param", crv.StartParam)); + data.Add(new Snoop.Data.Double("End param", crv.EndParam)); + + // Start point and end point are not applicable for some types of + // curves (e.g., Ray, Xline) + try { + data.Add(new Snoop.Data.Point3d("Start point", crv.StartPoint)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + data.Add(new Snoop.Data.Exception("Start point", e)); + else + throw e; + } + + try { + data.Add(new Snoop.Data.Point3d("End point", crv.EndPoint)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + data.Add(new Snoop.Data.Exception("End point", e)); + else + throw e; + } + + data.Add(new Snoop.Data.Bool("Is periodic", crv.IsPeriodic)); + + // the following is only valid in some cases + try { + data.Add(new Snoop.Data.Object("Spline", crv.Spline)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + data.Add(new Snoop.Data.Exception("Spline", e)); + else + throw e; + } + + // branch to all known major sub-classes + Line line = crv as Line; + if (line != null) { + Stream(data, line); + return; + } + + Arc arc = crv as Arc; + if (arc != null) { + Stream(data, arc); + return; + } + + Circle circ = crv as Circle; + if (circ != null) { + Stream(data, circ); + return; + } + + Ellipse ellipse = crv as Ellipse; + if (ellipse != null) { + Stream(data, ellipse); + return; + } + + Polyline pline = crv as Polyline; + if (pline != null) { + Stream(data, pline); + return; + } + + Polyline2d pline2d = crv as Polyline2d; + if (pline2d != null) { + Stream(data, pline2d); + return; + } + + Polyline3d pline3d = crv as Polyline3d; + if (pline3d != null) { + Stream(data, pline3d); + return; + } + + Leader ldr = crv as Leader; + if (ldr != null) { + Stream(data, ldr); + return; + } + + Ray ray = crv as Ray; + if (ray != null) { + Stream(data, ray); + return; + } + + Xline xline = crv as Xline; + if (xline != null) { + Stream(data, xline); + return; + } + + Spline spline = crv as Spline; + if (spline != null) { + Stream(data, spline); + return; + } + } + + // data for Line (AcDbLine) + private void + Stream (ArrayList data, Line line) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Line))); + + data.Add(new Snoop.Data.Point3d("Start", line.StartPoint)); + data.Add(new Snoop.Data.Point3d("End", line.EndPoint)); + data.Add(new Snoop.Data.Vector3d("Normal", line.Normal)); + data.Add(new Snoop.Data.Distance("Thickness", line.Thickness)); + } + + // data for Arc (AcDbArc) + private void + Stream (ArrayList data, Arc arc) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Arc))); + + data.Add(new Snoop.Data.Point3d("Center", arc.Center)); + data.Add(new Snoop.Data.Distance("Radius", arc.Radius)); + data.Add(new Snoop.Data.Angle("Start angle", arc.StartAngle)); + data.Add(new Snoop.Data.Angle("End angle", arc.EndAngle)); + data.Add(new Snoop.Data.Vector3d("Normal", arc.Normal)); + data.Add(new Snoop.Data.Distance("Thickness", arc.Thickness)); + } + + // data for Circle (AcDbCircle) + private void + Stream (ArrayList data, Circle circ) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Circle))); + + data.Add(new Snoop.Data.Point3d("Center", circ.Center)); + data.Add(new Snoop.Data.Distance("Radius", circ.Radius)); + data.Add(new Snoop.Data.Vector3d("Normal", circ.Normal)); + data.Add(new Snoop.Data.Distance("Thickness", circ.Thickness)); + } + + private void + Stream (ArrayList data, Ellipse ellipse) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Ellipse))); + + data.Add(new Snoop.Data.Point3d("Center", ellipse.Center)); + data.Add(new Snoop.Data.Angle("Start angle", ellipse.StartAngle)); + data.Add(new Snoop.Data.Angle("End angle", ellipse.EndAngle)); + data.Add(new Snoop.Data.Vector3d("Major axis", ellipse.MajorAxis)); + data.Add(new Snoop.Data.Vector3d("Minor axis", ellipse.MinorAxis)); + data.Add(new Snoop.Data.Double("Radius ratio", ellipse.RadiusRatio)); + data.Add(new Snoop.Data.Vector3d("Normal", ellipse.Normal)); + data.Add(new Snoop.Data.Bool("Is null", ellipse.IsNull)); + } + + private void + Stream (ArrayList data, Polyline pline) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Polyline))); + + data.Add(new Snoop.Data.Bool("Closed", pline.Closed)); + if (pline.Handle.Value != 859 && pline.Handle.Value !=741) + { + data.Add(new Snoop.Data.Distance("Constant width", pline.ConstantWidth)); + } + data.Add(new Snoop.Data.Distance("Elevation", pline.Elevation)); + data.Add(new Snoop.Data.Bool("Has bulges", pline.HasBulges)); + data.Add(new Snoop.Data.Bool("Has width", pline.HasWidth)); + data.Add(new Snoop.Data.Bool("Is only lines", pline.IsOnlyLines)); + data.Add(new Snoop.Data.Bool("Plinegen", pline.Plinegen)); + data.Add(new Snoop.Data.Vector3d("Normal", pline.Normal)); + data.Add(new Snoop.Data.Distance("Thickness", pline.Thickness)); + + data.Add(new Snoop.Data.CategorySeparator("Vertices")); + data.Add(new Snoop.Data.Int("Number of vertices", pline.NumberOfVertices)); + + for (int i = 0; i < pline.NumberOfVertices; i++) { + data.Add(new Snoop.Data.CategorySeparator(string.Format("Vertex [{0}]", i))); + + SegmentType segType = pline.GetSegmentType(i); + data.Add(new Snoop.Data.String("Segment type", segType.ToString())); + data.Add(new Snoop.Data.Point2d("2D point", pline.GetPoint2dAt(i))); + data.Add(new Snoop.Data.Point3d("3D point", pline.GetPoint3dAt(i))); + data.Add(new Snoop.Data.Distance("Start width", pline.GetStartWidthAt(i))); + data.Add(new Snoop.Data.Distance("End width", pline.GetEndWidthAt(i))); + data.Add(new Snoop.Data.Double("Bulge", pline.GetBulgeAt(i))); + + if (segType == SegmentType.Arc) + data.Add(new Snoop.Data.Object("Arc segment", pline.GetArcSegmentAt(i))); + else if (segType == SegmentType.Line) + data.Add(new Snoop.Data.Object("Line segment", pline.GetLineSegmentAt(i))); + } + } + + private void + Stream (ArrayList data, Polyline2d pline) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Polyline2d))); + + data.Add(new Snoop.Data.String("Poly type", pline.PolyType.ToString())); + data.Add(new Snoop.Data.Bool("Closed", pline.Closed)); + data.Add(new Snoop.Data.Distance("Default start width", pline.DefaultStartWidth)); + data.Add(new Snoop.Data.Distance("Default end width", pline.DefaultEndWidth)); + data.Add(new Snoop.Data.Distance("Elevation", pline.Elevation)); + data.Add(new Snoop.Data.Bool("Linetype generation on", pline.LinetypeGenerationOn)); + data.Add(new Snoop.Data.Vector3d("Normal", pline.Normal)); + data.Add(new Snoop.Data.Distance("Thickness", pline.Thickness)); + + ObjectIdCollection vertList = new ObjectIdCollection(); + System.Collections.IEnumerator iter = pline.GetEnumerator(); + while (iter.MoveNext()) + vertList.Add((ObjectId)iter.Current); + + data.Add(new Snoop.Data.ObjectIdCollection("Vertices", vertList)); + } + + private void + Stream (ArrayList data, Polyline3d pline) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Polyline3d))); + + data.Add(new Snoop.Data.String("Poly type", pline.PolyType.ToString())); + data.Add(new Snoop.Data.Bool("Closed", pline.Closed)); + + ObjectIdCollection vertList = new ObjectIdCollection(); + + // In case of MvParts the pline id is always null and so the Get + if (pline.ObjectId != ObjectId.Null) { + System.Collections.IEnumerator iter = pline.GetEnumerator(); + while (iter.MoveNext()) + vertList.Add((ObjectId)iter.Current); + } + data.Add(new Snoop.Data.ObjectIdCollection("Vertices", vertList)); + } + + + private void + Stream (ArrayList data, Leader ldr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Leader))); + + data.Add(new Snoop.Data.ObjectId("Dimension style", ldr.DimensionStyle)); + //data.Add(new Snoop.Data.Object("Dimstyle data", ldr.DimstyleData)); // redundant with the one above (just an opened Dimstyle object) + data.Add(new Snoop.Data.String("Annotation type", ldr.AnnoType.ToString())); + data.Add(new Snoop.Data.ObjectId("Annotation ID", ldr.Annotation)); + data.Add(new Snoop.Data.Distance("Annotation width", ldr.AnnoWidth)); + data.Add(new Snoop.Data.Distance("Annotation height", ldr.AnnoHeight)); + data.Add(new Snoop.Data.Vector3d("Annotation offset", ldr.AnnotationOffset)); + data.Add(new Snoop.Data.Distance("Dimasz", ldr.Dimasz)); + data.Add(new Snoop.Data.ObjectToString("Dimclrd", ldr.Dimclrd)); + data.Add(new Snoop.Data.ObjectId("Dimension style", ldr.DimensionStyle)); + data.Add(new Snoop.Data.Distance("Dimgap", ldr.Dimgap)); + data.Add(new Snoop.Data.ObjectId("Dimldrblk", ldr.Dimldrblk)); + data.Add(new Snoop.Data.String("Dimlwd", ldr.Dimlwd.ToString())); + data.Add(new Snoop.Data.Bool("Dimsah", ldr.Dimsah)); + data.Add(new Snoop.Data.Distance("Dimscale", ldr.Dimscale)); + data.Add(new Snoop.Data.Int("Dimtad", ldr.Dimtad)); + //data.Add(new Snoop.Data.ObjectId("Dimtxsty", ldr.Dimtxsty)); // TBD: Fix JMA + data.Add(new Snoop.Data.Distance("Dimtxt", ldr.Dimtxt)); + data.Add(new Snoop.Data.Bool("Has arrowhead", ldr.HasArrowHead)); + data.Add(new Snoop.Data.Bool("Has hookline", ldr.HasHookLine)); + data.Add(new Snoop.Data.Bool("Is splined", ldr.IsSplined)); + data.Add(new Snoop.Data.Vector3d("Normal", ldr.Normal)); + + data.Add(new Snoop.Data.CategorySeparator("Vertices")); + data.Add(new Snoop.Data.Point3d("First vertex", ldr.FirstVertex)); + data.Add(new Snoop.Data.Point3d("Last vertex", ldr.LastVertex)); + data.Add(new Snoop.Data.Int("Number of vertices", ldr.NumVertices)); + + for (int i = 0; i < ldr.NumVertices; i++) { + data.Add(new Snoop.Data.Point3d(string.Format("Vertex [{0}]", i), ldr.VertexAt(i))); + } + + } + + private void + Stream (ArrayList data, Ray ray) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Ray))); + + data.Add(new Snoop.Data.Point3d("Base point", ray.BasePoint)); + data.Add(new Snoop.Data.Vector3d("Unit direction", ray.UnitDir)); + } + + private void + Stream (ArrayList data, Xline xline) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Xline))); + + data.Add(new Snoop.Data.Point3d("Base point", xline.BasePoint)); + data.Add(new Snoop.Data.Vector3d("Unit direction", xline.UnitDir)); + } + + private void + Stream (ArrayList data, Spline spline) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Spline))); + + data.Add(new Snoop.Data.Int("Degree", spline.Degree)); + + try { + data.Add(new Snoop.Data.Vector3d("Start fit tangent", spline.StartFitTangent)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + data.Add(new Snoop.Data.Exception("Start fit tangent", e)); + else + throw e; + } + + try { + data.Add(new Snoop.Data.Vector3d("End fit tangent", spline.EndFitTangent)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e){ + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + data.Add(new Snoop.Data.Exception("End fit tangent", e)); + else + throw e; + } + + data.Add(new Snoop.Data.Bool("Has fit data", spline.HasFitData)); + + try { + data.Add(new Snoop.Data.Object("Fit data", spline.FitData)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + data.Add(new Snoop.Data.Exception("Fit data", e)); + else + throw e; + } + + try { + data.Add(new Snoop.Data.Double("Fit tolerance", spline.FitTolerance)); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + data.Add(new Snoop.Data.Exception("Fit tolerance", e)); + else + throw e; + } + + data.Add(new Snoop.Data.Object("Nurbs data", spline.NurbsData)); + data.Add(new Snoop.Data.Bool("Is null", spline.IsNull)); + data.Add(new Snoop.Data.Bool("Is rational", spline.IsRational)); + + data.Add(new Snoop.Data.Int("Number of control points", spline.NumControlPoints)); + for (int i=0; i + /// needs to be revisited: The managed wrapper for AcDbSurface class is missing an object factory + /// (protocol extension that maps rx class to managed class). + /// arj 02/03/06 + /// + /// + + private void + Stream (ArrayList data, Autodesk.AutoCAD.DatabaseServices.Surface surf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.DatabaseServices.Surface))); + + data.Add(new Snoop.Data.Int("U isoline density", surf.UIsoLineDensity)); + data.Add(new Snoop.Data.Int("V isoline density", surf.VIsoLineDensity)); + + + ExtrudedSurface extrSurf = surf as ExtrudedSurface; + if (extrSurf != null) { + Stream(data, extrSurf); + return; + } + + LoftedSurface loftSurf = surf as LoftedSurface; + if (loftSurf != null) { + Stream(data, loftSurf); + return; + } + + PlaneSurface planeSurf = surf as PlaneSurface; + if (planeSurf != null) { + Stream(data, planeSurf); + return; + } + + RevolvedSurface revSurf = surf as RevolvedSurface; + if (revSurf != null) { + Stream(data, revSurf); + return; + } + + SweptSurface sweptSurf = surf as SweptSurface; + if (sweptSurf != null) { + Stream(data, sweptSurf); + return; + } + } + + private void + Stream (ArrayList data, ExtrudedSurface extrSurf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ExtrudedSurface))); + + data.Add(new Snoop.Data.Double("Height", extrSurf.Height)); + data.Add(new Snoop.Data.Object("Sweep entity", extrSurf.SweepEntity)); + data.Add(new Snoop.Data.Object("Sweep options", extrSurf.SweepOptions)); + data.Add(new Snoop.Data.Vector3d("Sweep vector", extrSurf.SweepVec)); + } + + private void + Stream (ArrayList data, LoftedSurface loftSurf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LoftedSurface))); + + data.Add(new Snoop.Data.ObjectCollection("Cross sections", loftSurf.CrossSections)); + data.Add(new Snoop.Data.ObjectCollection("Guide curves", loftSurf.GuideCurves)); + data.Add(new Snoop.Data.Object("Loft options", loftSurf.LoftOptions)); + data.Add(new Snoop.Data.Object("Path entity", loftSurf.PathEntity)); + } + + private void + Stream (ArrayList data, PlaneSurface planeSurf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PlaneSurface))); + } + + private void + Stream (ArrayList data, RevolvedSurface revSurf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RevolvedSurface))); + + data.Add(new Snoop.Data.Vector3d("Axis direction", revSurf.AxisDirection)); + data.Add(new Snoop.Data.Point3d("Axis point", revSurf.AxisPoint)); + data.Add(new Snoop.Data.Angle("Revolve angle", revSurf.RevolveAngle)); + data.Add(new Snoop.Data.Object("Revolve entity", revSurf.RevolveEntity)); + data.Add(new Snoop.Data.Object("Revolve options", revSurf.RevolveOptions)); + data.Add(new Snoop.Data.Double("Start angle", revSurf.StartAngle)); + } + + private void + Stream (ArrayList data, SweptSurface sweptSurf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SweptSurface))); + + data.Add(new Snoop.Data.Distance("Path length", sweptSurf.PathLength)); + data.Add(new Snoop.Data.Object("Path entity", sweptSurf.PathEntity)); + data.Add(new Snoop.Data.Object("Sweep entity", sweptSurf.SweepEntity)); + data.Add(new Snoop.Data.Object("Sweep options", sweptSurf.SweepOptions)); + } + + private void + Stream (ArrayList data, Image img) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Image))); + + // no data at this level + + RasterImage rasterImg = img as RasterImage; + if (rasterImg != null) { + Stream(data, rasterImg); + return; + } + } + + private void + Stream (ArrayList data, RasterImage rasterImg) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RasterImage))); + + data.Add(new Snoop.Data.ObjectId("Image def ID", rasterImg.ImageDefId)); + data.Add(new Snoop.Data.Double("Brightness", rasterImg.Brightness)); + data.Add(new Snoop.Data.String("Clip boundary type", rasterImg.ClipBoundaryType.ToString())); + data.Add(new Snoop.Data.Int("Contrast", rasterImg.Contrast)); + data.Add(new Snoop.Data.String("Display options", rasterImg.DisplayOptions.ToString())); + data.Add(new Snoop.Data.Int("Fade", rasterImg.Fade)); + data.Add(new Snoop.Data.Bool("Is clipped", rasterImg.IsClipped)); + data.Add(new Snoop.Data.Object("Orientation", rasterImg.Orientation)); + data.Add(new Snoop.Data.Object("Pixel to model transform", rasterImg.PixelToModelTransform)); + data.Add(new Snoop.Data.ObjectId("Reactor ID", rasterImg.ReactorId)); + data.Add(new Snoop.Data.Vector2d("Scale", rasterImg.Scale)); + + Wipeout wipeout = rasterImg as Wipeout; + if (wipeout != null) { + Stream(data, wipeout); + return; + } + } + + private void + Stream(ArrayList data, Wipeout wipeout) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Wipeout))); + + data.Add(new Snoop.Data.Bool("Has frame", wipeout.HasFrame)); + } + + private void + Stream (ArrayList data, Shape shp) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Shape))); + + data.Add(new Snoop.Data.ObjectId("Style ID", shp.StyleId)); + data.Add(new Snoop.Data.String("Name", shp.Name)); + data.Add(new Snoop.Data.Vector3d("Normal", shp.Normal)); + data.Add(new Snoop.Data.Angle("Oblique", shp.Oblique)); + data.Add(new Snoop.Data.Point3d("Position", shp.Position)); + data.Add(new Snoop.Data.Angle("Rotation", shp.Rotation)); + data.Add(new Snoop.Data.ObjectId("Shape index", shp.ShapeIndex)); + data.Add(new Snoop.Data.Int("Shape number", shp.ShapeNumber)); + data.Add(new Snoop.Data.Distance("Size", shp.Size)); + data.Add(new Snoop.Data.Distance("Thickness", shp.Thickness)); + data.Add(new Snoop.Data.Distance("Width factor", shp.WidthFactor)); + } + } +} + diff --git a/MgdDbgLibrary/Snoop/CollectorExts/Geometry.cs b/MgdDbgLibrary/Snoop/CollectorExts/Geometry.cs new file mode 100644 index 0000000..f16fb2c --- /dev/null +++ b/MgdDbgLibrary/Snoop/CollectorExts/Geometry.cs @@ -0,0 +1,1391 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + + +using System.Diagnostics; +using System.Collections; +using Autodesk.AutoCAD.Geometry; +using MgdDbg.Snoop.Collectors; + +namespace MgdDbg.Snoop.CollectorExts +{ + /// + /// This is a Snoop Collector Extension object to collect data from AcGe objects. + /// + public class Geometry : CollectorExt + { + public + Geometry() + { + } + + protected override void + CollectEvent(object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + // see if it is a type we are responsible for + Entity3d ent3d = e.ObjToSnoop as Entity3d; + if (ent3d != null) { + Stream(snoopCollector.Data(), ent3d); + return; + } + + Entity2d ent2d = e.ObjToSnoop as Entity2d; + if (ent2d != null) { + Stream(snoopCollector.Data(), ent2d); + return; + } + + CurveBoundary curveBound = e.ObjToSnoop as CurveBoundary; + if (curveBound != null) { + Stream(snoopCollector.Data(), curveBound); + return; + } + + Interval interval = e.ObjToSnoop as Interval; + if (interval != null) { + Stream(snoopCollector.Data(), interval); + return; + } + + if (e.ObjToSnoop is Matrix2d) { + Stream(snoopCollector.Data(), (Matrix2d)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is Matrix3d) { + Stream(snoopCollector.Data(), (Matrix3d)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is CoordinateSystem3d) { + Stream(snoopCollector.Data(), (CoordinateSystem3d)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is Point2dCollection) { + Stream(snoopCollector.Data(), (Point2dCollection)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is Point3dCollection) { + Stream(snoopCollector.Data(), (Point3dCollection)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is DoubleCollection) { + Stream(snoopCollector.Data(), (DoubleCollection)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is IntegerCollection) { + Stream(snoopCollector.Data(), (IntegerCollection)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is ClipBoundary2dData) { + Stream(snoopCollector.Data(), (ClipBoundary2dData)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is CompositeParameter) { + Stream(snoopCollector.Data(), (CompositeParameter)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is CurveBoundaryData) { + Stream(snoopCollector.Data(), (CurveBoundaryData)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is GeoDataLonLatAltInfo) { + Stream(snoopCollector.Data(), (GeoDataLonLatAltInfo)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is NurbCurve2dData) { + Stream(snoopCollector.Data(), (NurbCurve2dData)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is NurbCurve2dFitData) { + Stream(snoopCollector.Data(), (NurbCurve2dFitData)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is NurbCurve3dData) { + Stream(snoopCollector.Data(), (NurbCurve2dData)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is NurbCurve3dFitData) { + Stream(snoopCollector.Data(), (NurbCurve2dFitData)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is NurbSurfaceDefinition) { + Stream(snoopCollector.Data(), (NurbCurve2dFitData)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is PlanarEquationCoefficients) { + Stream(snoopCollector.Data(), (PlanarEquationCoefficients)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is SurfaceSurfaceIntersectorConfigurations) { + Stream(snoopCollector.Data(), (SurfaceSurfaceIntersectorConfigurations)e.ObjToSnoop); + return; + } + } + + private void + Stream(ArrayList data, Entity3d ent3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Entity3d))); + + // branch to all known major sub-classes + Curve3d crv = ent3d as Curve3d; + if (crv != null) { + Stream(data, crv); + } + + BoundBlock3d bndBlk = ent3d as BoundBlock3d; + if (bndBlk != null) { + Stream(data, bndBlk); + } + + Surface surf = ent3d as Surface; + if (surf != null) { + Stream(data, surf); + } + + PointEntity3d ptEnt3d = ent3d as PointEntity3d; + if (ptEnt3d != null) { + Stream(data, ptEnt3d); + } + + CurveCurveIntersector3d curCurInt3d = ent3d as CurveCurveIntersector3d; + if (curCurInt3d != null) { + Stream(data, curCurInt3d); + } + + SurfaceSurfaceIntersector surSurInt = ent3d as SurfaceSurfaceIntersector; + if (surSurInt != null) { + Stream(data, surSurInt); + } + } + + #region Entity3d Derived classes + + private void + Stream(ArrayList data, Curve3d crv) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Curve3d))); + + data.Add(new Snoop.Data.Object("Bound block", crv.BoundBlock)); + data.Add(new Snoop.Data.Object("Ortho bound block", crv.OrthoBoundBlock)); + + // branch to all known major sub-classes + LinearEntity3d linearEnt = crv as LinearEntity3d; + if (linearEnt != null) { + Stream(data, linearEnt); + return; + } + + CircularArc3d circArc = crv as CircularArc3d; + if (circArc != null) { + Stream(data, circArc); + return; + } + + SplineEntity3d splineEnt3d = crv as SplineEntity3d; + if (splineEnt3d != null) { + Stream(data, splineEnt3d); + return; + } + + CompositeCurve3d compCur3d = crv as CompositeCurve3d; + if (compCur3d != null) { + Stream(data, compCur3d); + return; + } + + OffsetCurve3d offCur3d = crv as OffsetCurve3d; + if (offCur3d != null) { + Stream(data, offCur3d); + return; + } + + EllipticalArc3d ellArc3d = crv as EllipticalArc3d; + if (ellArc3d != null) { + Stream(data, ellArc3d); + return; + } + + ExternalCurve3d extCur3d = crv as ExternalCurve3d; + if (extCur3d != null) { + Stream(data, extCur3d); + return; + } + + } + + #region Curve3d Derived classes + private void + Stream(ArrayList data, SplineEntity3d splineEnt3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SplineEntity3d))); + + data.Add(new Snoop.Data.Int("Degree", splineEnt3d.Degree)); + data.Add(new Snoop.Data.Int("Number Of Control Points", splineEnt3d.NumberOfControlPoints)); + data.Add(new Snoop.Data.Int("Number Of Knots", splineEnt3d.NumberOfKnots)); + data.Add(new Snoop.Data.Int("Order", splineEnt3d.Order)); + data.Add(new Snoop.Data.Double("Start Parameter", splineEnt3d.StartParameter)); + data.Add(new Snoop.Data.Double("End Parameter", splineEnt3d.EndParameter)); + data.Add(new Snoop.Data.Point3d("Start Point", splineEnt3d.StartPoint)); + data.Add(new Snoop.Data.Point3d("End Point", splineEnt3d.EndPoint)); + + // branch to all known major sub-classes + PolylineCurve3d plineCur3d = splineEnt3d as PolylineCurve3d; + if (plineCur3d != null) { + Stream(data, plineCur3d); + return; + } + + CubicSplineCurve3d cubSplineCur3d = splineEnt3d as CubicSplineCurve3d; + if (cubSplineCur3d != null) { + Stream(data, cubSplineCur3d); + return; + } + + NurbCurve3d nurbCur = splineEnt3d as NurbCurve3d; + if (nurbCur != null) { + Stream(data, nurbCur); + return; + } + } + + #region SplineEnt3d Derived classes + + private void + Stream(ArrayList data, PolylineCurve3d plineCur3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PolylineCurve3d))); + + data.Add(new Snoop.Data.Int("Degree", plineCur3d.Degree)); + data.Add(new Snoop.Data.Int("Number Of Control Points", plineCur3d.NumberOfControlPoints)); + data.Add(new Snoop.Data.Int("Number Of Fit Points", plineCur3d.NumberOfFitPoints)); + data.Add(new Snoop.Data.Int("Number Of Knots", plineCur3d.NumberOfKnots)); + data.Add(new Snoop.Data.Int("Order", plineCur3d.Order)); + data.Add(new Snoop.Data.Double("Start Parameter", plineCur3d.StartParameter)); + data.Add(new Snoop.Data.Double("End Parameter", plineCur3d.EndParameter)); + data.Add(new Snoop.Data.Point3d("Start Point", plineCur3d.StartPoint)); + data.Add(new Snoop.Data.Point3d("End Point", plineCur3d.EndPoint)); + + // branch to all known major sub-classes + AugmentedPolylineCurve3d augPlineCur3d = plineCur3d as AugmentedPolylineCurve3d; + if (augPlineCur3d != null) { + Stream(data, augPlineCur3d); + return; + } + } + + private void + Stream(ArrayList data, AugmentedPolylineCurve3d augPlineCur3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AugmentedPolylineCurve3d))); + + data.Add(new Snoop.Data.Int("Degree", augPlineCur3d.Degree)); + data.Add(new Snoop.Data.Int("Number Of Control Points", augPlineCur3d.NumberOfControlPoints)); + data.Add(new Snoop.Data.Int("Number Of Fit Points", augPlineCur3d.NumberOfFitPoints)); + data.Add(new Snoop.Data.Int("Number Of Knots", augPlineCur3d.NumberOfKnots)); + data.Add(new Snoop.Data.Int("Order", augPlineCur3d.Order)); + data.Add(new Snoop.Data.Double("Start Parameter", augPlineCur3d.StartParameter)); + data.Add(new Snoop.Data.Double("End Parameter", augPlineCur3d.EndParameter)); + data.Add(new Snoop.Data.Point3d("Start Point", augPlineCur3d.StartPoint)); + data.Add(new Snoop.Data.Point3d("End Point", augPlineCur3d.EndPoint)); + data.Add(new Snoop.Data.Double("Approximate Tolerance", augPlineCur3d.ApproximateTolerance)); + } + + private void + Stream(ArrayList data, CubicSplineCurve3d cubSplineCur3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CubicSplineCurve3d))); + + data.Add(new Snoop.Data.Int("Degree", cubSplineCur3d.Degree)); + data.Add(new Snoop.Data.Int("Number Of Control Points", cubSplineCur3d.NumberOfControlPoints)); + data.Add(new Snoop.Data.Int("Number Of Fit Points", cubSplineCur3d.NumberOfFitPoints)); + data.Add(new Snoop.Data.Int("Number Of Knots", cubSplineCur3d.NumberOfKnots)); + data.Add(new Snoop.Data.Int("Order", cubSplineCur3d.Order)); + data.Add(new Snoop.Data.Double("Start Parameter", cubSplineCur3d.StartParameter)); + data.Add(new Snoop.Data.Double("End Parameter", cubSplineCur3d.EndParameter)); + data.Add(new Snoop.Data.Point3d("Start Point", cubSplineCur3d.StartPoint)); + data.Add(new Snoop.Data.Point3d("End Point", cubSplineCur3d.EndPoint)); + } + + private void + Stream(ArrayList data, NurbCurve3d nurbCur3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(NurbCurve3d))); + + data.Add(new Snoop.Data.Int("Degree", nurbCur3d.Degree)); + data.Add(new Snoop.Data.Int("Number Of Control Points", nurbCur3d.NumberOfControlPoints)); + data.Add(new Snoop.Data.Int("Number Of Fit Points", nurbCur3d.NumFitPoints)); + data.Add(new Snoop.Data.Int("Number Of Knots", nurbCur3d.NumberOfKnots)); + data.Add(new Snoop.Data.Int("Number Of Weights", nurbCur3d.NumWeights)); + data.Add(new Snoop.Data.Int("Order", nurbCur3d.Order)); + data.Add(new Snoop.Data.Double("Start Parameter", nurbCur3d.StartParameter)); + data.Add(new Snoop.Data.Double("End Parameter", nurbCur3d.EndParameter)); + data.Add(new Snoop.Data.Point3d("Start Point", nurbCur3d.StartPoint)); + data.Add(new Snoop.Data.Point3d("End Point", nurbCur3d.EndPoint)); + } + + #endregion + + private void + Stream(ArrayList data, LinearEntity3d linearEnt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LinearEntity3d))); + + data.Add(new Snoop.Data.Vector3d("Direction", linearEnt.Direction)); + data.Add(new Snoop.Data.Point3d("Point on line", linearEnt.PointOnLine)); + + // branch to all known major sub-classes + Line3d line = linearEnt as Line3d; + if (line != null) { + Stream(data, line); + return; + } + + LineSegment3d line3d = linearEnt as LineSegment3d; + if (line3d != null) + { + Stream(data, line3d); + return; + } + + Ray3d ray3d = linearEnt as Ray3d; + if (ray3d != null) { + Stream(data, ray3d); + return; + } + } + + #region LinearEnt3d Derived Classes + private void + Stream(ArrayList data, Line3d line) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Line3d))); + data.Add(new Snoop.Data.Point3d("Start point", line.StartPoint)); + data.Add(new Snoop.Data.Point3d("End point", line.EndPoint)); + } + + private void + Stream(ArrayList data, LineSegment3d line3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LineSegment3d))); + + data.Add(new Snoop.Data.Point3d("Start point", line3d.StartPoint)); + data.Add(new Snoop.Data.Point3d("Mid point", line3d.MidPoint)); + data.Add(new Snoop.Data.Point3d("End point", line3d.EndPoint)); + data.Add(new Snoop.Data.Double("Length", line3d.Length)); + } + + private void + Stream(ArrayList data, Ray3d ray3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Ray3d))); + + data.Add(new Snoop.Data.Point3d("Start point", ray3d.StartPoint)); + data.Add(new Snoop.Data.Point3d("End point", ray3d.EndPoint)); + } + #endregion + + private void + Stream(ArrayList data, CircularArc3d circArc) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CircularArc3d))); + + data.Add(new Snoop.Data.Point3d("Center", circArc.Center)); + data.Add(new Snoop.Data.Vector3d("Normal", circArc.Normal)); + data.Add(new Snoop.Data.Distance("Radius", circArc.Radius)); + data.Add(new Snoop.Data.Point3d("Start point", circArc.StartPoint)); + data.Add(new Snoop.Data.Point3d("End point", circArc.EndPoint)); + data.Add(new Snoop.Data.Angle("Start angle", circArc.StartAngle)); + data.Add(new Snoop.Data.Angle("End angle", circArc.EndAngle)); + data.Add(new Snoop.Data.Vector3d("Reference vector", circArc.ReferenceVector)); + } + + private void + Stream(ArrayList data, CompositeCurve3d compCur3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CompositeCurve3d))); + + data.Add(new Snoop.Data.Point3d("Start Point", compCur3d.StartPoint)); + data.Add(new Snoop.Data.Point3d("End Point", compCur3d.EndPoint)); + } + + private void + Stream(ArrayList data, OffsetCurve3d offCur3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(OffsetCurve3d))); + + data.Add(new Snoop.Data.Point3d("Start Point", offCur3d.StartPoint)); + data.Add(new Snoop.Data.Point3d("End Point", offCur3d.EndPoint)); + data.Add(new Snoop.Data.Vector3d("Normal", offCur3d.Normal)); + data.Add(new Snoop.Data.Double("Offset Distance", offCur3d.OffsetDistance)); + } + + private void + Stream(ArrayList data, EllipticalArc3d ellArc3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(EllipticalArc3d))); + + data.Add(new Snoop.Data.Point3d("Start Point", ellArc3d.StartPoint)); + data.Add(new Snoop.Data.Point3d("End Point", ellArc3d.EndPoint)); + data.Add(new Snoop.Data.Vector3d("Normal", ellArc3d.Normal)); + data.Add(new Snoop.Data.Point3d("Center", ellArc3d.Center)); + data.Add(new Snoop.Data.Double("Start Angle", ellArc3d.StartAngle)); + data.Add(new Snoop.Data.Double("End Angle", ellArc3d.EndAngle)); + data.Add(new Snoop.Data.Vector3d("Major Axis", ellArc3d.MajorAxis)); + data.Add(new Snoop.Data.Vector3d("Minor Axis", ellArc3d.MinorAxis)); + data.Add(new Snoop.Data.Double("Major Radius", ellArc3d.MajorRadius)); + data.Add(new Snoop.Data.Double("Minor Radius", ellArc3d.MinorRadius)); + } + + private void + Stream(ArrayList data, ExternalCurve3d exCur3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ExternalCurve3d))); + + data.Add(new Snoop.Data.Point3d("Start Point", exCur3d.StartPoint)); + data.Add(new Snoop.Data.Point3d("End Point", exCur3d.EndPoint)); + data.Add(new Snoop.Data.Bool("Is Circular Arc", exCur3d.IsCircularArc)); + data.Add(new Snoop.Data.Bool("Is Defined", exCur3d.IsDefined)); + data.Add(new Snoop.Data.Bool("Is EllipticalArc", exCur3d.IsEllipticalArc)); + data.Add(new Snoop.Data.Bool("Is Line", exCur3d.IsLine)); + data.Add(new Snoop.Data.Bool("Is LineSegment", exCur3d.IsLineSegment)); + data.Add(new Snoop.Data.Bool("Is Native Curve", exCur3d.IsNativeCurve)); + data.Add(new Snoop.Data.Bool("Is Nurb Curve", exCur3d.IsNurbCurve)); + data.Add(new Snoop.Data.Bool("Is Ray", exCur3d.IsRay)); + } + #endregion + + private void + Stream(ArrayList data, BoundBlock3d bndBlk) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(BoundBlock3d))); + + data.Add(new Snoop.Data.Point3d("Base point", bndBlk.BasePoint)); + data.Add(new Snoop.Data.Vector3d("Direction 1", bndBlk.Direction1)); + data.Add(new Snoop.Data.Vector3d("Direction 2", bndBlk.Direction2)); + data.Add(new Snoop.Data.Vector3d("Direction 3", bndBlk.Direction3)); + data.Add(new Snoop.Data.Bool("Is box", bndBlk.IsBox)); + } + + private void + Stream(ArrayList data, Surface surf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Surface))); + + data.Add(new Snoop.Data.Bool("Is normal reversed", surf.IsNormalReversed)); + data.Add(new Snoop.Data.Object("Reverse normal", surf.ReverseNormal)); + + + // branch to all known major sub-classes + PlanarEntity planEnt = surf as PlanarEntity; + if (planEnt != null) { + Stream(data, planEnt); + } + + Cone cone = surf as Cone; + if (cone != null) { + Stream(data, cone); + } + + Cylinder cyl = surf as Cylinder; + if (cyl != null) { + Stream(data, cyl); + } + + ExternalSurface extSurf = surf as ExternalSurface; + if (extSurf != null) { + Stream(data, extSurf); + } + + ExternalBoundedSurface extBoundSurf = surf as ExternalBoundedSurface; + if (extBoundSurf != null) { + Stream(data, extBoundSurf); + } + + NurbSurface nurbSurf = surf as NurbSurface; + if (nurbSurf != null) { + Stream(data, nurbSurf); + } + + OffsetSurface offSurf = surf as OffsetSurface; + if (offSurf != null) { + Stream(data, offSurf); + } + + Sphere sphere = surf as Sphere; + if (sphere != null) { + Stream(data, sphere); + } + + Torus torus = surf as Torus; + if (torus != null) { + Stream(data, torus); + } + } + + #region Surface Derived Classes + private void + Stream(ArrayList data, PlanarEntity planEnt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PlanarEntity))); + + data.Add(new Snoop.Data.Point3d("Point On Plane", planEnt.PointOnPlane)); + data.Add(new Snoop.Data.Vector3d("Normal", planEnt.Normal)); + data.Add(new Snoop.Data.Bool("Is Normal Reversed", planEnt.IsNormalReversed)); + + BoundedPlane boundPlane = planEnt as BoundedPlane; + if (boundPlane != null) { + Stream(data, boundPlane); + } + } + + private void + Stream(ArrayList data, BoundedPlane boundPlane) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(BoundedPlane))); + + data.Add(new Snoop.Data.Point3d("Point On Plane", boundPlane.PointOnPlane)); + data.Add(new Snoop.Data.Vector3d("Normal", boundPlane.Normal)); + data.Add(new Snoop.Data.Bool("Is Normal Reversed", boundPlane.IsNormalReversed)); + } + + private void + Stream(ArrayList data, Cone cone) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Cone))); + + data.Add(new Snoop.Data.Point3d("Apex", cone.Apex)); + data.Add(new Snoop.Data.Vector3d("Axis Of Symmetry", cone.AxisOfSymmetry)); + data.Add(new Snoop.Data.Bool("Is Normal Reversed", cone.IsNormalReversed)); + data.Add(new Snoop.Data.Point3d("Base Center", cone.BaseCenter)); + data.Add(new Snoop.Data.Double("Base Radius", cone.BaseRadius)); + data.Add(new Snoop.Data.Double("Half Angle", cone.HalfAngle)); + data.Add(new Snoop.Data.Vector3d("Reference Axis", cone.ReferenceAxis)); + } + + private void + Stream(ArrayList data, Cylinder cyl) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Cylinder))); + + data.Add(new Snoop.Data.Vector3d("Axis Of Symmetry", cyl.AxisOfSymmetry)); + data.Add(new Snoop.Data.Bool("Is Normal Reversed", cyl.IsNormalReversed)); + data.Add(new Snoop.Data.Vector3d("Reference Axis", cyl.ReferenceAxis)); + data.Add(new Snoop.Data.Point3d("Origin", cyl.Origin)); + data.Add(new Snoop.Data.Double("Radius", cyl.Radius)); + } + + private void + Stream(ArrayList data, ExternalSurface extSurf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ExternalSurface))); + + data.Add(new Snoop.Data.Bool("Is Cone", extSurf.IsCone)); + data.Add(new Snoop.Data.Bool("Is Cylinder", extSurf.IsCylinder)); + data.Add(new Snoop.Data.Bool("Is Native Surface", extSurf.IsNativeSurface)); + data.Add(new Snoop.Data.Bool("Is Normal Reversed", extSurf.IsNormalReversed)); + data.Add(new Snoop.Data.Bool("Is Nurb Surface", extSurf.IsNurbSurface)); + data.Add(new Snoop.Data.Bool("Is Owner Of Surface", extSurf.IsOwnerOfSurface)); + data.Add(new Snoop.Data.Bool("Is Plane", extSurf.IsPlane)); + data.Add(new Snoop.Data.Bool("Is Sphere", extSurf.IsSphere)); + data.Add(new Snoop.Data.Bool("Is Torus", extSurf.IsTorus)); + } + + private void + Stream(ArrayList data, ExternalBoundedSurface extBoundSurf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ExternalBoundedSurface))); + + data.Add(new Snoop.Data.Bool("Is Cone", extBoundSurf.IsCone)); + data.Add(new Snoop.Data.Bool("Is Cylinder", extBoundSurf.IsCylinder)); + data.Add(new Snoop.Data.Bool("Is External Surface", extBoundSurf.IsExternalSurface)); + data.Add(new Snoop.Data.Bool("Is Normal Reversed", extBoundSurf.IsNormalReversed)); + data.Add(new Snoop.Data.Bool("Is Nurbs", extBoundSurf.IsNurbs)); + data.Add(new Snoop.Data.Bool("Is Owner Of Surface", extBoundSurf.IsOwnerOfSurface)); + data.Add(new Snoop.Data.Bool("Is Plane", extBoundSurf.IsPlane)); + data.Add(new Snoop.Data.Bool("Is Sphere", extBoundSurf.IsSphere)); + data.Add(new Snoop.Data.Bool("Is Torus", extBoundSurf.IsTorus)); + data.Add(new Snoop.Data.Int("Number of Contours", extBoundSurf.NumContours)); + } + + private void + Stream(ArrayList data, NurbSurface nurbSurf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(NurbSurface))); + + data.Add(new Snoop.Data.Int("Degree In U", nurbSurf.DegreeInU)); + data.Add(new Snoop.Data.Int("Degree In V", nurbSurf.DegreeInV)); + data.Add(new Snoop.Data.Bool("Is Normal Reversed", nurbSurf.IsNormalReversed)); + data.Add(new Snoop.Data.Bool("Is Periodic In U", nurbSurf.IsPeriodicInU)); + data.Add(new Snoop.Data.Bool("Is Periodic In V", nurbSurf.IsPeriodicInV)); + data.Add(new Snoop.Data.Bool("Is Rational In U", nurbSurf.IsRationalInU)); + data.Add(new Snoop.Data.Bool("Is Rational In V", nurbSurf.IsRationalInV)); + data.Add(new Snoop.Data.Int("Number of Control Points In U", nurbSurf.NumControlPointsInU)); + data.Add(new Snoop.Data.Int("Number of Control Points In V", nurbSurf.NumControlPointsInV)); + data.Add(new Snoop.Data.Int("Number of Knots In U", nurbSurf.NumKnotsInU)); + data.Add(new Snoop.Data.Int("Number of Knots In V", nurbSurf.NumKnotsInV)); + data.Add(new Snoop.Data.Double("Periodic In U", nurbSurf.PeriodicInU)); + data.Add(new Snoop.Data.Double("Periodic In V", nurbSurf.PeriodicInV)); + data.Add(new Snoop.Data.Int("Singularity In U", nurbSurf.SingularityInU)); + data.Add(new Snoop.Data.Int("Singularity In V", nurbSurf.SingularityInV)); + } + + private void + Stream(ArrayList data, OffsetSurface offSurf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(OffsetSurface))); + + data.Add(new Snoop.Data.Bool("Is Bounded Plane", offSurf.IsBoundedPlane)); + data.Add(new Snoop.Data.Bool("Is Cone", offSurf.IsCone)); + data.Add(new Snoop.Data.Bool("Is Cylinder", offSurf.IsCylinder)); + data.Add(new Snoop.Data.Bool("Is Normal Reversed", offSurf.IsNormalReversed)); + data.Add(new Snoop.Data.Bool("Is Plane", offSurf.IsPlane)); + data.Add(new Snoop.Data.Bool("Is Sphere", offSurf.IsSphere)); + data.Add(new Snoop.Data.Bool("Is Torus", offSurf.IsTorus)); + data.Add(new Snoop.Data.Double("Offset Dist", offSurf.OffsetDist)); + } + + private void + Stream(ArrayList data, Sphere sphere) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Sphere))); + + data.Add(new Snoop.Data.Point3d("Center", sphere.Center)); + data.Add(new Snoop.Data.Bool("Is Outer Normal", sphere.IsOuterNormal)); + data.Add(new Snoop.Data.Vector3d("Reference Axis", sphere.ReferenceAxis)); + data.Add(new Snoop.Data.Vector3d("North Axis", sphere.NorthAxis)); + data.Add(new Snoop.Data.Point3d("North Pole", sphere.NorthPole)); + data.Add(new Snoop.Data.Point3d("South Pole", sphere.SouthPole)); + data.Add(new Snoop.Data.Double("Radius", sphere.Radius)); + } + + private void + Stream(ArrayList data, Torus torus) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Torus))); + + data.Add(new Snoop.Data.Vector3d("Axis Of Symmetry", torus.AxisOfSymmetry)); + data.Add(new Snoop.Data.Point3d("Center", torus.Center)); + data.Add(new Snoop.Data.Bool("Is Apple", torus.IsApple)); + data.Add(new Snoop.Data.Bool("Is Degenerate", torus.IsDegenerate)); + data.Add(new Snoop.Data.Bool("Is Doughnut", torus.IsDoughnut)); + data.Add(new Snoop.Data.Bool("Is Hollow", torus.IsHollow)); + data.Add(new Snoop.Data.Bool("Is Lemon", torus.IsLemon)); + data.Add(new Snoop.Data.Bool("Is Normal Reversed", torus.IsNormalReversed)); + data.Add(new Snoop.Data.Bool("Is Outer Normal", torus.IsOuterNormal)); + data.Add(new Snoop.Data.Bool("Is Vortex", torus.IsVortex)); + data.Add(new Snoop.Data.Double("Major Radius", torus.MajorRadius)); + data.Add(new Snoop.Data.Double("Minor Radius", torus.MinorRadius)); + data.Add(new Snoop.Data.Vector3d("Minor Radius", torus.ReferenceAxis)); + } + + #endregion + + private void + Stream(ArrayList data, PointEntity3d ptEnt3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PointEntity3d))); + + // branch to all known major sub-classes + PointOnCurve3d ptOnCur3d = ptEnt3d as PointOnCurve3d; + if (ptOnCur3d != null) { + Stream(data, ptOnCur3d); + } + + Position3d postn3d = ptEnt3d as Position3d; + if (postn3d != null) { + Stream(data, postn3d); + } + + PointOnSurface ptOnSurf = ptEnt3d as PointOnSurface; + if (ptOnSurf != null) { + Stream(data, ptOnSurf); + } + } + + #region PointEntity3d Derived Classes + + private void + Stream(ArrayList data, PointOnCurve3d ptOnCur3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PointOnCurve3d))); + + data.Add(new Snoop.Data.Double("Parameter", ptOnCur3d.Parameter)); + data.Add(new Snoop.Data.Point3d("Point", ptOnCur3d.Point)); + } + + private void + Stream(ArrayList data, Position3d postn3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Position3d))); + + // no data here!! 02.28.06 + } + + private void + Stream(ArrayList data, PointOnSurface ptOnSurf) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PointOnSurface))); + + data.Add(new Snoop.Data.Point2d("Parameter", ptOnSurf.Parameter)); + } + + #endregion + + private void + Stream(ArrayList data, CurveCurveIntersector3d curCurInt3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CurveCurveIntersector3d))); + + data.Add(new Snoop.Data.Object("Curve1", curCurInt3d.Curve1)); + data.Add(new Snoop.Data.Object("Curve2", curCurInt3d.Curve2)); + data.Add(new Snoop.Data.Int("Number Of Intersection Points", curCurInt3d.NumberOfIntersectionPoints)); + data.Add(new Snoop.Data.Vector3d("Plane Normal", curCurInt3d.PlaneNormal)); + data.Add(new Snoop.Data.Object("Tolerance", curCurInt3d.Tolerance)); + } + + private void + Stream(ArrayList data, SurfaceSurfaceIntersector surfSurfInt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SurfaceSurfaceIntersector))); + + data.Add(new Snoop.Data.Int("NumResults", surfSurfInt.NumResults)); + data.Add(new Snoop.Data.Object("Surface1", surfSurfInt.Surface1)); + data.Add(new Snoop.Data.Object("Surface2", surfSurfInt.Surface2)); + data.Add(new Snoop.Data.Object("Tolerance", surfSurfInt.Tolerance)); + } + + #endregion + + #region Entity2d Derived classes + + private void + Stream(ArrayList data, Entity2d ent2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Entity2d))); + + // branch to all known major sub-classes + Curve2d crv = ent2d as Curve2d; + if (crv != null) { + Stream(data, crv); + } + + BoundBlock2d bndBlk = ent2d as BoundBlock2d; + if (bndBlk != null) { + Stream(data, bndBlk); + } + + ClipBoundary2d clipBound2d = ent2d as ClipBoundary2d; + if (clipBound2d != null) { + Stream(data, clipBound2d); + } + + CurveCurveIntersector2d curcurInt2d = ent2d as CurveCurveIntersector2d; + if (curcurInt2d != null) { + Stream(data, curcurInt2d); + } + + PointEntity2d ptEnt2d = ent2d as PointEntity2d; + if (ptEnt2d != null) { + Stream(data, ptEnt2d); + } + } + + private void + Stream(ArrayList data, Curve2d crv) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Curve2d))); + + data.Add(new Snoop.Data.Object("Bound block", crv.BoundBlock)); + data.Add(new Snoop.Data.Object("Ortho bound block", crv.OrthoBoundBlock)); + data.Add(new Snoop.Data.Bool("Has start point", crv.HasStartPoint)); + if (crv.HasStartPoint) + data.Add(new Snoop.Data.Point2d("Start point", crv.StartPoint)); + data.Add(new Snoop.Data.Bool("Has end point", crv.HasEndPoint)); + if (crv.HasEndPoint) + data.Add(new Snoop.Data.Point2d("End point", crv.EndPoint)); + + // branch to all known major sub-classes + LinearEntity2d linearEnt = crv as LinearEntity2d; + if (linearEnt != null) { + Stream(data, linearEnt); + return; + } + + CircularArc2d circArc = crv as CircularArc2d; + if (circArc != null) { + Stream(data, circArc); + return; + } + + CompositeCurve2d compCurve2d = crv as CompositeCurve2d; + if (compCurve2d != null) { + Stream(data, compCurve2d); + return; + } + + SplineEntity2d splineEnt2d = crv as SplineEntity2d; + if (splineEnt2d != null) { + Stream(data, splineEnt2d); + return; + } + + EllipticalArc2d ellipticalArc2d = crv as EllipticalArc2d; + if (ellipticalArc2d != null) { + Stream(data, ellipticalArc2d); + return; + } + + ExternalCurve2d extCur2d = crv as ExternalCurve2d; + if (extCur2d != null) { + Stream(data, extCur2d); + return; + } + + OffsetCurve2d offsetCurve = crv as OffsetCurve2d; + if (offsetCurve != null) { + Stream(data, offsetCurve); + return; + } + } + + private void + Stream(ArrayList data, LinearEntity2d linearEnt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LinearEntity2d))); + + data.Add(new Snoop.Data.Vector2d("Direction", linearEnt.Direction)); + data.Add(new Snoop.Data.Point2d("Point on line", linearEnt.PointOnLine)); + + // branch to all known major sub-classes + Line2d line = linearEnt as Line2d; + if (line != null) { + Stream(data, line); + return; + } + + LineSegment2d lineSeg = linearEnt as LineSegment2d; + if (lineSeg != null) { + Stream(data, lineSeg); + return; + } + + Ray2d ray2d = linearEnt as Ray2d; + if (ray2d != null) { + Stream(data, ray2d); + return; + } + } + + private void + Stream(ArrayList data, Line2d line) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Line2d))); + + // no data at this level + } + + private void + Stream(ArrayList data, LineSegment2d lineSeg) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LineSegment2d))); + + data.Add(new Snoop.Data.Point2d("End point", lineSeg.EndPoint)); + data.Add(new Snoop.Data.Double("Length", lineSeg.Length)); + data.Add(new Snoop.Data.Point2d("Mid point", lineSeg.MidPoint)); + data.Add(new Snoop.Data.Point2d("Start point", lineSeg.StartPoint)); + } + + private void + Stream(ArrayList data, Ray2d ray2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Ray2d))); + + data.Add(new Snoop.Data.Point2d("Start point", ray2d.StartPoint)); + data.Add(new Snoop.Data.Point2d("End point", ray2d.EndPoint)); + } + + private void + Stream(ArrayList data, CircularArc2d circArc) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CircularArc2d))); + + data.Add(new Snoop.Data.Point2d("Center", circArc.Center)); + data.Add(new Snoop.Data.Distance("Radius", circArc.Radius)); + data.Add(new Snoop.Data.Point2d("Start point", circArc.StartPoint)); + data.Add(new Snoop.Data.Point2d("End point", circArc.EndPoint)); + data.Add(new Snoop.Data.Angle("Start angle", circArc.StartAngle)); + data.Add(new Snoop.Data.Angle("End angle", circArc.EndAngle)); + data.Add(new Snoop.Data.Vector2d("Reference vector", circArc.ReferenceVector)); + data.Add(new Snoop.Data.Bool("Is clockwise", circArc.IsClockWise)); + } + + private void + Stream(ArrayList data, CompositeCurve2d compCurve2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CompositeCurve2d))); + + data.Add(new Snoop.Data.Point2d("Start point", compCurve2d.StartPoint)); + data.Add(new Snoop.Data.Point2d("End point", compCurve2d.EndPoint)); + } + + private void + Stream(ArrayList data, SplineEntity2d splineEnt2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SplineEntity2d))); + + data.Add(new Snoop.Data.Int("Degree", splineEnt2d.Degree)); + data.Add(new Snoop.Data.Double("End parameter", splineEnt2d.EndParameter)); + data.Add(new Snoop.Data.Point2d("End point", splineEnt2d.EndPoint)); + data.Add(new Snoop.Data.Bool("Has fit data", splineEnt2d.HasFitData)); + data.Add(new Snoop.Data.Bool("Is rational", splineEnt2d.IsRational)); + data.Add(new Snoop.Data.Enumerable("Knots", splineEnt2d.Knots)); + data.Add(new Snoop.Data.Int("Num control points", splineEnt2d.NumControlPoints)); + data.Add(new Snoop.Data.Int("Num knots", splineEnt2d.NumKnots)); + data.Add(new Snoop.Data.Int("Order", splineEnt2d.Order)); + data.Add(new Snoop.Data.Double("Start parameter", splineEnt2d.StartParameter)); + data.Add(new Snoop.Data.Point2d("Start point", splineEnt2d.StartPoint)); + + + // branch to all known major sub-classes + CubicSplineCurve2d cubicSpline = splineEnt2d as CubicSplineCurve2d; + if (cubicSpline != null) { + Stream(data, cubicSpline); + return; + } + + NurbCurve2d nurbCur2d = splineEnt2d as NurbCurve2d; + if (nurbCur2d != null) { + Stream(data, nurbCur2d); + return; + } + + PolylineCurve2d polyCur2d = splineEnt2d as PolylineCurve2d; + if (polyCur2d != null) { + Stream(data, polyCur2d); + return; + } + } + + private void + Stream(ArrayList data, CubicSplineCurve2d cubicSpline) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CubicSplineCurve2d))); + + data.Add(new Snoop.Data.Int("Num fit points", cubicSpline.NumFitPoints)); + } + + private void + Stream(ArrayList data, NurbCurve2d nurbCur2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(NurbCurve2d))); + + data.Add(new Snoop.Data.Object("Definition data", nurbCur2d.DefinitionData)); + data.Add(new Snoop.Data.Bool("Eval mode", nurbCur2d.EvalMode)); + data.Add(new Snoop.Data.Object("Fit data", nurbCur2d.FitData)); + data.Add(new Snoop.Data.Object("Tolerance", nurbCur2d.FitTolerance)); + data.Add(new Snoop.Data.Int("Num of fit points", nurbCur2d.NumFitPoints)); + data.Add(new Snoop.Data.Int("Num of weights", nurbCur2d.NumWeights)); + } + + private void + Stream(ArrayList data, PolylineCurve2d polyCur2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PolylineCurve2d))); + + data.Add(new Snoop.Data.Int("Number of fit points", polyCur2d.NumberOfFitPoints)); + } + + private void + Stream(ArrayList data, EllipticalArc2d ellipticalArc2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(EllipticalArc2d))); + + data.Add(new Snoop.Data.Point2d("Center", ellipticalArc2d.Center)); + data.Add(new Snoop.Data.Double("End angle", ellipticalArc2d.EndAngle)); + data.Add(new Snoop.Data.Point2d("End point", ellipticalArc2d.EndPoint)); + data.Add(new Snoop.Data.Bool("Is clockwise", ellipticalArc2d.IsClockWise)); + data.Add(new Snoop.Data.Vector2d("Major axis", ellipticalArc2d.MajorAxis)); + data.Add(new Snoop.Data.Double("Major radius", ellipticalArc2d.MajorRadius)); + data.Add(new Snoop.Data.Vector2d("Minor axis", ellipticalArc2d.MinorAxis)); + data.Add(new Snoop.Data.Double("Minor radius", ellipticalArc2d.MinorRadius)); + data.Add(new Snoop.Data.Double("Start angle", ellipticalArc2d.StartAngle)); + data.Add(new Snoop.Data.Point2d("Start point", ellipticalArc2d.StartPoint)); + } + + private void + Stream(ArrayList data, ExternalCurve2d extCur2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ExternalCurve2d))); + + data.Add(new Snoop.Data.String("External curve kind", extCur2d.ExternalCurveKind.ToString())); + data.Add(new Snoop.Data.Bool("Is defined", extCur2d.IsDefined)); + data.Add(new Snoop.Data.Bool("Is nurb curve", extCur2d.IsNurbCurve)); + data.Add(new Snoop.Data.Bool("Is owner of curve", extCur2d.IsOwnerOfCurve)); + data.Add(new Snoop.Data.Object("Nurb curve", extCur2d.NurbCurve)); + } + + private void + Stream(ArrayList data, OffsetCurve2d offsetCur2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(OffsetCurve2d))); + + data.Add(new Snoop.Data.Object("Curve", offsetCur2d.Curve)); + data.Add(new Snoop.Data.Double("Offset distance", offsetCur2d.OffsetDistance)); + data.Add(new Snoop.Data.Bool("Parameter direction", offsetCur2d.ParameterDirection)); + data.Add(new Snoop.Data.Object("Transformation", offsetCur2d.Transformation)); + } + + private void + Stream(ArrayList data, BoundBlock2d bndBlk) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(BoundBlock2d))); + + data.Add(new Snoop.Data.Point2d("Base point", bndBlk.BasePoint)); + data.Add(new Snoop.Data.Vector2d("Direction 1", bndBlk.Direction1)); + data.Add(new Snoop.Data.Vector2d("Direction 2", bndBlk.Direction2)); + data.Add(new Snoop.Data.Bool("Is box", bndBlk.IsBox)); + } + + private void + Stream(ArrayList data, ClipBoundary2d clipBound2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ClipBoundary2d))); + + // no data at this level + } + + private void + Stream(ArrayList data, CurveCurveIntersector2d curcurInt2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CurveCurveIntersector2d))); + + data.Add(new Snoop.Data.Object("Curve1", curcurInt2d.Curve1)); + data.Add(new Snoop.Data.Object("Curve2", curcurInt2d.Curve2)); + data.Add(new Snoop.Data.Int("Number of intersection points", curcurInt2d.NumberOfIntersectionPoints)); + data.Add(new Snoop.Data.Int("Overlap count", curcurInt2d.OverlapCount)); + data.Add(new Snoop.Data.Bool("Overlap direction", curcurInt2d.OverlapDirection)); + data.Add(new Snoop.Data.Object("Tolerance", curcurInt2d.Tolerance)); + } + + private void + Stream(ArrayList data, PointEntity2d ptEnt2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PointEntity2d))); + + data.Add(new Snoop.Data.Point2d("Point", ptEnt2d.Point)); + + PointOnCurve2d ptOnCur2d = ptEnt2d as PointOnCurve2d; + if (ptOnCur2d != null) { + Stream(data, ptOnCur2d); + return; + } + + Position2d pos2d = ptEnt2d as Position2d; + if (pos2d != null) { + Stream(data, pos2d); + return; + } + } + + private void + Stream(ArrayList data, PointOnCurve2d ptOnCur2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PointOnCurve2d))); + + data.Add(new Snoop.Data.Object("Curve", ptOnCur2d.Curve)); + data.Add(new Snoop.Data.Double("Parameter", ptOnCur2d.Parameter)); + data.Add(new Snoop.Data.Point2d("Point", ptOnCur2d.Point)); + } + + private void + Stream(ArrayList data, Position2d pos2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Position2d))); + + // no data here!! + } + #endregion + + private void + Stream(ArrayList data, CurveBoundary curveBound) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CurveBoundary))); + + data.Add(new Snoop.Data.Object("Contour", curveBound.Contour)); + data.Add(new Snoop.Data.Object("Degenerate curve", curveBound.DegenerateCurve)); + data.Add(new Snoop.Data.Object("Degenerate position", curveBound.DegeneratePosition)); + data.Add(new Snoop.Data.Bool("Is degenerate", curveBound.IsDegenerate)); + data.Add(new Snoop.Data.Bool("Is owner of curves", curveBound.IsOwnerOfCurves)); + data.Add(new Snoop.Data.Int("Num of elements", curveBound.NumElements)); + } + + private void + Stream(ArrayList data, Interval interval) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Interval))); + + data.Add(new Snoop.Data.Double("Element", interval.Element)); + data.Add(new Snoop.Data.Bool("Is bounded", interval.IsBounded)); + data.Add(new Snoop.Data.Bool("Is bounded above", interval.IsBoundedAbove)); + data.Add(new Snoop.Data.Bool("Is bounded below", interval.IsBoundedBelow)); + data.Add(new Snoop.Data.Bool("Is singleton", interval.IsSingleton)); + data.Add(new Snoop.Data.Bool("Is unbounded", interval.IsUnbounded)); + data.Add(new Snoop.Data.Double("Lenght", interval.Length)); + data.Add(new Snoop.Data.Double("Lower bound", interval.LowerBound)); + data.Add(new Snoop.Data.Double("Tolerance", interval.Tolerance)); + data.Add(new Snoop.Data.Double("Upper bound", interval.UpperBound)); + } + + private void + Stream(ArrayList data, Matrix2d mat2d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Matrix2d))); + + data.Add(new Snoop.Data.Object("Coordinate system", mat2d.CoordinateSystem2d)); + data.Add(new Snoop.Data.Vector2d("Translation", mat2d.Translation)); + data.Add(new Snoop.Data.Bool("Is scaled ortho", mat2d.IsScaledOrtho())); + data.Add(new Snoop.Data.Bool("Is uni-scaled ortho", mat2d.IsUniscaledOrtho())); + data.Add(new Snoop.Data.Bool("Is singular", mat2d.IsSingular())); + } + + + private void + Stream(ArrayList data, Matrix3d mat3d) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Matrix3d))); + + data.Add(new Snoop.Data.Object("Coordinate system", mat3d.CoordinateSystem3d)); + data.Add(new Snoop.Data.Object("Inverse", mat3d.Inverse())); + data.Add(new Snoop.Data.Object("Transpose", mat3d.Transpose())); + data.Add(new Snoop.Data.Double("Scale", mat3d.GetScale())); + data.Add(new Snoop.Data.Double("Determinant", mat3d.GetDeterminant())); + data.Add(new Snoop.Data.Double("Normal", mat3d.Normal)); + data.Add(new Snoop.Data.Vector3d("Translation", mat3d.Translation)); + data.Add(new Snoop.Data.Bool("Is scaled ortho", mat3d.IsScaledOrtho())); + data.Add(new Snoop.Data.Bool("Is uni-scaled ortho", mat3d.IsUniscaledOrtho())); + data.Add(new Snoop.Data.Bool("Is singular", mat3d.IsSingular())); + } + + private void + Stream(ArrayList data, CoordinateSystem3d coordSys) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CoordinateSystem3d))); + + data.Add(new Snoop.Data.Point3d("Origin", coordSys.Origin)); + data.Add(new Snoop.Data.Vector3d("X-Axis", coordSys.Xaxis)); + data.Add(new Snoop.Data.Vector3d("Y-Axis", coordSys.Yaxis)); + data.Add(new Snoop.Data.Vector3d("Z-Axis", coordSys.Zaxis)); + } + + private void + Stream(ArrayList data, Point2dCollection pts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Point2dCollection))); + + for (int i=0; i + /// This is a Snoop Collector Extension object to collect data from Graph objects. + /// + public class GraphNodes : CollectorExt + { + public + GraphNodes() + { + } + + protected override void + CollectEvent(object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + // see if it is a type we are responsible for + GraphNode node = e.ObjToSnoop as GraphNode; + if (node != null) + Stream(snoopCollector.Data(), node); + + // see if it is a type we are responsible for + Graph graph = e.ObjToSnoop as Graph; + if (graph != null) + Stream(snoopCollector.Data(), graph); + } + + + private void + Stream(ArrayList data, GraphNode node) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(GraphNode))); + + data.Add(new Snoop.Data.Bool("Is cycle node", node.IsCycleNode)); + data.Add(new Snoop.Data.Int("Num cycle in", node.NumCycleIn)); + data.Add(new Snoop.Data.Int("Num cycle out", node.NumCycleOut)); + data.Add(new Snoop.Data.Int("Num in", node.NumIn)); + data.Add(new Snoop.Data.Int("Num out", node.NumOut)); + + XrefGraphNode xGraphNode = node as XrefGraphNode; + if (xGraphNode != null) + Stream(data, xGraphNode); + } + + private void + Stream(ArrayList data, XrefGraphNode xGraphNode) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(XrefGraphNode))); + + data.Add(new Snoop.Data.String("Name", xGraphNode.Name)); + data.Add(new Snoop.Data.ObjectId("Block table record ID", xGraphNode.BlockTableRecordId)); + data.Add(new Snoop.Data.Database("Database", xGraphNode.Database)); + data.Add(new Snoop.Data.Bool("Is nested", xGraphNode.IsNested)); + data.Add(new Snoop.Data.String("Xref status", xGraphNode.XrefStatus.ToString())); + data.Add(new Snoop.Data.String("Xref notification status", xGraphNode.XrefNotificationStatus.ToString())); + } + + private void + Stream(ArrayList data, Graph graph) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Graph))); + + data.Add(new Snoop.Data.Bool("Is empty", graph.IsEmpty)); + data.Add(new Snoop.Data.Int("Num nodes", graph.NumNodes)); + + XrefGraph xGraph = graph as XrefGraph; + if (xGraph != null) + Stream(data, xGraph); + } + + private void + Stream(ArrayList data, XrefGraph xgraph) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(XrefGraph))); + + // no data at this level + } + + } +} diff --git a/MgdDbgLibrary/Snoop/CollectorExts/GraphicsInterface.cs b/MgdDbgLibrary/Snoop/CollectorExts/GraphicsInterface.cs new file mode 100644 index 0000000..bc12a42 --- /dev/null +++ b/MgdDbgLibrary/Snoop/CollectorExts/GraphicsInterface.cs @@ -0,0 +1,1582 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using System.Collections; +using System.Diagnostics; + +using Autodesk.AutoCAD.GraphicsInterface; +using MgdDbg.Snoop.Collectors; + +namespace MgdDbg.Snoop.CollectorExts +{ + /// + /// Summary description for GraphicsInterface. + /// + public class GraphicsInterface : CollectorExt + { + public + GraphicsInterface() + { + } + + protected override void + CollectEvent(object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + // see if it is a type we are responsible for + + // TBD: this one just gets in the way of normal entity display + //Drawable drawable = e.ObjToSnoop as Drawable; + //if (drawable != null) + // Stream(snoopCollector.Data(), drawable); + + TextStyle txtStyle = e.ObjToSnoop as TextStyle; + if (txtStyle != null) + Stream(snoopCollector.Data(), txtStyle); + + // TBD: "twilight zone" weird matMap throws a nullReferenceException + // even as it is being checked for null !!! + //MaterialMap matMap = e.ObjToSnoop as MaterialMap; + //if (matMap != null) { + // Stream(snoopCollector.Data(), matMap); + // return; + //} + + CommonDraw comDraw = e.ObjToSnoop as CommonDraw; + if (comDraw != null) { + Stream(snoopCollector.Data(), comDraw); + return; + } + + SubEntityTraits subEntTraits = e.ObjToSnoop as SubEntityTraits; + if (subEntTraits != null) { + Stream(snoopCollector.Data(), subEntTraits); + return; + } + + LightAttenuation lightAtt = e.ObjToSnoop as LightAttenuation; + if (lightAtt != null) { + Stream(snoopCollector.Data(), lightAtt); + return; + } + + /*DisplayStyle dispStyl = e.ObjToSnoop as DisplayStyle; + if (dispStyl != null) { + Stream(snoopCollector.Data(), dispStyl); + return; + }*/ // TBD: Fix JMA + + ShadowParameters shadParams = e.ObjToSnoop as ShadowParameters; + if (shadParams != null) { + Stream(snoopCollector.Data(), shadParams); + return; + } + + //ShadowParameters2 shadParams2 = e.ObjToSnoop as ShadowParameters2; + //if (shadParams2 != null) { + // Stream(snoopCollector.Data(), shadParams2); + // return; + //} + + MaterialColor matColor = e.ObjToSnoop as MaterialColor; + if (matColor != null) { + Stream(snoopCollector.Data(), matColor); + return; + } + + Mapper mapper = e.ObjToSnoop as Mapper; + if (mapper != null) { + Stream(snoopCollector.Data(), mapper); + return; + } + + MaterialTexture matTxtr = e.ObjToSnoop as MaterialTexture; + if (matTxtr != null) { + Stream(snoopCollector.Data(), matTxtr); + return; + } + + Autodesk.AutoCAD.GraphicsInterface.Geometry geo = e.ObjToSnoop as Autodesk.AutoCAD.GraphicsInterface.Geometry; + if (geo != null) { + Stream(snoopCollector.Data(), geo); + return; + } + + Viewport vPort = e.ObjToSnoop as Viewport; + if (vPort != null) { + Stream(snoopCollector.Data(), vPort); + return; + } + + Context ctxt = e.ObjToSnoop as Context; + if (ctxt != null) { + Stream(snoopCollector.Data(), ctxt); + return; + } + + /*FaceStyle faceStyl = e.ObjToSnoop as FaceStyle; + if (faceStyl != null) { + Stream(snoopCollector.Data(), faceStyl); + return; + }*/ // TBD: Fix JMA + + /*EdgeStyle edgStyl = e.ObjToSnoop as EdgeStyle; + if (edgStyl != null) { + Stream(snoopCollector.Data(), edgStyl); + return; + }*/ // TBD: Fix JMA + + VisualStyle visStyl = e.ObjToSnoop as VisualStyle; + if (visStyl != null) { + Stream(snoopCollector.Data(), visStyl); + return; + } + + ClipBoundary clipBdry = e.ObjToSnoop as ClipBoundary; + if (clipBdry != null) { + Stream(snoopCollector.Data(), clipBdry); + return; + } + + EdgeData edgData = e.ObjToSnoop as EdgeData; + if (edgData != null) { + Stream(snoopCollector.Data(), edgData); + return; + } + + FaceData faceData = e.ObjToSnoop as FaceData; + if (faceData != null) { + Stream(snoopCollector.Data(), faceData); + return; + } + + VertexData vertData = e.ObjToSnoop as VertexData; + if (vertData != null) { + Stream(snoopCollector.Data(), vertData); + return; + } + + ContextualColors cntxtColors = e.ObjToSnoop as ContextualColors; + if (cntxtColors != null) { + Stream(snoopCollector.Data(), cntxtColors); + return; + } + + SkyParameters skyParams = e.ObjToSnoop as SkyParameters; + if (skyParams != null) { + Stream(snoopCollector.Data(), skyParams); + return; + } + + ToneOperatorParameters toneOperParams = e.ObjToSnoop as ToneOperatorParameters; + if (toneOperParams != null) { + Stream(snoopCollector.Data(), toneOperParams); + return; + } + + //Variant variant = e.ObjToSnoop as Variant; + //if (variant != null) { + // Stream(snoopCollector.Data(), variant); + // return; + //} + + // these are value types so we have to treat them a bit different + if (e.ObjToSnoop is FontDescriptor) { + Stream(snoopCollector.Data(), (FontDescriptor)e.ObjToSnoop); + return; + } + + /* if (e.ObjToSnoop is EdgeStyleOverride) { + Stream(snoopCollector.Data(), (EdgeStyleOverride)e.ObjToSnoop); + return; + }*/ // TBD: Fix JMA + + if (e.ObjToSnoop is MaterialDiffuseComponent) { + Stream(snoopCollector.Data(), (MaterialDiffuseComponent)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MaterialSpecularComponent) { + Stream(snoopCollector.Data(), (MaterialSpecularComponent)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MaterialOpacityComponent) { + Stream(snoopCollector.Data(), (MaterialOpacityComponent)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MaterialRefractionComponent) { + Stream(snoopCollector.Data(), (MaterialRefractionComponent)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MaterialRefractionComponent) { + Stream(snoopCollector.Data(), (MaterialRefractionComponent)e.ObjToSnoop); + return; + } + + /* if (e.ObjToSnoop is MentalRayRenderSettingsTraitsIntegerRangeParameter) { + Stream(snoopCollector.Data(), (MentalRayRenderSettingsTraitsIntegerRangeParameter)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MentalRayRenderSettingsTraitsTraceParameter) { + Stream(snoopCollector.Data(), (MentalRayRenderSettingsTraitsTraceParameter)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MentalRayRenderSettingsTraitsFloatParameter) { + Stream(snoopCollector.Data(), (MentalRayRenderSettingsTraitsFloatParameter)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MentalRayRenderSettingsTraitsDoubleRangeParameter) { + Stream(snoopCollector.Data(), (MentalRayRenderSettingsTraitsDoubleRangeParameter)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MentalRayRenderSettingsTraitsSamplingParameter) { + Stream(snoopCollector.Data(), (MentalRayRenderSettingsTraitsSamplingParameter)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MentalRayRenderSettingsTraitsBoolParameter) { + Stream(snoopCollector.Data(), (MentalRayRenderSettingsTraitsBoolParameter)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MentalRayRenderSettingsTraitsDiagnosticGridModeParameter) { + Stream(snoopCollector.Data(), (MentalRayRenderSettingsTraitsDiagnosticGridModeParameter)e.ObjToSnoop); + return; + }*/ + + if (e.ObjToSnoop is FrontAndBackClipping) { + Stream(snoopCollector.Data(), (FrontAndBackClipping)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is ColorRGB) { + Stream(snoopCollector.Data(), (ColorRGB)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is ColorRGBA) { + Stream(snoopCollector.Data(), (ColorRGBA)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is MaterialNormalMapComponent) { + Stream(snoopCollector.Data(), (MaterialNormalMapComponent)e.ObjToSnoop); + return; + } + } + + + private void + Stream(ArrayList data, Drawable drawable) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.GraphicsInterface.Drawable))); + + data.Add(new Snoop.Data.ObjectId("ID", drawable.Id)); + data.Add(new Snoop.Data.Bool("Is persistent", drawable.IsPersistent)); + data.Add(new Snoop.Data.String("Drawable Type", drawable.DrawableType.ToString())); + + Glyph glyph = drawable as Glyph; + if (glyph != null) { + Stream(data, glyph); + return; + } + } + + private void + Stream(ArrayList data, TextStyle txtStyle) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(TextStyle))); + + data.Add(new Snoop.Data.Bool("Backward", txtStyle.Backward)); + data.Add(new Snoop.Data.String("Big font file name", txtStyle.BigFontFileName)); + data.Add(new Snoop.Data.String("File name", txtStyle.FileName)); + data.Add(new Snoop.Data.Object("Font", txtStyle.Font)); + //data.Add(new Snoop.Data.Byte("Font", txtStyle.LoadStyleRec)); + data.Add(new Snoop.Data.Angle("Obliquing angle", txtStyle.ObliquingAngle)); + data.Add(new Snoop.Data.Bool("Overlined", txtStyle.Overlined)); + data.Add(new Snoop.Data.Bool("PreLoaded", txtStyle.PreLoaded)); + data.Add(new Snoop.Data.String("Style name", txtStyle.StyleName)); + data.Add(new Snoop.Data.Distance("Text size", txtStyle.TextSize)); + data.Add(new Snoop.Data.Double("Tracking percent", txtStyle.TrackingPercent)); + data.Add(new Snoop.Data.Bool("Underlined", txtStyle.Underlined)); + data.Add(new Snoop.Data.Bool("Upside down", txtStyle.UpsideDown)); + data.Add(new Snoop.Data.Bool("Vertical", txtStyle.Vertical)); + data.Add(new Snoop.Data.Double("X scale", txtStyle.XScale)); + } + + #region CommonDraw + private void + Stream(ArrayList data, CommonDraw comDraw) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(CommonDraw))); + + data.Add(new Snoop.Data.Object("Context", comDraw.Context)); + data.Add(new Snoop.Data.Bool("Is dragging", comDraw.IsDragging)); + data.Add(new Snoop.Data.Int("Number of isolines", comDraw.NumberOfIsolines)); + data.Add(new Snoop.Data.Object("Raw geometry", comDraw.RawGeometry)); + data.Add(new Snoop.Data.Bool("Regen abort", comDraw.RegenAbort)); + data.Add(new Snoop.Data.String("Regen type", comDraw.RegenType.ToString())); + data.Add(new Snoop.Data.Object("SubEntityTraits", comDraw.SubEntityTraits)); + + WorldDraw worldDraw = comDraw as WorldDraw; + if (worldDraw != null) { + Stream(data, worldDraw); + return; + } + + ViewportDraw viewPrtDrw = comDraw as ViewportDraw; + if (viewPrtDrw != null) { + Stream(data, viewPrtDrw); + return; + } + } + + private void + Stream(ArrayList data, WorldDraw worldDraw) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(WorldDraw))); + + data.Add(new Snoop.Data.Object("Geometry", worldDraw.Geometry)); + } + + private void + Stream(ArrayList data, ViewportDraw viewPrtDrw) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ViewportDraw))); + + data.Add(new Snoop.Data.Object("Geometry", viewPrtDrw.Geometry)); + data.Add(new Snoop.Data.Int("Sequence number", viewPrtDrw.SequenceNumber)); + data.Add(new Snoop.Data.Object("Viewport", viewPrtDrw.Viewport)); + } + + #endregion + + #region SubEntityTraits + private void + Stream(ArrayList data, SubEntityTraits subEntTraits) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SubEntityTraits))); + + data.Add(new Snoop.Data.Int("Color", subEntTraits.Color)); + data.Add(new Snoop.Data.Int("Draw flags", subEntTraits.DrawFlags)); + //data.Add(new Snoop.Data.Object("Edge style override", subEntTraits.EdgeStyleOverride)); // TBD: Fix JMA + data.Add(new Snoop.Data.String("Fill type", subEntTraits.FillType.ToString())); + data.Add(new Snoop.Data.ObjectId("Layer", subEntTraits.Layer)); + data.Add(new Snoop.Data.ObjectId("Line type", subEntTraits.LineType)); + data.Add(new Snoop.Data.Double("Line type scale", subEntTraits.LineTypeScale)); + data.Add(new Snoop.Data.String("Line weight", subEntTraits.LineWeight.ToString())); + data.Add(new Snoop.Data.Object("Mapper", subEntTraits.Mapper)); + data.Add(new Snoop.Data.ObjectId("Material", subEntTraits.Material)); + data.Add(new Snoop.Data.Object("Plot style descriptor", subEntTraits.PlotStyleDescriptor)); + data.Add(new Snoop.Data.Bool("Sectionable", subEntTraits.Sectionable)); + data.Add(new Snoop.Data.Bool("Selection only geometry", subEntTraits.SelectionOnlyGeometry)); + data.Add(new Snoop.Data.String("Shadow flags", subEntTraits.ShadowFlags.ToString())); + data.Add(new Snoop.Data.Double("Thickness", subEntTraits.Thickness)); + data.Add(new Snoop.Data.Object("True color", subEntTraits.TrueColor)); + data.Add(new Snoop.Data.ObjectId("Visual style", subEntTraits.VisualStyle)); + + DrawableTraits drwblTrts = subEntTraits as DrawableTraits; + if (drwblTrts != null) { + Stream(data, drwblTrts); + return; + } + } + + private void + Stream(ArrayList data, DrawableTraits drwblTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DrawableTraits))); + + // no extra data here + + NonEntityTraits nonEntTrts = drwblTrts as NonEntityTraits; + if (nonEntTrts != null) { + Stream(data, nonEntTrts); + return; + } + + ViewportTraits viewPrtTrts = drwblTrts as ViewportTraits; + if (viewPrtTrts != null) { + Stream(data, viewPrtTrts); + return; + } + + VisualStyleTraits visStylTrts = drwblTrts as VisualStyleTraits; + if (visStylTrts != null) { + Stream(data, visStylTrts); + return; + } + } + + #region NonEntityTraits + private void + Stream(ArrayList data, NonEntityTraits nonEntTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(NonEntityTraits))); + + data.Add(new Snoop.Data.Int("Color", nonEntTrts.Color)); + data.Add(new Snoop.Data.Int("Draw flags", nonEntTrts.DrawFlags)); + //data.Add(new Snoop.Data.Object("Edge style override", nonEntTrts.EdgeStyleOverride)); // TBD: Fix JMA + data.Add(new Snoop.Data.String("Fill type", nonEntTrts.FillType.ToString())); + data.Add(new Snoop.Data.ObjectId("Layer", nonEntTrts.Layer)); + data.Add(new Snoop.Data.ObjectId("Line type", nonEntTrts.LineType)); + data.Add(new Snoop.Data.Double("Line type scale", nonEntTrts.LineTypeScale)); + data.Add(new Snoop.Data.String("Line weight", nonEntTrts.LineWeight.ToString())); + data.Add(new Snoop.Data.Object("Mapper", nonEntTrts.Mapper)); + data.Add(new Snoop.Data.ObjectId("Material", nonEntTrts.Material)); + data.Add(new Snoop.Data.Object("Plot style descriptor", nonEntTrts.PlotStyleDescriptor)); + data.Add(new Snoop.Data.Bool("Sectionable", nonEntTrts.Sectionable)); + data.Add(new Snoop.Data.Bool("Selection only geometry", nonEntTrts.SelectionOnlyGeometry)); + data.Add(new Snoop.Data.String("Shadow flags", nonEntTrts.ShadowFlags.ToString())); + data.Add(new Snoop.Data.Distance("Thickness", nonEntTrts.Thickness)); + data.Add(new Snoop.Data.Object("True color", nonEntTrts.TrueColor)); + data.Add(new Snoop.Data.ObjectId("Visual style", nonEntTrts.VisualStyle)); + + LightTraits lightTrts = nonEntTrts as LightTraits; + if (nonEntTrts != null) { + Stream(data, nonEntTrts); + return; + } + + GradientBackgroundTraits grdntBkGrndTrts = nonEntTrts as GradientBackgroundTraits; + if (grdntBkGrndTrts != null) { + Stream(data, grdntBkGrndTrts); + return; + } + + GroundPlaneBackgroundTraits grndPlBkGrndTrts = nonEntTrts as GroundPlaneBackgroundTraits; + if (grndPlBkGrndTrts != null) { + Stream(data, grndPlBkGrndTrts); + return; + } + + ImageBackgroundTraits imgBkGrndTrts = nonEntTrts as ImageBackgroundTraits; + if (imgBkGrndTrts != null) { + Stream(data, imgBkGrndTrts); + return; + } + + MaterialTraits matTrts = nonEntTrts as MaterialTraits; + if (matTrts != null) { + Stream(data, matTrts); + return; + } + + //MaterialTraits2 matTrts2 = nonEntTrts as MaterialTraits2; + //if (matTrts2 != null) { + // Stream(data, matTrts2); + // return; + //} + + RenderSettingsTraits rndrSetTrts = nonEntTrts as RenderSettingsTraits; + if (rndrSetTrts != null) { + Stream(data, rndrSetTrts); + return; + } + + RenderEnvironmentTraits rndrEnvTrts = nonEntTrts as RenderEnvironmentTraits; + if (rndrEnvTrts != null) { + Stream(data, rndrEnvTrts); + return; + } + + SolidBackgroundTraits solBkGrndTrts = nonEntTrts as SolidBackgroundTraits; + if (solBkGrndTrts != null) { + Stream(data, solBkGrndTrts); + return; + } + + SkyBackgroundTraits skyBkGrndTrts = nonEntTrts as SkyBackgroundTraits; + if (skyBkGrndTrts != null) { + Stream(data, skyBkGrndTrts); + return; + } + } + + #region LightTraits + private void + Stream(ArrayList data, LightTraits lightTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LightTraits))); + + data.Add(new Snoop.Data.Bool("On", lightTrts.On)); + + StandardLightTraits stdLightTrts = lightTrts as StandardLightTraits; + if (stdLightTrts != null) { + Stream(data, stdLightTrts); + return; + } + } + + private void + Stream(ArrayList data, StandardLightTraits stdLightTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(StandardLightTraits))); + + data.Add(new Snoop.Data.Double("Intensity", stdLightTrts.Intensity)); + data.Add(new Snoop.Data.Object("Light color", stdLightTrts.LightColor)); + data.Add(new Snoop.Data.Object("Shadow", stdLightTrts.Shadow)); + + DistantLightTraits distLightTrts = stdLightTrts as DistantLightTraits; + if (distLightTrts != null) { + Stream(data, distLightTrts); + return; + } + + //DistantLightTraits2 distLightTrts2 = stdLightTrts as DistantLightTraits2; + //if (distLightTrts2 != null) { + // Stream(data, distLightTrts2); + // return; + //} + + PointLightTraits ptLightTrts = stdLightTrts as PointLightTraits; + if (ptLightTrts != null) { + Stream(data, ptLightTrts); + return; + } + + //PointLightTraits2 ptLightTrts2 = stdLightTrts as PointLightTraits2; + //if (ptLightTrts2 != null) { + // Stream(data, ptLightTrts2); + // return; + //} + + SpotLightTraits spotLightTrts = stdLightTrts as SpotLightTraits; + if (spotLightTrts != null) { + Stream(data, spotLightTrts); + return; + } + + //SpotLightTraits2 spotLightTrts2 = stdLightTrts as SpotLightTraits2; + //if (spotLightTrts2 != null) { + // Stream(data, spotLightTrts2); + // return; + //} + } + + private void + Stream(ArrayList data, DistantLightTraits distLightTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DistantLightTraits))); + + data.Add(new Snoop.Data.Bool("Is sunlight", distLightTrts.IsSunlight)); + data.Add(new Snoop.Data.Vector3d("Light direction", distLightTrts.LightDirection)); + + //data.Add(new Snoop.Data.ClassSeparator(typeof(DistantLightTraits2))); + + data.Add(new Snoop.Data.Object("Lamp color", distLightTrts.LampColor)); + data.Add(new Snoop.Data.Double("Physical intensity", distLightTrts.PhysicalIntensity)); + data.Add(new Snoop.Data.Object("Shadow parameters", distLightTrts.Shadow)); + data.Add(new Snoop.Data.Object("Sky parameters", distLightTrts.SkyParameters)); + } + + //private void + //Stream(ArrayList data, DistantLightTraits distLightTrts) + //{ + // data.Add(new Snoop.Data.ClassSeparator(typeof(DistantLightTraits2))); + + // data.Add(new Snoop.Data.Object("Lamp color", distLightTrts2.LampColor)); + // data.Add(new Snoop.Data.Double("Physical intensity", distLightTrts2.PhysicalIntensity)); + // data.Add(new Snoop.Data.Object("Shadow parameters", distLightTrts2.ShadowParameters)); + // data.Add(new Snoop.Data.Object("Sky parameters", distLightTrts2.SkyParameters)); + //} + + private void + Stream(ArrayList data, PointLightTraits ptLightTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(PointLightTraits))); + + data.Add(new Snoop.Data.Object("Attenuation", ptLightTrts.Attenuation)); + data.Add(new Snoop.Data.Point3d("Position", ptLightTrts.Position)); + + data.Add(new Snoop.Data.Bool("Has target", ptLightTrts.HasTarget)); + data.Add(new Snoop.Data.Object("Lamp color", ptLightTrts.LampColor)); + data.Add(new Snoop.Data.Double("Physical intensity", ptLightTrts.PhysicalIntensity)); + data.Add(new Snoop.Data.Point3d("Target location", ptLightTrts.TargetLocation)); + + WebLightTraits webLightTraits = ptLightTrts as WebLightTraits; + if (webLightTraits != null) + { + Stream(data, webLightTraits); + return; + } + } + + //private void + //Stream(ArrayList data, PointLightTraits2 ptLightTrts2) + //{ + // data.Add(new Snoop.Data.ClassSeparator(typeof(PointLightTraits2))); + + // data.Add(new Snoop.Data.Bool("Has target", ptLightTrts2.HasTarget)); + // data.Add(new Snoop.Data.Object("Lamp color", ptLightTrts2.LampColor)); + // data.Add(new Snoop.Data.Double("Physical intensity", ptLightTrts2.PhysicalIntensity)); + // data.Add(new Snoop.Data.Point3d("Target location", ptLightTrts2.TargetLocation)); + + // WebLightTraits webLightTraits = ptLightTrts2 as WebLightTraits; + // if (webLightTraits != null) { + // Stream(data, webLightTraits); + // return; + // } + //} + + private void + Stream(ArrayList data, WebLightTraits webLightTraits) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(WebLightTraits))); + + data.Add(new Snoop.Data.String("Web file", webLightTraits.WebFile)); + data.Add(new Snoop.Data.String("Web file type", webLightTraits.WebFileType.ToString())); + data.Add(new Snoop.Data.Double("Web flux", webLightTraits.WebFlux)); + data.Add(new Snoop.Data.Bool("Web horz ang 90to270", webLightTraits.WebHorzAng90to270)); + data.Add(new Snoop.Data.Vector3d("Web rotation", webLightTraits.WebRotation)); + data.Add(new Snoop.Data.String("Web symmetry", webLightTraits.WebSymmetry.ToString())); + } + + private void + Stream(ArrayList data, SpotLightTraits spotLightTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SpotLightTraits))); + + data.Add(new Snoop.Data.Object("Attenuation", spotLightTrts.Attenuation)); + data.Add(new Snoop.Data.Double("Fall off", spotLightTrts.Falloff)); + data.Add(new Snoop.Data.Double("Hotspot", spotLightTrts.Hotspot)); + data.Add(new Snoop.Data.Point3d("Position", spotLightTrts.Position)); + data.Add(new Snoop.Data.Point3d("Target location", spotLightTrts.TargetLocation)); + + data.Add(new Snoop.Data.Object("Attenuation", spotLightTrts.LampColor)); + data.Add(new Snoop.Data.Double("Fall off", spotLightTrts.PhysicalIntensity)); + data.Add(new Snoop.Data.Object("Hotspot", spotLightTrts.Shadow)); + } + + //private void + //Stream(ArrayList data, SpotLightTraits2 spotLightTrts2) + //{ + // data.Add(new Snoop.Data.ClassSeparator(typeof(SpotLightTraits2))); + + // data.Add(new Snoop.Data.Object("Attenuation", spotLightTrts2.LampColor)); + // data.Add(new Snoop.Data.Double("Fall off", spotLightTrts2.PhysicalIntensity)); + // data.Add(new Snoop.Data.Object("Hotspot", spotLightTrts2.ShadowParameters)); + //} + + #endregion + + private void + Stream(ArrayList data, GradientBackgroundTraits grdntBkGrndTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(GradientBackgroundTraits))); + + data.Add(new Snoop.Data.Object("Color bottom", grdntBkGrndTrts.ColorBottom)); + data.Add(new Snoop.Data.Object("Color middle", grdntBkGrndTrts.ColorMiddle)); + data.Add(new Snoop.Data.Object("Color top", grdntBkGrndTrts.ColorTop)); + data.Add(new Snoop.Data.Distance("Height", grdntBkGrndTrts.Height)); + data.Add(new Snoop.Data.Distance("Horizon", grdntBkGrndTrts.Horizon)); + data.Add(new Snoop.Data.Angle("Rotation", grdntBkGrndTrts.Rotation)); + } + + private void + Stream(ArrayList data, GroundPlaneBackgroundTraits grndPlBkGrndTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(GroundPlaneBackgroundTraits))); + + data.Add(new Snoop.Data.Object("Color ground plane far", grndPlBkGrndTrts.ColorGroundPlaneFar)); + data.Add(new Snoop.Data.Object("Color ground plane near", grndPlBkGrndTrts.ColorGroundPlaneNear)); + data.Add(new Snoop.Data.Object("Color sky horizon", grndPlBkGrndTrts.ColorSkyHorizon)); + data.Add(new Snoop.Data.Object("Color sky zenith", grndPlBkGrndTrts.ColorSkyZenith)); + data.Add(new Snoop.Data.Object("Color underground azimuth", grndPlBkGrndTrts.ColorUndergroundAzimuth)); + data.Add(new Snoop.Data.Object("Color underground horizon", grndPlBkGrndTrts.ColorUndergroundHorizon)); + } + + private void + Stream(ArrayList data, ImageBackgroundTraits imgBkGrndTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ImageBackgroundTraits))); + + data.Add(new Snoop.Data.Bool("Fit to screen", imgBkGrndTrts.FitToScreen)); + data.Add(new Snoop.Data.String("Image filename", imgBkGrndTrts.ImageFilename)); + data.Add(new Snoop.Data.Bool("Maintain aspect ratio", imgBkGrndTrts.MaintainAspectRatio)); + data.Add(new Snoop.Data.Bool("Use tiling", imgBkGrndTrts.UseTiling)); + data.Add(new Snoop.Data.Distance("X offset", imgBkGrndTrts.XOffset)); + data.Add(new Snoop.Data.Distance("Y offset", imgBkGrndTrts.YOffset)); + data.Add(new Snoop.Data.Double("X scale", imgBkGrndTrts.XScale)); + data.Add(new Snoop.Data.Double("Y scale", imgBkGrndTrts.YScale)); + } + + private void + Stream(ArrayList data, MaterialTraits matTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MaterialTraits))); + + data.Add(new Snoop.Data.Object("Ambient", matTrts.Ambient)); + data.Add(new Snoop.Data.Object("Bump", matTrts.Bump)); + data.Add(new Snoop.Data.String("Channel flags", matTrts.ChannelFlags.ToString())); + data.Add(new Snoop.Data.Object("Diffuse", matTrts.Diffuse)); + data.Add(new Snoop.Data.String("Illumination model", matTrts.IlluminationModel.ToString())); + data.Add(new Snoop.Data.String("Mode", matTrts.Mode.ToString())); + data.Add(new Snoop.Data.Object("Opacity", matTrts.Opacity)); + data.Add(new Snoop.Data.Object("Reflection", matTrts.Reflection)); + data.Add(new Snoop.Data.Double("Reflectivity", matTrts.Reflectivity)); + data.Add(new Snoop.Data.Object("Refraction", matTrts.Refraction)); + data.Add(new Snoop.Data.Double("Self illumination", matTrts.SelfIllumination)); + data.Add(new Snoop.Data.Object("Specular", matTrts.Specular)); + data.Add(new Snoop.Data.Double("Translucence", matTrts.Translucence)); + + data.Add(new Snoop.Data.Double("Color bleed scale", matTrts.ColorBleedScale)); + data.Add(new Snoop.Data.Object("Final gather", matTrts.FinalGather.ToString())); + data.Add(new Snoop.Data.String("Global illumination", matTrts.GlobalIllumination.ToString())); + data.Add(new Snoop.Data.Double("Indirect bump scale", matTrts.IndirectBumpScale)); + data.Add(new Snoop.Data.Double("Luminance", matTrts.Luminance)); + data.Add(new Snoop.Data.String("Luminance mode", matTrts.LuminanceMode.ToString())); + data.Add(new Snoop.Data.Object("Normal map", matTrts.NormalMap)); + data.Add(new Snoop.Data.Double("Reflectance scale", matTrts.ReflectanceScale)); + data.Add(new Snoop.Data.Double("Transmittance scale", matTrts.TransmittanceScale)); + data.Add(new Snoop.Data.Bool("Two sided", matTrts.TwoSided)); + } + + //private void + //Stream(ArrayList data, MaterialTraits2 matTrts2) + //{ + // data.Add(new Snoop.Data.ClassSeparator(typeof(MaterialTraits2))); + + // data.Add(new Snoop.Data.Double("Color bleed scale", matTrts2.ColorBleedScale)); + // data.Add(new Snoop.Data.Object("Final gather", matTrts2.FinalGather.ToString())); + // data.Add(new Snoop.Data.String("Global illumination", matTrts2.GlobalIllumination.ToString())); + // data.Add(new Snoop.Data.Double("Indirect bump scale", matTrts2.IndirectBumpScale)); + // data.Add(new Snoop.Data.Double("Luminance", matTrts2.Luminance)); + // data.Add(new Snoop.Data.String("Luminance mode", matTrts2.LuminanceMode.ToString())); + // data.Add(new Snoop.Data.Object("Normal map", matTrts2.NormalMap)); + // data.Add(new Snoop.Data.Double("Reflectance scale", matTrts2.ReflectanceScale)); + // data.Add(new Snoop.Data.Double("Transmittance scale", matTrts2.TransmittanceScale)); + // data.Add(new Snoop.Data.Bool("Two sided", matTrts2.TwoSided)); + //} + + private void + Stream(ArrayList data, RenderSettingsTraits rndrSetTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RenderSettingsTraits))); + + data.Add(new Snoop.Data.Bool("Back faces enabled", rndrSetTrts.BackFacesEnabled)); + data.Add(new Snoop.Data.Bool("Diagnostic background enabled", rndrSetTrts.DiagnosticBackgroundEnabled)); + data.Add(new Snoop.Data.Bool("Material enabled", rndrSetTrts.MaterialEnabled)); + data.Add(new Snoop.Data.Double("Model scale factor", rndrSetTrts.ModelScaleFactor)); + data.Add(new Snoop.Data.Bool("Shadows enabled", rndrSetTrts.ShadowsEnabled)); + data.Add(new Snoop.Data.Bool("Texture sampling", rndrSetTrts.TextureSampling)); + + //MentalRayRenderSettingsTraits mentalRayRendSetTraits = rndrSetTrts as MentalRayRenderSettingsTraits; + //if (mentalRayRendSetTraits != null) { + // Stream(data, mentalRayRendSetTraits); + // return; + //} + + //MentalRayRenderSettingsTraits2 mentalRayRendSetTraits2 = rndrSetTrts as MentalRayRenderSettingsTraits2; + //if (mentalRayRendSetTraits2 != null) { + // Stream(data, mentalRayRendSetTraits2); + // return; + //} + } + + /*private void + Stream(ArrayList data, MentalRayRenderSettingsTraits mentalRayRendSetTraits) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MentalRayRenderSettingsTraits))); + + data.Add(new Snoop.Data.String("Diagnostic BSP mode", mentalRayRendSetTraits.DiagnosticBSPMode.ToString())); + data.Add(new Snoop.Data.Object("Diagnostic grid mode", mentalRayRendSetTraits.DiagnosticGridMode)); + data.Add(new Snoop.Data.String("Diagnostic mode", mentalRayRendSetTraits.DiagnosticMode.ToString())); + data.Add(new Snoop.Data.String("Diagnostic photon mode", mentalRayRendSetTraits.DiagnosticPhotonMode.ToString())); + data.Add(new Snoop.Data.Double("Energy multiplier", mentalRayRendSetTraits.EnergyMultiplier)); + data.Add(new Snoop.Data.Bool("Export MI enabled", mentalRayRendSetTraits.ExportMIEnabled)); + data.Add(new Snoop.Data.String("Export MI file name", mentalRayRendSetTraits.ExportMIFileName)); + data.Add(new Snoop.Data.Int("FG ray count", mentalRayRendSetTraits.FGRayCount)); + data.Add(new Snoop.Data.Object("FG sample radius state", mentalRayRendSetTraits.FGSampleRadiusState)); + data.Add(new Snoop.Data.Object("FG sample radius", mentalRayRendSetTraits.FGSampleRadius)); + data.Add(new Snoop.Data.Bool("Final gathering enabled", mentalRayRendSetTraits.FinalGatheringEnabled)); + data.Add(new Snoop.Data.Int("GI photons per light", mentalRayRendSetTraits.GIPhotonsPerLight)); + data.Add(new Snoop.Data.Int("GI sample count", mentalRayRendSetTraits.GISampleCount)); + data.Add(new Snoop.Data.Double("GI sample radius", mentalRayRendSetTraits.GISampleRadius)); + data.Add(new Snoop.Data.Bool("GI sample radius enabled", mentalRayRendSetTraits.GISampleRadiusEnabled)); + data.Add(new Snoop.Data.Bool("Global illumination enabled", mentalRayRendSetTraits.GlobalIlluminationEnabled)); + data.Add(new Snoop.Data.Double("Light luminance scale", mentalRayRendSetTraits.LightLuminanceScale)); + data.Add(new Snoop.Data.Int("Memory limit", mentalRayRendSetTraits.MemoryLimit)); + data.Add(new Snoop.Data.Double("Model scale factor", mentalRayRendSetTraits.ModelScaleFactor)); + data.Add(new Snoop.Data.Object("Photon trace depth", mentalRayRendSetTraits.PhotonTraceDepth)); + data.Add(new Snoop.Data.Object("Ray trace depth", mentalRayRendSetTraits.RayTraceDepth)); + data.Add(new Snoop.Data.Bool("Ray trace enabled", mentalRayRendSetTraits.RayTraceEnabled)); + data.Add(new Snoop.Data.Object("Sampling", mentalRayRendSetTraits.Sampling)); + data.Add(new Snoop.Data.Object("Sampling contrast color", mentalRayRendSetTraits.SamplingContrastColor)); + data.Add(new Snoop.Data.Object("Sampling filter", mentalRayRendSetTraits.SamplingFilter)); + data.Add(new Snoop.Data.Bool("Shadow map enabled", mentalRayRendSetTraits.ShadowMapEnabled)); + data.Add(new Snoop.Data.String("Shadow mode", mentalRayRendSetTraits.ShadowMode.ToString())); + data.Add(new Snoop.Data.String("Tile order", mentalRayRendSetTraits.TileOrder.ToString())); + data.Add(new Snoop.Data.Int("Tile size", mentalRayRendSetTraits.TileSize)); + + data.Add(new Snoop.Data.String("Exposure type", mentalRayRendSetTraits.ExposureType.ToString())); + data.Add(new Snoop.Data.String("Final gathering mode", mentalRayRendSetTraits.FinalGatheringMode.ToString())); + data.Add(new Snoop.Data.Double("Shadow sampling multiplier", mentalRayRendSetTraits.ShadowSamplingMultiplier)); + }*/ + + //private void + //Stream(ArrayList data, MentalRayRenderSettingsTraits2 mentalRayRendSetTraits2) + //{ + // data.Add(new Snoop.Data.ClassSeparator(typeof(MentalRayRenderSettingsTraits2))); + + // data.Add(new Snoop.Data.String("Exposure type", mentalRayRendSetTraits2.ExposureType.ToString())); + // data.Add(new Snoop.Data.String("Final gathering mode", mentalRayRendSetTraits2.FinalGatheringMode.ToString())); + // data.Add(new Snoop.Data.Double("Shadow sampling multiplier", mentalRayRendSetTraits2.ShadowSamplingMultiplier)); + //} + + private void + Stream(ArrayList data, RenderEnvironmentTraits rndrEnvTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RenderEnvironmentTraits))); + + data.Add(new Snoop.Data.Bool("Enable", rndrEnvTrts.Enable)); + data.Add(new Snoop.Data.Object("Environment map", rndrEnvTrts.EnvironmentMap)); + data.Add(new Snoop.Data.Distance("Far distance", rndrEnvTrts.FarDistance)); + data.Add(new Snoop.Data.Distance("Near distance", rndrEnvTrts.NearDistance)); + data.Add(new Snoop.Data.Double("Far percentage", rndrEnvTrts.FarPercentage)); + data.Add(new Snoop.Data.Double("Near percentage", rndrEnvTrts.NearPercentage)); + data.Add(new Snoop.Data.Object("Fog color", rndrEnvTrts.FogColor)); + data.Add(new Snoop.Data.Bool("Is background", rndrEnvTrts.IsBackground)); + } + + private void + Stream(ArrayList data, SolidBackgroundTraits solBkGrndTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SolidBackgroundTraits))); + + data.Add(new Snoop.Data.Object("Color solid", solBkGrndTrts.ColorSolid)); + } + + private void + Stream(ArrayList data, SkyBackgroundTraits skyBkGrndTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SkyBackgroundTraits))); + + data.Add(new Snoop.Data.Object("Sky parameters", skyBkGrndTrts.SkyParameters)); + } + + #endregion + + private void + Stream(ArrayList data, ViewportTraits viewPrtTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ViewportTraits))); + + data.Add(new Snoop.Data.Object("Ambient light color", viewPrtTrts.AmbientLightColor)); + data.Add(new Snoop.Data.ObjectId("Background", viewPrtTrts.Background)); + data.Add(new Snoop.Data.Double("Brightness", viewPrtTrts.Brightness)); + data.Add(new Snoop.Data.Double("Contrast", viewPrtTrts.Contrast)); + data.Add(new Snoop.Data.Bool("Default lighting on", viewPrtTrts.DefaultLightingOn)); + data.Add(new Snoop.Data.String("Default lighting type", viewPrtTrts.DefaultLightingType.ToString())); + data.Add(new Snoop.Data.ObjectId("Render environment", viewPrtTrts.RenderEnvironment)); + data.Add(new Snoop.Data.ObjectId("Render settings", viewPrtTrts.RenderSettings)); + data.Add(new Snoop.Data.Object("Tone operator parameters", viewPrtTrts.ToneOperatorParameters)); + //ViewportTraits2 viewPrtTrts2 = viewPrtTrts as ViewportTraits2; + //if (viewPrtTrts2 != null) { + // Stream(data, viewPrtTrts2); + // return; + //} + } + + //private void + //Stream(ArrayList data, ViewportTraits2 viewPrtTrts2) + //{ + // data.Add(new Snoop.Data.ClassSeparator(typeof(ViewportTraits2))); + + // data.Add(new Snoop.Data.Object("Tone operator parameters", viewPrtTrts2.ToneOperatorParameters)); + //} + + + private void + Stream(ArrayList data, VisualStyleTraits visStylTrts) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(VisualStyleTraits))); + + data.Add(new Snoop.Data.Object("AcGi visual style", visStylTrts.AcGiVisualStyle)); + } + + #endregion + + private void + Stream(ArrayList data, LightAttenuation lightAtt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LightAttenuation))); + + data.Add(new Snoop.Data.String("Attenuation type", lightAtt.AttenuationType.ToString())); + data.Add(new Snoop.Data.Double("End limit", lightAtt.EndLimit)); + data.Add(new Snoop.Data.Double("Start limit", lightAtt.StartLimit)); + data.Add(new Snoop.Data.Bool("Use limits", lightAtt.UseLimits)); + } + + /*private void + Stream(ArrayList data, DisplayStyle dispStyl) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DisplayStyle))); + + data.Add(new Snoop.Data.Double("Brightness", dispStyl.Brightness)); + data.Add(new Snoop.Data.String("Display settings", dispStyl.DisplaySettings.ToString())); + data.Add(new Snoop.Data.String("Shadow type", dispStyl.ShadowType.ToString())); + }*/ // TBD: Fix JMA + + private void + Stream(ArrayList data, ShadowParameters shadParams) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ShadowParameters))); + + data.Add(new Snoop.Data.Int("Shadow map size", shadParams.ShadowMapSize)); + //data.Add(new Snoop.Data.Byte("Shadow map softness", shadParams.ShadowMapSoftness)); + data.Add(new Snoop.Data.Bool("Shadows on", shadParams.ShadowsOn)); + data.Add(new Snoop.Data.String("Shadow type", shadParams.ShadowType.ToString())); + + data.Add(new Snoop.Data.Double("Extended light length", shadParams.ExtendedLightLength)); + data.Add(new Snoop.Data.Double("Extended light radius", shadParams.ExtendedLightRadius)); + data.Add(new Snoop.Data.String("Extended light shape", shadParams.ExtendedLightShape.ToString())); + data.Add(new Snoop.Data.Double("Extended light width", shadParams.ExtendedLightWidth)); + data.Add(new Snoop.Data.Int("Shadows samples", shadParams.ShadowSamples)); + data.Add(new Snoop.Data.Bool("Shape visibility", shadParams.ShapeVisibility)); + } + + //private void + //Stream(ArrayList data, ShadowParameters2 shadParams2) + //{ + // data.Add(new Snoop.Data.ClassSeparator(typeof(ShadowParameters2))); + + // data.Add(new Snoop.Data.Double("Extended light length", shadParams2.ExtendedLightLength)); + // data.Add(new Snoop.Data.Double("Extended light radius", shadParams2.ExtendedLightRadius)); + // data.Add(new Snoop.Data.String("Extended light shape", shadParams2.ExtendedLightShape.ToString())); + // data.Add(new Snoop.Data.Double("Extended light width", shadParams2.ExtendedLightWidth)); + // data.Add(new Snoop.Data.Int("Shadows samples", shadParams2.ShadowSamples)); + // data.Add(new Snoop.Data.Bool("Shape visibility", shadParams2.ShapeVisibility)); + //} + + private void + Stream(ArrayList data, Glyph glyph) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Glyph))); + + data.Add(new Snoop.Data.ObjectId("ID", glyph.Id)); + data.Add(new Snoop.Data.Bool("Is persistent", glyph.IsPersistent)); + } + + private void + Stream(ArrayList data, MaterialColor matCol) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MaterialColor))); + + data.Add(new Snoop.Data.Object("Color", matCol.Color)); + data.Add(new Snoop.Data.Double("Factor", matCol.Factor)); + data.Add(new Snoop.Data.String("Method", matCol.Method.ToString())); + } + + private void + Stream(ArrayList data, MaterialMap matMap) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MaterialMap))); + + data.Add(new Snoop.Data.Double("Blend factor", matMap.BlendFactor)); + data.Add(new Snoop.Data.Object("Mapper", matMap.Mapper)); + data.Add(new Snoop.Data.String("Source", matMap.Source.ToString())); + //data.Add(new Snoop.Data.String("Source filename", matMap.SourceFileName)); // Obsolete in Spago + data.Add(new Snoop.Data.Object("Texture", matMap.Texture)); + } + + private void + Stream(ArrayList data, Mapper mapper) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Mapper))); + + data.Add(new Snoop.Data.String("Auto transform", mapper.AutoTransform.ToString())); + data.Add(new Snoop.Data.String("Projection", mapper.Projection.ToString())); + data.Add(new Snoop.Data.String("U Tiling", mapper.UTiling.ToString())); + data.Add(new Snoop.Data.String("V Tiling", mapper.VTiling.ToString())); + data.Add(new Snoop.Data.Object("Transform", mapper.Transform)); + } + + #region MaterialTexture + private void + Stream(ArrayList data, MaterialTexture matTxtr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MaterialTexture))); + + /// no data here + /// + ProceduralTexture procTxtr = matTxtr as ProceduralTexture; + if (procTxtr != null) { + Stream(data, procTxtr); + return; + } + + ImageTexture imgTxtr = matTxtr as ImageTexture; + if (imgTxtr != null) { + Stream(data, procTxtr); + return; + } + } + + private void + Stream(ArrayList data, ProceduralTexture procTxtr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ProceduralTexture))); + /// no data + /// + WoodTexture woodTxtr = procTxtr as WoodTexture; + if (woodTxtr != null) { + Stream(data, woodTxtr); + return; + } + + MarbleTexture marTxtr = procTxtr as MarbleTexture; + if (marTxtr != null) { + Stream(data, marTxtr); + return; + } + + GenericTexture genTxtr = procTxtr as GenericTexture; + if (genTxtr != null) { + Stream(data, genTxtr); + return; + } + } + + private void + Stream(ArrayList data, WoodTexture woodTxtr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(WoodTexture))); + + data.Add(new Snoop.Data.Double("Axial noise", woodTxtr.AxialNoise)); + data.Add(new Snoop.Data.Object("Color 1", woodTxtr.Color1)); + data.Add(new Snoop.Data.Object("Color 2", woodTxtr.Color2)); + data.Add(new Snoop.Data.Distance("Grain thickness", woodTxtr.GrainThickness)); + data.Add(new Snoop.Data.Double("Radial noise", woodTxtr.RadialNoise)); + } + + private void + Stream(ArrayList data, MarbleTexture marTxtr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MarbleTexture))); + + data.Add(new Snoop.Data.Object("Stone color", marTxtr.StoneColor)); + data.Add(new Snoop.Data.Object("Vein color", marTxtr.VeinColor)); + data.Add(new Snoop.Data.Distance("Vein spacing", marTxtr.VeinSpacing)); + data.Add(new Snoop.Data.Distance("Vein width", marTxtr.VeinWidth)); + } + + private void + Stream(ArrayList data, GenericTexture genTxtr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(GenericTexture))); + + data.Add(new Snoop.Data.Object("Definition", genTxtr.Definition)); + } + + private void + Stream(ArrayList data, ImageTexture imgTxtr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ImageTexture))); + + /// no data + /// + ImageFileTexture imgFilTxtr = imgTxtr as ImageFileTexture; + if (imgFilTxtr != null) { + Stream(data, imgFilTxtr); + return; + } + } + + private void + Stream(ArrayList data, ImageFileTexture imgFilTxtr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ImageFileTexture))); + + data.Add(new Snoop.Data.String("Source file name", imgFilTxtr.SourceFileName)); + } + + #endregion + + private void + Stream(ArrayList data, Autodesk.AutoCAD.GraphicsInterface.Geometry geo) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.GraphicsInterface.Geometry))); + + data.Add(new Snoop.Data.Object("Model to world transform", geo.ModelToWorldTransform)); + data.Add(new Snoop.Data.Object("World to model transform", geo.WorldToModelTransform)); + + ViewportGeometry vPortGeo = geo as ViewportGeometry; + if (vPortGeo != null) { + data.Add(new Snoop.Data.ClassSeparator(typeof(ViewportGeometry))); + // no more data here + return; + } + + WorldGeometry worldGeo = geo as WorldGeometry; + if (worldGeo != null) { + data.Add(new Snoop.Data.ClassSeparator(typeof(WorldGeometry))); + // no more data here + return; + } + } + + private void + Stream(ArrayList data, Viewport vPort) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Viewport))); + + data.Add(new Snoop.Data.Int("Acad window ID", vPort.AcadWindowId)); + data.Add(new Snoop.Data.Int("Viewport ID", vPort.ViewportId.ToInt32())); + data.Add(new Snoop.Data.Point3d("Camera location", vPort.CameraLocation)); + data.Add(new Snoop.Data.Point3d("Camera target", vPort.CameraTarget)); + data.Add(new Snoop.Data.Vector3d("Camera up vector", vPort.CameraUpVector)); + data.Add(new Snoop.Data.Object("Device context viewport corners", vPort.DeviceContextViewportCorners)); + data.Add(new Snoop.Data.Object("Front and back clipping", vPort.FrontAndBackClipping)); + data.Add(new Snoop.Data.Bool("Is perspective", vPort.IsPerspective)); + data.Add(new Snoop.Data.Double("Linetype generation criteria", vPort.LinetypeGenerationCriteria)); + data.Add(new Snoop.Data.Double("Linetype scale multiplier", vPort.LinetypeScaleMultiplier)); + data.Add(new Snoop.Data.Object("Eye to model transform", vPort.EyeToModelTransform)); + data.Add(new Snoop.Data.Object("Eye to world transform", vPort.EyeToWorldTransform)); + data.Add(new Snoop.Data.Object("Model to eye transform", vPort.ModelToEyeTransform)); + data.Add(new Snoop.Data.Object("World to eye transform", vPort.WorldToEyeTransform)); + data.Add(new Snoop.Data.Vector3d("View direction", vPort.ViewDirection)); + } + + private void + Stream(ArrayList data, Context ctxt) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Context))); + + data.Add(new Snoop.Data.String("ByBlock line weight", ctxt.ByBlockLineWeight.ToString())); + data.Add(new Snoop.Data.ObjectId("ByBlock PlotStyleName ID", ctxt.ByBlockPlotStyleNameId)); + data.Add(new Snoop.Data.Database("Database", ctxt.Database)); + data.Add(new Snoop.Data.Object("Effective color", ctxt.EffectiveColor)); + data.Add(new Snoop.Data.Bool("Is boundary clipping", ctxt.IsBoundaryClipping)); + data.Add(new Snoop.Data.Bool("Is nesting", ctxt.IsNesting)); + data.Add(new Snoop.Data.Bool("Is plot generation", ctxt.IsPlotGeneration)); + data.Add(new Snoop.Data.Bool("Is PostScript out", ctxt.IsPostScriptOut)); + data.Add(new Snoop.Data.Bool("Supports TrueType text", ctxt.SupportsTrueTypeText)); + } + + /* private void + Stream(ArrayList data, FaceStyle faceStyl) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(FaceStyle))); + + data.Add(new Snoop.Data.String("Face color mode", faceStyl.FaceColorMode.ToString())); + data.Add(new Snoop.Data.String("Face modifiers", faceStyl.FaceModifiers.ToString())); + data.Add(new Snoop.Data.String("Lighting model", faceStyl.LightingModel.ToString())); + data.Add(new Snoop.Data.String("Lighting quality", faceStyl.LightingQuality.ToString())); + data.Add(new Snoop.Data.Object("Mono color", faceStyl.MonoColor)); + data.Add(new Snoop.Data.Double("Opacity", faceStyl.Opacity)); + data.Add(new Snoop.Data.Double("Specular highlight", faceStyl.SpecularHighlight)); + } */ // TBD - fix JMA + + /*private void + Stream(ArrayList data, EdgeStyle edgStyl) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(EdgeStyle))); + + data.Add(new Snoop.Data.Angle("Crease angle", edgStyl.CreaseAngle)); + data.Add(new Snoop.Data.Object("Edge color", edgStyl.EdgeColor)); + data.Add(new Snoop.Data.String("Edge model", edgStyl.EdgeModel.ToString())); + data.Add(new Snoop.Data.String("Edge modifiers", edgStyl.EdgeModifiers.ToString())); + data.Add(new Snoop.Data.String("Edge style apply", edgStyl.EdgeStyleApply.ToString())); + data.Add(new Snoop.Data.String("Edge visibility", edgStyl.EdgeVisibility.ToString())); + data.Add(new Snoop.Data.Int("Edge width", edgStyl.EdgeWidth)); + data.Add(new Snoop.Data.Int("Halo gap", edgStyl.HaloGap)); + data.Add(new Snoop.Data.Bool("Hide precision", edgStyl.HidePrecision)); + data.Add(new Snoop.Data.Object("Intersection color", edgStyl.IntersectionColor)); + data.Add(new Snoop.Data.String("Intersection linetype", edgStyl.IntersectionLinetype.ToString())); + data.Add(new Snoop.Data.Int("Number of isolines", edgStyl.Isolines)); + data.Add(new Snoop.Data.String("Jitter", edgStyl.Jitter.ToString())); + data.Add(new Snoop.Data.Object("Obscured color", edgStyl.ObscuredColor)); + data.Add(new Snoop.Data.String("Obscured linetype", edgStyl.ObscuredLinetype.ToString())); + data.Add(new Snoop.Data.Double("Opacity", edgStyl.Opacity)); + data.Add(new Snoop.Data.Int("Overhang", edgStyl.Overhang)); + data.Add(new Snoop.Data.Object("Silhouette color", edgStyl.SilhouetteColor)); + data.Add(new Snoop.Data.Int("Silhouette width", edgStyl.SilhouetteWidth)); + }*/ // TBD Fix JMA + + private void + Stream(ArrayList data, VisualStyle visStyl) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(VisualStyle))); + // TBD: Fix JMA + //data.Add(new Snoop.Data.Object("Display style", visStyl.DisplayStyle)); + //data.Add(new Snoop.Data.Object("Edge style", visStyl.EdgeStyle)); + //data.Add(new Snoop.Data.Object("Face style", visStyl.FaceStyle)); + + } + + private void + Stream(ArrayList data, ClipBoundary clipBdry) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ClipBoundary))); + + data.Add(new Snoop.Data.Distance("Back clip Z", clipBdry.BackClipZ)); + data.Add(new Snoop.Data.Distance("Front clip Z", clipBdry.FrontClipZ)); + data.Add(new Snoop.Data.Bool("Clipping back", clipBdry.ClippingBack)); + data.Add(new Snoop.Data.Bool("Clipping rront", clipBdry.ClippingFront)); + data.Add(new Snoop.Data.Bool("Draw boundary", clipBdry.DrawBoundary)); + data.Add(new Snoop.Data.Vector3d("Normal vector", clipBdry.NormalVector)); + data.Add(new Snoop.Data.Point3d("Point", clipBdry.Point)); + data.Add(new Snoop.Data.Object("Transform inverse BblockRef xform", clipBdry.TransformInverseBlockRefXForm)); + data.Add(new Snoop.Data.Object("Transform to clip space", clipBdry.TransformToClipSpace)); + + } + + private void + Stream(ArrayList data, EdgeData edgData) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(EdgeData))); + + + data.Add(new Snoop.Data.ObjectIdCollection("Layers", edgData.GetLayers())); + data.Add(new Snoop.Data.ObjectIdCollection("Linetypes", edgData.GetLineTypes())); + data.Add(new Snoop.Data.ObjectCollection("True colors", edgData.GetTrueColors())); + + short[] colors = edgData.GetColors(); + data.Add(new Snoop.Data.CategorySeparator("Colors")); + for (int i = 0; i < colors.Length; i++) { + data.Add(new Snoop.Data.Int(string.Format("Color [{0}]", i), colors[i])); + } + + + +# if !ACAD2007 + // TBD: not sure what to do with IntPtrs? + //System.IntPtr[] selMrkrs = edgData.GetSelectionMarkers(); + //data.Add(new Snoop.Data.CategorySeparator("Selection Markers")); + //for (int i = 0; i < selMrkrs.Length; i++) { + // data.Add(new Snoop.Data.String(string.Format("Selection marker [{0}]", i), selMrkrs[i].ToString())); + //} +#endif + } + + private void + Stream(ArrayList data, FaceData faceData) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(FaceData))); + + data.Add(new Snoop.Data.ObjectIdCollection("Layers", faceData.GetLayers())); + data.Add(new Snoop.Data.ObjectCollection("Mappers", faceData.GetMappers())); + data.Add(new Snoop.Data.ObjectIdCollection("Materials", faceData.GetMaterials())); + data.Add(new Snoop.Data.ObjectCollection("True colors", faceData.GetTrueColors())); + + Autodesk.AutoCAD.Geometry.Vector3d[] vec3d = faceData.GetNormalVectors(); + data.Add(new Snoop.Data.CategorySeparator("Normal Vectors")); + for (int i = 0; i < vec3d.Length; i++) { + data.Add(new Snoop.Data.Vector3d(string.Format("Normal vector[{0}]", i), vec3d[i])); + } + + short[] colors = faceData.GetColors(); + data.Add(new Snoop.Data.CategorySeparator("Colors")); + for (int i = 0; i < colors.Length; i++) { + data.Add(new Snoop.Data.Int(string.Format("Color [{0}]", i), colors[i])); + } + + // TBD: not sure what to do with IntPtrs? +# if !ACAD2007 + System.IntPtr[] selMrkrs = faceData.GetSelectionMarkers(); + data.Add(new Snoop.Data.CategorySeparator("Selection Markers")); + for (int i = 0; i < selMrkrs.Length; i++) { + data.Add(new Snoop.Data.String(string.Format("Selection marker [{0}]", i), selMrkrs[i].ToString())); + } +#endif + + } + + private void + Stream(ArrayList data, VertexData vertData) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(VertexData))); + + + data.Add(new Snoop.Data.String("Orientation flag", vertData.OrientationFlag.ToString())); + data.Add(new Snoop.Data.ObjectCollection("True colors", vertData.GetTrueColors())); + + Autodesk.AutoCAD.Geometry.Vector3d[] vec3d = vertData.GetNormalVectors(); + data.Add(new Snoop.Data.CategorySeparator("Normal Vectors")); + for (int i = 0; i < vec3d.Length; i++) { + data.Add(new Snoop.Data.Vector3d(String.Format("Normal vector [{0}]", i), vec3d[i])); + } + } + + private void + Stream(ArrayList data, ContextualColors cntxtColors) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ContextualColors))); + + + data.Add(new Snoop.Data.Int("Camera clipping", cntxtColors.CameraClipping)); + data.Add(new Snoop.Data.Int("Camera frustrum", cntxtColors.CameraFrustrum)); + data.Add(new Snoop.Data.Int("Camera glyphs", cntxtColors.CameraGlyphs)); + data.Add(new Snoop.Data.Int("Grid axis lines", cntxtColors.GridAxisLines)); + data.Add(new Snoop.Data.Int("Grid axis line tint XYZ", cntxtColors.GridAxisLineTintXYZ)); + data.Add(new Snoop.Data.Int("Grid major lines", cntxtColors.GridMajorLines)); + data.Add(new Snoop.Data.Int("Grid major line tint XYZ", cntxtColors.GridMajorLineTintXYZ)); + data.Add(new Snoop.Data.Int("Grid minor lines", cntxtColors.GridMinorLines)); + data.Add(new Snoop.Data.Int("Grid minor line tint XYZ", cntxtColors.GridMinorLineTintXYZ)); + data.Add(new Snoop.Data.Object("Light distance color", cntxtColors.LightDistanceColor)); + data.Add(new Snoop.Data.Int("Light end limit", cntxtColors.LightEndLimit)); + data.Add(new Snoop.Data.Int("Light fall off", cntxtColors.LightFalloff)); + data.Add(new Snoop.Data.Int("Light glyphs", cntxtColors.LightGlyphs)); + data.Add(new Snoop.Data.Int("Light hot spot", cntxtColors.LightHotspot)); + data.Add(new Snoop.Data.Object("Light shape color", cntxtColors.LightShapeColor)); + data.Add(new Snoop.Data.Int("Light start limit", cntxtColors.LightStartLimit)); + data.Add(new Snoop.Data.Object("Web mesh color", cntxtColors.WebMeshColor)); + data.Add(new Snoop.Data.Object("Web mesh missing color", cntxtColors.WebMeshMissingColor)); + } + + private void + Stream(ArrayList data, SkyParameters skyParams) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(SkyParameters))); + + data.Add(new Snoop.Data.Bool("Aerial perspective", skyParams.AerialPerspective)); + data.Add(new Snoop.Data.Double("Disk intensity", skyParams.DiskIntensity)); + data.Add(new Snoop.Data.Double("Disk scale", skyParams.DiskScale)); + data.Add(new Snoop.Data.Double("Glow intensity", skyParams.GlowIntensity)); + data.Add(new Snoop.Data.Object("Ground color", skyParams.GroundColor)); + data.Add(new Snoop.Data.Double("Haze", skyParams.Haze)); + data.Add(new Snoop.Data.Double("Horizon blur", skyParams.HorizonBlur)); + data.Add(new Snoop.Data.Double("Horizon height", skyParams.HorizonHeight)); + data.Add(new Snoop.Data.Bool("Illumination", skyParams.Illumination)); + data.Add(new Snoop.Data.Double("Intensity factor", skyParams.IntensityFactor)); + data.Add(new Snoop.Data.Object("Night color", skyParams.NightColor)); + data.Add(new Snoop.Data.Double("Red blue shift", skyParams.RedBlueShift)); + data.Add(new Snoop.Data.Double("Saturationt", skyParams.Saturation)); + data.Add(new Snoop.Data.Int("Solar disk samples", skyParams.SolarDiskSamples)); + data.Add(new Snoop.Data.Vector3d("Sun direction", skyParams.SunDirection)); + data.Add(new Snoop.Data.Double("Visibility distance", skyParams.VisibilityDistance)); + } + + private void + Stream(ArrayList data, ToneOperatorParameters toneOperParams) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ToneOperatorParameters))); + + data.Add(new Snoop.Data.Double("Brightness", toneOperParams.Brightness)); + data.Add(new Snoop.Data.Bool("Chromatic adaptation", toneOperParams.ChromaticAdaptation)); + data.Add(new Snoop.Data.Bool("Color differentiation", toneOperParams.ColorDifferentiation)); + data.Add(new Snoop.Data.Double("Contrast", toneOperParams.Contrast)); + data.Add(new Snoop.Data.String("Exterior day light", toneOperParams.ExteriorDaylight.ToString())); + data.Add(new Snoop.Data.Bool("Is active", toneOperParams.IsActive)); + data.Add(new Snoop.Data.Double("Mid tones", toneOperParams.MidTones)); + data.Add(new Snoop.Data.Bool("Process background", toneOperParams.ProcessBackground)); + data.Add(new Snoop.Data.Object("White color", toneOperParams.WhiteColor)); + } + + //private void + //Stream(ArrayList data, Variant variant) + //{ + // data.Add(new Snoop.Data.ClassSeparator(typeof(Variant))); + + // data.Add(new Snoop.Data.Bool("Boolean", variant.Boolean)); + // data.Add(new Snoop.Data.Object("Color", variant.Color)); + // data.Add(new Snoop.Data.Double("Double", variant.Double)); + // data.Add(new Snoop.Data.Int("Int", variant.Int)); + // data.Add(new Snoop.Data.String("String", variant.String)); + // data.Add(new Snoop.Data.String("Type", variant.Type.ToString())); + //} + + private void + Stream(ArrayList data, FontDescriptor font) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.GraphicsInterface.FontDescriptor))); + + data.Add(new Snoop.Data.String("Font typeface", font.TypeFace)); + data.Add(new Snoop.Data.Bool("Font is bold", font.Bold)); + data.Add(new Snoop.Data.Bool("Font is italic", font.Italic)); + data.Add(new Snoop.Data.Int("Font charset", font.CharacterSet)); + data.Add(new Snoop.Data.Int("Font pitch/family", font.PitchAndFamily)); + } + + /* private void + Stream(ArrayList data, EdgeStyleOverride edgStyOvRd) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(EdgeStyleOverride))); + + data.Add(new Snoop.Data.Object("Edge style", edgStyOvRd.EdgeStyle)); + data.Add(new Snoop.Data.Double("Mask", edgStyOvRd.Mask)); + }*/ // TBD: fix JMA + + private void + Stream(ArrayList data, MaterialDiffuseComponent matDiffComp) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MaterialDiffuseComponent))); + + data.Add(new Snoop.Data.Object("Color", matDiffComp.Color)); + data.Add(new Snoop.Data.Object("Material map", matDiffComp.Map)); + } + + private void + Stream(ArrayList data, MaterialSpecularComponent matSpecComp) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MaterialSpecularComponent))); + + data.Add(new Snoop.Data.Object("Color", matSpecComp.Color)); + data.Add(new Snoop.Data.Double("Gloss", matSpecComp.Gloss)); + data.Add(new Snoop.Data.Object("Material pap", matSpecComp.Map)); + } + + private void + Stream(ArrayList data, MaterialOpacityComponent matOpacComp) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MaterialOpacityComponent))); + + data.Add(new Snoop.Data.Object("Material map", matOpacComp.Map)); + data.Add(new Snoop.Data.Double("Percentage", matOpacComp.Percentage)); + } + + private void + Stream(ArrayList data, MaterialRefractionComponent matRefComp) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MaterialRefractionComponent))); + + data.Add(new Snoop.Data.Object("Material map", matRefComp.Map)); + data.Add(new Snoop.Data.Double("Index", matRefComp.Index)); + } + + /*private void + Stream(ArrayList data, MentalRayRenderSettingsTraitsIntegerRangeParameter mRayRSetngsTraitsIntRngParam) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MentalRayRenderSettingsTraitsIntegerRangeParameter))); + + data.Add(new Snoop.Data.Object("Max", mRayRSetngsTraitsIntRngParam.Max)); + data.Add(new Snoop.Data.Double("Min", mRayRSetngsTraitsIntRngParam.Min)); + } + + private void + Stream(ArrayList data, MentalRayRenderSettingsTraitsTraceParameter mRayRSetngsTraitsTraceParam) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MentalRayRenderSettingsTraitsTraceParameter))); + + data.Add(new Snoop.Data.Int("Reflection", mRayRSetngsTraitsTraceParam.Reflection)); + data.Add(new Snoop.Data.Int("Refraction", mRayRSetngsTraitsTraceParam.Refraction)); + data.Add(new Snoop.Data.Int("Sum", mRayRSetngsTraitsTraceParam.Sum)); + } + + private void + Stream(ArrayList data, MentalRayRenderSettingsTraitsFloatParameter mRayRSetngsTraitsFltParam) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MentalRayRenderSettingsTraitsFloatParameter))); + + data.Add(new Snoop.Data.Double("A", mRayRSetngsTraitsFltParam.A)); + data.Add(new Snoop.Data.Double("B", mRayRSetngsTraitsFltParam.B)); + data.Add(new Snoop.Data.Double("G", mRayRSetngsTraitsFltParam.G)); + data.Add(new Snoop.Data.Double("R", mRayRSetngsTraitsFltParam.R)); + } + + private void + Stream(ArrayList data, MentalRayRenderSettingsTraitsDoubleRangeParameter mRayRSetngsTraitsDblRngParam) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MentalRayRenderSettingsTraitsDoubleRangeParameter))); + + data.Add(new Snoop.Data.Double("Max", mRayRSetngsTraitsDblRngParam.Max)); + data.Add(new Snoop.Data.Double("Min", mRayRSetngsTraitsDblRngParam.Min)); + } + + private void + Stream(ArrayList data, MentalRayRenderSettingsTraitsSamplingParameter mRayRSetngsTraitsSmplParam) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MentalRayRenderSettingsTraitsSamplingParameter))); + + data.Add(new Snoop.Data.String("Filter", mRayRSetngsTraitsSmplParam.Filter.ToString())); + data.Add(new Snoop.Data.Distance("Height", mRayRSetngsTraitsSmplParam.Height)); + data.Add(new Snoop.Data.Distance("Width", mRayRSetngsTraitsSmplParam.Width)); + } + + private void + Stream(ArrayList data, MentalRayRenderSettingsTraitsBoolParameter mRayRSetngsTraitsBoolParam) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MentalRayRenderSettingsTraitsBoolParameter))); + + data.Add(new Snoop.Data.Bool("Max", mRayRSetngsTraitsBoolParam.Max)); + data.Add(new Snoop.Data.Bool("Min", mRayRSetngsTraitsBoolParam.Min)); + data.Add(new Snoop.Data.Bool("Pixels", mRayRSetngsTraitsBoolParam.Pixels)); + } + + private void + Stream(ArrayList data, MentalRayRenderSettingsTraitsDiagnosticGridModeParameter mRayRSetngsTraitsDiaGridModeParam) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MentalRayRenderSettingsTraitsDiagnosticGridModeParameter))); + + data.Add(new Snoop.Data.String("Mode", mRayRSetngsTraitsDiaGridModeParam.Mode.ToString())); + data.Add(new Snoop.Data.Double("Size", mRayRSetngsTraitsDiaGridModeParam.Size)); + }*/ + + private void + Stream(ArrayList data, FrontAndBackClipping frntBackClip) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(FrontAndBackClipping))); + + data.Add(new Snoop.Data.Distance("Front", frntBackClip.Front)); + data.Add(new Snoop.Data.Distance("Back", frntBackClip.Back)); + data.Add(new Snoop.Data.Bool("Clip front", frntBackClip.ClipFront)); + data.Add(new Snoop.Data.Bool("Clip back", frntBackClip.ClipBack)); + } + + private void + Stream(ArrayList data, ColorRGB colorRGB) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ColorRGB))); + + data.Add(new Snoop.Data.Double("Blue", colorRGB.Blue)); + data.Add(new Snoop.Data.Double("Green", colorRGB.Green)); + data.Add(new Snoop.Data.Double("Red", colorRGB.Red)); + } + + private void + Stream(ArrayList data, ColorRGBA colorRGBA) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ColorRGBA))); + + data.Add(new Snoop.Data.Double("Blue", colorRGBA.Alpha)); + data.Add(new Snoop.Data.Double("Green", colorRGBA.Green)); + data.Add(new Snoop.Data.Double("Red", colorRGBA.Red)); + data.Add(new Snoop.Data.Double("Blue", colorRGBA.Blue)); + } + + private void + Stream(ArrayList data, MaterialNormalMapComponent matNormMapComp) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(MaterialNormalMapComponent))); + + data.Add(new Snoop.Data.Object("Map", matNormMapComp.Map)); + data.Add(new Snoop.Data.String("Method", matNormMapComp.Method.ToString())); + data.Add(new Snoop.Data.Double("Strength", matNormMapComp.Strength)); + } + } +} diff --git a/MgdDbgLibrary/Snoop/CollectorExts/GraphicsSystem.cs b/MgdDbgLibrary/Snoop/CollectorExts/GraphicsSystem.cs new file mode 100644 index 0000000..f92c846 --- /dev/null +++ b/MgdDbgLibrary/Snoop/CollectorExts/GraphicsSystem.cs @@ -0,0 +1,283 @@ + +// $Header: //Desktop/Source/TestTools/MgdDbg/Snoop/CollectorExts/GraphicsSystem.cs#1 $ +// $Author: fergusja $ $DateTime: 2007/03/16 08:08:08 $ $Change: 68854 $ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Collections; +using System.Diagnostics; + +using MgdDbg.Snoop.Collectors; + +using Autodesk.AutoCAD.GraphicsSystem; + +namespace MgdDbg.Snoop.CollectorExts { + public class GraphicsSystem : CollectorExt { + + public + GraphicsSystem() + { + } + + protected override void + CollectEvent(object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + // see if it is a type we are responsible for + Manager mgr = e.ObjToSnoop as Manager; + if (mgr != null) { + Stream(snoopCollector.Data(), mgr); + return; + } + + ViewEventArgs args = e.ObjToSnoop as ViewEventArgs; + if (args != null) { + Stream(snoopCollector.Data(), args); + return; + } + + View view = e.ObjToSnoop as View; + if (view != null) { + Stream(snoopCollector.Data(), view); + return; + } + + Configuration config = e.ObjToSnoop as Configuration; + if (config != null) { + Stream(snoopCollector.Data(), config); + return; + } + + Device device = e.ObjToSnoop as Device; + if (device != null) { + Stream(snoopCollector.Data(), device); + return; + } + + Model model = e.ObjToSnoop as Model; + if (model != null) { + Stream(snoopCollector.Data(), model); + return; + } + + Node node = e.ObjToSnoop as Node; + if (node != null) { + Stream(snoopCollector.Data(), node); + return; + } + + // ValueTypes we have to treat a bit different + if (e.ObjToSnoop is ClientViewInfo){ + Stream(snoopCollector.Data(), (ClientViewInfo)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is DriverInfo) { + Stream(snoopCollector.Data(), (DriverInfo)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is StereoParameters) { + Stream(snoopCollector.Data(), (StereoParameters)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is ViewportBorderProperties) { + Stream(snoopCollector.Data(), (ViewportBorderProperties)e.ObjToSnoop); + return; + } + } + + private void + Stream (ArrayList data, Manager mgr) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Manager))); + +#if AC2012 + data.Add(new Snoop.Data.ObjectUnknown("Display Size", mgr.DisplaySize)); +#else + data.Add(new Snoop.Data.ObjectUnknown("Display Size", mgr.DeviceIndependentDisplaySize)); +#endif + + KernelDescriptor descriptor = new KernelDescriptor(); + + descriptor.addRequirement(Autodesk.AutoCAD.UniqueString.Intern("3D Drawing")); + + GraphicsKernel kernal = Manager.AcquireGraphicsKernel(descriptor); + + data.Add(new Snoop.Data.Object("Get DB Model", mgr.GetDBModel(kernal))); + data.Add(new Snoop.Data.Object("Get GUI Device", mgr.GetGUIDevice(kernal))); + } + + private void + Stream(ArrayList data, ViewEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ViewEventArgs))); + + data.Add(new Snoop.Data.Object("View", args.View)); + } + + private void + Stream(ArrayList data, View view) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(View))); + + data.Add(new Snoop.Data.Double("Back clip", view.BackClip)); + data.Add(new Snoop.Data.Double("Front clip", view.FrontClip)); + data.Add(new Snoop.Data.ObjectId("Background ID", view.BackgroundId)); + data.Add(new Snoop.Data.Object("Device", view.Device)); + data.Add(new Snoop.Data.Bool("Enable back clip", view.EnableBackClip)); + data.Add(new Snoop.Data.Bool("Enable front clip", view.EnableFrontClip)); + data.Add(new Snoop.Data.Bool("Enable stereo", view.EnableStereo)); + data.Add(new Snoop.Data.Bool("Exceeded bounds", view.ExceededBounds)); + data.Add(new Snoop.Data.Double("Field width", view.FieldWidth)); + data.Add(new Snoop.Data.Double("Field height", view.FieldHeight)); + data.Add(new Snoop.Data.Bool("Is perspective", view.IsPerspective)); + data.Add(new Snoop.Data.Bool("Is valid", view.IsValid)); + data.Add(new Snoop.Data.Bool("Is visible", view.IsVisible)); + //data.Add(new Snoop.Data.String("Mode", view.Mode.ToString())); + data.Add(new Snoop.Data.Object("World to device matrix", view.WorldToDeviceMatrix)); + data.Add(new Snoop.Data.Object("Object to device matrix", view.ObjectToDeviceMatrix)); + data.Add(new Snoop.Data.Object("Projection matrix", view.ProjectionMatrix)); + data.Add(new Snoop.Data.Object("Screen matrix", view.ScreenMatrix)); + data.Add(new Snoop.Data.Object("Viewing matrix", view.ViewingMatrix)); + data.Add(new Snoop.Data.Point3d("Position", view.Position)); + data.Add(new Snoop.Data.Point3d("Target", view.Target)); + data.Add(new Snoop.Data.Vector3d("Up vector", view.UpVector)); + data.Add(new Snoop.Data.Object("Stereo parameters", view.StereoParameters)); +#if AC2012 + data.Add(new Snoop.Data.Object("Viewport Extents", view.ViewportD)); + //data.Add(new Snoop.Data.Object("Viewport D", view.ViewportD)); +#else + data.Add(new Snoop.Data.Object("Viewport Extents", view.ViewportExtents)); +#endif + data.Add(new Snoop.Data.Object("Viewport border properties", view.ViewportBorderProperties)); + data.Add(new Snoop.Data.Bool("Viewport border visibility", view.ViewportBorderVisibility)); + data.Add(new Snoop.Data.Object("Viewport style", view.VisualStyle)); + data.Add(new Snoop.Data.ObjectId("Viewport style ID", view.VisualStyleId)); + } + + private void + Stream (ArrayList data, Configuration config) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Configuration))); + + data.Add(new Snoop.Data.Bool("Adaptive Degradation", config.AdaptiveDegradation)); + //data.Add(new Snoop.Data.Bool("Cache Viewport Draw Geometry", config.CacheViewportDrawGeometry)); // TBD: Fix JMA + data.Add(new Snoop.Data.Object("Current Display Driver", config.CurrentDisplayDriver)); + data.Add(new Snoop.Data.Int("Curve Tessellation Tolerance", config.CurveTessellationTolerance)); + data.Add(new Snoop.Data.Object("Default Hardware Accelerated Driver", config.DefaultHardwareAcceleratedDriver)); + data.Add(new Snoop.Data.Bool("Discard Back Faces", config.DiscardBackFaces)); + data.Add(new Snoop.Data.String("Driver Name", config.DriverName)); + data.Add(new Snoop.Data.Int("Driver Revision", config.DriverRevision)); + data.Add(new Snoop.Data.String("Driver Search Path", config.DriverSearchPath)); + data.Add(new Snoop.Data.Int("Driver Version", config.DriverVersion)); + data.Add(new Snoop.Data.Bool("Dynamic Tessellation", config.DynamicTessellation)); + data.Add(new Snoop.Data.Int("Frame Rate", config.FrameRate)); + data.Add(new Snoop.Data.Object("Handedness", config.Handedness)); + data.Add(new Snoop.Data.Object("Hardware Accelerated Driver", config.HardwareAcceleratedDriver)); + data.Add(new Snoop.Data.Int("Max LODs", config.MaxLODs)); + data.Add(new Snoop.Data.Bool("Redraw On Window Expose", config.RedrawOnWindowExpose)); + data.Add(new Snoop.Data.Int("Surface Tessellation Tolerance", config.SurfaceTessellationTolerance)); + data.Add(new Snoop.Data.Object("Transparency", config.Transparency)); + // data.Add(new Snoop.Data.Bool("Use Display Lists", config.UseDisplayLists)); + //data.Add(new Snoop.Data.Bool("Use Half Pixel Deviation", config.UseHalfPixelDeviation)); // TBD: Fix JMA + + } + + private void + Stream (ArrayList data, Device device) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Device))); + + data.Add(new Snoop.Data.ObjectUnknown("Background Color", device.BackgroundColor)); + data.Add(new Snoop.Data.String("Device Render Type", device.DeviceRenderType.ToString())); + data.Add(new Snoop.Data.Bool("Is Valid", device.IsValid)); + } + + private void + Stream (ArrayList data, Model model) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Model))); + + data.Add(new Snoop.Data.ObjectId("Background Id", model.BackgroundId)); + data.Add(new Snoop.Data.Bool("Enable Sectioning", model.EnableSectioning)); + data.Add(new Snoop.Data.Bool("Linetypes Enabled", model.LinetypesEnabled)); + data.Add(new Snoop.Data.String("Render Type", model.RenderType.ToString())); + data.Add(new Snoop.Data.Double("Shadow Plane Location", model.ShadowPlaneLocation)); + data.Add(new Snoop.Data.Object("Transform", model.Transform)); + data.Add(new Snoop.Data.Object("Visual Style", model.VisualStyle)); + data.Add(new Snoop.Data.ObjectId("Visual Style Id", model.VisualStyleId)); + } + + private void + Stream (ArrayList data, Node node) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Node))); + // no data at this level + } + + private void + Stream (ArrayList data, ClientViewInfo clientViewInfo) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ClientViewInfo))); + + data.Add(new Snoop.Data.Int("Acad Window Id", clientViewInfo.AcadWindowId)); + data.Add(new Snoop.Data.Int("Viewport Id", clientViewInfo.ViewportId)); + data.Add(new Snoop.Data.Int("Viewport Object Id", clientViewInfo.ViewportObjectId)); + } + + private void + Stream (ArrayList data, DriverInfo driverInfo) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DriverInfo))); + + data.Add(new Snoop.Data.String("Driver", driverInfo.Driver)); + data.Add(new Snoop.Data.Bool("Hardware Accelerated", driverInfo.HardwareAccelerated)); + data.Add(new Snoop.Data.String("Path", driverInfo.Path)); + } + + private void + Stream (ArrayList data, StereoParameters stereoParams) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(StereoParameters))); + + data.Add(new Snoop.Data.Double("Magnitude", stereoParams.Magnitude)); + data.Add(new Snoop.Data.Double("Parallax", stereoParams.Parallax)); + } + + private void + Stream (ArrayList data, ViewportBorderProperties vPortBorderProps) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ViewportBorderProperties))); + + data.Add(new Snoop.Data.Object("Color", vPortBorderProps.Color)); + data.Add(new Snoop.Data.Int("Weight", vPortBorderProps.Weight)); + } + } +} diff --git a/MgdDbgLibrary/Snoop/CollectorExts/LayerManager.cs b/MgdDbgLibrary/Snoop/CollectorExts/LayerManager.cs new file mode 100644 index 0000000..8921032 --- /dev/null +++ b/MgdDbgLibrary/Snoop/CollectorExts/LayerManager.cs @@ -0,0 +1,124 @@ +using System.Collections; +using System.Diagnostics; + +using MgdDbg.Snoop.Collectors; + +using Autodesk.AutoCAD.LayerManager; + +namespace MgdDbg.Snoop.CollectorExts { + class LayerManager : CollectorExt { + + public + LayerManager() + { + } + + protected override void + CollectEvent(object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + // see if it is a type we are responsible for + AndExpression andExprn = e.ObjToSnoop as AndExpression; + if (andExprn != null) { + Stream(snoopCollector.Data(), andExprn); + return; + } + + LayerFilter layerFilter = e.ObjToSnoop as LayerFilter; + if (layerFilter != null) { + Stream(snoopCollector.Data(), layerFilter); + return; + } + + RelationalExpression relExprn = e.ObjToSnoop as RelationalExpression; + if (relExprn != null) { + Stream(snoopCollector.Data(), relExprn); + return; + } + + // ValueTypes we have to treat a bit different + if (e.ObjToSnoop is LayerFilterDisplayImages) { + Stream(snoopCollector.Data(), (LayerFilterDisplayImages)e.ObjToSnoop); + return; + } + + if (e.ObjToSnoop is LayerFilterTree) { + Stream(snoopCollector.Data(), (LayerFilterTree)e.ObjToSnoop); + return; + } + } + + private void + Stream(ArrayList data, AndExpression andExprn) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AndExpression))); + + data.Add(new Snoop.Data.Enumerable("Get relational expressions", andExprn.GetRelationalExpressions())); + } + + private void + Stream(ArrayList data, LayerFilter layerFilter) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayerFilter))); + + data.Add(new Snoop.Data.Bool("Allow delete", layerFilter.AllowDelete)); + data.Add(new Snoop.Data.Bool("Allow nested", layerFilter.AllowNested)); + data.Add(new Snoop.Data.Bool("Allow rename", layerFilter.AllowRename)); + data.Add(new Snoop.Data.Object("Display images", layerFilter.DisplayImages)); + data.Add(new Snoop.Data.Bool("Dynamically generated", layerFilter.DynamicallyGenerated)); + data.Add(new Snoop.Data.String("Filter expression", layerFilter.FilterExpression)); + data.Add(new Snoop.Data.Bool("Is Id filter", layerFilter.IsIdFilter)); + data.Add(new Snoop.Data.Bool("Is proxy", layerFilter.IsProxy)); + data.Add(new Snoop.Data.String("Name", layerFilter.Name)); + data.Add(new Snoop.Data.Enumerable("Nested filters", layerFilter.NestedFilters)); + data.Add(new Snoop.Data.Object("Parent", layerFilter.Parent)); + + LayerGroup layerGrp = layerFilter as LayerGroup; + if (layerGrp != null) { + Stream(data, layerGrp); + return; + } + } + + private void + Stream(ArrayList data, LayerGroup layerGrp) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayerGroup))); + + data.Add(new Snoop.Data.Enumerable("Layer Ids", layerGrp.LayerIds)); + } + + private void + Stream(ArrayList data, RelationalExpression relExprn) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RelationalExpression))); + + data.Add(new Snoop.Data.String("Constant", relExprn.Constant)); + data.Add(new Snoop.Data.String("Variable", relExprn.Variable)); + } + + private void + Stream(ArrayList data, LayerFilterDisplayImages layerFilterDispImgs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayerFilterDisplayImages))); + + data.Add(new Snoop.Data.Int("Image index", layerFilterDispImgs.ImageIndex)); + data.Add(new Snoop.Data.Int("Selected image index", layerFilterDispImgs.SelectedImageIndex)); + } + + private void + Stream(ArrayList data, LayerFilterTree layerFilterTree) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayerFilterTree))); + + data.Add(new Snoop.Data.Object("Current", layerFilterTree.Current)); + data.Add(new Snoop.Data.Object("Root", layerFilterTree.Root)); + } + } +} diff --git a/MgdDbgLibrary/Snoop/CollectorExts/Object.cs b/MgdDbgLibrary/Snoop/CollectorExts/Object.cs new file mode 100644 index 0000000..b8af6e1 --- /dev/null +++ b/MgdDbgLibrary/Snoop/CollectorExts/Object.cs @@ -0,0 +1,364 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + + +using System.Diagnostics; +using System.Collections; +using MgdDbg.Snoop.Collectors; + +using AcDb = Autodesk.AutoCAD.DatabaseServices; +using AcAp = Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.Windows; + +namespace MgdDbg.Snoop.CollectorExts { + + /// + /// This is a Snoop Collector Extension object to collect data from RxObject objects. + /// + + public class Object : CollectorExt { + + public + Object() + { + } + + protected override void + CollectEvent(object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + // branch to all types we are concerned with + System.Type type = e.ObjToSnoop as System.Type; + if (type != null) { + Stream(snoopCollector.Data(), type); + return; + } + + System.Version ver = e.ObjToSnoop as System.Version; + if (ver != null) { + Stream(snoopCollector.Data(), ver); + return; + } + + System.Collections.Specialized.StringCollection strCol = e.ObjToSnoop as System.Collections.Specialized.StringCollection; + if (strCol != null) { + Stream(snoopCollector.Data(), strCol); + return; + } + + AcAp.Document doc = e.ObjToSnoop as AcAp.Document; + if (doc != null) { + Stream(snoopCollector.Data(), doc); + return; + } + + AcAp.DocumentCollectionEventArgs docCollectEventArgs = e.ObjToSnoop as AcAp.DocumentCollectionEventArgs; + if (docCollectEventArgs != null) { + Stream(snoopCollector.Data(), docCollectEventArgs); + return; + } + + AcAp.DocumentLockModeWillChangeEventArgs docLockModeEventArgs = e.ObjToSnoop as AcAp.DocumentLockModeWillChangeEventArgs; + if (docLockModeEventArgs != null) { + Stream(snoopCollector.Data(), docLockModeEventArgs); + return; + } + + AcAp.DocumentLockModeChangedEventArgs docLockModeChangedEventArgs = e.ObjToSnoop as AcAp.DocumentLockModeChangedEventArgs; + if (docLockModeChangedEventArgs != null) { + Stream(snoopCollector.Data(), docLockModeChangedEventArgs); + return; + } + + AcAp.DocumentLockModeChangeVetoedEventArgs docLockModeVetoedEventArgs = e.ObjToSnoop as AcAp.DocumentLockModeChangeVetoedEventArgs; + if (docLockModeVetoedEventArgs != null) { + Stream(snoopCollector.Data(), docLockModeVetoedEventArgs); + return; + } + + AcAp.DocumentDestroyedEventArgs docDestroyedEventArgs = e.ObjToSnoop as AcAp.DocumentDestroyedEventArgs; + if (docDestroyedEventArgs != null) { + Stream(snoopCollector.Data(), docDestroyedEventArgs); + return; + } + + AcAp.DocumentCollection docCollection = e.ObjToSnoop as AcAp.DocumentCollection; + if (docCollection != null) { + Stream(snoopCollector.Data(), docCollection); + return; + } + + AcAp.XrefFileLock xrefFileLock = e.ObjToSnoop as AcAp.XrefFileLock; + if (xrefFileLock != null) { + Stream(snoopCollector.Data(), xrefFileLock); + return; + } + + Autodesk.AutoCAD.Windows.Window win = e.ObjToSnoop as Autodesk.AutoCAD.Windows.Window; + if (win != null) { + Stream(snoopCollector.Data(), win); + return; + } + + Autodesk.AutoCAD.Windows.StatusBar statusBar = e.ObjToSnoop as Autodesk.AutoCAD.Windows.StatusBar; + if (statusBar != null) { + Stream(snoopCollector.Data(), statusBar); + return; + } + + Autodesk.AutoCAD.Windows.StatusBarItem statusBarItem = e.ObjToSnoop as Autodesk.AutoCAD.Windows.StatusBarItem; + if (statusBarItem != null) { + Stream(snoopCollector.Data(), statusBarItem); + return; + } + } + + + /// + /// Collect data about a class + /// + + private void + Stream(ArrayList data, System.Type classes) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(System.Type))); + data.Add(new Snoop.Data.Class("Name", classes)); + data.Add(new Snoop.Data.String("NameSpace", classes.Namespace)); + if (classes.BaseType == null) + data.Add(new Snoop.Data.Class("Parent Class", null)); + else + data.Add(new Snoop.Data.Class("Parent Class", classes.BaseType)); + data.Add(new Snoop.Data.String("Assembly Qualified Name", classes.AssemblyQualifiedName)); + data.Add(new Snoop.Data.String("Attributes", classes.Attributes.ToString())); + data.Add(new Snoop.Data.String("GUID", classes.GUID.ToString())); + data.Add(new Snoop.Data.Bool("Is Abstract", classes.IsAbstract)); + data.Add(new Snoop.Data.Bool("Is Array", classes.IsArray)); + data.Add(new Snoop.Data.Bool("Is Primitive", classes.IsPrimitive)); + data.Add(new Snoop.Data.Bool("Is Public", classes.IsPublic)); + data.Add(new Snoop.Data.Bool("Is Sealed", classes.IsSealed)); + } + + private void + Stream(ArrayList data, System.Version ver) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(System.Version))); + + data.Add(new Snoop.Data.Int("Build", ver.Build)); + data.Add(new Snoop.Data.Int("Major", ver.Major)); + data.Add(new Snoop.Data.Int("Minor", ver.Minor)); + data.Add(new Snoop.Data.Int("Revision", ver.Revision)); + data.Add(new Snoop.Data.Int("Major revision", ver.MajorRevision)); + data.Add(new Snoop.Data.Int("Minor revision", ver.MinorRevision)); + data.Add(new Snoop.Data.String("To string", ver.ToString())); + } + + /// + /// Collect data about a document + /// + + private void + Stream(ArrayList data, AcAp.Document doc) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcAp.Document))); + +#if(AC2012) +#else + data.Add(new Snoop.Data.Object("Acad document", doc.GetAcadDocument())); +#endif + data.Add(new Snoop.Data.String("Name", doc.Name)); + data.Add(new Snoop.Data.Database("Database", doc.Database)); + data.Add(new Snoop.Data.String("Command in progress", doc.CommandInProgress)); + data.Add(new Snoop.Data.Bool("Is active", doc.IsActive)); + data.Add(new Snoop.Data.Bool("Is read only", doc.IsReadOnly)); + data.Add(new Snoop.Data.Object("Editor", doc.Editor)); + data.Add(new Snoop.Data.Object("Graphics manager", doc.GraphicsManager)); +#if(AC2012) +#else + data.Add(new Snoop.Data.Object("Status bar", doc.GetStatusBar())); +#endif + data.Add(new Snoop.Data.Object("Transaction manager", doc.TransactionManager)); + data.Add(new Snoop.Data.ObjectCollection("User data", doc.UserData)); + data.Add(new Snoop.Data.Object("Window", doc.Window)); + } + + private void + Stream(ArrayList data, AcAp.DocumentCollectionEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcAp.DocumentCollectionEventArgs))); + + data.Add(new Snoop.Data.Object("Document", args.Document)); + } + + private void + Stream(ArrayList data, AcAp.DocumentLockModeWillChangeEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcAp.DocumentLockModeWillChangeEventArgs))); + + data.Add(new Snoop.Data.Object("Document", args.Document)); + data.Add(new Snoop.Data.String("Global command name", args.GlobalCommandName)); + data.Add(new Snoop.Data.String("Current mode", args.CurrentMode.ToString())); + data.Add(new Snoop.Data.String("My current mode", args.MyCurrentMode.ToString())); + data.Add(new Snoop.Data.String("My new mode", args.MyNewMode.ToString())); + } + + private void + Stream(ArrayList data, AcAp.DocumentLockModeChangedEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcAp.DocumentLockModeChangedEventArgs))); + + data.Add(new Snoop.Data.Object("Document", args.Document)); + data.Add(new Snoop.Data.String("Global command name", args.GlobalCommandName)); + data.Add(new Snoop.Data.String("Current mode", args.CurrentMode.ToString())); + data.Add(new Snoop.Data.String("My current mode", args.MyCurrentMode.ToString())); + data.Add(new Snoop.Data.String("My previous mode", args.MyPreviousMode.ToString())); + } + + private void + Stream(ArrayList data, AcAp.DocumentLockModeChangeVetoedEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcAp.DocumentLockModeChangeVetoedEventArgs))); + + data.Add(new Snoop.Data.Object("Document", args.Document)); + data.Add(new Snoop.Data.String("Global command name", args.GlobalCommandName)); + } + + private void + Stream(ArrayList data, AcAp.DocumentDestroyedEventArgs args) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcAp.DocumentDestroyedEventArgs))); + + data.Add(new Snoop.Data.String("File name", args.FileName)); + } + + private void + Stream(ArrayList data, AcAp.DocumentCollection docCol) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcAp.DocumentCollection))); + + data.Add(new Snoop.Data.Bool("Document activation enabled", docCol.DocumentActivationEnabled)); + data.Add(new Snoop.Data.Bool("Is application context", docCol.IsApplicationContext)); + data.Add(new Snoop.Data.Int("Count", docCol.Count)); + data.Add(new Snoop.Data.Object("MDI active document", docCol.MdiActiveDocument)); + data.Add(new Snoop.Data.Enumerable("Documents", docCol)); + } + + private void + Stream(ArrayList data, AcAp.XrefFileLock xrefFileLock) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcAp.XrefFileLock))); + + data.Add(new Snoop.Data.ObjectIdCollection("Out of sync block Ids", xrefFileLock.OutOfSyncBlockIds)); + data.Add(new Snoop.Data.Int("Xload CtlType", xrefFileLock.XloadCtlType)); + } + + private void + Stream(ArrayList data, Autodesk.AutoCAD.Windows.Window win) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.Windows.Window))); + + data.Add(new Snoop.Data.Object("Handle", win.Handle)); +#if(AC2012) +#else + data.Add(new Snoop.Data.Icon("Icon", win.GetIcon())); + data.Add(new Snoop.Data.Object("Location", win.GetLocation())); + data.Add(new Snoop.Data.Object("Size", win.GetSize())); +#endif + data.Add(new Snoop.Data.String("Text", win.Text)); + data.Add(new Snoop.Data.Bool("Visible", win.Visible)); + data.Add(new Snoop.Data.String("Window state", win.WindowState.ToString())); + } + + private void + Stream(ArrayList data, Autodesk.AutoCAD.Windows.StatusBar statusBar) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.Windows.StatusBar))); + + data.Add(new Snoop.Data.Enumerable("Panes", statusBar.Panes)); + data.Add(new Snoop.Data.Enumerable("Tray items", statusBar.TrayItems)); + } + + private void + Stream(ArrayList data, Autodesk.AutoCAD.Windows.StatusBarItem statusBarItem) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.Windows.StatusBarItem))); + + data.Add(new Snoop.Data.Bool("Enabled", statusBarItem.Enabled)); + data.Add(new Snoop.Data.Icon("Icon", statusBarItem.Icon)); + data.Add(new Snoop.Data.String("Tool tip text", statusBarItem.ToolTipText)); + data.Add(new Snoop.Data.Bool("Visible", statusBarItem.Visible)); + + Autodesk.AutoCAD.Windows.Pane pane = statusBarItem as Autodesk.AutoCAD.Windows.Pane; + if (pane != null) { + Stream(data, pane); + return; + } + + Autodesk.AutoCAD.Windows.TrayItem trayItem = statusBarItem as Autodesk.AutoCAD.Windows.TrayItem; + if (trayItem != null) { + Stream(data, trayItem); + return; + } + } + + private void + Stream(ArrayList data, Autodesk.AutoCAD.Windows.Pane pane) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.Windows.Pane))); + + data.Add(new Snoop.Data.String("Text", pane.Text)); + data.Add(new Snoop.Data.String("Style", pane.Style.ToString())); + data.Add(new Snoop.Data.Int("Maximum width", pane.MaximumWidth)); + data.Add(new Snoop.Data.Int("Minimum width", pane.MinimumWidth)); + } + + private void + Stream(ArrayList data, Autodesk.AutoCAD.Windows.TrayItem pane) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.Windows.TrayItem))); + + // no data at this level + } + + private void + Stream(ArrayList data, System.Collections.Specialized.StringCollection strCol) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(System.Collections.Specialized.StringCollection))); + + data.Add(new Snoop.Data.Bool("Is read-only", strCol.IsReadOnly)); + + data.Add(new Snoop.Data.CategorySeparator("Strings")); + for (int i=0; i + /// This is a Snoop Collector Extension object to collect data from RxObject objects. + /// + + public class RxObject : CollectorExt { + + public + RxObject() + { + } + + protected override void + CollectEvent(object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + Autodesk.AutoCAD.Runtime.RXObject rxObj = e.ObjToSnoop as Autodesk.AutoCAD.Runtime.RXObject; + if (rxObj != null) { + Stream(snoopCollector.Data(), rxObj); + return; + } + } + + // main branch for anything derived from RXObject (AcRxObject) + private void + Stream(ArrayList data, Autodesk.AutoCAD.Runtime.RXObject rxObj) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.Runtime.RXObject))); + + data.Add(new Snoop.Data.Class("Class", rxObj.GetType())); + data.Add(new Snoop.Data.String("Rx class name", MgdDbg.Utils.AcadUi.ObjToRxClassStr(rxObj))); + + // branch to all types we are concerned with + AcDb.Database db = rxObj as AcDb.Database; + if (db != null) { + Stream(data, db); + return; + } + + AcDb.HostApplicationServices hAppSrvs = rxObj as AcDb.HostApplicationServices; + if (hAppSrvs != null) { + Stream(data, hAppSrvs); + return; + } + + AcRx.DynamicLinker dLinker = rxObj as AcRx.DynamicLinker; + if (dLinker != null) { + Stream(data, dLinker); + return; + } + + AcRx.Dictionary dict = rxObj as AcRx.Dictionary; + if (dict != null) { + Stream(data, dict); + return; + } + + AcRx.RXClass rxClass = rxObj as AcRx.RXClass; + if (rxClass != null) { + Stream(data, rxClass); + return; + } + } + + + private void + Stream(ArrayList data, Autodesk.AutoCAD.DatabaseServices.Database db) + { + // Symbol Tables + data.Add(new Snoop.Data.CategorySeparator("Symbol Tables")); + data.Add(new Snoop.Data.ObjectId("Block table ID", db.BlockTableId)); + data.Add(new Snoop.Data.ObjectId("DimStyleTableId", db.DimStyleTableId)); + data.Add(new Snoop.Data.ObjectId("Layer table ID", db.LayerTableId)); + data.Add(new Snoop.Data.ObjectId("Linetype table ID", db.LinetypeTableId)); + data.Add(new Snoop.Data.ObjectId("RegApp table ID", db.RegAppTableId)); + data.Add(new Snoop.Data.ObjectId("Text style", db.Textstyle)); + data.Add(new Snoop.Data.ObjectId("Text style table ID", db.TextStyleTableId)); + data.Add(new Snoop.Data.ObjectId("UCS table ID", db.UcsTableId)); + data.Add(new Snoop.Data.ObjectId("Viewport table ID", db.ViewportTableId)); + data.Add(new Snoop.Data.ObjectId("View table ID", db.ViewTableId)); + + // Dictionaries + data.Add(new Snoop.Data.CategorySeparator("Dictionaries")); + data.Add(new Snoop.Data.ObjectId("Color dictionary ID", db.ColorDictionaryId)); + data.Add(new Snoop.Data.ObjectId("Data link dictionary ID", db.DataLinkDictionaryId)); + data.Add(new Snoop.Data.ObjectId("Group dictionary ID", db.GroupDictionaryId)); + data.Add(new Snoop.Data.ObjectId("Layout dictionary ID", db.LayoutDictionaryId)); + data.Add(new Snoop.Data.ObjectId("Material dictionary ID", db.MaterialDictionaryId)); + data.Add(new Snoop.Data.ObjectId("MLine style dictionary ID", db.MLStyleDictionaryId)); + data.Add(new Snoop.Data.ObjectId("Named objects dictionary ID", db.NamedObjectsDictionaryId)); + data.Add(new Snoop.Data.ObjectId("Plot settings dictionary ID", db.PlotSettingsDictionaryId)); + data.Add(new Snoop.Data.ObjectId("Plot style name dictionary ID", db.PlotStyleNameDictionaryId)); + data.Add(new Snoop.Data.ObjectId("Table style dictionary ID", db.TableStyleDictionaryId)); + + // Current settings + data.Add(new Snoop.Data.CategorySeparator("Default SymbolRecs and DictionaryRecs")); + data.Add(new Snoop.Data.ObjectId("Layer zero", db.LayerZero)); + data.Add(new Snoop.Data.ObjectId("ByBlock Linetype ID", db.ByBlockLinetype)); + data.Add(new Snoop.Data.ObjectId("ByLayer Linetype ID", db.ByLayerLinetype)); + data.Add(new Snoop.Data.ObjectId("Continuous linetype", db.ContinuousLinetype)); + data.Add(new Snoop.Data.ObjectId("Current space ID", db.CurrentSpaceId)); + data.Add(new Snoop.Data.ObjectId("Current viewport table record ID", db.CurrentViewportTableRecordId)); + data.Add(new Snoop.Data.ObjectId("Paperspace vport ID", db.PaperSpaceVportId)); + data.Add(new Snoop.Data.ObjectId("Dimstyle", db.Dimstyle)); + data.Add(new Snoop.Data.ObjectId("Table style", db.Tablestyle)); + data.Add(new Snoop.Data.String("Plot style name ID", db.PlotStyleNameId.ToString())); + data.Add(new Snoop.Data.ObjectId("Section manager ID", db.SectionManagerId)); + + // File information + data.Add(new Snoop.Data.CategorySeparator("File Information")); + data.Add(new Snoop.Data.Bitmap("Thumbnail", db.ThumbnailBitmap)); + data.Add(new Snoop.Data.Int("Update thumbnail", db.UpdateThumbnail)); + data.Add(new Snoop.Data.String("Filename", db.Filename)); + data.Add(new Snoop.Data.String("Fingerprint GUID", db.FingerprintGuid)); + data.Add(new Snoop.Data.String("Project name", db.ProjectName)); + data.Add(new Snoop.Data.String("Menu", db.Menu)); + data.Add(new Snoop.Data.Int("Approx. number of objects", db.ApproxNumObjects)); + data.Add(new Snoop.Data.Bool("Is partially opened", db.IsPartiallyOpened)); + data.Add(new Snoop.Data.Int("Number of saves", db.NumberOfSaves)); + data.Add(new Snoop.Data.Bool("Drawing file saved by Autodesk software", db.DwgFileWasSavedByAutodeskSoftware)); + data.Add(new Snoop.Data.String("Version GUID", db.VersionGuid)); + data.Add(new Snoop.Data.Object("Summary info", db.SummaryInfo)); + data.Add(new Snoop.Data.String("Last saved as maintenance version", db.LastSavedAsMaintenanceVersion.ToString())); + data.Add(new Snoop.Data.String("Last saved as version", db.LastSavedAsVersion.ToString())); + data.Add(new Snoop.Data.Int("Maintenance release version", db.MaintenanceReleaseVersion)); + data.Add(new Snoop.Data.String("Original file Name", db.OriginalFileName)); + data.Add(new Snoop.Data.String("Original file version", db.OriginalFileVersion.ToString())); + data.Add(new Snoop.Data.String("Original file maintenance version", db.OriginalFileMaintenanceVersion.ToString())); + data.Add(new Snoop.Data.String("Original file saved by version", db.OriginalFileSavedByVersion.ToString())); + data.Add(new Snoop.Data.String("Original file saved by maintenance version", db.OriginalFileSavedByMaintenanceVersion.ToString())); + data.Add(new Snoop.Data.Bool("Retain original thumbnail bitmap", db.RetainOriginalThumbnailBitmap)); + data.Add(new Snoop.Data.Int("Save proxy graphics", db.Saveproxygraphics)); + + data.Add(new Snoop.Data.ObjectIdCollection("Dim recent style list", db.GetDimRecentStyleList())); + + // System variables + data.Add(new Snoop.Data.CategorySeparator("System Variables")); + data.Add(new Snoop.Data.Bool("Allow extended names", db.AllowExtendedNames)); + data.Add(new Snoop.Data.Angle("Angbase", db.Angbase)); + data.Add(new Snoop.Data.Bool("Angdir", db.Angdir)); + data.Add(new Snoop.Data.Bool("AnnoAllVisible", db.AnnoAllVisible)); + data.Add(new Snoop.Data.Bool("AnnotativeDwg", db.AnnotativeDwg)); + data.Add(new Snoop.Data.Int("Attmode", db.Attmode)); + data.Add(new Snoop.Data.Int("Aunits", db.Aunits)); + data.Add(new Snoop.Data.Int("Auprec", db.Auprec)); + data.Add(new Snoop.Data.Bool("Camera display", db.CameraDisplay)); + data.Add(new Snoop.Data.Distance("Camera height", db.CameraHeight)); + data.Add(new Snoop.Data.Object("Cannoscale", db.Cannoscale)); + data.Add(new Snoop.Data.ObjectToString("Cecolor", db.Cecolor)); + data.Add(new Snoop.Data.Distance("Celtscale", db.Celtscale)); + data.Add(new Snoop.Data.ObjectId("Celtype", db.Celtype)); + data.Add(new Snoop.Data.String("Celweight", db.Celweight.ToString())); + data.Add(new Snoop.Data.Object("Cetransparency", db.Cetransparency)); + data.Add(new Snoop.Data.Distance("Chamfera", db.Chamfera)); + data.Add(new Snoop.Data.Distance("Chamferb", db.Chamferb)); + data.Add(new Snoop.Data.Distance("Chamferc", db.Chamferc)); + data.Add(new Snoop.Data.Distance("Chamferd", db.Chamferd)); + data.Add(new Snoop.Data.ObjectId("Celayer", db.Clayer)); + data.Add(new Snoop.Data.ObjectId("Cmaterial", db.Cmaterial)); + data.Add(new Snoop.Data.Int("Cmljust", db.Cmljust)); + data.Add(new Snoop.Data.Distance("Cmlscale", db.Cmlscale)); + data.Add(new Snoop.Data.ObjectId("CmlstyleID", db.CmlstyleID)); + data.Add(new Snoop.Data.Int("Cshadow", db.Cshadow)); + data.Add(new Snoop.Data.Object("Data link manager", db.DataLinkManager)); + data.Add(new Snoop.Data.Int("DgnFrame", db.DgnFrame)); + data.Add(new Snoop.Data.Int("Dimadec", db.Dimadec)); + data.Add(new Snoop.Data.Bool("Dimalt", db.Dimalt)); + data.Add(new Snoop.Data.Int("Dimaltd", db.Dimaltd)); + data.Add(new Snoop.Data.Distance("Dimaltf", db.Dimaltf)); + data.Add(new Snoop.Data.Distance("Dimaltrnd", db.Dimaltrnd)); + data.Add(new Snoop.Data.Int("Dimalttd", db.Dimalttd)); + data.Add(new Snoop.Data.Int("Dimalttz", db.Dimalttz)); + data.Add(new Snoop.Data.Int("Dimaltu", db.Dimaltu)); + data.Add(new Snoop.Data.Int("Dimaltz", db.Dimaltz)); + data.Add(new Snoop.Data.String("Dimapost", db.Dimapost)); + data.Add(new Snoop.Data.Int("Dimarcsym", db.Dimarcsym)); + data.Add(new Snoop.Data.Bool("Dimaso", db.Dimaso)); + data.Add(new Snoop.Data.Int("Dimassoc", db.DimAssoc)); + data.Add(new Snoop.Data.Distance("Dimasz", db.Dimasz)); + data.Add(new Snoop.Data.Int("Dimatfit", db.Dimatfit)); + data.Add(new Snoop.Data.Int("Dimaunit", db.Dimaunit)); + data.Add(new Snoop.Data.Int("Dimazin", db.Dimazin)); + data.Add(new Snoop.Data.ObjectId("Dimblk", db.Dimblk)); + data.Add(new Snoop.Data.ObjectId("Dimblk1", db.Dimblk1)); + data.Add(new Snoop.Data.ObjectId("Dimblk2", db.Dimblk2)); + data.Add(new Snoop.Data.ObjectId("Dimldrblk", db.Dimldrblk)); + data.Add(new Snoop.Data.Distance("Dimcen", db.Dimcen)); + data.Add(new Snoop.Data.Object("Dimclrd", db.Dimclrd)); + data.Add(new Snoop.Data.Object("Dimclre", db.Dimclre)); + data.Add(new Snoop.Data.Object("Dimclrt", db.Dimclrt)); + data.Add(new Snoop.Data.Int("Dimdec", db.Dimdec)); + data.Add(new Snoop.Data.Distance("Dimdle", db.Dimdle)); + data.Add(new Snoop.Data.Distance("Dimdli", db.Dimdli)); + data.Add(new Snoop.Data.String("Dimdsep", db.Dimdsep.ToString())); + data.Add(new Snoop.Data.Distance("Dimexe", db.Dimexe)); + data.Add(new Snoop.Data.Distance("Dimexo", db.Dimexo)); + data.Add(new Snoop.Data.Int("Dimfrac", db.Dimfrac)); + data.Add(new Snoop.Data.Distance("Dimfxlen", db.Dimfxlen)); + data.Add(new Snoop.Data.Bool("Dimfxlenon", db.DimfxlenOn)); + data.Add(new Snoop.Data.Distance("Dimgap", db.Dimgap)); + data.Add(new Snoop.Data.Angle("Dimjogang", db.Dimjogang)); + data.Add(new Snoop.Data.Int("Dimjust", db.Dimjust)); + data.Add(new Snoop.Data.Distance("Dimlfac", db.Dimlfac)); + data.Add(new Snoop.Data.Bool("Dimlim", db.Dimlim)); + data.Add(new Snoop.Data.ObjectId("Dimltex1", db.Dimltex1)); + data.Add(new Snoop.Data.ObjectId("Dimltex2", db.Dimltex2)); + data.Add(new Snoop.Data.ObjectId("Dimltype", db.Dimltype)); + data.Add(new Snoop.Data.Int("Dimlunit", db.Dimlunit)); + data.Add(new Snoop.Data.String("Dimlwd", db.Dimlwd.ToString())); + data.Add(new Snoop.Data.String("Dimlwe", db.Dimlwe.ToString())); + data.Add(new Snoop.Data.String("Dimpost", db.Dimpost)); + data.Add(new Snoop.Data.Distance("Dimrnd", db.Dimrnd)); + data.Add(new Snoop.Data.Bool("Dimsah", db.Dimsah)); + data.Add(new Snoop.Data.Distance("Dimscale", db.Dimscale)); + data.Add(new Snoop.Data.Bool("Dimsd1", db.Dimsd1)); + data.Add(new Snoop.Data.Bool("Dimsd2", db.Dimsd2)); + data.Add(new Snoop.Data.Bool("Dimse1", db.Dimse1)); + data.Add(new Snoop.Data.Bool("Dimse2", db.Dimse2)); + data.Add(new Snoop.Data.Bool("Dimsoxd", db.Dimsoxd)); + data.Add(new Snoop.Data.ObjectId("Dimstyle", db.Dimstyle)); + data.Add(new Snoop.Data.Int("Dimtad", db.Dimtad)); + data.Add(new Snoop.Data.Int("Dimtdec", db.Dimtdec)); + data.Add(new Snoop.Data.Distance("Dimtfac", db.Dimtfac)); + data.Add(new Snoop.Data.Int("Dimtfill", db.Dimtfill)); + data.Add(new Snoop.Data.Object("Dimtfillclr", db.Dimtfillclr)); + data.Add(new Snoop.Data.Bool("Dimtih", db.Dimtih)); + data.Add(new Snoop.Data.Bool("Dimtix", db.Dimtix)); + data.Add(new Snoop.Data.Distance("Dimtm", db.Dimtm)); + data.Add(new Snoop.Data.Int("Dimtmove", db.Dimtmove)); + data.Add(new Snoop.Data.Bool("Dimtofl", db.Dimtofl)); + data.Add(new Snoop.Data.Bool("Dimtoh", db.Dimtoh)); + data.Add(new Snoop.Data.Bool("Dimtol", db.Dimtol)); + data.Add(new Snoop.Data.Int("Dimtolj", db.Dimtolj)); + data.Add(new Snoop.Data.Distance("Dimtp", db.Dimtp)); + data.Add(new Snoop.Data.Distance("Dimtsz", db.Dimtsz)); + data.Add(new Snoop.Data.Distance("Dimtvp", db.Dimtvp)); + data.Add(new Snoop.Data.ObjectId("Dimtxsty", db.Dimtxsty)); + data.Add(new Snoop.Data.Distance("Dimtxt", db.Dimtxt)); + data.Add(new Snoop.Data.Int("Dimtzin", db.Dimtzin)); + data.Add(new Snoop.Data.Bool("Dimupt", db.Dimupt)); + data.Add(new Snoop.Data.Int("Dimzin", db.Dimzin)); + data.Add(new Snoop.Data.Bool("DispSilh", db.DispSilh)); + data.Add(new Snoop.Data.ObjectId("Dragvs", db.dragvs)); + data.Add(new Snoop.Data.String("Draw order control", db.DrawOrderCtl.ToString())); + data.Add(new Snoop.Data.Int("Dwf frame", db.DwfFrame)); + data.Add(new Snoop.Data.Int("Dx eval", db.DxEval)); + data.Add(new Snoop.Data.Distance("Elevation", db.Elevation)); + data.Add(new Snoop.Data.String("End caps", db.EndCaps.ToString())); + data.Add(new Snoop.Data.Point3d("Extmax", db.Extmax)); + data.Add(new Snoop.Data.Point3d("Extmin", db.Extmin)); + data.Add(new Snoop.Data.Double("Facetres", db.Facetres)); + data.Add(new Snoop.Data.Distance("Filletrad", db.Filletrad)); + data.Add(new Snoop.Data.Bool("Fillmode", db.Fillmode)); + + try { + data.Add(new Snoop.Data.ObjectId("Geo data object", db.GeoDataObject)); // Fails when null instead of just returning null ObjectID + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + data.Add(new Snoop.Data.Exception("Geo data object", e)); // returns eKeyNotFound + } + + data.Add(new Snoop.Data.Int("Halo gap", db.HaloGap)); + data.Add(new Snoop.Data.String("Handseed", db.Handseed.ToString())); + data.Add(new Snoop.Data.Int("Hide text", db.HideText)); + + try { + data.Add(new Snoop.Data.Object("Home view", db.HomeView)); // Fails when null instead of just returning null + } + catch (Autodesk.AutoCAD.Runtime.Exception e) { + data.Add(new Snoop.Data.Exception("Home view", e)); // return eKeyNotFound + } + + data.Add(new Snoop.Data.Bool("Hp inherit", db.HpInherit)); + data.Add(new Snoop.Data.Point2d("Hp origin", db.HpOrigin)); + data.Add(new Snoop.Data.String("Hyperlink base", db.HyperlinkBase)); + data.Add(new Snoop.Data.Int("Indexctl", db.Indexctl)); + data.Add(new Snoop.Data.Point3d("Insbase", db.Insbase)); + data.Add(new Snoop.Data.String("Insunits", db.Insunits.ToString())); + data.Add(new Snoop.Data.Object("Interfere color", db.Interferecolor)); + data.Add(new Snoop.Data.ObjectId("Interfereobjvs", db.Interfereobjvs)); + data.Add(new Snoop.Data.ObjectId("Interferevpvs", db.Interferevpvs)); + data.Add(new Snoop.Data.Int("Intersect color", db.IntersectColor)); + data.Add(new Snoop.Data.Int("Intersect display", db.IntersectDisplay)); + // data.Add(new Snoop.Data.Bool("IsEmr", db.IsEmr)); + data.Add(new Snoop.Data.Int("Isolines", db.Isolines)); + data.Add(new Snoop.Data.String("Join style", db.JoinStyle.ToString())); + data.Add(new Snoop.Data.Double("Latitude", db.Latitude)); + data.Add(new Snoop.Data.Int("Layer eval", db.LayerEval)); + data.Add(new Snoop.Data.Object("Layer filters", db.LayerFilters)); + data.Add(new Snoop.Data.Int("Layer notify", db.LayerNotify)); + data.Add(new Snoop.Data.Object("Layer state manager", db.LayerStateManager)); + data.Add(new Snoop.Data.Double("Lens length", db.LensLength)); + data.Add(new Snoop.Data.Int("Light glyph display", db.LightGlyphDisplay)); + data.Add(new Snoop.Data.String("Lighting units", db.LightingUnits.ToString())); + data.Add(new Snoop.Data.Bool("Lights in blocks", db.LightsInBlocks)); + data.Add(new Snoop.Data.Bool("Limcheck", db.Limcheck)); + data.Add(new Snoop.Data.Point2d("Limmax", db.Limmax)); + data.Add(new Snoop.Data.Point2d("Limmin", db.Limmin)); + data.Add(new Snoop.Data.Bool("Lineweight display", db.LineWeightDisplay)); + data.Add(new Snoop.Data.Angle("Loft ang 1", db.LoftAng1)); + data.Add(new Snoop.Data.Angle("Loft ang 2", db.LoftAng2)); + data.Add(new Snoop.Data.Double("Loft mag 1", db.LoftMag1)); + data.Add(new Snoop.Data.Double("Loft mag 2", db.LoftMag2)); + data.Add(new Snoop.Data.Int("Loft normals", db.LoftNormals)); + data.Add(new Snoop.Data.Int("Loft param", db.LoftParam)); + data.Add(new Snoop.Data.Double("Longitude", db.Longitude)); + data.Add(new Snoop.Data.Distance("Ltscale", db.Ltscale)); + data.Add(new Snoop.Data.Int("Lunits", db.Lunits)); + data.Add(new Snoop.Data.Int("Luprec", db.Luprec)); + data.Add(new Snoop.Data.Int("Maxactvp", db.Maxactvp)); + data.Add(new Snoop.Data.String("Measurement", db.Measurement.ToString())); + data.Add(new Snoop.Data.Bool("Mirrtext", db.Mirrtext)); + data.Add(new Snoop.Data.Bool("MsLt scale", db.MsLtScale)); + data.Add(new Snoop.Data.Double("MsOleScale", db.MsOleScale)); + data.Add(new Snoop.Data.Double("North direction", db.NorthDirection)); + data.Add(new Snoop.Data.Object("Object context manager", db.ObjectContextManager)); + data.Add(new Snoop.Data.Int("Obscured color", db.ObscuredColor)); + data.Add(new Snoop.Data.Int("Obscured linetype", db.ObscuredLineType)); + data.Add(new Snoop.Data.Bool("OleStartUp", db.OleStartUp)); + data.Add(new Snoop.Data.Bool("Orthomode", db.Orthomode)); + data.Add(new Snoop.Data.Int("Pdf frame", db.PdfFrame)); + data.Add(new Snoop.Data.Int("Pdmode", db.Pdmode)); + data.Add(new Snoop.Data.Distance("Pdsize", db.Pdsize)); + data.Add(new Snoop.Data.Distance("Pelevation", db.Pelevation)); + data.Add(new Snoop.Data.Point3d("Pextmax", db.Pextmax)); + data.Add(new Snoop.Data.Point3d("Pextmin", db.Pextmin)); + data.Add(new Snoop.Data.Point3d("Pinsbase", db.Pinsbase)); + data.Add(new Snoop.Data.Bool("Plimcheck", db.Plimcheck)); + data.Add(new Snoop.Data.Point2d("Plimmax", db.Plimmax)); + data.Add(new Snoop.Data.Point2d("Plimmin", db.Plimmin)); + data.Add(new Snoop.Data.Bool("PlineEllipse", db.PlineEllipse)); + data.Add(new Snoop.Data.Bool("Plinegen", db.Plinegen)); + data.Add(new Snoop.Data.Distance("Plinewid", db.Plinewid)); + data.Add(new Snoop.Data.Bool("Plot style mode", db.PlotStyleMode)); + data.Add(new Snoop.Data.Bool("Psltscale", db.Psltscale)); + data.Add(new Snoop.Data.Distance("Psol height", db.PsolHeight)); + data.Add(new Snoop.Data.Distance("Psol width", db.PsolWidth)); + data.Add(new Snoop.Data.ObjectId("PucsBase", db.PucsBase)); + data.Add(new Snoop.Data.ObjectId("Pucsname", db.Pucsname)); + data.Add(new Snoop.Data.Point3d("Pucsorg", db.Pucsorg)); + data.Add(new Snoop.Data.String("PucsOrthographic", db.PucsOrthographic.ToString())); + data.Add(new Snoop.Data.Vector3d("Pucsxdir", db.Pucsxdir)); + data.Add(new Snoop.Data.Vector3d("Pucsydir", db.Pucsydir)); + data.Add(new Snoop.Data.Bool("Qtextmode", db.Qtextmode)); + data.Add(new Snoop.Data.Bool("Regenmode", db.Regenmode)); + data.Add(new Snoop.Data.Object("Security parameters", db.SecurityParameters)); + data.Add(new Snoop.Data.Int("Shadedge", db.Shadedge)); + data.Add(new Snoop.Data.Int("Shadedif", db.Shadedif)); + data.Add(new Snoop.Data.Distance("Shadow plane location", db.ShadowPlaneLocation)); + data.Add(new Snoop.Data.Int("Show hist", db.ShowHist)); + data.Add(new Snoop.Data.Distance("Sketchinc", db.Sketchinc)); + data.Add(new Snoop.Data.Bool("Skpoly", db.Skpoly)); + data.Add(new Snoop.Data.Int("Sortents", db.SortEnts)); + data.Add(new Snoop.Data.Int("Solid hist", db.SolidHist)); + data.Add(new Snoop.Data.Bool("Splframe", db.Splframe)); + data.Add(new Snoop.Data.Int("Splinesegs", db.Splinesegs)); + data.Add(new Snoop.Data.Int("Splinetype", db.Splinetype)); + data.Add(new Snoop.Data.Distance("Step size", db.StepSize)); + data.Add(new Snoop.Data.Double("Step per sec", db.StepsPerSec)); + data.Add(new Snoop.Data.String("Style sheet", db.StyleSheet)); + data.Add(new Snoop.Data.Int("Surftab1", db.Surftab1)); + data.Add(new Snoop.Data.Int("Surftab2", db.Surftab2)); + data.Add(new Snoop.Data.Int("Surftype", db.Surftype)); + data.Add(new Snoop.Data.Int("Surfu", db.Surfu)); + data.Add(new Snoop.Data.Int("Surfv", db.Surfv)); + data.Add(new Snoop.Data.String("Tdcreate", db.Tdcreate.ToString())); + data.Add(new Snoop.Data.String("Tdindwg", db.Tdindwg.ToString())); + data.Add(new Snoop.Data.String("Tducreate", db.Tducreate.ToString())); + data.Add(new Snoop.Data.String("Tdupdate", db.Tdupdate.ToString())); + data.Add(new Snoop.Data.String("Tdusrtimer", db.Tdusrtimer.ToString())); + data.Add(new Snoop.Data.String("Tduupdate", db.Tduupdate.ToString())); + data.Add(new Snoop.Data.Distance("Textsize", db.Textsize)); + data.Add(new Snoop.Data.Distance("Thickness", db.Thickness)); + data.Add(new Snoop.Data.Bool("Tilemode", db.TileMode)); + data.Add(new Snoop.Data.Int("Tilemode light synch", db.TileModeLightSynch)); + data.Add(new Snoop.Data.String("Time zone", db.TimeZone.ToString())); + data.Add(new Snoop.Data.Distance("Tracewid", db.Tracewid)); + data.Add(new Snoop.Data.Int("Treedepth", db.Treedepth)); + data.Add(new Snoop.Data.Int("TStackAlign", db.TStackAlign)); + data.Add(new Snoop.Data.Int("TStackSize", db.TstackSize)); + data.Add(new Snoop.Data.ObjectId("UcsBase", db.UcsBase)); + data.Add(new Snoop.Data.ObjectId("Ucsname", db.Ucsname)); + data.Add(new Snoop.Data.Point3d("Ucsorg", db.Ucsorg)); + data.Add(new Snoop.Data.String("UcsOrthographic", db.UcsOrthographic.ToString())); + data.Add(new Snoop.Data.Vector3d("Ucsxdir", db.Ucsxdir)); + data.Add(new Snoop.Data.Vector3d("Ucsydir", db.Ucsydir)); + data.Add(new Snoop.Data.Bool("Undo recoding", db.UndoRecording)); + data.Add(new Snoop.Data.Int("Unitmode", db.Unitmode)); + data.Add(new Snoop.Data.Int("Useri1", db.Useri1)); + data.Add(new Snoop.Data.Int("Useri2", db.Useri2)); + data.Add(new Snoop.Data.Int("Useri3", db.Useri3)); + data.Add(new Snoop.Data.Int("Useri4", db.Useri4)); + data.Add(new Snoop.Data.Int("Useri5", db.Useri5)); + data.Add(new Snoop.Data.Double("Userr1", db.Userr1)); + data.Add(new Snoop.Data.Double("Userr2", db.Userr2)); + data.Add(new Snoop.Data.Double("Userr3", db.Userr3)); + data.Add(new Snoop.Data.Double("Userr4", db.Userr4)); + data.Add(new Snoop.Data.Double("Userr5", db.Userr5)); + data.Add(new Snoop.Data.Bool("Usrtimer", db.Usrtimer)); + data.Add(new Snoop.Data.Distance("Viewport scale default", db.ViewportScaleDefault)); + data.Add(new Snoop.Data.Bool("Visretain", db.Visretain)); + data.Add(new Snoop.Data.Bool("Worldview", db.Worldview)); + data.Add(new Snoop.Data.Int("Xclip frame", db.XclipFrame)); + data.Add(new Snoop.Data.ObjectId("Xref block ID", db.XrefBlockId)); + data.Add(new Snoop.Data.Bool("Xref edit enabled", db.XrefEditEnabled)); + // TBD: GetHostDwgXrefGraph() + + data.Add(new Snoop.Data.ObjectIdCollection("Viewports (includePspace = true)", db.GetViewports(true))); + data.Add(new Snoop.Data.ObjectIdCollection("Viewports (includePspace = false)", db.GetViewports(false))); + // TBD: GetVisualStyleList(); + } + + /// + /// Collect data about host app services + /// + + private void + Stream(ArrayList data, AcDb.HostApplicationServices hAppSrvs) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcDb.HostApplicationServices))); + + data.Add(new Snoop.Data.String("Alternate font name", hAppSrvs.AlternateFontName)); + data.Add(new Snoop.Data.String("Font map file name", hAppSrvs.FontMapFileName)); + data.Add(new Snoop.Data.String("Roamable root folder", hAppSrvs.RoamableRootFolder)); + data.Add(new Snoop.Data.String("Local root folder", hAppSrvs.LocalRootFolder)); + data.Add(new Snoop.Data.String("Program", hAppSrvs.Program)); + data.Add(new Snoop.Data.String("Product", hAppSrvs.Product)); + data.Add(new Snoop.Data.String("Company name", hAppSrvs.CompanyName)); +#if(AC2012) +#else + data.Add(new Snoop.Data.String("Registry product root key", hAppSrvs.MachineRegistryProductRootKey)); +#endif + data.Add(new Snoop.Data.String("Modeler flavor", hAppSrvs.ModelerFlavor.ToString())); + data.Add(new Snoop.Data.Database("Working database", AcDb.HostApplicationServices.WorkingDatabase)); + data.Add(new Snoop.Data.Object("Current", AcDb.HostApplicationServices.Current)); + } + + private void + Stream(ArrayList data, AcRx.DynamicLinker dLinker) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcRx.DynamicLinker))); + +#if(AC2012) +#else + //data.Add(new Snoop.Data.String("Product key", dLinker.ProductKey)); +#endif + data.Add(new Snoop.Data.Int("Product license ID", dLinker.ProductLcid)); + + // TBD: GetLoadedModules(); + } + + private void + Stream(ArrayList data, AcRx.Dictionary dict) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcRx.Dictionary))); + + data.Add(new Snoop.Data.Int("Count", dict.Count)); + data.Add(new Snoop.Data.Bool("Deletes objects", dict.DeletesObjects)); + data.Add(new Snoop.Data.Bool("Is case sensitive", dict.IsCaseSensitive)); + data.Add(new Snoop.Data.Bool("Is sorted", dict.IsSorted)); + } + + private void + Stream(ArrayList data, AcRx.RXClass rxClass) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcRx.RXClass))); + + data.Add(new Snoop.Data.String("Name", rxClass.Name)); + data.Add(new Snoop.Data.String("Appname", rxClass.AppName)); + data.Add(new Snoop.Data.String("DXF name", rxClass.DxfName)); + data.Add(new Snoop.Data.Object("Class version", rxClass.ClassVersion)); + data.Add(new Snoop.Data.Object("My parent", rxClass.MyParent)); + data.Add(new Snoop.Data.Int("Proxy flags", rxClass.ProxyFlags)); + } + } +} diff --git a/MgdDbgLibrary/Snoop/CollectorExts/SymbolTable.cs b/MgdDbgLibrary/Snoop/CollectorExts/SymbolTable.cs new file mode 100644 index 0000000..ee8ca1c --- /dev/null +++ b/MgdDbgLibrary/Snoop/CollectorExts/SymbolTable.cs @@ -0,0 +1,452 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + + +using System.Diagnostics; +using System.Collections; +using Autodesk.AutoCAD.DatabaseServices; +using MgdDbg.Snoop.Collectors; +using AcDb = Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.Snoop.CollectorExts +{ + /// + /// This is a Snoop Collector Extension object to collect data from SymbolTable objects. + /// + public class SymbolTable : CollectorExt + { + public SymbolTable() + { + } + + protected override void CollectEvent(object sender, CollectorEventArgs e) + { + // cast the sender object to the SnoopCollector we are expecting + Collector snoopCollector = sender as Collector; + if (snoopCollector == null) + { + Debug.Assert(false); // why did someone else send us the message? + return; + } + + // branch to all types we are concerned with + AcDb.SymbolTableRecord tblRec = e.ObjToSnoop as AcDb.SymbolTableRecord; + if (tblRec != null) + { + Stream(snoopCollector.Data(), tblRec); + return; + } + + AcDb.SymbolTable + symTbl = + e.ObjToSnoop as AcDb.SymbolTable; // need to use namespace or it thinks we are referring to this class "SymbolTable" instead! + if (symTbl != null) + { + Stream(snoopCollector.Data(), symTbl); + return; + } + } + + #region SymbolTableRecords + + private void Stream(ArrayList data, AcDb.SymbolTableRecord tblRec) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcDb.SymbolTableRecord))); + + data.Add(new Snoop.Data.String("Name", tblRec.Name)); + data.Add(new Snoop.Data.Bool("Is dependent", tblRec.IsDependent)); + data.Add(new Snoop.Data.Bool("Is resolved", tblRec.IsResolved)); + + // branch to all known major sub-classes + AbstractViewTableRecord viewRec = tblRec as AbstractViewTableRecord; + if (viewRec != null) + { + Stream(data, viewRec); + return; + } + + BlockTableRecord blkRec = tblRec as BlockTableRecord; + if (blkRec != null) + { + Stream(data, blkRec); + return; + } + + DimStyleTableRecord dimRec = tblRec as DimStyleTableRecord; + if (dimRec != null) + { + Stream(data, dimRec); + return; + } + + LayerTableRecord layRec = tblRec as LayerTableRecord; + if (layRec != null) + { + Stream(data, layRec); + return; + } + + LinetypeTableRecord ltypeRec = tblRec as LinetypeTableRecord; + if (ltypeRec != null) + { + Stream(data, ltypeRec); + return; + } + + TextStyleTableRecord textRec = tblRec as TextStyleTableRecord; + if (textRec != null) + { + Stream(data, textRec); + return; + } + + UcsTableRecord ucsRec = tblRec as UcsTableRecord; + if (ucsRec != null) + { + Stream(data, ucsRec); + return; + } + } + + private void + Stream(ArrayList data, AbstractViewTableRecord rec) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AbstractViewTableRecord))); + + data.Add(new Snoop.Data.Point2d("Center point", rec.CenterPoint)); + data.Add(new Snoop.Data.Distance("Width", rec.Width)); + data.Add(new Snoop.Data.Distance("Height", rec.Height)); + data.Add(new Snoop.Data.Point3d("Target", rec.Target)); + data.Add(new Snoop.Data.Vector3d("View direction", rec.ViewDirection)); + data.Add(new Snoop.Data.Distance("View twist", rec.ViewTwist)); + data.Add(new Snoop.Data.Double("Lens length", rec.LensLength)); + data.Add(new Snoop.Data.Bool("Front clip at eye", rec.FrontClipAtEye)); + data.Add(new Snoop.Data.Distance("Front clip distance", rec.FrontClipDistance)); + data.Add(new Snoop.Data.Distance("Back clip distance", rec.BackClipDistance)); + data.Add(new Snoop.Data.Bool("Front clip enabled", rec.FrontClipEnabled)); + data.Add(new Snoop.Data.Bool("Back clip enabled", rec.BackClipEnabled)); + data.Add(new Snoop.Data.Distance("Elevation", rec.Elevation)); + data.Add(new Snoop.Data.Bool("Perspective enabled", rec.PerspectiveEnabled)); + // data.Add(new Snoop.Data.String("Render mode", rec.RenderMode.ToString())); + data.Add(new Snoop.Data.Object("UCS", rec.Ucs)); + data.Add(new Snoop.Data.ObjectId("UCS name", rec.UcsName)); + data.Add(new Snoop.Data.String("UCS orthographic", rec.UcsOrthographic.ToString())); + data.Add(new Snoop.Data.String("View orthographic", rec.ViewOrthographic.ToString())); + + data.Add(new Snoop.Data.Object("Ambient light color", rec.AmbientLightColor)); + data.Add(new Snoop.Data.ObjectId("Background ID", rec.Background)); + data.Add(new Snoop.Data.Double("Brightness", rec.Brightness)); + data.Add(new Snoop.Data.Double("Contrast", rec.Contrast)); + data.Add(new Snoop.Data.Bool("Default lighting on", rec.DefaultLightingOn)); + data.Add(new Snoop.Data.String("Default lighting type", rec.DefaultLightingType.ToString())); + data.Add(new Snoop.Data.ObjectId("Sun ID", rec.SunId)); + data.Add(new Snoop.Data.ObjectId("Visual style ID", rec.VisualStyleId)); + + ViewportTableRecord viewportRec = rec as ViewportTableRecord; + if (viewportRec != null) + { + Stream(data, viewportRec); + return; + } + + ViewTableRecord viewRec = rec as ViewTableRecord; + if (viewRec != null) + { + Stream(data, viewRec); + return; + } + } + + private void + Stream(ArrayList data, ViewportTableRecord rec) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ViewportTableRecord))); + + data.Add(new Snoop.Data.Point2d("Lower left corner", rec.LowerLeftCorner)); + data.Add(new Snoop.Data.Point2d("Upper right corner", rec.UpperRightCorner)); + data.Add(new Snoop.Data.Int("Circle sides", rec.CircleSides)); + data.Add(new Snoop.Data.Bool("Fast zooms enabled", rec.FastZoomsEnabled)); + data.Add(new Snoop.Data.Bool("Grid enabled", rec.GridEnabled)); + data.Add(new Snoop.Data.Bool("Grid adaptive", rec.GridAdaptive)); + data.Add(new Snoop.Data.Bool("Grid bound to limits", rec.GridBoundToLimits)); + data.Add(new Snoop.Data.Bool("Grid follow", rec.GridFollow)); + data.Add(new Snoop.Data.Int("Grid major", rec.GridMajor)); + data.Add(new Snoop.Data.Bool("Grid sub-division restricted", rec.GridSubdivisionRestricted)); + data.Add(new Snoop.Data.Point2d("Grid increments", rec.GridIncrements)); + data.Add(new Snoop.Data.Bool("Icon enabled", rec.IconEnabled)); + data.Add(new Snoop.Data.Bool("Icon at origin", rec.IconAtOrigin)); + data.Add(new Snoop.Data.Bool("Isometric snap enabled", rec.IsometricSnapEnabled)); + data.Add(new Snoop.Data.Bool("Snap enabled", rec.SnapEnabled)); + data.Add(new Snoop.Data.Point2d("Snap increments", rec.SnapIncrements)); + data.Add(new Snoop.Data.Int("Snap pair", rec.SnapPair)); + data.Add(new Snoop.Data.Bool("UCS follow mode", rec.UcsFollowMode)); + data.Add(new Snoop.Data.Bool("UCS saved with viewport", rec.UcsSavedWithViewport)); + } + + private void Stream(ArrayList data, ViewTableRecord rec) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(ViewTableRecord))); + + data.Add(new Snoop.Data.String("Cateogry name", rec.CategoryName)); + data.Add(new Snoop.Data.Bool("Is paper space view", rec.IsPaperspaceView)); + data.Add(new Snoop.Data.Bool("Is UCS assoc. to view", rec.IsUcsAssociatedToView)); + data.Add(new Snoop.Data.Bool("View assoc. to viewport", rec.ViewAssociatedToViewport)); + data.Add(new Snoop.Data.String("Layer state", rec.LayerState)); + data.Add(new Snoop.Data.ObjectId("Layout", rec.Layout)); + data.Add(new Snoop.Data.ObjectId("Live section ID", rec.LiveSection)); + data.Add(new Snoop.Data.Bitmap("Thumbnail", rec.Thumbnail)); + } + + private void Stream(ArrayList data, BlockTableRecord rec) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(BlockTableRecord))); + + data.Add(new Snoop.Data.String("Path name", rec.PathName)); + data.Add(new Snoop.Data.String("Comments", rec.Comments)); + data.Add(new Snoop.Data.Point3d("Origin", rec.Origin)); + data.Add(new Snoop.Data.ObjectId("Layout ID", rec.LayoutId)); + data.Add(new Snoop.Data.Bool("Has attribute definitions", rec.HasAttributeDefinitions)); + data.Add(new Snoop.Data.Bool("Has preview icon", rec.HasPreviewIcon)); + //if (rec.HasPreviewIcon) + // data.Add(new Snoop.Data.Bitmap("Preview icon", rec.PreviewIcon)); // TBD: throws exception, Not Implemented! + data.Add(new Snoop.Data.String("Block scaling", rec.BlockScaling.ToString())); + data.Add(new Snoop.Data.Bool("Explodable", rec.Explodable)); + data.Add(new Snoop.Data.String("Units", rec.Units.ToString())); + data.Add(new Snoop.Data.Bool("Is anonymous", rec.IsAnonymous)); + data.Add(new Snoop.Data.Bool("Is dynamic block", rec.IsDynamicBlock)); + data.Add(new Snoop.Data.Bool("Is from external reference", rec.IsFromExternalReference)); + data.Add(new Snoop.Data.Bool("Is from overlay reference", rec.IsFromOverlayReference)); + data.Add(new Snoop.Data.Bool("Is layout", rec.IsLayout)); + data.Add(new Snoop.Data.Bool("Is unloaded", rec.IsUnloaded)); + data.Add(new Snoop.Data.ObjectId("Draw order table ID", rec.DrawOrderTableId)); + data.Add(new Snoop.Data.ObjectId("BlockBegin ID", rec.BlockBeginId)); + data.Add(new Snoop.Data.ObjectId("BlockEnd ID", rec.BlockEndId)); + data.Add(new Snoop.Data.ObjectIdCollection("Entities within block", + MgdDbg.Utils.SymTbl.CollectBlockEnts(rec))); + data.Add(new Snoop.Data.ObjectIdCollection("Block reference IDs (directOnly = true)", + rec.GetBlockReferenceIds(true, false))); + data.Add(new Snoop.Data.ObjectIdCollection("Block reference IDs (directOnly = false)", + rec.GetBlockReferenceIds(false, false))); + data.Add( + new Snoop.Data.ObjectIdCollection("Block reference IDs (Erased)", rec.GetErasedBlockReferenceIds())); + data.Add(new Snoop.Data.String("Xref status", rec.XrefStatus.ToString())); + data.Add(new Snoop.Data.Database("Xref database", rec.GetXrefDatabase(true))); + } + + private void + Stream(ArrayList data, DimStyleTableRecord rec) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(DimStyleTableRecord))); + + data.Add(new Snoop.Data.ObjectId("First arrow", rec.GetArrowId(DimArrowFlag.FirstArrow))); + data.Add(new Snoop.Data.ObjectId("Second arrow", rec.GetArrowId(DimArrowFlag.SecondArrow))); + data.Add(new Snoop.Data.Bool("Is modified for recompute", rec.IsModifiedForRecompute)); + + data.Add(new Snoop.Data.CategorySeparator("DIMVARS")); + + // dimvars + data.Add(new Snoop.Data.Int("Dimadec", rec.Dimadec)); + data.Add(new Snoop.Data.Bool("Dimalt", rec.Dimalt)); + data.Add(new Snoop.Data.Int("Dimaltd", rec.Dimaltd)); + data.Add(new Snoop.Data.Distance("Dimaltf", rec.Dimaltf)); + data.Add(new Snoop.Data.Distance("Dimaltrnd", rec.Dimaltrnd)); + data.Add(new Snoop.Data.Int("Dimalttd", rec.Dimalttd)); + data.Add(new Snoop.Data.Int("Dimalttz", rec.Dimalttz)); + data.Add(new Snoop.Data.Int("Dimaltu", rec.Dimaltu)); + data.Add(new Snoop.Data.Int("Dimaltz", rec.Dimaltz)); + data.Add(new Snoop.Data.String("Dimapost", rec.Dimapost)); + data.Add(new Snoop.Data.Int("Dimarcsym", rec.Dimarcsym)); + data.Add(new Snoop.Data.Distance("Dimasz", rec.Dimasz)); + data.Add(new Snoop.Data.Int("Dimatfit", rec.Dimatfit)); + data.Add(new Snoop.Data.Int("Dimaunit", rec.Dimaunit)); + data.Add(new Snoop.Data.Int("Dimazin", rec.Dimazin)); + data.Add(new Snoop.Data.ObjectId("Dimblk", rec.Dimblk)); + data.Add(new Snoop.Data.ObjectId("Dimblk1", rec.Dimblk1)); + data.Add(new Snoop.Data.ObjectId("Dimblk2", rec.Dimblk2)); + data.Add(new Snoop.Data.Distance("Dimcen", rec.Dimcen)); + data.Add(new Snoop.Data.ObjectToString("Dimclrd", rec.Dimclrd)); + data.Add(new Snoop.Data.ObjectToString("Dimclre", rec.Dimclre)); + data.Add(new Snoop.Data.ObjectToString("Dimclrt", rec.Dimclrt)); + data.Add(new Snoop.Data.Int("Dimdec", rec.Dimdec)); + data.Add(new Snoop.Data.Distance("Dimdle", rec.Dimdle)); + data.Add(new Snoop.Data.Distance("Dimdli", rec.Dimdli)); + data.Add(new Snoop.Data.String("Dimdsep", rec.Dimdsep.ToString())); + data.Add(new Snoop.Data.Distance("Dimexe", rec.Dimexe)); + data.Add(new Snoop.Data.Distance("Dimexo", rec.Dimexo)); + data.Add(new Snoop.Data.Int("Dimfrac", rec.Dimfrac)); + data.Add(new Snoop.Data.Distance("Dimfxlen", rec.Dimfxlen)); + data.Add(new Snoop.Data.Bool("DimfxlenOn", rec.DimfxlenOn)); + data.Add(new Snoop.Data.Distance("Dimgap", rec.Dimgap)); + data.Add(new Snoop.Data.Angle("Dimjogang", rec.Dimjogang)); + data.Add(new Snoop.Data.Int("Dimjust", rec.Dimjust)); + data.Add(new Snoop.Data.ObjectId("Dimldrblk", rec.Dimldrblk)); + data.Add(new Snoop.Data.Distance("Dimlfac", rec.Dimlfac)); + data.Add(new Snoop.Data.Bool("Dimlim", rec.Dimlim)); + data.Add(new Snoop.Data.ObjectId("Dimltex1", rec.Dimltex1)); + data.Add(new Snoop.Data.ObjectId("Dimltex2", rec.Dimltex2)); + data.Add(new Snoop.Data.ObjectId("Dimltype", rec.Dimltype)); + data.Add(new Snoop.Data.Int("Dimlunit", rec.Dimlunit)); + data.Add(new Snoop.Data.String("Dimlwd", rec.Dimlwd.ToString())); + data.Add(new Snoop.Data.String("Dimlwe", rec.Dimlwe.ToString())); + data.Add(new Snoop.Data.String("Dimpost", rec.Dimpost)); + data.Add(new Snoop.Data.Distance("Dimrnd", rec.Dimrnd)); + data.Add(new Snoop.Data.Bool("Dimsah", rec.Dimsah)); + data.Add(new Snoop.Data.Distance("Dimscale", rec.Dimscale)); + data.Add(new Snoop.Data.Bool("Dimsd1", rec.Dimsd1)); + data.Add(new Snoop.Data.Bool("Dimsd2", rec.Dimsd2)); + data.Add(new Snoop.Data.Bool("Dimse1", rec.Dimse1)); + data.Add(new Snoop.Data.Bool("Dimse2", rec.Dimse2)); + data.Add(new Snoop.Data.Bool("Dimsoxd", rec.Dimsoxd)); + data.Add(new Snoop.Data.Int("Dimtad", rec.Dimtad)); + data.Add(new Snoop.Data.Int("Dimtdec", rec.Dimtdec)); + data.Add(new Snoop.Data.Distance("Dimtfac", rec.Dimtfac)); + data.Add(new Snoop.Data.Int("Dimtfill", rec.Dimtfill)); + data.Add(new Snoop.Data.Object("Dimtfillclr", rec.Dimtfillclr)); + data.Add(new Snoop.Data.Bool("Dimtih", rec.Dimtih)); + data.Add(new Snoop.Data.Bool("Dimtix", rec.Dimtix)); + data.Add(new Snoop.Data.Distance("Dimtm", rec.Dimtm)); + data.Add(new Snoop.Data.Int("Dimtmove", rec.Dimtmove)); + data.Add(new Snoop.Data.Bool("Dimtofl", rec.Dimtofl)); + data.Add(new Snoop.Data.Bool("Dimtoh", rec.Dimtoh)); + data.Add(new Snoop.Data.Bool("Dimtol", rec.Dimtol)); + data.Add(new Snoop.Data.Int("Dimtolj", rec.Dimtolj)); + data.Add(new Snoop.Data.Distance("Dimtp", rec.Dimtp)); + data.Add(new Snoop.Data.Distance("Dimtsz", rec.Dimtsz)); + data.Add(new Snoop.Data.Distance("Dimtvp", rec.Dimtvp)); + data.Add(new Snoop.Data.ObjectId("Dimtxsty", rec.Dimtxsty)); + data.Add(new Snoop.Data.Distance("Dimtxt", rec.Dimtxt)); + data.Add(new Snoop.Data.Int("Dimtzin", rec.Dimtzin)); + data.Add(new Snoop.Data.Bool("Dimupt", rec.Dimupt)); + data.Add(new Snoop.Data.Int("Dimzin", rec.Dimzin)); + } + + private void + Stream(ArrayList data, LayerTableRecord rec) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LayerTableRecord))); + + data.Add(new Snoop.Data.String("Description", rec.Description)); + data.Add(new Snoop.Data.ObjectToString("Color", rec.Color)); + data.Add(new Snoop.Data.Object("Entity color", rec.EntityColor)); + data.Add(new Snoop.Data.ObjectId("Linetype ID", rec.LinetypeObjectId)); + data.Add(new Snoop.Data.String("Lineweight", rec.LineWeight.ToString())); + data.Add(new Snoop.Data.String("PlotStyle name", rec.PlotStyleName)); + data.Add(new Snoop.Data.ObjectId("PlotStyle name ID", rec.PlotStyleNameId)); + data.Add(new Snoop.Data.Object("Transparency", rec.Transparency)); + data.Add(new Snoop.Data.Bool("Viewport visibility default", rec.ViewportVisibilityDefault)); + data.Add(new Snoop.Data.Bool("Is frozen", rec.IsFrozen)); + data.Add(new Snoop.Data.Bool("Is locked", rec.IsLocked)); + data.Add(new Snoop.Data.Bool("Is off", rec.IsOff)); + data.Add(new Snoop.Data.Bool("Is plottable", rec.IsPlottable)); + data.Add(new Snoop.Data.Bool("Is used", rec.IsUsed)); + } + + private void + Stream(ArrayList data, LinetypeTableRecord rec) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(LinetypeTableRecord))); + + data.Add(new Snoop.Data.String("Ascii Description", rec.AsciiDescription)); + data.Add(new Snoop.Data.String("Comments", rec.Comments)); + data.Add(new Snoop.Data.Bool("Is scaled to fit", rec.IsScaledToFit)); + data.Add(new Snoop.Data.Distance("Pattern length", rec.PatternLength)); + data.Add(new Snoop.Data.Int("Number of dashes", rec.NumDashes)); + + int i, len; + len = rec.NumDashes; + for (i = 0; i < len; i++) + { + data.Add(new Snoop.Data.CategorySeparator(string.Format("--- DASH [{0}] ---", i))); + data.Add(new Snoop.Data.Distance("Length", rec.DashLengthAt(i))); + data.Add(new Snoop.Data.ObjectId("Shape style", rec.ShapeStyleAt(i))); + data.Add(new Snoop.Data.Int("Shape number at", rec.ShapeNumberAt(i))); + data.Add(new Snoop.Data.Vector2d("Shape offset at", rec.ShapeOffsetAt(i))); + data.Add(new Snoop.Data.Double("Shape scale at", rec.ShapeScaleAt(i))); + data.Add(new Snoop.Data.Bool("Shape is UCS oriented at", rec.ShapeIsUcsOrientedAt(i))); + data.Add(new Snoop.Data.Angle("Shape rotation at", rec.ShapeRotationAt(i))); + + try + { + data.Add(new Snoop.Data.String("Text at", rec.TextAt(i))); + } + catch (Autodesk.AutoCAD.Runtime.Exception e) + { + if (e.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.NotApplicable) + data.Add(new Snoop.Data.Exception("Text at", e)); + else + throw e; + } + } + } + + private void + Stream(ArrayList data, RegAppTableRecord rec) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(RegAppTableRecord))); + } + + private void + Stream(ArrayList data, TextStyleTableRecord rec) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(TextStyleTableRecord))); + + data.Add(new Snoop.Data.String("Big font file name", rec.BigFontFileName)); + data.Add(new Snoop.Data.String("Filename", rec.FileName)); + data.Add(new Snoop.Data.String("Flag bits", rec.FlagBits.ToString())); + data.Add(new Snoop.Data.Object("Font descriptor", rec.Font)); + data.Add(new Snoop.Data.Bool("Is shape file", rec.IsShapeFile)); + data.Add(new Snoop.Data.Bool("Is vertical", rec.IsVertical)); + data.Add(new Snoop.Data.Angle("Obliquing angle", rec.ObliquingAngle)); + data.Add(new Snoop.Data.Distance("Prior size", rec.PriorSize)); + data.Add(new Snoop.Data.Distance("Text size", rec.TextSize)); + data.Add(new Snoop.Data.Distance("X scale", rec.XScale)); + } + + private void + Stream(ArrayList data, UcsTableRecord rec) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(UcsTableRecord))); + + data.Add(new Snoop.Data.Point3d("Origin", rec.Origin)); + data.Add(new Snoop.Data.Vector3d("X axis", rec.XAxis)); + data.Add(new Snoop.Data.Vector3d("Y axis", rec.YAxis)); + } + + #endregion + + #region SymbolTable + + private void + Stream(ArrayList data, AcDb.SymbolTable symTbl) + { + data.Add(new Snoop.Data.ClassSeparator(typeof(AcDb.SymbolTable))); + + // There is no data unique to different types of SymbolTables, so we will just take + // a short-cut here and print out the class name. The virtuals it defines are already + // taken care of by the UI (that is how we got the tree structure). + // branch to all known major sub-classes + data.Add(new Snoop.Data.ClassSeparator(symTbl.GetType())); + } + + #endregion + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/Collectors/Collector.cs b/MgdDbgLibrary/Snoop/Collectors/Collector.cs new file mode 100644 index 0000000..008f697 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Collectors/Collector.cs @@ -0,0 +1,65 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Collections; + + +namespace MgdDbg.Snoop.Collectors +{ + /// + /// This is the base class of data collector objects. We'll just establish + /// the protocol for derived classes. This class is abstract and cannot be + /// instantiated except by derived classes. + /// + public abstract class Collector + { + // Define an event so that we can broadcast out to any Collector Extension + // objects to fill in data that we don't know about. The Event is static + // to the base class, so all instances of all derived classes will inherit + // the ability to be extended. + public delegate void CollectorExt(object sender, CollectorEventArgs e); + public static event CollectorExt OnCollectorExt; + + protected ArrayList m_dataObjs = new ArrayList(); + + protected + Collector() + { + } + + public ArrayList + Data() + { + return m_dataObjs; + } + + // Apparently, you can't call the Event from outside the actual class that defines it. + // So, we'll simply wrap it. Now all derived classes can broadcast the event. + protected void + FireEvent_CollectExt(object objToSnoop) + { + if (OnCollectorExt != null) + OnCollectorExt(this, new CollectorEventArgs(objToSnoop)); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Collectors/CollectorEventArgs.cs b/MgdDbgLibrary/Snoop/Collectors/CollectorEventArgs.cs new file mode 100644 index 0000000..d98a6ab --- /dev/null +++ b/MgdDbgLibrary/Snoop/Collectors/CollectorEventArgs.cs @@ -0,0 +1,44 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Collectors +{ + /// + /// Simple class to package up EventArgs for any Snoop Collector Extensions. + /// + public class CollectorEventArgs : System.EventArgs + { + private object m_objToSnoop; + + public + CollectorEventArgs(object objToSnoop) + { + m_objToSnoop = objToSnoop; + } + + public object ObjToSnoop + { + get { return m_objToSnoop; } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Collectors/Objects.cs b/MgdDbgLibrary/Snoop/Collectors/Objects.cs new file mode 100644 index 0000000..8287e05 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Collectors/Objects.cs @@ -0,0 +1,52 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Collectors +{ + /// + /// Collect data about a System.Object. + /// + public class Objects : Collector + { + + public + Objects() + { + } + + /// + /// Collect data about a System.Object. + /// + + public void + Collect(System.Object obj) + { + m_dataObjs.Clear(); + + // fire an event to any registered Snoop Collector Extensions so + // they can add their data + if (obj != null) + FireEvent_CollectExt(obj); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Collectors/XmlNode.cs b/MgdDbgLibrary/Snoop/Collectors/XmlNode.cs new file mode 100644 index 0000000..890cfd2 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Collectors/XmlNode.cs @@ -0,0 +1,322 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Collectors +{ + /// + /// Collect data about an XmlNode + /// + public class XmlNode : Collector + { + + public + XmlNode() + { + } + + public void + Collect(System.Xml.XmlNode node) + { + m_dataObjs.Clear(); + Stream(node); + + // now that we've collected all the data that we know about, + // fire an event to any registered Snoop Collector Extensions so + // they can add their data + FireEvent_CollectExt(node); + } + + // main branch for anything derived from XmlNode (AcDbObject) + private void + Stream(System.Xml.XmlNode node) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlNode))); + + m_dataObjs.Add(new Snoop.Data.String("Node type", node.NodeType.ToString())); + m_dataObjs.Add(new Snoop.Data.String("Name", node.Name)); + m_dataObjs.Add(new Snoop.Data.String("Local name", node.LocalName)); + m_dataObjs.Add(new Snoop.Data.String("Value", node.Value)); + m_dataObjs.Add(new Snoop.Data.Bool("Has child nodes", node.HasChildNodes)); + m_dataObjs.Add(new Snoop.Data.String("Inner text", node.InnerText)); + m_dataObjs.Add(new Snoop.Data.Xml("Inner XML", node.InnerXml, false)); + m_dataObjs.Add(new Snoop.Data.Xml("Outer XML", node.OuterXml, false)); + m_dataObjs.Add(new Snoop.Data.Bool("Is read only", node.IsReadOnly)); + m_dataObjs.Add(new Snoop.Data.String("BaseURI", node.BaseURI)); + m_dataObjs.Add(new Snoop.Data.String("Namespace URI", node.NamespaceURI)); + m_dataObjs.Add(new Snoop.Data.String("Prefix", node.Prefix)); + + // branch to all known major sub-classes + System.Xml.XmlAttribute att = node as System.Xml.XmlAttribute; + if (att != null) { + Stream(att); + return; + } + + System.Xml.XmlDocument doc = node as System.Xml.XmlDocument; + if (doc != null) { + Stream(doc); + return; + } + + System.Xml.XmlDocumentFragment docFrag = node as System.Xml.XmlDocumentFragment; + if (docFrag != null) { + Stream(docFrag); + return; + } + + System.Xml.XmlEntity ent = node as System.Xml.XmlEntity; + if (ent != null) { + Stream(ent); + return; + } + + System.Xml.XmlNotation notation = node as System.Xml.XmlNotation; + if (notation != null) { + Stream(notation); + return; + } + + System.Xml.XmlLinkedNode lnkNode = node as System.Xml.XmlLinkedNode; + if (lnkNode != null) { + Stream(lnkNode); + return; + } + } + + private void + Stream(System.Xml.XmlAttribute att) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlAttribute))); + + m_dataObjs.Add(new Snoop.Data.Bool("Specified", att.Specified)); + } + + private void + Stream(System.Xml.XmlLinkedNode lnkNode) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlLinkedNode))); + + // No data to show at this level, but we want to explicitly + // show that there is an intermediate class. + + System.Xml.XmlElement elem = lnkNode as System.Xml.XmlElement; + if (elem != null) { + Stream(elem); + return; + } + + System.Xml.XmlCharacterData charData = lnkNode as System.Xml.XmlCharacterData; + if (charData != null) { + Stream(charData); + return; + } + + System.Xml.XmlDeclaration decl = lnkNode as System.Xml.XmlDeclaration; + if (decl != null) { + Stream(decl); + return; + } + + System.Xml.XmlDocumentType dType = lnkNode as System.Xml.XmlDocumentType; + if (dType != null) { + Stream(dType); + return; + } + + System.Xml.XmlEntityReference entRef = lnkNode as System.Xml.XmlEntityReference; + if (entRef != null) { + Stream(entRef); + return; + } + + System.Xml.XmlProcessingInstruction pi = lnkNode as System.Xml.XmlProcessingInstruction; + if (pi != null) { + Stream(pi); + return; + } + } + + + private void + Stream(System.Xml.XmlElement elem) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlElement))); + + m_dataObjs.Add(new Snoop.Data.Bool("Has attributes", elem.HasAttributes)); + m_dataObjs.Add(new Snoop.Data.Bool("Is empty", elem.IsEmpty)); + } + + private void + Stream(System.Xml.XmlCharacterData charData) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlCharacterData))); + + m_dataObjs.Add(new Snoop.Data.Int("Length", charData.Length)); + m_dataObjs.Add(new Snoop.Data.String("Data", charData.Data)); + + System.Xml.XmlCDataSection cDataSection = charData as System.Xml.XmlCDataSection; + if (cDataSection != null) { + Stream(cDataSection); + return; + } + + System.Xml.XmlComment comment = charData as System.Xml.XmlComment; + if (comment != null) { + Stream(comment); + return; + } + + System.Xml.XmlSignificantWhitespace swSpace = charData as System.Xml.XmlSignificantWhitespace; + if (swSpace != null) { + Stream(swSpace); + return; + } + + System.Xml.XmlText txt = charData as System.Xml.XmlText; + if (txt != null) { + Stream(txt); + return; + } + + System.Xml.XmlWhitespace wSpace = charData as System.Xml.XmlWhitespace; + if (wSpace != null) { + Stream(wSpace); + return; + } + } + + private void + Stream(System.Xml.XmlCDataSection cDataSection) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlCDataSection))); + + // do data to display at this level + } + + private void + Stream(System.Xml.XmlComment comment) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlComment))); + + // no data to display at this level + } + + private void + Stream(System.Xml.XmlDeclaration decl) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlDeclaration))); + + m_dataObjs.Add(new Snoop.Data.String("Encoding", decl.Encoding)); + m_dataObjs.Add(new Snoop.Data.String("Standalone", decl.Standalone)); + m_dataObjs.Add(new Snoop.Data.String("Version", decl.Version)); + } + + private void + Stream(System.Xml.XmlDocument doc) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlDocument))); + + m_dataObjs.Add(new Snoop.Data.Bool("Preserve whitespace", doc.PreserveWhitespace)); + } + + private void + Stream(System.Xml.XmlDocumentFragment doc) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlDocumentFragment))); + + // no data to display at this level + } + + private void + Stream(System.Xml.XmlDocumentType dType) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlDocumentType))); + + m_dataObjs.Add(new Snoop.Data.String("Internal subset", dType.InternalSubset)); + m_dataObjs.Add(new Snoop.Data.String("Public ID", dType.PublicId)); + m_dataObjs.Add(new Snoop.Data.String("System ID", dType.SystemId)); + } + + private void + Stream(System.Xml.XmlEntity ent) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlEntity))); + + m_dataObjs.Add(new Snoop.Data.String("Notation name", ent.NotationName)); + m_dataObjs.Add(new Snoop.Data.String("Public ID", ent.PublicId)); + m_dataObjs.Add(new Snoop.Data.String("System ID", ent.SystemId)); + } + + private void + Stream(System.Xml.XmlEntityReference entRef) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlEntityReference))); + + // no data to display at this level + } + + private void + Stream(System.Xml.XmlNotation notation) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlNotation))); + + m_dataObjs.Add(new Snoop.Data.String("Public ID", notation.PublicId)); + m_dataObjs.Add(new Snoop.Data.String("System ID", notation.SystemId)); + } + + private void + Stream(System.Xml.XmlProcessingInstruction pi) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlProcessingInstruction))); + + m_dataObjs.Add(new Snoop.Data.String("Target", pi.Target)); + } + + private void + Stream(System.Xml.XmlSignificantWhitespace swSpace) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlSignificantWhitespace))); + + // no data to display at this level + } + + private void + Stream(System.Xml.XmlText text) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlText))); + + // no data to display at this level + } + + private void + Stream(System.Xml.XmlWhitespace wSpace) + { + m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlWhitespace))); + + // no data to display at this level + } + } +} + + + \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/Data/Angle.cs b/MgdDbgLibrary/Snoop/Data/Angle.cs new file mode 100644 index 0000000..f763490 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Angle.cs @@ -0,0 +1,48 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.Runtime; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataAngle. + /// + public class Angle : Data + { + protected double m_val; + + public + Angle(string label, double val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return Converter.AngleToString(m_val, AngularUnitFormat.Current, -1); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Bitmap.cs b/MgdDbgLibrary/Snoop/Data/Bitmap.cs new file mode 100644 index 0000000..708d335 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Bitmap.cs @@ -0,0 +1,66 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataIcon. + /// + public class Bitmap : Data + { + protected System.Drawing.Bitmap m_val; + + public + Bitmap(string label, System.Drawing.Bitmap val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + if (m_val != null) + return string.Format("< {0} >", m_val.GetType().Name); + else + return "(null)"; + } + + public override bool + HasDrillDown + { + get { + return m_val != null; + } + } + + public override void + DrillDown() + { + if (m_val != null) { + MgdDbg.Snoop.Forms.Bitmap form = new MgdDbg.Snoop.Forms.Bitmap(m_val); + form.ShowDialog(); + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Bool.cs b/MgdDbgLibrary/Snoop/Data/Bool.cs new file mode 100644 index 0000000..f2c87a6 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Bool.cs @@ -0,0 +1,46 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataBool. + /// + public class Bool : Data + { + protected bool m_val; + + public + Bool(string label, bool val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return m_val.ToString(); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/CategorySeparator.cs b/MgdDbgLibrary/Snoop/Data/CategorySeparator.cs new file mode 100644 index 0000000..353aac3 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/CategorySeparator.cs @@ -0,0 +1,53 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataCategorySeparator. + /// + public class CategorySeparator : Data + { + protected string m_val; + + public + CategorySeparator(string category) + : base("------- CATEGORY -------") + { + m_val = category; + } + + override public string + StrValue() + { + return string.Format("--- {0} ---", m_val); + } + + public override bool + IsSeparator + { + get { return true; } + } + + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Class.cs b/MgdDbgLibrary/Snoop/Data/Class.cs new file mode 100644 index 0000000..6f0b603 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Class.cs @@ -0,0 +1,77 @@ +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data { + /// + /// Summary description for Class. + /// + public class Class : Data { + protected System.Type m_val; + + public + Class(string label, System.Type val) + : base(label) + { + m_val = val; + } + + /// + /// + /// + /// + public override string + StrValue() + { + if (m_val == null) + return "(null)"; + else + return string.Format(" {0} ", m_val.Name); + } + + /// + /// + /// + public override bool + HasDrillDown + { + get + { + if (m_val == null) + return false; + else + return true; + } + } + + /// + /// + /// + public override void + DrillDown() + { + if (m_val != null) { + Snoop.Forms.Objects form = new Snoop.Forms.Objects(m_val); + form.ShowDialog(); + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/ClassSeparator.cs b/MgdDbgLibrary/Snoop/Data/ClassSeparator.cs new file mode 100644 index 0000000..43e5683 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/ClassSeparator.cs @@ -0,0 +1,65 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataClassSeparator. + /// + public class ClassSeparator : Data + { + protected System.Type m_val; + + public ClassSeparator(System.Type val) + : base("------- CLASS -------") + { + m_val = val; + } + + override public string + StrValue() + { + return string.Format("--- {0} ---", m_val.Name); + } + + public override bool + IsSeparator + { + get { return true; } + } + + public override bool + HasDrillDown + { + get { return true; } + } + + public override void + DrillDown() + { + Snoop.Forms.GenericPropGrid pgForm = new Snoop.Forms.GenericPropGrid(m_val); + pgForm.Text = string.Format("System.Type = {0}", m_val.Name); + pgForm.ShowDialog(); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Data.cs b/MgdDbgLibrary/Snoop/Data/Data.cs new file mode 100644 index 0000000..a0a0b1c --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Data.cs @@ -0,0 +1,108 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// This is the base class for all types of "SnoopData". Basically, we + /// want something smarter than the original data type so that we can + /// hook it up to an editor and allow its output to go different places. + /// + + public abstract class Data + { + private string m_label; + + public + Data(string label) + { + m_label = label; + } + + /// + /// The Label value for the property (e.g. "Radius" for a Circle + /// + + public virtual string + Label + { + get { return m_label; } + set { m_label = value; } + } + + /// + /// The value for the Property, expressed as a string + /// + /// The value formatted as a string + + public abstract string StrValue(); + + /// + /// Format the Label and Value as a single string + /// + /// Label/Value pair as a string + + public override string ToString() + { + return string.Format("{0}: {1}", m_label, StrValue()); + } + + /// + /// Is there more information available about this property. For instance, + /// a type double would not have anything further to show. But, an ObjectIdCollection + /// can bring up a nested dialog showing all those entities/objects. + /// + + public virtual bool + HasDrillDown + { + get { return false; } + } + + /// + /// Do the act of drilling down on the data + /// + + public virtual void + DrillDown() + { + ; // do nothing by default + } + + /// + /// Is this real data, or just a logical category separator? + /// + + public virtual bool + IsSeparator + { + get { return false; } + } + + public virtual bool + IsError + { + get { return false; } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Database.cs b/MgdDbgLibrary/Snoop/Data/Database.cs new file mode 100644 index 0000000..8d822bb --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Database.cs @@ -0,0 +1,74 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using MgdDbg.CompBuilder; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataObjectId. + /// + public class Database : Data + { + protected Autodesk.AutoCAD.DatabaseServices.Database m_val = null; + + public + Database(string label, Autodesk.AutoCAD.DatabaseServices.Database val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return MgdDbg.Utils.AcadUi.DbToStr(m_val); + } + + public override bool + HasDrillDown + { + get { + if (m_val == null) + return false; + else + return true; + } + } + + public override void + DrillDown() + { + if (m_val != null) { + using (TransactionHelper trHlp = new TransactionHelper(m_val)) { + trHlp.Start(); + + Snoop.Forms.Database form = new Snoop.Forms.Database(m_val, trHlp); + form.ShowDialog(); + + trHlp.Commit(); + } + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Distance.cs b/MgdDbgLibrary/Snoop/Data/Distance.cs new file mode 100644 index 0000000..8b3d2ae --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Distance.cs @@ -0,0 +1,49 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.Runtime; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataDistance. + /// + public class Distance : Data + { + protected double m_val; + + public + Distance(string label, double val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + // format this according to the current display unit + return Converter.DistanceToString(m_val, DistanceUnitFormat.Current, -1); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Double.cs b/MgdDbgLibrary/Snoop/Data/Double.cs new file mode 100644 index 0000000..00fb871 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Double.cs @@ -0,0 +1,49 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.Runtime; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataDouble. + /// + public class Double : Data + { + protected double m_val; + + public + Double(string label, double val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + // format this as a decimal no matter what + return Converter.DistanceToString(m_val, DistanceUnitFormat.Decimal, -1); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Enumerable.cs b/MgdDbgLibrary/Snoop/Data/Enumerable.cs new file mode 100644 index 0000000..89d3665 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Enumerable.cs @@ -0,0 +1,81 @@ +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Collections; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Snoop.Data class to hold and format an Enumerable value. This class can be used + /// for any object that supports the IEnumerable interface. However, some classes, + /// such as a Map, are better seen visually in Key/Value pairs vs a straight list of + /// enumerated objects. Use this when it works well, but write your own Snoop.Data object + /// for Enumerable cases that need better feedback to the user. + /// + + public class Enumerable : Data + { + protected IEnumerable m_val; + protected ArrayList m_objs = new ArrayList(); + + public + Enumerable(string label, IEnumerable val) + : base(label) + { + m_val = val; + + // iterate over the collection and put them in an ArrayList so we can pass on + // to our Form + if (m_val != null) { + IEnumerator iter = m_val.GetEnumerator(); + while (iter.MoveNext()) + m_objs.Add(iter.Current); + } + } + + public override string + StrValue() + { + return Snoop.Utils.ObjToTypeStr(m_val); + } + + public override bool + HasDrillDown + { + get { + if ((m_val == null) || (m_objs.Count == 0)) + return false; + else + return true; + } + } + + public override void + DrillDown() + { + if ((m_val != null) && (m_objs.Count != 0)) { + Snoop.Forms.Objects form = new Snoop.Forms.Objects(m_objs); + form.ShowDialog(); + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Exception.cs b/MgdDbgLibrary/Snoop/Data/Exception.cs new file mode 100644 index 0000000..4533fc8 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Exception.cs @@ -0,0 +1,47 @@ +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + public class Exception : Data + { + protected string m_val; + + public + Exception(string label, System.Exception val) + : base(label) + { + m_val = val.Message; + } + + public override string + StrValue () + { + return m_val; + } + + public override bool + IsError + { + get { return true; } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/ExtDictId.cs b/MgdDbgLibrary/Snoop/Data/ExtDictId.cs new file mode 100644 index 0000000..88d7aca --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/ExtDictId.cs @@ -0,0 +1,56 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using MgdDbg.CompBuilder; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataExtDictId. + /// + public class ExtDictId : Snoop.Data.ObjectId + { + + public + ExtDictId(string label, Autodesk.AutoCAD.DatabaseServices.ObjectId val) + : base(label, val) + { + m_val = val; + } + + public override void + DrillDown() + { + if (m_val.IsNull == false) { + using (TransactionHelper trHlp = new TransactionHelper(m_val.Database)) { + trHlp.Start(); + + Snoop.Forms.ExtDict form = new Snoop.Forms.ExtDict(m_val, trHlp); + form.ShowDialog(); + + trHlp.Commit(); + } + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Icon.cs b/MgdDbgLibrary/Snoop/Data/Icon.cs new file mode 100644 index 0000000..73d8004 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Icon.cs @@ -0,0 +1,66 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataIcon. + /// + public class Icon : Data + { + protected System.Drawing.Icon m_val; + + public + Icon(string label, System.Drawing.Icon val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + if (m_val == null) + return "(null)"; + else + return string.Format("< {0} >", m_val.GetType().Name); + } + + public override bool + HasDrillDown + { + get { + return (m_val != null); + } + } + + public override void + DrillDown() + { + if (m_val != null) { + MgdDbg.Snoop.Forms.Icon form = new MgdDbg.Snoop.Forms.Icon(m_val); + form.ShowDialog(); + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Int.cs b/MgdDbgLibrary/Snoop/Data/Int.cs new file mode 100644 index 0000000..d5cc252 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Int.cs @@ -0,0 +1,46 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataInt. + /// + public class Int : Data + { + protected int m_val; + + public + Int(string label, int val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return m_val.ToString(); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Long.cs b/MgdDbgLibrary/Snoop/Data/Long.cs new file mode 100644 index 0000000..21ea47b --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Long.cs @@ -0,0 +1,47 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataLong. + /// + public class Long : Data + { + protected long m_val; + + public + Long(string label, long val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return m_val.ToString(); + } + } +} + diff --git a/MgdDbgLibrary/Snoop/Data/Object.cs b/MgdDbgLibrary/Snoop/Data/Object.cs new file mode 100644 index 0000000..969e57c --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Object.cs @@ -0,0 +1,69 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for Object. + /// + public class Object : Data + { + protected System.Object m_val; + + public + Object(string label, System.Object val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + if (m_val == null) + return "(null)"; + else + return string.Format("< {0} >", m_val.GetType().Name); + } + + public override bool + HasDrillDown + { + get { + if (m_val == null) + return false; + else + return true; + } + } + + public override void + DrillDown() + { + if (m_val != null) { + Snoop.Forms.Objects form = new Snoop.Forms.Objects(m_val); + form.ShowDialog(); + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/ObjectCollection.cs b/MgdDbgLibrary/Snoop/Data/ObjectCollection.cs new file mode 100644 index 0000000..df4f1da --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/ObjectCollection.cs @@ -0,0 +1,78 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Collections; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for ObjectCollection. + /// + public class ObjectCollection : Data + { + protected ArrayList m_val = null; + + public + ObjectCollection(string label, ArrayList val) + : base(label) + { + m_val = val; + } + + public + ObjectCollection(string label, System.Collections.ICollection val) + : base(label) + { + if (val == null) + m_val = null; + else + m_val = new ArrayList(val); + } + + public override string + StrValue() + { + return Snoop.Utils.ObjToTypeStr(m_val); + } + + public override bool + HasDrillDown + { + get { + if ((m_val == null) || (m_val.Count == 0)) + return false; + else + return true; + } + } + + public override void + DrillDown() + { + if ((m_val != null) && (m_val.Count > 0)) { + Snoop.Forms.Objects form = new Snoop.Forms.Objects(m_val); + form.ShowDialog(); + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/ObjectId.cs b/MgdDbgLibrary/Snoop/Data/ObjectId.cs new file mode 100644 index 0000000..9f404dc --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/ObjectId.cs @@ -0,0 +1,77 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using MgdDbg.CompBuilder; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataObjectId. + /// + public class ObjectId : Data + { + protected Autodesk.AutoCAD.DatabaseServices.ObjectId m_val; + + public + ObjectId(string label, Autodesk.AutoCAD.DatabaseServices.ObjectId val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return MgdDbg.Utils.AcadUi.ObjToTypeAndHandleStr(m_val); + } + + public override bool + HasDrillDown + { + get { + if (m_val.IsNull) + return false; + else + return true; + } + } + + public override void + DrillDown() + { + if (m_val.IsNull == false) { + Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection objIds = new Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection(); + objIds.Add(m_val); + + using (TransactionHelper trHlp = new TransactionHelper(m_val.Database)) { + trHlp.Start(); + + Snoop.Forms.DBObjects form = new Snoop.Forms.DBObjects(objIds, trHlp); + form.ShowDialog(); + + trHlp.Commit(); + } + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/ObjectIdCollection.cs b/MgdDbgLibrary/Snoop/Data/ObjectIdCollection.cs new file mode 100644 index 0000000..5c20c2b --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/ObjectIdCollection.cs @@ -0,0 +1,84 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using MgdDbg.CompBuilder; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataObjectIdCollection. + /// + public class ObjectIdCollection : Data + { + protected Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection m_val = null; + + public + ObjectIdCollection(string label, Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection val) + : base(label) + { + m_val = val; + } + + public + ObjectIdCollection(string label, Autodesk.AutoCAD.DatabaseServices.ObjectId[] val) + : base(label) + { + if (val.Length == 0) + m_val = new Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection(); + else + m_val = new Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection(val); + } + + public override string + StrValue() + { + return Snoop.Utils.ObjToTypeStr(m_val); + } + + public override bool + HasDrillDown + { + get { + if ((m_val == null) || (m_val.Count == 0)) + return false; + else + return true; + } + } + + public override void + DrillDown() + { + if ((m_val != null) && (m_val.Count > 0)) { + using (TransactionHelper trHlp = new TransactionHelper(m_val[0].Database)) { + trHlp.Start(); + + Snoop.Forms.DBObjects form = new Snoop.Forms.DBObjects(m_val, trHlp); + form.ShowDialog(); + + trHlp.Commit(); + } + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/ObjectToString.cs b/MgdDbgLibrary/Snoop/Data/ObjectToString.cs new file mode 100644 index 0000000..a829bac --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/ObjectToString.cs @@ -0,0 +1,44 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// ObjectToString code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for ObjectToString. + /// + public class ObjectToString : MgdDbg.Snoop.Data.Object + { + public + ObjectToString(string label, System.Object val) + : base(label, val) + { + } + + public override string + StrValue() + { + return m_val.ToString(); + } + + } +} diff --git a/MgdDbgLibrary/Snoop/Data/ObjectUnknown.cs b/MgdDbgLibrary/Snoop/Data/ObjectUnknown.cs new file mode 100644 index 0000000..3dc3e9f --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/ObjectUnknown.cs @@ -0,0 +1,47 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// ObjectToString code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for ObjectToString. + /// + public class ObjectUnknown : MgdDbg.Snoop.Data.Object + { + public + ObjectUnknown(string label, System.Object val) + : base(label, val) + { + } + + public override void + DrillDown() + { + if (m_val != null) { + MgdDbg.Snoop.Forms.GenericPropGrid pgForm = new MgdDbg.Snoop.Forms.GenericPropGrid(m_val); + pgForm.ShowDialog(); + } + } + + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Point2d.cs b/MgdDbgLibrary/Snoop/Data/Point2d.cs new file mode 100644 index 0000000..c4085ca --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Point2d.cs @@ -0,0 +1,45 @@ +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataPoint2d. + /// + public class Point2d : Data + { + protected Autodesk.AutoCAD.Geometry.Point2d m_val; + + public + Point2d(string label, Autodesk.AutoCAD.Geometry.Point2d val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return MgdDbg.Utils.AcadUi.PtToStr(m_val); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Point3d.cs b/MgdDbgLibrary/Snoop/Data/Point3d.cs new file mode 100644 index 0000000..b0e1790 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Point3d.cs @@ -0,0 +1,46 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataPoint3d. + /// + public class Point3d : Data + { + protected Autodesk.AutoCAD.Geometry.Point3d m_val; + + public + Point3d(string label, Autodesk.AutoCAD.Geometry.Point3d val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return MgdDbg.Utils.AcadUi.PtToStr(m_val); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/ReferencedBy.cs b/MgdDbgLibrary/Snoop/Data/ReferencedBy.cs new file mode 100644 index 0000000..7aa83b3 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/ReferencedBy.cs @@ -0,0 +1,152 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using MgdDbg.CompBuilder; +using AcDb = Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.Snoop.Data { + + class ReferencedBy : Data { + + public AcDb.ObjectIdCollection m_hardPointerIds = new AcDb.ObjectIdCollection(); + public AcDb.ObjectIdCollection m_softPointerIds = new AcDb.ObjectIdCollection(); + public AcDb.ObjectIdCollection m_hardOwnershipIds = new AcDb.ObjectIdCollection(); + public AcDb.ObjectIdCollection m_softOwnershipIds = new AcDb.ObjectIdCollection(); + + protected AcDb.ObjectId m_val; + protected int m_count = 0; + protected int m_skipped = 0; + + public + ReferencedBy(string label, AcDb.ObjectId val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return "< ObjectIdCollection >"; + } + + public override bool + HasDrillDown + { + get { + if (m_val.IsNull) + return false; + + return true; // someone should always reference it (besides, we don't want to go thru + // the brute force algorithm just to find out) + } + } + + public override void + DrillDown() + { + using (TransactionHelper trHlp = new TransactionHelper(m_val.Database)) { + trHlp.Start(); + + BruteForceFindReferences(trHlp); + + Snoop.Forms.References form = new Snoop.Forms.References(m_hardPointerIds, m_softPointerIds, m_hardOwnershipIds, m_softOwnershipIds, trHlp); + form.Text = "Object Referenced By"; + form.ShowDialog(); + + trHlp.Commit(); + } + } + + private void + BruteForceFindReferences(TransactionHelper trHelp) + { + m_count = 0; + m_skipped = 0; + + // since we aren't calculating this in the destructor, we have to re-init every time they + // do the drill-down. + m_hardPointerIds.Clear(); + m_softPointerIds.Clear(); + m_hardOwnershipIds.Clear(); + m_softOwnershipIds.Clear(); + + AcDb.Database db = m_val.Database; + + // pass in all the root objects + ProcessObject(trHelp, m_val, db.NamedObjectsDictionaryId); + ProcessObject(trHelp, m_val, db.BlockTableId); + ProcessObject(trHelp, m_val, db.DimStyleTableId); + ProcessObject(trHelp, m_val, db.LayerTableId); + ProcessObject(trHelp, m_val, db.LinetypeTableId); + ProcessObject(trHelp, m_val, db.RegAppTableId); + ProcessObject(trHelp, m_val, db.TextStyleTableId); + ProcessObject(trHelp, m_val, db.UcsTableId); + ProcessObject(trHelp, m_val, db.ViewportTableId); + ProcessObject(trHelp, m_val, db.ViewTableId); + + //string str = string.Format("Visited: {0:d}, Skipped: {1:d}, DB Approx: {2:d}", m_count, m_skipped, db.ApproxNumObjects); + //MessageBox.Show(str); + } + + private void + ProcessObject(TransactionHelper trHelp, AcDb.ObjectId lookForObjId, AcDb.ObjectId curObjId) + { + AcDb.DBObject tmpObj = trHelp.Transaction.GetObject(curObjId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead); + if (tmpObj != null) { + m_count++; + MgdDbg.Utils.ReferenceFiler filer = new MgdDbg.Utils.ReferenceFiler(); + tmpObj.DwgOut(filer); // find out who this object owns + + RecordReferences(lookForObjId, tmpObj, filer); // record references for this object + + // now recursively visit all the objects this one owns + for (int i=0; i"; + } + + public override bool + HasDrillDown + { + get { + return m_hasRefs; + } + } + + public override void + DrillDown() + { + if (m_hasRefs) { + using (TransactionHelper trHlp = new TransactionHelper(m_val.Database)) { + trHlp.Start(); + + Snoop.Forms.References form = new Snoop.Forms.References(m_hardPointerIds, m_softPointerIds, m_hardOwnershipIds, m_softOwnershipIds, trHlp); + form.Text = "Object References"; + form.ShowDialog(); + + trHlp.Commit(); + } + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Scale2d.cs b/MgdDbgLibrary/Snoop/Data/Scale2d.cs new file mode 100644 index 0000000..75e228f --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Scale2d.cs @@ -0,0 +1,46 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataScale2d. + /// + public class Scale2d : Data + { + protected Autodesk.AutoCAD.Geometry.Scale2d m_val; + + public + Scale2d(string label, Autodesk.AutoCAD.Geometry.Scale2d val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return MgdDbg.Utils.AcadUi.ScaleToStr(m_val); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Scale3d.cs b/MgdDbgLibrary/Snoop/Data/Scale3d.cs new file mode 100644 index 0000000..5c6bc87 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Scale3d.cs @@ -0,0 +1,46 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataScale3d. + /// + public class Scale3d : Data + { + protected Autodesk.AutoCAD.Geometry.Scale3d m_val; + + public + Scale3d(string label, Autodesk.AutoCAD.Geometry.Scale3d val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return MgdDbg.Utils.AcadUi.ScaleToStr(m_val); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/SelectionSet.cs b/MgdDbgLibrary/Snoop/Data/SelectionSet.cs new file mode 100644 index 0000000..ba6f0d6 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/SelectionSet.cs @@ -0,0 +1,76 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using MgdDbg.CompBuilder; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SelectionSet. + /// + public class SelectionSet : Data + { + protected Autodesk.AutoCAD.EditorInput.SelectionSet m_val; + + public + SelectionSet(string label, Autodesk.AutoCAD.EditorInput.SelectionSet val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return "< SelectionSet >"; + } + + public override bool + HasDrillDown + { + get { + if (m_val.Count == 0) + return false; + else + return true; + } + } + + public override void + DrillDown() + { + if (m_val.Count > 0) { + Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection objIds = new Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection(m_val.GetObjectIds()); + using (TransactionHelper trHlp = new TransactionHelper(objIds[0].Database)) { + trHlp.Start(); + + Snoop.Forms.DBObjects form = new Snoop.Forms.DBObjects(objIds, trHlp); + form.ShowDialog(); + + trHlp.Commit(); + } + } + } + } +} + diff --git a/MgdDbgLibrary/Snoop/Data/String.cs b/MgdDbgLibrary/Snoop/Data/String.cs new file mode 100644 index 0000000..6f74a1c --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/String.cs @@ -0,0 +1,46 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataString. + /// + public class String : Data + { + protected string m_val; + + public + String(string label, string val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return m_val; + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Vector2d.cs b/MgdDbgLibrary/Snoop/Data/Vector2d.cs new file mode 100644 index 0000000..5e3e40a --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Vector2d.cs @@ -0,0 +1,48 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.Runtime; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataVector2d. + /// + public class Vector2d : Data + { + protected Autodesk.AutoCAD.Geometry.Vector2d m_val; + + public + Vector2d(string label, Autodesk.AutoCAD.Geometry.Vector2d val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return MgdDbg.Utils.AcadUi.VecToStr(m_val, DistanceUnitFormat.Decimal, -1); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Vector3d.cs b/MgdDbgLibrary/Snoop/Data/Vector3d.cs new file mode 100644 index 0000000..1b750c1 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Vector3d.cs @@ -0,0 +1,48 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.Runtime; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataVector3d. + /// + public class Vector3d : Data + { + protected Autodesk.AutoCAD.Geometry.Vector3d m_val; + + public + Vector3d(string label, Autodesk.AutoCAD.Geometry.Vector3d val) + : base(label) + { + m_val = val; + } + + public override string + StrValue() + { + return MgdDbg.Utils.AcadUi.VecToStr(m_val, DistanceUnitFormat.Decimal, -1); + } + } +} diff --git a/MgdDbgLibrary/Snoop/Data/Xml.cs b/MgdDbgLibrary/Snoop/Data/Xml.cs new file mode 100644 index 0000000..fb8fe39 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Data/Xml.cs @@ -0,0 +1,79 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Windows.Forms; + +namespace MgdDbg.Snoop.Data +{ + /// + /// Summary description for SnoopDataXml. + /// + public class Xml : Data + { + protected string m_val; + protected bool m_isFileName = false; + + public + Xml(string label, string val, bool isFileName) + : base(label) + { + m_val = val; + m_isFileName = isFileName; + } + + public override string + StrValue() + { + return m_val; + } + + public override bool + HasDrillDown + { + get { + if (m_val == string.Empty) + return false; + else + return true; + } + } + + public override void + DrillDown() + { + try { + System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); + if (m_isFileName) + xmlDoc.Load(m_val); + else + xmlDoc.LoadXml(m_val); + + MgdDbg.Xml.Forms.Dom form = new MgdDbg.Xml.Forms.Dom(xmlDoc); + form.ShowDialog(); + } + catch (System.Xml.XmlException e) { + MessageBox.Show(e.Message, "XML Exception"); + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Forms/Bitmap.cs b/MgdDbgLibrary/Snoop/Forms/Bitmap.cs new file mode 100644 index 0000000..3617974 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/Bitmap.cs @@ -0,0 +1,115 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Windows.Forms; + +namespace MgdDbg.Snoop.Forms +{ + /// + /// Summary description for Icon. + /// + public class Bitmap : System.Windows.Forms.Form + { + private System.Windows.Forms.PictureBox m_picBox; + private System.Windows.Forms.Button m_bnOk; + + /// + /// Required designer variable. + /// + + private System.ComponentModel.Container components = null; + + public + Bitmap(System.Drawing.Bitmap bitmap) + { + InitializeComponent(); + + m_picBox.SizeMode = PictureBoxSizeMode.AutoSize; + m_picBox.Image = bitmap; + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.m_picBox = new System.Windows.Forms.PictureBox(); + this.m_bnOk = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // m_picBox + // + this.m_picBox.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right); + this.m_picBox.Location = new System.Drawing.Point(16, 24); + this.m_picBox.Name = "m_picBox"; + this.m_picBox.Size = new System.Drawing.Size(416, 280); + this.m_picBox.TabIndex = 0; + this.m_picBox.TabStop = false; + // + // m_bnOk + // + this.m_bnOk.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); + this.m_bnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnOk.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOk.Location = new System.Drawing.Point(352, 320); + this.m_bnOk.Name = "m_bnOk"; + this.m_bnOk.TabIndex = 1; + this.m_bnOk.Text = "OK"; + // + // Bitmap + // + this.AcceptButton = this.m_bnOk; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_bnOk; + this.ClientSize = new System.Drawing.Size(450, 360); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnOk, + this.m_picBox}); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Bitmap"; + this.Text = "Bitmap"; + this.ResumeLayout(false); + + } + #endregion + } +} diff --git a/MgdDbgLibrary/Snoop/Forms/Bitmap.resx b/MgdDbgLibrary/Snoop/Forms/Bitmap.resx new file mode 100644 index 0000000..8d9b57d --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/Bitmap.resx @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Bitmap + + \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/Forms/ClassesComp.cs b/MgdDbgLibrary/Snoop/Forms/ClassesComp.cs new file mode 100644 index 0000000..d36c0ec --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/ClassesComp.cs @@ -0,0 +1,364 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using System.Diagnostics; +using System.Collections; +using System.Windows.Forms; + +namespace MgdDbg.Snoop.Forms +{ + /// + /// Summary description for ClassesComp. + /// + public class ClassesComp : System.Windows.Forms.Form + { + private System.Windows.Forms.Button m_bnOK; + private System.Windows.Forms.Button m_bnCancel; + private System.Windows.Forms.ColumnHeader m_colName; + private System.Windows.Forms.ColumnHeader m_colNamSpc; + private System.Windows.Forms.ColumnHeader m_colPrnt; + private System.Windows.Forms.ListView m_lvData; + + private MgdDbg.Utils.ListViewColumnSorter m_colSorter; + private ArrayList m_classArray = new ArrayList(); + private System.Type m_selectedClass = null; + private ColumnHeader m_colAss; + private ColumnHeader m_colPub; + private ColumnHeader m_colSeal; + private ColumnHeader m_colAbs; + private ColumnHeader m_colGUID; + + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + /// + /// + /// + public + ClassesComp() + { + InitializeComponent(); + m_colSorter = new MgdDbg.Utils.ListViewColumnSorter(); + m_lvData.ListViewItemSorter = m_colSorter; + BuildClassList(); + Display(); + } + + /// + /// If somebody has already done the hard work, just give + /// me the arraylist. + /// + /// + public + ClassesComp(ArrayList tempArray) + { + InitializeComponent(); + m_colSorter = new MgdDbg.Utils.ListViewColumnSorter(); + m_lvData.ListViewItemSorter = m_colSorter; + m_classArray = tempArray; + Display(); + } + + /// + /// Clean up any resources being used. + /// + protected override void + Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.m_lvData = new System.Windows.Forms.ListView(); + this.m_colName = new System.Windows.Forms.ColumnHeader(); + this.m_colNamSpc = new System.Windows.Forms.ColumnHeader(); + this.m_colPrnt = new System.Windows.Forms.ColumnHeader(); + this.m_colAss = new System.Windows.Forms.ColumnHeader(); + this.m_colPub = new System.Windows.Forms.ColumnHeader(); + this.m_colSeal = new System.Windows.Forms.ColumnHeader(); + this.m_colAbs = new System.Windows.Forms.ColumnHeader(); + this.m_colGUID = new System.Windows.Forms.ColumnHeader(); + this.m_bnOK = new System.Windows.Forms.Button(); + this.m_bnCancel = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // m_lvData + // + this.m_lvData.AllowColumnReorder = true; + this.m_lvData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_lvData.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_colName, + this.m_colNamSpc, + this.m_colPrnt, + this.m_colAss, + this.m_colPub, + this.m_colSeal, + this.m_colAbs, + this.m_colGUID}); + this.m_lvData.FullRowSelect = true; + this.m_lvData.GridLines = true; + this.m_lvData.HideSelection = false; + this.m_lvData.Location = new System.Drawing.Point(12, 12); + this.m_lvData.MultiSelect = false; + this.m_lvData.Name = "m_lvData"; + this.m_lvData.Size = new System.Drawing.Size(888, 496); + this.m_lvData.Sorting = System.Windows.Forms.SortOrder.Ascending; + this.m_lvData.TabIndex = 0; + this.m_lvData.UseCompatibleStateImageBehavior = false; + this.m_lvData.View = System.Windows.Forms.View.Details; + this.m_lvData.SelectedIndexChanged += new System.EventHandler(this.ItemSelected); + this.m_lvData.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.m_lvData_ColumnClick); + // + // m_colName + // + this.m_colName.Text = "Class Name"; + this.m_colName.Width = 168; + // + // m_colNamSpc + // + this.m_colNamSpc.Text = "NameSpace"; + this.m_colNamSpc.Width = 144; + // + // m_colPrnt + // + this.m_colPrnt.Text = "Parent Name"; + this.m_colPrnt.Width = 152; + // + // m_colAss + // + this.m_colAss.Text = "Assembly Qualified Name"; + // + // m_colPub + // + this.m_colPub.Text = "IsPublic"; + this.m_colPub.Width = 64; + // + // m_colSeal + // + this.m_colSeal.Text = "IsSealed"; + this.m_colSeal.Width = 65; + // + // m_colAbs + // + this.m_colAbs.Text = "IsAbstract"; + this.m_colAbs.Width = 73; + // + // m_colGUID + // + this.m_colGUID.Text = "GUID"; + this.m_colGUID.Width = 163; + // + // m_bnOK + // + this.m_bnOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnOK.Location = new System.Drawing.Point(379, 528); + this.m_bnOK.Name = "m_bnOK"; + this.m_bnOK.Size = new System.Drawing.Size(75, 23); + this.m_bnOK.TabIndex = 1; + this.m_bnOK.Text = "OK"; + // + // m_bnCancel + // + this.m_bnCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnCancel.Location = new System.Drawing.Point(467, 528); + this.m_bnCancel.Name = "m_bnCancel"; + this.m_bnCancel.Size = new System.Drawing.Size(75, 23); + this.m_bnCancel.TabIndex = 2; + this.m_bnCancel.Text = "Cancel"; + // + // ClassesComp + // + this.AcceptButton = this.m_bnOK; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_bnCancel; + this.ClientSize = new System.Drawing.Size(920, 559); + this.Controls.Add(this.m_bnCancel); + this.Controls.Add(this.m_bnOK); + this.Controls.Add(this.m_lvData); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ClassesComp"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Classes"; + this.ResumeLayout(false); + + } + #endregion + + /// + /// + /// + public void + BuildClassList() + { + try { + + /// These are dependencies that need to be preloaded + /// in order to load assemblies: "mscorlib", "acmgd" and "acdbmgd". + /// This is because ReflectionOnlyLoad() does not take care of dependencies + /// unlike Load() and we donot want to unnecessarily "load" these assemblies. + /// Instead run with ReflectionOnlyLoad() which is designed for this very purpose. + /// (TBD: Somehow the assembly names for System, System.Xml etc are not working. + /// So for now I am using hard coded file names. Do away later. This works for now. + /// jai 02.23.06) + System.Reflection.Assembly.ReflectionOnlyLoadFrom("C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\System.Drawing.dll"); + System.Reflection.Assembly.ReflectionOnlyLoadFrom("C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\System.Windows.Forms.dll"); + System.Reflection.Assembly.ReflectionOnlyLoadFrom("C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\System.Configuration.dll"); + System.Reflection.Assembly.ReflectionOnlyLoadFrom("C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\System.Xml.dll"); + System.Reflection.Assembly.ReflectionOnlyLoadFrom("C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\System.dll"); + + System.Reflection.Assembly assembly1 = System.Reflection.Assembly.ReflectionOnlyLoad("mscorlib"); + System.Reflection.Assembly assembly2 = System.Reflection.Assembly.ReflectionOnlyLoad("acmgd"); + System.Reflection.Assembly assembly3 = System.Reflection.Assembly.ReflectionOnlyLoad("acdbmgd"); + System.Reflection.Assembly assembly4 = System.Reflection.Assembly.ReflectionOnlyLoadFrom("C:\\Kyoto\\bin\\debug\\AecBaseMgd.dll"); + System.Reflection.Assembly assembly5 = System.Reflection.Assembly.ReflectionOnlyLoadFrom("C:\\Kyoto\\bin\\debug\\AecArchMgd.dll"); + + m_classArray.AddRange(assembly1.GetTypes()); + m_classArray.AddRange(assembly2.GetTypes()); + m_classArray.AddRange(assembly3.GetTypes()); + m_classArray.AddRange(assembly4.GetTypes()); + m_classArray.AddRange(assembly5.GetTypes()); + + /// Currently only classes are being considered and the rest of the types + /// (ex. Value Types) are being thrown away. However, something like + /// Autodesk.AutoCAD.EditorInput.PickPointDescriptor (a struct) is a value type + /// and thus gets left out of this. Do we want everything instead(comes with a lot + /// of unwanted stuff)?? + /// jai 02.24.06 + for (int i = 0; i < m_classArray.Count; i++) { + System.Type type = (System.Type)m_classArray[i]; + if (!type.IsClass) { + m_classArray.RemoveAt(i); + i--; + } + } + } + catch (System.Reflection.ReflectionTypeLoadException e) { + Exception[] ex = e.LoaderExceptions; + MessageBox.Show(e.Message); + } + } + + /// + /// Hook up the details in the list view + /// + public void + Display() + { + m_lvData.BeginUpdate(); + m_lvData.Items.Clear(); + + int len = m_classArray.Count; + for (int i=0; i + /// + /// + /// + public System.Type + SelectedClass() + { + return m_selectedClass; + } + + /// + /// + /// + /// + /// + private void + ItemSelected(object sender, System.EventArgs e) + { + Debug.Assert((m_lvData.SelectedItems.Count > 1) == false); + + if (m_lvData.SelectedItems.Count != 0) + m_selectedClass = (System.Type)m_lvData.SelectedItems[0].Tag; + else + m_selectedClass = null; + } + + private void m_lvData_ColumnClick(object sender, ColumnClickEventArgs e) + { + // Determine if clicked column is already the column that is being sorted. + if (e.Column == m_colSorter.SortColumn) { + // Reverse the current sort direction for this column. + if (m_colSorter.Order == SortOrder.Ascending){ + m_colSorter.Order = SortOrder.Descending; + } + else { + m_colSorter.Order = SortOrder.Ascending; + } + } + else { + // Set the column number that is to be sorted; default to ascending. + m_colSorter.SortColumn = e.Column; + m_colSorter.Order = SortOrder.Ascending; + } + + // Perform the sort with these new sort options. + m_lvData.Sort(); + + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/Forms/ClassesComp.resx b/MgdDbgLibrary/Snoop/Forms/ClassesComp.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/ClassesComp.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/Forms/DBObjects.cs b/MgdDbgLibrary/Snoop/Forms/DBObjects.cs new file mode 100644 index 0000000..e15e03b --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/DBObjects.cs @@ -0,0 +1,627 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using System.ComponentModel; +using System.Windows.Forms; +using Autodesk.AutoCAD.DatabaseServices; +using MgdDbg.CompBuilder; +using AcDb = Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.Snoop.Forms +{ + /// + /// Summary description for DBObjects. + /// + public class DBObjects : System.Windows.Forms.Form + { + // member vars + protected System.Windows.Forms.ListView m_lvData; + protected System.Windows.Forms.Button m_bnOK; + protected System.Windows.Forms.ColumnHeader m_lvCol_label; + protected System.Windows.Forms.ColumnHeader m_lvCol_value; + protected System.Windows.Forms.TreeView m_tvObjs; + protected System.Windows.Forms.ContextMenu m_cntxMenuObjId; + protected System.Windows.Forms.MenuItem m_mnuItemObjectDbInfo; + protected System.Windows.Forms.MenuItem m_mnuItemBrowseReflection; + protected System.Windows.Forms.MenuItem m_mnuItemSeparator1; + protected System.Windows.Forms.MenuItem m_mnuItemAddToSnoopObjSet; + protected System.Windows.Forms.MenuItem m_mnuItemRemoveFromSnoopObjSet; + protected System.Windows.Forms.MenuItem m_mnuItemShowSnoopObjSet; + + protected Snoop.Collectors.Objects m_snoopCollector = new Snoop.Collectors.Objects(); + protected AcDb.ObjectId m_curObjId; + protected TransactionHelper m_trans = null; + private ContextMenuStrip listViewContextMenuStrip; + private ToolStripMenuItem copyToolStripMenuItem; + private MenuItem m_mnuItemCopy; + private ToolStrip toolStrip1; + private ToolStripButton toolStripButton1; + private ToolStripButton toolStripButton2; + private PrintDialog m_printDialog; + private PrintPreviewDialog m_printPreviewDialog; + private System.Drawing.Printing.PrintDocument m_printDocument; + private IContainer components; + private Int32[] m_maxWidths; + private ToolStripButton toolStripButton3; + private Int32 m_currentPrintItem = 0; + + protected + DBObjects(TransactionHelper tr) + { + m_trans = tr; + + // this constructor is for derived classes to call + InitializeComponent(); + } + + public + DBObjects(AcDb.ObjectIdCollection objIds, TransactionHelper tr) + { + m_trans = tr; + + // Required for Windows Form Designer support + InitializeComponent(); + + m_tvObjs.BeginUpdate(); + + AddObjectIdCollectionToTree(objIds); + m_tvObjs.ExpandAll(); + + m_tvObjs.EndUpdate(); + } + + public + DBObjects(ObjectId[] objIds, TransactionHelper tr) + { + m_trans = tr; + + // Required for Windows Form Designer support + InitializeComponent(); + + m_tvObjs.BeginUpdate(); + + AddObjectIdCollectionToTree(objIds); + m_tvObjs.ExpandAll(); + + m_tvObjs.EndUpdate(); + } + + /// + /// Clean up any resources being used. + /// + protected override void + Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + protected void + InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DBObjects)); + this.m_tvObjs = new System.Windows.Forms.TreeView(); + this.m_cntxMenuObjId = new System.Windows.Forms.ContextMenu(); + this.m_mnuItemCopy = new System.Windows.Forms.MenuItem(); + this.m_mnuItemObjectDbInfo = new System.Windows.Forms.MenuItem(); + this.m_mnuItemBrowseReflection = new System.Windows.Forms.MenuItem(); + this.m_mnuItemSeparator1 = new System.Windows.Forms.MenuItem(); + this.m_mnuItemAddToSnoopObjSet = new System.Windows.Forms.MenuItem(); + this.m_mnuItemRemoveFromSnoopObjSet = new System.Windows.Forms.MenuItem(); + this.m_mnuItemShowSnoopObjSet = new System.Windows.Forms.MenuItem(); + this.m_lvData = new System.Windows.Forms.ListView(); + this.m_lvCol_label = new System.Windows.Forms.ColumnHeader(); + this.m_lvCol_value = new System.Windows.Forms.ColumnHeader(); + this.listViewContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.m_bnOK = new System.Windows.Forms.Button(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); + this.m_printDialog = new System.Windows.Forms.PrintDialog(); + this.m_printDocument = new System.Drawing.Printing.PrintDocument(); + this.m_printPreviewDialog = new System.Windows.Forms.PrintPreviewDialog(); + this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); + this.listViewContextMenuStrip.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // m_tvObjs + // + this.m_tvObjs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.m_tvObjs.ContextMenu = this.m_cntxMenuObjId; + this.m_tvObjs.HideSelection = false; + this.m_tvObjs.Location = new System.Drawing.Point(20, 41); + this.m_tvObjs.Name = "m_tvObjs"; + this.m_tvObjs.ShowNodeToolTips = true; + this.m_tvObjs.Size = new System.Drawing.Size(240, 459); + this.m_tvObjs.TabIndex = 0; + this.m_tvObjs.NodeMouseClick += new TreeNodeMouseClickEventHandler(this.TreeNodeSelected); + this.m_tvObjs.AfterSelect += new TreeViewEventHandler(this.TreeNodeSelected); + // + // m_cntxMenuObjId + // + this.m_cntxMenuObjId.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.m_mnuItemCopy, + this.m_mnuItemObjectDbInfo, + this.m_mnuItemBrowseReflection, + this.m_mnuItemSeparator1, + this.m_mnuItemAddToSnoopObjSet, + this.m_mnuItemRemoveFromSnoopObjSet, + this.m_mnuItemShowSnoopObjSet}); + this.m_cntxMenuObjId.Popup += new System.EventHandler(this.OnContextMenuPopup); + // + // m_mnuItemCopy + // + this.m_mnuItemCopy.Index = 0; + this.m_mnuItemCopy.Text = "Copy"; + this.m_mnuItemCopy.Click += new System.EventHandler(this.ContextMenuClick_Copy); + // + // m_mnuItemObjectDbInfo + // + this.m_mnuItemObjectDbInfo.Index = 1; + this.m_mnuItemObjectDbInfo.Text = "Show ObjectID Info..."; + this.m_mnuItemObjectDbInfo.Click += new System.EventHandler(this.ContextMenuClick_ObjIdInfo); + // + // m_mnuItemBrowseReflection + // + this.m_mnuItemBrowseReflection.Index = 2; + this.m_mnuItemBrowseReflection.Text = "Browse Using Reflection..."; + this.m_mnuItemBrowseReflection.Click += new System.EventHandler(this.ContextMenuClick_BrowseReflection); + // + // m_mnuItemSeparator1 + // + this.m_mnuItemSeparator1.Index = 3; + this.m_mnuItemSeparator1.Text = "-"; + // + // m_mnuItemAddToSnoopObjSet + // + this.m_mnuItemAddToSnoopObjSet.Index = 4; + this.m_mnuItemAddToSnoopObjSet.Text = "Add To Snoop Object Set"; + this.m_mnuItemAddToSnoopObjSet.Click += new System.EventHandler(this.ContextMenuClick_AddToSnoopObjSet); + // + // m_mnuItemRemoveFromSnoopObjSet + // + this.m_mnuItemRemoveFromSnoopObjSet.Index = 5; + this.m_mnuItemRemoveFromSnoopObjSet.Text = "Remove From Snoop Object Set"; + this.m_mnuItemRemoveFromSnoopObjSet.Click += new System.EventHandler(this.ContextMenuClick_RemoveFromSnoopObjSet); + // + // m_mnuItemShowSnoopObjSet + // + this.m_mnuItemShowSnoopObjSet.Index = 6; + this.m_mnuItemShowSnoopObjSet.Text = "Show Snoop Object Set..."; + this.m_mnuItemShowSnoopObjSet.Click += new System.EventHandler(this.ContextMenuClick_ShowSnoopObjSet); + // + // m_lvData + // + this.m_lvData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_lvData.AutoArrange = false; + this.m_lvData.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvCol_label, + this.m_lvCol_value}); + this.m_lvData.ContextMenuStrip = this.listViewContextMenuStrip; + this.m_lvData.Cursor = System.Windows.Forms.Cursors.Default; + this.m_lvData.FullRowSelect = true; + this.m_lvData.GridLines = true; + this.m_lvData.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvData.HideSelection = false; + this.m_lvData.Location = new System.Drawing.Point(276, 41); + this.m_lvData.MultiSelect = false; + this.m_lvData.Name = "m_lvData"; + this.m_lvData.ShowItemToolTips = true; + this.m_lvData.Size = new System.Drawing.Size(504, 459); + this.m_lvData.TabIndex = 1; + this.m_lvData.UseCompatibleStateImageBehavior = false; + this.m_lvData.View = System.Windows.Forms.View.Details; + this.m_lvData.DoubleClick += new System.EventHandler(this.DataItemSelected); + this.m_lvData.Click += new System.EventHandler(this.DataItemSelected); + // + // m_lvCol_label + // + this.m_lvCol_label.Text = "Field"; + this.m_lvCol_label.Width = 200; + // + // m_lvCol_value + // + this.m_lvCol_value.Text = "Value"; + this.m_lvCol_value.Width = 300; + // + // listViewContextMenuStrip + // + this.listViewContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.copyToolStripMenuItem}); + this.listViewContextMenuStrip.Name = "listViewContextMenuStrip"; + this.listViewContextMenuStrip.Size = new System.Drawing.Size(100, 26); + // + // copyToolStripMenuItem + // + this.copyToolStripMenuItem.Image = global::MgdDbg.Properties.Resources.COPY1; + this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; + this.copyToolStripMenuItem.Size = new System.Drawing.Size(99, 22); + this.copyToolStripMenuItem.Text = "Copy"; + this.copyToolStripMenuItem.Click += new System.EventHandler(this.CopyToolStripMenuItem_Click); + // + // m_bnOK + // + this.m_bnOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnOK.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOK.Location = new System.Drawing.Point(359, 517); + this.m_bnOK.Name = "m_bnOK"; + this.m_bnOK.Size = new System.Drawing.Size(75, 23); + this.m_bnOK.TabIndex = 2; + this.m_bnOK.Text = "OK"; + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButton1, + this.toolStripButton2, + this.toolStripButton3}); + this.toolStrip1.Location = new System.Drawing.Point(0, 0); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(792, 25); + this.toolStrip1.TabIndex = 3; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripButton1 + // + this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton1.Image = global::MgdDbg.Properties.Resources.Print1; + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(23, 22); + this.toolStripButton1.Text = "Print"; + this.toolStripButton1.Click += new System.EventHandler(this.PrintMenuItem_Click); + // + // toolStripButton2 + // + this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton2.Image = global::MgdDbg.Properties.Resources.Preview1; + this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton2.Name = "toolStripButton2"; + this.toolStripButton2.Size = new System.Drawing.Size(23, 22); + this.toolStripButton2.Text = "Print Preview"; + this.toolStripButton2.Click += new System.EventHandler(this.PrintPreviewMenuItem_Click); + // + // m_printDialog + // + this.m_printDialog.Document = this.m_printDocument; + this.m_printDialog.UseEXDialog = true; + // + // m_printDocument + // + this.m_printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.PrintDocument_PrintPage); + // + // m_printPreviewDialog + // + this.m_printPreviewDialog.AutoScrollMargin = new System.Drawing.Size(0, 0); + this.m_printPreviewDialog.AutoScrollMinSize = new System.Drawing.Size(0, 0); + this.m_printPreviewDialog.ClientSize = new System.Drawing.Size(400, 300); + this.m_printPreviewDialog.Document = this.m_printDocument; + this.m_printPreviewDialog.Enabled = true; + this.m_printPreviewDialog.Icon = ((System.Drawing.Icon)(resources.GetObject("m_printPreviewDialog.Icon"))); + this.m_printPreviewDialog.Name = "printPreviewDialog1"; + this.m_printPreviewDialog.Visible = false; + // + // toolStripButton3 + // + this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton3.Image = global::MgdDbg.Properties.Resources.COPY1; + this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton3.Name = "toolStripButton3"; + this.toolStripButton3.Size = new System.Drawing.Size(23, 22); + this.toolStripButton3.Text = "Copy To Clipboard"; + this.toolStripButton3.Click += new System.EventHandler(this.ContextMenuClick_Copy); + // + // DBObjects + // + this.AcceptButton = this.m_bnOK; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_bnOK; + this.ClientSize = new System.Drawing.Size(792, 548); + this.Controls.Add(this.toolStrip1); + this.Controls.Add(this.m_bnOK); + this.Controls.Add(this.m_lvData); + this.Controls.Add(this.m_tvObjs); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(575, 225); + this.Name = "DBObjects"; + this.ShowInTaskbar = false; + this.Text = "Snoop Objects"; + this.listViewContextMenuStrip.ResumeLayout(false); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + #endregion + + + /// + /// + /// + /// + protected void + AddObjectIdCollectionToTree(AcDb.ObjectIdCollection objIds) + { + // initialize the tree control with the ObjectId of each item + for (int i=0; i + /// + /// + /// + protected void + AddObjectIdCollectionToTree(ObjectId[] objIds) + { + // initialize the tree control with the ObjectId of each item + for (int i=0; i + /// + /// + /// + /// + protected void + TreeNodeSelected(object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs e) + { + if (e.Node.Tag != null) { + m_curObjId = (AcDb.ObjectId)e.Node.Tag; + + AcDb.DBObject dbObj = m_trans.Transaction.GetObject(m_curObjId, OpenMode.ForRead); + + // collect the data about this object + m_snoopCollector.Collect(dbObj); + + // display it + Snoop.Utils.Display(m_lvData, m_snoopCollector); + } + else { + m_curObjId = AcDb.ObjectId.Null; + m_lvData.Items.Clear(); + } + } + + /// + /// + /// + /// + /// + protected void + TreeNodeSelected (object sender, System.Windows.Forms.TreeViewEventArgs e) + { + if (e.Node.Tag != null) { + m_curObjId = (AcDb.ObjectId)e.Node.Tag; + + AcDb.DBObject dbObj = m_trans.Transaction.GetObject(m_curObjId, OpenMode.ForRead); + + // collect the data about this object + m_snoopCollector.Collect(dbObj); + + // display it + Snoop.Utils.Display(m_lvData, m_snoopCollector); + } + else { + m_curObjId = AcDb.ObjectId.Null; + m_lvData.Items.Clear(); + } + } + + + /// + /// + /// + /// + /// + protected void + DataItemSelected(object sender, System.EventArgs e) + { + Snoop.Utils.DataItemSelected(m_lvData); + } + + #region TreeView Context Menu Events + /// + /// + /// + /// + /// + protected void + ContextMenuClick_Copy (object sender, System.EventArgs e) + { + if (m_tvObjs.SelectedNode != null) { + Utils.CopyToClipboard(m_lvData); + } + } + + + /// + /// + /// + /// + /// + protected void + ContextMenuClick_ObjIdInfo(object sender, System.EventArgs e) + { + Snoop.Utils.ShowObjIdInfo(m_curObjId); + } + + + /// + /// + /// + /// + /// + private void + ContextMenuClick_BrowseReflection(object sender, System.EventArgs e) + { + Snoop.Utils.BrowseReflection(m_curObjId); + } + + + /// + /// + /// + /// + /// + private void + ContextMenuClick_AddToSnoopObjSet(object sender, System.EventArgs e) + { + if (Snoop.Utils.CurrentSnoopSet != null) { + Snoop.Utils.CurrentSnoopSet.AddToSet(m_curObjId); + } + } + + /// + /// + /// + /// + /// + private void + ContextMenuClick_RemoveFromSnoopObjSet(object sender, System.EventArgs e) + { + if (Snoop.Utils.CurrentSnoopSet != null) { + Snoop.Utils.CurrentSnoopSet.RemoveFromSet(m_curObjId); + } + } + + + /// + /// + /// + /// + /// + private void + ContextMenuClick_ShowSnoopObjSet(object sender, System.EventArgs e) + { + if (Snoop.Utils.CurrentSnoopSet != null) { + Snoop.Forms.DBObjects form = new Snoop.Forms.DBObjects(Snoop.Utils.CurrentSnoopSet.Set, m_trans); + form.Text = "Snoop Object Set"; + form.ShowDialog(); + } + } + + /// + /// + /// + /// + /// + private void + OnContextMenuPopup(object sender, System.EventArgs e) + { + bool enabled = (Snoop.Utils.CurrentSnoopSet == null) ? false : true; + m_mnuItemAddToSnoopObjSet.Enabled = enabled; + m_mnuItemRemoveFromSnoopObjSet.Enabled = enabled; + m_mnuItemShowSnoopObjSet.Enabled = enabled; + } + #endregion + + #region Copy Events + /// + /// + /// + /// + /// + private void + CopyToolStripMenuItem_Click (object sender, System.EventArgs e) + { + if (m_lvData.SelectedItems.Count > 0) { + Utils.CopyToClipboard(m_lvData.SelectedItems[0]); + } + else { + Clipboard.Clear(); + } + } + #endregion + + + #region Print Events + /// + /// + /// + /// + /// + private void + PrintDocument_PrintPage (object sender, System.Drawing.Printing.PrintPageEventArgs e) + { + m_currentPrintItem = Utils.Print(m_tvObjs.SelectedNode.Text, m_lvData, e, m_maxWidths[0], m_maxWidths[1], m_currentPrintItem); + } + + + /// + /// + /// + /// + /// + private void + PrintMenuItem_Click (object sender, EventArgs e) + { + Utils.UpdatePrintSettings(m_printDocument, m_tvObjs, m_lvData, ref m_maxWidths); + Utils.PrintMenuItemClick(m_printDialog, m_tvObjs); + } + + /// + /// + /// + /// + /// + private void + PrintPreviewMenuItem_Click (object sender, EventArgs e) + { + Utils.UpdatePrintSettings(m_printDocument, m_tvObjs, m_lvData, ref m_maxWidths); + Utils.PrintPreviewMenuItemClick(m_printPreviewDialog, m_tvObjs); + } + #endregion + + #endregion + } +} diff --git a/MgdDbgLibrary/Snoop/Forms/DBObjects.resx b/MgdDbgLibrary/Snoop/Forms/DBObjects.resx new file mode 100644 index 0000000..f13107b --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/DBObjects.resx @@ -0,0 +1,315 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 173, 28 + + + 316, 28 + + + 494, 28 + + + 593, 28 + + + 168, 65 + + + 17, 65 + + + + + AAABAAYAICAQAAAAAADoAgAAZgAAABAQEAAAAAAAKAEAAE4DAAAgIAAAAQAIAKgIAAB2BAAAEBAAAAEA + CABoBQAAHg0AACAgAAABACAAqBAAAIYSAAAQEAAAAQAgAGgEAAAuIwAAKAAAACAAAABAAAAAAQAEAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAACAgACAAAAAgACAAICAAACAgIAAwMDAAAAA + /wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIoiI + iIiIiIiIiIiIiIiIiIiCIigiIiIozMzMzMzMyCIogiIoIiIiKM7m5ubm5sgiKIIiKCIiIijObm5ubm7I + IiiCIigiIiIozubm5ubmyCIogiIoIiIiKM5ubm5ubsgiKIIiKCIiIijO5ubm5ubIIiiIiIiIiIiIzm5u + bm5uyCIogRERERERGM7u7u7u7sgiKIHZWVlZWRjMzMzMzMzIIiiB1ZWVlZUYiIiIiIiIiIiIgdlZWVlZ + GDMzMzMzMzMzOIHVlZWVlRg/uLi4uLi4uDiB2VlZWVkYP7uLi4uLi4s4gdWVlZWVGD+4uLi4uLi4OIHZ + WVlZWRg/u4uLi4uLiziB1ZWVlZUYP7i4uLi4uLg4gdlZWVlZGD+7i4uLi4uLOIHVlZWVlRg/uLi4uLi4 + uDiB3d3d3d0YP7uLi4uLi4s4gRERERERGD+4uLi4uLi4OIiIiIiIiIg/u4uLi4uLiziCIiIiIiIoP7i4 + uLi4uLg4giIiIiIiKD+7i4uLi4uLOIIiIiIiIig/uLi4uLi4uDiCIiIiIiIoP7u7u7u7u7s4giIiIiIi + KD//////////OIIiIiIiIigzMzMzMzMzMziIiIiIiIiIiIiIiIiIiIiIIiIiIiIiIiIiIiIiIiIiIv// + ////////AAAAAHv4AA57+AAOe/gADnv4AA57+AAOe/gADgAAAA4AAAAOAAAADgAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/4AAB/+AAAf/gAAH/4AAB/+AAAf/gAAAAA + AAD/////KAAAABAAAAAgAAAAAQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAACA + gACAAAAAgACAAICAAACAgIAAwMDAAAAA/wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAiIiIiIiIiIoiI + iIiIiIiIgigijMzMyCiCKCKM5mbIKIiIiIzu7sgogRERjMzMyCiB2ZGIiIiIiIHZkYMzMzM4gdmRg/u7 + uziB3dGD+7u7OIEREYP7u7s4iIiIg/u7uziCIiKD+7u7OIIiIoP///84giIigzMzMziIiIiIiIiIiP// + KCIAACjObALm5mwCIigAAoiIAAKIzgAAbm4AACIoAAAREQAAGM4AAO7uAAAiKHwAWVl8ABjMfADMzAAA + IigoAAAAIAAAAEAAAAABAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAA + AACAAIAAgIAAAICAgADA3MAA8MqmAKo/KgD/PyoAAF8qAFVfKgCqXyoA/18qAAB/KgBVfyoAqn8qAP9/ + KgAAnyoAVZ8qAKqfKgD/nyoAAL8qAFW/KgCqvyoA/78qAADfKgBV3yoAqt8qAP/fKgAA/yoAVf8qAKr/ + KgD//yoAAABVAFUAVQCqAFUA/wBVAAAfVQBVH1UAqh9VAP8fVQAAP1UAVT9VAKo/VQD/P1UAAF9VAFVf + VQCqX1UA/19VAAB/VQBVf1UAqn9VAP9/VQAAn1UAVZ9VAKqfVQD/n1UAAL9VAFW/VQCqv1UA/79VAADf + VQBV31UAqt9VAP/fVQAA/1UAVf9VAKr/VQD//1UAAAB/AFUAfwCqAH8A/wB/AAAffwBVH38Aqh9/AP8f + fwAAP38AVT9/AKo/fwD/P38AAF9/AFVffwCqX38A/19/AAB/fwBVf38Aqn9/AP9/fwAAn38AVZ9/AKqf + fwD/n38AAL9/AFW/fwCqv38A/79/AADffwBV338Aqt9/AP/ffwAA/38AVf9/AKr/fwD//38AAACqAFUA + qgCqAKoA/wCqAAAfqgBVH6oAqh+qAP8fqgAAP6oAVT+qAKo/qgD/P6oAAF+qAFVfqgCqX6oA/1+qAAB/ + qgBVf6oAqn+qAP9/qgAAn6oAVZ+qAKqfqgD/n6oAAL+qAFW/qgCqv6oA/7+qAADfqgBV36oAqt+qAP/f + qgAA/6oAVf+qAKr/qgD//6oAAADUAFUA1ACqANQA/wDUAAAf1ABVH9QAqh/UAP8f1AAAP9QAVT/UAKo/ + 1AD/P9QAAF/UAFVf1ACqX9QA/1/UAAB/1ABVf9QAqn/UAP9/1AAAn9QAVZ/UAKqf1AD/n9QAAL/UAFW/ + 1ACqv9QA/7/UAADf1ABV39QAqt/UAP/f1AAA/9QAVf/UAKr/1AD//9QAVQD/AKoA/wAAH/8AVR//AKof + /wD/H/8AAD//AFU//wCqP/8A/z//AABf/wBVX/8Aql//AP9f/wAAf/8AVX//AKp//wD/f/8AAJ//AFWf + /wCqn/8A/5//AAC//wBVv/8Aqr//AP+//wAA3/8AVd//AKrf/wD/3/8AVf//AKr//wD/zMwA/8z/AP// + MwD//2YA//+ZAP//zAAAfwAAVX8AAKp/AAD/fwAAAJ8AAFWfAACqnwAA/58AAAC/AABVvwAAqr8AAP+/ + AAAA3wAAVd8AAKrfAAD/3wAAVf8AAKr/AAAAACoAVQAqAKoAKgD/ACoAAB8qAFUfKgCqHyoA/x8qAAA/ + KgBVPyoA8Pv/AKSgoACAgIAAAAD/AAD/AAAA//8A/wAAAAAAAAD//wAA////AP39/f39/f39/f39/f39 + /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39 + /f39/f39/f39/f39/f39/f39/f39/f39qoYIqoYIhqoIqgiqCaoIqgiqhqqGhoYIhoYIqv39/f0I/f39 + /ar9/f39/YY2Ng4yDg4ODgoOCgoKCgqG/f39/Yb9/f39CP39/f39qjY7Ozs3Nzc3NjMSMjIOCqr9/f39 + qv39/f2G/f39/f0IN19fOzs3Nzc3NjcODg4KCP39/f0I/f39/ar9/f39/ao6X19fXzs7Ozc3NzY3NgqG + /f39/Yb9/f39CP39/f39hl9jY19jX187Ozs7Nzc3Dqr9/f39qv39/f2G/f39/f0IOodjh19jX19fXztf + OzcOCP39/f0ICAmqCAiqCKoICapfCYdjh2ODY19fXzs7Ow6q/f39/QhITEwoSCUoKSQoqmMJCYcJCWNj + Y2NfY19fNgj9/f39qkyZmZmYmJRwlCmqX19fXl9fX186WzY3Njc2gv39/f0JcJ2dmZmZlJmUJAmqCaoJ + hggIqggICKoIqggI/f39/YZwnp2dnZmZmJVMqnx8fHx8fFR8VHhUVFRUVKr9/f39CHChoZ2dnZ2ZmUwJ + fKSkxqSkxqSkpKSkpKBUCP39/f2qcKLDoqGdnZ2ZTKp8ysakxqSkxqSkxqSkpFSq/f39/QiUpqbDoqHE + nZ1Mq3ykqMakyqSkxqSkpKSkVAj9/f39hpTIyKbHoqGhoXAIfMrLpMqkxqSkxqTGpKRUqv39/f0IlMym + yKbIpcShcAh8y6jKpMqkxsqkpKSkxlQI/f39/aqUzMzMyKbIpqJwqnzLy8qpxsqkpMakxqSkeAj9/f39 + CJSUlJSUlJSUlJQJgMupy8qpysqkyqSkxqRUqv39/f2GCKoIqgiqCKoIhgigrcvPqcuoy8qkxsqkxnyG + /f39/ar9/f39/f39/f39qnzPz6nLy8uoyqnKpKTKVAj9/f39CP39/f39/f39/f0IfNDPz8+py8upyqjG + yqR8hv39/f2G/f39/f39/f39/Qik0K7P0M+ty8vLy6jKpXyq/f39/ar9/f39/f39/f39CHzQ09Ctz8/P + qcupy6jKeAj9/f39CP39/f39/f39/f2qoNPQ0NPQ0M/Qz8vLy6l8CP39/f2G/f39/f39/f39/QmkfKR8 + oHx8fHx8fHx8fHyG/f39/aoIqgiqCKoIqgiqCKoIqgiqCKoIqgiqCKoIqgj9/f39/f39/f39/f39/f39 + /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f3///////////// + ///AAAAD3vgAA974AAPe+AAD3vgAA974AAPe+AADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAADwAAAA9/4AAPf+AAD3/gAA9/4AAPf+AAD3/gAA8AAAAP//////////ygA + AAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAA + gACAgAAAgICAAMDcwADwyqYAqj8qAP8/KgAAXyoAVV8qAKpfKgD/XyoAAH8qAFV/KgCqfyoA/38qAACf + KgBVnyoAqp8qAP+fKgAAvyoAVb8qAKq/KgD/vyoAAN8qAFXfKgCq3yoA/98qAAD/KgBV/yoAqv8qAP// + KgAAAFUAVQBVAKoAVQD/AFUAAB9VAFUfVQCqH1UA/x9VAAA/VQBVP1UAqj9VAP8/VQAAX1UAVV9VAKpf + VQD/X1UAAH9VAFV/VQCqf1UA/39VAACfVQBVn1UAqp9VAP+fVQAAv1UAVb9VAKq/VQD/v1UAAN9VAFXf + VQCq31UA/99VAAD/VQBV/1UAqv9VAP//VQAAAH8AVQB/AKoAfwD/AH8AAB9/AFUffwCqH38A/x9/AAA/ + fwBVP38Aqj9/AP8/fwAAX38AVV9/AKpffwD/X38AAH9/AFV/fwCqf38A/39/AACffwBVn38Aqp9/AP+f + fwAAv38AVb9/AKq/fwD/v38AAN9/AFXffwCq338A/99/AAD/fwBV/38Aqv9/AP//fwAAAKoAVQCqAKoA + qgD/AKoAAB+qAFUfqgCqH6oA/x+qAAA/qgBVP6oAqj+qAP8/qgAAX6oAVV+qAKpfqgD/X6oAAH+qAFV/ + qgCqf6oA/3+qAACfqgBVn6oAqp+qAP+fqgAAv6oAVb+qAKq/qgD/v6oAAN+qAFXfqgCq36oA/9+qAAD/ + qgBV/6oAqv+qAP//qgAAANQAVQDUAKoA1AD/ANQAAB/UAFUf1ACqH9QA/x/UAAA/1ABVP9QAqj/UAP8/ + 1AAAX9QAVV/UAKpf1AD/X9QAAH/UAFV/1ACqf9QA/3/UAACf1ABVn9QAqp/UAP+f1AAAv9QAVb/UAKq/ + 1AD/v9QAAN/UAFXf1ACq39QA/9/UAAD/1ABV/9QAqv/UAP//1ABVAP8AqgD/AAAf/wBVH/8Aqh//AP8f + /wAAP/8AVT//AKo//wD/P/8AAF//AFVf/wCqX/8A/1//AAB//wBVf/8Aqn//AP9//wAAn/8AVZ//AKqf + /wD/n/8AAL//AFW//wCqv/8A/7//AADf/wBV3/8Aqt//AP/f/wBV//8Aqv//AP/MzAD/zP8A//8zAP// + ZgD//5kA///MAAB/AABVfwAAqn8AAP9/AAAAnwAAVZ8AAKqfAAD/nwAAAL8AAFW/AACqvwAA/78AAADf + AABV3wAAqt8AAP/fAABV/wAAqv8AAAAAKgBVACoAqgAqAP8AKgAAHyoAVR8qAKofKgD/HyoAAD8qAFU/ + KgDw+/8ApKCgAICAgAAAAP8AAP8AAAD//wD/AAAAAAAAAP//AAD///8A/f39/f39/f39/f39/f39/f0I + hgiqCKoICKoICKaGCP39qv39hv2GNg4ODjII/ar9/Yb9/ar9qjdjXzsOCP2G/f0IhquGCAleCWNfNob9 + qv39qkxMTEgIX19fX18I/Qj9/QhwnZlMqoYIqggIqgiG/f2qcKadcAl8fFQDVFQDqv39CHDMpnCqfMvL + ysrKVAj9/QiUlHBwCYDPy8/LylSG/f2GqoYIqgig0M/Py8t8qv39CP39/f2GpNDQ0M/PfAn9/ar9/f39 + qqT20NDQ0Hyq/f2G/f39/QmkpKSloKR8CP39CKoIhgiqCIYIqgiGCKr9/f39/f39/f39/f39/f39/f// + hv2AAf0ItAX9/bQFX2OABWNfgAU7O4ABNzeAAf39gAGq/YAB/YaAAf39vAE6h7wBX2O8AV9fgAE7N/// + /f0oAAAAIAAAAEAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAADCv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAA + AAAAAAAAwr/B/7Z3Sf+zckT/rm0//6toO/+nYjb/pF4y/6BZLv+dVCr/mlEn/5dNI/+VSiH/kkce/5FE + HP+RRBz/kUUb/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/AAAAAAAA + AAAAAAAAAAAAAAAAAADCv8H/v4JS//+aZv//lWD/+5Bc//WLV//uh1P/54FO/997S//Wdkb/zXBD/8Vr + QP+9Zj3/tGI5/65dN/+RRRz/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/AAAAAAAAAAAAAAAAAAAAAMK/ + wf8AAAAAAAAAAAAAAAAAAAAAAAAAAMK/wf/GjFv//6Rz//+fbf//m2f//5Zh//yRXf/3jVj/8IhV/+mD + UP/hfUz/2HhI/9ByRP/HbED/v2c9/5VJIf/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAA + AAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAAAAAAAAAAwr/B/86WZP//r4L//6p7//+mdf//oW7//5xo//+X + Yv/9kl7/+I5a//KJVf/rhFH/4n5N/9t4SP/Sc0X/mlEm/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAA + AAAAAAAAAAAAAAAAAADCv8H/AAAAAAAAAAAAAAAAAAAAAAAAAADCv8H/1J9s//+4kf//tIv//6+E//+r + ff//p3f//6Jw//+eav//mWT//pRf//qQWv/0i1b/7IVS/+V/Tv+gWC7/wr/B/wAAAAAAAAAAAAAAAAAA + AADCv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAAAAAAMK/wf/apnP//7+d//+7 + mP//uJL//7WM//+whv//rH///6d4//+jcf//n2v//5ll//+VYP/6kVv/9YxY/6diN//Cv8H/AAAAAAAA + AAAAAAAAAAAAAMK/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/96t + eP//wqL//8Gi//+/nv//vJn//7mT//+2jv//sYj//66A//+pev//pHP//6Bt//+bZ///l2L/r20//8K/ + wf8AAAAAAAAAAAAAAAAAAAAAwr/B/xYXev8XF3b/GBVx/xkUbf8ZFGr/GhNm/xoSY/8bEV//HBFd/xwQ + W//Cv8H/4K96///Cov//wqL//8Ki///Cov//wJ///72b//+6lf//t4///7KJ//+ugv//qnv//6V0//+h + bv+3d0n/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/FRqE/0dN1v8/RNL/Nz3Q/y40zv8nLcz/ISfK/xwh + yf8WHMf/GxJh/8K/wf/gr3r/4K96/+Cvev/gr3r/3614/9yqdf/apnL/16Nw/9Sea//Rmmj/zZZk/8qR + X//GjFz/w4dW/7+CUv/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8SHZD/WF3a/05U1/9FS9X/PUPS/zU7 + 0P8uM83/JyzL/yAmyf8aFGn/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/xAfnP9obt7/YGTc/1Zb + 2f9NU9f/RUrU/ztB0v80OdD/LDHO/xgWcv/Cv8H/Dn+n/w18pP8MeqH/DHie/wt1m/8Kc5j/CXGV/wlv + k/8JbJD/CGqN/wdpi/8HZ4j/BmWH/wZkhf8GYoP/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/DiKp/3l+ + 4/9vdeH/Zmze/11i2/9UWtn/S1HW/0NI1P86P9H/Fhh9/8K/wf8Ogar/Barp/wGo6P8Apef/AKPm/wCi + 5P8An+L/AJ7h/wCd3/8AnN7/AJnc/wCY2/8AmNn/AJbX/wZjhP/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/ + wf8MJbX/iI7n/4CF5v93fOP/bnPg/2Vr3f9bYdv/UljY/0lP1v8UGoj/wr/B/w+Erf8Lrur/Bqvq/wOo + 6f8Apuf/AKTm/wCi5f8AoOT/AJ/i/wCd4f8AnN//AJrd/wCZ2/8AmNr/BmWH/8K/wf8AAAAAAAAAAAAA + AAAAAAAAwr/B/wkowP+WnOz/jpTq/4aL6P9+hOX/dXri/2xx4P9jaN3/WV/b/xEek//Cv8H/EIaw/xay + 7P8Or+z/Cavr/wWq6v8Bp+j/AKbn/wCj5f8AoeT/AJ/j/wCe4f8AnOD/AJve/wCa3f8HZ4n/wr/B/wAA + AAAAAAAAAAAAAAAAAADCv8H/CCrK/6Ko7/+coe7/lZrr/42T6f+Fiub/fIHl/3N54v9rcN//ECGg/8K/ + wf8QiLP/I7nu/xq07f8Ssez/C63r/war6v8Cqen/AKbo/wCk5v8AouX/AKHk/wCf4f8AneH/AJzf/who + i//Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8GLNP/q7Hy/6as8P+hpu//mp/u/5OY6/+LkOj/g4nm/3qA + 5P8NI6z/wr/B/xCKtv8xvvD/J7rv/x627f8Vsuz/Dq/s/wmr6/8Equn/Aafo/wCl5/8Ao+X/AKHk/wCf + 4v8AnuH/CGqO/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wUu2/+vtPP/r7Tz/6qv8v+mq/D/oKXv/5me + 7f+Sl+v/io/p/wsmt//Cv8H/Eo24/0HF8f82wfD/LLzv/yK47v8atO3/EbHs/wut6/8Gq+r/A6np/wCm + 6P8Apeb/AKLl/wCh5P8IbJD/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/BC/h/wQv3/8FL9z/BS3Z/wYt + 1v8GLNL/ByvP/wgqy/8IKcb/CSnC/8K/wf8Sjrv/Uszy/0fH8f87w/H/Mb7v/ye67/8et+7/FbPt/w6v + 6/8IrOv/BKnp/wGo6P8Apef/AKPl/wluk//Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/xKRvf9j0/P/WM/z/0zK8f9BxfH/N8Hw/yy8 + 7/8iuO7/GbTt/xGx7P8Lruv/Bqrq/wOo6f8Apuf/CnGV/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADCv8H/E5LA/3Ta8/9q1fP/XtHz/1LM + 8v9Hx/H/O8Pw/zG+7/8nu+//Hrbt/xay7f8Or+v/CKzq/wSq6f8Kc5j/wr/B/wAAAAAAAAAAAAAAAAAA + AADCv8H/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMK/wf8UlMH/hOD1/3rc + 9f9v2PP/ZNTy/1jO8v9NyvH/Qsbx/zbB8P8svO//I7ju/xm07f8SsOz/C67r/wt2m//Cv8H/AAAAAAAA + AAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwr/B/xSW + w/+T5vb/iuL1/3/e9P912vT/adbz/13R8/9SzPL/R8jx/zzD8P8xvvD/J7rv/x627v8Vsuz/C3ie/8K/ + wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AADCv8H/FJbG/57r9/+X6Pb/juT1/4Th9f963fX/b9j0/2PT8/9Yz/L/TMrx/0HF8f83wO//LLzv/yK4 + 7v8MeqH/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAMK/wf8VmMf/qO/3/6Lt9/+b6vb/kub2/4rj9f9/3vX/dNrz/2rV8/9d0fP/Uszy/0fI + 8f88w/D/Mr7v/w19pP/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAwr/B/xWZyP8UmMf/FZfF/xSVw/8TlML/E5K//xOQvf8Sjrv/EYy4/xGK + tv8QiLL/D4Ww/w+Erf8Pgar/Dn+n/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP// + /////////////8AAAAPe+AAD3vgAA974AAPe+AAD3vgAA974AAPAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAAD3/gAA9/4AAPf+AAD3/gAA9/4AAPf+AADwAAAA/// + ////////KAAAABAAAAAgAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwMDA/8DA + wP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP8AAAAAAAAAAMDA + wP8AAAAAAAAAAMDAwP8AAAAAwMDA/8F2R/+9bj//umc6/7diNf+3YjX/wMDA/wAAAADAwMD/AAAAAAAA + AADAwMD/AAAAAAAAAADAwMD/AAAAAMDAwP/RkmD//7aP//+ldP/8kl3/vW0//8DAwP8AAAAAwMDA/wAA + AAAAAAAAwMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/3ap2///Cov//to7//6V0/8uJWP/AwMD/AAAAAMDA + wP8AAAAAAAAAAMDAwP8THI7/FBqF/xYYfP8XFnP/wMDA/+Cvev/gr3r/4K96/92qdv/ao3D/wMDA/wAA + AADAwMD/AAAAAAAAAADAwMD/ECCd/2Fn3P8zOc//FRmC/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DA + wP/AwMD/wMDA/wAAAAAAAAAAwMDA/w0krP+Pler/YWbd/xIcj//AwMD/DHmf/wpzmP8Ib5L/B2uO/wdq + jf8Gao3/B2qN/8DAwP8AAAAAAAAAAMDAwP8KJrv/r7Tz/5CU6v8PIJ//wMDA/w+Dq/87y/z/Kcb8/xrD + /P8QwPv/EMD7/wdqjf/AwMD/AAAAAAAAAADAwMD/CCrI/woowP8LJrf/DSSu/8DAwP8Sjbj/Zdb9/0/Q + /P88y/v/Kcf7/xrC+/8IbZD/wMDA/wAAAAAAAAAAwMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/FpfG/43h + /f962/3/Zdb8/0/Q/P87zPz/CXSZ/8DAwP8AAAAAAAAAAMDAwP8AAAAAAAAAAAAAAAAAAAAAwMDA/xif + z/+u6f7/n+X9/47h/f953P3/ZNb9/w19pP/AwMD/AAAAAAAAAADAwMD/AAAAAAAAAAAAAAAAAAAAAMDA + wP8apNX/uez+/7ns/v+u6f7/oOX9/43h/f8Rh7H/wMDA/wAAAAAAAAAAwMDA/wAAAAAAAAAAAAAAAAAA + AADAwMD/GqTV/xqk1f8apNX/GaHR/xecy/8WmMb/FJK+/8DAwP8AAAAAAAAAAMDAwP/AwMD/wMDA/8DA + wP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/AAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAAgAEAALQF + wf+0BQAAgAUAAIAFAACAAQAAgAHB/4ABAACAAQAAgAEAALwBAAC8AQAAvAHB/4ABbP///5H/ + + + + 168 + + \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/Forms/Database.cs b/MgdDbgLibrary/Snoop/Forms/Database.cs new file mode 100644 index 0000000..3dbde29 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/Database.cs @@ -0,0 +1,919 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Diagnostics; +using Autodesk.AutoCAD.DatabaseServices; +using MgdDbg.CompBuilder; +using AcDb = Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.Snoop.Forms +{ + /// + /// This is a tabbed form that has all the information that can appear in an AcDbDatabase. + /// It is divided into 3 pages (Symbol Tables, Dictionaries, and Other Database Data). + /// + public class Database : System.Windows.Forms.Form + { + private System.Windows.Forms.Button m_bnOk; + private System.Windows.Forms.TabControl m_tabCtrl; + private System.Windows.Forms.TabPage m_tabSymTbls; + private System.Windows.Forms.TabPage m_tabDicts; + private System.Windows.Forms.TabPage m_tabDatabase; + private System.Windows.Forms.TreeView m_tvSymTbls; + private System.Windows.Forms.ListView m_lvSymTbl; + private System.Windows.Forms.ColumnHeader m_colSymTblField; + private System.Windows.Forms.ColumnHeader m_colSymTblValue; + private System.Windows.Forms.TreeView m_tvDicts; + private System.Windows.Forms.ListView m_lvDict; + private System.Windows.Forms.ColumnHeader m_colDictField; + private System.Windows.Forms.ColumnHeader m_colDictValue; + private System.Windows.Forms.ListView m_lvDb; + private System.Windows.Forms.ColumnHeader m_colDbField; + private System.Windows.Forms.ColumnHeader m_colDbValue; + private System.Windows.Forms.ContextMenu m_cntxMenuObjId; + private System.Windows.Forms.MenuItem m_mnuItemObjectDbInfo; + private System.Windows.Forms.MenuItem m_mnuItemBrowseReflection; + private System.Windows.Forms.MenuItem m_mnuItemSeparator1; + private System.Windows.Forms.MenuItem m_mnuItemAddToSnoopObjSet; + private System.Windows.Forms.MenuItem m_mnuItemRemoveFromSnoopObjSet; + private System.Windows.Forms.MenuItem m_mnuItemShowSnoopObjSet; + + private Snoop.Collectors.Objects m_snoopCollector = new Snoop.Collectors.Objects(); + private AcDb.Database m_db = null; + private bool m_dictTabInited = false; + private bool m_dbTabInited = false; + private AcDb.ObjectId m_curObjId; + private TransactionHelper m_trans = null; + private ContextMenuStrip listViewContextMenuStrip; + private ToolStripMenuItem copyToolStripMenuItem; + private MenuItem m_mnuItemCopy; + private ToolStrip toolStrip1; + private ToolStripButton toolStripButton1; + private ToolStripButton toolStripButton2; + private PrintDialog m_printDialog; + private System.Drawing.Printing.PrintDocument m_printDocument; + private PrintPreviewDialog m_printPreviewDialog; + private IContainer components; + private Int32[] m_maxWidths; + private Int32 m_currentPrintItem = 0; + private ToolStripButton toolStripButton3; + private String selectedTab = "SymTbl"; + + public + Database(AcDb.Database db, TransactionHelper tr) + { + m_db = db; + m_trans = tr; + + InitializeComponent(); + + // We could initialize all the tabs here, but just for fun, we + // will do delayed-initialization on the other two tabs. This will + // help us out in cases where we have a lot of data on each tab to show. + InitSymbolTableTab(); + } + + + /// + /// Clean up any resources being used. + /// + protected override void + Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Database)); + this.m_bnOk = new System.Windows.Forms.Button(); + this.m_tabCtrl = new System.Windows.Forms.TabControl(); + this.m_tabSymTbls = new System.Windows.Forms.TabPage(); + this.m_lvSymTbl = new System.Windows.Forms.ListView(); + this.m_colSymTblField = new System.Windows.Forms.ColumnHeader(); + this.m_colSymTblValue = new System.Windows.Forms.ColumnHeader(); + this.listViewContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.m_tvSymTbls = new System.Windows.Forms.TreeView(); + this.m_cntxMenuObjId = new System.Windows.Forms.ContextMenu(); + this.m_mnuItemCopy = new System.Windows.Forms.MenuItem(); + this.m_mnuItemObjectDbInfo = new System.Windows.Forms.MenuItem(); + this.m_mnuItemBrowseReflection = new System.Windows.Forms.MenuItem(); + this.m_mnuItemSeparator1 = new System.Windows.Forms.MenuItem(); + this.m_mnuItemAddToSnoopObjSet = new System.Windows.Forms.MenuItem(); + this.m_mnuItemRemoveFromSnoopObjSet = new System.Windows.Forms.MenuItem(); + this.m_mnuItemShowSnoopObjSet = new System.Windows.Forms.MenuItem(); + this.m_tabDicts = new System.Windows.Forms.TabPage(); + this.m_lvDict = new System.Windows.Forms.ListView(); + this.m_colDictField = new System.Windows.Forms.ColumnHeader(); + this.m_colDictValue = new System.Windows.Forms.ColumnHeader(); + this.m_tvDicts = new System.Windows.Forms.TreeView(); + this.m_tabDatabase = new System.Windows.Forms.TabPage(); + this.m_lvDb = new System.Windows.Forms.ListView(); + this.m_colDbField = new System.Windows.Forms.ColumnHeader(); + this.m_colDbValue = new System.Windows.Forms.ColumnHeader(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); + this.m_printDialog = new System.Windows.Forms.PrintDialog(); + this.m_printDocument = new System.Drawing.Printing.PrintDocument(); + this.m_printPreviewDialog = new System.Windows.Forms.PrintPreviewDialog(); + this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); + this.m_tabCtrl.SuspendLayout(); + this.m_tabSymTbls.SuspendLayout(); + this.listViewContextMenuStrip.SuspendLayout(); + this.m_tabDicts.SuspendLayout(); + this.m_tabDatabase.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // m_bnOk + // + this.m_bnOk.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnOk.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOk.Location = new System.Drawing.Point(374, 531); + this.m_bnOk.Name = "m_bnOk"; + this.m_bnOk.Size = new System.Drawing.Size(75, 23); + this.m_bnOk.TabIndex = 0; + this.m_bnOk.Text = "OK"; + // + // m_tabCtrl + // + this.m_tabCtrl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_tabCtrl.Controls.Add(this.m_tabSymTbls); + this.m_tabCtrl.Controls.Add(this.m_tabDicts); + this.m_tabCtrl.Controls.Add(this.m_tabDatabase); + this.m_tabCtrl.Location = new System.Drawing.Point(20, 37); + this.m_tabCtrl.Name = "m_tabCtrl"; + this.m_tabCtrl.SelectedIndex = 0; + this.m_tabCtrl.ShowToolTips = true; + this.m_tabCtrl.Size = new System.Drawing.Size(800, 488); + this.m_tabCtrl.TabIndex = 1; + this.m_tabCtrl.SelectedIndexChanged += new System.EventHandler(this.TabSelected); + // + // m_tabSymTbls + // + this.m_tabSymTbls.Controls.Add(this.m_lvSymTbl); + this.m_tabSymTbls.Controls.Add(this.m_tvSymTbls); + this.m_tabSymTbls.Location = new System.Drawing.Point(4, 22); + this.m_tabSymTbls.Name = "m_tabSymTbls"; + this.m_tabSymTbls.Size = new System.Drawing.Size(792, 462); + this.m_tabSymTbls.TabIndex = 0; + this.m_tabSymTbls.Text = "Symbol Tables"; + // + // m_lvSymTbl + // + this.m_lvSymTbl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_lvSymTbl.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_colSymTblField, + this.m_colSymTblValue}); + this.m_lvSymTbl.ContextMenuStrip = this.listViewContextMenuStrip; + this.m_lvSymTbl.FullRowSelect = true; + this.m_lvSymTbl.GridLines = true; + this.m_lvSymTbl.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvSymTbl.HideSelection = false; + this.m_lvSymTbl.Location = new System.Drawing.Point(293, 16); + this.m_lvSymTbl.MultiSelect = false; + this.m_lvSymTbl.Name = "m_lvSymTbl"; + this.m_lvSymTbl.ShowItemToolTips = true; + this.m_lvSymTbl.Size = new System.Drawing.Size(496, 432); + this.m_lvSymTbl.TabIndex = 1; + this.m_lvSymTbl.UseCompatibleStateImageBehavior = false; + this.m_lvSymTbl.View = System.Windows.Forms.View.Details; + this.m_lvSymTbl.DoubleClick += new System.EventHandler(this.DataItemSelected); + this.m_lvSymTbl.Click += new System.EventHandler(this.DataItemSelected); + // + // m_colSymTblField + // + this.m_colSymTblField.Text = "Field"; + this.m_colSymTblField.Width = 200; + // + // m_colSymTblValue + // + this.m_colSymTblValue.Text = "Value"; + this.m_colSymTblValue.Width = 300; + // + // listViewContextMenuStrip + // + this.listViewContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.copyToolStripMenuItem}); + this.listViewContextMenuStrip.Name = "listViewContextMenuStrip"; + this.listViewContextMenuStrip.Size = new System.Drawing.Size(100, 26); + // + // copyToolStripMenuItem + // + this.copyToolStripMenuItem.Image = global::MgdDbg.Properties.Resources.COPY1; + this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; + this.copyToolStripMenuItem.Size = new System.Drawing.Size(99, 22); + this.copyToolStripMenuItem.Text = "Copy"; + this.copyToolStripMenuItem.Click += new System.EventHandler(this.CopyToolStripMenuItem_Click); + // + // m_tvSymTbls + // + this.m_tvSymTbls.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.m_tvSymTbls.ContextMenu = this.m_cntxMenuObjId; + this.m_tvSymTbls.HideSelection = false; + this.m_tvSymTbls.Location = new System.Drawing.Point(16, 16); + this.m_tvSymTbls.Name = "m_tvSymTbls"; + this.m_tvSymTbls.ShowNodeToolTips = true; + this.m_tvSymTbls.Size = new System.Drawing.Size(256, 432); + this.m_tvSymTbls.TabIndex = 0; + this.m_tvSymTbls.NodeMouseClick += new TreeNodeMouseClickEventHandler(this.TreeNodeSelected); + this.m_tvSymTbls.AfterSelect += new TreeViewEventHandler(this.TreeNodeSelected); + // + // m_cntxMenuObjId + // + this.m_cntxMenuObjId.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.m_mnuItemCopy, + this.m_mnuItemObjectDbInfo, + this.m_mnuItemBrowseReflection, + this.m_mnuItemSeparator1, + this.m_mnuItemAddToSnoopObjSet, + this.m_mnuItemRemoveFromSnoopObjSet, + this.m_mnuItemShowSnoopObjSet}); + this.m_cntxMenuObjId.Popup += new System.EventHandler(this.OnContextMenuPopup); + // + // m_mnuItemCopy + // + this.m_mnuItemCopy.Index = 0; + this.m_mnuItemCopy.Text = "Copy"; + this.m_mnuItemCopy.Click += new System.EventHandler(this.ContextMenuClick_Copy); + // + // m_mnuItemObjectDbInfo + // + this.m_mnuItemObjectDbInfo.Index = 1; + this.m_mnuItemObjectDbInfo.Text = "Show ObjectID Info..."; + this.m_mnuItemObjectDbInfo.Click += new System.EventHandler(this.ContextMenuClick_ObjIdInfo); + // + // m_mnuItemBrowseReflection + // + this.m_mnuItemBrowseReflection.Index = 2; + this.m_mnuItemBrowseReflection.Text = "Browse Using Reflection..."; + this.m_mnuItemBrowseReflection.Click += new System.EventHandler(this.ContextMenuClick_BrowseReflection); + // + // m_mnuItemSeparator1 + // + this.m_mnuItemSeparator1.Index = 3; + this.m_mnuItemSeparator1.Text = "-"; + // + // m_mnuItemAddToSnoopObjSet + // + this.m_mnuItemAddToSnoopObjSet.Index = 4; + this.m_mnuItemAddToSnoopObjSet.Text = "Add To Snoop Object Set"; + this.m_mnuItemAddToSnoopObjSet.Click += new System.EventHandler(this.ContextMenuClick_AddToSnoopObjSet); + // + // m_mnuItemRemoveFromSnoopObjSet + // + this.m_mnuItemRemoveFromSnoopObjSet.Index = 5; + this.m_mnuItemRemoveFromSnoopObjSet.Text = "Remove From Snoop Object Set"; + this.m_mnuItemRemoveFromSnoopObjSet.Click += new System.EventHandler(this.ContextMenuClick_RemoveFromSnoopObjSet); + // + // m_mnuItemShowSnoopObjSet + // + this.m_mnuItemShowSnoopObjSet.Index = 6; + this.m_mnuItemShowSnoopObjSet.Text = "Show Snoop Object Set..."; + this.m_mnuItemShowSnoopObjSet.Click += new System.EventHandler(this.ContextMenuClick_ShowSnoopObjSet); + // + // m_tabDicts + // + this.m_tabDicts.Controls.Add(this.m_lvDict); + this.m_tabDicts.Controls.Add(this.m_tvDicts); + this.m_tabDicts.Location = new System.Drawing.Point(4, 22); + this.m_tabDicts.Name = "m_tabDicts"; + this.m_tabDicts.Size = new System.Drawing.Size(792, 462); + this.m_tabDicts.TabIndex = 1; + this.m_tabDicts.Text = "Dictionaries"; + // + // m_lvDict + // + this.m_lvDict.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_lvDict.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_colDictField, + this.m_colDictValue}); + this.m_lvDict.ContextMenuStrip = this.listViewContextMenuStrip; + this.m_lvDict.FullRowSelect = true; + this.m_lvDict.GridLines = true; + this.m_lvDict.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvDict.HideSelection = false; + this.m_lvDict.Location = new System.Drawing.Point(288, 16); + this.m_lvDict.MultiSelect = false; + this.m_lvDict.Name = "m_lvDict"; + this.m_lvDict.ShowItemToolTips = true; + this.m_lvDict.Size = new System.Drawing.Size(496, 432); + this.m_lvDict.TabIndex = 3; + this.m_lvDict.UseCompatibleStateImageBehavior = false; + this.m_lvDict.View = System.Windows.Forms.View.Details; + this.m_lvDict.DoubleClick += new System.EventHandler(this.DataItemSelected); + this.m_lvDict.Click += new System.EventHandler(this.DataItemSelected); + // + // m_colDictField + // + this.m_colDictField.Text = "Field"; + this.m_colDictField.Width = 200; + // + // m_colDictValue + // + this.m_colDictValue.Text = "Value"; + this.m_colDictValue.Width = 300; + // + // m_tvDicts + // + this.m_tvDicts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.m_tvDicts.ContextMenu = this.m_cntxMenuObjId; + this.m_tvDicts.FullRowSelect = true; + this.m_tvDicts.HideSelection = false; + this.m_tvDicts.Location = new System.Drawing.Point(16, 16); + this.m_tvDicts.Name = "m_tvDicts"; + this.m_tvDicts.ShowNodeToolTips = true; + this.m_tvDicts.Size = new System.Drawing.Size(256, 432); + this.m_tvDicts.TabIndex = 2; + this.m_tvDicts.NodeMouseClick += new TreeNodeMouseClickEventHandler(this.TreeNodeSelected); + this.m_tvDicts.AfterSelect += new TreeViewEventHandler(this.TreeNodeSelected); + // + // m_tabDatabase + // + this.m_tabDatabase.Controls.Add(this.m_lvDb); + this.m_tabDatabase.Location = new System.Drawing.Point(4, 22); + this.m_tabDatabase.Name = "m_tabDatabase"; + this.m_tabDatabase.Size = new System.Drawing.Size(792, 462); + this.m_tabDatabase.TabIndex = 2; + this.m_tabDatabase.Text = "Database"; + // + // m_lvDb + // + this.m_lvDb.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_lvDb.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_colDbField, + this.m_colDbValue}); + this.m_lvDb.ContextMenuStrip = this.listViewContextMenuStrip; + this.m_lvDb.FullRowSelect = true; + this.m_lvDb.GridLines = true; + this.m_lvDb.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvDb.Location = new System.Drawing.Point(16, 15); + this.m_lvDb.MultiSelect = false; + this.m_lvDb.Name = "m_lvDb"; + this.m_lvDb.ShowItemToolTips = true; + this.m_lvDb.Size = new System.Drawing.Size(760, 432); + this.m_lvDb.TabIndex = 4; + this.m_lvDb.UseCompatibleStateImageBehavior = false; + this.m_lvDb.View = System.Windows.Forms.View.Details; + this.m_lvDb.DoubleClick += new System.EventHandler(this.DataItemSelected); + this.m_lvDb.Click += new System.EventHandler(this.DataItemSelected); + // + // m_colDbField + // + this.m_colDbField.Text = "Field"; + this.m_colDbField.Width = 300; + // + // m_colDbValue + // + this.m_colDbValue.Text = "Value"; + this.m_colDbValue.Width = 500; + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButton1, + this.toolStripButton2, + this.toolStripButton3}); + this.toolStrip1.Location = new System.Drawing.Point(0, 0); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(832, 25); + this.toolStrip1.TabIndex = 2; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripButton1 + // + this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton1.Image = global::MgdDbg.Properties.Resources.Print1; + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(23, 22); + this.toolStripButton1.Text = "Print"; + this.toolStripButton1.Click += new System.EventHandler(this.PrintMenuItem_Click); + // + // toolStripButton2 + // + this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton2.Image = global::MgdDbg.Properties.Resources.Preview1; + this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton2.Name = "toolStripButton2"; + this.toolStripButton2.Size = new System.Drawing.Size(23, 22); + this.toolStripButton2.Text = "Print Preview"; + this.toolStripButton2.Click += new System.EventHandler(this.PrintPreviewMenuItem_Click); + // + // m_printDialog + // + this.m_printDialog.Document = this.m_printDocument; + this.m_printDialog.UseEXDialog = true; + // + // m_printDocument + // + this.m_printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.PrintDocument_PrintPage); + // + // m_printPreviewDialog + // + this.m_printPreviewDialog.AutoScrollMargin = new System.Drawing.Size(0, 0); + this.m_printPreviewDialog.AutoScrollMinSize = new System.Drawing.Size(0, 0); + this.m_printPreviewDialog.ClientSize = new System.Drawing.Size(400, 300); + this.m_printPreviewDialog.Document = this.m_printDocument; + this.m_printPreviewDialog.Enabled = true; + this.m_printPreviewDialog.Icon = ((System.Drawing.Icon)(resources.GetObject("m_printPreviewDialog.Icon"))); + this.m_printPreviewDialog.Name = "m_printPreviewDialog"; + this.m_printPreviewDialog.Visible = false; + // + // toolStripButton3 + // + this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton3.Image = global::MgdDbg.Properties.Resources.COPY1; + this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton3.Name = "toolStripButton3"; + this.toolStripButton3.Size = new System.Drawing.Size(23, 22); + this.toolStripButton3.Text = "Copy To Clipboard"; + this.toolStripButton3.Click += new System.EventHandler(this.ContextMenuClick_Copy); + // + // Database + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(832, 559); + this.Controls.Add(this.toolStrip1); + this.Controls.Add(this.m_tabCtrl); + this.Controls.Add(this.m_bnOk); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(720, 250); + this.Name = "Database"; + this.Text = "Snoop Database"; + this.m_tabCtrl.ResumeLayout(false); + this.m_tabSymTbls.ResumeLayout(false); + this.listViewContextMenuStrip.ResumeLayout(false); + this.m_tabDicts.ResumeLayout(false); + this.m_tabDatabase.ResumeLayout(false); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + #endregion + + /// + /// Collect all the Symbol Table information and populate the tree control + /// + + private void + InitSymbolTableTab() + { + m_tvSymTbls.BeginUpdate(); + + AddSymbolTableToTree("Block Table", m_db.BlockTableId); + AddSymbolTableToTree("Dimension Style Table", m_db.DimStyleTableId); + AddSymbolTableToTree("Layer Table", m_db.LayerTableId); + AddSymbolTableToTree("Linetype Table", m_db.LinetypeTableId); + AddSymbolTableToTree("Reg App Table", m_db.RegAppTableId); + AddSymbolTableToTree("Text Style Table", m_db.TextStyleTableId); + AddSymbolTableToTree("View Table", m_db.ViewTableId); + AddSymbolTableToTree("Viewport Table", m_db.ViewportTableId); + AddSymbolTableToTree("UCS Table", m_db.UcsTableId); + + m_tvSymTbls.Sorted = true; + m_tvSymTbls.SelectedNode = m_tvSymTbls.Nodes[0]; + + m_tvSymTbls.EndUpdate(); + } + + /// + /// Add a single Symbol Table to the tree and iterate over all its SymbolTableRecords, + /// adding each one of them as a sub-node + /// + /// Name of the table + /// ObjectId of the table + + private void + AddSymbolTableToTree(string tblName, AcDb.ObjectId tblId) + { + AcDb.DBObject tmpObj = m_trans.Transaction.GetObject(tblId, OpenMode.ForRead); + SymbolTable tbl = tmpObj as SymbolTable; + if (tbl != null) { + TreeNode mainTblNode = new TreeNode(tblName); + mainTblNode.Tag = tblId; + m_tvSymTbls.Nodes.Add(mainTblNode); + + // iterate over each TblRec in the SymbolTable + foreach (AcDb.ObjectId tblRecId in tbl) { + TreeNode recNode = new TreeNode(m_trans.SymbolIdToName(tblRecId)); + recNode.Tag = tblRecId; + mainTblNode.Nodes.Add(recNode); + } + } + } + + /// + /// Recursively iterate through all the dictionaries that are under the + /// root "Named Objects Dictionary". + /// + private void + InitDictionariesTab() + { + m_tvDicts.BeginUpdate(); + + TreeNode rootNode = new TreeNode("Named Objects Dictionary"); + rootNode.Tag = m_db.NamedObjectsDictionaryId; + m_tvDicts.Nodes.Add(rootNode); + + AddDictionaryToTree(m_db.NamedObjectsDictionaryId, rootNode, m_trans.Transaction); + + m_tvDicts.Sorted = true; + rootNode.Expand(); + m_tvDicts.SelectedNode = m_tvDicts.Nodes[0]; + + m_tvDicts.EndUpdate(); + } + + private void + AddDictionaryToTree(AcDb.ObjectId dictId, TreeNode parentNode, Transaction tr) + { + // NOTE: when recursively processing items in a dictionary + // we may encounter things that are not derived from DBDictionary. + // In that case, the cast to type DBDictionary will fail and + // we'll just return without adding any nested items. + AcDb.DBObject tmpObj = tr.GetObject(dictId, OpenMode.ForRead); + DBDictionary dbDict = tmpObj as DBDictionary; + if (dbDict != null) { + foreach (DictionaryEntry curEntry in dbDict) { + TreeNode newNode = new TreeNode((string)curEntry.Key); + newNode.Tag = curEntry.Value; + parentNode.Nodes.Add(newNode); + + // if this is a dictionary, it will recursively add + // all of its children to the tree + AddDictionaryToTree((AcDb.ObjectId)curEntry.Value, newNode, tr); + } + } + } + + /// + /// Get all the data that is directly accessible from a Database + /// + private void + InitDatabaseTab() + { + m_lvDb.BeginUpdate(); + + m_snoopCollector.Collect(m_db); + Snoop.Utils.Display(m_lvDb, m_snoopCollector); + + m_lvDb.EndUpdate(); + } + + #region Events + private void + TreeNodeSelected (object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs e) + { + // this call back is used for both the SymTbl and Dict tab pages, + // but we need to know which so we can use the correct ListView + // control. + ListView lvCur = null; + if (sender == m_tvSymTbls) + lvCur = m_lvSymTbl; + else if (sender == m_tvDicts) + lvCur = m_lvDict; + else + Debug.Assert(false); // Why not? + + m_curObjId = (AcDb.ObjectId)e.Node.Tag; + + + AcDb.DBObject dbObj = m_trans.Transaction.GetObject(m_curObjId, OpenMode.ForRead); + + // collect all the data about the object + m_snoopCollector.Collect(dbObj); + + // now display it + Snoop.Utils.Display(lvCur, m_snoopCollector); + } + + private void + TreeNodeSelected (object sender, System.Windows.Forms.TreeViewEventArgs e) + { + // this call back is used for both the SymTbl and Dict tab pages, + // but we need to know which so we can use the correct ListView + // control. + ListView lvCur = null; + if (sender == m_tvSymTbls) + lvCur = m_lvSymTbl; + else if (sender == m_tvDicts) + lvCur = m_lvDict; + else + Debug.Assert(false); // Why not? + + m_curObjId = (AcDb.ObjectId)e.Node.Tag; + + + AcDb.DBObject dbObj = m_trans.Transaction.GetObject(m_curObjId, OpenMode.ForRead); + + // collect all the data about the object + m_snoopCollector.Collect(dbObj); + + // now display it + Snoop.Utils.Display(lvCur, m_snoopCollector); + } + + private void + DataItemSelected(object sender, System.EventArgs e) + { + ListView lvCur = sender as ListView; // which ListView sent us this? + + Snoop.Utils.DataItemSelected(lvCur); + } + + /// + /// Handle delayed initialization of non-current tabs. In other words, + /// they aren't initialized unless they are actually selected. + /// + /// + /// + + private void + TabSelected(object sender, System.EventArgs e) + { + TabControl tabCtrl = (TabControl)sender; + + if (tabCtrl.SelectedTab == m_tabSymTbls) { + ; // we've already inited in the constructor, so do nothing + selectedTab = "SymTbl"; + } + else if (tabCtrl.SelectedTab == m_tabDicts) { + if (m_dictTabInited == false) { + m_dictTabInited = true; + InitDictionariesTab(); + } + selectedTab = "Dict"; + } + else if (tabCtrl.SelectedTab == m_tabDatabase) { + if (m_dbTabInited == false) { + m_dbTabInited = true; + InitDatabaseTab(); + } + selectedTab = "Db"; + } + else + Debug.Assert(false); + } + + + #region TreeView Context Menu Events + /// + /// + /// + /// + /// + private void + ContextMenuClick_ObjIdInfo(object sender, System.EventArgs e) + { + Snoop.Utils.ShowObjIdInfo(m_curObjId); + } + + + /// + /// + /// + /// + /// + private void + ContextMenuClick_Copy (object sender, System.EventArgs e) + { + if (selectedTab == "Dict") { + if (m_tvDicts.SelectedNode != null) { + Utils.CopyToClipboard(m_lvDict); + } + } + else if (selectedTab == "SymTbl") { + if (m_tvSymTbls.SelectedNode != null) { + Utils.CopyToClipboard(m_lvSymTbl); + } + } + else { + Clipboard.Clear(); + } + } + + + /// + /// + /// + /// + /// + private void + ContextMenuClick_BrowseReflection(object sender, System.EventArgs e) + { + Snoop.Utils.BrowseReflection(m_curObjId); + } + + + /// + /// + /// + /// + /// + private void + ContextMenuClick_AddToSnoopObjSet(object sender, System.EventArgs e) + { + if (Snoop.Utils.CurrentSnoopSet != null) { + Snoop.Utils.CurrentSnoopSet.AddToSet(m_curObjId); + } + } + + + /// + /// + /// + /// + /// + private void + ContextMenuClick_RemoveFromSnoopObjSet(object sender, System.EventArgs e) + { + if (Snoop.Utils.CurrentSnoopSet != null) { + Snoop.Utils.CurrentSnoopSet.RemoveFromSet(m_curObjId); + } + } + + + /// + /// + /// + /// + /// + private void + ContextMenuClick_ShowSnoopObjSet(object sender, System.EventArgs e) + { + if (Snoop.Utils.CurrentSnoopSet != null) { + Snoop.Forms.DBObjects form = new Snoop.Forms.DBObjects(Snoop.Utils.CurrentSnoopSet.Set, m_trans); + form.Text = "Snoop Object Set"; + form.ShowDialog(); + } + } + + /// + /// + /// + /// + /// + private void + OnContextMenuPopup(object sender, System.EventArgs e) + { + bool enabled = (Snoop.Utils.CurrentSnoopSet == null) ? false : true; + m_mnuItemAddToSnoopObjSet.Enabled = enabled; + m_mnuItemRemoveFromSnoopObjSet.Enabled = enabled; + m_mnuItemShowSnoopObjSet.Enabled = enabled; + } + #endregion + + #region Copy Events + /// + /// + /// + /// + /// + private void + CopyToolStripMenuItem_Click (object sender, EventArgs e) + { + if (m_lvDb.SelectedItems.Count > 0) { + Utils.CopyToClipboard(m_lvDb.SelectedItems[0]); + } + else if (m_lvDict.SelectedItems.Count > 0) { + Utils.CopyToClipboard(m_lvDict.SelectedItems[0]); + } + else if (m_lvSymTbl.SelectedItems.Count > 0) { + Utils.CopyToClipboard(m_lvSymTbl.SelectedItems[0]); + } + else { + Clipboard.Clear(); + } + } + #endregion + + #region Print Events + /// + /// + /// + /// + /// + private void + PrintMenuItem_Click (object sender, EventArgs e) + { + if (selectedTab == "SymTbl") + { + Utils.UpdatePrintSettings(m_printDocument, m_tvSymTbls, m_lvSymTbl, ref m_maxWidths); + Utils.PrintMenuItemClick(m_printDialog, m_tvSymTbls); + } + else if (selectedTab == "Dict") + { + Utils.UpdatePrintSettings(m_printDocument, m_tvDicts, m_lvDict, ref m_maxWidths); + Utils.PrintMenuItemClick(m_printDialog, m_tvDicts); + } + else if (selectedTab == "Db") + { + Utils.UpdatePrintSettings(m_lvDb, ref m_maxWidths); + Utils.PrintMenuItemClick(m_printDialog); + } + } + + + /// + /// + /// + /// + /// + private void + PrintPreviewMenuItem_Click (object sender, EventArgs e) + { + if (selectedTab == "SymTbl") + { + Utils.UpdatePrintSettings(m_printDocument, m_tvSymTbls, m_lvSymTbl, ref m_maxWidths); + Utils.PrintPreviewMenuItemClick(m_printPreviewDialog, m_tvSymTbls); + } + else if (selectedTab == "Dict") + { + Utils.UpdatePrintSettings(m_printDocument, m_tvDicts, m_lvDict, ref m_maxWidths); + Utils.PrintPreviewMenuItemClick(m_printPreviewDialog, m_tvDicts); + } + else if (selectedTab == "Db") + { + Utils.UpdatePrintSettings(m_lvDb, ref m_maxWidths); + Utils.PrintPreviewMenuItemClick(m_printPreviewDialog, m_lvDb); + } + } + + + /// + /// + /// + /// + /// + private void + PrintDocument_PrintPage (object sender, System.Drawing.Printing.PrintPageEventArgs e) + { + if (selectedTab == "SymTbl") + { + m_currentPrintItem = Utils.Print(m_tvSymTbls.SelectedNode.Text, m_lvSymTbl, e, m_maxWidths[0], m_maxWidths[1], m_currentPrintItem); + } + else if (selectedTab == "Dict") + { + m_currentPrintItem = Utils.Print(m_tvDicts.SelectedNode.Text, m_lvDict, e, m_maxWidths[0], m_maxWidths[1], m_currentPrintItem); + } + else if (selectedTab == "Db") + { + m_currentPrintItem = Utils.Print("", m_lvDb, e, m_maxWidths[0], m_maxWidths[1], m_currentPrintItem); + } + } + #endregion + #endregion + } +} diff --git a/MgdDbgLibrary/Snoop/Forms/Database.resx b/MgdDbgLibrary/Snoop/Forms/Database.resx new file mode 100644 index 0000000..a605c24 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/Database.resx @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 160, 17 + + + 17, 17 + + + 338, 17 + + + 437, 17 + + + 17, 54 + + + 558, 17 + + + + + AAABAAYAICAQAAAAAADoAgAAZgAAABAQEAAAAAAAKAEAAE4DAAAgIAAAAQAIAKgIAAB2BAAAEBAAAAEA + CABoBQAAHg0AACAgAAABACAAqBAAAIYSAAAQEAAAAQAgAGgEAAAuIwAAKAAAACAAAABAAAAAAQAEAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAACAgACAAAAAgACAAICAAACAgIAAwMDAAAAA + /wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIoiI + iIiIiIiIiIiIiIiIiIiCIigiIiIozMzMzMzMyCIogiIoIiIiKM7m5ubm5sgiKIIiKCIiIijObm5ubm7I + IiiCIigiIiIozubm5ubmyCIogiIoIiIiKM5ubm5ubsgiKIIiKCIiIijO5ubm5ubIIiiIiIiIiIiIzm5u + bm5uyCIogRERERERGM7u7u7u7sgiKIHZWVlZWRjMzMzMzMzIIiiB1ZWVlZUYiIiIiIiIiIiIgdlZWVlZ + GDMzMzMzMzMzOIHVlZWVlRg/uLi4uLi4uDiB2VlZWVkYP7uLi4uLi4s4gdWVlZWVGD+4uLi4uLi4OIHZ + WVlZWRg/u4uLi4uLiziB1ZWVlZUYP7i4uLi4uLg4gdlZWVlZGD+7i4uLi4uLOIHVlZWVlRg/uLi4uLi4 + uDiB3d3d3d0YP7uLi4uLi4s4gRERERERGD+4uLi4uLi4OIiIiIiIiIg/u4uLi4uLiziCIiIiIiIoP7i4 + uLi4uLg4giIiIiIiKD+7i4uLi4uLOIIiIiIiIig/uLi4uLi4uDiCIiIiIiIoP7u7u7u7u7s4giIiIiIi + KD//////////OIIiIiIiIigzMzMzMzMzMziIiIiIiIiIiIiIiIiIiIiIIiIiIiIiIiIiIiIiIiIiIv// + ////////AAAAAHv4AA57+AAOe/gADnv4AA57+AAOe/gADgAAAA4AAAAOAAAADgAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/4AAB/+AAAf/gAAH/4AAB/+AAAf/gAAAAA + AAD/////KAAAABAAAAAgAAAAAQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAACA + gACAAAAAgACAAICAAACAgIAAwMDAAAAA/wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAiIiIiIiIiIoiI + iIiIiIiIgigijMzMyCiCKCKM5mbIKIiIiIzu7sgogRERjMzMyCiB2ZGIiIiIiIHZkYMzMzM4gdmRg/u7 + uziB3dGD+7u7OIEREYP7u7s4iIiIg/u7uziCIiKD+7u7OIIiIoP///84giIigzMzMziIiIiIiIiIiP// + KCIAACjObALm5mwCIigAAoiIAAKIzgAAbm4AACIoAAAREQAAGM4AAO7uAAAiKHwAWVl8ABjMfADMzAAA + IigoAAAAIAAAAEAAAAABAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAA + AACAAIAAgIAAAICAgADA3MAA8MqmAKo/KgD/PyoAAF8qAFVfKgCqXyoA/18qAAB/KgBVfyoAqn8qAP9/ + KgAAnyoAVZ8qAKqfKgD/nyoAAL8qAFW/KgCqvyoA/78qAADfKgBV3yoAqt8qAP/fKgAA/yoAVf8qAKr/ + KgD//yoAAABVAFUAVQCqAFUA/wBVAAAfVQBVH1UAqh9VAP8fVQAAP1UAVT9VAKo/VQD/P1UAAF9VAFVf + VQCqX1UA/19VAAB/VQBVf1UAqn9VAP9/VQAAn1UAVZ9VAKqfVQD/n1UAAL9VAFW/VQCqv1UA/79VAADf + VQBV31UAqt9VAP/fVQAA/1UAVf9VAKr/VQD//1UAAAB/AFUAfwCqAH8A/wB/AAAffwBVH38Aqh9/AP8f + fwAAP38AVT9/AKo/fwD/P38AAF9/AFVffwCqX38A/19/AAB/fwBVf38Aqn9/AP9/fwAAn38AVZ9/AKqf + fwD/n38AAL9/AFW/fwCqv38A/79/AADffwBV338Aqt9/AP/ffwAA/38AVf9/AKr/fwD//38AAACqAFUA + qgCqAKoA/wCqAAAfqgBVH6oAqh+qAP8fqgAAP6oAVT+qAKo/qgD/P6oAAF+qAFVfqgCqX6oA/1+qAAB/ + qgBVf6oAqn+qAP9/qgAAn6oAVZ+qAKqfqgD/n6oAAL+qAFW/qgCqv6oA/7+qAADfqgBV36oAqt+qAP/f + qgAA/6oAVf+qAKr/qgD//6oAAADUAFUA1ACqANQA/wDUAAAf1ABVH9QAqh/UAP8f1AAAP9QAVT/UAKo/ + 1AD/P9QAAF/UAFVf1ACqX9QA/1/UAAB/1ABVf9QAqn/UAP9/1AAAn9QAVZ/UAKqf1AD/n9QAAL/UAFW/ + 1ACqv9QA/7/UAADf1ABV39QAqt/UAP/f1AAA/9QAVf/UAKr/1AD//9QAVQD/AKoA/wAAH/8AVR//AKof + /wD/H/8AAD//AFU//wCqP/8A/z//AABf/wBVX/8Aql//AP9f/wAAf/8AVX//AKp//wD/f/8AAJ//AFWf + /wCqn/8A/5//AAC//wBVv/8Aqr//AP+//wAA3/8AVd//AKrf/wD/3/8AVf//AKr//wD/zMwA/8z/AP// + MwD//2YA//+ZAP//zAAAfwAAVX8AAKp/AAD/fwAAAJ8AAFWfAACqnwAA/58AAAC/AABVvwAAqr8AAP+/ + AAAA3wAAVd8AAKrfAAD/3wAAVf8AAKr/AAAAACoAVQAqAKoAKgD/ACoAAB8qAFUfKgCqHyoA/x8qAAA/ + KgBVPyoA8Pv/AKSgoACAgIAAAAD/AAD/AAAA//8A/wAAAAAAAAD//wAA////AP39/f39/f39/f39/f39 + /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39 + /f39/f39/f39/f39/f39/f39/f39/f39qoYIqoYIhqoIqgiqCaoIqgiqhqqGhoYIhoYIqv39/f0I/f39 + /ar9/f39/YY2Ng4yDg4ODgoOCgoKCgqG/f39/Yb9/f39CP39/f39qjY7Ozs3Nzc3NjMSMjIOCqr9/f39 + qv39/f2G/f39/f0IN19fOzs3Nzc3NjcODg4KCP39/f0I/f39/ar9/f39/ao6X19fXzs7Ozc3NzY3NgqG + /f39/Yb9/f39CP39/f39hl9jY19jX187Ozs7Nzc3Dqr9/f39qv39/f2G/f39/f0IOodjh19jX19fXztf + OzcOCP39/f0ICAmqCAiqCKoICapfCYdjh2ODY19fXzs7Ow6q/f39/QhITEwoSCUoKSQoqmMJCYcJCWNj + Y2NfY19fNgj9/f39qkyZmZmYmJRwlCmqX19fXl9fX186WzY3Njc2gv39/f0JcJ2dmZmZlJmUJAmqCaoJ + hggIqggICKoIqggI/f39/YZwnp2dnZmZmJVMqnx8fHx8fFR8VHhUVFRUVKr9/f39CHChoZ2dnZ2ZmUwJ + fKSkxqSkxqSkpKSkpKBUCP39/f2qcKLDoqGdnZ2ZTKp8ysakxqSkxqSkxqSkpFSq/f39/QiUpqbDoqHE + nZ1Mq3ykqMakyqSkxqSkpKSkVAj9/f39hpTIyKbHoqGhoXAIfMrLpMqkxqSkxqTGpKRUqv39/f0IlMym + yKbIpcShcAh8y6jKpMqkxsqkpKSkxlQI/f39/aqUzMzMyKbIpqJwqnzLy8qpxsqkpMakxqSkeAj9/f39 + CJSUlJSUlJSUlJQJgMupy8qpysqkyqSkxqRUqv39/f2GCKoIqgiqCKoIhgigrcvPqcuoy8qkxsqkxnyG + /f39/ar9/f39/f39/f39qnzPz6nLy8uoyqnKpKTKVAj9/f39CP39/f39/f39/f0IfNDPz8+py8upyqjG + yqR8hv39/f2G/f39/f39/f39/Qik0K7P0M+ty8vLy6jKpXyq/f39/ar9/f39/f39/f39CHzQ09Ctz8/P + qcupy6jKeAj9/f39CP39/f39/f39/f2qoNPQ0NPQ0M/Qz8vLy6l8CP39/f2G/f39/f39/f39/QmkfKR8 + oHx8fHx8fHx8fHyG/f39/aoIqgiqCKoIqgiqCKoIqgiqCKoIqgiqCKoIqgj9/f39/f39/f39/f39/f39 + /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f3///////////// + ///AAAAD3vgAA974AAPe+AAD3vgAA974AAPe+AADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAADwAAAA9/4AAPf+AAD3/gAA9/4AAPf+AAD3/gAA8AAAAP//////////ygA + AAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAA + gACAgAAAgICAAMDcwADwyqYAqj8qAP8/KgAAXyoAVV8qAKpfKgD/XyoAAH8qAFV/KgCqfyoA/38qAACf + KgBVnyoAqp8qAP+fKgAAvyoAVb8qAKq/KgD/vyoAAN8qAFXfKgCq3yoA/98qAAD/KgBV/yoAqv8qAP// + KgAAAFUAVQBVAKoAVQD/AFUAAB9VAFUfVQCqH1UA/x9VAAA/VQBVP1UAqj9VAP8/VQAAX1UAVV9VAKpf + VQD/X1UAAH9VAFV/VQCqf1UA/39VAACfVQBVn1UAqp9VAP+fVQAAv1UAVb9VAKq/VQD/v1UAAN9VAFXf + VQCq31UA/99VAAD/VQBV/1UAqv9VAP//VQAAAH8AVQB/AKoAfwD/AH8AAB9/AFUffwCqH38A/x9/AAA/ + fwBVP38Aqj9/AP8/fwAAX38AVV9/AKpffwD/X38AAH9/AFV/fwCqf38A/39/AACffwBVn38Aqp9/AP+f + fwAAv38AVb9/AKq/fwD/v38AAN9/AFXffwCq338A/99/AAD/fwBV/38Aqv9/AP//fwAAAKoAVQCqAKoA + qgD/AKoAAB+qAFUfqgCqH6oA/x+qAAA/qgBVP6oAqj+qAP8/qgAAX6oAVV+qAKpfqgD/X6oAAH+qAFV/ + qgCqf6oA/3+qAACfqgBVn6oAqp+qAP+fqgAAv6oAVb+qAKq/qgD/v6oAAN+qAFXfqgCq36oA/9+qAAD/ + qgBV/6oAqv+qAP//qgAAANQAVQDUAKoA1AD/ANQAAB/UAFUf1ACqH9QA/x/UAAA/1ABVP9QAqj/UAP8/ + 1AAAX9QAVV/UAKpf1AD/X9QAAH/UAFV/1ACqf9QA/3/UAACf1ABVn9QAqp/UAP+f1AAAv9QAVb/UAKq/ + 1AD/v9QAAN/UAFXf1ACq39QA/9/UAAD/1ABV/9QAqv/UAP//1ABVAP8AqgD/AAAf/wBVH/8Aqh//AP8f + /wAAP/8AVT//AKo//wD/P/8AAF//AFVf/wCqX/8A/1//AAB//wBVf/8Aqn//AP9//wAAn/8AVZ//AKqf + /wD/n/8AAL//AFW//wCqv/8A/7//AADf/wBV3/8Aqt//AP/f/wBV//8Aqv//AP/MzAD/zP8A//8zAP// + ZgD//5kA///MAAB/AABVfwAAqn8AAP9/AAAAnwAAVZ8AAKqfAAD/nwAAAL8AAFW/AACqvwAA/78AAADf + AABV3wAAqt8AAP/fAABV/wAAqv8AAAAAKgBVACoAqgAqAP8AKgAAHyoAVR8qAKofKgD/HyoAAD8qAFU/ + KgDw+/8ApKCgAICAgAAAAP8AAP8AAAD//wD/AAAAAAAAAP//AAD///8A/f39/f39/f39/f39/f39/f0I + hgiqCKoICKoICKaGCP39qv39hv2GNg4ODjII/ar9/Yb9/ar9qjdjXzsOCP2G/f0IhquGCAleCWNfNob9 + qv39qkxMTEgIX19fX18I/Qj9/QhwnZlMqoYIqggIqgiG/f2qcKadcAl8fFQDVFQDqv39CHDMpnCqfMvL + ysrKVAj9/QiUlHBwCYDPy8/LylSG/f2GqoYIqgig0M/Py8t8qv39CP39/f2GpNDQ0M/PfAn9/ar9/f39 + qqT20NDQ0Hyq/f2G/f39/QmkpKSloKR8CP39CKoIhgiqCIYIqgiGCKr9/f39/f39/f39/f39/f39/f// + hv2AAf0ItAX9/bQFX2OABWNfgAU7O4ABNzeAAf39gAGq/YAB/YaAAf39vAE6h7wBX2O8AV9fgAE7N/// + /f0oAAAAIAAAAEAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAADCv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAA + AAAAAAAAwr/B/7Z3Sf+zckT/rm0//6toO/+nYjb/pF4y/6BZLv+dVCr/mlEn/5dNI/+VSiH/kkce/5FE + HP+RRBz/kUUb/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/AAAAAAAA + AAAAAAAAAAAAAAAAAADCv8H/v4JS//+aZv//lWD/+5Bc//WLV//uh1P/54FO/997S//Wdkb/zXBD/8Vr + QP+9Zj3/tGI5/65dN/+RRRz/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/AAAAAAAAAAAAAAAAAAAAAMK/ + wf8AAAAAAAAAAAAAAAAAAAAAAAAAAMK/wf/GjFv//6Rz//+fbf//m2f//5Zh//yRXf/3jVj/8IhV/+mD + UP/hfUz/2HhI/9ByRP/HbED/v2c9/5VJIf/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAA + AAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAAAAAAAAAAwr/B/86WZP//r4L//6p7//+mdf//oW7//5xo//+X + Yv/9kl7/+I5a//KJVf/rhFH/4n5N/9t4SP/Sc0X/mlEm/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAA + AAAAAAAAAAAAAAAAAADCv8H/AAAAAAAAAAAAAAAAAAAAAAAAAADCv8H/1J9s//+4kf//tIv//6+E//+r + ff//p3f//6Jw//+eav//mWT//pRf//qQWv/0i1b/7IVS/+V/Tv+gWC7/wr/B/wAAAAAAAAAAAAAAAAAA + AADCv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAAAAAAMK/wf/apnP//7+d//+7 + mP//uJL//7WM//+whv//rH///6d4//+jcf//n2v//5ll//+VYP/6kVv/9YxY/6diN//Cv8H/AAAAAAAA + AAAAAAAAAAAAAMK/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/96t + eP//wqL//8Gi//+/nv//vJn//7mT//+2jv//sYj//66A//+pev//pHP//6Bt//+bZ///l2L/r20//8K/ + wf8AAAAAAAAAAAAAAAAAAAAAwr/B/xYXev8XF3b/GBVx/xkUbf8ZFGr/GhNm/xoSY/8bEV//HBFd/xwQ + W//Cv8H/4K96///Cov//wqL//8Ki///Cov//wJ///72b//+6lf//t4///7KJ//+ugv//qnv//6V0//+h + bv+3d0n/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/FRqE/0dN1v8/RNL/Nz3Q/y40zv8nLcz/ISfK/xwh + yf8WHMf/GxJh/8K/wf/gr3r/4K96/+Cvev/gr3r/3614/9yqdf/apnL/16Nw/9Sea//Rmmj/zZZk/8qR + X//GjFz/w4dW/7+CUv/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8SHZD/WF3a/05U1/9FS9X/PUPS/zU7 + 0P8uM83/JyzL/yAmyf8aFGn/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/xAfnP9obt7/YGTc/1Zb + 2f9NU9f/RUrU/ztB0v80OdD/LDHO/xgWcv/Cv8H/Dn+n/w18pP8MeqH/DHie/wt1m/8Kc5j/CXGV/wlv + k/8JbJD/CGqN/wdpi/8HZ4j/BmWH/wZkhf8GYoP/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/DiKp/3l+ + 4/9vdeH/Zmze/11i2/9UWtn/S1HW/0NI1P86P9H/Fhh9/8K/wf8Ogar/Barp/wGo6P8Apef/AKPm/wCi + 5P8An+L/AJ7h/wCd3/8AnN7/AJnc/wCY2/8AmNn/AJbX/wZjhP/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/ + wf8MJbX/iI7n/4CF5v93fOP/bnPg/2Vr3f9bYdv/UljY/0lP1v8UGoj/wr/B/w+Erf8Lrur/Bqvq/wOo + 6f8Apuf/AKTm/wCi5f8AoOT/AJ/i/wCd4f8AnN//AJrd/wCZ2/8AmNr/BmWH/8K/wf8AAAAAAAAAAAAA + AAAAAAAAwr/B/wkowP+WnOz/jpTq/4aL6P9+hOX/dXri/2xx4P9jaN3/WV/b/xEek//Cv8H/EIaw/xay + 7P8Or+z/Cavr/wWq6v8Bp+j/AKbn/wCj5f8AoeT/AJ/j/wCe4f8AnOD/AJve/wCa3f8HZ4n/wr/B/wAA + AAAAAAAAAAAAAAAAAADCv8H/CCrK/6Ko7/+coe7/lZrr/42T6f+Fiub/fIHl/3N54v9rcN//ECGg/8K/ + wf8QiLP/I7nu/xq07f8Ssez/C63r/war6v8Cqen/AKbo/wCk5v8AouX/AKHk/wCf4f8AneH/AJzf/who + i//Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8GLNP/q7Hy/6as8P+hpu//mp/u/5OY6/+LkOj/g4nm/3qA + 5P8NI6z/wr/B/xCKtv8xvvD/J7rv/x627f8Vsuz/Dq/s/wmr6/8Equn/Aafo/wCl5/8Ao+X/AKHk/wCf + 4v8AnuH/CGqO/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wUu2/+vtPP/r7Tz/6qv8v+mq/D/oKXv/5me + 7f+Sl+v/io/p/wsmt//Cv8H/Eo24/0HF8f82wfD/LLzv/yK47v8atO3/EbHs/wut6/8Gq+r/A6np/wCm + 6P8Apeb/AKLl/wCh5P8IbJD/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/BC/h/wQv3/8FL9z/BS3Z/wYt + 1v8GLNL/ByvP/wgqy/8IKcb/CSnC/8K/wf8Sjrv/Uszy/0fH8f87w/H/Mb7v/ye67/8et+7/FbPt/w6v + 6/8IrOv/BKnp/wGo6P8Apef/AKPl/wluk//Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/xKRvf9j0/P/WM/z/0zK8f9BxfH/N8Hw/yy8 + 7/8iuO7/GbTt/xGx7P8Lruv/Bqrq/wOo6f8Apuf/CnGV/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADCv8H/E5LA/3Ta8/9q1fP/XtHz/1LM + 8v9Hx/H/O8Pw/zG+7/8nu+//Hrbt/xay7f8Or+v/CKzq/wSq6f8Kc5j/wr/B/wAAAAAAAAAAAAAAAAAA + AADCv8H/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMK/wf8UlMH/hOD1/3rc + 9f9v2PP/ZNTy/1jO8v9NyvH/Qsbx/zbB8P8svO//I7ju/xm07f8SsOz/C67r/wt2m//Cv8H/AAAAAAAA + AAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwr/B/xSW + w/+T5vb/iuL1/3/e9P912vT/adbz/13R8/9SzPL/R8jx/zzD8P8xvvD/J7rv/x627v8Vsuz/C3ie/8K/ + wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AADCv8H/FJbG/57r9/+X6Pb/juT1/4Th9f963fX/b9j0/2PT8/9Yz/L/TMrx/0HF8f83wO//LLzv/yK4 + 7v8MeqH/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAMK/wf8VmMf/qO/3/6Lt9/+b6vb/kub2/4rj9f9/3vX/dNrz/2rV8/9d0fP/Uszy/0fI + 8f88w/D/Mr7v/w19pP/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAwr/B/xWZyP8UmMf/FZfF/xSVw/8TlML/E5K//xOQvf8Sjrv/EYy4/xGK + tv8QiLL/D4Ww/w+Erf8Pgar/Dn+n/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP// + /////////////8AAAAPe+AAD3vgAA974AAPe+AAD3vgAA974AAPAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAAD3/gAA9/4AAPf+AAD3/gAA9/4AAPf+AADwAAAA/// + ////////KAAAABAAAAAgAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwMDA/8DA + wP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP8AAAAAAAAAAMDA + wP8AAAAAAAAAAMDAwP8AAAAAwMDA/8F2R/+9bj//umc6/7diNf+3YjX/wMDA/wAAAADAwMD/AAAAAAAA + AADAwMD/AAAAAAAAAADAwMD/AAAAAMDAwP/RkmD//7aP//+ldP/8kl3/vW0//8DAwP8AAAAAwMDA/wAA + AAAAAAAAwMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/3ap2///Cov//to7//6V0/8uJWP/AwMD/AAAAAMDA + wP8AAAAAAAAAAMDAwP8THI7/FBqF/xYYfP8XFnP/wMDA/+Cvev/gr3r/4K96/92qdv/ao3D/wMDA/wAA + AADAwMD/AAAAAAAAAADAwMD/ECCd/2Fn3P8zOc//FRmC/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DA + wP/AwMD/wMDA/wAAAAAAAAAAwMDA/w0krP+Pler/YWbd/xIcj//AwMD/DHmf/wpzmP8Ib5L/B2uO/wdq + jf8Gao3/B2qN/8DAwP8AAAAAAAAAAMDAwP8KJrv/r7Tz/5CU6v8PIJ//wMDA/w+Dq/87y/z/Kcb8/xrD + /P8QwPv/EMD7/wdqjf/AwMD/AAAAAAAAAADAwMD/CCrI/woowP8LJrf/DSSu/8DAwP8Sjbj/Zdb9/0/Q + /P88y/v/Kcf7/xrC+/8IbZD/wMDA/wAAAAAAAAAAwMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/FpfG/43h + /f962/3/Zdb8/0/Q/P87zPz/CXSZ/8DAwP8AAAAAAAAAAMDAwP8AAAAAAAAAAAAAAAAAAAAAwMDA/xif + z/+u6f7/n+X9/47h/f953P3/ZNb9/w19pP/AwMD/AAAAAAAAAADAwMD/AAAAAAAAAAAAAAAAAAAAAMDA + wP8apNX/uez+/7ns/v+u6f7/oOX9/43h/f8Rh7H/wMDA/wAAAAAAAAAAwMDA/wAAAAAAAAAAAAAAAAAA + AADAwMD/GqTV/xqk1f8apNX/GaHR/xecy/8WmMb/FJK+/8DAwP8AAAAAAAAAAMDAwP/AwMD/wMDA/8DA + wP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/AAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAAgAEAALQF + wf+0BQAAgAUAAIAFAACAAQAAgAHB/4ABAACAAQAAgAEAALwBAAC8AQAAvAHB/4ABbP///5H/ + + + \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/Forms/Editor.Designer.cs b/MgdDbgLibrary/Snoop/Forms/Editor.Designer.cs new file mode 100644 index 0000000..8cb78cd --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/Editor.Designer.cs @@ -0,0 +1,550 @@ +namespace MgdDbg.Snoop.Forms { + partial class Editor { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose (bool disposing) + { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent () + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Editor)); + this.m_bnOK = new System.Windows.Forms.Button(); + this.m_bnCancel = new System.Windows.Forms.Button(); + this.columnHeader1 = new System.Windows.Forms.ColumnHeader(); + this.columnHeader2 = new System.Windows.Forms.ColumnHeader(); + this.m_tabSystem = new System.Windows.Forms.TabPage(); + this.m_lvCmds = new System.Windows.Forms.ListView(); + this.columnHeader5 = new System.Windows.Forms.ColumnHeader(); + this.columnHeader6 = new System.Windows.Forms.ColumnHeader(); + this.listViewContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.copyListViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.m_tvCmds = new System.Windows.Forms.TreeView(); + this.treeViewContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.copyTreeViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.m_tabClasses = new System.Windows.Forms.TabPage(); + this.m_labelNameSpc = new System.Windows.Forms.Label(); + this.m_rdBtnAdsk = new System.Windows.Forms.RadioButton(); + this.m_rdBtnSys = new System.Windows.Forms.RadioButton(); + this.m_bnCompList = new System.Windows.Forms.Button(); + this.m_lvClasses = new System.Windows.Forms.ListView(); + this.columnHeader3 = new System.Windows.Forms.ColumnHeader(); + this.columnHeader4 = new System.Windows.Forms.ColumnHeader(); + this.m_btnNext = new System.Windows.Forms.Button(); + this.m_tvClasses = new System.Windows.Forms.TreeView(); + this.m_txtBoxSearch = new System.Windows.Forms.TextBox(); + this.m_labelSearch = new System.Windows.Forms.Label(); + this.m_tabDocs = new System.Windows.Forms.TabPage(); + this.m_lvDocs = new System.Windows.Forms.ListView(); + this.m_colSymTblField = new System.Windows.Forms.ColumnHeader(); + this.m_colSymTblValue = new System.Windows.Forms.ColumnHeader(); + this.m_tvDocs = new System.Windows.Forms.TreeView(); + this.m_tabControl = new System.Windows.Forms.TabControl(); + this.m_progressBar = new System.Windows.Forms.ProgressBar(); + this.m_printDialog = new System.Windows.Forms.PrintDialog(); + this.m_printDocument = new System.Drawing.Printing.PrintDocument(); + this.m_printPreviewDialog = new System.Windows.Forms.PrintPreviewDialog(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); + this.m_tabSystem.SuspendLayout(); + this.listViewContextMenuStrip.SuspendLayout(); + this.treeViewContextMenuStrip.SuspendLayout(); + this.m_tabClasses.SuspendLayout(); + this.m_tabDocs.SuspendLayout(); + this.m_tabControl.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // m_bnOK + // + this.m_bnOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnOK.Location = new System.Drawing.Point(490, 561); + this.m_bnOK.Name = "m_bnOK"; + this.m_bnOK.Size = new System.Drawing.Size(75, 23); + this.m_bnOK.TabIndex = 1; + this.m_bnOK.Text = "OK"; + this.m_bnOK.UseVisualStyleBackColor = true; + // + // m_bnCancel + // + this.m_bnCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnCancel.Location = new System.Drawing.Point(580, 561); + this.m_bnCancel.Name = "m_bnCancel"; + this.m_bnCancel.Size = new System.Drawing.Size(75, 23); + this.m_bnCancel.TabIndex = 2; + this.m_bnCancel.Text = "Cancel"; + this.m_bnCancel.UseVisualStyleBackColor = true; + // + // columnHeader1 + // + this.columnHeader1.Text = "Field"; + this.columnHeader1.Width = 200; + // + // columnHeader2 + // + this.columnHeader2.Text = "Value"; + this.columnHeader2.Width = 300; + // + // m_tabSystem + // + this.m_tabSystem.Controls.Add(this.m_lvCmds); + this.m_tabSystem.Controls.Add(this.m_tvCmds); + this.m_tabSystem.Location = new System.Drawing.Point(4, 22); + this.m_tabSystem.Name = "m_tabSystem"; + this.m_tabSystem.Padding = new System.Windows.Forms.Padding(3); + this.m_tabSystem.Size = new System.Drawing.Size(787, 473); + this.m_tabSystem.TabIndex = 2; + this.m_tabSystem.Text = "System"; + this.m_tabSystem.UseVisualStyleBackColor = true; + // + // m_lvCmds + // + this.m_lvCmds.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_lvCmds.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader5, + this.columnHeader6}); + this.m_lvCmds.ContextMenuStrip = this.listViewContextMenuStrip; + this.m_lvCmds.FullRowSelect = true; + this.m_lvCmds.GridLines = true; + this.m_lvCmds.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvCmds.HideSelection = false; + this.m_lvCmds.Location = new System.Drawing.Point(281, 20); + this.m_lvCmds.MultiSelect = false; + this.m_lvCmds.Name = "m_lvCmds"; + this.m_lvCmds.ShowItemToolTips = true; + this.m_lvCmds.Size = new System.Drawing.Size(496, 437); + this.m_lvCmds.TabIndex = 3; + this.m_lvCmds.UseCompatibleStateImageBehavior = false; + this.m_lvCmds.View = System.Windows.Forms.View.Details; + // + // columnHeader5 + // + this.columnHeader5.Text = "Field"; + this.columnHeader5.Width = 200; + // + // columnHeader6 + // + this.columnHeader6.Text = "Value"; + this.columnHeader6.Width = 300; + // + // listViewContextMenuStrip + // + this.listViewContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.copyListViewToolStripMenuItem}); + this.listViewContextMenuStrip.Name = "listViewContextMenuStrip"; + this.listViewContextMenuStrip.Size = new System.Drawing.Size(100, 26); + // + // copyListViewToolStripMenuItem + // + this.copyListViewToolStripMenuItem.Image = global::MgdDbg.Properties.Resources.COPY1; + this.copyListViewToolStripMenuItem.Name = "copyListViewToolStripMenuItem"; + this.copyListViewToolStripMenuItem.Size = new System.Drawing.Size(99, 22); + this.copyListViewToolStripMenuItem.Text = "Copy"; + this.copyListViewToolStripMenuItem.Click += new System.EventHandler(this.CopyListViewToolStripMenuItem_Click); + // + // m_tvCmds + // + this.m_tvCmds.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.m_tvCmds.ContextMenuStrip = this.treeViewContextMenuStrip; + this.m_tvCmds.HideSelection = false; + this.m_tvCmds.Location = new System.Drawing.Point(9, 20); + this.m_tvCmds.Name = "m_tvCmds"; + this.m_tvCmds.ShowNodeToolTips = true; + this.m_tvCmds.Size = new System.Drawing.Size(256, 437); + this.m_tvCmds.TabIndex = 2; + // + // treeViewContextMenuStrip + // + this.treeViewContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.copyTreeViewToolStripMenuItem}); + this.treeViewContextMenuStrip.Name = "treeViewContextMenuStrip"; + this.treeViewContextMenuStrip.Size = new System.Drawing.Size(100, 26); + // + // copyTreeViewToolStripMenuItem + // + this.copyTreeViewToolStripMenuItem.Image = global::MgdDbg.Properties.Resources.COPY1; + this.copyTreeViewToolStripMenuItem.Name = "copyTreeViewToolStripMenuItem"; + this.copyTreeViewToolStripMenuItem.Size = new System.Drawing.Size(99, 22); + this.copyTreeViewToolStripMenuItem.Text = "Copy"; + this.copyTreeViewToolStripMenuItem.Click += new System.EventHandler(this.CopyTreeViewToolStripMenuItem_Click); + // + // m_tabClasses + // + this.m_tabClasses.Controls.Add(this.m_labelNameSpc); + this.m_tabClasses.Controls.Add(this.m_rdBtnAdsk); + this.m_tabClasses.Controls.Add(this.m_rdBtnSys); + this.m_tabClasses.Controls.Add(this.m_bnCompList); + this.m_tabClasses.Controls.Add(this.m_lvClasses); + this.m_tabClasses.Controls.Add(this.m_btnNext); + this.m_tabClasses.Controls.Add(this.m_tvClasses); + this.m_tabClasses.Controls.Add(this.m_txtBoxSearch); + this.m_tabClasses.Controls.Add(this.m_labelSearch); + this.m_tabClasses.Location = new System.Drawing.Point(4, 22); + this.m_tabClasses.Name = "m_tabClasses"; + this.m_tabClasses.Padding = new System.Windows.Forms.Padding(3); + this.m_tabClasses.Size = new System.Drawing.Size(787, 473); + this.m_tabClasses.TabIndex = 1; + this.m_tabClasses.Text = "Classes"; + this.m_tabClasses.UseVisualStyleBackColor = true; + // + // m_labelNameSpc + // + this.m_labelNameSpc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.m_labelNameSpc.AutoSize = true; + this.m_labelNameSpc.Location = new System.Drawing.Point(15, 497); + this.m_labelNameSpc.Name = "m_labelNameSpc"; + this.m_labelNameSpc.Size = new System.Drawing.Size(134, 13); + this.m_labelNameSpc.TabIndex = 17; + this.m_labelNameSpc.Text = "NameSpace Enumeration :"; + // + // m_rdBtnAdsk + // + this.m_rdBtnAdsk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.m_rdBtnAdsk.AutoSize = true; + this.m_rdBtnAdsk.Enabled = false; + this.m_rdBtnAdsk.Location = new System.Drawing.Point(249, 495); + this.m_rdBtnAdsk.Name = "m_rdBtnAdsk"; + this.m_rdBtnAdsk.Size = new System.Drawing.Size(70, 17); + this.m_rdBtnAdsk.TabIndex = 16; + this.m_rdBtnAdsk.Text = "Autodesk"; + this.m_rdBtnAdsk.UseVisualStyleBackColor = true; + this.m_rdBtnAdsk.CheckedChanged += new System.EventHandler(this.m_rdBtnAdsk_CheckedChanged); + // + // m_rdBtnSys + // + this.m_rdBtnSys.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.m_rdBtnSys.AutoSize = true; + this.m_rdBtnSys.Location = new System.Drawing.Point(162, 495); + this.m_rdBtnSys.Name = "m_rdBtnSys"; + this.m_rdBtnSys.Size = new System.Drawing.Size(59, 17); + this.m_rdBtnSys.TabIndex = 15; + this.m_rdBtnSys.Text = "System"; + this.m_rdBtnSys.UseVisualStyleBackColor = true; + this.m_rdBtnSys.CheckedChanged += new System.EventHandler(this.m_rdBtnSys_CheckedChanged); + // + // m_bnCompList + // + this.m_bnCompList.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnCompList.Location = new System.Drawing.Point(495, 472); + this.m_bnCompList.Name = "m_bnCompList"; + this.m_bnCompList.Size = new System.Drawing.Size(208, 23); + this.m_bnCompList.TabIndex = 7; + this.m_bnCompList.Text = "Show Comparative List..."; + this.m_bnCompList.Click += new System.EventHandler(this.m_bnCompList_Click); + // + // m_lvClasses + // + this.m_lvClasses.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_lvClasses.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader3, + this.columnHeader4}); + this.m_lvClasses.ContextMenuStrip = this.listViewContextMenuStrip; + this.m_lvClasses.FullRowSelect = true; + this.m_lvClasses.GridLines = true; + this.m_lvClasses.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvClasses.HideSelection = false; + this.m_lvClasses.Location = new System.Drawing.Point(457, 20); + this.m_lvClasses.MultiSelect = false; + this.m_lvClasses.Name = "m_lvClasses"; + this.m_lvClasses.ShowItemToolTips = true; + this.m_lvClasses.Size = new System.Drawing.Size(320, 443); + this.m_lvClasses.TabIndex = 3; + this.m_lvClasses.UseCompatibleStateImageBehavior = false; + this.m_lvClasses.View = System.Windows.Forms.View.Details; + // + // columnHeader3 + // + this.columnHeader3.Text = "Field"; + this.columnHeader3.Width = 118; + // + // columnHeader4 + // + this.columnHeader4.Text = "Value"; + this.columnHeader4.Width = 300; + // + // m_btnNext + // + this.m_btnNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.m_btnNext.Location = new System.Drawing.Point(344, 447); + this.m_btnNext.Name = "m_btnNext"; + this.m_btnNext.Size = new System.Drawing.Size(52, 23); + this.m_btnNext.TabIndex = 14; + this.m_btnNext.Text = "Next"; + this.m_btnNext.UseVisualStyleBackColor = true; + this.m_btnNext.Click += new System.EventHandler(this.m_btnNext_Click); + // + // m_tvClasses + // + this.m_tvClasses.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.m_tvClasses.ContextMenuStrip = this.treeViewContextMenuStrip; + this.m_tvClasses.HideSelection = false; + this.m_tvClasses.Location = new System.Drawing.Point(9, 20); + this.m_tvClasses.Name = "m_tvClasses"; + this.m_tvClasses.ShowNodeToolTips = true; + this.m_tvClasses.Size = new System.Drawing.Size(430, 418); + this.m_tvClasses.TabIndex = 2; + // + // m_txtBoxSearch + // + this.m_txtBoxSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.m_txtBoxSearch.Location = new System.Drawing.Point(140, 449); + this.m_txtBoxSearch.Name = "m_txtBoxSearch"; + this.m_txtBoxSearch.Size = new System.Drawing.Size(198, 20); + this.m_txtBoxSearch.TabIndex = 12; + // + // m_labelSearch + // + this.m_labelSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.m_labelSearch.AutoSize = true; + this.m_labelSearch.Location = new System.Drawing.Point(15, 452); + this.m_labelSearch.Name = "m_labelSearch"; + this.m_labelSearch.Size = new System.Drawing.Size(119, 13); + this.m_labelSearch.TabIndex = 13; + this.m_labelSearch.Text = "Dynamic Class Search :"; + // + // m_tabDocs + // + this.m_tabDocs.Controls.Add(this.m_lvDocs); + this.m_tabDocs.Controls.Add(this.m_tvDocs); + this.m_tabDocs.Location = new System.Drawing.Point(4, 22); + this.m_tabDocs.Name = "m_tabDocs"; + this.m_tabDocs.Padding = new System.Windows.Forms.Padding(3); + this.m_tabDocs.Size = new System.Drawing.Size(787, 473); + this.m_tabDocs.TabIndex = 0; + this.m_tabDocs.Text = "Documents"; + this.m_tabDocs.UseVisualStyleBackColor = true; + // + // m_lvDocs + // + this.m_lvDocs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_lvDocs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_colSymTblField, + this.m_colSymTblValue}); + this.m_lvDocs.ContextMenuStrip = this.listViewContextMenuStrip; + this.m_lvDocs.FullRowSelect = true; + this.m_lvDocs.GridLines = true; + this.m_lvDocs.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvDocs.HideSelection = false; + this.m_lvDocs.Location = new System.Drawing.Point(275, 20); + this.m_lvDocs.MultiSelect = false; + this.m_lvDocs.Name = "m_lvDocs"; + this.m_lvDocs.Size = new System.Drawing.Size(496, 447); + this.m_lvDocs.TabIndex = 3; + this.m_lvDocs.UseCompatibleStateImageBehavior = false; + this.m_lvDocs.View = System.Windows.Forms.View.Details; + // + // m_colSymTblField + // + this.m_colSymTblField.Text = "Field"; + this.m_colSymTblField.Width = 200; + // + // m_colSymTblValue + // + this.m_colSymTblValue.Text = "Value"; + this.m_colSymTblValue.Width = 300; + // + // m_tvDocs + // + this.m_tvDocs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.m_tvDocs.ContextMenuStrip = this.treeViewContextMenuStrip; + this.m_tvDocs.HideSelection = false; + this.m_tvDocs.Location = new System.Drawing.Point(9, 20); + this.m_tvDocs.Name = "m_tvDocs"; + this.m_tvDocs.ShowNodeToolTips = true; + this.m_tvDocs.Size = new System.Drawing.Size(256, 447); + this.m_tvDocs.TabIndex = 2; + // + // m_tabControl + // + this.m_tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_tabControl.Controls.Add(this.m_tabDocs); + this.m_tabControl.Controls.Add(this.m_tabSystem); + this.m_tabControl.Controls.Add(this.m_tabClasses); + this.m_tabControl.Location = new System.Drawing.Point(12, 38); + this.m_tabControl.Name = "m_tabControl"; + this.m_tabControl.SelectedIndex = 0; + this.m_tabControl.Size = new System.Drawing.Size(795, 499); + this.m_tabControl.TabIndex = 0; + this.m_tabControl.SelectedIndexChanged += new System.EventHandler(this.TabSelected); + // + // m_progressBar + // + this.m_progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.m_progressBar.Location = new System.Drawing.Point(12, 543); + this.m_progressBar.Maximum = 700; + this.m_progressBar.Name = "m_progressBar"; + this.m_progressBar.Size = new System.Drawing.Size(443, 12); + this.m_progressBar.Step = 1; + this.m_progressBar.TabIndex = 3; + this.m_progressBar.Visible = false; + // + // m_printDialog + // + this.m_printDialog.Document = this.m_printDocument; + this.m_printDialog.UseEXDialog = true; + // + // m_printDocument + // + this.m_printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.PrintDocument_PrintPage); + // + // m_printPreviewDialog + // + this.m_printPreviewDialog.AutoScrollMargin = new System.Drawing.Size(0, 0); + this.m_printPreviewDialog.AutoScrollMinSize = new System.Drawing.Size(0, 0); + this.m_printPreviewDialog.ClientSize = new System.Drawing.Size(400, 300); + this.m_printPreviewDialog.Document = this.m_printDocument; + this.m_printPreviewDialog.Enabled = true; + this.m_printPreviewDialog.Icon = ((System.Drawing.Icon)(resources.GetObject("m_printPreviewDialog.Icon"))); + this.m_printPreviewDialog.Name = "printPreviewDialog1"; + this.m_printPreviewDialog.Visible = false; + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButton1, + this.toolStripButton2, + this.toolStripButton3}); + this.toolStrip1.Location = new System.Drawing.Point(0, 0); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(819, 25); + this.toolStrip1.TabIndex = 4; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripButton1 + // + this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton1.Image = global::MgdDbg.Properties.Resources.Print1; + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(23, 22); + this.toolStripButton1.Text = "Print"; + this.toolStripButton1.Click += new System.EventHandler(this.PrintMenuItem_Click); + // + // toolStripButton2 + // + this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton2.Image = global::MgdDbg.Properties.Resources.Preview1; + this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton2.Name = "toolStripButton2"; + this.toolStripButton2.Size = new System.Drawing.Size(23, 22); + this.toolStripButton2.Text = "Print Preview"; + this.toolStripButton2.Click += new System.EventHandler(this.PrintPreviewMenuItem_Click); + // + // toolStripButton3 + // + this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton3.Image = global::MgdDbg.Properties.Resources.COPY1; + this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton3.Name = "toolStripButton3"; + this.toolStripButton3.Size = new System.Drawing.Size(23, 22); + this.toolStripButton3.Text = "Copy To Clipboard"; + this.toolStripButton3.Click += new System.EventHandler(this.CopyTreeViewToolStripMenuItem_Click); + // + // Editor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(819, 596); + this.Controls.Add(this.toolStrip1); + this.Controls.Add(this.m_tabControl); + this.Controls.Add(this.m_progressBar); + this.Controls.Add(this.m_bnOK); + this.Controls.Add(this.m_bnCancel); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(575, 225); + this.Name = "Editor"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Snoop Editor"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Editor_FormClosing); + this.m_tabSystem.ResumeLayout(false); + this.listViewContextMenuStrip.ResumeLayout(false); + this.treeViewContextMenuStrip.ResumeLayout(false); + this.m_tabClasses.ResumeLayout(false); + this.m_tabClasses.PerformLayout(); + this.m_tabDocs.ResumeLayout(false); + this.m_tabControl.ResumeLayout(false); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button m_bnOK; + private System.Windows.Forms.Button m_bnCancel; + private System.Windows.Forms.ColumnHeader columnHeader1; + private System.Windows.Forms.ColumnHeader columnHeader2; + private System.Windows.Forms.TabPage m_tabSystem; + private System.Windows.Forms.ListView m_lvCmds; + private System.Windows.Forms.ColumnHeader columnHeader5; + private System.Windows.Forms.ColumnHeader columnHeader6; + private System.Windows.Forms.TreeView m_tvCmds; + private System.Windows.Forms.TabPage m_tabClasses; + private System.Windows.Forms.Label m_labelNameSpc; + private System.Windows.Forms.RadioButton m_rdBtnAdsk; + private System.Windows.Forms.RadioButton m_rdBtnSys; + private System.Windows.Forms.Button m_bnCompList; + private System.Windows.Forms.ListView m_lvClasses; + private System.Windows.Forms.ColumnHeader columnHeader3; + private System.Windows.Forms.ColumnHeader columnHeader4; + private System.Windows.Forms.Button m_btnNext; + private System.Windows.Forms.TreeView m_tvClasses; + private System.Windows.Forms.TextBox m_txtBoxSearch; + private System.Windows.Forms.Label m_labelSearch; + private System.Windows.Forms.TabPage m_tabDocs; + private System.Windows.Forms.ListView m_lvDocs; + private System.Windows.Forms.ColumnHeader m_colSymTblField; + private System.Windows.Forms.ColumnHeader m_colSymTblValue; + private System.Windows.Forms.TreeView m_tvDocs; + private System.Windows.Forms.TabControl m_tabControl; + private System.Windows.Forms.ProgressBar m_progressBar; + private System.Windows.Forms.ContextMenuStrip listViewContextMenuStrip; + private System.Windows.Forms.ContextMenuStrip treeViewContextMenuStrip; + private System.Windows.Forms.ToolStripMenuItem copyListViewToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem copyTreeViewToolStripMenuItem; + private System.Windows.Forms.PrintDialog m_printDialog; + private System.Windows.Forms.PrintPreviewDialog m_printPreviewDialog; + private System.Drawing.Printing.PrintDocument m_printDocument; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripButton toolStripButton1; + private System.Windows.Forms.ToolStripButton toolStripButton2; + private System.Windows.Forms.ToolStripButton toolStripButton3; + } +} diff --git a/MgdDbgLibrary/Snoop/Forms/Editor.cs b/MgdDbgLibrary/Snoop/Forms/Editor.cs new file mode 100644 index 0000000..31071d0 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/Editor.cs @@ -0,0 +1,889 @@ +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using System.Windows.Forms; +using System.Diagnostics; +using System.Collections; +using System.Threading; +using AcApp = Autodesk.AutoCAD.ApplicationServices; +using AcDb = Autodesk.AutoCAD.DatabaseServices; +using AcRx = Autodesk.AutoCAD.Runtime; +using System.Text.RegularExpressions; + +namespace MgdDbg.Snoop.Forms { + + /// + /// This is a tabbed form that has all the information needed for a SnoopEd command. + /// It is divided into 4 pages (Documents, Classes, Commands, Host Application Services). + /// + public partial class Editor : Form { + + private Snoop.Collectors.Objects m_snoopCollectorObjs = new MgdDbg.Snoop.Collectors.Objects(); + + private ArrayList m_classArray = new ArrayList(); + private ArrayList m_placedNodes = new ArrayList(); + private ArrayList m_treeNodes = new ArrayList(); + private ListView m_lvCur = null; + private int m_selNode; + private bool m_classesTabInited = false; + private Int32[] m_maxWidths; + private Int32 m_currentPrintItem = 0; + private String selectedTab = "Docs"; + + + + // other apps can extend this by adding their own assemblies + public static ArrayList assemblyNamesToLoad = new ArrayList(); + + /// + /// Initialize components(wizard) and tab pages + /// + public Editor() + { + InitializeComponent(); + + this.m_tvClasses.NodeMouseClick += new TreeNodeMouseClickEventHandler(this.TreeNodeSelected); + this.m_tvClasses.AfterSelect += new TreeViewEventHandler(this.TreeNodeSelected); + this.m_txtBoxSearch.TextChanged += new System.EventHandler(this.m_txtBoxSearch_TextChanged); + + // to start collecting info on an object when an item + // in the tree view is selected + this.m_tvDocs.NodeMouseClick += new TreeNodeMouseClickEventHandler(this.TreeNodeSelected); + this.m_tvDocs.AfterSelect += new TreeViewEventHandler(this.TreeNodeSelected); + this.m_tvClasses.NodeMouseClick += new TreeNodeMouseClickEventHandler(this.TreeNodeSelected); + this.m_tvClasses.AfterSelect += new TreeViewEventHandler(this.TreeNodeSelected); + this.m_tvCmds.NodeMouseClick += new TreeNodeMouseClickEventHandler(this.TreeNodeSelected); + this.m_tvCmds.AfterSelect += new TreeViewEventHandler(this.TreeNodeSelected); + + // hook up event handlers to affect a drill down + this.m_lvDocs.Click += new System.EventHandler(this.DataItemSelected); + this.m_lvDocs.DoubleClick += new System.EventHandler(this.DataItemSelected); + + this.m_lvCmds.Click += new System.EventHandler(this.DataItemSelected); + this.m_lvCmds.DoubleClick += new System.EventHandler(this.DataItemSelected); + + this.m_lvClasses.Click += new System.EventHandler(this.DataItemSelected); + this.m_lvClasses.DoubleClick += new System.EventHandler(this.DataItemSelected); + + // Initialise tab pages + InitDocsTab(); + InitSystemTab(); + } + + #region Common Event Handlers + + /// + /// This call back is used for the Documents, Commands + /// and Classes tab pages, but we need to know which so + /// we can use the correct ListView control. + /// + /// + /// + private void + TreeNodeSelected(object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs e) + { + if (sender == m_tvDocs) + m_lvCur = m_lvDocs; + else if (sender == m_tvCmds) + m_lvCur = m_lvCmds; + else + if (sender == m_tvClasses) { + if (m_tvClasses.SelectedNode != null) { + m_selNode = m_tvClasses.SelectedNode.Index; + } + m_lvCur = m_lvClasses; + System.Type tmpClass = (System.Type)e.Node.Tag; + } + else + Debug.Assert(false); + + m_snoopCollectorObjs.Collect(e.Node.Tag); + + // now display it in the list view + Snoop.Utils.Display(m_lvCur, m_snoopCollectorObjs); + } + + /// + /// This call back is used for the Documents, Commands + /// and Classes tab pages, but we need to know which so + /// we can use the correct ListView control. + /// + /// + /// + private void + TreeNodeSelected (object sender, System.Windows.Forms.TreeViewEventArgs e) + { + if (sender == m_tvDocs) + m_lvCur = m_lvDocs; + else if (sender == m_tvCmds) + m_lvCur = m_lvCmds; + else + if (sender == m_tvClasses) { + if (m_tvClasses.SelectedNode != null) { + m_selNode = m_tvClasses.SelectedNode.Index; + } + m_lvCur = m_lvClasses; + System.Type tmpClass = (System.Type)e.Node.Tag; + } + else + Debug.Assert(false); + + m_snoopCollectorObjs.Collect(e.Node.Tag); + + // now display it in the list view + Snoop.Utils.Display(m_lvCur, m_snoopCollectorObjs); + } + + /// + /// To affect a drill down when a cell is selected + /// + /// + /// + private void + DataItemSelected(object sender, System.EventArgs e) + { + ListView m_lvCur = sender as ListView; + Snoop.Utils.DataItemSelected(m_lvCur); + } + + #endregion + + #region Documents Tab + /// + /// Collects all document names and stuffs them in the tree view + /// jai 02.03.06 + /// + private void + InitDocsTab() + { + m_tvDocs.BeginUpdate(); + + // get all documents + AcApp.DocumentCollection docs = AcApp.Application.DocumentManager; + int count = docs.Count; + foreach (AcApp.Document doc in docs) { + TreeNode treeNode = new TreeNode(doc.Name); + treeNode.Tag = (AcApp.Document)doc; + m_tvDocs.Nodes.Add(treeNode); + } + // initial select condition + m_tvDocs.SelectedNode = m_tvDocs.Nodes[0]; + m_tvDocs.EndUpdate(); + } + + #endregion + + #region Classes Tab + /// + /// Collects all type names and stuffs them in the tree view + /// + private void + InitClassesTab () + { + CollectClasses(); + m_rdBtnSys.Checked = true; + } + + /// + /// + /// + private void + CollectClasses () + { + ArrayList assembliesLoaded = new ArrayList(); + try { + foreach (string assemblyName in assemblyNamesToLoad) { + System.Reflection.Assembly assembly = System.Reflection.Assembly.Load(assemblyName); + assembliesLoaded.Add(assembly); + } + + foreach (System.Reflection.Assembly assembly in assembliesLoaded) { + m_classArray.AddRange(assembly.GetTypes()); + } + } + + catch (System.Reflection.ReflectionTypeLoadException e) { + Exception[] ex = e.LoaderExceptions; + MessageBox.Show(e.Message); + } + } + + #region System NameSpace Classes + + /// + /// background thread for processing + /// + private Thread m_thread; + + /// + /// Toggle between diff. Namespace enumerations + /// + /// + /// + private void m_rdBtnSys_CheckedChanged (object sender, EventArgs e) + { + if (m_rdBtnSys.Checked) { + + if (m_classArray.Count == 0) + CollectClasses(); + + m_rdBtnAdsk.Enabled = false; + m_tvClasses.Nodes.Clear(); + + m_progressBar.Visible = true; + m_progressBar.Minimum = 0; + m_progressBar.Maximum = m_classArray.Count; + m_progressBar.Value = 0; + + /// Spawn background thread to do the processing + /// so that it doesnt freeze the UI + m_thread = new Thread(new ThreadStart(BuildClassTree)); + m_thread.Start(); + } + } + + /// + /// + /// + /// + private bool IsProgressComplete () + { + return (m_progressBar.Value == m_progressBar.Maximum) ? true : false; + } + + /// + /// + /// + private void + BuildClassTree () + { + // now hook them up in the tree + m_placedNodes.Clear(); + m_treeNodes.Clear(); + + m_placedNodes.Add(null); // add in root node + m_treeNodes.Add(null); + + TreeNode parentNode = null; + TreeNode newNode = null; + int index = 0; + + while (Regress(ref index, ref parentNode)) { + newNode = AddTreeItem((System.Type)m_classArray[index], parentNode); + + m_treeNodes.Add(newNode); + m_placedNodes.Add(m_classArray[index]); + m_classArray.RemoveAt(index); + } + + m_classArray.Clear(); + this.Invoke(new EventHandler(UpdateUIEnd)); + } + + + /// + /// This is a brute-force walk of the array to find out who everyone's parent + /// is. There is probably a more clever way to figure this out, but this will + /// work for now. + /// + /// + /// + /// + private bool + Regress (ref int index, ref TreeNode parentNode) + { + System.Type tmpClass; + int nodeLen; + + int len = m_classArray.Count; + for (int i = 0; i < len; i++) { + if (m_classArray[i] != null) { + tmpClass = (System.Type)m_classArray[i]; + nodeLen = m_placedNodes.Count; + System.Type parent = tmpClass.BaseType; + for (int j = 0; j < nodeLen; j++) { + if (parent == (System.Type)m_placedNodes[j]) { + index = i; + parentNode = (TreeNode)m_treeNodes[j]; + return true; + } + } + } + } + return false; + } + + /// + /// delegate to add tree node + /// + /// + /// + public delegate void AddNode (TreeNodeCollection treeNodes, TreeNode treeNode); + + /// + /// Adds a node into the tree and returns that node + /// + /// + /// + /// + private TreeNode + AddTreeItem (System.Type classObj, TreeNode parentNode) + { + TreeNode newNode = new TreeNode(classObj.FullName); + newNode.Name = classObj.FullName; + newNode.Tag = classObj; + + TreeNodeCollection tempNodeColl; + + if (parentNode == null) + tempNodeColl = m_tvClasses.Nodes; + else + tempNodeColl = parentNode.Nodes; + + this.Invoke(new AddNode(AddNodeMethod), tempNodeColl, newNode); + return newNode; + } + + /// + /// + /// + /// + /// + public void AddNodeMethod (TreeNodeCollection tempNodeColl, TreeNode treeNode) + { + tempNodeColl.Add(treeNode); + m_progressBar.PerformStep(); + } + + /// + /// + /// + /// + /// + public void UpdateUIEnd (object sender, EventArgs e) + { + /// the value is not always equal to max., so force it + m_progressBar.Value = m_progressBar.Maximum; + m_progressBar.Visible = false; + // initial select condition + m_tvClasses.SelectedNode = m_tvClasses.Nodes[0]; + m_rdBtnAdsk.Enabled = true; + } + + #endregion + + #region Autodesk NameSpace Classes + + /// + /// Toggle between diff. Namespace enumerations + /// + /// + /// + private void m_rdBtnAdsk_CheckedChanged (object sender, EventArgs e) + { + if (m_rdBtnAdsk.Checked) { + + m_rdBtnSys.Enabled = false; + + m_progressBar.Visible = true; + m_progressBar.Minimum = 0; + m_progressBar.Maximum = m_tvClasses.GetNodeCount(true); + m_progressBar.Value = 0; + + // to minimise flickering + m_tvClasses.CollapseAll(); + + /// Spawn background thread to do the processing + /// so that it doesnt freeze the UI + Thread thread = new Thread(new ParameterizedThreadStart(NameSpaceFilter)); + thread.Start(m_tvClasses.Nodes); + } + } + + /// + /// delegate to delete tree node + /// + /// + /// + public delegate void DeleteNode (TreeNodeCollection treeNodes, int index); + + /// + /// Filter out non "Autodesk" namespace types + /// (except for parents containing "Autodesk" types) + /// + /// + private void NameSpaceFilter (object treeNodesObj) + { + TreeNodeCollection treeNodes = treeNodesObj as TreeNodeCollection; + for (int i = 0; i < treeNodes.Count; i++) { + TreeNode node = treeNodes[i]; + if (node != null) { + System.Type type = (System.Type)node.Tag; + bool done = false; + while (node.Nodes.Count > 0 && !done) { + NameSpaceFilter(node.Nodes); + done = true; + } + if (!Regex.IsMatch(type.FullName.ToLower(), "autodesk") && node.Nodes.Count == 0) { + this.Invoke(new DeleteNode(DeleteNodeMethod), treeNodes, i); + i--; + } + } + this.Invoke(new EventHandler(ProgressBarStep)); + } + } + + /// + /// + /// + /// + /// + public void ProgressBarStep (object obj, EventArgs e) + { + m_progressBar.PerformStep(); + + if (m_progressBar.Value == m_progressBar.Maximum) { + m_progressBar.Visible = false; + + // initial select condition + m_tvClasses.SelectedNode = m_tvClasses.Nodes[0]; + + m_rdBtnSys.Enabled = true; + m_rdBtnAdsk.Enabled = true; + } + } + + /// + /// + /// + /// + /// + public void DeleteNodeMethod (TreeNodeCollection treeNodes, int index) + { + treeNodes.RemoveAt(index); + } + + #endregion + + #endregion + + #region System Tab + + /// + /// Collects all the system objects + /// + private void + InitSystemTab() + { + m_tvCmds.BeginUpdate(); + + // add Application objects (Application is static so we can't use it as an object to snoop + TreeNode appNode = new TreeNode(); + appNode.Tag = null; + appNode.Text = "Application"; + m_tvCmds.Nodes.Add(appNode); + + AddSystemObjectTreeNode("Document Manager", AcApp.Application.DocumentManager, appNode); + AddSystemObjectTreeNode("Main Window", AcApp.Application.MainWindow, appNode); + AddSystemObjectTreeNode("Menu Bar", AcApp.Application.MenuBar, appNode); + AddSystemObjectTreeNode("Menu Groups", AcApp.Application.MenuGroups, appNode); + AddSystemObjectTreeNode("Preferences", AcApp.Application.Preferences, appNode); + AddSystemObjectTreeNode("Publisher", AcApp.Application.Publisher, appNode); + AddSystemObjectTreeNode("Status Bar", AcApp.Application.StatusBar, appNode); + AddSystemObjectTreeNode("User Configuration Manager", AcApp.Application.UserConfigurationManager, appNode); + + // add other System objects + AddSystemObjectTreeNode("Class Dictionary", AcRx.SystemObjects.ClassDictionary, null); + AddSystemObjectTreeNode("Service Dictionary", AcRx.SystemObjects.ServiceDictionary, null); + AddSystemObjectTreeNode("Dynamic Linker", AcRx.SystemObjects.DynamicLinker, null); + AddSystemObjectTreeNode("Host Application Services", AcDb.HostApplicationServices.Current, null); + + m_tvCmds.EndUpdate(); + } + + /// + /// Recursively walk through a service object node (if its a Dictionary) + /// + /// Label to use for the TreeNode + /// Object to display if TreeNode selected + /// Parent node of tree (or null for root) + + private void + AddSystemObjectTreeNode(string name, object obj, TreeNode parent) + { + TreeNode newNode = new TreeNode(); + newNode.Tag = obj; + newNode.Text = name; + if (parent == null) + m_tvCmds.Nodes.Add(newNode); + else + parent.Nodes.Add(newNode); + + AcRx.Dictionary dict = obj as AcRx.Dictionary; + if (dict != null) { + IEnumerable enumerable = dict as IEnumerable; + if (enumerable != null) { + IEnumerator enumerator = enumerable.GetEnumerator(); + while (enumerator.MoveNext()) { + this.AddSystemObjectTreeNode( ((DictionaryEntry)enumerator.Current).Key.ToString(), ((DictionaryEntry)enumerator.Current).Value, newNode); + } + } + } + } + + #endregion + + #region Comparison feature + + /// + /// A comparative list of classes + /// + /// + /// + private void m_bnCompList_Click (object sender, EventArgs e) + { + ArrayList tempClassArray = new ArrayList(); + foreach (TreeNode node in m_treeNodes) { + if (node != null) + tempClassArray.Add((System.Type)node.Tag); + } + Snoop.Forms.ClassesComp form = new Snoop.Forms.ClassesComp(tempClassArray); + form.ShowDialog(); + } + + #endregion + + #region Search Feature + /// + /// Finds a class name dynamically as you + /// type along. + /// + /// + /// + private void m_txtBoxSearch_TextChanged (object sender, EventArgs e) + { + for (int i = 0; i < m_tvClasses.Nodes.Count; i++) { + if (Search(m_tvClasses.Nodes[i], true, m_txtBoxSearch.Text)) + break; + } + } + + /// + /// Small help feature to find a class buried somewhere in the + /// tree expeditiously. + /// + /// node and its children to search + /// to include the Node itself or not + /// the string to search + /// + private bool Search (TreeNode treeNode, bool includeNode, string searchStr) + { + System.Type type; + // search the node itself + if (includeNode) { + type = (System.Type)treeNode.Tag; + if (Regex.IsMatch(type.FullName.ToLower(), searchStr.ToLower())) { + m_tvClasses.SelectedNode = treeNode; + return true; + } + } + // search the node's children + for (int i = 0; i < treeNode.Nodes.Count; i++) { + TreeNode node = treeNode.Nodes[i]; + if (node != null) { + type = (System.Type)node.Tag; + bool done = false; + if (Regex.IsMatch(type.FullName.ToLower(), searchStr.ToLower())) { + m_tvClasses.SelectedNode = node; + return true; + } + while (node.Nodes.Count > 0 && !done) { + if (Search(node, true, searchStr)) + return true; + done = true; + } + } + } + return false; + } + + /// + /// To find the next match + /// + /// + /// + private void m_btnNext_Click (object sender, EventArgs e) + { + if (m_tvClasses.SelectedNode == null) + return; + + if (m_tvClasses.SelectedNode.Nodes.Count > 0) { + if (Search(m_tvClasses.SelectedNode, false, m_txtBoxSearch.Text)) + return; + } + else { + TreeNode siblingNode = m_tvClasses.SelectedNode.NextNode; + while (siblingNode != null) { + if (Search(siblingNode, true, m_txtBoxSearch.Text)) + return; + siblingNode = siblingNode.NextNode; + } + + TreeNode bkTrackNode = GetBackTrackNode(m_tvClasses.SelectedNode); + if (bkTrackNode != null) { + if (BackTrack(bkTrackNode)) + return; + } + } + // invoke the textchanged event instead of this + for (int i = 0; i < m_tvClasses.Nodes.Count; i++) { + if (Search(m_tvClasses.Nodes[i], true, m_txtBoxSearch.Text)) + break; + } + } + + /// + /// Get the node to go back to + /// + /// the node to go back from + /// the node to go back to + private TreeNode GetBackTrackNode (TreeNode node) + { + if (node == null) + return null; + + if (node.Parent == null) + return null; + + if (node.Parent.NextNode == null) + return null; + + TreeNode bkTrackNode = node.Parent.NextNode; + if (bkTrackNode != null) + return bkTrackNode; + else { + if (node.Parent != null) + return GetBackTrackNode(node.Parent); + else + return null; + } + } + + /// + /// Get back in the tree to search for the string + /// This is a depth first search. First search in + /// the siblings. If not found, then go to the parent. + /// + /// the parent node + /// pass along success/failure of Search() + private bool BackTrack (TreeNode parent) + { + if (parent != null) { + if (Search(parent, true, m_txtBoxSearch.Text)) + return true; + else { + TreeNode siblingNode = parent.NextNode; + while (siblingNode != null) { + if (Search(siblingNode, true, m_txtBoxSearch.Text)) + return true; + siblingNode = siblingNode.NextNode; + } + if (parent.Parent != null) + return BackTrack(parent.Parent.NextNode); + else + return false; + } + } + return false; + } + #endregion + + /// + /// The Classes tab takes a ton of time so don't init it until someone + /// selects it + /// + /// + /// + private void + TabSelected(object sender, System.EventArgs e) + { + TabControl tabCtrl = (TabControl)sender; + + /// progress bar is only relevant to the Classes tab + if ((tabCtrl.SelectedTab == m_tabSystem) || (tabCtrl.SelectedTab == m_tabDocs)) { + m_progressBar.Visible = false; + + if (tabCtrl.SelectedTab == m_tabDocs) { + selectedTab = "Docs"; + } + else { + selectedTab = "System"; + } + } + else { + /// show progress bar only if it is still active + m_progressBar.Visible = !IsProgressComplete(); + } + + if (tabCtrl.SelectedTab == m_tabClasses) { + if (m_classesTabInited == false) { + m_classesTabInited = true; + InitClassesTab(); + } + selectedTab = "Classes"; + } + } + + #region Copy Events + private void + CopyListViewToolStripMenuItem_Click (object sender, System.EventArgs e) + { + if (m_lvDocs.SelectedItems.Count > 0) { + Utils.CopyToClipboard(m_lvDocs.SelectedItems[0]); + m_lvDocs.SelectedItems.Clear(); + } + else if (m_lvCmds.SelectedItems.Count > 0) { + Utils.CopyToClipboard(m_lvCmds.SelectedItems[0]); + m_lvCmds.SelectedItems.Clear(); + } + else if (m_lvClasses.SelectedItems.Count > 0) { + Utils.CopyToClipboard(m_lvClasses.SelectedItems[0]); + m_lvClasses.SelectedItems.Clear(); + } + else { + Clipboard.Clear(); + } + } + + private void + CopyTreeViewToolStripMenuItem_Click (object sender, System.EventArgs e) + { + Clipboard.Clear(); + + if (selectedTab == "Docs") { + if (m_tvDocs.SelectedNode != null) { + Utils.CopyToClipboard(m_lvDocs); + } + } + else if (selectedTab == "System") { + if (m_tvCmds.SelectedNode != null) { + Utils.CopyToClipboard(m_lvCmds); + } + } + else if (selectedTab == "Classes") { + if (m_tvClasses.SelectedNode != null) { + Utils.CopyToClipboard(m_lvClasses); + } + } + } + #endregion + + + #region TBD + + /// + /// + /// + /// + private void + DisplayCurrentProxyInfo (System.Type classDef) + { + // TBD: + } + + /// + /// + /// + /// + private void + DisplayCurrentProtocolExtInfo (System.Type classDef) + { + // TBD: Protocol Extension objects. + } + #endregion + + /// + /// if user escapes out of form , kill the processing thread + /// + /// + /// + private void Editor_FormClosing (object sender, FormClosingEventArgs e) + { + if (m_thread != null) + { + m_thread.Abort(); + } + } + + + #region Print Events + private void + PrintMenuItem_Click (object sender, EventArgs e) + { + if (selectedTab == "Docs") { + Utils.UpdatePrintSettings(m_printDocument, m_tvDocs, m_lvDocs, ref m_maxWidths); + Utils.PrintMenuItemClick(m_printDialog, m_tvDocs); + } + else if (selectedTab == "System") { + Utils.UpdatePrintSettings(m_printDocument, m_tvCmds, m_lvCmds, ref m_maxWidths); + Utils.PrintMenuItemClick(m_printDialog, m_tvCmds); + } + else if (selectedTab == "Classes") { + Utils.UpdatePrintSettings(m_printDocument,m_tvClasses, m_lvClasses, ref m_maxWidths); + Utils.PrintMenuItemClick(m_printDialog, m_tvClasses); + } + } + + private void + PrintPreviewMenuItem_Click (object sender, EventArgs e) + { + if (selectedTab == "Docs") { + Utils.UpdatePrintSettings(m_printDocument, m_tvDocs, m_lvDocs, ref m_maxWidths); + Utils.PrintPreviewMenuItemClick(m_printPreviewDialog, m_tvDocs); + } + else if (selectedTab == "System") { + Utils.UpdatePrintSettings(m_printDocument, m_tvCmds, m_lvCmds, ref m_maxWidths); + Utils.PrintPreviewMenuItemClick(m_printPreviewDialog, m_tvCmds); + } + else if (selectedTab == "Classes") { + Utils.UpdatePrintSettings(m_printDocument, m_tvClasses, m_lvClasses, ref m_maxWidths); + Utils.PrintPreviewMenuItemClick(m_printPreviewDialog, m_tvClasses); + } + } + + private void + PrintDocument_PrintPage (object sender, System.Drawing.Printing.PrintPageEventArgs e) + { + if (selectedTab == "Docs") { + m_currentPrintItem = Utils.Print(m_tvDocs.SelectedNode.Text, m_lvDocs, e, m_maxWidths[0], m_maxWidths[1], m_currentPrintItem); + } + else if (selectedTab == "System") { + m_currentPrintItem = Utils.Print(m_tvCmds.SelectedNode.Text, m_lvCmds, e, m_maxWidths[0], m_maxWidths[1], m_currentPrintItem); + } + else if (selectedTab == "Classes") { + m_currentPrintItem = Utils.Print(m_tvClasses.SelectedNode.Text, m_lvClasses, e, m_maxWidths[0], m_maxWidths[1], m_currentPrintItem); + } + } + #endregion + } +} diff --git a/MgdDbgLibrary/Snoop/Forms/Editor.resx b/MgdDbgLibrary/Snoop/Forms/Editor.resx new file mode 100644 index 0000000..af295f0 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/Editor.resx @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 195, 17 + + + 378, 17 + + + 168, 54 + + + 17, 54 + + + + + AAABAAYAICAQAAAAAADoAgAAZgAAABAQEAAAAAAAKAEAAE4DAAAgIAAAAQAIAKgIAAB2BAAAEBAAAAEA + CABoBQAAHg0AACAgAAABACAAqBAAAIYSAAAQEAAAAQAgAGgEAAAuIwAAKAAAACAAAABAAAAAAQAEAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAACAgACAAAAAgACAAICAAACAgIAAwMDAAAAA + /wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIoiI + iIiIiIiIiIiIiIiIiIiCIigiIiIozMzMzMzMyCIogiIoIiIiKM7m5ubm5sgiKIIiKCIiIijObm5ubm7I + IiiCIigiIiIozubm5ubmyCIogiIoIiIiKM5ubm5ubsgiKIIiKCIiIijO5ubm5ubIIiiIiIiIiIiIzm5u + bm5uyCIogRERERERGM7u7u7u7sgiKIHZWVlZWRjMzMzMzMzIIiiB1ZWVlZUYiIiIiIiIiIiIgdlZWVlZ + GDMzMzMzMzMzOIHVlZWVlRg/uLi4uLi4uDiB2VlZWVkYP7uLi4uLi4s4gdWVlZWVGD+4uLi4uLi4OIHZ + WVlZWRg/u4uLi4uLiziB1ZWVlZUYP7i4uLi4uLg4gdlZWVlZGD+7i4uLi4uLOIHVlZWVlRg/uLi4uLi4 + uDiB3d3d3d0YP7uLi4uLi4s4gRERERERGD+4uLi4uLi4OIiIiIiIiIg/u4uLi4uLiziCIiIiIiIoP7i4 + uLi4uLg4giIiIiIiKD+7i4uLi4uLOIIiIiIiIig/uLi4uLi4uDiCIiIiIiIoP7u7u7u7u7s4giIiIiIi + KD//////////OIIiIiIiIigzMzMzMzMzMziIiIiIiIiIiIiIiIiIiIiIIiIiIiIiIiIiIiIiIiIiIv// + ////////AAAAAHv4AA57+AAOe/gADnv4AA57+AAOe/gADgAAAA4AAAAOAAAADgAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/4AAB/+AAAf/gAAH/4AAB/+AAAf/gAAAAA + AAD/////KAAAABAAAAAgAAAAAQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAACA + gACAAAAAgACAAICAAACAgIAAwMDAAAAA/wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAiIiIiIiIiIoiI + iIiIiIiIgigijMzMyCiCKCKM5mbIKIiIiIzu7sgogRERjMzMyCiB2ZGIiIiIiIHZkYMzMzM4gdmRg/u7 + uziB3dGD+7u7OIEREYP7u7s4iIiIg/u7uziCIiKD+7u7OIIiIoP///84giIigzMzMziIiIiIiIiIiP// + KCIAACjObALm5mwCIigAAoiIAAKIzgAAbm4AACIoAAAREQAAGM4AAO7uAAAiKHwAWVl8ABjMfADMzAAA + IigoAAAAIAAAAEAAAAABAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAA + AACAAIAAgIAAAICAgADA3MAA8MqmAKo/KgD/PyoAAF8qAFVfKgCqXyoA/18qAAB/KgBVfyoAqn8qAP9/ + KgAAnyoAVZ8qAKqfKgD/nyoAAL8qAFW/KgCqvyoA/78qAADfKgBV3yoAqt8qAP/fKgAA/yoAVf8qAKr/ + KgD//yoAAABVAFUAVQCqAFUA/wBVAAAfVQBVH1UAqh9VAP8fVQAAP1UAVT9VAKo/VQD/P1UAAF9VAFVf + VQCqX1UA/19VAAB/VQBVf1UAqn9VAP9/VQAAn1UAVZ9VAKqfVQD/n1UAAL9VAFW/VQCqv1UA/79VAADf + VQBV31UAqt9VAP/fVQAA/1UAVf9VAKr/VQD//1UAAAB/AFUAfwCqAH8A/wB/AAAffwBVH38Aqh9/AP8f + fwAAP38AVT9/AKo/fwD/P38AAF9/AFVffwCqX38A/19/AAB/fwBVf38Aqn9/AP9/fwAAn38AVZ9/AKqf + fwD/n38AAL9/AFW/fwCqv38A/79/AADffwBV338Aqt9/AP/ffwAA/38AVf9/AKr/fwD//38AAACqAFUA + qgCqAKoA/wCqAAAfqgBVH6oAqh+qAP8fqgAAP6oAVT+qAKo/qgD/P6oAAF+qAFVfqgCqX6oA/1+qAAB/ + qgBVf6oAqn+qAP9/qgAAn6oAVZ+qAKqfqgD/n6oAAL+qAFW/qgCqv6oA/7+qAADfqgBV36oAqt+qAP/f + qgAA/6oAVf+qAKr/qgD//6oAAADUAFUA1ACqANQA/wDUAAAf1ABVH9QAqh/UAP8f1AAAP9QAVT/UAKo/ + 1AD/P9QAAF/UAFVf1ACqX9QA/1/UAAB/1ABVf9QAqn/UAP9/1AAAn9QAVZ/UAKqf1AD/n9QAAL/UAFW/ + 1ACqv9QA/7/UAADf1ABV39QAqt/UAP/f1AAA/9QAVf/UAKr/1AD//9QAVQD/AKoA/wAAH/8AVR//AKof + /wD/H/8AAD//AFU//wCqP/8A/z//AABf/wBVX/8Aql//AP9f/wAAf/8AVX//AKp//wD/f/8AAJ//AFWf + /wCqn/8A/5//AAC//wBVv/8Aqr//AP+//wAA3/8AVd//AKrf/wD/3/8AVf//AKr//wD/zMwA/8z/AP// + MwD//2YA//+ZAP//zAAAfwAAVX8AAKp/AAD/fwAAAJ8AAFWfAACqnwAA/58AAAC/AABVvwAAqr8AAP+/ + AAAA3wAAVd8AAKrfAAD/3wAAVf8AAKr/AAAAACoAVQAqAKoAKgD/ACoAAB8qAFUfKgCqHyoA/x8qAAA/ + KgBVPyoA8Pv/AKSgoACAgIAAAAD/AAD/AAAA//8A/wAAAAAAAAD//wAA////AP39/f39/f39/f39/f39 + /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39 + /f39/f39/f39/f39/f39/f39/f39/f39qoYIqoYIhqoIqgiqCaoIqgiqhqqGhoYIhoYIqv39/f0I/f39 + /ar9/f39/YY2Ng4yDg4ODgoOCgoKCgqG/f39/Yb9/f39CP39/f39qjY7Ozs3Nzc3NjMSMjIOCqr9/f39 + qv39/f2G/f39/f0IN19fOzs3Nzc3NjcODg4KCP39/f0I/f39/ar9/f39/ao6X19fXzs7Ozc3NzY3NgqG + /f39/Yb9/f39CP39/f39hl9jY19jX187Ozs7Nzc3Dqr9/f39qv39/f2G/f39/f0IOodjh19jX19fXztf + OzcOCP39/f0ICAmqCAiqCKoICapfCYdjh2ODY19fXzs7Ow6q/f39/QhITEwoSCUoKSQoqmMJCYcJCWNj + Y2NfY19fNgj9/f39qkyZmZmYmJRwlCmqX19fXl9fX186WzY3Njc2gv39/f0JcJ2dmZmZlJmUJAmqCaoJ + hggIqggICKoIqggI/f39/YZwnp2dnZmZmJVMqnx8fHx8fFR8VHhUVFRUVKr9/f39CHChoZ2dnZ2ZmUwJ + fKSkxqSkxqSkpKSkpKBUCP39/f2qcKLDoqGdnZ2ZTKp8ysakxqSkxqSkxqSkpFSq/f39/QiUpqbDoqHE + nZ1Mq3ykqMakyqSkxqSkpKSkVAj9/f39hpTIyKbHoqGhoXAIfMrLpMqkxqSkxqTGpKRUqv39/f0IlMym + yKbIpcShcAh8y6jKpMqkxsqkpKSkxlQI/f39/aqUzMzMyKbIpqJwqnzLy8qpxsqkpMakxqSkeAj9/f39 + CJSUlJSUlJSUlJQJgMupy8qpysqkyqSkxqRUqv39/f2GCKoIqgiqCKoIhgigrcvPqcuoy8qkxsqkxnyG + /f39/ar9/f39/f39/f39qnzPz6nLy8uoyqnKpKTKVAj9/f39CP39/f39/f39/f0IfNDPz8+py8upyqjG + yqR8hv39/f2G/f39/f39/f39/Qik0K7P0M+ty8vLy6jKpXyq/f39/ar9/f39/f39/f39CHzQ09Ctz8/P + qcupy6jKeAj9/f39CP39/f39/f39/f2qoNPQ0NPQ0M/Qz8vLy6l8CP39/f2G/f39/f39/f39/QmkfKR8 + oHx8fHx8fHx8fHyG/f39/aoIqgiqCKoIqgiqCKoIqgiqCKoIqgiqCKoIqgj9/f39/f39/f39/f39/f39 + /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f3///////////// + ///AAAAD3vgAA974AAPe+AAD3vgAA974AAPe+AADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAADwAAAA9/4AAPf+AAD3/gAA9/4AAPf+AAD3/gAA8AAAAP//////////ygA + AAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAA + gACAgAAAgICAAMDcwADwyqYAqj8qAP8/KgAAXyoAVV8qAKpfKgD/XyoAAH8qAFV/KgCqfyoA/38qAACf + KgBVnyoAqp8qAP+fKgAAvyoAVb8qAKq/KgD/vyoAAN8qAFXfKgCq3yoA/98qAAD/KgBV/yoAqv8qAP// + KgAAAFUAVQBVAKoAVQD/AFUAAB9VAFUfVQCqH1UA/x9VAAA/VQBVP1UAqj9VAP8/VQAAX1UAVV9VAKpf + VQD/X1UAAH9VAFV/VQCqf1UA/39VAACfVQBVn1UAqp9VAP+fVQAAv1UAVb9VAKq/VQD/v1UAAN9VAFXf + VQCq31UA/99VAAD/VQBV/1UAqv9VAP//VQAAAH8AVQB/AKoAfwD/AH8AAB9/AFUffwCqH38A/x9/AAA/ + fwBVP38Aqj9/AP8/fwAAX38AVV9/AKpffwD/X38AAH9/AFV/fwCqf38A/39/AACffwBVn38Aqp9/AP+f + fwAAv38AVb9/AKq/fwD/v38AAN9/AFXffwCq338A/99/AAD/fwBV/38Aqv9/AP//fwAAAKoAVQCqAKoA + qgD/AKoAAB+qAFUfqgCqH6oA/x+qAAA/qgBVP6oAqj+qAP8/qgAAX6oAVV+qAKpfqgD/X6oAAH+qAFV/ + qgCqf6oA/3+qAACfqgBVn6oAqp+qAP+fqgAAv6oAVb+qAKq/qgD/v6oAAN+qAFXfqgCq36oA/9+qAAD/ + qgBV/6oAqv+qAP//qgAAANQAVQDUAKoA1AD/ANQAAB/UAFUf1ACqH9QA/x/UAAA/1ABVP9QAqj/UAP8/ + 1AAAX9QAVV/UAKpf1AD/X9QAAH/UAFV/1ACqf9QA/3/UAACf1ABVn9QAqp/UAP+f1AAAv9QAVb/UAKq/ + 1AD/v9QAAN/UAFXf1ACq39QA/9/UAAD/1ABV/9QAqv/UAP//1ABVAP8AqgD/AAAf/wBVH/8Aqh//AP8f + /wAAP/8AVT//AKo//wD/P/8AAF//AFVf/wCqX/8A/1//AAB//wBVf/8Aqn//AP9//wAAn/8AVZ//AKqf + /wD/n/8AAL//AFW//wCqv/8A/7//AADf/wBV3/8Aqt//AP/f/wBV//8Aqv//AP/MzAD/zP8A//8zAP// + ZgD//5kA///MAAB/AABVfwAAqn8AAP9/AAAAnwAAVZ8AAKqfAAD/nwAAAL8AAFW/AACqvwAA/78AAADf + AABV3wAAqt8AAP/fAABV/wAAqv8AAAAAKgBVACoAqgAqAP8AKgAAHyoAVR8qAKofKgD/HyoAAD8qAFU/ + KgDw+/8ApKCgAICAgAAAAP8AAP8AAAD//wD/AAAAAAAAAP//AAD///8A/f39/f39/f39/f39/f39/f0I + hgiqCKoICKoICKaGCP39qv39hv2GNg4ODjII/ar9/Yb9/ar9qjdjXzsOCP2G/f0IhquGCAleCWNfNob9 + qv39qkxMTEgIX19fX18I/Qj9/QhwnZlMqoYIqggIqgiG/f2qcKadcAl8fFQDVFQDqv39CHDMpnCqfMvL + ysrKVAj9/QiUlHBwCYDPy8/LylSG/f2GqoYIqgig0M/Py8t8qv39CP39/f2GpNDQ0M/PfAn9/ar9/f39 + qqT20NDQ0Hyq/f2G/f39/QmkpKSloKR8CP39CKoIhgiqCIYIqgiGCKr9/f39/f39/f39/f39/f39/f// + hv2AAf0ItAX9/bQFX2OABWNfgAU7O4ABNzeAAf39gAGq/YAB/YaAAf39vAE6h7wBX2O8AV9fgAE7N/// + /f0oAAAAIAAAAEAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAADCv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAA + AAAAAAAAwr/B/7Z3Sf+zckT/rm0//6toO/+nYjb/pF4y/6BZLv+dVCr/mlEn/5dNI/+VSiH/kkce/5FE + HP+RRBz/kUUb/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/AAAAAAAA + AAAAAAAAAAAAAAAAAADCv8H/v4JS//+aZv//lWD/+5Bc//WLV//uh1P/54FO/997S//Wdkb/zXBD/8Vr + QP+9Zj3/tGI5/65dN/+RRRz/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/AAAAAAAAAAAAAAAAAAAAAMK/ + wf8AAAAAAAAAAAAAAAAAAAAAAAAAAMK/wf/GjFv//6Rz//+fbf//m2f//5Zh//yRXf/3jVj/8IhV/+mD + UP/hfUz/2HhI/9ByRP/HbED/v2c9/5VJIf/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAA + AAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAAAAAAAAAAwr/B/86WZP//r4L//6p7//+mdf//oW7//5xo//+X + Yv/9kl7/+I5a//KJVf/rhFH/4n5N/9t4SP/Sc0X/mlEm/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAA + AAAAAAAAAAAAAAAAAADCv8H/AAAAAAAAAAAAAAAAAAAAAAAAAADCv8H/1J9s//+4kf//tIv//6+E//+r + ff//p3f//6Jw//+eav//mWT//pRf//qQWv/0i1b/7IVS/+V/Tv+gWC7/wr/B/wAAAAAAAAAAAAAAAAAA + AADCv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAAAAAAMK/wf/apnP//7+d//+7 + mP//uJL//7WM//+whv//rH///6d4//+jcf//n2v//5ll//+VYP/6kVv/9YxY/6diN//Cv8H/AAAAAAAA + AAAAAAAAAAAAAMK/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/96t + eP//wqL//8Gi//+/nv//vJn//7mT//+2jv//sYj//66A//+pev//pHP//6Bt//+bZ///l2L/r20//8K/ + wf8AAAAAAAAAAAAAAAAAAAAAwr/B/xYXev8XF3b/GBVx/xkUbf8ZFGr/GhNm/xoSY/8bEV//HBFd/xwQ + W//Cv8H/4K96///Cov//wqL//8Ki///Cov//wJ///72b//+6lf//t4///7KJ//+ugv//qnv//6V0//+h + bv+3d0n/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/FRqE/0dN1v8/RNL/Nz3Q/y40zv8nLcz/ISfK/xwh + yf8WHMf/GxJh/8K/wf/gr3r/4K96/+Cvev/gr3r/3614/9yqdf/apnL/16Nw/9Sea//Rmmj/zZZk/8qR + X//GjFz/w4dW/7+CUv/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8SHZD/WF3a/05U1/9FS9X/PUPS/zU7 + 0P8uM83/JyzL/yAmyf8aFGn/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/xAfnP9obt7/YGTc/1Zb + 2f9NU9f/RUrU/ztB0v80OdD/LDHO/xgWcv/Cv8H/Dn+n/w18pP8MeqH/DHie/wt1m/8Kc5j/CXGV/wlv + k/8JbJD/CGqN/wdpi/8HZ4j/BmWH/wZkhf8GYoP/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/DiKp/3l+ + 4/9vdeH/Zmze/11i2/9UWtn/S1HW/0NI1P86P9H/Fhh9/8K/wf8Ogar/Barp/wGo6P8Apef/AKPm/wCi + 5P8An+L/AJ7h/wCd3/8AnN7/AJnc/wCY2/8AmNn/AJbX/wZjhP/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/ + wf8MJbX/iI7n/4CF5v93fOP/bnPg/2Vr3f9bYdv/UljY/0lP1v8UGoj/wr/B/w+Erf8Lrur/Bqvq/wOo + 6f8Apuf/AKTm/wCi5f8AoOT/AJ/i/wCd4f8AnN//AJrd/wCZ2/8AmNr/BmWH/8K/wf8AAAAAAAAAAAAA + AAAAAAAAwr/B/wkowP+WnOz/jpTq/4aL6P9+hOX/dXri/2xx4P9jaN3/WV/b/xEek//Cv8H/EIaw/xay + 7P8Or+z/Cavr/wWq6v8Bp+j/AKbn/wCj5f8AoeT/AJ/j/wCe4f8AnOD/AJve/wCa3f8HZ4n/wr/B/wAA + AAAAAAAAAAAAAAAAAADCv8H/CCrK/6Ko7/+coe7/lZrr/42T6f+Fiub/fIHl/3N54v9rcN//ECGg/8K/ + wf8QiLP/I7nu/xq07f8Ssez/C63r/war6v8Cqen/AKbo/wCk5v8AouX/AKHk/wCf4f8AneH/AJzf/who + i//Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8GLNP/q7Hy/6as8P+hpu//mp/u/5OY6/+LkOj/g4nm/3qA + 5P8NI6z/wr/B/xCKtv8xvvD/J7rv/x627f8Vsuz/Dq/s/wmr6/8Equn/Aafo/wCl5/8Ao+X/AKHk/wCf + 4v8AnuH/CGqO/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wUu2/+vtPP/r7Tz/6qv8v+mq/D/oKXv/5me + 7f+Sl+v/io/p/wsmt//Cv8H/Eo24/0HF8f82wfD/LLzv/yK47v8atO3/EbHs/wut6/8Gq+r/A6np/wCm + 6P8Apeb/AKLl/wCh5P8IbJD/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/BC/h/wQv3/8FL9z/BS3Z/wYt + 1v8GLNL/ByvP/wgqy/8IKcb/CSnC/8K/wf8Sjrv/Uszy/0fH8f87w/H/Mb7v/ye67/8et+7/FbPt/w6v + 6/8IrOv/BKnp/wGo6P8Apef/AKPl/wluk//Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/xKRvf9j0/P/WM/z/0zK8f9BxfH/N8Hw/yy8 + 7/8iuO7/GbTt/xGx7P8Lruv/Bqrq/wOo6f8Apuf/CnGV/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADCv8H/E5LA/3Ta8/9q1fP/XtHz/1LM + 8v9Hx/H/O8Pw/zG+7/8nu+//Hrbt/xay7f8Or+v/CKzq/wSq6f8Kc5j/wr/B/wAAAAAAAAAAAAAAAAAA + AADCv8H/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMK/wf8UlMH/hOD1/3rc + 9f9v2PP/ZNTy/1jO8v9NyvH/Qsbx/zbB8P8svO//I7ju/xm07f8SsOz/C67r/wt2m//Cv8H/AAAAAAAA + AAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwr/B/xSW + w/+T5vb/iuL1/3/e9P912vT/adbz/13R8/9SzPL/R8jx/zzD8P8xvvD/J7rv/x627v8Vsuz/C3ie/8K/ + wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AADCv8H/FJbG/57r9/+X6Pb/juT1/4Th9f963fX/b9j0/2PT8/9Yz/L/TMrx/0HF8f83wO//LLzv/yK4 + 7v8MeqH/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAMK/wf8VmMf/qO/3/6Lt9/+b6vb/kub2/4rj9f9/3vX/dNrz/2rV8/9d0fP/Uszy/0fI + 8f88w/D/Mr7v/w19pP/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAwr/B/xWZyP8UmMf/FZfF/xSVw/8TlML/E5K//xOQvf8Sjrv/EYy4/xGK + tv8QiLL/D4Ww/w+Erf8Pgar/Dn+n/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP// + /////////////8AAAAPe+AAD3vgAA974AAPe+AAD3vgAA974AAPAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAAD3/gAA9/4AAPf+AAD3/gAA9/4AAPf+AADwAAAA/// + ////////KAAAABAAAAAgAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwMDA/8DA + wP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP8AAAAAAAAAAMDA + wP8AAAAAAAAAAMDAwP8AAAAAwMDA/8F2R/+9bj//umc6/7diNf+3YjX/wMDA/wAAAADAwMD/AAAAAAAA + AADAwMD/AAAAAAAAAADAwMD/AAAAAMDAwP/RkmD//7aP//+ldP/8kl3/vW0//8DAwP8AAAAAwMDA/wAA + AAAAAAAAwMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/3ap2///Cov//to7//6V0/8uJWP/AwMD/AAAAAMDA + wP8AAAAAAAAAAMDAwP8THI7/FBqF/xYYfP8XFnP/wMDA/+Cvev/gr3r/4K96/92qdv/ao3D/wMDA/wAA + AADAwMD/AAAAAAAAAADAwMD/ECCd/2Fn3P8zOc//FRmC/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DA + wP/AwMD/wMDA/wAAAAAAAAAAwMDA/w0krP+Pler/YWbd/xIcj//AwMD/DHmf/wpzmP8Ib5L/B2uO/wdq + jf8Gao3/B2qN/8DAwP8AAAAAAAAAAMDAwP8KJrv/r7Tz/5CU6v8PIJ//wMDA/w+Dq/87y/z/Kcb8/xrD + /P8QwPv/EMD7/wdqjf/AwMD/AAAAAAAAAADAwMD/CCrI/woowP8LJrf/DSSu/8DAwP8Sjbj/Zdb9/0/Q + /P88y/v/Kcf7/xrC+/8IbZD/wMDA/wAAAAAAAAAAwMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/FpfG/43h + /f962/3/Zdb8/0/Q/P87zPz/CXSZ/8DAwP8AAAAAAAAAAMDAwP8AAAAAAAAAAAAAAAAAAAAAwMDA/xif + z/+u6f7/n+X9/47h/f953P3/ZNb9/w19pP/AwMD/AAAAAAAAAADAwMD/AAAAAAAAAAAAAAAAAAAAAMDA + wP8apNX/uez+/7ns/v+u6f7/oOX9/43h/f8Rh7H/wMDA/wAAAAAAAAAAwMDA/wAAAAAAAAAAAAAAAAAA + AADAwMD/GqTV/xqk1f8apNX/GaHR/xecy/8WmMb/FJK+/8DAwP8AAAAAAAAAAMDAwP/AwMD/wMDA/8DA + wP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/AAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAAgAEAALQF + wf+0BQAAgAUAAIAFAACAAQAAgAHB/4ABAACAAQAAgAEAALwBAAC8AQAAvAHB/4ABbP///5H/ + + + + 309, 54 + + \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/Forms/ExtDict.cs b/MgdDbgLibrary/Snoop/Forms/ExtDict.cs new file mode 100644 index 0000000..f4c6c09 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/ExtDict.cs @@ -0,0 +1,77 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Collections; +using System.Windows.Forms; +using Autodesk.AutoCAD.DatabaseServices; +using MgdDbg.CompBuilder; + +namespace MgdDbg.Snoop.Forms +{ + /// + /// Summary description for ExtDict. + /// + public class ExtDict : DBObjects + { + public + ExtDict(Autodesk.AutoCAD.DatabaseServices.ObjectId extDictId, TransactionHelper tr) + : base(tr) + { + m_tvObjs.BeginUpdate(); + + TreeNode rootNode = new TreeNode("Extension Dictionary"); + rootNode.Tag = extDictId; + m_tvObjs.Nodes.Add(rootNode); + + AddDictionaryToTree(extDictId, rootNode); + + m_tvObjs.Sorted = true; + rootNode.Expand(); + m_tvObjs.SelectedNode = m_tvObjs.Nodes[0]; + + m_tvObjs.EndUpdate(); + } + + private void + AddDictionaryToTree(Autodesk.AutoCAD.DatabaseServices.ObjectId dictId, TreeNode parentNode) + { + // NOTE: when recursively processing items in a dictionary + // we may encounter things that are not derived from DBDictionary. + // In that case, the cast to type DBDictionary will fail and + // we'll just return without adding any nested items. + Autodesk.AutoCAD.DatabaseServices.DBObject tmpObj = m_trans.Transaction.GetObject(dictId, OpenMode.ForRead); + DBDictionary dbDict = tmpObj as DBDictionary; + if (dbDict != null) { + foreach (DictionaryEntry curEntry in dbDict) { + TreeNode newNode = new TreeNode((string)curEntry.Key); + newNode.Tag = curEntry.Value; + parentNode.Nodes.Add(newNode); + + // if this is a dictionary, it will recursively add + // all of its children to the tree + AddDictionaryToTree((Autodesk.AutoCAD.DatabaseServices.ObjectId)curEntry.Value, newNode); + } + } + } + } +} diff --git a/MgdDbgLibrary/Snoop/Forms/GenericPropGrid.cs b/MgdDbgLibrary/Snoop/Forms/GenericPropGrid.cs new file mode 100644 index 0000000..316cc1f --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/GenericPropGrid.cs @@ -0,0 +1,227 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Windows.Forms; +using AcDb = Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.Snoop.Forms +{ + /// + /// This Form makes use of the built-in abilities of Reflection and the PropertyGrid + /// class to automatically list out the data of an object. Because we don't have much + /// control, it will get output in the order that it chooses (or alphabetical) and + /// most of the items will appear as Greyed-out, read-only items. But, we don't have + /// to go write a SnoopCollector for every item in the .NET system. We will only worry + /// about things specific to the AutoCAD environment. + /// + public class GenericPropGrid : System.Windows.Forms.Form + { + private System.Windows.Forms.PropertyGrid m_pgProps; + private System.Windows.Forms.Button m_bnOK; + private System.Windows.Forms.Button m_bnCancel; + private System.Windows.Forms.ContextMenu m_mnuContext; + private System.Windows.Forms.MenuItem m_mnuItemShowObjInfo; + private System.Windows.Forms.MenuItem m_mnuItemShowClassInfo; + + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public + GenericPropGrid(object obj) + { + // Required for Windows Form Designer support + InitializeComponent(); + + m_pgProps.SelectedObject = obj; // This all we need to do for Reflection to kick in + } + + /// + /// Clean up any resources being used. + /// + protected override void + Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.m_pgProps = new System.Windows.Forms.PropertyGrid(); + this.m_mnuContext = new System.Windows.Forms.ContextMenu(); + this.m_mnuItemShowObjInfo = new System.Windows.Forms.MenuItem(); + this.m_mnuItemShowClassInfo = new System.Windows.Forms.MenuItem(); + this.m_bnOK = new System.Windows.Forms.Button(); + this.m_bnCancel = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // m_pgProps + // + this.m_pgProps.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right); + this.m_pgProps.CommandsVisibleIfAvailable = true; + this.m_pgProps.ContextMenu = this.m_mnuContext; + this.m_pgProps.Cursor = System.Windows.Forms.Cursors.Hand; + this.m_pgProps.LargeButtons = false; + this.m_pgProps.LineColor = System.Drawing.SystemColors.ScrollBar; + this.m_pgProps.Location = new System.Drawing.Point(16, 16); + this.m_pgProps.Name = "m_pgProps"; + this.m_pgProps.PropertySort = System.Windows.Forms.PropertySort.Alphabetical; + this.m_pgProps.Size = new System.Drawing.Size(520, 440); + this.m_pgProps.TabIndex = 0; + this.m_pgProps.Text = "Properties"; + this.m_pgProps.ViewBackColor = System.Drawing.SystemColors.Window; + this.m_pgProps.ViewForeColor = System.Drawing.SystemColors.WindowText; + // + // m_mnuContext + // + this.m_mnuContext.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.m_mnuItemShowObjInfo, + this.m_mnuItemShowClassInfo}); + this.m_mnuContext.Popup += new System.EventHandler(this.OnMenuContextPopup); + // + // m_mnuItemShowObjInfo + // + this.m_mnuItemShowObjInfo.Index = 0; + this.m_mnuItemShowObjInfo.Text = "Show Object Info..."; + this.m_mnuItemShowObjInfo.Click += new System.EventHandler(this.OnShowObjInfo); + // + // m_mnuItemShowClassInfo + // + this.m_mnuItemShowClassInfo.Index = 1; + this.m_mnuItemShowClassInfo.Text = "Show Class Info..."; + this.m_mnuItemShowClassInfo.Click += new System.EventHandler(this.OnShowClassInfo); + // + // m_bnOK + // + this.m_bnOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnOK.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOK.Location = new System.Drawing.Point(191, 472); + this.m_bnOK.Name = "m_bnOK"; + this.m_bnOK.TabIndex = 1; + this.m_bnOK.Text = "OK"; + // + // m_bnCancel + // + this.m_bnCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnCancel.Location = new System.Drawing.Point(279, 472); + this.m_bnCancel.Name = "m_bnCancel"; + this.m_bnCancel.TabIndex = 3; + this.m_bnCancel.Text = "Cancel"; + // + // GenericPropGrid + // + this.AcceptButton = this.m_bnOK; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_bnCancel; + this.ClientSize = new System.Drawing.Size(552, 511); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnCancel, + this.m_bnOK, + this.m_pgProps}); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(450, 250); + this.Name = "GenericPropGrid"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "PropGrid"; + this.ResumeLayout(false); + + } + #endregion + + + /// + /// User chose "Show Object Info..." from the context menu. Allow them to browse + /// using Reflection for the sub-object selected. + /// + /// + /// + + private void + OnShowObjInfo(object sender, System.EventArgs e) + { + object selObj = m_pgProps.SelectedGridItem.Value; + + if (selObj == null) + MessageBox.Show("Value is null."); + else { + GenericPropGrid pgForm = new GenericPropGrid(selObj); + pgForm.Text = string.Format("{0} (Object Info: {1})", m_pgProps.SelectedGridItem.Label, selObj.GetType()); + pgForm.ShowDialog(); + } + } + + /// + /// User chose "Show Class Info..." from the context menu. Allow them to browse + /// using Reflection for the class of the sub-object selected. + /// + /// + /// + + private void + OnShowClassInfo(object sender, System.EventArgs e) + { + object selObj = m_pgProps.SelectedGridItem.Value; + + if (selObj == null) + MessageBox.Show("Value is null."); + else { + GenericPropGrid pgForm = new GenericPropGrid(selObj.GetType()); + pgForm.Text = string.Format("{0} (Type Info: {1})", m_pgProps.SelectedGridItem.Label, selObj.GetType()); + pgForm.ShowDialog(); + } + } + + /// + /// disable any menu options if there is no current item selected in the PropGrid + /// + /// + /// + + private void + OnMenuContextPopup(object sender, System.EventArgs e) + { + bool enabled = (m_pgProps.SelectedGridItem == null) ? false : true; + m_mnuItemShowObjInfo.Enabled = enabled; + m_mnuItemShowClassInfo.Enabled = enabled; + } + + } +} diff --git a/MgdDbgLibrary/Snoop/Forms/GenericPropGrid.resx b/MgdDbgLibrary/Snoop/Forms/GenericPropGrid.resx new file mode 100644 index 0000000..4b8cf5b --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/GenericPropGrid.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + GenericPropGrid + + \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/Forms/Icon.cs b/MgdDbgLibrary/Snoop/Forms/Icon.cs new file mode 100644 index 0000000..00cc930 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/Icon.cs @@ -0,0 +1,108 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +namespace MgdDbg.Snoop.Forms +{ + /// + /// Summary description for Icon. + /// + public class Icon : System.Windows.Forms.Form + { + private System.Windows.Forms.PictureBox m_picBox; + private System.Windows.Forms.Button m_bnOk; + + /// + /// Required designer variable. + /// + + private System.ComponentModel.Container components = null; + + public + Icon(System.Drawing.Icon icon) + { + InitializeComponent(); + + m_picBox.Image = icon.ToBitmap(); + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.m_picBox = new System.Windows.Forms.PictureBox(); + this.m_bnOk = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // m_picBox + // + this.m_picBox.Location = new System.Drawing.Point(16, 24); + this.m_picBox.Name = "m_picBox"; + this.m_picBox.Size = new System.Drawing.Size(32, 32); + this.m_picBox.TabIndex = 0; + this.m_picBox.TabStop = false; + // + // m_bnOk + // + this.m_bnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnOk.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOk.Location = new System.Drawing.Point(104, 24); + this.m_bnOk.Name = "m_bnOk"; + this.m_bnOk.TabIndex = 1; + this.m_bnOk.Text = "OK"; + // + // Icon + // + this.AcceptButton = this.m_bnOk; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_bnOk; + this.ClientSize = new System.Drawing.Size(208, 72); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnOk, + this.m_picBox}); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Icon"; + this.Text = "Icon"; + this.ResumeLayout(false); + + } + #endregion + } +} diff --git a/MgdDbgLibrary/Snoop/Forms/Icon.resx b/MgdDbgLibrary/Snoop/Forms/Icon.resx new file mode 100644 index 0000000..339d054 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/Icon.resx @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Icon + + \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/Forms/ObjIdSets.cs b/MgdDbgLibrary/Snoop/Forms/ObjIdSets.cs new file mode 100644 index 0000000..c67ea5d --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/ObjIdSets.cs @@ -0,0 +1,277 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Diagnostics; +using System.Collections; +using System.Windows.Forms; +using MgdDbg.CompBuilder; + +namespace MgdDbg.Snoop.Forms +{ + /// + /// Summary description for ObjIdSets. + /// + public class ObjIdSets : System.Windows.Forms.Form + { + private System.Windows.Forms.ListView m_lvObjIdSets; + private System.Windows.Forms.ColumnHeader m_lvColName; + private System.Windows.Forms.Button m_bnOk; + private System.Windows.Forms.Button m_bnNew; + private System.Windows.Forms.Button m_bnShow; + private System.Windows.Forms.Button m_bnSnoop; + private System.Windows.Forms.Button m_bnDelete; + + static private ArrayList m_objIdSets = new ArrayList(); + + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public ObjIdSets() + { + InitializeComponent(); + Display(); + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.m_lvObjIdSets = new System.Windows.Forms.ListView(); + this.m_lvColName = new System.Windows.Forms.ColumnHeader(); + this.m_bnOk = new System.Windows.Forms.Button(); + this.m_bnNew = new System.Windows.Forms.Button(); + this.m_bnShow = new System.Windows.Forms.Button(); + this.m_bnSnoop = new System.Windows.Forms.Button(); + this.m_bnDelete = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // m_lvObjIdSets + // + this.m_lvObjIdSets.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right); + this.m_lvObjIdSets.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvColName}); + this.m_lvObjIdSets.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvObjIdSets.HideSelection = false; + this.m_lvObjIdSets.LabelEdit = true; + this.m_lvObjIdSets.Location = new System.Drawing.Point(16, 24); + this.m_lvObjIdSets.MultiSelect = false; + this.m_lvObjIdSets.Name = "m_lvObjIdSets"; + this.m_lvObjIdSets.Size = new System.Drawing.Size(336, 376); + this.m_lvObjIdSets.TabIndex = 1; + this.m_lvObjIdSets.View = System.Windows.Forms.View.List; + this.m_lvObjIdSets.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.OnAfterLabelEdit); + // + // m_lvColName + // + this.m_lvColName.Text = "Name"; + this.m_lvColName.Width = 400; + // + // m_bnOk + // + this.m_bnOk.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnOk.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOk.Location = new System.Drawing.Point(195, 424); + this.m_bnOk.Name = "m_bnOk"; + this.m_bnOk.TabIndex = 2; + this.m_bnOk.Text = "OK"; + // + // m_bnNew + // + this.m_bnNew.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right); + this.m_bnNew.Location = new System.Drawing.Point(368, 104); + this.m_bnNew.Name = "m_bnNew"; + this.m_bnNew.TabIndex = 3; + this.m_bnNew.Text = "New"; + this.m_bnNew.Click += new System.EventHandler(this.OnBnNew); + // + // m_bnShow + // + this.m_bnShow.Location = new System.Drawing.Point(368, 240); + this.m_bnShow.Name = "m_bnShow"; + this.m_bnShow.TabIndex = 4; + this.m_bnShow.Text = "Show..."; + this.m_bnShow.Click += new System.EventHandler(this.OnBnShow); + // + // m_bnSnoop + // + this.m_bnSnoop.Location = new System.Drawing.Point(368, 272); + this.m_bnSnoop.Name = "m_bnSnoop"; + this.m_bnSnoop.TabIndex = 5; + this.m_bnSnoop.Text = "Snoop..."; + this.m_bnSnoop.Click += new System.EventHandler(this.OnBnSnoop); + // + // m_bnDelete + // + this.m_bnDelete.Location = new System.Drawing.Point(368, 136); + this.m_bnDelete.Name = "m_bnDelete"; + this.m_bnDelete.TabIndex = 6; + this.m_bnDelete.Text = "Delete"; + this.m_bnDelete.Click += new System.EventHandler(this.OnBnDelete); + // + // ObjIdSets + // + this.AcceptButton = this.m_bnOk; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_bnOk; + this.ClientSize = new System.Drawing.Size(464, 463); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnDelete, + this.m_bnSnoop, + this.m_bnShow, + this.m_bnNew, + this.m_bnOk, + this.m_lvObjIdSets}); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ObjIdSets"; + this.ShowInTaskbar = false; + this.Text = "ObjIdSets"; + this.ResumeLayout(false); + + } + #endregion + + public void + Display() + { + m_lvObjIdSets.BeginUpdate(); + m_lvObjIdSets.Items.Clear(); + + foreach (Snoop.ObjIdSet tmpSet in m_objIdSets) { + ListViewItem lvItem = new ListViewItem(tmpSet.Name); + lvItem.Tag = tmpSet; + m_lvObjIdSets.Items.Add(lvItem); + } + + m_lvObjIdSets.EndUpdate(); + } + + private void + OnAfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e) + { + + } + + private void + OnBnNew(object sender, System.EventArgs e) + { + string setName; + + while (true) { + int index = 1; + setName = string.Format("Set {0}", index); + bool found = false; + + foreach (ObjIdSet tmpSet in m_objIdSets) { + if (tmpSet.Name == setName) { + found = true; + break; + } + } + + if (!found) { + Snoop.ObjIdSet newSet = new Snoop.ObjIdSet(setName); + m_objIdSets.Add(newSet); + break; + } + } + + Display(); + } + + private void + OnBnShow(object sender, System.EventArgs e) + { + Snoop.ObjIdSet curSet = GetCurrentSet(); + if (curSet != null) { + using (TransactionHelper trHlp = new TransactionHelper(curSet.Db)) { + trHlp.Start(); + + Snoop.Forms.DBObjects form = new Snoop.Forms.DBObjects(curSet.Set, trHlp); + form.ShowDialog(); + + trHlp.Commit(); + } + } + } + + private void + OnBnSnoop(object sender, System.EventArgs e) + { + Snoop.ObjIdSet curSet = GetCurrentSet(); + if (curSet != null) { + using (TransactionHelper trHlp = new TransactionHelper(curSet.Db)) { + trHlp.Start(); + + Snoop.Forms.Database form = new Snoop.Forms.Database(curSet.Db, trHlp); + form.ShowDialog(); + + trHlp.Commit(); + } + } + } + + public Snoop.ObjIdSet + GetCurrentSet() + { + Debug.Assert((m_lvObjIdSets.SelectedItems.Count > 1) == false); + + if (m_lvObjIdSets.SelectedItems.Count != 0) { + Snoop.ObjIdSet tmpSet = (Snoop.ObjIdSet)m_lvObjIdSets.SelectedItems[0].Tag; + return tmpSet; + } + + return null; + } + + private void + OnBnDelete(object sender, System.EventArgs e) + { + Snoop.ObjIdSet curSet = GetCurrentSet(); + if (curSet != null) + m_objIdSets.Remove(curSet); + } + + } +} diff --git a/MgdDbgLibrary/Snoop/Forms/ObjIdSets.resx b/MgdDbgLibrary/Snoop/Forms/ObjIdSets.resx new file mode 100644 index 0000000..f22d6db --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/ObjIdSets.resx @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ObjIdSets + + \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/Forms/Objects.cs b/MgdDbgLibrary/Snoop/Forms/Objects.cs new file mode 100644 index 0000000..33a2b5b --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/Objects.cs @@ -0,0 +1,463 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; + +namespace MgdDbg.Snoop.Forms +{ + /// + /// Summary description for Objects. + /// + public class Objects : System.Windows.Forms.Form + { + // member vars + protected ListView m_lvData; + protected Button m_bnOK; + protected ColumnHeader m_lvCol_label; + protected ColumnHeader m_lvCol_value; + protected TreeView m_tvObjs; + protected MenuItem m_mnuItemBrowseReflection; + protected ContextMenu m_cntxMenu; + + protected Snoop.Collectors.Objects m_snoopCollector = new Snoop.Collectors.Objects(); + protected System.Object m_curObj; + private ContextMenuStrip listViewContextMenuStrip; + private MenuItem m_mnuItemCopy; + private ToolStripMenuItem copyToolStripMenuItem; + private ToolStrip toolStrip1; + private System.Drawing.Printing.PrintDocument m_printDocument; + private PrintPreviewDialog m_printPreviewDialog; + private PrintDialog m_printDialog; + private ToolStripButton toolStripButton1; + private ToolStripButton toolStripButton2; + private IContainer components; + private Int32[] m_maxWidths; + private ToolStripButton toolStripButton3; + private Int32 m_currentPrintItem = 0; + + public + Objects(System.Object obj) + { + // Required for Windows Form Designer support + InitializeComponent(); + + m_tvObjs.BeginUpdate(); + + ArrayList tmpObjArray = new ArrayList(); + tmpObjArray.Add(obj); + + AddObjectCollectionToTree(tmpObjArray); + m_tvObjs.ExpandAll(); + + m_tvObjs.EndUpdate(); + } + + public + Objects(ArrayList objs) + { + // Required for Windows Form Designer support + InitializeComponent(); + + m_tvObjs.BeginUpdate(); + + AddObjectCollectionToTree(objs); + m_tvObjs.ExpandAll(); + + m_tvObjs.EndUpdate(); + } + + /// + /// Clean up any resources being used. + /// + protected override void + Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + protected void + InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Objects)); + this.m_tvObjs = new System.Windows.Forms.TreeView(); + this.m_cntxMenu = new System.Windows.Forms.ContextMenu(); + this.m_mnuItemCopy = new System.Windows.Forms.MenuItem(); + this.m_mnuItemBrowseReflection = new System.Windows.Forms.MenuItem(); + this.m_lvData = new System.Windows.Forms.ListView(); + this.m_lvCol_label = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.m_lvCol_value = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.listViewContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.m_bnOK = new System.Windows.Forms.Button(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); + this.m_printDocument = new System.Drawing.Printing.PrintDocument(); + this.m_printPreviewDialog = new System.Windows.Forms.PrintPreviewDialog(); + this.m_printDialog = new System.Windows.Forms.PrintDialog(); + this.listViewContextMenuStrip.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // m_tvObjs + // + this.m_tvObjs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.m_tvObjs.ContextMenu = this.m_cntxMenu; + this.m_tvObjs.HideSelection = false; + this.m_tvObjs.Location = new System.Drawing.Point(12, 37); + this.m_tvObjs.Name = "m_tvObjs"; + this.m_tvObjs.ShowNodeToolTips = true; + this.m_tvObjs.Size = new System.Drawing.Size(240, 469); + this.m_tvObjs.TabIndex = 0; + this.m_tvObjs.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TreeNodeSelected); + this.m_tvObjs.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.TreeNodeSelected); + // + // m_cntxMenu + // + this.m_cntxMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.m_mnuItemCopy, + this.m_mnuItemBrowseReflection}); + // + // m_mnuItemCopy + // + this.m_mnuItemCopy.Index = 0; + this.m_mnuItemCopy.Text = "Copy"; + this.m_mnuItemCopy.Click += new System.EventHandler(this.ContextMenuClick_Copy); + // + // m_mnuItemBrowseReflection + // + this.m_mnuItemBrowseReflection.Index = 1; + this.m_mnuItemBrowseReflection.Text = "Browse Using Reflection..."; + this.m_mnuItemBrowseReflection.Click += new System.EventHandler(this.ContextMenuClick_BrowseReflection); + // + // m_lvData + // + this.m_lvData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_lvData.AutoArrange = false; + this.m_lvData.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvCol_label, + this.m_lvCol_value}); + this.m_lvData.ContextMenuStrip = this.listViewContextMenuStrip; + this.m_lvData.Cursor = System.Windows.Forms.Cursors.Default; + this.m_lvData.FullRowSelect = true; + this.m_lvData.GridLines = true; + this.m_lvData.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvData.HideSelection = false; + this.m_lvData.Location = new System.Drawing.Point(276, 37); + this.m_lvData.MultiSelect = false; + this.m_lvData.Name = "m_lvData"; + this.m_lvData.ShowItemToolTips = true; + this.m_lvData.Size = new System.Drawing.Size(504, 469); + this.m_lvData.TabIndex = 1; + this.m_lvData.UseCompatibleStateImageBehavior = false; + this.m_lvData.View = System.Windows.Forms.View.Details; + this.m_lvData.Click += new System.EventHandler(this.DataItemSelected); + this.m_lvData.DoubleClick += new System.EventHandler(this.DataItemSelected); + // + // m_lvCol_label + // + this.m_lvCol_label.Text = "Field"; + this.m_lvCol_label.Width = 200; + // + // m_lvCol_value + // + this.m_lvCol_value.Text = "Value"; + this.m_lvCol_value.Width = 300; + // + // listViewContextMenuStrip + // + this.listViewContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.copyToolStripMenuItem}); + this.listViewContextMenuStrip.Name = "listViewContextMenuStrip"; + this.listViewContextMenuStrip.Size = new System.Drawing.Size(103, 26); + // + // copyToolStripMenuItem + // + this.copyToolStripMenuItem.Image = global::MgdDbg.Properties.Resources.COPY1; + this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; + this.copyToolStripMenuItem.Size = new System.Drawing.Size(102, 22); + this.copyToolStripMenuItem.Text = "Copy"; + this.copyToolStripMenuItem.Click += new System.EventHandler(this.CopyToolStripMenuItem_Click); + // + // m_bnOK + // + this.m_bnOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnOK.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOK.Location = new System.Drawing.Point(359, 519); + this.m_bnOK.Name = "m_bnOK"; + this.m_bnOK.Size = new System.Drawing.Size(75, 23); + this.m_bnOK.TabIndex = 2; + this.m_bnOK.Text = "OK"; + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButton1, + this.toolStripButton2, + this.toolStripButton3}); + this.toolStrip1.Location = new System.Drawing.Point(0, 0); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(792, 25); + this.toolStrip1.TabIndex = 3; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripButton1 + // + this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton1.Image = global::MgdDbg.Properties.Resources.Print1; + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(23, 22); + this.toolStripButton1.Text = "Print"; + this.toolStripButton1.Click += new System.EventHandler(this.PrintMenuItem_Click); + // + // toolStripButton2 + // + this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton2.Image = global::MgdDbg.Properties.Resources.Preview1; + this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton2.Name = "toolStripButton2"; + this.toolStripButton2.Size = new System.Drawing.Size(23, 22); + this.toolStripButton2.Text = "Print Preview"; + this.toolStripButton2.Click += new System.EventHandler(this.PrintPreviewMenuItem_Click); + // + // toolStripButton3 + // + this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton3.Image = global::MgdDbg.Properties.Resources.COPY1; + this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton3.Name = "toolStripButton3"; + this.toolStripButton3.Size = new System.Drawing.Size(23, 22); + this.toolStripButton3.Text = "Copy To Clipboard"; + this.toolStripButton3.Click += new System.EventHandler(this.ContextMenuClick_Copy); + // + // m_printDocument + // + this.m_printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.PrintDocument_PrintPage); + // + // m_printPreviewDialog + // + this.m_printPreviewDialog.AutoScrollMargin = new System.Drawing.Size(0, 0); + this.m_printPreviewDialog.AutoScrollMinSize = new System.Drawing.Size(0, 0); + this.m_printPreviewDialog.ClientSize = new System.Drawing.Size(400, 300); + this.m_printPreviewDialog.Document = this.m_printDocument; + this.m_printPreviewDialog.Enabled = true; + this.m_printPreviewDialog.Icon = ((System.Drawing.Icon)(resources.GetObject("m_printPreviewDialog.Icon"))); + this.m_printPreviewDialog.Name = "m_printPreviewDialog"; + this.m_printPreviewDialog.Visible = false; + // + // m_printDialog + // + this.m_printDialog.Document = this.m_printDocument; + this.m_printDialog.UseEXDialog = true; + // + // Objects + // + this.AcceptButton = this.m_bnOK; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_bnOK; + this.ClientSize = new System.Drawing.Size(792, 550); + this.Controls.Add(this.toolStrip1); + this.Controls.Add(this.m_bnOK); + this.Controls.Add(this.m_lvData); + this.Controls.Add(this.m_tvObjs); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(575, 225); + this.Name = "Objects"; + this.ShowInTaskbar = false; + this.Text = "Snoop Objects"; + this.listViewContextMenuStrip.ResumeLayout(false); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + #endregion + + #region Events + /// + /// + /// + /// + protected void + AddObjectCollectionToTree(ArrayList objs) + { + // initialize the tree control with the ObjectId of each item + foreach (Object obj in objs) { + TreeNode tmpNode = new TreeNode(string.Format("< {0} >", obj.GetType().Name)); + tmpNode.Tag = obj; + m_tvObjs.Nodes.Add(tmpNode); + } + } + + + /// + /// + /// + /// + /// + protected void + TreeNodeSelected (object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs e) + { + m_curObj = e.Node.Tag; + + // collect the data about this object + m_snoopCollector.Collect(m_curObj); + + // display it + Snoop.Utils.Display(m_lvData, m_snoopCollector); + } + + /// + /// + /// + /// + /// + protected void + TreeNodeSelected (object sender, System.Windows.Forms.TreeViewEventArgs e) + { + m_curObj = e.Node.Tag; + + // collect the data about this object + m_snoopCollector.Collect(m_curObj); + + // display it + Snoop.Utils.Display(m_lvData, m_snoopCollector); + } + + + /// + /// + /// + /// + /// + protected void + DataItemSelected(object sender, System.EventArgs e) + { + Snoop.Utils.DataItemSelected(m_lvData); + } + + /// + /// + /// + /// + /// + private void + ContextMenuClick_BrowseReflection(object sender, System.EventArgs e) + { + Snoop.Utils.BrowseReflection(m_curObj); + } + + + /// + /// + /// + /// + /// + private void + ContextMenuClick_Copy (object sender, System.EventArgs e) + { + if (m_tvObjs.SelectedNode != null) { + Utils.CopyToClipboard(m_lvData); + } + } + + + /// + /// + /// + /// + /// + private void + CopyToolStripMenuItem_Click (object sender, System.EventArgs e) + { + if (m_lvData.SelectedItems.Count > 0) { + Utils.CopyToClipboard(m_lvData.SelectedItems[0]); + } + else { + Clipboard.Clear(); + } + } + + #region Print Events + /// + /// + /// + /// + /// + private void + PrintDocument_PrintPage (object sender, System.Drawing.Printing.PrintPageEventArgs e) + { + m_currentPrintItem = Utils.Print(m_tvObjs.SelectedNode.Text, m_lvData, e, m_maxWidths[0], m_maxWidths[1], m_currentPrintItem); + } + + + /// + /// + /// + /// + /// + private void + PrintMenuItem_Click (object sender, EventArgs e) + { + Utils.UpdatePrintSettings(m_printDocument, m_tvObjs, m_lvData, ref m_maxWidths); + Utils.PrintMenuItemClick(m_printDialog, m_tvObjs); + } + + /// + /// + /// + /// + /// + private void + PrintPreviewMenuItem_Click (object sender, EventArgs e) + { + Utils.UpdatePrintSettings(m_printDocument, m_tvObjs, m_lvData, ref m_maxWidths); + Utils.PrintPreviewMenuItemClick(m_printPreviewDialog, m_tvObjs); + } + #endregion + + #endregion + } +} diff --git a/MgdDbgLibrary/Snoop/Forms/Objects.resx b/MgdDbgLibrary/Snoop/Forms/Objects.resx new file mode 100644 index 0000000..7c9a3ed --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/Objects.resx @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 173, 28 + + + 288, 28 + + + 466, 28 + + + 565, 28 + + + 706, 28 + + + + + AAABAAYAICAQAAAAAADoAgAAZgAAABAQEAAAAAAAKAEAAE4DAAAgIAAAAQAIAKgIAAB2BAAAEBAAAAEA + CABoBQAAHg0AACAgAAABACAAqBAAAIYSAAAQEAAAAQAgAGgEAAAuIwAAKAAAACAAAABAAAAAAQAEAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAACAgACAAAAAgACAAICAAACAgIAAwMDAAAAA + /wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIoiI + iIiIiIiIiIiIiIiIiIiCIigiIiIozMzMzMzMyCIogiIoIiIiKM7m5ubm5sgiKIIiKCIiIijObm5ubm7I + IiiCIigiIiIozubm5ubmyCIogiIoIiIiKM5ubm5ubsgiKIIiKCIiIijO5ubm5ubIIiiIiIiIiIiIzm5u + bm5uyCIogRERERERGM7u7u7u7sgiKIHZWVlZWRjMzMzMzMzIIiiB1ZWVlZUYiIiIiIiIiIiIgdlZWVlZ + GDMzMzMzMzMzOIHVlZWVlRg/uLi4uLi4uDiB2VlZWVkYP7uLi4uLi4s4gdWVlZWVGD+4uLi4uLi4OIHZ + WVlZWRg/u4uLi4uLiziB1ZWVlZUYP7i4uLi4uLg4gdlZWVlZGD+7i4uLi4uLOIHVlZWVlRg/uLi4uLi4 + uDiB3d3d3d0YP7uLi4uLi4s4gRERERERGD+4uLi4uLi4OIiIiIiIiIg/u4uLi4uLiziCIiIiIiIoP7i4 + uLi4uLg4giIiIiIiKD+7i4uLi4uLOIIiIiIiIig/uLi4uLi4uDiCIiIiIiIoP7u7u7u7u7s4giIiIiIi + KD//////////OIIiIiIiIigzMzMzMzMzMziIiIiIiIiIiIiIiIiIiIiIIiIiIiIiIiIiIiIiIiIiIv// + ////////AAAAAHv4AA57+AAOe/gADnv4AA57+AAOe/gADgAAAA4AAAAOAAAADgAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/4AAB/+AAAf/gAAH/4AAB/+AAAf/gAAAAA + AAD/////KAAAABAAAAAgAAAAAQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAACA + gACAAAAAgACAAICAAACAgIAAwMDAAAAA/wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAiIiIiIiIiIoiI + iIiIiIiIgigijMzMyCiCKCKM5mbIKIiIiIzu7sgogRERjMzMyCiB2ZGIiIiIiIHZkYMzMzM4gdmRg/u7 + uziB3dGD+7u7OIEREYP7u7s4iIiIg/u7uziCIiKD+7u7OIIiIoP///84giIigzMzMziIiIiIiIiIiP// + KCIAACjObALm5mwCIigAAoiIAAKIzgAAbm4AACIoAAAREQAAGM4AAO7uAAAiKHwAWVl8ABjMfADMzAAA + IigoAAAAIAAAAEAAAAABAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAA + AACAAIAAgIAAAICAgADA3MAA8MqmAKo/KgD/PyoAAF8qAFVfKgCqXyoA/18qAAB/KgBVfyoAqn8qAP9/ + KgAAnyoAVZ8qAKqfKgD/nyoAAL8qAFW/KgCqvyoA/78qAADfKgBV3yoAqt8qAP/fKgAA/yoAVf8qAKr/ + KgD//yoAAABVAFUAVQCqAFUA/wBVAAAfVQBVH1UAqh9VAP8fVQAAP1UAVT9VAKo/VQD/P1UAAF9VAFVf + VQCqX1UA/19VAAB/VQBVf1UAqn9VAP9/VQAAn1UAVZ9VAKqfVQD/n1UAAL9VAFW/VQCqv1UA/79VAADf + VQBV31UAqt9VAP/fVQAA/1UAVf9VAKr/VQD//1UAAAB/AFUAfwCqAH8A/wB/AAAffwBVH38Aqh9/AP8f + fwAAP38AVT9/AKo/fwD/P38AAF9/AFVffwCqX38A/19/AAB/fwBVf38Aqn9/AP9/fwAAn38AVZ9/AKqf + fwD/n38AAL9/AFW/fwCqv38A/79/AADffwBV338Aqt9/AP/ffwAA/38AVf9/AKr/fwD//38AAACqAFUA + qgCqAKoA/wCqAAAfqgBVH6oAqh+qAP8fqgAAP6oAVT+qAKo/qgD/P6oAAF+qAFVfqgCqX6oA/1+qAAB/ + qgBVf6oAqn+qAP9/qgAAn6oAVZ+qAKqfqgD/n6oAAL+qAFW/qgCqv6oA/7+qAADfqgBV36oAqt+qAP/f + qgAA/6oAVf+qAKr/qgD//6oAAADUAFUA1ACqANQA/wDUAAAf1ABVH9QAqh/UAP8f1AAAP9QAVT/UAKo/ + 1AD/P9QAAF/UAFVf1ACqX9QA/1/UAAB/1ABVf9QAqn/UAP9/1AAAn9QAVZ/UAKqf1AD/n9QAAL/UAFW/ + 1ACqv9QA/7/UAADf1ABV39QAqt/UAP/f1AAA/9QAVf/UAKr/1AD//9QAVQD/AKoA/wAAH/8AVR//AKof + /wD/H/8AAD//AFU//wCqP/8A/z//AABf/wBVX/8Aql//AP9f/wAAf/8AVX//AKp//wD/f/8AAJ//AFWf + /wCqn/8A/5//AAC//wBVv/8Aqr//AP+//wAA3/8AVd//AKrf/wD/3/8AVf//AKr//wD/zMwA/8z/AP// + MwD//2YA//+ZAP//zAAAfwAAVX8AAKp/AAD/fwAAAJ8AAFWfAACqnwAA/58AAAC/AABVvwAAqr8AAP+/ + AAAA3wAAVd8AAKrfAAD/3wAAVf8AAKr/AAAAACoAVQAqAKoAKgD/ACoAAB8qAFUfKgCqHyoA/x8qAAA/ + KgBVPyoA8Pv/AKSgoACAgIAAAAD/AAD/AAAA//8A/wAAAAAAAAD//wAA////AP39/f39/f39/f39/f39 + /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39 + /f39/f39/f39/f39/f39/f39/f39/f39qoYIqoYIhqoIqgiqCaoIqgiqhqqGhoYIhoYIqv39/f0I/f39 + /ar9/f39/YY2Ng4yDg4ODgoOCgoKCgqG/f39/Yb9/f39CP39/f39qjY7Ozs3Nzc3NjMSMjIOCqr9/f39 + qv39/f2G/f39/f0IN19fOzs3Nzc3NjcODg4KCP39/f0I/f39/ar9/f39/ao6X19fXzs7Ozc3NzY3NgqG + /f39/Yb9/f39CP39/f39hl9jY19jX187Ozs7Nzc3Dqr9/f39qv39/f2G/f39/f0IOodjh19jX19fXztf + OzcOCP39/f0ICAmqCAiqCKoICapfCYdjh2ODY19fXzs7Ow6q/f39/QhITEwoSCUoKSQoqmMJCYcJCWNj + Y2NfY19fNgj9/f39qkyZmZmYmJRwlCmqX19fXl9fX186WzY3Njc2gv39/f0JcJ2dmZmZlJmUJAmqCaoJ + hggIqggICKoIqggI/f39/YZwnp2dnZmZmJVMqnx8fHx8fFR8VHhUVFRUVKr9/f39CHChoZ2dnZ2ZmUwJ + fKSkxqSkxqSkpKSkpKBUCP39/f2qcKLDoqGdnZ2ZTKp8ysakxqSkxqSkxqSkpFSq/f39/QiUpqbDoqHE + nZ1Mq3ykqMakyqSkxqSkpKSkVAj9/f39hpTIyKbHoqGhoXAIfMrLpMqkxqSkxqTGpKRUqv39/f0IlMym + yKbIpcShcAh8y6jKpMqkxsqkpKSkxlQI/f39/aqUzMzMyKbIpqJwqnzLy8qpxsqkpMakxqSkeAj9/f39 + CJSUlJSUlJSUlJQJgMupy8qpysqkyqSkxqRUqv39/f2GCKoIqgiqCKoIhgigrcvPqcuoy8qkxsqkxnyG + /f39/ar9/f39/f39/f39qnzPz6nLy8uoyqnKpKTKVAj9/f39CP39/f39/f39/f0IfNDPz8+py8upyqjG + yqR8hv39/f2G/f39/f39/f39/Qik0K7P0M+ty8vLy6jKpXyq/f39/ar9/f39/f39/f39CHzQ09Ctz8/P + qcupy6jKeAj9/f39CP39/f39/f39/f2qoNPQ0NPQ0M/Qz8vLy6l8CP39/f2G/f39/f39/f39/QmkfKR8 + oHx8fHx8fHx8fHyG/f39/aoIqgiqCKoIqgiqCKoIqgiqCKoIqgiqCKoIqgj9/f39/f39/f39/f39/f39 + /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f3///////////// + ///AAAAD3vgAA974AAPe+AAD3vgAA974AAPe+AADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAADwAAAA9/4AAPf+AAD3/gAA9/4AAPf+AAD3/gAA8AAAAP//////////ygA + AAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAA + gACAgAAAgICAAMDcwADwyqYAqj8qAP8/KgAAXyoAVV8qAKpfKgD/XyoAAH8qAFV/KgCqfyoA/38qAACf + KgBVnyoAqp8qAP+fKgAAvyoAVb8qAKq/KgD/vyoAAN8qAFXfKgCq3yoA/98qAAD/KgBV/yoAqv8qAP// + KgAAAFUAVQBVAKoAVQD/AFUAAB9VAFUfVQCqH1UA/x9VAAA/VQBVP1UAqj9VAP8/VQAAX1UAVV9VAKpf + VQD/X1UAAH9VAFV/VQCqf1UA/39VAACfVQBVn1UAqp9VAP+fVQAAv1UAVb9VAKq/VQD/v1UAAN9VAFXf + VQCq31UA/99VAAD/VQBV/1UAqv9VAP//VQAAAH8AVQB/AKoAfwD/AH8AAB9/AFUffwCqH38A/x9/AAA/ + fwBVP38Aqj9/AP8/fwAAX38AVV9/AKpffwD/X38AAH9/AFV/fwCqf38A/39/AACffwBVn38Aqp9/AP+f + fwAAv38AVb9/AKq/fwD/v38AAN9/AFXffwCq338A/99/AAD/fwBV/38Aqv9/AP//fwAAAKoAVQCqAKoA + qgD/AKoAAB+qAFUfqgCqH6oA/x+qAAA/qgBVP6oAqj+qAP8/qgAAX6oAVV+qAKpfqgD/X6oAAH+qAFV/ + qgCqf6oA/3+qAACfqgBVn6oAqp+qAP+fqgAAv6oAVb+qAKq/qgD/v6oAAN+qAFXfqgCq36oA/9+qAAD/ + qgBV/6oAqv+qAP//qgAAANQAVQDUAKoA1AD/ANQAAB/UAFUf1ACqH9QA/x/UAAA/1ABVP9QAqj/UAP8/ + 1AAAX9QAVV/UAKpf1AD/X9QAAH/UAFV/1ACqf9QA/3/UAACf1ABVn9QAqp/UAP+f1AAAv9QAVb/UAKq/ + 1AD/v9QAAN/UAFXf1ACq39QA/9/UAAD/1ABV/9QAqv/UAP//1ABVAP8AqgD/AAAf/wBVH/8Aqh//AP8f + /wAAP/8AVT//AKo//wD/P/8AAF//AFVf/wCqX/8A/1//AAB//wBVf/8Aqn//AP9//wAAn/8AVZ//AKqf + /wD/n/8AAL//AFW//wCqv/8A/7//AADf/wBV3/8Aqt//AP/f/wBV//8Aqv//AP/MzAD/zP8A//8zAP// + ZgD//5kA///MAAB/AABVfwAAqn8AAP9/AAAAnwAAVZ8AAKqfAAD/nwAAAL8AAFW/AACqvwAA/78AAADf + AABV3wAAqt8AAP/fAABV/wAAqv8AAAAAKgBVACoAqgAqAP8AKgAAHyoAVR8qAKofKgD/HyoAAD8qAFU/ + KgDw+/8ApKCgAICAgAAAAP8AAP8AAAD//wD/AAAAAAAAAP//AAD///8A/f39/f39/f39/f39/f39/f0I + hgiqCKoICKoICKaGCP39qv39hv2GNg4ODjII/ar9/Yb9/ar9qjdjXzsOCP2G/f0IhquGCAleCWNfNob9 + qv39qkxMTEgIX19fX18I/Qj9/QhwnZlMqoYIqggIqgiG/f2qcKadcAl8fFQDVFQDqv39CHDMpnCqfMvL + ysrKVAj9/QiUlHBwCYDPy8/LylSG/f2GqoYIqgig0M/Py8t8qv39CP39/f2GpNDQ0M/PfAn9/ar9/f39 + qqT20NDQ0Hyq/f2G/f39/QmkpKSloKR8CP39CKoIhgiqCIYIqgiGCKr9/f39/f39/f39/f39/f39/f// + hv2AAf0ItAX9/bQFX2OABWNfgAU7O4ABNzeAAf39gAGq/YAB/YaAAf39vAE6h7wBX2O8AV9fgAE7N/// + /f0oAAAAIAAAAEAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAADCv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAA + AAAAAAAAwr/B/7Z3Sf+zckT/rm0//6toO/+nYjb/pF4y/6BZLv+dVCr/mlEn/5dNI/+VSiH/kkce/5FE + HP+RRBz/kUUb/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/AAAAAAAA + AAAAAAAAAAAAAAAAAADCv8H/v4JS//+aZv//lWD/+5Bc//WLV//uh1P/54FO/997S//Wdkb/zXBD/8Vr + QP+9Zj3/tGI5/65dN/+RRRz/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/AAAAAAAAAAAAAAAAAAAAAMK/ + wf8AAAAAAAAAAAAAAAAAAAAAAAAAAMK/wf/GjFv//6Rz//+fbf//m2f//5Zh//yRXf/3jVj/8IhV/+mD + UP/hfUz/2HhI/9ByRP/HbED/v2c9/5VJIf/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAA + AAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAAAAAAAAAAwr/B/86WZP//r4L//6p7//+mdf//oW7//5xo//+X + Yv/9kl7/+I5a//KJVf/rhFH/4n5N/9t4SP/Sc0X/mlEm/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAA + AAAAAAAAAAAAAAAAAADCv8H/AAAAAAAAAAAAAAAAAAAAAAAAAADCv8H/1J9s//+4kf//tIv//6+E//+r + ff//p3f//6Jw//+eav//mWT//pRf//qQWv/0i1b/7IVS/+V/Tv+gWC7/wr/B/wAAAAAAAAAAAAAAAAAA + AADCv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAAAAAAMK/wf/apnP//7+d//+7 + mP//uJL//7WM//+whv//rH///6d4//+jcf//n2v//5ll//+VYP/6kVv/9YxY/6diN//Cv8H/AAAAAAAA + AAAAAAAAAAAAAMK/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/96t + eP//wqL//8Gi//+/nv//vJn//7mT//+2jv//sYj//66A//+pev//pHP//6Bt//+bZ///l2L/r20//8K/ + wf8AAAAAAAAAAAAAAAAAAAAAwr/B/xYXev8XF3b/GBVx/xkUbf8ZFGr/GhNm/xoSY/8bEV//HBFd/xwQ + W//Cv8H/4K96///Cov//wqL//8Ki///Cov//wJ///72b//+6lf//t4///7KJ//+ugv//qnv//6V0//+h + bv+3d0n/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/FRqE/0dN1v8/RNL/Nz3Q/y40zv8nLcz/ISfK/xwh + yf8WHMf/GxJh/8K/wf/gr3r/4K96/+Cvev/gr3r/3614/9yqdf/apnL/16Nw/9Sea//Rmmj/zZZk/8qR + X//GjFz/w4dW/7+CUv/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8SHZD/WF3a/05U1/9FS9X/PUPS/zU7 + 0P8uM83/JyzL/yAmyf8aFGn/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/xAfnP9obt7/YGTc/1Zb + 2f9NU9f/RUrU/ztB0v80OdD/LDHO/xgWcv/Cv8H/Dn+n/w18pP8MeqH/DHie/wt1m/8Kc5j/CXGV/wlv + k/8JbJD/CGqN/wdpi/8HZ4j/BmWH/wZkhf8GYoP/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/DiKp/3l+ + 4/9vdeH/Zmze/11i2/9UWtn/S1HW/0NI1P86P9H/Fhh9/8K/wf8Ogar/Barp/wGo6P8Apef/AKPm/wCi + 5P8An+L/AJ7h/wCd3/8AnN7/AJnc/wCY2/8AmNn/AJbX/wZjhP/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/ + wf8MJbX/iI7n/4CF5v93fOP/bnPg/2Vr3f9bYdv/UljY/0lP1v8UGoj/wr/B/w+Erf8Lrur/Bqvq/wOo + 6f8Apuf/AKTm/wCi5f8AoOT/AJ/i/wCd4f8AnN//AJrd/wCZ2/8AmNr/BmWH/8K/wf8AAAAAAAAAAAAA + AAAAAAAAwr/B/wkowP+WnOz/jpTq/4aL6P9+hOX/dXri/2xx4P9jaN3/WV/b/xEek//Cv8H/EIaw/xay + 7P8Or+z/Cavr/wWq6v8Bp+j/AKbn/wCj5f8AoeT/AJ/j/wCe4f8AnOD/AJve/wCa3f8HZ4n/wr/B/wAA + AAAAAAAAAAAAAAAAAADCv8H/CCrK/6Ko7/+coe7/lZrr/42T6f+Fiub/fIHl/3N54v9rcN//ECGg/8K/ + wf8QiLP/I7nu/xq07f8Ssez/C63r/war6v8Cqen/AKbo/wCk5v8AouX/AKHk/wCf4f8AneH/AJzf/who + i//Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8GLNP/q7Hy/6as8P+hpu//mp/u/5OY6/+LkOj/g4nm/3qA + 5P8NI6z/wr/B/xCKtv8xvvD/J7rv/x627f8Vsuz/Dq/s/wmr6/8Equn/Aafo/wCl5/8Ao+X/AKHk/wCf + 4v8AnuH/CGqO/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wUu2/+vtPP/r7Tz/6qv8v+mq/D/oKXv/5me + 7f+Sl+v/io/p/wsmt//Cv8H/Eo24/0HF8f82wfD/LLzv/yK47v8atO3/EbHs/wut6/8Gq+r/A6np/wCm + 6P8Apeb/AKLl/wCh5P8IbJD/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/BC/h/wQv3/8FL9z/BS3Z/wYt + 1v8GLNL/ByvP/wgqy/8IKcb/CSnC/8K/wf8Sjrv/Uszy/0fH8f87w/H/Mb7v/ye67/8et+7/FbPt/w6v + 6/8IrOv/BKnp/wGo6P8Apef/AKPl/wluk//Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/xKRvf9j0/P/WM/z/0zK8f9BxfH/N8Hw/yy8 + 7/8iuO7/GbTt/xGx7P8Lruv/Bqrq/wOo6f8Apuf/CnGV/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADCv8H/E5LA/3Ta8/9q1fP/XtHz/1LM + 8v9Hx/H/O8Pw/zG+7/8nu+//Hrbt/xay7f8Or+v/CKzq/wSq6f8Kc5j/wr/B/wAAAAAAAAAAAAAAAAAA + AADCv8H/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMK/wf8UlMH/hOD1/3rc + 9f9v2PP/ZNTy/1jO8v9NyvH/Qsbx/zbB8P8svO//I7ju/xm07f8SsOz/C67r/wt2m//Cv8H/AAAAAAAA + AAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwr/B/xSW + w/+T5vb/iuL1/3/e9P912vT/adbz/13R8/9SzPL/R8jx/zzD8P8xvvD/J7rv/x627v8Vsuz/C3ie/8K/ + wf8AAAAAAAAAAAAAAAAAAAAAwr/B/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AADCv8H/FJbG/57r9/+X6Pb/juT1/4Th9f963fX/b9j0/2PT8/9Yz/L/TMrx/0HF8f83wO//LLzv/yK4 + 7v8MeqH/wr/B/wAAAAAAAAAAAAAAAAAAAADCv8H/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAMK/wf8VmMf/qO/3/6Lt9/+b6vb/kub2/4rj9f9/3vX/dNrz/2rV8/9d0fP/Uszy/0fI + 8f88w/D/Mr7v/w19pP/Cv8H/AAAAAAAAAAAAAAAAAAAAAMK/wf8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAwr/B/xWZyP8UmMf/FZfF/xSVw/8TlML/E5K//xOQvf8Sjrv/EYy4/xGK + tv8QiLL/D4Ww/w+Erf8Pgar/Dn+n/8K/wf8AAAAAAAAAAAAAAAAAAAAAwr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/ + wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/8K/wf/Cv8H/wr/B/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP// + /////////////8AAAAPe+AAD3vgAA974AAPe+AAD3vgAA974AAPAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAAD3/gAA9/4AAPf+AAD3/gAA9/4AAPf+AADwAAAA/// + ////////KAAAABAAAAAgAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwMDA/8DA + wP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP8AAAAAAAAAAMDA + wP8AAAAAAAAAAMDAwP8AAAAAwMDA/8F2R/+9bj//umc6/7diNf+3YjX/wMDA/wAAAADAwMD/AAAAAAAA + AADAwMD/AAAAAAAAAADAwMD/AAAAAMDAwP/RkmD//7aP//+ldP/8kl3/vW0//8DAwP8AAAAAwMDA/wAA + AAAAAAAAwMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/3ap2///Cov//to7//6V0/8uJWP/AwMD/AAAAAMDA + wP8AAAAAAAAAAMDAwP8THI7/FBqF/xYYfP8XFnP/wMDA/+Cvev/gr3r/4K96/92qdv/ao3D/wMDA/wAA + AADAwMD/AAAAAAAAAADAwMD/ECCd/2Fn3P8zOc//FRmC/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DA + wP/AwMD/wMDA/wAAAAAAAAAAwMDA/w0krP+Pler/YWbd/xIcj//AwMD/DHmf/wpzmP8Ib5L/B2uO/wdq + jf8Gao3/B2qN/8DAwP8AAAAAAAAAAMDAwP8KJrv/r7Tz/5CU6v8PIJ//wMDA/w+Dq/87y/z/Kcb8/xrD + /P8QwPv/EMD7/wdqjf/AwMD/AAAAAAAAAADAwMD/CCrI/woowP8LJrf/DSSu/8DAwP8Sjbj/Zdb9/0/Q + /P88y/v/Kcf7/xrC+/8IbZD/wMDA/wAAAAAAAAAAwMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/FpfG/43h + /f962/3/Zdb8/0/Q/P87zPz/CXSZ/8DAwP8AAAAAAAAAAMDAwP8AAAAAAAAAAAAAAAAAAAAAwMDA/xif + z/+u6f7/n+X9/47h/f953P3/ZNb9/w19pP/AwMD/AAAAAAAAAADAwMD/AAAAAAAAAAAAAAAAAAAAAMDA + wP8apNX/uez+/7ns/v+u6f7/oOX9/43h/f8Rh7H/wMDA/wAAAAAAAAAAwMDA/wAAAAAAAAAAAAAAAAAA + AADAwMD/GqTV/xqk1f8apNX/GaHR/xecy/8WmMb/FJK+/8DAwP8AAAAAAAAAAMDAwP/AwMD/wMDA/8DA + wP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/AAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAAgAEAALQF + wf+0BQAAgAUAAIAFAACAAQAAgAHB/4ABAACAAQAAgAEAALwBAAC8AQAAvAHB/4ABbP///5H/ + + + + 17, 65 + + \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/Forms/References.cs b/MgdDbgLibrary/Snoop/Forms/References.cs new file mode 100644 index 0000000..0564204 --- /dev/null +++ b/MgdDbgLibrary/Snoop/Forms/References.cs @@ -0,0 +1,68 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Windows.Forms; +using MgdDbg.CompBuilder; +using AcDb = Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.Snoop.Forms +{ + /// + /// Derived Form to show References to other objects + /// + public class References : DBObjects + { + public + References(AcDb.ObjectIdCollection hardPointerIds, AcDb.ObjectIdCollection softPointerIds, + AcDb.ObjectIdCollection hardOwnerIds, AcDb.ObjectIdCollection softOwnerIds, TransactionHelper tr) + : base(tr) + { + m_tvObjs.BeginUpdate(); + + AddRefsToTree("Hard Pointers", hardPointerIds); + AddRefsToTree("Soft Pointers", softPointerIds); + AddRefsToTree("Hard Ownership", hardOwnerIds); + AddRefsToTree("Soft Ownership", softOwnerIds); + + m_tvObjs.ExpandAll(); + m_tvObjs.EndUpdate(); + } + + protected void + AddRefsToTree(string categoryStr, AcDb.ObjectIdCollection objIds) + { + TreeNode categoryNode = new TreeNode(categoryStr); + categoryNode.Tag = null; + m_tvObjs.Nodes.Add(categoryNode); + + // initialize the tree control with the ObjectId of each item + for (int i=0; i + /// Summary description for DBObjects. + /// + public class XrefGraph : System.Windows.Forms.Form + { + // member vars + protected System.Windows.Forms.ListView m_lvData; + protected System.Windows.Forms.Button m_bnOK; + protected System.Windows.Forms.ColumnHeader m_lvCol_label; + protected System.Windows.Forms.ColumnHeader m_lvCol_value; + protected System.Windows.Forms.TreeView m_tvObjs; + protected System.Windows.Forms.MenuItem m_mnuItemBrowseReflection; + protected System.Windows.Forms.ContextMenu m_cntxMenuTree; + + protected Snoop.Collectors.Objects m_snoopCollector = new Snoop.Collectors.Objects(); + protected AcDb.XrefGraph m_xrefGraph; + protected object m_curObj = null; + + /// + /// Required designer variable. + /// + protected System.ComponentModel.Container components = null; + + protected + XrefGraph() + { + // this constructor is for derived classes to call + InitializeComponent(); + } + + public + XrefGraph(AcDb.XrefGraph xrefGraph) + { + m_xrefGraph = xrefGraph; + + // Required for Windows Form Designer support + InitializeComponent(); + + m_tvObjs.BeginUpdate(); + + AddGraphToTree(m_xrefGraph); + m_tvObjs.ExpandAll(); + + m_tvObjs.EndUpdate(); + } + + /// + /// Clean up any resources being used. + /// + protected override void + Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + protected void + InitializeComponent() + { + this.m_tvObjs = new System.Windows.Forms.TreeView(); + this.m_cntxMenuTree = new System.Windows.Forms.ContextMenu(); + this.m_mnuItemBrowseReflection = new System.Windows.Forms.MenuItem(); + this.m_lvData = new System.Windows.Forms.ListView(); + this.m_lvCol_label = new System.Windows.Forms.ColumnHeader(); + this.m_lvCol_value = new System.Windows.Forms.ColumnHeader(); + this.m_bnOK = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // m_tvObjs + // + this.m_tvObjs.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left); + this.m_tvObjs.ContextMenu = this.m_cntxMenuTree; + this.m_tvObjs.HideSelection = false; + this.m_tvObjs.ImageIndex = -1; + this.m_tvObjs.Location = new System.Drawing.Point(16, 16); + this.m_tvObjs.Name = "m_tvObjs"; + this.m_tvObjs.SelectedImageIndex = -1; + this.m_tvObjs.Size = new System.Drawing.Size(240, 472); + this.m_tvObjs.TabIndex = 0; + this.m_tvObjs.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TreeNodeSelected); + // + // m_cntxMenuTree + // + this.m_cntxMenuTree.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.m_mnuItemBrowseReflection}); + // + // m_mnuItemBrowseReflection + // + this.m_mnuItemBrowseReflection.Index = 0; + this.m_mnuItemBrowseReflection.Text = "Browse Using Reflection..."; + this.m_mnuItemBrowseReflection.Click += new System.EventHandler(this.ContextMenuClick_BrowseReflection); + // + // m_lvData + // + this.m_lvData.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right); + this.m_lvData.AutoArrange = false; + this.m_lvData.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvCol_label, + this.m_lvCol_value}); + this.m_lvData.Cursor = System.Windows.Forms.Cursors.Hand; + this.m_lvData.FullRowSelect = true; + this.m_lvData.GridLines = true; + this.m_lvData.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvData.HideSelection = false; + this.m_lvData.Location = new System.Drawing.Point(272, 16); + this.m_lvData.MultiSelect = false; + this.m_lvData.Name = "m_lvData"; + this.m_lvData.Size = new System.Drawing.Size(504, 472); + this.m_lvData.TabIndex = 1; + this.m_lvData.View = System.Windows.Forms.View.Details; + this.m_lvData.Click += new System.EventHandler(this.DataItemSelected); + this.m_lvData.DoubleClick += new System.EventHandler(this.DataItemSelected); + // + // m_lvCol_label + // + this.m_lvCol_label.Text = "Field"; + this.m_lvCol_label.Width = 200; + // + // m_lvCol_value + // + this.m_lvCol_value.Text = "Value"; + this.m_lvCol_value.Width = 300; + // + // m_bnOK + // + this.m_bnOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.m_bnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnOK.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOK.Location = new System.Drawing.Point(359, 504); + this.m_bnOK.Name = "m_bnOK"; + this.m_bnOK.TabIndex = 2; + this.m_bnOK.Text = "OK"; + // + // XrefGraph + // + this.AcceptButton = this.m_bnOK; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_bnOK; + this.ClientSize = new System.Drawing.Size(792, 535); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnOK, + this.m_lvData, + this.m_tvObjs}); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(575, 225); + this.Name = "XrefGraph"; + this.ShowInTaskbar = false; + this.Text = "Snoop Xref Graph"; + this.ResumeLayout(false); + + } + #endregion + + protected void + AddGraphToTree(AcDb.XrefGraph xrefGraph) + { + TreeNode rootTreeNode = new TreeNode("Xref Graph"); + rootTreeNode.Tag = xrefGraph; + m_tvObjs.Nodes.Add(rootTreeNode); + + //AddGraphNodeToTree(xrefGraph.RootNode, rootTreeNode); // TBD: should be the same, but only gives base class GraphNode + AddGraphNodeToTree(xrefGraph.HostDrawing, rootTreeNode); + + m_tvObjs.Sorted = false; + rootTreeNode.Expand(); + m_tvObjs.SelectedNode = m_tvObjs.Nodes[0]; + } + + private void + AddGraphNodeToTree(AcDb.GraphNode graphNode, TreeNode parentTreeNode) + { + // TBD: for some reason, these are returning GraphNodes, not XrefGraphNodes + string name = "*UNNAMED*"; + AcDb.XrefGraphNode xNode = graphNode as AcDb.XrefGraphNode; + if (xNode != null) + name = xNode.Name; + + TreeNode newTreeNode = new TreeNode(name); + newTreeNode.Tag = graphNode; + parentTreeNode.Nodes.Add(newTreeNode); + + for (int i=0; i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Family + + + 173, 28 + + + Family + + + Family + + + Family + + + Family + + + Family + + + Family + + + XrefGraph + + \ No newline at end of file diff --git a/MgdDbgLibrary/Snoop/ObjIdSet.cs b/MgdDbgLibrary/Snoop/ObjIdSet.cs new file mode 100644 index 0000000..5afc7cc --- /dev/null +++ b/MgdDbgLibrary/Snoop/ObjIdSet.cs @@ -0,0 +1,165 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Diagnostics; +using System.Windows.Forms; + +using Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.Snoop +{ + /// + /// A class to keep track of a unique set of objects collected by the user. + /// It is basically a specialized form of ObjectIdCollection that ensures that + /// each object is unique and encourages them all to be from the same database. The + /// first object added to the set establishes the primary database and it + /// is suggested to the user that the rest should be from the same database. + /// If you want to enforce it, call the constructor with the Database arg. + /// + + public class ObjIdSet + { + private string m_name; + private Database m_db = null; + private ObjectIdCollection m_objIdSet = new ObjectIdCollection(); + private bool m_enforceSameDb = false; + + /// + /// Constructor to use when first object selected establishes the primary database + /// and non-same dbs are only encouraged, not enforced. + /// + /// name of the set + + public + ObjIdSet(string name) + { + m_name = name; + } + + /// + /// Constructor to use when all objects must come from the same database + /// + /// name of the set + /// database that all objects must come from + + public + ObjIdSet(string name, Database allowThisDbOnly) + { + m_name = name; + m_db = allowThisDbOnly; + m_enforceSameDb = true; + } + + public string + Name { + get { return m_name; } + set { m_name = value; } + } + + public Database + Db { + get { return m_db; } + } + + public ObjectIdCollection + Set { + get { return m_objIdSet; } + } + + public bool + AddToSet(ObjectId objId) + { + if (objId.IsNull) { + Debug.Assert(false); + return false; + } + + // if this the first thing recorded, stamp the selection set + // as being from a particular database so we can warn non-same + // db additions. + if ((m_enforceSameDb == false) && (m_db == null)) { + m_db = objId.Database; + m_objIdSet.Add(objId); + return true; + } + else { + if (m_db != objId.Database) { + if (m_enforceSameDb) { + MessageBox.Show("This object is not from the same database dictated by the set. It will not be added."); + return false; + } + else { + DialogResult res = MessageBox.Show("This object is from a different database. Are you sure you want to add it to the set?", "ObjectId Set", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (res == DialogResult.No) + return false; + } + } + + if (Contains(objId)) { + MessageBox.Show("This object is already in the set.", "ObjectId Set", MessageBoxButtons.OK, MessageBoxIcon.Information); + return false; + } + + m_objIdSet.Add(objId); + return true; + } + } + + public void + RemoveFromSet(ObjectId objId) + { + m_objIdSet.Remove(objId); + if (m_objIdSet.Count == 0) { + if (m_enforceSameDb == false) + m_db = null; + } + } + + public void + ClearSet() + { + m_objIdSet.Clear(); + if (m_enforceSameDb == false) + m_db = null; + } + + /// + /// The Contains() function of ObjectIdCollection does not see ObjectId's as the same + /// if there are two separate references to it. Compare the OldId integer values to + /// see if they both point to the same thing. + /// + /// + /// + + public bool + Contains(ObjectId objId) + { + foreach (ObjectId tmpObjId in m_objIdSet) { + if (tmpObjId.OldIdPtr.ToInt32() == objId.OldIdPtr.ToInt32()) + return true; + } + + return false; + } + } +} diff --git a/MgdDbgLibrary/Snoop/Utils.cs b/MgdDbgLibrary/Snoop/Utils.cs new file mode 100644 index 0000000..a886a4e --- /dev/null +++ b/MgdDbgLibrary/Snoop/Utils.cs @@ -0,0 +1,635 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using System.Drawing; +using System.Diagnostics; +using System.Windows.Forms; +using System.Drawing.Printing; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.EditorInput; +using MgdDbg.CompBuilder; + +namespace MgdDbg.Snoop +{ + /// + /// Summary description for Utils. + /// + public class Utils + { + public Utils() + { + } + + // static ObjIdSet that Snoop forms use to collect a set. If the Snoop dialogs + // are being used to collect a set, this will temporarily be set to something. + // After the form is finished it will get set back to null for the normal snoop + // contexts. + private static ObjIdSet m_snoopObjSet = null; + + public static ObjIdSet + CurrentSnoopSet + { + get { return m_snoopObjSet; } + } + + /// + /// Given a ListView to display the data in, clear it out and add all the + /// data that has been collected. For things that have a DrillDown, change + /// the font to Bold so the user knows they can select it. For things that + /// are a Separator, change the background color. + /// + /// The ListView UI control to draw into + /// The collected data about an object + + public static void + Display(ListView lvCur, Snoop.Collectors.Collector snoopCollector) + { + lvCur.BeginUpdate(); + lvCur.Items.Clear(); + + System.Drawing.Font oldFont = lvCur.Font; + System.Drawing.FontStyle newStyle = lvCur.Font.Style ^ System.Drawing.FontStyle.Bold; + System.Drawing.Font boldFont = new System.Drawing.Font(oldFont, newStyle); + + for (int i=0; i < snoopCollector.Data().Count; i++) { + Snoop.Data.Data tmpSnoopData = (Snoop.Data.Data)snoopCollector.Data()[i]; + + // if it is a class separator, then color the background differently + // and don't add a SubItem for the "Field" value + if (tmpSnoopData.IsSeparator) { + ListViewItem lvItem = new ListViewItem(tmpSnoopData.StrValue()); + + if (tmpSnoopData is Snoop.Data.ClassSeparator) + lvItem.BackColor = Color.LightBlue; + else + lvItem.BackColor = Color.Khaki; + + lvItem.Tag = tmpSnoopData; + lvCur.Items.Add(lvItem); + } + else { + ListViewItem lvItem = new ListViewItem(tmpSnoopData.Label); + lvItem.SubItems.Add(tmpSnoopData.StrValue()); + + if (tmpSnoopData.HasDrillDown) { + ListViewItem.ListViewSubItem sItem = (ListViewItem.ListViewSubItem)lvItem.SubItems[0]; + sItem.Font = boldFont; + } + + if (tmpSnoopData.IsError == true) + { + lvItem.ForeColor = Color.Red; + } + + lvItem.Tag = tmpSnoopData; + lvCur.Items.Add(lvItem); + } + } + + lvCur.EndUpdate(); + } + + /// + /// A Snoop.Data item was selected in the ListView. Call its DrillDown() function to + /// get more detailed info about it. + /// + /// The ListView control in question + + public static void + DataItemSelected(ListView lvCur) + { + Debug.Assert((lvCur.SelectedItems.Count > 1) == false); + + if (lvCur.SelectedItems.Count != 0) { + Snoop.Data.Data tmpSnoopData = (Snoop.Data.Data)lvCur.SelectedItems[0].Tag; + tmpSnoopData.DrillDown(); + } + } + + /// + /// Show information about the ObjectId itself (not what the ObjectId refers to). + /// + /// ObjectId to display info for + + public static void + ShowObjIdInfo(ObjectId objId) + { + Snoop.Forms.Objects dbox = new Snoop.Forms.Objects(objId); + dbox.ShowDialog(); + } + + /// + /// Given an ObjectId, allow the user to browse its properties based on Reflection only. + /// + /// Object to browse + + public static void + BrowseReflection(ObjectId objId) + { + if (objId.IsNull) { + Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("ObjectId == null"); + return; + } + + if (objId.IsValid == false) { + Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("ObjectId not valid"); + return; + } + + using (TransactionHelper tr = new TransactionHelper(objId.Database)) { + tr.Start(); + + DBObject tmpObj = tr.Transaction.GetObject(objId, OpenMode.ForRead); + MgdDbg.Snoop.Forms.GenericPropGrid pgForm = new MgdDbg.Snoop.Forms.GenericPropGrid(tmpObj); + pgForm.Text = MgdDbg.Utils.AcadUi.ObjToTypeAndHandleStr(tmpObj); + pgForm.ShowDialog(); + + tr.Commit(); + } + } + + /// + /// Given an ObjectId, allow the user to browse its properties based on Reflection only. + /// + /// Object to browse + + public static void + BrowseReflection(Object obj) + { + if (obj == null) { + Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Object == null"); + return; + } + + MgdDbg.Snoop.Forms.GenericPropGrid pgForm = new MgdDbg.Snoop.Forms.GenericPropGrid(obj); + pgForm.ShowDialog(); + } + + /// + /// Ask the user for an ObjIdSet. First, they are allowed to select graphical + /// objects, SsGet() style. Then, they are prompted to search for non-graphic + /// objects via the Snoop.Database form. + /// + /// The collected ObjIdSet or null if the user canceled + /// + public static Snoop.ObjIdSet + GetSnoopSet() + { + try { + Snoop.ObjIdSet objSet = new Snoop.ObjIdSet("*A"); // TBD: how to deal with named sets? ... later... + + // select the graphic objects they want + PromptSelectionOptions selOpts = new PromptSelectionOptions(); + selOpts.MessageForAdding = "Select graphical objects for test (or RETURN for none)"; + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptSelectionResult res = ed.GetSelection(selOpts); + if (res.Status == PromptStatus.OK) { + foreach (ObjectId objId in res.Value.GetObjectIds()) // set these as the original, let dialog add the rest + objSet.AddToSet(objId); + } + else if (res.Status == PromptStatus.Error) { + ; // empty selection set + } + else { + return null; + } + + Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Select non-graphical objects by browsing, right-click on item, choose \"Add to Snoop Set\"."); + + using (TransactionHelper trHlp = new TransactionHelper(MgdDbg.Utils.Db.GetCurDwg())) { + trHlp.Start(); + + Snoop.Forms.Database form = new Snoop.Forms.Database(trHlp.Database, trHlp); + // temporarily hook up the snoop set to the snoop browse dialogs. + m_snoopObjSet = objSet; + + if (form.ShowDialog() == DialogResult.OK) { + trHlp.Commit(); + return objSet; + } + else { + trHlp.Abort(); + return null; + } + } + } + finally { + m_snoopObjSet = null; // reset to null for next invocation + } + } + + /// + /// Format a type string to represent a given object. + /// + /// Object to label + /// The formatted type string + + public static string + ObjToTypeStr(System.Object obj) + { + if (obj == null) + return "(null)"; + + return string.Format("< {0} >", obj.GetType().Name); + } + + public static string + BytesToHexStr(byte[] bytes) + { + string hexStr = ""; + + for (int j=0; j + /// + /// + /// + /// + public static void + CopyToClipboard (ListView lv) + { + if (lv.Items.Count == 0) { + Clipboard.Clear(); + return; + } + + //First find the longest piece of text in the Field column + // + Int32 maxField = 0; + Int32 maxValue = 0; + + foreach (ListViewItem item in lv.Items) { + if (item.Text.Length > maxField) { + maxField = item.Text.Length; + } + if ((item.SubItems.Count > 1) && (item.SubItems[1].Text.Length > maxValue)) { + maxValue = item.SubItems[1].Text.Length; + } + } + + String headerFormat = String.Format("{{0,{0}}}----{1}\r\n", maxField, new String('-', maxValue)); + String tabbedFormat = String.Format("{{0,{0}}} {{1}}\r\n", maxField); + + System.Text.StringBuilder bldr = new System.Text.StringBuilder(); + + foreach (ListViewItem item in lv.Items) { + if (item.SubItems.Count == 1) { + String tmp = item.Text; + if (item.Text.Length < maxField) { + tmp = item.Text.PadLeft(item.Text.Length + (maxField - item.Text.Length), '-'); + } + + bldr.AppendFormat(headerFormat, tmp); + } + else if (item.SubItems.Count > 1) { + bldr.AppendFormat(tabbedFormat, item.Text, item.SubItems[1].Text); + } + } + + String txt = bldr.ToString(); + if (String.IsNullOrEmpty(txt) == false) { + Clipboard.SetDataObject(txt); + } + } + + /// + /// + /// + /// + public static void + CopyToClipboard (ListViewItem lvItem) + { + if (lvItem.SubItems.Count > 1) { + Clipboard.SetDataObject(lvItem.SubItems[1].Text); + } + else { + Clipboard.Clear(); + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static Int32 + Print (String title, ListView lv, System.Drawing.Printing.PrintPageEventArgs e, Int32 maxFieldWidth, Int32 maxValueWidth, Int32 currentItem) + { + Single linesPerPage = 0; + Single yPos = 0; + Single leftMargin = e.MarginBounds.Left + ((e.MarginBounds.Width - (maxFieldWidth + maxValueWidth)) / 2); + Single topMargin = e.MarginBounds.Top; + Single fontHeight = lv.Font.GetHeight(e.Graphics); + Int32 count = 0; + String line = null; + ListViewItem item; + SolidBrush backgroundBrush; + SolidBrush subbackgroundBrush; + SolidBrush textBrush; + RectangleF rect; + StringFormat centerFormat = new StringFormat(); + StringFormat fieldFormat = new StringFormat(); + StringFormat valueFormat = new StringFormat(); + + centerFormat.Alignment = StringAlignment.Center; + fieldFormat.Alignment = HorizontalAlignmentToStringAligment(lv.Columns[0].TextAlign); + valueFormat.Alignment = HorizontalAlignmentToStringAligment(lv.Columns[1].TextAlign); + + //Draw the title of the list. + // + rect = new RectangleF(leftMargin, topMargin, maxFieldWidth + maxValueWidth, fontHeight); + e.Graphics.DrawString(title, lv.Font, Brushes.Black, rect, centerFormat); + + //Update the count so that we are giving ourselves a line between the title and the list. + // + count = 2; + + //Calculate the number of lines per page + // + linesPerPage = e.MarginBounds.Height / fontHeight; + + while ((count < linesPerPage) && (currentItem < lv.Items.Count)) + { + item = lv.Items[currentItem]; + line = item.Text; + yPos = topMargin + (count * fontHeight); + + backgroundBrush = new SolidBrush(item.BackColor); + textBrush = new SolidBrush(item.ForeColor); + + rect = new RectangleF(leftMargin, yPos, maxFieldWidth, fontHeight); + + e.Graphics.FillRectangle(backgroundBrush, rect); + e.Graphics.DrawRectangle(Pens.Black, rect.X, rect.Y, rect.Width, rect.Height); + + //Draw the field portion of the list view item + // + e.Graphics.DrawString(" " + item.Text, item.Font, textBrush, rect, fieldFormat); + + //Draw the value portion of the list view item + // + rect = new RectangleF(leftMargin + maxFieldWidth, yPos, maxValueWidth, fontHeight); + if (item.SubItems.Count > 1) + { + subbackgroundBrush = new SolidBrush(item.SubItems[1].BackColor); + + e.Graphics.FillRectangle(subbackgroundBrush, rect); + e.Graphics.DrawString(" " + item.SubItems[1].Text, item.Font, textBrush, rect, valueFormat); + } + else + { + e.Graphics.FillRectangle(backgroundBrush, rect); + } + e.Graphics.DrawRectangle(Pens.Black, rect.X, rect.Y, rect.Width, rect.Height); + + count++; + currentItem++; + } + + if (currentItem < lv.Items.Count) + { + e.HasMorePages = true; + } + else + { + e.HasMorePages = false; + currentItem = 0; + } + + return currentItem; + } + + /// + /// + /// + /// + /// + public static StringAlignment + HorizontalAlignmentToStringAligment (HorizontalAlignment ha) + { + switch (ha) + { + case HorizontalAlignment.Center: + return StringAlignment.Center; + case HorizontalAlignment.Left: + return StringAlignment.Near; + case HorizontalAlignment.Right: + return StringAlignment.Far; + default: + return StringAlignment.Near; + } + } + + + /// + /// + /// + /// + /// + public static Int32[] + GetMaximumColumnWidths (ListView lv) + { + Int32 index = 0; + Int32[] widthArray = new Int32[lv.Columns.Count]; + + foreach (ColumnHeader col in lv.Columns) + { + widthArray[index] = col.Width; + index++; + } + + System.Drawing.Graphics g = lv.CreateGraphics(); + Int32 offset = Convert.ToInt32(Math.Ceiling(g.MeasureString(" ", lv.Font).Width)); + Int32 width = 0; + + foreach (ListViewItem item in lv.Items) + { + index = 0; + + foreach (ListViewItem.ListViewSubItem subItem in item.SubItems) + { + width = Convert.ToInt32(Math.Ceiling(g.MeasureString(subItem.Text, item.Font).Width)) + offset; + if (width > widthArray[index]) + { + widthArray[index] = width; + } + index++; + } + } + + g.Dispose(); + + return widthArray; + } + + /// + /// + /// + /// + /// + public static TreeNode + GetRootNode (TreeNode node) + { + if (node.Parent == null) + { + return node; + } + return GetRootNode(node.Parent); + } + + /// + /// + /// + /// + /// + public static String + GetPrintDocumentName (TreeNode node) + { + TreeNode root = GetRootNode(node); + String str = root.Tag as String; + + if (str != null) + { + return System.IO.Path.GetFileNameWithoutExtension((String)root.Tag); + } + return String.Empty; + } + + /// + /// + /// + /// + /// + /// + /// + public static void + UpdatePrintSettings (PrintDocument doc, TreeView tv, ListView lv, ref Int32[] widthArray) + { + if (tv.SelectedNode == null) + { + return; + } + doc.DocumentName = Utils.GetPrintDocumentName(tv.SelectedNode); + widthArray = Utils.GetMaximumColumnWidths(lv); + } + + /// + /// + /// + /// + /// + /// + /// + public static void + UpdatePrintSettings (ListView lv, ref Int32[] widthArray) + { + widthArray = Utils.GetMaximumColumnWidths(lv); + } + + /// + /// + /// + /// + /// + /// + /// + public static void + PrintMenuItemClick (PrintDialog dlg, TreeView tv) + { + if (tv.SelectedNode == null) + { + MessageBox.Show(tv.Parent, "Please select a node in the tree to print.", "MgdDbg", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + if (dlg.ShowDialog(tv.Parent) == DialogResult.OK) + { + dlg.Document.Print(); + } + } + + /// + /// + /// + /// + /// + /// + /// + public static void + PrintMenuItemClick (PrintDialog dlg) + { + dlg.Document.Print(); + } + + /// + /// + /// + /// + /// + /// + public static void + PrintPreviewMenuItemClick (PrintPreviewDialog dlg, TreeView tv) + { + if (tv.SelectedNode == null) + { + MessageBox.Show(tv.Parent, "Please select a node in the tree to print.", "MgdDbg", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + if (PrinterSettings.InstalledPrinters.Count > 0) { + dlg.ShowDialog(tv.Parent); + } + else { + MessageBox.Show("No installed printers found", "MgdDbg", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + + /// + /// + /// + /// + /// + /// + public static void + PrintPreviewMenuItemClick (PrintPreviewDialog dlg, ListView lv) + { + if (PrinterSettings.InstalledPrinters.Count > 0) { + dlg.ShowDialog(lv.Parent); + } + else { + MessageBox.Show("No installed printers found", "MgdDbg", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } +} diff --git a/MgdDbgLibrary/Throwaway/TestForm.cs b/MgdDbgLibrary/Throwaway/TestForm.cs new file mode 100644 index 0000000..08140a3 --- /dev/null +++ b/MgdDbgLibrary/Throwaway/TestForm.cs @@ -0,0 +1,206 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Windows.Forms; + +namespace MgdDbg.Throwaway +{ + /// + /// Summary description for TestForm. + /// + public class TestForm : System.Windows.Forms.Form + { + private System.Windows.Forms.TreeView m_tvEnts; + private System.Windows.Forms.ListView m_lvData; + private System.Windows.Forms.Label m_txtTreeLabel; + private System.Windows.Forms.Button m_bnOK; + private System.Windows.Forms.ColumnHeader m_lvCol_label; + private System.Windows.Forms.ColumnHeader m_lvCol_value; + private System.Windows.Forms.TrackBar m_trkBarOpacity; + private System.Windows.Forms.Label label1; + + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public TestForm() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + TreeNode newNode = new TreeNode("My root node dude"); + m_tvEnts.Nodes.Add(newNode); + //m_tvEnts.SelectedNode = newNode; + + //m_tvEnts.SelectedNode.Nodes.Add(new TreeNode("Dufus")); + newNode.Nodes.Add(new TreeNode("Dufus")); + m_tvEnts.Nodes.Add(new TreeNode("Hobo Show")); + m_tvEnts.ExpandAll(); + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.m_tvEnts = new System.Windows.Forms.TreeView(); + this.m_lvData = new System.Windows.Forms.ListView(); + this.m_lvCol_label = new System.Windows.Forms.ColumnHeader(); + this.m_lvCol_value = new System.Windows.Forms.ColumnHeader(); + this.m_txtTreeLabel = new System.Windows.Forms.Label(); + this.m_bnOK = new System.Windows.Forms.Button(); + this.m_trkBarOpacity = new System.Windows.Forms.TrackBar(); + this.label1 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.m_trkBarOpacity)).BeginInit(); + this.SuspendLayout(); + // + // m_tvEnts + // + this.m_tvEnts.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + this.m_tvEnts.ForeColor = System.Drawing.Color.Red; + this.m_tvEnts.ImageIndex = -1; + this.m_tvEnts.Location = new System.Drawing.Point(16, 64); + this.m_tvEnts.Name = "m_tvEnts"; + this.m_tvEnts.SelectedImageIndex = -1; + this.m_tvEnts.Size = new System.Drawing.Size(240, 328); + this.m_tvEnts.TabIndex = 0; + this.m_tvEnts.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TreeNodeSelected); + // + // m_lvData + // + this.m_lvData.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvCol_label, + this.m_lvCol_value}); + this.m_lvData.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvData.Location = new System.Drawing.Point(272, 64); + this.m_lvData.Name = "m_lvData"; + this.m_lvData.Size = new System.Drawing.Size(456, 328); + this.m_lvData.TabIndex = 1; + // + // m_lvCol_label + // + this.m_lvCol_label.Text = "Field"; + // + // m_lvCol_value + // + this.m_lvCol_value.Text = "Value"; + // + // m_txtTreeLabel + // + this.m_txtTreeLabel.Location = new System.Drawing.Point(16, 32); + this.m_txtTreeLabel.Name = "m_txtTreeLabel"; + this.m_txtTreeLabel.Size = new System.Drawing.Size(240, 23); + this.m_txtTreeLabel.TabIndex = 3; + this.m_txtTreeLabel.Text = "Entities"; + this.m_txtTreeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // m_bnOK + // + this.m_bnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_bnOK.Location = new System.Drawing.Point(335, 480); + this.m_bnOK.Name = "m_bnOK"; + this.m_bnOK.TabIndex = 2; + this.m_bnOK.Text = "OK"; + // + // m_trkBarOpacity + // + this.m_trkBarOpacity.BackColor = System.Drawing.Color.CornflowerBlue; + this.m_trkBarOpacity.Cursor = System.Windows.Forms.Cursors.Hand; + this.m_trkBarOpacity.Location = new System.Drawing.Point(72, 408); + this.m_trkBarOpacity.Maximum = 100; + this.m_trkBarOpacity.Minimum = 10; + this.m_trkBarOpacity.Name = "m_trkBarOpacity"; + this.m_trkBarOpacity.Size = new System.Drawing.Size(232, 50); + this.m_trkBarOpacity.TabIndex = 4; + this.m_trkBarOpacity.TickStyle = System.Windows.Forms.TickStyle.Both; + this.m_trkBarOpacity.Value = 100; + this.m_trkBarOpacity.ValueChanged += new System.EventHandler(this.ChangeOpacity); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(16, 408); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(48, 23); + this.label1.TabIndex = 5; + this.label1.Text = "Opacity"; + // + // TestForm + // + this.AcceptButton = this.m_bnOK; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_bnOK; + this.ClientSize = new System.Drawing.Size(744, 511); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.label1, + this.m_trkBarOpacity, + this.m_txtTreeLabel, + this.m_bnOK, + this.m_lvData, + this.m_tvEnts}); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "TestForm"; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "TestForm"; + ((System.ComponentModel.ISupportInitialize)(this.m_trkBarOpacity)).EndInit(); + this.ResumeLayout(false); + + } + #endregion + + private void + TreeNodeSelected(object sender, System.Windows.Forms.TreeViewEventArgs e) { + //MessageBox.Show("Dude, we selected something!"); + } + + private void + ChangeOpacity(object sender, System.EventArgs e) { + this.Opacity = m_trkBarOpacity.Value / 100.0; + } + } +} diff --git a/MgdDbgLibrary/Throwaway/TestForm.resx b/MgdDbgLibrary/Throwaway/TestForm.resx new file mode 100644 index 0000000..33f1dd5 --- /dev/null +++ b/MgdDbgLibrary/Throwaway/TestForm.resx @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TestForm + + \ No newline at end of file diff --git a/MgdDbgLibrary/Throwaway/TestTabForm.cs b/MgdDbgLibrary/Throwaway/TestTabForm.cs new file mode 100644 index 0000000..052dc92 --- /dev/null +++ b/MgdDbgLibrary/Throwaway/TestTabForm.cs @@ -0,0 +1,201 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Windows.Forms; + +namespace MgdDbg.Throwaway +{ + /// + /// Summary description for TestTabForm. + /// + public class TestTabForm : System.Windows.Forms.Form + { + private System.Windows.Forms.TabControl m_tabCtrl; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.ContextMenu contextMenu1; + private System.Windows.Forms.MenuItem menuItem1; + private System.Windows.Forms.MenuItem menuItem2; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public TestTabForm() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.m_tabCtrl = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.button1 = new System.Windows.Forms.Button(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.button2 = new System.Windows.Forms.Button(); + this.contextMenu1 = new System.Windows.Forms.ContextMenu(); + this.menuItem1 = new System.Windows.Forms.MenuItem(); + this.menuItem2 = new System.Windows.Forms.MenuItem(); + this.m_tabCtrl.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.SuspendLayout(); + // + // m_tabCtrl + // + this.m_tabCtrl.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right); + this.m_tabCtrl.Controls.AddRange(new System.Windows.Forms.Control[] { + this.tabPage1, + this.tabPage2}); + this.m_tabCtrl.Location = new System.Drawing.Point(16, 16); + this.m_tabCtrl.Name = "m_tabCtrl"; + this.m_tabCtrl.SelectedIndex = 0; + this.m_tabCtrl.Size = new System.Drawing.Size(680, 392); + this.m_tabCtrl.TabIndex = 0; + // + // tabPage1 + // + this.tabPage1.ContextMenu = this.contextMenu1; + this.tabPage1.Controls.AddRange(new System.Windows.Forms.Control[] { + this.button1}); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Size = new System.Drawing.Size(672, 366); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "tabPage1"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(40, 48); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(144, 23); + this.button1.TabIndex = 0; + this.button1.Text = "button1"; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // tabPage2 + // + this.tabPage2.Controls.AddRange(new System.Windows.Forms.Control[] { + this.button2}); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Size = new System.Drawing.Size(672, 366); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "tabPage2"; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(32, 40); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(160, 23); + this.button2.TabIndex = 0; + this.button2.Text = "button2"; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // contextMenu1 + // + this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.menuItem1, + this.menuItem2}); + this.contextMenu1.Popup += new System.EventHandler(this.contextMenu1_Popup); + // + // menuItem1 + // + this.menuItem1.Index = 0; + this.menuItem1.Text = "Add to Browse Set"; + this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click); + // + // menuItem2 + // + this.menuItem2.Index = 1; + this.menuItem2.Text = "Show Object Id Info..."; + this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click); + // + // TestTabForm + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(712, 471); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_tabCtrl}); + this.Name = "TestTabForm"; + this.Text = "TestTabForm"; + this.m_tabCtrl.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.ResumeLayout(false); + + } + #endregion + + private void button1_Click(object sender, System.EventArgs e) { + MessageBox.Show("I came from Tab 1"); + } + + private void button2_Click(object sender, System.EventArgs e) { + MessageBox.Show("I came from Tab 2"); + } + + private void contextMenu1_Popup(object sender, System.EventArgs e) { + MessageBox.Show(sender.ToString()); + } + + private void menuItem1_Click(object sender, System.EventArgs e) { + MessageBox.Show("Context menu event 1"); + } + + private void menuItem2_Click(object sender, System.EventArgs e) { + MessageBox.Show("Context menu event 2"); + } + } +} diff --git a/MgdDbgLibrary/Throwaway/TestTabForm.resx b/MgdDbgLibrary/Throwaway/TestTabForm.resx new file mode 100644 index 0000000..3731b1e --- /dev/null +++ b/MgdDbgLibrary/Throwaway/TestTabForm.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + TestTabForm + + \ No newline at end of file diff --git a/MgdDbgLibrary/Utils/AcadUi.cs b/MgdDbgLibrary/Utils/AcadUi.cs new file mode 100644 index 0000000..35c18b6 --- /dev/null +++ b/MgdDbgLibrary/Utils/AcadUi.cs @@ -0,0 +1,525 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using System.Diagnostics; +using System.Windows.Forms; + +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.EditorInput; +using AcadApp = Autodesk.AutoCAD.ApplicationServices; + +namespace MgdDbg.Utils +{ + /// + /// General Acad UI Utils used within the AutoCAD environment. + /// Most of these are just convenient wrappers around existing functions + /// to make them easier to use. + /// + public class AcadUi + { + + public + AcadUi() + { + } + + /// + /// simple wrapper to print a string to the AutoCAD command line. Will not include + /// a \n unless specifically in the string. + /// + public static void + PrintToCmdLine(string str) + { + Editor ed = AcadApp.Application.DocumentManager.MdiActiveDocument.Editor; + ed.WriteMessage(str); + } + + /// + /// format a point in AutoCAD terminology and style using a specified unit + /// and precision. + /// + /// value to format + /// display unit to format as + /// number of decimal places for display precision + public static string + PtToStr(Point3d pt, DistanceUnitFormat unitType, int prec) + { + string x = Converter.DistanceToString(pt.X, unitType, prec); + string y = Converter.DistanceToString(pt.Y, unitType, prec); + string z = Converter.DistanceToString(pt.Z, unitType, prec); + + return string.Format("({0}, {1}, {2})", x, y, z); + } + + /// + /// format a point in AutoCAD terminology and style using the default unit + /// and precision. + /// + /// value to format + public static string + PtToStr(Point3d pt) + { + return PtToStr(pt, DistanceUnitFormat.Current, -1); + } + + /// + /// format a point in AutoCAD terminology and style using a specified unit + /// and precision. + /// + /// value to format + /// display unit to format as + /// number of decimal places for display precision + public static string + PtToStr(Point2d pt, DistanceUnitFormat unitType, int prec) + { + string x = Converter.DistanceToString(pt.X, unitType, prec); + string y = Converter.DistanceToString(pt.Y, unitType, prec); + + return string.Format("({0}, {1})", x, y); + } + + /// + /// format a point in AutoCAD terminology and style using the default unit + /// and precision. + /// + /// value to format + public static string + PtToStr(Point2d pt) + { + return PtToStr(pt, DistanceUnitFormat.Current, -1); + } + + /// + /// format a scale in AutoCAD terminology and style using a specified unit + /// and precision. + /// + /// value to format + /// display unit to format as + /// number of decimal places for display precision + public static string + ScaleToStr (Scale2d sc, DistanceUnitFormat unitType, int prec) + { + string x = Converter.DistanceToString(sc.X, unitType, prec); + string y = Converter.DistanceToString(sc.Y, unitType, prec); + + return string.Format("({0}, {1})", x, y); + } + + /// + /// format a scale in AutoCAD terminology and style using the default unit + /// and precision. + /// + /// value to format + public static string + ScaleToStr (Scale2d sc) + { + return ScaleToStr(sc, DistanceUnitFormat.Current, -1); + } + + /// + /// format a scale in AutoCAD terminology and style using a specified unit + /// and precision. + /// + /// value to format + /// display unit to format as + /// number of decimal places for display precision + public static string + ScaleToStr (Scale3d sc, DistanceUnitFormat unitType, int prec) + { + string x = Converter.DistanceToString(sc.X, unitType, prec); + string y = Converter.DistanceToString(sc.Y, unitType, prec); + string z = Converter.DistanceToString(sc.Z, unitType, prec); + + return string.Format("({0}, {1}, {2})", x, y, z); + } + + /// + /// format a scale in AutoCAD terminology and style using the default unit + /// and precision. + /// + /// value to format + public static string + ScaleToStr (Scale3d sc) + { + return ScaleToStr(sc, DistanceUnitFormat.Current, -1); + } + + /// + /// format a vector in AutoCAD terminology and style using a specified unit + /// and precision. + /// + /// value to format + /// display unit to format as + /// number of decimal places for display precision + public static string + VecToStr(Vector3d v, DistanceUnitFormat unitType, int prec) + { + string x = Converter.DistanceToString(v.X, unitType, prec); + string y = Converter.DistanceToString(v.Y, unitType, prec); + string z = Converter.DistanceToString(v.Z, unitType, prec); + + return string.Format("({0}, {1}, {2})", x, y, z); + } + + + /// + /// format a vector in AutoCAD terminology and style using the default unit + /// and precision. + /// + /// value to format + public static string + VecToStr(Vector3d v) + { + return VecToStr(v, DistanceUnitFormat.Current, -1); + } + + /// + /// format a vector in AutoCAD terminology and style using a specified unit + /// and precision. + /// + /// value to format + /// display unit to format as + /// number of decimal places for display precision + public static string + VecToStr(Vector2d v, DistanceUnitFormat unitType, int prec) + { + string x = Converter.DistanceToString(v.X, unitType, prec); + string y = Converter.DistanceToString(v.Y, unitType, prec); + + return string.Format("({0}, {1})", x, y); + } + + /// + /// format a vector in AutoCAD terminology and style using the default unit + /// and precision. + /// + /// value to format + public static string + VecToStr(Vector2d v) + { + return VecToStr(v, DistanceUnitFormat.Current, -1); + } + + /// + /// print out the class name of a given RXObject + /// + /// RXObject to print the class name from + public static string + ObjToRxClassStr(RXObject obj) + { + Debug.Assert(obj != null); + + RXClass rxClass = obj.GetRXClass(); + if (rxClass == null) { + Debug.Assert(false); + MessageBox.Show("AcRxObject class has not called rxInit()!"); + return "*Unknown*"; + } + else + return rxClass.Name; + } + + public static string + ObjToRxClassAndHandleStr(DBObject dbObj) + { + Debug.Assert(dbObj != null); + + string str1 = ObjToRxClassStr(dbObj); + return string.Format("< {0,-25} {1,4} >", str1, dbObj.Handle.ToString()); + } + + public static string + ObjToRxClassAndHandleStr(ObjectId objId) + { + string str; + + if (objId.IsNull) + str = "(null)"; + else { + // open up even if erased + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = objId.Database.TransactionManager; + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) { + DBObject tmpObj = tr.GetObject(objId, OpenMode.ForRead, true); + str = ObjToRxClassAndHandleStr(tmpObj); + tr.Commit(); + } + } + + return str; + } + + public static string + ObjToTypeAndHandleStr(DBObject dbObj) + { + Debug.Assert(dbObj != null); + + string str1 = dbObj.GetType().Name; + return string.Format("< {0,-20} {1,4} >", str1, dbObj.Handle.ToString()); + } + + public static string + ObjToTypeAndHandleStr(ObjectId objId) + { + string str; + + if (objId.IsNull) + str = "(null)"; + else { + // open up even if erased + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = objId.Database.TransactionManager; + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) { + DBObject tmpObj = tr.GetObject(objId, OpenMode.ForRead, true); + str = ObjToTypeAndHandleStr(tmpObj); + tr.Commit(); + } + } + + return str; + } + + + public static string + ColorIndexToStr(int color, bool convertStandard) + { + string str; + + color = Math.Abs(color); // in case used from Layer table DXF + + Debug.Assert((color >= 0) && (color <= 256)); + + if (color == 0) + str = "ByBlock"; + else if (color == 256) + str = "ByLayer"; + else if (convertStandard) { + if (color == 1) + str = "1-Red"; + else if (color == 2) + str = "2-Yellow"; + else if (color == 3) + str = "3-Green"; + else if (color == 4) + str = "4-Cyan"; + else if (color == 5) + str = "5-Blue"; + else if (color == 6) + str = "6-Magenta"; + else if (color == 7) + str = "7-White"; + else + str = color.ToString(); + } + else + str = color.ToString(); + + return str; + } + + public static string + DbToStr(Database db) + { + if (db == null) { + return "(null)"; + } + + return db.Filename; + + // TBD: what if this fails or returns NullStr? ARX version used pointer value + // to display + } + + public static PromptStatus + PromptYesNo(string prmpt, bool def, out bool answer) + { + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + answer = false; + + string defStr = (def) ? "Yes" : "No"; + PromptKeywordOptions prOpts = new PromptKeywordOptions(prmpt); + prOpts.Keywords.Add("Yes"); + prOpts.Keywords.Add("No"); + prOpts.Keywords.Default = defStr; + + PromptResult prRes = ed.GetKeywords(prOpts); + if (prRes.Status == PromptStatus.OK) { + if (prRes.StringResult == "Yes") + answer = true; + } + + return prRes.Status; + } + + + public static PromptStatus + PromptInteger(string prmpt, bool bIntAllowArbitraryInput, bool bIntAllowNone, + bool bIntAllowZero, bool bIntAllowNegative, bool bIntUseDefault, + int def, out int answer) + { + PromptIntegerOptions prOpts = new PromptIntegerOptions(prmpt); + prOpts.AllowArbitraryInput = bIntAllowArbitraryInput; + prOpts.AllowNone = bIntAllowNone; + prOpts.AllowZero = bIntAllowZero; + prOpts.AllowNegative = bIntAllowNegative; + prOpts.UseDefaultValue = bIntUseDefault; + if (bIntUseDefault) + prOpts.DefaultValue = def; + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptIntegerResult prRes = ed.GetInteger(prOpts); + if (prRes.Status == PromptStatus.OK) + answer = prRes.Value; + else + answer = 0; //bogus value + + return prRes.Status; + } + + + public static bool + GetSelSetFromUser(out ObjectIdCollection selSet) + { + selSet = null; + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptSelectionResult res = ed.GetSelection(); + if (res.Status != PromptStatus.OK) + return false; + + selSet = new ObjectIdCollection(res.Value.GetObjectIds()); + + return true; + } + + public static bool + GetObject (out ObjectId objId) + { + objId = ObjectId.Null; + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptStringOptions prOpts = new PromptStringOptions(string.Format("\nHandle of Db Object")); + prOpts.AllowSpaces = true; + + PromptResult prRes = ed.GetString(prOpts); + + if (prRes.Status != PromptStatus.OK) + return false; + + Handle handle = Utils.Db.StringToHandle(prRes.StringResult); + objId = Utils.Db.HandleToObjectId(Utils.Db.GetCurDwg(), handle); + return true; + } + + + /// + /// + /// + /// + /// + public static Boolean + GetPline3dCollection (Point3dCollection pts3dCollection) + { + if (pts3dCollection == null) + return false; + + Editor ed = AcadApp.Application.DocumentManager.MdiActiveDocument.Editor; + PromptPointOptions options = new PromptPointOptions("\nSelect Point"); + options.AllowNone = true; + PromptPointResult ptResult = ed.GetPoint(options); + + /// Get the initial point + Point3d basePt = new Point3d(); + if (ptResult.Status == PromptStatus.OK) { + basePt = ptResult.Value; + } + + /// loop till you break out + while (true) { + + pts3dCollection.Add(basePt); + int count = pts3dCollection.Count; + if (count > 1) { + /// + /// NOTE: DrawVector wraps acedGrDraw, which provides a jig for free. + /// However here we have to set up our own pline jig + /// + ed.DrawVector(pts3dCollection[count - 2], pts3dCollection[count - 1], -1, false); + options.BasePoint = basePt; + } + + /// drag with the help of a pline jig + JigPline jig = new Utils.JigPline(basePt); + PromptResult result = ed.Drag(jig); + if (result.Status != PromptStatus.OK) { + break; + } + basePt = jig.EndPoint; + } + + if (pts3dCollection.Count < 2) { + PrintToCmdLine("There must be at least 2 points."); + return false; + } + return true; + } + + /// + /// + /// + /// + /// + /// + public static Boolean + GetCorners(out Point3d corner1, out Point3d corner2) + { + Editor ed = AcadApp.Application.DocumentManager.MdiActiveDocument.Editor; + + PromptPointResult prRes = ed.GetPoint("\nSelect one corner"); + if (prRes.Status != PromptStatus.OK) + { + corner1 = prRes.Value; + corner2 = prRes.Value; + return false; + } + + corner1 = prRes.Value; + PromptCornerOptions prOpts = new PromptCornerOptions(string.Format("\n{0}", "Select another corner"), corner1); + prOpts.AllowNone = true; + prOpts.UseDashedLine = true; + + prRes = ed.GetCorner(prOpts); + if (prRes.Status != PromptStatus.OK) + { + corner2 = prRes.Value; + return false; + } + corner2 = prRes.Value; + + return true; + } + } +} diff --git a/MgdDbgLibrary/Utils/ColumnSorterStringUI.cs b/MgdDbgLibrary/Utils/ColumnSorterStringUI.cs new file mode 100644 index 0000000..1d900d0 --- /dev/null +++ b/MgdDbgLibrary/Utils/ColumnSorterStringUI.cs @@ -0,0 +1,116 @@ +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. + +using System.Collections; +using System.Windows.Forms; + + +namespace MgdDbg.Utils { + /// + /// This class is an implementation of the 'IComparer' interface. + /// + public class ListViewColumnSorter : IComparer { + /// + /// Specifies the column to be sorted + /// + private int ColumnToSort; + /// + /// Specifies the order in which to sort (i.e. 'Ascending'). + /// + private SortOrder OrderOfSort; + /// + /// Case insensitive comparer object + /// + private CaseInsensitiveComparer ObjectCompare; + + /// + /// + /// + public ListViewColumnSorter() + { + ColumnToSort = 0; + OrderOfSort = SortOrder.None; + ObjectCompare = new CaseInsensitiveComparer(); + } + + /// + /// This method is inherited from the IComparer interface. + /// Compares the two objects passed using a case insensitive comparison. + /// + /// First object to be compared + /// Second object to be compared + /// The result of the comparison. + /// "0" if equal, negative if 'x' is less than 'y' + /// and positive if 'x' is greater than 'y' + /// + public int Compare(object x, object y) + { + int compareResult; + ListViewItem listviewX, listviewY; + + listviewX = (ListViewItem)x; + listviewY = (ListViewItem)y; + + compareResult = ObjectCompare.Compare(listviewX.SubItems[ColumnToSort].Text, listviewY.SubItems[ColumnToSort].Text); + + if (OrderOfSort == SortOrder.Ascending) { + return compareResult; + } + else if (OrderOfSort == SortOrder.Descending) { + return (-compareResult); + } + else { + return 0; + } + } + + /// + /// Gets or sets the number of the column + /// to which to apply the sorting operation (Defaults to '0'). + /// + public int SortColumn + { + set + { + ColumnToSort = value; + } + get + { + return ColumnToSort; + } + } + + /// + /// Gets or sets the order of sorting + /// to apply (for example, 'Ascending' or 'Descending'). + /// + public SortOrder Order + { + set + { + OrderOfSort = value; + } + get + { + return OrderOfSort; + } + } + } +} \ No newline at end of file diff --git a/MgdDbgLibrary/Utils/Db.cs b/MgdDbgLibrary/Utils/Db.cs new file mode 100644 index 0000000..94352e0 --- /dev/null +++ b/MgdDbgLibrary/Utils/Db.cs @@ -0,0 +1,488 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using System.Diagnostics; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.EditorInput; +using MgdDbg.CompBuilder; +using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application; + +namespace MgdDbg.Utils +{ + /// + /// Summary description for Db. + /// + public class Db + { + public Db() + { + } + + /// + /// shortcut for getting the current DWG's database + /// + /// Database for the current drawing + + public static Database + GetCurDwg() + { + Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; + return db; + } + + /// + /// Is Paper Space active in the given database? + /// + /// Specific database to use + /// + + public static bool + IsPaperSpace(Database db) + { + Debug.Assert(db != null); + + if (db.TileMode) + return false; + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + if (db.PaperSpaceVportId == ed.CurrentViewportObjectId) + return true; + + return false; + } + + /// + /// Figure out the current UCS matrix for the given database. If + /// PaperSpace is active, it will return the UCS for PaperSpace. + /// Otherwise, it will return the UCS for the current viewport in + /// ModelSpace. + /// + /// Specific database to use + /// UCS Matrix for the specified database + + public static Matrix3d + GetUcsMatrix(Database db) + { + Debug.Assert(db != null); + + Point3d origin; + Vector3d xAxis, yAxis, zAxis; + + if (IsPaperSpace(db)) { + origin = db.Pucsorg; + xAxis = db.Pucsxdir; + yAxis = db.Pucsydir; + } + else { + origin = db.Ucsorg; + xAxis = db.Ucsxdir; + yAxis = db.Ucsydir; + } + + zAxis = xAxis.CrossProduct(yAxis); + + return Matrix3d.AlignCoordinateSystem(Utils.Ge.kOrigin, Utils.Ge.kXAxis, Utils.Ge.kYAxis, Utils.Ge.kZAxis, origin, xAxis, yAxis, zAxis); + } + + /// + /// Get the UCS Z Axis for the given database + /// + /// Specific database to use + /// UCS Z Axis + + public static Vector3d + GetUcsZAxis(Database db) + { + Matrix3d m = GetUcsMatrix(db); + + return m.CoordinateSystem3d.Zaxis; + } + + /// + /// + /// + /// + /// + public static Vector3d + GetUcsXAxis (Database db) + { + Matrix3d m = GetUcsMatrix(db); + + return m.CoordinateSystem3d.Xaxis; + } + + /// + /// + /// + /// + /// + public static Vector3d + GetUcsYAxis (Database db) + { + Matrix3d m = GetUcsMatrix(db); + + return m.CoordinateSystem3d.Yaxis; + } + + /// + /// Get the Plane that is defined by the current UCS + /// + /// Database to use + /// Plane defined by the current UCS + + public static Plane + GetUcsPlane(Database db) + { + Matrix3d m = GetUcsMatrix(db); + CoordinateSystem3d coordSys = m.CoordinateSystem3d; + + return new Plane(coordSys.Origin, coordSys.Xaxis, coordSys.Yaxis); + } + + + /// + /// Get the Matrix that is the Xform between UCS and WCS Origin. This is useful + /// for operations like creating a block definition. For those cases you want the + /// origin of the block to be in a reasonable spot. + /// + /// Base point to use as the origin + /// Specific database to use + /// Xform between UCS and WCS Origin + + public static Matrix3d + GetUcsToWcsOriginMatrix(Point3d wcsBasePt, Database db) + { + Matrix3d m = GetUcsMatrix(db); + + Point3d origin = m.CoordinateSystem3d.Origin; + origin += wcsBasePt.GetAsVector(); + + m = Matrix3d.AlignCoordinateSystem(origin, + m.CoordinateSystem3d.Xaxis, + m.CoordinateSystem3d.Yaxis, + m.CoordinateSystem3d.Zaxis, + Utils.Ge.kOrigin, Utils.Ge.kXAxis, Utils.Ge.kYAxis, Utils.Ge.kZAxis); + + return m; + } + + /// + /// Get the X-Axis relative to an entities ECS (In other words, what it considers the + /// X-Axis. This is crucial for Entities like Dimensions and DBPoints. The X-Axis is + /// determined by the Arbitrary Axis algorithm. + /// + /// The normal vector of the entity + /// The X-Axis for this ECS + + public static Vector3d + GetEcsXAxis(Vector3d ecsZAxis) + { + Matrix3d arbMat = GetEcsToWcsMatrix(Utils.Ge.kOrigin, ecsZAxis); + + return arbMat.CoordinateSystem3d.Xaxis; + } + + /// + /// This is the AutoCAD Arbitrary Axis Algorithm. Given a normal vector, + /// establish the ECS matrix that corresponds. + /// + /// Origin point + /// Normal vector of the entity + /// ECS Matrix + + public static Matrix3d + GetEcsToWcsMatrix(Point3d origin, Vector3d zAxis) + { + const double kArbBound = 0.015625; // 1/64th + + // short circuit if in WCS already + if (zAxis == Utils.Ge.kZAxis) { + return Matrix3d.Identity; + } + + Vector3d xAxis, yAxis; + + Debug.Assert(zAxis.IsUnitLength(Tolerance.Global)); + + if ((Math.Abs(zAxis.X) < kArbBound) && (Math.Abs(zAxis.Y) < kArbBound)) + xAxis = Utils.Ge.kYAxis.CrossProduct(zAxis); + else + xAxis = Utils.Ge.kZAxis.CrossProduct(zAxis); + + xAxis = xAxis.GetNormal(); + yAxis = zAxis.CrossProduct(xAxis).GetNormal(); + + return Matrix3d.AlignCoordinateSystem(Utils.Ge.kOrigin, Utils.Ge.kXAxis, Utils.Ge.kYAxis, Utils.Ge.kZAxis, + origin, xAxis, yAxis, zAxis); + } + + /// + /// Get a transformed copy of a point from UCS to WCS + /// + /// Point to transform + /// Transformed copy of point + + public static Point3d + UcsToWcs(Point3d pt) + { + Matrix3d m = GetUcsMatrix(GetCurDwg()); + + return pt.TransformBy(m); + } + + /// + /// Get a transformed copy of a vector from UCS to WCS + /// + /// Vector to transform + /// Transformed copy of vector + + public static Vector3d + UcsToWcs(Vector3d vec) + { + Matrix3d m = GetUcsMatrix(GetCurDwg()); + + return vec.TransformBy(m); + } + + /// + /// Get a transformed copy of a point from WCS to UCS + /// + /// Point to transform + /// Transformed copy of point + + public static Point3d + WcsToUcs(Point3d pt) + { + Matrix3d m = GetUcsMatrix(GetCurDwg()); + + return pt.TransformBy(m.Inverse()); + } + + /// + /// Transform an Entity from UCS to WCS + /// + /// Entity to transform + /// Database the entity belongs to (or will belong to) + + public static void + TransformToWcs(Entity ent, Database db) + { + Debug.Assert(ent != null); + Debug.Assert(db != null); + Debug.Assert(ent.IsWriteEnabled); + + Matrix3d m = GetUcsMatrix(db); + ent.TransformBy(m); + } + + /// + /// Transform a collection of Entities from UCS to WCS + /// + /// Entities to transform + /// Database the entities belong to (or will belong to) + + public static void + TransformToWcs(DBObjectCollection ents, Database db) + { + Debug.Assert(ents != null); + Debug.Assert(db != null); + + Matrix3d m = GetUcsMatrix(db); + + foreach (Entity tmpEnt in ents) { + Debug.Assert(tmpEnt.IsWriteEnabled); + tmpEnt.TransformBy(m); + } + } + + /// + /// Clone and transform a collection of entities. NOTE: this function + /// is not operational yet because it can't iterate over the idMap to + /// accomplish the Xform. + /// + /// database to perform the operation on + /// set of objects to clone + /// owner of the new objects + /// transformation to apply + + public static void + CloneAndXformObjects(Database db, ObjectIdCollection entsToClone, + ObjectId ownerBlockId, Matrix3d xformMat) + { + using (TransactionHelper trHlp = new TransactionHelper(db)) { + trHlp.Start(); + + IdMapping idMap = new IdMapping(); + db.DeepCloneObjects(entsToClone, ownerBlockId, idMap, false); + + // walk through all the cloned objects and Xform any of the entities + foreach (IdPair idpair in idMap) { + if (idpair.IsCloned) { + DBObject clonedObj = trHlp.Transaction.GetObject(idpair.Value, OpenMode.ForWrite); + Entity clonedEnt = clonedObj as Entity; + if (clonedEnt != null) + clonedEnt.TransformBy(xformMat); + } + } + + trHlp.Commit(); + } + } + + public static void + MakePointEnt(Point3d pt, int colorIndex, Transaction tr, Database db) + { + short mode = (short)AcadApp.GetSystemVariable("pdmode"); + if (mode == 0) + AcadApp.SetSystemVariable("pdmode", 99); + + using (DBPoint dbPt = new DBPoint(pt)) { + dbPt.ColorIndex = colorIndex; + MgdDbg.Utils.SymTbl.AddToCurrentSpace(dbPt, db, tr); + } + } + + public static void + MakeRayEnt(Point3d basePt, Vector3d unitDir, int colorIndex, Transaction tr, Database db) + { + if (unitDir.IsZeroLength()) { + Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; + ed.WriteMessage("\nSkipping zero length vector (colorIndex = {0:d})", colorIndex); + return; + } + + using (Ray ray = new Ray()) { + ray.ColorIndex = colorIndex; + ray.BasePoint = basePt; + ray.UnitDir = unitDir; + MgdDbg.Utils.SymTbl.AddToCurrentSpace(ray, db, tr); + } + } + + public static void + MakeExtentsBlock(BoundBlock3d ext, int colorIndex, Database db) + { + Point3d minPt = ext.GetMinimumPoint(); + Point3d maxPt = ext.GetMaximumPoint(); + + double deltaX = Math.Abs(maxPt.X - minPt.X); + double deltaY = Math.Abs(maxPt.Y - minPt.Y); + double deltaZ = Math.Abs(maxPt.Z - minPt.Z); + + Point3d[] pts = new Point3d[8]; + + pts[0] = minPt; + pts[6] = maxPt; + + // make bottom face + pts[1] = new Point3d(pts[0].X + deltaX, pts[0].Y, pts[0].Z); + pts[2] = new Point3d(pts[1].X, pts[1].Y + deltaY, pts[1].Z); + pts[3] = new Point3d(pts[0].X, pts[0].Y + deltaY, pts[0].Z); + + // project up by Z + pts[4] = new Point3d(pts[0].X, pts[0].Y, pts[0].Z + deltaZ); + pts[5] = new Point3d(pts[1].X, pts[1].Y, pts[1].Z + deltaZ); + pts[7] = new Point3d(pts[3].X, pts[3].Y, pts[3].Z + deltaZ); + + Vector3d offset = minPt.GetAsVector(); + + // move points so that they are centered at WCS origin + // for block creation. Express everything in WCS since + // that is what Entity.Extents works in. + for (int i=0; i + /// Converts a string value to a Handle object. + /// + /// + /// + public static Handle + StringToHandle (String strHandle) + { + Handle handle = new Handle(); + + try + { + Int64 nHandle = Convert.ToInt64(strHandle, 16); + handle = new Handle(nHandle); + } + catch (System.FormatException) + { + } + return handle; + } + + /// + /// Gets the ObjectId that corresponds to the handle. + /// + /// + /// + /// + public static ObjectId + HandleToObjectId (Database db, Handle h) + { + ObjectId id = ObjectId.Null; + try + { + id = db.GetObjectId(false, h, 0); + } + catch (Autodesk.AutoCAD.Runtime.Exception x) + { + if (x.ErrorStatus != Autodesk.AutoCAD.Runtime.ErrorStatus.UnknownHandle) + { + throw x; + } + } + return id; + } + } + +} diff --git a/MgdDbgLibrary/Utils/Dialog.cs b/MgdDbgLibrary/Utils/Dialog.cs new file mode 100644 index 0000000..049eca9 --- /dev/null +++ b/MgdDbgLibrary/Utils/Dialog.cs @@ -0,0 +1,53 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. + +using System.Windows.Forms; + +namespace MgdDbg.Utils +{ + public class Dialog + { + /// + /// + /// + /// .ext + /// title of the dialog + /// Ext files (*.ext)|*.ext + /// + public static string OpenFileDialog (string defExtension, string title, string filterString) + { + string fileName = string.Empty; + System.Windows.Forms.OpenFileDialog dbox = new System.Windows.Forms.OpenFileDialog(); + dbox.AddExtension = true; + dbox.DefaultExt = defExtension; + dbox.Filter = filterString; + dbox.Title = title; + dbox.CheckFileExists = true; + dbox.Multiselect = false; + if (dbox.ShowDialog() == DialogResult.OK) { + fileName = dbox.FileName; + } + return fileName; + } + + } +} diff --git a/MgdDbgLibrary/Utils/Ge.cs b/MgdDbgLibrary/Utils/Ge.cs new file mode 100644 index 0000000..0d94cdc --- /dev/null +++ b/MgdDbgLibrary/Utils/Ge.cs @@ -0,0 +1,81 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using Autodesk.AutoCAD.Geometry; + +namespace MgdDbg.Utils +{ + /// + /// Summary description for Ge. + /// + + public class Ge + { + // predefined constants for common angles + public const double kPi = 3.14159265358979323846; + public const double kHalfPi = 3.14159265358979323846 / 2.0; + public const double kTwoPi = 3.14159265358979323846 * 2.0; + + public const double kRad0 = 0.0; + public const double kRad45 = 3.14159265358979323846 / 4.0; + public const double kRad90 = 3.14159265358979323846 / 2.0; + public const double kRad135 = (3.14159265358979323846 * 3.0) / 4.0; + public const double kRad180 = 3.14159265358979323846; + public const double kRad270 = 3.14159265358979323846 * 1.5; + public const double kRad360 = 3.14159265358979323846 * 2.0; + + // predefined values for common Points and Vectors + public static readonly Point3d kOrigin = new Point3d(0.0, 0.0, 0.0); + public static readonly Vector3d kXAxis = new Vector3d(1.0, 0.0, 0.0); + public static readonly Vector3d kYAxis = new Vector3d(0.0, 1.0, 0.0); + public static readonly Vector3d kZAxis = new Vector3d(0.0, 0.0, 1.0); + + public Ge() + { + } + + public static double + RadiansToDegrees(double rads) + { + return rads * (180.0 / kPi); + } + + public static double + DegreesToRadians(double degrees) + { + return degrees * (kPi / 180.0); + } + + public static Point3d + Midpoint(Point3d pt1, Point3d pt2) + { + Point3d newPt = new Point3d(((pt1.X + pt2.X) / 2.0), + ((pt1.Y + pt2.Y) / 2.0), + ((pt1.Z + pt2.Z) / 2.0)); + + return newPt; + } + + + } +} diff --git a/MgdDbgLibrary/Utils/JigPline.cs b/MgdDbgLibrary/Utils/JigPline.cs new file mode 100644 index 0000000..1d6430c --- /dev/null +++ b/MgdDbgLibrary/Utils/JigPline.cs @@ -0,0 +1,105 @@ +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using AcDb = Autodesk.AutoCAD.DatabaseServices; +using AcEd = Autodesk.AutoCAD.EditorInput; +using AcGe = Autodesk.AutoCAD.Geometry; +using AcAp = Autodesk.AutoCAD.ApplicationServices; + +namespace MgdDbg.Utils +{ + /// + /// + /// + public class JigPline : AcEd.DrawJig + { + private AcGe.Point3d m_startPt; + private AcGe.Point3d m_endPt; + + /// + /// + /// + /// + public + JigPline (AcGe.Point3d startPt) + { + m_startPt = startPt; + } + + /// + /// + /// + public AcGe.Point3d + EndPoint + { + get { return m_endPt; } + } + + /// + /// + /// + /// + /// + protected override bool + WorldDraw (Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw) + { + return false; + } + + /// + /// + /// + /// + protected override void + ViewportDraw (Autodesk.AutoCAD.GraphicsInterface.ViewportDraw draw) + { + draw.Geometry.WorldLine(m_startPt, m_endPt); + } + + /// + /// + /// + /// + /// + protected override Autodesk.AutoCAD.EditorInput.SamplerStatus + Sampler (Autodesk.AutoCAD.EditorInput.JigPrompts prompts) + { + AcEd.SamplerStatus samplerStatus = AcEd.SamplerStatus.NoChange; + AcEd.JigPromptPointOptions opts = new AcEd.JigPromptPointOptions(); + + opts.Message = "\nPoint"; + opts.BasePoint = m_startPt; + opts.UseBasePoint = true; + opts.UserInputControls |= AcEd.UserInputControls.AnyBlankTerminatesInput | AcEd.UserInputControls.NullResponseAccepted; + + AcEd.PromptPointResult result = prompts.AcquirePoint(opts); + if (result.Status == AcEd.PromptStatus.OK) { + if (m_endPt != result.Value) { + m_endPt = result.Value; + samplerStatus = AcEd.SamplerStatus.OK; + } + } + + return samplerStatus; + } + } +} diff --git a/MgdDbgLibrary/Utils/ObjectCompare.cs b/MgdDbgLibrary/Utils/ObjectCompare.cs new file mode 100644 index 0000000..3592c82 --- /dev/null +++ b/MgdDbgLibrary/Utils/ObjectCompare.cs @@ -0,0 +1,380 @@ +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using System.Collections; +using System.Reflection; +using AcDb = Autodesk.AutoCAD.DatabaseServices; +using AcadApp = Autodesk.AutoCAD.ApplicationServices; + +namespace MgdDbg.Utils +{ + /// + /// This class takes two objects and compares their + /// properties using Reflection and stores them in a map. + /// + public class ObjectCompare + { + // member vars + private Object m_obj1; + private Object m_obj2; + + private PropertyInfo[] m_propInfos1 = null; + private PropertyInfo[] m_propInfos2 = null; + + private ArrayList m_commonHierarchy = new ArrayList(); + /// + /// only 2 objects to compare , so restrict the capacity + /// + private ArrayList m_objData = new ArrayList(2); + private Hashtable m_propMapItem = new Hashtable(); + private Hashtable m_propMap = new Hashtable(); + + /// + /// + /// + /// + /// + public + ObjectCompare (Object obj1, Object obj2) + { + if (obj1 == null) + m_obj1 = System.DBNull.Value; + if (obj2 == null) + m_obj2 = System.DBNull.Value; + + m_obj1 = obj1; + m_obj2 = obj2; + + Initialise(); + } + + /// + /// + /// + public ArrayList + CommonHierarchy + { + get { return m_commonHierarchy; } + } + + /// + /// + /// + public void + Initialise () + { + m_propInfos1 = m_obj1.GetType().GetProperties(); + m_propInfos2 = m_obj2.GetType().GetProperties(); + + Type intersectionType = GetIntersectionLevel(m_obj1, m_obj2); + Boolean isIntersecting = (intersectionType == typeof(System.Object)) ? false : true; + + m_propInfos1 = GetPropsTillLevel(m_propInfos1, intersectionType); + m_propInfos2 = GetPropsTillLevel(m_propInfos2, intersectionType); + + BuildHierarchy(m_propInfos1); + + if (m_obj1.GetType() == typeof(System.DBNull) && m_obj2.GetType() != typeof(System.DBNull)) { + m_propInfos1 = new PropertyInfo[m_propInfos2.Length]; + m_propInfos1.Initialize(); + BuildHierarchy(m_propInfos2); + } + + if (m_obj2.GetType() == typeof(System.DBNull) && m_obj1.GetType() != typeof(System.DBNull)) { + m_propInfos2 = new PropertyInfo[m_propInfos1.Length]; + m_propInfos2.Initialize(); + BuildHierarchy(m_propInfos1); + } + + + if (isIntersecting) { + for (int i = m_propInfos1.Length - 1; i >= 0; i--) { + + for (int j = m_propInfos2.Length - 1; j >= 0; j--) { + + /// Case where a base property is hidden by a derived property + /// ex: Curve's Closed property is hidden by the Polyline's + /// Closed property and thus for a pline object the Closed property + /// doesnt show up at the Curve level, so check to see if the + /// property name *and* the declaring type are the same + if (m_propInfos1[i].Name == m_propInfos2[j].Name + && m_propInfos1[i].DeclaringType == m_propInfos2[j].DeclaringType) { + + PopulateMap(m_propInfos1[i], m_propInfos2[j]); + break; + } + } + } + } + else { + /// Case where a valid object is being compared to a + /// null object. Happens in case of collection objects + for (int i = m_propInfos1.Length - 1; i >= 0; i--) { + PopulateMap(m_propInfos1[i], m_propInfos2[i]); + } + } + + /// address collection objects + if (IsCollectionObject(m_obj1) || IsCollectionObject(m_obj2)) { + + ArrayList items1 = GetItemsFromCollection(m_obj1); + ArrayList items2 = GetItemsFromCollection(m_obj2); + + int maxCount = (items1.Count >= items2.Count) ? items1.Count : items2.Count; + + for (int i = 0; i < maxCount; i++) { + + m_objData = new ArrayList(2); + try { + m_objData.Add(items1[i]); + } + catch { + m_objData.Add(System.DBNull.Value); + } + try { + m_objData.Add(items2[i]); + } + catch { + m_objData.Add(System.DBNull.Value); + } + string keyStr = String.Format("Item {0}", i); + m_propMapItem[keyStr] = m_objData; + } + } + } + + + /// + /// + /// + /// + /// + private void + PopulateMap (PropertyInfo propInfo1, PropertyInfo propInfo2) + { + Type declaringType = null; + String propName = string.Empty; + + if (propInfo1 != null && propInfo2 != null) { + declaringType = propInfo1.DeclaringType; + propName = propInfo1.Name; + } + + if (propInfo1 == null) { + declaringType = propInfo2.DeclaringType; + propName = propInfo2.Name; + } + if (propInfo2 == null) { + declaringType = propInfo1.DeclaringType; + propName = propInfo1.Name; + } + + if (!m_propMap.ContainsKey(declaringType)) { + + m_propMapItem = new Hashtable(); + m_propMap.Add(declaringType, m_propMapItem); + } + + m_objData = new ArrayList(2); + + /// some properties throw an exception + /// handle them + try { + object value = propInfo1.GetValue(m_obj1, null); + if (value == null) + m_objData.Add(System.DBNull.Value); + else + m_objData.Add(value); + } + catch { + m_objData.Add(System.DBNull.Value); + } + /// some properties throw an exception + /// handle them + try { + object value = propInfo2.GetValue(m_obj2, null); + if (value == null) + m_objData.Add(System.DBNull.Value); + else + m_objData.Add(value); + } + catch { + m_objData.Add(System.DBNull.Value); + } + m_propMapItem[propName] = m_objData; + } + + /// + /// + /// + /// + /// + public Hashtable + GetPropsAtLevel (Type type) + { + return m_propMap[type] as Hashtable; + } + + /// + /// Build and store the object hierarchy + /// + /// + private void + BuildHierarchy (PropertyInfo[] propInfos) + { + Type type = null; + Stack types = new Stack(); + foreach (PropertyInfo propInfo in propInfos) { + if (propInfo.DeclaringType != type) { + type = propInfo.DeclaringType; + types.Push(type); + } + } + + m_commonHierarchy.Clear(); + + while (types.Count != 0) { + m_commonHierarchy.Add(types.Pop() as Type); + } + } + + /// + /// + /// + /// + /// + private Boolean + IsCollectionObject (Object obj) + { + /// a collection object has to implement IList + if (obj.GetType().GetInterface(typeof(IList).FullName) != null) + return true; + return false; + } + + /// + /// Gets the properties till the level type + /// + /// + /// + /// + private PropertyInfo[] + GetPropsTillLevel (PropertyInfo[] propInfo, Type level) + { + Boolean done = false; + for (int i = propInfo.Length - 1; i >= 0; i--) { + + if (propInfo[i].DeclaringType == level) { + done = true; + } + else { + if (done) { + PropertyInfo[] tempPropInfo = propInfo; + propInfo = new PropertyInfo[(propInfo.Length) - (i + 1)]; + Array.Copy(tempPropInfo, i + 1, propInfo, 0, propInfo.Length); + break; + } + } + } + return propInfo; + } + + /// + /// At what level of the hierarchy do + /// the 2 objects intersect + /// + /// + /// + /// + private Type + GetIntersectionLevel (Object obj1, Object obj2) + { + Type type1 = obj1.GetType(); + Type type2 = obj2.GetType(); + Type origType2 = obj2.GetType(); + + while (type1 != type2) { + if (type2 != null) + type2 = type2.BaseType; + else { + type2 = origType2; + type1 = type1.BaseType; + } + + } + + return type1; + } + + /// + /// mine into collection objects and get their items + /// + /// + /// + private ArrayList + GetItemsFromCollection (Object obj) + { + PropertyInfo[] propInfos = obj.GetType().GetProperties(); + PropertyInfo propInfoItem = null; + Int32 count = 0; + + foreach (PropertyInfo propInfo in propInfos) { + + ParameterInfo[] paramArr = propInfo.GetIndexParameters(); + if (paramArr.Length != 0) { + propInfoItem = propInfo; + continue; + } + + /// TBD: an IList implementer has to implement + /// the "Count" property, so this should be safe + /// albeit there should be a better way + if (propInfo.Name == "Count") { + count = (Int32)propInfo.GetValue(obj, null); + } + } + + ArrayList itemData = new ArrayList(); + /// some properties throw an exception + /// handle them + + for (int i = 0; i < count; i++) { + + object[] index = new object[1]; + index[0] = i; + + try { + object value = propInfoItem.GetValue(obj, index); + if (value == null) + itemData.Add(System.DBNull.Value); + else + itemData.Add(value); + } + catch { + itemData.Add(System.DBNull.Value); + } + } + return itemData; + } + } +} + diff --git a/MgdDbgLibrary/Utils/ReferenceFiler.cs b/MgdDbgLibrary/Utils/ReferenceFiler.cs new file mode 100644 index 0000000..99d05b3 --- /dev/null +++ b/MgdDbgLibrary/Utils/ReferenceFiler.cs @@ -0,0 +1,138 @@ + +// +// (C) Copyright 2006 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Geometry; + +namespace MgdDbg.Utils { + + /// + /// Simple class to record Object References. All other data is ignored. + /// + + class ReferenceFiler : DwgFiler { + + // member data + public ObjectIdCollection m_softPointerIds = new ObjectIdCollection(); + public ObjectIdCollection m_hardPointerIds = new ObjectIdCollection(); + public ObjectIdCollection m_softOwnershipIds = new ObjectIdCollection(); + public ObjectIdCollection m_hardOwnershipIds = new ObjectIdCollection(); + + + public override void ResetFilerStatus() {} + + public override Autodesk.AutoCAD.Runtime.ErrorStatus FilerStatus + { + get { return Autodesk.AutoCAD.Runtime.ErrorStatus.OK; } + set {} + } + + public override FilerType FilerType { get { return FilerType.IdFiler; } } + public override long Position { get { return 0; } } + public override void Seek(long offset, int method) {} + + public override IntPtr ReadAddress() { return new System.IntPtr(); } + public override byte[] ReadBinaryChunk() { return new byte[0]; } + public override bool ReadBoolean() { return false; } + public override byte ReadByte() { return 0; } + public override void ReadBytes(byte[] value) {} + public override double ReadDouble() { return 0.0; } + public override Handle ReadHandle() { return new Handle(); } + public override short ReadInt16() { return 0; } + public override int ReadInt32() { return 0; } + public override long ReadInt64() { return 0; } + public override Point2d ReadPoint2d() { return new Point2d(); } + public override Point3d ReadPoint3d() { return new Point3d(); } + public override Scale3d ReadScale3d() { return new Scale3d(); } + public override string ReadString() { return ""; } + public override ushort ReadUInt16() { return 0; } + public override uint ReadUInt32() { return 0; } + public override ulong ReadUInt64() { return 0; } + public override Vector2d ReadVector2d() { return new Vector2d(); } + public override Vector3d ReadVector3d() { return new Vector3d(); } + + public override ObjectId ReadHardOwnershipId() { return new ObjectId(); } + public override ObjectId ReadHardPointerId() { return new ObjectId(); } + public override ObjectId ReadSoftOwnershipId() { return new ObjectId(); } + public override ObjectId ReadSoftPointerId() { return new ObjectId(); } + + public override void WriteAddress(IntPtr value) {} + public override void WriteBinaryChunk(byte[] chunk) {} + public override void WriteBoolean(bool value) {} + public override void WriteByte(byte value) {} + public override void WriteBytes(byte[] value) {} + public override void WriteDouble(double value) {} + public override void WriteHandle(Handle handle) {} + public override void WriteInt16(short value) {} + public override void WriteInt32(int value) {} + public override void WriteInt64(long value) {} + public override void WritePoint2d(Point2d value) {} + public override void WritePoint3d(Point3d value) {} + public override void WriteScale3d(Scale3d value) {} + public override void WriteString(string value) {} + public override void WriteUInt16(ushort value) {} + public override void WriteUInt32(uint value) {} + public override void WriteUInt64(ulong value) {} + public override void WriteVector2d(Vector2d value) {} + public override void WriteVector3d(Vector3d value) {} + + + public override void + WriteHardOwnershipId(ObjectId value) + { + if (value.IsNull == false) + m_hardOwnershipIds.Add(value); + } + + public override void + WriteHardPointerId(ObjectId value) + { + if (value.IsNull == false) + m_hardPointerIds.Add(value); + } + + public override void + WriteSoftOwnershipId(ObjectId value) + { + if (value.IsNull == false) + m_softOwnershipIds.Add(value); + } + + public override void + WriteSoftPointerId(ObjectId value) + { + if (value.IsNull == false) + m_hardPointerIds.Add(value); + } + + public void + Reset() + { + m_softPointerIds.Clear(); + m_hardPointerIds.Clear(); + m_softOwnershipIds.Clear(); + m_hardOwnershipIds.Clear(); + } + } +} diff --git a/MgdDbgLibrary/Utils/SymTbl.cs b/MgdDbgLibrary/Utils/SymTbl.cs new file mode 100644 index 0000000..41869c2 --- /dev/null +++ b/MgdDbgLibrary/Utils/SymTbl.cs @@ -0,0 +1,270 @@ + +// +// (C) Copyright 2004 by Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer +// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) +// (Rights in Technical Data and Computer Software), as applicable. +// + +using System.Diagnostics; +using Autodesk.AutoCAD.DatabaseServices; + +namespace MgdDbg.Utils +{ + /// + /// Summary description for SymTbl. + /// + public class SymTbl + { + public SymTbl() + { + } + + /// + /// Add a newly allocated Entity to the Current Space (ModelSpace or PaperSpace). + /// Use this function as a simple way to add an isolated entity. For "real" situations + /// where you need to add several entities (like when creating a BlockTableRecord), + /// use a CompBldr object. + /// + /// Entity that has not yet been added to the database + /// Database to add to + /// Active Transaction + /// The ObjectId of the new entity + + public static ObjectId + AddToCurrentSpace(Entity ent, Database db, Transaction tr) + { + ObjectId objId; + + BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite); + objId = btr.AppendEntity(ent); + tr.AddNewlyCreatedDBObject(ent, true); + + return objId; + } + + /// + /// Add newly allocated Entites to the Current Space (ModelSpace or PaperSpace). + /// Use this function as a simple way to add isolated entities. For "real" situations + /// where you need to add several entities (like when creating a BlockTableRecord), + /// use a CompBldr object. + /// + /// Entities that have not yet been added to the database + /// Database to add to + /// Active Transaction + + public static void + AddToCurrentSpace(DBObjectCollection ents, Database db, Transaction tr) + { + BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite); + foreach (Entity tmpEnt in ents) { + btr.AppendEntity(tmpEnt); + tr.AddNewlyCreatedDBObject(tmpEnt, true); + } + } + + /// + /// Add a newly allocated Entity to the Current Space (ModelSpace or PaperSpace). + /// Use this function as a simple way to add an isolated entity. For "real" situations + /// where you need to add several entities (like when creating a BlockTableRecord), + /// use a CompBldr object. This version will Start and Commit a Transaction. + /// + /// An entity which is not yet in the database + /// The Database to add it to + /// The ObjectId of the newly added Entity + + public static ObjectId + AddToCurrentSpaceAndClose(Entity ent, Database db) + { + ObjectId objId; + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager; + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) { + objId = AddToCurrentSpace(ent, db, tr); + tr.Commit(); + } + + return objId; + } + + /// + /// Add newly allocated Entites to the Current Space (ModelSpace or PaperSpace). + /// Use this function as a simple way to add isolated entities. For "real" situations + /// where you need to add several entities (like when creating a BlockTableRecord), + /// use a CompBldr object. This version will Start and Commit a Transaction. + /// + /// An entities which are not yet in the database + /// The Database to add it to + /// The ObjectId of the newly added Entity + + public static void + AddToCurrentSpaceAndClose(DBObjectCollection ents, Database db) + { + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager; + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) { + AddToCurrentSpace(ents, db, tr); + tr.Commit(); + } + } + + /// + /// Iterate over a BlockTableRecord and collect all the ObjectIds of the + /// entities it contains. + /// + /// BlockTableRecord to iterate over + /// The collection of objects within the BlockTableRecord + + public static ObjectIdCollection + CollectBlockEnts(BlockTableRecord blkRec) + { + ObjectIdCollection objIds = new ObjectIdCollection(); + + foreach (ObjectId id in blkRec) { + objIds.Add(id); + } + + return objIds; + } + + /// + /// Given a type of SymbolTableRecord, look up the appropriate SymbolTable + /// for this type of object. This is used to programmatically find owning + /// symbol tables when we don't know ahead of time what type of object we + /// are dealing with. + /// + /// System.Type of the SymbolTableRecord + /// Specific database we are looking at + /// ObjectId of the SymbolTable that owns this type of SymbolTableRecord. + + public static ObjectId + GetSymbolTableId(System.Type classType, Database db) + { + Debug.Assert(classType != null); + Debug.Assert(db != null); + + if (classType == typeof(BlockTableRecord)) + return db.BlockTableId; + else if (classType == typeof(DimStyleTableRecord)) + return db.DimStyleTableId; + else if (classType == typeof(LayerTableRecord)) + return db.LayerTableId; + else if (classType == typeof(LinetypeTableRecord)) + return db.LinetypeTableId; + else if (classType == typeof(TextStyleTableRecord)) + return db.TextStyleTableId; + else if (classType == typeof(RegAppTableRecord)) + return db.RegAppTableId; + else if (classType == typeof(UcsTableRecord)) + return db.UcsTableId; + else if (classType == typeof(ViewTableRecord)) + return db.ViewTableId; + else if (classType == typeof(ViewportTableRecord)) + return db.ViewportTableId; + else { + Debug.Assert(false); + ObjectId nullObj = new ObjectId(); + return nullObj; + } + } + + /// + /// Get the ObjectId of a named SymbolTableRecord + /// + /// + /// + /// + /// + + public static ObjectId + GetSymbolTableRecId(System.Type classType, string symName, Database db) + { + ObjectId tblId = GetSymbolTableId(classType, db); + ObjectId recId = new ObjectId(); + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager; + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) { + SymbolTable tbl = (SymbolTable)tr.GetObject(tblId, OpenMode.ForRead); + if (tbl.Has(symName)) // TBD: should indexer return ObjectId.null instead of throwing exception + recId = tbl[symName]; + tr.Commit(); + } + + return recId; + } + + /// + /// See if a SymbolTableRecord of the given name already exists + /// + /// Type of the SymbolTableRecord (e.g., LayerTableRecord) + /// Name of the symbol + /// True if the symbol already exists, False if it doesn't + + public static bool + SymbolTableRecExists(System.Type classType, string symName, Database db) + { + bool doesExist = false; + + ObjectId tblId = GetSymbolTableId(classType, db); + + Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager; + using (Autodesk.AutoCAD.DatabaseServices.Transaction tr = tm.StartTransaction()) { + SymbolTable tbl = (SymbolTable)tr.GetObject(tblId, OpenMode.ForRead); + doesExist = tbl.Has(symName); + tr.Commit(); + } + + return doesExist; + } + + + /// + /// Get the ObjectId of a named Linetype. If the Linetype does not already exist + /// in the drawing, it will attempt to load it from the standard AutoCAD Linetype + /// files. + /// + /// Name of the Linetype + /// Specific database we are using + /// ObjectId of the named linetype. Returns CONTINUOUS if not found and could not load. + + public static ObjectId + GetOrLoadLinetypeId(string ltypeName, Database db) + { + ObjectId ltypeId = GetSymbolTableRecId(typeof(LinetypeTableRecord), ltypeName, db); + + if (ltypeId.IsNull) { + string[] ltypeFiles = {"acad.lin", "acadiso.lin", "ltypeshp.lin"}; + + int len = ltypeFiles.Length; + for (int i=0; i + /// UI Test for navigating the XML Dom + /// + public class Dom : System.Windows.Forms.Form + { + private System.Windows.Forms.TreeView m_tvDom; + private System.Windows.Forms.ListView m_lvData; + private System.Windows.Forms.RadioButton m_rbNodeNameOnly; + private System.Windows.Forms.RadioButton m_rbNodeAndText; + private System.Windows.Forms.GroupBox m_grpLabelDisplay; + private System.Windows.Forms.GroupBox m_grpNodeDisplay; + private System.Windows.Forms.CheckBox m_cbHideCommentNodes; + private System.Windows.Forms.CheckBox m_cbHideTextNodes; + private System.Windows.Forms.Button m_bnParent; + private System.Windows.Forms.Button m_bnOwnerDoc; + private System.Windows.Forms.Button m_bnPrevSibling; + private System.Windows.Forms.Button m_bnNextSibling; + private System.Windows.Forms.Button m_bnFirstChild; + private System.Windows.Forms.Button m_bnLastChild; + private System.Windows.Forms.Button m_bnDocElem; + private System.Windows.Forms.TextBox m_ebXpathPattern; + private System.Windows.Forms.Button m_bnSelectSingleNode; + private System.Windows.Forms.Button m_bnXpathClear; + private System.Windows.Forms.Button m_bnSelectNodes; + private System.Windows.Forms.Button m_bnOk; + private System.Windows.Forms.ColumnHeader m_lvColLabel; + private System.Windows.Forms.ColumnHeader m_lvColValue; + private System.Windows.Forms.ImageList m_imgListTree; + private System.Windows.Forms.Label m_txtXpathPattern; + private System.Windows.Forms.GroupBox m_grpXpath; + + private System.Xml.XmlDocument m_xmlDoc = null; + private Snoop.Collectors.XmlNode m_snoopCollector = new Snoop.Collectors.XmlNode(); + + private System.ComponentModel.IContainer components; + + public + Dom(System.Xml.XmlDocument xmlDoc) + { + m_xmlDoc = xmlDoc; + + InitializeComponent(); + + LoadTree(); + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Dom)); + this.m_tvDom = new System.Windows.Forms.TreeView(); + this.m_imgListTree = new System.Windows.Forms.ImageList(this.components); + this.m_lvData = new System.Windows.Forms.ListView(); + this.m_lvColLabel = new System.Windows.Forms.ColumnHeader(); + this.m_lvColValue = new System.Windows.Forms.ColumnHeader(); + this.m_rbNodeNameOnly = new System.Windows.Forms.RadioButton(); + this.m_rbNodeAndText = new System.Windows.Forms.RadioButton(); + this.m_grpLabelDisplay = new System.Windows.Forms.GroupBox(); + this.m_grpNodeDisplay = new System.Windows.Forms.GroupBox(); + this.m_cbHideTextNodes = new System.Windows.Forms.CheckBox(); + this.m_cbHideCommentNodes = new System.Windows.Forms.CheckBox(); + this.m_bnParent = new System.Windows.Forms.Button(); + this.m_bnOwnerDoc = new System.Windows.Forms.Button(); + this.m_bnPrevSibling = new System.Windows.Forms.Button(); + this.m_bnNextSibling = new System.Windows.Forms.Button(); + this.m_bnFirstChild = new System.Windows.Forms.Button(); + this.m_bnLastChild = new System.Windows.Forms.Button(); + this.m_txtXpathPattern = new System.Windows.Forms.Label(); + this.m_ebXpathPattern = new System.Windows.Forms.TextBox(); + this.m_bnSelectSingleNode = new System.Windows.Forms.Button(); + this.m_bnSelectNodes = new System.Windows.Forms.Button(); + this.m_bnOk = new System.Windows.Forms.Button(); + this.m_bnXpathClear = new System.Windows.Forms.Button(); + this.m_grpXpath = new System.Windows.Forms.GroupBox(); + this.m_bnDocElem = new System.Windows.Forms.Button(); + this.m_grpNodeDisplay.SuspendLayout(); + this.m_grpXpath.SuspendLayout(); + this.SuspendLayout(); + // + // m_tvDom + // + this.m_tvDom.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right); + this.m_tvDom.HideSelection = false; + this.m_tvDom.ImageList = this.m_imgListTree; + this.m_tvDom.Location = new System.Drawing.Point(16, 16); + this.m_tvDom.Name = "m_tvDom"; + this.m_tvDom.Size = new System.Drawing.Size(336, 416); + this.m_tvDom.TabIndex = 0; + this.m_tvDom.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TreeNodeSelected); + // + // m_imgListTree + // + this.m_imgListTree.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; + this.m_imgListTree.ImageSize = new System.Drawing.Size(16, 16); + this.m_imgListTree.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("m_imgListTree.ImageStream"))); + this.m_imgListTree.TransparentColor = System.Drawing.Color.Transparent; + // + // m_lvData + // + this.m_lvData.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right); + this.m_lvData.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.m_lvColLabel, + this.m_lvColValue}); + this.m_lvData.FullRowSelect = true; + this.m_lvData.GridLines = true; + this.m_lvData.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvData.Location = new System.Drawing.Point(368, 16); + this.m_lvData.MultiSelect = false; + this.m_lvData.Name = "m_lvData"; + this.m_lvData.Size = new System.Drawing.Size(416, 328); + this.m_lvData.TabIndex = 1; + this.m_lvData.View = System.Windows.Forms.View.Details; + this.m_lvData.Click += new System.EventHandler(this.DataItemSelected); + // + // m_lvColLabel + // + this.m_lvColLabel.Text = "Field"; + this.m_lvColLabel.Width = 200; + // + // m_lvColValue + // + this.m_lvColValue.Text = "Value"; + this.m_lvColValue.Width = 250; + // + // m_rbNodeNameOnly + // + this.m_rbNodeNameOnly.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); + this.m_rbNodeNameOnly.Checked = true; + this.m_rbNodeNameOnly.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_rbNodeNameOnly.Location = new System.Drawing.Point(384, 376); + this.m_rbNodeNameOnly.Name = "m_rbNodeNameOnly"; + this.m_rbNodeNameOnly.Size = new System.Drawing.Size(152, 24); + this.m_rbNodeNameOnly.TabIndex = 2; + this.m_rbNodeNameOnly.TabStop = true; + this.m_rbNodeNameOnly.Text = "Node Name Only"; + this.m_rbNodeNameOnly.CheckedChanged += new System.EventHandler(this.OnRbChanged_LabelDisplay); + // + // m_rbNodeAndText + // + this.m_rbNodeAndText.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); + this.m_rbNodeAndText.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_rbNodeAndText.Location = new System.Drawing.Point(384, 400); + this.m_rbNodeAndText.Name = "m_rbNodeAndText"; + this.m_rbNodeAndText.Size = new System.Drawing.Size(168, 24); + this.m_rbNodeAndText.TabIndex = 4; + this.m_rbNodeAndText.Text = "Node Name and Value"; + this.m_rbNodeAndText.CheckedChanged += new System.EventHandler(this.OnRbChanged_LabelDisplay); + // + // m_grpLabelDisplay + // + this.m_grpLabelDisplay.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); + this.m_grpLabelDisplay.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_grpLabelDisplay.Location = new System.Drawing.Point(368, 360); + this.m_grpLabelDisplay.Name = "m_grpLabelDisplay"; + this.m_grpLabelDisplay.Size = new System.Drawing.Size(200, 72); + this.m_grpLabelDisplay.TabIndex = 5; + this.m_grpLabelDisplay.TabStop = false; + this.m_grpLabelDisplay.Text = "Label Display"; + // + // m_grpNodeDisplay + // + this.m_grpNodeDisplay.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); + this.m_grpNodeDisplay.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_cbHideTextNodes, + this.m_cbHideCommentNodes}); + this.m_grpNodeDisplay.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_grpNodeDisplay.Location = new System.Drawing.Point(584, 360); + this.m_grpNodeDisplay.Name = "m_grpNodeDisplay"; + this.m_grpNodeDisplay.Size = new System.Drawing.Size(200, 72); + this.m_grpNodeDisplay.TabIndex = 6; + this.m_grpNodeDisplay.TabStop = false; + this.m_grpNodeDisplay.Text = "Node Display"; + // + // m_cbHideTextNodes + // + this.m_cbHideTextNodes.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); + this.m_cbHideTextNodes.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbHideTextNodes.Location = new System.Drawing.Point(16, 40); + this.m_cbHideTextNodes.Name = "m_cbHideTextNodes"; + this.m_cbHideTextNodes.Size = new System.Drawing.Size(176, 24); + this.m_cbHideTextNodes.TabIndex = 1; + this.m_cbHideTextNodes.Text = "Hide Text Nodes"; + this.m_cbHideTextNodes.CheckedChanged += new System.EventHandler(this.OnCbChanged_NodeDisplay); + // + // m_cbHideCommentNodes + // + this.m_cbHideCommentNodes.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); + this.m_cbHideCommentNodes.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_cbHideCommentNodes.Location = new System.Drawing.Point(16, 16); + this.m_cbHideCommentNodes.Name = "m_cbHideCommentNodes"; + this.m_cbHideCommentNodes.Size = new System.Drawing.Size(176, 24); + this.m_cbHideCommentNodes.TabIndex = 0; + this.m_cbHideCommentNodes.Text = "Hide Comment Nodes"; + this.m_cbHideCommentNodes.CheckedChanged += new System.EventHandler(this.OnCbChanged_NodeDisplay); + // + // m_bnParent + // + this.m_bnParent.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_bnParent.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnParent.Location = new System.Drawing.Point(16, 448); + this.m_bnParent.Name = "m_bnParent"; + this.m_bnParent.TabIndex = 7; + this.m_bnParent.Text = "Parent"; + this.m_bnParent.Click += new System.EventHandler(this.OnBnParent); + // + // m_bnOwnerDoc + // + this.m_bnOwnerDoc.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_bnOwnerDoc.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOwnerDoc.Location = new System.Drawing.Point(104, 448); + this.m_bnOwnerDoc.Name = "m_bnOwnerDoc"; + this.m_bnOwnerDoc.TabIndex = 8; + this.m_bnOwnerDoc.Text = "Owner Doc"; + this.m_bnOwnerDoc.Click += new System.EventHandler(this.OnBnOwnerDoc); + // + // m_bnPrevSibling + // + this.m_bnPrevSibling.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_bnPrevSibling.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnPrevSibling.Location = new System.Drawing.Point(192, 448); + this.m_bnPrevSibling.Name = "m_bnPrevSibling"; + this.m_bnPrevSibling.TabIndex = 9; + this.m_bnPrevSibling.Text = "Prev Sibling"; + this.m_bnPrevSibling.Click += new System.EventHandler(this.OnBnPrevSibling); + // + // m_bnNextSibling + // + this.m_bnNextSibling.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_bnNextSibling.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnNextSibling.Location = new System.Drawing.Point(280, 448); + this.m_bnNextSibling.Name = "m_bnNextSibling"; + this.m_bnNextSibling.TabIndex = 10; + this.m_bnNextSibling.Text = "Next Sibling"; + this.m_bnNextSibling.Click += new System.EventHandler(this.OnBnNextSibling); + // + // m_bnFirstChild + // + this.m_bnFirstChild.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_bnFirstChild.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnFirstChild.Location = new System.Drawing.Point(368, 448); + this.m_bnFirstChild.Name = "m_bnFirstChild"; + this.m_bnFirstChild.TabIndex = 11; + this.m_bnFirstChild.Text = "First Child"; + this.m_bnFirstChild.Click += new System.EventHandler(this.OnBnFirstChild); + // + // m_bnLastChild + // + this.m_bnLastChild.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_bnLastChild.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnLastChild.Location = new System.Drawing.Point(456, 448); + this.m_bnLastChild.Name = "m_bnLastChild"; + this.m_bnLastChild.TabIndex = 12; + this.m_bnLastChild.Text = "Last Child"; + this.m_bnLastChild.Click += new System.EventHandler(this.OnBnLastChild); + // + // m_txtXpathPattern + // + this.m_txtXpathPattern.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_txtXpathPattern.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_txtXpathPattern.Location = new System.Drawing.Point(32, 512); + this.m_txtXpathPattern.Name = "m_txtXpathPattern"; + this.m_txtXpathPattern.Size = new System.Drawing.Size(64, 23); + this.m_txtXpathPattern.TabIndex = 14; + this.m_txtXpathPattern.Text = "Expression:"; + // + // m_ebXpathPattern + // + this.m_ebXpathPattern.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_ebXpathPattern.Location = new System.Drawing.Point(88, 24); + this.m_ebXpathPattern.Name = "m_ebXpathPattern"; + this.m_ebXpathPattern.Size = new System.Drawing.Size(424, 20); + this.m_ebXpathPattern.TabIndex = 15; + this.m_ebXpathPattern.Text = ""; + // + // m_bnSelectSingleNode + // + this.m_bnSelectSingleNode.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_bnSelectSingleNode.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnSelectSingleNode.Location = new System.Drawing.Point(128, 56); + this.m_bnSelectSingleNode.Name = "m_bnSelectSingleNode"; + this.m_bnSelectSingleNode.Size = new System.Drawing.Size(120, 23); + this.m_bnSelectSingleNode.TabIndex = 16; + this.m_bnSelectSingleNode.Text = "Select Single Node"; + this.m_bnSelectSingleNode.Click += new System.EventHandler(this.OnBnSelectSingleNode); + // + // m_bnSelectNodes + // + this.m_bnSelectNodes.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_bnSelectNodes.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnSelectNodes.Location = new System.Drawing.Point(256, 56); + this.m_bnSelectNodes.Name = "m_bnSelectNodes"; + this.m_bnSelectNodes.Size = new System.Drawing.Size(120, 23); + this.m_bnSelectNodes.TabIndex = 17; + this.m_bnSelectNodes.Text = "Select Nodes"; + this.m_bnSelectNodes.Click += new System.EventHandler(this.OnBnSelectNodes); + // + // m_bnOk + // + this.m_bnOk.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); + this.m_bnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.m_bnOk.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnOk.Location = new System.Drawing.Point(704, 544); + this.m_bnOk.Name = "m_bnOk"; + this.m_bnOk.TabIndex = 18; + this.m_bnOk.Text = "OK"; + // + // m_bnXpathClear + // + this.m_bnXpathClear.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_bnXpathClear.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnXpathClear.Location = new System.Drawing.Point(384, 56); + this.m_bnXpathClear.Name = "m_bnXpathClear"; + this.m_bnXpathClear.Size = new System.Drawing.Size(120, 23); + this.m_bnXpathClear.TabIndex = 19; + this.m_bnXpathClear.Text = "Clear"; + this.m_bnXpathClear.Click += new System.EventHandler(this.OnBnClear); + // + // m_grpXpath + // + this.m_grpXpath.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_grpXpath.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_ebXpathPattern, + this.m_bnXpathClear, + this.m_bnSelectNodes, + this.m_bnSelectSingleNode}); + this.m_grpXpath.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_grpXpath.Location = new System.Drawing.Point(16, 488); + this.m_grpXpath.Name = "m_grpXpath"; + this.m_grpXpath.Size = new System.Drawing.Size(520, 88); + this.m_grpXpath.TabIndex = 20; + this.m_grpXpath.TabStop = false; + this.m_grpXpath.Text = "XPath Expressions"; + // + // m_bnDocElem + // + this.m_bnDocElem.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); + this.m_bnDocElem.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.m_bnDocElem.Location = new System.Drawing.Point(544, 448); + this.m_bnDocElem.Name = "m_bnDocElem"; + this.m_bnDocElem.Size = new System.Drawing.Size(80, 23); + this.m_bnDocElem.TabIndex = 21; + this.m_bnDocElem.Text = "Doc Element"; + this.m_bnDocElem.Click += new System.EventHandler(this.OnBnDocElement); + // + // Dom + // + this.AcceptButton = this.m_bnOk; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_bnOk; + this.ClientSize = new System.Drawing.Size(800, 591); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.m_bnDocElem, + this.m_bnOk, + this.m_txtXpathPattern, + this.m_bnLastChild, + this.m_bnFirstChild, + this.m_bnNextSibling, + this.m_bnPrevSibling, + this.m_bnOwnerDoc, + this.m_bnParent, + this.m_grpNodeDisplay, + this.m_rbNodeAndText, + this.m_rbNodeNameOnly, + this.m_lvData, + this.m_tvDom, + this.m_grpLabelDisplay, + this.m_grpXpath}); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(650, 400); + this.Name = "Dom"; + this.Text = "XML DOM Tree"; + this.m_grpNodeDisplay.ResumeLayout(false); + this.m_grpXpath.ResumeLayout(false); + this.ResumeLayout(false); + + } + #endregion + + /// + /// This will populate the UI TreeView with all the nodes from the DOM tree + /// + + private void + LoadTree() + { + m_tvDom.BeginUpdate(); // suppress redraw events + m_tvDom.Nodes.Clear(); + + MakeTree(m_xmlDoc, null); + + m_tvDom.ExpandAll(); + if (m_tvDom.Nodes.Count > 0) + m_tvDom.SelectedNode = m_tvDom.Nodes[0]; // make first one selected + + m_tvDom.EndUpdate(); // flushes redraw events + } + + /// + /// Recursive function to walk the tree and populate all the nodes + /// + /// The "root" of this portion of the tree + /// The parent node to attach to or null for the root + + private void + MakeTree(System.Xml.XmlNode xmlNode, TreeNode parentNode) + { + XmlNodeType nType = xmlNode.NodeType; + + // bail early if user doesn't want this type of node displayed + if (((nType == XmlNodeType.Comment) && (m_cbHideCommentNodes.Checked)) || + ((nType == XmlNodeType.Text) && (m_cbHideTextNodes.Checked))) + return; + + // get image index and label to use in the TreeNode + int imageIndex = GetImageIndex(nType); + string labelStr = FormatLabel(xmlNode); + + TreeNode treeNode = new TreeNode(labelStr); + treeNode.Tag = xmlNode; + treeNode.ImageIndex = imageIndex; + treeNode.SelectedImageIndex = imageIndex; + + if (parentNode == null) + m_tvDom.Nodes.Add(treeNode); // This is the root node + else + parentNode.Nodes.Add(treeNode); + + // get attributes of this node + XmlAttributeCollection atts = xmlNode.Attributes; + if (atts != null) { + foreach (XmlAttribute tmpAtt in atts) { + MakeTree(tmpAtt, treeNode); + } + } + // now recursively go to the children of this node + if (xmlNode.HasChildNodes) { + foreach (XmlNode childNode in xmlNode.ChildNodes) { + MakeTree(childNode, treeNode); + } + } + } + + /// + /// Match a particular Image with the XML Node type. A different Icon will + /// be used in the UI tree for each type of node. + /// + /// The node type + /// index into the ImageList assigned to the TreeView + + private int + GetImageIndex(XmlNodeType nType) + { + int imageIndex = 0; + + // associate the correct image with this type of node + if (nType == XmlNodeType.Document) + imageIndex = 0; + else if (nType == XmlNodeType.Attribute) + imageIndex = 1; + else if (nType == XmlNodeType.CDATA) + imageIndex = 2; + else if (nType == XmlNodeType.Comment) + imageIndex = 3; + else if (nType == XmlNodeType.DocumentType) + imageIndex = 4; + else if (nType == XmlNodeType.Element) + imageIndex = 5; + else if (nType == XmlNodeType.Entity) + imageIndex = 6; + else if (nType == XmlNodeType.DocumentFragment) + imageIndex = 7; + else if (nType == XmlNodeType.ProcessingInstruction) + imageIndex = 8; + else if (nType == XmlNodeType.EntityReference) + imageIndex = 9; + else if (nType == XmlNodeType.Text) + imageIndex = 10; + else if (nType == XmlNodeType.XmlDeclaration) + imageIndex = 11; + + // TBD: Not sure what when the rest of these come up yet? + // I will reserve a spot in case they become significant + else if (nType == XmlNodeType.EndElement) + imageIndex = 12; + else if (nType == XmlNodeType.EndEntity) + imageIndex = 12; + else if (nType == XmlNodeType.None) + imageIndex = 12; + else if (nType == XmlNodeType.Notation) + imageIndex = 12; + else if (nType == XmlNodeType.SignificantWhitespace) + imageIndex = 12; + else if (nType == XmlNodeType.Whitespace) + imageIndex = 12; + else { + Debug.Assert(false); + imageIndex = 12; + } + + return imageIndex; + } + + /// + /// Allow the user prefernces to affect how we format the label for the tree node. + /// + /// The node to format + /// formatted string according to user preferences + + private string + FormatLabel(XmlNode node) + { + string labelStr; + + if (m_rbNodeNameOnly.Checked) + labelStr = node.Name; + else if (m_rbNodeAndText.Checked) { + if ((node.NodeType == XmlNodeType.Element) || (node.NodeType == XmlNodeType.Attribute)) + labelStr = string.Format("{0} ({1})", node.Name, GetTextLabelValue(node)); + else + labelStr = string.Format("{0} ({1})", node.Name, node.Value); + } + else { + Debug.Assert(false, "Unknown radio button!"); // Someone must have added a button we don't know about! + labelStr = string.Empty; + } + + return labelStr; + } + + /// + /// Retrieve the text value for a given node + /// + /// Node to look at + /// Text value of the node (the XmlText Child Node of the one passed in) + + private string + GetTextLabelValue(XmlNode node) + { + XmlNode txtNode = node.FirstChild; + if ((txtNode != null) && (txtNode.NodeType == XmlNodeType.Text)) { + return txtNode.Value; + } + else { + return string.Empty; + } + } + + /// + /// Display the data values associated with a selected node in the tree. + /// + /// Currently selected node + + private void + Display(XmlNode node) + { + SetButtonModes(node); + + m_snoopCollector.Collect(node); + Snoop.Utils.Display(m_lvData, m_snoopCollector); + } + + /// + /// Do a preview check to see which navigation buttons are going to work. Disable + /// the ones that will not. + /// + /// Currently selected node + + private void + SetButtonModes(XmlNode node) + { + XmlNode tmpNode; + + tmpNode = node.ParentNode; + m_bnParent.Enabled = (tmpNode != null); + + tmpNode = node.OwnerDocument; + m_bnOwnerDoc.Enabled = (tmpNode != null); + + tmpNode = node.PreviousSibling; + m_bnPrevSibling.Enabled = (tmpNode != null); + + tmpNode = node.NextSibling; + m_bnNextSibling.Enabled = (tmpNode != null); + + tmpNode = node.FirstChild; + m_bnFirstChild.Enabled = (tmpNode != null); + + tmpNode = node.LastChild; + m_bnLastChild.Enabled = (tmpNode != null); + } + + /// + /// The user selected a UI TreeNode. Update the Display based on the new selection + /// + /// + /// + + private void + TreeNodeSelected(object sender, System.Windows.Forms.TreeViewEventArgs e) + { + XmlNode curNode = (XmlNode)e.Node.Tag; + Display(curNode); + } + + // UI Callbacks when buttons in the Form are pressed + + private void + OnBnParent(object sender, System.EventArgs e) + { + XmlNode curNode = (XmlNode)m_tvDom.SelectedNode.Tag; + MoveToNewNodeInTree(curNode.ParentNode); + } + + private void + OnBnOwnerDoc(object sender, System.EventArgs e) + { + XmlNode curNode = (XmlNode)m_tvDom.SelectedNode.Tag; + MoveToNewNodeInTree(curNode.OwnerDocument); + } + + private void + OnBnPrevSibling(object sender, System.EventArgs e) + { + XmlNode curNode = (XmlNode)m_tvDom.SelectedNode.Tag; + MoveToNewNodeInTree(curNode.PreviousSibling); + } + + private void + OnBnNextSibling(object sender, System.EventArgs e) + { + XmlNode curNode = (XmlNode)m_tvDom.SelectedNode.Tag; + MoveToNewNodeInTree(curNode.NextSibling); + } + + private void + OnBnFirstChild(object sender, System.EventArgs e) + { + XmlNode curNode = (XmlNode)m_tvDom.SelectedNode.Tag; + MoveToNewNodeInTree(curNode.FirstChild); + } + + private void + OnBnLastChild(object sender, System.EventArgs e) + { + XmlNode curNode = (XmlNode)m_tvDom.SelectedNode.Tag; + MoveToNewNodeInTree(curNode.LastChild); + } + + private void + OnBnDocElement(object sender, System.EventArgs e) + { + XmlElement elem = m_xmlDoc.DocumentElement; + MoveToNewNodeInTree(elem); + } + + /// + /// Based on a user-specified XPath expression, try to find a matching + /// node. If found, change the background of the label to a different + /// color and make that item the current selection in the UI Tree. + /// + /// + /// + + private void + OnBnSelectSingleNode(object sender, System.EventArgs e) + { + XmlNode curNode = (XmlNode)m_tvDom.SelectedNode.Tag; + + try { + XmlNode newNode = curNode.SelectSingleNode(m_ebXpathPattern.Text); + + if (newNode != null) { + m_tvDom.BeginUpdate(); + + SetSelectedNode(m_tvDom.Nodes, newNode); + MoveToNewNodeInTree(newNode); + + m_tvDom.EndUpdate(); + } + else { + MessageBox.Show("No node matches the pattern.", "XPath Search", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + } + catch (System.Xml.XPath.XPathException ex) { + MessageBox.Show(ex.Message, "XPath Exception", MessageBoxButtons.OK, MessageBoxIcon.Stop); + } + } + + /// + /// Based on a user-specified XPath expression, try to find any matching + /// nodes. If found, change the background of the labels to a different + /// color and make the first item the current selection in the UI Tree. + /// + /// + /// + + private void + OnBnSelectNodes(object sender, System.EventArgs e) + { + XmlNode curNode = (XmlNode)m_tvDom.SelectedNode.Tag; + + try { + XmlNodeList selNodes = curNode.SelectNodes(m_ebXpathPattern.Text); + if ((selNodes != null) && (selNodes.Count > 0)) { + m_tvDom.BeginUpdate(); + + SetSelectedNodes(m_tvDom.Nodes, selNodes); + MoveToNewNodeInTree(selNodes[0]); + + m_tvDom.EndUpdate(); + } + else { + MessageBox.Show("No nodes match the pattern.", "XPath Search", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + catch (System.Xml.XPath.XPathException ex) { + MessageBox.Show(ex.Message, "XPath Exception", MessageBoxButtons.OK, MessageBoxIcon.Stop); + } + } + + private void + OnBnClear(object sender, System.EventArgs e) + { + m_ebXpathPattern.Text = string.Empty; + ClearSelectedNodes(m_tvDom.Nodes); + } + + private void + OnRbChanged_LabelDisplay(object sender, System.EventArgs e) + { + LoadTree(); // reload the tree with our new display preference set + } + + private void + OnCbChanged_NodeDisplay(object sender, System.EventArgs e) + { + LoadTree(); // reload the tree with our new display preference set + } + + private void + DataItemSelected(object sender, System.EventArgs e) + { + Snoop.Utils.DataItemSelected(m_lvData); + } + + /// + /// One of the navigation buttons ("Parent", "First Child", etc) was picked. Based on the + /// XmlNode that those functions returned, find the corresponding UI TreeNode and make it + /// the currently selected one. + /// + /// The XmlNode that should now be selected + + private void + MoveToNewNodeInTree(XmlNode newXmlNode) + { + Debug.Assert(newXmlNode != null); // we should have checked out OK in SetButtonModes() + + TreeNode newTreeNode = FindTreeNodeFromXmlNodeTag(m_tvDom.Nodes, newXmlNode); + if (newTreeNode != null) { + m_tvDom.SelectedNode = newTreeNode; + } + else { + MessageBox.Show("The node exist in the XML DOM, but not in the UI tree.\nPerhaps you have Text or Comment nodes turned off?", + "MgdDbg", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + + /// + /// Sometimes we have the Xml DOM node and we need to find where that is in our + /// UI tree. This function will brute-force search the UI tree looking for a + /// TreeNode.Tag that matches the XmlNode we are searching for. Note: this function + /// is recursive. + /// + /// The current collection of nodes to look through + /// The XmlNode we are searching for. + /// The found TreeNode or null, if not found + + private TreeNode + FindTreeNodeFromXmlNodeTag(TreeNodeCollection treeNodes, XmlNode xmlNode) + { + XmlNode tmpXmlNode = null; + + // walk the list of tree nodes looking for a match in the attached + // Tag object. + foreach (TreeNode tNode in treeNodes) { + tmpXmlNode = (XmlNode)tNode.Tag; + if (tmpXmlNode == xmlNode) + return tNode; // found it + + // Didn't find it, but this node may have children, so recursively + // look for it here. + if (tNode.Nodes.Count > 0) { + // if we find it on the recursive call, pop back out, + // otherwise continue searching at this level + TreeNode recursiveNode = null; + recursiveNode = FindTreeNodeFromXmlNodeTag(tNode.Nodes, xmlNode); + if (recursiveNode != null) + return recursiveNode; + } + } + + return null; + } + + /// + /// When nodes are selected by XPath expressions, we highlighted them by changing + /// the background color. Go through and reset them to normal. This function handles + /// one level of the tree at a time and then goes recursive. + /// + /// The "root" of this protion of the tree + + private void + ClearSelectedNodes(TreeNodeCollection treeNodes) + { + foreach (TreeNode tNode in treeNodes) { + tNode.BackColor = System.Drawing.Color.Empty; + if (tNode.Nodes.Count > 0) { + ClearSelectedNodes(tNode.Nodes); + } + } + } + + /// + /// Change the background color of the matching node + /// + /// The "root" of this section of the tree + /// The XmlNode we are trying to find + + private void + SetSelectedNode(TreeNodeCollection treeNodes, XmlNode selNode) + { + foreach (TreeNode tNode in treeNodes) { + if (selNode == (XmlNode)tNode.Tag) + tNode.BackColor = System.Drawing.Color.LightSkyBlue; + else + tNode.BackColor = System.Drawing.Color.Empty; + + if (tNode.Nodes.Count > 0) { + SetSelectedNode(tNode.Nodes, selNode); + } + } + } + + /// + /// Same as SetSelectedNode(), but with a set of matches. + /// NOTE: You cannot manually add to an XmlNodeList, so I couldn't + /// have the above function call this one. + /// + /// + /// + + private void + SetSelectedNodes(TreeNodeCollection treeNodes, XmlNodeList selNodes) + { + foreach (TreeNode tNode in treeNodes) { + if (NodeListContains(selNodes, (XmlNode)tNode.Tag)) + tNode.BackColor = System.Drawing.Color.LightSkyBlue; + else + tNode.BackColor = System.Drawing.Color.Empty; + + if (tNode.Nodes.Count > 0) { + SetSelectedNodes(tNode.Nodes, selNodes); + } + } + } + + /// + /// Is a given node part of the nodeSet? + /// + /// Set of nodes to search + /// Node we are searching for + /// true if found, false if not + + private bool + NodeListContains(XmlNodeList nodeSet, XmlNode findNode) + { + foreach (XmlNode tmpNode in nodeSet) { + if (tmpNode == findNode) + return true; + } + + return false; + } + + + } +} diff --git a/MgdDbgLibrary/Xml/Forms/Dom.resx b/MgdDbgLibrary/Xml/Forms/Dom.resx new file mode 100644 index 0000000..7bc88c9 --- /dev/null +++ b/MgdDbgLibrary/Xml/Forms/Dom.resx @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuMzMw + MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZT + eXN0ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMA + AACgDAAAAk1TRnQBSQFMAgEBDQEAAQ4BAAEEAQABEAEAARABAAT/AQkBEAj/AUIBTQE2AQQGAAE2AQQC + AAEoAwABQAMAAUADAAEBAQABCAYAARAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB + 3AHAAQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IB + AAM5AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8B + MwMAAWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYC + AAFmAZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMC + AAHMAWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQAB + ZgEAATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8B + AAEzAWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQAB + MwGZAWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQAB + MwLMAQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQAB + MwEAAWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMB + mQEAAWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQAB + ZgGZAWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYB + zAH/AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMB + mQEAAZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgAB + mQFmATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwB + AAKZAf8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB + /wEzAQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQAB + mQEAAcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYC + AAHMAWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYB + AAHMApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8C + AAHMAf8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQAB + mQEAAcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMB + AAHMAmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB + /wGZAcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC + /wEzAQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC + /wFmAQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gB + AAHwAfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/wEAEP8wABD/MAAM + /QT/MAAN/QP/MAAG/QEAB/0C/zAAD/0B/zAABv0BAAn9MAAG/QIACP0wAAj9AQAH/TAABP0BAAP9AQAG + /QH/MAAF/QMABv0C/zAADf0D/zAADP0E/zAAEP8wABD/MAAQ/zAAgP8NBAP/DfkD/wwFBP8M+wT/DgQC + /w75Av8NBQP/DfsD/w8EAf8P+QH/DgUC/w77Av8CBAH/AQQB/wIEAf8BBAP/BAQD+QEAAvkBAAH5AwAB + +QEAA/kDBQH/AgUB/wEFAf8CBQH/AwUB/wL7AgAD+wIAAfsDAAL7Af8CBAH/AQQB/wIEAf8EBAH/AwQD + +QEAAvkBAAH5AQAD+QEAA/kDBQH/AgUB/wEFAf8CBQH/BAUC+wEAAfsBAAH7AQAD+wEABfsCBAH/AQQB + /wEEAv8CBAL/BAQD+QMAAvkCAAL5AgAC+QMFAf8DBQH/AwUB/wQFAvsBAAH7AQAB+wEAA/sBAAX7AgQB + /wEEAv8BBAH/AQQB/wYEA/kBAAL5AQAB+QEAA/kBAAP5AwUB/wIFAf8BBQH/AgUB/wQFAvsBAAH7AQAB + +wEAA/sBAAX7AgQB/wEEAf8CBAH/AgQD/wMEA/kDAAL5AwAB+QMAAfkCBQP/AQUB/wEFAf8BBQP/AgUB + /wL7AgAD+wIAAfsBAAT7Af8PBAH/D/kB/w4FAv8O+wL/DgQC/w75Av8NBQP/DfsD/w0EA/8N+QP/DAUE + /wz7//9F/w36E/8MBwT/DQMD/w76Av8MAgT/DQcD/w4DAv8P+gH/DQID/w4HAv8PAwH/A/oBAAP6AQAC + +gEABfoOAgL/AgcDAAEHAQACBwEAAgcBAAIHAf8BAwEAAwMBAAIDAQACAwMAAgMD+gEAA/oBAAL6AQAF + +gECA/8BAgP/AQIB/wMCAf8BAgH/AgcBAAMHAQACBwEAAgcBAAMHAQMBAAMDAQACAwEAAQMBAAIDAQAC + AwP6AQAD+gEAAvoDAAP6AQIB/wMCAf8DAgH/AwIB/wICAgcCAAIHAQABBwIAAgcBAAMHAQMCAAIDAwAC + AwEAAQMCAAIDA/oBAAL6AQAB+gEAAfoBAAL6AQAC+gECAv8CAgH/AwIB/wECAf8BAgH/AgICBwEAAwcC + AAEHAQACBwEAAwcBAwEAAwMBAAIDAQABAwEABQMC+gMAAfoBAAH6AQAB+gMAA/oBAgH/AwIB/wMCAv8B + AgL/AgICBwMAAQcBAAIHAQABBwMAAQcB/wEDAwABAwMAAwMDAAIDD/oB/wECA/8BAgH/AwIB/wMCAf8B + AgH/DgcC/w8DAf8O+gL/DgIC/w0HA/8OAwL/DfoD/w0CA/8MBwT/DQMT/wwC//8l/wwGBP8MAAT/DP4E + /wz8BP8NBgP/DQAD/w3+A/8N/AP/DgYC/w4AAv8O/gL/DvwC/wEGA/8DBgL/AwYC/wEGAf8CAAH/AgAB + /wIAAf8DAAH/AgAB/wT+AgAC/gMABP4B/wP8Av8C/AH/A/wB/wP8Af8BBgH/AgYB/wEGAf8CBgH/AQYB + /wIGAf8BBgIABP8CAAH/AwAB/wMAA/4BAAL+AQAB/gEAAv4BAAT+AvwB/wL8Af8B/AH/A/wB/wT8AQYB + /wIGAf8BBgH/AgYB/wEGAf8EBgIAAf8CAAH/AgAB/wMAAf8DAAP+AQAE/gEAAv4BAAT+AvwB/wT8Af8B + /AH/AfwB/wT8AQYB/wIGAf8BBgH/AgYB/wEGAf8CBgH/AQYDAAL/AwAB/wMAAf8DAAP+AQAC/gEAAf4B + AAL+AQAE/gL8Af8C/AH/AfwC/wH8Av8E/AEGA/8DBgL/AwYC/wIGAwAC/wIAA/8BAAP/AQAB/wT+AgAC + /gMABP4B/wP8Av8C/AH/A/wB/wP8Af8PBgH/DgAC/w7+Av8O/AL/DgYC/w0AA/8N/gP/DfwD/w0GA/8M + AAT/DP4E/wz8BP8MBrT/AUIBTQE+BwABPgMAASgDAAFAAwABQAMAAQEBAAEBBgABAhYAA///AP8AGQAL + + + + Dom + + \ No newline at end of file diff --git a/MgdDbgLibrary/res/COPY.ico b/MgdDbgLibrary/res/COPY.ico new file mode 100644 index 0000000..12fe587 Binary files /dev/null and b/MgdDbgLibrary/res/COPY.ico differ diff --git a/MgdDbgLibrary/res/ImageTreeCategory.bmp b/MgdDbgLibrary/res/ImageTreeCategory.bmp new file mode 100644 index 0000000..7ecac7e Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeCategory.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeClass.bmp b/MgdDbgLibrary/res/ImageTreeClass.bmp new file mode 100644 index 0000000..ec8a965 Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeClass.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeTest.bmp b/MgdDbgLibrary/res/ImageTreeTest.bmp new file mode 100644 index 0000000..1096323 Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeTest.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlAttribute.bmp b/MgdDbgLibrary/res/ImageTreeXmlAttribute.bmp new file mode 100644 index 0000000..e371f57 Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlAttribute.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlCdata.bmp b/MgdDbgLibrary/res/ImageTreeXmlCdata.bmp new file mode 100644 index 0000000..9e36e23 Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlCdata.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlComment.bmp b/MgdDbgLibrary/res/ImageTreeXmlComment.bmp new file mode 100644 index 0000000..d4c0849 Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlComment.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlDeclaration.bmp b/MgdDbgLibrary/res/ImageTreeXmlDeclaration.bmp new file mode 100644 index 0000000..d282238 Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlDeclaration.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlDoc.bmp b/MgdDbgLibrary/res/ImageTreeXmlDoc.bmp new file mode 100644 index 0000000..35f8fa1 Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlDoc.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlDocType.bmp b/MgdDbgLibrary/res/ImageTreeXmlDocType.bmp new file mode 100644 index 0000000..d5829b5 Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlDocType.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlElement.bmp b/MgdDbgLibrary/res/ImageTreeXmlElement.bmp new file mode 100644 index 0000000..7b3c227 Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlElement.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlEntity.bmp b/MgdDbgLibrary/res/ImageTreeXmlEntity.bmp new file mode 100644 index 0000000..ed406eb Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlEntity.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlFragment.bmp b/MgdDbgLibrary/res/ImageTreeXmlFragment.bmp new file mode 100644 index 0000000..fdc469d Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlFragment.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlProcInstr.bmp b/MgdDbgLibrary/res/ImageTreeXmlProcInstr.bmp new file mode 100644 index 0000000..ff60d83 Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlProcInstr.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlReference.bmp b/MgdDbgLibrary/res/ImageTreeXmlReference.bmp new file mode 100644 index 0000000..4a3b60a Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlReference.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlText.bmp b/MgdDbgLibrary/res/ImageTreeXmlText.bmp new file mode 100644 index 0000000..e476993 Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlText.bmp differ diff --git a/MgdDbgLibrary/res/ImageTreeXmlUnknown.bmp b/MgdDbgLibrary/res/ImageTreeXmlUnknown.bmp new file mode 100644 index 0000000..909aa8a Binary files /dev/null and b/MgdDbgLibrary/res/ImageTreeXmlUnknown.bmp differ diff --git a/MgdDbgLibrary/res/Preview.ico b/MgdDbgLibrary/res/Preview.ico new file mode 100644 index 0000000..8279234 Binary files /dev/null and b/MgdDbgLibrary/res/Preview.ico differ diff --git a/MgdDbgLibrary/res/Print.ico b/MgdDbgLibrary/res/Print.ico new file mode 100644 index 0000000..c7ca555 Binary files /dev/null and b/MgdDbgLibrary/res/Print.ico differ diff --git a/PackageContents.xml b/PackageContents.xml deleted file mode 100644 index 79ececb..0000000 --- a/PackageContents.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/PythonConsoleControl/PythonConsoleCompletionDataProvider.cs b/PythonConsoleControl/PythonConsoleCompletionDataProvider.cs index c9c2afe..f107d46 100644 --- a/PythonConsoleControl/PythonConsoleCompletionDataProvider.cs +++ b/PythonConsoleControl/PythonConsoleCompletionDataProvider.cs @@ -21,6 +21,7 @@ public class PythonConsoleCompletionDataProvider internal volatile bool AutocompletionInProgress = false; private bool excludeCallables; + public bool ExcludeCallables { get { return excludeCallables; } set { excludeCallables = value; } } @@ -63,7 +64,7 @@ public ICompletionData[] GenerateCompletionData(string line) string dirCommand = "dir(" + name + ")"; object value = commandLine.ScriptScope.Engine.CreateScriptSourceFromString(dirCommand, SourceCodeKind.Expression).Execute(commandLine.ScriptScope); AutocompletionInProgress = false; - foreach (object member in (value as IronPython.Runtime.List)) + foreach (object member in (value as IronPython.Runtime.PythonList)) { items.Add(new PythonCompletionData((string)member, name, commandLine, false)); } diff --git a/PythonConsoleControl/PythonConsoleControl.csproj b/PythonConsoleControl/PythonConsoleControl.csproj index 17ce1c4..e680bc3 100644 --- a/PythonConsoleControl/PythonConsoleControl.csproj +++ b/PythonConsoleControl/PythonConsoleControl.csproj @@ -50,6 +50,10 @@ SettingsSingleFileGenerator + + + + Project diff --git a/README.md b/README.md index 58a4fcb..e9885b1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # CADPythonShell -![Autocad API](https://img.shields.io/badge/Autocad%20API%202023-blue.svg) ![Platform](https://img.shields.io/badge/platform-Windows-lightgray.svg) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +![Autocad API](https://img.shields.io/badge/Autocad%20API%202024-blue.svg) ![Platform](https://img.shields.io/badge/platform-Windows-lightgray.svg) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![ReSharper](https://img.shields.io/badge/ReSharper-2021.3.3-yellow) ![Rider](https://img.shields.io/badge/Rider-2021.3.3-yellow) ![Visual Studio 2022](https://img.shields.io/badge/Visual_Studio_2022_Preview_2.0-17.1.0-yellow) ![.NET Framework](https://img.shields.io/badge/.NET_6.0-yellow) @@ -10,6 +10,19 @@ follow on Twitter +![](Images/CadPythonShell.png) + +## 💖 Support This Project + +If you like this project and want to support its development, please consider making a donation. Your contributions will help us continue to improve and maintain the project. + +

+ + Donate with Stripe + +

+ + ## Introduction This is obviously a fork of [RevitPythonShell](https://github.com/architecture-building-systems/revitpythonshell), bringing an IronPython interpreter to Autodesk Autocad, @@ -21,6 +34,14 @@ The biggest limitation is that you can't deploy DLLs with custom scripts at this ![](Images/Ribbon.png) +## IronPython 3 + +IronPython 3.4 uses Python 3.4 syntax and standard libraries and so your Python code will need to be updated accordingly. There are numerous tools and guides available on the web to help porting from Python 2 to 3. + +IronPython 3 targets Python 3, including the re-organized standard library, Unicode strings, and all of the other new features.with user upgrade from **IronPython 2** to **IronPython 3**, please follow [Upgrade from IronPython 2 to IronPython 3](https://github.com/IronLanguages/ironpython3/blob/master/Documentation/upgrading-from-ipy2.md). + +Various differences between IronPython and CPython can follow at [Differences IronPython and CPython](https://github.com/IronLanguages/ironpython3/blob/master/Documentation/differences-from-c-python.md). + ## Features - Interactive IronPython interpreter for exploring the API @@ -42,50 +63,23 @@ The biggest limitation is that you can't deploy DLLs with custom scripts at this Note : Support for 5 last version(2019-2023) Autocad or Civil 3D. Older versions can be used but will not guarantee the expected performance. -## Basic Usage +## Basic Usage CadPythonShell - PythonConsole - Open Python Console -![](Images/PythonShellConsole.png) +![](Images/cadpythonshell3.png) - PythonShellSetting - Open Setting Config Console -![](Images/ConfigPythonShell.png) - -- Snoop - Quick Snoop Object Sample In CAD or Civil3D - -![](Images/Snoop.png) - -- SnoopDB - Snoop Database In CAD or Civil3D - -![](Images/SnoopDB.png) - -- SnoopEd - Snoop Editor In CAD or Civil3D - -![](Images/SnoopEditor.png) - -- SnoopEnts - Snoop Entities In CAD or Civil3D - -![](Images/SnoopEntities.png) - -- SnoopNEnts - Snoop Entities Nested In CAD or Civil3D - -- SnoopByHandle - Snoop By Handle In CAD or Civil3D - -![](Images/SnoopByHandle.png) - -- SnoopEvents - Snoop Follow Events In CAD or Civil3D - -![](Images/SnoopEvents.png) +![](Images/configure.png) -#### Use Snoop In Python Shell Console +Use Snoop In Python Shell In Python Script : +- Snoop - Quick Snoop Object Sample In CAD or Civil3D - sn.Snoop(obj) - Snoop Object by Python Console In CAD or Civil3D - snoop(obj) - Snoop Object by Python Console or Execute python code In CAD or Civil3D -![](Images/pythoncmd.png) - -#### Write Console Sample +Write Console Sample In Console : ``` py ed = doc.Editor @@ -93,14 +87,10 @@ ed.WriteMessage("Hello") ``` ![](Images/console.gif) -- Try create script get Object +Create Script Execute `ShowAlertDialog` Demo : ```py import clr -import sys -sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib') -import os -import math clr.AddReference('acmgd') clr.AddReference('acdbmgd') clr.AddReference('accoremgd') @@ -110,22 +100,47 @@ from Autodesk.AutoCAD.ApplicationServices import * from Autodesk.AutoCAD.EditorInput import * from Autodesk.AutoCAD.DatabaseServices import * from Autodesk.AutoCAD.Geometry import * -adoc = Application.DocumentManager.MdiActiveDocument -ed = adoc.Editor -with adoc.LockDocument(): - with adoc.Database as db: - with db.TransactionManager.StartTransaction() as t: - bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite) - btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) - for objectid in btr: - obj1 = t.GetObject(objectid, OpenMode.ForRead) - print(obj1) -ed.WriteMessage("Done") +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +# Write Code Below +Application.ShowAlertDialog("Hello World!") ``` + +![](Images/AlertDialogDemo.png) + +Create Script Execute `ShowAlertDialog` Demo : + ![](Images/getobject.png) Note : you can see more example in folder [Script Examples](https://github.com/chuongmep/CadPythonShell/tree/dev/Script%20Examples) +## Basic Usage Snoop + +![](Images/Snoop.png) + +- SnoopDB - Snoop Database In CAD or Civil3D + +![](Images/SnoopDB.png) + +- SnoopEd - Snoop Editor In CAD or Civil3D + +![](Images/SnoopEditor.png) + +- SnoopEnts - Snoop Entities In CAD or Civil3D + +![](Images/SnoopEntities.png) + +- SnoopNEnts - Snoop Entities Nested In CAD or Civil3D + +- SnoopByHandle - Snoop By Handle In CAD or Civil3D + +![](Images/SnoopByHandle.png) + +- SnoopEvents - Snoop Follow Events In CAD or Civil3D + +![](Images/SnoopEvents.png) + ## Contribute - Don't hesitate to file any issues you stumble uppon. (Tho I don't guarantee I'll be able to solve them all for you) @@ -155,7 +170,7 @@ Thanks for providing a free All product IDE for this project. ## Credits * Daren Thomas (original RPS Developer) [RPS](https://github.com/architecture-building-systems/revitpythonshell) - * Joe Moorhouse (interactive shell was taken from his project [IronLab](http://ironlab.net/)) + * Joe Moorhouse (interactive shell was taken from his project [IronLab](https://code.google.com/archive/p/ironlab/) * [Dimitar Venkov](https://github.com/dimven/NavisPythonShell) (original port to Navisworks) * [ChuongMep](https://github.com/chuongmep) (original port to Autocad) * The rest of the RPS contributors diff --git a/RefrencedAssemblies/AdWindows.dll b/RefrencedAssemblies/AdWindows.dll deleted file mode 100644 index 494ab99..0000000 Binary files a/RefrencedAssemblies/AdWindows.dll and /dev/null differ diff --git a/RefrencedAssemblies/ICSharpCode.AvalonEdit.dll b/RefrencedAssemblies/ICSharpCode.AvalonEdit.dll deleted file mode 100644 index 69ed201..0000000 Binary files a/RefrencedAssemblies/ICSharpCode.AvalonEdit.dll and /dev/null differ diff --git a/RefrencedAssemblies/IronPython.Modules.dll b/RefrencedAssemblies/IronPython.Modules.dll deleted file mode 100644 index f9ae5c2..0000000 Binary files a/RefrencedAssemblies/IronPython.Modules.dll and /dev/null differ diff --git a/RefrencedAssemblies/IronPython.SQLite.dll b/RefrencedAssemblies/IronPython.SQLite.dll deleted file mode 100644 index 3b46157..0000000 Binary files a/RefrencedAssemblies/IronPython.SQLite.dll and /dev/null differ diff --git a/RefrencedAssemblies/IronPython.Wpf.dll b/RefrencedAssemblies/IronPython.Wpf.dll deleted file mode 100644 index 8399ec3..0000000 Binary files a/RefrencedAssemblies/IronPython.Wpf.dll and /dev/null differ diff --git a/RefrencedAssemblies/IronPython.dll b/RefrencedAssemblies/IronPython.dll deleted file mode 100644 index 3a7e463..0000000 Binary files a/RefrencedAssemblies/IronPython.dll and /dev/null differ diff --git a/RefrencedAssemblies/Microsoft.Dynamic.dll b/RefrencedAssemblies/Microsoft.Dynamic.dll deleted file mode 100644 index 0d7e6a7..0000000 Binary files a/RefrencedAssemblies/Microsoft.Dynamic.dll and /dev/null differ diff --git a/RefrencedAssemblies/Microsoft.Scripting.Metadata.dll b/RefrencedAssemblies/Microsoft.Scripting.Metadata.dll deleted file mode 100644 index c3cda22..0000000 Binary files a/RefrencedAssemblies/Microsoft.Scripting.Metadata.dll and /dev/null differ diff --git a/RefrencedAssemblies/Microsoft.Scripting.dll b/RefrencedAssemblies/Microsoft.Scripting.dll deleted file mode 100644 index 3f0771a..0000000 Binary files a/RefrencedAssemblies/Microsoft.Scripting.dll and /dev/null differ diff --git a/RefrencedAssemblies/System.Windows.Controls.WpfPropertyGrid.dll b/RefrencedAssemblies/System.Windows.Controls.WpfPropertyGrid.dll deleted file mode 100644 index 8d9f2d1..0000000 Binary files a/RefrencedAssemblies/System.Windows.Controls.WpfPropertyGrid.dll and /dev/null differ diff --git a/RefrencedAssemblies/WPG.dll b/RefrencedAssemblies/WPG.dll deleted file mode 100644 index ea4623a..0000000 Binary files a/RefrencedAssemblies/WPG.dll and /dev/null differ diff --git a/RefrencedAssemblies/accoremgd.dll b/RefrencedAssemblies/accoremgd.dll deleted file mode 100644 index a78bddb..0000000 Binary files a/RefrencedAssemblies/accoremgd.dll and /dev/null differ diff --git a/RefrencedAssemblies/acdbmgd.dll b/RefrencedAssemblies/acdbmgd.dll deleted file mode 100644 index ffab00f..0000000 Binary files a/RefrencedAssemblies/acdbmgd.dll and /dev/null differ diff --git a/RequiredLibraries/ICSharpCode.AvalonEdit.dll b/RequiredLibraries/ICSharpCode.AvalonEdit.dll deleted file mode 100644 index 69ed201..0000000 Binary files a/RequiredLibraries/ICSharpCode.AvalonEdit.dll and /dev/null differ diff --git a/RequiredLibraries/IronPython.Modules.dll b/RequiredLibraries/IronPython.Modules.dll deleted file mode 100644 index f9ae5c2..0000000 Binary files a/RequiredLibraries/IronPython.Modules.dll and /dev/null differ diff --git a/RequiredLibraries/IronPython.SQLite.dll b/RequiredLibraries/IronPython.SQLite.dll deleted file mode 100644 index 3b46157..0000000 Binary files a/RequiredLibraries/IronPython.SQLite.dll and /dev/null differ diff --git a/RequiredLibraries/IronPython.Wpf.dll b/RequiredLibraries/IronPython.Wpf.dll deleted file mode 100644 index 8399ec3..0000000 Binary files a/RequiredLibraries/IronPython.Wpf.dll and /dev/null differ diff --git a/RequiredLibraries/IronPython.dll b/RequiredLibraries/IronPython.dll deleted file mode 100644 index 3a7e463..0000000 Binary files a/RequiredLibraries/IronPython.dll and /dev/null differ diff --git a/RequiredLibraries/Microsoft.CSharp.dll b/RequiredLibraries/Microsoft.CSharp.dll deleted file mode 100644 index f11e2a9..0000000 Binary files a/RequiredLibraries/Microsoft.CSharp.dll and /dev/null differ diff --git a/RequiredLibraries/Microsoft.Dynamic.dll b/RequiredLibraries/Microsoft.Dynamic.dll deleted file mode 100644 index 0d7e6a7..0000000 Binary files a/RequiredLibraries/Microsoft.Dynamic.dll and /dev/null differ diff --git a/RequiredLibraries/Microsoft.Scripting.AspNet.dll b/RequiredLibraries/Microsoft.Scripting.AspNet.dll deleted file mode 100644 index ecbec45..0000000 Binary files a/RequiredLibraries/Microsoft.Scripting.AspNet.dll and /dev/null differ diff --git a/RequiredLibraries/Microsoft.Scripting.Metadata.dll b/RequiredLibraries/Microsoft.Scripting.Metadata.dll deleted file mode 100644 index c3cda22..0000000 Binary files a/RequiredLibraries/Microsoft.Scripting.Metadata.dll and /dev/null differ diff --git a/RequiredLibraries/Microsoft.Scripting.dll b/RequiredLibraries/Microsoft.Scripting.dll deleted file mode 100644 index 3f0771a..0000000 Binary files a/RequiredLibraries/Microsoft.Scripting.dll and /dev/null differ diff --git a/RequiredLibraries/System.Windows.Controls.WpfPropertyGrid.dll b/RequiredLibraries/System.Windows.Controls.WpfPropertyGrid.dll deleted file mode 100644 index 8d9f2d1..0000000 Binary files a/RequiredLibraries/System.Windows.Controls.WpfPropertyGrid.dll and /dev/null differ diff --git a/RequiredLibraries/WPG.dll b/RequiredLibraries/WPG.dll deleted file mode 100644 index ea4623a..0000000 Binary files a/RequiredLibraries/WPG.dll and /dev/null differ diff --git a/Script Examples/countBlock.py b/Script Examples/ironpython2.7/countBlock.py similarity index 100% rename from Script Examples/countBlock.py rename to Script Examples/ironpython2.7/countBlock.py diff --git a/Script Examples/createARC.py b/Script Examples/ironpython2.7/createARC.py similarity index 100% rename from Script Examples/createARC.py rename to Script Examples/ironpython2.7/createARC.py diff --git a/Script Examples/createBox3D.py b/Script Examples/ironpython2.7/createBox3D.py similarity index 91% rename from Script Examples/createBox3D.py rename to Script Examples/ironpython2.7/createBox3D.py index 3af57ec..dd7e53f 100644 --- a/Script Examples/createBox3D.py +++ b/Script Examples/ironpython2.7/createBox3D.py @@ -1,10 +1,6 @@ #Copyright(c) 2021 Hồ Văn Chương # @chuongmep https://chuongmep.com/ import clr -import sys -sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib') -import os -import math clr.AddReference('acmgd') clr.AddReference('acdbmgd') clr.AddReference('accoremgd') diff --git a/Script Examples/createCircleByCenterRadius.py b/Script Examples/ironpython2.7/createCircleByCenterRadius.py similarity index 100% rename from Script Examples/createCircleByCenterRadius.py rename to Script Examples/ironpython2.7/createCircleByCenterRadius.py diff --git a/Script Examples/createCircleByPickPointEnterRadius.py b/Script Examples/ironpython2.7/createCircleByPickPointEnterRadius.py similarity index 92% rename from Script Examples/createCircleByPickPointEnterRadius.py rename to Script Examples/ironpython2.7/createCircleByPickPointEnterRadius.py index 3961019..1207d75 100644 --- a/Script Examples/createCircleByPickPointEnterRadius.py +++ b/Script Examples/ironpython2.7/createCircleByPickPointEnterRadius.py @@ -1,10 +1,6 @@ #Copyright(c) 2021, Hồ Văn Chương # @chuongmep, https://chuongmep.com/ import clr -import sys -sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib') -import os -import math clr.AddReference('acmgd') clr.AddReference('acdbmgd') clr.AddReference('accoremgd') diff --git a/Script Examples/createLayerCivil3d.py b/Script Examples/ironpython2.7/createLayerCivil3d.py similarity index 100% rename from Script Examples/createLayerCivil3d.py rename to Script Examples/ironpython2.7/createLayerCivil3d.py diff --git a/Script Examples/createLine.py b/Script Examples/ironpython2.7/createLine.py similarity index 100% rename from Script Examples/createLine.py rename to Script Examples/ironpython2.7/createLine.py diff --git a/Script Examples/createPolyLine.py b/Script Examples/ironpython2.7/createPolyLine.py similarity index 100% rename from Script Examples/createPolyLine.py rename to Script Examples/ironpython2.7/createPolyLine.py diff --git a/Script Examples/deleteObject.py b/Script Examples/ironpython2.7/deleteObject.py similarity index 100% rename from Script Examples/deleteObject.py rename to Script Examples/ironpython2.7/deleteObject.py diff --git a/Script Examples/getObjectIdWithPrompt.py b/Script Examples/ironpython2.7/getObjectIdWithPrompt.py similarity index 100% rename from Script Examples/getObjectIdWithPrompt.py rename to Script Examples/ironpython2.7/getObjectIdWithPrompt.py diff --git a/Script Examples/getcolor.py b/Script Examples/ironpython2.7/getcolor.py similarity index 100% rename from Script Examples/getcolor.py rename to Script Examples/ironpython2.7/getcolor.py diff --git a/Script Examples/getobject.py b/Script Examples/ironpython2.7/getobject.py similarity index 59% rename from Script Examples/getobject.py rename to Script Examples/ironpython2.7/getobject.py index 396b22e..c272744 100644 --- a/Script Examples/getobject.py +++ b/Script Examples/ironpython2.7/getobject.py @@ -16,12 +16,12 @@ ed = adoc.Editor output =[] with adoc.LockDocument(): - with adoc.Database as db: - with db.TransactionManager.StartTransaction() as t: - bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite) - btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) - for objectid in btr: - obj1 = t.GetObject(objectid, OpenMode.ForRead) - output.append(obj1) - print(obj1) + with adoc.Database as db: + with db.TransactionManager.StartTransaction() as t: + bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite) + btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) + for objectid in btr: + obj1 = t.GetObject(objectid, OpenMode.ForRead) + output.append(obj1) + print(obj1) ed.WriteMessage("Done") \ No newline at end of file diff --git a/Script Examples/getselection.py b/Script Examples/ironpython2.7/getselection.py similarity index 100% rename from Script Examples/getselection.py rename to Script Examples/ironpython2.7/getselection.py diff --git a/Script Examples/libCadTransaction.py b/Script Examples/ironpython2.7/libCadTransaction.py similarity index 100% rename from Script Examples/libCadTransaction.py rename to Script Examples/ironpython2.7/libCadTransaction.py diff --git a/Script Examples/libcad.txt b/Script Examples/ironpython2.7/libcad.txt similarity index 100% rename from Script Examples/libcad.txt rename to Script Examples/ironpython2.7/libcad.txt diff --git a/Script Examples/libcivil3dyanmo.py b/Script Examples/ironpython2.7/libcivil3dyanmo.py similarity index 100% rename from Script Examples/libcivil3dyanmo.py rename to Script Examples/ironpython2.7/libcivil3dyanmo.py diff --git a/Script Examples/message.py b/Script Examples/ironpython2.7/message.py similarity index 100% rename from Script Examples/message.py rename to Script Examples/ironpython2.7/message.py diff --git a/Script Examples/sample_base.dwg b/Script Examples/ironpython2.7/sample_base.dwg similarity index 100% rename from Script Examples/sample_base.dwg rename to Script Examples/ironpython2.7/sample_base.dwg diff --git a/Script Examples/selectionpickobject.py b/Script Examples/ironpython2.7/selectionpickobject.py similarity index 100% rename from Script Examples/selectionpickobject.py rename to Script Examples/ironpython2.7/selectionpickobject.py diff --git a/Script Examples/showAlertDialog.py b/Script Examples/ironpython2.7/showAlertDialog.py similarity index 100% rename from Script Examples/showAlertDialog.py rename to Script Examples/ironpython2.7/showAlertDialog.py diff --git a/Script Examples/showdialog.py b/Script Examples/ironpython2.7/showdialog.py similarity index 100% rename from Script Examples/showdialog.py rename to Script Examples/ironpython2.7/showdialog.py diff --git a/Script Examples/zoomtoobject.py b/Script Examples/ironpython2.7/zoomtoobject.py similarity index 86% rename from Script Examples/zoomtoobject.py rename to Script Examples/ironpython2.7/zoomtoobject.py index c747279..95b592b 100644 --- a/Script Examples/zoomtoobject.py +++ b/Script Examples/ironpython2.7/zoomtoobject.py @@ -23,9 +23,9 @@ def ZoomToObj(ed,min,max): max2d = Point2d(max.X, max.Y) view = ViewTableRecord() view.CenterPoint = min2d + ((max2d - min2d) / 2.0) - view.Height = max2d.Y - min2d.Y; - view.Width = max2d.X - min2d.X; - ed.SetCurrentView(view); + view.Height = max2d.Y - min2d.Y + view.Width = max2d.X - min2d.X + ed.SetCurrentView(view) peo = PromptEntityOptions("Select An Entity:") result = ed.GetEntity(peo) if(result.Status==PromptStatus.OK): @@ -33,8 +33,8 @@ def ZoomToObj(ed,min,max): with doc.Database as db: with db.TransactionManager.StartTransaction() as t: ent = t.GetObject(result.ObjectId,OpenMode.ForRead) - ext = ent.GeometricExtents; + ext = ent.GeometricExtents # Do action here - ZoomToObj(ed, ext.MinPoint, ext.MaxPoint); + ZoomToObj(ed, ext.MinPoint, ext.MaxPoint) t.Commit() \ No newline at end of file diff --git a/Script Examples/ironpython3.4/collectPolylinesAndWriteTextInCenter.py b/Script Examples/ironpython3.4/collectPolylinesAndWriteTextInCenter.py new file mode 100644 index 0000000..622edc3 --- /dev/null +++ b/Script Examples/ironpython3.4/collectPolylinesAndWriteTextInCenter.py @@ -0,0 +1,86 @@ +# Many thanks to Chuong Ho for this awesome repository +# Many thanks Cyril-Pop for the starting point in this script. + +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') + +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * + +# Global AutoCAD variables +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database + +# Layer names +polyline_layer_name = "Aux-REVISION" +text_layer_name = "I-WALL" + +def polyline_center(polyline): + """ + Calculates the approximate geometric center of a polyline. + """ + extents = polyline.GeometricExtents + center = Point3d( + (extents.MinPoint.X + extents.MaxPoint.X) / 2, + (extents.MinPoint.Y + extents.MaxPoint.Y) / 2, + (extents.MinPoint.Z + extents.MaxPoint.Z) / 2 + ) + return center + +def create_text(btr, trans, position, text_value, text_layer): + """ + Creates a text entity in AutoCAD and adds it to the model space. + """ + text = DBText() + text.Position = position + text.Height = 3 # Text height + text.TextString = text_value # Text content + text.Layer = text_layer # Assign the text to the specified layer + btr.AppendEntity(text) + trans.AddNewlyCreatedDBObject(text, True) + return text + +def main(): + output = [] # List to store created texts + errors = [] # List to record errors + + with doc.LockDocument(): # Lock the document + with db.TransactionManager.StartTransaction() as t: + # Access the model space + bt = t.GetObject(db.BlockTableId, OpenMode.ForRead) + btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) + + # Iterate through the entities in model space + for objectid in btr: + blkRef = t.GetObject(objectid, OpenMode.ForRead) + if isinstance(blkRef, Polyline) and blkRef.Layer == polyline_layer_name: + try: + # Get the geometric center of the polyline + center = polyline_center(blkRef) + + # Create a unique text entity at the center of the polyline + text = create_text(btr, t, center, f"Text-{len(output) + 1}", text_layer_name) + output.append(text) + except Exception as e: + errors.append((blkRef, str(e))) + ed.WriteMessage(f"\nError processing polyline: {e}") + else: + errors.append(blkRef) + + # Commit the transaction + t.Commit() + + # Results + ed.WriteMessage(f"\n{len(output)} texts were created.") + if errors: + ed.WriteMessage(f"\nErrors found: {len(errors)}") + +if __name__ == "__main__": + main() diff --git a/Script Examples/ironpython3.4/countBlock.py b/Script Examples/ironpython3.4/countBlock.py new file mode 100644 index 0000000..55b4d41 --- /dev/null +++ b/Script Examples/ironpython3.4/countBlock.py @@ -0,0 +1,32 @@ +#Many thanks Cyril-Pop +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +# Write Code Below +all_blkName = [] +with doc.LockDocument(): + with doc.Database as db: + with db.TransactionManager.StartTransaction() as t: + bt = t.GetObject(db.BlockTableId,OpenMode.ForRead) + btr = t.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForRead) + for objectid in btr: + blkRef = t.GetObject(objectid, OpenMode.ForRead) + if isinstance(blkRef, BlockReference): + if blkRef.IsDynamicBlock: + block = t.GetObject(blkRef.DynamicBlockTableRecord, OpenMode.ForRead) + all_blkName.append(block.Name) + else: + all_blkName.append(blkRef.Name) + resultcount = ["{} - total:{}".format(x, all_blkName.count(x)) for x in set(all_blkName)] + print("\n".join(resultcount)) + t.Commit() \ No newline at end of file diff --git a/Script Examples/ironpython3.4/createARC.py b/Script Examples/ironpython3.4/createARC.py new file mode 100644 index 0000000..5cf8dfc --- /dev/null +++ b/Script Examples/ironpython3.4/createARC.py @@ -0,0 +1,29 @@ +#Copyright(c) 2021, Hồ Văn Chương +# @chuongmep, https://chuongmep.com/ +import clr +import math +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +#Code Here : +with doc.LockDocument(): + with doc.Database as db: + with db.TransactionManager.StartTransaction() as t: + bt = t.GetObject(db.BlockTableId,OpenMode.ForRead) + btr = t.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite) + centerPt = Point3d(0,0,0) + radius = 50 + arc = Arc(centerPt,Vector3d.ZAxis,radius,0,math.pi / 2) + btr.AppendEntity(arc) + t.AddNewlyCreatedDBObject(arc,True) + t.Commit() + print("Arc Created") \ No newline at end of file diff --git a/Script Examples/ironpython3.4/createCircleByCenterRadius.py b/Script Examples/ironpython3.4/createCircleByCenterRadius.py new file mode 100644 index 0000000..ce71fb3 --- /dev/null +++ b/Script Examples/ironpython3.4/createCircleByCenterRadius.py @@ -0,0 +1,28 @@ +#Copyright(c) 2021, Hồ Văn Chương +# @chuongmep, https://chuongmep.com/ +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +#Code Here : +with doc.LockDocument(): + with doc.Database as db: + with db.TransactionManager.StartTransaction() as t: + bt = t.GetObject(db.BlockTableId,OpenMode.ForRead) + btr = t.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite) + centerPt = Point3d(0,0,0) + radius = 50 + circle = Circle(centerPt, Vector3d.ZAxis, radius) + btr.AppendEntity(circle) + t.AddNewlyCreatedDBObject(circle,True) + t.Commit() + print("Circle Created") \ No newline at end of file diff --git a/Script Examples/ironpython3.4/createLayerCivil3d.py b/Script Examples/ironpython3.4/createLayerCivil3d.py new file mode 100644 index 0000000..8615e8e --- /dev/null +++ b/Script Examples/ironpython3.4/createLayerCivil3d.py @@ -0,0 +1,100 @@ +""" +Copyright 2019 Autodesk, Inc. All rights reserved. +# https://forum.dynamobim.com/t/use-dynamo-to-create-and-manipulate-autocad-civil-3d-layers/38567/8 +This file is part of the Civil 3D Python Module. + +""" +__author__ = 'Paolo Emilio Serra - paolo.serra@autodesk.com' +__modifiedby__ = 'Deivid Steffens - deividsteffens@msn.com' +__copyright__ = '2020' +__version__ = '1.0.0' + +import clr + +# Add Assemblies for AutoCAD and Civil 3D APIs +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +clr.AddReference('AecBaseMgd') +clr.AddReference('AecPropDataMgd') +clr.AddReference('AeccDbMgd') +clr.AddReference('AeccPressurePipesMgd') +clr.AddReference('acdbmgdbrep') +clr.AddReference('System.Windows.Forms') + +# Add references to manage arrays, collections and interact with the user +from System import * +from System.IO import * +from System.Collections.Specialized import * +from System.Windows.Forms import MessageBox + +# Create an alias to the Autodesk.AutoCAD.ApplicationServices.Application class +import Autodesk.AutoCAD.ApplicationServices.Application as acapp + +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +from Autodesk.AutoCAD.Colors import Color +from Autodesk.AutoCAD.Colors import ColorMethod +# Import references for PropertySets +from Autodesk.Aec.PropertyData import * +from Autodesk.Aec.PropertyData.DatabaseServices import * + +# Import references for Civil 3D +from Autodesk.Civil.ApplicationServices import * +from Autodesk.Civil.DatabaseServices import * + +adoc = acapp.DocumentManager.MdiActiveDocument +ed = adoc.Editor + +# Example function +def create_layer(name, index): + + indx = int(index) + + # Fail gracefully + if not isinstance(name, str) or len(name) == 0: + raise Exception('The name is not a valid string') + if not isinstance(indx, int) or indx < 0 or indx > 255: + raise Exception('The index component is not a valid integer') + + # replace invalid characters in the name + name = name.replace(':', '_').replace(';', '_').replace(',', '_') + + global adoc + result = False + + with adoc.LockDocument(): + with adoc.Database as db: + with db.TransactionManager.StartTransaction() as t: + # Get the Layer Table Object + lt = t.GetObject(db.LayerTableId, OpenMode.ForRead) + # Check if the layer already exists + if not lt.Has(name): + with LayerTableRecord() as ltr: + ltr = LayerTableRecord() + ltr.Name = name + ltr.Color = Color.FromColorIndex(ColorMethod.ByAci,indx) + lt.UpgradeOpen() + lt.Add(ltr) + lt.DowngradeOpen() + t.AddNewlyCreatedDBObject(ltr, True) + else: + ltr = t.GetObject(lt[name], OpenMode.ForWrite) + # Set the color + if ltr is not None: + ltr.Color = Color.FromColorIndex(ColorMethod.ByAci,indx) + + result = True + t.Commit() + + return result + +for i in range(10): + name = "Test"+ str(i) + create_layer(name,i) + print("Created Layer",name) + diff --git a/Script Examples/ironpython3.4/createLine.py b/Script Examples/ironpython3.4/createLine.py new file mode 100644 index 0000000..495d747 --- /dev/null +++ b/Script Examples/ironpython3.4/createLine.py @@ -0,0 +1,29 @@ +#Copyright(c) 2021, Hồ Văn Chương +# @chuongmep, https://chuongmep.com/ +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +#Code Here : +objects = [] +p1 = Point3d(0,0,0) +p2 = Point3d(100,100,0) +line1 = Line(p1,p2) +with doc.LockDocument(): + with doc.Database as db: + with db.TransactionManager.StartTransaction() as t: + bt = t.GetObject(db.BlockTableId,OpenMode.ForRead) + btr = t.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite) + btr.AppendEntity(line1) + t.AddNewlyCreatedDBObject(line1,True) + t.Commit() + print("Line Created") \ No newline at end of file diff --git a/Script Examples/ironpython3.4/createPolyLine.py b/Script Examples/ironpython3.4/createPolyLine.py new file mode 100644 index 0000000..cae7b13 --- /dev/null +++ b/Script Examples/ironpython3.4/createPolyLine.py @@ -0,0 +1,30 @@ +#Copyright(c) 2021, Hồ Văn Chương +# @chuongmep, https://chuongmep.com/ +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +# Write Code Below +with doc.LockDocument(): + with doc.Database as db: + with db.TransactionManager.StartTransaction() as t: + bt = t.GetObject(db.BlockTableId,OpenMode.ForRead) + btr = t.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite) + # Do action here + pl = Polyline() + pl.AddVertexAt(0,Point2d(0.0, 0.0), 0.0, 0.0, 0.0) + pl.AddVertexAt(1,Point2d(100.0, 0.0), 0.0, 0.0, 0.0) + pl.AddVertexAt(2,Point2d(100.0, 100.0), 0.0, 0.0, 0.0) + pl.AddVertexAt(3,Point2d(0.0, 100.0), 0.0, 0.0, 0.0) + btr.AppendEntity(pl) + t.AddNewlyCreatedDBObject(pl,True) + t.Commit() \ No newline at end of file diff --git a/Script Examples/ironpython3.4/deleteObject.py b/Script Examples/ironpython3.4/deleteObject.py new file mode 100644 index 0000000..38d3b5a --- /dev/null +++ b/Script Examples/ironpython3.4/deleteObject.py @@ -0,0 +1,26 @@ +#Copyright(c) 2021, Hồ Văn Chương +# @chuongmep, https://chuongmep.com/ +import clr +import sys +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +result = ed.GetEntity("Please Select Object To Delete") +if(result.Status==PromptStatus.OK): objId = result.ObjectId +#Code Here : +with doc.LockDocument(): + with doc.Database as db: + with db.TransactionManager.StartTransaction() as t: + obj = t.GetObject(objId, OpenMode.ForWrite) + obj.Erase() + t.Commit() + print("Object Deleted") \ No newline at end of file diff --git a/Script Examples/ironpython3.4/getObjectIdWithPrompt.py b/Script Examples/ironpython3.4/getObjectIdWithPrompt.py new file mode 100644 index 0000000..688fe3c --- /dev/null +++ b/Script Examples/ironpython3.4/getObjectIdWithPrompt.py @@ -0,0 +1,22 @@ +#Copyright(c) 2021, Hồ Văn Chương +# @chuongmep, https://chuongmep.com/ +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +# Write Code Below +def GetObjectIdWithPrompt(editor): + result = editor.GetEntity("Please Select an Entity") + if(result.Status!= PromptStatus.OK) : return + editor.WriteMessage(result.ObjectId.ObjectClass.Name) + print("Object Class Name:",result.ObjectId.ObjectClass.Name) +GetObjectIdWithPrompt(ed) \ No newline at end of file diff --git a/Script Examples/ironpython3.4/getcolor.py b/Script Examples/ironpython3.4/getcolor.py new file mode 100644 index 0000000..235438c --- /dev/null +++ b/Script Examples/ironpython3.4/getcolor.py @@ -0,0 +1,23 @@ +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +adoc = Application.DocumentManager.MdiActiveDocument +ed = adoc.Editor + +## Get Color +import Autodesk.AutoCAD.Colors.EntityColor as cl +rgbcad = cl.LookUpRgb(111) +print(rgbcad) +blue = rgbcad & 255 +green = (rgbcad >> 8) & 255 +red = (rgbcad >> 16) & 255 +print("Color RGB is", (red,green,blue)) + +## see more at : https://forum.dynamobim.com/t/aci-color-to-rgb/59856/6 \ No newline at end of file diff --git a/Script Examples/ironpython3.4/getobject.py b/Script Examples/ironpython3.4/getobject.py new file mode 100644 index 0000000..3fe402b --- /dev/null +++ b/Script Examples/ironpython3.4/getobject.py @@ -0,0 +1,23 @@ +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +adoc = Application.DocumentManager.MdiActiveDocument +ed = adoc.Editor +output =[] +with adoc.LockDocument(): + with adoc.Database as db: + with db.TransactionManager.StartTransaction() as t: + bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite) + btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) + for objectid in btr: + obj1 = t.GetObject(objectid, OpenMode.ForRead) + output.append(obj1) + print(obj1) +ed.WriteMessage("Done") \ No newline at end of file diff --git a/Script Examples/ironpython3.4/getselection.py b/Script Examples/ironpython3.4/getselection.py new file mode 100644 index 0000000..f7f2b83 --- /dev/null +++ b/Script Examples/ironpython3.4/getselection.py @@ -0,0 +1,33 @@ +#Copyright(c) 2021, Hồ Văn Chương +# @chuongmep, https://chuongmep.com/ +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +# Write Code Below +with doc.LockDocument(): + with doc.Database as db: + with db.TransactionManager.StartTransaction() as t: + bt = t.GetObject(db.BlockTableId,OpenMode.ForRead) + btr = t.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite) + # Do action here + result = ed.GetSelection() + if(result.Status==PromptStatus.OK): + print("Selected Entity") + print(dir(result)) + #There are selected entities + #Put your command using pickfirst set code here + else : + print("There are no selected entities ") + #Put your command code here + + t.Commit() \ No newline at end of file diff --git a/Script Examples/ironpython3.4/libCadTransaction.py b/Script Examples/ironpython3.4/libCadTransaction.py new file mode 100644 index 0000000..197dcc4 --- /dev/null +++ b/Script Examples/ironpython3.4/libCadTransaction.py @@ -0,0 +1,25 @@ +#Copyright(c) 2021, Hồ Văn Chương +# @chuongmep, https://chuongmep.com/ +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +# Write Code Below +with doc.LockDocument(): + with doc.Database as db: + with db.TransactionManager.StartTransaction() as t: + bt = t.GetObject(db.BlockTableId,OpenMode.ForRead) + btr = t.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite) + # Do action here + + + t.Commit() \ No newline at end of file diff --git a/Script Examples/ironpython3.4/libcivil3dyanmo.py b/Script Examples/ironpython3.4/libcivil3dyanmo.py new file mode 100644 index 0000000..b3914a7 --- /dev/null +++ b/Script Examples/ironpython3.4/libcivil3dyanmo.py @@ -0,0 +1,39 @@ +import clr + +# Add Assemblies for AutoCAD and Civil 3D APIs +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +clr.AddReference('AecBaseMgd') +clr.AddReference('AecPropDataMgd') +clr.AddReference('AeccDbMgd') +clr.AddReference('AeccPressurePipesMgd') +clr.AddReference('acdbmgdbrep') +clr.AddReference('System.Windows.Forms') +clr.AddReference('Civil3DNodes') +clr.AddReference('AutoCADNodes') + +# Add references to manage arrays, collections and interact with the user +from System import * +from System.IO import * +from System.Collections.Specialized import * +from System.Windows.Forms import MessageBox + +# Create an alias to the Autodesk.AutoCAD.ApplicationServices.Application class +import Autodesk.AutoCAD.ApplicationServices.Application as acapp + +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * + +# Import references for Civil 3D +from Autodesk.Civil.ApplicationServices import * +from Autodesk.Civil.DatabaseServices import * + +# Import references for Dynamo for Civil 3D +from Autodesk.Civil.DynamoNodes import Surface as DynSurface +from Autodesk.Civil.DynamoNodes.Selection import SurfaceByName +from Autodesk.AutoCAD.DynamoNodes import Document as DynDocument \ No newline at end of file diff --git a/Script Examples/ironpython3.4/sample_base.dwg b/Script Examples/ironpython3.4/sample_base.dwg new file mode 100644 index 0000000..182002d Binary files /dev/null and b/Script Examples/ironpython3.4/sample_base.dwg differ diff --git a/Script Examples/ironpython3.4/selectionpickobject.py b/Script Examples/ironpython3.4/selectionpickobject.py new file mode 100644 index 0000000..7f638fe --- /dev/null +++ b/Script Examples/ironpython3.4/selectionpickobject.py @@ -0,0 +1,29 @@ +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +#Code Here : +objects = [] +with doc.LockDocument(): + with doc.Database as db: + with db.TransactionManager.StartTransaction() as t: + acblkbl = t.GetObject(db.BlockTableId,OpenMode.ForRead) + print(type(acblkbl)) + acblktblrec = t.GetObject(acblkbl[BlockTableRecord.ModelSpace],OpenMode.ForWrite) + print(type(acblktblrec)) + sel = doc.Editor.GetSelection() + if(sel.Status== PromptStatus.OK): + results = sel.Value + for i in range(len(results)): + if(results[i] != None) : objects.append(i) + else : pass +print("Count Object Exploded:",len(objects)) \ No newline at end of file diff --git a/Script Examples/ironpython3.4/showAlertDialog.py b/Script Examples/ironpython3.4/showAlertDialog.py new file mode 100644 index 0000000..ab8b90a --- /dev/null +++ b/Script Examples/ironpython3.4/showAlertDialog.py @@ -0,0 +1,17 @@ +#Copyright(c) 2021, Hồ Văn Chương +# @chuongmep, https://chuongmep.com/ +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +# Write Code Below +Application.ShowAlertDialog("Hello World!") \ No newline at end of file diff --git a/Script Examples/ironpython3.4/showdialog.py b/Script Examples/ironpython3.4/showdialog.py new file mode 100644 index 0000000..ee00456 --- /dev/null +++ b/Script Examples/ironpython3.4/showdialog.py @@ -0,0 +1,51 @@ +import sys +import clr +# Add Assemblies for AutoCAD +clr.AddReference('AcMgd') +clr.AddReference('AcCoreMgd') +clr.AddReference('AcDbMgd') +clr.AddReference('AdWindows') + +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.Windows import * + + +adoc = Application.DocumentManager.MdiActiveDocument +ed = adoc.Editor + +td = TaskDialog() +td.WindowTitle = "The title" +td.MainInstruction = "Something has happened." +td.ContentText = "Here's some text, with a " + "" + "link to the ADN site" +td.VerificationText = "Verification text" +td.FooterText = "The footer with a "+ "link to Kean's blog" +td.EnableHyperlinks = True +td.EnableVerificationHandler = True + +td.CollapsedControlText = "This control can be collapsed." +td.ExpandedText = "This control can be expanded..." + "\nto multiple lines." +td.ExpandFooterArea = True +td.ExpandedByDefault = False + +td.MainIcon = TaskDialogIcon.Shield +td.FooterIcon = TaskDialogIcon.Information + +td.UseCommandLinks = True +td.Buttons.Add(TaskDialogButton(1, "This is one course of action.")) +td.Buttons.Add(TaskDialogButton(2, "This is another course of action.")) +td.Buttons.Add(TaskDialogButton(3, "And would you believe we have a third!")) +td.DefaultButton = 3 + +td.RadioButtons.Add(TaskDialogButton(4, "Yes")) +td.RadioButtons.Add(TaskDialogButton(5, "No")) +td.RadioButtons.Add(TaskDialogButton(6, "Maybe")) + +td.DefaultRadioButton = 5 +td.AllowDialogCancellation = False + +"Need help with the Callback here" + +td.Show(Application.MainWindow.Handle) diff --git a/Script Examples/testironpython3.py b/Script Examples/ironpython3.4/testironpython3.py similarity index 100% rename from Script Examples/testironpython3.py rename to Script Examples/ironpython3.4/testironpython3.py diff --git a/Script Examples/ironpython3.4/zoomtoobject.py b/Script Examples/ironpython3.4/zoomtoobject.py new file mode 100644 index 0000000..786df5f --- /dev/null +++ b/Script Examples/ironpython3.4/zoomtoobject.py @@ -0,0 +1,36 @@ +#Copyright(c) 2021, Hồ Văn Chương +# @chuongmep, https://chuongmep.com/ +import clr +clr.AddReference('acmgd') +clr.AddReference('acdbmgd') +clr.AddReference('accoremgd') +# Import references from AutoCAD +from Autodesk.AutoCAD.Runtime import * +from Autodesk.AutoCAD.ApplicationServices import * +from Autodesk.AutoCAD.EditorInput import * +from Autodesk.AutoCAD.DatabaseServices import * +from Autodesk.AutoCAD.Geometry import * +doc = Application.DocumentManager.MdiActiveDocument +ed = doc.Editor +db = doc.Database +# Write Code Below +def ZoomToObj(ed,min,max): + min2d = Point2d(min.X, min.Y) + max2d = Point2d(max.X, max.Y) + view = ViewTableRecord() + view.CenterPoint = min2d + ((max2d - min2d) / 2.0) + view.Height = max2d.Y - min2d.Y + view.Width = max2d.X - min2d.X + ed.SetCurrentView(view) +peo = PromptEntityOptions("Select An Entity:") +result = ed.GetEntity(peo) +if(result.Status==PromptStatus.OK): + with doc.LockDocument(): + with doc.Database as db: + with db.TransactionManager.StartTransaction() as t: + ent = t.GetObject(result.ObjectId,OpenMode.ForRead) + ext = ent.GeometricExtents + # Do action here + ZoomToObj(ed, ext.MinPoint, ext.MaxPoint) + + t.Commit() \ No newline at end of file diff --git a/Script Examples/snoopobjectdemo.py b/Script Examples/snoopobjectdemo.py deleted file mode 100644 index 76726aa..0000000 --- a/Script Examples/snoopobjectdemo.py +++ /dev/null @@ -1,37 +0,0 @@ -import clr -import sys -sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib') -import os -import math -clr.AddReference('acmgd') -clr.AddReference('acdbmgd') -clr.AddReference('accoremgd') -# Import references from AutoCAD -from Autodesk.AutoCAD.Runtime import * -from Autodesk.AutoCAD.ApplicationServices import * -from Autodesk.AutoCAD.EditorInput import * -from Autodesk.AutoCAD.DatabaseServices import * -from Autodesk.AutoCAD.Geometry import * -adoc = Application.DocumentManager.MdiActiveDocument -ed = adoc.Editor -output =[] -with adoc.LockDocument(): - with adoc.Database as db: - with db.TransactionManager.StartTransaction() as t: - bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite) - btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) - for objectid in btr: - obj1 = t.GetObject(objectid, OpenMode.ForRead) - output.append(obj1) - print(obj1) -if(len(output)==0): - print("Dont have any object in view \nPlease draw something!") -else: - from CADSnoop import SnoopCommand - a = output[0] - sn = SnoopCommand() - sn.Snoop(a) -## you can use shell to snoop with method : -# snoop(a) -## or use sn.Snoop(a) from shell command -# note with option snoop() will be snoop by pick object same with button from in ribbon \ No newline at end of file diff --git a/global.json b/global.json new file mode 100644 index 0000000..29253f5 --- /dev/null +++ b/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "6.*", + "rollForward": "latestMajor", + "allowPrerelease": false + } +} \ No newline at end of file diff --git a/global.json.bak b/global.json.bak new file mode 100644 index 0000000..9e5e1fd --- /dev/null +++ b/global.json.bak @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "6.0.0", + "rollForward": "latestMajor", + "allowPrerelease": true + } +} \ No newline at end of file