diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f412a4ded..2e39dd440 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -168,8 +168,6 @@ There are [several pages](https://github.com/baldurk/renderdoc/wiki/Code-Dives) ... ; everything else in here consists of the core renderdoc runtime renderdoccmd/ ; A small C++ utility program that runs to do various little tasks renderdocshim/ ; A tiny C DLL using only kernel32.dll that is used for global hooking - renderdocui/ ; The .NET UI layer built on top of renderdoc/ - 3rdparty/ ; third party utilities & libraries included qrenderdoc/ ; The Qt UI layer built on top of renderdoc/ docs/ ; source documentation for the .chm file or http://docs.renderdoc.org/ ; in the Sandcastle help file builder diff --git a/renderdoc.sln b/renderdoc.sln index f28e006d9..1c7e6c4b4 100644 --- a/renderdoc.sln +++ b/renderdoc.sln @@ -5,12 +5,6 @@ VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UI", "UI", "{89059266-9C4E-4637-AB1D-BFF1DC15096B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "renderdocui", "renderdocui\renderdocui.csproj", "{5504BAC8-287E-4083-A57F-5EE172EDDAEB}" - ProjectSection(ProjectDependencies) = postProject - {6DEE3F12-F2F8-42CA-865A-578D0FD11387} = {6DEE3F12-F2F8-42CA-865A-578D0FD11387} - {E2B46D67-90E2-40B6-9597-72930E7845E5} = {E2B46D67-90E2-40B6-9597-72930E7845E5} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "renderdoc", "renderdoc\renderdoc.vcxproj", "{E2B46D67-90E2-40B6-9597-72930E7845E5}" ProjectSection(ProjectDependencies) = postProject {7893E300-3ED0-7F4C-158F-67EA63934C57} = {7893E300-3ED0-7F4C-158F-67EA63934C57} @@ -22,8 +16,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "renderdoc", "renderdoc\rend {EA1242CF-BB42-B1AC-9B6A-A508D96D1CB7} = {EA1242CF-BB42-B1AC-9B6A-A508D96D1CB7} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsUI", "renderdocui\3rdparty\WinFormsUI\WinFormsUI.csproj", "{C75532C4-765B-418E-B09B-46D36B2ABDB1}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DLL", "DLL", "{B1FB29A4-9C48-4D47-BAEF-CF14CB2A40A3}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "renderdoccmd", "renderdoccmd\renderdoccmd.vcxproj", "{D03DF2F9-513C-4084-BBDD-1DEE8D9250D7}" @@ -79,6 +71,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IHV", "IHV", "{4DA2F3E3-9A6 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d3d8", "renderdoc\driver\d3d8\renderdoc_d3d8.vcxproj", "{9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qrenderdoc", "qrenderdoc\qrenderdoc_local.vcxproj", "{A14A6AE5-02B1-35FE-BE59-B3E7C273B40B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Development|x64 = Development|x64 @@ -87,14 +81,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5504BAC8-287E-4083-A57F-5EE172EDDAEB}.Development|x64.ActiveCfg = Development|x64 - {5504BAC8-287E-4083-A57F-5EE172EDDAEB}.Development|x64.Build.0 = Development|x64 - {5504BAC8-287E-4083-A57F-5EE172EDDAEB}.Development|x86.ActiveCfg = Development|x86 - {5504BAC8-287E-4083-A57F-5EE172EDDAEB}.Development|x86.Build.0 = Development|x86 - {5504BAC8-287E-4083-A57F-5EE172EDDAEB}.Release|x64.ActiveCfg = Release|x64 - {5504BAC8-287E-4083-A57F-5EE172EDDAEB}.Release|x64.Build.0 = Release|x64 - {5504BAC8-287E-4083-A57F-5EE172EDDAEB}.Release|x86.ActiveCfg = Release|x86 - {5504BAC8-287E-4083-A57F-5EE172EDDAEB}.Release|x86.Build.0 = Release|x86 {E2B46D67-90E2-40B6-9597-72930E7845E5}.Development|x64.ActiveCfg = Development|x64 {E2B46D67-90E2-40B6-9597-72930E7845E5}.Development|x64.Build.0 = Development|x64 {E2B46D67-90E2-40B6-9597-72930E7845E5}.Development|x86.ActiveCfg = Development|Win32 @@ -103,14 +89,6 @@ Global {E2B46D67-90E2-40B6-9597-72930E7845E5}.Release|x64.Build.0 = Release|x64 {E2B46D67-90E2-40B6-9597-72930E7845E5}.Release|x86.ActiveCfg = Release|Win32 {E2B46D67-90E2-40B6-9597-72930E7845E5}.Release|x86.Build.0 = Release|Win32 - {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Development|x64.ActiveCfg = Development|Any CPU - {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Development|x64.Build.0 = Development|Any CPU - {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Development|x86.ActiveCfg = Development|Any CPU - {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Development|x86.Build.0 = Development|Any CPU - {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Release|x64.ActiveCfg = Release|Any CPU - {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Release|x64.Build.0 = Release|Any CPU - {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Release|x86.ActiveCfg = Release|Any CPU - {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Release|x86.Build.0 = Release|Any CPU {D03DF2F9-513C-4084-BBDD-1DEE8D9250D7}.Development|x64.ActiveCfg = Development|x64 {D03DF2F9-513C-4084-BBDD-1DEE8D9250D7}.Development|x64.Build.0 = Development|x64 {D03DF2F9-513C-4084-BBDD-1DEE8D9250D7}.Development|x86.ActiveCfg = Development|Win32 @@ -232,14 +210,20 @@ Global {9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}.Release|x64.Build.0 = Release|x64 {9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}.Release|x86.ActiveCfg = Release|Win32 {9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}.Release|x86.Build.0 = Release|Win32 + {A14A6AE5-02B1-35FE-BE59-B3E7C273B40B}.Development|x64.ActiveCfg = Development|x64 + {A14A6AE5-02B1-35FE-BE59-B3E7C273B40B}.Development|x64.Build.0 = Development|x64 + {A14A6AE5-02B1-35FE-BE59-B3E7C273B40B}.Development|x86.ActiveCfg = Development|Win32 + {A14A6AE5-02B1-35FE-BE59-B3E7C273B40B}.Development|x86.Build.0 = Development|Win32 + {A14A6AE5-02B1-35FE-BE59-B3E7C273B40B}.Release|x64.ActiveCfg = Release|x64 + {A14A6AE5-02B1-35FE-BE59-B3E7C273B40B}.Release|x64.Build.0 = Release|x64 + {A14A6AE5-02B1-35FE-BE59-B3E7C273B40B}.Release|x86.ActiveCfg = Release|Win32 + {A14A6AE5-02B1-35FE-BE59-B3E7C273B40B}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {5504BAC8-287E-4083-A57F-5EE172EDDAEB} = {89059266-9C4E-4637-AB1D-BFF1DC15096B} {E2B46D67-90E2-40B6-9597-72930E7845E5} = {B1FB29A4-9C48-4D47-BAEF-CF14CB2A40A3} - {C75532C4-765B-418E-B09B-46D36B2ABDB1} = {89059266-9C4E-4637-AB1D-BFF1DC15096B} {D03DF2F9-513C-4084-BBDD-1DEE8D9250D7} = {B5A783D9-AEB9-420D-8E77-D4D930F8D88C} {9B86ABCF-0A48-41CE-B109-FFA08D80F345} = {B1FB29A4-9C48-4D47-BAEF-CF14CB2A40A3} {EA1242CF-BB42-B1AC-9B6A-A508D96D1CB7} = {9B86ABCF-0A48-41CE-B109-FFA08D80F345} @@ -260,5 +244,6 @@ Global {5DE5A561-548A-4DD7-90F0-06A2B39EAE9A} = {4DA2F3E3-9A65-45DD-A69B-82C7757D4904} {4DA2F3E3-9A65-45DD-A69B-82C7757D4904} = {864A44B0-5612-451A-857F-41E3EF785EF6} {9C4487E8-EEB0-4A7F-BD81-23F81CD24E22} = {864A44B0-5612-451A-857F-41E3EF785EF6} + {A14A6AE5-02B1-35FE-BE59-B3E7C273B40B} = {89059266-9C4E-4637-AB1D-BFF1DC15096B} EndGlobalSection EndGlobal diff --git a/renderdoc/os/posix/posix_libentry.cpp b/renderdoc/os/posix/posix_libentry.cpp index b675f08ab..2264dd20e 100644 --- a/renderdoc/os/posix/posix_libentry.cpp +++ b/renderdoc/os/posix/posix_libentry.cpp @@ -42,8 +42,7 @@ void library_loaded() string curfile; FileIO::GetExecutableFilename(curfile); - if(curfile.find("/renderdoccmd") != string::npos || - curfile.find("/renderdocui") != string::npos || curfile.find("/qrenderdoc") != string::npos || + if(curfile.find("/renderdoccmd") != string::npos || curfile.find("/qrenderdoc") != string::npos || curfile.find("org.renderdoc.renderdoccmd") != string::npos) { RDCDEBUG("Not creating hooks - in replay app"); diff --git a/renderdoc/os/win32/sys_win32_hooks.cpp b/renderdoc/os/win32/sys_win32_hooks.cpp index 0669cb62c..2641ba515 100644 --- a/renderdoc/os/win32/sys_win32_hooks.cpp +++ b/renderdoc/os/win32/sys_win32_hooks.cpp @@ -296,9 +296,7 @@ private: string app = lpApplicationName; app = strlower(app); - if(app.find("renderdoccmd.exe") != string::npos || - app.find("renderdocui.vshost.exe") != string::npos || - app.find("qrenderdoc.exe") != string::npos || app.find("renderdocui.exe") != string::npos) + if(app.find("renderdoccmd.exe") != string::npos || app.find("qrenderdoc.exe") != string::npos) { inject = false; } @@ -308,9 +306,7 @@ private: string cmd = lpCommandLine; cmd = strlower(cmd); - if(cmd.find("renderdoccmd.exe") != string::npos || - cmd.find("renderdocui.vshost.exe") != string::npos || - cmd.find("qrenderdoc.exe") != string::npos || cmd.find("renderdocui.exe") != string::npos) + if(cmd.find("renderdoccmd.exe") != string::npos || cmd.find("qrenderdoc.exe") != string::npos) { inject = false; } @@ -385,9 +381,7 @@ private: app = strlower(app); if(app.find(L"renderdoccmd.exe") != wstring::npos || - app.find(L"renderdocui.vshost.exe") != wstring::npos || - app.find(L"qrenderdoc.exe") != string::npos || - app.find(L"renderdocui.exe") != wstring::npos) + app.find(L"qrenderdoc.exe") != string::npos) { inject = false; } @@ -398,9 +392,7 @@ private: cmd = strlower(cmd); if(cmd.find(L"renderdoccmd.exe") != wstring::npos || - cmd.find(L"renderdocui.vshost.exe") != wstring::npos || - cmd.find(L"qrenderdoc.exe") != wstring::npos || - cmd.find(L"renderdocui.exe") != wstring::npos) + cmd.find(L"qrenderdoc.exe") != wstring::npos) { inject = false; } diff --git a/renderdoc/os/win32/win32_stringio.cpp b/renderdoc/os/win32/win32_stringio.cpp index a1795c4a1..8dff41c11 100644 --- a/renderdoc/os/win32/win32_stringio.cpp +++ b/renderdoc/os/win32/win32_stringio.cpp @@ -253,7 +253,7 @@ string GetReplayAppFilename() string path = StringFormat::Wide2UTF8(wstring(curFile)); path = dirname(path); - string exe = path + "/renderdocui.exe"; + string exe = path + "/qrenderdoc.exe"; FILE *f = FileIO::fopen(exe.c_str(), "rb"); if(f) @@ -262,9 +262,9 @@ string GetReplayAppFilename() return exe; } - // if renderdocui.exe doesn't live in the same dir, we must be in x86/ + // if qrenderdoc.exe doesn't live in the same dir, we must be in x86/ // so look one up the tree. - exe = path + "/../renderdocui.exe"; + exe = path + "/../qrenderdoc.exe"; f = FileIO::fopen(exe.c_str(), "rb"); if(f) diff --git a/renderdoccmd/renderdoccmd.rc b/renderdoccmd/renderdoccmd.rc index 9288b8195..4152f8a49 100644 Binary files a/renderdoccmd/renderdoccmd.rc and b/renderdoccmd/renderdoccmd.rc differ diff --git a/renderdoccmd/renderdoccmd.vcxproj b/renderdoccmd/renderdoccmd.vcxproj index 5799c3dc8..f37f243c2 100644 --- a/renderdoccmd/renderdoccmd.vcxproj +++ b/renderdoccmd/renderdoccmd.vcxproj @@ -207,7 +207,7 @@ - + diff --git a/renderdoccmd/renderdoccmd.vcxproj.filters b/renderdoccmd/renderdoccmd.vcxproj.filters index e0601464b..b9b7f6fb0 100644 --- a/renderdoccmd/renderdoccmd.vcxproj.filters +++ b/renderdoccmd/renderdoccmd.vcxproj.filters @@ -34,7 +34,7 @@ - + Resources diff --git a/renderdoccmd/renderdoccmd_win32.cpp b/renderdoccmd/renderdoccmd_win32.cpp index b9ce300a5..f7cd7bdec 100644 --- a/renderdoccmd/renderdoccmd_win32.cpp +++ b/renderdoccmd/renderdoccmd_win32.cpp @@ -93,7 +93,7 @@ INT_PTR CALLBACK CrashHandlerProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM L"states and local memory at the time of the " L"crash & thread stacks, etc. The diagnostic log contains diagnostic messages like " L"warnings and errors.\n\n" - L"The only other information sent is the version of RenderDoc, C# exception callstack, " + L"The only other information sent is the version of RenderDoc, " L"and any notes you include.\n\n" L"Any repro steps or notes would be helpful to include with the report. If you'd like to " L"be contacted about the bug " @@ -454,7 +454,7 @@ struct UpgradeCommand : public Command // run original UI exe and tell it an update succeeded wstring cmdline = L"\""; cmdline += wide_path; - cmdline += L"/renderdocui.exe\" "; + cmdline += L"/qrenderdoc.exe\" "; if(successful) cmdline += L"--updatedone"; else @@ -595,36 +595,6 @@ struct CrashHandlerCommand : public Command report += "\n\nRepro steps/Notes:\n\n" + reproSteps; - { - FILE *f = NULL; - _wfopen_s(&f, logpath.c_str(), L"r"); - if(f) - { - fseek(f, 0, SEEK_END); - long filesize = ftell(f); - fseek(f, 0, SEEK_SET); - - if(filesize > 10) - { - char *error_log = new char[filesize + 1]; - memset(error_log, 0, filesize + 1); - - fread(error_log, 1, filesize, f); - - char *managed_callstack = strstr(error_log, "--- Begin C# Exception Data ---"); - if(managed_callstack) - { - report += managed_callstack; - report += "\n\n"; - } - - delete[] error_log; - } - - fclose(f); - } - } - if(uploadReport) { mz_zip_archive zip; diff --git a/renderdocui/3rdparty/ScintillaNET/License.txt b/renderdocui/3rdparty/ScintillaNET/License.txt deleted file mode 100644 index 80e563d93..000000000 --- a/renderdocui/3rdparty/ScintillaNET/License.txt +++ /dev/null @@ -1,21 +0,0 @@ -ScintillaNET is based on the Scintilla component by Neil Hodgson. - -ScintillaNET is released on this same license. - -The ScintillaNET bindings are Copyright 2002-2006 by Garrett Serack - -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. - -GARRETT SERACK AND ALL EMPLOYERS PAST AND PRESENT DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL GARRETT SERACK AND ALL EMPLOYERS PAST AND PRESENT BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -The license for Scintilla is as follows: ------------------------------------------------------------------------ -Copyright 1998-2006 by Neil Hodgson - -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. - -NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/renderdocui/3rdparty/ScintillaNET/SciLexer.dll b/renderdocui/3rdparty/ScintillaNET/SciLexer.dll deleted file mode 100644 index 39976a576..000000000 Binary files a/renderdocui/3rdparty/ScintillaNET/SciLexer.dll and /dev/null differ diff --git a/renderdocui/3rdparty/ScintillaNET/SciLexer64.dll b/renderdocui/3rdparty/ScintillaNET/SciLexer64.dll deleted file mode 100644 index 51a453234..000000000 Binary files a/renderdocui/3rdparty/ScintillaNET/SciLexer64.dll and /dev/null differ diff --git a/renderdocui/3rdparty/ScintillaNET/ScintillaNET.dll b/renderdocui/3rdparty/ScintillaNET/ScintillaNET.dll deleted file mode 100644 index 9857a7bc0..000000000 Binary files a/renderdocui/3rdparty/ScintillaNET/ScintillaNET.dll and /dev/null differ diff --git a/renderdocui/3rdparty/ScintillaNET/ScintillaNET.pdb b/renderdocui/3rdparty/ScintillaNET/ScintillaNET.pdb deleted file mode 100644 index 8dd2a279f..000000000 Binary files a/renderdocui/3rdparty/ScintillaNET/ScintillaNET.pdb and /dev/null differ diff --git a/renderdocui/3rdparty/ScintillaNET/ScintillaNET.xml b/renderdocui/3rdparty/ScintillaNET/ScintillaNET.xml deleted file mode 100644 index 3f2b7800f..000000000 --- a/renderdocui/3rdparty/ScintillaNET/ScintillaNET.xml +++ /dev/null @@ -1,4556 +0,0 @@ - - - - ScintillaNET - - - - - Provides a writer paradigm for building a list and optionally - the text that is being styled. - - - - - Returns the underlying . - - The underlying if one was provided; otherwise, null. - - - - Returns a enumerable built by the thus far. - - A enumerable representing the style runs written thus far. - - - - Writes a run of the specified string length in the specified style. - - - The string that determines the run length. If a was used to - create the the string value will also be appended. - - The zero-based index of the style for this run. - - - - Initializes a new instance of the class. - - The optional to write to. - - - - Provides data for the StyleNeeded event - - - - - Initializes a new instance of the StyleNeededEventArgs class. - - the document range that needs styling - - - - Returns the document range that needs styling - - - - - Provides data for the StyleChanged event - - - StyleChangedEventHandler is used for the StyleChanged Event which is also used as - a more specific abstraction around the SCN_MODIFIED notification message. - - - - - Base class for modified events - - - ModifiedEventArgs is the base class for all events that are fired - in response to an SCN_MODIFY notification message. They all have - the Undo/Redo flags in common and I'm also including the raw - modificationType integer value for convenience purposes. - - - - - Returns how many characters have changed - - - - - Returns the starting document position where the style has been changed - - - - - Top level ScintillaHelpers Like Style and Folding inherit from this class so they don't have - to reimplement the same Equals method - - - - - Abstract Equals Override. All Helpers must implement this. Use IsSameHelperFamily to - determine if the types are compatible and they have the same Scintilla. For most top - level helpers like Caret and Lexing this should be enough. Helpers like Marker and - Line also need to take other variables into consideration. - - - - - - - Determines if obj belongs to the same Scintilla and is of compatible type - - - - - Struct used for passing parameters to FormatRange() - - - - - The HDC (device context) we print to - - - - - The HDC we use for measuring (may be same as hdc) - - - - - Rectangle in which to print - - - - - Physically printable page size - - - - - Range of characters to print - - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - - Returns the cached ResourceManager instance used by this class. - - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - - Looks up a localized string similar to Cannot create the Scintilla direct message function.. - - - - - Looks up a localized string similar to Cannot load the '{0}' module into memory.. - - - - - Looks up a localized string similar to The '{0}' argument cannot be an empty string.. - - - - - Looks up a localized string similar to Enumeration already finished.. - - - - - Looks up a localized string similar to Enumeration has not started. Call MoveNext.. - - - - - Looks up a localized string similar to Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on.. - - - - - Looks up a localized string similar to Index was out of range. Must be non-negative and less than the size of the collection.. - - - - - Looks up a localized string similar to Insufficient space in the target location to copy the information.. - - - - - Looks up a localized string similar to A change in the control who created this annotation has rendered the object invalid.. - - - - - Looks up a localized string similar to The {0} line must specify a valid line within the document.. - - - - - Looks up a localized string similar to The start line and end line must specify a valid range.. - - - - - Looks up a localized string similar to '{0}' is not a valid Scintilla module.. - - - - - Looks up a localized string similar to The start line must be greater than or equal to zero.. - - - - - Looks up a localized string similar to The module name must be set before any Scintilla object are created.. - - - - - Looks up a localized string similar to '{0}' was out of range. Must be non-negative and less than {1}.. - - - - - Looks up a localized string similar to SciLexer.dll. - - - - - Looks up a localized string similar to SciLexer64.dll. - - - - - Provides an abstraction over Scintilla's Document Pointer - - - - - Increases the document's reference count - - No, you aren't looking at COM, move along. - - - - Overridden. - - Another Document Object - True if both Documents have the same Handle - - - - Overridden - - Document Pointer's hashcode - - - - Decreases the document's reference count - - - When the document's reference count reaches 0 Scintilla will destroy the document - - - - - Scintilla's internal document pointer. - - - - - Specifies the display mode of whitespace characters. - - - - - The normal display mode with whitespace displayed as an empty background color. - - - - - Whitespace characters are drawn as dots and arrows. - - - - - Whitespace used for indentation is displayed normally but after the first visible character, it is shown as dots and arrows. - - - - - Returns an HTML #XXXXXX format for a color. Unlike the ColorTranslator class it - never returns named colors. - - - - - Marshals an IntPtr pointing to un unmanaged byte[] to a .NET String using the given Encoding. - - - I'd love to have this as en extension method but ScintillaNET's probably going to be 2.0 for a long - time to come. There's nothing really compelling in later versions that applies to ScintillaNET that - can't be done with a 2.0 construct (extension methods, linq, etc) - - - - - The flags that are stored along with the fold level. - - - - - The base value for a 0-level fold. The fold level is a number in the range 0 to 4095 (NumberMask). - However, the initial fold level is set to Base(1024) to allow unsigned arithmetic on folding levels. - - - - - WhiteFlag indicates that the line is blank and allows it to be treated slightly different then its level may - indicate. For example, blank lines should generally not be fold points and will be considered part - of the preceding section even though they may have a lesser fold level. - - - - - HeaderFlag indicates that the line is a header (fold point). - - - - - Not documented by current Scintilla docs - associated with the removed Box fold style? - - - - - A bit-mask indicating which bits are used to store the actual fold level. - - - - - Determines how whitespace should be displayed in a control. - - - By default, whitespace is determined by the lexer in use. Setting the - or properties overrides the lexer behavior. - - - - - Gets or sets the whitespace background color. - - - By default, the whitespace background color is determined by the lexer in use. - Setting the BackColor to anything other than overrides the lexer behavior. - Transparent colors are not supported. - - - A that represents the background color of whitespace characters. - The default is . - - - The specified has an alpha value that is less that . - - - - - Gets or sets the whitespace foreground color. - - - By default, the whitespace foreground color is determined by the lexer in use. - Setting the ForeColor to anything other than overrides the lexer behavior. - Transparent colors are not supported. - - - A that represents the foreground color of whitespace characters. - The default is . - - - The specified has an alpha value that is less that . - - - - - Gets or sets the whitespace display mode. - - One of the values. The default is - - The specified value is not a valid value. - - - - - Provides data for the UriDropped event - - - - - Initializes a new instance of the UriDroppedEventArgs class. - - Text of the dropped file or uri - - - - Text of the dropped file or uri - - - - - List of strings to be used with . - - - - - Creates a new instance of an OverLoadList - - - - - Creates a new instance of an OverLoadList. The list of overloads is supplied by collection - - - - - Creates a new instance of an OverLoadList. The - - - - - Text of the overload to be displayed in the CallTip - - - - - Index of the overload to be displayed in the CallTip - - - - - Specifies the line layout caching strategy used by a control. - - - - - No line layout data is cached. - - - - - Line layout data of the current caret line is cached. - - - - - Line layout data for all visible lines and the current caret line are cached. - - - - - Line layout data for the entire document is cached. - - - - - Represents casing styles - - - - - Both upper and lower case - - - - - Only upper case - - - - - Only lower case - - - - - Provides data for the LinesNeedShown event - - - - - Initializes a new instance of the LinesNeedShownEventArgs class. - - the first (top) line that needs to be shown - the last (bottom) line that needs to be shown - - - - Returns the first (top) line that needs to be shown - - - - - Returns the last (bottom) line that needs to be shown - - - - - Built in lexers supported by Scintilla - - - - - No lexing is performed, the Containing application must respond to StyleNeeded events - - - - - No lexing is performed - - - - - Required designer variable. - - - - - Clean up any resources being used. - - true if managed resources should be disposed; otherwise, false. - - - - Required method for Designer support - do not modify - the contents of this method with the code editor. - - - - - Provides methods to place data on and retrieve data from the system Clipboard. - - - - - Copies the current selection in the document to the Clipboard. - - - - - Copies the current selection, or the current line if there is no selection, to the Clipboard. - - - Indicates whether to copy the current line if there is no selection. - - - A line copied in this mode is given a "MSDEVLineSelect" marker when added to the Clipboard and - then used in the method to paste the whole line before the current line. - - - - - Copies the specified range of text (bytes) in the document to the Clipboard. - - The zero-based byte position to start copying. - The zero-based byte position to stop copying. - - - - Moves the current document selection to the Clipboard. - - - - - Replaces the current document selection with the contents of the Clipboard. - - - - - Gets a value indicating whether text (bytes) can be copied given the current selection. - - true if the text can be copied; otherwise, false. - This is equivalent to determining if there is a valid selection. - - - - Gets a value indicating whether text (bytes) can be cut given the current selection. - - true if the text can be cut; otherwise, false. - This is equivalent to determining if there is a valid selection. - - - - Gets a value indicating whether the document can accept text currently stored in the Clipboard. - - true if text can be pasted; otherwise, false. - - - - Gets or sets whether pasted line break characters are converted to match the document's end-of-line mode. - - - true if line break characters are converted; otherwise, false. - The default is true. - - - - - Used internally to signify an ignored parameter by overloads of SendMessageDirect - that match the native Scintilla's Message signatures. - - - - - Represents a DropMarker, currently a single document point. - - - - - A range within the editor. Start and End are both Positions. - - - - - Collapses all folds - - - - - Expands all folds - - - - - Removes trailing spaces from each line - - - - - Overridden, changes the document position. Start and End should - match. - - Document _start position - Document _end position - - - - Collects the DropMarker and causes it to be removed from all - lists it belongs ti. - - - - - Overridden. - - - - - Gets the Client Rectangle in pixels of the DropMarker's visual indicator. - - - - - Forces a repaint of the DropMarker - - - - - Overridden. Drop Markers are points, not a spanned range. Though this could change in the future. - - - - - Uniquely identifies the DropMarker - - - - - Not currently used, the offset in pixels from the document view's top. - - - - - Represents a Scintilla text editor control. - - - - - Interface representing the native Scintilla Message Based API. In addition - to wrappers around each of the messages I have included an additional Method - named SendMessageDirect with 9 overloads. This allows you to send messages - to the Scintilla DefWndProc bypassing Windows' SendMessage. Each of the other - methods wrap calls to SendMessageDirect. - - Scintilla explicetly implements this interface. To use these methods on - a Scintilla control Cast it as INativeScintilla or use NativeScintilla - property. - - The reason for this interface is to keep the "regular" interface surface - area of the Scintilla control as clean and .NETish as possible. Also - this means when you want a direct native interface there's no other - absracted members (Aside from SendMessageDirect ;) cluttering the native - interface. - - - - - Handles Scintilla Call Style: - (,) - - Scintilla Message Number - - - - - Handles Scintilla Call Style: - (int,) - - Scintilla Message Number - wParam - - - - - Handles Scintilla Call Style: - (bool,) - - Scintilla Message Number - boolean wParam - - - - - Handles Scintilla Call Style: - (,stringresult) - Notes: - Helper method to wrap all calls to messages that take a char* - in the lParam and returns a regular .NET String. This overload - assumes there will be no wParam and obtains the string _length - by calling the message with a 0 lParam. - - Scintilla Message Number - String output - - - - - This is the primary Native communication method with Scintilla - used by this control. All the other overloads call into this one. - - - - - Handles Scintilla Call Style: - (int,int) - - Scintilla Message Number - wParam - lParam - - - - - Handles Scintilla Call Style: - (int,uint) - - Scintilla Message Number - wParam - lParam - - - - - Handles Scintilla Call Style: - (,int) - - Scintilla Message Number - always pass null--Unused parameter - lParam - - - - - Handles Scintilla Call Style: - (bool,int) - - Scintilla Message Number - boolean wParam - int lParam - - - - - Handles Scintilla Call Style: - (int,bool) - - Scintilla Message Number - int wParam - boolean lParam - - - - - Handles Scintilla Call Style: - (int,stringresult) - Notes: - Helper method to wrap all calls to messages that take a char* - in the lParam and returns a regular .NET String. This overload - assumes there will be no wParam and obtains the string _length - by calling the message with a 0 lParam. - - Scintilla Message Number - String output - - - - - Handles Scintilla Call Style: - (?) - Notes: - Helper method to wrap all calls to messages that take a char* - in the wParam and set a regular .NET String in the lParam. - Both the _length of the string and an additional wParam are used - so that various string Message styles can be acommodated. - - Scintilla Message Number - int wParam - String output - _length of the input buffer - - - - - Handles Scintilla Call Style: - (int,string) - Notes: - This helper method handles all messages that take - const char* as an input string in the lParam. In - some messages Scintilla expects a NULL terminated string - and in others it depends on the string _length passed in - as wParam. This method handles both situations and will - NULL terminate the string either way. - - - Scintilla Message Number - int wParam - string lParam - - - - - Handles Scintilla Call Style: - (,string) - - Notes: - This helper method handles all messages that take - const char* as an input string in the lParam. In - some messages Scintilla expects a NULL terminated string - and in others it depends on the string _length passed in - as wParam. This method handles both situations and will - NULL terminate the string either way. - - - Scintilla Message Number - always pass null--Unused parameter - string lParam - - - - - Handles Scintilla Call Style: - (string,string) - - Notes: - Used by SCI_SETPROPERTY - - Scintilla Message Number - string wParam - string lParam - - - - - Handles Scintilla Call Style: - (string,stringresult) - - Notes: - This one is used specifically by SCI_GETPROPERTY and SCI_GETPROPERTYEXPANDED - so it assumes it's usage - - - Scintilla Message Number - string wParam - Stringresult output - - - - - Handles Scintilla Call Style: - (string,int) - - Scintilla Message Number - string wParam - int lParam - - - - - Handles Scintilla Call Style: - (string,) - - Scintilla Message Number - string wParam - - - - - Enables the brace matching from current position. - - - - - Adds a line _end marker to the _end of the document - - - - - Appends a copy of the specified string to the _end of this instance. - - The to append. - A representing the appended text. - - - - Creates and returns a new object. - - A new object. - - - - Creates and returns a new object. - - A new object. - - - - Sends the specified message directly to the native Scintilla window, - bypassing any managed APIs. - - The message ID. - The message wparam field. - The message lparam field. - An representing the result of the message request. - - Warning: The Surgeon General Has Determined that Calling the Underlying Scintilla - Window Directly May Result in Unexpected Behavior! - - - The method was called from a thread other than the thread it was created on. - - - - - Overridden. Releases the unmanaged resources used by the and - its child controls and optionally releases the managed resources. - - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - - Exports a HTML representation of the current document. - - A containing the contents of the document formatted as HTML. - Only ASCII documents are supported. Other encoding types have undefined behavior. - - - - Exports a HTML representation of the current document. - - The with which to write. - The title of the HTML document. - - true to output all styles including those not - used in the document; otherwise, false. - - Only ASCII documents are supported. Other encoding types have undefined behavior. - - - - Gets the text of the line containing the caret. - - A representing the text of the line containing the caret. - - - - Gets the text of the line containing the caret and the current caret position within that line. - - When this method returns, contains the byte offset of the current caret position with the line. - A representing the text of the line containing the caret. - - - - Gets a word from the specified position - - - - - Inserts text at the current cursor position - - Text to insert - The range inserted - - - - Inserts text at the given position - - The position to insert text in - Text to insert - The text range inserted - - - - Overridden. See . - - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Overridden. See . - - - - - Raises the event. - - An that contains the event data. - - - - Provides the support for code block selection - - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Overridden. See . - - - - - Overridden. Raises the event. - - An that contains the event data. - - - - Raises the event. - - A that contains the event data. - - - - Raises the event. - - A that contains the event data. - - - - Raises the event. - - A that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Overridden. See . - - - - - Overridden. See . - - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Overridden. See . - - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Overridden. See . - - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Raises the event. - - An that contains the event data. - - - - Checks that if the specified position is on comment. - - - - - Checks that if the specified position is on comment. - - - - - Overridden. See . - - - - - Custom way to find the matching brace when BraceMatch() does not work - - - - - Sets the application-wide default module name of the native Scintilla library. - - The native Scintilla module name. - This method must be called prior to the first control being created. - The is null. - The is an empty string. - This method was called after the first control was created. - - - - Overridden. Processes Windows messages. - - The Windows to process. - - - - Gets or sets a value indicating whether pressing ENTER creates a new line of text in the - control or activates the default button for the form. - - - true if the ENTER key creates a new line of text; false if the ENTER key activates - the default button for the form. The default is false. - - - - - Gets or sets a value indicating whether pressing the TAB key types a TAB character in the control - instead of moving the focus to the next control in the tab order. - - - true if users can enter tabs using the TAB key; false if pressing the TAB key - moves the focus. The default is false. - - - - - Gets a collection containing all annotations in the control. - - - A that contains all the annotations in the control. - - - - - Controls autocompletion behavior. - - - - - Gets or sets the background color for the control. - - - A that represents the background color of the control. - The default is . - - Settings this property resets any current document styling. - - - - This property is not relevant for this class. - - - - - This property is not relevant for this class. - - - - - Gets or sets the border style of the control. - - - A that represents the border type of the control. - The default is . - - - The value assigned is not one of the values. - - - - - Manages CallTip (Visual Studio-like code Tooltip) behaviors - - - - - Gets/Sets the Win32 Window Caption. Defaults to Type's FullName - - - - - Controls Caret Behavior - - - - - Gets Clipboard access for the control. - - A object the provides Clipboard access for the control. - - - - Controls behavior of keyboard bound commands. - - - - - Controls behavior of loading/managing ScintillaNET configurations. - - - - - Overridden. See . - - - - - Gets or sets the character index of the current caret position. - - The character index of the current caret position. - - - Gets or sets the default cursor for the control. - An object of type representing the current default cursor. - - - - Overridden. See . - - - - - Controls behavior of Documents - - - - - Controls behavior of automatic document navigation - - - - - Controls behavior of Drop Markers - - - - - Controls Encoding behavior - - - - - Controls End Of Line Behavior - - - - - Gets or sets the font of the text displayed by the control. - - - The to apply to the text displayed by the control. - The default is the value of the property. - - Settings this property resets any current document styling. - - - - Gets or sets the foreground color of the control. - - - The foreground of the control. - The default is . - - Settings this property resets any current document styling. - - - - Gets or sets the line layout caching strategy in a control. - - - One of the enumeration values. - The default is . - - - The value assigned is not one of the values. - - Larger cache sizes increase performance at the expense of memory. - - - - Gets an object that controls line wrapping options in the control. - - A object that manages line wrapping options in a control. - - - - Gets a collection representing the marker objects and options within the control. - - A representing the marker objects and options within the control. - - - - Gets or sets a value that indicates that the control has been modified by the user since - the control was created or its contents were last set. - - - true if the control's contents have been modified; otherwise, false. - The default is false. - - - - - Gets or sets the position cache size used to layout short runs of text in a control. - - The size of the position cache in bytes. The default is 1024. - Larger cache sizes increase performance at the expense of memory. - - - - Gets or sets a value indicating whether characters not considered alphanumeric (ASCII values 0 through 31) - are prevented as text input. - - - true to prevent control characters as input; otherwise, false. - The default is true. - - - - - Gets or sets the current text in the control. - - The text displayed in the control. - - - - Gets the _length of text in the control. - - The number of characters contained in the text of the control. - - - - Gets the display mode and style behavior associated with the control. - - A object that represents whitespace display mode and style behavior in a control. - - - - Gets or sets the current zoom level of the control. - - The factor by which the contents of the control is zoomed. - - - - Occurs when an annotation has changed. - - - - - Occurs when the user makes a selection from the auto-complete list. - - - - - Occurs when text is about to be removed from the document. - - - - - Occurs when text is about to be inserted into the document. - - - - - Occurs when the value of the property has changed. - - - - - Occurs when a user clicks on a call tip. - - - - - Occurs when the user types an ordinary text character (as opposed to a command character) into the text. - - - - - Occurs when the text or styling of the document changes or is about to change. - - - - - Occurs when a is about to be collected. - - - - - Occurs when a user actions such as a mouse move or key press ends a dwell (hover) activity. - - - - - Occurs when the user hovers the mouse (dwells) in one position for the dwell period. - - - - - Occurs when a folding change has occurred. - - - - - Occurs when a user clicks on text that is in a style with the hotspot attribute set. - - - - - Occurs when a user double-clicks on text that is in a style with the hotspot attribute set. - - - - - Occurs when a user releases a click on text that is in a style with the hotspot attribute set. - - - - - Occurs when the a clicks or releases the mouse on text that has an indicator. - - - - - Occurs when a range of lines that is currently invisible should be made visible. - - - - - Occurs when the control is first loaded. - - - - - Occurs each time a recordable change occurs. - - - - - Occurs when the mouse was clicked inside a margin that was marked as sensitive. - - - - - Occurs when one or more markers has changed in a line of text. - - - - - - Occurs when a user tries to modify text when in read-only mode. - - - - - Occurs when the control is scrolled. - - - - - Occurs when the selection has changed. - - - - - Occurs when the control is about to display or print text that requires styling. - - - - - Occurs when text has been removed from the document. - - - - - Occurs when text has been inserted into the document. - - - - - Occurs when the user zooms the display using the keyboard or the property is set. - - - - - Holds the last previous selection's properties, to let us know when we should fire SelectionChanged - - - - - Type of data to display at one of the positions in a Page Information section - - - - - Nothing is displayed at the position - - - - - The page number is displayed in the format "Page #" - - - - - The document name is displayed - - - - - Style of Indicator to be displayed - - - - - Underline - - - - - Squigly lines (commonly used for spellcheck) - - - - - Small t's are displayed - - - - - Small diagnol lines - - - - - Strikethrough line - - - - - Hidden - - - - - Displayes a bounding box around the indicated text - - - - - Displayes a bounding box around the indicated text with rounded corners - and an translucent background color - - - - - Provides data for the , , and - events. - - - - - Initializes a new instance of the class. - - The byte offset in the document of the character that was clicked. - - - - Gets the byte offset in the document of the character that was clicked. - - An representing the byte offset in the document of the character that was clicked. - - - - Required designer variable. - - - - - Clean up any resources being used. - - true if managed resources should be disposed; otherwise, false. - - - - Required method for Designer support - do not modify - the contents of this method with the code editor. - - - - - Class for determining how and what to print for a header or footer. - - - - - Default font used for Page Information sections - - - - - Draws the page information section in the specified rectangle - - - - - - - - - Default Constructor - - - - - Full Constructor - - Margin to use - Font to use - Border style - What to print on the left side of the page - What to print in the center of the page - What to print on the right side of the page - - - - Normal Use Constructor - - Border style - What to print on the left side of the page - What to print in the center of the page - What to print on the right side of the page - - - - Border style used for the Page Information section - - - - - Information printed in the center of the Page Information section - - - - - Whether there is a need to display this item, true if left, center, or right are not nothing. - - - - - Font used in printing the Page Information section - - - - - Height required to draw the Page Information section based on the options selected. - - - - - Information printed on the left side of the Page Information section - - - - - Space between the Page Information section and the rest of the page - - - - - Information printed on the right side of the Page Information section - - - - - Default Constructor - - - - - Full Constructor - - Margin to use - Font to use - Border style - What to print on the left side of the page - What to print in the center of the page - What to print on the right side of the page - - - - Normal Use Constructor - - Border style - What to print on the left side of the page - What to print in the center of the page - What to print on the right side of the page - - - - Specifies the symbol displayed by a . - - - - - The marker is drawn as a circle. - - - - - The marker is drawn as a rectangle with rounded edges. - - - - - The marker is drawn as a triangle pointing right. - This symbol is typically used to mark a closed folder. - - - - - The marker is drawn as a horizontal rectangle. - - - - - The marker is drawn as a small arrow pointing right. - - - - - The marker has no visible glpyh. - This symbol can still be used, however, to mark and track lines. - - - - - The marker is drawn as a triangle pointing down. - This symbol is typically used to mark an open folder. - - - - - The marker is drawn as a minus sign. - This symbol is typically used to mark an open folder. - - - - - The marker is drawn as a plus sign. - This symbol is typically used to mark a closed folder. - - - - - The marker is drawn as a vertical line. - This symbol is typically used to mark nested lines of an open folder. - - - - - The marker is drawn as straight lines intersecting in an "L" shape. - This symbol is typically used to mark the end of a folder in a "box style" tree. - - - - - The marker is drawn as straight lines intersecting in a rotated "T" shape. - This symbol is typically used to mark the end of a nested folder in a "box style" tree. - - - - - The marker is drawn as a plus sign surrounded by a rectangle. - This symbol is typically used to mark a closed folder in a "box style" tree. - - - - - The marker is drawn as a plus sign surrounded by a rectangle and vertial lines. - This symbol is typically used to mark a nested closed folder in a "box style" tree. - - - - - The marker is drawn as a minus sign surrounded by a rectangle and a vertical line at the bottom. - This symbol is typically used to mark an open folder in a "box style" tree. - - - - - The marker is drawn as a minus sign surrounded by a rectangle and vertical lines. - This symbol is typically used to mark a nested open folder in a "box style" tree. - - - - - The marker is drawn as curved lines intersecting in an "L" shape. - This symbol is typically used to mark the end of a folder in a "circle style" tree. - - - - - The marker is drawn as curved lines intersecting in a rotated "T" shape. - This symbol is typically used to mark the end of a nested folder in a "circle style" tree. - - - - - The marker is drawn as a plus sign surrounded by a circle. - This symbol is typically used to mark a closed folder in a "circle style" tree. - - - - - The marker is drawn as a plus sign surrounded by a circle and vertial lines. - This symbol is typically used to mark a nested closed folder in a "circle style" tree. - - - - - The marker is drawn as a minus sign surrounded by a circle and a vertical line at the bottom. - This symbol is typically used to mark an open folder in a "circle style" tree. - - - - - The marker is drawn as a minus sign surrounded by a circle and vertical lines. - This symbol is typically used to mark a nested open folder in a "circle style" tree. - - - - - The marker has no visible glyph, however, the background color of the entire text line - is drawn as specified in the property. - - - - - This marker is drawn as three horizontal dots. - - - - - The marker is drawn as three consecutive greater than glyphs. - - - - - The marker is drawn using the image specified in the method. - - - - - The marker has no visible glyph, however, the margin background color is draw as - specified in the property. - - - - - The marker is drawn as a thick vertical line along the left edge of the margin. - - - - - The marker has no visible glyph, however, it can be used to signify to a plugin - that the marker is available for a custom purpose. - - - - - The marker has no visible glyph, however, the entire text line is drawn with an underline in - the color specified by the property. - - - - - Document's EndOfLine Mode - - - - - Carriage Return + Line Feed (Windows Style) - - - - - Carriage Return Only (Mac Style) - - - - - Line Feed Only (Unix Style) - - - - - Provides data for the AutoCompleteAccepted event - - - - - Initializes a new instance of the AutoCompleteAcceptedEventArgs class. - - Text of the selected autocomplete entry selected - - - - Gets/Sets if the autocomplete action should be cancelled - - - - - Text of the selected autocomplete entry selected - - - - - Returns the _start position of the current word in the document. - - - This controls how many characters of the selected autocomplete entry - is actually inserted into the document - - - - - Gets or sets the first visible line in a control. - - The zero-based index of the first visible line in a control. - The value is a visible line rather than a document line. - - - - Represents a collection of objects and options in a control. - - - - - Manages End of line settings for the Scintilla Control - - - - - Converts all lines in the document to the given mode. - - The EndOfLineMode to convert all lines to - - - - Return as a string the characters used to mean _end-of-line. This depends solely on the - selected EOL mode. - - Should Mode not be CR, LF or CrLf, this function returns the empty string. - - - - Gets/Sets if End of line markers are visible in the Scintilla control. - - - - - Gets/Sets the for the document. Default is CrLf. - - - Changing this value does NOT change all EOL marks in a currently-loaded document. - To do this, use ConvertAllLines. - - - - - Initializes a new instance of the KeyWordConfig class. - - - - - - - - The style of visual indicator that the caret displayes. - - - - - The caret is not displayed - - - - - A vertical line is displayed - - - - - A horizontal block is displayed that may cover the character. - - - - - Used to invoke AutoComplete and UserList windows. Also manages AutoComplete - settings. - - - Autocomplete is typically used in IDEs to automatically complete some kind - of identifier or keyword based on a partial name. - - - - - Accepts the current AutoComplete window entry - - - If the AutoComplete window is open Accept() will close it. This also causes the - event to fire - - - - - Cancels the autocomplete window - - - If the AutoComplete window is displayed calling Cancel() will close the window. - - - - - Deletes all registered images. - - - - - Registers an image with index to be displayed in the AutoComplete window. - - Index of the image to register to - Image to display in Bitmap format - - - - Registers an image with index to be displayed in the AutoComplete window. - - Index of the image to register to - Image to display in the XPM image format - Color to mask the image as transparent - - - - Registers an image with index to be displayed in the AutoComplete window. - - Index of the image to register to - Image in the XPM image format - - - - Registers a list of images to be displayed in the AutoComplete window. - - List of images in the Bitmap image format - Indecis are assigned sequentially starting at 0 - - - - Registers a list of images to be displayed in the AutoComplete window. - - List of images in the Bitmap image format - Color to mask the image as transparent - Indecis are assigned sequentially starting at 0 - - - - Registers a list of images to be displayed in the AutoComplete window. - - List of images in the XPM image format - Indecis are assigned sequentially starting at 0 - - - - Registers a list of images to be displayed in the AutoComplete window. - - List of images contained in an ImageList - Indecis are assigned sequentially starting at 0 - - - - Registers a list of images to be displayed in the AutoComplete window. - - List of images contained in an ImageList - Color to mask the image as transparent - Indecis are assigned sequentially starting at 0 - - - - Shows the autocomplete window. - - - This overload assumes that the property has been - set. The lengthEntered is automatically detected by the editor. - - - - - Shows the autocomplete window - - - Sets the property. - In this overload the lengthEntered is automatically detected by the editor. - - - - - Shows the autocomplete window - - Number of characters of the current word already entered in the editor - - This overload assumes that the property has been set. - - - - - Shows the autocomplete window - - Number of characters of the current word already entered in the editor - Sets the property. - - - - Shows the autocomplete window. - - Number of characters of the current word already entered in the editor - Sets the property. - - - - Shows the autocomplete window. - - Sets the property. - - In this overload the lengthEntered is automatically detected by the editor. - - - - - Shows a UserList window - - Index of the userlist to show. Can be any integer - List of words to show. - - UserLists are not as powerful as autocomplete but can be assigned to a user defined index. - - - - - Shows a UserList window - - Index of the userlist to show. Can be any integer - List of words to show separated by " " - - UserLists are not as powerful as autocomplete but can be assigned to a user defined index. - - - - - By default, the list is cancelled if there are no viable matches (the user has typed characters that no longer match a list entry). - If you want to keep displaying the original list, set AutoHide to false. - - - - - Gets or Sets the last automatically calculated LengthEntered used whith . - - - - - The default behavior is for the list to be cancelled if the caret moves before the location it was at when the list was displayed. - By setting this property to false, the list is not cancelled until the caret moves before the first character of the word being completed. - - - - - When an item is selected, any word characters following the caret are first erased if dropRestOfWord is set to true. - - Defaults to false - - - - List of characters (no separated) that causes the AutoComplete window to accept the current - selection. - - - - - Autocompletion list items may display an image as well as text. Each image is first registered with an integer type. - Then this integer is included in the text of the list separated by a '?' from the text. For example, "fclose?2 fopen" - displays image 2 before the string "fclose" and no image before "fopen". - - - - - Returns wether or not the AutoComplete window is currently displayed - - - - - Gets or Sets if the comparison of words to the AutoComplete are case sensitive. - - Defaults to true - - - - Gets the document posision when the AutoComplete window was last invoked - - - - - List if words to display in the AutoComplete window when invoked. - - - - - Character used to split to convert to a List. - - - - - List of words to display in the AutoComplete window. - - - The list of words separated by which - is " " by default. - - - - - Get or set the maximum number of rows that will be visible in an autocompletion list. If there are more rows in the list, then a vertical scrollbar is shown - - Defaults to 5 - - - - Get or set the maximum width of an autocompletion list expressed as the number of characters in the longest item that will be totally visible. - - - If zero (the default) then the list's width is calculated to fit the item with the most characters. Any items that cannot be fully displayed - within the available width are indicated by the presence of ellipsis. - - - - - Gets or Sets the index of the currently selected item in the AutoComplete - - - - - Gets or Sets the Text of the currently selected AutoComplete item. - - - When setting this property it does not change the text of the currently - selected item. Instead it searches the list for the given value and selects - that item if it matches. - - - - - If you set this value to true and a list has only one item, it is automatically added and no list is displayed. - The default is to display the list even if there is only a single item. - - - - - List of characters (no separator) that causes the AutoComplete window to cancel. - - - - - Struct used for specifying the printing bounds - - - - - Left X Bounds Coordinate - - - - - Top Y Bounds Coordinate - - - - - Right X Bounds Coordinate - - - - - Bottom Y Bounds Coordinate - - - - - Provides data for native Scintilla Events - - - All events fired from the INativeScintilla Interface uses - NativeScintillaEventArgs. Msg is a copy - of the Notification Message sent to Scintilla's Parent WndProc - and SCNotification is the SCNotification Struct pointed to by - Msg's lParam. - - - - - Initializes a new instance of the NativeScintillaEventArgs class. - - Notification Message sent from the native Scintilla - SCNotification structure sent from Scintilla that contains the event data - - - - Notification Message sent from the native Scintilla - - - - - SCNotification structure sent from Scintilla that contains the event data - - - - - Mostly behaves like a stack but internally maintains a List for more flexability - - - FakeStack is not a general purpose datastructure and can only hold NavigationPoint objects - - - - - Specifies the visibility and appearance of annotations in a control. - - - - - Annotations are not displayed. - - - - - Annotations are drawn left-justified with no adorment. - - - - - Annotations are indented to match the text and are surrounded by a box. - - - - - Specifies the locations of line wrapping visual glyphs in a control. - - - - - Line wrapping glyphs are drawn near the control border. - - - - - Line wrapping glyphs are drawn at the end of wrapped lines near the text. - - - - - Line wrapping glyphs are drawn at the start of wrapped lines near the text. - - - - - Contains Undo/Redo information, used by many of the events - - - - - Was this action the result of an undo action - - - - - Was this action the result of a redo action - - - - - Is this part of a multiple undo or redo - - - - - Is this the last step in an undi or redo - - - - - Does this affect multiple lines - - - - - Overridden - - - - - Initializes a new instance of the UndoRedoFlags structure. - - Was this action the result of an undo action - Was this action the result of a redo action - Is this part of a multiple undo or redo - Is this the last step in an undi or redo - Does this affect multiple lines - - - - Style of smart indent - - - - - No smart indent - - - - - C++ style indenting - - - - - Alternate C++ style indenting - - - - - Block indenting, the last indentation is retained in new lines - - - - - Required designer variable. - - - - - Clean up any resources being used. - - true if managed resources should be disposed; otherwise, false. - - - - Required method for Designer support - do not modify - the contents of this method with the code editor. - - - - - ScintillaNET derived class for handling printing of source code from a Scintilla control. - - - - - Method called after the Print method is called and before the first page of the document prints - - A PrintPageEventArgs that contains the event data - - - - Method called when the last page of the document has printed - - A PrintPageEventArgs that contains the event data - - - - Method called when printing a page - - A PrintPageEventArgs that contains the event data - - - - Default Constructor - - Scintilla control being printed - - - - Represents a point in the document used for navigation. - - - - - Overridden. - - - - - Initializes a new instance of the NavigationPont class. - - - - - Provides data for the FoldChanged event - - - - - Initializes a new instance of the FoldChangedEventArgs class. - - Line # that the fold change occured on - new Fold Level of the line - previous Fold Level of the line - What kind of fold modification occured - - - - Gets/Sets the Line # that the fold change occured on - - - - - Gets the new Fold Level of the line - - - - - Gets the previous Fold Level of the line - - - - - Used to display CallTips and Manages CallTip settings. - - - CallTips are a special form of ToolTip that can be displayed specifically for - a document position. It also display a list of method overloads and - highlighight a portion of the message. This is useful in IDE scenarios. - - - - - Hides the calltip - - - and do the same thing - - - - - Hides the calltip - - - and do the same thing - - - - - Displays a calltip without overloads - - - The must already be populated. The calltip will be displayed at the current document position - with no highlight. - - - - - Displays a calltip without overloads - - Start posision of the part of the message that should be selected - End posision of the part of the message that should be selected - - The must already be populated. The calltip will be displayed at the current document position - - - - - Displays a calltip without overloads - - The document position to show the calltip - - The must already be populated. The calltip with no highlight - - - - - Displays a calltip without overloads - - The document position to show the calltip - Start posision of the part of the message that should be selected - End posision of the part of the message that should be selected - - The must already be populated. - - - - - Displays a calltip without overloads - - The calltip message to be displayed - - The calltip will be displayed at the current document position with no highlight - - - - - Displays a calltip without overloads - - The calltip message to be displayed - Start posision of the part of the message that should be selected - End posision of the part of the message that should be selected - - The calltip will be displayed at the current document position - - - - - Displays a calltip without overloads - - The calltip message to be displayed - The document position to show the calltip - - The calltip will be displayed with no highlight - - - - - Displays a calltip without overloads - - The calltip message to be displayed - The document position to show the calltip - Start posision of the part of the message that should be selected - End posision of the part of the message that should be selected - - - - Shows the calltip with overloads - - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The must already be populated. It will be displayed at the current document - position starting at overload 0 with no highlight. - - - - - Shows the calltip with overloads - - Start posision of the part of the message that should be selected - End posision of the part of the message that should be selected - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The must already be populated. It will be displayed at the current document - position starting at overload 0 - - - - - Shows the calltip with overloads - - The document position where the calltip should be displayed - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The must already be populated. The overload at position 0 will be displayed - with no highlight. - - - - - Shows the calltip with overloads - - The document position where the calltip should be displayed - Start posision of the part of the message that should be selected - End posision of the part of the message that should be selected - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The must already be populated. The overload at position 0 will be displayed. - - - - - Shows the calltip with overloads - - The document position where the calltip should be displayed - The index of the initial overload to display - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The must already be populated. It will be displayed at the current document - position with no highlight - - - - - Shows the calltip with overloads - - The document position where the calltip should be displayed - The index of the initial overload to display - Start posision of the part of the message that should be selected - End posision of the part of the message that should be selected - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The must already be populated. - - - - - Shows the calltip with overloads - - List of overloads to be displayed see - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The current document position will be used starting at position 0 with no highlight - - - - - Shows the calltip with overloads - - List of overloads to be displayed see - Start posision of the part of the message that should be selected - End posision of the part of the message that should be selected - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The current document position will be used starting at position 0 - - - - - Shows the calltip with overloads - - List of overloads to be displayed see - The document position where the calltip should be displayed - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The overload startIndex will be 0 with no Highlight - - - - - Shows the calltip with overloads - - List of overloads to be displayed see - The document position where the calltip should be displayed - Start posision of the part of the message that should be selected - End posision of the part of the message that should be selected - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The overload startIndex will be 0 - - - - - Shows the calltip with overloads - - List of overloads to be displayed see - The document position where the calltip should be displayed - The index of the initial overload to display - Start posision of the part of the message that should be selected - End posision of the part of the message that should be selected - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - - - - - Shows the calltip with overloads - - List of overloads to be displayed see - The index of the initial overload to display - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The current document position will be used with no highlight - - - - - Shows the calltip with overloads - - List of overloads to be displayed see - The index of the initial overload to display - Start posision of the part of the message that should be selected - End posision of the part of the message that should be selected - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The current document position will be used - - - - - Shows the calltip with overloads - - The index of the initial overload to display - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The must already be populated. It will be displayed at the current document - position with no highlight. - - - - - Shows the calltip with overloads - - The index of the initial overload to display - Start posision of the part of the message that should be selected - End posision of the part of the message that should be selected - - ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the - up and down arrows and cycles through the list of overloads in response to mouse clicks. - The must already be populated. It will be displayed at the current document - position. - - - - - Gets/Sets the background color of all CallTips - - - - - Gets/Sets Text color of all CallTips - - - - - End position of the text to be highlighted in the CalTip - - - - - Start position of the text to be highlighted in the CalTip - - - - - Gets/Sets the Text Color of the portion of the CallTip that is highlighted - - - - - Returns true if a CallTip is currently displayed - - - - - The message displayed in the calltip - - - - - List of method overloads to display in the calltip - - - This is used to display IDE type toolips that include Up/Down arrows that cycle - through the list of overloads when clicked - - - - - Provices data for the TextModified event - - - TextModifiedEventHandler is used as an abstracted subset of the - SCN_MODIFIED notification message. It's used whenever the SCNotification's - modificationType flags are SC_MOD_INSERTTEXT ,SC_MOD_DELETETEXT, - SC_MOD_BEFOREINSERT and SC_MOD_BEFORE_DELETE. They all use a - TextModifiedEventArgs which corresponds to a subset of the - SCNotification struct having to do with these modification types. - - - - - Overridden. - - - - - Initializes a new instance of the TextModifiedEventArgs class. - - document position where the change occured - _length of the change occured - the # of lines added or removed as a result of the change - affected text of the change - true if the change was a direct result of user interaction - the line # of where the marker change occured (if applicable) - - - - Returns true if the change was a direct result of user interaction - - - - - Returns the length of the change occured. - - - - - Returns the # of lines added or removed as a result of the change - - - - - Returns the line # of where the marker change occured (if applicable) - - - - - Returns the document position where the change occured - - - - - The affected text of the change - - - - - Defines a run of styled text in a control - - - - - Represents a new instance of the struct with member data left uninitialized. - - - - - Initializes a new instance of the struct. - - The length of the run. - The zero-based index of the style that the run represents. - - - - Gets or sets length of this . - - An representing the length of this . - - - - Gets or sets the style index of this . - - An representing the zero-based style index of this . - - - - Provides data for the MarkerChanged event - - - - - Initializes a new instance of the LinesNeedShownEventArgs class. - - Line number where the marker change occured - What type of Scintilla modification occured - - - - Returns the line number where the marker change occured - - - - - Required designer variable. - - - - - Clean up any resources being used. - - true if managed resources should be disposed; otherwise, false. - - - - Required method for Designer support - do not modify - the contents of this method with the code editor. - - - - - Controls color mode fore printing - - - - - Normal - - - - - Inverts the colors - - - - - Black Text on white background - - - - - Styled color text on white background - - - - - Styled color text on white background for unstyled background colors - - - - - Provides data for the MarginClick event - - - - - Initializes a new instance of the MarginClickEventArgs class. - - - Any Modifier keys (shift, alt, ctrl) that were in use at the - time the click event occured - - Document position of the line where the click occured - Document line # where the click occured - Margin where the click occured - marker number that should be toggled in result of the click - Whether the fold at the current line should be toggled - - - - Returns the Document line # where the click occured - - - - - Returns the Margin where the click occured - - - - - Returns any Modifier keys (shift, alt, ctrl) that were in use at the - time the click event occured - - - - - Returns the Document position of the line where the click occured - - - - - Gets/Sets whether the fold at the current line should be toggled - - - - - Gets/Sets the marker number that should be toggled in result of the click - - - - - Controls line wrapping options in a control. - - - - - The number of lines displayed when a line of text is wrapped. - - The zero-based index of the line to count. - The numbers of display lines the line of text occupies. - - - - Forces the line range specified to wrap at the given pixel width. This operates independently - of the current line wrapping property. - - The zero-based line index to start wrapping. - The zero-based line index to stop wrapping. - - The maximum width in pixels of the lines to wrap. A value of zero resets forced line wrapping. - - - - - Initializes a new instance of the class. - - The control that created this object. - - - - Gets or sets how wrapped lines are indented. - - - One of the values. - The default is . - - - The value assigned is not one of the values. - - - - - Gets or sets the size that wrapped lines are indented when is . - - An representing the size (in characters) that wrapped lines are indented. - The value is less that zero or greater than 256. - - - - Gets or sets how and whether line wrapping is performed. - - - One of the values. - The default is . - - - The value assigned is not one of the values. - - - - - Gets or sets the visual glyphs displayed on wrapped lines. - - - A bitwise combination of the values. - The default is . - - - - - Gets or sets the location of visual glyphs displayed on wrapped lines. - - - A bitwise combination of the values. - The default is . - - - - - Enables the Smart Indenter so that On enter, it indents the next line. - - - - - For Custom Smart Indenting, assign a handler to this delegate property. - - - - - If Smart Indenting is enabled, this delegate will be added to the CharAdded multicast event. - - - - - Smart Indenting helper method - - - - - How long lines are visually indicated - - - - - No indication - - - - - A vertical line is displayed - - - - - The background color changes - - - - - Manages Document Navigation, which is a snapshot history of movements within - a document. - - - - - Causes the current position to navigate to the last snapshotted document position. - - - - - After 1 or more backwards navigations this command navigates to the previous - backwards navigation point. - - - - - List of entries that allow you to navigate backwards. - - - The ForwardStack and BackwardStack can be shared between multiple - ScintillaNET objects. This is useful in MDI applications when you wish - to have a shared document navigation that remembers positions in each - document. - - - - - Returns true if ScintillaNET can perform a successful backward navigation. - - - - - Returns true if ScintillaNET can perform a successful forward navigation. - - - - - List of entries that allow you to navigate forwards. - - - The ForwardStack and BackwardStack can be shared between multiple - ScintillaNET objects. This is useful in MDI applications when you wish - to have a shared document navigation that remembers positions in each - document. - - - - - Gets/Sets whether Document Navigation is tracked. Defaults to true. - - - - - Maximum number of places the document navigation remembers. Defaults to 50. - - - When the max value is reached the oldest entries are removed. - - - - - Time in milliseconds to wait before a Navigation Point is set. Default is 200 - - - In text editing, the current caret position is constantly changing. Rather than capture every - change in position, ScintillaNET captures the current position [NavigationPointTimeout]ms after a - position changes, only then is it eligable for another snapshot - - - - - Initializes a new instance of the CommandBindingConfig structure. - - - - - The CharacterSet used by the document - - - - - Provides data for the MacroRecorded event - - - - - Initializes a new instance of the MacroRecordEventArgs class. - - the recorded window message that can be sent back to the native Scintilla window - - - - Initializes a new instance of the MacroRecordEventArgs class. - - NativeScintillaEventArgs object containing the message data - - - - Returns the recorded window message that can be sent back to the native Scintilla window - - - - - Read or change the Flags associated with a fold. The default value is 0. - - - - - Read or change the Fold Marker Scheme. This changes the way Scintilla displays folds - in the control. The default is BoxPlusMinus and the value Custom can be used to disable - ScintillaNET changing selections made directly using MarkerCollection.FolderXX methods. - - - - - Read or change the value controlling whether to use compact folding from the lexer. - - This tracks the property "fold.compact" - - - - Manages DropMarkers, a Stack Based document bookmarking system. - - - - - Collects the last dropped DropMarker - - - When a DropMarker is collected the current document posision is moved - to the DropMarker posision, the DropMarker is removed from the stack - and the visual indicator is removed. - - - - - Drops a DropMarker at the current document position - - - Dropping a DropMarker creates a visual marker (red triangle) - indicating the DropMarker point. - - The newly created DropMarker - - - - Drops a DropMarker at the specified document position - - - The newly created DropMarker - - Dropping a DropMarker creates a visual marker (red triangle) - indicating the DropMarker point. - - - - - Gets/Sets a list of All DropMarkers specific to this Scintilla control - - - - - Gets/Sets the Stack of DropMarkers - - - You can manually set this to implement your own shared DropMarker stack - between Scintilla Controls. - - - - - - Gets/Sets a shared name associated with other Scintilla controls. - - - All Scintilla controls with the same SharedStackName share a common - DropMarker stack. This is useful in MDI applications where you want - the DropMarker stack not to be specific to one document. - - - - - Manages the Native Scintilla's Document features. - - - See Scintilla's documentation on multiple views for an understanding of Documents. - Note that all ScintillaNET specific features are considered to be part of the View, not document. - - - - - Creates a new Document - - - - - - Gets/Sets the currently loaded Document - - - - - Manages Caret Settings - - - The caret is the blinking line that indicates the current document position. This - is sometimes referred to as cursor. - - - - - Places the caret somewhere within the document that is displayed in the - Scintilla Window - - - If the caret is already visible in the current scrolled view this method does - nothing. - - - - - Scintilla remembers the x value of the last position horizontally moved to explicitly by the user and this value is then - used when moving vertically such as by using the up and down keys. This method sets the current x position of the caret as - the remembered value. - - - - - Scrolls the Scintilla window so that the Caret is visible. - - - - - Places the caret at the specified document position - - Position in the document to place the caret - - - - Gets/Sets the current anchor position - - - If the anchor position is less than the Caret Position it acts as the _start of - the selection. - - - - - Gets/Sets the time interval in milliseconds that the caret should blink. - - - This defaults to the system default value. - - - - - Gets/Sets the color of the Caret. - - Defaults to black - - - - Gets/Sets the transparency alpha of the CurrentLine Background highlight - - - Values range from 0 to 256. Default is 256. - - - - - Gets/Sets the color of the document line where the caret currently resides - - - The property must be set to true in order - for this to to take effect. - - - - - Gets/Sets if the current document line where the caret resides is highlighted. - - - determines the color. - - - - - Controls when the last position of the caret on the line is saved. When set to true, the position is not saved when you type a character, a tab, paste the clipboard content or press backspace - - - Defaults to false - - - - - Gets/Sets the current Line Number that the caret resides. - - - - - Gets/Sets the current document position where the caret resides - - - - - Gets/Sets the displayed. - - - - - Gets/Sets the width in pixels of the Caret - - - This defaults to the system default. - - - - - Provides data for the CallTipClick event - - - - - Initializes a new instance of the CallTipClickEventArgs class. - - CallTipArrow clicked - Current posision of the overload list - New position of the overload list - List of overloads to be cycled in the calltip - Start position of the highlighted text - End position of the highlighted text - - - - Returns the CallTipArrow that was clicked - - - - - Gets/Sets if the CallTip should be hidden - - - - - Gets the current index of the CallTip's overload list - - - - - Gets/Sets the _end position of the CallTip's highlighted portion of text - - - - - Gets/Sets the _start position of the CallTip's highlighted portion of text - - - - - Gets/Sets the new index of the CallTip's overload list - - - - - Returns the OverLoad list of the CallTip - - - - - Specifies how line wrapping visual glyphs are displayed in a control. - - - - - No line wrapping glyphs are displayed. - - - - - Line wrapping glyphs are displayed at the end of wrapped lines. - - - - - Line wrapping glyphs are displayed at the start of wrapped lines. This also has - the effect of indenting the line by one additional unit to accommodate the glyph. - - - - - This matches the Win32 NMHDR structure - - - - - Represents the Binding Combination of a Keyboard Key + Modifiers - - - - - Overridden. - - Another KeyBinding struct - True if the Keycode and Modifiers are equal - - - - Overridden - - Hashcode of ToString() - - - - Overridden. Returns string representation of the Keyboard shortcut - - Returns string representation of the Keyboard shortcut - - - - Initializes a new instance of the KeyBinding structure. - - Key to trigger command - key modifiers to the Keyboard shortcut - - - - Gets/Sets Key to trigger command - - - - - Gets sets key modifiers to the Keyboard shortcut - - - - - The flags affecting how the fold is marked in the main text area (as well as in the margin). If the value - changes for onscreen text, the display will redraw. - - - - - A line is drawn above the text if the fold is expanded. - - - - - A line is drawn above the text if the fold is collapsed. - - - - - A line is drawn below the text if the fold is expanded. - - - - - A line is drawn below the text if the fold is collapsed. - - - - - Display hexadecimal fold levels in line margin to aid debugging of folding. The appearance of this feature may change in the future. - - - - - Experimental feature that has been removed. - - - - - Represents an arrow in the CallTip - - - - - No arrow - - - - - The Up arrow - - - - - The Down Arrow - - - - - Represents a customizable read-only block of text which can be displayed below - each line in a control. - - - - - Removes all text and styles associated with the annotation. - - - - - Overridden. Determines whether the specified is equal to the current . - - The object to compare with the current object. - - true if the specified is equal to the - current ; otherwise, false. - - - - - Determines whether the specified is equal to the current . - - The annotation to compare with the current annotation. - - true if the specified is equal to the - current ; otherwise, false. - - - - - Overridden. Serves as a hash function for a particular type. - - A hash code for the current . - - - - Returns a enumerable representing the individual character styling of the annotation text. - - - A enumerable representing the individual character styling, - where the property of each run represents the number - of characters the run spans. - - - - - Uses the enumerable specified to individually style characters in the annotation text. - - - The enumerable indicating how to style the annotation text, - where the property of each run represents the number - of characters the run spans. - - is null. - - The property must be set prior to styling and the sum length of - all runs should match the text length. - - - - - Tests whether two object differ in location or content. - - The object that is to the left of the inequality operator. - The object that is to the right of the inequality operator. - true if the objects are considered unequal; otherwise, false. - - - - Tests whether two objects have equal location and content. - - The object that is to the left of the equality operator. - The object that is to the right of the equality operator. - true if the objects are considered equal; otherwise, false. - - - - Initializes a new instance of the class. - - The control that created this object. - The zero-based index of the document line containing the annotation. - - - - Gets the total number of text lines in the annotation. - - An representing the total number of text lines in the annotation. - - - - Gets the index of the document line containing the annotation. - - - An representing the zero-based index of the document line - containing the annotation, or -1 if the annotation has been rendered invalid - from a change in the control that created it. - - - - - Gets or sets the index of the style used to style the annotation text. - - - An representing the zero-based index of the style used to style the annotation text, - or -1 if the annotation has individually style characters. - - - - - Gets or sets the text of the annotation. - - A representing the annotation text, or null if there is no annotation. - - Only line feed characters ('\n') are recognized as line breaks. - All other control characters are not rendered. - - - - - Converts Bitmap images to XPM data for use with ScintillaNET. - Warning: images with more than (around) 50 colors will generate incorrect XPM - The XpmConverter class was based on code from flashdevelop. - - - - - The default transparent Color - - - - - Converts Bitmap images to XPM data for use with ScintillaNET. - Warning: images with more than (around) 50 colors will generate incorrect XPM. - Uses the DefaultTransparentColor. - - The image to transform. - - - - Converts Bitmap images to XPM data for use with ScintillaNET. - Warning: images with more than (around) 50 colors will generate incorrect XPM - tColor: specified transparent color in format: "#00FF00". - - The image to transform. - The overriding transparent Color - - - - Cicles an image list object to convert contained images into xpm - at the same time we add converted images into an arraylist that lets us to retrieve images later. - Uses the DefaultTransparentColor. - - The image list to transform. - - - - Cicles an image list object to convert contained images into xpm - at the same time we add converted images into an arraylist that lets us to retrieve images later - - The image list to transform. - The overriding transparent Color - - - - Provides data for Scintilla mouse events - - - - - Initializes a new instance of the ScintillaMouseEventArgs class. - - X (left) position of mouse in pixels - Y (top) position of mouse in pixels - Document position - - - - Returns the Document position - - - - - Returns the X (left) position of mouse in pixels - - - - - Returns the Y (top) position of mouse in pixels - - - - - Type of border to print for a Page Information section - - - - - No border - - - - - Border along the top - - - - - Border along the bottom - - - - - A full border around the page information section - - - - - Default Constructor - - - - - Full Constructor - - Margin to use - Font to use - Border style - What to print on the left side of the page - What to print in the center of the page - What to print on the right side of the page - - - - Normal Use Constructor - - Border style - What to print on the left side of the page - What to print in the center of the page - What to print on the right side of the page - - - - Defines a marker's appearance in a control. - - - - - Gets or sets the marker symbol. - - One of the values. The default is . - - The value assigned is not one of the values. - - - - - Data structure used to store DropMarkers in the AllDocumentDropMarkers property. - - - - - Provides data for the CharAdded event - - - - - Initializes a new instance of the CharAddedEventArgs class. - - The character that was added - - - - Returns the character that was added - - - - - Represents a collection of objects and options in a control. - - - Annotations are customizable read-only blocks of text which can be displayed below - each line in a control. - - - - - Removes all annotations from the document. - - This is equivalent to setting the property to null for each line. - - - - Creates and returns a new object. - - A new object. - - - - Returns an enumerator for the . - - An for the . - - - - Initializes a new instance of the class. - - The control that created this object. - - - - Gets the number of annotations in the . - - The number of annotations contained in the . - - As there can be one annotation per document line, - this is equivalent to the property. - - - - - Gets or sets the offset applied to style indexes used in annotations. - - The offset applied to style indexes used in annotations. - - Annotation styles may be completely separated from standard text styles by setting a style offset. - For example, a value of 512 would shift the range of possible annotation styles to be from 512 to 767 - so they do not overlap with standard text styles. This adjustment is applied automatically when setting - or calling so the offset should NOT be - manually factored in by the caller. This property is provided to maintain architectural symmetry with - the native Scintilla component but is an advanced feature and typically should never need to be changed. - - - - - Gets or sets the visibility style for all annotations. - - - One of the values. - The default is . - - - The value assigned is not one of the values. - - - - - Gets the annotation at the specified line index. - - The zero-based document line index of the annotation to get. - The at the specified line index. - - is less than zero. -or- - is equal to or greater than . - - - - - Specifies the line wrapping modes that can be applied to a control. - - - - - Line wrapping is disabled. - - - - - Lines wrap on word boundaries. - - - - - Lines wrap between characters. - - - - - Common predefined styles that are always valid with any lexer. - - - - - ScintillaNET derived class for handling printed page settings. It holds information - on how and what to print in the header and footer of pages. - - - - - Default footer style used when no footer is provided. - - - - - Default header style used when no header is provided. - - - - - Default constructor - - - - - Method used to render colored text on a printer - - - - - Number of points to add or subtract to the size of each screen font during printing - - - - - Page Information printed in the footer of the page - - - - - Page Information printed in header of the page - - - - - Controls find behavior for non-regular expression searches - - - - - Find must match the whole word - - - - - Find must match the case of the expression - - - - - Only match the _start of a word - - - - - Not used in ScintillaNET - - - - - Not used in ScintillaNET - - - - - Provides data for a DropMarkerCollect event - - - - - Initializes a new instance of the DropMarkerCollectEventArgs class. - - - - - Returns the DropMarker that was collected - - - - - Manages commands, which are actions in ScintillaNET that can be bound to key combinations. - - - - - Adds a key combination to a Command - - Character corresponding to a (keyboard) key to trigger command - Command to execute - - - - Adds a key combination to a Command - - Character corresponding to a (keyboard) key to trigger command - Shift, alt, ctrl - Command to execute - - - - Adds a key combination to a Command - - Key to trigger command - Command to execute - - - - Adds a key combination to a Command - - Key to trigger command - Shift, alt, ctrl - Command to execute - - - - Executes a Command - - Any - Value to indicate whether other bound commands should continue to execute - - - - Returns a list of Commands bound to a keyboard shortcut - - Character corresponding to a (keyboard) key to trigger command - List of Commands bound to a keyboard shortcut - - - - Returns a list of Commands bound to a keyboard shortcut - - Character corresponding to a (keyboard) key to trigger command - Shift, alt, ctrl - List of Commands bound to a keyboard shortcut - - - - Returns a list of Commands bound to a keyboard shortcut - - Key to trigger command - List of Commands bound to a keyboard shortcut - - - - Returns a list of Commands bound to a keyboard shortcut - - Key to trigger command - Shift, alt, ctrl - List of Commands bound to a keyboard shortcut - - - - Returns a list of KeyBindings bound to a given command - - Command to execute - List of KeyBindings bound to the given command - - - - Removes all key command bindings - - - Performing this action will make ScintillaNET virtually unusable until you assign new command bindings. - This removes even basic functionality like arrow keys, common clipboard commands, home/_end, etc. - - - - - Removes all commands bound to a keyboard shortcut - - Character corresponding to a (keyboard) key to trigger command - - - - Removes a keyboard shortcut / command combination - - Character corresponding to a (keyboard) key to trigger command - Command to execute - - - - Removes all commands bound to a keyboard shortcut - - Character corresponding to a (keyboard) key to trigger command - Shift, alt, ctrl - - - - Removes a keyboard shortcut / command combination - - Character corresponding to a (keyboard) key to trigger command - Shift, alt, ctrl - Command to execute - - - - Removes all commands bound to a keyboard shortcut - - Key to trigger command - - - - Removes a keyboard shortcut / command combination - - Key to trigger command - Command to execute - - - - Removes all commands bound to a keyboard shortcut - - Key to trigger command - Shift, alt, ctrl - - - - Removes a keyboard shortcut / command combination - - Key to trigger command - Shift, alt, ctrl - Command to execute - - - - Gets/Sets if a key combination can be bound to more than one command. (default is true) - - - When set to false only the first command bound to a key combination is kept. - Subsequent requests are ignored. - - - - - Specifies how wrapped lines are indented when line wrapping is enabled in a control. - - - - - Wrapped lines are aligned on the left and indented by the amount - spcified in the property. - - - - - Wrapped lines are aligned to the first subline indent. - - - - - Wrapped lines are aligned to the first subline indent plus - one more level of indentation. - - - - - List of commands that ScintillaNET can execute. These can be - bound to keyboard shortcuts - - - - - Provides data for the event. - - - - - Initializes a new instance of the class. - - The document line index of the annotation that changed. - The number of lines added to or removed from the annotation that changed. - - - - Gets the number of lines added to or removed from the changed annotation. - - - An representing the number of lines added to or removed from the annotation. - Postive values indicate lines have been added; negative values indicate lines have been removed. - - - - - Gets the index of the document line containing the changed annotation. - - The zero-based index of the document line containing the changed annotation. - - - diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/AutoHideStripBase.cs b/renderdocui/3rdparty/WinFormsUI/Docking/AutoHideStripBase.cs deleted file mode 100644 index edc746181..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/AutoHideStripBase.cs +++ /dev/null @@ -1,540 +0,0 @@ -using System; -using System.Collections; -using System.Windows.Forms; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public abstract partial class AutoHideStripBase : Control - { - [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - protected class Tab : IDisposable - { - private IDockContent m_content; - - protected internal Tab(IDockContent content) - { - m_content = content; - } - - ~Tab() - { - Dispose(false); - } - - public IDockContent Content - { - get { return m_content; } - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - } - } - - [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - protected sealed class TabCollection : IEnumerable - { - #region IEnumerable Members - IEnumerator IEnumerable.GetEnumerator() - { - for (int i = 0; i < Count; i++) - yield return this[i]; - } - - IEnumerator IEnumerable.GetEnumerator() - { - for (int i = 0; i < Count; i++) - yield return this[i]; - } - #endregion - - internal TabCollection(DockPane pane) - { - m_dockPane = pane; - } - - private DockPane m_dockPane = null; - public DockPane DockPane - { - get { return m_dockPane; } - } - - public DockPanel DockPanel - { - get { return DockPane.DockPanel; } - } - - public int Count - { - get { return DockPane.DisplayingContents.Count; } - } - - public Tab this[int index] - { - get - { - IDockContent content = DockPane.DisplayingContents[index]; - if (content == null) - throw (new ArgumentOutOfRangeException("index")); - if (content.DockHandler.AutoHideTab == null) - content.DockHandler.AutoHideTab = (DockPanel.AutoHideStripControl.CreateTab(content)); - return content.DockHandler.AutoHideTab as Tab; - } - } - - public bool Contains(Tab tab) - { - return (IndexOf(tab) != -1); - } - - public bool Contains(IDockContent content) - { - return (IndexOf(content) != -1); - } - - public int IndexOf(Tab tab) - { - if (tab == null) - return -1; - - return IndexOf(tab.Content); - } - - public int IndexOf(IDockContent content) - { - return DockPane.DisplayingContents.IndexOf(content); - } - } - - [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - protected class Pane : IDisposable - { - private DockPane m_dockPane; - - protected internal Pane(DockPane dockPane) - { - m_dockPane = dockPane; - } - - ~Pane() - { - Dispose(false); - } - - public DockPane DockPane - { - get { return m_dockPane; } - } - - public TabCollection AutoHideTabs - { - get - { - if (DockPane.AutoHideTabs == null) - DockPane.AutoHideTabs = new TabCollection(DockPane); - return DockPane.AutoHideTabs as TabCollection; - } - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - } - } - - [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - protected sealed class PaneCollection : IEnumerable - { - private class AutoHideState - { - public DockState m_dockState; - public bool m_selected = false; - - public AutoHideState(DockState dockState) - { - m_dockState = dockState; - } - - public DockState DockState - { - get { return m_dockState; } - } - - public bool Selected - { - get { return m_selected; } - set { m_selected = value; } - } - } - - private class AutoHideStateCollection - { - private AutoHideState[] m_states; - - public AutoHideStateCollection() - { - m_states = new AutoHideState[] { - new AutoHideState(DockState.DockTopAutoHide), - new AutoHideState(DockState.DockBottomAutoHide), - new AutoHideState(DockState.DockLeftAutoHide), - new AutoHideState(DockState.DockRightAutoHide) - }; - } - - public AutoHideState this[DockState dockState] - { - get - { - for (int i = 0; i < m_states.Length; i++) - { - if (m_states[i].DockState == dockState) - return m_states[i]; - } - throw new ArgumentOutOfRangeException("dockState"); - } - } - - public bool ContainsPane(DockPane pane) - { - if (pane.IsHidden) - return false; - - for (int i = 0; i < m_states.Length; i++) - { - if (m_states[i].DockState == pane.DockState && m_states[i].Selected) - return true; - } - return false; - } - } - - internal PaneCollection(DockPanel panel, DockState dockState) - { - m_dockPanel = panel; - m_states = new AutoHideStateCollection(); - States[DockState.DockTopAutoHide].Selected = (dockState == DockState.DockTopAutoHide); - States[DockState.DockBottomAutoHide].Selected = (dockState == DockState.DockBottomAutoHide); - States[DockState.DockLeftAutoHide].Selected = (dockState == DockState.DockLeftAutoHide); - States[DockState.DockRightAutoHide].Selected = (dockState == DockState.DockRightAutoHide); - } - - private DockPanel m_dockPanel; - public DockPanel DockPanel - { - get { return m_dockPanel; } - } - - private AutoHideStateCollection m_states; - private AutoHideStateCollection States - { - get { return m_states; } - } - - public int Count - { - get - { - int count = 0; - foreach (DockPane pane in DockPanel.Panes) - { - if (States.ContainsPane(pane)) - count++; - } - - return count; - } - } - - public Pane this[int index] - { - get - { - int count = 0; - foreach (DockPane pane in DockPanel.Panes) - { - if (!States.ContainsPane(pane)) - continue; - - if (count == index) - { - if (pane.AutoHidePane == null) - pane.AutoHidePane = DockPanel.AutoHideStripControl.CreatePane(pane); - return pane.AutoHidePane as Pane; - } - - count++; - } - throw new ArgumentOutOfRangeException("index"); - } - } - - public bool Contains(Pane pane) - { - return (IndexOf(pane) != -1); - } - - public int IndexOf(Pane pane) - { - if (pane == null) - return -1; - - int index = 0; - foreach (DockPane dockPane in DockPanel.Panes) - { - if (!States.ContainsPane(pane.DockPane)) - continue; - - if (pane == dockPane.AutoHidePane) - return index; - - index++; - } - return -1; - } - - #region IEnumerable Members - - IEnumerator IEnumerable.GetEnumerator() - { - for (int i = 0; i < Count; i++) - yield return this[i]; - } - - IEnumerator IEnumerable.GetEnumerator() - { - for (int i = 0; i < Count; i++) - yield return this[i]; - } - - #endregion - } - - protected AutoHideStripBase(DockPanel panel) - { - m_dockPanel = panel; - m_panesTop = new PaneCollection(panel, DockState.DockTopAutoHide); - m_panesBottom = new PaneCollection(panel, DockState.DockBottomAutoHide); - m_panesLeft = new PaneCollection(panel, DockState.DockLeftAutoHide); - m_panesRight = new PaneCollection(panel, DockState.DockRightAutoHide); - - SetStyle(ControlStyles.OptimizedDoubleBuffer, true); - SetStyle(ControlStyles.Selectable, false); - } - - private DockPanel m_dockPanel; - protected DockPanel DockPanel - { - get { return m_dockPanel; } - } - - private PaneCollection m_panesTop; - protected PaneCollection PanesTop - { - get { return m_panesTop; } - } - - private PaneCollection m_panesBottom; - protected PaneCollection PanesBottom - { - get { return m_panesBottom; } - } - - private PaneCollection m_panesLeft; - protected PaneCollection PanesLeft - { - get { return m_panesLeft; } - } - - private PaneCollection m_panesRight; - protected PaneCollection PanesRight - { - get { return m_panesRight; } - } - - protected PaneCollection GetPanes(DockState dockState) - { - if (dockState == DockState.DockTopAutoHide) - return PanesTop; - else if (dockState == DockState.DockBottomAutoHide) - return PanesBottom; - else if (dockState == DockState.DockLeftAutoHide) - return PanesLeft; - else if (dockState == DockState.DockRightAutoHide) - return PanesRight; - else - throw new ArgumentOutOfRangeException("dockState"); - } - - internal int GetNumberOfPanes(DockState dockState) - { - return GetPanes(dockState).Count; - } - - protected Rectangle RectangleTopLeft - { - get - { - int height = MeasureHeight(); - return PanesTop.Count > 0 && PanesLeft.Count > 0 ? new Rectangle(0, 0, height, height) : Rectangle.Empty; - } - } - - protected Rectangle RectangleTopRight - { - get - { - int height = MeasureHeight(); - return PanesTop.Count > 0 && PanesRight.Count > 0 ? new Rectangle(Width - height, 0, height, height) : Rectangle.Empty; - } - } - - protected Rectangle RectangleBottomLeft - { - get - { - int height = MeasureHeight(); - return PanesBottom.Count > 0 && PanesLeft.Count > 0 ? new Rectangle(0, Height - height, height, height) : Rectangle.Empty; - } - } - - protected Rectangle RectangleBottomRight - { - get - { - int height = MeasureHeight(); - return PanesBottom.Count > 0 && PanesRight.Count > 0 ? new Rectangle(Width - height, Height - height, height, height) : Rectangle.Empty; - } - } - - protected internal Rectangle GetTabStripRectangle(DockState dockState) - { - int height = MeasureHeight(); - if (dockState == DockState.DockTopAutoHide && PanesTop.Count > 0) - return new Rectangle(RectangleTopLeft.Width, 0, Width - RectangleTopLeft.Width - RectangleTopRight.Width, height); - else if (dockState == DockState.DockBottomAutoHide && PanesBottom.Count > 0) - return new Rectangle(RectangleBottomLeft.Width, Height - height, Width - RectangleBottomLeft.Width - RectangleBottomRight.Width, height); - else if (dockState == DockState.DockLeftAutoHide && PanesLeft.Count > 0) - return new Rectangle(0, RectangleTopLeft.Width, height, Height - RectangleTopLeft.Height - RectangleBottomLeft.Height); - else if (dockState == DockState.DockRightAutoHide && PanesRight.Count > 0) - return new Rectangle(Width - height, RectangleTopRight.Width, height, Height - RectangleTopRight.Height - RectangleBottomRight.Height); - else - return Rectangle.Empty; - } - - private GraphicsPath m_displayingArea = null; - private GraphicsPath DisplayingArea - { - get - { - if (m_displayingArea == null) - m_displayingArea = new GraphicsPath(); - - return m_displayingArea; - } - } - - private void SetRegion() - { - DisplayingArea.Reset(); - DisplayingArea.AddRectangle(RectangleTopLeft); - DisplayingArea.AddRectangle(RectangleTopRight); - DisplayingArea.AddRectangle(RectangleBottomLeft); - DisplayingArea.AddRectangle(RectangleBottomRight); - DisplayingArea.AddRectangle(GetTabStripRectangle(DockState.DockTopAutoHide)); - DisplayingArea.AddRectangle(GetTabStripRectangle(DockState.DockBottomAutoHide)); - DisplayingArea.AddRectangle(GetTabStripRectangle(DockState.DockLeftAutoHide)); - DisplayingArea.AddRectangle(GetTabStripRectangle(DockState.DockRightAutoHide)); - Region = new Region(DisplayingArea); - } - - protected override void OnMouseDown(MouseEventArgs e) - { - base.OnMouseDown(e); - - if (e.Button != MouseButtons.Left) - return; - - IDockContent content = HitTest(); - if (content == null) - return; - - SetActiveAutoHideContent(content); - - content.DockHandler.Activate(); - } - - protected override void OnMouseHover(EventArgs e) - { - base.OnMouseHover(e); - - if (!DockPanel.ShowAutoHideContentOnHover) - return; - - IDockContent content = HitTest(); - SetActiveAutoHideContent(content); - - // requires further tracking of mouse hover behavior, - ResetMouseEventArgs(); - } - - private void SetActiveAutoHideContent(IDockContent content) - { - if (content != null && DockPanel.ActiveAutoHideContent != content) - DockPanel.ActiveAutoHideContent = content; - } - - protected override void OnLayout(LayoutEventArgs levent) - { - RefreshChanges(); - base.OnLayout (levent); - } - - internal void RefreshChanges() - { - if (IsDisposed) - return; - - SetRegion(); - OnRefreshChanges(); - } - - protected virtual void OnRefreshChanges() - { - } - - protected internal abstract int MeasureHeight(); - - private IDockContent HitTest() - { - Point ptMouse = PointToClient(Control.MousePosition); - return HitTest(ptMouse); - } - - protected virtual Tab CreateTab(IDockContent content) - { - return new Tab(content); - } - - protected virtual Pane CreatePane(DockPane dockPane) - { - return new Pane(dockPane); - } - - protected abstract IDockContent HitTest(Point point); - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockAreasEditor.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockAreasEditor.cs deleted file mode 100644 index 921f602b9..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockAreasEditor.cs +++ /dev/null @@ -1,142 +0,0 @@ -using System; -using System.ComponentModel; -using System.Drawing; -using System.Drawing.Design; -using System.Windows.Forms; -using System.Windows.Forms.Design; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal class DockAreasEditor : UITypeEditor - { - private class DockAreasEditorControl : System.Windows.Forms.UserControl - { - private CheckBox checkBoxFloat; - private CheckBox checkBoxDockLeft; - private CheckBox checkBoxDockRight; - private CheckBox checkBoxDockTop; - private CheckBox checkBoxDockBottom; - private CheckBox checkBoxDockFill; - private DockAreas m_oldDockAreas; - - public DockAreas DockAreas - { - get - { - DockAreas dockAreas = 0; - if (checkBoxFloat.Checked) - dockAreas |= DockAreas.Float; - if (checkBoxDockLeft.Checked) - dockAreas |= DockAreas.DockLeft; - if (checkBoxDockRight.Checked) - dockAreas |= DockAreas.DockRight; - if (checkBoxDockTop.Checked) - dockAreas |= DockAreas.DockTop; - if (checkBoxDockBottom.Checked) - dockAreas |= DockAreas.DockBottom; - if (checkBoxDockFill.Checked) - dockAreas |= DockAreas.Document; - - if (dockAreas == 0) - return m_oldDockAreas; - else - return dockAreas; - } - } - - public DockAreasEditorControl() - { - checkBoxFloat = new CheckBox(); - checkBoxDockLeft = new CheckBox(); - checkBoxDockRight = new CheckBox(); - checkBoxDockTop = new CheckBox(); - checkBoxDockBottom = new CheckBox(); - checkBoxDockFill = new CheckBox(); - - SuspendLayout(); - - checkBoxFloat.Appearance = Appearance.Button; - checkBoxFloat.Dock = DockStyle.Top; - checkBoxFloat.Height = 24; - checkBoxFloat.Text = Strings.DockAreaEditor_FloatCheckBoxText; - checkBoxFloat.TextAlign = ContentAlignment.MiddleCenter; - checkBoxFloat.FlatStyle = FlatStyle.System; - - checkBoxDockLeft.Appearance = System.Windows.Forms.Appearance.Button; - checkBoxDockLeft.Dock = System.Windows.Forms.DockStyle.Left; - checkBoxDockLeft.Width = 24; - checkBoxDockLeft.FlatStyle = FlatStyle.System; - - checkBoxDockRight.Appearance = System.Windows.Forms.Appearance.Button; - checkBoxDockRight.Dock = System.Windows.Forms.DockStyle.Right; - checkBoxDockRight.Width = 24; - checkBoxDockRight.FlatStyle = FlatStyle.System; - - checkBoxDockTop.Appearance = System.Windows.Forms.Appearance.Button; - checkBoxDockTop.Dock = System.Windows.Forms.DockStyle.Top; - checkBoxDockTop.Height = 24; - checkBoxDockTop.FlatStyle = FlatStyle.System; - - checkBoxDockBottom.Appearance = System.Windows.Forms.Appearance.Button; - checkBoxDockBottom.Dock = System.Windows.Forms.DockStyle.Bottom; - checkBoxDockBottom.Height = 24; - checkBoxDockBottom.FlatStyle = FlatStyle.System; - - checkBoxDockFill.Appearance = System.Windows.Forms.Appearance.Button; - checkBoxDockFill.Dock = System.Windows.Forms.DockStyle.Fill; - checkBoxDockFill.FlatStyle = FlatStyle.System; - - this.Controls.AddRange(new Control[] { - checkBoxDockFill, - checkBoxDockBottom, - checkBoxDockTop, - checkBoxDockRight, - checkBoxDockLeft, - checkBoxFloat}); - - Size = new System.Drawing.Size(160, 144); - BackColor = SystemColors.Control; - ResumeLayout(); - } - - public void SetStates(DockAreas dockAreas) - { - m_oldDockAreas = dockAreas; - if ((dockAreas & DockAreas.DockLeft) != 0) - checkBoxDockLeft.Checked = true; - if ((dockAreas & DockAreas.DockRight) != 0) - checkBoxDockRight.Checked = true; - if ((dockAreas & DockAreas.DockTop) != 0) - checkBoxDockTop.Checked = true; - if ((dockAreas & DockAreas.DockTop) != 0) - checkBoxDockTop.Checked = true; - if ((dockAreas & DockAreas.DockBottom) != 0) - checkBoxDockBottom.Checked = true; - if ((dockAreas & DockAreas.Document) != 0) - checkBoxDockFill.Checked = true; - if ((dockAreas & DockAreas.Float) != 0) - checkBoxFloat.Checked = true; - } - } - - private DockAreasEditor.DockAreasEditorControl m_ui = null; - - public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) - { - return UITypeEditorEditStyle.DropDown; - } - - public override object EditValue(ITypeDescriptorContext context, IServiceProvider sp, object value) - { - if (m_ui == null) - m_ui = new DockAreasEditor.DockAreasEditorControl(); - - m_ui.SetStates((DockAreas)value); - - IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)sp.GetService(typeof(IWindowsFormsEditorService)); - edSvc.DropDownControl(m_ui); - - return m_ui.DockAreas; - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockContent.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockContent.cs deleted file mode 100644 index 7c4579e33..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockContent.cs +++ /dev/null @@ -1,374 +0,0 @@ -using System; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.Diagnostics.CodeAnalysis; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public class DockContent : Form, IDockContent - { - public DockContent() - { - m_dockHandler = new DockContentHandler(this, new GetPersistStringCallback(GetPersistString)); - m_dockHandler.DockStateChanged += new EventHandler(DockHandler_DockStateChanged); - //Suggested as a fix by bensty regarding form resize - this.ParentChanged += new EventHandler(DockContent_ParentChanged); - } - - //Suggested as a fix by bensty regarding form resize - private void DockContent_ParentChanged(object Sender, EventArgs e) - { - if (this.Parent != null) - this.Font = this.Parent.Font; - } - - private DockContentHandler m_dockHandler = null; - [Browsable(false)] - public DockContentHandler DockHandler - { - get { return m_dockHandler; } - } - - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockContent_AllowEndUserDocking_Description")] - [DefaultValue(true)] - public bool AllowEndUserDocking - { - get { return DockHandler.AllowEndUserDocking; } - set { DockHandler.AllowEndUserDocking = value; } - } - - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockContent_DockAreas_Description")] - [DefaultValue(DockAreas.DockLeft|DockAreas.DockRight|DockAreas.DockTop|DockAreas.DockBottom|DockAreas.Document|DockAreas.Float)] - public DockAreas DockAreas - { - get { return DockHandler.DockAreas; } - set { DockHandler.DockAreas = value; } - } - - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockContent_AutoHidePortion_Description")] - [DefaultValue(0.25)] - public double AutoHidePortion - { - get { return DockHandler.AutoHidePortion; } - set { DockHandler.AutoHidePortion = value; } - } - - private string m_tabText = null; - [Localizable(true)] - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockContent_TabText_Description")] - [DefaultValue(null)] - public string TabText - { - get { return m_tabText; } - set { DockHandler.TabText = m_tabText = value; } - } - - private bool ShouldSerializeTabText() - { - return (m_tabText != null); - } - - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockContent_CloseButton_Description")] - [DefaultValue(true)] - public bool CloseButton - { - get { return DockHandler.CloseButton; } - set { DockHandler.CloseButton = value; } - } - - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockContent_CloseButtonVisible_Description")] - [DefaultValue(true)] - public bool CloseButtonVisible - { - get { return DockHandler.CloseButtonVisible; } - set { DockHandler.CloseButtonVisible = value; } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public DockPanel DockPanel - { - get { return DockHandler.DockPanel; } - set { DockHandler.DockPanel = value; } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public DockState DockState - { - get { return DockHandler.DockState; } - set { DockHandler.DockState = value; } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public DockPane Pane - { - get { return DockHandler.Pane; } - set { DockHandler.Pane = value; } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool IsHidden - { - get { return DockHandler.IsHidden; } - set { DockHandler.IsHidden = value; } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public DockState VisibleState - { - get { return DockHandler.VisibleState; } - set { DockHandler.VisibleState = value; } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool IsFloat - { - get { return DockHandler.IsFloat; } - set { DockHandler.IsFloat = value; } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public DockPane PanelPane - { - get { return DockHandler.PanelPane; } - set { DockHandler.PanelPane = value; } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public DockPane FloatPane - { - get { return DockHandler.FloatPane; } - set { DockHandler.FloatPane = value; } - } - - [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] - protected virtual string GetPersistString() - { - return GetType().ToString(); - } - - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockContent_HideOnClose_Description")] - [DefaultValue(false)] - public bool HideOnClose - { - get { return DockHandler.HideOnClose; } - set { DockHandler.HideOnClose = value; } - } - - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockContent_ShowHint_Description")] - [DefaultValue(DockState.Unknown)] - public DockState ShowHint - { - get { return DockHandler.ShowHint; } - set { DockHandler.ShowHint = value; } - } - - [Browsable(false)] - public bool IsActivated - { - get { return DockHandler.IsActivated; } - } - - public bool IsDockStateValid(DockState dockState) - { - return DockHandler.IsDockStateValid(dockState); - } - - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockContent_TabPageContextMenu_Description")] - [DefaultValue(null)] - public ContextMenu TabPageContextMenu - { - get { return DockHandler.TabPageContextMenu; } - set { DockHandler.TabPageContextMenu = value; } - } - - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockContent_TabPageContextMenuStrip_Description")] - [DefaultValue(null)] - public ContextMenuStrip TabPageContextMenuStrip - { - get { return DockHandler.TabPageContextMenuStrip; } - set { DockHandler.TabPageContextMenuStrip = value; } - } - - [Localizable(true)] - [Category("Appearance")] - [LocalizedDescription("DockContent_ToolTipText_Description")] - [DefaultValue(null)] - public string ToolTipText - { - get { return DockHandler.ToolTipText; } - set { DockHandler.ToolTipText = value; } - } - - public new void Activate() - { - DockHandler.Activate(); - } - - public new void Hide() - { - DockHandler.Hide(); - } - - public new void Show() - { - DockHandler.Show(); - } - - public void Show(DockPanel dockPanel) - { - DockHandler.Show(dockPanel); - } - - public void Show(DockPanel dockPanel, DockState dockState) - { - DockHandler.Show(dockPanel, dockState); - } - - [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")] - public void Show(DockPanel dockPanel, Rectangle floatWindowBounds) - { - DockHandler.Show(dockPanel, floatWindowBounds); - } - - public void Show(DockPane pane, IDockContent beforeContent) - { - DockHandler.Show(pane, beforeContent); - } - - public void Show(DockPane previousPane, DockAlignment alignment, double proportion) - { - DockHandler.Show(previousPane, alignment, proportion); - } - - [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")] - public void FloatAt(Rectangle floatWindowBounds) - { - DockHandler.FloatAt(floatWindowBounds); - } - - public void DockTo(DockPane paneTo, DockStyle dockStyle, int contentIndex) - { - DockHandler.DockTo(paneTo, dockStyle, contentIndex); - } - - public void DockTo(DockPanel panel, DockStyle dockStyle) - { - DockHandler.DockTo(panel, dockStyle); - } - - #region IDockContent Members - void IDockContent.OnActivated(EventArgs e) - { - this.OnActivated(e); - } - - void IDockContent.OnDeactivate(EventArgs e) - { - this.OnDeactivate(e); - } - #endregion - - #region Events - private void DockHandler_DockStateChanged(object sender, EventArgs e) - { - OnDockStateChanged(e); - } - - private static readonly object DockStateChangedEvent = new object(); - [LocalizedCategory("Category_PropertyChanged")] - [LocalizedDescription("Pane_DockStateChanged_Description")] - public event EventHandler DockStateChanged - { - add { Events.AddHandler(DockStateChangedEvent, value); } - remove { Events.RemoveHandler(DockStateChangedEvent, value); } - } - protected virtual void OnDockStateChanged(EventArgs e) - { - EventHandler handler = (EventHandler)Events[DockStateChangedEvent]; - if (handler != null) - handler(this, e); - } - #endregion - - /// - /// Overridden to avoid resize issues with nested controls - /// - /// - /// http://blogs.msdn.com/b/alejacma/archive/2008/11/20/controls-won-t-get-resized-once-the-nesting-hierarchy-of-windows-exceeds-a-certain-depth-x64.aspx - /// http://support.microsoft.com/kb/953934 - /// - protected override void OnSizeChanged(EventArgs e) - { - if (DockPanel != null && DockPanel.SupportDeeplyNestedContent && IsHandleCreated) - { - BeginInvoke((MethodInvoker)delegate - { - base.OnSizeChanged(e); - }); - } - else - { - base.OnSizeChanged(e); - } - } - - protected override void OnFormClosing(FormClosingEventArgs e) - { - if (Pane != null && Pane.DockPanel != null && Pane.DockPanel.CloseTabsToLeft && - Pane.ActiveContent == this && Pane.TabStripControl != null) - { - var tabs = Pane.TabStripControl.Tabs; - - if (tabs != null && tabs.Count > 1) - { - for (int i = 0; i < tabs.Count; i++) - { - if (tabs[i].Content == this) - { - DockContent dc = null; - - if (i > 0) - { - for (int j = i-1; j >= 0; j--) - { - if (tabs[j].Content is DockContent) - { - dc = tabs[j].Content as DockContent; - break; - } - } - } - - if(dc != null) - dc.Show(); - - break; - } - } - } - } - - base.OnFormClosing(e); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockContentCollection.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockContentCollection.cs deleted file mode 100644 index d6ee6bf09..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockContentCollection.cs +++ /dev/null @@ -1,175 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public class DockContentCollection : ReadOnlyCollection - { - private static List _emptyList = new List(0); - - internal DockContentCollection() - : base(new List()) - { - } - - internal DockContentCollection(DockPane pane) - : base(_emptyList) - { - m_dockPane = pane; - } - - private DockPane m_dockPane = null; - private DockPane DockPane - { - get { return m_dockPane; } - } - - public new IDockContent this[int index] - { - get - { - if (DockPane == null) - return Items[index] as IDockContent; - else - return GetVisibleContent(index); - } - } - - internal int Add(IDockContent content) - { -#if DEBUG - if (DockPane != null) - throw new InvalidOperationException(); -#endif - - if (Contains(content)) - return IndexOf(content); - - Items.Add(content); - return Count - 1; - } - - internal void AddAt(IDockContent content, int index) - { -#if DEBUG - if (DockPane != null) - throw new InvalidOperationException(); -#endif - - if (index < 0 || index > Items.Count - 1) - return; - - if (Contains(content)) - return; - - Items.Insert(index, content); - } - - public new bool Contains(IDockContent content) - { - if (DockPane == null) - return Items.Contains(content); - else - return (GetIndexOfVisibleContents(content) != -1); - } - - public new int Count - { - get - { - if (DockPane == null) - return base.Count; - else - return CountOfVisibleContents; - } - } - - public new int IndexOf(IDockContent content) - { - if (DockPane == null) - { - if (!Contains(content)) - return -1; - else - return Items.IndexOf(content); - } - else - return GetIndexOfVisibleContents(content); - } - - internal void Remove(IDockContent content) - { - if (DockPane != null) - throw new InvalidOperationException(); - - if (!Contains(content)) - return; - - Items.Remove(content); - } - - private int CountOfVisibleContents - { - get - { -#if DEBUG - if (DockPane == null) - throw new InvalidOperationException(); -#endif - - int count = 0; - foreach (IDockContent content in DockPane.Contents) - { - if (content.DockHandler.DockState == DockPane.DockState) - count++; - } - return count; - } - } - - private IDockContent GetVisibleContent(int index) - { -#if DEBUG - if (DockPane == null) - throw new InvalidOperationException(); -#endif - - int currentIndex = -1; - foreach (IDockContent content in DockPane.Contents) - { - if (content.DockHandler.DockState == DockPane.DockState) - currentIndex++; - - if (currentIndex == index) - return content; - } - throw (new ArgumentOutOfRangeException()); - } - - private int GetIndexOfVisibleContents(IDockContent content) - { -#if DEBUG - if (DockPane == null) - throw new InvalidOperationException(); -#endif - - if (content == null) - return -1; - - int index = -1; - foreach (IDockContent c in DockPane.Contents) - { - if (c.DockHandler.DockState == DockPane.DockState) - { - index++; - - if (c == content) - return index; - } - } - return -1; - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockContentEventArgs.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockContentEventArgs.cs deleted file mode 100644 index 92a9362bb..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockContentEventArgs.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public class DockContentEventArgs : EventArgs - { - private IDockContent m_content; - - public DockContentEventArgs(IDockContent content) - { - m_content = content; - } - - public IDockContent Content - { - get { return m_content; } - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockContentHandler.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockContentHandler.cs deleted file mode 100644 index f872b22b2..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockContentHandler.cs +++ /dev/null @@ -1,1146 +0,0 @@ -using System; -using System.Windows.Forms; -using System.Drawing; -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public delegate string GetPersistStringCallback(); - - public class DockContentHandler : IDisposable, IDockDragSource - { - public DockContentHandler(Form form) : this(form, null) - { - } - - public DockContentHandler(Form form, GetPersistStringCallback getPersistStringCallback) - { - if (!(form is IDockContent)) - throw new ArgumentException(Strings.DockContent_Constructor_InvalidForm, "form"); - - m_form = form; - m_getPersistStringCallback = getPersistStringCallback; - - m_events = new EventHandlerList(); - Form.Disposed +=new EventHandler(Form_Disposed); - Form.TextChanged += new EventHandler(Form_TextChanged); - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (disposing) - { - DockPanel = null; - if (m_autoHideTab != null) - m_autoHideTab.Dispose(); - if (m_tab != null) - m_tab.Dispose(); - - Form.Disposed -= new EventHandler(Form_Disposed); - Form.TextChanged -= new EventHandler(Form_TextChanged); - m_events.Dispose(); - } - } - - private Form m_form; - public Form Form - { - get { return m_form; } - } - - public IDockContent Content - { - get { return Form as IDockContent; } - } - - private IDockContent m_previousActive = null; - public IDockContent PreviousActive - { - get { return m_previousActive; } - internal set { m_previousActive = value; } - } - - private IDockContent m_nextActive = null; - public IDockContent NextActive - { - get { return m_nextActive; } - internal set { m_nextActive = value; } - } - - private EventHandlerList m_events; - private EventHandlerList Events - { - get { return m_events; } - } - - private bool m_allowEndUserDocking = true; - public bool AllowEndUserDocking - { - get { return m_allowEndUserDocking; } - set { m_allowEndUserDocking = value; } - } - - private double m_autoHidePortion = 0.25; - public double AutoHidePortion - { - get { return m_autoHidePortion; } - set - { - if (value <= 0) - throw(new ArgumentOutOfRangeException(Strings.DockContentHandler_AutoHidePortion_OutOfRange)); - - if (m_autoHidePortion == value) - return; - - m_autoHidePortion = value; - - if (DockPanel == null) - return; - - if (DockPanel.ActiveAutoHideContent == Content) - DockPanel.PerformLayout(); - } - } - - private bool m_closeButton = true; - public bool CloseButton - { - get { return m_closeButton; } - set - { - if (m_closeButton == value) - return; - - m_closeButton = value; - if (IsActiveContentHandler) - Pane.RefreshChanges(); - } - } - - private bool m_closeButtonVisible = true; - /// - /// Determines whether the close button is visible on the content - /// - public bool CloseButtonVisible - { - get { return m_closeButtonVisible; } - set - { - if (m_closeButtonVisible == value) - return; - - m_closeButtonVisible = value; - if (IsActiveContentHandler) - Pane.RefreshChanges(); - } - } - - private bool IsActiveContentHandler - { - get { return Pane != null && Pane.ActiveContent != null && Pane.ActiveContent.DockHandler == this; } - } - - private DockState DefaultDockState - { - get - { - if (ShowHint != DockState.Unknown && ShowHint != DockState.Hidden) - return ShowHint; - - if ((DockAreas & DockAreas.Document) != 0) - return DockState.Document; - if ((DockAreas & DockAreas.DockRight) != 0) - return DockState.DockRight; - if ((DockAreas & DockAreas.DockLeft) != 0) - return DockState.DockLeft; - if ((DockAreas & DockAreas.DockBottom) != 0) - return DockState.DockBottom; - if ((DockAreas & DockAreas.DockTop) != 0) - return DockState.DockTop; - - return DockState.Unknown; - } - } - - private DockState DefaultShowState - { - get - { - if (ShowHint != DockState.Unknown) - return ShowHint; - - if ((DockAreas & DockAreas.Document) != 0) - return DockState.Document; - if ((DockAreas & DockAreas.DockRight) != 0) - return DockState.DockRight; - if ((DockAreas & DockAreas.DockLeft) != 0) - return DockState.DockLeft; - if ((DockAreas & DockAreas.DockBottom) != 0) - return DockState.DockBottom; - if ((DockAreas & DockAreas.DockTop) != 0) - return DockState.DockTop; - if ((DockAreas & DockAreas.Float) != 0) - return DockState.Float; - - return DockState.Unknown; - } - } - - private DockAreas m_allowedAreas = DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockTop | DockAreas.DockBottom | DockAreas.Document | DockAreas.Float; - public DockAreas DockAreas - { - get { return m_allowedAreas; } - set - { - if (m_allowedAreas == value) - return; - - if (!DockHelper.IsDockStateValid(DockState, value)) - throw(new InvalidOperationException(Strings.DockContentHandler_DockAreas_InvalidValue)); - - m_allowedAreas = value; - - if (!DockHelper.IsDockStateValid(ShowHint, m_allowedAreas)) - ShowHint = DockState.Unknown; - } - } - - private DockState m_dockState = DockState.Unknown; - public DockState DockState - { - get { return m_dockState; } - set - { - if (m_dockState == value) - return; - - DockPanel.SuspendLayout(true); - - if (value == DockState.Hidden) - IsHidden = true; - else - SetDockState(false, value, Pane); - - DockPanel.ResumeLayout(true, true); - } - } - - private DockPanel m_dockPanel = null; - public DockPanel DockPanel - { - get { return m_dockPanel; } - set - { - if (m_dockPanel == value) - return; - - Pane = null; - - if (m_dockPanel != null) - m_dockPanel.RemoveContent(Content); - - if (m_tab != null) - { - m_tab.Dispose(); - m_tab = null; - } - - if (m_autoHideTab != null) - { - m_autoHideTab.Dispose(); - m_autoHideTab = null; - } - - m_dockPanel = value; - - if (m_dockPanel != null) - { - m_dockPanel.AddContent(Content); - Form.TopLevel = false; - Form.FormBorderStyle = FormBorderStyle.None; - Form.ShowInTaskbar = false; - Form.WindowState = FormWindowState.Normal; - if (Win32Helper.IsRunningOnMono) - return; - - NativeMethods.SetWindowPos(Form.Handle, IntPtr.Zero, 0, 0, 0, 0, - Win32.FlagsSetWindowPos.SWP_NOACTIVATE | - Win32.FlagsSetWindowPos.SWP_NOMOVE | - Win32.FlagsSetWindowPos.SWP_NOSIZE | - Win32.FlagsSetWindowPos.SWP_NOZORDER | - Win32.FlagsSetWindowPos.SWP_NOOWNERZORDER | - Win32.FlagsSetWindowPos.SWP_FRAMECHANGED); - } - } - } - - public Icon Icon - { - get { return Form.Icon; } - } - - public DockPane Pane - { - get { return IsFloat ? FloatPane : PanelPane; } - set - { - if (Pane == value) - return; - - DockPanel.SuspendLayout(true); - - DockPane oldPane = Pane; - - SuspendSetDockState(); - FloatPane = (value == null ? null : (value.IsFloat ? value : FloatPane)); - PanelPane = (value == null ? null : (value.IsFloat ? PanelPane : value)); - ResumeSetDockState(IsHidden, value != null ? value.DockState : DockState.Unknown, oldPane); - - DockPanel.ResumeLayout(true, true); - } - } - - private bool m_isHidden = true; - public bool IsHidden - { - get { return m_isHidden; } - set - { - if (m_isHidden == value) - return; - - SetDockState(value, VisibleState, Pane); - } - } - - private string m_tabText = null; - public string TabText - { - get { return m_tabText == null || m_tabText == "" ? Form.Text : m_tabText; } - set - { - if (m_tabText == value) - return; - - m_tabText = value; - if (Pane != null) - Pane.RefreshChanges(); - } - } - - private DockState m_visibleState = DockState.Unknown; - public DockState VisibleState - { - get { return m_visibleState; } - set - { - if (m_visibleState == value) - return; - - SetDockState(IsHidden, value, Pane); - } - } - - private bool m_isFloat = false; - public bool IsFloat - { - get { return m_isFloat; } - set - { - if (m_isFloat == value) - return; - - DockState visibleState = CheckDockState(value); - - if (visibleState == DockState.Unknown) - throw new InvalidOperationException(Strings.DockContentHandler_IsFloat_InvalidValue); - - SetDockState(IsHidden, visibleState, Pane); - } - } - - [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")] - public DockState CheckDockState(bool isFloat) - { - DockState dockState; - - if (isFloat) - { - if (!IsDockStateValid(DockState.Float)) - dockState = DockState.Unknown; - else - dockState = DockState.Float; - } - else - { - dockState = (PanelPane != null) ? PanelPane.DockState : DefaultDockState; - if (dockState != DockState.Unknown && !IsDockStateValid(dockState)) - dockState = DockState.Unknown; - } - - return dockState; - } - - private DockPane m_panelPane = null; - public DockPane PanelPane - { - get { return m_panelPane; } - set - { - if (m_panelPane == value) - return; - - if (value != null) - { - if (value.IsFloat || value.DockPanel != DockPanel) - throw new InvalidOperationException(Strings.DockContentHandler_DockPane_InvalidValue); - } - - DockPane oldPane = Pane; - - if (m_panelPane != null) - RemoveFromPane(m_panelPane); - m_panelPane = value; - if (m_panelPane != null) - { - m_panelPane.AddContent(Content); - SetDockState(IsHidden, IsFloat ? DockState.Float : m_panelPane.DockState, oldPane); - } - else - SetDockState(IsHidden, DockState.Unknown, oldPane); - } - } - - private void RemoveFromPane(DockPane pane) - { - pane.RemoveContent(Content); - SetPane(null); - if (pane.Contents.Count == 0) - pane.Dispose(); - } - - private DockPane m_floatPane = null; - public DockPane FloatPane - { - get { return m_floatPane; } - set - { - if (m_floatPane == value) - return; - - if (value != null) - { - if (!value.IsFloat || value.DockPanel != DockPanel) - throw new InvalidOperationException(Strings.DockContentHandler_FloatPane_InvalidValue); - } - - DockPane oldPane = Pane; - - if (m_floatPane != null) - RemoveFromPane(m_floatPane); - m_floatPane = value; - if (m_floatPane != null) - { - m_floatPane.AddContent(Content); - SetDockState(IsHidden, IsFloat ? DockState.Float : VisibleState, oldPane); - } - else - SetDockState(IsHidden, DockState.Unknown, oldPane); - } - } - - private int m_countSetDockState = 0; - private void SuspendSetDockState() - { - m_countSetDockState ++; - } - - private void ResumeSetDockState() - { - m_countSetDockState --; - if (m_countSetDockState < 0) - m_countSetDockState = 0; - } - - internal bool IsSuspendSetDockState - { - get { return m_countSetDockState != 0; } - } - - private void ResumeSetDockState(bool isHidden, DockState visibleState, DockPane oldPane) - { - ResumeSetDockState(); - SetDockState(isHidden, visibleState, oldPane); - } - - internal void SetDockState(bool isHidden, DockState visibleState, DockPane oldPane) - { - if (IsSuspendSetDockState) - return; - - if (DockPanel == null && visibleState != DockState.Unknown) - throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_NullPanel); - - if (visibleState == DockState.Hidden || (visibleState != DockState.Unknown && !IsDockStateValid(visibleState))) - throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_InvalidState); - - DockPanel dockPanel = DockPanel; - if (dockPanel != null) - dockPanel.SuspendLayout(true); - - SuspendSetDockState(); - - DockState oldDockState = DockState; - - if (m_isHidden != isHidden || oldDockState == DockState.Unknown) - { - m_isHidden = isHidden; - } - m_visibleState = visibleState; - m_dockState = isHidden ? DockState.Hidden : visibleState; - - if (visibleState == DockState.Unknown) - Pane = null; - else - { - m_isFloat = (m_visibleState == DockState.Float); - - if (Pane == null) - Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, true); - else if (Pane.DockState != visibleState) - { - if (Pane.Contents.Count == 1) - Pane.SetDockState(visibleState); - else - Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, true); - } - } - - if (Form.ContainsFocus) - { - if (DockState == DockState.Hidden || DockState == DockState.Unknown) - { - if (!Win32Helper.IsRunningOnMono) - { - DockPanel.ContentFocusManager.GiveUpFocus(Content); - } - } - } - - SetPaneAndVisible(Pane); - - if (oldPane != null && !oldPane.IsDisposed && oldDockState == oldPane.DockState) - RefreshDockPane(oldPane); - - if (Pane != null && DockState == Pane.DockState) - { - if ((Pane != oldPane) || - (Pane == oldPane && oldDockState != oldPane.DockState)) - { - // Avoid early refresh of hidden AutoHide panes - if ((Pane.DockWindow == null || Pane.DockWindow.Visible || Pane.IsHidden) && !Pane.IsAutoHide) - { - RefreshDockPane(Pane); - } - } - } - - if (oldDockState != DockState) - { - if (DockState == DockState.Hidden || DockState == DockState.Unknown || - DockHelper.IsDockStateAutoHide(DockState)) - { - if (!Win32Helper.IsRunningOnMono) - { - DockPanel.ContentFocusManager.RemoveFromList(Content); - } - } - else if (!Win32Helper.IsRunningOnMono) - { - DockPanel.ContentFocusManager.AddToList(Content); - } - - ResetAutoHidePortion(oldDockState, DockState); - OnDockStateChanged(EventArgs.Empty); - } - - ResumeSetDockState(); - - if (dockPanel != null) - dockPanel.ResumeLayout(true, true); - } - - private void ResetAutoHidePortion(DockState oldState, DockState newState) - { - if (oldState == newState || DockHelper.ToggleAutoHideState(oldState) == newState) - return; - - switch (newState) - { - case DockState.DockTop: - case DockState.DockTopAutoHide: - AutoHidePortion = DockPanel.DockTopPortion; - break; - case DockState.DockLeft: - case DockState.DockLeftAutoHide: - AutoHidePortion = DockPanel.DockLeftPortion; - break; - case DockState.DockBottom: - case DockState.DockBottomAutoHide: - AutoHidePortion = DockPanel.DockBottomPortion; - break; - case DockState.DockRight: - case DockState.DockRightAutoHide: - AutoHidePortion = DockPanel.DockRightPortion; - break; - } - } - - private static void RefreshDockPane(DockPane pane) - { - pane.RefreshChanges(); - pane.ValidateActiveContent(); - } - - internal string PersistString - { - get { return GetPersistStringCallback == null ? Form.GetType().ToString() : GetPersistStringCallback(); } - } - - private GetPersistStringCallback m_getPersistStringCallback = null; - public GetPersistStringCallback GetPersistStringCallback - { - get { return m_getPersistStringCallback; } - set { m_getPersistStringCallback = value; } - } - - - private bool m_hideOnClose = false; - public bool HideOnClose - { - get { return m_hideOnClose; } - set { m_hideOnClose = value; } - } - - private DockState m_showHint = DockState.Unknown; - public DockState ShowHint - { - get { return m_showHint; } - set - { - if (!DockHelper.IsDockStateValid(value, DockAreas)) - throw (new InvalidOperationException(Strings.DockContentHandler_ShowHint_InvalidValue)); - - if (m_showHint == value) - return; - - m_showHint = value; - } - } - - private bool m_isActivated = false; - public bool IsActivated - { - get { return m_isActivated; } - internal set - { - if (m_isActivated == value) - return; - - m_isActivated = value; - } - } - - public bool IsDockStateValid(DockState dockState) - { - if (DockPanel != null && dockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.SystemMdi) - return false; - else - return DockHelper.IsDockStateValid(dockState, DockAreas); - } - - private ContextMenu m_tabPageContextMenu = null; - public ContextMenu TabPageContextMenu - { - get { return m_tabPageContextMenu; } - set { m_tabPageContextMenu = value; } - } - - private string m_toolTipText = null; - public string ToolTipText - { - get { return m_toolTipText; } - set { m_toolTipText = value; } - } - - public void Activate() - { - if (DockPanel == null) - Form.Activate(); - else if (Pane == null) - Show(DockPanel); - else - { - IsHidden = false; - Pane.ActiveContent = Content; - if (DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.SystemMdi) - { - Form.Activate(); - return; - } - else if (DockHelper.IsDockStateAutoHide(DockState)) - { - if (DockPanel.ActiveAutoHideContent != Content) - { - DockPanel.ActiveAutoHideContent = null; - return; - } - } - - if (Form.ContainsFocus) - return; - - if (Win32Helper.IsRunningOnMono) - return; - - DockPanel.ContentFocusManager.Activate(Content); - } - } - - public void GiveUpFocus() - { - if (!Win32Helper.IsRunningOnMono) - DockPanel.ContentFocusManager.GiveUpFocus(Content); - } - - private IntPtr m_activeWindowHandle = IntPtr.Zero; - internal IntPtr ActiveWindowHandle - { - get { return m_activeWindowHandle; } - set { m_activeWindowHandle = value; } - } - - public void Hide() - { - IsHidden = true; - } - - internal void SetPaneAndVisible(DockPane pane) - { - SetPane(pane); - SetVisible(); - } - - private void SetPane(DockPane pane) - { - if (pane != null && pane.DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.DockingMdi) - { - if (Form.Parent is DockPane) - SetParent(null); - if (Form.MdiParent != DockPanel.ParentForm) - { - FlagClipWindow = true; - Form.MdiParent = DockPanel.ParentForm; - } - } - else - { - FlagClipWindow = true; - if (Form.MdiParent != null) - Form.MdiParent = null; - if (Form.TopLevel) - Form.TopLevel = false; - SetParent(pane); - } - } - - internal void SetVisible() - { - bool visible; - - if (IsHidden) - visible = false; - else if (Pane != null && Pane.DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.DockingMdi) - visible = true; - else if (Pane != null && Pane.ActiveContent == Content) - visible = true; - else if (Pane != null && Pane.ActiveContent != Content) - visible = false; - else - visible = Form.Visible; - - if (Form.Visible != visible) - Form.Visible = visible; - } - - private void SetParent(Control value) - { - if (Form.Parent == value) - return; - - //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // Workaround of .Net Framework bug: - // Change the parent of a control with focus may result in the first - // MDI child form get activated. - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - bool bRestoreFocus = false; - if (Form.ContainsFocus) - { - // Suggested as a fix for a memory leak by bugreports - if (value == null && !IsFloat) - { - if (!Win32Helper.IsRunningOnMono) - { - DockPanel.ContentFocusManager.GiveUpFocus(this.Content); - } - } - else - { - DockPanel.SaveFocus(); - bRestoreFocus = true; - } - } - - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - Form.Parent = value; - - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // Workaround of .Net Framework bug: - // Change the parent of a control with focus may result in the first - // MDI child form get activated. - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if (bRestoreFocus) - Activate(); - - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - } - - public void Show() - { - if (DockPanel == null) - Form.Show(); - else - Show(DockPanel); - } - - public void Show(DockPanel dockPanel) - { - if (dockPanel == null) - throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullDockPanel)); - - if (DockState == DockState.Unknown) - Show(dockPanel, DefaultShowState); - else - Activate(); - } - - public void Show(DockPanel dockPanel, DockState dockState) - { - if (dockPanel == null) - throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullDockPanel)); - - if (dockState == DockState.Unknown || dockState == DockState.Hidden) - throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidDockState)); - - dockPanel.SuspendLayout(true); - - DockPanel = dockPanel; - - if (dockState == DockState.Float && FloatPane == null) - Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Float, true); - else if (PanelPane == null) - { - DockPane paneExisting = null; - foreach (DockPane pane in DockPanel.Panes) - if (pane.DockState == dockState) - { - if (paneExisting == null || pane.IsActivated) - paneExisting = pane; - - if (pane.IsActivated) - break; - } - - if (paneExisting == null) - Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, dockState, true); - else - Pane = paneExisting; - } - - DockState = dockState; - dockPanel.ResumeLayout(true, true); //we'll resume the layout before activating to ensure that the position - Activate(); //and size of the form are finally processed before the form is shown - } - - [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")] - public void Show(DockPanel dockPanel, Rectangle floatWindowBounds) - { - if (dockPanel == null) - throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullDockPanel)); - - dockPanel.SuspendLayout(true); - - DockPanel = dockPanel; - if (FloatPane == null) - { - IsHidden = true; // to reduce the screen flicker - FloatPane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Float, false); - FloatPane.FloatWindow.StartPosition = FormStartPosition.Manual; - } - - FloatPane.FloatWindow.Bounds = floatWindowBounds; - - Show(dockPanel, DockState.Float); - Activate(); - - dockPanel.ResumeLayout(true, true); - } - - public void Show(DockPane pane, IDockContent beforeContent) - { - if (pane == null) - throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullPane)); - - if (beforeContent != null && pane.Contents.IndexOf(beforeContent) == -1) - throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidBeforeContent)); - - pane.DockPanel.SuspendLayout(true); - - DockPanel = pane.DockPanel; - Pane = pane; - pane.SetContentIndex(Content, pane.Contents.IndexOf(beforeContent)); - Show(); - - pane.DockPanel.ResumeLayout(true, true); - } - - public void Show(DockPane previousPane, DockAlignment alignment, double proportion) - { - if (previousPane == null) - throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidPrevPane)); - - if (DockHelper.IsDockStateAutoHide(previousPane.DockState)) - throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidPrevPane)); - - previousPane.DockPanel.SuspendLayout(true); - - DockPanel = previousPane.DockPanel; - DockPanel.DockPaneFactory.CreateDockPane(Content, previousPane, alignment, proportion, true); - Show(); - - previousPane.DockPanel.ResumeLayout(true, true); - } - - public void Close() - { - DockPanel dockPanel = DockPanel; - if (dockPanel != null) - dockPanel.SuspendLayout(true); - Form.Close(); - if (dockPanel != null) - dockPanel.ResumeLayout(true, true); - - } - - private DockPaneStripBase.Tab m_tab = null; - internal DockPaneStripBase.Tab GetTab(DockPaneStripBase dockPaneStrip) - { - if (m_tab == null) - m_tab = dockPaneStrip.CreateTab(Content); - - return m_tab; - } - - private IDisposable m_autoHideTab = null; - internal IDisposable AutoHideTab - { - get { return m_autoHideTab; } - set { m_autoHideTab = value; } - } - - #region Events - private static readonly object DockStateChangedEvent = new object(); - public event EventHandler DockStateChanged - { - add { Events.AddHandler(DockStateChangedEvent, value); } - remove { Events.RemoveHandler(DockStateChangedEvent, value); } - } - protected virtual void OnDockStateChanged(EventArgs e) - { - EventHandler handler = (EventHandler)Events[DockStateChangedEvent]; - if (handler != null) - handler(this, e); - } - #endregion - - private void Form_Disposed(object sender, EventArgs e) - { - Dispose(); - } - - private void Form_TextChanged(object sender, EventArgs e) - { - if (DockHelper.IsDockStateAutoHide(DockState)) - DockPanel.RefreshAutoHideStrip(); - else if (Pane != null) - { - if (Pane.FloatWindow != null) - Pane.FloatWindow.SetText(); - Pane.RefreshChanges(); - } - } - - private bool m_flagClipWindow = false; - internal bool FlagClipWindow - { - get { return m_flagClipWindow; } - set - { - if (m_flagClipWindow == value) - return; - - m_flagClipWindow = value; - if (m_flagClipWindow) - Form.Region = new Region(Rectangle.Empty); - else - Form.Region = null; - } - } - - private ContextMenuStrip m_tabPageContextMenuStrip = null; - public ContextMenuStrip TabPageContextMenuStrip - { - get { return m_tabPageContextMenuStrip; } - set { m_tabPageContextMenuStrip = value; } - } - - #region IDockDragSource Members - - Control IDragSource.DragControl - { - get { return Form; } - } - - bool IDockDragSource.CanDockTo(DockPane pane) - { - if (!IsDockStateValid(pane.DockState)) - return false; - - if (Pane == pane && pane.DisplayingContents.Count == 1) - return false; - - return true; - } - - Rectangle IDockDragSource.BeginDrag(Point ptMouse) - { - Size size; - DockPane floatPane = this.FloatPane; - if (DockState == DockState.Float || floatPane == null || floatPane.FloatWindow.NestedPanes.Count != 1) - size = DockPanel.DefaultFloatWindowSize; - else - size = floatPane.FloatWindow.Size; - - Point location; - Rectangle rectPane = Pane.ClientRectangle; - if (DockState == DockState.Document) - { - if (Pane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - location = new Point(rectPane.Left, rectPane.Bottom - size.Height); - else - location = new Point(rectPane.Left, rectPane.Top); - } - else - { - location = new Point(rectPane.Left, rectPane.Bottom); - location.Y -= size.Height; - } - location = Pane.PointToScreen(location); - - if (ptMouse.X > location.X + size.Width) - location.X += ptMouse.X - (location.X + size.Width) + Measures.SplitterSize; - - return new Rectangle(location, size); - } - - void IDockDragSource.EndDrag() - { - } - - public void FloatAt(Rectangle floatWindowBounds) - { - DockPane pane = DockPanel.DockPaneFactory.CreateDockPane(Content, floatWindowBounds, true); - } - - public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex) - { - if (dockStyle == DockStyle.Fill) - { - bool samePane = (Pane == pane); - if (!samePane) - Pane = pane; - - if (contentIndex == -1 || !samePane) - pane.SetContentIndex(Content, contentIndex); - else - { - DockContentCollection contents = pane.Contents; - int oldIndex = contents.IndexOf(Content); - int newIndex = contentIndex; - if (oldIndex < newIndex) - { - newIndex += 1; - if (newIndex > contents.Count -1) - newIndex = -1; - } - pane.SetContentIndex(Content, newIndex); - } - } - else - { - DockPane paneFrom = DockPanel.DockPaneFactory.CreateDockPane(Content, pane.DockState, true); - INestedPanesContainer container = pane.NestedPanesContainer; - if (dockStyle == DockStyle.Left) - paneFrom.DockTo(container, pane, DockAlignment.Left, 0.5); - else if (dockStyle == DockStyle.Right) - paneFrom.DockTo(container, pane, DockAlignment.Right, 0.5); - else if (dockStyle == DockStyle.Top) - paneFrom.DockTo(container, pane, DockAlignment.Top, 0.5); - else if (dockStyle == DockStyle.Bottom) - paneFrom.DockTo(container, pane, DockAlignment.Bottom, 0.5); - - paneFrom.DockState = pane.DockState; - } - } - - public void DockTo(DockPanel panel, DockStyle dockStyle) - { - if (panel != DockPanel) - throw new ArgumentException(Strings.IDockDragSource_DockTo_InvalidPanel, "panel"); - - DockPane pane; - - if (dockStyle == DockStyle.Top) - pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.DockTop, true); - else if (dockStyle == DockStyle.Bottom) - pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.DockBottom, true); - else if (dockStyle == DockStyle.Left) - pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.DockLeft, true); - else if (dockStyle == DockStyle.Right) - pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.DockRight, true); - else if (dockStyle == DockStyle.Fill) - pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Document, true); - else - return; - } - - #endregion - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockOutlineBase.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockOutlineBase.cs deleted file mode 100644 index 6d24175fc..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockOutlineBase.cs +++ /dev/null @@ -1,161 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal abstract class DockOutlineBase - { - public DockOutlineBase() - { - Init(); - } - - private void Init() - { - SetValues(Rectangle.Empty, null, DockStyle.None, -1); - SaveOldValues(); - } - - private Rectangle m_oldFloatWindowBounds; - protected Rectangle OldFloatWindowBounds - { - get { return m_oldFloatWindowBounds; } - } - - private Control m_oldDockTo; - protected Control OldDockTo - { - get { return m_oldDockTo; } - } - - private DockStyle m_oldDock; - protected DockStyle OldDock - { - get { return m_oldDock; } - } - - private int m_oldContentIndex; - protected int OldContentIndex - { - get { return m_oldContentIndex; } - } - - protected bool SameAsOldValue - { - get - { - return FloatWindowBounds == OldFloatWindowBounds && - DockTo == OldDockTo && - Dock == OldDock && - ContentIndex == OldContentIndex; - } - } - - private Rectangle m_floatWindowBounds; - public Rectangle FloatWindowBounds - { - get { return m_floatWindowBounds; } - } - - private Control m_dockTo; - public Control DockTo - { - get { return m_dockTo; } - } - - private DockStyle m_dock; - public DockStyle Dock - { - get { return m_dock; } - } - - private int m_contentIndex; - public int ContentIndex - { - get { return m_contentIndex; } - } - - public bool FlagFullEdge - { - get { return m_contentIndex != 0; } - } - - private bool m_flagTestDrop = false; - public bool FlagTestDrop - { - get { return m_flagTestDrop; } - set { m_flagTestDrop = value; } - } - - private void SaveOldValues() - { - m_oldDockTo = m_dockTo; - m_oldDock = m_dock; - m_oldContentIndex = m_contentIndex; - m_oldFloatWindowBounds = m_floatWindowBounds; - } - - protected abstract void OnShow(); - - protected abstract void OnClose(); - - private void SetValues(Rectangle floatWindowBounds, Control dockTo, DockStyle dock, int contentIndex) - { - m_floatWindowBounds = floatWindowBounds; - m_dockTo = dockTo; - m_dock = dock; - m_contentIndex = contentIndex; - FlagTestDrop = true; - } - - private void TestChange() - { - if (m_floatWindowBounds != m_oldFloatWindowBounds || - m_dockTo != m_oldDockTo || - m_dock != m_oldDock || - m_contentIndex != m_oldContentIndex) - OnShow(); - } - - public void Show() - { - SaveOldValues(); - SetValues(Rectangle.Empty, null, DockStyle.None, -1); - TestChange(); - } - - public void Show(DockPane pane, DockStyle dock) - { - SaveOldValues(); - SetValues(Rectangle.Empty, pane, dock, -1); - TestChange(); - } - - public void Show(DockPane pane, int contentIndex) - { - SaveOldValues(); - SetValues(Rectangle.Empty, pane, DockStyle.Fill, contentIndex); - TestChange(); - } - - public void Show(DockPanel dockPanel, DockStyle dock, bool fullPanelEdge) - { - SaveOldValues(); - SetValues(Rectangle.Empty, dockPanel, dock, fullPanelEdge ? -1 : 0); - TestChange(); - } - - public void Show(Rectangle floatWindowBounds) - { - SaveOldValues(); - SetValues(floatWindowBounds, null, DockStyle.None, -1); - TestChange(); - } - - public void Close() - { - OnClose(); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPane.SplitterControl.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPane.SplitterControl.cs deleted file mode 100644 index dc69fb944..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPane.SplitterControl.cs +++ /dev/null @@ -1,157 +0,0 @@ -using System; -using System.Collections; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - partial class DockPane - { - private class SplitterControl : Control, ISplitterDragSource - { - DockPane m_pane; - - public SplitterControl(DockPane pane) - { - SetStyle(ControlStyles.Selectable, false); - m_pane = pane; - } - - public DockPane DockPane - { - get { return m_pane; } - } - - private DockAlignment m_alignment; - public DockAlignment Alignment - { - get { return m_alignment; } - set - { - m_alignment = value; - if (m_alignment == DockAlignment.Left || m_alignment == DockAlignment.Right) - Cursor = Cursors.VSplit; - else if (m_alignment == DockAlignment.Top || m_alignment == DockAlignment.Bottom) - Cursor = Cursors.HSplit; - else - Cursor = Cursors.Default; - - if (DockPane.DockState == DockState.Document) - Invalidate(); - } - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - if (DockPane.DockState != DockState.Document) - return; - - Graphics g = e.Graphics; - Rectangle rect = ClientRectangle; - if (Alignment == DockAlignment.Top || Alignment == DockAlignment.Bottom) - g.DrawLine(SystemPens.ControlDark, rect.Left, rect.Bottom - 1, rect.Right, rect.Bottom - 1); - else if (Alignment == DockAlignment.Left || Alignment == DockAlignment.Right) - g.DrawLine(SystemPens.ControlDarkDark, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom); - } - - protected override void OnMouseDown(MouseEventArgs e) - { - base.OnMouseDown(e); - - if (e.Button != MouseButtons.Left) - return; - - DockPane.DockPanel.BeginDrag(this, Parent.RectangleToScreen(Bounds)); - } - - #region ISplitterDragSource Members - - void ISplitterDragSource.BeginDrag(Rectangle rectSplitter) - { - } - - void ISplitterDragSource.EndDrag() - { - } - - bool ISplitterDragSource.IsVertical - { - get - { - NestedDockingStatus status = DockPane.NestedDockingStatus; - return (status.DisplayingAlignment == DockAlignment.Left || - status.DisplayingAlignment == DockAlignment.Right); - } - } - - Rectangle ISplitterDragSource.DragLimitBounds - { - get - { - NestedDockingStatus status = DockPane.NestedDockingStatus; - Rectangle rectLimit = Parent.RectangleToScreen(status.LogicalBounds); - if (((ISplitterDragSource)this).IsVertical) - { - rectLimit.X += MeasurePane.MinSize; - rectLimit.Width -= 2 * MeasurePane.MinSize; - } - else - { - rectLimit.Y += MeasurePane.MinSize; - rectLimit.Height -= 2 * MeasurePane.MinSize; - } - - return rectLimit; - } - } - - void ISplitterDragSource.MoveSplitter(int offset) - { - NestedDockingStatus status = DockPane.NestedDockingStatus; - double proportion = status.Proportion; - if (status.LogicalBounds.Width <= 0 || status.LogicalBounds.Height <= 0) - return; - else if (status.DisplayingAlignment == DockAlignment.Left) - proportion += ((double)offset) / (double)status.LogicalBounds.Width; - else if (status.DisplayingAlignment == DockAlignment.Right) - proportion -= ((double)offset) / (double)status.LogicalBounds.Width; - else if (status.DisplayingAlignment == DockAlignment.Top) - proportion += ((double)offset) / (double)status.LogicalBounds.Height; - else - proportion -= ((double)offset) / (double)status.LogicalBounds.Height; - - DockPane.SetNestedDockingProportion(proportion); - } - - #region IDragSource Members - - Control IDragSource.DragControl - { - get { return this; } - } - - #endregion - - #endregion - } - - private SplitterControl m_splitter; - private SplitterControl Splitter - { - get { return m_splitter; } - } - - internal Rectangle SplitterBounds - { - set { Splitter.Bounds = value; } - } - - internal DockAlignment SplitterAlignment - { - set { Splitter.Alignment = value; } - } - } -} \ No newline at end of file diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPane.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPane.cs deleted file mode 100644 index ca637e24d..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPane.cs +++ /dev/null @@ -1,1317 +0,0 @@ -using System; -using System.ComponentModel; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.Security.Permissions; -using System.Diagnostics.CodeAnalysis; - -namespace WeifenLuo.WinFormsUI.Docking -{ - [ToolboxItem(false)] - public partial class DockPane : UserControl, IDockDragSource - { - public enum AppearanceStyle - { - ToolWindow, - Document - } - - private enum HitTestArea - { - Caption, - TabStrip, - Content, - None - } - - private struct HitTestResult - { - public HitTestArea HitArea; - public int Index; - - public HitTestResult(HitTestArea hitTestArea, int index) - { - HitArea = hitTestArea; - Index = index; - } - } - - private DockPaneCaptionBase m_captionControl; - private DockPaneCaptionBase CaptionControl - { - get { return m_captionControl; } - } - - private DockPaneStripBase m_tabStripControl; - public DockPaneStripBase TabStripControl - { - get { return m_tabStripControl; } - } - - internal protected DockPane(IDockContent content, DockState visibleState, bool show) - { - InternalConstruct(content, visibleState, false, Rectangle.Empty, null, DockAlignment.Right, 0.5, show); - } - - [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "1#")] - internal protected DockPane(IDockContent content, FloatWindow floatWindow, bool show) - { - if (floatWindow == null) - throw new ArgumentNullException("floatWindow"); - - InternalConstruct(content, DockState.Float, false, Rectangle.Empty, floatWindow.NestedPanes.GetDefaultPreviousPane(this), DockAlignment.Right, 0.5, show); - } - - internal protected DockPane(IDockContent content, DockPane previousPane, DockAlignment alignment, double proportion, bool show) - { - if (previousPane == null) - throw (new ArgumentNullException("previousPane")); - InternalConstruct(content, previousPane.DockState, false, Rectangle.Empty, previousPane, alignment, proportion, show); - } - - [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "1#")] - internal protected DockPane(IDockContent content, Rectangle floatWindowBounds, bool show) - { - InternalConstruct(content, DockState.Float, true, floatWindowBounds, null, DockAlignment.Right, 0.5, show); - } - - private void InternalConstruct(IDockContent content, DockState dockState, bool flagBounds, Rectangle floatWindowBounds, DockPane prevPane, DockAlignment alignment, double proportion, bool show) - { - if (dockState == DockState.Hidden || dockState == DockState.Unknown) - throw new ArgumentException(Strings.DockPane_SetDockState_InvalidState); - - if (content == null) - throw new ArgumentNullException(Strings.DockPane_Constructor_NullContent); - - if (content.DockHandler.DockPanel == null) - throw new ArgumentException(Strings.DockPane_Constructor_NullDockPanel); - - - SuspendLayout(); - SetStyle(ControlStyles.Selectable, false); - - m_isFloat = (dockState == DockState.Float); - - m_contents = new DockContentCollection(); - m_displayingContents = new DockContentCollection(this); - m_dockPanel = content.DockHandler.DockPanel; - m_dockPanel.AddPane(this); - - m_splitter = new SplitterControl(this); - - m_nestedDockingStatus = new NestedDockingStatus(this); - - m_captionControl = DockPanel.DockPaneCaptionFactory.CreateDockPaneCaption(this); - m_tabStripControl = DockPanel.DockPaneStripFactory.CreateDockPaneStrip(this); - Controls.AddRange(new Control[] { m_captionControl, m_tabStripControl }); - - DockPanel.SuspendLayout(true); - if (flagBounds) - FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this, floatWindowBounds); - else if (prevPane != null) - DockTo(prevPane.NestedPanesContainer, prevPane, alignment, proportion); - - SetDockState(dockState); - if (show) - content.DockHandler.Pane = this; - else if (this.IsFloat) - content.DockHandler.FloatPane = this; - else - content.DockHandler.PanelPane = this; - - ResumeLayout(); - DockPanel.ResumeLayout(true, true); - } - - private bool m_isDisposing; - - protected override void Dispose(bool disposing) - { - if (disposing) - { - // IMPORTANT: avoid nested call into this method on Mono. - // https://github.com/dockpanelsuite/dockpanelsuite/issues/16 - if (Win32Helper.IsRunningOnMono) - { - if (m_isDisposing) - return; - - m_isDisposing = true; - } - - m_dockState = DockState.Unknown; - - if (NestedPanesContainer != null) - NestedPanesContainer.NestedPanes.Remove(this); - - if (DockPanel != null) - { - DockPanel.RemovePane(this); - m_dockPanel = null; - } - - Splitter.Dispose(); - if (m_autoHidePane != null) - m_autoHidePane.Dispose(); - } - base.Dispose(disposing); - } - - private IDockContent m_activeContent = null; - public virtual IDockContent ActiveContent - { - get { return m_activeContent; } - set - { - if (ActiveContent == value) - return; - - if (value != null) - { - if (!DisplayingContents.Contains(value)) - throw (new InvalidOperationException(Strings.DockPane_ActiveContent_InvalidValue)); - } - else - { - if (DisplayingContents.Count != 0) - throw (new InvalidOperationException(Strings.DockPane_ActiveContent_InvalidValue)); - } - - IDockContent oldValue = m_activeContent; - - if (DockPanel.ActiveAutoHideContent == oldValue) - DockPanel.ActiveAutoHideContent = null; - - m_activeContent = value; - - if (DockPanel.DocumentStyle == DocumentStyle.DockingMdi && DockState == DockState.Document) - { - if (m_activeContent != null) - m_activeContent.DockHandler.Form.BringToFront(); - } - else - { - if (m_activeContent != null) - m_activeContent.DockHandler.SetVisible(); - if (oldValue != null && DisplayingContents.Contains(oldValue)) - oldValue.DockHandler.SetVisible(); - if (IsActivated && m_activeContent != null) - m_activeContent.DockHandler.Activate(); - } - - if (FloatWindow != null) - FloatWindow.SetText(); - - if (DockPanel.DocumentStyle == DocumentStyle.DockingMdi && - DockState == DockState.Document) - RefreshChanges(false); // delayed layout to reduce screen flicker - else - RefreshChanges(); - - if (m_activeContent != null) - TabStripControl.EnsureTabVisible(m_activeContent); - } - } - - private bool m_allowDockDragAndDrop = true; - public virtual bool AllowDockDragAndDrop - { - get { return m_allowDockDragAndDrop; } - set { m_allowDockDragAndDrop = value; } - } - - private IDisposable m_autoHidePane = null; - internal IDisposable AutoHidePane - { - get { return m_autoHidePane; } - set { m_autoHidePane = value; } - } - - private object m_autoHideTabs = null; - internal object AutoHideTabs - { - get { return m_autoHideTabs; } - set { m_autoHideTabs = value; } - } - - private object TabPageContextMenu - { - get - { - IDockContent content = ActiveContent; - - if (content == null) - return null; - - if (content.DockHandler.TabPageContextMenuStrip != null) - return content.DockHandler.TabPageContextMenuStrip; - else if (content.DockHandler.TabPageContextMenu != null) - return content.DockHandler.TabPageContextMenu; - else - return null; - } - } - - internal bool HasTabPageContextMenu - { - get { return TabPageContextMenu != null; } - } - - internal void ShowTabPageContextMenu(Control control, Point position) - { - object menu = TabPageContextMenu; - - if (menu == null) - return; - - ContextMenuStrip contextMenuStrip = menu as ContextMenuStrip; - if (contextMenuStrip != null) - { - contextMenuStrip.Show(control, position); - return; - } - - ContextMenu contextMenu = menu as ContextMenu; - if (contextMenu != null) - contextMenu.Show(this, position); - } - - private Rectangle CaptionRectangle - { - get - { - if (!HasCaption) - return Rectangle.Empty; - - Rectangle rectWindow = DisplayingRectangle; - int x, y, width; - x = rectWindow.X; - y = rectWindow.Y; - width = rectWindow.Width; - int height = CaptionControl.MeasureHeight(); - - return new Rectangle(x, y, width, height); - } - } - - internal Rectangle ContentRectangle - { - get - { - Rectangle rectWindow = DisplayingRectangle; - Rectangle rectCaption = CaptionRectangle; - Rectangle rectTabStrip = TabStripRectangle; - - int x = rectWindow.X; - - int y = rectWindow.Y + (rectCaption.IsEmpty ? 0 : rectCaption.Height); - if (DockState == DockState.Document && DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Top) - y += rectTabStrip.Height; - - int width = rectWindow.Width; - int height = rectWindow.Height - rectCaption.Height - rectTabStrip.Height; - - return new Rectangle(x, y, width, height); - } - } - - internal Rectangle TabStripRectangle - { - get - { - if (Appearance == AppearanceStyle.ToolWindow) - return TabStripRectangle_ToolWindow; - else - return TabStripRectangle_Document; - } - } - - private Rectangle TabStripRectangle_ToolWindow - { - get - { - if (DisplayingContents.Count <= 1 || IsAutoHide) - return Rectangle.Empty; - - Rectangle rectWindow = DisplayingRectangle; - - int width = rectWindow.Width; - int height = TabStripControl.MeasureHeight(); - int x = rectWindow.X; - int y = rectWindow.Bottom - height; - Rectangle rectCaption = CaptionRectangle; - if (rectCaption.Contains(x, y)) - y = rectCaption.Y + rectCaption.Height; - - return new Rectangle(x, y, width, height); - } - } - - private Rectangle TabStripRectangle_Document - { - get - { - if (DisplayingContents.Count == 0) - return Rectangle.Empty; - - if (DisplayingContents.Count == 1 && DockPanel.DocumentStyle == DocumentStyle.DockingSdi) - return Rectangle.Empty; - - Rectangle rectWindow = DisplayingRectangle; - int x = rectWindow.X; - int width = rectWindow.Width; - int height = TabStripControl.MeasureHeight(); - - int y = 0; - if (DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - y = rectWindow.Height - height; - else - y = rectWindow.Y; - - return new Rectangle(x, y, width, height); - } - } - - public virtual string CaptionText - { - get { return ActiveContent == null ? string.Empty : ActiveContent.DockHandler.TabText; } - } - - private DockContentCollection m_contents; - public DockContentCollection Contents - { - get { return m_contents; } - } - - private DockContentCollection m_displayingContents; - public DockContentCollection DisplayingContents - { - get { return m_displayingContents; } - } - - private DockPanel m_dockPanel; - public DockPanel DockPanel - { - get { return m_dockPanel; } - } - - private bool HasCaption - { - get - { - if (DockState == DockState.Document || - DockState == DockState.Hidden || - DockState == DockState.Unknown || - (DockState == DockState.Float && FloatWindow.VisibleNestedPanes.Count <= 1)) - return false; - else - return true; - } - } - - private bool m_isActivated = false; - public bool IsActivated - { - get { return m_isActivated; } - } - internal void SetIsActivated(bool value) - { - if (m_isActivated == value) - return; - - m_isActivated = value; - if (DockState != DockState.Document) - RefreshChanges(false); - OnIsActivatedChanged(EventArgs.Empty); - } - - private bool m_isActiveDocumentPane = false; - public bool IsActiveDocumentPane - { - get { return m_isActiveDocumentPane; } - } - internal void SetIsActiveDocumentPane(bool value) - { - if (m_isActiveDocumentPane == value) - return; - - m_isActiveDocumentPane = value; - if (DockState == DockState.Document) - RefreshChanges(); - OnIsActiveDocumentPaneChanged(EventArgs.Empty); - } - - public bool IsDockStateValid(DockState dockState) - { - foreach (IDockContent content in Contents) - if (!content.DockHandler.IsDockStateValid(dockState)) - return false; - - return true; - } - - public bool IsAutoHide - { - get { return DockHelper.IsDockStateAutoHide(DockState); } - } - - public AppearanceStyle Appearance - { - get { return (DockState == DockState.Document) ? AppearanceStyle.Document : AppearanceStyle.ToolWindow; } - } - - internal Rectangle DisplayingRectangle - { - get { return ClientRectangle; } - } - - public void Activate() - { - if (DockHelper.IsDockStateAutoHide(DockState) && DockPanel.ActiveAutoHideContent != ActiveContent) - DockPanel.ActiveAutoHideContent = ActiveContent; - else if (!IsActivated && ActiveContent != null) - ActiveContent.DockHandler.Activate(); - } - - internal void AddContent(IDockContent content) - { - if (Contents.Contains(content)) - return; - - Contents.Add(content); - } - - internal void Close() - { - Dispose(); - } - - public void CloseActiveContent() - { - CloseContent(ActiveContent); - } - - internal void CloseContent(IDockContent content) - { - if (content == null) - return; - - if (!content.DockHandler.CloseButton) - return; - - DockPanel dockPanel = DockPanel; - - dockPanel.SuspendLayout(true); - - try - { - if (content.DockHandler.HideOnClose) - { - content.DockHandler.Hide(); - NestedDockingStatus.NestedPanes.SwitchPaneWithFirstChild(this); - } - else - content.DockHandler.Close(); - } - finally - { - dockPanel.ResumeLayout(true, true); - } - } - - private HitTestResult GetHitTest(Point ptMouse) - { - Point ptMouseClient = PointToClient(ptMouse); - - Rectangle rectCaption = CaptionRectangle; - if (rectCaption.Contains(ptMouseClient)) - return new HitTestResult(HitTestArea.Caption, -1); - - Rectangle rectContent = ContentRectangle; - if (rectContent.Contains(ptMouseClient)) - return new HitTestResult(HitTestArea.Content, -1); - - Rectangle rectTabStrip = TabStripRectangle; - if (rectTabStrip.Contains(ptMouseClient)) - return new HitTestResult(HitTestArea.TabStrip, TabStripControl.HitTest(TabStripControl.PointToClient(ptMouse))); - - return new HitTestResult(HitTestArea.None, -1); - } - - private bool m_isHidden = true; - public bool IsHidden - { - get { return m_isHidden; } - } - private void SetIsHidden(bool value) - { - if (m_isHidden == value) - return; - - m_isHidden = value; - if (DockHelper.IsDockStateAutoHide(DockState)) - { - DockPanel.RefreshAutoHideStrip(); - DockPanel.PerformLayout(); - } - else if (NestedPanesContainer != null) - ((Control)NestedPanesContainer).PerformLayout(); - } - - protected override void OnLayout(LayoutEventArgs levent) - { - SetIsHidden(DisplayingContents.Count == 0); - if (!IsHidden) - { - CaptionControl.Bounds = CaptionRectangle; - TabStripControl.Bounds = TabStripRectangle; - - SetContentBounds(); - - foreach (IDockContent content in Contents) - { - if (DisplayingContents.Contains(content)) - if (content.DockHandler.FlagClipWindow && content.DockHandler.Form.Visible) - content.DockHandler.FlagClipWindow = false; - } - } - - base.OnLayout(levent); - } - - internal void SetContentBounds() - { - Rectangle rectContent = ContentRectangle; - if (DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.DockingMdi) - rectContent = DockPanel.RectangleToMdiClient(RectangleToScreen(rectContent)); - - Rectangle rectInactive = new Rectangle(-rectContent.Width, rectContent.Y, rectContent.Width, rectContent.Height); - foreach (IDockContent content in Contents) - if (content.DockHandler.Pane == this) - { - if (content == ActiveContent) - content.DockHandler.Form.Bounds = rectContent; - else - content.DockHandler.Form.Bounds = rectInactive; - } - } - - internal void RefreshChanges() - { - RefreshChanges(true); - } - - private void RefreshChanges(bool performLayout) - { - if (IsDisposed) - return; - - CaptionControl.RefreshChanges(); - TabStripControl.RefreshChanges(); - if (DockState == DockState.Float && FloatWindow != null) - FloatWindow.RefreshChanges(); - if (DockHelper.IsDockStateAutoHide(DockState) && DockPanel != null) - { - DockPanel.RefreshAutoHideStrip(); - DockPanel.PerformLayout(); - } - - if (performLayout) - PerformLayout(); - } - - internal void RemoveContent(IDockContent content) - { - if (!Contents.Contains(content)) - return; - - Contents.Remove(content); - } - - public void SetContentIndex(IDockContent content, int index) - { - int oldIndex = Contents.IndexOf(content); - if (oldIndex == -1) - throw (new ArgumentException(Strings.DockPane_SetContentIndex_InvalidContent)); - - if (index < 0 || index > Contents.Count - 1) - if (index != -1) - throw (new ArgumentOutOfRangeException(Strings.DockPane_SetContentIndex_InvalidIndex)); - - if (oldIndex == index) - return; - if (oldIndex == Contents.Count - 1 && index == -1) - return; - - Contents.Remove(content); - if (index == -1) - Contents.Add(content); - else if (oldIndex < index) - Contents.AddAt(content, index - 1); - else - Contents.AddAt(content, index); - - RefreshChanges(); - } - - private void SetParent() - { - if (DockState == DockState.Unknown || DockState == DockState.Hidden) - { - SetParent(null); - Splitter.Parent = null; - } - else if (DockState == DockState.Float) - { - SetParent(FloatWindow); - Splitter.Parent = FloatWindow; - } - else if (DockHelper.IsDockStateAutoHide(DockState)) - { - SetParent(DockPanel.AutoHideControl); - Splitter.Parent = null; - } - else - { - SetParent(DockPanel.DockWindows[DockState]); - Splitter.Parent = Parent; - } - } - - private void SetParent(Control value) - { - if (Parent == value) - return; - - //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // Workaround of .Net Framework bug: - // Change the parent of a control with focus may result in the first - // MDI child form get activated. - //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - IDockContent contentFocused = GetFocusedContent(); - if (contentFocused != null) - DockPanel.SaveFocus(); - - //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - Parent = value; - - //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // Workaround of .Net Framework bug: - // Change the parent of a control with focus may result in the first - // MDI child form get activated. - //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if (contentFocused != null) - contentFocused.DockHandler.Activate(); - //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - } - - public new void Show() - { - Activate(); - } - - internal void TestDrop(IDockDragSource dragSource, DockOutlineBase dockOutline) - { - if (!dragSource.CanDockTo(this)) - return; - - Point ptMouse = Control.MousePosition; - - HitTestResult hitTestResult = GetHitTest(ptMouse); - if (hitTestResult.HitArea == HitTestArea.Caption) - dockOutline.Show(this, -1); - else if (hitTestResult.HitArea == HitTestArea.TabStrip && hitTestResult.Index != -1) - dockOutline.Show(this, hitTestResult.Index); - } - - internal void ValidateActiveContent() - { - if (ActiveContent == null) - { - if (DisplayingContents.Count != 0) - ActiveContent = DisplayingContents[0]; - return; - } - - if (DisplayingContents.IndexOf(ActiveContent) >= 0) - return; - - IDockContent prevVisible = null; - for (int i = Contents.IndexOf(ActiveContent) - 1; i >= 0; i--) - if (Contents[i].DockHandler.DockState == DockState) - { - prevVisible = Contents[i]; - break; - } - - IDockContent nextVisible = null; - for (int i = Contents.IndexOf(ActiveContent) + 1; i < Contents.Count; i++) - if (Contents[i].DockHandler.DockState == DockState) - { - nextVisible = Contents[i]; - break; - } - - if (prevVisible != null) - ActiveContent = prevVisible; - else if (nextVisible != null) - ActiveContent = nextVisible; - else - ActiveContent = null; - } - - private static readonly object DockStateChangedEvent = new object(); - public event EventHandler DockStateChanged - { - add { Events.AddHandler(DockStateChangedEvent, value); } - remove { Events.RemoveHandler(DockStateChangedEvent, value); } - } - protected virtual void OnDockStateChanged(EventArgs e) - { - EventHandler handler = (EventHandler)Events[DockStateChangedEvent]; - if (handler != null) - handler(this, e); - } - - private static readonly object IsActivatedChangedEvent = new object(); - public event EventHandler IsActivatedChanged - { - add { Events.AddHandler(IsActivatedChangedEvent, value); } - remove { Events.RemoveHandler(IsActivatedChangedEvent, value); } - } - protected virtual void OnIsActivatedChanged(EventArgs e) - { - EventHandler handler = (EventHandler)Events[IsActivatedChangedEvent]; - if (handler != null) - handler(this, e); - } - - private static readonly object IsActiveDocumentPaneChangedEvent = new object(); - public event EventHandler IsActiveDocumentPaneChanged - { - add { Events.AddHandler(IsActiveDocumentPaneChangedEvent, value); } - remove { Events.RemoveHandler(IsActiveDocumentPaneChangedEvent, value); } - } - protected virtual void OnIsActiveDocumentPaneChanged(EventArgs e) - { - EventHandler handler = (EventHandler)Events[IsActiveDocumentPaneChangedEvent]; - if (handler != null) - handler(this, e); - } - - public DockWindow DockWindow - { - get { return (m_nestedDockingStatus.NestedPanes == null) ? null : m_nestedDockingStatus.NestedPanes.Container as DockWindow; } - set - { - DockWindow oldValue = DockWindow; - if (oldValue == value) - return; - - DockTo(value); - } - } - - public FloatWindow FloatWindow - { - get { return (m_nestedDockingStatus.NestedPanes == null) ? null : m_nestedDockingStatus.NestedPanes.Container as FloatWindow; } - set - { - FloatWindow oldValue = FloatWindow; - if (oldValue == value) - return; - - DockTo(value); - } - } - - private NestedDockingStatus m_nestedDockingStatus; - public NestedDockingStatus NestedDockingStatus - { - get { return m_nestedDockingStatus; } - } - - private bool m_isFloat; - public bool IsFloat - { - get { return m_isFloat; } - } - - public INestedPanesContainer NestedPanesContainer - { - get - { - if (NestedDockingStatus.NestedPanes == null) - return null; - else - return NestedDockingStatus.NestedPanes.Container; - } - } - - private DockState m_dockState = DockState.Unknown; - public DockState DockState - { - get { return m_dockState; } - set - { - SetDockState(value); - } - } - - public DockPane SetDockState(DockState value) - { - if (value == DockState.Unknown || value == DockState.Hidden) - throw new InvalidOperationException(Strings.DockPane_SetDockState_InvalidState); - - if ((value == DockState.Float) == this.IsFloat) - { - InternalSetDockState(value); - return this; - } - - if (DisplayingContents.Count == 0) - return null; - - IDockContent firstContent = null; - for (int i = 0; i < DisplayingContents.Count; i++) - { - IDockContent content = DisplayingContents[i]; - if (content.DockHandler.IsDockStateValid(value)) - { - firstContent = content; - break; - } - } - if (firstContent == null) - return null; - - firstContent.DockHandler.DockState = value; - DockPane pane = firstContent.DockHandler.Pane; - DockPanel.SuspendLayout(true); - for (int i = 0; i < DisplayingContents.Count; i++) - { - IDockContent content = DisplayingContents[i]; - if (content.DockHandler.IsDockStateValid(value)) - content.DockHandler.Pane = pane; - } - DockPanel.ResumeLayout(true, true); - return pane; - } - - private void InternalSetDockState(DockState value) - { - if (m_dockState == value) - return; - - DockState oldDockState = m_dockState; - INestedPanesContainer oldContainer = NestedPanesContainer; - - m_dockState = value; - - SuspendRefreshStateChange(); - - IDockContent contentFocused = GetFocusedContent(); - if (contentFocused != null) - DockPanel.SaveFocus(); - - if (!IsFloat) - DockWindow = DockPanel.DockWindows[DockState]; - else if (FloatWindow == null) - FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this); - - if (contentFocused != null) - { - if (!Win32Helper.IsRunningOnMono) - { - DockPanel.ContentFocusManager.Activate(contentFocused); - } - } - - ResumeRefreshStateChange(oldContainer, oldDockState); - } - - private int m_countRefreshStateChange = 0; - private void SuspendRefreshStateChange() - { - m_countRefreshStateChange++; - DockPanel.SuspendLayout(true); - } - - private void ResumeRefreshStateChange() - { - m_countRefreshStateChange--; - System.Diagnostics.Debug.Assert(m_countRefreshStateChange >= 0); - DockPanel.ResumeLayout(true, true); - } - - private bool IsRefreshStateChangeSuspended - { - get { return m_countRefreshStateChange != 0; } - } - - private void ResumeRefreshStateChange(INestedPanesContainer oldContainer, DockState oldDockState) - { - ResumeRefreshStateChange(); - RefreshStateChange(oldContainer, oldDockState); - } - - private void RefreshStateChange(INestedPanesContainer oldContainer, DockState oldDockState) - { - if (IsRefreshStateChangeSuspended) - return; - - SuspendRefreshStateChange(); - - DockPanel.SuspendLayout(true); - - IDockContent contentFocused = GetFocusedContent(); - if (contentFocused != null) - DockPanel.SaveFocus(); - SetParent(); - - if (ActiveContent != null) - ActiveContent.DockHandler.SetDockState(ActiveContent.DockHandler.IsHidden, DockState, ActiveContent.DockHandler.Pane); - foreach (IDockContent content in Contents) - { - if (content.DockHandler.Pane == this) - content.DockHandler.SetDockState(content.DockHandler.IsHidden, DockState, content.DockHandler.Pane); - } - - if (oldContainer != null) - { - Control oldContainerControl = (Control)oldContainer; - if (oldContainer.DockState == oldDockState && !oldContainerControl.IsDisposed) - oldContainerControl.PerformLayout(); - } - if (DockHelper.IsDockStateAutoHide(oldDockState)) - DockPanel.RefreshActiveAutoHideContent(); - - if (NestedPanesContainer.DockState == DockState) - ((Control)NestedPanesContainer).PerformLayout(); - if (DockHelper.IsDockStateAutoHide(DockState)) - DockPanel.RefreshActiveAutoHideContent(); - - if (DockHelper.IsDockStateAutoHide(oldDockState) || - DockHelper.IsDockStateAutoHide(DockState)) - { - DockPanel.RefreshAutoHideStrip(); - DockPanel.PerformLayout(); - } - - ResumeRefreshStateChange(); - - if (contentFocused != null) - contentFocused.DockHandler.Activate(); - - DockPanel.ResumeLayout(true, true); - - if (oldDockState != DockState) - OnDockStateChanged(EventArgs.Empty); - } - - private IDockContent GetFocusedContent() - { - IDockContent contentFocused = null; - foreach (IDockContent content in Contents) - { - if (content.DockHandler.Form.ContainsFocus) - { - contentFocused = content; - break; - } - } - - return contentFocused; - } - - public DockPane DockTo(INestedPanesContainer container) - { - if (container == null) - throw new InvalidOperationException(Strings.DockPane_DockTo_NullContainer); - - DockAlignment alignment; - if (container.DockState == DockState.DockLeft || container.DockState == DockState.DockRight) - alignment = DockAlignment.Bottom; - else - alignment = DockAlignment.Right; - - return DockTo(container, container.NestedPanes.GetDefaultPreviousPane(this), alignment, 0.5); - } - - public DockPane DockTo(INestedPanesContainer container, DockPane previousPane, DockAlignment alignment, double proportion) - { - if (container == null) - throw new InvalidOperationException(Strings.DockPane_DockTo_NullContainer); - - if (container.IsFloat == this.IsFloat) - { - InternalAddToDockList(container, previousPane, alignment, proportion); - return this; - } - - IDockContent firstContent = GetFirstContent(container.DockState); - if (firstContent == null) - return null; - - DockPane pane; - DockPanel.DummyContent.DockPanel = DockPanel; - if (container.IsFloat) - pane = DockPanel.DockPaneFactory.CreateDockPane(DockPanel.DummyContent, (FloatWindow)container, true); - else - pane = DockPanel.DockPaneFactory.CreateDockPane(DockPanel.DummyContent, container.DockState, true); - - pane.DockTo(container, previousPane, alignment, proportion); - SetVisibleContentsToPane(pane); - DockPanel.DummyContent.DockPanel = null; - - return pane; - } - - private void SetVisibleContentsToPane(DockPane pane) - { - SetVisibleContentsToPane(pane, ActiveContent); - } - - private void SetVisibleContentsToPane(DockPane pane, IDockContent activeContent) - { - for (int i = 0; i < DisplayingContents.Count; i++) - { - IDockContent content = DisplayingContents[i]; - if (content.DockHandler.IsDockStateValid(pane.DockState)) - { - content.DockHandler.Pane = pane; - i--; - } - } - - if (activeContent.DockHandler.Pane == pane) - pane.ActiveContent = activeContent; - } - - private void InternalAddToDockList(INestedPanesContainer container, DockPane prevPane, DockAlignment alignment, double proportion) - { - if ((container.DockState == DockState.Float) != IsFloat) - throw new InvalidOperationException(Strings.DockPane_DockTo_InvalidContainer); - - int count = container.NestedPanes.Count; - if (container.NestedPanes.Contains(this)) - count--; - if (prevPane == null && count > 0) - throw new InvalidOperationException(Strings.DockPane_DockTo_NullPrevPane); - - if (prevPane != null && !container.NestedPanes.Contains(prevPane)) - throw new InvalidOperationException(Strings.DockPane_DockTo_NoPrevPane); - - if (prevPane == this) - throw new InvalidOperationException(Strings.DockPane_DockTo_SelfPrevPane); - - INestedPanesContainer oldContainer = NestedPanesContainer; - DockState oldDockState = DockState; - container.NestedPanes.Add(this); - NestedDockingStatus.SetStatus(container.NestedPanes, prevPane, alignment, proportion); - - if (DockHelper.IsDockWindowState(DockState)) - m_dockState = container.DockState; - - RefreshStateChange(oldContainer, oldDockState); - } - - public void SetNestedDockingProportion(double proportion) - { - NestedDockingStatus.SetStatus(NestedDockingStatus.NestedPanes, NestedDockingStatus.PreviousPane, NestedDockingStatus.Alignment, proportion); - if (NestedPanesContainer != null) - ((Control)NestedPanesContainer).PerformLayout(); - } - - public DockPane Float() - { - DockPanel.SuspendLayout(true); - - IDockContent activeContent = ActiveContent; - - DockPane floatPane = GetFloatPaneFromContents(); - if (floatPane == null) - { - IDockContent firstContent = GetFirstContent(DockState.Float); - if (firstContent == null) - { - DockPanel.ResumeLayout(true, true); - return null; - } - floatPane = DockPanel.DockPaneFactory.CreateDockPane(firstContent, DockState.Float, true); - } - SetVisibleContentsToPane(floatPane, activeContent); - - DockPanel.ResumeLayout(true, true); - return floatPane; - } - - private DockPane GetFloatPaneFromContents() - { - DockPane floatPane = null; - for (int i = 0; i < DisplayingContents.Count; i++) - { - IDockContent content = DisplayingContents[i]; - if (!content.DockHandler.IsDockStateValid(DockState.Float)) - continue; - - if (floatPane != null && content.DockHandler.FloatPane != floatPane) - return null; - else - floatPane = content.DockHandler.FloatPane; - } - - return floatPane; - } - - private IDockContent GetFirstContent(DockState dockState) - { - for (int i = 0; i < DisplayingContents.Count; i++) - { - IDockContent content = DisplayingContents[i]; - if (content.DockHandler.IsDockStateValid(dockState)) - return content; - } - return null; - } - - public void RestoreToPanel() - { - DockPanel.SuspendLayout(true); - - IDockContent activeContent = DockPanel.ActiveContent; - - for (int i = DisplayingContents.Count - 1; i >= 0; i--) - { - IDockContent content = DisplayingContents[i]; - if (content.DockHandler.CheckDockState(false) != DockState.Unknown) - content.DockHandler.IsFloat = false; - } - - DockPanel.ResumeLayout(true, true); - } - - [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] - protected override void WndProc(ref Message m) - { - if (m.Msg == (int)Win32.Msgs.WM_MOUSEACTIVATE) - Activate(); - - base.WndProc(ref m); - } - - #region IDockDragSource Members - - #region IDragSource Members - - Control IDragSource.DragControl - { - get { return this; } - } - - #endregion - - bool IDockDragSource.IsDockStateValid(DockState dockState) - { - return IsDockStateValid(dockState); - } - - bool IDockDragSource.CanDockTo(DockPane pane) - { - if (!IsDockStateValid(pane.DockState)) - return false; - - if (pane == this) - return false; - - return true; - } - - Rectangle IDockDragSource.BeginDrag(Point ptMouse) - { - Point location = PointToScreen(new Point(0, 0)); - Size size; - - DockPane floatPane = ActiveContent.DockHandler.FloatPane; - if (DockState == DockState.Float || floatPane == null || floatPane.FloatWindow.NestedPanes.Count != 1) - size = DockPanel.DefaultFloatWindowSize; - else - size = floatPane.FloatWindow.Size; - - if (ptMouse.X > location.X + size.Width) - location.X += ptMouse.X - (location.X + size.Width) + Measures.SplitterSize; - - return new Rectangle(location, size); - } - - void IDockDragSource.EndDrag() - { - } - - public void FloatAt(Rectangle floatWindowBounds) - { - if (FloatWindow == null || FloatWindow.NestedPanes.Count != 1) - FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this, floatWindowBounds); - else - FloatWindow.Bounds = floatWindowBounds; - - DockState = DockState.Float; - - NestedDockingStatus.NestedPanes.SwitchPaneWithFirstChild(this); - } - - public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex) - { - if (dockStyle == DockStyle.Fill) - { - IDockContent activeContent = ActiveContent; - for (int i = Contents.Count - 1; i >= 0; i--) - { - IDockContent c = Contents[i]; - if (c.DockHandler.DockState == DockState) - { - c.DockHandler.Pane = pane; - if (contentIndex != -1) - pane.SetContentIndex(c, contentIndex); - } - } - pane.ActiveContent = activeContent; - } - else - { - if (dockStyle == DockStyle.Left) - DockTo(pane.NestedPanesContainer, pane, DockAlignment.Left, 0.5); - else if (dockStyle == DockStyle.Right) - DockTo(pane.NestedPanesContainer, pane, DockAlignment.Right, 0.5); - else if (dockStyle == DockStyle.Top) - DockTo(pane.NestedPanesContainer, pane, DockAlignment.Top, 0.5); - else if (dockStyle == DockStyle.Bottom) - DockTo(pane.NestedPanesContainer, pane, DockAlignment.Bottom, 0.5); - - DockState = pane.DockState; - } - } - - public void DockTo(DockPanel panel, DockStyle dockStyle) - { - if (panel != DockPanel) - throw new ArgumentException(Strings.IDockDragSource_DockTo_InvalidPanel, "panel"); - - if (dockStyle == DockStyle.Top) - DockState = DockState.DockTop; - else if (dockStyle == DockStyle.Bottom) - DockState = DockState.DockBottom; - else if (dockStyle == DockStyle.Left) - DockState = DockState.DockLeft; - else if (dockStyle == DockStyle.Right) - DockState = DockState.DockRight; - else if (dockStyle == DockStyle.Fill) - DockState = DockState.Document; - } - - #endregion - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPaneCaptionBase.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPaneCaptionBase.cs deleted file mode 100644 index e66b261f5..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPaneCaptionBase.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.Windows.Forms; -using System.Drawing; -using System.Runtime.InteropServices; -using System.Security.Permissions; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public abstract class DockPaneCaptionBase : Control - { - protected internal DockPaneCaptionBase(DockPane pane) - { - m_dockPane = pane; - - SetStyle(ControlStyles.OptimizedDoubleBuffer | - ControlStyles.ResizeRedraw | - ControlStyles.UserPaint | - ControlStyles.AllPaintingInWmPaint, true); - SetStyle(ControlStyles.Selectable, false); - } - - private DockPane m_dockPane; - protected DockPane DockPane - { - get { return m_dockPane; } - } - - protected DockPane.AppearanceStyle Appearance - { - get { return DockPane.Appearance; } - } - - protected bool HasTabPageContextMenu - { - get { return DockPane.HasTabPageContextMenu; } - } - - protected void ShowTabPageContextMenu(Point position) - { - DockPane.ShowTabPageContextMenu(this, position); - } - - protected override void OnMouseUp(MouseEventArgs e) - { - base.OnMouseUp(e); - - if (e.Button == MouseButtons.Right) - ShowTabPageContextMenu(new Point(e.X, e.Y)); - } - - protected override void OnMouseDown(MouseEventArgs e) - { - base.OnMouseDown(e); - - if (e.Button == MouseButtons.Left && - DockPane.DockPanel.AllowEndUserDocking && - DockPane.AllowDockDragAndDrop && - !DockHelper.IsDockStateAutoHide(DockPane.DockState) && - DockPane.ActiveContent != null) - DockPane.DockPanel.BeginDrag(DockPane); - } - - [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] - protected override void WndProc(ref Message m) - { - if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK) - { - if (DockHelper.IsDockStateAutoHide(DockPane.DockState)) - { - DockPane.DockPanel.ActiveAutoHideContent = null; - return; - } - - if (DockPane.IsFloat) - DockPane.RestoreToPanel(); - else - DockPane.Float(); - } - base.WndProc(ref m); - } - - internal void RefreshChanges() - { - if (IsDisposed) - return; - - OnRefreshChanges(); - } - - protected virtual void OnRightToLeftLayoutChanged() - { - } - - protected virtual void OnRefreshChanges() - { - } - - protected internal abstract int MeasureHeight(); - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPaneCollection.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPaneCollection.cs deleted file mode 100644 index d946aca71..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPaneCollection.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.ObjectModel; -using System.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public class DockPaneCollection : ReadOnlyCollection - { - internal DockPaneCollection() - : base(new List()) - { - } - - internal int Add(DockPane pane) - { - if (Items.Contains(pane)) - return Items.IndexOf(pane); - - Items.Add(pane); - return Count - 1; - } - - internal void AddAt(DockPane pane, int index) - { - if (index < 0 || index > Items.Count - 1) - return; - - if (Contains(pane)) - return; - - Items.Insert(index, pane); - } - - internal void Dispose() - { - for (int i=Count - 1; i>=0; i--) - this[i].Close(); - } - - internal void Remove(DockPane pane) - { - Items.Remove(pane); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPaneStripBase.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPaneStripBase.cs deleted file mode 100644 index 332943839..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPaneStripBase.cs +++ /dev/null @@ -1,265 +0,0 @@ -using System; -using System.Windows.Forms; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Collections; -using System.Collections.Generic; -using System.Security.Permissions; -using System.Diagnostics.CodeAnalysis; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public abstract class DockPaneStripBase : Control - { - [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - public class Tab : IDisposable - { - private IDockContent m_content; - - public Tab(IDockContent content) - { - m_content = content; - } - - ~Tab() - { - Dispose(false); - } - - public IDockContent Content - { - get { return m_content; } - } - - public Form ContentForm - { - get { return m_content as Form; } - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - } - } - - [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - public sealed class TabCollection : IEnumerable - { - #region IEnumerable Members - IEnumerator IEnumerable.GetEnumerator() - { - for (int i = 0; i < Count; i++) - yield return this[i]; - } - - IEnumerator IEnumerable.GetEnumerator() - { - for (int i = 0; i < Count; i++) - yield return this[i]; - } - #endregion - - internal TabCollection(DockPane pane) - { - m_dockPane = pane; - } - - private DockPane m_dockPane; - public DockPane DockPane - { - get { return m_dockPane; } - } - - public int Count - { - get { return DockPane.DisplayingContents.Count; } - } - - public Tab this[int index] - { - get - { - IDockContent content = DockPane.DisplayingContents[index]; - if (content == null) - throw (new ArgumentOutOfRangeException("index")); - return content.DockHandler.GetTab(DockPane.TabStripControl); - } - } - - public bool Contains(Tab tab) - { - return (IndexOf(tab) != -1); - } - - public bool Contains(IDockContent content) - { - return (IndexOf(content) != -1); - } - - public int IndexOf(Tab tab) - { - if (tab == null) - return -1; - - return DockPane.DisplayingContents.IndexOf(tab.Content); - } - - public int IndexOf(IDockContent content) - { - return DockPane.DisplayingContents.IndexOf(content); - } - } - - protected DockPaneStripBase(DockPane pane) - { - m_dockPane = pane; - - SetStyle(ControlStyles.OptimizedDoubleBuffer, true); - SetStyle(ControlStyles.Selectable, false); - AllowDrop = true; - } - - private DockPane m_dockPane; - public DockPane DockPane - { - get { return m_dockPane; } - } - - protected DockPane.AppearanceStyle Appearance - { - get { return DockPane.Appearance; } - } - - private TabCollection m_tabs = null; - public TabCollection Tabs - { - get - { - if (m_tabs == null) - m_tabs = new TabCollection(DockPane); - - return m_tabs; - } - } - - internal void RefreshChanges() - { - if (IsDisposed) - return; - - OnRefreshChanges(); - } - - protected virtual void OnRefreshChanges() - { - } - - protected internal abstract int MeasureHeight(); - - protected internal abstract void EnsureTabVisible(IDockContent content); - - public int HitTest() - { - return HitTest(PointToClient(Control.MousePosition)); - } - - public abstract int HitTest(Point point); - - protected internal abstract GraphicsPath GetOutline(int index); - - protected internal virtual Tab CreateTab(IDockContent content) - { - return new Tab(content); - } - - protected override void OnMouseDown(MouseEventArgs e) - { - base.OnMouseDown(e); - - int index = HitTest(e.Location); - - if (index != -1) - { - if (e.Button == MouseButtons.Middle) - { - // Close the specified content. - IDockContent content = Tabs[index].Content; - DockPane.CloseContent(content); - } - else - { - IDockContent content = Tabs[index].Content; - if (DockPane.ActiveContent != content) - DockPane.ActiveContent = content; - } - } - - if (e.Button == MouseButtons.Left) - { - if (DockPane.DockPanel.AllowEndUserDocking && DockPane.AllowDockDragAndDrop && DockPane.ActiveContent.DockHandler.AllowEndUserDocking) - DockPane.DockPanel.BeginDrag(DockPane.ActiveContent.DockHandler); - } - } - - protected bool HasTabPageContextMenu - { - get { return DockPane.HasTabPageContextMenu; } - } - - protected void ShowTabPageContextMenu(Point position) - { - DockPane.ShowTabPageContextMenu(this, position); - } - - protected override void OnMouseUp(MouseEventArgs e) - { - base.OnMouseUp(e); - - if (e.Button == MouseButtons.Right) - ShowTabPageContextMenu(new Point(e.X, e.Y)); - } - - [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] - protected override void WndProc(ref Message m) - { - if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK) - { - base.WndProc(ref m); - - int index = HitTest(); - if (DockPane.DockPanel.AllowEndUserDocking && index != -1) - { - IDockContent content = Tabs[index].Content; - if (content.DockHandler.CheckDockState(!content.DockHandler.IsFloat) != DockState.Unknown) - content.DockHandler.IsFloat = !content.DockHandler.IsFloat; - } - - return; - } - - base.WndProc(ref m); - return; - } - - protected override void OnDragOver(DragEventArgs drgevent) - { - base.OnDragOver(drgevent); - - if (!DockPane.DockPanel.RaiseTabsOnDragOver) - return; - - int index = HitTest(); - if (index != -1) - { - IDockContent content = Tabs[index].Content; - if (DockPane.ActiveContent != content) - DockPane.ActiveContent = content; - } - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.Appearance.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.Appearance.cs deleted file mode 100644 index eb97d901c..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.Appearance.cs +++ /dev/null @@ -1,35 +0,0 @@ -using WeifenLuo.WinFormsUI.Docking.Skins; -using System.ComponentModel; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public partial class DockPanel - { - private DockPanelSkin m_dockPanelSkin = DockPanelSkinBuilder.Create(Style.VisualStudio2005); - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockPanel_DockPanelSkin")] - public DockPanelSkin Skin - { - get { return m_dockPanelSkin; } - set { m_dockPanelSkin = value; } - } - - private Style m_dockPanelSkinStyle = Style.VisualStudio2005; - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockPanel_DockPanelSkinStyle")] - [DefaultValue(Style.VisualStudio2005)] - public Style SkinStyle - { - get { return m_dockPanelSkinStyle; } - set - { - if (m_dockPanelSkinStyle == value) - return; - - m_dockPanelSkinStyle = value; - - Skin = DockPanelSkinBuilder.Create(m_dockPanelSkinStyle); - } - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.AutoHideWindow.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.AutoHideWindow.cs deleted file mode 100644 index 4d910b837..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.AutoHideWindow.cs +++ /dev/null @@ -1,634 +0,0 @@ -using System; -using System.Windows.Forms; -using System.Drawing; -using System.Runtime.InteropServices; - -namespace WeifenLuo.WinFormsUI.Docking -{ - partial class DockPanel - { - private class AutoHideWindowControl : Panel, ISplitterDragSource - { - private class SplitterControl : SplitterBase - { - public SplitterControl(AutoHideWindowControl autoHideWindow) - { - m_autoHideWindow = autoHideWindow; - } - - private AutoHideWindowControl m_autoHideWindow; - private AutoHideWindowControl AutoHideWindow - { - get { return m_autoHideWindow; } - } - - protected override int SplitterSize - { - get { return Measures.SplitterSize; } - } - - protected override void StartDrag() - { - AutoHideWindow.DockPanel.BeginDrag(AutoHideWindow, AutoHideWindow.RectangleToScreen(Bounds)); - } - } - - #region consts - private const int ANIMATE_TIME = 100; // in mini-seconds - #endregion - - private Timer m_timerMouseTrack; - private SplitterControl m_splitter; - - public AutoHideWindowControl(DockPanel dockPanel) - { - m_dockPanel = dockPanel; - - m_timerMouseTrack = new Timer(); - m_timerMouseTrack.Tick += new EventHandler(TimerMouseTrack_Tick); - - Visible = false; - m_splitter = new SplitterControl(this); - Controls.Add(m_splitter); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - m_timerMouseTrack.Dispose(); - } - base.Dispose(disposing); - } - - private DockPanel m_dockPanel = null; - public DockPanel DockPanel - { - get { return m_dockPanel; } - } - - private DockPane m_activePane = null; - public DockPane ActivePane - { - get { return m_activePane; } - } - private void SetActivePane() - { - DockPane value = (ActiveContent == null ? null : ActiveContent.DockHandler.Pane); - - if (value == m_activePane) - return; - - m_activePane = value; - } - - private static readonly object ActiveContentChangedEvent = new object(); - public event EventHandler ActiveContentChanged - { - add { Events.AddHandler(ActiveContentChangedEvent, value); } - remove { Events.RemoveHandler(ActiveContentChangedEvent, value); } - } - - protected virtual void OnActiveContentChanged(EventArgs e) - { - EventHandler handler = (EventHandler)Events[ActiveContentChangedEvent]; - if (handler != null) - handler(this, e); - } - - private IDockContent m_activeContent = null; - public IDockContent ActiveContent - { - get { return m_activeContent; } - set - { - if (value == m_activeContent) - return; - - if (value != null) - { - if (!DockHelper.IsDockStateAutoHide(value.DockHandler.DockState) || value.DockHandler.DockPanel != DockPanel) - throw (new InvalidOperationException(Strings.DockPanel_ActiveAutoHideContent_InvalidValue)); - } - - DockPanel.SuspendLayout(); - - if (m_activeContent != null) - { - if (m_activeContent.DockHandler.Form.ContainsFocus) - { - if (!Win32Helper.IsRunningOnMono) - { - DockPanel.ContentFocusManager.GiveUpFocus(m_activeContent); - } - } - - AnimateWindow(false); - } - - m_activeContent = value; - SetActivePane(); - if (ActivePane != null) - ActivePane.ActiveContent = m_activeContent; - - if (m_activeContent != null) - AnimateWindow(true); - - DockPanel.ResumeLayout(); - DockPanel.RefreshAutoHideStrip(); - - SetTimerMouseTrack(); - - OnActiveContentChanged(EventArgs.Empty); - } - } - - public DockState DockState - { - get { return ActiveContent == null ? DockState.Unknown : ActiveContent.DockHandler.DockState; } - } - - private bool m_flagAnimate = true; - private bool FlagAnimate - { - get { return m_flagAnimate; } - set { m_flagAnimate = value; } - } - - private bool m_flagDragging = false; - internal bool FlagDragging - { - get { return m_flagDragging; } - set - { - if (m_flagDragging == value) - return; - - m_flagDragging = value; - SetTimerMouseTrack(); - } - } - - private void AnimateWindow(bool show) - { - if (!FlagAnimate && Visible != show) - { - Visible = show; - return; - } - - Parent.SuspendLayout(); - - Rectangle rectSource = GetRectangle(!show); - Rectangle rectTarget = GetRectangle(show); - int dxLoc, dyLoc; - int dWidth, dHeight; - dxLoc = dyLoc = dWidth = dHeight = 0; - if (DockState == DockState.DockTopAutoHide) - dHeight = show ? 1 : -1; - else if (DockState == DockState.DockLeftAutoHide) - dWidth = show ? 1 : -1; - else if (DockState == DockState.DockRightAutoHide) - { - dxLoc = show ? -1 : 1; - dWidth = show ? 1 : -1; - } - else if (DockState == DockState.DockBottomAutoHide) - { - dyLoc = (show ? -1 : 1); - dHeight = (show ? 1 : -1); - } - - if (show) - { - Bounds = DockPanel.GetAutoHideWindowBounds(new Rectangle(-rectTarget.Width, -rectTarget.Height, rectTarget.Width, rectTarget.Height)); - if (Visible == false) - Visible = true; - PerformLayout(); - } - - SuspendLayout(); - - LayoutAnimateWindow(rectSource); - if (Visible == false) - Visible = true; - - int speedFactor = 1; - int totalPixels = (rectSource.Width != rectTarget.Width) ? - Math.Abs(rectSource.Width - rectTarget.Width) : - Math.Abs(rectSource.Height - rectTarget.Height); - int remainPixels = totalPixels; - DateTime startingTime = DateTime.Now; - while (rectSource != rectTarget) - { - DateTime startPerMove = DateTime.Now; - - rectSource.X += dxLoc * speedFactor; - rectSource.Y += dyLoc * speedFactor; - rectSource.Width += dWidth * speedFactor; - rectSource.Height += dHeight * speedFactor; - if (Math.Sign(rectTarget.X - rectSource.X) != Math.Sign(dxLoc)) - rectSource.X = rectTarget.X; - if (Math.Sign(rectTarget.Y - rectSource.Y) != Math.Sign(dyLoc)) - rectSource.Y = rectTarget.Y; - if (Math.Sign(rectTarget.Width - rectSource.Width) != Math.Sign(dWidth)) - rectSource.Width = rectTarget.Width; - if (Math.Sign(rectTarget.Height - rectSource.Height) != Math.Sign(dHeight)) - rectSource.Height = rectTarget.Height; - - LayoutAnimateWindow(rectSource); - if (Parent != null) - Parent.Update(); - - remainPixels -= speedFactor; - - while (true) - { - TimeSpan time = new TimeSpan(0, 0, 0, 0, ANIMATE_TIME); - TimeSpan elapsedPerMove = DateTime.Now - startPerMove; - TimeSpan elapsedTime = DateTime.Now - startingTime; - if (((int)((time - elapsedTime).TotalMilliseconds)) <= 0) - { - speedFactor = remainPixels; - break; - } - else - speedFactor = remainPixels * (int)elapsedPerMove.TotalMilliseconds / (int)((time - elapsedTime).TotalMilliseconds); - if (speedFactor >= 1) - break; - } - } - ResumeLayout(); - Parent.ResumeLayout(); - } - - private void LayoutAnimateWindow(Rectangle rect) - { - Bounds = DockPanel.GetAutoHideWindowBounds(rect); - - Rectangle rectClient = ClientRectangle; - - if (DockState == DockState.DockLeftAutoHide) - ActivePane.Location = new Point(rectClient.Right - 2 - Measures.SplitterSize - ActivePane.Width, ActivePane.Location.Y); - else if (DockState == DockState.DockTopAutoHide) - ActivePane.Location = new Point(ActivePane.Location.X, rectClient.Bottom - 2 - Measures.SplitterSize - ActivePane.Height); - } - - private Rectangle GetRectangle(bool show) - { - if (DockState == DockState.Unknown) - return Rectangle.Empty; - - Rectangle rect = DockPanel.AutoHideWindowRectangle; - - if (show) - return rect; - - if (DockState == DockState.DockLeftAutoHide) - rect.Width = 0; - else if (DockState == DockState.DockRightAutoHide) - { - rect.X += rect.Width; - rect.Width = 0; - } - else if (DockState == DockState.DockTopAutoHide) - rect.Height = 0; - else - { - rect.Y += rect.Height; - rect.Height = 0; - } - - return rect; - } - - private void SetTimerMouseTrack() - { - if (ActivePane == null || ActivePane.IsActivated || FlagDragging) - { - m_timerMouseTrack.Enabled = false; - return; - } - - // start the timer - int hovertime = SystemInformation.MouseHoverTime ; - - // assign a default value 400 in case of setting Timer.Interval invalid value exception - if (hovertime <= 0) - hovertime = 400; - - m_timerMouseTrack.Interval = 2 * (int)hovertime; - m_timerMouseTrack.Enabled = true; - } - - protected virtual Rectangle DisplayingRectangle - { - get - { - Rectangle rect = ClientRectangle; - - // exclude the border and the splitter - if (DockState == DockState.DockBottomAutoHide) - { - rect.Y += 2 + Measures.SplitterSize; - rect.Height -= 2 + Measures.SplitterSize; - } - else if (DockState == DockState.DockRightAutoHide) - { - rect.X += 2 + Measures.SplitterSize; - rect.Width -= 2 + Measures.SplitterSize; - } - else if (DockState == DockState.DockTopAutoHide) - rect.Height -= 2 + Measures.SplitterSize; - else if (DockState == DockState.DockLeftAutoHide) - rect.Width -= 2 + Measures.SplitterSize; - - return rect; - } - } - - protected override void OnLayout(LayoutEventArgs levent) - { - DockPadding.All = 0; - if (DockState == DockState.DockLeftAutoHide) - { - DockPadding.Right = 2; - m_splitter.Dock = DockStyle.Right; - } - else if (DockState == DockState.DockRightAutoHide) - { - DockPadding.Left = 2; - m_splitter.Dock = DockStyle.Left; - } - else if (DockState == DockState.DockTopAutoHide) - { - DockPadding.Bottom = 2; - m_splitter.Dock = DockStyle.Bottom; - } - else if (DockState == DockState.DockBottomAutoHide) - { - DockPadding.Top = 2; - m_splitter.Dock = DockStyle.Top; - } - - Rectangle rectDisplaying = DisplayingRectangle; - Rectangle rectHidden = new Rectangle(-rectDisplaying.Width, rectDisplaying.Y, rectDisplaying.Width, rectDisplaying.Height); - foreach (Control c in Controls) - { - DockPane pane = c as DockPane; - if (pane == null) - continue; - - - if (pane == ActivePane) - pane.Bounds = rectDisplaying; - else - pane.Bounds = rectHidden; - } - - base.OnLayout(levent); - } - - protected override void OnPaint(PaintEventArgs e) - { - // Draw the border - Graphics g = e.Graphics; - - if (DockState == DockState.DockBottomAutoHide) - g.DrawLine(SystemPens.ControlLightLight, 0, 1, ClientRectangle.Right, 1); - else if (DockState == DockState.DockRightAutoHide) - g.DrawLine(SystemPens.ControlLightLight, 1, 0, 1, ClientRectangle.Bottom); - else if (DockState == DockState.DockTopAutoHide) - { - g.DrawLine(SystemPens.ControlDark, 0, ClientRectangle.Height - 2, ClientRectangle.Right, ClientRectangle.Height - 2); - g.DrawLine(SystemPens.ControlDarkDark, 0, ClientRectangle.Height - 1, ClientRectangle.Right, ClientRectangle.Height - 1); - } - else if (DockState == DockState.DockLeftAutoHide) - { - g.DrawLine(SystemPens.ControlDark, ClientRectangle.Width - 2, 0, ClientRectangle.Width - 2, ClientRectangle.Bottom); - g.DrawLine(SystemPens.ControlDarkDark, ClientRectangle.Width - 1, 0, ClientRectangle.Width - 1, ClientRectangle.Bottom); - } - - base.OnPaint(e); - } - - public void RefreshActiveContent() - { - if (ActiveContent == null) - return; - - if (!DockHelper.IsDockStateAutoHide(ActiveContent.DockHandler.DockState)) - { - FlagAnimate = false; - ActiveContent = null; - FlagAnimate = true; - } - } - - public void RefreshActivePane() - { - SetTimerMouseTrack(); - } - - private void TimerMouseTrack_Tick(object sender, EventArgs e) - { - if (IsDisposed) - return; - - if (ActivePane == null || ActivePane.IsActivated) - { - m_timerMouseTrack.Enabled = false; - return; - } - - DockPane pane = ActivePane; - Point ptMouseInAutoHideWindow = PointToClient(Control.MousePosition); - Point ptMouseInDockPanel = DockPanel.PointToClient(Control.MousePosition); - - Rectangle rectTabStrip = DockPanel.GetTabStripRectangle(pane.DockState); - - if (!ClientRectangle.Contains(ptMouseInAutoHideWindow) && !rectTabStrip.Contains(ptMouseInDockPanel)) - { - ActiveContent = null; - m_timerMouseTrack.Enabled = false; - } - } - - #region ISplitterDragSource Members - - void ISplitterDragSource.BeginDrag(Rectangle rectSplitter) - { - FlagDragging = true; - } - - void ISplitterDragSource.EndDrag() - { - FlagDragging = false; - } - - bool ISplitterDragSource.IsVertical - { - get { return (DockState == DockState.DockLeftAutoHide || DockState == DockState.DockRightAutoHide); } - } - - Rectangle ISplitterDragSource.DragLimitBounds - { - get - { - Rectangle rectLimit = DockPanel.DockArea; - - if ((this as ISplitterDragSource).IsVertical) - { - rectLimit.X += MeasurePane.MinSize; - rectLimit.Width -= 2 * MeasurePane.MinSize; - } - else - { - rectLimit.Y += MeasurePane.MinSize; - rectLimit.Height -= 2 * MeasurePane.MinSize; - } - - return DockPanel.RectangleToScreen(rectLimit); - } - } - - void ISplitterDragSource.MoveSplitter(int offset) - { - Rectangle rectDockArea = DockPanel.DockArea; - IDockContent content = ActiveContent; - if (DockState == DockState.DockLeftAutoHide && rectDockArea.Width > 0) - { - if (content.DockHandler.AutoHidePortion < 1) - content.DockHandler.AutoHidePortion += ((double)offset) / (double)rectDockArea.Width; - else - content.DockHandler.AutoHidePortion = Width + offset; - } - else if (DockState == DockState.DockRightAutoHide && rectDockArea.Width > 0) - { - if (content.DockHandler.AutoHidePortion < 1) - content.DockHandler.AutoHidePortion -= ((double)offset) / (double)rectDockArea.Width; - else - content.DockHandler.AutoHidePortion = Width - offset; - } - else if (DockState == DockState.DockBottomAutoHide && rectDockArea.Height > 0) - { - if (content.DockHandler.AutoHidePortion < 1) - content.DockHandler.AutoHidePortion -= ((double)offset) / (double)rectDockArea.Height; - else - content.DockHandler.AutoHidePortion = Height - offset; - } - else if (DockState == DockState.DockTopAutoHide && rectDockArea.Height > 0) - { - if (content.DockHandler.AutoHidePortion < 1) - content.DockHandler.AutoHidePortion += ((double)offset) / (double)rectDockArea.Height; - else - content.DockHandler.AutoHidePortion = Height + offset; - } - } - - #region IDragSource Members - - Control IDragSource.DragControl - { - get { return this; } - } - - #endregion - - #endregion - } - - private AutoHideWindowControl AutoHideWindow - { - get { return m_autoHideWindow; } - } - - internal Control AutoHideControl - { - get { return m_autoHideWindow; } - } - - internal void RefreshActiveAutoHideContent() - { - AutoHideWindow.RefreshActiveContent(); - } - - internal Rectangle AutoHideWindowRectangle - { - get - { - DockState state = AutoHideWindow.DockState; - Rectangle rectDockArea = DockArea; - if (ActiveAutoHideContent == null) - return Rectangle.Empty; - - if (Parent == null) - return Rectangle.Empty; - - Rectangle rect = Rectangle.Empty; - double autoHideSize = ActiveAutoHideContent.DockHandler.AutoHidePortion; - if (state == DockState.DockLeftAutoHide) - { - if (autoHideSize < 1) - autoHideSize = rectDockArea.Width * autoHideSize; - if (autoHideSize > rectDockArea.Width - MeasurePane.MinSize) - autoHideSize = rectDockArea.Width - MeasurePane.MinSize; - rect.X = rectDockArea.X; - rect.Y = rectDockArea.Y; - rect.Width = (int)autoHideSize; - rect.Height = rectDockArea.Height; - } - else if (state == DockState.DockRightAutoHide) - { - if (autoHideSize < 1) - autoHideSize = rectDockArea.Width * autoHideSize; - if (autoHideSize > rectDockArea.Width - MeasurePane.MinSize) - autoHideSize = rectDockArea.Width - MeasurePane.MinSize; - rect.X = rectDockArea.X + rectDockArea.Width - (int)autoHideSize; - rect.Y = rectDockArea.Y; - rect.Width = (int)autoHideSize; - rect.Height = rectDockArea.Height; - } - else if (state == DockState.DockTopAutoHide) - { - if (autoHideSize < 1) - autoHideSize = rectDockArea.Height * autoHideSize; - if (autoHideSize > rectDockArea.Height - MeasurePane.MinSize) - autoHideSize = rectDockArea.Height - MeasurePane.MinSize; - rect.X = rectDockArea.X; - rect.Y = rectDockArea.Y; - rect.Width = rectDockArea.Width; - rect.Height = (int)autoHideSize; - } - else if (state == DockState.DockBottomAutoHide) - { - if (autoHideSize < 1) - autoHideSize = rectDockArea.Height * autoHideSize; - if (autoHideSize > rectDockArea.Height - MeasurePane.MinSize) - autoHideSize = rectDockArea.Height - MeasurePane.MinSize; - rect.X = rectDockArea.X; - rect.Y = rectDockArea.Y + rectDockArea.Height - (int)autoHideSize; - rect.Width = rectDockArea.Width; - rect.Height = (int)autoHideSize; - } - - return rect; - } - } - - internal Rectangle GetAutoHideWindowBounds(Rectangle rectAutoHideWindow) - { - if (DocumentStyle == DocumentStyle.SystemMdi || - DocumentStyle == DocumentStyle.DockingMdi) - return (Parent == null) ? Rectangle.Empty : Parent.RectangleToClient(RectangleToScreen(rectAutoHideWindow)); - else - return rectAutoHideWindow; - } - - internal void RefreshAutoHideStrip() - { - AutoHideStripControl.RefreshChanges(); - } - - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.DockDragHandler.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.DockDragHandler.cs deleted file mode 100644 index 2e5935b8e..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.DockDragHandler.cs +++ /dev/null @@ -1,816 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.ComponentModel; - -namespace WeifenLuo.WinFormsUI.Docking -{ - partial class DockPanel - { - private sealed class DockDragHandler : DragHandler - { - private class DockIndicator : DragForm - { - #region IHitTest - private interface IHitTest - { - DockStyle HitTest(Point pt); - DockStyle Status { get; set; } - } - #endregion - - #region PanelIndicator - private class PanelIndicator : PictureBox, IHitTest - { - private static Image _imagePanelLeft = Resources.DockIndicator_PanelLeft; - private static Image _imagePanelRight = Resources.DockIndicator_PanelRight; - private static Image _imagePanelTop = Resources.DockIndicator_PanelTop; - private static Image _imagePanelBottom = Resources.DockIndicator_PanelBottom; - private static Image _imagePanelFill = Resources.DockIndicator_PanelFill; - private static Image _imagePanelLeftActive = Resources.DockIndicator_PanelLeft_Active; - private static Image _imagePanelRightActive = Resources.DockIndicator_PanelRight_Active; - private static Image _imagePanelTopActive = Resources.DockIndicator_PanelTop_Active; - private static Image _imagePanelBottomActive = Resources.DockIndicator_PanelBottom_Active; - private static Image _imagePanelFillActive = Resources.DockIndicator_PanelFill_Active; - - public PanelIndicator(DockStyle dockStyle) - { - m_dockStyle = dockStyle; - SizeMode = PictureBoxSizeMode.AutoSize; - Image = ImageInactive; - } - - private DockStyle m_dockStyle; - private DockStyle DockStyle - { - get { return m_dockStyle; } - } - - private DockStyle m_status; - public DockStyle Status - { - get { return m_status; } - set - { - if (value != DockStyle && value != DockStyle.None) - throw new InvalidEnumArgumentException(); - - if (m_status == value) - return; - - m_status = value; - IsActivated = (m_status != DockStyle.None); - } - } - - private Image ImageInactive - { - get - { - if (DockStyle == DockStyle.Left) - return _imagePanelLeft; - else if (DockStyle == DockStyle.Right) - return _imagePanelRight; - else if (DockStyle == DockStyle.Top) - return _imagePanelTop; - else if (DockStyle == DockStyle.Bottom) - return _imagePanelBottom; - else if (DockStyle == DockStyle.Fill) - return _imagePanelFill; - else - return null; - } - } - - private Image ImageActive - { - get - { - if (DockStyle == DockStyle.Left) - return _imagePanelLeftActive; - else if (DockStyle == DockStyle.Right) - return _imagePanelRightActive; - else if (DockStyle == DockStyle.Top) - return _imagePanelTopActive; - else if (DockStyle == DockStyle.Bottom) - return _imagePanelBottomActive; - else if (DockStyle == DockStyle.Fill) - return _imagePanelFillActive; - else - return null; - } - } - - private bool m_isActivated = false; - private bool IsActivated - { - get { return m_isActivated; } - set - { - m_isActivated = value; - Image = IsActivated ? ImageActive : ImageInactive; - } - } - - public DockStyle HitTest(Point pt) - { - return this.Visible && ClientRectangle.Contains(PointToClient(pt)) ? DockStyle : DockStyle.None; - } - } - #endregion PanelIndicator - - #region PaneIndicator - private class PaneIndicator : PictureBox, IHitTest - { - private struct HotSpotIndex - { - public HotSpotIndex(int x, int y, DockStyle dockStyle) - { - m_x = x; - m_y = y; - m_dockStyle = dockStyle; - } - - private int m_x; - public int X - { - get { return m_x; } - } - - private int m_y; - public int Y - { - get { return m_y; } - } - - private DockStyle m_dockStyle; - public DockStyle DockStyle - { - get { return m_dockStyle; } - } - } - - private static Bitmap _bitmapPaneDiamond = Resources.DockIndicator_PaneDiamond; - private static Bitmap _bitmapPaneDiamondLeft = Resources.DockIndicator_PaneDiamond_Left; - private static Bitmap _bitmapPaneDiamondRight = Resources.DockIndicator_PaneDiamond_Right; - private static Bitmap _bitmapPaneDiamondTop = Resources.DockIndicator_PaneDiamond_Top; - private static Bitmap _bitmapPaneDiamondBottom = Resources.DockIndicator_PaneDiamond_Bottom; - private static Bitmap _bitmapPaneDiamondFill = Resources.DockIndicator_PaneDiamond_Fill; - private static Bitmap _bitmapPaneDiamondHotSpot = Resources.DockIndicator_PaneDiamond_HotSpot; - private static Bitmap _bitmapPaneDiamondHotSpotIndex = Resources.DockIndicator_PaneDiamond_HotSpotIndex; - private static HotSpotIndex[] _hotSpots = new HotSpotIndex[] - { - new HotSpotIndex(1, 0, DockStyle.Top), - new HotSpotIndex(0, 1, DockStyle.Left), - new HotSpotIndex(1, 1, DockStyle.Fill), - new HotSpotIndex(2, 1, DockStyle.Right), - new HotSpotIndex(1, 2, DockStyle.Bottom) - }; - private static GraphicsPath _displayingGraphicsPath = DrawHelper.CalculateGraphicsPathFromBitmap(_bitmapPaneDiamond); - - public PaneIndicator() - { - SizeMode = PictureBoxSizeMode.AutoSize; - Image = _bitmapPaneDiamond; - Region = new Region(DisplayingGraphicsPath); - } - - public static GraphicsPath DisplayingGraphicsPath - { - get { return _displayingGraphicsPath; } - } - - public DockStyle HitTest(Point pt) - { - if (!Visible) - return DockStyle.None; - - pt = PointToClient(pt); - if (!ClientRectangle.Contains(pt)) - return DockStyle.None; - - for (int i = _hotSpots.GetLowerBound(0); i <= _hotSpots.GetUpperBound(0); i++) - { - if (_bitmapPaneDiamondHotSpot.GetPixel(pt.X, pt.Y) == _bitmapPaneDiamondHotSpotIndex.GetPixel(_hotSpots[i].X, _hotSpots[i].Y)) - return _hotSpots[i].DockStyle; - } - - return DockStyle.None; - } - - private DockStyle m_status = DockStyle.None; - public DockStyle Status - { - get { return m_status; } - set - { - m_status = value; - if (m_status == DockStyle.None) - Image = _bitmapPaneDiamond; - else if (m_status == DockStyle.Left) - Image = _bitmapPaneDiamondLeft; - else if (m_status == DockStyle.Right) - Image = _bitmapPaneDiamondRight; - else if (m_status == DockStyle.Top) - Image = _bitmapPaneDiamondTop; - else if (m_status == DockStyle.Bottom) - Image = _bitmapPaneDiamondBottom; - else if (m_status == DockStyle.Fill) - Image = _bitmapPaneDiamondFill; - } - } - } - #endregion PaneIndicator - - #region consts - private int _PanelIndicatorMargin = 10; - #endregion - - private DockDragHandler m_dragHandler; - - public DockIndicator(DockDragHandler dragHandler) - { - m_dragHandler = dragHandler; - Controls.AddRange(new Control[] { - PaneDiamond, - PanelLeft, - PanelRight, - PanelTop, - PanelBottom, - PanelFill - }); - Region = new Region(Rectangle.Empty); - } - - private PaneIndicator m_paneDiamond = null; - private PaneIndicator PaneDiamond - { - get - { - if (m_paneDiamond == null) - m_paneDiamond = new PaneIndicator(); - - return m_paneDiamond; - } - } - - private PanelIndicator m_panelLeft = null; - private PanelIndicator PanelLeft - { - get - { - if (m_panelLeft == null) - m_panelLeft = new PanelIndicator(DockStyle.Left); - - return m_panelLeft; - } - } - - private PanelIndicator m_panelRight = null; - private PanelIndicator PanelRight - { - get - { - if (m_panelRight == null) - m_panelRight = new PanelIndicator(DockStyle.Right); - - return m_panelRight; - } - } - - private PanelIndicator m_panelTop = null; - private PanelIndicator PanelTop - { - get - { - if (m_panelTop == null) - m_panelTop = new PanelIndicator(DockStyle.Top); - - return m_panelTop; - } - } - - private PanelIndicator m_panelBottom = null; - private PanelIndicator PanelBottom - { - get - { - if (m_panelBottom == null) - m_panelBottom = new PanelIndicator(DockStyle.Bottom); - - return m_panelBottom; - } - } - - private PanelIndicator m_panelFill = null; - private PanelIndicator PanelFill - { - get - { - if (m_panelFill == null) - m_panelFill = new PanelIndicator(DockStyle.Fill); - - return m_panelFill; - } - } - - private bool m_fullPanelEdge = false; - public bool FullPanelEdge - { - get { return m_fullPanelEdge; } - set - { - if (m_fullPanelEdge == value) - return; - - m_fullPanelEdge = value; - RefreshChanges(); - } - } - - public DockDragHandler DragHandler - { - get { return m_dragHandler; } - } - - public DockPanel DockPanel - { - get { return DragHandler.DockPanel; } - } - - private DockPane m_dockPane = null; - public DockPane DockPane - { - get { return m_dockPane; } - internal set - { - if (m_dockPane == value) - return; - - DockPane oldDisplayingPane = DisplayingPane; - m_dockPane = value; - if (oldDisplayingPane != DisplayingPane) - RefreshChanges(); - } - } - - private IHitTest m_hitTest = null; - private IHitTest HitTestResult - { - get { return m_hitTest; } - set - { - if (m_hitTest == value) - return; - - if (m_hitTest != null) - m_hitTest.Status = DockStyle.None; - - m_hitTest = value; - } - } - - private DockPane DisplayingPane - { - get { return ShouldPaneDiamondVisible() ? DockPane : null; } - } - - private void RefreshChanges() - { - Region region = new Region(Rectangle.Empty); - Rectangle rectDockArea = FullPanelEdge ? DockPanel.DockArea : DockPanel.DocumentWindowBounds; - - rectDockArea = RectangleToClient(DockPanel.RectangleToScreen(rectDockArea)); - if (ShouldPanelIndicatorVisible(DockState.DockLeft)) - { - PanelLeft.Location = new Point(rectDockArea.X + _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2); - PanelLeft.Visible = true; - region.Union(PanelLeft.Bounds); - } - else - PanelLeft.Visible = false; - - if (ShouldPanelIndicatorVisible(DockState.DockRight)) - { - PanelRight.Location = new Point(rectDockArea.X + rectDockArea.Width - PanelRight.Width - _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2); - PanelRight.Visible = true; - region.Union(PanelRight.Bounds); - } - else - PanelRight.Visible = false; - - if (ShouldPanelIndicatorVisible(DockState.DockTop)) - { - PanelTop.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelTop.Width) / 2, rectDockArea.Y + _PanelIndicatorMargin); - PanelTop.Visible = true; - region.Union(PanelTop.Bounds); - } - else - PanelTop.Visible = false; - - if (ShouldPanelIndicatorVisible(DockState.DockBottom)) - { - PanelBottom.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelBottom.Width) / 2, rectDockArea.Y + rectDockArea.Height - PanelBottom.Height - _PanelIndicatorMargin); - PanelBottom.Visible = true; - region.Union(PanelBottom.Bounds); - } - else - PanelBottom.Visible = false; - - if (ShouldPanelIndicatorVisible(DockState.Document)) - { - Rectangle rectDocumentWindow = RectangleToClient(DockPanel.RectangleToScreen(DockPanel.DocumentWindowBounds)); - PanelFill.Location = new Point(rectDocumentWindow.X + (rectDocumentWindow.Width - PanelFill.Width) / 2, rectDocumentWindow.Y + (rectDocumentWindow.Height - PanelFill.Height) / 2); - PanelFill.Visible = true; - region.Union(PanelFill.Bounds); - } - else - PanelFill.Visible = false; - - if (ShouldPaneDiamondVisible()) - { - Rectangle rect = RectangleToClient(DockPane.RectangleToScreen(DockPane.ClientRectangle)); - PaneDiamond.Location = new Point(rect.Left + (rect.Width - PaneDiamond.Width) / 2, rect.Top + (rect.Height - PaneDiamond.Height) / 2); - PaneDiamond.Visible = true; - using (GraphicsPath graphicsPath = PaneIndicator.DisplayingGraphicsPath.Clone() as GraphicsPath) - { - Point[] pts = new Point[] - { - new Point(PaneDiamond.Left, PaneDiamond.Top), - new Point(PaneDiamond.Right, PaneDiamond.Top), - new Point(PaneDiamond.Left, PaneDiamond.Bottom) - }; - using (Matrix matrix = new Matrix(PaneDiamond.ClientRectangle, pts)) - { - graphicsPath.Transform(matrix); - } - region.Union(graphicsPath); - } - } - else - PaneDiamond.Visible = false; - - Region = region; - } - - private bool ShouldPanelIndicatorVisible(DockState dockState) - { - if (!Visible) - return false; - - if (DockPanel.DockWindows[dockState].Visible) - return false; - - return DragHandler.DragSource.IsDockStateValid(dockState); - } - - private bool ShouldPaneDiamondVisible() - { - if (DockPane == null) - return false; - - if (!DockPanel.AllowEndUserNestedDocking) - return false; - - return DragHandler.DragSource.CanDockTo(DockPane); - } - - public override void Show(bool bActivate) - { - base.Show(bActivate); - Bounds = SystemInformation.VirtualScreen; - RefreshChanges(); - } - - public void TestDrop() - { - Point pt = Control.MousePosition; - DockPane = DockHelper.PaneAtPoint(pt, DockPanel); - - if (TestDrop(PanelLeft, pt) != DockStyle.None) - HitTestResult = PanelLeft; - else if (TestDrop(PanelRight, pt) != DockStyle.None) - HitTestResult = PanelRight; - else if (TestDrop(PanelTop, pt) != DockStyle.None) - HitTestResult = PanelTop; - else if (TestDrop(PanelBottom, pt) != DockStyle.None) - HitTestResult = PanelBottom; - else if (TestDrop(PanelFill, pt) != DockStyle.None) - HitTestResult = PanelFill; - else if (TestDrop(PaneDiamond, pt) != DockStyle.None) - HitTestResult = PaneDiamond; - else - HitTestResult = null; - - if (HitTestResult != null) - { - if (HitTestResult is PaneIndicator) - DragHandler.Outline.Show(DockPane, HitTestResult.Status); - else - DragHandler.Outline.Show(DockPanel, HitTestResult.Status, FullPanelEdge); - } - } - - private static DockStyle TestDrop(IHitTest hitTest, Point pt) - { - return hitTest.Status = hitTest.HitTest(pt); - } - } - - private class DockOutline : DockOutlineBase - { - public DockOutline() - { - m_dragForm = new DragForm(); - SetDragForm(Rectangle.Empty); - DragForm.BackColor = SystemColors.ActiveCaption; - DragForm.Opacity = 0.5; - DragForm.Show(false); - } - - DragForm m_dragForm; - private DragForm DragForm - { - get { return m_dragForm; } - } - - protected override void OnShow() - { - CalculateRegion(); - } - - protected override void OnClose() - { - DragForm.Close(); - } - - private void CalculateRegion() - { - if (SameAsOldValue) - return; - - if (!FloatWindowBounds.IsEmpty) - SetOutline(FloatWindowBounds); - else if (DockTo is DockPanel) - SetOutline(DockTo as DockPanel, Dock, (ContentIndex != 0)); - else if (DockTo is DockPane) - SetOutline(DockTo as DockPane, Dock, ContentIndex); - else - SetOutline(); - } - - private void SetOutline() - { - SetDragForm(Rectangle.Empty); - } - - private void SetOutline(Rectangle floatWindowBounds) - { - SetDragForm(floatWindowBounds); - } - - private void SetOutline(DockPanel dockPanel, DockStyle dock, bool fullPanelEdge) - { - Rectangle rect = fullPanelEdge ? dockPanel.DockArea : dockPanel.DocumentWindowBounds; - rect.Location = dockPanel.PointToScreen(rect.Location); - if (dock == DockStyle.Top) - { - int height = dockPanel.GetDockWindowSize(DockState.DockTop); - rect = new Rectangle(rect.X, rect.Y, rect.Width, height); - } - else if (dock == DockStyle.Bottom) - { - int height = dockPanel.GetDockWindowSize(DockState.DockBottom); - rect = new Rectangle(rect.X, rect.Bottom - height, rect.Width, height); - } - else if (dock == DockStyle.Left) - { - int width = dockPanel.GetDockWindowSize(DockState.DockLeft); - rect = new Rectangle(rect.X, rect.Y, width, rect.Height); - } - else if (dock == DockStyle.Right) - { - int width = dockPanel.GetDockWindowSize(DockState.DockRight); - rect = new Rectangle(rect.Right - width, rect.Y, width, rect.Height); - } - else if (dock == DockStyle.Fill) - { - rect = dockPanel.DocumentWindowBounds; - rect.Location = dockPanel.PointToScreen(rect.Location); - } - - SetDragForm(rect); - } - - private void SetOutline(DockPane pane, DockStyle dock, int contentIndex) - { - if (dock != DockStyle.Fill) - { - Rectangle rect = pane.DisplayingRectangle; - if (dock == DockStyle.Right) - rect.X += rect.Width / 2; - if (dock == DockStyle.Bottom) - rect.Y += rect.Height / 2; - if (dock == DockStyle.Left || dock == DockStyle.Right) - rect.Width -= rect.Width / 2; - if (dock == DockStyle.Top || dock == DockStyle.Bottom) - rect.Height -= rect.Height / 2; - rect.Location = pane.PointToScreen(rect.Location); - - SetDragForm(rect); - } - else if (contentIndex == -1) - { - Rectangle rect = pane.DisplayingRectangle; - rect.Location = pane.PointToScreen(rect.Location); - SetDragForm(rect); - } - else - { - using (GraphicsPath path = pane.TabStripControl.GetOutline(contentIndex)) - { - RectangleF rectF = path.GetBounds(); - Rectangle rect = new Rectangle((int)rectF.X, (int)rectF.Y, (int)rectF.Width, (int)rectF.Height); - using (Matrix matrix = new Matrix(rect, new Point[] { new Point(0, 0), new Point(rect.Width, 0), new Point(0, rect.Height) })) - { - path.Transform(matrix); - } - Region region = new Region(path); - SetDragForm(rect, region); - } - } - } - - private void SetDragForm(Rectangle rect) - { - DragForm.Bounds = rect; - if (rect == Rectangle.Empty) - DragForm.Region = new Region(Rectangle.Empty); - else if (DragForm.Region != null) - DragForm.Region = null; - } - - private void SetDragForm(Rectangle rect, Region region) - { - DragForm.Bounds = rect; - DragForm.Region = region; - } - } - - public DockDragHandler(DockPanel panel) - : base(panel) - { - } - - public new IDockDragSource DragSource - { - get { return base.DragSource as IDockDragSource; } - set { base.DragSource = value; } - } - - private DockOutlineBase m_outline; - public DockOutlineBase Outline - { - get { return m_outline; } - private set { m_outline = value; } - } - - private DockIndicator m_indicator; - private DockIndicator Indicator - { - get { return m_indicator; } - set { m_indicator = value; } - } - - private Rectangle m_floatOutlineBounds; - private Rectangle FloatOutlineBounds - { - get { return m_floatOutlineBounds; } - set { m_floatOutlineBounds = value; } - } - - public void BeginDrag(IDockDragSource dragSource) - { - DragSource = dragSource; - - if (!BeginDrag()) - { - DragSource = null; - return; - } - - Outline = new DockOutline(); - Indicator = new DockIndicator(this); - Indicator.Show(false); - - FloatOutlineBounds = DragSource.BeginDrag(StartMousePosition); - } - - protected override void OnDragging() - { - TestDrop(); - } - - protected override void OnEndDrag(bool abort) - { - DockPanel.SuspendLayout(true); - - Outline.Close(); - Indicator.Close(); - - EndDrag(abort); - - // Queue a request to layout all children controls - DockPanel.PerformMdiClientLayout(); - - DockPanel.ResumeLayout(true, true); - - DragSource.EndDrag(); - - DragSource = null; - } - - private void TestDrop() - { - Outline.FlagTestDrop = false; - - Indicator.FullPanelEdge = ((Control.ModifierKeys & Keys.Shift) != 0); - - if ((Control.ModifierKeys & Keys.Control) == 0) - { - Indicator.TestDrop(); - - if (!Outline.FlagTestDrop) - { - DockPane pane = DockHelper.PaneAtPoint(Control.MousePosition, DockPanel); - if (pane != null && DragSource.IsDockStateValid(pane.DockState)) - pane.TestDrop(DragSource, Outline); - } - - if (!Outline.FlagTestDrop && DragSource.IsDockStateValid(DockState.Float)) - { - FloatWindow floatWindow = DockHelper.FloatWindowAtPoint(Control.MousePosition, DockPanel); - if (floatWindow != null) - floatWindow.TestDrop(DragSource, Outline); - } - } - else - Indicator.DockPane = DockHelper.PaneAtPoint(Control.MousePosition, DockPanel); - - if (!Outline.FlagTestDrop) - { - if (DragSource.IsDockStateValid(DockState.Float)) - { - Rectangle rect = FloatOutlineBounds; - rect.Offset(Control.MousePosition.X - StartMousePosition.X, Control.MousePosition.Y - StartMousePosition.Y); - Outline.Show(rect); - } - } - - if (!Outline.FlagTestDrop) - { - Cursor.Current = Cursors.No; - Outline.Show(); - } - else - Cursor.Current = DragControl.Cursor; - } - - private void EndDrag(bool abort) - { - if (abort) - return; - - if (!Outline.FloatWindowBounds.IsEmpty) - DragSource.FloatAt(Outline.FloatWindowBounds); - else if (Outline.DockTo is DockPane) - { - DockPane pane = Outline.DockTo as DockPane; - DragSource.DockTo(pane, Outline.Dock, Outline.ContentIndex); - } - else if (Outline.DockTo is DockPanel) - { - DockPanel panel = Outline.DockTo as DockPanel; - panel.UpdateDockWindowZOrder(Outline.Dock, Outline.FlagFullEdge); - DragSource.DockTo(panel, Outline.Dock); - } - } - } - - private DockDragHandler m_dockDragHandler = null; - private DockDragHandler GetDockDragHandler() - { - if (m_dockDragHandler == null) - m_dockDragHandler = new DockDragHandler(this); - return m_dockDragHandler; - } - - internal void BeginDrag(IDockDragSource dragSource) - { - GetDockDragHandler().BeginDrag(dragSource); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.DragHandler.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.DragHandler.cs deleted file mode 100644 index 2ae47d02a..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.DragHandler.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.ComponentModel; - -namespace WeifenLuo.WinFormsUI.Docking -{ - partial class DockPanel - { - /// - /// DragHandlerBase is the base class for drag handlers. The derived class should: - /// 1. Define its public method BeginDrag. From within this public BeginDrag method, - /// DragHandlerBase.BeginDrag should be called to initialize the mouse capture - /// and message filtering. - /// 2. Override the OnDragging and OnEndDrag methods. - /// - private abstract class DragHandlerBase : NativeWindow, IMessageFilter - { - protected DragHandlerBase() - { - } - - protected abstract Control DragControl - { - get; - } - - private Point m_startMousePosition = Point.Empty; - protected Point StartMousePosition - { - get { return m_startMousePosition; } - private set { m_startMousePosition = value; } - } - - protected bool BeginDrag() - { - if (DragControl == null) - return false; - - StartMousePosition = Control.MousePosition; - - if (!Win32Helper.IsRunningOnMono) - { - if (!NativeMethods.DragDetect(DragControl.Handle, StartMousePosition)) - { - return false; - } - } - - DragControl.FindForm().Capture = true; - AssignHandle(DragControl.FindForm().Handle); - Application.AddMessageFilter(this); - return true; - } - - protected abstract void OnDragging(); - - protected abstract void OnEndDrag(bool abort); - - private void EndDrag(bool abort) - { - ReleaseHandle(); - Application.RemoveMessageFilter(this); - DragControl.FindForm().Capture = false; - - OnEndDrag(abort); - } - - bool IMessageFilter.PreFilterMessage(ref Message m) - { - if (m.Msg == (int)Win32.Msgs.WM_MOUSEMOVE) - OnDragging(); - else if (m.Msg == (int)Win32.Msgs.WM_LBUTTONUP) - EndDrag(false); - else if (m.Msg == (int)Win32.Msgs.WM_CAPTURECHANGED) - EndDrag(true); - else if (m.Msg == (int)Win32.Msgs.WM_KEYDOWN && (int)m.WParam == (int)Keys.Escape) - EndDrag(true); - - return OnPreFilterMessage(ref m); - } - - protected virtual bool OnPreFilterMessage(ref Message m) - { - return false; - } - - protected sealed override void WndProc(ref Message m) - { - if (m.Msg == (int)Win32.Msgs.WM_CANCELMODE || m.Msg == (int)Win32.Msgs.WM_CAPTURECHANGED) - EndDrag(true); - - base.WndProc(ref m); - } - } - - private abstract class DragHandler : DragHandlerBase - { - private DockPanel m_dockPanel; - - protected DragHandler(DockPanel dockPanel) - { - m_dockPanel = dockPanel; - } - - public DockPanel DockPanel - { - get { return m_dockPanel; } - } - - private IDragSource m_dragSource; - protected IDragSource DragSource - { - get { return m_dragSource; } - set { m_dragSource = value; } - } - - protected sealed override Control DragControl - { - get { return DragSource == null ? null : DragSource.DragControl; } - } - - protected sealed override bool OnPreFilterMessage(ref Message m) - { - if ((m.Msg == (int)Win32.Msgs.WM_KEYDOWN || m.Msg == (int)Win32.Msgs.WM_KEYUP) && - ((int)m.WParam == (int)Keys.ControlKey || (int)m.WParam == (int)Keys.ShiftKey)) - OnDragging(); - - return base.OnPreFilterMessage(ref m); - } - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.FocusManager.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.FocusManager.cs deleted file mode 100644 index a159faec1..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.FocusManager.cs +++ /dev/null @@ -1,595 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.ComponentModel; -using System.Runtime.InteropServices; -using System.Windows.Forms; -using System.Diagnostics.CodeAnalysis; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal interface IContentFocusManager - { - void Activate(IDockContent content); - void GiveUpFocus(IDockContent content); - void AddToList(IDockContent content); - void RemoveFromList(IDockContent content); - } - - partial class DockPanel - { - private interface IFocusManager - { - void SuspendFocusTracking(); - void ResumeFocusTracking(); - bool IsFocusTrackingSuspended { get; } - IDockContent ActiveContent { get; } - DockPane ActivePane { get; } - IDockContent ActiveDocument { get; } - DockPane ActiveDocumentPane { get; } - } - - private class FocusManagerImpl : Component, IContentFocusManager, IFocusManager - { - private class HookEventArgs : EventArgs - { - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public int HookCode; - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public IntPtr wParam; - public IntPtr lParam; - } - - private class LocalWindowsHook : IDisposable - { - // Internal properties - private IntPtr m_hHook = IntPtr.Zero; - private NativeMethods.HookProc m_filterFunc = null; - private Win32.HookType m_hookType; - - // Event delegate - public delegate void HookEventHandler(object sender, HookEventArgs e); - - // Event: HookInvoked - public event HookEventHandler HookInvoked; - protected void OnHookInvoked(HookEventArgs e) - { - if (HookInvoked != null) - HookInvoked(this, e); - } - - public LocalWindowsHook(Win32.HookType hook) - { - m_hookType = hook; - m_filterFunc = new NativeMethods.HookProc(this.CoreHookProc); - } - - // Default filter function - public IntPtr CoreHookProc(int code, IntPtr wParam, IntPtr lParam) - { - if (code < 0) - return NativeMethods.CallNextHookEx(m_hHook, code, wParam, lParam); - - // Let clients determine what to do - HookEventArgs e = new HookEventArgs(); - e.HookCode = code; - e.wParam = wParam; - e.lParam = lParam; - OnHookInvoked(e); - - // Yield to the next hook in the chain - return NativeMethods.CallNextHookEx(m_hHook, code, wParam, lParam); - } - - // Install the hook - public void Install() - { - if (m_hHook != IntPtr.Zero) - Uninstall(); - - int threadId = NativeMethods.GetCurrentThreadId(); - m_hHook = NativeMethods.SetWindowsHookEx(m_hookType, m_filterFunc, IntPtr.Zero, threadId); - } - - // Uninstall the hook - public void Uninstall() - { - if (m_hHook != IntPtr.Zero) - { - NativeMethods.UnhookWindowsHookEx(m_hHook); - m_hHook = IntPtr.Zero; - } - } - - ~LocalWindowsHook() - { - Dispose(false); - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - Uninstall(); - } - } - - // Use a static instance of the windows hook to prevent stack overflows in the windows kernel. - [ThreadStatic] - private static LocalWindowsHook sm_localWindowsHook; - - private LocalWindowsHook.HookEventHandler m_hookEventHandler; - - public FocusManagerImpl(DockPanel dockPanel) - { - m_dockPanel = dockPanel; - if (Win32Helper.IsRunningOnMono) - return; - m_hookEventHandler = new LocalWindowsHook.HookEventHandler(HookEventHandler); - - // Ensure the windows hook has been created for this thread - if (sm_localWindowsHook == null) - { - sm_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET); - sm_localWindowsHook.Install(); - } - - sm_localWindowsHook.HookInvoked += m_hookEventHandler; - } - - private DockPanel m_dockPanel; - public DockPanel DockPanel - { - get { return m_dockPanel; } - } - - private bool m_disposed = false; - protected override void Dispose(bool disposing) - { - if (!m_disposed && disposing) - { - if (!Win32Helper.IsRunningOnMono) - { - sm_localWindowsHook.HookInvoked -= m_hookEventHandler; - } - - m_disposed = true; - } - - base.Dispose(disposing); - } - - private IDockContent m_contentActivating = null; - private IDockContent ContentActivating - { - get { return m_contentActivating; } - set { m_contentActivating = value; } - } - - public void Activate(IDockContent content) - { - if (IsFocusTrackingSuspended) - { - ContentActivating = content; - return; - } - - if (content == null) - return; - DockContentHandler handler = content.DockHandler; - if (handler.Form.IsDisposed) - return; // Should not reach here, but better than throwing an exception - if (ContentContains(content, handler.ActiveWindowHandle)) - { - if (!Win32Helper.IsRunningOnMono) - { - NativeMethods.SetFocus(handler.ActiveWindowHandle); - } - } - - if (handler.Form.ContainsFocus) - return; - - if (handler.Form.SelectNextControl(handler.Form.ActiveControl, true, true, true, true)) - return; - - if (Win32Helper.IsRunningOnMono) - return; - - // Since DockContent Form is not selectalbe, use Win32 SetFocus instead - NativeMethods.SetFocus(handler.Form.Handle); - } - - private List m_listContent = new List(); - private List ListContent - { - get { return m_listContent; } - } - public void AddToList(IDockContent content) - { - if (ListContent.Contains(content) || IsInActiveList(content)) - return; - - ListContent.Add(content); - } - - public void RemoveFromList(IDockContent content) - { - if (IsInActiveList(content)) - RemoveFromActiveList(content); - if (ListContent.Contains(content)) - ListContent.Remove(content); - } - - private IDockContent m_lastActiveContent = null; - private IDockContent LastActiveContent - { - get { return m_lastActiveContent; } - set { m_lastActiveContent = value; } - } - - private bool IsInActiveList(IDockContent content) - { - return !(content.DockHandler.NextActive == null && LastActiveContent != content); - } - - private void AddLastToActiveList(IDockContent content) - { - IDockContent last = LastActiveContent; - if (last == content) - return; - - DockContentHandler handler = content.DockHandler; - - if (IsInActiveList(content)) - RemoveFromActiveList(content); - - handler.PreviousActive = last; - handler.NextActive = null; - LastActiveContent = content; - if (last != null) - last.DockHandler.NextActive = LastActiveContent; - } - - private void RemoveFromActiveList(IDockContent content) - { - if (LastActiveContent == content) - LastActiveContent = content.DockHandler.PreviousActive; - - IDockContent prev = content.DockHandler.PreviousActive; - IDockContent next = content.DockHandler.NextActive; - if (prev != null) - prev.DockHandler.NextActive = next; - if (next != null) - next.DockHandler.PreviousActive = prev; - - content.DockHandler.PreviousActive = null; - content.DockHandler.NextActive = null; - } - - public void GiveUpFocus(IDockContent content) - { - DockContentHandler handler = content.DockHandler; - if (!handler.Form.ContainsFocus) - return; - - if (IsFocusTrackingSuspended) - DockPanel.DummyControl.Focus(); - - if (LastActiveContent == content) - { - IDockContent prev = handler.PreviousActive; - if (prev != null) - Activate(prev); - else if (ListContent.Count > 0) - Activate(ListContent[ListContent.Count - 1]); - } - else if (LastActiveContent != null) - Activate(LastActiveContent); - else if (ListContent.Count > 0) - Activate(ListContent[ListContent.Count - 1]); - } - - private static bool ContentContains(IDockContent content, IntPtr hWnd) - { - Control control = Control.FromChildHandle(hWnd); - for (Control parent = control; parent != null; parent = parent.Parent) - if (parent == content.DockHandler.Form) - return true; - - return false; - } - - private int m_countSuspendFocusTracking = 0; - public void SuspendFocusTracking() - { - m_countSuspendFocusTracking++; - if (!Win32Helper.IsRunningOnMono) - sm_localWindowsHook.HookInvoked -= m_hookEventHandler; - } - - public void ResumeFocusTracking() - { - if (m_countSuspendFocusTracking > 0) - m_countSuspendFocusTracking--; - - if (m_countSuspendFocusTracking == 0) - { - if (ContentActivating != null) - { - Activate(ContentActivating); - ContentActivating = null; - } - - if (!Win32Helper.IsRunningOnMono) - sm_localWindowsHook.HookInvoked += m_hookEventHandler; - - if (!InRefreshActiveWindow) - RefreshActiveWindow(); - } - } - - public bool IsFocusTrackingSuspended - { - get { return m_countSuspendFocusTracking != 0; } - } - - // Windows hook event handler - private void HookEventHandler(object sender, HookEventArgs e) - { - Win32.Msgs msg = (Win32.Msgs)Marshal.ReadInt32(e.lParam, IntPtr.Size * 3); - - if (msg == Win32.Msgs.WM_KILLFOCUS) - { - IntPtr wParam = Marshal.ReadIntPtr(e.lParam, IntPtr.Size * 2); - DockPane pane = GetPaneFromHandle(wParam); - if (pane == null) - RefreshActiveWindow(); - } - else if (msg == Win32.Msgs.WM_SETFOCUS) - RefreshActiveWindow(); - } - - private DockPane GetPaneFromHandle(IntPtr hWnd) - { - Control control = Control.FromChildHandle(hWnd); - - IDockContent content = null; - DockPane pane = null; - for (; control != null; control = control.Parent) - { - content = control as IDockContent; - if (content != null) - content.DockHandler.ActiveWindowHandle = hWnd; - - if (content != null && content.DockHandler.DockPanel == DockPanel) - return content.DockHandler.Pane; - - pane = control as DockPane; - if (pane != null && pane.DockPanel == DockPanel) - break; - } - - return pane; - } - - private bool m_inRefreshActiveWindow = false; - private bool InRefreshActiveWindow - { - get { return m_inRefreshActiveWindow; } - } - - private void RefreshActiveWindow() - { - SuspendFocusTracking(); - m_inRefreshActiveWindow = true; - - DockPane oldActivePane = ActivePane; - IDockContent oldActiveContent = ActiveContent; - IDockContent oldActiveDocument = ActiveDocument; - - SetActivePane(); - SetActiveContent(); - SetActiveDocumentPane(); - SetActiveDocument(); - DockPanel.AutoHideWindow.RefreshActivePane(); - - ResumeFocusTracking(); - m_inRefreshActiveWindow = false; - - if (oldActiveContent != ActiveContent) - DockPanel.OnActiveContentChanged(EventArgs.Empty); - if (oldActiveDocument != ActiveDocument) - DockPanel.OnActiveDocumentChanged(EventArgs.Empty); - if (oldActivePane != ActivePane) - DockPanel.OnActivePaneChanged(EventArgs.Empty); - } - - private DockPane m_activePane = null; - public DockPane ActivePane - { - get { return m_activePane; } - } - - private void SetActivePane() - { - DockPane value = Win32Helper.IsRunningOnMono ? null : GetPaneFromHandle(NativeMethods.GetFocus()); - if (m_activePane == value) - return; - - if (m_activePane != null) - m_activePane.SetIsActivated(false); - - m_activePane = value; - - if (m_activePane != null) - m_activePane.SetIsActivated(true); - } - - private IDockContent m_activeContent = null; - public IDockContent ActiveContent - { - get { return m_activeContent; } - } - - internal void SetActiveContent() - { - IDockContent value = ActivePane == null ? null : ActivePane.ActiveContent; - - if (m_activeContent == value) - return; - - if (m_activeContent != null) - m_activeContent.DockHandler.IsActivated = false; - - m_activeContent = value; - - if (m_activeContent != null) - { - m_activeContent.DockHandler.IsActivated = true; - if (!DockHelper.IsDockStateAutoHide((m_activeContent.DockHandler.DockState))) - AddLastToActiveList(m_activeContent); - } - } - - private DockPane m_activeDocumentPane = null; - public DockPane ActiveDocumentPane - { - get { return m_activeDocumentPane; } - } - - private void SetActiveDocumentPane() - { - DockPane value = null; - - if (ActivePane != null && ActivePane.DockState == DockState.Document) - value = ActivePane; - - if (value == null && DockPanel.DockWindows != null) - { - if (ActiveDocumentPane == null) - value = DockPanel.DockWindows[DockState.Document].DefaultPane; - else if (ActiveDocumentPane.DockPanel != DockPanel || ActiveDocumentPane.DockState != DockState.Document) - value = DockPanel.DockWindows[DockState.Document].DefaultPane; - else - value = ActiveDocumentPane; - } - - if (m_activeDocumentPane == value) - return; - - if (m_activeDocumentPane != null) - m_activeDocumentPane.SetIsActiveDocumentPane(false); - - m_activeDocumentPane = value; - - if (m_activeDocumentPane != null) - m_activeDocumentPane.SetIsActiveDocumentPane(true); - } - - private IDockContent m_activeDocument = null; - public IDockContent ActiveDocument - { - get { return m_activeDocument; } - } - - private void SetActiveDocument() - { - IDockContent value = ActiveDocumentPane == null ? null : ActiveDocumentPane.ActiveContent; - - if (m_activeDocument == value) - return; - - m_activeDocument = value; - } - } - - private IFocusManager FocusManager - { - get { return m_focusManager; } - } - - internal IContentFocusManager ContentFocusManager - { - get { return m_focusManager; } - } - - internal void SaveFocus() - { - DummyControl.Focus(); - } - - [Browsable(false)] - public IDockContent ActiveContent - { - get { return FocusManager.ActiveContent; } - } - - [Browsable(false)] - public DockPane ActivePane - { - get { return FocusManager.ActivePane; } - } - - [Browsable(false)] - public IDockContent ActiveDocument - { - get { return FocusManager.ActiveDocument; } - } - - [Browsable(false)] - public DockPane ActiveDocumentPane - { - get { return FocusManager.ActiveDocumentPane; } - } - - private static readonly object ActiveDocumentChangedEvent = new object(); - [LocalizedCategory("Category_PropertyChanged")] - [LocalizedDescription("DockPanel_ActiveDocumentChanged_Description")] - public event EventHandler ActiveDocumentChanged - { - add { Events.AddHandler(ActiveDocumentChangedEvent, value); } - remove { Events.RemoveHandler(ActiveDocumentChangedEvent, value); } - } - protected virtual void OnActiveDocumentChanged(EventArgs e) - { - EventHandler handler = (EventHandler)Events[ActiveDocumentChangedEvent]; - if (handler != null) - handler(this, e); - } - - private static readonly object ActiveContentChangedEvent = new object(); - [LocalizedCategory("Category_PropertyChanged")] - [LocalizedDescription("DockPanel_ActiveContentChanged_Description")] - public event EventHandler ActiveContentChanged - { - add { Events.AddHandler(ActiveContentChangedEvent, value); } - remove { Events.RemoveHandler(ActiveContentChangedEvent, value); } - } - protected void OnActiveContentChanged(EventArgs e) - { - EventHandler handler = (EventHandler)Events[ActiveContentChangedEvent]; - if (handler != null) - handler(this, e); - } - - private static readonly object ActivePaneChangedEvent = new object(); - [LocalizedCategory("Category_PropertyChanged")] - [LocalizedDescription("DockPanel_ActivePaneChanged_Description")] - public event EventHandler ActivePaneChanged - { - add { Events.AddHandler(ActivePaneChangedEvent, value); } - remove { Events.RemoveHandler(ActivePaneChangedEvent, value); } - } - protected virtual void OnActivePaneChanged(EventArgs e) - { - EventHandler handler = (EventHandler)Events[ActivePaneChangedEvent]; - if (handler != null) - handler(this, e); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.MdiClientController.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.MdiClientController.cs deleted file mode 100644 index 196b72422..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.MdiClientController.cs +++ /dev/null @@ -1,438 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Runtime.InteropServices; - -namespace WeifenLuo.WinFormsUI.Docking -{ - partial class DockPanel - { - // This class comes from Jacob Slusser's MdiClientController class: - // http://www.codeproject.com/cs/miscctrl/mdiclientcontroller.asp - private class MdiClientController : NativeWindow, IComponent, IDisposable - { - private bool m_autoScroll = true; - private BorderStyle m_borderStyle = BorderStyle.Fixed3D; - private MdiClient m_mdiClient = null; - private Form m_parentForm = null; - private ISite m_site = null; - - public MdiClientController() - { - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (disposing) - { - if (Site != null && Site.Container != null) - Site.Container.Remove(this); - - if (Disposed != null) - Disposed(this, EventArgs.Empty); - } - } - - public bool AutoScroll - { - get { return m_autoScroll; } - set - { - // By default the MdiClient control scrolls. It can appear though that - // there are no scrollbars by turning them off when the non-client - // area is calculated. I decided to expose this method following - // the .NET vernacular of an AutoScroll property. - m_autoScroll = value; - if (MdiClient != null) - UpdateStyles(); - } - } - - public BorderStyle BorderStyle - { - set - { - // Error-check the enum. - if (!Enum.IsDefined(typeof(BorderStyle), value)) - throw new InvalidEnumArgumentException(); - - m_borderStyle = value; - - if (MdiClient == null) - return; - - // This property can actually be visible in design-mode, - // but to keep it consistent with the others, - // prevent this from being show at design-time. - if (Site != null && Site.DesignMode) - return; - - // There is no BorderStyle property exposed by the MdiClient class, - // but this can be controlled by Win32 functions. A Win32 ExStyle - // of WS_EX_CLIENTEDGE is equivalent to a Fixed3D border and a - // Style of WS_BORDER is equivalent to a FixedSingle border. - - // This code is inspired Jason Dori's article: - // "Adding designable borders to user controls". - // http://www.codeproject.com/cs/miscctrl/CsAddingBorders.asp - - if (!Win32Helper.IsRunningOnMono) - { - // Get styles using Win32 calls - int style = NativeMethods.GetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_STYLE); - int exStyle = NativeMethods.GetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_EXSTYLE); - - // Add or remove style flags as necessary. - switch (m_borderStyle) - { - case BorderStyle.Fixed3D: - exStyle |= (int)Win32.WindowExStyles.WS_EX_CLIENTEDGE; - style &= ~((int)Win32.WindowStyles.WS_BORDER); - break; - - case BorderStyle.FixedSingle: - exStyle &= ~((int)Win32.WindowExStyles.WS_EX_CLIENTEDGE); - style |= (int)Win32.WindowStyles.WS_BORDER; - break; - - case BorderStyle.None: - style &= ~((int)Win32.WindowStyles.WS_BORDER); - exStyle &= ~((int)Win32.WindowExStyles.WS_EX_CLIENTEDGE); - break; - } - - // Set the styles using Win32 calls - NativeMethods.SetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_STYLE, style); - NativeMethods.SetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_EXSTYLE, exStyle); - } - - // Cause an update of the non-client area. - UpdateStyles(); - } - } - - public MdiClient MdiClient - { - get { return m_mdiClient; } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public Form ParentForm - { - get { return m_parentForm; } - set - { - // If the ParentForm has previously been set, - // unwire events connected to the old parent. - if (m_parentForm != null) - { - m_parentForm.HandleCreated -= new EventHandler(ParentFormHandleCreated); - m_parentForm.MdiChildActivate -= new EventHandler(ParentFormMdiChildActivate); - } - - m_parentForm = value; - - if (m_parentForm == null) - return; - - // If the parent form has not been created yet, - // wait to initialize the MDI client until it is. - if (m_parentForm.IsHandleCreated) - { - InitializeMdiClient(); - RefreshProperties(); - } - else - m_parentForm.HandleCreated += new EventHandler(ParentFormHandleCreated); - - m_parentForm.MdiChildActivate += new EventHandler(ParentFormMdiChildActivate); - } - } - - public ISite Site - { - get { return m_site; } - set - { - m_site = value; - - if (m_site == null) - return; - - // If the component is dropped onto a form during design-time, - // set the ParentForm property. - IDesignerHost host = (value.GetService(typeof(IDesignerHost)) as IDesignerHost); - if (host != null) - { - Form parent = host.RootComponent as Form; - if (parent != null) - ParentForm = parent; - } - } - } - - public void RenewMdiClient() - { - // Reinitialize the MdiClient and its properties. - InitializeMdiClient(); - RefreshProperties(); - } - - public event EventHandler Disposed; - - public event EventHandler HandleAssigned; - - public event EventHandler MdiChildActivate; - - public event LayoutEventHandler Layout; - - protected virtual void OnHandleAssigned(EventArgs e) - { - // Raise the HandleAssigned event. - if (HandleAssigned != null) - HandleAssigned(this, e); - } - - protected virtual void OnMdiChildActivate(EventArgs e) - { - // Raise the MdiChildActivate event - if (MdiChildActivate != null) - MdiChildActivate(this, e); - } - - protected virtual void OnLayout(LayoutEventArgs e) - { - // Raise the Layout event - if (Layout != null) - Layout(this, e); - } - - public event PaintEventHandler Paint; - - protected virtual void OnPaint(PaintEventArgs e) - { - // Raise the Paint event. - if (Paint != null) - Paint(this, e); - } - - protected override void WndProc(ref Message m) - { - switch (m.Msg) - { - case (int)Win32.Msgs.WM_NCCALCSIZE: - // If AutoScroll is set to false, hide the scrollbars when the control - // calculates its non-client area. - if (!AutoScroll) - { - if (!Win32Helper.IsRunningOnMono) - { - NativeMethods.ShowScrollBar(m.HWnd, (int)Win32.ScrollBars.SB_BOTH, 0 /*false*/); - } - } - - break; - } - - base.WndProc(ref m); - } - - private void ParentFormHandleCreated(object sender, EventArgs e) - { - // The form has been created, unwire the event, and initialize the MdiClient. - this.m_parentForm.HandleCreated -= new EventHandler(ParentFormHandleCreated); - InitializeMdiClient(); - RefreshProperties(); - } - - private void ParentFormMdiChildActivate(object sender, EventArgs e) - { - OnMdiChildActivate(e); - } - - private void MdiClientLayout(object sender, LayoutEventArgs e) - { - OnLayout(e); - } - - private void MdiClientHandleDestroyed(object sender, EventArgs e) - { - // If the MdiClient handle has been released, drop the reference and - // release the handle. - if (m_mdiClient != null) - { - m_mdiClient.HandleDestroyed -= new EventHandler(MdiClientHandleDestroyed); - m_mdiClient = null; - } - - ReleaseHandle(); - } - - private void InitializeMdiClient() - { - // If the mdiClient has previously been set, unwire events connected - // to the old MDI. - if (MdiClient != null) - { - MdiClient.HandleDestroyed -= new EventHandler(MdiClientHandleDestroyed); - MdiClient.Layout -= new LayoutEventHandler(MdiClientLayout); - } - - if (ParentForm == null) - return; - - // Get the MdiClient from the parent form. - foreach (Control control in ParentForm.Controls) - { - // If the form is an MDI container, it will contain an MdiClient control - // just as it would any other control. - - m_mdiClient = control as MdiClient; - if (m_mdiClient == null) - continue; - - // Assign the MdiClient Handle to the NativeWindow. - ReleaseHandle(); - AssignHandle(MdiClient.Handle); - - // Raise the HandleAssigned event. - OnHandleAssigned(EventArgs.Empty); - - // Monitor the MdiClient for when its handle is destroyed. - MdiClient.HandleDestroyed += new EventHandler(MdiClientHandleDestroyed); - MdiClient.Layout += new LayoutEventHandler(MdiClientLayout); - - break; - } - } - - private void RefreshProperties() - { - // Refresh all the properties - BorderStyle = m_borderStyle; - AutoScroll = m_autoScroll; - } - - private void UpdateStyles() - { - // To show style changes, the non-client area must be repainted. Using the - // control's Invalidate method does not affect the non-client area. - // Instead use a Win32 call to signal the style has changed. - if (!Win32Helper.IsRunningOnMono) - NativeMethods.SetWindowPos(MdiClient.Handle, IntPtr.Zero, 0, 0, 0, 0, - Win32.FlagsSetWindowPos.SWP_NOACTIVATE | - Win32.FlagsSetWindowPos.SWP_NOMOVE | - Win32.FlagsSetWindowPos.SWP_NOSIZE | - Win32.FlagsSetWindowPos.SWP_NOZORDER | - Win32.FlagsSetWindowPos.SWP_NOOWNERZORDER | - Win32.FlagsSetWindowPos.SWP_FRAMECHANGED); - } - } - - private MdiClientController m_mdiClientController = null; - private MdiClientController GetMdiClientController() - { - if (m_mdiClientController == null) - { - m_mdiClientController = new MdiClientController(); - m_mdiClientController.HandleAssigned += new EventHandler(MdiClientHandleAssigned); - m_mdiClientController.MdiChildActivate += new EventHandler(ParentFormMdiChildActivate); - m_mdiClientController.Layout += new LayoutEventHandler(MdiClient_Layout); - } - - return m_mdiClientController; - } - - private void ParentFormMdiChildActivate(object sender, EventArgs e) - { - if (GetMdiClientController().ParentForm == null) - return; - - IDockContent content = GetMdiClientController().ParentForm.ActiveMdiChild as IDockContent; - if (content == null) - return; - - if (content.DockHandler.DockPanel == this && content.DockHandler.Pane != null) - content.DockHandler.Pane.ActiveContent = content; - } - - private bool MdiClientExists - { - get { return GetMdiClientController().MdiClient != null; } - } - - private void SetMdiClientBounds(Rectangle bounds) - { - GetMdiClientController().MdiClient.Bounds = bounds; - } - - private void SuspendMdiClientLayout() - { - if (GetMdiClientController().MdiClient != null) - GetMdiClientController().MdiClient.SuspendLayout(); - } - - private void ResumeMdiClientLayout(bool perform) - { - if (GetMdiClientController().MdiClient != null) - GetMdiClientController().MdiClient.ResumeLayout(perform); - } - - private void PerformMdiClientLayout() - { - if (GetMdiClientController().MdiClient != null) - GetMdiClientController().MdiClient.PerformLayout(); - } - - // Called when: - // 1. DockPanel.DocumentStyle changed - // 2. DockPanel.Visible changed - // 3. MdiClientController.Handle assigned - private void SetMdiClient() - { - MdiClientController controller = GetMdiClientController(); - - if (this.DocumentStyle == DocumentStyle.DockingMdi) - { - controller.AutoScroll = false; - controller.BorderStyle = BorderStyle.None; - if (MdiClientExists) - controller.MdiClient.Dock = DockStyle.Fill; - } - else if (DocumentStyle == DocumentStyle.DockingSdi || DocumentStyle == DocumentStyle.DockingWindow) - { - controller.AutoScroll = true; - controller.BorderStyle = BorderStyle.Fixed3D; - if (MdiClientExists) - controller.MdiClient.Dock = DockStyle.Fill; - } - else if (this.DocumentStyle == DocumentStyle.SystemMdi) - { - controller.AutoScroll = true; - controller.BorderStyle = BorderStyle.Fixed3D; - if (controller.MdiClient != null) - { - controller.MdiClient.Dock = DockStyle.None; - controller.MdiClient.Bounds = SystemMdiClientBounds; - } - } - } - - internal Rectangle RectangleToMdiClient(Rectangle rect) - { - if (MdiClientExists) - return GetMdiClientController().MdiClient.RectangleToClient(rect); - else - return Rectangle.Empty; - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.Persistor.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.Persistor.cs deleted file mode 100644 index 6e661414b..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.Persistor.cs +++ /dev/null @@ -1,801 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using System.Drawing; -using WeifenLuo.WinFormsUI.Docking; -using System.IO; -using System.Text; -using System.Xml; -using System.Globalization; - -namespace WeifenLuo.WinFormsUI.Docking -{ - partial class DockPanel - { - private static class Persistor - { - private const string ConfigFileVersion = "1.0"; - private static string[] CompatibleConfigFileVersions = new string[] { }; - - private class DummyContent : DockContent - { - } - - private struct DockPanelStruct - { - private double m_dockLeftPortion; - public double DockLeftPortion - { - get { return m_dockLeftPortion; } - set { m_dockLeftPortion = value; } - } - - private double m_dockRightPortion; - public double DockRightPortion - { - get { return m_dockRightPortion; } - set { m_dockRightPortion = value; } - } - - private double m_dockTopPortion; - public double DockTopPortion - { - get { return m_dockTopPortion; } - set { m_dockTopPortion = value; } - } - - private double m_dockBottomPortion; - public double DockBottomPortion - { - get { return m_dockBottomPortion; } - set { m_dockBottomPortion = value; } - } - - private int m_indexActiveDocumentPane; - public int IndexActiveDocumentPane - { - get { return m_indexActiveDocumentPane; } - set { m_indexActiveDocumentPane = value; } - } - - private int m_indexActivePane; - public int IndexActivePane - { - get { return m_indexActivePane; } - set { m_indexActivePane = value; } - } - } - - private struct ContentStruct - { - private string m_persistString; - public string PersistString - { - get { return m_persistString; } - set { m_persistString = value; } - } - - private double m_autoHidePortion; - public double AutoHidePortion - { - get { return m_autoHidePortion; } - set { m_autoHidePortion = value; } - } - - private bool m_isHidden; - public bool IsHidden - { - get { return m_isHidden; } - set { m_isHidden = value; } - } - - private bool m_isFloat; - public bool IsFloat - { - get { return m_isFloat; } - set { m_isFloat = value; } - } - } - - private struct PaneStruct - { - private DockState m_dockState; - public DockState DockState - { - get { return m_dockState; } - set { m_dockState = value; } - } - - private int m_indexActiveContent; - public int IndexActiveContent - { - get { return m_indexActiveContent; } - set { m_indexActiveContent = value; } - } - - private int[] m_indexContents; - public int[] IndexContents - { - get { return m_indexContents; } - set { m_indexContents = value; } - } - - private int m_zOrderIndex; - public int ZOrderIndex - { - get { return m_zOrderIndex; } - set { m_zOrderIndex = value; } - } - } - - private struct NestedPane - { - private int m_indexPane; - public int IndexPane - { - get { return m_indexPane; } - set { m_indexPane = value; } - } - - private int m_indexPrevPane; - public int IndexPrevPane - { - get { return m_indexPrevPane; } - set { m_indexPrevPane = value; } - } - - private DockAlignment m_alignment; - public DockAlignment Alignment - { - get { return m_alignment; } - set { m_alignment = value; } - } - - private double m_proportion; - public double Proportion - { - get { return m_proportion; } - set { m_proportion = value; } - } - } - - private struct DockWindowStruct - { - private DockState m_dockState; - public DockState DockState - { - get { return m_dockState; } - set { m_dockState = value; } - } - - private int m_zOrderIndex; - public int ZOrderIndex - { - get { return m_zOrderIndex; } - set { m_zOrderIndex = value; } - } - - private NestedPane[] m_nestedPanes; - public NestedPane[] NestedPanes - { - get { return m_nestedPanes; } - set { m_nestedPanes = value; } - } - } - - private struct FloatWindowStruct - { - private Rectangle m_bounds; - public Rectangle Bounds - { - get { return m_bounds; } - set { m_bounds = value; } - } - - private int m_zOrderIndex; - public int ZOrderIndex - { - get { return m_zOrderIndex; } - set { m_zOrderIndex = value; } - } - - private NestedPane[] m_nestedPanes; - public NestedPane[] NestedPanes - { - get { return m_nestedPanes; } - set { m_nestedPanes = value; } - } - - private bool m_maximized; - public bool Maximized - { - get { return m_maximized; } - set { m_maximized = value; } - } - } - - public static void SaveAsXml(DockPanel dockPanel, string fileName, string userString) - { - SaveAsXml(dockPanel, fileName, userString, Encoding.Unicode); - } - - public static void SaveAsXml(DockPanel dockPanel, string fileName, string userString, Encoding encoding) - { - FileStream fs = new FileStream(fileName, FileMode.Create); - try - { - SaveAsXml(dockPanel, fs, userString, encoding); - } - finally - { - fs.Close(); - } - } - - public static void SaveAsXml(DockPanel dockPanel, Stream stream, string userString, Encoding encoding) - { - SaveAsXml(dockPanel, stream, userString, encoding, false); - } - - public static void SaveAsXml(DockPanel dockPanel, Stream stream, string userString, Encoding encoding, bool upstream) - { - XmlTextWriter xmlOut = new XmlTextWriter(stream, encoding); - - // Use indenting for readability - xmlOut.Formatting = Formatting.Indented; - - if (!upstream) - xmlOut.WriteStartDocument(); - - // Always begin file with identification and warning - xmlOut.WriteComment(Strings.DockPanel_Persistor_XmlFileComment1); - xmlOut.WriteComment(Strings.DockPanel_Persistor_XmlFileComment2); - - // Associate a version number with the root element so that future version of the code - // will be able to be backwards compatible or at least recognise out of date versions - xmlOut.WriteStartElement("DockPanel"); - xmlOut.WriteAttributeString("FormatVersion", ConfigFileVersion); - xmlOut.WriteAttributeString("DockLeftPortion", dockPanel.DockLeftPortion.ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("DockRightPortion", dockPanel.DockRightPortion.ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("DockTopPortion", dockPanel.DockTopPortion.ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("DockBottomPortion", dockPanel.DockBottomPortion.ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("UserString", userString); - - if (!Win32Helper.IsRunningOnMono) - { - xmlOut.WriteAttributeString("ActiveDocumentPane", dockPanel.Panes.IndexOf(dockPanel.ActiveDocumentPane).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("ActivePane", dockPanel.Panes.IndexOf(dockPanel.ActivePane).ToString(CultureInfo.InvariantCulture)); - } - - // Contents - xmlOut.WriteStartElement("Contents"); - xmlOut.WriteAttributeString("Count", dockPanel.Contents.Count.ToString(CultureInfo.InvariantCulture)); - foreach (IDockContent content in dockPanel.Contents) - { - xmlOut.WriteStartElement("Content"); - xmlOut.WriteAttributeString("ID", dockPanel.Contents.IndexOf(content).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("PersistString", content.DockHandler.PersistString); - xmlOut.WriteAttributeString("AutoHidePortion", content.DockHandler.AutoHidePortion.ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("IsHidden", content.DockHandler.IsHidden.ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("IsFloat", content.DockHandler.IsFloat.ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteEndElement(); - } - xmlOut.WriteEndElement(); - - // Panes - xmlOut.WriteStartElement("Panes"); - xmlOut.WriteAttributeString("Count", dockPanel.Panes.Count.ToString(CultureInfo.InvariantCulture)); - foreach (DockPane pane in dockPanel.Panes) - { - xmlOut.WriteStartElement("Pane"); - xmlOut.WriteAttributeString("ID", dockPanel.Panes.IndexOf(pane).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("DockState", pane.DockState.ToString()); - xmlOut.WriteAttributeString("ActiveContent", dockPanel.Contents.IndexOf(pane.ActiveContent).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteStartElement("Contents"); - xmlOut.WriteAttributeString("Count", pane.Contents.Count.ToString(CultureInfo.InvariantCulture)); - foreach (IDockContent content in pane.Contents) - { - xmlOut.WriteStartElement("Content"); - xmlOut.WriteAttributeString("ID", pane.Contents.IndexOf(content).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("RefID", dockPanel.Contents.IndexOf(content).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteEndElement(); - } - xmlOut.WriteEndElement(); - xmlOut.WriteEndElement(); - } - xmlOut.WriteEndElement(); - - // DockWindows - xmlOut.WriteStartElement("DockWindows"); - int dockWindowId = 0; - foreach (DockWindow dw in dockPanel.DockWindows) - { - xmlOut.WriteStartElement("DockWindow"); - xmlOut.WriteAttributeString("ID", dockWindowId.ToString(CultureInfo.InvariantCulture)); - dockWindowId++; - xmlOut.WriteAttributeString("DockState", dw.DockState.ToString()); - xmlOut.WriteAttributeString("ZOrderIndex", dockPanel.Controls.IndexOf(dw).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteStartElement("NestedPanes"); - xmlOut.WriteAttributeString("Count", dw.NestedPanes.Count.ToString(CultureInfo.InvariantCulture)); - foreach (DockPane pane in dw.NestedPanes) - { - xmlOut.WriteStartElement("Pane"); - xmlOut.WriteAttributeString("ID", dw.NestedPanes.IndexOf(pane).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("RefID", dockPanel.Panes.IndexOf(pane).ToString(CultureInfo.InvariantCulture)); - NestedDockingStatus status = pane.NestedDockingStatus; - xmlOut.WriteAttributeString("PrevPane", dockPanel.Panes.IndexOf(status.PreviousPane).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("Alignment", status.Alignment.ToString()); - xmlOut.WriteAttributeString("Proportion", status.Proportion.ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteEndElement(); - } - xmlOut.WriteEndElement(); - xmlOut.WriteEndElement(); - } - xmlOut.WriteEndElement(); - - // FloatWindows - RectangleConverter rectConverter = new RectangleConverter(); - xmlOut.WriteStartElement("FloatWindows"); - xmlOut.WriteAttributeString("Count", dockPanel.FloatWindows.Count.ToString(CultureInfo.InvariantCulture)); - foreach (FloatWindow fw in dockPanel.FloatWindows) - { - xmlOut.WriteStartElement("FloatWindow"); - xmlOut.WriteAttributeString("ID", dockPanel.FloatWindows.IndexOf(fw).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("Bounds", rectConverter.ConvertToInvariantString(fw.Bounds)); - xmlOut.WriteAttributeString("ZOrderIndex", fw.DockPanel.FloatWindows.IndexOf(fw).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("Maximized", (fw.WindowState == FormWindowState.Maximized).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteStartElement("NestedPanes"); - xmlOut.WriteAttributeString("Count", fw.NestedPanes.Count.ToString(CultureInfo.InvariantCulture)); - foreach (DockPane pane in fw.NestedPanes) - { - xmlOut.WriteStartElement("Pane"); - xmlOut.WriteAttributeString("ID", fw.NestedPanes.IndexOf(pane).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("RefID", dockPanel.Panes.IndexOf(pane).ToString(CultureInfo.InvariantCulture)); - NestedDockingStatus status = pane.NestedDockingStatus; - xmlOut.WriteAttributeString("PrevPane", dockPanel.Panes.IndexOf(status.PreviousPane).ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteAttributeString("Alignment", status.Alignment.ToString()); - xmlOut.WriteAttributeString("Proportion", status.Proportion.ToString(CultureInfo.InvariantCulture)); - xmlOut.WriteEndElement(); - } - xmlOut.WriteEndElement(); - xmlOut.WriteEndElement(); - } - xmlOut.WriteEndElement(); // - - xmlOut.WriteEndElement(); - - if (!upstream) - { - xmlOut.WriteEndDocument(); - xmlOut.Close(); - } - else - xmlOut.Flush(); - } - - public static void LoadFromXml(DockPanel dockPanel, string fileName, DeserializeDockContent deserializeContent) - { - FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); - try - { - LoadFromXml(dockPanel, fs, deserializeContent); - } - finally - { - fs.Close(); - } - } - - public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent) - { - LoadFromXml(dockPanel, stream, deserializeContent, true); - } - - private static ContentStruct[] LoadContents(XmlTextReader xmlIn) - { - int countOfContents = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture); - ContentStruct[] contents = new ContentStruct[countOfContents]; - MoveToNextElement(xmlIn); - for (int i = 0; i < countOfContents; i++) - { - int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture); - if (xmlIn.Name != "Content" || id != i) - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - - contents[i].PersistString = xmlIn.GetAttribute("PersistString"); - contents[i].AutoHidePortion = Convert.ToDouble(xmlIn.GetAttribute("AutoHidePortion"), CultureInfo.InvariantCulture); - contents[i].IsHidden = Convert.ToBoolean(xmlIn.GetAttribute("IsHidden"), CultureInfo.InvariantCulture); - contents[i].IsFloat = Convert.ToBoolean(xmlIn.GetAttribute("IsFloat"), CultureInfo.InvariantCulture); - MoveToNextElement(xmlIn); - } - - return contents; - } - - private static PaneStruct[] LoadPanes(XmlTextReader xmlIn) - { - EnumConverter dockStateConverter = new EnumConverter(typeof(DockState)); - int countOfPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture); - PaneStruct[] panes = new PaneStruct[countOfPanes]; - MoveToNextElement(xmlIn); - for (int i = 0; i < countOfPanes; i++) - { - int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture); - if (xmlIn.Name != "Pane" || id != i) - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - - panes[i].DockState = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState")); - panes[i].IndexActiveContent = Convert.ToInt32(xmlIn.GetAttribute("ActiveContent"), CultureInfo.InvariantCulture); - panes[i].ZOrderIndex = -1; - - MoveToNextElement(xmlIn); - if (xmlIn.Name != "Contents") - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - int countOfPaneContents = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture); - panes[i].IndexContents = new int[countOfPaneContents]; - MoveToNextElement(xmlIn); - for (int j = 0; j < countOfPaneContents; j++) - { - int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture); - if (xmlIn.Name != "Content" || id2 != j) - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - - panes[i].IndexContents[j] = Convert.ToInt32(xmlIn.GetAttribute("RefID"), CultureInfo.InvariantCulture); - MoveToNextElement(xmlIn); - } - } - - return panes; - } - - private static DockWindowStruct[] LoadDockWindows(XmlTextReader xmlIn, DockPanel dockPanel) - { - EnumConverter dockStateConverter = new EnumConverter(typeof(DockState)); - EnumConverter dockAlignmentConverter = new EnumConverter(typeof(DockAlignment)); - int countOfDockWindows = dockPanel.DockWindows.Count; - DockWindowStruct[] dockWindows = new DockWindowStruct[countOfDockWindows]; - MoveToNextElement(xmlIn); - for (int i = 0; i < countOfDockWindows; i++) - { - int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture); - if (xmlIn.Name != "DockWindow" || id != i) - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - - dockWindows[i].DockState = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState")); - dockWindows[i].ZOrderIndex = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex"), CultureInfo.InvariantCulture); - MoveToNextElement(xmlIn); - if (xmlIn.Name != "DockList" && xmlIn.Name != "NestedPanes") - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - int countOfNestedPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture); - dockWindows[i].NestedPanes = new NestedPane[countOfNestedPanes]; - MoveToNextElement(xmlIn); - for (int j = 0; j < countOfNestedPanes; j++) - { - int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture); - if (xmlIn.Name != "Pane" || id2 != j) - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - dockWindows[i].NestedPanes[j].IndexPane = Convert.ToInt32(xmlIn.GetAttribute("RefID"), CultureInfo.InvariantCulture); - dockWindows[i].NestedPanes[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane"), CultureInfo.InvariantCulture); - dockWindows[i].NestedPanes[j].Alignment = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment")); - dockWindows[i].NestedPanes[j].Proportion = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture); - MoveToNextElement(xmlIn); - } - } - - return dockWindows; - } - - private static FloatWindowStruct[] LoadFloatWindows(XmlTextReader xmlIn) - { - EnumConverter dockAlignmentConverter = new EnumConverter(typeof(DockAlignment)); - RectangleConverter rectConverter = new RectangleConverter(); - int countOfFloatWindows = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture); - FloatWindowStruct[] floatWindows = new FloatWindowStruct[countOfFloatWindows]; - MoveToNextElement(xmlIn); - for (int i = 0; i < countOfFloatWindows; i++) - { - int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture); - if (xmlIn.Name != "FloatWindow" || id != i) - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - - floatWindows[i].Bounds = (Rectangle)rectConverter.ConvertFromInvariantString(xmlIn.GetAttribute("Bounds")); - floatWindows[i].Maximized = Convert.ToBoolean(xmlIn.GetAttribute("Maximized"), CultureInfo.InvariantCulture); - floatWindows[i].ZOrderIndex = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex"), CultureInfo.InvariantCulture); - MoveToNextElement(xmlIn); - if (xmlIn.Name != "DockList" && xmlIn.Name != "NestedPanes") - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - int countOfNestedPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture); - floatWindows[i].NestedPanes = new NestedPane[countOfNestedPanes]; - MoveToNextElement(xmlIn); - for (int j = 0; j < countOfNestedPanes; j++) - { - int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture); - if (xmlIn.Name != "Pane" || id2 != j) - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - floatWindows[i].NestedPanes[j].IndexPane = Convert.ToInt32(xmlIn.GetAttribute("RefID"), CultureInfo.InvariantCulture); - floatWindows[i].NestedPanes[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane"), CultureInfo.InvariantCulture); - floatWindows[i].NestedPanes[j].Alignment = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment")); - floatWindows[i].NestedPanes[j].Proportion = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture); - MoveToNextElement(xmlIn); - } - } - - return floatWindows; - } - - public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent, bool closeStream) - { - - if (dockPanel.Contents.Count != 0) - throw new InvalidOperationException(Strings.DockPanel_LoadFromXml_AlreadyInitialized); - - XmlTextReader xmlIn = new XmlTextReader(stream); - xmlIn.WhitespaceHandling = WhitespaceHandling.None; - xmlIn.MoveToContent(); - - while (!xmlIn.Name.Equals("DockPanel")) - { - if (!MoveToNextElement(xmlIn)) - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - } - - string formatVersion = xmlIn.GetAttribute("FormatVersion"); - if (!IsFormatVersionValid(formatVersion)) - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidFormatVersion); - - string userString = xmlIn.GetAttribute("UserString"); - deserializeContent(userString); - - DockPanelStruct dockPanelStruct = new DockPanelStruct(); - dockPanelStruct.DockLeftPortion = Convert.ToDouble(xmlIn.GetAttribute("DockLeftPortion"), CultureInfo.InvariantCulture); - dockPanelStruct.DockRightPortion = Convert.ToDouble(xmlIn.GetAttribute("DockRightPortion"), CultureInfo.InvariantCulture); - dockPanelStruct.DockTopPortion = Convert.ToDouble(xmlIn.GetAttribute("DockTopPortion"), CultureInfo.InvariantCulture); - dockPanelStruct.DockBottomPortion = Convert.ToDouble(xmlIn.GetAttribute("DockBottomPortion"), CultureInfo.InvariantCulture); - dockPanelStruct.IndexActiveDocumentPane = Convert.ToInt32(xmlIn.GetAttribute("ActiveDocumentPane"), CultureInfo.InvariantCulture); - dockPanelStruct.IndexActivePane = Convert.ToInt32(xmlIn.GetAttribute("ActivePane"), CultureInfo.InvariantCulture); - - // Load Contents - MoveToNextElement(xmlIn); - if (xmlIn.Name != "Contents") - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - ContentStruct[] contents = LoadContents(xmlIn); - - // Load Panes - if (xmlIn.Name != "Panes") - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - PaneStruct[] panes = LoadPanes(xmlIn); - - // Load DockWindows - if (xmlIn.Name != "DockWindows") - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - DockWindowStruct[] dockWindows = LoadDockWindows(xmlIn, dockPanel); - - // Load FloatWindows - if (xmlIn.Name != "FloatWindows") - throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat); - FloatWindowStruct[] floatWindows = LoadFloatWindows(xmlIn); - - if (closeStream) - xmlIn.Close(); - - dockPanel.SuspendLayout(true); - - dockPanel.DockLeftPortion = dockPanelStruct.DockLeftPortion; - dockPanel.DockRightPortion = dockPanelStruct.DockRightPortion; - dockPanel.DockTopPortion = dockPanelStruct.DockTopPortion; - dockPanel.DockBottomPortion = dockPanelStruct.DockBottomPortion; - - // Set DockWindow ZOrders - int prevMaxDockWindowZOrder = int.MaxValue; - for (int i = 0; i < dockWindows.Length; i++) - { - int maxDockWindowZOrder = -1; - int index = -1; - for (int j = 0; j < dockWindows.Length; j++) - { - if (dockWindows[j].ZOrderIndex > maxDockWindowZOrder && dockWindows[j].ZOrderIndex < prevMaxDockWindowZOrder) - { - maxDockWindowZOrder = dockWindows[j].ZOrderIndex; - index = j; - } - } - - dockPanel.DockWindows[dockWindows[index].DockState].BringToFront(); - prevMaxDockWindowZOrder = maxDockWindowZOrder; - } - - // Create Contents - for (int i = 0; i < contents.Length; i++) - { - IDockContent content = deserializeContent(contents[i].PersistString); - if (content == null || dockPanel.Contents.IndexOf(content) >= 0) - content = new DummyContent(); - content.DockHandler.DockPanel = dockPanel; - content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion; - content.DockHandler.IsHidden = true; - content.DockHandler.IsFloat = contents[i].IsFloat; - } - - // Create panes - for (int i = 0; i < panes.Length; i++) - { - DockPane pane = null; - for (int j = 0; j < panes[i].IndexContents.Length; j++) - { - IDockContent content = dockPanel.Contents[panes[i].IndexContents[j]]; - if (j == 0) - pane = dockPanel.DockPaneFactory.CreateDockPane(content, panes[i].DockState, false); - else if (panes[i].DockState == DockState.Float) - content.DockHandler.FloatPane = pane; - else - content.DockHandler.PanelPane = pane; - } - } - - // Assign Panes to DockWindows - for (int i = 0; i < dockWindows.Length; i++) - { - for (int j = 0; j < dockWindows[i].NestedPanes.Length; j++) - { - DockWindow dw = dockPanel.DockWindows[dockWindows[i].DockState]; - int indexPane = dockWindows[i].NestedPanes[j].IndexPane; - DockPane pane = dockPanel.Panes[indexPane]; - int indexPrevPane = dockWindows[i].NestedPanes[j].IndexPrevPane; - DockPane prevPane = (indexPrevPane == -1) ? dw.NestedPanes.GetDefaultPreviousPane(pane) : dockPanel.Panes[indexPrevPane]; - DockAlignment alignment = dockWindows[i].NestedPanes[j].Alignment; - double proportion = dockWindows[i].NestedPanes[j].Proportion; - pane.DockTo(dw, prevPane, alignment, proportion); - if (panes[indexPane].DockState == dw.DockState) - panes[indexPane].ZOrderIndex = dockWindows[i].ZOrderIndex; - } - } - - // Create float windows - for (int i = 0; i < floatWindows.Length; i++) - { - FloatWindow fw = null; - for (int j = 0; j < floatWindows[i].NestedPanes.Length; j++) - { - int indexPane = floatWindows[i].NestedPanes[j].IndexPane; - DockPane pane = dockPanel.Panes[indexPane]; - if (j == 0) - fw = dockPanel.FloatWindowFactory.CreateFloatWindow(dockPanel, pane, floatWindows[i].Bounds); - else - { - int indexPrevPane = floatWindows[i].NestedPanes[j].IndexPrevPane; - DockPane prevPane = indexPrevPane == -1 ? null : dockPanel.Panes[indexPrevPane]; - DockAlignment alignment = floatWindows[i].NestedPanes[j].Alignment; - double proportion = floatWindows[i].NestedPanes[j].Proportion; - pane.DockTo(fw, prevPane, alignment, proportion); - } - - if (floatWindows[i].Maximized) - fw.WindowState = FormWindowState.Maximized; - - if (panes[indexPane].DockState == fw.DockState) - panes[indexPane].ZOrderIndex = floatWindows[i].ZOrderIndex; - } - } - - // sort IDockContent by its Pane's ZOrder - int[] sortedContents = null; - if (contents.Length > 0) - { - sortedContents = new int[contents.Length]; - for (int i = 0; i < contents.Length; i++) - sortedContents[i] = i; - - int lastDocument = contents.Length; - for (int i = 0; i < contents.Length - 1; i++) - { - for (int j = i + 1; j < contents.Length; j++) - { - DockPane pane1 = dockPanel.Contents[sortedContents[i]].DockHandler.Pane; - int ZOrderIndex1 = pane1 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane1)].ZOrderIndex; - DockPane pane2 = dockPanel.Contents[sortedContents[j]].DockHandler.Pane; - int ZOrderIndex2 = pane2 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane2)].ZOrderIndex; - if (ZOrderIndex1 > ZOrderIndex2) - { - int temp = sortedContents[i]; - sortedContents[i] = sortedContents[j]; - sortedContents[j] = temp; - } - } - } - } - - // show non-document IDockContent first to avoid screen flickers - for (int i = 0; i < contents.Length; i++) - { - IDockContent content = dockPanel.Contents[sortedContents[i]]; - if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState != DockState.Document) - content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden; - } - - // after all non-document IDockContent, show document IDockContent - for (int i = 0; i < contents.Length; i++) - { - IDockContent content = dockPanel.Contents[sortedContents[i]]; - if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState == DockState.Document) - content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden; - } - - for (int i = 0; i < panes.Length; i++) - dockPanel.Panes[i].ActiveContent = panes[i].IndexActiveContent == -1 ? null : dockPanel.Contents[panes[i].IndexActiveContent]; - - if (dockPanelStruct.IndexActiveDocumentPane != -1) - dockPanel.Panes[dockPanelStruct.IndexActiveDocumentPane].Activate(); - - if (dockPanelStruct.IndexActivePane != -1) - dockPanel.Panes[dockPanelStruct.IndexActivePane].Activate(); - - for (int i = dockPanel.Contents.Count - 1; i >= 0; i--) - if (dockPanel.Contents[i] is DummyContent) - dockPanel.Contents[i].DockHandler.Form.Close(); - - dockPanel.ResumeLayout(true, true); - } - - private static bool MoveToNextElement(XmlTextReader xmlIn) - { - if (!xmlIn.Read()) - return false; - - while (xmlIn.NodeType == XmlNodeType.EndElement) - { - if (!xmlIn.Read()) - return false; - } - - return true; - } - - private static bool IsFormatVersionValid(string formatVersion) - { - if (formatVersion == ConfigFileVersion) - return true; - - foreach (string s in CompatibleConfigFileVersions) - if (s == formatVersion) - return true; - - return false; - } - } - - public void SaveAsXml(string fileName, string userString) - { - Persistor.SaveAsXml(this, fileName, userString); - } - - public void SaveAsXml(string fileName, string userString, Encoding encoding) - { - Persistor.SaveAsXml(this, fileName, userString, encoding); - } - - public void SaveAsXml(Stream stream, string userString, Encoding encoding) - { - Persistor.SaveAsXml(this, stream, userString, encoding); - } - - public void SaveAsXml(Stream stream, string userString, Encoding encoding, bool upstream) - { - Persistor.SaveAsXml(this, stream, userString, encoding, upstream); - } - - public void LoadFromXml(string fileName, DeserializeDockContent deserializeContent) - { - Persistor.LoadFromXml(this, fileName, deserializeContent); - } - - public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent) - { - Persistor.LoadFromXml(this, stream, deserializeContent); - } - - public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent, bool closeStream) - { - Persistor.LoadFromXml(this, stream, deserializeContent, closeStream); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.SplitterDragHandler.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.SplitterDragHandler.cs deleted file mode 100644 index 8689e166f..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.SplitterDragHandler.cs +++ /dev/null @@ -1,165 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.ComponentModel; - -namespace WeifenLuo.WinFormsUI.Docking -{ - partial class DockPanel - { - private sealed class SplitterDragHandler : DragHandler - { - private class SplitterOutline - { - public SplitterOutline() - { - m_dragForm = new DragForm(); - SetDragForm(Rectangle.Empty); - DragForm.BackColor = Color.Black; - DragForm.Opacity = 0.7; - DragForm.Show(false); - } - - DragForm m_dragForm; - private DragForm DragForm - { - get { return m_dragForm; } - } - - public void Show(Rectangle rect) - { - SetDragForm(rect); - } - - public void Close() - { - DragForm.Close(); - } - - private void SetDragForm(Rectangle rect) - { - DragForm.Bounds = rect; - if (rect == Rectangle.Empty) - DragForm.Region = new Region(Rectangle.Empty); - else if (DragForm.Region != null) - DragForm.Region = null; - } - } - - public SplitterDragHandler(DockPanel dockPanel) - : base(dockPanel) - { - } - - public new ISplitterDragSource DragSource - { - get { return base.DragSource as ISplitterDragSource; } - private set { base.DragSource = value; } - } - - private SplitterOutline m_outline; - private SplitterOutline Outline - { - get { return m_outline; } - set { m_outline = value; } - } - - private Rectangle m_rectSplitter; - private Rectangle RectSplitter - { - get { return m_rectSplitter; } - set { m_rectSplitter = value; } - } - - public void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter) - { - DragSource = dragSource; - RectSplitter = rectSplitter; - - if (!BeginDrag()) - { - DragSource = null; - return; - } - - Outline = new SplitterOutline(); - Outline.Show(rectSplitter); - DragSource.BeginDrag(rectSplitter); - } - - protected override void OnDragging() - { - Outline.Show(GetSplitterOutlineBounds(Control.MousePosition)); - } - - protected override void OnEndDrag(bool abort) - { - DockPanel.SuspendLayout(true); - - Outline.Close(); - - if (!abort) - DragSource.MoveSplitter(GetMovingOffset(Control.MousePosition)); - - DragSource.EndDrag(); - DockPanel.ResumeLayout(true, true); - } - - private int GetMovingOffset(Point ptMouse) - { - Rectangle rect = GetSplitterOutlineBounds(ptMouse); - if (DragSource.IsVertical) - return rect.X - RectSplitter.X; - else - return rect.Y - RectSplitter.Y; - } - - private Rectangle GetSplitterOutlineBounds(Point ptMouse) - { - Rectangle rectLimit = DragSource.DragLimitBounds; - - Rectangle rect = RectSplitter; - if (rectLimit.Width <= 0 || rectLimit.Height <= 0) - return rect; - - if (DragSource.IsVertical) - { - rect.X += ptMouse.X - StartMousePosition.X; - rect.Height = rectLimit.Height; - } - else - { - rect.Y += ptMouse.Y - StartMousePosition.Y; - rect.Width = rectLimit.Width; - } - - if (rect.Left < rectLimit.Left) - rect.X = rectLimit.X; - if (rect.Top < rectLimit.Top) - rect.Y = rectLimit.Y; - if (rect.Right > rectLimit.Right) - rect.X -= rect.Right - rectLimit.Right; - if (rect.Bottom > rectLimit.Bottom) - rect.Y -= rect.Bottom - rectLimit.Bottom; - - return rect; - } - } - - private SplitterDragHandler m_splitterDragHandler = null; - private SplitterDragHandler GetSplitterDragHandler() - { - if (m_splitterDragHandler == null) - m_splitterDragHandler = new SplitterDragHandler(this); - return m_splitterDragHandler; - } - - internal void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter) - { - GetSplitterDragHandler().BeginDrag(dragSource, rectSplitter); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.bmp deleted file mode 100644 index 10d6858f9..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.cs deleted file mode 100644 index 0e32476a8..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.cs +++ /dev/null @@ -1,1121 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Windows.Forms; -using System.ComponentModel; -using System.Runtime.InteropServices; -using System.IO; -using System.Text; -using System.Diagnostics.CodeAnalysis; -using System.Collections.Generic; - -// To simplify the process of finding the toolbox bitmap resource: -// #1 Create an internal class called "resfinder" outside of the root namespace. -// #2 Use "resfinder" in the toolbox bitmap attribute instead of the control name. -// #3 use the "." string to locate the resource. -// See: http://www.bobpowell.net/toolboxbitmap.htm -internal class resfinder -{ -} - -namespace WeifenLuo.WinFormsUI.Docking -{ - [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "0#")] - public delegate IDockContent DeserializeDockContent(string persistString); - - [LocalizedDescription("DockPanel_Description")] - [Designer("System.Windows.Forms.Design.ControlDesigner, System.Design")] - [ToolboxBitmap(typeof(resfinder), "WeifenLuo.WinFormsUI.Docking.DockPanel.bmp")] - [DefaultProperty("DocumentStyle")] - [DefaultEvent("ActiveContentChanged")] - public partial class DockPanel : Panel - { - private readonly FocusManagerImpl m_focusManager; - private readonly DockPanelExtender m_extender; - private readonly DockPaneCollection m_panes; - private readonly FloatWindowCollection m_floatWindows; - private readonly AutoHideWindowControl m_autoHideWindow; - private readonly DockWindowCollection m_dockWindows; - private readonly DockContent m_dummyContent; - private readonly Control m_dummyControl; - - public DockPanel() - { - ShowAutoHideContentOnHover = true; - - m_focusManager = new FocusManagerImpl(this); - m_extender = new DockPanelExtender(this); - m_panes = new DockPaneCollection(); - m_floatWindows = new FloatWindowCollection(); - - SuspendLayout(); - - m_autoHideWindow = new AutoHideWindowControl(this); - m_autoHideWindow.Visible = false; - m_autoHideWindow.ActiveContentChanged += m_autoHideWindow_ActiveContentChanged; - SetAutoHideWindowParent(); - - m_dummyControl = new DummyControl(); - m_dummyControl.Bounds = new Rectangle(0, 0, 1, 1); - Controls.Add(m_dummyControl); - - m_dockWindows = new DockWindowCollection(this); - Controls.AddRange(new Control[] { - DockWindows[DockState.Document], - DockWindows[DockState.DockLeft], - DockWindows[DockState.DockRight], - DockWindows[DockState.DockTop], - DockWindows[DockState.DockBottom] - }); - - m_dummyContent = new DockContent(); - ResumeLayout(); - } - - private Color m_BackColor; - /// - /// Determines the color with which the client rectangle will be drawn. - /// If this property is used instead of the BackColor it will not have any influence on the borders to the surrounding controls (DockPane). - /// The BackColor property changes the borders of surrounding controls (DockPane). - /// Alternatively both properties may be used (BackColor to draw and define the color of the borders and DockBackColor to define the color of the client rectangle). - /// For Backgroundimages: Set your prefered Image, then set the DockBackColor and the BackColor to the same Color (Control) - /// - [Description("Determines the color with which the client rectangle will be drawn.\r\n" + - "If this property is used instead of the BackColor it will not have any influence on the borders to the surrounding controls (DockPane).\r\n" + - "The BackColor property changes the borders of surrounding controls (DockPane).\r\n" + - "Alternatively both properties may be used (BackColor to draw and define the color of the borders and DockBackColor to define the color of the client rectangle).\r\n" + - "For Backgroundimages: Set your prefered Image, then set the DockBackColor and the BackColor to the same Color (Control).")] - public Color DockBackColor - { - get - { - return !m_BackColor.IsEmpty ? m_BackColor : base.BackColor; - } - set - { - if (m_BackColor != value) - { - m_BackColor = value; - this.Refresh(); - } - } - } - - private bool ShouldSerializeDockBackColor() - { - return !m_BackColor.IsEmpty; - } - - private void ResetDockBackColor() - { - DockBackColor = Color.Empty; - } - - private AutoHideStripBase m_autoHideStripControl = null; - internal AutoHideStripBase AutoHideStripControl - { - get - { - if (m_autoHideStripControl == null) - { - m_autoHideStripControl = AutoHideStripFactory.CreateAutoHideStrip(this); - Controls.Add(m_autoHideStripControl); - } - return m_autoHideStripControl; - } - } - internal void ResetAutoHideStripControl() - { - if (m_autoHideStripControl != null) - m_autoHideStripControl.Dispose(); - - m_autoHideStripControl = null; - } - - private void MdiClientHandleAssigned(object sender, EventArgs e) - { - SetMdiClient(); - PerformLayout(); - } - - private void MdiClient_Layout(object sender, LayoutEventArgs e) - { - if (DocumentStyle != DocumentStyle.DockingMdi) - return; - - foreach (DockPane pane in Panes) - if (pane.DockState == DockState.Document) - pane.SetContentBounds(); - - InvalidateWindowRegion(); - } - - private bool m_disposed = false; - protected override void Dispose(bool disposing) - { - if (!m_disposed && disposing) - { - m_focusManager.Dispose(); - if (m_mdiClientController != null) - { - m_mdiClientController.HandleAssigned -= new EventHandler(MdiClientHandleAssigned); - m_mdiClientController.MdiChildActivate -= new EventHandler(ParentFormMdiChildActivate); - m_mdiClientController.Layout -= new LayoutEventHandler(MdiClient_Layout); - m_mdiClientController.Dispose(); - } - FloatWindows.Dispose(); - Panes.Dispose(); - DummyContent.Dispose(); - - m_disposed = true; - } - - base.Dispose(disposing); - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public IDockContent ActiveAutoHideContent - { - get { return AutoHideWindow.ActiveContent; } - set { AutoHideWindow.ActiveContent = value; } - } - - private bool m_allowEndUserDocking = !Win32Helper.IsRunningOnMono; - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockPanel_AllowEndUserDocking_Description")] - [DefaultValue(true)] - public bool AllowEndUserDocking - { - get - { - if (Win32Helper.IsRunningOnMono && m_allowEndUserDocking) - m_allowEndUserDocking = false; - - return m_allowEndUserDocking; - } - set - { - if (Win32Helper.IsRunningOnMono && value) - throw new InvalidOperationException("AllowEndUserDocking can only be false if running on Mono"); - - m_allowEndUserDocking = value; - } - } - - - private bool m_raiseTabsOnDragOver = true; - [LocalizedCategory("Category_Docking")] - [Description("Raises tabs in a document pane when dragging over them")] - [DefaultValue(true)] - public bool RaiseTabsOnDragOver - { - get - { - return m_raiseTabsOnDragOver; - } - set - { - m_raiseTabsOnDragOver = value; - } - } - - private bool m_closeTabsToLeft = true; - [LocalizedCategory("Category_Docking")] - [Description("When closing the active tab, select next to the left")] - [DefaultValue(true)] - public bool CloseTabsToLeft - { - get - { - return m_closeTabsToLeft; - } - set - { - m_closeTabsToLeft = value; - } - } - - private bool m_allowEndUserNestedDocking = !Win32Helper.IsRunningOnMono; - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockPanel_AllowEndUserNestedDocking_Description")] - [DefaultValue(true)] - public bool AllowEndUserNestedDocking - { - get - { - if (Win32Helper.IsRunningOnMono && m_allowEndUserDocking) - m_allowEndUserDocking = false; - return m_allowEndUserNestedDocking; - } - set - { - if (Win32Helper.IsRunningOnMono && value) - throw new InvalidOperationException("AllowEndUserNestedDocking can only be false if running on Mono"); - - m_allowEndUserNestedDocking = value; - } - } - - private DockContentCollection m_contents = new DockContentCollection(); - [Browsable(false)] - public DockContentCollection Contents - { - get { return m_contents; } - } - - internal DockContent DummyContent - { - get { return m_dummyContent; } - } - - private bool m_rightToLeftLayout = false; - [DefaultValue(false)] - [LocalizedCategory("Appearance")] - [LocalizedDescription("DockPanel_RightToLeftLayout_Description")] - public bool RightToLeftLayout - { - get { return m_rightToLeftLayout; } - set - { - if (m_rightToLeftLayout == value) - return; - - m_rightToLeftLayout = value; - foreach (FloatWindow floatWindow in FloatWindows) - floatWindow.RightToLeftLayout = value; - } - } - - protected override void OnRightToLeftChanged(EventArgs e) - { - base.OnRightToLeftChanged(e); - foreach (FloatWindow floatWindow in FloatWindows) - { - if (floatWindow.RightToLeft != RightToLeft) - floatWindow.RightToLeft = RightToLeft; - } - } - - private bool m_showDocumentIcon = false; - [DefaultValue(false)] - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockPanel_ShowDocumentIcon_Description")] - public bool ShowDocumentIcon - { - get { return m_showDocumentIcon; } - set - { - if (m_showDocumentIcon == value) - return; - - m_showDocumentIcon = value; - Refresh(); - } - } - - private DocumentTabStripLocation m_documentTabStripLocation = DocumentTabStripLocation.Top; - [DefaultValue(DocumentTabStripLocation.Top)] - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockPanel_DocumentTabStripLocation")] - public DocumentTabStripLocation DocumentTabStripLocation - { - get { return m_documentTabStripLocation; } - set { m_documentTabStripLocation = value; } - } - - [Browsable(false)] - public DockPanelExtender Extender - { - get { return m_extender; } - } - - [Browsable(false)] - public DockPanelExtender.IDockPaneFactory DockPaneFactory - { - get { return Extender.DockPaneFactory; } - } - - [Browsable(false)] - public DockPanelExtender.IFloatWindowFactory FloatWindowFactory - { - get { return Extender.FloatWindowFactory; } - } - - internal DockPanelExtender.IDockPaneCaptionFactory DockPaneCaptionFactory - { - get { return Extender.DockPaneCaptionFactory; } - } - - internal DockPanelExtender.IDockPaneStripFactory DockPaneStripFactory - { - get { return Extender.DockPaneStripFactory; } - } - - internal DockPanelExtender.IAutoHideStripFactory AutoHideStripFactory - { - get { return Extender.AutoHideStripFactory; } - } - - [Browsable(false)] - public DockPaneCollection Panes - { - get { return m_panes; } - } - - internal Rectangle DockArea - { - get - { - return new Rectangle(DockPadding.Left, DockPadding.Top, - ClientRectangle.Width - DockPadding.Left - DockPadding.Right, - ClientRectangle.Height - DockPadding.Top - DockPadding.Bottom); - } - } - - private double m_dockBottomPortion = 0.25; - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockPanel_DockBottomPortion_Description")] - [DefaultValue(0.25)] - public double DockBottomPortion - { - get { return m_dockBottomPortion; } - set - { - if (value <= 0) - throw new ArgumentOutOfRangeException("value"); - - if (value == m_dockBottomPortion) - return; - - m_dockBottomPortion = value; - - if (m_dockBottomPortion < 1 && m_dockTopPortion < 1) - { - if (m_dockTopPortion + m_dockBottomPortion > 1) - m_dockTopPortion = 1 - m_dockBottomPortion; - } - - PerformLayout(); - } - } - - private double m_dockLeftPortion = 0.25; - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockPanel_DockLeftPortion_Description")] - [DefaultValue(0.25)] - public double DockLeftPortion - { - get { return m_dockLeftPortion; } - set - { - if (value <= 0) - throw new ArgumentOutOfRangeException("value"); - - if (value == m_dockLeftPortion) - return; - - m_dockLeftPortion = value; - - if (m_dockLeftPortion < 1 && m_dockRightPortion < 1) - { - if (m_dockLeftPortion + m_dockRightPortion > 1) - m_dockRightPortion = 1 - m_dockLeftPortion; - } - PerformLayout(); - } - } - - private double m_dockRightPortion = 0.25; - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockPanel_DockRightPortion_Description")] - [DefaultValue(0.25)] - public double DockRightPortion - { - get { return m_dockRightPortion; } - set - { - if (value <= 0) - throw new ArgumentOutOfRangeException("value"); - - if (value == m_dockRightPortion) - return; - - m_dockRightPortion = value; - - if (m_dockLeftPortion < 1 && m_dockRightPortion < 1) - { - if (m_dockLeftPortion + m_dockRightPortion > 1) - m_dockLeftPortion = 1 - m_dockRightPortion; - } - PerformLayout(); - } - } - - private double m_dockTopPortion = 0.25; - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockPanel_DockTopPortion_Description")] - [DefaultValue(0.25)] - public double DockTopPortion - { - get { return m_dockTopPortion; } - set - { - if (value <= 0) - throw new ArgumentOutOfRangeException("value"); - - if (value == m_dockTopPortion) - return; - - m_dockTopPortion = value; - - if (m_dockTopPortion < 1 && m_dockBottomPortion < 1) - { - if (m_dockTopPortion + m_dockBottomPortion > 1) - m_dockBottomPortion = 1 - m_dockTopPortion; - } - PerformLayout(); - } - } - - [Browsable(false)] - public DockWindowCollection DockWindows - { - get { return m_dockWindows; } - } - - public void UpdateDockWindowZOrder(DockStyle dockStyle, bool fullPanelEdge) - { - if (dockStyle == DockStyle.Left) - { - if (fullPanelEdge) - DockWindows[DockState.DockLeft].SendToBack(); - else - DockWindows[DockState.DockLeft].BringToFront(); - } - else if (dockStyle == DockStyle.Right) - { - if (fullPanelEdge) - DockWindows[DockState.DockRight].SendToBack(); - else - DockWindows[DockState.DockRight].BringToFront(); - } - else if (dockStyle == DockStyle.Top) - { - if (fullPanelEdge) - DockWindows[DockState.DockTop].SendToBack(); - else - DockWindows[DockState.DockTop].BringToFront(); - } - else if (dockStyle == DockStyle.Bottom) - { - if (fullPanelEdge) - DockWindows[DockState.DockBottom].SendToBack(); - else - DockWindows[DockState.DockBottom].BringToFront(); - } - } - - [Browsable(false)] - public int DocumentsCount - { - get - { - int count = 0; - foreach (IDockContent content in Documents) - count++; - - return count; - } - } - - public IDockContent[] DocumentsToArray() - { - int count = DocumentsCount; - IDockContent[] documents = new IDockContent[count]; - int i = 0; - foreach (IDockContent content in Documents) - { - documents[i] = content; - i++; - } - - return documents; - } - - [Browsable(false)] - public IEnumerable Documents - { - get - { - foreach (IDockContent content in Contents) - { - if (content.DockHandler.DockState == DockState.Document) - yield return content; - } - } - } - - private Control DummyControl - { - get { return m_dummyControl; } - } - - [Browsable(false)] - public FloatWindowCollection FloatWindows - { - get { return m_floatWindows; } - } - - private Size m_defaultFloatWindowSize = new Size(300, 300); - [Category("Layout")] - [LocalizedDescription("DockPanel_DefaultFloatWindowSize_Description")] - public Size DefaultFloatWindowSize - { - get { return m_defaultFloatWindowSize; } - set { m_defaultFloatWindowSize = value; } - } - private bool ShouldSerializeDefaultFloatWindowSize() - { - return DefaultFloatWindowSize != new Size(300, 300); - } - private void ResetDefaultFloatWindowSize() - { - DefaultFloatWindowSize = new Size(300, 300); - } - - private DocumentStyle m_documentStyle = DocumentStyle.DockingMdi; - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockPanel_DocumentStyle_Description")] - [DefaultValue(DocumentStyle.DockingMdi)] - public DocumentStyle DocumentStyle - { - get { return m_documentStyle; } - set - { - if (value == m_documentStyle) - return; - - if (!Enum.IsDefined(typeof(DocumentStyle), value)) - throw new InvalidEnumArgumentException(); - - if (value == DocumentStyle.SystemMdi && DockWindows[DockState.Document].VisibleNestedPanes.Count > 0) - throw new InvalidEnumArgumentException(); - - m_documentStyle = value; - - SuspendLayout(true); - - SetAutoHideWindowParent(); - SetMdiClient(); - InvalidateWindowRegion(); - - foreach (IDockContent content in Contents) - { - if (content.DockHandler.DockState == DockState.Document) - content.DockHandler.SetPaneAndVisible(content.DockHandler.Pane); - } - - PerformMdiClientLayout(); - - ResumeLayout(true, true); - } - } - - private bool _supprtDeeplyNestedContent = false; - [LocalizedCategory("Category_Performance")] - [LocalizedDescription("DockPanel_SupportDeeplyNestedContent_Description")] - [DefaultValue(false)] - public bool SupportDeeplyNestedContent - { - get { return _supprtDeeplyNestedContent; } - set { _supprtDeeplyNestedContent = value; } - } - - [LocalizedCategory("Category_Docking")] - [LocalizedDescription("DockPanel_ShowAutoHideContentOnHover_Description")] - [DefaultValue(true)] - public bool ShowAutoHideContentOnHover { get; set; } - - private int GetDockWindowSize(DockState dockState) - { - if (dockState == DockState.DockLeft || dockState == DockState.DockRight) - { - int width = ClientRectangle.Width - DockPadding.Left - DockPadding.Right; - int dockLeftSize = m_dockLeftPortion >= 1 ? (int)m_dockLeftPortion : (int)(width * m_dockLeftPortion); - int dockRightSize = m_dockRightPortion >= 1 ? (int)m_dockRightPortion : (int)(width * m_dockRightPortion); - - if (dockLeftSize < MeasurePane.MinSize) - dockLeftSize = MeasurePane.MinSize; - if (dockRightSize < MeasurePane.MinSize) - dockRightSize = MeasurePane.MinSize; - - if (dockLeftSize + dockRightSize > width - MeasurePane.MinSize) - { - int adjust = (dockLeftSize + dockRightSize) - (width - MeasurePane.MinSize); - dockLeftSize -= adjust / 2; - dockRightSize -= adjust / 2; - } - - return dockState == DockState.DockLeft ? dockLeftSize : dockRightSize; - } - else if (dockState == DockState.DockTop || dockState == DockState.DockBottom) - { - int height = ClientRectangle.Height - DockPadding.Top - DockPadding.Bottom; - int dockTopSize = m_dockTopPortion >= 1 ? (int)m_dockTopPortion : (int)(height * m_dockTopPortion); - int dockBottomSize = m_dockBottomPortion >= 1 ? (int)m_dockBottomPortion : (int)(height * m_dockBottomPortion); - - if (dockTopSize < MeasurePane.MinSize) - dockTopSize = MeasurePane.MinSize; - if (dockBottomSize < MeasurePane.MinSize) - dockBottomSize = MeasurePane.MinSize; - - if (dockTopSize + dockBottomSize > height - MeasurePane.MinSize) - { - int adjust = (dockTopSize + dockBottomSize) - (height - MeasurePane.MinSize); - dockTopSize -= adjust / 2; - dockBottomSize -= adjust / 2; - } - - return dockState == DockState.DockTop ? dockTopSize : dockBottomSize; - } - else - return 0; - } - - protected override void OnLayout(LayoutEventArgs levent) - { - SuspendLayout(true); - - AutoHideStripControl.Bounds = ClientRectangle; - - CalculateDockPadding(); - - DockWindows[DockState.DockLeft].Width = GetDockWindowSize(DockState.DockLeft); - DockWindows[DockState.DockRight].Width = GetDockWindowSize(DockState.DockRight); - DockWindows[DockState.DockTop].Height = GetDockWindowSize(DockState.DockTop); - DockWindows[DockState.DockBottom].Height = GetDockWindowSize(DockState.DockBottom); - - AutoHideWindow.Bounds = GetAutoHideWindowBounds(AutoHideWindowRectangle); - - DockWindows[DockState.Document].BringToFront(); - AutoHideWindow.BringToFront(); - - base.OnLayout(levent); - - if (DocumentStyle == DocumentStyle.SystemMdi && MdiClientExists) - { - SetMdiClientBounds(SystemMdiClientBounds); - InvalidateWindowRegion(); - } - else if (DocumentStyle == DocumentStyle.DockingMdi) - InvalidateWindowRegion(); - - ResumeLayout(true, true); - } - - internal Rectangle GetTabStripRectangle(DockState dockState) - { - return AutoHideStripControl.GetTabStripRectangle(dockState); - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - if (DockBackColor == BackColor) return; - - Graphics g = e.Graphics; - SolidBrush bgBrush = new SolidBrush(DockBackColor); - g.FillRectangle(bgBrush, ClientRectangle); - } - - internal void AddContent(IDockContent content) - { - if (content == null) - throw(new ArgumentNullException()); - - if (!Contents.Contains(content)) - { - Contents.Add(content); - OnContentAdded(new DockContentEventArgs(content)); - } - } - - internal void AddPane(DockPane pane) - { - if (Panes.Contains(pane)) - return; - - Panes.Add(pane); - } - - internal void AddFloatWindow(FloatWindow floatWindow) - { - if (FloatWindows.Contains(floatWindow)) - return; - - FloatWindows.Add(floatWindow); - } - - private void CalculateDockPadding() - { - DockPadding.All = 0; - - int height = AutoHideStripControl.MeasureHeight(); - - if (AutoHideStripControl.GetNumberOfPanes(DockState.DockLeftAutoHide) > 0) - DockPadding.Left = height; - if (AutoHideStripControl.GetNumberOfPanes(DockState.DockRightAutoHide) > 0) - DockPadding.Right = height; - if (AutoHideStripControl.GetNumberOfPanes(DockState.DockTopAutoHide) > 0) - DockPadding.Top = height; - if (AutoHideStripControl.GetNumberOfPanes(DockState.DockBottomAutoHide) > 0) - DockPadding.Bottom = height; - } - - internal void RemoveContent(IDockContent content) - { - if (content == null) - throw(new ArgumentNullException()); - - if (Contents.Contains(content)) - { - Contents.Remove(content); - OnContentRemoved(new DockContentEventArgs(content)); - } - } - - internal void RemovePane(DockPane pane) - { - if (!Panes.Contains(pane)) - return; - - Panes.Remove(pane); - } - - internal void RemoveFloatWindow(FloatWindow floatWindow) - { - if (!FloatWindows.Contains(floatWindow)) - return; - - FloatWindows.Remove(floatWindow); - if (FloatWindows.Count != 0) - return; - - if (ParentForm == null) - return; - - ParentForm.Focus(); - } - - public void SetPaneIndex(DockPane pane, int index) - { - int oldIndex = Panes.IndexOf(pane); - if (oldIndex == -1) - throw(new ArgumentException(Strings.DockPanel_SetPaneIndex_InvalidPane)); - - if (index < 0 || index > Panes.Count - 1) - if (index != -1) - throw(new ArgumentOutOfRangeException(Strings.DockPanel_SetPaneIndex_InvalidIndex)); - - if (oldIndex == index) - return; - if (oldIndex == Panes.Count - 1 && index == -1) - return; - - Panes.Remove(pane); - if (index == -1) - Panes.Add(pane); - else if (oldIndex < index) - Panes.AddAt(pane, index - 1); - else - Panes.AddAt(pane, index); - } - - public void SuspendLayout(bool allWindows) - { - FocusManager.SuspendFocusTracking(); - SuspendLayout(); - if (allWindows) - SuspendMdiClientLayout(); - } - - public void ResumeLayout(bool performLayout, bool allWindows) - { - FocusManager.ResumeFocusTracking(); - ResumeLayout(performLayout); - if (allWindows) - ResumeMdiClientLayout(performLayout); - } - - internal Form ParentForm - { - get - { - if (!IsParentFormValid()) - throw new InvalidOperationException(Strings.DockPanel_ParentForm_Invalid); - - return GetMdiClientController().ParentForm; - } - } - - private bool IsParentFormValid() - { - if (DocumentStyle == DocumentStyle.DockingSdi || DocumentStyle == DocumentStyle.DockingWindow) - return true; - - if (!MdiClientExists) - GetMdiClientController().RenewMdiClient(); - - return (MdiClientExists); - } - - protected override void OnParentChanged(EventArgs e) - { - SetAutoHideWindowParent(); - GetMdiClientController().ParentForm = (this.Parent as Form); - base.OnParentChanged (e); - } - - private void SetAutoHideWindowParent() - { - Control parent; - if (DocumentStyle == DocumentStyle.DockingMdi || - DocumentStyle == DocumentStyle.SystemMdi) - parent = this.Parent; - else - parent = this; - if (AutoHideWindow.Parent != parent) - { - AutoHideWindow.Parent = parent; - AutoHideWindow.BringToFront(); - } - } - - protected override void OnVisibleChanged(EventArgs e) - { - base.OnVisibleChanged (e); - - if (Visible) - SetMdiClient(); - } - - private Rectangle SystemMdiClientBounds - { - get - { - if (!IsParentFormValid() || !Visible) - return Rectangle.Empty; - - Rectangle rect = ParentForm.RectangleToClient(RectangleToScreen(DocumentWindowBounds)); - return rect; - } - } - - internal Rectangle DocumentWindowBounds - { - get - { - Rectangle rectDocumentBounds = DisplayRectangle; - if (DockWindows[DockState.DockLeft].Visible) - { - rectDocumentBounds.X += DockWindows[DockState.DockLeft].Width; - rectDocumentBounds.Width -= DockWindows[DockState.DockLeft].Width; - } - if (DockWindows[DockState.DockRight].Visible) - rectDocumentBounds.Width -= DockWindows[DockState.DockRight].Width; - if (DockWindows[DockState.DockTop].Visible) - { - rectDocumentBounds.Y += DockWindows[DockState.DockTop].Height; - rectDocumentBounds.Height -= DockWindows[DockState.DockTop].Height; - } - if (DockWindows[DockState.DockBottom].Visible) - rectDocumentBounds.Height -= DockWindows[DockState.DockBottom].Height; - - return rectDocumentBounds; - - } - } - - private PaintEventHandler m_dummyControlPaintEventHandler = null; - private void InvalidateWindowRegion() - { - if (DesignMode) - return; - - if (m_dummyControlPaintEventHandler == null) - m_dummyControlPaintEventHandler = new PaintEventHandler(DummyControl_Paint); - - DummyControl.Paint += m_dummyControlPaintEventHandler; - DummyControl.Invalidate(); - } - - void DummyControl_Paint(object sender, PaintEventArgs e) - { - DummyControl.Paint -= m_dummyControlPaintEventHandler; - UpdateWindowRegion(); - } - - private void UpdateWindowRegion() - { - if (this.DocumentStyle == DocumentStyle.DockingMdi) - UpdateWindowRegion_ClipContent(); - else if (this.DocumentStyle == DocumentStyle.DockingSdi || - this.DocumentStyle == DocumentStyle.DockingWindow) - UpdateWindowRegion_FullDocumentArea(); - else if (this.DocumentStyle == DocumentStyle.SystemMdi) - UpdateWindowRegion_EmptyDocumentArea(); - } - - private void UpdateWindowRegion_FullDocumentArea() - { - SetRegion(null); - } - - private void UpdateWindowRegion_EmptyDocumentArea() - { - Rectangle rect = DocumentWindowBounds; - SetRegion(new Rectangle[] { rect }); - } - - private void UpdateWindowRegion_ClipContent() - { - int count = 0; - foreach (DockPane pane in this.Panes) - { - if (!pane.Visible || pane.DockState != DockState.Document) - continue; - - count ++; - } - - if (count == 0) - { - SetRegion(null); - return; - } - - Rectangle[] rects = new Rectangle[count]; - int i = 0; - foreach (DockPane pane in this.Panes) - { - if (!pane.Visible || pane.DockState != DockState.Document) - continue; - - rects[i] = RectangleToClient(pane.RectangleToScreen(pane.ContentRectangle)); - i++; - } - - SetRegion(rects); - } - - private Rectangle[] m_clipRects = null; - private void SetRegion(Rectangle[] clipRects) - { - if (!IsClipRectsChanged(clipRects)) - return; - - m_clipRects = clipRects; - - if (m_clipRects == null || m_clipRects.GetLength(0) == 0) - Region = null; - else - { - Region region = new Region(new Rectangle(0, 0, this.Width, this.Height)); - foreach (Rectangle rect in m_clipRects) - region.Exclude(rect); - Region = region; - } - } - - private bool IsClipRectsChanged(Rectangle[] clipRects) - { - if (clipRects == null && m_clipRects == null) - return false; - else if ((clipRects == null) != (m_clipRects == null)) - return true; - - foreach (Rectangle rect in clipRects) - { - bool matched = false; - foreach (Rectangle rect2 in m_clipRects) - { - if (rect == rect2) - { - matched = true; - break; - } - } - if (!matched) - return true; - } - - foreach (Rectangle rect2 in m_clipRects) - { - bool matched = false; - foreach (Rectangle rect in clipRects) - { - if (rect == rect2) - { - matched = true; - break; - } - } - if (!matched) - return true; - } - return false; - } - - private static readonly object ActiveAutoHideContentChangedEvent = new object(); - [LocalizedCategory("Category_DockingNotification")] - [LocalizedDescription("DockPanel_ActiveAutoHideContentChanged_Description")] - public event EventHandler ActiveAutoHideContentChanged - { - add { Events.AddHandler(ActiveAutoHideContentChangedEvent, value); } - remove { Events.RemoveHandler(ActiveAutoHideContentChangedEvent, value); } - } - protected virtual void OnActiveAutoHideContentChanged(EventArgs e) - { - EventHandler handler = (EventHandler)Events[ActiveAutoHideContentChangedEvent]; - if (handler != null) - handler(this, e); - } - private void m_autoHideWindow_ActiveContentChanged(object sender, EventArgs e) - { - OnActiveAutoHideContentChanged(e); - } - - - private static readonly object ContentAddedEvent = new object(); - [LocalizedCategory("Category_DockingNotification")] - [LocalizedDescription("DockPanel_ContentAdded_Description")] - public event EventHandler ContentAdded - { - add { Events.AddHandler(ContentAddedEvent, value); } - remove { Events.RemoveHandler(ContentAddedEvent, value); } - } - protected virtual void OnContentAdded(DockContentEventArgs e) - { - EventHandler handler = (EventHandler)Events[ContentAddedEvent]; - if (handler != null) - handler(this, e); - } - - private static readonly object ContentRemovedEvent = new object(); - [LocalizedCategory("Category_DockingNotification")] - [LocalizedDescription("DockPanel_ContentRemoved_Description")] - public event EventHandler ContentRemoved - { - add { Events.AddHandler(ContentRemovedEvent, value); } - remove { Events.RemoveHandler(ContentRemovedEvent, value); } - } - protected virtual void OnContentRemoved(DockContentEventArgs e) - { - EventHandler handler = (EventHandler)Events[ContentRemovedEvent]; - if (handler != null) - handler(this, e); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanelExtender.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanelExtender.cs deleted file mode 100644 index 534af2088..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanelExtender.cs +++ /dev/null @@ -1,225 +0,0 @@ -using System; -using System.Drawing; -using System.Diagnostics.CodeAnalysis; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public sealed class DockPanelExtender - { - [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - public interface IDockPaneFactory - { - DockPane CreateDockPane(IDockContent content, DockState visibleState, bool show); - [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "1#")] - DockPane CreateDockPane(IDockContent content, FloatWindow floatWindow, bool show); - DockPane CreateDockPane(IDockContent content, DockPane previousPane, DockAlignment alignment, double proportion, bool show); - [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "1#")] - DockPane CreateDockPane(IDockContent content, Rectangle floatWindowBounds, bool show); - } - - [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - public interface IFloatWindowFactory - { - FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane); - FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds); - } - - [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - public interface IDockPaneCaptionFactory - { - DockPaneCaptionBase CreateDockPaneCaption(DockPane pane); - } - - [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - public interface IDockPaneStripFactory - { - DockPaneStripBase CreateDockPaneStrip(DockPane pane); - } - - [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - public interface IAutoHideStripFactory - { - AutoHideStripBase CreateAutoHideStrip(DockPanel panel); - } - - #region DefaultDockPaneFactory - private class DefaultDockPaneFactory : IDockPaneFactory - { - public DockPane CreateDockPane(IDockContent content, DockState visibleState, bool show) - { - return new DockPane(content, visibleState, show); - } - - public DockPane CreateDockPane(IDockContent content, FloatWindow floatWindow, bool show) - { - return new DockPane(content, floatWindow, show); - } - - public DockPane CreateDockPane(IDockContent content, DockPane prevPane, DockAlignment alignment, double proportion, bool show) - { - return new DockPane(content, prevPane, alignment, proportion, show); - } - - public DockPane CreateDockPane(IDockContent content, Rectangle floatWindowBounds, bool show) - { - return new DockPane(content, floatWindowBounds, show); - } - } - #endregion - - #region DefaultFloatWindowFactory - private class DefaultFloatWindowFactory : IFloatWindowFactory - { - public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane) - { - return new FloatWindow(dockPanel, pane); - } - - public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds) - { - return new FloatWindow(dockPanel, pane, bounds); - } - } - #endregion - - #region DefaultDockPaneCaptionFactory - private class DefaultDockPaneCaptionFactory : IDockPaneCaptionFactory - { - public DockPaneCaptionBase CreateDockPaneCaption(DockPane pane) - { - return new VS2005DockPaneCaption(pane); - } - } - #endregion - - #region DefaultDockPaneTabStripFactory - private class DefaultDockPaneStripFactory : IDockPaneStripFactory - { - public DockPaneStripBase CreateDockPaneStrip(DockPane pane) - { - return new VS2005DockPaneStrip(pane); - } - } - #endregion - - #region DefaultAutoHideStripFactory - private class DefaultAutoHideStripFactory : IAutoHideStripFactory - { - public AutoHideStripBase CreateAutoHideStrip(DockPanel panel) - { - return new VS2005AutoHideStrip(panel); - } - } - #endregion - - internal DockPanelExtender(DockPanel dockPanel) - { - m_dockPanel = dockPanel; - } - - private DockPanel m_dockPanel; - private DockPanel DockPanel - { - get { return m_dockPanel; } - } - - private IDockPaneFactory m_dockPaneFactory = null; - public IDockPaneFactory DockPaneFactory - { - get - { - if (m_dockPaneFactory == null) - m_dockPaneFactory = new DefaultDockPaneFactory(); - - return m_dockPaneFactory; - } - set - { - if (DockPanel.Panes.Count > 0) - throw new InvalidOperationException(); - - m_dockPaneFactory = value; - } - } - - private IFloatWindowFactory m_floatWindowFactory = null; - public IFloatWindowFactory FloatWindowFactory - { - get - { - if (m_floatWindowFactory == null) - m_floatWindowFactory = new DefaultFloatWindowFactory(); - - return m_floatWindowFactory; - } - set - { - if (DockPanel.FloatWindows.Count > 0) - throw new InvalidOperationException(); - - m_floatWindowFactory = value; - } - } - - private IDockPaneCaptionFactory m_dockPaneCaptionFactory = null; - public IDockPaneCaptionFactory DockPaneCaptionFactory - { - get - { - if (m_dockPaneCaptionFactory == null) - m_dockPaneCaptionFactory = new DefaultDockPaneCaptionFactory(); - - return m_dockPaneCaptionFactory; - } - set - { - if (DockPanel.Panes.Count > 0) - throw new InvalidOperationException(); - - m_dockPaneCaptionFactory = value; - } - } - - private IDockPaneStripFactory m_dockPaneStripFactory = null; - public IDockPaneStripFactory DockPaneStripFactory - { - get - { - if (m_dockPaneStripFactory == null) - m_dockPaneStripFactory = new DefaultDockPaneStripFactory(); - - return m_dockPaneStripFactory; - } - set - { - if (DockPanel.Contents.Count > 0) - throw new InvalidOperationException(); - - m_dockPaneStripFactory = value; - } - } - - private IAutoHideStripFactory m_autoHideStripFactory = null; - public IAutoHideStripFactory AutoHideStripFactory - { - get - { - if (m_autoHideStripFactory == null) - m_autoHideStripFactory = new DefaultAutoHideStripFactory(); - - return m_autoHideStripFactory; - } - set - { - if (DockPanel.Contents.Count > 0) - throw new InvalidOperationException(); - - if (m_autoHideStripFactory == value) - return; - - m_autoHideStripFactory = value; - DockPanel.ResetAutoHideStripControl(); - } - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanelSkin.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanelSkin.cs deleted file mode 100644 index b6c5476ca..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanelSkin.cs +++ /dev/null @@ -1,371 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Drawing.Design; -using System.Windows.Forms.Design; -using System.ComponentModel; - -namespace WeifenLuo.WinFormsUI.Docking -{ - #region DockPanelSkin classes - /// - /// The skin to use when displaying the DockPanel. - /// The skin allows custom gradient color schemes to be used when drawing the - /// DockStrips and Tabs. - /// - [TypeConverter(typeof(DockPanelSkinConverter))] - public class DockPanelSkin - { - private AutoHideStripSkin m_autoHideStripSkin = new AutoHideStripSkin(); - private DockPaneStripSkin m_dockPaneStripSkin = new DockPaneStripSkin(); - - /// - /// The skin used to display the auto hide strips and tabs. - /// - public AutoHideStripSkin AutoHideStripSkin - { - get { return m_autoHideStripSkin; } - set { m_autoHideStripSkin = value; } - } - - /// - /// The skin used to display the Document and ToolWindow style DockStrips and Tabs. - /// - public DockPaneStripSkin DockPaneStripSkin - { - get { return m_dockPaneStripSkin; } - set { m_dockPaneStripSkin = value; } - } - } - - /// - /// The skin used to display the auto hide strip and tabs. - /// - [TypeConverter(typeof(AutoHideStripConverter))] - public class AutoHideStripSkin - { - private DockPanelGradient m_dockStripGradient = new DockPanelGradient(); - private TabGradient m_TabGradient = new TabGradient(); - private Font m_textFont = SystemFonts.MenuFont; - - /// - /// The gradient color skin for the DockStrips. - /// - public DockPanelGradient DockStripGradient - { - get { return m_dockStripGradient; } - set { m_dockStripGradient = value; } - } - - /// - /// The gradient color skin for the Tabs. - /// - public TabGradient TabGradient - { - get { return m_TabGradient; } - set { m_TabGradient = value; } - } - - /// - /// Font used in AutoHideStrip elements. - /// - [DefaultValue(typeof(SystemFonts), "MenuFont")] - public Font TextFont - { - get { return m_textFont; } - set { m_textFont = value; } - } - } - - /// - /// The skin used to display the document and tool strips and tabs. - /// - [TypeConverter(typeof(DockPaneStripConverter))] - public class DockPaneStripSkin - { - private DockPaneStripGradient m_DocumentGradient = new DockPaneStripGradient(); - private DockPaneStripToolWindowGradient m_ToolWindowGradient = new DockPaneStripToolWindowGradient(); - private Font m_textFont = SystemFonts.MenuFont; - - /// - /// The skin used to display the Document style DockPane strip and tab. - /// - public DockPaneStripGradient DocumentGradient - { - get { return m_DocumentGradient; } - set { m_DocumentGradient = value; } - } - - /// - /// The skin used to display the ToolWindow style DockPane strip and tab. - /// - public DockPaneStripToolWindowGradient ToolWindowGradient - { - get { return m_ToolWindowGradient; } - set { m_ToolWindowGradient = value; } - } - - /// - /// Font used in DockPaneStrip elements. - /// - [DefaultValue(typeof(SystemFonts), "MenuFont")] - public Font TextFont - { - get { return m_textFont; } - set { m_textFont = value; } - } - } - - /// - /// The skin used to display the DockPane ToolWindow strip and tab. - /// - [TypeConverter(typeof(DockPaneStripGradientConverter))] - public class DockPaneStripToolWindowGradient : DockPaneStripGradient - { - private TabGradient m_activeCaptionGradient = new TabGradient(); - private TabGradient m_inactiveCaptionGradient = new TabGradient(); - - /// - /// The skin used to display the active ToolWindow caption. - /// - public TabGradient ActiveCaptionGradient - { - get { return m_activeCaptionGradient; } - set { m_activeCaptionGradient = value; } - } - - /// - /// The skin used to display the inactive ToolWindow caption. - /// - public TabGradient InactiveCaptionGradient - { - get { return m_inactiveCaptionGradient; } - set { m_inactiveCaptionGradient = value; } - } - } - - /// - /// The skin used to display the DockPane strip and tab. - /// - [TypeConverter(typeof(DockPaneStripGradientConverter))] - public class DockPaneStripGradient - { - private DockPanelGradient m_dockStripGradient = new DockPanelGradient(); - private TabGradient m_activeTabGradient = new TabGradient(); - private TabGradient m_inactiveTabGradient = new TabGradient(); - - /// - /// The gradient color skin for the DockStrip. - /// - public DockPanelGradient DockStripGradient - { - get { return m_dockStripGradient; } - set { m_dockStripGradient = value; } - } - - /// - /// The skin used to display the active DockPane tabs. - /// - public TabGradient ActiveTabGradient - { - get { return m_activeTabGradient; } - set { m_activeTabGradient = value; } - } - - /// - /// The skin used to display the inactive DockPane tabs. - /// - public TabGradient InactiveTabGradient - { - get { return m_inactiveTabGradient; } - set { m_inactiveTabGradient = value; } - } - } - - /// - /// The skin used to display the dock pane tab - /// - [TypeConverter(typeof(DockPaneTabGradientConverter))] - public class TabGradient : DockPanelGradient - { - private Color m_textColor = SystemColors.ControlText; - - /// - /// The text color. - /// - [DefaultValue(typeof(SystemColors), "ControlText")] - public Color TextColor - { - get { return m_textColor; } - set { m_textColor = value; } - } - } - - /// - /// The gradient color skin. - /// - [TypeConverter(typeof(DockPanelGradientConverter))] - public class DockPanelGradient - { - private Color m_startColor = SystemColors.Control; - private Color m_endColor = SystemColors.Control; - private LinearGradientMode m_linearGradientMode = LinearGradientMode.Horizontal; - - /// - /// The beginning gradient color. - /// - [DefaultValue(typeof(SystemColors), "Control")] - public Color StartColor - { - get { return m_startColor; } - set { m_startColor = value; } - } - - /// - /// The ending gradient color. - /// - [DefaultValue(typeof(SystemColors), "Control")] - public Color EndColor - { - get { return m_endColor; } - set { m_endColor = value; } - } - - /// - /// The gradient mode to display the colors. - /// - [DefaultValue(LinearGradientMode.Horizontal)] - public LinearGradientMode LinearGradientMode - { - get { return m_linearGradientMode; } - set { m_linearGradientMode = value; } - } - } - - #endregion - - #region Converters - public class DockPanelSkinConverter : ExpandableObjectConverter - { - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - if (destinationType == typeof(DockPanelSkin)) - return true; - - return base.CanConvertTo(context, destinationType); - } - - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) - { - if (destinationType == typeof(String) && value is DockPanelSkin) - { - return "DockPanelSkin"; - } - return base.ConvertTo(context, culture, value, destinationType); - } - } - - public class DockPanelGradientConverter : ExpandableObjectConverter - { - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - if (destinationType == typeof(DockPanelGradient)) - return true; - - return base.CanConvertTo(context, destinationType); - } - - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) - { - if (destinationType == typeof(String) && value is DockPanelGradient) - { - return "DockPanelGradient"; - } - return base.ConvertTo(context, culture, value, destinationType); - } - } - - public class AutoHideStripConverter : ExpandableObjectConverter - { - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - if (destinationType == typeof(AutoHideStripSkin)) - return true; - - return base.CanConvertTo(context, destinationType); - } - - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) - { - if (destinationType == typeof(String) && value is AutoHideStripSkin) - { - return "AutoHideStripSkin"; - } - return base.ConvertTo(context, culture, value, destinationType); - } - } - - public class DockPaneStripConverter : ExpandableObjectConverter - { - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - if (destinationType == typeof(DockPaneStripSkin)) - return true; - - return base.CanConvertTo(context, destinationType); - } - - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) - { - if (destinationType == typeof(String) && value is DockPaneStripSkin) - { - return "DockPaneStripSkin"; - } - return base.ConvertTo(context, culture, value, destinationType); - } - } - - public class DockPaneStripGradientConverter : ExpandableObjectConverter - { - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - if (destinationType == typeof(DockPaneStripGradient)) - return true; - - return base.CanConvertTo(context, destinationType); - } - - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) - { - if (destinationType == typeof(String) && value is DockPaneStripGradient) - { - return "DockPaneStripGradient"; - } - return base.ConvertTo(context, culture, value, destinationType); - } - } - - public class DockPaneTabGradientConverter : ExpandableObjectConverter - { - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - if (destinationType == typeof(TabGradient)) - return true; - - return base.CanConvertTo(context, destinationType); - } - - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) - { - TabGradient val = value as TabGradient; - if (destinationType == typeof(String) && val != null) - { - return "DockPaneTabGradient"; - } - return base.ConvertTo(context, culture, value, destinationType); - } - } - #endregion -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockWindow.SplitterControl.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockWindow.SplitterControl.cs deleted file mode 100644 index 3eaa65390..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockWindow.SplitterControl.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public partial class DockWindow - { - private class SplitterControl : SplitterBase - { - protected override int SplitterSize - { - get { return Measures.SplitterSize; } - } - - protected override void StartDrag() - { - DockWindow window = Parent as DockWindow; - if (window == null) - return; - - window.DockPanel.BeginDrag(window, window.RectangleToScreen(Bounds)); - } - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockWindow.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockWindow.cs deleted file mode 100644 index 9d12bc836..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockWindow.cs +++ /dev/null @@ -1,243 +0,0 @@ -using System; -using System.Windows.Forms; -using System.Drawing; -using System.Runtime.InteropServices; -using System.ComponentModel; - -namespace WeifenLuo.WinFormsUI.Docking -{ - [ToolboxItem(false)] - public partial class DockWindow : Panel, INestedPanesContainer, ISplitterDragSource - { - private DockPanel m_dockPanel; - private DockState m_dockState; - private SplitterControl m_splitter; - private NestedPaneCollection m_nestedPanes; - - internal DockWindow(DockPanel dockPanel, DockState dockState) - { - m_nestedPanes = new NestedPaneCollection(this); - m_dockPanel = dockPanel; - m_dockState = dockState; - Visible = false; - - SuspendLayout(); - - if (DockState == DockState.DockLeft || DockState == DockState.DockRight || - DockState == DockState.DockTop || DockState == DockState.DockBottom) - { - m_splitter = new SplitterControl(); - Controls.Add(m_splitter); - } - - if (DockState == DockState.DockLeft) - { - Dock = DockStyle.Left; - m_splitter.Dock = DockStyle.Right; - } - else if (DockState == DockState.DockRight) - { - Dock = DockStyle.Right; - m_splitter.Dock = DockStyle.Left; - } - else if (DockState == DockState.DockTop) - { - Dock = DockStyle.Top; - m_splitter.Dock = DockStyle.Bottom; - } - else if (DockState == DockState.DockBottom) - { - Dock = DockStyle.Bottom; - m_splitter.Dock = DockStyle.Top; - } - else if (DockState == DockState.Document) - { - Dock = DockStyle.Fill; - } - - ResumeLayout(); - } - - public VisibleNestedPaneCollection VisibleNestedPanes - { - get { return NestedPanes.VisibleNestedPanes; } - } - - public NestedPaneCollection NestedPanes - { - get { return m_nestedPanes; } - } - - public DockPanel DockPanel - { - get { return m_dockPanel; } - } - - public DockState DockState - { - get { return m_dockState; } - } - - public bool IsFloat - { - get { return DockState == DockState.Float; } - } - - internal DockPane DefaultPane - { - get { return VisibleNestedPanes.Count == 0 ? null : VisibleNestedPanes[0]; } - } - - public virtual Rectangle DisplayingRectangle - { - get - { - Rectangle rect = ClientRectangle; - // if DockWindow is document, exclude the border - if (DockState == DockState.Document) - { - rect.X += 1; - rect.Y += 1; - rect.Width -= 2; - rect.Height -= 2; - } - // exclude the splitter - else if (DockState == DockState.DockLeft) - rect.Width -= Measures.SplitterSize; - else if (DockState == DockState.DockRight) - { - rect.X += Measures.SplitterSize; - rect.Width -= Measures.SplitterSize; - } - else if (DockState == DockState.DockTop) - rect.Height -= Measures.SplitterSize; - else if (DockState == DockState.DockBottom) - { - rect.Y += Measures.SplitterSize; - rect.Height -= Measures.SplitterSize; - } - - return rect; - } - } - - protected override void OnPaint(PaintEventArgs e) - { - // if DockWindow is document, draw the border - if (DockState == DockState.Document) - e.Graphics.DrawRectangle(SystemPens.ControlDark, ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1); - - base.OnPaint(e); - } - - protected override void OnLayout(LayoutEventArgs levent) - { - VisibleNestedPanes.Refresh(); - if (VisibleNestedPanes.Count == 0) - { - if (Visible) - Visible = false; - } - else if (!Visible) - { - Visible = true; - VisibleNestedPanes.Refresh(); - } - - base.OnLayout (levent); - } - - #region ISplitterDragSource Members - - void ISplitterDragSource.BeginDrag(Rectangle rectSplitter) - { - } - - void ISplitterDragSource.EndDrag() - { - } - - bool ISplitterDragSource.IsVertical - { - get { return (DockState == DockState.DockLeft || DockState == DockState.DockRight); } - } - - Rectangle ISplitterDragSource.DragLimitBounds - { - get - { - Rectangle rectLimit = DockPanel.DockArea; - Point location; - if ((Control.ModifierKeys & Keys.Shift) == 0) - location = Location; - else - location = DockPanel.DockArea.Location; - - if (((ISplitterDragSource)this).IsVertical) - { - rectLimit.X += MeasurePane.MinSize; - rectLimit.Width -= 2 * MeasurePane.MinSize; - rectLimit.Y = location.Y; - if ((Control.ModifierKeys & Keys.Shift) == 0) - rectLimit.Height = Height; - } - else - { - rectLimit.Y += MeasurePane.MinSize; - rectLimit.Height -= 2 * MeasurePane.MinSize; - rectLimit.X = location.X; - if ((Control.ModifierKeys & Keys.Shift) == 0) - rectLimit.Width = Width; - } - - return DockPanel.RectangleToScreen(rectLimit); - } - } - - void ISplitterDragSource.MoveSplitter(int offset) - { - if ((Control.ModifierKeys & Keys.Shift) != 0) - SendToBack(); - - Rectangle rectDockArea = DockPanel.DockArea; - if (DockState == DockState.DockLeft && rectDockArea.Width > 0) - { - if (DockPanel.DockLeftPortion > 1) - DockPanel.DockLeftPortion = Width + offset; - else - DockPanel.DockLeftPortion += ((double)offset) / (double)rectDockArea.Width; - } - else if (DockState == DockState.DockRight && rectDockArea.Width > 0) - { - if (DockPanel.DockRightPortion > 1) - DockPanel.DockRightPortion = Width - offset; - else - DockPanel.DockRightPortion -= ((double)offset) / (double)rectDockArea.Width; - } - else if (DockState == DockState.DockBottom && rectDockArea.Height > 0) - { - if (DockPanel.DockBottomPortion > 1) - DockPanel.DockBottomPortion = Height - offset; - else - DockPanel.DockBottomPortion -= ((double)offset) / (double)rectDockArea.Height; - } - else if (DockState == DockState.DockTop && rectDockArea.Height > 0) - { - if (DockPanel.DockTopPortion > 1) - DockPanel.DockTopPortion = Height + offset; - else - DockPanel.DockTopPortion += ((double)offset) / (double)rectDockArea.Height; - } - } - - #region IDragSource Members - - Control IDragSource.DragControl - { - get { return this; } - } - - #endregion - #endregion - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockWindowCollection.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockWindowCollection.cs deleted file mode 100644 index 3e0b1c1e2..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockWindowCollection.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public class DockWindowCollection : ReadOnlyCollection - { - internal DockWindowCollection(DockPanel dockPanel) - : base(new List()) - { - Items.Add(new DockWindow(dockPanel, DockState.Document)); - Items.Add(new DockWindow(dockPanel, DockState.DockLeft)); - Items.Add(new DockWindow(dockPanel, DockState.DockRight)); - Items.Add(new DockWindow(dockPanel, DockState.DockTop)); - Items.Add(new DockWindow(dockPanel, DockState.DockBottom)); - } - - public DockWindow this [DockState dockState] - { - get - { - if (dockState == DockState.Document) - return Items[0]; - else if (dockState == DockState.DockLeft || dockState == DockState.DockLeftAutoHide) - return Items[1]; - else if (dockState == DockState.DockRight || dockState == DockState.DockRightAutoHide) - return Items[2]; - else if (dockState == DockState.DockTop || dockState == DockState.DockTopAutoHide) - return Items[3]; - else if (dockState == DockState.DockBottom || dockState == DockState.DockBottomAutoHide) - return Items[4]; - - throw (new ArgumentOutOfRangeException()); - } - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DragForm.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DragForm.cs deleted file mode 100644 index c40a9aa7f..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DragForm.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - // Inspired by Chris Sano's article: - // http://msdn.microsoft.com/smartclient/default.aspx?pull=/library/en-us/dnwinforms/html/colorpicker.asp - // In Sano's article, the DragForm needs to meet the following criteria: - // (1) it was not to show up in the task bar; - // ShowInTaskBar = false - // (2) it needed to be the top-most window; - // TopMost = true - // (3) its icon could not show up in the ALT+TAB window if the user pressed ALT+TAB during a drag-and-drop; - // FormBorderStyle = FormBorderStyle.None; - // Create with WS_EX_TOOLWINDOW window style. - // Compares with the solution in the artile by setting FormBorderStyle as FixedToolWindow, - // and then clip the window caption and border, this way is much simplier. - // (4) it was not to steal focus from the application when displayed. - // User Win32 ShowWindow API with SW_SHOWNOACTIVATE - // In addition, this form should only for display and therefore should act as transparent, otherwise - // WindowFromPoint will return this form, instead of the control beneath. Need BOTH of the following to - // achieve this (don't know why, spent hours to try it out :( ): - // 1. Enabled = false; - // 2. WM_NCHITTEST returns HTTRANSPARENT - internal class DragForm : Form - { - public DragForm() - { - FormBorderStyle = FormBorderStyle.None; - ShowInTaskbar = false; - SetStyle(ControlStyles.Selectable, false); - Enabled = false; - TopMost = true; - } - - protected override CreateParams CreateParams - { - get - { - CreateParams createParams = base.CreateParams; - createParams.ExStyle |= (int)(Win32.WindowExStyles.WS_EX_NOACTIVATE | Win32.WindowExStyles.WS_EX_TOOLWINDOW); - return createParams; - } - } - - protected override void WndProc(ref Message m) - { - if (m.Msg == (int)Win32.Msgs.WM_NCHITTEST) - { - m.Result = (IntPtr)Win32.HitTest.HTTRANSPARENT; - return; - } - - base.WndProc(ref m); - } - //The form can be still activated by explicity calling Activate - protected override bool ShowWithoutActivation - { - get { return true; } - } - public virtual void Show(bool bActivate) - { - Show(); - - if (bActivate) - Activate(); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DummyControl.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DummyControl.cs deleted file mode 100644 index 6c04ecd0b..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DummyControl.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal class DummyControl : Control - { - public DummyControl() - { - SetStyle(ControlStyles.Selectable, false); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Enums.cs b/renderdocui/3rdparty/WinFormsUI/Docking/Enums.cs deleted file mode 100644 index 36b076b22..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Enums.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - [Flags] - [Serializable] - [Editor(typeof(DockAreasEditor), typeof(System.Drawing.Design.UITypeEditor))] - public enum DockAreas - { - Float = 1, - DockLeft = 2, - DockRight = 4, - DockTop = 8, - DockBottom = 16, - Document = 32 - } - - public enum DockState - { - Unknown = 0, - Float = 1, - DockTopAutoHide = 2, - DockLeftAutoHide = 3, - DockBottomAutoHide = 4, - DockRightAutoHide = 5, - Document = 6, - DockTop = 7, - DockLeft = 8, - DockBottom = 9, - DockRight = 10, - Hidden = 11 - } - - public enum DockAlignment - { - Left, - Right, - Top, - Bottom - } - - public enum DocumentStyle - { - DockingMdi, - DockingWindow, - DockingSdi, - SystemMdi, - } - - /// - /// The location to draw the DockPaneStrip for Document style windows. - /// - public enum DocumentTabStripLocation - { - Top, - Bottom - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/FloatWindow.cs b/renderdocui/3rdparty/WinFormsUI/Docking/FloatWindow.cs deleted file mode 100644 index c03271009..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/FloatWindow.cs +++ /dev/null @@ -1,482 +0,0 @@ -using System; -using System.Collections; -using System.Drawing; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.Security.Permissions; -using System.Diagnostics.CodeAnalysis; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public class FloatWindow : Form, INestedPanesContainer, IDockDragSource - { - private NestedPaneCollection m_nestedPanes; - internal const int WM_CHECKDISPOSE = (int)(Win32.Msgs.WM_USER + 1); - - internal protected FloatWindow(DockPanel dockPanel, DockPane pane) - { - InternalConstruct(dockPanel, pane, false, Rectangle.Empty); - } - - internal protected FloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds) - { - InternalConstruct(dockPanel, pane, true, bounds); - } - - private void InternalConstruct(DockPanel dockPanel, DockPane pane, bool boundsSpecified, Rectangle bounds) - { - if (dockPanel == null) - throw(new ArgumentNullException(Strings.FloatWindow_Constructor_NullDockPanel)); - - m_nestedPanes = new NestedPaneCollection(this); - - FormBorderStyle = FormBorderStyle.SizableToolWindow; - ShowInTaskbar = false; - if (dockPanel.RightToLeft != RightToLeft) - RightToLeft = dockPanel.RightToLeft; - if (RightToLeftLayout != dockPanel.RightToLeftLayout) - RightToLeftLayout = dockPanel.RightToLeftLayout; - - SuspendLayout(); - if (boundsSpecified) - { - Bounds = bounds; - StartPosition = FormStartPosition.Manual; - } - else - { - StartPosition = FormStartPosition.WindowsDefaultLocation; - Size = dockPanel.DefaultFloatWindowSize; - } - - m_dockPanel = dockPanel; - Owner = DockPanel.FindForm(); - DockPanel.AddFloatWindow(this); - if (pane != null) - pane.FloatWindow = this; - - ResumeLayout(); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - if (DockPanel != null) - DockPanel.RemoveFloatWindow(this); - m_dockPanel = null; - } - base.Dispose(disposing); - } - - private bool m_allowEndUserDocking = true; - public bool AllowEndUserDocking - { - get { return m_allowEndUserDocking; } - set { m_allowEndUserDocking = value; } - } - - private bool m_doubleClickTitleBarToDock = false; - public bool DoubleClickTitleBarToDock - { - get { return m_doubleClickTitleBarToDock; } - set { m_doubleClickTitleBarToDock = value; } - } - - public NestedPaneCollection NestedPanes - { - get { return m_nestedPanes; } - } - - public VisibleNestedPaneCollection VisibleNestedPanes - { - get { return NestedPanes.VisibleNestedPanes; } - } - - private DockPanel m_dockPanel; - public DockPanel DockPanel - { - get { return m_dockPanel; } - } - - public DockState DockState - { - get { return DockState.Float; } - } - - public bool IsFloat - { - get { return DockState == DockState.Float; } - } - - internal bool IsDockStateValid(DockState dockState) - { - foreach (DockPane pane in NestedPanes) - foreach (IDockContent content in pane.Contents) - if (!DockHelper.IsDockStateValid(dockState, content.DockHandler.DockAreas)) - return false; - - return true; - } - - protected override void OnActivated(EventArgs e) - { - DockPanel.FloatWindows.BringWindowToFront(this); - base.OnActivated (e); - // Propagate the Activated event to the visible panes content objects - foreach (DockPane pane in VisibleNestedPanes) - foreach (IDockContent content in pane.Contents) - content.OnActivated(e); - } - - protected override void OnDeactivate(EventArgs e) - { - base.OnDeactivate(e); - // Propagate the Deactivate event to the visible panes content objects - foreach (DockPane pane in VisibleNestedPanes) - foreach (IDockContent content in pane.Contents) - content.OnDeactivate(e); - } - - protected override void OnLayout(LayoutEventArgs levent) - { - VisibleNestedPanes.Refresh(); - RefreshChanges(); - Visible = (VisibleNestedPanes.Count > 0); - SetText(); - - base.OnLayout(levent); - } - - - [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.Windows.Forms.Control.set_Text(System.String)")] - internal void SetText() - { - DockPane theOnlyPane = (VisibleNestedPanes.Count == 1) ? VisibleNestedPanes[0] : null; - - if (theOnlyPane == null || theOnlyPane.ActiveContent == null) - { - Text = " "; // use " " instead of string.Empty because the whole title bar will disappear when ControlBox is set to false. - Icon = null; - } - else - { - Text = theOnlyPane.ActiveContent.DockHandler.TabText; - Icon = theOnlyPane.ActiveContent.DockHandler.Icon; - } - } - - protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) - { - Rectangle rectWorkArea = SystemInformation.VirtualScreen; - - if (y + height > rectWorkArea.Bottom) - y -= (y + height) - rectWorkArea.Bottom; - - if (y < rectWorkArea.Top) - y += rectWorkArea.Top - y; - - base.SetBoundsCore (x, y, width, height, specified); - } - - [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] - protected override void WndProc(ref Message m) - { - switch (m.Msg) - { - case (int)Win32.Msgs.WM_NCLBUTTONDOWN: - { - if (IsDisposed) - return; - - uint result = Win32Helper.IsRunningOnMono ? 0 : NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam); - if (result == 2 && DockPanel.AllowEndUserDocking && this.AllowEndUserDocking) // HITTEST_CAPTION - { - Activate(); - m_dockPanel.BeginDrag(this); - } - else - base.WndProc(ref m); - - return; - } - case (int)Win32.Msgs.WM_NCRBUTTONDOWN: - { - uint result = Win32Helper.IsRunningOnMono ? 0 : NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam); - if (result == 2) // HITTEST_CAPTION - { - DockPane theOnlyPane = (VisibleNestedPanes.Count == 1) ? VisibleNestedPanes[0] : null; - if (theOnlyPane != null && theOnlyPane.ActiveContent != null) - { - theOnlyPane.ShowTabPageContextMenu(this, PointToClient(Control.MousePosition)); - return; - } - } - - base.WndProc(ref m); - return; - } - case (int)Win32.Msgs.WM_CLOSE: - if (NestedPanes.Count == 0) - { - base.WndProc(ref m); - return; - } - for (int i = NestedPanes.Count - 1; i >= 0; i--) - { - DockContentCollection contents = NestedPanes[i].Contents; - for (int j = contents.Count - 1; j >= 0; j--) - { - IDockContent content = contents[j]; - if (content.DockHandler.DockState != DockState.Float) - continue; - - if (!content.DockHandler.CloseButton) - continue; - - if (content.DockHandler.HideOnClose) - content.DockHandler.Hide(); - else - content.DockHandler.Close(); - } - } - return; - case (int)Win32.Msgs.WM_NCLBUTTONDBLCLK: - { - uint result = !DoubleClickTitleBarToDock || Win32Helper.IsRunningOnMono - ? 0 - : NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam); - - if (result != 2) // HITTEST_CAPTION - { - base.WndProc(ref m); - return; - } - - DockPanel.SuspendLayout(true); - - // Restore to panel - foreach (DockPane pane in NestedPanes) - { - if (pane.DockState != DockState.Float) - continue; - pane.RestoreToPanel(); - } - - - DockPanel.ResumeLayout(true, true); - return; - } - case WM_CHECKDISPOSE: - if (NestedPanes.Count == 0) - Dispose(); - return; - } - - base.WndProc(ref m); - } - - internal void RefreshChanges() - { - if (IsDisposed) - return; - - if (VisibleNestedPanes.Count == 0) - { - ControlBox = true; - return; - } - - for (int i=VisibleNestedPanes.Count - 1; i>=0; i--) - { - DockContentCollection contents = VisibleNestedPanes[i].Contents; - for (int j=contents.Count - 1; j>=0; j--) - { - IDockContent content = contents[j]; - if (content.DockHandler.DockState != DockState.Float) - continue; - - if (content.DockHandler.CloseButton && content.DockHandler.CloseButtonVisible) - { - ControlBox = true; - return; - } - } - } - //Only if there is a ControlBox do we turn it off - //old code caused a flash of the window. - if (ControlBox) - ControlBox = false; - } - - public virtual Rectangle DisplayingRectangle - { - get { return ClientRectangle; } - } - - internal void TestDrop(IDockDragSource dragSource, DockOutlineBase dockOutline) - { - if (VisibleNestedPanes.Count == 1) - { - DockPane pane = VisibleNestedPanes[0]; - if (!dragSource.CanDockTo(pane)) - return; - - Point ptMouse = Control.MousePosition; - uint lParam = Win32Helper.MakeLong(ptMouse.X, ptMouse.Y); - if (!Win32Helper.IsRunningOnMono) - { - if (NativeMethods.SendMessage(Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, lParam) == (uint)Win32.HitTest.HTCAPTION) - { - dockOutline.Show(VisibleNestedPanes[0], -1); - } - } - } - } - - #region IDockDragSource Members - - #region IDragSource Members - - Control IDragSource.DragControl - { - get { return this; } - } - - #endregion - - bool IDockDragSource.IsDockStateValid(DockState dockState) - { - return IsDockStateValid(dockState); - } - - bool IDockDragSource.CanDockTo(DockPane pane) - { - if (!IsDockStateValid(pane.DockState)) - return false; - - if (pane.FloatWindow == this) - return false; - - return true; - } - - private int m_preDragExStyle; - - Rectangle IDockDragSource.BeginDrag(Point ptMouse) - { - m_preDragExStyle = NativeMethods.GetWindowLong(this.Handle, (int)Win32.GetWindowLongIndex.GWL_EXSTYLE); - NativeMethods.SetWindowLong(this.Handle, - (int)Win32.GetWindowLongIndex.GWL_EXSTYLE, - m_preDragExStyle | (int)(Win32.WindowExStyles.WS_EX_TRANSPARENT | Win32.WindowExStyles.WS_EX_LAYERED) ); - return Bounds; - } - - void IDockDragSource.EndDrag() - { - NativeMethods.SetWindowLong(this.Handle, (int)Win32.GetWindowLongIndex.GWL_EXSTYLE, m_preDragExStyle); - - Invalidate(true); - NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCPAINT, 1, 0); - } - - public void FloatAt(Rectangle floatWindowBounds) - { - Bounds = floatWindowBounds; - } - - public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex) - { - if (dockStyle == DockStyle.Fill) - { - for (int i = NestedPanes.Count - 1; i >= 0; i--) - { - DockPane paneFrom = NestedPanes[i]; - for (int j = paneFrom.Contents.Count - 1; j >= 0; j--) - { - IDockContent c = paneFrom.Contents[j]; - c.DockHandler.Pane = pane; - if (contentIndex != -1) - pane.SetContentIndex(c, contentIndex); - c.DockHandler.Activate(); - } - } - } - else - { - DockAlignment alignment = DockAlignment.Left; - if (dockStyle == DockStyle.Left) - alignment = DockAlignment.Left; - else if (dockStyle == DockStyle.Right) - alignment = DockAlignment.Right; - else if (dockStyle == DockStyle.Top) - alignment = DockAlignment.Top; - else if (dockStyle == DockStyle.Bottom) - alignment = DockAlignment.Bottom; - - MergeNestedPanes(VisibleNestedPanes, pane.NestedPanesContainer.NestedPanes, pane, alignment, 0.5); - } - } - - public void DockTo(DockPanel panel, DockStyle dockStyle) - { - if (panel != DockPanel) - throw new ArgumentException(Strings.IDockDragSource_DockTo_InvalidPanel, "panel"); - - NestedPaneCollection nestedPanesTo = null; - - if (dockStyle == DockStyle.Top) - nestedPanesTo = DockPanel.DockWindows[DockState.DockTop].NestedPanes; - else if (dockStyle == DockStyle.Bottom) - nestedPanesTo = DockPanel.DockWindows[DockState.DockBottom].NestedPanes; - else if (dockStyle == DockStyle.Left) - nestedPanesTo = DockPanel.DockWindows[DockState.DockLeft].NestedPanes; - else if (dockStyle == DockStyle.Right) - nestedPanesTo = DockPanel.DockWindows[DockState.DockRight].NestedPanes; - else if (dockStyle == DockStyle.Fill) - nestedPanesTo = DockPanel.DockWindows[DockState.Document].NestedPanes; - - DockPane prevPane = null; - for (int i = nestedPanesTo.Count - 1; i >= 0; i--) - if (nestedPanesTo[i] != VisibleNestedPanes[0]) - prevPane = nestedPanesTo[i]; - MergeNestedPanes(VisibleNestedPanes, nestedPanesTo, prevPane, DockAlignment.Left, 0.5); - } - - private static void MergeNestedPanes(VisibleNestedPaneCollection nestedPanesFrom, NestedPaneCollection nestedPanesTo, DockPane prevPane, DockAlignment alignment, double proportion) - { - if (nestedPanesFrom.Count == 0) - return; - - int count = nestedPanesFrom.Count; - DockPane[] panes = new DockPane[count]; - DockPane[] prevPanes = new DockPane[count]; - DockAlignment[] alignments = new DockAlignment[count]; - double[] proportions = new double[count]; - - for (int i = 0; i < count; i++) - { - panes[i] = nestedPanesFrom[i]; - prevPanes[i] = nestedPanesFrom[i].NestedDockingStatus.PreviousPane; - alignments[i] = nestedPanesFrom[i].NestedDockingStatus.Alignment; - proportions[i] = nestedPanesFrom[i].NestedDockingStatus.Proportion; - } - - DockPane pane = panes[0].DockTo(nestedPanesTo.Container, prevPane, alignment, proportion); - panes[0].DockState = nestedPanesTo.DockState; - - for (int i = 1; i < count; i++) - { - for (int j = i; j < count; j++) - { - if (prevPanes[j] == panes[i - 1]) - prevPanes[j] = pane; - } - pane = panes[i].DockTo(nestedPanesTo.Container, prevPanes[i], alignments[i], proportions[i]); - panes[i].DockState = nestedPanesTo.DockState; - } - } - - #endregion - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/FloatWindowCollection.cs b/renderdocui/3rdparty/WinFormsUI/Docking/FloatWindowCollection.cs deleted file mode 100644 index e0fd0b68c..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/FloatWindowCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Drawing; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public class FloatWindowCollection : ReadOnlyCollection - { - internal FloatWindowCollection() - : base(new List()) - { - } - - internal int Add(FloatWindow fw) - { - if (Items.Contains(fw)) - return Items.IndexOf(fw); - - Items.Add(fw); - return Count - 1; - } - - internal void Dispose() - { - for (int i=Count - 1; i>=0; i--) - this[i].Close(); - } - - internal void Remove(FloatWindow fw) - { - Items.Remove(fw); - } - - internal void BringWindowToFront(FloatWindow fw) - { - Items.Remove(fw); - Items.Add(fw); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Helpers/DockHelper.cs b/renderdocui/3rdparty/WinFormsUI/Docking/Helpers/DockHelper.cs deleted file mode 100644 index d5b59d8a3..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Helpers/DockHelper.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal static class DockHelper - { - public static bool IsDockStateAutoHide(DockState dockState) - { - if (dockState == DockState.DockLeftAutoHide || - dockState == DockState.DockRightAutoHide || - dockState == DockState.DockTopAutoHide || - dockState == DockState.DockBottomAutoHide) - return true; - else - return false; - } - - public static bool IsDockStateValid(DockState dockState, DockAreas dockableAreas) - { - if (((dockableAreas & DockAreas.Float) == 0) && - (dockState == DockState.Float)) - return false; - else if (((dockableAreas & DockAreas.Document) == 0) && - (dockState == DockState.Document)) - return false; - else if (((dockableAreas & DockAreas.DockLeft) == 0) && - (dockState == DockState.DockLeft || dockState == DockState.DockLeftAutoHide)) - return false; - else if (((dockableAreas & DockAreas.DockRight) == 0) && - (dockState == DockState.DockRight || dockState == DockState.DockRightAutoHide)) - return false; - else if (((dockableAreas & DockAreas.DockTop) == 0) && - (dockState == DockState.DockTop || dockState == DockState.DockTopAutoHide)) - return false; - else if (((dockableAreas & DockAreas.DockBottom) == 0) && - (dockState == DockState.DockBottom || dockState == DockState.DockBottomAutoHide)) - return false; - else - return true; - } - - public static bool IsDockWindowState(DockState state) - { - if (state == DockState.DockTop || state == DockState.DockBottom || state == DockState.DockLeft || - state == DockState.DockRight || state == DockState.Document) - return true; - else - return false; - } - - public static DockState ToggleAutoHideState(DockState state) - { - if (state == DockState.DockLeft) - return DockState.DockLeftAutoHide; - else if (state == DockState.DockRight) - return DockState.DockRightAutoHide; - else if (state == DockState.DockTop) - return DockState.DockTopAutoHide; - else if (state == DockState.DockBottom) - return DockState.DockBottomAutoHide; - else if (state == DockState.DockLeftAutoHide) - return DockState.DockLeft; - else if (state == DockState.DockRightAutoHide) - return DockState.DockRight; - else if (state == DockState.DockTopAutoHide) - return DockState.DockTop; - else if (state == DockState.DockBottomAutoHide) - return DockState.DockBottom; - else - return state; - } - - public static DockPane PaneAtPoint(Point pt, DockPanel dockPanel) - { - if (!Win32Helper.IsRunningOnMono) - for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent) - { - IDockContent content = control as IDockContent; - if (content != null && content.DockHandler.DockPanel == dockPanel) - return content.DockHandler.Pane; - - DockPane pane = control as DockPane; - if (pane != null && pane.DockPanel == dockPanel) - return pane; - } - - return null; - } - - public static FloatWindow FloatWindowAtPoint(Point pt, DockPanel dockPanel) - { - if (!Win32Helper.IsRunningOnMono) - for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent) - { - FloatWindow floatWindow = control as FloatWindow; - if (floatWindow != null && floatWindow.DockPanel == dockPanel) - return floatWindow; - } - - return null; - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Helpers/DrawHelper.cs b/renderdocui/3rdparty/WinFormsUI/Docking/Helpers/DrawHelper.cs deleted file mode 100644 index d92fbbdc7..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Helpers/DrawHelper.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Drawing.Imaging; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal static class DrawHelper - { - public static Point RtlTransform(Control control, Point point) - { - if (control.RightToLeft != RightToLeft.Yes) - return point; - else - return new Point(control.Right - point.X, point.Y); - } - - public static Rectangle RtlTransform(Control control, Rectangle rectangle) - { - if (control.RightToLeft != RightToLeft.Yes) - return rectangle; - else - return new Rectangle(control.ClientRectangle.Right - rectangle.Right, rectangle.Y, rectangle.Width, rectangle.Height); - } - - public static GraphicsPath GetRoundedCornerTab(GraphicsPath graphicsPath, Rectangle rect, bool upCorner) - { - if (graphicsPath == null) - graphicsPath = new GraphicsPath(); - else - graphicsPath.Reset(); - - int curveSize = 6; - if (upCorner) - { - graphicsPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top + curveSize / 2); - graphicsPath.AddArc(new Rectangle(rect.Left, rect.Top, curveSize, curveSize), 180, 90); - graphicsPath.AddLine(rect.Left + curveSize / 2, rect.Top, rect.Right - curveSize / 2, rect.Top); - graphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Top, curveSize, curveSize), -90, 90); - graphicsPath.AddLine(rect.Right, rect.Top + curveSize / 2, rect.Right, rect.Bottom); - } - else - { - graphicsPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom - curveSize / 2); - graphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Bottom - curveSize, curveSize, curveSize), 0, 90); - graphicsPath.AddLine(rect.Right - curveSize / 2, rect.Bottom, rect.Left + curveSize / 2, rect.Bottom); - graphicsPath.AddArc(new Rectangle(rect.Left, rect.Bottom - curveSize, curveSize, curveSize), 90, 90); - graphicsPath.AddLine(rect.Left, rect.Bottom - curveSize / 2, rect.Left, rect.Top); - } - - return graphicsPath; - } - - public static GraphicsPath CalculateGraphicsPathFromBitmap(Bitmap bitmap) - { - return CalculateGraphicsPathFromBitmap(bitmap, Color.Empty); - } - - // From http://edu.cnzz.cn/show_3281.html - public static GraphicsPath CalculateGraphicsPathFromBitmap(Bitmap bitmap, Color colorTransparent) - { - GraphicsPath graphicsPath = new GraphicsPath(); - if (colorTransparent == Color.Empty) - colorTransparent = bitmap.GetPixel(0, 0); - - for(int row = 0; row < bitmap.Height; row ++) - { - int colOpaquePixel = 0; - for(int col = 0; col < bitmap.Width; col ++) - { - if(bitmap.GetPixel(col, row) != colorTransparent) - { - colOpaquePixel = col; - int colNext = col; - for(colNext = colOpaquePixel; colNext < bitmap.Width; colNext ++) - if(bitmap.GetPixel(colNext, row) == colorTransparent) - break; - - graphicsPath.AddRectangle(new Rectangle(colOpaquePixel, row, colNext - colOpaquePixel, 1)); - col = colNext; - } - } - } - return graphicsPath; - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Helpers/ResourceHelper.cs b/renderdocui/3rdparty/WinFormsUI/Docking/Helpers/ResourceHelper.cs deleted file mode 100644 index 5620908af..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Helpers/ResourceHelper.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Drawing; -using System.Reflection; -using System.Resources; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal static class ResourceHelper - { - private static ResourceManager _resourceManager = null; - - private static ResourceManager ResourceManager - { - get - { - if (_resourceManager == null) - _resourceManager = new ResourceManager("WeifenLuo.WinFormsUI.Docking.Strings", typeof(ResourceHelper).Assembly); - return _resourceManager; - } - - } - - public static string GetString(string name) - { - return ResourceManager.GetString(name); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Helpers/Win32Helper.cs b/renderdocui/3rdparty/WinFormsUI/Docking/Helpers/Win32Helper.cs deleted file mode 100644 index a5d467c1c..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Helpers/Win32Helper.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public static class Win32Helper - { - private static readonly bool _isRunningOnMono = Type.GetType("Mono.Runtime") != null; - - public static bool IsRunningOnMono { get { return _isRunningOnMono; } } - - internal static Control ControlAtPoint(Point pt) - { - return Control.FromChildHandle(NativeMethods.WindowFromPoint(pt)); - } - - internal static uint MakeLong(int low, int high) - { - return (uint)((high << 16) + low); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/InertButtonBase.cs b/renderdocui/3rdparty/WinFormsUI/Docking/InertButtonBase.cs deleted file mode 100644 index 92d5731d7..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/InertButtonBase.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Drawing; -using System.Drawing.Imaging; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal abstract class InertButtonBase : Control - { - protected InertButtonBase() - { - SetStyle(ControlStyles.SupportsTransparentBackColor, true); - BackColor = Color.Transparent; - } - - public abstract Bitmap Image - { - get; - } - - private bool m_isMouseOver = false; - protected bool IsMouseOver - { - get { return m_isMouseOver; } - private set - { - if (m_isMouseOver == value) - return; - - m_isMouseOver = value; - Invalidate(); - } - } - - protected override Size DefaultSize - { - get { return Resources.DockPane_Close.Size; } - } - - protected override void OnMouseMove(MouseEventArgs e) - { - base.OnMouseMove(e); - bool over = ClientRectangle.Contains(e.X, e.Y); - if (IsMouseOver != over) - IsMouseOver = over; - } - - protected override void OnMouseEnter(EventArgs e) - { - base.OnMouseEnter(e); - if (!IsMouseOver) - IsMouseOver = true; - } - - protected override void OnMouseLeave(EventArgs e) - { - base.OnMouseLeave(e); - if (IsMouseOver) - IsMouseOver = false; - } - - protected override void OnPaint(PaintEventArgs e) - { - if (IsMouseOver && Enabled) - { - using (Pen pen = new Pen(ForeColor)) - { - e.Graphics.DrawRectangle(pen, Rectangle.Inflate(ClientRectangle, -1, -1)); - } - } - - using (ImageAttributes imageAttributes = new ImageAttributes()) - { - ColorMap[] colorMap = new ColorMap[2]; - colorMap[0] = new ColorMap(); - colorMap[0].OldColor = Color.FromArgb(0, 0, 0); - colorMap[0].NewColor = ForeColor; - colorMap[1] = new ColorMap(); - colorMap[1].OldColor = Image.GetPixel(0, 0); - colorMap[1].NewColor = Color.Transparent; - - imageAttributes.SetRemapTable(colorMap); - - e.Graphics.DrawImage( - Image, - new Rectangle(0, 0, Image.Width, Image.Height), - 0, 0, - Image.Width, - Image.Height, - GraphicsUnit.Pixel, - imageAttributes); - } - - base.OnPaint(e); - } - - public void RefreshChanges() - { - if (IsDisposed) - return; - - bool mouseOver = ClientRectangle.Contains(PointToClient(Control.MousePosition)); - if (mouseOver != IsMouseOver) - IsMouseOver = mouseOver; - - OnRefreshChanges(); - } - - protected virtual void OnRefreshChanges() - { - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Interfaces.cs b/renderdocui/3rdparty/WinFormsUI/Docking/Interfaces.cs deleted file mode 100644 index 91bdc0b85..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Interfaces.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public interface IDockContent - { - DockContentHandler DockHandler { get; } - void OnActivated(EventArgs e); - void OnDeactivate(EventArgs e); - } - - public interface INestedPanesContainer - { - DockState DockState { get; } - Rectangle DisplayingRectangle { get; } - NestedPaneCollection NestedPanes { get; } - VisibleNestedPaneCollection VisibleNestedPanes { get; } - bool IsFloat { get; } - } - - internal interface IDragSource - { - Control DragControl { get; } - } - - internal interface IDockDragSource : IDragSource - { - Rectangle BeginDrag(Point ptMouse); - void EndDrag(); - bool IsDockStateValid(DockState dockState); - bool CanDockTo(DockPane pane); - void FloatAt(Rectangle floatWindowBounds); - void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex); - void DockTo(DockPanel panel, DockStyle dockStyle); - } - - internal interface ISplitterDragSource : IDragSource - { - void BeginDrag(Rectangle rectSplitter); - void EndDrag(); - bool IsVertical { get; } - Rectangle DragLimitBounds { get; } - void MoveSplitter(int offset); - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Localization.cs b/renderdocui/3rdparty/WinFormsUI/Docking/Localization.cs deleted file mode 100644 index bfe73db28..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Localization.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.ComponentModel; - -namespace WeifenLuo.WinFormsUI.Docking -{ - [AttributeUsage(AttributeTargets.All)] - internal sealed class LocalizedDescriptionAttribute : DescriptionAttribute - { - private bool m_initialized = false; - - public LocalizedDescriptionAttribute(string key) : base(key) - { - } - - public override string Description - { - get - { - if (!m_initialized) - { - string key = base.Description; - DescriptionValue = ResourceHelper.GetString(key); - if (DescriptionValue == null) - DescriptionValue = String.Empty; - - m_initialized = true; - } - - return DescriptionValue; - } - } - } - - [AttributeUsage(AttributeTargets.All)] - internal sealed class LocalizedCategoryAttribute : CategoryAttribute - { - public LocalizedCategoryAttribute(string key) : base(key) - { - } - - protected override string GetLocalizedString(string key) - { - return ResourceHelper.GetString(key); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Measures.cs b/renderdocui/3rdparty/WinFormsUI/Docking/Measures.cs deleted file mode 100644 index e1afb14d8..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Measures.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal static class Measures - { - public const int SplitterSize = 4; - } - - internal static class MeasurePane - { - public const int MinSize = 24; - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/NestedDockingStatus.cs b/renderdocui/3rdparty/WinFormsUI/Docking/NestedDockingStatus.cs deleted file mode 100644 index 717e194d9..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/NestedDockingStatus.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using System.Drawing; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public sealed class NestedDockingStatus - { - internal NestedDockingStatus(DockPane pane) - { - m_dockPane = pane; - } - - private DockPane m_dockPane = null; - public DockPane DockPane - { - get { return m_dockPane; } - } - - private NestedPaneCollection m_nestedPanes = null; - public NestedPaneCollection NestedPanes - { - get { return m_nestedPanes; } - } - - private DockPane m_previousPane = null; - public DockPane PreviousPane - { - get { return m_previousPane; } - } - - private DockAlignment m_alignment = DockAlignment.Left; - public DockAlignment Alignment - { - get { return m_alignment; } - } - - private double m_proportion = 0.5; - public double Proportion - { - get { return m_proportion; } - } - - private bool m_isDisplaying = false; - public bool IsDisplaying - { - get { return m_isDisplaying; } - } - - private DockPane m_displayingPreviousPane = null; - public DockPane DisplayingPreviousPane - { - get { return m_displayingPreviousPane; } - } - - private DockAlignment m_displayingAlignment = DockAlignment.Left; - public DockAlignment DisplayingAlignment - { - get { return m_displayingAlignment; } - } - - private double m_displayingProportion = 0.5; - public double DisplayingProportion - { - get { return m_displayingProportion; } - } - - private Rectangle m_logicalBounds = Rectangle.Empty; - public Rectangle LogicalBounds - { - get { return m_logicalBounds; } - } - - private Rectangle m_paneBounds = Rectangle.Empty; - public Rectangle PaneBounds - { - get { return m_paneBounds; } - } - - private Rectangle m_splitterBounds = Rectangle.Empty; - public Rectangle SplitterBounds - { - get { return m_splitterBounds; } - } - - internal void SetStatus(NestedPaneCollection nestedPanes, DockPane previousPane, DockAlignment alignment, double proportion) - { - m_nestedPanes = nestedPanes; - m_previousPane = previousPane; - m_alignment = alignment; - m_proportion = proportion; - } - - internal void SetDisplayingStatus(bool isDisplaying, DockPane displayingPreviousPane, DockAlignment displayingAlignment, double displayingProportion) - { - m_isDisplaying = isDisplaying; - m_displayingPreviousPane = displayingPreviousPane; - m_displayingAlignment = displayingAlignment; - m_displayingProportion = displayingProportion; - } - - internal void SetDisplayingBounds(Rectangle logicalBounds, Rectangle paneBounds, Rectangle splitterBounds) - { - m_logicalBounds = logicalBounds; - m_paneBounds = paneBounds; - m_splitterBounds = splitterBounds; - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/NestedPaneCollection.cs b/renderdocui/3rdparty/WinFormsUI/Docking/NestedPaneCollection.cs deleted file mode 100644 index 7e425756a..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/NestedPaneCollection.cs +++ /dev/null @@ -1,171 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Drawing; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public sealed class NestedPaneCollection : ReadOnlyCollection - { - private INestedPanesContainer m_container; - private VisibleNestedPaneCollection m_visibleNestedPanes; - - internal NestedPaneCollection(INestedPanesContainer container) - : base(new List()) - { - m_container = container; - m_visibleNestedPanes = new VisibleNestedPaneCollection(this); - } - - public INestedPanesContainer Container - { - get { return m_container; } - } - - public VisibleNestedPaneCollection VisibleNestedPanes - { - get { return m_visibleNestedPanes; } - } - - public DockState DockState - { - get { return Container.DockState; } - } - - public bool IsFloat - { - get { return DockState == DockState.Float; } - } - - internal void Add(DockPane pane) - { - if (pane == null) - return; - - NestedPaneCollection oldNestedPanes = (pane.NestedPanesContainer == null) ? null : pane.NestedPanesContainer.NestedPanes; - if (oldNestedPanes != null) - oldNestedPanes.InternalRemove(pane); - Items.Add(pane); - if (oldNestedPanes != null) - oldNestedPanes.CheckFloatWindowDispose(); - } - - private void CheckFloatWindowDispose() - { - if (Count != 0 || Container.DockState != DockState.Float) - return; - - FloatWindow floatWindow = (FloatWindow)Container; - if (floatWindow.Disposing || floatWindow.IsDisposed) - return; - - if (Win32Helper.IsRunningOnMono) - return; - - NativeMethods.PostMessage(((FloatWindow)Container).Handle, FloatWindow.WM_CHECKDISPOSE, 0, 0); - } - - /// - /// Switches a pane with its first child in the pane hierarchy. (The actual hiding happens elsewhere.) - /// - /// Pane to switch - internal void SwitchPaneWithFirstChild(DockPane pane) - { - if (!Contains(pane)) - return; - - NestedDockingStatus statusPane = pane.NestedDockingStatus; - DockPane lastNestedPane = null; - for (int i = Count - 1; i > IndexOf(pane); i--) - { - if (this[i].NestedDockingStatus.PreviousPane == pane) - { - lastNestedPane = this[i]; - break; - } - } - - if (lastNestedPane != null) - { - int indexLastNestedPane = IndexOf(lastNestedPane); - Items[IndexOf(pane)] = lastNestedPane; - Items[indexLastNestedPane] = pane; - NestedDockingStatus lastNestedDock = lastNestedPane.NestedDockingStatus; - - DockAlignment newAlignment; - if (lastNestedDock.Alignment == DockAlignment.Left) - newAlignment = DockAlignment.Right; - else if (lastNestedDock.Alignment == DockAlignment.Right) - newAlignment = DockAlignment.Left; - else if (lastNestedDock.Alignment == DockAlignment.Top) - newAlignment = DockAlignment.Bottom; - else - newAlignment = DockAlignment.Top; - double newProportion = 1 - lastNestedDock.Proportion; - - lastNestedDock.SetStatus(this, statusPane.PreviousPane, statusPane.Alignment, statusPane.Proportion); - for (int i = indexLastNestedPane - 1; i > IndexOf(lastNestedPane); i--) - { - NestedDockingStatus status = this[i].NestedDockingStatus; - if (status.PreviousPane == pane) - status.SetStatus(this, lastNestedPane, status.Alignment, status.Proportion); - } - - statusPane.SetStatus(this, lastNestedPane, newAlignment, newProportion); - } - } - - internal void Remove(DockPane pane) - { - InternalRemove(pane); - CheckFloatWindowDispose(); - } - - private void InternalRemove(DockPane pane) - { - if (!Contains(pane)) - return; - - NestedDockingStatus statusPane = pane.NestedDockingStatus; - DockPane lastNestedPane = null; - for (int i=Count - 1; i> IndexOf(pane); i--) - { - if (this[i].NestedDockingStatus.PreviousPane == pane) - { - lastNestedPane = this[i]; - break; - } - } - - if (lastNestedPane != null) - { - int indexLastNestedPane = IndexOf(lastNestedPane); - Items.Remove(lastNestedPane); - Items[IndexOf(pane)] = lastNestedPane; - NestedDockingStatus lastNestedDock = lastNestedPane.NestedDockingStatus; - lastNestedDock.SetStatus(this, statusPane.PreviousPane, statusPane.Alignment, statusPane.Proportion); - for (int i=indexLastNestedPane - 1; i>IndexOf(lastNestedPane); i--) - { - NestedDockingStatus status = this[i].NestedDockingStatus; - if (status.PreviousPane == pane) - status.SetStatus(this, lastNestedPane, status.Alignment, status.Proportion); - } - } - else - Items.Remove(pane); - - statusPane.SetStatus(null, null, DockAlignment.Left, 0.5); - statusPane.SetDisplayingStatus(false, null, DockAlignment.Left, 0.5); - statusPane.SetDisplayingBounds(Rectangle.Empty, Rectangle.Empty, Rectangle.Empty); - } - - public DockPane GetDefaultPreviousPane(DockPane pane) - { - for (int i=Count-1; i>=0; i--) - if (this[i] != pane) - return this[i]; - - return null; - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources.Designer.cs b/renderdocui/3rdparty/WinFormsUI/Docking/Resources.Designer.cs deleted file mode 100644 index 59dc95908..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Resources.Designer.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.4952 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace WeifenLuo.WinFormsUI.Docking { - 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", "2.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("WeifenLuo.WinFormsUI.Docking.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; - } - } - - internal static System.Drawing.Bitmap DockIndicator_PaneDiamond { - get { - object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Bottom { - get { - object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Bottom", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Fill { - get { - object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Fill", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_HotSpot { - get { - object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_HotSpot", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_HotSpotIndex { - get { - object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_HotSpotIndex", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Left { - get { - object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Left", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Right { - get { - object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Right", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Top { - get { - object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Top", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PanelBottom { - get { - object obj = ResourceManager.GetObject("DockIndicator_PanelBottom", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PanelBottom_Active { - get { - object obj = ResourceManager.GetObject("DockIndicator_PanelBottom_Active", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PanelFill { - get { - object obj = ResourceManager.GetObject("DockIndicator_PanelFill", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PanelFill_Active { - get { - object obj = ResourceManager.GetObject("DockIndicator_PanelFill_Active", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PanelLeft { - get { - object obj = ResourceManager.GetObject("DockIndicator_PanelLeft", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PanelLeft_Active { - get { - object obj = ResourceManager.GetObject("DockIndicator_PanelLeft_Active", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PanelRight { - get { - object obj = ResourceManager.GetObject("DockIndicator_PanelRight", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PanelRight_Active { - get { - object obj = ResourceManager.GetObject("DockIndicator_PanelRight_Active", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PanelTop { - get { - object obj = ResourceManager.GetObject("DockIndicator_PanelTop", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockIndicator_PanelTop_Active { - get { - object obj = ResourceManager.GetObject("DockIndicator_PanelTop_Active", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockPane_AutoHide { - get { - object obj = ResourceManager.GetObject("DockPane_AutoHide", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockPane_Close { - get { - object obj = ResourceManager.GetObject("DockPane_Close", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockPane_Dock { - get { - object obj = ResourceManager.GetObject("DockPane_Dock", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockPane_Option { - get { - object obj = ResourceManager.GetObject("DockPane_Option", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap DockPane_OptionOverflow { - get { - object obj = ResourceManager.GetObject("DockPane_OptionOverflow", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources.resx b/renderdocui/3rdparty/WinFormsUI/Docking/Resources.resx deleted file mode 100644 index c92c94f50..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Resources.resx +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - Resources\DockIndicator_PaneDiamond.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PaneDiamond_Bottom.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\Dockindicator_PaneDiamond_Fill.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PaneDiamond_Hotspot.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PaneDiamond_HotspotIndex.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PaneDiamond_Left.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PaneDiamond_Right.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PaneDiamond_Top.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PanelBottom.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PanelBottom_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PanelFill.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PanelFill_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PanelLeft.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PanelLeft_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PanelRight.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PanelRight_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PanelTop.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockIndicator_PanelTop_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockPane_AutoHide.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockPane_Close.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockPane_Dock.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockPane_Option.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\DockPane_OptionOverflow.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond.bmp deleted file mode 100644 index 70e70e288..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Bottom.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Bottom.bmp deleted file mode 100644 index d95ec6972..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Bottom.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Hotspot.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Hotspot.bmp deleted file mode 100644 index e801d382d..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Hotspot.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_HotspotIndex.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_HotspotIndex.bmp deleted file mode 100644 index e5ef472c5..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_HotspotIndex.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Left.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Left.bmp deleted file mode 100644 index 1fbda61c0..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Left.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Right.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Right.bmp deleted file mode 100644 index 1de97a098..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Right.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Top.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Top.bmp deleted file mode 100644 index 95122a0f3..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Top.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelBottom.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelBottom.bmp deleted file mode 100644 index ad851ea18..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelBottom.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelBottom_Active.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelBottom_Active.bmp deleted file mode 100644 index 212fb0d36..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelBottom_Active.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelFill.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelFill.bmp deleted file mode 100644 index 21a1b274d..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelFill.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelFill_Active.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelFill_Active.bmp deleted file mode 100644 index d58b00f9d..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelFill_Active.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelLeft.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelLeft.bmp deleted file mode 100644 index f6cdce04c..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelLeft.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelLeft_Active.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelLeft_Active.bmp deleted file mode 100644 index d6843f844..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelLeft_Active.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelRight.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelRight.bmp deleted file mode 100644 index b5d80a727..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelRight.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelRight_Active.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelRight_Active.bmp deleted file mode 100644 index 9bd4bc04d..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelRight_Active.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelTop.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelTop.bmp deleted file mode 100644 index f6293fd2b..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelTop.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelTop_Active.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelTop_Active.bmp deleted file mode 100644 index 563549eba..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockIndicator_PanelTop_Active.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_AutoHide.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_AutoHide.bmp deleted file mode 100644 index 2f395fc01..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_AutoHide.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_Close.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_Close.bmp deleted file mode 100644 index a7748a672..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_Close.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_Dock.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_Dock.bmp deleted file mode 100644 index 6a9d145e0..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_Dock.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_Option.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_Option.bmp deleted file mode 100644 index 0d9927a7c..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_Option.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_OptionOverflow.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_OptionOverflow.bmp deleted file mode 100644 index 02e4bf290..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/DockPane_OptionOverflow.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/Dockindicator_PaneDiamond_Fill.bmp b/renderdocui/3rdparty/WinFormsUI/Docking/Resources/Dockindicator_PaneDiamond_Fill.bmp deleted file mode 100644 index cbe0a156a..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/Docking/Resources/Dockindicator_PaneDiamond_Fill.bmp and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Skins/DockPanelSkinBuilder.cs b/renderdocui/3rdparty/WinFormsUI/Docking/Skins/DockPanelSkinBuilder.cs deleted file mode 100644 index b9ec11412..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Skins/DockPanelSkinBuilder.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Drawing; -using System.Drawing.Drawing2D; - -namespace WeifenLuo.WinFormsUI.Docking.Skins -{ - internal static class DockPanelSkinBuilder - { - public static DockPanelSkin Create(Style style) - { - switch (style) - { - case Style.VisualStudio2005: - default: - return CreateVisualStudio2005(); - } - } - - private static DockPanelSkin CreateVisualStudio2005() - { - DockPanelSkin skin = new DockPanelSkin(); - - skin.AutoHideStripSkin.DockStripGradient.StartColor = SystemColors.ControlLight; - skin.AutoHideStripSkin.DockStripGradient.EndColor = SystemColors.ControlLight; - skin.AutoHideStripSkin.TabGradient.TextColor = SystemColors.ControlDarkDark; - - skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.StartColor = SystemColors.Control; - skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.EndColor = SystemColors.Control; - skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.StartColor = SystemColors.ControlLightLight; - skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.EndColor = SystemColors.ControlLightLight; - skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.StartColor = SystemColors.ControlLight; - skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.EndColor = SystemColors.ControlLight; - - skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.StartColor = SystemColors.ControlLight; - skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.EndColor = SystemColors.ControlLight; - - skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.StartColor = SystemColors.Control; - skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.EndColor = SystemColors.Control; - - skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.StartColor = Color.Transparent; - skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.EndColor = Color.Transparent; - skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.TextColor = SystemColors.ControlDarkDark; - - skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.StartColor = SystemColors.GradientActiveCaption; - skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor = SystemColors.ActiveCaption; - skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode = LinearGradientMode.Vertical; - skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.TextColor = SystemColors.ActiveCaptionText; - - skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor = SystemColors.GradientInactiveCaption; - skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor = SystemColors.InactiveCaption; - skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.LinearGradientMode = LinearGradientMode.Vertical; - skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.TextColor = SystemColors.InactiveCaptionText; - - return skin; - } - - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Skins/Style.cs b/renderdocui/3rdparty/WinFormsUI/Docking/Skins/Style.cs deleted file mode 100644 index ba75b14fc..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Skins/Style.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace WeifenLuo.WinFormsUI.Docking.Skins -{ - public enum Style - { - VisualStudio2005 = 1 - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/SplitterBase.cs b/renderdocui/3rdparty/WinFormsUI/Docking/SplitterBase.cs deleted file mode 100644 index 78448ea98..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/SplitterBase.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal class SplitterBase : Control - { - public SplitterBase() - { - SetStyle(ControlStyles.Selectable, false); - } - - public override DockStyle Dock - { - get { return base.Dock; } - set - { - SuspendLayout(); - base.Dock = value; - - if (Dock == DockStyle.Left || Dock == DockStyle.Right) - Width = SplitterSize; - else if (Dock == DockStyle.Top || Dock == DockStyle.Bottom) - Height = SplitterSize; - else - Bounds = Rectangle.Empty; - - if (Dock == DockStyle.Left || Dock == DockStyle.Right) - Cursor = Cursors.VSplit; - else if (Dock == DockStyle.Top || Dock == DockStyle.Bottom) - Cursor = Cursors.HSplit; - else - Cursor = Cursors.Default; - - ResumeLayout(); - } - } - - protected virtual int SplitterSize - { - get { return 0; } - } - - protected override void OnMouseDown(MouseEventArgs e) - { - base.OnMouseDown(e); - - if (e.Button != MouseButtons.Left) - return; - - StartDrag(); - } - - protected virtual void StartDrag() - { - } - - protected override void WndProc(ref Message m) - { - // eat the WM_MOUSEACTIVATE message - if (m.Msg == (int)Win32.Msgs.WM_MOUSEACTIVATE) - return; - - base.WndProc(ref m); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Strings.Designer.cs b/renderdocui/3rdparty/WinFormsUI/Docking/Strings.Designer.cs deleted file mode 100644 index 9a4acad98..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Strings.Designer.cs +++ /dev/null @@ -1,819 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18033 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace WeifenLuo.WinFormsUI.Docking { - 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", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Strings { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Strings() { - } - - /// - /// 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("WeifenLuo.WinFormsUI.Docking.Strings", typeof(Strings).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 string similar to Docking. - /// - internal static string Category_Docking { - get { - return ResourceManager.GetString("Category_Docking", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Docking Notification. - /// - internal static string Category_DockingNotification { - get { - return ResourceManager.GetString("Category_DockingNotification", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Performance. - /// - internal static string Category_Performance { - get { - return ResourceManager.GetString("Category_Performance", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Property Changed. - /// - internal static string Category_PropertyChanged { - get { - return ResourceManager.GetString("Category_PropertyChanged", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to (Float). - /// - internal static string DockAreaEditor_FloatCheckBoxText { - get { - return ResourceManager.GetString("DockAreaEditor_FloatCheckBoxText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Determines if end user drag and drop docking is allowed.. - /// - internal static string DockContent_AllowEndUserDocking_Description { - get { - return ResourceManager.GetString("DockContent_AllowEndUserDocking_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The size to display the content in auto hide mode. Value < 1 to specify the size in portion; value >= 1 to specify the size in pixel.. - /// - internal static string DockContent_AutoHidePortion_Description { - get { - return ResourceManager.GetString("DockContent_AutoHidePortion_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Enable/Disable the close button of the content.. - /// - internal static string DockContent_CloseButton_Description { - get { - return ResourceManager.GetString("DockContent_CloseButton_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Shows or hides the close button of the content. This property does not function with System MDI Document Style.. - /// - internal static string DockContent_CloseButtonVisible_Description { - get { - return ResourceManager.GetString("DockContent_CloseButtonVisible_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The form must be of type IDockContent.. - /// - internal static string DockContent_Constructor_InvalidForm { - get { - return ResourceManager.GetString("DockContent_Constructor_InvalidForm", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Gets or sets a value indicating in which area of the DockPanel the content allowed to show.. - /// - internal static string DockContent_DockAreas_Description { - get { - return ResourceManager.GetString("DockContent_DockAreas_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when the value of DockState property changed.. - /// - internal static string DockContent_DockStateChanged_Description { - get { - return ResourceManager.GetString("DockContent_DockStateChanged_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Indicates the content will be hidden instead of being closed.. - /// - internal static string DockContent_HideOnClose_Description { - get { - return ResourceManager.GetString("DockContent_HideOnClose_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The desired docking state when first showing.. - /// - internal static string DockContent_ShowHint_Description { - get { - return ResourceManager.GetString("DockContent_ShowHint_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Context menu displayed for the dock pane tab strip.. - /// - internal static string DockContent_TabPageContextMenu_Description { - get { - return ResourceManager.GetString("DockContent_TabPageContextMenu_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The tab text displayed in the dock pane. If not set, the Text property will be used.. - /// - internal static string DockContent_TabText_Description { - get { - return ResourceManager.GetString("DockContent_TabText_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The text displayed when mouse hovers over the tab.. - /// - internal static string DockContent_ToolTipText_Description { - get { - return ResourceManager.GetString("DockContent_ToolTipText_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The provided value is out of range.. - /// - internal static string DockContentHandler_AutoHidePortion_OutOfRange { - get { - return ResourceManager.GetString("DockContentHandler_AutoHidePortion_OutOfRange", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid Value: The value of DockAreas conflicts with current DockState.. - /// - internal static string DockContentHandler_DockAreas_InvalidValue { - get { - return ResourceManager.GetString("DockContentHandler_DockAreas_InvalidValue", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane.. - /// - internal static string DockContentHandler_DockPane_InvalidValue { - get { - return ResourceManager.GetString("DockContentHandler_DockPane_InvalidValue", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane.. - /// - internal static string DockContentHandler_FloatPane_InvalidValue { - get { - return ResourceManager.GetString("DockContentHandler_FloatPane_InvalidValue", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid value, conflicts with DockableAreas property.. - /// - internal static string DockContentHandler_IsFloat_InvalidValue { - get { - return ResourceManager.GetString("DockContentHandler_IsFloat_InvalidValue", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The dock state is invalid.. - /// - internal static string DockContentHandler_SetDockState_InvalidState { - get { - return ResourceManager.GetString("DockContentHandler_SetDockState_InvalidState", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The dock panel is null.. - /// - internal static string DockContentHandler_SetDockState_NullPanel { - get { - return ResourceManager.GetString("DockContentHandler_SetDockState_NullPanel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid beforeContent, it must be contained by the pane.. - /// - internal static string DockContentHandler_Show_InvalidBeforeContent { - get { - return ResourceManager.GetString("DockContentHandler_Show_InvalidBeforeContent", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid DockState: Content can not be showed as "Unknown" or "Hidden".. - /// - internal static string DockContentHandler_Show_InvalidDockState { - get { - return ResourceManager.GetString("DockContentHandler_Show_InvalidDockState", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The previous pane is invalid. It can not be null, and its docking state must not be auto-hide.. - /// - internal static string DockContentHandler_Show_InvalidPrevPane { - get { - return ResourceManager.GetString("DockContentHandler_Show_InvalidPrevPane", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to DockPanel can not be null.. - /// - internal static string DockContentHandler_Show_NullDockPanel { - get { - return ResourceManager.GetString("DockContentHandler_Show_NullDockPanel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The Pane can not be null.. - /// - internal static string DockContentHandler_Show_NullPane { - get { - return ResourceManager.GetString("DockContentHandler_Show_NullPane", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid value, check DockableAreas property.. - /// - internal static string DockContentHandler_ShowHint_InvalidValue { - get { - return ResourceManager.GetString("DockContentHandler_ShowHint_InvalidValue", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Context menu displayed for the dock pane tab strip.. - /// - internal static string DockHandler_TabPageContextMenuStrip_Description { - get { - return ResourceManager.GetString("DockHandler_TabPageContextMenuStrip_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Press SHIFT for docking to full side.. - /// - internal static string DockIndicator_ToolTipText { - get { - return ResourceManager.GetString("DockIndicator_ToolTipText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid Content: ActiveContent must be one of the visible contents, or null if there is no visible content.. - /// - internal static string DockPane_ActiveContent_InvalidValue { - get { - return ResourceManager.GetString("DockPane_ActiveContent_InvalidValue", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid argument: Content can not be "null".. - /// - internal static string DockPane_Constructor_NullContent { - get { - return ResourceManager.GetString("DockPane_Constructor_NullContent", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid argument: The content's DockPanel can not be "null".. - /// - internal static string DockPane_Constructor_NullDockPanel { - get { - return ResourceManager.GetString("DockPane_Constructor_NullDockPanel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The specified container conflicts with the IsFloat property.. - /// - internal static string DockPane_DockTo_InvalidContainer { - get { - return ResourceManager.GetString("DockPane_DockTo_InvalidContainer", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The previous pane does not exist in the nested docking pane collection.. - /// - internal static string DockPane_DockTo_NoPrevPane { - get { - return ResourceManager.GetString("DockPane_DockTo_NoPrevPane", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The container can not be null.. - /// - internal static string DockPane_DockTo_NullContainer { - get { - return ResourceManager.GetString("DockPane_DockTo_NullContainer", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The previous pane can not be null when the nested docking pane collection is not empty.. - /// - internal static string DockPane_DockTo_NullPrevPane { - get { - return ResourceManager.GetString("DockPane_DockTo_NullPrevPane", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The previous pane can not be itself.. - /// - internal static string DockPane_DockTo_SelfPrevPane { - get { - return ResourceManager.GetString("DockPane_DockTo_SelfPrevPane", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to FloatWindow property can not be set to "null" when DockState is DockState.Float.. - /// - internal static string DockPane_FloatWindow_InvalidValue { - get { - return ResourceManager.GetString("DockPane_FloatWindow_InvalidValue", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid Content: Content not within the collection.. - /// - internal static string DockPane_SetContentIndex_InvalidContent { - get { - return ResourceManager.GetString("DockPane_SetContentIndex_InvalidContent", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid Index: The index is out of range.. - /// - internal static string DockPane_SetContentIndex_InvalidIndex { - get { - return ResourceManager.GetString("DockPane_SetContentIndex_InvalidIndex", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The state for the dock pane is invalid.. - /// - internal static string DockPane_SetDockState_InvalidState { - get { - return ResourceManager.GetString("DockPane_SetDockState_InvalidState", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Auto Hide. - /// - internal static string DockPaneCaption_ToolTipAutoHide { - get { - return ResourceManager.GetString("DockPaneCaption_ToolTipAutoHide", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Close. - /// - internal static string DockPaneCaption_ToolTipClose { - get { - return ResourceManager.GetString("DockPaneCaption_ToolTipClose", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Options. - /// - internal static string DockPaneCaption_ToolTipOptions { - get { - return ResourceManager.GetString("DockPaneCaption_ToolTipOptions", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid Content: The content must be auto-hide state and associates with this DockPanel.. - /// - internal static string DockPanel_ActiveAutoHideContent_InvalidValue { - get { - return ResourceManager.GetString("DockPanel_ActiveAutoHideContent_InvalidValue", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when the value of the AutoHideWindow's ActiveContent changed.. - /// - internal static string DockPanel_ActiveAutoHideContentChanged_Description { - get { - return ResourceManager.GetString("DockPanel_ActiveAutoHideContentChanged_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when the value of ActiveContentProperty changed.. - /// - internal static string DockPanel_ActiveContentChanged_Description { - get { - return ResourceManager.GetString("DockPanel_ActiveContentChanged_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when the value of ActiveDocument property changed.. - /// - internal static string DockPanel_ActiveDocumentChanged_Description { - get { - return ResourceManager.GetString("DockPanel_ActiveDocumentChanged_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when the value of ActivePane property changed.. - /// - internal static string DockPanel_ActivePaneChanged_Description { - get { - return ResourceManager.GetString("DockPanel_ActivePaneChanged_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Determines if the drag and drop docking is allowed.. - /// - internal static string DockPanel_AllowEndUserDocking_Description { - get { - return ResourceManager.GetString("DockPanel_AllowEndUserDocking_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Determines if the drag and drop nested docking is allowed.. - /// - internal static string DockPanel_AllowEndUserNestedDocking_Description { - get { - return ResourceManager.GetString("DockPanel_AllowEndUserNestedDocking_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when a content added to the DockPanel.. - /// - internal static string DockPanel_ContentAdded_Description { - get { - return ResourceManager.GetString("DockPanel_ContentAdded_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when a content removed from the DockPanel.. - /// - internal static string DockPanel_ContentRemoved_Description { - get { - return ResourceManager.GetString("DockPanel_ContentRemoved_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The default size of float window.. - /// - internal static string DockPanel_DefaultFloatWindowSize_Description { - get { - return ResourceManager.GetString("DockPanel_DefaultFloatWindowSize_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Provides Visual Studio .Net style docking.. - /// - internal static string DockPanel_Description { - get { - return ResourceManager.GetString("DockPanel_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Size of the bottom docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.. - /// - internal static string DockPanel_DockBottomPortion_Description { - get { - return ResourceManager.GetString("DockPanel_DockBottomPortion_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Size of the left docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.. - /// - internal static string DockPanel_DockLeftPortion_Description { - get { - return ResourceManager.GetString("DockPanel_DockLeftPortion_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The visual skin to use when displaying the docked windows.. - /// - internal static string DockPanel_DockPanelSkin { - get { - return ResourceManager.GetString("DockPanel_DockPanelSkin", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The predefined style used as the base for the skin.. - /// - internal static string DockPanel_DockPanelSkinStyle { - get { - return ResourceManager.GetString("DockPanel_DockPanelSkinStyle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Size of the right docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.. - /// - internal static string DockPanel_DockRightPortion_Description { - get { - return ResourceManager.GetString("DockPanel_DockRightPortion_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Size of the top docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.. - /// - internal static string DockPanel_DockTopPortion_Description { - get { - return ResourceManager.GetString("DockPanel_DockTopPortion_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The style of the document window.. - /// - internal static string DockPanel_DocumentStyle_Description { - get { - return ResourceManager.GetString("DockPanel_DocumentStyle_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Determines where the tab strip for Document style content is drawn.. - /// - internal static string DockPanel_DocumentTabStripLocation { - get { - return ResourceManager.GetString("DockPanel_DocumentTabStripLocation", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The DockPanel has already been initialized.. - /// - internal static string DockPanel_LoadFromXml_AlreadyInitialized { - get { - return ResourceManager.GetString("DockPanel_LoadFromXml_AlreadyInitialized", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The configuration file's version is invalid.. - /// - internal static string DockPanel_LoadFromXml_InvalidFormatVersion { - get { - return ResourceManager.GetString("DockPanel_LoadFromXml_InvalidFormatVersion", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The XML file format is invalid.. - /// - internal static string DockPanel_LoadFromXml_InvalidXmlFormat { - get { - return ResourceManager.GetString("DockPanel_LoadFromXml_InvalidXmlFormat", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid parent form. When using DockingMdi or SystemMdi document style, the DockPanel control must be the child control of the main MDI container form.. - /// - internal static string DockPanel_ParentForm_Invalid { - get { - return ResourceManager.GetString("DockPanel_ParentForm_Invalid", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to DockPanel configuration file. Author: Weifen Luo, all rights reserved.. - /// - internal static string DockPanel_Persistor_XmlFileComment1 { - get { - return ResourceManager.GetString("DockPanel_Persistor_XmlFileComment1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to !!! AUTOMATICALLY GENERATED FILE. DO NOT MODIFY !!!. - /// - internal static string DockPanel_Persistor_XmlFileComment2 { - get { - return ResourceManager.GetString("DockPanel_Persistor_XmlFileComment2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Indicates whether the control layout is right-to-left when the RightToLeft property is set to Yes.. - /// - internal static string DockPanel_RightToLeftLayout_Description { - get { - return ResourceManager.GetString("DockPanel_RightToLeftLayout_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid Index: The index is out of range.. - /// - internal static string DockPanel_SetPaneIndex_InvalidIndex { - get { - return ResourceManager.GetString("DockPanel_SetPaneIndex_InvalidIndex", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid Pane: DockPane not within the collection.. - /// - internal static string DockPanel_SetPaneIndex_InvalidPane { - get { - return ResourceManager.GetString("DockPanel_SetPaneIndex_InvalidPane", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Shows the hidden autohide content when hovering over the tab. When disabled, the tab must be clicked to show the content.. - /// - internal static string DockPanel_ShowAutoHideContentOnHover_Description { - get { - return ResourceManager.GetString("DockPanel_ShowAutoHideContentOnHover_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Determines if the document icon will be displayed in the tab strip.. - /// - internal static string DockPanel_ShowDocumentIcon_Description { - get { - return ResourceManager.GetString("DockPanel_ShowDocumentIcon_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Support deeply nested controls. Disabling this setting may improve resize performance but may cause heavily nested content not to resize.. - /// - internal static string DockPanel_SupportDeeplyNestedContent_Description { - get { - return ResourceManager.GetString("DockPanel_SupportDeeplyNestedContent_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Close. - /// - internal static string DockPaneStrip_ToolTipClose { - get { - return ResourceManager.GetString("DockPaneStrip_ToolTipClose", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Window List. - /// - internal static string DockPaneStrip_ToolTipWindowList { - get { - return ResourceManager.GetString("DockPaneStrip_ToolTipWindowList", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid argument: DockPanel can not be "null".. - /// - internal static string FloatWindow_Constructor_NullDockPanel { - get { - return ResourceManager.GetString("FloatWindow_Constructor_NullDockPanel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid Index: The index is out of range.. - /// - internal static string FloatWindow_SetPaneIndex_InvalidIndex { - get { - return ResourceManager.GetString("FloatWindow_SetPaneIndex_InvalidIndex", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid Pane: DockPane not within the collection.. - /// - internal static string FloatWindow_SetPaneIndex_InvalidPane { - get { - return ResourceManager.GetString("FloatWindow_SetPaneIndex_InvalidPane", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid DockPanel.. - /// - internal static string IDockDragSource_DockTo_InvalidPanel { - get { - return ResourceManager.GetString("IDockDragSource_DockTo_InvalidPanel", resourceCulture); - } - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/Strings.resx b/renderdocui/3rdparty/WinFormsUI/Docking/Strings.resx deleted file mode 100644 index d0056d279..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/Strings.resx +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - Docking - - - Docking Notification - - - Property Changed - - - (Float) - - - Determines if end user drag and drop docking is allowed. - - - The size to display the content in auto hide mode. Value < 1 to specify the size in portion; value >= 1 to specify the size in pixel. - - - Enable/Disable the close button of the content. - - - The form must be of type IDockContent. - - - Gets or sets a value indicating in which area of the DockPanel the content allowed to show. - - - Occurs when the value of DockState property changed. - - - Indicates the content will be hidden instead of being closed. - - - The desired docking state when first showing. - - - Context menu displayed for the dock pane tab strip. - - - The tab text displayed in the dock pane. If not set, the Text property will be used. - - - The text displayed when mouse hovers over the tab. - - - The provided value is out of range. - - - Invalid Value: The value of DockAreas conflicts with current DockState. - - - The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane. - - - The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane. - - - Invalid value, conflicts with DockableAreas property. - - - The dock state is invalid. - - - The dock panel is null. - - - Invalid beforeContent, it must be contained by the pane. - - - Invalid DockState: Content can not be showed as "Unknown" or "Hidden". - - - The previous pane is invalid. It can not be null, and its docking state must not be auto-hide. - - - DockPanel can not be null. - - - The Pane can not be null. - - - Invalid value, check DockableAreas property. - - - Context menu displayed for the dock pane tab strip. - - - Press SHIFT for docking to full side. - - - Invalid Content: ActiveContent must be one of the visible contents, or null if there is no visible content. - - - Invalid argument: Content can not be "null". - - - Invalid argument: The content's DockPanel can not be "null". - - - The specified container conflicts with the IsFloat property. - - - The previous pane does not exist in the nested docking pane collection. - - - The container can not be null. - - - The previous pane can not be null when the nested docking pane collection is not empty. - - - The previous pane can not be itself. - - - FloatWindow property can not be set to "null" when DockState is DockState.Float. - - - Invalid Content: Content not within the collection. - - - Invalid Index: The index is out of range. - - - The state for the dock pane is invalid. - - - Auto Hide - - - Close - - - Options - - - Invalid Content: The content must be auto-hide state and associates with this DockPanel. - - - Occurs when the value of ActiveContentProperty changed. - - - Occurs when the value of ActiveDocument property changed. - - - Occurs when the value of ActivePane property changed. - - - Determines if the drag and drop docking is allowed. - - - Determines if the drag and drop nested docking is allowed. - - - Occurs when the value of the AutoHideWindow's ActiveContent changed. - - - Occurs when a content added to the DockPanel. - - - Occurs when a content removed from the DockPanel. - - - The default size of float window. - - - Provides Visual Studio .Net style docking. - - - Size of the bottom docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels. - - - Size of the left docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels. - - - Size of the right docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels. - - - Size of the top docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels. - - - The style of the document window. - - - The DockPanel has already been initialized. - - - The configuration file's version is invalid. - - - The XML file format is invalid. - - - Invalid parent form. When using DockingMdi or SystemMdi document style, the DockPanel control must be the child control of the main MDI container form. - - - DockPanel configuration file. Author: Weifen Luo, all rights reserved. - - - !!! AUTOMATICALLY GENERATED FILE. DO NOT MODIFY !!! - - - Indicates whether the control layout is right-to-left when the RightToLeft property is set to Yes. - - - Invalid Index: The index is out of range. - - - Invalid Pane: DockPane not within the collection. - - - Determines if the document icon will be displayed in the tab strip. - - - Close - - - Window List - - - Invalid argument: DockPanel can not be "null". - - - Invalid Index: The index is out of range. - - - Invalid Pane: DockPane not within the collection. - - - Invalid DockPanel. - - - Shows or hides the close button of the content. This property does not function with System MDI Document Style. - - - The visual skin to use when displaying the docked windows. - - - The predefined style used as the base for the skin. - - - Determines where the tab strip for Document style content is drawn. - - - Performance - - - Support deeply nested controls. Disabling this setting may improve resize performance but may cause heavily nested content not to resize. - - - Shows the hidden autohide content when hovering over the tab. When disabled, the tab must be clicked to show the content. - - \ No newline at end of file diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/VS2005AutoHideStrip.cs b/renderdocui/3rdparty/WinFormsUI/Docking/VS2005AutoHideStrip.cs deleted file mode 100644 index eee1dd8db..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/VS2005AutoHideStrip.cs +++ /dev/null @@ -1,529 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; -using System.Drawing.Drawing2D; -using System.ComponentModel; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal class VS2005AutoHideStrip : AutoHideStripBase - { - private class TabVS2005 : Tab - { - internal TabVS2005(IDockContent content) - : base(content) - { - } - - private int m_tabX = 0; - public int TabX - { - get { return m_tabX; } - set { m_tabX = value; } - } - - private int m_tabWidth = 0; - public int TabWidth - { - get { return m_tabWidth; } - set { m_tabWidth = value; } - } - - } - - private const int _ImageHeight = 16; - private const int _ImageWidth = 16; - private const int _ImageGapTop = 2; - private const int _ImageGapLeft = 4; - private const int _ImageGapRight = 2; - private const int _ImageGapBottom = 2; - private const int _TextGapLeft = 0; - private const int _TextGapRight = 0; - private const int _TabGapTop = 3; - private const int _TabGapLeft = 4; - private const int _TabGapBetween = 10; - - #region Customizable Properties - public Font TextFont - { - get { return DockPanel.Skin.AutoHideStripSkin.TextFont; } - } - - private static StringFormat _stringFormatTabHorizontal; - private StringFormat StringFormatTabHorizontal - { - get - { - if (_stringFormatTabHorizontal == null) - { - _stringFormatTabHorizontal = new StringFormat(); - _stringFormatTabHorizontal.Alignment = StringAlignment.Near; - _stringFormatTabHorizontal.LineAlignment = StringAlignment.Center; - _stringFormatTabHorizontal.FormatFlags = StringFormatFlags.NoWrap; - _stringFormatTabHorizontal.Trimming = StringTrimming.None; - } - - if (RightToLeft == RightToLeft.Yes) - _stringFormatTabHorizontal.FormatFlags |= StringFormatFlags.DirectionRightToLeft; - else - _stringFormatTabHorizontal.FormatFlags &= ~StringFormatFlags.DirectionRightToLeft; - - return _stringFormatTabHorizontal; - } - } - - private static StringFormat _stringFormatTabVertical; - private StringFormat StringFormatTabVertical - { - get - { - if (_stringFormatTabVertical == null) - { - _stringFormatTabVertical = new StringFormat(); - _stringFormatTabVertical.Alignment = StringAlignment.Near; - _stringFormatTabVertical.LineAlignment = StringAlignment.Center; - _stringFormatTabVertical.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.DirectionVertical; - _stringFormatTabVertical.Trimming = StringTrimming.None; - } - if (RightToLeft == RightToLeft.Yes) - _stringFormatTabVertical.FormatFlags |= StringFormatFlags.DirectionRightToLeft; - else - _stringFormatTabVertical.FormatFlags &= ~StringFormatFlags.DirectionRightToLeft; - - return _stringFormatTabVertical; - } - } - - private static int ImageHeight - { - get { return _ImageHeight; } - } - - private static int ImageWidth - { - get { return _ImageWidth; } - } - - private static int ImageGapTop - { - get { return _ImageGapTop; } - } - - private static int ImageGapLeft - { - get { return _ImageGapLeft; } - } - - private static int ImageGapRight - { - get { return _ImageGapRight; } - } - - private static int ImageGapBottom - { - get { return _ImageGapBottom; } - } - - private static int TextGapLeft - { - get { return _TextGapLeft; } - } - - private static int TextGapRight - { - get { return _TextGapRight; } - } - - private static int TabGapTop - { - get { return _TabGapTop; } - } - - private static int TabGapLeft - { - get { return _TabGapLeft; } - } - - private static int TabGapBetween - { - get { return _TabGapBetween; } - } - - private static Pen PenTabBorder - { - get { return SystemPens.GrayText; } - } - #endregion - - private static Matrix _matrixIdentity = new Matrix(); - private static Matrix MatrixIdentity - { - get { return _matrixIdentity; } - } - - private static DockState[] _dockStates; - private static DockState[] DockStates - { - get - { - if (_dockStates == null) - { - _dockStates = new DockState[4]; - _dockStates[0] = DockState.DockLeftAutoHide; - _dockStates[1] = DockState.DockRightAutoHide; - _dockStates[2] = DockState.DockTopAutoHide; - _dockStates[3] = DockState.DockBottomAutoHide; - } - return _dockStates; - } - } - - private static GraphicsPath _graphicsPath; - internal static GraphicsPath GraphicsPath - { - get - { - if (_graphicsPath == null) - _graphicsPath = new GraphicsPath(); - - return _graphicsPath; - } - } - - public VS2005AutoHideStrip(DockPanel panel) - : base(panel) - { - SetStyle(ControlStyles.ResizeRedraw | - ControlStyles.UserPaint | - ControlStyles.AllPaintingInWmPaint | - ControlStyles.OptimizedDoubleBuffer, true); - BackColor = SystemColors.ControlLight; - } - - protected override void OnPaint(PaintEventArgs e) - { - Graphics g = e.Graphics; - - Color startColor = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.StartColor; - Color endColor = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.EndColor; - LinearGradientMode gradientMode = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.LinearGradientMode; - using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode)) - { - g.FillRectangle(brush, ClientRectangle); - } - - DrawTabStrip(g); - } - - protected override void OnLayout(LayoutEventArgs levent) - { - CalculateTabs(); - base.OnLayout(levent); - } - - private void DrawTabStrip(Graphics g) - { - DrawTabStrip(g, DockState.DockTopAutoHide); - DrawTabStrip(g, DockState.DockBottomAutoHide); - DrawTabStrip(g, DockState.DockLeftAutoHide); - DrawTabStrip(g, DockState.DockRightAutoHide); - } - - private void DrawTabStrip(Graphics g, DockState dockState) - { - Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState); - - if (rectTabStrip.IsEmpty) - return; - - Matrix matrixIdentity = g.Transform; - if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) - { - Matrix matrixRotated = new Matrix(); - matrixRotated.RotateAt(90, new PointF((float)rectTabStrip.X + (float)rectTabStrip.Height / 2, - (float)rectTabStrip.Y + (float)rectTabStrip.Height / 2)); - g.Transform = matrixRotated; - } - - foreach (Pane pane in GetPanes(dockState)) - { - foreach (TabVS2005 tab in pane.AutoHideTabs) - DrawTab(g, tab); - } - g.Transform = matrixIdentity; - } - - private void CalculateTabs() - { - CalculateTabs(DockState.DockTopAutoHide); - CalculateTabs(DockState.DockBottomAutoHide); - CalculateTabs(DockState.DockLeftAutoHide); - CalculateTabs(DockState.DockRightAutoHide); - } - - private void CalculateTabs(DockState dockState) - { - Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState); - - int imageHeight = rectTabStrip.Height - ImageGapTop - ImageGapBottom; - int imageWidth = ImageWidth; - if (imageHeight > ImageHeight) - imageWidth = ImageWidth * (imageHeight / ImageHeight); - - int x = TabGapLeft + rectTabStrip.X; - foreach (Pane pane in GetPanes(dockState)) - { - foreach (TabVS2005 tab in pane.AutoHideTabs) - { - int width = imageWidth + ImageGapLeft + ImageGapRight + - TextRenderer.MeasureText(tab.Content.DockHandler.TabText, TextFont).Width + - TextGapLeft + TextGapRight; - tab.TabX = x; - tab.TabWidth = width; - x += width; - } - - x += TabGapBetween; - } - } - - private Rectangle RtlTransform(Rectangle rect, DockState dockState) - { - Rectangle rectTransformed; - if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) - rectTransformed = rect; - else - rectTransformed = DrawHelper.RtlTransform(this, rect); - - return rectTransformed; - } - - private GraphicsPath GetTabOutline(TabVS2005 tab, bool transformed, bool rtlTransform) - { - DockState dockState = tab.Content.DockHandler.DockState; - Rectangle rectTab = GetTabRectangle(tab, transformed); - if (rtlTransform) - rectTab = RtlTransform(rectTab, dockState); - bool upTab = (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockBottomAutoHide); - DrawHelper.GetRoundedCornerTab(GraphicsPath, rectTab, upTab); - - return GraphicsPath; - } - - private void DrawTab(Graphics g, TabVS2005 tab) - { - Rectangle rectTabOrigin = GetTabRectangle(tab); - if (rectTabOrigin.IsEmpty) - return; - - DockState dockState = tab.Content.DockHandler.DockState; - IDockContent content = tab.Content; - - GraphicsPath path = GetTabOutline(tab, false, true); - - Color startColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.StartColor; - Color endColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.EndColor; - LinearGradientMode gradientMode = DockPanel.Skin.AutoHideStripSkin.TabGradient.LinearGradientMode; - g.FillPath(new LinearGradientBrush(rectTabOrigin, startColor, endColor, gradientMode), path); - g.DrawPath(PenTabBorder, path); - - // Set no rotate for drawing icon and text - Matrix matrixRotate = g.Transform; - g.Transform = MatrixIdentity; - - // Draw the icon - Rectangle rectImage = rectTabOrigin; - rectImage.X += ImageGapLeft; - rectImage.Y += ImageGapTop; - int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom; - int imageWidth = ImageWidth; - if (imageHeight > ImageHeight) - imageWidth = ImageWidth * (imageHeight / ImageHeight); - rectImage.Height = imageHeight; - rectImage.Width = imageWidth; - rectImage = GetTransformedRectangle(dockState, rectImage); - - if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) - { - // The DockState is DockLeftAutoHide or DockRightAutoHide, so rotate the image 90 degrees to the right. - Rectangle rectTransform = RtlTransform(rectImage, dockState); - Point[] rotationPoints = - { - new Point(rectTransform.X + rectTransform.Width, rectTransform.Y), - new Point(rectTransform.X + rectTransform.Width, rectTransform.Y + rectTransform.Height), - new Point(rectTransform.X, rectTransform.Y) - }; - - using (Icon rotatedIcon = new Icon(((Form)content).Icon, 16, 16)) - { - g.DrawImage(rotatedIcon.ToBitmap(), rotationPoints); - } - } - else - { - // Draw the icon normally without any rotation. - g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState)); - } - - // Draw the text - Rectangle rectText = rectTabOrigin; - rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft; - rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft; - rectText = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState); - - Color textColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.TextColor; - - if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) - g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabVertical); - else - g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabHorizontal); - - // Set rotate back - g.Transform = matrixRotate; - } - - private Rectangle GetLogicalTabStripRectangle(DockState dockState) - { - return GetLogicalTabStripRectangle(dockState, false); - } - - private Rectangle GetLogicalTabStripRectangle(DockState dockState, bool transformed) - { - if (!DockHelper.IsDockStateAutoHide(dockState)) - return Rectangle.Empty; - - int leftPanes = GetPanes(DockState.DockLeftAutoHide).Count; - int rightPanes = GetPanes(DockState.DockRightAutoHide).Count; - int topPanes = GetPanes(DockState.DockTopAutoHide).Count; - int bottomPanes = GetPanes(DockState.DockBottomAutoHide).Count; - - int x, y, width, height; - - height = MeasureHeight(); - if (dockState == DockState.DockLeftAutoHide && leftPanes > 0) - { - x = 0; - y = (topPanes == 0) ? 0 : height; - width = Height - (topPanes == 0 ? 0 : height) - (bottomPanes == 0 ? 0 : height); - } - else if (dockState == DockState.DockRightAutoHide && rightPanes > 0) - { - x = Width - height; - if (leftPanes != 0 && x < height) - x = height; - y = (topPanes == 0) ? 0 : height; - width = Height - (topPanes == 0 ? 0 : height) - (bottomPanes == 0 ? 0 : height); - } - else if (dockState == DockState.DockTopAutoHide && topPanes > 0) - { - x = leftPanes == 0 ? 0 : height; - y = 0; - width = Width - (leftPanes == 0 ? 0 : height) - (rightPanes == 0 ? 0 : height); - } - else if (dockState == DockState.DockBottomAutoHide && bottomPanes > 0) - { - x = leftPanes == 0 ? 0 : height; - y = Height - height; - if (topPanes != 0 && y < height) - y = height; - width = Width - (leftPanes == 0 ? 0 : height) - (rightPanes == 0 ? 0 : height); - } - else - return Rectangle.Empty; - - if (width == 0 || height == 0) - { - return Rectangle.Empty; - } - - var rect = new Rectangle(x, y, width, height); - return transformed ? GetTransformedRectangle(dockState, rect) : rect; - } - - private Rectangle GetTabRectangle(TabVS2005 tab) - { - return GetTabRectangle(tab, false); - } - - private Rectangle GetTabRectangle(TabVS2005 tab, bool transformed) - { - DockState dockState = tab.Content.DockHandler.DockState; - Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState); - - if (rectTabStrip.IsEmpty) - return Rectangle.Empty; - - int x = tab.TabX; - int y = rectTabStrip.Y + - (dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide ? - 0 : TabGapTop); - int width = tab.TabWidth; - int height = rectTabStrip.Height - TabGapTop; - - if (!transformed) - return new Rectangle(x, y, width, height); - else - return GetTransformedRectangle(dockState, new Rectangle(x, y, width, height)); - } - - private Rectangle GetTransformedRectangle(DockState dockState, Rectangle rect) - { - if (dockState != DockState.DockLeftAutoHide && dockState != DockState.DockRightAutoHide) - return rect; - - PointF[] pts = new PointF[1]; - // the center of the rectangle - pts[0].X = (float)rect.X + (float)rect.Width / 2; - pts[0].Y = (float)rect.Y + (float)rect.Height / 2; - Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState); - Matrix matrix = new Matrix(); - matrix.RotateAt(90, new PointF((float)rectTabStrip.X + (float)rectTabStrip.Height / 2, - (float)rectTabStrip.Y + (float)rectTabStrip.Height / 2)); - matrix.TransformPoints(pts); - - return new Rectangle((int)(pts[0].X - (float)rect.Height / 2 + .5F), - (int)(pts[0].Y - (float)rect.Width / 2 + .5F), - rect.Height, rect.Width); - } - - protected override IDockContent HitTest(Point ptMouse) - { - foreach (DockState state in DockStates) - { - Rectangle rectTabStrip = GetLogicalTabStripRectangle(state, true); - if (!rectTabStrip.Contains(ptMouse)) - continue; - - foreach (Pane pane in GetPanes(state)) - { - foreach (TabVS2005 tab in pane.AutoHideTabs) - { - GraphicsPath path = GetTabOutline(tab, true, true); - if (path.IsVisible(ptMouse)) - return tab.Content; - } - } - } - - return null; - } - - protected internal override int MeasureHeight() - { - return Math.Max(ImageGapBottom + - ImageGapTop + ImageHeight, - TextFont.Height) + TabGapTop; - } - - protected override void OnRefreshChanges() - { - CalculateTabs(); - Invalidate(); - } - - protected override AutoHideStripBase.Tab CreateTab(IDockContent content) - { - return new TabVS2005(content); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/VS2005DockPaneCaption.cs b/renderdocui/3rdparty/WinFormsUI/Docking/VS2005DockPaneCaption.cs deleted file mode 100644 index c7a0134bf..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/VS2005DockPaneCaption.cs +++ /dev/null @@ -1,480 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Windows.Forms; -using System.ComponentModel; -using System.Windows.Forms.VisualStyles; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal class VS2005DockPaneCaption : DockPaneCaptionBase - { - private sealed class InertButton : InertButtonBase - { - private Bitmap m_image, m_imageAutoHide; - - public InertButton(VS2005DockPaneCaption dockPaneCaption, Bitmap image, Bitmap imageAutoHide) - : base() - { - m_dockPaneCaption = dockPaneCaption; - m_image = image; - m_imageAutoHide = imageAutoHide; - RefreshChanges(); - } - - private VS2005DockPaneCaption m_dockPaneCaption; - private VS2005DockPaneCaption DockPaneCaption - { - get { return m_dockPaneCaption; } - } - - public bool IsAutoHide - { - get { return DockPaneCaption.DockPane.IsAutoHide; } - } - - public override Bitmap Image - { - get { return IsAutoHide ? m_imageAutoHide : m_image; } - } - - protected override void OnRefreshChanges() - { - if (DockPaneCaption.DockPane.DockPanel != null) - { - if (DockPaneCaption.TextColor != ForeColor) - { - ForeColor = DockPaneCaption.TextColor; - Invalidate(); - } - } - } - } - - #region consts - private const int _TextGapTop = 2; - private const int _TextGapBottom = 0; - private const int _TextGapLeft = 3; - private const int _TextGapRight = 3; - private const int _ButtonGapTop = 2; - private const int _ButtonGapBottom = 1; - private const int _ButtonGapBetween = 1; - private const int _ButtonGapLeft = 1; - private const int _ButtonGapRight = 2; - #endregion - - private static Bitmap _imageButtonClose; - private static Bitmap ImageButtonClose - { - get - { - if (_imageButtonClose == null) - _imageButtonClose = Resources.DockPane_Close; - - return _imageButtonClose; - } - } - - private InertButton m_buttonClose; - private InertButton ButtonClose - { - get - { - if (m_buttonClose == null) - { - m_buttonClose = new InertButton(this, ImageButtonClose, ImageButtonClose); - m_toolTip.SetToolTip(m_buttonClose, ToolTipClose); - m_buttonClose.Click += new EventHandler(Close_Click); - Controls.Add(m_buttonClose); - } - - return m_buttonClose; - } - } - - private static Bitmap _imageButtonAutoHide; - private static Bitmap ImageButtonAutoHide - { - get - { - if (_imageButtonAutoHide == null) - _imageButtonAutoHide = Resources.DockPane_AutoHide; - - return _imageButtonAutoHide; - } - } - - private static Bitmap _imageButtonDock; - private static Bitmap ImageButtonDock - { - get - { - if (_imageButtonDock == null) - _imageButtonDock = Resources.DockPane_Dock; - - return _imageButtonDock; - } - } - - private InertButton m_buttonAutoHide; - private InertButton ButtonAutoHide - { - get - { - if (m_buttonAutoHide == null) - { - m_buttonAutoHide = new InertButton(this, ImageButtonDock, ImageButtonAutoHide); - m_toolTip.SetToolTip(m_buttonAutoHide, ToolTipAutoHide); - m_buttonAutoHide.Click += new EventHandler(AutoHide_Click); - Controls.Add(m_buttonAutoHide); - } - - return m_buttonAutoHide; - } - } - - private static Bitmap _imageButtonOptions; - private static Bitmap ImageButtonOptions - { - get - { - if (_imageButtonOptions == null) - _imageButtonOptions = Resources.DockPane_Option; - - return _imageButtonOptions; - } - } - - private InertButton m_buttonOptions; - private InertButton ButtonOptions - { - get - { - if (m_buttonOptions == null) - { - m_buttonOptions = new InertButton(this, ImageButtonOptions, ImageButtonOptions); - m_toolTip.SetToolTip(m_buttonOptions, ToolTipOptions); - m_buttonOptions.Click += new EventHandler(Options_Click); - Controls.Add(m_buttonOptions); - } - return m_buttonOptions; - } - } - - private IContainer m_components; - private IContainer Components - { - get { return m_components; } - } - - private ToolTip m_toolTip; - - public VS2005DockPaneCaption(DockPane pane) : base(pane) - { - SuspendLayout(); - - m_components = new Container(); - m_toolTip = new ToolTip(Components); - - ResumeLayout(); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - Components.Dispose(); - base.Dispose(disposing); - } - - private static int TextGapTop - { - get { return _TextGapTop; } - } - - public Font TextFont - { - get { return DockPane.DockPanel.Skin.DockPaneStripSkin.TextFont; } - } - - private static int TextGapBottom - { - get { return _TextGapBottom; } - } - - private static int TextGapLeft - { - get { return _TextGapLeft; } - } - - private static int TextGapRight - { - get { return _TextGapRight; } - } - - private static int ButtonGapTop - { - get { return _ButtonGapTop; } - } - - private static int ButtonGapBottom - { - get { return _ButtonGapBottom; } - } - - private static int ButtonGapLeft - { - get { return _ButtonGapLeft; } - } - - private static int ButtonGapRight - { - get { return _ButtonGapRight; } - } - - private static int ButtonGapBetween - { - get { return _ButtonGapBetween; } - } - - private static string _toolTipClose; - private static string ToolTipClose - { - get - { - if (_toolTipClose == null) - _toolTipClose = Strings.DockPaneCaption_ToolTipClose; - return _toolTipClose; - } - } - - private static string _toolTipOptions; - private static string ToolTipOptions - { - get - { - if (_toolTipOptions == null) - _toolTipOptions = Strings.DockPaneCaption_ToolTipOptions; - - return _toolTipOptions; - } - } - - private static string _toolTipAutoHide; - private static string ToolTipAutoHide - { - get - { - if (_toolTipAutoHide == null) - _toolTipAutoHide = Strings.DockPaneCaption_ToolTipAutoHide; - return _toolTipAutoHide; - } - } - - private static Blend _activeBackColorGradientBlend; - private static Blend ActiveBackColorGradientBlend - { - get - { - if (_activeBackColorGradientBlend == null) - { - Blend blend = new Blend(2); - - blend.Factors = new float[]{0.5F, 1.0F}; - blend.Positions = new float[]{0.0F, 1.0F}; - _activeBackColorGradientBlend = blend; - } - - return _activeBackColorGradientBlend; - } - } - - private Color TextColor - { - get - { - if (DockPane.IsActivated) - return DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.TextColor; - else - return DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.TextColor; - } - } - - private static TextFormatFlags _textFormat = - TextFormatFlags.SingleLine | - TextFormatFlags.EndEllipsis | - TextFormatFlags.VerticalCenter; - private TextFormatFlags TextFormat - { - get - { - if (RightToLeft == RightToLeft.No) - return _textFormat; - else - return _textFormat | TextFormatFlags.RightToLeft | TextFormatFlags.Right; - } - } - - protected internal override int MeasureHeight() - { - int height = TextFont.Height + TextGapTop + TextGapBottom; - - if (height < ButtonClose.Image.Height + ButtonGapTop + ButtonGapBottom) - height = ButtonClose.Image.Height + ButtonGapTop + ButtonGapBottom; - - return height; - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint (e); - DrawCaption(e.Graphics); - } - - private void DrawCaption(Graphics g) - { - if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0) - return; - - if (DockPane.IsActivated) - { - Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.StartColor; - Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor; - LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode; - using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode)) - { - brush.Blend = ActiveBackColorGradientBlend; - g.FillRectangle(brush, ClientRectangle); - } - } - else - { - Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor; - Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor; - LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.LinearGradientMode; - using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode)) - { - g.FillRectangle(brush, ClientRectangle); - } - } - - Rectangle rectCaption = ClientRectangle; - - Rectangle rectCaptionText = rectCaption; - rectCaptionText.X += TextGapLeft; - rectCaptionText.Width -= TextGapLeft + TextGapRight; - rectCaptionText.Width -= ButtonGapLeft + ButtonClose.Width + ButtonGapRight; - if (ShouldShowAutoHideButton) - rectCaptionText.Width -= ButtonAutoHide.Width + ButtonGapBetween; - if (HasTabPageContextMenu) - rectCaptionText.Width -= ButtonOptions.Width + ButtonGapBetween; - rectCaptionText.Y += TextGapTop; - rectCaptionText.Height -= TextGapTop + TextGapBottom; - - Color colorText; - if (DockPane.IsActivated) - colorText = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.TextColor; - else - colorText = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.TextColor; - - TextRenderer.DrawText(g, DockPane.CaptionText, TextFont, DrawHelper.RtlTransform(this, rectCaptionText), colorText, TextFormat); - } - - protected override void OnLayout(LayoutEventArgs levent) - { - SetButtonsPosition(); - base.OnLayout (levent); - } - - protected override void OnRefreshChanges() - { - SetButtons(); - Invalidate(); - } - - private bool CloseButtonEnabled - { - get { return (DockPane.ActiveContent != null)? DockPane.ActiveContent.DockHandler.CloseButton : false; } - } - - /// - /// Determines whether the close button is visible on the content - /// - private bool CloseButtonVisible - { - get { return (DockPane.ActiveContent != null) ? DockPane.ActiveContent.DockHandler.CloseButtonVisible : false; } - } - - private bool ShouldShowAutoHideButton - { - get { return !DockPane.IsFloat; } - } - - private void SetButtons() - { - ButtonClose.Enabled = CloseButtonEnabled; - ButtonClose.Visible = CloseButtonVisible; - ButtonAutoHide.Visible = ShouldShowAutoHideButton; - ButtonOptions.Visible = HasTabPageContextMenu; - ButtonClose.RefreshChanges(); - ButtonAutoHide.RefreshChanges(); - ButtonOptions.RefreshChanges(); - - SetButtonsPosition(); - } - - private void SetButtonsPosition() - { - // set the size and location for close and auto-hide buttons - Rectangle rectCaption = ClientRectangle; - int buttonWidth = ButtonClose.Image.Width; - int buttonHeight = ButtonClose.Image.Height; - int height = rectCaption.Height - ButtonGapTop - ButtonGapBottom; - if (buttonHeight < height) - { - buttonWidth = buttonWidth * (height / buttonHeight); - buttonHeight = height; - } - Size buttonSize = new Size(buttonWidth, buttonHeight); - int x = rectCaption.X + rectCaption.Width - 1 - ButtonGapRight - m_buttonClose.Width; - int y = rectCaption.Y + ButtonGapTop; - Point point = new Point(x, y); - ButtonClose.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize)); - - // If the close button is not visible draw the auto hide button overtop. - // Otherwise it is drawn to the left of the close button. - if (CloseButtonVisible) - point.Offset(-(buttonWidth + ButtonGapBetween), 0); - - ButtonAutoHide.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize)); - if (ShouldShowAutoHideButton) - point.Offset(-(buttonWidth + ButtonGapBetween), 0); - ButtonOptions.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize)); - } - - private void Close_Click(object sender, EventArgs e) - { - DockPane.CloseActiveContent(); - } - - private void AutoHide_Click(object sender, EventArgs e) - { - DockPane.DockState = DockHelper.ToggleAutoHideState(DockPane.DockState); - if (DockHelper.IsDockStateAutoHide(DockPane.DockState)) - { - DockPane.DockPanel.ActiveAutoHideContent = null; - DockPane.NestedDockingStatus.NestedPanes.SwitchPaneWithFirstChild(DockPane); - } - } - - private void Options_Click(object sender, EventArgs e) - { - ShowTabPageContextMenu(PointToClient(Control.MousePosition)); - } - - protected override void OnRightToLeftChanged(EventArgs e) - { - base.OnRightToLeftChanged(e); - PerformLayout(); - } - } -} diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/VS2005DockPaneStrip.cs b/renderdocui/3rdparty/WinFormsUI/Docking/VS2005DockPaneStrip.cs deleted file mode 100644 index d0f744634..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/VS2005DockPaneStrip.cs +++ /dev/null @@ -1,1498 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Windows.Forms; -using System.ComponentModel; -using System.Collections; -using System.Collections.Generic; - -namespace WeifenLuo.WinFormsUI.Docking -{ - internal class VS2005DockPaneStrip : DockPaneStripBase - { - private class TabVS2005 : Tab - { - public TabVS2005(IDockContent content) - : base(content) - { - } - - private int m_tabX; - public int TabX - { - get { return m_tabX; } - set { m_tabX = value; } - } - - private int m_tabWidth; - public int TabWidth - { - get { return m_tabWidth; } - set { m_tabWidth = value; } - } - - private int m_maxWidth; - public int MaxWidth - { - get { return m_maxWidth; } - set { m_maxWidth = value; } - } - - private bool m_flag; - protected internal bool Flag - { - get { return m_flag; } - set { m_flag = value; } - } - } - - protected internal override DockPaneStripBase.Tab CreateTab(IDockContent content) - { - return new TabVS2005(content); - } - - private sealed class InertButton : InertButtonBase - { - private Bitmap m_image0, m_image1; - - public InertButton(Bitmap image0, Bitmap image1) - : base() - { - m_image0 = image0; - m_image1 = image1; - } - - private int m_imageCategory = 0; - public int ImageCategory - { - get { return m_imageCategory; } - set - { - if (m_imageCategory == value) - return; - - m_imageCategory = value; - Invalidate(); - } - } - - public override Bitmap Image - { - get { return ImageCategory == 0 ? m_image0 : m_image1; } - } - } - - #region Constants - - private const int _ToolWindowStripGapTop = 0; - private const int _ToolWindowStripGapBottom = 1; - private const int _ToolWindowStripGapLeft = 0; - private const int _ToolWindowStripGapRight = 0; - private const int _ToolWindowImageHeight = 16; - private const int _ToolWindowImageWidth = 16; - private const int _ToolWindowImageGapTop = 3; - private const int _ToolWindowImageGapBottom = 1; - private const int _ToolWindowImageGapLeft = 2; - private const int _ToolWindowImageGapRight = 0; - private const int _ToolWindowTextGapRight = 3; - private const int _ToolWindowTabSeperatorGapTop = 3; - private const int _ToolWindowTabSeperatorGapBottom = 3; - - private const int _DocumentStripGapTop = 0; - private const int _DocumentStripGapBottom = 1; - private const int _DocumentTabMaxWidth = 200; - private const int _DocumentButtonGapTop = 4; - private const int _DocumentButtonGapBottom = 4; - private const int _DocumentButtonGapBetween = 0; - private const int _DocumentButtonGapRight = 3; - private const int _DocumentTabGapTop = 3; - private const int _DocumentTabGapLeft = 3; - private const int _DocumentTabGapRight = 3; - private const int _DocumentIconGapBottom = 2; - private const int _DocumentIconGapLeft = 12; - private const int _DocumentIconGapRight = 0; - private const int _DocumentIconHeight = 16; - private const int _DocumentIconWidth = 16; - private const int _DocumentTextGapRight = 3; - - #endregion - - #region Members - - private ContextMenuStrip m_selectMenu; - private static Bitmap m_imageButtonClose; - private InertButton m_buttonClose; - private static Bitmap m_imageButtonWindowList; - private static Bitmap m_imageButtonWindowListOverflow; - private InertButton m_buttonWindowList; - private IContainer m_components; - private ToolTip m_toolTip; - private Font m_font; - private Font m_boldFont; - private int m_startDisplayingTab = 0; - private int m_endDisplayingTab = 0; - private int m_firstDisplayingTab = 0; - private bool m_documentTabsOverflow = false; - private static string m_toolTipSelect; - private static string m_toolTipClose; - private bool m_closeButtonVisible = false; - - #endregion - - #region Properties - - private Rectangle TabStripRectangle - { - get - { - if (Appearance == DockPane.AppearanceStyle.Document) - return TabStripRectangle_Document; - else - return TabStripRectangle_ToolWindow; - } - } - - private Rectangle TabStripRectangle_ToolWindow - { - get - { - Rectangle rect = ClientRectangle; - return new Rectangle(rect.X, rect.Top + ToolWindowStripGapTop, rect.Width, rect.Height - ToolWindowStripGapTop - ToolWindowStripGapBottom); - } - } - - private Rectangle TabStripRectangle_Document - { - get - { - Rectangle rect = ClientRectangle; - return new Rectangle(rect.X, rect.Top + DocumentStripGapTop, rect.Width, rect.Height - DocumentStripGapTop - ToolWindowStripGapBottom); - } - } - - private Rectangle TabsRectangle - { - get - { - if (Appearance == DockPane.AppearanceStyle.ToolWindow) - return TabStripRectangle; - - Rectangle rectWindow = TabStripRectangle; - int x = rectWindow.X; - int y = rectWindow.Y; - int width = rectWindow.Width; - int height = rectWindow.Height; - - x += DocumentTabGapLeft; - width -= DocumentTabGapLeft + - DocumentTabGapRight + - DocumentButtonGapRight + - ButtonClose.Width + - ButtonWindowList.Width + - 2 * DocumentButtonGapBetween; - - return new Rectangle(x, y, width, height); - } - } - - private ContextMenuStrip SelectMenu - { - get { return m_selectMenu; } - } - - private static Bitmap ImageButtonClose - { - get - { - if (m_imageButtonClose == null) - m_imageButtonClose = Resources.DockPane_Close; - - return m_imageButtonClose; - } - } - - private InertButton ButtonClose - { - get - { - if (m_buttonClose == null) - { - m_buttonClose = new InertButton(ImageButtonClose, ImageButtonClose); - m_toolTip.SetToolTip(m_buttonClose, ToolTipClose); - m_buttonClose.Click += new EventHandler(Close_Click); - Controls.Add(m_buttonClose); - } - - return m_buttonClose; - } - } - - private static Bitmap ImageButtonWindowList - { - get - { - if (m_imageButtonWindowList == null) - m_imageButtonWindowList = Resources.DockPane_Option; - - return m_imageButtonWindowList; - } - } - - private static Bitmap ImageButtonWindowListOverflow - { - get - { - if (m_imageButtonWindowListOverflow == null) - m_imageButtonWindowListOverflow = Resources.DockPane_OptionOverflow; - - return m_imageButtonWindowListOverflow; - } - } - - private InertButton ButtonWindowList - { - get - { - if (m_buttonWindowList == null) - { - m_buttonWindowList = new InertButton(ImageButtonWindowList, ImageButtonWindowListOverflow); - m_toolTip.SetToolTip(m_buttonWindowList, ToolTipSelect); - m_buttonWindowList.Click += new EventHandler(WindowList_Click); - Controls.Add(m_buttonWindowList); - } - - return m_buttonWindowList; - } - } - - private static GraphicsPath GraphicsPath - { - get { return VS2005AutoHideStrip.GraphicsPath; } - } - - private IContainer Components - { - get { return m_components; } - } - - public Font TextFont - { - get { return DockPane.DockPanel.Skin.DockPaneStripSkin.TextFont; } - } - - private Font BoldFont - { - get - { - if (IsDisposed) - return null; - - if (m_boldFont == null) - { - m_font = TextFont; - m_boldFont = new Font(TextFont, FontStyle.Bold); - } - else if (m_font != TextFont) - { - m_boldFont.Dispose(); - m_font = TextFont; - m_boldFont = new Font(TextFont, FontStyle.Bold); - } - - return m_boldFont; - } - } - - private int StartDisplayingTab - { - get { return m_startDisplayingTab; } - set - { - m_startDisplayingTab = value; - Invalidate(); - } - } - - private int EndDisplayingTab - { - get { return m_endDisplayingTab; } - set { m_endDisplayingTab = value; } - } - - private int FirstDisplayingTab - { - get { return m_firstDisplayingTab; } - set { m_firstDisplayingTab = value; } - } - - private bool DocumentTabsOverflow - { - set - { - if (m_documentTabsOverflow == value) - return; - - m_documentTabsOverflow = value; - if (value) - ButtonWindowList.ImageCategory = 1; - else - ButtonWindowList.ImageCategory = 0; - } - } - - #region Customizable Properties - - private static int ToolWindowStripGapTop - { - get { return _ToolWindowStripGapTop; } - } - - private static int ToolWindowStripGapBottom - { - get { return _ToolWindowStripGapBottom; } - } - - private static int ToolWindowStripGapLeft - { - get { return _ToolWindowStripGapLeft; } - } - - private static int ToolWindowStripGapRight - { - get { return _ToolWindowStripGapRight; } - } - - private static int ToolWindowImageHeight - { - get { return _ToolWindowImageHeight; } - } - - private static int ToolWindowImageWidth - { - get { return _ToolWindowImageWidth; } - } - - private static int ToolWindowImageGapTop - { - get { return _ToolWindowImageGapTop; } - } - - private static int ToolWindowImageGapBottom - { - get { return _ToolWindowImageGapBottom; } - } - - private static int ToolWindowImageGapLeft - { - get { return _ToolWindowImageGapLeft; } - } - - private static int ToolWindowImageGapRight - { - get { return _ToolWindowImageGapRight; } - } - - private static int ToolWindowTextGapRight - { - get { return _ToolWindowTextGapRight; } - } - - private static int ToolWindowTabSeperatorGapTop - { - get { return _ToolWindowTabSeperatorGapTop; } - } - - private static int ToolWindowTabSeperatorGapBottom - { - get { return _ToolWindowTabSeperatorGapBottom; } - } - - private static string ToolTipClose - { - get - { - if (m_toolTipClose == null) - m_toolTipClose = Strings.DockPaneStrip_ToolTipClose; - return m_toolTipClose; - } - } - - private static string ToolTipSelect - { - get - { - if (m_toolTipSelect == null) - m_toolTipSelect = Strings.DockPaneStrip_ToolTipWindowList; - return m_toolTipSelect; - } - } - - private TextFormatFlags ToolWindowTextFormat - { - get - { - TextFormatFlags textFormat = TextFormatFlags.EndEllipsis | - TextFormatFlags.HorizontalCenter | - TextFormatFlags.SingleLine | - TextFormatFlags.VerticalCenter; - if (RightToLeft == RightToLeft.Yes) - return textFormat | TextFormatFlags.RightToLeft | TextFormatFlags.Right; - else - return textFormat; - } - } - - private static int DocumentStripGapTop - { - get { return _DocumentStripGapTop; } - } - - private static int DocumentStripGapBottom - { - get { return _DocumentStripGapBottom; } - } - - private TextFormatFlags DocumentTextFormat - { - get - { - TextFormatFlags textFormat = TextFormatFlags.EndEllipsis | - TextFormatFlags.SingleLine | - TextFormatFlags.VerticalCenter | - TextFormatFlags.HorizontalCenter; - if (RightToLeft == RightToLeft.Yes) - return textFormat | TextFormatFlags.RightToLeft; - else - return textFormat; - } - } - - private static int DocumentTabMaxWidth - { - get { return _DocumentTabMaxWidth; } - } - - private static int DocumentButtonGapTop - { - get { return _DocumentButtonGapTop; } - } - - private static int DocumentButtonGapBottom - { - get { return _DocumentButtonGapBottom; } - } - - private static int DocumentButtonGapBetween - { - get { return _DocumentButtonGapBetween; } - } - - private static int DocumentButtonGapRight - { - get { return _DocumentButtonGapRight; } - } - - private static int DocumentTabGapTop - { - get { return _DocumentTabGapTop; } - } - - private static int DocumentTabGapLeft - { - get { return _DocumentTabGapLeft; } - } - - private static int DocumentTabGapRight - { - get { return _DocumentTabGapRight; } - } - - private static int DocumentIconGapBottom - { - get { return _DocumentIconGapBottom; } - } - - private static int DocumentIconGapLeft - { - get { return _DocumentIconGapLeft; } - } - - private static int DocumentIconGapRight - { - get { return _DocumentIconGapRight; } - } - - private static int DocumentIconWidth - { - get { return _DocumentIconWidth; } - } - - private static int DocumentIconHeight - { - get { return _DocumentIconHeight; } - } - - private static int DocumentTextGapRight - { - get { return _DocumentTextGapRight; } - } - - private static Pen PenToolWindowTabBorder - { - get { return SystemPens.GrayText; } - } - - private static Pen PenDocumentTabActiveBorder - { - get { return SystemPens.ControlDarkDark; } - } - - private static Pen PenDocumentTabInactiveBorder - { - get { return SystemPens.GrayText; } - } - - #endregion - - #endregion - - public VS2005DockPaneStrip(DockPane pane) - : base(pane) - { - SetStyle(ControlStyles.ResizeRedraw | - ControlStyles.UserPaint | - ControlStyles.AllPaintingInWmPaint | - ControlStyles.OptimizedDoubleBuffer, true); - - SuspendLayout(); - - m_components = new Container(); - m_toolTip = new ToolTip(Components); - m_selectMenu = new ContextMenuStrip(Components); - - ResumeLayout(); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - Components.Dispose(); - if (m_boldFont != null) - { - m_boldFont.Dispose(); - m_boldFont = null; - } - } - base.Dispose(disposing); - } - - protected internal override int MeasureHeight() - { - if (Appearance == DockPane.AppearanceStyle.ToolWindow) - return MeasureHeight_ToolWindow(); - else - return MeasureHeight_Document(); - } - - private int MeasureHeight_ToolWindow() - { - if (DockPane.IsAutoHide || Tabs.Count <= 1) - return 0; - - int height = Math.Max(TextFont.Height, ToolWindowImageHeight + ToolWindowImageGapTop + ToolWindowImageGapBottom) - + ToolWindowStripGapTop + ToolWindowStripGapBottom; - - return height; - } - - private int MeasureHeight_Document() - { - int height = Math.Max(TextFont.Height + DocumentTabGapTop, - ButtonClose.Height + DocumentButtonGapTop + DocumentButtonGapBottom) - + DocumentStripGapBottom + DocumentStripGapTop; - - return height; - } - - protected override void OnPaint(PaintEventArgs e) - { - Rectangle rect = TabsRectangle; - - if (Appearance == DockPane.AppearanceStyle.Document) - { - rect.X -= DocumentTabGapLeft; - - // Add these values back in so that the DockStrip color is drawn - // beneath the close button and window list button. - rect.Width += DocumentTabGapLeft + - DocumentTabGapRight + - DocumentButtonGapRight + - ButtonClose.Width + - ButtonWindowList.Width; - - // It is possible depending on the DockPanel DocumentStyle to have - // a Document without a DockStrip. - if (rect.Width > 0 && rect.Height > 0) - { - Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.StartColor; - Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.EndColor; - LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.LinearGradientMode; - using (LinearGradientBrush brush = new LinearGradientBrush(rect, startColor, endColor, gradientMode)) - { - e.Graphics.FillRectangle(brush, rect); - } - } - } - else - { - if (rect.Width > 0 && rect.Height > 0) - { - Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.StartColor; - Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.EndColor; - LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.LinearGradientMode; - using (LinearGradientBrush brush = new LinearGradientBrush(rect, startColor, endColor, gradientMode)) - { - e.Graphics.FillRectangle(brush, rect); - } - } - } - base.OnPaint(e); - CalculateTabs(); - if (Appearance == DockPane.AppearanceStyle.Document && DockPane.ActiveContent != null) - { - if (EnsureDocumentTabVisible(DockPane.ActiveContent, false)) - CalculateTabs(); - } - - DrawTabStrip(e.Graphics); - } - - protected override void OnRefreshChanges() - { - SetInertButtons(); - Invalidate(); - } - - protected internal override GraphicsPath GetOutline(int index) - { - - if (Appearance == DockPane.AppearanceStyle.Document) - return GetOutline_Document(index); - else - return GetOutline_ToolWindow(index); - - } - - private GraphicsPath GetOutline_Document(int index) - { - Rectangle rectTab = GetTabRectangle(index); - rectTab.X -= rectTab.Height / 2; - rectTab.Intersect(TabsRectangle); - rectTab = RectangleToScreen(DrawHelper.RtlTransform(this, rectTab)); - Rectangle rectPaneClient = DockPane.RectangleToScreen(DockPane.ClientRectangle); - - GraphicsPath path = new GraphicsPath(); - GraphicsPath pathTab = GetTabOutline_Document(Tabs[index], true, true, true); - path.AddPath(pathTab, true); - - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - { - path.AddLine(rectTab.Right, rectTab.Top, rectPaneClient.Right, rectTab.Top); - path.AddLine(rectPaneClient.Right, rectTab.Top, rectPaneClient.Right, rectPaneClient.Top); - path.AddLine(rectPaneClient.Right, rectPaneClient.Top, rectPaneClient.Left, rectPaneClient.Top); - path.AddLine(rectPaneClient.Left, rectPaneClient.Top, rectPaneClient.Left, rectTab.Top); - path.AddLine(rectPaneClient.Left, rectTab.Top, rectTab.Right, rectTab.Top); - } - else - { - path.AddLine(rectTab.Right, rectTab.Bottom, rectPaneClient.Right, rectTab.Bottom); - path.AddLine(rectPaneClient.Right, rectTab.Bottom, rectPaneClient.Right, rectPaneClient.Bottom); - path.AddLine(rectPaneClient.Right, rectPaneClient.Bottom, rectPaneClient.Left, rectPaneClient.Bottom); - path.AddLine(rectPaneClient.Left, rectPaneClient.Bottom, rectPaneClient.Left, rectTab.Bottom); - path.AddLine(rectPaneClient.Left, rectTab.Bottom, rectTab.Right, rectTab.Bottom); - } - return path; - } - - private GraphicsPath GetOutline_ToolWindow(int index) - { - Rectangle rectTab = GetTabRectangle(index); - rectTab.Intersect(TabsRectangle); - rectTab = RectangleToScreen(DrawHelper.RtlTransform(this, rectTab)); - Rectangle rectPaneClient = DockPane.RectangleToScreen(DockPane.ClientRectangle); - - GraphicsPath path = new GraphicsPath(); - GraphicsPath pathTab = GetTabOutline(Tabs[index], true, true); - path.AddPath(pathTab, true); - path.AddLine(rectTab.Left, rectTab.Top, rectPaneClient.Left, rectTab.Top); - path.AddLine(rectPaneClient.Left, rectTab.Top, rectPaneClient.Left, rectPaneClient.Top); - path.AddLine(rectPaneClient.Left, rectPaneClient.Top, rectPaneClient.Right, rectPaneClient.Top); - path.AddLine(rectPaneClient.Right, rectPaneClient.Top, rectPaneClient.Right, rectTab.Top); - path.AddLine(rectPaneClient.Right, rectTab.Top, rectTab.Right, rectTab.Top); - return path; - } - - private void CalculateTabs() - { - if (Appearance == DockPane.AppearanceStyle.ToolWindow) - CalculateTabs_ToolWindow(); - else - CalculateTabs_Document(); - } - - private void CalculateTabs_ToolWindow() - { - if (Tabs.Count <= 1 || DockPane.IsAutoHide) - return; - - Rectangle rectTabStrip = TabStripRectangle; - - // Calculate tab widths - int countTabs = Tabs.Count; - foreach (TabVS2005 tab in Tabs) - { - tab.MaxWidth = GetMaxTabWidth(Tabs.IndexOf(tab)); - tab.Flag = false; - } - - // Set tab whose max width less than average width - bool anyWidthWithinAverage = true; - int totalWidth = rectTabStrip.Width - ToolWindowStripGapLeft - ToolWindowStripGapRight; - int totalAllocatedWidth = 0; - int averageWidth = totalWidth / countTabs; - int remainedTabs = countTabs; - for (anyWidthWithinAverage = true; anyWidthWithinAverage && remainedTabs > 0; ) - { - anyWidthWithinAverage = false; - foreach (TabVS2005 tab in Tabs) - { - if (tab.Flag) - continue; - - if (tab.MaxWidth <= averageWidth) - { - tab.Flag = true; - tab.TabWidth = tab.MaxWidth; - totalAllocatedWidth += tab.TabWidth; - anyWidthWithinAverage = true; - remainedTabs--; - } - } - if (remainedTabs != 0) - averageWidth = (totalWidth - totalAllocatedWidth) / remainedTabs; - } - - // If any tab width not set yet, set it to the average width - if (remainedTabs > 0) - { - int roundUpWidth = (totalWidth - totalAllocatedWidth) - (averageWidth * remainedTabs); - foreach (TabVS2005 tab in Tabs) - { - if (tab.Flag) - continue; - - tab.Flag = true; - if (roundUpWidth > 0) - { - tab.TabWidth = averageWidth + 1; - roundUpWidth--; - } - else - tab.TabWidth = averageWidth; - } - } - - // Set the X position of the tabs - int x = rectTabStrip.X + ToolWindowStripGapLeft; - foreach (TabVS2005 tab in Tabs) - { - tab.TabX = x; - x += tab.TabWidth; - } - } - - private bool CalculateDocumentTab(Rectangle rectTabStrip, ref int x, int index) - { - bool overflow = false; - - TabVS2005 tab = Tabs[index] as TabVS2005; - tab.MaxWidth = GetMaxTabWidth(index); - int width = Math.Min(tab.MaxWidth, DocumentTabMaxWidth); - if (x + width < rectTabStrip.Right || index == StartDisplayingTab) - { - tab.TabX = x; - tab.TabWidth = width; - EndDisplayingTab = index; - } - else - { - tab.TabX = 0; - tab.TabWidth = 0; - overflow = true; - } - x += width; - - return overflow; - } - - /// - /// Calculate which tabs are displayed and in what order. - /// - private void CalculateTabs_Document() - { - if (m_startDisplayingTab >= Tabs.Count) - m_startDisplayingTab = 0; - - Rectangle rectTabStrip = TabsRectangle; - - int x = rectTabStrip.X + rectTabStrip.Height / 2; - bool overflow = false; - - // Originally all new documents that were considered overflow - // (not enough pane strip space to show all tabs) were added to - // the far left (assuming not right to left) and the tabs on the - // right were dropped from view. If StartDisplayingTab is not 0 - // then we are dealing with making sure a specific tab is kept in focus. - if (m_startDisplayingTab > 0) - { - int tempX = x; - TabVS2005 tab = Tabs[m_startDisplayingTab] as TabVS2005; - tab.MaxWidth = GetMaxTabWidth(m_startDisplayingTab); - - // Add the active tab and tabs to the left - for (int i = StartDisplayingTab; i >= 0; i--) - CalculateDocumentTab(rectTabStrip, ref tempX, i); - - // Store which tab is the first one displayed so that it - // will be drawn correctly (without part of the tab cut off) - FirstDisplayingTab = EndDisplayingTab; - - tempX = x; // Reset X location because we are starting over - - // Start with the first tab displayed - name is a little misleading. - // Loop through each tab and set its location. If there is not enough - // room for all of them overflow will be returned. - for (int i = EndDisplayingTab; i < Tabs.Count; i++) - overflow = CalculateDocumentTab(rectTabStrip, ref tempX, i); - - // If not all tabs are shown then we have an overflow. - if (FirstDisplayingTab != 0) - overflow = true; - } - else - { - for (int i = StartDisplayingTab; i < Tabs.Count; i++) - overflow = CalculateDocumentTab(rectTabStrip, ref x, i); - for (int i = 0; i < StartDisplayingTab; i++) - overflow = CalculateDocumentTab(rectTabStrip, ref x, i); - - FirstDisplayingTab = StartDisplayingTab; - } - - if (!overflow) - { - m_startDisplayingTab = 0; - FirstDisplayingTab = 0; - x = rectTabStrip.X + rectTabStrip.Height / 2; - foreach (TabVS2005 tab in Tabs) - { - tab.TabX = x; - x += tab.TabWidth; - } - } - DocumentTabsOverflow = overflow; - } - - protected internal override void EnsureTabVisible(IDockContent content) - { - if (Appearance != DockPane.AppearanceStyle.Document || !Tabs.Contains(content)) - return; - - CalculateTabs(); - EnsureDocumentTabVisible(content, true); - } - - private bool EnsureDocumentTabVisible(IDockContent content, bool repaint) - { - int index = Tabs.IndexOf(content); - TabVS2005 tab = Tabs[index] as TabVS2005; - if (tab.TabWidth != 0) - return false; - - StartDisplayingTab = index; - if (repaint) - Invalidate(); - - return true; - } - - private int GetMaxTabWidth(int index) - { - if (Appearance == DockPane.AppearanceStyle.ToolWindow) - return GetMaxTabWidth_ToolWindow(index); - else - return GetMaxTabWidth_Document(index); - } - - private int GetMaxTabWidth_ToolWindow(int index) - { - IDockContent content = Tabs[index].Content; - Size sizeString = TextRenderer.MeasureText(content.DockHandler.TabText, TextFont); - return ToolWindowImageWidth + sizeString.Width + ToolWindowImageGapLeft - + ToolWindowImageGapRight + ToolWindowTextGapRight; - } - - private int GetMaxTabWidth_Document(int index) - { - IDockContent content = Tabs[index].Content; - - int height = GetTabRectangle_Document(index).Height; - - Size sizeText = TextRenderer.MeasureText(content.DockHandler.TabText, BoldFont, new Size(DocumentTabMaxWidth, height), DocumentTextFormat); - - if (DockPane.DockPanel.ShowDocumentIcon) - return sizeText.Width + DocumentIconWidth + DocumentIconGapLeft + DocumentIconGapRight + DocumentTextGapRight; - else - return sizeText.Width + DocumentIconGapLeft + DocumentTextGapRight; - } - - private void DrawTabStrip(Graphics g) - { - if (Appearance == DockPane.AppearanceStyle.Document) - DrawTabStrip_Document(g); - else - DrawTabStrip_ToolWindow(g); - } - - private void DrawTabStrip_Document(Graphics g) - { - int count = Tabs.Count; - if (count == 0) - return; - - Rectangle rectTabStrip = TabStripRectangle; - - // Draw the tabs - Rectangle rectTabOnly = TabsRectangle; - Rectangle rectTab = Rectangle.Empty; - TabVS2005 tabActive = null; - g.SetClip(DrawHelper.RtlTransform(this, rectTabOnly)); - for (int i = 0; i < count; i++) - { - rectTab = GetTabRectangle(i); - if (Tabs[i].Content == DockPane.ActiveContent) - { - tabActive = Tabs[i] as TabVS2005; - continue; - } - if (rectTab.IntersectsWith(rectTabOnly)) - DrawTab(g, Tabs[i] as TabVS2005, rectTab); - } - - g.SetClip(rectTabStrip); - - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - g.DrawLine(PenDocumentTabActiveBorder, rectTabStrip.Left, rectTabStrip.Top + 1, - rectTabStrip.Right, rectTabStrip.Top + 1); - else - g.DrawLine(PenDocumentTabActiveBorder, rectTabStrip.Left, rectTabStrip.Bottom - 1, - rectTabStrip.Right, rectTabStrip.Bottom - 1); - - g.SetClip(DrawHelper.RtlTransform(this, rectTabOnly)); - if (tabActive != null) - { - rectTab = GetTabRectangle(Tabs.IndexOf(tabActive)); - if (rectTab.IntersectsWith(rectTabOnly)) - DrawTab(g, tabActive, rectTab); - } - } - - private void DrawTabStrip_ToolWindow(Graphics g) - { - Rectangle rectTabStrip = TabStripRectangle; - - g.DrawLine(PenToolWindowTabBorder, rectTabStrip.Left, rectTabStrip.Top, - rectTabStrip.Right, rectTabStrip.Top); - - for (int i = 0; i < Tabs.Count; i++) - DrawTab(g, Tabs[i] as TabVS2005, GetTabRectangle(i)); - } - - private Rectangle GetTabRectangle(int index) - { - if (Appearance == DockPane.AppearanceStyle.ToolWindow) - return GetTabRectangle_ToolWindow(index); - else - return GetTabRectangle_Document(index); - } - - private Rectangle GetTabRectangle_ToolWindow(int index) - { - Rectangle rectTabStrip = TabStripRectangle; - - TabVS2005 tab = (TabVS2005)(Tabs[index]); - return new Rectangle(tab.TabX, rectTabStrip.Y, tab.TabWidth, rectTabStrip.Height); - } - - private Rectangle GetTabRectangle_Document(int index) - { - Rectangle rectTabStrip = TabStripRectangle; - TabVS2005 tab = (TabVS2005)Tabs[index]; - - Rectangle rect = new Rectangle(); - rect.X = tab.TabX; - rect.Width = tab.TabWidth; - rect.Height = rectTabStrip.Height - DocumentTabGapTop; - - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - rect.Y = rectTabStrip.Y + DocumentStripGapBottom; - else - rect.Y = rectTabStrip.Y + DocumentTabGapTop; - - return rect; - } - - private void DrawTab(Graphics g, TabVS2005 tab, Rectangle rect) - { - if (Appearance == DockPane.AppearanceStyle.ToolWindow) - DrawTab_ToolWindow(g, tab, rect); - else - DrawTab_Document(g, tab, rect); - } - - private GraphicsPath GetTabOutline(Tab tab, bool rtlTransform, bool toScreen) - { - if (Appearance == DockPane.AppearanceStyle.ToolWindow) - return GetTabOutline_ToolWindow(tab, rtlTransform, toScreen); - else - return GetTabOutline_Document(tab, rtlTransform, toScreen, false); - } - - private GraphicsPath GetTabOutline_ToolWindow(Tab tab, bool rtlTransform, bool toScreen) - { - Rectangle rect = GetTabRectangle(Tabs.IndexOf(tab)); - if (rtlTransform) - rect = DrawHelper.RtlTransform(this, rect); - if (toScreen) - rect = RectangleToScreen(rect); - - DrawHelper.GetRoundedCornerTab(GraphicsPath, rect, false); - return GraphicsPath; - } - - private GraphicsPath GetTabOutline_Document(Tab tab, bool rtlTransform, bool toScreen, bool full) - { - int curveSize = 6; - - GraphicsPath.Reset(); - Rectangle rect = GetTabRectangle(Tabs.IndexOf(tab)); - if (rtlTransform) - rect = DrawHelper.RtlTransform(this, rect); - if (toScreen) - rect = RectangleToScreen(rect); - - // Draws the full angle piece for active content (or first tab) - if (tab.Content == DockPane.ActiveContent || full || Tabs.IndexOf(tab) == FirstDisplayingTab) - { - if (RightToLeft == RightToLeft.Yes) - { - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - { - // For some reason the next line draws a line that is not hidden like it is when drawing the tab strip on top. - // It is not needed so it has been commented out. - //GraphicsPath.AddLine(rect.Right, rect.Bottom, rect.Right + rect.Height / 2, rect.Bottom); - GraphicsPath.AddLine(rect.Right + rect.Height / 2, rect.Top, rect.Right - rect.Height / 2 + curveSize / 2, rect.Bottom - curveSize / 2); - } - else - { - GraphicsPath.AddLine(rect.Right, rect.Bottom, rect.Right + rect.Height / 2, rect.Bottom); - GraphicsPath.AddLine(rect.Right + rect.Height / 2, rect.Bottom, rect.Right - rect.Height / 2 + curveSize / 2, rect.Top + curveSize / 2); - } - } - else - { - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - { - // For some reason the next line draws a line that is not hidden like it is when drawing the tab strip on top. - // It is not needed so it has been commented out. - //GraphicsPath.AddLine(rect.Left, rect.Top, rect.Left - rect.Height / 2, rect.Top); - GraphicsPath.AddLine(rect.Left - rect.Height / 2, rect.Top, rect.Left + rect.Height / 2 - curveSize / 2, rect.Bottom - curveSize / 2); - } - else - { - GraphicsPath.AddLine(rect.Left, rect.Bottom, rect.Left - rect.Height / 2, rect.Bottom); - GraphicsPath.AddLine(rect.Left - rect.Height / 2, rect.Bottom, rect.Left + rect.Height / 2 - curveSize / 2, rect.Top + curveSize / 2); - } - } - } - // Draws the partial angle for non-active content - else - { - if (RightToLeft == RightToLeft.Yes) - { - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - { - GraphicsPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Top + rect.Height / 2); - GraphicsPath.AddLine(rect.Right, rect.Top + rect.Height / 2, rect.Right - rect.Height / 2 + curveSize / 2, rect.Bottom - curveSize / 2); - } - else - { - GraphicsPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Bottom - rect.Height / 2); - GraphicsPath.AddLine(rect.Right, rect.Bottom - rect.Height / 2, rect.Right - rect.Height / 2 + curveSize / 2, rect.Top + curveSize / 2); - } - } - else - { - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - { - GraphicsPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Top + rect.Height / 2); - GraphicsPath.AddLine(rect.Left, rect.Top + rect.Height / 2, rect.Left + rect.Height / 2 - curveSize / 2, rect.Bottom - curveSize / 2); - } - else - { - GraphicsPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Bottom - rect.Height / 2); - GraphicsPath.AddLine(rect.Left, rect.Bottom - rect.Height / 2, rect.Left + rect.Height / 2 - curveSize / 2, rect.Top + curveSize / 2); - } - } - } - - if (RightToLeft == RightToLeft.Yes) - { - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - { - // Draws the bottom horizontal line (short side) - GraphicsPath.AddLine(rect.Right - rect.Height / 2 - curveSize / 2, rect.Bottom, rect.Left + curveSize / 2, rect.Bottom); - - // Drawing the rounded corner is not necessary. The path is automatically connected - //GraphicsPath.AddArc(new Rectangle(rect.Left, rect.Top, curveSize, curveSize), 180, 90); - } - else - { - // Draws the bottom horizontal line (short side) - GraphicsPath.AddLine(rect.Right - rect.Height / 2 - curveSize / 2, rect.Top, rect.Left + curveSize / 2, rect.Top); - GraphicsPath.AddArc(new Rectangle(rect.Left, rect.Top, curveSize, curveSize), 180, 90); - } - } - else - { - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - { - // Draws the bottom horizontal line (short side) - GraphicsPath.AddLine(rect.Left + rect.Height / 2 + curveSize / 2, rect.Bottom, rect.Right - curveSize / 2, rect.Bottom); - - // Drawing the rounded corner is not necessary. The path is automatically connected - //GraphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Bottom, curveSize, curveSize), 90, -90); - } - else - { - // Draws the top horizontal line (short side) - GraphicsPath.AddLine(rect.Left + rect.Height / 2 + curveSize / 2, rect.Top, rect.Right - curveSize / 2, rect.Top); - - // Draws the rounded corner oppposite the angled side - GraphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Top, curveSize, curveSize), -90, 90); - } - } - - if (Tabs.IndexOf(tab) != EndDisplayingTab && - (Tabs.IndexOf(tab) != Tabs.Count - 1 && Tabs[Tabs.IndexOf(tab) + 1].Content == DockPane.ActiveContent) - && !full) - { - if (RightToLeft == RightToLeft.Yes) - { - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - { - GraphicsPath.AddLine(rect.Left, rect.Bottom - curveSize / 2, rect.Left, rect.Bottom - rect.Height / 2); - GraphicsPath.AddLine(rect.Left, rect.Bottom - rect.Height / 2, rect.Left + rect.Height / 2, rect.Top); - } - else - { - GraphicsPath.AddLine(rect.Left, rect.Top + curveSize / 2, rect.Left, rect.Top + rect.Height / 2); - GraphicsPath.AddLine(rect.Left, rect.Top + rect.Height / 2, rect.Left + rect.Height / 2, rect.Bottom); - } - } - else - { - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - { - GraphicsPath.AddLine(rect.Right, rect.Bottom - curveSize / 2, rect.Right, rect.Bottom - rect.Height / 2); - GraphicsPath.AddLine(rect.Right, rect.Bottom - rect.Height / 2, rect.Right - rect.Height / 2, rect.Top); - } - else - { - GraphicsPath.AddLine(rect.Right, rect.Top + curveSize / 2, rect.Right, rect.Top + rect.Height / 2); - GraphicsPath.AddLine(rect.Right, rect.Top + rect.Height / 2, rect.Right - rect.Height / 2, rect.Bottom); - } - } - } - else - { - // Draw the vertical line opposite the angled side - if (RightToLeft == RightToLeft.Yes) - { - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - GraphicsPath.AddLine(rect.Left, rect.Bottom - curveSize / 2, rect.Left, rect.Top); - else - GraphicsPath.AddLine(rect.Left, rect.Top + curveSize / 2, rect.Left, rect.Bottom); - } - else - { - if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom) - GraphicsPath.AddLine(rect.Right, rect.Bottom - curveSize / 2, rect.Right, rect.Top); - else - GraphicsPath.AddLine(rect.Right, rect.Top + curveSize / 2, rect.Right, rect.Bottom); - } - } - - return GraphicsPath; - } - - private void DrawTab_ToolWindow(Graphics g, TabVS2005 tab, Rectangle rect) - { - Rectangle rectIcon = new Rectangle( - rect.X + ToolWindowImageGapLeft, - rect.Y + rect.Height - 1 - ToolWindowImageGapBottom - ToolWindowImageHeight, - ToolWindowImageWidth, ToolWindowImageHeight); - Rectangle rectText = rectIcon; - rectText.X += rectIcon.Width + ToolWindowImageGapRight; - rectText.Width = rect.Width - rectIcon.Width - ToolWindowImageGapLeft - - ToolWindowImageGapRight - ToolWindowTextGapRight; - - Rectangle rectTab = DrawHelper.RtlTransform(this, rect); - rectText = DrawHelper.RtlTransform(this, rectText); - rectIcon = DrawHelper.RtlTransform(this, rectIcon); - GraphicsPath path = GetTabOutline(tab, true, false); - if (DockPane.ActiveContent == tab.Content) - { - Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.StartColor; - Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.EndColor; - LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.LinearGradientMode; - if(rectTab.Width > 0 && rectTab.Height > 0) - g.FillPath(new LinearGradientBrush(rectTab, startColor, endColor, gradientMode), path); - g.DrawPath(PenToolWindowTabBorder, path); - - Color textColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.TextColor; - TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, textColor, ToolWindowTextFormat); - } - else - { - Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.StartColor; - Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.EndColor; - LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.LinearGradientMode; - if (rectTab.Width > 0 && rectTab.Height > 0) - g.FillPath(new LinearGradientBrush(rectTab, startColor, endColor, gradientMode), path); - - if (Tabs.IndexOf(DockPane.ActiveContent) != Tabs.IndexOf(tab) + 1) - { - Point pt1 = new Point(rect.Right, rect.Top + ToolWindowTabSeperatorGapTop); - Point pt2 = new Point(rect.Right, rect.Bottom - ToolWindowTabSeperatorGapBottom); - g.DrawLine(PenToolWindowTabBorder, DrawHelper.RtlTransform(this, pt1), DrawHelper.RtlTransform(this, pt2)); - } - - Color textColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.TextColor; - TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, textColor, ToolWindowTextFormat); - } - - if (rectTab.Contains(rectIcon)) - g.DrawIcon(new Icon(tab.Content.DockHandler.Icon, new Size(rectIcon.Width, rectIcon.Height)), rectIcon); - } - - private void DrawTab_Document(Graphics g, TabVS2005 tab, Rectangle rect) - { - if (tab.TabWidth == 0) - return; - - Rectangle rectIcon = new Rectangle( - rect.X + DocumentIconGapLeft, - rect.Y + rect.Height - 1 - DocumentIconGapBottom - DocumentIconHeight, - DocumentIconWidth, DocumentIconHeight); - Rectangle rectText = rectIcon; - rectIcon.Y += 1; - if (DockPane.DockPanel.ShowDocumentIcon) - { - rectText.X += rectIcon.Width + DocumentIconGapRight; - rectText.Y = rect.Y; - rectText.Width = rect.Width - rectIcon.Width - DocumentIconGapLeft - - DocumentIconGapRight - DocumentTextGapRight; - rectText.Height = rect.Height; - } - else - rectText.Width = rect.Width - DocumentIconGapLeft - DocumentTextGapRight; - - Rectangle rectTab = DrawHelper.RtlTransform(this, rect); - Rectangle rectBack = DrawHelper.RtlTransform(this, rect); - rectBack.Width += rect.X; - rectBack.X = 0; - - rectText = DrawHelper.RtlTransform(this, rectText); - rectIcon = DrawHelper.RtlTransform(this, rectIcon); - GraphicsPath path = GetTabOutline(tab, true, false); - if (DockPane.ActiveContent == tab.Content) - { - Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.StartColor; - Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.EndColor; - LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.LinearGradientMode; - g.FillPath(new LinearGradientBrush(rectBack, startColor, endColor, gradientMode), path); - g.DrawPath(PenDocumentTabActiveBorder, path); - - Color textColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.TextColor; - if (DockPane.IsActiveDocumentPane) - TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, BoldFont, rectText, textColor, DocumentTextFormat); - else - TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, textColor, DocumentTextFormat); - } - else - { - Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.StartColor; - Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.EndColor; - LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.LinearGradientMode; - g.FillPath(new LinearGradientBrush(rectBack, startColor, endColor, gradientMode), path); - g.DrawPath(PenDocumentTabInactiveBorder, path); - - Color textColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.TextColor; - TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, textColor, DocumentTextFormat); - } - - if (rectTab.Contains(rectIcon) && DockPane.DockPanel.ShowDocumentIcon) - g.DrawIcon(new Icon(tab.Content.DockHandler.Icon, new Size(rectIcon.Width, rectIcon.Height)), rectIcon); - } - - private void WindowList_Click(object sender, EventArgs e) - { - int x = 0; - int y = ButtonWindowList.Location.Y + ButtonWindowList.Height; - - SelectMenu.Items.Clear(); - foreach (TabVS2005 tab in Tabs) - { - IDockContent content = tab.Content; - ToolStripItem item = SelectMenu.Items.Add(content.DockHandler.TabText, content.DockHandler.Icon.ToBitmap()); - item.Tag = tab.Content; - item.Click += new EventHandler(ContextMenuItem_Click); - } - SelectMenu.Show(ButtonWindowList, x, y); - } - - private void ContextMenuItem_Click(object sender, EventArgs e) - { - ToolStripMenuItem item = sender as ToolStripMenuItem; - if (item != null) - { - IDockContent content = (IDockContent)item.Tag; - DockPane.ActiveContent = content; - } - } - - private void SetInertButtons() - { - if (Appearance == DockPane.AppearanceStyle.ToolWindow) - { - if (m_buttonClose != null) - m_buttonClose.Left = -m_buttonClose.Width; - - if (m_buttonWindowList != null) - m_buttonWindowList.Left = -m_buttonWindowList.Width; - } - else - { - ButtonClose.Enabled = DockPane.ActiveContent == null ? true : DockPane.ActiveContent.DockHandler.CloseButton; - m_closeButtonVisible = DockPane.ActiveContent == null ? true : DockPane.ActiveContent.DockHandler.CloseButtonVisible; - ButtonClose.Visible = m_closeButtonVisible; - ButtonClose.RefreshChanges(); - ButtonWindowList.RefreshChanges(); - } - } - - protected override void OnLayout(LayoutEventArgs levent) - { - if (Appearance == DockPane.AppearanceStyle.Document) - { - LayoutButtons(); - OnRefreshChanges(); - } - - base.OnLayout(levent); - } - - private void LayoutButtons() - { - Rectangle rectTabStrip = TabStripRectangle; - - // Set position and size of the buttons - int buttonWidth = ButtonClose.Image.Width; - int buttonHeight = ButtonClose.Image.Height; - int height = rectTabStrip.Height - DocumentButtonGapTop - DocumentButtonGapBottom; - if (buttonHeight < height) - { - buttonWidth = buttonWidth * (height / buttonHeight); - buttonHeight = height; - } - Size buttonSize = new Size(buttonWidth, buttonHeight); - - int x = rectTabStrip.X + rectTabStrip.Width - DocumentTabGapLeft - - DocumentButtonGapRight - buttonWidth; - int y = rectTabStrip.Y + DocumentButtonGapTop; - Point point = new Point(x, y); - ButtonClose.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize)); - - // If the close button is not visible draw the window list button overtop. - // Otherwise it is drawn to the left of the close button. - if (m_closeButtonVisible) - point.Offset(-(DocumentButtonGapBetween + buttonWidth), 0); - - ButtonWindowList.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize)); - } - - private void Close_Click(object sender, EventArgs e) - { - DockPane.CloseActiveContent(); - } - - public override int HitTest(Point ptMouse) - { - if (!TabsRectangle.Contains(ptMouse)) - return -1; - - foreach (Tab tab in Tabs) - { - GraphicsPath path = GetTabOutline(tab, true, false); - if (path.IsVisible(ptMouse)) - return Tabs.IndexOf(tab); - } - return -1; - } - - protected override void OnMouseHover(EventArgs e) - { - int index = HitTest(PointToClient(Control.MousePosition)); - string toolTip = string.Empty; - - base.OnMouseHover(e); - - if (index != -1) - { - TabVS2005 tab = Tabs[index] as TabVS2005; - if (!String.IsNullOrEmpty(tab.Content.DockHandler.ToolTipText)) - toolTip = tab.Content.DockHandler.ToolTipText; - else if (tab.MaxWidth > tab.TabWidth) - toolTip = tab.Content.DockHandler.TabText; - } - - if (m_toolTip.GetToolTip(this) != toolTip) - { - m_toolTip.Active = false; - m_toolTip.SetToolTip(this, toolTip); - m_toolTip.Active = true; - } - - // requires further tracking of mouse hover behavior, - ResetMouseEventArgs(); - } - - protected override void OnRightToLeftChanged(EventArgs e) - { - base.OnRightToLeftChanged(e); - PerformLayout(); - } - } -} \ No newline at end of file diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/VisibleNestedPaneCollection.cs b/renderdocui/3rdparty/WinFormsUI/Docking/VisibleNestedPaneCollection.cs deleted file mode 100644 index 04d9b4677..000000000 --- a/renderdocui/3rdparty/WinFormsUI/Docking/VisibleNestedPaneCollection.cs +++ /dev/null @@ -1,168 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Drawing; -using System.Windows.Forms; - -namespace WeifenLuo.WinFormsUI.Docking -{ - public sealed class VisibleNestedPaneCollection : ReadOnlyCollection - { - private NestedPaneCollection m_nestedPanes; - - internal VisibleNestedPaneCollection(NestedPaneCollection nestedPanes) - : base(new List()) - { - m_nestedPanes = nestedPanes; - } - - public NestedPaneCollection NestedPanes - { - get { return m_nestedPanes; } - } - - public INestedPanesContainer Container - { - get { return NestedPanes.Container; } - } - - public DockState DockState - { - get { return NestedPanes.DockState; } - } - - public bool IsFloat - { - get { return NestedPanes.IsFloat; } - } - - internal void Refresh() - { - Items.Clear(); - for (int i=0; i IndexOf(pane); i--) - { - if (this[i].NestedDockingStatus.PreviousPane == pane) - { - lastNestedPane = this[i]; - break; - } - } - - if (lastNestedPane != null) - { - int indexLastNestedPane = IndexOf(lastNestedPane); - Items.Remove(lastNestedPane); - Items[IndexOf(pane)] = lastNestedPane; - NestedDockingStatus lastNestedDock = lastNestedPane.NestedDockingStatus; - lastNestedDock.SetDisplayingStatus(true, statusPane.DisplayingPreviousPane, statusPane.DisplayingAlignment, statusPane.DisplayingProportion); - for (int i=indexLastNestedPane - 1; i>IndexOf(lastNestedPane); i--) - { - NestedDockingStatus status = this[i].NestedDockingStatus; - if (status.PreviousPane == pane) - status.SetDisplayingStatus(true, lastNestedPane, status.DisplayingAlignment, status.DisplayingProportion); - } - } - else - Items.Remove(pane); - - statusPane.SetDisplayingStatus(false, null, DockAlignment.Left, 0.5); - } - - private void CalculateBounds() - { - if (Count == 0) - return; - - this[0].NestedDockingStatus.SetDisplayingBounds(Container.DisplayingRectangle, Container.DisplayingRectangle, Rectangle.Empty); - - for (int i=1; i - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C75532C4-765B-418E-B09B-46D36B2ABDB1} - Library - Properties - WeifenLuo.WinFormsUI - WeifenLuo.WinFormsUI.Docking - true - dockpanelsuite.snk - False - File - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - bin\Development\ - TRACE - true - pdbonly - AnyCPU - prompt - false - false - - - - - - - - - - - - Component - - - Component - - - Form - - - Component - - - Component - - - Component - - - - - - - Component - - - Component - - - - - Form - - - - - Component - - - - - - UserControl - - - Component - - - Component - - - - Component - - - - Component - - - UserControl - - - Component - - - Component - - - Component - - - - Component - - - Component - - - - - Form - - - - Component - - - - - - Component - - - - - - - - True - True - Resources.resx - - - True - True - Strings.resx - - - - - - - Designer - ResXFileCodeGenerator - Resources.Designer.cs - - - Designer - ResXFileCodeGenerator - Strings.Designer.cs - - - - - Component - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/renderdocui/3rdparty/WinFormsUI/dockpanelsuite.snk b/renderdocui/3rdparty/WinFormsUI/dockpanelsuite.snk deleted file mode 100644 index 39a8b183c..000000000 Binary files a/renderdocui/3rdparty/WinFormsUI/dockpanelsuite.snk and /dev/null differ diff --git a/renderdocui/3rdparty/WinFormsUI/license.txt b/renderdocui/3rdparty/WinFormsUI/license.txt deleted file mode 100644 index 9d7cc5871..000000000 --- a/renderdocui/3rdparty/WinFormsUI/license.txt +++ /dev/null @@ -1,9 +0,0 @@ -The MIT License - -Copyright (c) 2007-2012 Weifen Luo (email: weifenluo@yahoo.com) and other contributors - -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/renderdocui/3rdparty/ironpython/IronPython.Modules.dll b/renderdocui/3rdparty/ironpython/IronPython.Modules.dll deleted file mode 100644 index 6277cbfce..000000000 Binary files a/renderdocui/3rdparty/ironpython/IronPython.Modules.dll and /dev/null differ diff --git a/renderdocui/3rdparty/ironpython/IronPython.Modules.xml b/renderdocui/3rdparty/ironpython/IronPython.Modules.xml deleted file mode 100644 index aa58068c3..000000000 --- a/renderdocui/3rdparty/ironpython/IronPython.Modules.xml +++ /dev/null @@ -1,4510 +0,0 @@ - - - - IronPython.Modules - - - - - Try to convert IList(Of byte) to byte[] without copying, if possible. - - - - - - - Copy the latest data from the memory buffer. - - This won't always contain data, because comrpessed data is only written after a block is filled. - - - - - - Add data to the input buffer. This manipulates the position of the stream - to make it appear to the BZip2 stream that nothing has actually changed. - - The data to append to the buffer. - - - - Reset the BitWriter. - - - - This is useful when the BitWriter writes into a MemoryStream, and - is used by a BZip2Compressor, which itself is re-used for multiple - distinct data blocks. - - - - - - Write some number of bits from the given value, into the output. - - - - The nbits value should be a max of 25, for safety. For performance - reasons, this method does not check! - - - - - - Write a full 8-bit byte into the output. - - - - - Write four 8-bit bytes into the output. - - - - - Write all available byte-aligned bytes. - - - - This method writes no new output, but flushes any accumulated - bits. At completion, the accumulator may contain up to 7 - bits. - - - This is necessary when re-assembling output from N independent - compressors, one for each of N blocks. The output of any - particular compressor will in general have some fragment of a byte - remaining. This fragment needs to be accumulated into the - parent BZip2OutputStream. - - - - - - Writes all available bytes, and emits padding for the final byte as - necessary. This must be the last method invoked on an instance of - BitWriter. - - - - - Delivers the remaining bits, left-aligned, in a byte. - - - - This is valid only if NumRemainingBits is less than 8; - in other words it is valid only after a call to Flush(). - - - - - Knuth's increments seem to work better than Incerpi-Sedgewick here. - Possibly because the number of elems to sort is usually small, typically - <= 20. - - - - BZip2Compressor writes its compressed data out via a BitWriter. This - is necessary because BZip2 does byte shredding. - - - - - Accept new bytes into the compressor data buffer - - - - This method does the first-level (cheap) run-length encoding, and - stores the encoded data into the rle block. - - - - - - Process one input byte into the block. - - - - - To "process" the byte means to do the run-length encoding. - There are 3 possible return values: - - 0 - the byte was not written, in other words, not - encoded into the block. This happens when the - byte b would require the start of a new run, and - the block has no more room for new runs. - - 1 - the byte was written, and the block is not full. - - 2 - the byte was written, and the block is full. - - - - 0 if the byte was not written, non-zero if written. - - - - Append one run to the output block. - - - - - This compressor does run-length-encoding before BWT and etc. This - method simply appends a run to the output block. The append always - succeeds. The return value indicates whether the block is full: - false (not full) implies that at least one additional run could be - processed. - - - true if the block is now full; otherwise false. - - - - Compress the data that has been placed (Run-length-encoded) into the - block. The compressed data goes into the CompressedBytes array. - - - - Side effects: 1. fills the CompressedBytes array. 2. sets the - AvailableBytesOut property. - - - - - This is the most hammered method of this class. - -

- This is the version using unrolled loops. -

-
- - Method "mainQSort3", file "blocksort.c", BZip2 1.0.2 - - - - The number of uncompressed bytes being held in the buffer. - - - - I am thinking this may be useful in a Stream that uses this - compressor class. In the Close() method on the stream it could - check this value to see if anything has been written at all. You - may think the stream could easily track the number of bytes it - wrote, which would eliminate the need for this. But, there is the - case where the stream writes a complete block, and it is full, and - then writes no more. In that case the stream may want to check. - - - - - Array instance identical to sfmap, both are used only - temporarily and independently, so we do not need to allocate - additional memory. - - - - A read-only decorator stream that performs BZip2 decompression on Read. - - - - - Create a BZip2InputStream, wrapping it around the given input Stream. - - - - The input stream will be closed when the BZip2InputStream is closed. - - - The stream from which to read compressed data - - - - Create a BZip2InputStream with the given stream, and - specifying whether to leave the wrapped stream open when - the BZip2InputStream is closed. - - The stream from which to read compressed data - - Whether to leave the input stream open, when the BZip2InputStream closes. - - - - - This example reads a bzip2-compressed file, decompresses it, - and writes the decompressed data into a newly created file. - - - var fname = "logfile.log.bz2"; - using (var fs = File.OpenRead(fname)) - { - using (var decompressor = new Ionic.BZip2.BZip2InputStream(fs)) - { - var outFname = fname + ".decompressed"; - using (var output = File.Create(outFname)) - { - byte[] buffer = new byte[2048]; - int n; - while ((n = decompressor.Read(buffer, 0, buffer.Length)) > 0) - { - output.Write(buffer, 0, n); - } - } - } - } - - - - - - Read data from the stream. - - - - - To decompress a BZip2 data stream, create a BZip2InputStream, - providing a stream that reads compressed data. Then call Read() on - that BZip2InputStream, and the data read will be decompressed - as you read. - - - - A BZip2InputStream can be used only for Read(), not for Write(). - - - - The buffer into which the read data should be placed. - the offset within that data array to put the first byte read. - the number of bytes to read. - the number of bytes actually read - - - - Read a single byte from the stream. - - the byte read from the stream, or -1 if EOF - - - - Flush the stream. - - - - - Calling this method always throws a . - - this is irrelevant, since it will always throw! - this is irrelevant, since it will always throw! - irrelevant! - - - - Calling this method always throws a . - - this is irrelevant, since it will always throw! - - - - Calling this method always throws a . - - this parameter is never used - this parameter is never used - this parameter is never used - - - - Dispose the stream. - - - indicates whether the Dispose method was invoked by user code. - - - - - Close the stream. - - - - - Read n bits from input, right justifying the result. - - - - For example, if you read 1 bit, the result is either 0 - or 1. - - - - The number of bits to read, always between 1 and 32. - - - - Called by createHuffmanDecodingTables() exclusively. - - - Called by recvDecodingTables() exclusively. - - - - Dump the current state of the decompressor, to restore it in case of an error. - This allows the decompressor to be essentially "rewound" and retried when more - data arrives. - - This is only used by IronPython. - - The current state. - - - - Restore the internal compressor state if an error occurred. - - The old state. - - - - Indicates whether the stream can be read. - - - The return value depends on whether the captive stream supports reading. - - - - - Indicates whether the stream supports Seek operations. - - - Always returns false. - - - - - Indicates whether the stream can be written. - - - The return value depends on whether the captive stream supports writing. - - - - - Reading this property always throws a . - - - - - The position of the stream pointer. - - - - Setting this property always throws a . Reading will return the - total number of uncompressed bytes read in. - - - - - Compressor State - - - - Freq table collected to save a pass over the data during - decompression. - - - Initializes the tt array. - - This method is called when the required length of the array is known. - I don't initialize it at construction time to avoid unneccessary - memory allocation when compressing small files. - - - - A write-only decorator stream that compresses data as it is - written using the BZip2 algorithm. - - - - - Constructs a new BZip2OutputStream, that sends its - compressed output to the given output stream. - - - - The destination stream, to which compressed output will be sent. - - - - - This example reads a file, then compresses it with bzip2 file, - and writes the compressed data into a newly created file. - - - var fname = "logfile.log"; - using (var fs = File.OpenRead(fname)) - { - var outFname = fname + ".bz2"; - using (var output = File.Create(outFname)) - { - using (var compressor = new Ionic.BZip2.BZip2OutputStream(output)) - { - byte[] buffer = new byte[2048]; - int n; - while ((n = fs.Read(buffer, 0, buffer.Length)) > 0) - { - compressor.Write(buffer, 0, n); - } - } - } - } - - - - - - Constructs a new BZip2OutputStream with specified blocksize. - - the destination stream. - - The blockSize in units of 100000 bytes. - The valid range is 1..9. - - - - - Constructs a new BZip2OutputStream. - - the destination stream. - - whether to leave the captive stream open upon closing this stream. - - - - - Constructs a new BZip2OutputStream with specified blocksize, - and explicitly specifies whether to leave the wrapped stream open. - - - the destination stream. - - The blockSize in units of 100000 bytes. - The valid range is 1..9. - - - whether to leave the captive stream open upon closing this stream. - - - - - Close the stream. - - - - This may or may not close the underlying stream. Check the - constructors that accept a bool value. - - - - - - Flush the stream. - - - - - Write data to the stream. - - - - - Use the BZip2OutputStream to compress data while writing: - create a BZip2OutputStream with a writable output stream. - Then call Write() on that BZip2OutputStream, providing - uncompressed data as input. The data sent to the output stream will - be the compressed form of the input data. - - - - A BZip2OutputStream can be used only for Write() not for Read(). - - - - - The buffer holding data to write to the stream. - the offset within that data array to find the first byte to write. - the number of bytes to write. - - - - Calling this method always throws a . - - this is irrelevant, since it will always throw! - this is irrelevant, since it will always throw! - irrelevant! - - - - Calling this method always throws a . - - this is irrelevant, since it will always throw! - - - - Calling this method always throws a . - - this parameter is never used - this parameter is never used - this parameter is never used - never returns anything; always throws - - - - The blocksize parameter specified at construction time. - - - - - Indicates whether the stream can be read. - - - The return value is always false. - - - - - Indicates whether the stream supports Seek operations. - - - Always returns false. - - - - - Indicates whether the stream can be written. - - - The return value should always be true, unless and until the - object is disposed and closed. - - - - - Reading this property always throws a . - - - - - The position of the stream pointer. - - - - Setting this property always throws a . Reading will return the - total number of uncompressed bytes written through. - - - - - Computes a CRC-32. The CRC-32 algorithm is parameterized - you - can set the polynomial and enable or disable bit - reversal. This can be used for GZIP, BZip2, or ZIP. - - - This type is used internally by DotNetZip; it is generally not used - directly by applications wishing to create, read, or manipulate zip - archive files. - - - - - Returns the CRC32 for the specified stream. - - The stream over which to calculate the CRC32 - the CRC32 calculation - - - - Returns the CRC32 for the specified stream, and writes the input into the - output stream. - - The stream over which to calculate the CRC32 - The stream into which to deflate the input - the CRC32 calculation - - - - Get the CRC32 for the given (word,byte) combo. This is a - computation defined by PKzip for PKZIP 2.0 (weak) encryption. - - The word to start with. - The byte to combine it with. - The CRC-ized result. - - - - Update the value for the running CRC32 using the given block of bytes. - This is useful when using the CRC32() class in a Stream. - - block of bytes to slurp - starting point in the block - how many bytes within the block to slurp - - - - Process one byte in the CRC. - - the byte to include into the CRC . - - - - Process a run of N identical bytes into the CRC. - - - - This method serves as an optimization for updating the CRC when a - run of identical bytes is found. Rather than passing in a buffer of - length n, containing all identical bytes b, this method accepts the - byte value and the length of the (virtual) buffer - the length of - the run. - - - the byte to include into the CRC. - the number of times that byte should be repeated. - - - - Combines the given CRC32 value with the current running total. - - - This is useful when using a divide-and-conquer approach to - calculating a CRC. Multiple threads can each calculate a - CRC32 on a segment of the data, and then combine the - individual CRC32 values at the end. - - the crc value to be combined with this one - the length of data the CRC value was calculated on - - - - Create an instance of the CRC32 class using the default settings: no - bit reversal, and a polynomial of 0xEDB88320. - - - - - Create an instance of the CRC32 class, specifying whether to reverse - data bits or not. - - - specify true if the instance should reverse data bits. - - - - In the CRC-32 used by BZip2, the bits are reversed. Therefore if you - want a CRC32 with compatibility with BZip2, you should pass true - here. In the CRC-32 used by GZIP and PKZIP, the bits are not - reversed; Therefore if you want a CRC32 with compatibility with - those, you should pass false. - - - - - - Create an instance of the CRC32 class, specifying the polynomial and - whether to reverse data bits or not. - - - The polynomial to use for the CRC, expressed in the reversed (LSB) - format: the highest ordered bit in the polynomial value is the - coefficient of the 0th power; the second-highest order bit is the - coefficient of the 1 power, and so on. Expressed this way, the - polynomial for the CRC-32C used in IEEE 802.3, is 0xEDB88320. - - - specify true if the instance should reverse data bits. - - - - - In the CRC-32 used by BZip2, the bits are reversed. Therefore if you - want a CRC32 with compatibility with BZip2, you should pass true - here for the reverseBits parameter. In the CRC-32 used by - GZIP and PKZIP, the bits are not reversed; Therefore if you want a - CRC32 with compatibility with those, you should pass false for the - reverseBits parameter. - - - - - - Reset the CRC-32 class - clear the CRC "remainder register." - - - - Use this when employing a single instance of this class to compute - multiple, distinct CRCs on multiple, distinct data blocks. - - - - - - Indicates the total number of bytes applied to the CRC. - - - - - Indicates the current CRC for all blocks slurped in. - - - - - A Stream that calculates a CRC32 (a checksum) on all bytes read, - or on all bytes written. - - - - - This class can be used to verify the CRC of a ZipEntry when - reading from a stream, or to calculate a CRC when writing to a - stream. The stream should be used to either read, or write, but - not both. If you intermix reads and writes, the results are not - defined. - - - - This class is intended primarily for use internally by the - DotNetZip library. - - - - - - The default constructor. - - - - Instances returned from this constructor will leave the underlying - stream open upon Close(). The stream uses the default CRC32 - algorithm, which implies a polynomial of 0xEDB88320. - - - The underlying stream - - - - The constructor allows the caller to specify how to handle the - underlying stream at close. - - - - The stream uses the default CRC32 algorithm, which implies a - polynomial of 0xEDB88320. - - - The underlying stream - true to leave the underlying stream - open upon close of the CrcCalculatorStream; false otherwise. - - - - A constructor allowing the specification of the length of the stream - to read. - - - - The stream uses the default CRC32 algorithm, which implies a - polynomial of 0xEDB88320. - - - Instances returned from this constructor will leave the underlying - stream open upon Close(). - - - The underlying stream - The length of the stream to slurp - - - - A constructor allowing the specification of the length of the stream - to read, as well as whether to keep the underlying stream open upon - Close(). - - - - The stream uses the default CRC32 algorithm, which implies a - polynomial of 0xEDB88320. - - - The underlying stream - The length of the stream to slurp - true to leave the underlying stream - open upon close of the CrcCalculatorStream; false otherwise. - - - - A constructor allowing the specification of the length of the stream - to read, as well as whether to keep the underlying stream open upon - Close(), and the CRC32 instance to use. - - - - The stream uses the specified CRC32 instance, which allows the - application to specify how the CRC gets calculated. - - - The underlying stream - The length of the stream to slurp - true to leave the underlying stream - open upon close of the CrcCalculatorStream; false otherwise. - the CRC32 instance to use to calculate the CRC32 - - - - Read from the stream - - the buffer to read - the offset at which to start - the number of bytes to read - the number of bytes actually read - - - - Write to the stream. - - the buffer from which to write - the offset at which to start writing - the number of bytes to write - - - - Flush the stream. - - - - - Seeking is not supported on this stream. This method always throws - - - N/A - N/A - N/A - - - - This method always throws - - - N/A - - - - Closes the stream. - - - - - Gets the total number of bytes run through the CRC32 calculator. - - - - This is either the total number of bytes read, or the total number of - bytes written, depending on the direction of this stream. - - - - - Provides the current CRC for all blocks slurped in. - - - - The running total of the CRC is kept as data is written or read - through the stream. read this property after all reads or writes to - get an accurate CRC for the entire stream. - - - - - - Indicates whether the underlying stream will be left open when the - CrcCalculatorStream is Closed. - - - - Set this at any point before calling . - - - - - - Indicates whether the stream supports reading. - - - - - Indicates whether the stream supports seeking. - - - - Always returns false. - - - - - - Indicates whether the stream supports writing. - - - - - Returns the length of the underlying stream. - - - - - The getter for this property returns the total bytes read. - If you use the setter, it will throw - . - - - - - A write-only decorator stream that compresses data as it is - written using the BZip2 algorithm. This stream compresses by - block using multiple threads. - - - This class performs BZIP2 compression through writing. For - more information on the BZIP2 algorithm, see - . - - - - This class is similar to , - except that this implementation uses an approach that employs multiple - worker threads to perform the compression. On a multi-cpu or multi-core - computer, the performance of this class can be significantly higher than - the single-threaded BZip2OutputStream, particularly for larger streams. - How large? Anything over 10mb is a good candidate for parallel - compression. - - - - The tradeoff is that this class uses more memory and more CPU than the - vanilla BZip2OutputStream. Also, for small files, the - ParallelBZip2OutputStream can be much slower than the vanilla - BZip2OutputStream, because of the overhead associated to using the - thread pool. - - - - - - - Constructs a new ParallelBZip2OutputStream, that sends its - compressed output to the given output stream. - - - - The destination stream, to which compressed output will be sent. - - - - - This example reads a file, then compresses it with bzip2 file, - and writes the compressed data into a newly created file. - - - var fname = "logfile.log"; - using (var fs = File.OpenRead(fname)) - { - var outFname = fname + ".bz2"; - using (var output = File.Create(outFname)) - { - using (var compressor = new Ionic.BZip2.ParallelBZip2OutputStream(output)) - { - byte[] buffer = new byte[2048]; - int n; - while ((n = fs.Read(buffer, 0, buffer.Length)) > 0) - { - compressor.Write(buffer, 0, n); - } - } - } - } - - - - - - Constructs a new ParallelBZip2OutputStream with specified blocksize. - - the destination stream. - - The blockSize in units of 100000 bytes. - The valid range is 1..9. - - - - - Constructs a new ParallelBZip2OutputStream. - - the destination stream. - - whether to leave the captive stream open upon closing this stream. - - - - - Constructs a new ParallelBZip2OutputStream with specified blocksize, - and explicitly specifies whether to leave the wrapped stream open. - - - the destination stream. - - The blockSize in units of 100000 bytes. - The valid range is 1..9. - - - whether to leave the captive stream open upon closing this stream. - - - - - Close the stream. - - - - This may or may not close the underlying stream. Check the - constructors that accept a bool value. - - - - - - Flush the stream. - - - - - Write data to the stream. - - - - - Use the ParallelBZip2OutputStream to compress data while - writing: create a ParallelBZip2OutputStream with a writable - output stream. Then call Write() on that - ParallelBZip2OutputStream, providing uncompressed data as - input. The data sent to the output stream will be the compressed - form of the input data. - - - - A ParallelBZip2OutputStream can be used only for - Write() not for Read(). - - - - - The buffer holding data to write to the stream. - the offset within that data array to find the first byte to write. - the number of bytes to write. - - - - Calling this method always throws a . - - this is irrelevant, since it will always throw! - this is irrelevant, since it will always throw! - irrelevant! - - - - Calling this method always throws a . - - this is irrelevant, since it will always throw! - - - - Calling this method always throws a . - - this parameter is never used - this parameter is never used - this parameter is never used - never returns anything; always throws - - - - The maximum number of concurrent compression worker threads to use. - - - - - This property sets an upper limit on the number of concurrent worker - threads to employ for compression. The implementation of this stream - employs multiple threads from the .NET thread pool, via - ThreadPool.QueueUserWorkItem(), to compress the incoming data by - block. As each block of data is compressed, this stream re-orders the - compressed blocks and writes them to the output stream. - - - - A higher number of workers enables a higher degree of - parallelism, which tends to increase the speed of compression on - multi-cpu computers. On the other hand, a higher number of buffer - pairs also implies a larger memory consumption, more active worker - threads, and a higher cpu utilization for any compression. This - property enables the application to limit its memory consumption and - CPU utilization behavior depending on requirements. - - - - By default, DotNetZip allocates 4 workers per CPU core, subject to the - upper limit specified in this property. For example, suppose the - application sets this property to 16. Then, on a machine with 2 - cores, DotNetZip will use 8 workers; that number does not exceed the - upper limit specified by this property, so the actual number of - workers used will be 4 * 2 = 8. On a machine with 4 cores, DotNetZip - will use 16 workers; again, the limit does not apply. On a machine - with 8 cores, DotNetZip will use 16 workers, because of the limit. - - - - For each compression "worker thread" that occurs in parallel, there is - up to 2mb of memory allocated, for buffering and processing. The - actual number depends on the property. - - - - CPU utilization will also go up with additional workers, because a - larger number of buffer pairs allows a larger number of background - threads to compress in parallel. If you find that parallel - compression is consuming too much memory or CPU, you can adjust this - value downward. - - - - The default value is 16. Different values may deliver better or - worse results, depending on your priorities and the dynamic - performance characteristics of your storage and compute resources. - - - - The application can set this value at any time, but it is effective - only before the first call to Write(), which is when the buffers are - allocated. - - - - - - The blocksize parameter specified at construction time. - - - - - Indicates whether the stream can be read. - - - The return value is always false. - - - - - Indicates whether the stream supports Seek operations. - - - Always returns false. - - - - - Indicates whether the stream can be written. - - - The return value depends on whether the captive stream supports writing. - - - - - Reading this property always throws a . - - - - - The position of the stream pointer. - - - - Setting this property always throws a . Reading will return the - total number of uncompressed bytes written through. - - - - - The total number of bytes written out by the stream. - - - This value is meaningful only after a call to Close(). - - - - - Returns the "random" number at a specific index. - - the index - the random number - - - - Implementes a resource-based meta_path importer as described in PEP 302. - - - - - Instantiates a new meta_path importer using an embedded ZIP resource file. - - - - - - - zip_searchorder defines how we search for a module in the Zip - archive: we first search for a package __init__, then for - non-package .pyc, .pyo and .py entries. The .pyc and .pyo entries - are swapped by initzipimport() if we run in optimized mode. Also, - '/' is replaced by SEP there. - - - - - Given a path to a Zip file and a toc_entry, return the (uncompressed) - data as a new reference. - - - - - - - - Return the code object for the module named by 'fullname' from the - Zip archive as a new reference. - - - - - - - - - - - Given a path to a Zip archive, build a dict, mapping file names - (local to the archive, using SEP as a separator) to toc entries. - - A toc_entry is a tuple: - (__file__, # value to use for __file__, available for all files - compress, # compression kind; 0 for uncompressed - data_size, # size of compressed data on disk - file_size, # size of decompressed data - file_offset, # offset of file header from start of archive - time, # mod time of file (in dos format) - date, # mod data of file (in dos format) - crc, # crc checksum of the data - ) - Directories can be recognized by the trailing SEP in the name, - data_size and file_offset are 0. - - - - - - - Given a (sub)modulename, write the potential file path in the - archive (without extension) to the path buffer. - - - - - - - - Determines the type of module we have (package or module, or not found). - - - - - - - - Provides a StreamContentProvider for a stream of content backed by a file on disk. - - - - - This class represents adler32 checksum algorithm - - - - - This static method returns adler32 checksum of the buffer data - - - - - Implementation of the Deflate compression algorithm. - - - - - Maximum memory level - - - - - Defalult compression method - - - - - Default memory level - - - - - block not completed, need more input or more output - - - - - Block internalFlush performed - - - - - Finish started, need only more output at next deflate - - - - - finish done, accept no more input or output - - - - - preset dictionary flag in zlib header - - - - - The deflate compression method - - - - - The size of the buffer - - - - - repeat previous bit length 3-6 times (2 bits of repeat count) - - - - - repeat a zero length 3-10 times (3 bits of repeat count) - - - - - repeat a zero length 11-138 times (7 bits of repeat count) - - - - - Deflate class congiration table - - - - - Pointer back to this zlib stream - - - - - As the name implies - - - - - Output still pending - - - - - Size of Pending_buf - - - - - Next pending byte to output to the stream - - - - - Number of bytes in the pending buffer - - - - - suppress zlib header and adler32 - - - - - UNKNOWN, BINARY or ASCII - - - - - STORED (for zip only) or DEFLATED - - - - - Value of internalFlush parameter for previous deflate call - - - - - LZ77 Window size (32K by default) - - - - - log2(w_size) (8..16) - - - - - w_size - 1 - - - - - Sliding Window. Input bytes are ReadPos into the second half of the Window, - and move to the first half later to keep a dictionary of at least wSize - bytes. With this organization, matches are limited to a distance of - wSize-MAX_MATCH bytes, but this ensures that IO is always - performed with a length multiple of the block size. Also, it limits - the Window size to 64K, which is quite useful on MSDOS. - To do: use the user input buffer as sliding Window. - - - - - Actual size of Window: 2*wSize, except when the user input buffer is directly used as sliding Window. - - - - - Link to older string with same hash index. To limit the size of this - array to 64K, this link is maintained only for the last 32K strings. - An index in this array is thus a Window index modulo 32K. - - - - - Heads of the hash chains or NIL. - - - - - hash index of string to be inserted - - - - - number of elements in hash table - - - - - log2(hash_size) - - - - - hash_size-1 - - - - - Number of bits by which ins_h must be shifted at each input - step. It must be such that after MIN_MATCH steps, the oldest - byte no longer takes part in the hash key, that is: - hash_shift * MIN_MATCH >= hash_bits - - - - - Window position at the beginning of the current output block. Gets negative when the Window is moved backwards. - - - - - length of best match - - - - - previous match - - - - - set if previous match exists - - - - - start of string to insert - - - - - start of matching string - - - - - number of valid bytes ahead in Window - - - - - Length of the best match at previous step. Matches not greater than this - are discarded. This is used in the lazy match evaluation. - - - - - To speed up deflation, hash chains are never searched beyond this - length. A higher limit improves compression ratio but degrades the speed. - - - - - Attempt to find a better match only when the current match is strictly - smaller than this value. This mechanism is used only for compression - levels >= 4. - - - - - compression level (1..9) - - - - - favor or force Huffman coding - - - - - Use a faster search when the previous match is longer than this - - - - - Stop searching when current match exceeds this - - - - - literal and length tree - - - - - distance tree - - - - - Huffman tree for bit lengths - - - - - Desc for literal tree - - - - - desc for distance tree - - - - - desc for bit length tree - - - - - number of codes at each bit length for an optimal tree - - - - - heap used to build the Huffman trees - - - - - number of elements in the heap - - - - - element of largest frequency - - - - - Depth of each subtree used as tie breaker for trees of equal frequency - - - - - index for literals or lengths - - - - - Size of match buffer for literals/lengths. There are 4 reasons for - limiting lit_bufsize to 64K: - - frequencies can be kept in 16 bit counters - - if compression is not successful for the first block, all input - data is still in the Window so we can still emit a stored block even - when input comes from standard input. (This can also be done for - all blocks if lit_bufsize is not greater than 32K.) - - if compression is not successful for a file smaller than 64K, we can - even emit a stored file instead of a stored block (saving 5 bytes). - This is applicable only for zip (not gzip or zlib). - - creating new Huffman trees less frequently may not provide fast - adaptation to changes in the input data statistics. (Take for - example a binary file with poorly compressible code followed by - a highly compressible string table.) Smaller buffer sizes give - fast adaptation but have of course the overhead of transmitting - trees more frequently. - - I can't count above 4 - - - - - running index in l_buf - - - - - index of pendig_buf - - - - - bit length of current block with optimal trees - - - - - bit length of current block with static trees - - - - - number of string matches in current block - - - - - bit length of EOB code for last block - - - - - Output buffer. bits are inserted starting at the bottom (least - significant bits). - - - - - Number of valid bits in bi_buf. All bits above the last valid bit - are always zero. - - - - - Default constructor - - - - - Initialization - - - - - Initialize the tree data structures for a new zlib stream. - - - - - Initializes block - - - - - Restore the heap property by moving down the tree starting at node k, - exchanging a node with the smallest of its two sons if necessary, stopping - when the heap property is re-established (each father smaller than its - two sons). - - - - - Scan a literal or distance tree to determine the frequencies of the codes - in the bit length tree. - - - - - Construct the Huffman tree for the bit lengths and return the index in - bl_order of the last bit length code to send. - - - - - Send the header for a block using dynamic Huffman trees: the counts, the - lengths of the bit length codes, the literal tree and the distance tree. - IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - - - - - Send a literal or distance tree in compressed form, using the codes in - bl_tree. - - - - - Output a byte on the stream. - IN assertion: there is enough room in Pending_buf. - - - - - Adds a byte to the buffer - - - - - Send one empty static block to give enough lookahead for inflate. - This takes 10 bits, of which 7 may remain in the bit buffer. - The current inflate code requires 9 bits of lookahead. If the - last two codes for the previous block (real code plus EOB) were coded - on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode - the last real code. In this case we send two empty static blocks instead - of one. (There are no problems if the previous block is stored or fixed.) - To simplify the code, we assume the worst case of last real code encoded - on one bit only. - - - - - Save the match info and tally the frequency counts. Return true if - the current block must be flushed. - - - - - Send the block data compressed using the given Huffman trees - - - - - Set the data type to ASCII or BINARY, using a crude approximation: - binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise. - IN assertion: the fields freq of dyn_ltree are set and the total of all - frequencies does not exceed 64K (to fit in an int on 16 bit machines). - - - - - Flush the bit buffer, keeping at most 7 bits in it. - - - - - Flush the bit buffer and align the output on a byte boundary - - - - - Copy a stored block, storing first the length and its - one's complement if requested. - - - - - Flushes block - - - - - Copy without compression as much as possible from the input stream, return - the current block state. - This function does not insert new strings in the dictionary since - uncompressible data is probably not useful. This function is used - only for the level=0 compression option. - NOTE: this function should be optimized to avoid extra copying from - Window to Pending_buf. - - - - - Send a stored block - - - - - Determine the best encoding for the current block: dynamic trees, static - trees or store, and output the encoded block to the zip file. - - - - - Fill the Window when the lookahead becomes insufficient. - Updates strstart and lookahead. - - IN assertion: lookahead less than MIN_LOOKAHEAD - OUT assertions: strstart less than or equal to window_size-MIN_LOOKAHEAD - At least one byte has been ReadPos, or _avail_in == 0; reads are - performed for at least two bytes (required for the zip translate_eol - option -- not supported here). - - - - - Compress as much as possible from the input stream, return the current - block state. - This function does not perform lazy evaluation of matches and inserts - new strings in the dictionary only for unmatched strings or for short - matches. It is used only for the fast compression options. - - - - - Same as above, but achieves better compression. We use a lazy - evaluation for matches: a match is finally adopted only if there is - no better match at the next Window position. - - - - - Finds the longest matching data part - - - - - Deflate algorithm initialization - - ZStream object - Compression level - Window bits - A result code - - - - Initializes deflate algorithm - - ZStream object - Compression level - Operation result result code - - - - Deflate algorithm initialization - - ZStream object - Compression level - Compression method - Window bits - Memory level - Compression strategy - Operation result code - - - - Resets the current state of deflate object - - - - - Finish compression with deflate algorithm - - - - - Sets deflate algorithm parameters - - - - - Sets deflate dictionary - - - - - Performs data compression with the deflate algorithm - - - - - Static constructor initializes config_table - - - - - Compression level - - - - - Number of bytes in the pending buffer - - - - - Output still pending - - - - - Next pending byte to output to the stream - - - - - suppress zlib header and adler32 - - - - - Deflate algorithm configuration parameters class - - - - - reduce lazy search above this match length - - - - - do not perform lazy search above this match length - - - - - quit search above this match length - - - - - Constructor which initializes class inner fields - - - - - current inflate_block mode - - - - - if STORED, bytes left to copy - - - - - table lengths (14 bits) - - - - - index into blens (or border) - - - - - bit lengths of codes - - - - - bit length tree depth - - - - - bit length decoding tree - - - - - if CODES, current state - - - - - true if this block is the last block - - - - - bits in bit buffer - - - - - bit buffer - - - - - single malloc for tree space - - - - - sliding Window - - - - - one byte after sliding Window - - - - - Window ReadPos pointer - - - - - Window WritePos pointer - - - - - need check - - - - - check on output - - - - - Resets this InfBlocks class instance - - - - - Block processing functions - - - - - Frees inner buffers - - - - - Sets dictionary - - - - - Returns true if inflate is currently at the End of a block generated - by Z_SYNC_FLUSH or Z_FULL_FLUSH. - - - - - copy as much as possible from the sliding Window to the output area - - - - - sliding window - - - - - one byte after sliding Window - - - - - Window ReadPos pointer - - - - - Window WritePos pointer - - - - - bits in bit buffer - - - - - bit buffer - - - - - Inflate codes mode - - - - - This class is used by the InfBlocks class - - - - - current inflate_codes mode - - - - - length - - - - - pointer into tree - - - - - current index of the tree - - - - - - - - - - ltree bits decoded per branch - - - - - dtree bits decoded per branch - - - - - literal/length/eob tree - - - - - literal/length/eob tree index - - - - - distance tree - - - - - distance tree index - - - - - Constructor which takes literal, distance trees, corresponding bites decoded for branches, corresponding indexes and a ZStream object - - - - - Constructor which takes literal, distance trees, corresponding bites decoded for branches and a ZStream object - - - - - Block processing method - - An instance of the InfBlocks class - A ZStream object - A result code - - - - Frees allocated resources - - - - - Fast inflate procedure. Called with number of bytes left to WritePos in Window at least 258 - (the maximum string length) and number of input bytes available - at least ten. The ten bytes are six bytes for the longest length/ - distance pair plus four bytes for overloading the bit buffer. - - - - - This enumeration contains modes of inflate processing - - - - - waiting for method byte - - - - - waiting for flag byte - - - - - four dictionary check bytes to go - - - - - three dictionary check bytes to go - - - - - two dictionary check bytes to go - - - - - one dictionary check byte to go - - - - - waiting for inflateSetDictionary - - - - - decompressing blocks - - - - - four check bytes to go - - - - - three check bytes to go - - - - - two check bytes to go - - - - - one check byte to go - - - - - finished check, done - - - - - got an error--stay here - - - - - current inflate mode - - - - - if FLAGS, method byte - - - - - computed check value - - - - - stream check value - - - - - if BAD, inflateSync's marker bytes count - - - - - flag for no wrapper - - - - - log2(Window size) (8..15, defaults to 15) - - - - - current inflate_blocks state - - - - - Resets the Inflate algorithm - - A ZStream object - A result code - - - - Finishes the inflate algorithm processing - - A ZStream object - Operation result code - - - - Initializes the inflate algorithm - - A ZStream object - Window size - Operation result code - - - - Runs inflate algorithm - - A ZStream object - Flush strategy - Operation result code - - - - Sets dictionary for the inflate operation - - A ZStream object - An array of byte - dictionary - Dictionary length - Operation result code - - - - Inflate synchronization - - A ZStream object - Operation result code - - - - Returns true if inflate is currently at the End of a block generated - by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP - implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH - but removes the length bytes of the resulting empty stored block. When - decompressing, PPP checks that at the End of input packet, inflate is - waiting for these length bytes. - - - - - Contains utility information for the InfTree class - - - - - Given a list of code lengths and a maximum table size, make a set of - tables to decode that set of codes. - - Return (int)ZLibResultCode.Z_OK on success, (int)ZLibResultCode.Z_DATA_ERROR if the given code set is incomplete (the tables are still built in this case), (int)ZLibResultCode.Z_DATA_ERROR if the input is invalid (an over-subscribed set of lengths), or (int)ZLibResultCode.Z_DATA_ERROR if not enough memory. - - - - - Build trees - - - - - Builds dynamic trees - - - - - Build fixed trees - - - - - Bit length codes must not exceed MAX_BL_BITS bits - - - - - This class represents a tree and is used in the Deflate class - - - - - The dynamic tree - - - - - Largest code with non zero frequency - - - - - the corresponding static tree - - - - - Mapping from a distance to a distance code. dist is the distance - 1 and - must not have side effects. _dist_code[256] and _dist_code[257] are never - used. - - - - - Compute the optimal bit lengths for a tree and update the total bit length - for the current block. - IN assertion: the fields freq and dad are set, heap[heap_max] and - above are the tree nodes sorted by increasing frequency. - OUT assertions: the field count is set to the optimal bit length, the - array bl_count contains the frequencies for each bit length. - The length opt_len is updated; static_len is also updated if stree is - not null. - - - - - Construct one Huffman tree and assigns the code bit strings and lengths. - Update the total bit length for the current block. - IN assertion: the field freq is set for all tree elements. - OUT assertions: the fields count and code are set to the optimal bit length - and corresponding code. The length opt_len is updated; static_len is - also updated if stree is not null. The field max_code is set. - - - - - Generate the codes for a given tree and bit counts (which need not be - optimal). - IN assertion: the array bl_count contains the bit length statistics for - the given tree and the field count is set for all tree elements. - OUT assertion: the field code is set for all tree elements of non - zero code length. - - - - - Reverse the first count bits of a code, using straightforward code (a faster - method would use a table) - - - - - The dynamic tree - - - - - Largest code with non zero frequency - - - - - the corresponding static tree - - - - - Some constants for specifying compression levels. Methods which takes a compression level as a parameter expects an integer value from 0 to 9. You can either specify an integer value or use constants for some most widely used compression levels. - - - - - No compression should be used at all. - - - - - Minimal compression, but greatest speed. - - - - - Maximum compression, but slowest. - - - - - Select default compression level (good compression, good speed). - - - - - Compression strategies. The strategy parameter is used to tune the compression algorithm. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately. - - - - - This strategy is designed for filtered data. Data which consists of mostly small values, with random distribution should use Z_FILTERED. With this strategy, less string matching is performed. - - - - - Z_HUFFMAN_ONLY forces Huffman encoding only (no string match) - - - - - The default strategy is the most commonly used. With this strategy, string matching and huffman compression are balanced. - - - - - Flush strategies - - - - - Do not internalFlush data, but just write data as normal to the output buffer. This is the normal way in which data is written to the output buffer. - - - - - Obsolete. You should use Z_SYNC_FLUSH instead. - - - - - All pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far. - - - - - All output is flushed as with Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using Z_FULL_FLUSH too often can seriously degrade the compression. ZLib_InflateSync will locate points in the compression string where a full has been performed. - - - - - Notifies the module that the input has now been exhausted. Pending input is processed, pending output is flushed and calls return with Z_STREAM_END if there was enough output space. - - - - - Results of operations in ZLib library - - - - - No failure was encountered, the operation completed without problem. - - - - - No failure was encountered, and the input has been exhausted. - - - - - A preset dictionary is required for decompression of the data. - - - - - An internal error occurred - - - - - The stream structure was inconsistent - - - - - Input data has been corrupted (for decompression). - - - - - Memory allocation failed. - - - - - There was not enough space in the output buffer. - - - - - The version supplied does not match that supported by the ZLib module. - - - - - States of deflate operation - - - - - Data block types, i.e. binary or ascii text - - - - - Helper class - - - - - Max Window size - - - - - preset dictionary flag in zlib header - - - - - The size of the buffer - - - - - Deflate compression method index - - - - - see definition of array dist_code below - - - - - This method returns the literal value received - - The literal to return - The received value - - - - This method returns the literal value received - - The literal to return - The received value - - - - This method returns the literal value received - - The literal to return - The received value - - - - This method returns the literal value received - - The literal to return - The received value - - - - Performs an unsigned bitwise right shift with the specified number - - Number to operate on - Ammount of bits to shift - The resulting number from the shift operation - - - - Performs an unsigned bitwise right shift with the specified number - - Number to operate on - Ammount of bits to shift - The resulting number from the shift operation - - - - Performs an unsigned bitwise right shift with the specified number - - Number to operate on - Ammount of bits to shift - The resulting number from the shift operation - - - - Performs an unsigned bitwise right shift with the specified number - - Number to operate on - Ammount of bits to shift - The resulting number from the shift operation - - - Reads a number of characters from the current source Stream and writes the data to the target array at the specified index. - The source Stream to ReadPos from. - Contains the array of characters ReadPos from the source Stream. - The starting index of the target array. - The maximum number of characters to ReadPos from the source Stream. - The number of characters ReadPos. The number will be less than or equal to count depending on the data available in the source Stream. Returns -1 if the End of the stream is reached. - - - Reads a number of characters from the current source TextReader and writes the data to the target array at the specified index. - The source TextReader to ReadPos from - Contains the array of characteres ReadPos from the source TextReader. - The starting index of the target array. - The maximum number of characters to ReadPos from the source TextReader. - The number of characters ReadPos. The number will be less than or equal to count depending on the data available in the source TextReader. Returns -1 if the End of the stream is reached. - - - - Converts a string to an array of bytes - - The string to be converted - The new array of bytes - - - - Converts an array of bytes to an array of chars - - The array of bytes to convert - The new array of chars - - - - Copies large array which was passed as srcBuf to the Initialize method into the destination array which were passes as destBuff - - The number of bytes copied - - - - ZStream is used to store user data to compress/decompress. - - - - - Maximum memory level - - - - - Next input byte array - - - - - Index of the first byte in the input array. - - - - - Number of bytes available at _next_in - - - - - total nb of input bytes ReadPos so far - - - - - Byte array for the next output block - - - - - Index of the first byte in the _next_out array - - - - - Remaining free space at _next_out - - - - - Total number of bytes in output array - - - - - A string to store operation result message (corresponding to result codes) - - - - - A deflate object to perform data compression - - - - - Inflate object to perform data decompression - - - - - Best guess about the data type: ascii or binary - - - - - A checksum computed with Adler algorithm - - - - - Initializes the internal stream state for decompression. The fields , must be - initialized before by the caller. If is not null and is large - enough (the exact value depends on the compression method), determines the compression - method from the ZLib header and allocates all data structures accordingly; otherwise the allocation will be deferred - to the first call of . - - - inflateInit returns if success, if there was not enough memory, - if the ZLib library version is incompatible with the version assumed by the caller. - is set to null if there is no error message. does not perform any decompression - apart from reading the ZLib header if present: this will be done by . (So and - may be modified, but and are unchanged.) - - - - - This is another version of with an extra parameter. The fields , must be - initialized before by the caller. If is not null and is large enough - (the exact value depends on the compression method), determines the compression method from - the ZLib header and allocates all data structures accordingly; otherwise the allocation will be deferred to the first - call of . - - The windowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer). - It should be in the range 8..15 for this version of the library. The default value is 15 if is used instead. - If a compressed stream with a larger window size is given as input, will return with the error code - instead of trying to allocate a larger window. - - inflateInit returns if success, if there was not enough memory, - if a parameter is invalid (such as a negative memLevel). is set to null - if there is no error message. does not perform any decompression apart from reading the ZLib header - if present: this will be done by . (So and may be modified, - but and are unchanged.) - - - - - This method decompresses as much data as possible, and stops when the input buffer () becomes empty or - the output buffer () becomes full. It may some introduce some output latency (reading input without producing any output) - except when forced to flush. - The detailed semantics are as follows. performs one or both of the following actions: - - - Decompress more input starting at and update and - accordingly. If not all input can be processed (because there is not enough room in the output buffer), is updated and - processing will resume at this point for the next call of . - Provide more output starting at and update and - accordingly. provides as much output as possible, until there is no more input data or no more space in - the output buffer (see below about the parameter). - - - - Flush strategy to use. - - Before the call of , the application should ensure that at least one of the actions is possible, by providing - more input and/or consuming more output, and updating the next_* and avail_* values accordingly. The application can consume the uncompressed - output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of . - If returns and with zero , it must be called again - after making room in the output buffer because there might be more output pending. - If the parameter is set to , flushes - as much output as possible to the output buffer. The flushing behavior of is not specified for values of - the parameter other than and , - but the current implementation actually flushes as much output as possible anyway. - should normally be called until it returns or an error. - However if all decompression is to be performed in a single step (a single call of inflate), the parameter - should be set to . In this case all pending input is processed and all pending output is flushed; - must be large enough to hold all the uncompressed data. (The size of the uncompressed data may have been - saved by the compressor for this purpose.) The next operation on this stream must be to deallocate the decompression - state. The use of is never required, but can be used to inform that a faster - routine may be used for the single call. - If a preset dictionary is needed at this point (see ), sets strm-adler - to the adler32 checksum of the dictionary chosen by the compressor and returns ; otherwise it - sets strm->adler to the adler32 checksum of all output produced so far (that is, bytes) and returns - , or an error code as described below. At the end of the stream, - ) checks that its computed adler32 checksum is equal to that saved by the compressor and returns - only if the checksum is correct. - - - returns if some progress has been made (more input processed or more output produced), - if the end of the compressed data has been reached and all uncompressed output has been produced, - if a preset dictionary is needed at this point, if - the input data was corrupted (input stream not conforming to the ZLib format or incorrect adler32 checksum), - if the stream structure was inconsistent (for example if or - was null), if there was not enough memory, - if no progress is possible or if there was not enough room in the output buffer - when is used. In the case, the application - may then call to look for a good compression block. - - - - - All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any - pending output. - - - inflateEnd returns if success, - if the stream state was inconsistent. In the error case, msg may be set but then points to a static string (which must not be deallocated). - - - - - Skips invalid compressed data until a full flush point (see the description of deflate with Z_FULL_FLUSH) can be found, - or until all available input is skipped. No output is provided. - - - returns if a full flush point has been found, - if no more input was provided, if no flush point has been found, or - if the stream structure was inconsistent. In the success case, the application may save the current - current value of which indicates where valid compressed data was found. In the error case, the application may repeatedly - call , providing more input each time, until success or end of the input data. - - - - - Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of if this call returned . The dictionary chosen by the compressor can be determined from the Adler32 value returned by this call of . The compressor and decompresser must use exactly the same dictionary. - - A byte array - a dictionary. - The length of the dictionary. - - inflateSetDictionary returns if success, if a parameter is invalid (such as null dictionary) or the stream state is inconsistent, if the given dictionary doesn't match the expected one (incorrect Adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of . - - - - - Initializes the internal stream state for compression. - - An integer value from 0 to 9 indicating the desired compression level. - - deflateInit returns if success, if there was not enough memory, - if level is not a valid compression level. is set to null if there is - no error message. does not perform any compression: this will be done by . - - - - - Initializes the internal stream state for compression. - - An integer value from 0 to 9 indicating the desired compression level. - The windowBits parameter is the base two logarithm of the window size (the size of the history buffer). It should be in the - range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage. - The default value is 15 if deflateInit is used instead. - - deflateInit returns if success, if there was not enough memory, - if level is not a valid compression level. is set to null if there - is no error message. does not perform any compression: this will be done by . - - - - - Deflate compresses as much data as possible, and stops when the input buffer becomes empty or the - output buffer becomes full. It may introduce some output latency (reading input without producing any output) - except when forced to flush. - The detailed semantics are as follows. deflate performs one or both of the following actions: - - Compress more input starting at and update and accordingly. - If not all input can be processed (because there is not enough room in the output buffer), and - are updated and processing will resume at this point for the next call of . - Provide more output starting at and update and accordingly. - This action is forced if the parameter flush is non zero. Forcing flush frequently degrades the compression ratio, so this parameter should - be set only when necessary (in interactive applications). Some output may be provided even if flush is not set. - - - - The flush strategy to use. - - - Before the call of , the application should ensure that at least one of the actions is possible, by providing - more input and/or consuming more output, and updating or accordingly ; - should never be zero before the call. The application can consume the compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of . If returns - and with zero , it must be called again after making room in the output buffer because there might be more output pending. - - - If the parameter is set to , all pending output is flushed to the - output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input - data available so far. (In particular is zero after the call if enough output space has been provided before the call.) - Flushing may degrade compression for some compression algorithms and so it should be used only when necessary. - - - If flush is set to , all output is flushed as with , - and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if - random access is desired. Using too often can seriously degrade the compression. - - - - - If deflate returns with == 0, this function must be called again with the same value of the flush - parameter and more output space (updated ), until the flush is complete ( returns with - non-zero ). - - - If the parameter is set to , pending input is processed, pending - output is flushed and deflate returns with if there was enough output space ; - if deflate returns with , this function must be called again with - and more output space (updated ) but no more input data, until it returns with - or an error. After deflate has returned , the only possible operation on the stream is - . - - can be used immediately after if all the compression is to be - done in a single step. In this case, avail_out must be at least 0.1% larger than avail_in plus 12 bytes. If deflate does not return - Z_STREAM_END, then it must be called again as described above. - - - sets strm-> adler to the adler32 checksum of all input read so far (that is, bytes). - - - may update data_type if it can make a good guess about the input data type (Z_ASCII or Z_BINARY). - In doubt, the data is considered binary. This field is only for information purposes and does not affect the compression algorithm in any manner. - - - returns if some progress has been made (more input processed or more output produced), - if all input has been consumed and all output has been produced (only when flush is set to - ), if the stream state was inconsistent (for example if - or was null), if no progress is possible - (for example or was zero). - - - - - - All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending - output. - - - deflateEnd returns if success, if the stream state was inconsistent, - if the stream was freed prematurely (some input or output was discarded). In the error case, - may be set but then points to a static string (which must not be deallocated). - - - - - Dynamically update the compression level and compression strategy. The interpretation of level is as in . - This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data - requiring a different strategy. If the compression level is changed, the input available so far is compressed with the old level - (and may be flushed); the new level will take effect only at the next call of - - An integer value indicating the desired compression level. - A flush strategy to use. - - Before the call of , the stream state must be set as for a call of , since the - currently available input may have to be compressed and flushed. In particular, must be non-zero. - - - deflateParams returns if success, if the source stream - state was inconsistent or if a parameter was invalid, if was zero. - - - - - Initializes the compression dictionary from the given byte sequence without producing any compressed output. This function must be called - immediately after , before any call of . The compressor and decompressor must use - exactly the same dictionary (see ). - - A byte array - a dictionary. - The length of the dictionary byte array - - - The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, - with the most commonly used strings preferably put towards the end of the dictionary. Using a dictionary is most useful when the data - to be compressed is short and can be predicted with good accuracy; the data can then be compressed better than with the default empty dictionary. - - Depending on the size of the compression data structures selected by , a part of the dictionary may - in effect be discarded, for example if the dictionary is larger than the window size in . Thus the strings most likely - to be useful should be put at the end of the dictionary, not at the front. - Upon return of this function, adler is set to the Adler32 value of the dictionary; the decompresser may later use this value to determine - which dictionary has been used by the compressor. (The Adler32 value applies to the whole dictionary even if only a subset of the dictionary - is actually used by the compressor.) - - - deflateSetDictionary returns if success, or if a parameter - is invalid (such as null dictionary) or the stream state is inconsistent (for example if has already been - called for this stream or if the compression method is bsort). does not perform any compression: - this will be done by . - - - - - Flush as much pending output as possible. All output goes through this function so some applications may wish to - modify it to avoid allocating a large buffer and copying into it. - - - - - - Read a new buffer from the current input stream, update the adler32 and total number of bytes read. All input goes - through this function so some applications may wish to modify it to avoid allocating a large buffer and copying from it. - - - - - - Frees all inner buffers. - - - - - Adler-32 value for uncompressed data processed so far. - - - - - Best guess about the data type: ascii or binary - - - - - Gets/Sets the next input byte array. - - - - - Index of the first byte in the input array. - - - - - Gets/Sets the number of bytes available in the input buffer. - - - - - Gets/Sets the total number of bytes in the input buffer. - - - - - Gets/Sets the buffer for the next output data. - - - - - Gets/Sets the index of the first byte in the byte array to write to. - - - - - Gets/Sets the remaining free space in the buffer. - - - - - Gets/Sets the total number of bytes in the output array. - - - - - Gets sets the last error message occurred during class operations. - - - - - A deflate object to perform data compression - - - - - Inflate object to perform data decompression - - - - - Exceptions that occur in ZStream - - - - - Default constructor. - - - - - Constructor which takes one parameter - an error message - - - - - Creates an optimized encoding mapping that can be consumed by an optimized version of charmap_encode. - - - - - Decodes the input string using the provided string mapping. - - - - - Encodes the input string with the specified optimized encoding map. - - - - - Optimied encoding mapping that can be consumed by charmap_encode. - - - - - Provides helper functions which need to be called from generated code to implement various - portions of modules. - - - - - Convert string or bytes into bytes - - - - - Convert most bytearray-like objects into IList of byte - - - - - BytesIO([initializer]) -> object - - Create a buffered I/O implementation using an in-memory bytes - buffer, ready for reading and writing. - - - - - close() -> None. Disable all I/O operations. - - - - - getvalue() -> bytes. - - Retrieve the entire contents of the BytesIO object. - - - - - True if the file is closed. - - - - - Read and decode the next chunk from the buffered reader. Returns true if EOF was - not reached. Places decoded string in _decodedChars. - - - - - Remove all 'b's from mode string to simplify parsing - - - - - Walks the queue calling back to the specified delegate for - each populated index in the queue. - - - - - Throw TypeError with a specified message if object isn't callable. - - - - - Convert object to ushort, throwing ValueError on overflow. - - - - - Interface for "file-like objects" that implement the protocol needed by load() and friends. - This enables the creation of thin wrappers that make fast .NET types and slow Python types look the same. - - - - - Interface for "file-like objects" that implement the protocol needed by dump() and friends. - This enables the creation of thin wrappers that make fast .NET types and slow Python types look the same. - - - - - Call the appropriate reduce method for obj and pickle the object using - the resulting data. Use the first available of - copy_reg.dispatch_table[type(obj)], obj.__reduce_ex__, and obj.__reduce__. - - - - - Pickle the result of a reduce function. - - Only context, obj, func, and reduceCallable are required; all other arguments may be null. - - - - - Write value in pickle decimalnl_short format. - - - - - Write value in pickle float8 format. - - - - - Write value in pickle uint1 format. - - - - - Write value in pickle uint2 format. - - - - - Write value in pickle int4 format. - - - - - Write value in pickle decimalnl_short format. - - - - - Write value in pickle decimalnl_short format. - - - - - Write value in pickle decimalnl_long format. - - - - - Write value in pickle unicodestringnl format. - - - - - Write value in pickle unicodestring4 format. - - - - - Write value in pickle stringnl_noescape_pair format. - - - - - Return true if value is appropriate for formatting in pickle uint1 format. - - - - - Return true if value is appropriate for formatting in pickle uint2 format. - - - - - Return true if value is appropriate for formatting in pickle int4 format. - - - - - Emit a series of opcodes that will set append all items indexed by iter - to the object at the top of the stack. Use APPENDS if possible, but - append no more than BatchSize items at a time. - - - - - Emit a series of opcodes that will set all (key, value) pairs indexed by - iter in the object at the top of the stack. Use SETITEMS if possible, - but append no more than BatchSize items at a time. - - - - - Emit a series of opcodes that will set all (key, value) pairs indexed by - iter in the object at the top of the stack. Use SETITEMS if possible, - but append no more than BatchSize items at a time. - - - - - Find the module for obj and ensure that obj is reachable in that module by the given name. - - Throw PicklingError if any of the following are true: - - The module couldn't be determined. - - The module couldn't be loaded. - - The given name doesn't exist in the module. - - The given name is a different object than obj. - - Otherwise, return the name of the module. - - To determine which module obj lives in, obj.__module__ is used if available. The - module named by obj.__module__ is loaded if needed. If obj has no __module__ - attribute, then each loaded module is searched. If a loaded module has an - attribute with the given name, and that attribute is the same object as obj, - then that module is used. - - - - - Interpret everything from markIndex to the top of the stack as a sequence - of key, value, key, value, etc. Set dict[key] = value for each. Pop - everything from markIndex up when done. - - - - - Used to check the type to see if we can do a comparison. Returns true if we can - or false if we should return NotImplemented. May throw if the type's really wrong. - - - - - Helper function for doing the comparisons. time has no __cmp__ method - - - - - Base class used for iterator wrappers. - - - - - Returns the dialects from the code context. - - - - - - - Populates the given directory w/ the locale information from the given - CultureInfo. - - - - - Error function on real values - - - - - Complementary error function on real values: erfc(x) = 1 - erf(x) - - - - - Gamma function on real values - - - - - Natural log of absolute value of Gamma function - - - - - Checks for the specific permissions, provided by the mode parameter, are available for the provided path. Permissions can be: - - F_OK: Check to see if the file exists - R_OK | W_OK | X_OK: Check for the specific permissions. Only W_OK is respected. - - - - - single instance of environment dictionary is shared between multiple runtimes because the environment - is shared by multiple runtimes. - - - - - lstat(path) -> stat result - Like stat(path), but do not follow symbolic links. - - - - - spawns a new process. - - If mode is nt.P_WAIT then then the call blocks until the process exits and the return value - is the exit code. - - Otherwise the call returns a handle to the process. The caller must then call nt.waitpid(pid, options) - to free the handle and get the exit code of the process. Failure to call nt.waitpid will result - in a handle leak. - - - - - spawns a new process. - - If mode is nt.P_WAIT then then the call blocks until the process exits and the return value - is the exit code. - - Otherwise the call returns a handle to the process. The caller must then call nt.waitpid(pid, options) - to free the handle and get the exit code of the process. Failure to call nt.waitpid will result - in a handle leak. - - - - - spawns a new process. - - If mode is nt.P_WAIT then then the call blocks until the process exits and the return value - is the exit code. - - Otherwise the call returns a handle to the process. The caller must then call nt.waitpid(pid, options) - to free the handle and get the exit code of the process. Failure to call nt.waitpid will result - in a handle leak. - - - - - spawns a new process. - - If mode is nt.P_WAIT then then the call blocks until the process exits and the return value - is the exit code. - - Otherwise the call returns a handle to the process. The caller must then call nt.waitpid(pid, options) - to free the handle and get the exit code of the process. Failure to call nt.waitpid will result - in a handle leak. - - - - - Copy elements from a Python mapping of dict environment variables to a StringDictionary. - - - - - Convert a sequence of args to a string suitable for using to spawn a process. - - - - - Python regular expression module. - - - - - Preparses a regular expression text returning a ParsedRegex class - that can be used for further regular expressions. - - - - - Compiled reg-ex pattern - - - - - Process a sequence of objects that are compatible with ObjectToSocket(). Return two - things as out params: an in-order List of sockets that correspond to the original - objects in the passed-in sequence, and a mapping of these socket objects to their - original objects. - - The socketToOriginal mapping is generated because the CPython select module supports - passing to select either file descriptor numbers or an object with a fileno() method. - We try to be faithful to what was originally requested when we return. - - - - - Return the System.Net.Sockets.Socket object that corresponds to the passed-in - object. obj can be a System.Net.Sockets.Socket, a PythonSocket.SocketObj, a - long integer (representing a socket handle), or a Python object with a fileno() - method (whose result is used to look up an existing PythonSocket.SocketObj, - which is in turn converted to a Socket. - - - - - Convert an object to a 32-bit integer. This adds two features to Converter.ToInt32: - 1. Sign is ignored. For example, 0xffff0000 converts to 4294901760, where Convert.ToInt32 - would throw because 0xffff0000 is less than zero. - 2. Overflow exceptions are thrown. Converter.ToInt32 throws TypeError if x is - an integer, but is bigger than 32 bits. Instead, we throw OverflowException. - - - - - Convert an object to a 16-bit integer. This adds two features to Converter.ToInt16: - 1. Sign is ignored. For example, 0xff00 converts to 65280, where Convert.ToInt16 - would throw because signed 0xff00 is -256. - 2. Overflow exceptions are thrown. Converter.ToInt16 throws TypeError if x is - an integer, but is bigger than 16 bits. Instead, we throw OverflowException. - - - - - Return a standard socket exception (socket.error) whose message and error code come from a SocketException - This will eventually be enhanced to generate the correct error type (error, herror, gaierror) based on the error code. - - - - - Convert an IPv6 address byte array to a string in standard colon-hex notation. - The .NET IPAddress.ToString() method uses dotted-quad for the last 32 bits, - which differs from the normal Python implementation (but is allowed by the IETF); - this method returns the standard (no dotted-quad) colon-hex form. - - - - - Handle conversion of "" to INADDR_ANY and "<broadcast>" to INADDR_BROADCAST. - Otherwise returns host unchanged. - - - - - Return the IP address associated with host, with optional address family checking. - host may be either a name or an IP address (in string form). - - If family is non-null, a gaierror will be thrown if the host's address family is - not the same as the specified family. gaierror is also raised if the hostname cannot be - converted to an IP address (e.g. through a name lookup failure). - - - - - Return the IP address associated with host, with optional address family checking. - host may be either a name or an IP address (in string form). - - If family is non-null, a gaierror will be thrown if the host's address family is - not the same as the specified family. gaierror is also raised if the hostname cannot be - converted to an IP address (e.g. through a name lookup failure). - - - - - Return fqdn, but with its domain removed if it's on the same domain as the local machine. - - - - - Convert a (host, port) tuple [IPv4] (host, port, flowinfo, scopeid) tuple [IPv6] - to its corresponding IPEndPoint. - - Throws gaierror if host is not a valid address. - Throws ArgumentTypeException if any of the following are true: - - address does not have exactly two elements - - address[0] is not a string - - address[1] is not an int - - - - - Convert an IPEndPoint to its corresponding (host, port) [IPv4] or (host, port, flowinfo, scopeid) [IPv6] tuple. - Throws SocketException if the address family is other than IPv4 or IPv6. - - - - - handleToSocket allows us to translate from Python's idea of a socket resource (file - descriptor numbers) to .NET's idea of a socket resource (System.Net.Socket objects). - In particular, this allows the select module to convert file numbers (as returned by - fileno()) and convert them to Socket objects so that it can do something useful with them. - - - - - Return the internal System.Net.Sockets.Socket socket object associated with the given - handle (as returned by GetHandle()), or null if no corresponding socket exists. This is - primarily intended to be used by other modules (such as select) that implement - networking primitives. User code should not normally need to call this function. - - - - - Create a Python socket object from an existing .NET socket object - (like one returned from Socket.Accept()) - - - - - Perform initialization common to all constructors - - - - - Wrapper class for emitting locals/variables during marshalling code gen. - - - - - A wrapper around allocated memory to ensure it gets released and isn't accessed - when it could be finalized. - - - - - Creates a new MemoryHolder and allocates a buffer of the specified size. - - - - - Creates a new MemoryHolder at the specified address which is not tracked - by us and we will never free. - - - - - Creates a new MemoryHolder at the specified address which will keep alive the - parent memory holder. - - - - - Used to track the lifetime of objects when one memory region depends upon - another memory region. For example if you have an array of objects that - each have an element which has it's own lifetime the array needs to keep - the individual elements alive. - - The keys used here match CPython's keys as tested by CPython's test_ctypes. - Typically they are a string which is the array index, "ffffffff" when - from_buffer is used, or when it's a simple type there's just a string - instead of the full dictionary - we store that under the key "str". - - - - - Copies the data in data into this MemoryHolder. - - - - - Copies memory from one location to another keeping the associated memory holders alive during the - operation. - - - - - Gets the address of the held memory. The caller should ensure the MemoryHolder - is always alive as long as the address will continue to be accessed. - - - - - Gets a list of objects which need to be kept alive for this MemoryHolder to be - remain valid. - - - - - Native functions used for exposing ctypes functionality. - - - - - Allocates memory that's zero-filled - - - - - Helper function for implementing memset. Could be more efficient if we - could P/Invoke or call some otherwise native code to do this. - - - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - Provides support for interop with native code from Python code. - - - - - Implementation of our cast function. data is marshalled as a void* - so it ends up as an address. obj and type are marshalled as an object - so we need to unmarshal them. - - - - - Returns a new type which represents a pointer given the existing type. - - - - - Converts an address acquired from PyObj_FromPtr or that has been - marshaled as type 'O' back into an object. - - - - - Converts an object into an opaque address which can be handed out to - managed code. - - - - - Decreases the ref count on an object which has been increased with - Py_INCREF. - - - - - Increases the ref count on an object ensuring that it will not be collected. - - - - - returns address of C instance internal buffer. - - It is the callers responsibility to ensure that the provided instance will - stay alive if memory in the resulting address is to be used later. - - - - - Gets the required alignment of the given type. - - - - - Gets the required alignment of an object. - - - - - Returns a pointer instance for the given CData - - - - - Given a specific size returns a .NET type of the equivalent size that - we can use when marshalling these values across calls. - - - - - Shared helper between struct and union for getting field info and validating it. - - - - - Verifies that the provided bit field settings are valid for this type. - - - - - Shared helper to get the _fields_ list for struct/union and validate it. - - - - - Helper function for translating from memset to NT's FillMemory API. - - - - - Helper function for translating from memset to NT's FillMemory API. - - - - - Emits the marshalling code to create a CData object for reverse marshalling. - - - - - Gets a function which casts the specified memory. Because this is used only - w/ Python API we use a delegate as the return type instead of an actual address. - - - - - Gets the ModuleBuilder used to generate our unsafe call stubs into. - - - - - The enum used for tracking the various ctypes primitive types. - - - - 'c' - - - 'b' - - - 'B' - - - 'h' - - - 'H' - - - 'i' - - - 'I' - - - 'l' - - - 'L' - - - 'f' - - - 'd', 'g' - - - 'q' - - - 'Q' - - - 'O' - - - 'P' - - - 'z' - - - 'Z' - - - 'u' - - - '?' - - - 'v' - - - 'X' - - - - Base class for all ctypes interop types. - - - - - The meta class for ctypes array instances. - - - - - Common functionality that all of the meta classes provide which is part of - our implementation. This is used to implement the serialization/deserialization - of values into/out of memory, emit the marshalling logic for call stubs, and - provide common information (size/alignment) for the types. - - - - - Deserialized the value of this type from the given address at the given - offset. Any new objects which are created will keep the provided - MemoryHolder alive. - - raw determines if the cdata is returned or if the primitive value is - returned. This is only applicable for subtypes of simple cdata types. - - - - - Serializes the provided value into the specified address at the given - offset. - - - - - Gets the .NET type which is used when calling or returning the value - from native code. - - - - - Gets the .NET type which the native type is converted into when going to Python - code. This is usually int, BigInt, double, object, or a CData type. - - - - - Emits marshalling of an object from Python to native code. This produces the - native type from the Python type. - - - - - Emits marshalling from native code to Python code This produces the python type - from the native type. This is used for return values and parameters - to Python callable objects that are passed back out to native code. - - - - - Gets the native size of the type - - - - - Gets the required alignment for the type - - - - - Returns a string which describes the type. Used for _buffer_info implementation which - only exists for testing purposes. - - - - - Converts an object into a function call parameter. - - - - - Creates a new CFuncPtr object from a tuple. The 1st element of the - tuple is the ordinal or function name. The second is an object with - a _handle property. The _handle property is the handle of the module - from which the function will be loaded. - - - - - Creates a new CFuncPtr which calls a COM method. - - - - - Creates a new CFuncPtr with the specfied address. - - - - - Creates a new CFuncPtr with the specfied address. - - - - - we need to keep alive any methods which have arguments for the duration of the - call. Otherwise they could be collected on the finalizer thread before we come back. - - - - - Creates a method for calling with the specified signature. The returned method has a signature - of the form: - - (IntPtr funcAddress, arg0, arg1, ..., object[] constantPool) - - where IntPtr is the address of the function to be called. The arguments types are based upon - the types that the ArgumentMarshaller requires. - - - - - Base class for marshalling arguments from the user provided value to the - call stub. This class provides the logic for creating the call stub and - calling it. - - - - - Emits the IL to get the argument for the call stub generated into - a dynamic method. - - - - - Gets an expression which keeps alive the argument for the duration of the call. - - Returns null if a keep alive is not necessary. - - - - - Gets the expression used to provide the argument. This is the expression - from an incoming DynamicMetaObject. - - - - - Provides marshalling of primitive values when the function type - has no type information or when the user has provided us with - an explicit cdata instance. - - - - - Provides marshalling for when the function type provide argument information. - - - - - Provides marshalling for when the user provides a native argument object - (usually gotten by byref or pointer) and the function type has no type information. - - - - - The meta class for ctypes function pointer instances. - - - - - Converts an object into a function call parameter. - - - - - Fields are created when a Structure is defined and provide - introspection of the structure. - - - - - Called for fields which have been limited to a range of bits. Given the - value for the full type this extracts the individual bits. - - - - - Called for fields which have been limited to a range of bits. Sets the - specified value into the bits for the field. - - - - - The meta class for ctypes pointers. - - - - - Converts an object into a function call parameter. - - - - - Access an instance at the specified address - - - - - The meta class for ctypes simple data types. These include primitives like ints, - floats, etc... char/wchar pointers, and untyped pointers. - - - - - Converts an object into a function call parameter. - - - - - Helper function for reading char/wchar's. This is used for reading from - arrays and pointers to avoid creating lots of 1-char strings. - - - - - Meta class for structures. Validates _fields_ on creation, provides factory - methods for creating instances from addresses and translating to parameters. - - - - - Converts an object into a function call parameter. - - Structures just return themselves. - - - - - If our size/alignment hasn't been initialized then grabs the size/alignment - from all of our base classes. If later new _fields_ are added we'll be - initialized and these values will be replaced. - - - - - Base class for data structures. Subclasses can define _fields_ which - specifies the in memory layout of the values. Instances can then - be created with the initial values provided as the array. The values - can then be accessed from the instance by field name. The value can also - be passed to a foreign C API and the type can be used in other structures. - - class MyStructure(Structure): - _fields_ = [('a', c_int), ('b', c_int)] - - MyStructure(1, 2).a - MyStructure() - - class MyOtherStructure(Structure): - _fields_ = [('c', MyStructure), ('b', c_int)] - - MyOtherStructure((1, 2), 3) - MyOtherStructure(MyStructure(1, 2), 3) - - - - - The meta class for ctypes unions. - - - - - Converts an object into a function call parameter. - - - - - Enum which specifies the format type for a compiled struct - - - - - Struct used to store the format and the number of times it should be repeated. - - - - - Stops execution of Python or other .NET code on the main thread. If the thread is - blocked in native code the thread will be interrupted after it returns back to Python - or other .NET code. - - - - - Provides a dictionary storage implementation whose storage is local to - the thread. - - - - - Represents the date components that we found while parsing the date. Used for zeroing out values - which have different defaults from CPython. Currently we only know that we need to do this for - the year. - - - - - Samples on how to subtype built-in types from C# - - - - - an int variable for demonstration purposes - - - - - an int variable for demonstration purposes - - - - - Returns a new callable object with the provided initial set of arguments - bound to it. Calling the new function then appends to the additional - user provided arguments. - - - - - Creates a new partial object with the provided positional arguments. - - - - - Creates a new partial object with the provided positional and keyword arguments. - - - - - Calls func with the previously provided arguments and more positional arguments. - - - - - Calls func with the previously provided arguments and more positional arguments and keyword arguments. - - - - - Operator method to set arbitrary members on the partial object. - - - - - Operator method to get additional arbitrary members defined on the partial object. - - - - - Operator method to delete arbitrary members defined in the partial object. - - - - - Gets the function which will be called - - - - - Gets the initially provided positional arguments. - - - - - Gets the initially provided keyword arguments or None. - - - - - Gets or sets the dictionary used for storing extra attributes on the partial object. - - - - - BER encoding of an integer value is the number of bytes - required to represent the integer followed by the bytes - - - - - Duplicates a subprocess handle which was created for piping. - - This is only called when we're duplicating the handle to make it inheritable to the child process. In CPython - the parent handle is always reliably garbage collected. Because we know this handle is not going to be - used we close the handle being duplicated. - - - - - Special hash function because IStructuralEquatable.GetHashCode is not allowed to throw. - - - - - Special equals because none of the special cases in Ops.Equals - are applicable here, and the reference equality check breaks some tests. - - - - - gets the object or throws a reference exception - - - - - Special equality function because IStructuralEquatable.Equals is not allowed to throw. - - - - - gets the object or throws a reference exception - - - - - Special equality function because IStructuralEquatable.Equals is not allowed to throw. - - - - - Returns the underlying .NET RegistryKey - - - -
-
diff --git a/renderdocui/3rdparty/ironpython/IronPython.dll b/renderdocui/3rdparty/ironpython/IronPython.dll deleted file mode 100644 index 35a05a81d..000000000 Binary files a/renderdocui/3rdparty/ironpython/IronPython.dll and /dev/null differ diff --git a/renderdocui/3rdparty/ironpython/IronPython.xml b/renderdocui/3rdparty/ironpython/IronPython.xml deleted file mode 100644 index 89a6fde8e..000000000 --- a/renderdocui/3rdparty/ironpython/IronPython.xml +++ /dev/null @@ -1,7569 +0,0 @@ - - - - IronPython - - - - - Creates a method frame for tracking purposes and enforces recursion - - - - - Removes the frames from generated code for when we're compiling the tracing delegate - which will track the frames it's self. - - - - - Returns true if the node can throw, false otherwise. Used to determine - whether or not we need to update the current dynamic stack info. - - - - - A temporary variable to track if the current line number has been emitted via the fault update block. - - For example consider: - - try: - raise Exception() - except Exception, e: - # do something here - raise - - At "do something here" we need to have already emitted the line number, when we re-raise we shouldn't add it - again. If we handled the exception then we should have set the bool back to false. - - We also sometimes directly check _lineNoUpdated to avoid creating this unless we have nested exceptions. - - - - - A temporary variable to track the current line number - - - - - Fake ScopeStatement for FunctionCode's to hold on to after we have deserialized pre-compiled code. - - - - - Gets or creates the FunctionCode object for this FunctionDefinition. - - - - - Gets the expression for updating the dynamic stack trace at runtime when an - exception is thrown. - - - - - Gets the expression for the actual updating of the line number for stack traces to be available - - - - - Wraps the body of a statement which should result in a frame being available during - exception handling. This ensures the line number is updated as the stack is unwound. - - - - - The variable used to hold out parents closure tuple in our local scope. - - - - - Gets the expression associated with the local CodeContext. If the function - doesn't have a local CodeContext then this is the global context. - - - - - True if this scope accesses a variable from an outer scope. - - - - - True if an inner scope is accessing a variable defined in this scope. - - - - - True if we are forcing the creation of a dictionary for storing locals. - - This occurs for calls to locals(), dir(), vars(), unqualified exec, and - from ... import *. - - - - - True if variables can be set in a late bound fashion that we don't - know about at code gen time - for example via from foo import *. - - This is tracked independently of the ContainsUnqualifiedExec/NeedsLocalsDictionary - - - - - Variables that are bound in an outer scope - but not a global scope - - - - - Variables that are bound to the global scope - - - - - Variables that are referred to from a nested scope and need to be - promoted to cells. - - - - - Provides a place holder for the expression which represents - a FunctionCode. For functions/classes this gets updated after - the AST has been generated because the FunctionCode needs to - know about the tree which gets generated. For modules we - immediately have the value because it always comes in as a parameter. - - - - - Reducible node so that re-writing for profiling does not occur until - after the script code has been completed and is ready to be compiled. - - Without this extra node profiling would force reduction of the node - and we wouldn't have setup our constant access correctly yet. - - - - - A global allocator that puts all of the globals into an array access. The array is an - array of PythonGlobal objects. We then just close over the array for any inner functions. - - Once compiled a RuntimeScriptCode is produced which is closed over the entire execution - environment. - - - - - Specifies the compilation mode which will be used during the AST transformation - - - - - Compilation will proceed in a manner in which the resulting AST can be serialized to disk. - - - - - Compilation will use a type and declare static fields for globals. The resulting type - is uncollectible and therefore extended use of this will cause memory leaks. - - - - - Compilation will use an array for globals. The resulting code will be fully collectible - and once all references are released will be collected. - - - - - Compilation will force all global accesses to do a full lookup. This will also happen for - any unbound local references. This is the slowest form of code generation and is only - used for exec/eval code where we can run against an arbitrary dictionary. - - - - - Implements globals which are backed by a static type, followed by an array if the static types' slots become full. The global - variables are stored in static fields on a type for fast access. The type also includes fields for constants and call sites - so they can be accessed much fasetr. - - We don't generate any code into the type though - DynamicMethod's are much faster for code gen then normal ref emit. - - - Implements globals which are backed by a static type, followed by an array if the static types' slots become full. The global - variables are stored in static fields on a type for fast access. The type also includes fields for constants and call sites - so they can be accessed much fasetr. - - We don't generate any code into the type though - DynamicMethod's are much faster for code gen then normal ref emit. - - - - Ensures the underlying array is long enough to accomodate the given index - The context storage type corresponding to the given index - - - Ensures the underlying array is long enough to accomodate the given index - The constant storage type corresponding to the given index - - - Ensures the underlying array is long enough to accomodate the given index - The global storage type corresponding to the given index - - - Ensures the underlying array is long enough to accomodate the given index - The site storage type corresponding to the given index - - - - Not used. - - - - - Not used. - - - - - PythonWalker class - The Python AST Walker (default result is true) - - - - - Not an actual node. We don't create this, but it's here for compatibility. - - - - - Interface used to mark objects which contain a dictionary of custom attributes that shadow - their existing attributes in a dynamic fashion. - - - - - Ensures that a non-null IDictionary instance is created for CustomAttributes and - returns it. - - - - - Meta-object which allows IPythonExpandable objects to behave like Python objects in their - ability to dynamically add and remove new or existing custom attributes, generally shadowing - existing built-in members. - - Getting: Member accesses first consult the object's CustomAttributes dictionary, then fall - through to the underlying object. - - Setting: Values can be bound to any member name, shadowing any existing attributes except - public non-PythonHidden fields and properties, which will bypass the dictionary. Thus, - it is possible for SetMember to fail, for example if the property is read-only or of - the wrong type. - - Deleting: Any member represented in the dictionary can be deleted, re-exposing the - underlying member if it exists. Any other deletions will fail. - - - - - Provides a way for the binder to provide a custom error message when lookup fails. Just - doing this for the time being until we get a more robust error return mechanism. - - - - - Provides a way for the binder to provide a custom error message when lookup fails. Just - doing this for the time being until we get a more robust error return mechanism. - - - - - Gets the PythonBinder associated with tihs CodeContext - - - - - Performs .NET member resolution. This looks within the given type and also - includes any extension members. Base classes and their extension members are - not searched. - - - - - Performs .NET member resolution. This looks within the given type and also - includes any extension members. Base classes and their extension members are - not searched. - - This version allows PythonType's for protected member resolution. It shouldn't - be called externally for other purposes. - - - - - Performs .NET member resolution. This looks the type and any base types - for members. It also searches for extension members in the type and any base types. - - - - - Gets the member names which are defined in this type and any extension members. - - This search does not include members in any subtypes or their extension members. - - - - - Gets the member names which are defined in the type and any subtypes. - - This search includes members in the type and any subtypes as well as extension - types of the type and its subtypes. - - - - - Creates the initial table of extension types. These are standard extension that we apply - to well known .NET types to make working with them better. Being added to this table does - not make a type a Python type though so that it's members are generally accessible w/o an - import clr and their type is not re-named. - - - - - Creates a table of standard .NET types which are also standard Python types. These types have a standard - set of extension types which are shared between all runtimes. - - - - - Event handler for when our domain manager has an assembly loaded by the user hosting the script - runtime. Here we can gather any information regarding extension methods. - - Currently DLR-style extension methods become immediately available w/o an explicit import step. - - - - - Provides a cache from Type/name -> PythonTypeSlot and also allows access to - all members (and remembering whether all members are cached). - - - - - Writes to a cache the result of a type lookup. Null values are allowed for the slots and they indicate that - the value does not exist. - - - - - Looks up a cached type slot for the specified member and type. This may return true and return a null slot - that indicates - that a cached result for a member which doesn't exist has been stored. Otherwise it returns true if a slot is found or - false if it is not. - - - - - Looks up a cached member group for the specified member and type. This may return true and return a null group - that indicates - that a cached result for a member which doesn't exist has been stored. Otherwise it returns true if a group is found or - false if it is not. - - - - - Checks to see if all members have been populated for the provided type. - - - - - Populates the type with all the provided members and marks the type - as being fully cached. - - The dictionary is used for the internal storage and should not be modified after - providing it to the cache. - - - - - Returns an enumerable object which provides access to all the members of the provided type. - - The caller must check that the type is fully cached and populate the cache if it isn't before - calling this method. - - - - - Implements a built-in module which is instanced per PythonContext. - - Implementers can subclass this type and then have a module which has efficient access - to internal state (this doesn't need to go through PythonContext.GetModuleState). These - modules can also declare module level globals which they'd like to provide efficient - access to by overloading GetGlobalVariableNames. When Initialize is called these - globals are provided and can be cached in the instance for fast global access. - - Just like normal static modules these modules are registered with the PythonModuleAttribute. - - - - - Initializes the module for it's first usage. By default this calls PerformModuleReload with the - the dictionary. - - The CodeContext for the module. - A list of globals which have optimize access. Contains at least all of the global variables reutrned by GetGlobalVariableNames. - - - - Gets a list of variable names which should have optimized storage (instances of PythonGlobal objects). - The module receives the global objects during the Initialize call and can hold onto them for - direct access to global members. - - - - - Called when the user attempts to reload() on your module and by the base class Initialize method. - - This provides an opportunity to allocate any per-module data which is not simply function definitions. - - A common usage here is to create exception objects which are allocated by the module using PythonExceptions.CreateSubType. - - - - - Provides access to the PythonContext which this module was created for. - - - - - Provides access to the CodeContext for the module. Returns null before Initialize() is called. - - - - - Copy on write constant dictionary storage used for dictionaries created with constant items. - - - - - Abstract base class for all PythonDictionary storage. - - Defined as a class instead of an interface for performance reasons. Also not - using IDictionary* for keeping a simple interface. - - Full locking is defined as being on the DictionaryStorage object it's self, - not an internal member. This enables subclasses to provide their own locking - aruond large operations and call lock free functions. - - - - - Adds items from this dictionary into the other dictionary - - - - - Provides fast access to the __path__ attribute if the dictionary storage supports caching it. - - - - - Provides fast access to the __package__ attribute if the dictionary storage supports caching it. - - - - - Provides fast access to the __builtins__ attribute if the dictionary storage supports caching it. - - - - - Provides fast access to the __name__ attribute if the dictionary storage supports caching it. - - - - - Provides fast access to the __import__ attribute if the dictionary storage supports caching it. - - - - - Provides more specific type information for Python dictionaries which are not strongly typed. - - This attribute can be applied to fields, parameters, proeprties, and return values. It can be - inspected to get type information about the types of the keys and values of the expected - dictionary or the returned dictionary. - - - - - Adapts an IDictionary[object, object] for use as a PythonDictionary used for - our debug frames. Also hides the special locals which start with $. - - - - - An interface that is implemented on DynamicMetaObjects. - - This allows objects to opt-into custom conversions when calling - COM APIs. The IronPython binders all call this interface before - doing any COM binding. - - - - - Captures and flows the state of executing code from the generated - Python code into the IronPython runtime. - - - - - Creates a new CodeContext which is backed by the specified Python dictionary. - - - - - Attempts to lookup the provided name in this scope or any outer scope. - - - - - Looks up a global variable. If the variable is not defined in the - global scope then built-ins is consulted. - - - - - Attempts to lookup the variable in the local scope. - - - - - Removes a variable from the local scope. - - - - - Sets a variable in the local scope. - - - - - Gets a variable from the global scope. - - - - - Sets a variable in the global scope. - - - - - Removes a variable from the global scope. - - - - - Returns the dictionary associated with __builtins__ if one is - set or null if it's not available. If __builtins__ is a module - the module's dictionary is returned. - - - - - Gets the module state for top-level code. - - - - - Gets the DLR scope object that corresponds to the global variables of this context. - - - - - Gets the PythonContext which created the CodeContext. - - - - - Gets the dictionary for the global variables from the ModuleContext. - - - - - True if this global context should display CLR members on shared types (for example .ToString on int/bool/etc...) - - False if these attributes should be hidden. - - - - - Gets the dictionary used for storage of local variables. - - - - - Marks a type so that IronPython will not expose the IEnumerable interface out as - __iter__ - - - - - ArgBuilder which provides the CodeContext parameter to a method. - - - - - Small reducable node which just fetches the value from a ClosureCell - object. Like w/ global variables the compiler recognizes these on - sets and turns them into assignments on the python global object. - - - - - Creates the storage for the closure cell. If this is a closure over a parameter it - captures the initial incoming parameter value. - - - - - Reduces the closure cell to a read of the value stored in the cell. - - - - - Assigns a value to the closure cell. - - - - - Removes the current value from the closure cell. - - - - - Gets the expression which points at the closure cell. - - - - - The original expression for the incoming parameter if this is a parameter closure. Otherwise - the value is null. - - - - - Gets the PythonVariable for which this closure expression was created. - - - - - Tracking for variables lifted into closure objects. Used to store information in a function - about the outer variables it accesses. - - - - - When finding a yield return or yield break, this rewriter flattens out - containing blocks, scopes, and expressions with stack state. All - scopes encountered have their variables promoted to the generator's - closure, so they survive yields. - - - - - Spills the right side into a temp, and replaces it with its temp. - Returns the expression that initializes the temp. - - - - - Makes an assignment to this variable. Pushes the assignment as far - into the right side as possible, to allow jumps into it. - - - - - Accesses the property of a tuple. The node can be created first and then the tuple and index - type can be filled in before the tree is actually generated. This enables creation of these - nodes before the tuple type is actually known. - - - - - Represents code which can be lazily compiled. - - The code is created in an AST which provides the Expression of T and - whether or not the code should be interpreted. For non-pre compiled - scenarios the code will not be compiled until the 1st time it is run. - - For pre-compiled scenarios the code is IExpressionSerializable and will - turn into a normal pre-compiled method. - - - - - Marks a type so that IronPython will not expose types which have GetMemberNames - as having a __dir__ method. - - Also suppresses __dir__ on something which implements IDynamicMetaObjectProvider - but is not an IPythonObject. - - - - - Marks a type so that IronPython will not expose the ICollection interface out as - __len__. - - - - - Marks a type so that IronPython will not expose the IDisposable interface out as - __enter__ and __exit__ methods of a context manager. - - - - - Marks a type so that IronPython will not expose the IEnumerable interface out as - __contains__ - - - - - Singleton used for dictionaries which contain no items. - - - - - Represents the set of extension methods which are loaded into a module. - - This set is immutable (as far the external viewer is considered). When a - new extension method set is loaded into a module we create a new ExtensionMethodsSet object. - - Multiple modules which have the same set of extension methods use the same set. - - - - - Returns all of the extension methods with the given name. - - - - - Returns all of the extension methods which are applicable for the given type. - - - - - Tracks the extension types that are loaded for a given assembly. - - We can have either types, namespaces, or a full assembly added as a reference. - - When the user just adds types we just add them to the type hash set. - - When the user adds namespaces we add them to the namespaces hashset. On the - next lookup we'll lazily load the types from that namespace and put them in Types. - - When the user adds assemblies we set the value to the NotYetLoadedButFullAssembly - value. The next load request will load the types from that namespace and put them - in Types. When we do that we'll mark the assembly as FullyLoaded so we don't - have to go through that again if the user adds a namespace. - - - - - Return a copy of this tuple's data array. - - - - - ModuleDictionaryStorage for a built-in module which is bound to a specific instance. - - These modules don't need to use PythonContext.GetModuleState() for storage and therefore - can provide efficient access to internal variables. They can also cache PythonGlobal - objects and provide efficient access to module globals. - - To the end user these modules appear just like any other module. These modules are - implemented by subclassing the BuiltinPythonModule class. - - - - - Enables lazy initialization of module dictionaries. - - - - - Gets all of the extra names and values stored in the dictionary. - - - - - Attemps to sets a value in the extra keys. Returns true if the value is set, false if - the value is not an extra key. - - - - - Attempts to get a value from the extra keys. Returns true if the value is an extra - key and has a value. False if it is not an extra key or doesn't have a value. - - - - - Attempts to remove the key. Returns true if the key is removed, false - if the key was not removed, or null if the key is not an extra key. - - - - - A TypeSlot is an item that gets stored in a type's dictionary. Slots provide an - opportunity to customize access at runtime when a value is get or set from a dictionary. - - - - - Gets the value stored in the slot for the given instance binding it to an instance if one is provided and - the slot binds to instances. - - - - - Sets the value of the slot for the given instance. - - true if the value was set, false if it can't be set - - - - Deletes the value stored in the slot from the instance. - - true if the value was deleted, false if it can't be deleted - - - - Gets an expression which is used for accessing this slot. If the slot lookup fails the error expression - is used again. - - The default implementation just calls the TryGetValue method. Subtypes of PythonTypeSlot can override - this and provide a more optimal implementation. - - - - - True if generating code for gets can result in more optimal accesses. - - - - - True if TryGetValue will always succeed, false if it may fail. - - This is used to optimize away error generation code. - - - - - Defines the internal interface used for accessing weak references and adding finalizers - to user-defined types. - - - - - Gets the current WeakRefTracker for an object that can be used to - append additional weak references. - - - - - Attempts to set the WeakRefTracker for an object. Used on the first - addition of a weak ref tracker to an object. If the object doesn't - support adding weak references then it returns false. - - - - - Sets a WeakRefTracker on an object for the purposes of supporting finalization. - All user types (new-style and old-style) support finalization even if they don't - support weak-references, and therefore this function always succeeds. Note the - slot used to store the WeakRefTracker is still shared between SetWeakRef and - SetFinalizer if a type supports both. - - - - - - Provides a list of all the members of an instance. ie. all the keys in the - dictionary of the object. Note that it can contain objects that are not strings. - - Such keys can be added in IronPython using syntax like: - obj.__dict__[100] = someOtherObject - - This Python specific version also supports filtering based upon the show cls - flag by flowing in the code context. - - - - - Validates that the current self object is usable for this method. - - - - - Marks a class as being hidden from the Python hierarchy. This is applied to the base class - and then all derived types will not see the base class in their hierarchy and will not be - able to access members declaredo on the base class. - - - - - Provides more specific type information for Python lists which are not strongly typed. - - This attribute can be applied to fields, parameters, proeprties, and return values. It can be - inspected to get type information about the types of the values of the expected - list or the returned list. - - - - - Captures the globals and other state of module code. - - - - - Creates a new ModuleContext which is backed by the specified dictionary. - - - - - Creates a new ModuleContext for the specified module. - - - - - Initializes __builtins__ for the module scope. - - - - - Gets the dictionary used for the global variables in the module - - - - - Gets the language context which created this module. - - - - - Gets the DLR Scope object which is associated with the modules dictionary. - - - - - Gets the global CodeContext object which is used for execution of top-level code. - - - - - Gets the module object which this code is executing in. - - This module may or may not be published in sys.modules. For user defined - code typically the module gets published at the start of execution. But if - this ModuleContext is attached to a Scope, or if we've just created a new - module context for executing code it will not be in sys.modules. - - - - - Gets the features that code has been compiled with in the module. - - - - - Gets or sets whether code running in this context should display - CLR members (for example .ToString on objects). - - - - - Cached global value. Created and maintained on a per-language basis. Default - implementation returns a singleton which indicates caching is not occuring. - - - - - Creates a new ModuleGlobalCache with the specified value. - - - - - Event handler for when the value has changed. Language implementors should call this when - the cached value is invalidated. - - - - - True if the ModuleGlobalCache is participating in a caching strategy. - - - - - True if there is currently a value associated with this global variable. False if - it is currently unassigned. - - - - - Gets or sets the current cached value - - - - - Enable true division (1/2 == .5) - - - - - Indicates that .NET methods such as .ToString should be available on Python objects. - - - - - Indicates that the module should be generated in an optimal form which will result - in it being uncollectable. - - - - - Indicates when the module should be executed immedatiately upon creation. - - - - - Enable usage of the with statement - - - - - Enable absolute imports - - - - - Indiciates that __builtins__ should not be set in the module - - - - - Indiciates that when the module is initialized it should set __builtins__ to the __builtin__ module - instead of the __builtin__ dictionary. - - - - - Marks code as being created for exec, eval. Code generated this way will - be capable of running against different scopes and will do lookups at runtime - for free global variables. - - - - - Indiciates that the first line of code should be skipped. - - - - - Enable usage of print as a function for better compatibility with Python 3.0. - - - - - Forces the code to be interpreted rather than compiled - - - - - String Literals should be parsed as Unicode strings - - - - - Include comments in the parse tree - - - - - Generated code should support light exceptions - - - - - Manages the acquisition of profiling data for a single ScriptRuntime - - - - - Get the unique Profiler instance for this ScriptRuntime - - - - - Given a MethodBase, return an index into the array of perf data. Treat each - CLR method as unique. - - - - - Given the unique name of something we're profiling, return an index into the array of perf data. - - - - - Add a new profiler entry. Not all names are unique. - - - - - Gets the current summary of profile data - - - - - Resets the current summary of profile data back to zero - - - - - Adds profiling calls to a Python method. - Calculates both the time spent only in this method - - - - - Wraps a call to a MethodInfo with profiling capture for that MethodInfo - - - - - Encapsulates profiler data to return to clients - - - - - Marks that this built-in method should be treated as external by the profiler. - When placed on a call emitted into a Python method, all the time spent in this - call will still show up in its parent's inclusive time, but will not be - part of its exclusive time. - - - - - Gets the closure tuple from our parent context. - - - - - PythonWalkerNonRecursive class - The Python AST Walker (default result is false) - - - - - Pulls the closure tuple from our function/generator which is flowed into each function call. - - - - - Returns an expression which creates the function object. - - - - - Creates the LambdaExpression which is the actual function body. - - - - - Creates the LambdaExpression which implements the body of the function. - - The functions signature is either "object Function(PythonFunction, ...)" - where there is one object parameter for each user defined parameter or - object Function(PythonFunction, object[]) for functions which take more - than PythonCallTargets.MaxArgs arguments. - - - - - Determines delegate type for the Python function - - - - - Scope for the comprehension. Because scopes are usually statements and comprehensions are expressions - this doesn't actually show up in the AST hierarchy and instead hangs off the comprehension expression. - - - - - Provides globals for when we need to lookup into a dictionary for each global access. - - This is the slowest form of globals and is only used when we need to run against an - arbitrary dictionary given to us by a user. - - - - - Provides a wrapper around "dynamic" expressions which we've opened coded (for optimized code generation). - - This lets us recognize both normal Dynamic and our own Dynamic expressions and apply the combo binder on them. - - - - - A ScriptCode which can be saved to disk. We only create this when called via - the clr.CompileModules API. This ScriptCode does not support running. - - - - - Parameter base class - - - - - Position of the parameter: 0-based index - - - - - Parameter name - - - - - Top-level ast for all Python code. Typically represents a module but could also - be exec or eval code. - - - - - Creates a new PythonAst without a body. ParsingFinished should be called afterwards to set - the body. - - - - - Called when parsing is complete, the body is built, the line mapping and language features are known. - - This is used in conjunction with the constructor which does not take a body. It enables creating - the outer most PythonAst first so that nodes can always have a global parent. This lets an un-bound - tree to still provide it's line information immediately after parsing. When we set the location - of each node during construction we also set the global parent. When we name bind the global - parent gets replaced with the real parent ScopeStatement. - - a mapping of where each line begins - The body of code - The language features which were set during parsing. - - - - Binds an AST and makes it capable of being reduced and compiled. Before calling Bind an AST cannot successfully - be reduced. - - - - - Creates a variable at the global level. Called for known globals (e.g. __name__), - for variables explicitly declared global by the user, and names accessed - but not defined in the lexical scope. - - - - - Reduces the PythonAst to a LambdaExpression of type Type. - - - - - Returns a ScriptCode object for this PythonAst. The ScriptCode object - can then be used to execute the code against it's closed over scope or - to execute it against a different scope. - - - - - Rewrites the tree for performing lookups against globals instead of being bound - against the optimized scope. This is used if the user compiles optimied code and then - runs it against a different scope. - - - - - True division is enabled in this AST. - - - - - True if the with statement is enabled in this AST. - - - - - True if absolute imports are enabled - - - - - True if this is on-disk code which we don't really have an AST for. - - - - - Represents a reference to a name. A PythonReference is created for each name - referred to in a scope (global, class, or function). - - - - - True if the user provided a step parameter (either providing an explicit parameter - or providing an empty step parameter) false if only start and stop were provided. - - - - - The statements under the try-block. - - - - - Array of except (catch) blocks associated with this try. NULL if there are no except blocks. - - - - - The body of the optional Else block for this try. NULL if there is no Else block. - - - - - The body of the optional finally associated with this try. NULL if there is no finally block. - - - - - Transform multiple python except handlers for a try block into a single catch body. - - The variable for the exception in the catch block. - Null if there are no except handlers. Else the statement to go inside the catch handler - - - - Surrounds the body of an except block w/ the appropriate code for maintaining the traceback. - - - - - True iff there is a path in control flow graph on which the variable is used before initialized (assigned or deleted). - - - - - True iff the variable is referred to from the inner scope. - - - - - Local variable. - - Local variables can be referenced from nested lambdas - - - - - Parameter to a LambdaExpression - - Like locals, they can be referenced from nested lambdas - - - - - Global variable - - Should only appear in global (top level) lambda. - - - - - WithStatement is translated to the DLR AST equivalent to - the following Python code snippet (from with statement spec): - - mgr = (EXPR) - exit = mgr.__exit__ # Not calling it yet - value = mgr.__enter__() - exc = True - try: - VAR = value # Only if "as VAR" is present - BLOCK - except: - # The exceptional case is handled here - exc = False - if not exit(*sys.exc_info()): - raise - # The exception is swallowed if exit() returns true - finally: - # The normal and non-local-goto cases are handled here - if exc: - exit(None, None, None) - - - - - - A ScriptCode which has been loaded from an assembly which is saved on disk. - - - - - Creates a fake PythonAst object which is represenative of the on-disk script code. - - - - - Base class for all of our fast get delegates. This holds onto the - delegate and provides the Update function. - - - - - Updates the call site when the current rule is no longer applicable. - - - - - Base class for all of our fast set delegates. This holds onto the - delegate and provides the Update and Optimize functions. - - - - - Updates the call site when the current rule is no longer applicable. - - - - - Provides cached global variable for modules to enable optimized access to - module globals. Both the module global value and the cached value can be held - onto and the cached value can be invalidated by the providing LanguageContext. - - The cached value is provided by the LanguageContext.GetModuleCache API. - - - - - Small reducable node which just fetches the value from a PythonGlobal - object. The compiler recognizes these on sets and turns them into - assignments on the python global object. - - - - - Represents a script code which can be dynamically bound to execute against - arbitrary Scope objects. This is used for code when the user runs against - a particular scope as well as for exec and eval code as well. It is also - used when tracing is enabled. - - - - - Represents a script code which can be consumed at runtime as-is. This code has - no external dependencies and is closed over its scope. - - - - - Helper class for implementing the Python class. - - This is exposed as a service through PythonEngine and the helper class - uses this service to get the correct remoting semantics. - - - - - Returns an ObjectHandle to a delegate of type Action[Action] which calls the current - command dispatcher. - - - - - Marks that the return value of a function might include NotImplemented. - - This is added to an operator method to ensure that all necessary methods are called - if one cannot guarantee that it can perform the comparison. - - - - - Provides support for emitting warnings when built in methods are invoked at runtime. - - - - - Backwards compatible Convert for the old sites that need to flow CodeContext - - - - - Creates a new InvokeBinder which will call with positional splatting. - - The signature of the target site should be object(function), object[], retType - - - - - - - Creates a new InvokeBinder which will call with positional and keyword splatting. - - The signature of the target site should be object(function), object[], dictionary, retType - - - - - Fallback action for performing an invoke from Python. We translate the - CallSignature which supports splatting position and keyword args into - their expanded form. - - - - - Gets the PythonContext which the CallSiteBinder is associated with. - - - - - Fallback action for performing a new() on a foreign IDynamicMetaObjectProvider. used - when call falls back. - - - - - Python's Invoke is a non-standard action. Here we first try to bind through a Python - internal interface (IPythonInvokable) which supports CallSigantures. If that fails - and we have an IDO then we translate to the DLR protocol through a nested dynamic site - - this includes unsplatting any keyword / position arguments. Finally if it's just a plain - old .NET type we use the default binder which supports CallSignatures. - - - - - Interface used to mark objects as being invokable from Python. These objects support - calling with splatted positional and keyword arguments. - - - - - Provides binding logic which is implemented to follow various Python protocols. This includes - things such as calling __call__ to perform calls, calling __nonzero__/__len__ to convert to - bool, calling __add__/__radd__ to do addition, etc... - - This logic gets shared between both the IDynamicMetaObjectProvider implementation for Python objects as well - as the Python sites. This ensures the logic we follow for our builtin types and user defined - types is identical and properly conforming to the various protocols. - - - - - Gets a MetaObject which converts the provided object to a bool using __nonzero__ or __len__ - protocol methods. This code is shared between both our fallback for a site and our MetaObject - for user defined objects. - - - - - Used for conversions to bool - - - - - Creates a rule for the contains operator. This is exposed via "x in y" in - IronPython. It is implemented by calling the __contains__ method on x and - passing in y. - - If a type doesn't define __contains__ but does define __getitem__ then __getitem__ is - called repeatedly in order to see if the object is there. - - For normal .NET enumerables we'll walk the iterator and see if it's present. - - - - - Helper to handle a comparison operator call. Checks to see if the call can - return NotImplemented and allows the caller to modify the expression that - is ultimately returned (e.g. to turn __cmp__ into a bool after a comparison) - - - - - calls __coerce__ for old-style classes and performs the operation if the coercion is successful. - - - - - Makes the comparison rule which returns an int (-1, 0, 1). TODO: Better name? - - - - - Python has three protocols for slicing: - Simple Slicing x[i:j] - Extended slicing x[i,j,k,...] - Long Slice x[start:stop:step] - - The first maps to __*slice__ (get, set, and del). - This takes indexes - i, j - which specify the range of elements to be - returned. In the slice variants both i, j must be numeric data types. - The 2nd and 3rd are both __*item__. - This receives a single index which is either a Tuple or a Slice object (which - encapsulates the start, stop, and step values) - - This is in addition to a simple indexing x[y]. - - For simple slicing and long slicing Python generates Operators.*Slice. For - the extended slicing and simple indexing Python generates a Operators.*Item - action. - - Extended slicing maps to the normal .NET multi-parameter input. - - So our job here is to first determine if we're to call a __*slice__ method or - a __*item__ method. - - - - - Helper to convert all of the arguments to their known types. - - - - - Gets the arguments that need to be provided to __*item__ when we need to pass a slice object. - - - - - Helper to get the symbols for __*item__ and __*slice__ based upon if we're doing - a get/set/delete and the minimum number of arguments required for each of those. - - - - - Checks if a coercion check should be performed. We perform coercion under the following - situations: - 1. Old instances performing a binary operator (excluding rich comparisons) - 2. User-defined new instances calling __cmp__ but only if we wouldn't dispatch to a built-in __coerce__ on the parent type - - This matches the behavior of CPython. - - - - - - Produces an error message for the provided message and type names. The error message should contain - string formatting characters ({0}, {1}, etc...) for each of the type names. - - - - - Delegate for finishing the comparison. This takes in a condition and a return value and needs to update the ConditionalBuilder - with the appropriate resulting body. The condition may be null. - - - - - Base class for calling indexers. We have two subclasses that target built-in functions and user defined callable objects. - - The Callable objects get handed off to ItemBuilder's which then call them with the appropriate arguments. - - - - - Creates a new CallableObject. If BuiltinFunction is available we'll create a BuiltinCallable otherwise - we create a SlotCallable. - - - - - Gets the arguments in a form that should be used for extended slicing. - - Python defines that multiple tuple arguments received (x[1,2,3]) get - packed into a Tuple. For most .NET methods we just want to expand - this into the multiple index arguments. For slots and old-instances - we want to pass in the tuple - - - - - Adds the target of the call to the rule. - - - - - Subclass of Callable for a built-in function. This calls a .NET method performing - the appropriate bindings. - - - - - Callable to a user-defined callable object. This could be a Python function, - a class defining __call__, etc... - - - - - Base class for building a __*item__ or __*slice__ call. - - - - - Derived IndexBuilder for calling __*slice__ methods - - - - - Derived IndexBuilder for calling __*item__ methods. - - - - - Common helpers used by the various binding logic. - - - - - Tries to get the BuiltinFunction for the given name on the type of the provided MetaObject. - - Succeeds if the MetaObject is a BuiltinFunction or BuiltinMethodDescriptor. - - - - - Gets the best CallSignature from a MetaAction. - - The MetaAction should be either a Python InvokeBinder, or a DLR InvokeAction or - CreateAction. For Python we can use a full-fidelity - - - - - - - Transforms an invoke member into a Python GetMember/Invoke. The caller should - verify that the given attribute is not resolved against a normal .NET class - before calling this. If it is a normal .NET member then a fallback InvokeMember - is preferred. - - - - - Determines if the type associated with the first MetaObject is a subclass of the - type associated with the second MetaObject. - - - - - Adds a try/finally which enforces recursion limits around the target method. - - - - - Helper to do fallback for Invoke's so we can handle both StandardAction and Python's - InvokeBinder. - - - - - Converts arguments into a form which can be used for COM interop. - - The argument is only converted if we have an IronPython specific - conversion when calling COM methods. - - - - - Converts a single argument into a form which can be used for COM - interop. - - The argument is only converted if we have an IronPython specific - conversion when calling COM methods. - - - - - Builds up a series of conditionals when the False clause isn't yet known. We can - keep appending conditions and if true's. Each subsequent true branch becomes the - false branch of the previous condition and body. Finally a non-conditional terminating - branch must be added. - - - - - Adds a new conditional and body. The first call this becomes the top-level - conditional, subsequent calls will have it added as false statement of the - previous conditional. - - - - - Adds a new condition to the last added body / condition. - - - - - Adds the non-conditional terminating node. - - - - - Gets the resulting meta object for the full body. FinishCondition - must have been called. - - - - - Adds a variable which will be scoped at the level of the final expression. - - - - - Returns true if no conditions have been added - - - - - Returns true if a final, non-conditional, body has been added. - - - - - Creates a target which creates a new dynamic method which contains a single - dynamic site that invokes the callable object. - - TODO: This should be specialized for each callable object - - - - - Various helpers related to calling Python __*__ conversion methods - - - - - Helper for falling back - if we have a base object fallback to it first (which can - then fallback to the calling site), otherwise fallback to the calling site. - - - - - Helper for falling back - if we have a base object fallback to it first (which can - then fallback to the calling site), otherwise fallback to the calling site. - - - - - Checks to see if this type has __getattribute__ that overrides all other attribute lookup. - - This is more complex then it needs to be. The problem is that when we have a - mixed new-style/old-style class we have a weird __getattribute__ defined. When - we always dispatch through rules instead of PythonTypes it should be easy to remove - this. - - - - - Looks up the associated PythonTypeSlot from the object. Indicates if the result - came from a standard .NET type in which case we will fallback to the sites binder. - - - - - Helper for falling back - if we have a base object fallback to it first (which can - then fallback to the calling site), otherwise fallback to the calling site. - - - - - Helper for falling back - if we have a base object fallback to it first (which can - then fallback to the calling site), otherwise fallback to the calling site. - - - - - Provides the lookup logic for resolving a Python object. Subclasses - provide the actual logic for producing the binding result. Currently - there are two forms of the binding result: one is the DynamicMetaObject - form used for non-optimized bindings. The other is the Func of CallSite, - object, CodeContext, object form which is used for fast binding and - pre-compiled rules. - - - - - GetBinder which produces a DynamicMetaObject. This binder always - successfully produces a DynamicMetaObject which can perform the requested get. - - - - - Makes a rule which calls a user-defined __getattribute__ function and falls back to __getattr__ if that - raises an AttributeError. - - slot is the __getattribute__ method to be called. - - - - - Checks a range of the MRO to perform old-style class lookups if any old-style classes - are present. We will call this twice to produce a search before a slot and after - a slot. - - - - - Helper for falling back - if we have a base object fallback to it first (which can - then fallback to the calling site), otherwise fallback to the calling site. - - - - - Custom dynamic site kinds for simple sites that just take a fixed set of parameters. - - - - - Unary operator. - - Gets various documentation about the object returned as a string - - - - - Unary operator. - - Gets information about the type of parameters, returned as a string. - - - - - Unary operator. - - Checks whether the object is callable or not, returns true if it is. - - - - - Binary operator. - - Checks to see if the instance contains another object. Returns true or false. - - - - - Unary operator. - - Returns the number of items stored in the object. - - - - - Binary operator. - - Compares two instances returning an integer indicating the relationship between them. May - throw if the object types are uncomparable. - - - - - Binary operator. - - Returns both the dividend and quotioent of x / y. - - - - - Unary operator. - - Get the absolute value of the instance. - - - - - Unary operator. - - Gets the positive value of the instance. - - - - - Unary operator. - - Negates the instance and return the new value. - - - - - Unary operator. - - Returns the ones complement of the instance. - - - - - Unary operator. - - Boolean negation - - - - - Unary operator. - - Negation, returns object - - - - - Get enumerator for iteration binder. Returns a KeyValuePair<IEnumerator, IDisposable> - - The IEnumerator is used for iteration. The IDisposable is provided if the object was an - IEnumerable or IEnumerable<T> and is a disposable object. - - - - Operator for performing add - - - Operator for performing sub - - - Operator for performing pow - - - Operator for performing mul - - - Operator for performing floordiv - - - Operator for performing div - - - Operator for performing truediv - - - Operator for performing mod - - - Operator for performing lshift - - - Operator for performing rshift - - - Operator for performing and - - - Operator for performing or - - - Operator for performing xor - - - Operator for performing lt - - - Operator for performing gt - - - Operator for performing le - - - Operator for performing ge - - - Operator for performing eq - - - Operator for performing ne - - - Operator for performing lg - - - Operator for performing in-place add - - - Operator for performing in-place sub - - - Operator for performing in-place pow - - - Operator for performing in-place mul - - - Operator for performing in-place floordiv - - - Operator for performing in-place div - - - Operator for performing in-place truediv - - - Operator for performing in-place mod - - - Operator for performing in-place lshift - - - Operator for performing in-place rshift - - - Operator for performing in-place and - - - Operator for performing in-place or - - - Operator for performing in-place xor - - - Operator for performing reverse add - - - Operator for performing reverse sub - - - Operator for performing reverse pow - - - Operator for performing reverse mul - - - Operator for performing reverse floordiv - - - Operator for performing reverse div - - - Operator for performing reverse truediv - - - Operator for performing reverse mod - - - Operator for performing reverse lshift - - - Operator for performing reverse rshift - - - Operator for performing reverse and - - - Operator for performing reverse or - - - Operator for performing reverse xor - - - Operator for performing reverse divmod - - - - Provides an abstraction for calling something which might be a builtin function or - might be some arbitrary user defined slot. If the object is a builtin function the - call will go directly to the underlying .NET method. If the object is an arbitrary - callable object we will setup a nested dynamic site for performing the additional - dispatch. - - TODO: We could probably do a specific binding to the object if it's another IDyanmicObject. - - - - - Combines two methods, which came from two different binary types, selecting the method which has the best - set of conversions (the conversions which result in the least narrowing). - - - - - Tries to get a MethodBinder associated with the slot for the specified type. - - If a method is found the binder is set and true is returned. - If nothing is found binder is null and true is returned. - If something other than a method is found false is returned. - - TODO: Remove rop - - - - - bytearray(string, encoding[, errors]) -> bytearray - bytearray(iterable) -> bytearray - - Construct a mutable bytearray object from: - - an iterable yielding values in range(256), including: - + a list of integer values - + a bytes, bytearray, buffer, or array object - - a text string encoded using the specified encoding - - bytearray([int]) -> bytearray - - Construct a zero-ititialized bytearray of the specified length. - (default=0) - - - - - return true if self is a titlecased string and there is at least one - character in self; also, uppercase characters may only follow uncased - characters (e.g. whitespace) and lowercase characters only cased ones. - return false otherwise. - - - - - Return a string which is the concatenation of the strings - in the sequence seq. The separator between elements is the - string providing this method - - - - - return true if self is a titlecased string and there is at least one - character in self; also, uppercase characters may only follow uncased - characters (e.g. whitespace) and lowercase characters only cased ones. - return false otherwise. - - - - - Return a string which is the concatenation of the strings - in the sequence seq. The separator between elements is the - string providing this method - - - - - Returns a copy of the internal byte array. - - - System.Byte[] - - - - - This method returns the underlying byte array directly. - It should be used sparingly! - - - System.Byte[] - - - - - Marks a method as being a class method. The PythonType which was used to access - the method will then be passed as the first argument. - - - - - this class contains objecs and static methods used for - .NET/CLS interop with Python. - - - - - Gets the current ScriptDomainManager that IronPython is loaded into. The - ScriptDomainManager can then be used to work with the language portion of the - DLR hosting APIs. - - - - - Use(name) -> module - - Attempts to load the specified module searching all languages in the loaded ScriptRuntime. - - - - - Use(path, language) -> module - - Attempts to load the specified module belonging to a specific language loaded into the - current ScriptRuntime. - - - - - SetCommandDispatcher(commandDispatcher) - - Sets the current command dispatcher for the Python command line. - - The command dispatcher will be called with a delegate to be executed. The command dispatcher - should invoke the target delegate in the desired context. - - A common use for this is to enable running all REPL commands on the UI thread while the REPL - continues to run on a non-UI thread. - - - - - LoadTypeLibrary(rcw) -> type lib desc - - Gets an ITypeLib object from OLE Automation compatible RCW , - reads definitions of CoClass'es and Enum's from this library - and creates an object that allows to instantiate coclasses - and get actual values for the enums. - - - - - LoadTypeLibrary(guid) -> type lib desc - - Reads the latest registered type library for the corresponding GUID, - reads definitions of CoClass'es and Enum's from this library - and creates a IDynamicMetaObjectProvider that allows to instantiate coclasses - and get actual values for the enums. - - - - - AddReferenceToTypeLibrary(rcw) -> None - - Makes the type lib desc available for importing. See also LoadTypeLibrary. - - - - - AddReferenceToTypeLibrary(guid) -> None - - Makes the type lib desc available for importing. See also LoadTypeLibrary. - - - - - Gets the CLR Type object from a given Python type object. - - - - - Gets the Python type object from a given CLR Type object. - - - - - OBSOLETE: Gets the Python type object from a given CLR Type object. - - Use clr.GetPythonType instead. - - - - - accepts(*types) -> ArgChecker - - Decorator that returns a new callable object which will validate the arguments are of the specified types. - - - - - - - returns(type) -> ReturnChecker - - Returns a new callable object which will validate the return type is of the specified type. - - - - - returns the result of dir(o) as-if "import clr" has not been performed. - - - - - Returns the result of dir(o) as-if "import clr" has been performed. - - - - - Attempts to convert the provided object to the specified type. Conversions that - will be attempted include standard Python conversions as well as .NET implicit - and explicit conversions. - - If the conversion cannot be performed a TypeError will be raised. - - - - - Provides a helper for compiling a group of modules into a single assembly. The assembly can later be - reloaded using the clr.AddReference API. - - - - - clr.CompileSubclassTypes(assemblyName, *typeDescription) - - Provides a helper for creating an assembly which contains pre-generated .NET - base types for new-style types. - - This assembly can then be AddReferenced or put sys.prefix\DLLs and the cached - types will be used instead of generating the types at runtime. - - This function takes the name of the assembly to save to and then an arbitrary - number of parameters describing the types to be created. Each of those - parameter can either be a plain type or a sequence of base types. - - clr.CompileSubclassTypes(object) -> create a base type for object - clr.CompileSubclassTypes(object, str, System.Collections.ArrayList) -> create - base types for both object and ArrayList. - - clr.CompileSubclassTypes(object, (object, IComparable)) -> create base types for - object and an object which implements IComparable. - - - - - - clr.GetSubclassedTypes() -> tuple - - Returns a tuple of information about the types which have been subclassed. - - This tuple can be passed to clr.CompileSubclassTypes to cache these - types on disk such as: - - clr.CompileSubclassTypes('assembly', *clr.GetSubclassedTypes()) - - - - - Goes through the list of files identifying the relationship between packages - and subpackages. Returns a dictionary with all of the package filenames (minus __init__.py) - mapping to their full name. For example given a structure: - - C:\ - someDir\ - package\ - __init__.py - a.py - b\ - __init.py - c.py - - Returns: - {r'C:\somedir\package' : 'package', r'C:\somedir\package\b', 'package.b'} - - This can then be used for calculating the full module name of individual files - and packages. For example a's full name is "package.a" and c's full name is - "package.b.c". - - - - - Returns a list of profile data. The values are tuples of Profiler.Data objects - - All times are expressed in the same unit of measure as DateTime.Ticks - - - - - Resets all profiler counters back to zero - - - - - Enable or disable profiling for the current ScriptEngine. This will only affect code - that is compiled after the setting is changed; previously-compiled code will retain - whatever setting was active when the code was originally compiled. - - The easiest way to recompile a module is to reload() it. - - - - - Serializes data using the .NET serialization formatter for complex - types. Returns a tuple identifying the serialization format and the serialized - data which can be fed back into clr.Deserialize. - - Current serialization formats include custom formats for primitive .NET - types which aren't already recognized as tuples. None is used to indicate - that the Binary .NET formatter is used. - - - - - Deserializes the result of a Serialize call. This can be used to perform serialization - for .NET types which are serializable. This method is the callable object provided - from __reduce_ex__ for .serializable .NET types. - - The first parameter indicates the serialization format and is the first tuple element - returned from the Serialize call. - - The second parameter is the serialized data. - - - - - Decorator for verifying the arguments to a function are of a specified type. - - - - - Returned value when using clr.accepts/ArgChecker. Validates the argument types and - then calls the original function. - - - - - Decorator for verifying the return type of functions. - - - - - Returned value when using clr.returns/ReturnChecker. Calls the original function and - validates the return type is of a specified type. - - - - - Provides a StreamContentProvider for a stream of content backed by a file on disk. - - - - - Wrapper class used when a user defined type (new-style or old-style) - defines __index__. We provide a conversion from all user defined - types to the Index type so they can be used for determing and method bind - time the most appropriate method to dispatch to. - - - - - New string formatter for 'str'.format(...) calls and support for the Formatter - library via the _formatter_parser / _formatter_field_name_split - methods. - - We parse this format: - - replacement_field = "{" field_name ["!" conversion] [":" format_spec] "}" - field_name = (identifier | integer) ("." attribute_name | "[" element_index "]")* - attribute_name = identifier - element_index = identifier - conversion = "r" | "s" - format_spec = any char, { must be balanced (for computed values), passed to __format__ method on object - - - - - Runs the formatting operation on the given format and keyword arguments - - - - - Gets the formatting information for the given format. This is a list of tuples. The tuples - include: - - text, field name, format spec, conversion - - - - - Parses a field name returning the argument name and an iterable - object which can be used to access the individual attribute - or element accesses. The iterator yields tuples of: - - bool (true if attribute, false if element index), attribute/index value - - - - - Parses the field name including attribute access or element indexing. - - - - - Parses the field name including attribute access or element indexing. - - - - - Converts accessors from our internal structure into a PythonTuple matching how CPython - exposes these - - - - - Parses an identifier and returns it - - - - - Base class used for parsing the format. Subclasss override Text/ReplacementField methods. Those - methods get called when they call Parse and then they can do the appropriate actions for the - format. - - - - - Gets an enumerable object for walking the parsed format. - - TODO: object array? struct? - - - - - Provides an enumerable of the parsed format. The elements of the tuple are: - the text preceding the format information - the field name - the format spec - the conversion - - - - - Handles {{ and }} within the string. Returns true if a double bracket - is found and yields the text - - - - - Parses the conversion character and returns it - - - - - Checks to see if we're at the end of the format. If there's no more characters left we report - the error, otherwise if we hit a } we return true to indicate parsing should stop. - - - - - Parses the format spec string and returns it. - - - - - Parses the field name and returns it. - - - - - Handles parsing the field name and the format spec and returns it. At the parse - level these are basically the same - field names just have more terminating characters. - - The most complex part of parsing them is they both allow nested braces and require - the braces are matched. Strangely though the braces need to be matched across the - combined field and format spec - not within each format. - - - - - Provides the built-in string formatter which is exposed to Python via the str.format API. - - - - - Inspects a format spec to see if it contains nested format specs which - we need to compute. If so runs another string formatter on the format - spec to compute those values. - - - - - Given the field name gets the object from our arguments running - any of the member/index accessors. - - - - - Applies the known built-in conversions to the object if a conversion is - specified. - - - - - Gets the initial object represented by the field name - e.g. the 0 or - keyword name. - - - - - Given the object value runs the accessors in the field name (if any) against the object. - - - - - Encodes all the information about the field name. - - - - - Encodes a single field accessor (.b or [number] or [str]) - - - - - For IList arguments: Marks that the argument is typed to accept a bytes or - bytearray object. This attribute disallows passing a Python list object and - auto-applying our generic conversion. It also enables conversion of a string to - a IList of byte in IronPython 2.6. - - For string arguments: Marks that the argument is typed to accept a bytes object - as well. (2.6 only) - - - - stored for copy_reg module, used for reduce protocol - - - stored for copy_reg module, used for reduce protocol - - - - Creates a new PythonContext not bound to Engine. - - - - - Checks to see if module state has the current value stored already. - - - - - Gets per-runtime state used by a module. The module should have a unique key for - each piece of state it needs to store. - - - - - Sets per-runtime state used by a module. The module should have a unique key for - each piece of state it needs to store. - - - - - Sets per-runtime state used by a module and returns the previous value. The module - should have a unique key for each piece of state it needs to store. - - - - - Sets per-runtime state used by a module and returns the previous value. The module - should have a unique key for each piece of state it needs to store. - - - - - Initializes the sys module on startup. Called both to load and reload sys - - - - - Reads one line keeping track of the # of bytes read - - - - - We use Assembly.LoadFile to load assemblies from a path specified by the script (in LoadAssemblyFromFileWithPath). - However, when the CLR loader tries to resolve any of assembly references, it will not be able to - find the dependencies, unless we can hook into the CLR loader. - - - - - Returns (and creates if necessary) the PythonService that is associated with this PythonContext. - - The PythonService is used for providing remoted convenience helpers for the DLR hosting APIs. - - - - - Gets the member names associated with the object - TODO: Move "GetMemberNames" functionality into MetaObject implementations - - - - - Gets a SiteLocalStorage when no call site is available. - - - - - Invokes the specified operation on the provided arguments and returns the new resulting value. - - operation is usually a value from StandardOperators (standard CLR/DLR operator) or - OperatorStrings (a Python specific operator) - - - - - Sets the current command dispatcher for the Python command line. The previous dispatcher - is returned. Null can be passed to remove the current command dispatcher. - - The command dispatcher will be called with a delegate to be executed. The command dispatcher - should invoke the target delegate in the desired context. - - A common use for this is to enable running all REPL commands on the UI thread while the REPL - continues to run on a non-UI thread. - - The ipy.exe REPL will call into PythonContext.DispatchCommand to dispatch each execution to - the correct thread. Other REPLs can do the same to support this functionality as well. - - - - - Dispatches the command to the current command dispatcher. If there is no current command - dispatcher the command is executed immediately on the current thread. - - - - - Gets a function which can be used for comparing two values. If cmp is not null - then the comparison will use the provided comparison function. Otherwise - it will use the normal Python semantics. - - If type is null then a generic comparison function is returned. If type is - not null a comparison function is returned that's used for just that type. - - - - - Performs a GC collection including the possibility of freeing weak data structures held onto by the Python runtime. - - - - - - Gets a PythonContext given a DynamicMetaObjectBinder. - - - - - Gets or sets the maximum depth of function calls. Equivalent to sys.getrecursionlimit - and sys.setrecursionlimit. - - - - - Gets or sets the main thread which should be interupted by thread.interrupt_main - - - - - Gets or sets the default encoding for this system state / engine. - - - - - Dictionary from name to type of all known built-in module names. - - - - - Dictionary from type to name of all built-in modules. - - - - - TODO: Remove me, or stop caching built-ins. This is broken if the user changes __builtin__ - - - - Dictionary of error handlers for string codecs. - - - Table of functions used for looking for additional codecs. - - - - Returns a shared code context for the current PythonContext. This shared - context can be used for performing general operations which usually - require a CodeContext. - - - - - Returns an overload resolver for the current PythonContext. The overload - resolver will flow the shared context through as it's CodeContext. - - - - - Returns a shared code context for the current PythonContext. This shared - context can be used for doing lookups which need to occur as if they - happened in a module which has done "import clr". - - - - - A DynamicStackFrame which has Python specific data. Currently this - includes the code context which may provide access to locals and the - function code object which is needed to build frame objects from. - - - - - Gets the code context of the function. - - If the function included a call to locals() or the FullFrames - option is enabled then the code context includes all local variables. - - Null if deserialized. - - - - - Gets the code object for this frame. This is used in creating - the trace back. Null if deserialized. - - - - - Created for a user-defined function. - - - - - Python ctor - maps to function.__new__ - - y = func(x.__code__, globals(), 'foo', None, (a, )) - - - - - Calculates the _compat value which is used for call-compatibility checks - for simple calls. Whenver any of the dependent values are updated this - must be called again. - - The dependent values include: - _nparams - this is readonly, and never requies an update - _defaults - the user can mutate this (func_defaults) and that forces - an update - expand dict/list - based on nparams and flags, both read-only - - Bits are allocated as: - 00003fff - Normal argument count - 0fffb000 - Default count - 10000000 - unused - 20000000 - expand list - 40000000 - expand dict - 80000000 - unused - - Enforce recursion is added at runtime. - - - - - The parent CodeContext in which this function was declared. - - - - - Captures the # of args and whether we have kw / arg lists. This - enables us to share sites for simple calls (calls that don't directly - provide named arguments or the list/dict params). - - - - - Generators w/ exception handling need to have some data stored - on them so that we appropriately set/restore the exception state. - - - - - Returns an ID for the function if one has been assigned, or zero if the - function has not yet required the use of an ID. - - - - - Gets the position for the expand list argument or -1 if the function doesn't have an expand list parameter. - - - - - Gets the position for the expand dictionary argument or -1 if the function doesn't have an expand dictionary parameter. - - - - - Gets the number of normal (not params or kw-params) parameters. - - - - - Gets the number of extra arguments (params or kw-params) - - - - - Gets the collection of command line arguments. - - - - - Should we strip out all doc strings (the -O command line option). - - - - - Should we strip out all doc strings (the -OO command line option). - - - - - List of -W (warning filter) options collected from the command line. - - - - - Enables warnings related to Python 3.0 features. - - - - - Enables 3.0 features that are implemented in IronPython. - - - - - Enables debugging support. When enabled a .NET debugger can be attached - to the process to step through Python code. - - - - - Enables inspect mode. After running the main module the REPL will be started - within that modules context. - - - - - Suppresses addition of the user site directory. This is ignored by IronPython - except for updating sys.flags. - - - - - Disables import site on startup. - - - - - Ignore environment variables that configure the IronPython context. - - - - - Enables the verbose option which traces import statements. This is ignored by IronPython - except for setting sys.flags. - - - - - Sets the maximum recursion depth. Setting to Int32.MaxValue will disable recursion - enforcement. - - - - - Makes available sys._getframe. Local variables will not be available in frames unless the - function calls locals(), dir(), vars(), etc... For ensuring locals are always available use - the FullFrames option. - - - - - Makes available sys._getframe. All locals variables will live on the heap (for a considerable - performance cost) enabling introspection of all code. - - - - - Tracing is always available. Without this option tracing is only enabled when sys.settrace - is called. This means code that was already running before sys.settrace will not be debuggable. - - With this option pdb.set_trace and pdb.post_mortem will always work properly. - - - - - Severity of a warning that indentation is formatted inconsistently. - - - - - The division options (old, new, warn, warnall) - - - - - Forces all code to be compiled in a mode in which the code can be reliably collected by the CLR. - - - - - Enable profiling code - - - - - Returns a regular expression of Python files which should not be emitted in debug mode. - - - - - Gets the CPython version which IronPython will emulate. Currently limited - to either 2.6 or 3.0. - - - - - Marks a member as being hidden from Python code. - - - - - This assembly-level attribute specifies which types in the engine represent built-in Python modules. - - Members of a built-in module type should all be static as an instance is never created. - - - - - Creates a new PythonModuleAttribute that can be used to specify a built-in module that exists - within an assembly. - - The built-in module name - The type that implements the built-in module. - - - - The built-in module name - - - - - The type that implements the built-in module - - - - - Marks a type as being a PythonType for purposes of member lookup, creating instances, etc... - - If defined a PythonType will use __new__ / __init__ when creating instances. This allows the - object to match the native Python behavior such as returning cached values from __new__ or - supporting initialization to run multiple times via __init__. - - The attribute also allows you to specify an alternate type name. This allows the .NET name to - be different from the Python name so they can follow .NET naming conventions. - - Types defining this attribute also don't show CLR methods such as Equals, GetHashCode, etc... until - the user has done an import clr. - - - - - General-purpose storage used for Python sets and frozensets. - - The set storage is thread-safe for multiple readers or writers. - - Mutations to the set involve a simple locking strategy of locking on the SetStorage object - itself to ensure mutual exclusion. - - Reads against the set happen lock-free. When the set is mutated, it adds or removes buckets - in an atomic manner so that the readers will see a consistent picture as if the read - occurred either before or after the mutation. - - - - - Creates a new set storage with no buckets - - - - - Creates a new set storage with no buckets - - - - - Adds a new item to the set, unless an equivalent item is already present - - - - - Static helper which adds the given non-null item with a precomputed hash code. Returns - true if the item was added, false if it was already present in the set. - - - - - Lock-free helper on a non-null item with a pre-calculated hash code. Removes the item - if it is present in the set, otherwise adds it. - - - - - Clears the contents of the set - - - - - Clones the set, returning a new SetStorage object - - - - - Checks to see if the given item exists in the set - - - - - Checks to see if the given item exists in the set, and tries to hash it even - if it is known not to be in the set. - - - - - - - Adds items from this set into the other set - - - - - Removes the first set element in the iteration order. - - true if an item was removed, false if the set was empty - - - - Removes an item from the set and returns true if it was present, otherwise returns - false - - - - - Removes an item from the set and returns true if it was removed. The item will always - be hashed, throwing if it is unhashable - even if the set has no buckets. - - - - - Lock-free helper to remove a non-null item - - - - - Determines whether the current set shares no elements with the given set - - - - - Determines whether the current set is a subset of the given set - - - - - Determines whether the current set is a strict subset of the given set - - - - - Mutates this set to contain its union with 'other'. The caller must lock the current - set if synchronization is desired. - - - - - Mutates this set to contain its intersection with 'other'. The caller must lock the - current set if synchronization is desired. - - - - - Mutates this set to contain its symmetric difference with 'other'. The caller must - lock the current set if synchronization is desired. - - - - - Mutates this set to contain its difference with 'other'. The caller must lock the - current set if synchronization is desired. - - - - - Computes the union of self and other, returning an entirely new set. This method is - thread-safe and makes no modifications to self or other. - - - - - Computes the intersection of self and other, returning an entirely new set. This - method is thread-safe and makes no modifications to self or other. - - - - - Computes the symmetric difference of self and other, returning an entirely new set. - This method is thread-safe and makes no modifications to self or other. - - - - - Computes the difference of self and other, returning an entirely new set. This - method is thread-safe and makes no modifications to self or other. - - - - - Helper to hash the given item w/ support for null - - - - - Helper which ensures that the first argument x requires the least work to enumerate - - - - - A factory which creates a SetStorage object from any Python iterable. It extracts - the underlying storage of a set or frozen set without copying, which is left to the - caller if necessary. - - - - - A factory which creates a SetStorage object from any Python iterable. It extracts - the underlying storage of a set or frozen set without copying, which is left to the - caller if necessary. - Returns true if the given object was a set or frozen set, false otherwise. - - - - - A factory which creates a SetStorage object from any Python iterable. It extracts - the underlying storage of a set or frozen set, copying in the former case, to return - a SetStorage object that is guaranteed not to receive any outside mutations. - - - - - Extracts the SetStorage object from o if it is a set or frozenset and returns true. - Otherwise returns false. - - - - - Creates a hashable set from the given set, or does nothing if the given object - is not a set. - - True if o is a set or frozenset, false otherwise - - - - Returns the number of items currently in the set - - - - - Used to store a single hashed item. - - Bucket is not serializable because it stores the computed hash code, which could change - between serialization and deserialization. - - - - - Provides storage which is flowed into a callers site. The same storage object is - flowed for multiple calls enabling the callee to cache data that can be re-used - across multiple calls. - - Data is a public field so that this works properly with DynamicSite's as the reference - type (and EnsureInitialize) - - - - - Provides a representation and parsing for the default formatting specification. This is used - by object.__format__, int.__format__, long.__format__, and float.__format__ to do the common - format spec parsing. - - The default specification is: - - format_spec = [[fill]align][sign][#][0][width][,][.precision][type] - fill = a character other than } - align = "<" | ">" | "=" | "^" - sign = "+" | "-" | " " - width = integer - precision = integer - type = "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "x" | "X" | "%" - - - - - Parses a format spec and returns a new StringFormatSpec object. - - - - - Optimized storage for setting exc_type, exc_value, and exc_traceback. - - This optimization can go away in Python 3.0 when these attributes are no longer used. - - - - - Marks a type as being a suitable type to be used for user-defined classes. - - The requirements for this are that a type has to follow the patterns - that NewTypeMaker derived types follow. This includes: - The type's constructors must all take PythonType as the 1st parameter - which sets the underlying type for the actual object - The type needs to implement IPythonObject - Dictionary-based storage needs to be provided for setting individual members - Virtual methods exposed to Python need to support checking the types dictionary for invocations - - - - - Base class for helper which creates instances. We have two derived types: One for user - defined types which prepends the type before calling, and one for .NET types which - doesn't prepend the type. - - - - - Contains helper methods for converting C# names into Python names. - - - - - TypeInfo captures the minimal CLI information required by NewTypeMaker for a Python object - that inherits from a CLI type. - - - - - "bases" contains a set of PythonTypes. These can include types defined in Python (say cpy1, cpy2), - CLI types (say cCLI1, cCLI2), and CLI interfaces (say iCLI1, iCLI2). Here are some - examples of how this works: - - (bases) => baseType, {interfaceTypes} - - (cpy1) => System.Object, {} - (cpy1, cpy2) => System.Object, {} - (cpy1, cCLI1, iCLI1, iCLI2) => cCLI1, {iCLI1, iCLI2} - [some type that satisfies the line above] => - cCLI1, {iCLI1, iCLI2} - (cCLI1, cCLI2) => error - - - - - Filters out old-classes and throws if any non-types are included, returning a - yielding the remaining PythonType objects. - - - - - Python class hierarchy is represented using the __class__ field in the object. It does not - use the CLI type system for pure Python types. However, Python types which inherit from a - CLI type, or from a builtin Python type which is implemented in the engine by a CLI type, - do have to use the CLI type system to interoperate with the CLI world. This means that - objects of different Python types, but with the same CLI base type, can use the same CLI type - - they will just have different values for the __class__ field. - - The easiest way to inspect the functionality implemented by NewTypeMaker is to persist the - generated IL using "ipy.exe -X:SaveAssemblies", and then inspect the - persisted IL using ildasm. - - - - - Loads any available new types from the provided assembly and makes them - available via the GetNewType API. - - - - - Is this a type used for instances Python types (and not for the types themselves)? - - - - - Gets the position for the parameter which we are overriding. - - - - - - - - - Defines an interface on the type that forwards all calls - to a helper method in UserType. The method names all will - have Helper appended to them to get the name for UserType. The - UserType version should take 1 extra parameter (self). - - - - - Overrides methods - this includes all accessible virtual methods as well as protected non-virtual members - including statics and non-statics. - - - - - Loads all the incoming arguments and forwards them to mi which - has the same signature and then returns the result - - - - - Emits code to check if the class has overridden this specific - function. For example: - - MyDerivedType.SomeVirtualFunction = ... - or - - class MyDerivedType(MyBaseType): - def SomeVirtualFunction(self, ...): - - - - - - Emit code to convert object to a given type. This code is semantically equivalent - to PythonBinder.EmitConvertFromObject, except this version accepts ILGen whereas - PythonBinder accepts Compiler. The Binder will chagne soon and the two will merge. - - - - - Emits code to check if the class has overridden this specific - function. For example: - - MyDerivedType.SomeVirtualFunction = ... - or - - class MyDerivedType(MyBaseType): - def SomeVirtualFunction(self, ...): - - - - - - Emits the call to lookup a member defined in the user's type. Returns - the local which stores the resulting value and leaves a value on the - stack indicating the success of the lookup. - - - - - Creates a method for doing a base method dispatch. This is used to support - super(type, obj) calls. - - - - - Generates stub to receive the CLR call and then call the dynamic language code. - This code is same as StubGenerator.cs in the Microsoft.Scripting, except it - accepts ILGen instead of Compiler. - - - - - Called from PythonTypeOps - the BuiltinFunction._function lock must be held. - - - - - Same as the DLR ReturnFixer, but accepts lower level constructs, - such as LocalBuilder, ParameterInfos and ILGen. - - - - - Creates a new PythonCompilerOptions with the default language features enabled. - - - - - Creates a new PythonCompilerOptions with the specified language features enabled. - - - - - Creates a new PythonCompilerOptions and enables or disables true division. - - This overload is obsolete, instead you should use the overload which takes a - ModuleOptions. - - - - - Gets or sets the initial indentation. This can be set to allow parsing - partial blocks of code that are already indented. - - For each element of the array there is an additional level of indentation. - Each integer value represents the number of spaces used for the indentation. - - If this value is null then no indentation level is specified. - - - - - Language features initialized on parser construction and possibly updated during parsing. - The code can set the language features (e.g. "from __future__ import division"). - - - - - Parse one or more lines of interactive input - - null if input is not yet valid but could be with more lines - - - - Given the interactive text input for a compound statement, calculate what the - indentation level of the next line should be - - - - - Peek if the next token is a 'yield' and parse a yield expression. Else return null. - - Called w/ yield already eaten. - - A yield expression if present, else null. - - - - Maybe eats a new line token returning true if the token was - eaten. - - Python always tokenizes to have only 1 new line character in a - row. But we also craete NLToken's and ignore them except for - error reporting purposes. This gives us the same errors as - CPython and also matches the behavior of the standard library - tokenize module. This function eats any present NL tokens and throws - them away. - - - - - Eats a new line token throwing if the next token isn't a new line. - - Python always tokenizes to have only 1 new line character in a - row. But we also craete NLToken's and ignore them except for - error reporting purposes. This gives us the same errors as - CPython and also matches the behavior of the standard library - tokenize module. This function eats any present NL tokens and throws - them away. - - - - - Summary description for Token. - - - - - IronPython tokenizer - - - - - Used to create tokenizer for hosting API. - - - - - Returns whether the - - - - - Resizes an array to a speficied new size and copies a portion of the original array into its beginning. - - - - - True if the last characters in the buffer are a backslash followed by a new line indicating - that their is an incompletement statement which needs further input to complete. - - - - - Equality comparer that can compare strings to our current token w/o creating a new string first. - - - - - A simple Python command-line should mimic the standard python.exe - - - - - Returns the display look for IronPython. - - The returned string uses This \n instead of Environment.NewLine for it's line seperator - because it is intended to be outputted through the Python I/O system. - - - - - Loads any extension DLLs present in sys.prefix\DLLs directory and adds references to them. - - This provides an easy drop-in location for .NET assemblies which should be automatically referenced - (exposed via import), COM libraries, and pre-compiled Python code. - - - - - Attempts to run a single interaction and handle any language-specific - exceptions. Base classes can override this and call the base implementation - surrounded with their own exception handling. - - Returns null if successful and execution should continue, or an exit code. - - - - - Parses a single interactive command and executes it. - - Returns null if successful and execution should continue, or the appropiate exit code. - - - - - Skip the first line of the code to execute. This is useful for executing Unix scripts which - have the command to execute specified in the first line. - This only apply to the script code executed by the ScriptEngine APIs, but not for other script code - that happens to get called as a result of the execution. - - - - On error. - - - - Provides helpers for interacting with IronPython. - - - - - Creates a new ScriptRuntime with the IronPython scipting engine pre-configured. - - - - - - Creates a new ScriptRuntime with the IronPython scipting engine pre-configured and - additional options. - - - - - Creates a new ScriptRuntime with the IronPython scripting engine pre-configured - in the specified AppDomain. The remote ScriptRuntime may be manipulated from - the local domain but all code will run in the remote domain. - - - - - Creates a new ScriptRuntime with the IronPython scripting engine pre-configured - in the specified AppDomain with additional options. The remote ScriptRuntime may - be manipulated from the local domain but all code will run in the remote domain. - - - - - Creates a new ScriptRuntime and returns the ScriptEngine for IronPython. If - the ScriptRuntime is required it can be acquired from the Runtime property - on the engine. - - - - - Creates a new ScriptRuntime with the specified options and returns the - ScriptEngine for IronPython. If the ScriptRuntime is required it can be - acquired from the Runtime property on the engine. - - - - - Creates a new ScriptRuntime and returns the ScriptEngine for IronPython. If - the ScriptRuntime is required it can be acquired from the Runtime property - on the engine. - - The remote ScriptRuntime may be manipulated from the local domain but - all code will run in the remote domain. - - - - - Creates a new ScriptRuntime with the specified options and returns the - ScriptEngine for IronPython. If the ScriptRuntime is required it can be - acquired from the Runtime property on the engine. - - The remote ScriptRuntime may be manipulated from the local domain but - all code will run in the remote domain. - - - - - Given a ScriptRuntime gets the ScriptEngine for IronPython. - - - - - Gets a ScriptScope which is the Python sys module for the provided ScriptRuntime. - - - - - Gets a ScriptScope which is the Python sys module for the provided ScriptEngine. - - - - - Gets a ScriptScope which is the Python __builtin__ module for the provided ScriptRuntime. - - - - - Gets a ScriptScope which is the Python __builtin__ module for the provided ScriptEngine. - - - - - Gets a ScriptScope which is the Python clr module for the provided ScriptRuntime. - - - - - Gets a ScriptScope which is the Python clr module for the provided ScriptEngine. - - - - - Imports the Python module by the given name and returns its ScriptSCope. If the - module does not exist an exception is raised. - - - - - Imports the Python module by the given name and returns its ScriptSCope. If the - module does not exist an exception is raised. - - - - - Imports the Python module by the given name and inserts it into the ScriptScope as that name. If the - module does not exist an exception is raised. - - - - - - - Sets sys.exec_prefix, sys.executable and sys.version and adds the prefix to sys.path - - - - - Sets sys.exec_prefix, sys.executable and sys.version and adds the prefix to sys.path - - - - - Enables call tracing for the current thread in this ScriptEngine. - - TracebackDelegate will be called back for each function entry, exit, exception, and line change. - - - - - Enables call tracing for the current thread for the Python engine in this ScriptRuntime. - - TracebackDelegate will be called back for each function entry, exit, exception, and line change. - - - - - Provides nested level debugging support when SetTrace or SetProfile are used. - - This saves the current tracing information and then calls the provided object. - - - - - Provides nested level debugging support when SetTrace or SetProfile are used. - - This saves the current tracing information and then calls the provided object. - - - - - Creates a ScriptRuntimeSetup object which includes the Python script engine with the specified options. - - The ScriptRuntimeSetup object can then be additional configured and used to create a ScriptRuntime. - - - - - Creates a LanguageSetup object which includes the Python script engine with the specified options. - - The LanguageSetup object can be used with other LanguageSetup objects from other languages to - configure a ScriptRuntimeSetup object. - - - - - Creates a new PythonModule with the specified name and published it in sys.modules. - - Returns the ScriptScope associated with the module. - - - - - Creates a new PythonModule with the specified name and filename published it - in sys.modules. - - Returns the ScriptScope associated with the module. - - - - - Creates a new PythonModule with the specified name, filename, and doc string and - published it in sys.modules. - - Returns the ScriptScope associated with the module. - - - - - Gets the list of loaded Python module files names which are available in the provided ScriptEngine. - - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - - Returns the cached ResourceManager instance used by this class. - - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - - Looks up a localized string similar to couldn't find member {0}. - - - - - Looks up a localized string similar to default value must be specified here. - - - - - Looks up a localized string similar to duplicate argument '{0}' in function definition. - - - - - Looks up a localized string similar to duplicate keyword argument. - - - - - Looks up a localized string similar to <eof> while reading string. - - - - - Looks up a localized string similar to EOF while scanning triple-quoted string. - - - - - Looks up a localized string similar to EOL while scanning single-quoted string. - - - - - Looks up a localized string similar to expected an indented block. - - - - - Looks up a localized string similar to expected name. - - - - - Looks up a localized string similar to Expecting identifier:. - - - - - Looks up a localized string similar to inconsistent use of tabs and spaces in indentation. - - - - - Looks up a localized string similar to unindent does not match any outer indentation level. - - - - - Looks up a localized string similar to Invalid argument value.. - - - - - Looks up a localized string similar to MakeGenericType on non-generic type. - - - - - Looks up a localized string similar to Invalid parameter collection for the function.. - - - - - Looks up a localized string similar to invalid syntax. - - - - - Looks up a localized string similar to object ({0}) is not creatable w/ keyword arguments. - - - - - Looks up a localized string similar to keywords must come before * args. - - - - - Looks up a localized string similar to type does not have {0} field. - - - - - Looks up a localized string similar to from __future__ imports must occur at the beginning of the file. - - - - - Looks up a localized string similar to 'return' outside function. - - - - - Looks up a localized string similar to 'yield' outside function. - - - - - Looks up a localized string similar to NEWLINE in double-quoted string. - - - - - Looks up a localized string similar to NEWLINE in single-quoted string. - - - - - Looks up a localized string similar to future statement does not support import *. - - - - - Looks up a localized string similar to non-keyword arg after keyword arg. - - - - - Looks up a localized string similar to not a chance. - - - - - Looks up a localized string similar to The method or operation is not implemented.. - - - - - Looks up a localized string similar to only one ** allowed. - - - - - Looks up a localized string similar to only one * allowed. - - - - - Looks up a localized string similar to Context must be PythonCompilerContext. - - - - - Looks up a localized string similar to cannot delete slot. - - - - - Looks up a localized string similar to cannot get slot. - - - - - Looks up a localized string similar to cannot set slot. - - - - - Looks up a localized string similar to static property '{0}' of '{1}' can only be read through a type, not an instance. - - - - - Looks up a localized string similar to static property '{0}' of '{1}' can only be assigned to through a type, not an instance. - - - - - Looks up a localized string similar to no value for this token. - - - - - Looks up a localized string similar to too many versions. - - - - - Looks up a localized string similar to unexpected token '{0}'. - - - - - Looks up a localized string similar to future feature is not defined:. - - - - - The Action used for Python call sites. This supports both splatting of position and keyword arguments. - - When a foreign object is encountered the arguments are expanded into normal position/keyword arguments. - - - - - Python's Invoke is a non-standard action. Here we first try to bind through a Python - internal interface (IPythonInvokable) which supports CallSigantures. If that fails - and we have an IDO then we translate to the DLR protocol through a nested dynamic site - - this includes unsplatting any keyword / position arguments. Finally if it's just a plain - old .NET type we use the default binder which supports CallSignatures. - - - - - Fallback - performs the default binding operation if the object isn't recognized - as being invokable. - - - - - Creates a nested dynamic site which uses the unpacked arguments. - - - - - Translates our CallSignature into a DLR Argument list and gives the simple MetaObject's which are extracted - from the tuple or dictionary parameters being splatted. - - - - - Gets the CallSignature for this invocation which describes how the MetaObject array - is to be mapped. - - - - - General purpose storage used for most PythonDictionarys. - - This dictionary storage is thread safe for multiple readers or writers. - - Mutations to the dictionary involves a simple locking strategy of - locking on the DictionaryStorage object to ensure that only one - mutation happens at a time. - - Reads against the dictionary happen lock free. When the dictionary is mutated - it is either adding or removing buckets in a thread-safe manner so that the readers - will either see a consistent picture as if the read occured before or after the mutation. - - When resizing the dictionary the buckets are replaced atomically so that the reader - sees the new buckets or the old buckets. When reading the reader first reads - the buckets and then calls a static helper function to do the read from the bucket - array to ensure that readers are not seeing multiple bucket arrays. - - - - - Creates a new dictionary storage with no buckets - - - - - Creates a new dictionary storage with no buckets - - - - - Creates a new dictionary geting values/keys from the - items arary - - - - - Creates a new dictionary storage with the given set of buckets - and size. Used when cloning the dictionary storage. - - - - - Adds a new item to the dictionary, replacing an existing one if it already exists. - - - - - Initializes the buckets to their initial capacity, the caller - must check if the buckets are empty first. - - - - - Add helper that works over a single set of buckets. Used for - both the normal add case as well as the resize case. - - - - - Add helper which adds the given key/value (where the key is not null) with - a pre-computed hash code. - - - - - Removes an entry from the dictionary and returns true if the - entry was removed or false. - - - - - Removes an entry from the dictionary and returns true if the - entry was removed or false. The key will always be hashed - so if it is unhashable an exception will be thrown - even - if the dictionary has no buckets. - - - - - Checks to see if the key exists in the dictionary. - - - - - Trys to get the value associated with the given key and returns true - if it's found or false if it's not present. - - - - - Static helper to try and get the value from the dictionary. - - Used so the value lookup can run against a buckets while a writer - replaces the buckets. - - - - - Clears the contents of the dictionary. - - - - - Clones the storage returning a new DictionaryStorage object. - - - - - Helper to hash the given key w/ support for null. - - - - - Returns the number of key/value pairs currently in the dictionary. - - - - - Used to store a single hashed key/value. - - Bucket is not serializable because it stores the computed hash - code which could change between serialization and deserialization. - - - - - Special marker NullValue used during deserialization to not add - an extra field to the dictionary storage type. - - - - - The error involved an incomplete statement due to an unexpected EOF. - - - - - The error involved an incomplete token. - - - - - The mask for the actual error values - - - - - The error was a general syntax error - - - - - The error was an indentation error. - - - - - The error was a tab error. - - - - - syntax error shouldn't include a caret (no column offset should be included) - - - - - GeneratorExitException is a standard exception raised by Generator.Close() to allow a caller - to close out a generator. - - GeneratorExit is introduced in Pep342 for Python2.5. - - - - .NET exception thrown when a Python syntax error is related to incorrect indentation. - - - - - Implementation of the Python exceptions module and the IronPython/CLR exception mapping - mechanism. The exception module is the parent module for all Python exception classes - and therefore is built-in to IronPython.dll instead of IronPython.Modules.dll. - - The exception mapping mechanism is exposed as internal surface area available to only - IronPython / IronPython.Modules.dll. The actual exceptions themselves are all public. - - Because the oddity of the built-in exception types all sharing the same physical layout - (see also PythonExceptions.BaseException) some classes are defined as classes w/ their - proper name and some classes are defined as PythonType fields. When a class is defined - for convenience their's also an _TypeName version which is the PythonType. - - - - - Creates a new throwable exception of type type where the type is an new-style exception. - - Used at runtime when creating the exception from a user provided type via the raise statement. - - - - - Creates a throwable exception of type type where the type is an OldClass. - - Used at runtime when creating the exception form a user provided type that's an old class (via the raise statement). - - - - - Returns the CLR exception associated with a Python exception - creating a new exception if necessary - - - - - Given a CLR exception returns the Python exception which most closely maps to the CLR exception. - - - - - Creates a new style Python exception from the .NET exception - - - - - Internal helper to associate a .NET exception and a Python exception. - - - - - Internal helper to get the associated Python exception from a .NET exception. - - - - - Converts the DLR SyntaxErrorException into a Python new-style SyntaxError instance. - - - - - Creates a PythonType for a built-in module. These types are mutable like - normal user types. - - - - - Creates a PythonType for a built-in module. These types are mutable like - normal user types. - - - - - Creates a PythonType for a built-in module, where the type may inherit - from multiple bases. These types are mutable like normal user types. - - - - - Creates a new type for a built-in exception which derives from another Python - type. . These types are built-in and immutable like any other normal type. For - example StandardError.x = 3 is illegal. This isn't for module exceptions which - are like user defined types. thread.error.x = 3 is legal. - - - - - Creates a new type for a built-in exception which is the root concrete type. - - - - - Gets the list of DynamicStackFrames for the current exception. - - - - - Base class for all Python exception objects. - - When users throw exceptions they typically throw an exception which is - a subtype of this. A mapping is maintained between Python exceptions - and .NET exceptions and a corresponding .NET exception is thrown which - is associated with the Python exception. This class represents the - base class for the Python exception hierarchy. - - Users can catch exceptions rooted in either hierarchy. The hierarchy - determines whether the user catches the .NET exception object or the - Python exception object. - - Most built-in Python exception classes are actually instances of the BaseException - class here. This is important because in CPython the exceptions do not - add new members and therefore their layouts are compatible for multiple - inheritance. The exceptions to this rule are the classes which define - their own fields within their type, therefore altering their layout: - EnvironmentError - SyntaxError - IndentationError (same layout as SyntaxError) - TabError (same layout as SyntaxError) - SystemExit - UnicodeDecodeError - UnicodeEncodeError - UnicodeTranslateError - - These exceptions cannot be combined in multiple inheritance, e.g.: - class foo(EnvironmentError, IndentationError): pass - - fails but they can be combined with anything which is just a BaseException: - class foo(UnicodeDecodeError, SystemError): pass - - Therefore the majority of the classes are just BaseException instances with a - custom PythonType object. The specialized ones have their own .NET class - which inherits from BaseException. User defined exceptions likewise inherit - from this and have their own .NET class. - - - - - This interface is used for implementing parts of the IronPython type system. It - is not intended for consumption from user programs. - - - - - Thread-safe dictionary set. Returns the dictionary set or the previous value if already set or - null if the dictionary set isn't supported. - - - - - - - Dictionary replacement. Returns true if replaced, false if the dictionary set isn't supported. - - - - - - - Initializes the Exception object with an unlimited number of arguments - - - - - Returns a tuple of (type, (arg0, ..., argN)) for implementing pickling/copying - - - - - Returns a tuple of (type, (arg0, ..., argN)) for implementing pickling/copying - - - - - Updates the exception's state (dictionary) with the new values - - - - - Provides custom member lookup access that fallbacks to the dictionary - - - - - Provides custom member assignment which stores values in the dictionary - - - - - Provides custom member deletion which deletes values from the dictionary - or allows clearing 'message'. - - - - - Implements __repr__ which returns the type name + the args - tuple code formatted. - - - - - Initializes the Python exception from a .NET exception - - - - - - Helper to get the CLR exception associated w/ this Python exception - creating it if one has not already been created. - - - - - Returns the exception 'message' if only a single argument was provided - during creation or an empty string. - - - - - Gets or sets the arguments used for creating the exception - - - - - Gets the nth member of the args property - - - - - Gets or sets the dictionary which is used for storing members not declared to have space reserved - within the exception object. - - - - - Gets the CLR exception associated w/ this Python exception. Not visible - until a .NET namespace is imported. - - - - - .NET exception that is thrown to signal the end of iteration in Python - - - - - .NET exception that is thrown to shutdown the interpretter and exit the system. - - - - - Result of sys.exit(n) - - - null if the script exited using "sys.exit(int_value)" - null if the script exited using "sys.exit(None)" - x if the script exited using "sys.exit(x)" where isinstance(x, int) == False - - - int_value if the script exited using "sys.exit(int_value)" - 1 otherwise - - - - - .NET Exception thrown when a Python syntax error is related to incorrect tabs. - - - - - Represents a sequence which may have been provided as a set of parameters to an indexer. - - TODO: This should be removed, and all uses of this should go to [SpecialName]object GetItem(..., params object[] keys) - and [SpecialName]void SetItem(..., params object [] keys) or this[params object[]xyz] which is also legal. - - currently this exists for backwards compatibility w/ IronPython's "expandable tuples". - - - - - Provides a MetaObject for instances of Python's old-style classes. - - TODO: Lots of CodeConetxt references, need to move CodeContext onto OldClass and pull it from there. - - - - - Performs the actual work of binding to the function. - - Overall this works by going through the arguments and attempting to bind all the outstanding known - arguments - position arguments and named arguments which map to parameters are easy and handled - in the 1st pass for GetArgumentsForRule. We also pick up any extra named or position arguments which - will need to be passed off to a kw argument or a params array. - - After all the normal args have been assigned to do a 2nd pass in FinishArguments. Here we assign - a value to either a value from the params list, kw-dict, or defaults. If there is ambiguity between - this (e.g. we have a splatted params list, kw-dict, and defaults) we call a helper which extracts them - in the proper order (first try the list, then the dict, then the defaults). - - - - - Makes the test for our rule. - - - - - Makes the test when we just have simple positional arguments. - - - - - Makes the test when we have a keyword argument call or splatting. - - - - - - Gets the array of expressions which correspond to each argument for the function. These - correspond with the function as it's defined in Python and must be transformed for our - delegate type before being used. - - - - - Binds any missing arguments to values from params array, kw dictionary, or default values. - - - - - Creates the argument for the list expansion parameter. - - - - - Adds extra positional arguments to the start of the expanded list. - - - - - Creates the argument for the dictionary expansion parameter. - - - - - Adds an unbound keyword argument into the dictionary. - - - - - - Adds a check to the last parameter (so it's evaluated after we've extracted - all the parameters) to ensure that we don't have any extra params or kw-params - when we don't have a params array or params dict to expand them into. - - - - - Helper function to validate that a named arg isn't duplicated with by - a params list or the dictionary (or both). - - - - - Helper function to get a value (which has no default) from either the - params list or the dictionary (or both). - - - - - Helper function to get the specified variable from the dictionary. - - - - - Helper function to extract the variable from defaults, or to call a helper - to check params / kw-dict / defaults to see which one contains the actual value. - - - - - Helper function to extract from the params list or dictionary depending upon - which one has an available value. - - - - - Helper function to extract the next argument from the params list. - - - - - Fixes up the argument list for the appropriate target delegate type. - - - - - Helper function to get the function argument strongly typed. - - - - - Called when the user is expanding a dictionary - we copy the user - dictionary and verify that it contains only valid string names. - - - - - Called when the user is expanding a params argument - - - - - Called when the user hasn't supplied a dictionary to be expanded but the - function takes a dictionary to be expanded. - - - - - Helper function to create the expression for creating the actual tuple passed through. - - - - - Creates the code to invoke the target delegate function w/ the specified arguments. - - - - - Appends the initialization code for the call to the function if any exists. - - - - - Creating a standard .NET type is easy - we just call it's constructor with the provided - arguments. - - - - - Creating a Python type involves calling __new__ and __init__. We resolve them - and generate calls to either the builtin funcions directly or embed sites which - call the slots at runtime. - - - - - Checks if we have a default new and init - in this case if we have any - arguments we don't allow the call. - - - - - Creates a test which tests the specific version of the type. - - - - - Base class for performing member binding. Derived classes override Add methods - to produce the actual final result based upon what the GetBinderHelper resolves. - - - - - - Provides the normal meta binder binding. - - - - - Provides delegate based fast binding. - - - - - The result type of the operation. - - - - - Looks up __init__ avoiding calls to __getattribute__ and handling both - new-style and old-style classes in the MRO. - - - - - Gets a builtin function for the given declaring type and member infos. - - Given the same inputs this always returns the same object ensuring there's only 1 builtinfunction - for each .NET method. - - This method takes both a cacheName and a pythonName. The cache name is the real method name. The pythonName - is the name of the method as exposed to Python. - - - - - Checks to see if the provided members are always visible for the given type. - - This filters out methods such as GetHashCode and Equals on standard .NET - types that we expose directly as Python types (e.g. object, string, etc...). - - It also filters out the base helper overrides that are added for supporting - super calls on user defined types. - - - - - a function is static if it's a static .NET method and it's defined on the type or is an extension method - with StaticExtensionMethod decoration. - - - - - If we have only interfaces, we'll need to insert object's base - - - - - Simple implementation of ASCII encoding/decoding. The default instance (PythonAsciiEncoding.Instance) is - setup to always convert even values outside of the ASCII range. The EncoderFallback/DecoderFallbacks can - be replaced with versions that will throw exceptions instead though. - - - - - Specialized version because enumerating tuples by Python's definition - doesn't call __getitem__, but filter does! - - - - - Opens a file and returns a new file object. - - name -> the name of the file to open. - mode -> the mode to open the file (r for reading, w for writing, a for appending, default is r). - bufsize -> the size of the buffer to be used (<= 0 indicates to use the default size) - - - - - Creates a new Python file object from a .NET stream object. - - stream -> the stream to wrap in a file object. - - - - - object overload of range - attempts to convert via __int__, and __trunc__ if arg is - an OldInstance - - - - - object overload of range - attempts to convert via __int__, and __trunc__ if arg is - an OldInstance - - - - - Gets the appropriate LanguageContext to be used for code compiled with Python's compile, eval, execfile, etc... - - - - Returns true if we should inherit our callers context (true division, etc...), false otherwise - - - Returns the default compiler flags or the flags the user specified. - - - - Gets a scope used for executing new code in optionally replacing the globals and locals dictionaries. - - - - - Set if the function includes a *args argument list. - - - - - Set if the function includes a **kwargs argument dictionary. - - - - - Set if the function is a generator. - - - - - Set if the function was compiled with future division. - - - - - IronPython specific: Set if the function includes nested exception handling and therefore can alter - sys.exc_info(). - - - - - IronPython specific: Set if the function includes a try/finally block. - - - - - Represents a piece of code. This can reference either a CompiledCode - object or a Function. The user can explicitly call FunctionCode by - passing it into exec or eval. - - - - - This is both the lock that is held while enumerating the threads or updating the thread accounting - information. It's also a marker CodeList which is put in place when we are enumerating the thread - list and all additions need to block. - - This lock is also acquired whenever we need to calculate how a function's delegate should be created - so that we don't race against sys.settrace/sys.setprofile. - - - - - Constructor used to create a FunctionCode for code that's been serialized to disk. - - Code constructed this way cannot be interpreted or debugged using sys.settrace/sys.setprofile. - - Function codes created this way do support recursion enforcement and are therefore registered in the global function code registry. - - - - - Constructor to create a FunctionCode at runtime. - - Code constructed this way supports both being interpreted and debugged. When necessary the code will - be re-compiled or re-interpreted for that specific purpose. - - Function codes created this way do support recursion enforcement and are therefore registered in the global function code registry. - - the initial delegate provided here should NOT be the actual code. It should always be a delegate which updates our Target lazily. - - - - - Registers the current function code in our global weak list of all function codes. - - The weak list can be enumerated with GetAllCode(). - - Ultimately there are 3 types of threads we care about races with: - 1. Other threads which are registering function codes - 2. Threads calling sys.settrace which require the world to stop and get updated - 3. Threads running cleanup (thread pool thread, or call to gc.collect). - - The 1st two must have perfect synchronization. We cannot have a thread registering - a new function which another thread is trying to update all of the functions in the world. Doing - so would mean we could miss adding tracing to a thread. - - But the cleanup thread can run in parallel to either registrying or sys.settrace. The only - thing it needs to take a lock for is updating our accounting information about the - number of code objects are alive. - - - - - Enumerates all function codes for updating the current type of targets we generate. - - While enumerating we hold a lock so that users cannot change sys.settrace/sys.setprofile - until the lock is released. - - - - - Creates a FunctionCode object for exec/eval/execfile'd/compile'd code. - - The code is then executed in a specific CodeContext by calling the .Call method. - - If the code is being used for compile (vs. exec/eval/execfile) then it needs to be - registered incase our tracing mode changes. - - - - - Called the 1st time a function is invoked by our OriginalCallTarget* methods - over in PythonCallTargets. This computes the real delegate which needs to be - created for the function. Usually this means starting off interpretering. It - also involves adding the wrapper function for recursion enforcement. - - Because this can race against sys.settrace/setprofile we need to take our - _ThreadIsEnumeratingAndAccountingLock to ensure no one is actively changing all - of the live functions. - - - - - Updates the delegate based upon current Python context settings for recursion enforcement - and for tracing. - - - - - Called to set the initial target delegate when the user has passed -X:Debug to enable - .NET style debugging. - - - - - Gets the LambdaExpression for tracing. - - If this is a generator function code then the lambda gets tranformed into the correct generator code. - - - - - Gets the correct final LambdaExpression for this piece of code. - - This is either just _lambda or _lambda re-written to be a generator expression. - - - - - Returns a list of variable names which are accessed from nested functions. - - - - - Returns the byte code. IronPython does not implement this and always - returns an empty string for byte code. - - - - - Returns a list of constants used by the function. - - The first constant is the doc string, or None if no doc string is provided. - - IronPython currently does not include any other constants than the doc string. - - - - - Returns the filename that the code object was defined in. - - - - - Returns the 1st line number of the code object. - - - - - Returns a set of flags for the function. - - 0x04 is set if the function used *args - 0x08 is set if the function used **args - 0x20 is set if the function is a generator - - - - - Returns a list of free variables (variables accessed - from an outer scope). This does not include variables - accessed in the global scope. - - - - - Returns a mapping between byte code and line numbers. IronPython does - not implement this because byte code is not available. - - - - - Returns the name of the code (function name, class name, or <module>). - - - - - Returns a list of global variable names accessed by the code. - - - - - Returns the number of local varaibles defined in the function. - - - - - Returns the stack size. IronPython does not implement this - because byte code is not supported. - - - - - Extremely light weight linked list of weak references used for tracking - all of the FunctionCode objects which get created and need to be updated - for purposes of recursion enforcement or tracing. - - - - - General conversion routine TryConvert - tries to convert the object to the desired type. - Try to avoid using this method, the goal is to ultimately remove it! - - - - - This function tries to convert an object to IEnumerator, or wraps it into an adapter - Do not use this function directly. It is only meant to be used by Ops.GetEnumerator. - - - - - This function tries to convert an object to IEnumerator, or wraps it into an adapter - Do not use this function directly. It is only meant to be used by Ops.GetEnumerator. - - - - - Attempts to convert value into a index usable for slicing and return the integer - value. If the conversion fails false is returned. - - If throwOverflowError is true then BigInteger's outside the normal range of integers will - result in an OverflowError. - - - - - Attempts to convert value into a index usable for slicing and return the integer - value. If the conversion fails false is returned. - - If throwOverflowError is true then BigInteger's outside the normal range of integers will - result in an OverflowError. - - - - - Converts a value to int ignoring floats - - - - - Note: - IEnumerator innerEnum = Dictionary<K,V>.KeysCollections.GetEnumerator(); - innerEnum.MoveNext() will throw InvalidOperation even if the values get changed, - which is supported in python - - - - - Note: - IEnumerator innerEnum = Dictionary<K,V>.KeysCollections.GetEnumerator(); - innerEnum.MoveNext() will throw InvalidOperation even if the values get changed, - which is supported in python - - - - - Note: - IEnumerator innerEnum = Dictionary<K,V>.KeysCollections.GetEnumerator(); - innerEnum.MoveNext() will throw InvalidOperation even if the values get changed, - which is supported in python - - - - - Provides both helpers for implementing Python dictionaries as well - as providing public methods that should be exposed on all dictionary types. - - Currently these are published on IDictionary<object, object> - - - - - Creates a DLR OverloadDoc object which describes information about this overload. - - The method to document - The name of the method if it should override the name in the MethodBase - Parameters to skip at the end - used for removing the value on a setter method - true to include self on instance methods - - - - Converts a Type object into a string suitable for lookup in the help file. All generic types are - converted down to their generic type definition. - - - - - Gets the XPathDocument for the specified assembly, or null if one is not available. - - - - - Gets the Xml documentation for the specified MethodBase. - - - - - Gets the Xml documentation for the specified Type. - - - - - Gets the Xml documentation for the specified Field. - - - - - Gets the Xml documentation for the specified Field. - - - - - Converts the XML as stored in the config file into a human readable string. - - - - - True iff the thread is currently inside the generator (ie, invoking the _next delegate). - This can be used to enforce that a generator does not call back into itself. - Pep255 says that a generator should throw a ValueError if called reentrantly. - - - - - We cache the GeneratorFinalizer of generators that were closed on the user - thread, and did not get finalized on the finalizer thread. We can then reuse - the object. Reusing objects with a finalizer is good because it reduces - the load on the GC's finalizer queue. - - - - - Fields set by Throw() to communicate an exception to the yield point. - These are plumbed through the generator to become parameters to Raise(...) invoked - at the yield suspension point in the generator. - - - - - Value sent by generator.send(). - Since send() could send an exception, we need to keep this different from throwable's value. - - - - - See PEP 342 (http://python.org/dev/peps/pep-0342/) for details of new methods on Generator. - Full signature including default params for throw is: - throw(type, value=None, traceback=None) - Use multiple overloads to resolve the default parameters. - - - - - Throw(...) is like Raise(...) being called from the yield point within the generator. - Note it must come from inside the generator so that the traceback matches, and so that it can - properly cooperate with any try/catch/finallys inside the generator body. - - If the generator catches the exception and yields another value, that is the return value of g.throw(). - - - - - send() was added in Pep342. It sends a result back into the generator, and the expression becomes - the result of yield when used as an expression. - - - - - Close introduced in Pep 342. - - - - - Core implementation of IEnumerator.MoveNext() - - - - - Core implementation of Python's next() method. - - - - - Helper called from PythonOps after the yield statement - Keepin this in a helper method: - - reduces generated code size - - allows better coupling with PythonGenerator.Throw() - - avoids throws from emitted code (which can be harder to debug). - - - - - - Called to throw an exception set by Throw(). - - - - - Gets the name of the function that produced this generator object. - - - - - True if the generator has finished (is "closed"), else false. - Python language spec mandates that calling Next on a closed generator gracefully throws a StopIterationException. - This can never be reset. - - - - - True if the generator can set sys exc info and therefore needs exception save/restore. - - - - - Importer class - used for importing modules. Used by Ops and __builtin__ - Singleton living on Python engine. - - - - - Gateway into importing ... called from Ops. Performs the initial import of - a module and returns the module. - - - - - Gateway into importing ... called from Ops. Performs the initial import of - a module and returns the module. This version returns light exceptions instead of throwing. - - - - - Gateway into importing ... called from Ops. This is called after - importing the module and is used to return individual items from - the module. The outer modules dictionary is then updated with the - result. - - - - - Called by the __builtin__.__import__ functions (general importing) and ScriptEngine (for site.py) - - level indiciates whether to perform absolute or relative imports. - -1 indicates both should be performed - 0 indicates only absolute imports should be performed - Positive numbers indicate the # of parent directories to search relative to the calling module - - - - - Interrogates the importing module for __name__ and __path__, which determine - whether the imported module (whose name is 'name') is being imported as nested - module (__path__ is present) or as sibling. - - For sibling import, the full name of the imported module is parent.sibling - For nested import, the full name of the imported module is parent.module.nested - where parent.module is the mod.__name__ - - - the globals dictionary - Name of the module to be imported - Output - full name of the module being imported - Path to use to search for "full" - the import level for relaive imports - the parent module - the global __package__ value - - - - - Given the parent module name looks up the __path__ property. - - - - - Trys to get an existing module and if that fails fall backs to searching - - - - - Attempts to load a module from sys.meta_path as defined in PEP 302. - - The meta_path provides a list of importer objects which can be used to load modules before - searching sys.path but after searching built-in modules. - - - - - Given a user defined importer object as defined in PEP 302 tries to load a module. - - First the find_module(fullName, path) is invoked to get a loader, then load_module(fullName) is invoked - - - - - Finds a user defined importer for the given path or returns null if no importer - handles this path. - - - - - Creates a new list with the data in the array and a size - the same as the length of the array. The array is held - onto and may be mutated in the future by the list. - - params array to use for lists storage - - - - Gets a reasonable size for the addition of two arrays. We round - to a power of two so that we usually have some extra space if - the resulting array gets added to. - - - - - Non-thread safe adder, should only be used by internal callers that - haven't yet exposed their list. - - - - - Compares the two specified keys - - - - - Supports __index__ on arbitrary types, also prevents __float__ - - - - - we need to lock both objects (or copy all of one's data w/ it's lock held, and - then compare, which is bad). Therefore we have a strong order for locking on - the two objects based upon the hash code or object identity in case of a collision - - - - - Summary description for ConstantValue. - - - - - Multiply two object[] arrays - slow version, we need to get the type, etc... - - - - - Multiply two object[] arrays - internal version used for objects backed by arrays - - - - - Add two arrays - internal versions for objects backed by arrays - - - - - - - - - - We override the behavior of equals, compare and hashcode to make - chars seem as much like strings as possible. In Python there is no - difference between these types. - - - - - Helper class that all custom type descriptor implementations call for - the bulk of their implementation. - - - - - Returns the digits for the format spec, no sign is included. - - - - - InstanceOps contains methods that get added to CLS types depending on what - methods and constructors they define. These have not been added directly to - PythonType since they need to be added conditionally. - - Possibilities include: - - __new__, one of 3 __new__ sets can be added: - DefaultNew - This is the __new__ used for a PythonType (list, dict, object, etc...) that - has only 1 default public constructor that takes no parameters. These types are - mutable types, and __new__ returns a new instance of the type, and __init__ can be used - to re-initialize the types. This __new__ allows an unlimited number of arguments to - be passed if a non-default __init__ is also defined. - - NonDefaultNew - This is used when a type has more than one constructor, or only has one - that takes more than zero parameters. This __new__ does not allow an arbitrary # of - extra arguments. - - DefaultNewCls - This is the default new used for CLS types that have only a single ctor - w/ an arbitray number of arguments. This constructor allows setting of properties - based upon an extra set of kw-args, e.g.: System.Windows.Forms.Button(Text='abc'). It - is only used on non-Python types. - - __init__: - For types that do not define __init__ we have an __init__ function that takes an - unlimited number of arguments and does nothing. All types share the same reference - to 1 instance of this. - - next: Defined when a type is an enumerator to expose the Python iter protocol. - - - repr: Added for types that override ToString - - get: added for types that implement IDescriptor - - - - - __dir__(self) -> Returns the list of members defined on a foreign IDynamicMetaObjectProvider. - - - - - Provides the implementation of __enter__ for objects which implement IDisposable. - - - - - Provides the implementation of __exit__ for objects which implement IDisposable. - - - - - Determines if a type member can be imported. This is used to treat static types like modules. - - - - - Implements __contains__ for types implementing IEnumerable of T. - - - - - Implements __contains__ for types implementing IEnumerable - - - - - Implements __contains__ for types implementing IEnumerable of T. - - - - - Implements __contains__ for types implementing IEnumerable - - - - - Implements __reduce_ex__ for .NET types which are serializable. This uses the .NET - serializer to get a string of raw data which can be serialized. - - - - - Contains Python extension methods that are added to object - - - - Types for which the pickle module has built-in support (from PEP 307 case 2) - - - - __class__, a custom slot so that it works for both objects and types. - - - - - Removes an attribute from the provided member - - - - - Returns the hash code of the given object - - - - - Gets the specified attribute from the object without running any custom lookup behavior - (__getattr__ and __getattribute__) - - - - - Initializes the object. The base class does nothing. - - - - - Initializes the object. The base class does nothing. - - - - - Initializes the object. The base class does nothing. - - - - - Creates a new instance of the type - - - - - Creates a new instance of the type - - - - - Creates a new instance of the type - - - - - Runs the pickle protocol - - - - - Runs the pickle protocol - - - - - Runs the pickle protocol - - - - - Returns the code representation of the object. The default implementation returns - a string which consists of the type and a unique numerical identifier. - - - - - Sets an attribute on the object without running any custom object defined behavior. - - - - - Returns the number of bytes of memory required to allocate the object. - - - - - Returns a friendly string representation of the object. - - - - - Return a dict that maps slot names to slot values, but only include slots that have been assigned to. - Looks up slots in base types as well as the current type. - - Sort-of Python equivalent (doesn't look up base slots, while the real code does): - return dict([(slot, getattr(self, slot)) for slot in type(self).__slots__ if hasattr(self, slot)]) - - Return null if the object has no __slots__, or empty dict if it has __slots__ but none are initialized. - - - - - Implements the default __reduce_ex__ method as specified by PEP 307 case 2 (new-style instance, protocol 0 or 1) - - - - - Returns the closest base class (in terms of MRO) that isn't defined in Python code - - - - - Implements the default __reduce_ex__ method as specified by PEP 307 case 3 (new-style instance, protocol 2) - - - - - Contains functions that are called directly from - generated code to perform low-level runtime functionality. - - - - - Creates a new dictionary extracting the keys and values from the - provided data array. Keys/values are adjacent in the array with - the value coming first. - - - - - Creates a new dictionary extracting the keys and values from the - provided data array. Keys/values are adjacent in the array with - the value coming first. - - - - - Wraps up all the semantics of multiplying sequences so that all of our sequences - don't duplicate the same logic. When multiplying sequences we need to deal with - only multiplying by valid sequence types (ints, not floats), support coercion - to integers if the type supports it, not multiplying by None, and getting the - right semantics for multiplying by negative numbers and 1 (w/ and w/o subclasses). - - This function assumes that it is only called for case where count is not implicitly - coercible to int so that check is skipped. - - - - - Supports calling of functions that require an explicit 'this' - Currently, we check if the function object implements the interface - that supports calling with 'this'. If not, the 'this' object is dropped - and a normal call is made. - - - - - Called from generated code emitted by NewTypeMaker. - - - - - Handles the descriptor protocol for user-defined objects that may implement __get__ - - - - - Handles the descriptor protocol for user-defined objects that may implement __set__ - - - - - Handles the descriptor protocol for user-defined objects that may implement __delete__ - - - - - Python runtime helper for raising assertions. Used by AssertStatement. - - Object representing the assertion message - - - - Python runtime helper to create instance of Python List object. - - New instance of List - - - - Python runtime helper to create a populated instance of Python List object. - - - - - Python runtime helper to create a populated instance of Python List object w/o - copying the array contents. - - - - - Python runtime helper to create a populated instance of Python List object. - - List is populated by arbitrary user defined object. - - - - - Python runtime helper to create an instance of Python List object. - - List has the initial provided capacity. - - - - - Python runtime helper to create an instance of Tuple - - - - - - - Python runtime helper to create an instance of Tuple - - - - - - Python Runtime Helper for enumerator unpacking (tuple assignments, ...) - Creates enumerator from the input parameter e, and then extracts - expected number of values, returning them as array - - If the input is a Python tuple returns the tuples underlying data array. Callers - should not mutate the resulting tuple. - - The code context of the AST getting enumerator values. - object to enumerate - expected number of objects to extract from the enumerator - - array of objects (.Lengh == expected) if exactly expected objects are in the enumerator. - Otherwise throws exception - - - - - Python runtime helper to create instance of Slice object - - Start of the slice. - End of the slice. - Step of the slice. - Slice - - - - Prints newline into default standard output - - - - - Prints newline into specified destination. Sets softspace property to false. - - - - - Prints value into default standard output with Python comma semantics. - - - - - Prints value into specified destination with Python comma semantics. - - - - - Called from generated code when we are supposed to print an expression value - - - - - Called from generated code for: - - import spam.eggs - - - - - Python helper method called from generated code for: - - import spam.eggs as ham - - - - - Called from generated code for: - - from spam import eggs1, eggs2 - - - - - Imports one element from the module in the context of: - - from module import a, b, c, d - - Called repeatedly for all elements being imported (a, b, c, d above) - - - - - Called from generated code for: - - from spam import * - - - - - Unqualified exec statement support. - A Python helper which will be called for the statement: - - exec code - - - - - Qualified exec statement support, - Python helper which will be called for the statement: - - exec code in globals [, locals ] - - - - - Called from generated code at the start of a catch block. - - - - - Get an exception tuple for the "current" exception. This is used for sys.exc_info() - - - - - Get an exception tuple for a given exception. This is like the inverse of MakeException. - - the code context - the exception to create a tuple for. - a tuple of (type, value, traceback) - This is called directly by the With statement so that it can get an exception tuple - in its own private except handler without disturbing the thread-wide sys.exc_info(). - - - - helper function for re-raised exceptions. - - - - - helper function for non-re-raise exceptions. - - type is the type of exception to throw or an instance. If it - is an instance then value should be null. - - If type is a type then value can either be an instance of type, - a Tuple, or a single value. This case is handled by EC.CreateThrowable. - - - - - Extracts an argument from either the dictionary or params - - - - - Creates a new array the values set to Uninitialized.Instance. The array - is large enough to hold for all of the slots allocated for the type and - its sub types. - - - - - Helper to determine if the value is a simple numeric type (int or big int or bool) - used for OldInstance - deprecated form of slicing. - - - - - Helper to determine if the type is a simple numeric type (int or big int or bool) - used for OldInstance - deprecated form of slicing. - - - - - Helper to determine if the type is a simple numeric type (int or big int or bool) but not a subclass - - - - - For slicing. Fixes up a BigInteger and returns an integer w/ the length of the - object added if the value is negative. - - - - - For slicing. Gets the length of the object, used to only get the length once. - - - - - Helper method for DynamicSite rules that check the version of their dynamic object - TODO - Remove this method for more direct field accesses - - - - - - - - Called from generated code. Gets a builtin function and the BuiltinFunctionData associated - with the object. Tests to see if the function is bound and has the same data for the generated - rule. - - - - - Convert object to a given type. This code is equivalent to NewTypeMaker.EmitConvertFromObject - except that it happens at runtime instead of compile time. - - - - - Provides access to AppDomain.DefineDynamicAssembly which cannot be called from a DynamicMethod - - - - - Generates a new delegate type. The last type in the array is the return type. - - - - - Generates a new delegate type. The last type in the array is the return type. - - - - - Provides the entry point for a compiled module. The stub exe calls into InitializeModule which - does the actual work of adding references and importing the main module. Upon completion it returns - the exit code that the program reported via SystemExit or 0. - - - - - Provides the entry point for a compiled module. The stub exe calls into InitializeModule which - does the actual work of adding references and importing the main module. Upon completion it returns - the exit code that the program reported via SystemExit or 0. - - - - - Called from generated code, helper to remove a name - - - - - Called from generated code, helper to do name lookup - - - - - Called from generated code, helper to do name assignment - - - - - Returns an IntPtr in the proper way to CPython - an int or a Python long - - - - - Create at TypeError exception for when Raise() can't create the exception requested. - - original type of exception requested - a TypeEror exception - - - - Gets a list of DynamicStackFrames for the given exception. These stack frames - can be programmatically inspected to understand the frames the exception crossed - through including Python frames. - - Dynamic stack frames are not preserved when an exception crosses an app domain - boundary. - - - - - Helper clas for calls to unicode(...). We generate code which checks if unicode - is str and if it is we redirect those calls to the unicode function defined on this - class. - - - - - ExtensibleString is the base class that is used for types the user defines - that derive from string. It carries along with it the string's value and - our converter recognizes it as a string. - - - - - StringOps is the static class that contains the methods defined on strings, i.e. 'abc' - - Here we define all of the methods that a Python user would see when doing dir('abc'). - If the user is running in a CLS aware context they will also see all of the methods - defined in the CLS System.String type. - - - - - Returns a copy of this string converted to uppercase - - - - - return true if self is a titlecased string and there is at least one - character in self; also, uppercase characters may only follow uncased - characters (e.g. whitespace) and lowercase characters only cased ones. - return false otherwise. - - - - - Return a string which is the concatenation of the strings - in the sequence seq. The separator between elements is the - string providing this method - - - - - Replaces each replacement field in the string with the provided arguments. - - replacement_field = "{" field_name ["!" conversion] [":" format_spec] "}" - field_name = (identifier | integer) ("." identifier | "[" element_index "]")* - - format_spec: [[fill]align][sign][#][0][width][,][.precision][type] - - Conversion can be 'r' for repr or 's' for string. - - - - - Replaces each replacement field in the string with the provided arguments. - - replacement_field = "{" field_name ["!" conversion] [":" format_spec] "}" - field_name = (identifier | integer) ("." identifier | "[" element_index "]")* - - format_spec: [[fill]align][sign][#][0][width][.precision][type] - - Conversion can be 'r' for repr or 's' for string. - - - - - Gets the starting offset checking to see if the incoming bytes already include a preamble. - - - - When encoding or decoding strings if an error occurs CPython supports several different - behaviors, in addition it supports user-extensible behaviors as well. For the default - behavior we're ok - both of us support throwing and replacing. For custom behaviors - we define a single fallback for decoding and encoding that calls the python function to do - the replacement. - - When we do the replacement we call the provided handler w/ a UnicodeEncodeError or UnicodeDecodeError - object which contains: - encoding (string, the encoding the user requested) - end (the end of the invalid characters) - object (the original string being decoded) - reason (the error, e.g. 'unexpected byte code', not sure of others) - start (the start of the invalid sequence) - - The decoder returns a tuple of (unicode, int) where unicode is the replacement string - and int is an index where encoding should continue. - - - - Indexer for generic parameter resolution. We bind to one of the generic versions - available in this type collision. A user can also do someType[()] to force to - bind to the non-generic version, but we will always present the non-generic version - when no bindings are available. - - - - - Object.ToString() displays the CLI type name. But we want to display the class name (e.g. - '<foo object at 0x000000000000002C>' unless we've overridden __repr__ but not __str__ in - which case we'll display the result of __repr__. - - - - - Provides a debug view for user defined types. This class is declared as public - because it is referred to from generated code. You should not use this class. - - - - - A DynamicMetaObject which is just used to support custom conversions to COM. - - - - - A marker interface so we can recognize and access sequence members on our array objects. - - - - - List of unary operators which we have sites for to enable fast dispatch that - doesn't collide with other operators. - - - - - Sets the mode to text or binary. Returns true if previously set to text, false if previously set to binary. - - - - - Truncates the file to the current length as indicated by tell(). - - - - - Truncates the file to the specified length. - - - - - - Provides storage of IronPython specific data in the DLR Scope ScopeExtension. - - This enables IronPython to track code compilation flags such as from __future__ - flags and import clr flags across multiple executions of user-provided scopes. - - - - - Provides human readable names for how Python maps the various DLR NarrowingLevel's. - - - - - No narrowing conversions are performed - - - - - Double/Single to Decimal - PythonTuple to Array - Generic conversions - BigInteger to Int64 - - - - - Numeric conversions excluding from floating point values - Boolean conversions - Delegate conversions - Enumeration conversions - - - - - Enables Python protocol conversions (__int__, etc...) - - - - - Provides dictionary based storage which is backed by a Scope object. - - - - - Mutable set class - - - - - Appends an IEnumerable to an existing set - - - - - Immutable set class - - - - - Iterator over sets - - - - - Gets the indices for the deprecated __getslice__, __setslice__, __delslice__ functions - - This form is deprecated in favor of using __getitem__ w/ a slice object as an index. This - form also has subtly different mechanisms for fixing the slice index before calling the function. - - If an index is negative and __len__ is not defined on the object than an AttributeError - is raised. - - - - - StringFormatter provides Python's % style string formatting services. - - - - - Read a possible mapping key for %(key)s. - - The key name enclosed between the '%(key)s', - or null if there are no paranthesis such as '%s'. - - - - AppendBase appends an integer at the specified radix doing all the - special forms for Python. We have a copy and paste version of this - for BigInteger below that should be kept in sync. - - - - - BigInteger version of AppendBase. Should be kept in sync w/ AppendBase - - - - - public class to get optimized - - - - - Returns detailed call statistics. Not implemented in IronPython and always returns None. - - - - - Handles output of the expression statement. - Prints the value and sets the __builtin__._ - - - - - Provides a CustomTracker which handles special fields which have custom - behavior on get/set. - - - - - Provides custom, versioned, dictionary access for instances. Used for both - new-style and old-style instances. - - Each class can allocate a version for instance storage using the - CustomInstanceDictionaryStorage.AllocateInstance method. The version allocated - is dependent upon the names which are likely to appear in the instance - dictionary. Currently these names are calculated by collecting the names - that are assigned to during the __init__ method and combining these with - all such names in the types MRO. - - When creating the dictionary for storing instance values the class can then create - a PythonDictionary backed by a CustomInstanceDictionaryStorage with it's - version. When doing a get/set optimized code can then be produced that - verifies we have CustomInstanceDictionaryStorage and it has the - correct version. If we have a matching dictionary then gets/sets can turn - into simple array accesses rather than dictionary gets/sets. For programs - which access a large number of instance variables this can dramatically - speed up the program. - - TODO: Should we attempt to unify all versions which share the same keys? - - - - - Interface used for things which can convert to delegates w/o code gen. Currently - this is just non-overloaded builtin functions and bound builtin functions. Avoiding - the code gen is not only nice for compilation but it also enables delegates to be added - in C# and removed in Python. - - - - - Represents a set of attributes that different functions can have. - - - - No flags have been set - - - This is a function w/ no instance pointer - - - This is a method that requires an instance - - - Built-in functions can encapsulate both methods and functions, in which case both bits are set - - - True is the function/method should be visible from pure-Python code - - - True if this is a __r*__ method for a CLS overloaded operator method - - - - This method represents a binary operator method for a CLS overloaded operator method. - - Being a binary operator causes the following special behaviors to kick in: - A failed binding at call time returns NotImplemented instead of raising an exception - A reversed operator will automatically be created if: - 1. The parameters are both of the instance type - 2. The parameters are in reversed order (other, this) - - This enables simple .NET operator methods to be mapped into the Python semantics. - - - - - A method declared on a built-in module - - - - - OperatorMapping provides a mapping from DLR operators to their associated .NET methods. - - - - - Given an operator returns the OperatorMapping associated with the operator or null - - - - - The operator the OperatorMapping provides info for. - - - - - The primary method name associated with the method. This method name is - usally in the form of op_Operator (e.g. op_Addition). - - - - - The secondary method name associated with the method. This method name is - usually a standard .NET method name with pascal casing (e.g. Add). - - - - - The return type that must match for the alternate operator to be valid. - - This is available alternate operators don't have special names and therefore - could be confused for a normal method which isn't fulfilling the contract. - - - - - This helper type lets us build a fake ParameterInfo object with a specific type and name - to pass along to methods that expect ParameterInfos. This is currently found useful - for the NewTypeMaker code and may be useful in other situations as well. - - - - - Cached CallSites. User types are cached on the PythonType and System types are cached on the - PythonContext to avoid cross-runtime contamination due to the binder on the site. - - - - - Represents a PythonType. Instances of PythonType are created via PythonTypeBuilder. - - - - - Used in copy_reg which is the only consumer of __flags__ in the standard library. - - Set if the type is user defined - - - - - Set if the type has __abstractmethods__ defined - - - - - Implements fast binding for user defined types. This ensures that common highly dynamic - scenarios will run fast (for instance creating new types repeatedly and only creating a limited - number of instances of them). It also gives better code sharing amongst different subclasses - of the same types and improved startup time due to reduced code generation. - - - - - Provides delegates that will invoke a parameterless type ctor. The first key provides - the dictionary for a specific type, the 2nd key provides the delegate for a specific - call site type used in conjunction w/ our IFastInvokable implementation. - - - - - Shared built-in functions for creating instances of user defined types. Because all - types w/ the same UnderlyingSystemType share the same constructors these can be - shared across multiple types. - - - - - Creates a new type for a user defined type. The name, base classes (a tuple of type - objects), and a dictionary of members is provided. - - - - - Creates a new type for a user defined type. The name, base classes (a tuple of type - objects), and a dictionary of members is provided. - - - - - Creates a new PythonType object which is backed by the specified .NET type for - storage. The type is considered a system type which can not be modified - by the user. - - - - - - Creates a new PythonType which is a subclass of the specified PythonType. - - Used for runtime defined new-style classes which require multiple inheritance. The - primary example of this is the exception system. - - - - - Creates a new PythonType which is a subclass of the specified PythonTypes. - - Used for runtime defined new-style classes which require multiple inheritance. The - primary example of this is the exception system. - - - - - Creates a new PythonType which is a subclass of the specified PythonTypes. - - Used for runtime defined new-style classes which require multiple inheritance. The - primary example of this is the exception system. - - - - - Creates a new PythonType which is a subclass of the specified PythonType. - - Used for runtime defined new-style classes which require multiple inheritance. The - primary example of this is the exception system. - - - - - Creates a new PythonType which is a subclass of the specified PythonTypes. - - Used for runtime defined new-style classes which require multiple inheritance. The - primary example of this is the exception system. - - - - - Creates a new PythonType which is a subclass of the specified PythonTypes. - - Used for runtime defined new-style classes which require multiple inheritance. The - primary example of this is the exception system. - - - - - Creates a new PythonType object which represents an Old-style class. - - - - - Returns true if the specified object is an instance of this type. - - - - - Gets the dynamic type that corresponds with the provided static type. - - Returns null if no type is available. TODO: In the future this will - always return a PythonType created by the DLR. - - - - - - - Sets the python type that corresponds with the provided static type. - - This is used for built-in types which have a metaclass. Currently - only used by ctypes. - - - - - Allocates the storage for the instance running the .NET constructor. This provides - the creation functionality for __new__ implementations. - - - - - Allocates the storage for the instance running the .NET constructor. This provides - the creation functionality for __new__ implementations. - - - - - Allocates the storage for the instance running the .NET constructor. This provides - the creation functionality for __new__ implementations. - - - - - Allocates the storage for the instance running the .NET constructor. This provides - the creation functionality for __new__ implementations. - - - - - Allocates the storage for the instance running the .NET constructor. This provides - the creation functionality for __new__ implementations. - - - - - Allocates the storage for the instance running the .NET constructor. This provides - the creation functionality for __new__ implementations. - - - - - Returns true if this type is a subclass of other - - - - - Looks up a slot on the dynamic type - - - - - Searches the resolution order for a slot matching by name - - - - - Searches the resolution order for a slot matching by name. - - Includes searching for methods in old-style classes - - - - - Internal helper to add a new slot to the type - - - - - - - Gets a value from a dynamic type and any sub-types. Values are stored in slots (which serve as a level of - indirection). This searches the types resolution order and returns the first slot that - contains the value. - - - - - Attempts to lookup a member w/o using the customizer. Equivelent to object.__getattribute__ - but it doens't throw an exception. - - - - - - Gets a value from a dynamic type and any sub-types. Values are stored in slots (which serve as a level of - indirection). This searches the types resolution order and returns the first slot that - contains the value. - - - - - Attempts to lookup a member w/o using the customizer. - - - - - - Sets a value on an instance. If a slot is available in the most derived type the slot - is set there, otherwise the value is stored directly in the instance. - - - - - Attempst to set a value w/o going through the customizer. - - This enables languages to provide the "base" implementation for setting attributes - so that the customizer can call back here. - - - - - Returns a list of all slot names for the type and any subtypes. - - The context that is doing the inquiry of InvariantContext.Instance. - - - - Returns a list of all slot names for the type, any subtypes, and the instance. - - The context that is doing the inquiry of InvariantContext.Instance. - the instance to get instance members from, or null. - - - - Adds members from a user defined type. - - - - - Adds members from a user defined type instance - - - - - Gets the .NET type which is used for instances of the Python type. - - When overridden by a metaclass enables a customization of the .NET type which - is used for instances of the Python type. Meta-classes can construct custom - types at runtime which include new .NET methods, fields, custom attributes or - other features to better interoperate with .NET. - - - - - Initializes a PythonType that represents a standard .NET type. The same .NET type - can be shared with the Python type system. For example object, string, int, - etc... are all the same types. - - - - - Creates a __new__ method for the type. If the type defines interesting constructors - then the __new__ method will call that. Otherwise if it has only a single argless - - - - - This will return a unique integer for every version of every type in the system. - This means that DynamicSite code can generate a check to see if it has the correct - PythonType and version with a single integer compare. - - TODO - This method and related code should fail gracefully on overflow. - - - - - Internal helper function to add a subtype - - - - - Returns a CLR WeakReference object to this PythonType that can be shared - between anyone who needs a weak reference to the type. - - - - - Gets the name of the dynamic type - - - - - Gets the resolution order used for attribute lookup - - - - - Gets the underlying system type that is backing this type. All instances of this - type are an instance of the underlying system type. - - - - - Gets the extension type for this type. The extension type provides - a .NET type which can be inherited from to extend sealed classes - or value types which Python allows inheritance from. - - - - - Gets the base types from which this type inherits. - - - - - True if the type is a system type. A system type is a type which represents an - underlying .NET type and not a subtype of one of these types. - - - - - Gets a list of weak references to all the subtypes of this class. May return null - if there are no subtypes of the class. - - - - - Base class for doing fast type invoke binding. Subclasses are created using - reflection once during the binding. The subclasses can then proceed to do - the binding w/o using reflection. Otherwise we'd have lots more reflection - calls which would slow the binding up. - - - - - Gets or creates delegate for calling the constructor function. - - - - - The type has a ctor which does not accept PythonTypes. This is used - for user defined types which implement __clrtype__ - - - - - Used when a type overrides __new__ with a Python function or other object - that can return an arbitrary value. If the return value is not the same type - as the type which had __new__ then we need to lookup __init__ on the type - and invoke it. Also handles initialization for finalization when __del__ - is defined for the same reasons. - - - - - target is the newly initialized value. - args are the arguments to be passed to __init__ - - - - - Couples a MemberGroup and the name which produces the member group together - - - - - Represents an ops-extension which adds a new slot. The slot can have arbitrary - get/set behavior above and beyond normal .NET methods or properties. This is - typically in regards to how it processes access from instances or subtypes. - - - - - Provides a slot object for the dictionary to allow setting of the dictionary. - - - - - Calculates the method resolution order for a Python class - the rules are: - If A is a subtype of B, then A has precedence (A > B) - If C appears before D in the list of bases then C > D - If E > F in one __mro__ then E > F in all __mro__'s for our subtype - - class A(object): pass - class B(object): pass - class C(B): pass - class N(A,B,C): pass # illegal - - This is because: - C.__mro__ == (C, B, object) - N.__mro__ == (N, A, B, C, object) - which would conflict, but: - - N(B,A) is ok (N, B, a, object) - N(C, B, A) is ok (N, C, B, A, object) - - Calculates a C3 MRO as described in "The Python 2.3 Method Resolution Order" - plus support for old-style classes. - - We build up a list of our base classes MRO's plus our base classes themselves. - We go through the list in order. Look at the 1st class in the current list, and - if it's not the non-first class in any other list then remove it from all the lists - and append it to the mro. Otherwise continue to the next list. If all the classes at - the start are no-good then the MRO is bad and we throw. - - For old-style classes if the old-style class is the only one in the list of bases add - it as a depth-first old-style MRO, otherwise compute a new-style mro for all the classes - and use that. - - - - - - - - - Returns the dictionary used to store state for this object - - - - - Python module. Stores classes, functions, and data. Usually a module - is created by importing a file or package from disk. But a module can also - be directly created by calling the module type and providing a name or - optionally a documentation string. - - - - - Creates a new module backed by a Scope. Used for creating modules for foreign Scope's. - - - - - Creates a new PythonModule with the specified dictionary. - - Used for creating modules for builtin modules which don't have any code associated with them. - - - - - Represents a member of a user-defined type which defines __slots__. The names listed in - __slots__ have storage allocated for them with the type and provide fast get/set access. - - - - - Gets the index into the object array to be used for the slot storage. - - - - - Helpers for interacting w/ .NET types. This includes: - - Member resolution via GetMember/GetMembers. This performs a member lookup which includes the registered - extension types in the PythonBinder. Internally the class has many MemberResolver's which provide - the various resolution behaviors. - - Cached member access - this is via static classes such as Object and provides various MemberInfo's so we're - not constantly looking up via reflection. - - - - list of resolvers which we run to resolve items - - - - Gets the statically known member from the type with the specific name. Searches the entire type hierarchy to find the specified member. - - - - - Gets all the statically known members from the specified type. Searches the entire type hierarchy to get all possible members. - - The result may include multiple resolution. It is the callers responsibility to only treat the 1st one by name as existing. - - - - - Gets the statically known member from the type with the specific name. Searches only the specified type to find the member. - - - - - Gets all the statically known members from the specified type. Searches only the specified type to find the members. - - The result may include multiple resolution. It is the callers responsibility to only treat the 1st one by name as existing. - - - - - Creates the resolver table which includes all the possible resolutions. - - - - - - Provides a resolution for __str__. - - - - - Provides a resolution for __repr__ - - - - - Helper to see if the type explicitly overrides the method. This ignores members - defined on object. - - - - - Provides a resolution for __hash__, first looking for IStructuralEquatable.GetHashCode, - then IValueEquality.GetValueHashCode. - - - - - Provides a resolution for __new__. For standard .NET types __new__ resolves to their - constructor. For Python types they inherit __new__ from their base class. - - TODO: Can we just always fallback to object.__new__? If not why not? - - - - - Provides a resolution for next - - - - - Provides a resolution for __len__ - - - - - Provides a resolution for __iter__ - - - - - Looks for an Equals overload defined on the type and if one is present binds __ne__ to an - InstanceOps helper. - - - - - Provides an implementation of __contains__. We can pull contains from: - ICollection of T which defines Contains directly - IList which defines Contains directly - IDictionary which defines Contains directly - IDictionary of K,V which defines Contains directly - IEnumerable of K which we have an InstaceOps helper for - IEnumerable which we have an instance ops helper for - IEnumerator of K which we have an InstanceOps helper for - IEnumerator which we have an instance ops helper for - - String is ignored here because it defines __contains__ via extension methods already. - - The lookup is well ordered and not dependent upon the order of values returned by reflection. - - - - - Helper for IEnumerable/IEnumerator __contains__ - - - - - Primary worker for getting the member(s) associated with a single name. Can be called with different MemberBinder's to alter the - scope of the search. - - - - - Primary worker for returning a list of all members in a type. Can be called with different MemberBinder's to alter the scope - of the search. - - - - - Helper to get a MemberGroup for methods declared on InstanceOps - - - - - Helper to get the proper typecasting method, according to the following precedence rules: - - 1. Strongest (most specific) declaring type - 2. Strongest (most specific) parameter type - 3. Type of conversion - i. Implicit - ii. Explicit - 4. Return type (order specified in toTypes) - - - - - Helper for creating a typecast resolver - - - - - Helper for creating __getitem__/__setitem__ resolvers - - false for a getter, true for a setter - - - - Filters out methods which are present on standard .NET types but shouldn't be there in Python - - - - - When private binding is enabled we can have a collision between the private Event - and private field backing the event. We filter this out and favor the event. - - This matches the v1.0 behavior of private binding. - - - - - Filters down to include only protected methods - - - - - If an operator is a reverisble operator (e.g. addition) then we need to filter down to just the forward/reverse - versions of the .NET method. For example consider: - - String.op_Multiplication(int, string) - String.op_Multiplication(string, int) - - If this method were defined on string it defines that you can do: - 2 * 'abc' - or: - 'abc' * 2 - - either of which will produce 'abcabc'. The 1st form is considered the reverse form because it is declared on string - but takes a non-string for the 1st argument. The 2nd is considered the forward form because it takes a string as the - 1st argument. - - When dynamically dispatching for 2 * 'abc' we'll first try __mul__ on int, which will fail with a string argument. Then we'll try - __rmul__ on a string which will succeed and dispatch to the (int, string) overload. - - For multiplication in this case it's not too interesting because it's commutative. For addition this might be more interesting - if, for example, we had unicode and ASCII strings. In that case Unicode strings would define addition taking both unicode and - ASCII strings in both forms. - - - - - Checks to see if the parameter type and the declaring type are compatible to determine - if an operator is forward or reverse. - - - - - Checks to see if this is an operator method which Python recognizes. For example - op_Comma is not recognized by Python and therefore should exposed to the user as - a method that is callable by name. - - - - - Provides a resolution for __complex__ - - - - - Provides a resolution for __float__ - - - - - Provides a resolution for __int__ - - - - - Provides a resolution for __long__ - - - - - Provides a resolution for __getitem__ - - - - - Provides a resolution for __setitem__ - - - - - Abstract class used for resolving members. This provides two methods of member look. The first is looking - up a single member by name. The other is getting all of the members. - - There are various subclasses of this which have different methods of resolving the members. The primary - function of the resolvers are to provide the name->value lookup. They also need to provide a simple name - enumerator. The enumerator is kept simple because it's allowed to return duplicate names as well as return - names of members that don't exist. The base MemberResolver will then verify their existance as well as - filter duplicates. - - - - - Looks up an individual member and returns a MemberGroup with the given members. - - - - - Returns a list of members that exist on the type. The ResolvedMember structure indicates both - the name and provides the MemberGroup. - - - - - Returns a list of possible members which could exist. ResolveMember needs to be called to verify their existance. Duplicate - names can also be returned. - - - - - One off resolver for various special methods which are known by name. A delegate is provided to provide the actual member which - will be resolved. - - - - - Standard resolver for looking up .NET members. Uses reflection to get the members by name. - - - - - Resolves methods mapped to __eq__ and __ne__ from: - 1. IStructuralEquatable.Equals - 2. IValueEquality.Equals (CLR2 only) - - - - - Resolves methods mapped to __gt__, __lt__, __ge__, __le__, as well as providing an alternate resolution - for __eq__ and __ne__, from the comparable type's CompareTo method. - - This should be run after the EqualityResolver. - - - - - Resolves methods mapped to __*__ methods automatically from the .NET operator. - - - - - Filters alternative methods out that don't match the expected signature and therefore - are just sharing a common method name. - - - - - Removes Object.Equals methods as we never return these for PythonOperationKind. - - - - - Provides bindings to private members when that global option is enabled. - - - - - Provides resolutions for protected members that haven't yet been - subclassed by NewTypeMaker. - - - - - Base class used for resolving a name into a member on the type. - - - - - Gets an instance op method for the given type and name. - - Instance ops methods appaer on the base most class that's required to expose it. So - if we have: Array[int], Array, object we'd only add an instance op method to Array and - Array[int] inherits it. It's obviously not on object because if it was there we'd just - put the method in ObjectOps. - - Therefore the different binders expose this at the appropriate times. - - - - - MemberBinder which searches the entire type hierarchy and their extension types to find a member. - - - - - MemberBinder which searches only the current type and it's extension types to find a member. - - - - - BuiltinFunction represents any standard CLR function exposed to Python. - This is used for both methods on standard Python types such as list or tuple - and for methods from arbitrary .NET assemblies. - - All calls are made through the optimizedTarget which is created lazily. - - TODO: Back BuiltinFunction's by MethodGroup's. - - - - - Creates a new builtin function for a static .NET function. This is used for module methods - and well-known __new__ methods. - - - - - Creates a built-in function for a .NET method declared on a type. - - - - - Creates a bound built-in function. The instance may be null for built-in functions - accessed for None. - - - - - Returns a BuiltinFunction bound to the provided type arguments. Returns null if the binding - cannot be performed. - - - - - Returns a descriptor for the built-in function if one is - neededed - - - - - Makes a test for the built-in function against the private _data - which is unique per built-in function. - - - - - Helper for generating the call to a builtin function. This is used for calls from built-in method - descriptors and built-in functions w/ and w/o a bound instance. - - This provides all sorts of common checks on top of the call while the caller provides a delegate - to do the actual call. The common checks include: - check for generic-only methods - reversed operator support - transforming arguments so the default binder can understand them (currently user defined mapping types to PythonDictionary) - returning NotImplemented from binary operators - Warning when calling certain built-in functions - - - The call binder we're doing the call for - An expression which points to the code context - the meta object for the built in function - true if we're calling with an instance - The arguments being passed to the function - A restriction for the built-in function, method desc, etc... - A delegate to perform the actual call to the method. - - - - Gets the target methods that we'll be calling. - - - - - True if the method should be visible to non-CLS opt-in callers - - - - - Provides (for reflected methods) a mapping from a signature to the exact target - which takes this signature. - signature with syntax like the following: - someClass.SomeMethod.Overloads[str, int]("Foo", 123) - - - - - Gets the overload dictionary for the logical function. These overloads - are never bound to an instance. - - - - - Returns the instance used for binding. This differs on module functions implemented - using instance methods so the built-in functions there don't expose the instance. - - - - - A custom built-in function which supports indexing - - - - - Use indexing on generic methods to provide a new reflected method with targets bound with - the supplied type arguments. - - - - - The unbound representation of an event property - - - - - BoundEvent is the object that gets returned when the user gets an event object. An - BoundEvent tracks where the event was received from and is used to verify we get - a proper add when dealing w/ statics events. - - - - - Represents a ReflectedProperty created for an extension method. Logically the property is an - instance property but the method implementing it is static. - - - - - Base class for properties backed by methods. These include our slot properties, - indexers, and normal properties. This class provides the storage of these as well - as the storage of our optimized getter/setter methods, documentation for the property, - etc... - - - - - Convenience function for users to call directly - - - - - This function can be used to set a field on a value type without emitting a warning. Otherwise it is provided only to have symmetry with properties which have GetValue/SetValue for supporting explicitly implemented interfaces. - - Setting fields on value types usually warns because it can silently fail to update the value you expect. For example consider this example where Point is a value type with the public fields X and Y: - - arr = System.Array.CreateInstance(Point, 10) - arr[0].X = 42 - print arr[0].X - - prints 0. This is because reading the value from the array creates a copy of the value. Setting the value then mutates the copy and the array does not get updated. The same problem exists when accessing members of a class. - - - - - Provides access to non-default .NET indexers (aka properties w/ parameters). - - C# doesn't support these, but both COM and VB.NET do. The types dictionary - gets populated w/a ReflectedGetterSetter indexer which is a descriptor. Getting - the descriptor returns a bound indexer. The bound indexer supports indexing. - We support multiple indexer parameters via expandable tuples. - - - - - Convenience function for users to call directly - - - - - Convenience function for users to call directly - - - - - True if generating code for gets can result in more optimal accesses. - - - - - single finalizable instance used to track and deliver all the - callbacks for a single object that has been weakly referenced by - one or more references and proxies. The reference to this object - is held in objects that implement IWeakReferenceable. - - - - - Finalizable object used to hook up finalization calls for OldInstances. - - We create one of these each time an object w/ a finalizer gets created. The - only reference to this object is the instance so when that goes out of context - this does as well and this will get finalized. - - - - - Marks a method/field/property as being a wrapper descriptor. A wrapper desriptor - is a member defined on PythonType but is available both for type and other - instances of type. For example type.__bases__. - - - - diff --git a/renderdocui/3rdparty/ironpython/LICENSE.md b/renderdocui/3rdparty/ironpython/LICENSE.md deleted file mode 100644 index 19a651e25..000000000 --- a/renderdocui/3rdparty/ironpython/LICENSE.md +++ /dev/null @@ -1,69 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -1. You must give any other recipients of the Work or Derivative Works a copy of this License; and - -2. You must cause any modified files to carry prominent notices stating that You changed the files; and - -3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - -You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. diff --git a/renderdocui/3rdparty/ironpython/Microsoft.Dynamic.dll b/renderdocui/3rdparty/ironpython/Microsoft.Dynamic.dll deleted file mode 100644 index f6bb2688a..000000000 Binary files a/renderdocui/3rdparty/ironpython/Microsoft.Dynamic.dll and /dev/null differ diff --git a/renderdocui/3rdparty/ironpython/Microsoft.Dynamic.xml b/renderdocui/3rdparty/ironpython/Microsoft.Dynamic.xml deleted file mode 100644 index c68cc6a0b..000000000 --- a/renderdocui/3rdparty/ironpython/Microsoft.Dynamic.xml +++ /dev/null @@ -1,6534 +0,0 @@ - - - - Microsoft.Dynamic - - - - - Binds named arguments to the parameters. Returns a permutation of indices that captures the relationship between - named arguments and their corresponding parameters. Checks for duplicate and unbound named arguments. - - Ensures that for all i: namedArgs[i] binds to parameters[args.Length + bindingPermutation[i]] - - - - - The number of arguments not counting the collapsed ones. - - - - - Gets the total number of visible arguments passed to the call site including collapsed ones. - - - - - ArgBuilder provides an argument value used by the MethodBinder. One ArgBuilder exists for each - physical parameter defined on a method. - - Contrast this with ParameterWrapper which represents the logical argument passed to the method. - - - - - Provides the Expression which provides the value to be passed to the argument. - If null is returned the argument is skipped (not passed to the callee). - - - - - Provides an Expression which will update the provided value after a call to the method. May - return null if no update is required. - - - - - If the argument produces a return value (e.g. a ref or out value) this provides - the additional value to be returned. - - - - - The number of actual arguments consumed by this builder. - - - - - Returns the type required for the argument or null if the ArgBuilder - does not consume a type. - - - - - An assignable value that is passed to a byref parameter - After the call it will contain the updated value - - - - - Indicates the specific type of failure, if any, from binding to a method. - - - - - The binding succeeded. Only one method was applicable or had the best conversion. - - - - - More than one method was applicable for the provided parameters and no method was considered the best. - - - - - There are no overloads that match the number of parameters required for the call - - - - - None of the target method(s) can successfully be called. The failure can be due to: - 1. Arguments could not be successfully converted for the call - 2. Keyword arguments could not be assigned to positional arguments - 3. Keyword arguments could be assigned but would result in an argument being assigned - multiple times (keyword and positional arguments conflit or dupliate keyword arguments). - - - - - Actual arguments cannot be constructed. - - - - - No method is callable. For example, all methods have an unbound generic parameter. - - - - - Encapsulates the result of an attempt to bind to one or methods using the OverloadResolver. - - Users should first check the Result property to see if the binding was successful or - to determine the specific type of failure that occured. If the binding was successful - MakeExpression can then be called to create an expression which calls the method. - If the binding was a failure callers can then create a custom error message based upon - the reason the call failed. - - - - - Creates a new BindingTarget when the method binding has succeeded. - - - - - Creates a new BindingTarget when the method binding has failed due to an incorrect argument count - - - - - Creates a new BindingTarget when the method binding has failued due to - one or more parameters which could not be converted. - - - - - Creates a new BindingTarget when the match was ambiguous - - - - - Other failure. - - - - - Gets an Expression which calls the binding target if the method binding succeeded. - - Throws InvalidOperationException if the binding failed. - - - - - Gets the result of the attempt to bind. - - - - - Returns the method if the binding succeeded, or null if no method was applicable. - - - - - Returns the selected overload if the binding succeeded, or null if no one was applicable. - - - - - Gets the name of the method as supplied to the OverloadResolver. - - - - - Returns the MethodTarget if the binding succeeded, or null if no method was applicable. - - - - - Returns the methods which don't have any matches or null if Result == BindingResult.AmbiguousMatch - - - - - Returns the methods and their associated conversion failures if Result == BindingResult.CallFailure. - - - - - Returns the acceptable number of arguments which can be passed to the method if Result == BindingResult.IncorrectArgumentCount. - - - - - Returns the total number of arguments provided to the call. 0 if the call succeeded or failed for a reason other - than argument count mismatch. - - - - - Gets the MetaObjects which we originally did binding against in their restricted form. - - The members of the array correspond to each of the arguments. All members of the array - have a value. - - - - - Returns the return type of the binding, or null if no method was applicable. - - - - - Returns the NarrowingLevel of the method if the call succeeded. If the call - failed returns NarrowingLevel.None. - - - - - Returns true if the binding was succesful, false if it failed. - - This is an alias for BindingTarget.Result == BindingResult.Success. - - - - - Creates a ReturnBuilder - - the type the ReturnBuilder will leave on the stack - - - - Represents the reason why a call to a specific method could not be performed by the OverloadResolver. - - The reason for the failure is specified by the CallFailureReason property. Once this property - has been consulted the other properties can be consulted for more detailed information regarding - the failure. - - If reason is ConversionFailure the ConversionResults property will be non-null. - If reason is UnassignableKeyword the KeywordArguments property will be non-null and include - the keywords which could not be assigned. - If reason is DuplicateKeyword the KeywordArguments property will be non-null and include - the keywords which were duplicated (either by the keywords themselves or by positional - arguments). - - MethodTarget is always set and indicates the method which failed to bind. - - - - - Gets the MethodTarget which the call failed for. - - - - - Gets the reason for the call failure which determines the other - properties of the CallFailure which should be consulted. - - - - - Gets a list of ConversionResult's for each parameter indicating - whether the conversion was successful or failed and the types - being converted. - - - - - Gets the list of keyword arguments that were either dupliated or - unassignable. - - - - - Default value, their was no CallFailure. - - - - - One of more parameters failed to be converted - - - - - One or more keyword arguments could not be successfully assigned to a positional argument - - - - - One or more keyword arguments were duplicated or would have taken the spot of a - provided positional argument. - - - - - Type arguments could not be inferred - - - - - Represents a collection of MethodCandidate's which all accept the - same number of logical parameters. For example a params method - and a method with 3 parameters would both be a CandidateSet for 3 parameters. - - - - - Represents information about a failure to convert an argument from one - type to another. - - - - - Value of the argument or null if it is not available. - - - - - Argument actual type or its limit type if the value not known. - DynamicNull if the argument value is null. - - - - - ArgBuilder which provides a default parameter value for a method call. - - - - - Provides binding and overload resolution to .NET methods. - - MethodBinder's can be used for: - generating new AST code for calling a method - calling a method via reflection at runtime - (not implemented) performing an abstract call - - MethodBinder's support default arguments, optional arguments, by-ref (in and out), and keyword arguments. - - Implementation Details: - - The MethodBinder works by building up a CandidateSet for each number of effective arguments that can be - passed to a set of overloads. For example a set of overloads such as: - foo(object a, object b, object c) - foo(int a, int b) - - would have 2 target sets - one for 3 parameters and one for 2 parameters. For parameter arrays - we fallback and create the appropriately sized CandidateSet on demand. - - Each CandidateSet consists of a set of MethodCandidate's. Each MethodCandidate knows the flattened - parameters that could be received. For example for a function such as: - foo(params int[] args) - - When this method is in a CandidateSet of size 3 the MethodCandidate takes 3 parameters - all of them - ints; if it's in a CandidateSet of size 4 it takes 4 parameters. Effectively a MethodCandidate is - a simplified view that allows all arguments to be treated as required positional arguments. - - Each MethodCandidate in turn refers to a MethodTarget. The MethodTarget is composed of a set - of ArgBuilder's and a ReturnBuilder which know how to consume the positional arguments and pass - them to the appropriate argument of the destination method. This includes routing keyword - arguments to the correct position, providing the default values for optional arguments, etc... - - After binding is finished the MethodCandidates are thrown away and a BindingTarget is returned. - The BindingTarget indicates whether the binding was successful and if not any additional information - that should be reported to the user about the failed binding. It also exposes the MethodTarget which - allows consumers to get the flattened list of required parameters for the call. MethodCandidates - are not exposed and are an internal implementation detail of the MethodBinder. - - - - - Resolves a method overload and returns back a BindingTarget. - - The BindingTarget can then be tested for the success or particular type of - failure that prevents the method from being called. If successfully bound the BindingTarget - contains a list of argument meta-objects with additional restrictions that ensure the selection - of the particular overload. - - - - - Checks to see if the language allows named arguments to be bound to instance fields or - properties and turned into setters. By default this is only allowed on contructors. - - - - - Gets an expression that evaluates to the result of GetByRefArray operation. - - - - - Allow to bind an array/dictionary instance or a null reference to params array/dictionary parameter. - - - - - Called before arguments binding. - - - A bitmask that indicates (set bits) the parameters that were mapped by this method. - A default mapping will be constructed for the remaining parameters (cleared bits). - - - - - Return null if arguments cannot be constructed and overload resolution should produce an error. - - - - - Determines whether given overloads are overloaded on index-th parameter (the types of the index-th parameters are the same). - - - - - Selects the best (of two) candidates for conversion from actualType - - - - - Provides ordering for two parameter types if there is no conversion between the two parameter types. - - - - - The method is called each time an item of lazily splatted argument is needed. - - - - - The number of actual arguments consumed by this builder. - - - - - ArgBuilder which provides a value for a keyword argument. - - The KeywordArgBuilder calculates its position at emit time using it's initial - offset within the keyword arguments, the number of keyword arguments, and the - total number of arguments provided by the user. It then delegates to an - underlying ArgBuilder which only receives the single correct argument. - - Delaying the calculation of the position to emit time allows the method binding to be - done without knowing the exact the number of arguments provided by the user. Hence, - the method binder can be dependent only on the set of method overloads and keyword names, - but not the user arguments. While the number of user arguments could be determined - upfront, the current MethodBinder does not have this design. - - - - - The underlying builder should expect a single parameter as KeywordArgBuilder is responsible - for calculating the correct parameter to use - - - - - - Updates fields/properties of the returned value with unused keyword parameters. - - - - - MethodCandidate represents the different possible ways of calling a method or a set of method overloads. - A single method can result in multiple MethodCandidates. Some reasons include: - - Every optional parameter or parameter with a default value will result in a candidate - - The presence of ref and out parameters will add a candidate for languages which want to return the updated values as return values. - - ArgumentKind.List and ArgumentKind.Dictionary can result in a new candidate per invocation since the list might be different every time. - - Each MethodCandidate represents the parameter type for the candidate using ParameterWrapper. - - - - - Builds a new MethodCandidate which takes count arguments and the provided list of keyword arguments. - - The basic idea here is to figure out which parameters map to params or a dictionary params and - fill in those spots w/ extra ParameterWrapper's. - - - - - Narrowing conversions are conversions that cannot be proved to always succeed, conversions that are - known to possibly lose information, and conversions across domains of types sufficiently different - to merit narrowing notation like casts. - - Its upto every language to define the levels for conversions. The narrowling levels can be used by - for method overload resolution, where the overload is based on the parameter types (and not the number - of parameters). - - - - - Conversions at this level do not do any narrowing. Typically, this will include - implicit numeric conversions, Type.IsAssignableFrom, StringBuilder to string, etc. - - - - - Language defined prefered narrowing conversion. First level that introduces narrowing - conversions. - - - - - Language defined preferred narrowing conversion. Second level that introduces narrowing - conversions and should have more conversions than One. - - - - - Language defined preferred narrowing conversion. Third level that introduces narrowing - conversions and should have more conversions that Two. - - - - - A somewhat meaningful conversion is possible, but it will quite likely be lossy. - For eg. BigInteger to an Int32, Boolean to Int32, one-char string to a char, - larger number type to a smaller numeric type (where there is no overflow), etc - - - - - Builds the argument for an out argument when not passed a StrongBox. The out parameter - is returned as an additional return value. - - - - - Defines a method overload abstraction for the purpose of overload resolution. - It provides the overload resolver the metadata it needs to perform the resolution. - - - WARNING: This is a temporary API that will undergo breaking changes in future versions. - - - - - Null for constructors. - - - - - The method arity can vary, i.e. the method has params array or params dict parameters. - - - - - Represents a method overload that is bound to a . - - - Not thread safe. - WARNING: This is a temporary API that will undergo breaking changes in future versions. - - - - - Maps out parameters to return args and ref parameters to ones that don't accept StrongBox. - - - - - ParameterWrapper represents the logical view of a parameter. For eg. the byref-reduced signature - of a method with byref parameters will be represented using a ParameterWrapper of the underlying - element type, since the logical view of the byref-reduced signature is that the argument will be - passed by value (and the updated value is included in the return value). - - Contrast this with ArgBuilder which represents the real physical argument passed to the method. - - - - - ParameterInfo is not available. - - - - - Creates a parameter that represents an expanded item of params-array. - - - - - True if the wrapper represents a params-array parameter (false for parameters created by expansion of a params-array). - - - - - True if the wrapper represents a params-dict parameter (false for parameters created by expansion of a params-dict). - - - - - Builds the parameter for a params dictionary argument - this collects all the extra name/value - pairs provided to the function into a SymbolDictionary which is passed to the function. - - - - - An argument that the user wants to explicitly pass by-reference (with copy-in copy-out semantics). - The user passes a StrongBox[T] object whose value will get updated when the call returns. - - - - - SimpleArgBuilder produces the value produced by the user as the argument value. It - also tracks information about the original parameter and is used to create extended - methods for params arrays and param dictionary functions. - - - - - Parameter info is not available for this argument. - - - - - Type and whether the parameter is a params-array or params-dictionary is derived from info. - - - - - True if there are restrictions beyond just simple type restrictions - - - - - Builds a parameter for a reference argument when a StrongBox has not been provided. The - updated return value is returned as one of the resulting return values. - - - - - Gets the generic arguments for method based upon the constraints discovered during - type inference. Returns null if not all generic arguments had their types inferred. - - - - - Creates a new set of arg builders for the given generic method definition which target the new - parameters. - - - - - Creates a new list of ParameterWrappers for the generic method replacing the old parameters with the new ones. - - - - - Gets the generic type arguments sorted so that the type arguments - that are depended upon by other type arguments are sorted before - their dependencies. - - - - - Checks to see if the x type parameter is dependent upon the y type parameter. - - - - - Builds a mapping based upon generic parameter constraints between related generic - parameters. This is then used to sort the generic parameters so that we can process - the least dependent parameters first. For example given the method: - - void Foo{T0, T1}(T0 x, T1 y) where T0 : T1 - - We need to first infer the type information for T1 before we infer the type information - for T0 so that we can ensure the constraints are correct. - - - - - Returns a mapping from generic type parameter to the input DMOs which map to it. - - - - - Adds any additional ArgumentInputs entries for the given object and parameter type. - - - - - Walks the nested generic hierarchy to construct all of the generic parameters referred - to by this type. For example if getting the generic parameters for the x parameter on - the method: - - void Foo{T0, T1}(Dictionary{T0, T1} x); - - We would add both typeof(T0) and typeof(T1) to the list of generic arguments. - - - - - Provides generic type inference for a single parameter. - - - For example: - M{T}(T x) - M{T}(IList{T} x) - M{T}(ref T x) - M{T}(T[] x) - M{T}(ref Dictionary{T,T}[] x) - - - - - Provides generic type inference for a single parameter. - - - For example: - M{T}(T x) - M{T}(IList{T} x) - M{T}(ref T x) - M{T}(T[] x) - M{T}(ref Dictionary{T,T}[] x) - - - - - Checks if the constraints are violated by the given input for the specified generic method parameter. - - This method must be supplied with a mapping for any dependent generic method type parameters which - this one can be constrained to. For example for the signature "void Foo{T0, T1}(T0 x, T1 y) where T0 : T1". - we cannot know if the constraints are violated unless we know what we have calculated T1 to be. - - - - - Finds all occurences of genericParameter in openType and the corresponding concrete types in closedType. - Returns true iff all occurences of the generic parameter in the open type correspond to the same concrete type in the closed type - and this type satisfies given constraints. Returns the concrete type in match if so. - - - - - Maps a single type parameter to the possible parameters and DynamicMetaObjects - we can get inference from. For example for the signature: - - void Foo{T0, T1}(T0 x, T1 y, IList{T1} z); - - We would have one ArgumentInput for T0 which holds onto the DMO providing the argument - value for x. We would also have one ArgumentInput for T1 which holds onto the 2 DMOs - for y and z. Associated with y would be a GenericParameterInferer and associated with - z would be a ConstructedParameterInferer. - - - - - Implemented by DynamicMetaObject subclasses when the associated object - can participate in generic method type inference. This interface - is used when the inference engine is attempting to perform type inference - for a parameter which is typed to a delegate type. - - - - - Returns the type inferred for parameterType when performing - inference for a conversion to delegateType. - - - - - Provides information about the result of a custom object which dynamically - infers back types. - - Currently only used for invokable objects to feedback the types for a delegate - type. - - - - - Determines the result of a conversion action. The result can either result in an exception, a value that - has been successfully converted or default(T), or a true/false result indicating if the value can be converted. - - - - - Attempts to perform available implicit conversions and throws if there are no available conversions. - - - - - Attempst to perform available implicit and explicit conversions and throws if there are no available conversions. - - - - - Attempts to perform available implicit conversions and returns default(ReturnType) if no conversions can be performed. - - If the return type of the rule is a value type then the return value will be zero-initialized. If the return type - of the rule is object or another class then the return type will be null (even if the conversion is to a value type). - This enables ImplicitTry to be used to do TryConvertTo even if the type is value type (and the difference between - null and a real value can be distinguished). - - - - - Attempts to perform available implicit and explicit conversions and returns default(ReturnType) if no conversions - can be performed. - - If the return type of the rule is a value type then the return value will be zero-initialized. If the return type - of the rule is object or another class then the return type will be null (even if the conversion is to a value type). - This enables ExplicitTry to be used to do TryConvertTo even if the type is value type (and the difference between - null and a real value can be distinguished). - - - - - Provides binding semantics for a language. This include conversions as well as support - for producing rules for actions. These optimized rules are used for calling methods, - performing operators, and getting members using the ActionBinder's conversion semantics. - - - - - Provides binding semantics for a language. This include conversions as well as support - for producing rules for actions. These optimized rules are used for calling methods, - performing operators, and getting members using the ActionBinder's conversion semantics. - - - - - Converts an object at runtime into the specified type. - - - - - Determines if a conversion exists from fromType to toType at the specified narrowing level. - toNotNullable is true if the target variable doesn't allow null values. - - - - - Provides ordering for two parameter types if there is no conversion between the two parameter types. - - - - - Converts the provided expression to the given type. The expression is safe to evaluate multiple times. - - - - - Gets the members that are visible from the provided type of the specified name. - - The default implemetnation first searches the type, then the flattened heirachy of the type, and then - registered extension methods. - - - - - Called when a set is attempting to assign to a field or property from a derived class through the base class. - - The default behavior is to allow the assignment. - - - - - Creates an ErrorInfo object when a static property is accessed from an instance member. The default behavior is throw - an exception indicating that static members properties be accessed via an instance. Languages can override this to - customize the exception, message, or to produce an ErrorInfo object which reads or writes to the property being accessed. - - The static property being accessed through an instance - True if the user is assigning to the property, false if the user is reading from the property - The parameters being used to access the property. This includes the instance as the first entry, any index parameters, and the - value being assigned as the last entry if isAssignment is true. - - - - - Provides a way for the binder to provide a custom error message when lookup fails. Just - doing this for the time being until we get a more robust error return mechanism. - - Deprecated, use the non-generic version instead - - - - - Gets the extension members of the given name from the provided type. Base classes are also - searched for their extension members. Once any of the types in the inheritance hierarchy - provide an extension member the search is stopped. - - - - - Gets the extension members of the given name from the provided type. Subclasses of the - type and their extension members are not searched. - - - - - Provides an opportunity for languages to replace all MemberTracker's with their own type. - - Alternatlely a language can expose MemberTracker's directly. - - The member which is being returned to the user. - Tthe type which the memberTrack was accessed from - - - - - Determines if the binder should allow access to non-public members. - - By default the binder does not allow access to non-public members. Base classes - can inherit and override this value to customize whether or not private binding - is available. - - - - - Creates the MetaObject for indexing directly into arrays or indexing into objects which have - default members. Returns null if we're not an indexing operation. - - - - - Creates the MetaObject for indexing directly into arrays or indexing into objects which have - default members. Returns null if we're not an indexing operation. - - - - - Creates the meta object for the rest of the operations: comparisons and all other - ExpressionType. If the operation cannot be completed a MetaObject which indicates an - error will be returned. - - - - - Creates the meta object for the rest of the operations: comparisons and all other - ExpressionType. If the operation cannot be completed a MetaObject which indicates an - error will be returned. - - - - - Produces a rule for comparing a value to null - supports comparing object references and nullable types. - - - - - Checks if the conversion is to object and produces a target if it is. - - - - - Checks if any conversions are available and if so builds the target for that conversion. - - - - - Checks if the conversion can be handled by a simple cast. - - - - - Checks if the conversion can be handled by calling a user-defined conversion method. - - - - - Helper that checkes both types to see if either one defines the specified conversion - method. - - - - - Checks if any of the members of the MemberGroup provide the applicable conversion and - if so uses it to build a conversion rule. - - - - - Checks if the conversion is to applicable by extracting the value from Extensible of T. - - - - - Checks if there's an implicit numeric conversion for primitive data types. - - - - - Checks if there's a conversion to/from Nullable of T. - - - - - Checks to see if there's a conversion of null to a reference type - - - - - Helper to produce an error when a conversion cannot occur - - - - - Helper to produce a rule which just boxes a value type - - - - - Helper to produce a conversion rule by calling the helper method to do the convert - - - - - Helper to produce a conversion rule by calling the helper method to do the convert - - - - - Helper to produce a conversion rule by calling the method to do the convert. This version takes the parameter - to be passed to the conversion function and we call it w/ our own value or w/ our Extensible.Value. - - - - - Helper to wrap explicit conversion call into try/catch incase it throws an exception. If - it throws the default value is returned. - - - - - Helper to produce a rule when no conversion is required (the strong type of the expression - input matches the type we're converting to or has an implicit conversion at the IL level) - - - - - Helper to produce a rule when no conversion is required from an extensible type's - underlying storage to the type we're converting to. The type of extensible type - matches the type we're converting to or has an implicit conversion at the IL level. - - - - - Helper to extract the value from an Extensible of T - - - - - Helper to convert a null value to nullable of T - - - - - Helper to produce the rule for converting T to Nullable of T - - - - - Helper to produce the rule for converting T to Nullable of T - - - - - Returns a value which indicates failure when a OldConvertToAction of ImplicitTry or - ExplicitTry. - - - - - Helper to extract the Value of an Extensible of T from the - expression being converted. - - - - - Helper that checks if fromType is an Extensible of T or a subtype of - Extensible of T and if so returns the T. Otherwise it returns fromType. - - This is used to treat extensible types the same as their underlying types. - - - - - Creates a target which returns null for a reference type. - - - - if a member-injector is defined-on or registered-for this type call it - - - - Builds a MetaObject for performing a member get. Supports all built-in .NET members, the OperatorMethod - GetBoundMember, and StrongBox instances. - - - The name of the member to retrieve. This name is not processed by the DefaultBinder and - is instead handed off to the GetMember API which can do name mangling, case insensitive lookups, etc... - - - The MetaObject from which the member is retrieved. - - - Returns a DynamicMetaObject which represents the value that will be returned when the member is accessed. - - The returned DynamicMetaObject may be strongly typed to a value type which needs boxing before being - returned from a standard DLR GetMemberBinder. The language is responsible for performing any boxing - so that it has an opportunity to perform custom boxing. - - - - - Builds a MetaObject for performing a member get. Supports all built-in .NET members, the OperatorMethod - GetBoundMember, and StrongBox instances. - - - The name of the member to retrieve. This name is not processed by the DefaultBinder and - is instead handed off to the GetMember API which can do name mangling, case insensitive lookups, etc... - - - The MetaObject from which the member is retrieved. - - - Provides overload resolution and method binding for any calls which need to be performed for the GetMember. - - - Returns a DynamicMetaObject which represents the value that will be returned when the member is accessed. - - The returned DynamicMetaObject may be strongly typed to a value type which needs boxing before being - returned from a standard DLR GetMemberBinder. The language is responsible for performing any boxing - so that it has an opportunity to perform custom boxing. - - - - - Builds a MetaObject for performing a member get. Supports all built-in .NET members, the OperatorMethod - GetBoundMember, and StrongBox instances. - - - The name of the member to retrieve. This name is not processed by the DefaultBinder and - is instead handed off to the GetMember API which can do name mangling, case insensitive lookups, etc... - - - The MetaObject from which the member is retrieved. - - - An OverloadResolverFactory which can be used for performing overload resolution and method binding. - - - True if the operation should return Operation.Failed on failure, false if it - should return the exception produced by MakeMissingMemberError. - - - The meta object to be used if the get results in an error. - - - Returns a DynamicMetaObject which represents the value that will be returned when the member is accessed. - - The returned DynamicMetaObject may be strongly typed to a value type which needs boxing before being - returned from a standard DLR GetMemberBinder. The language is responsible for performing any boxing - so that it has an opportunity to perform custom boxing. - - - - - Builds a MetaObject for performing a member get. Supports all built-in .NET members, the OperatorMethod - GetBoundMember, and StrongBox instances. - - - The name of the member to retrieve. This name is not processed by the DefaultBinder and - is instead handed off to the GetMember API which can do name mangling, case insensitive lookups, etc... - - - The MetaObject from which the member is retrieved. - - - True if the operation should return Operation.Failed on failure, false if it - should return the exception produced by MakeMissingMemberError. - - - The meta object to be used if the get results in an error. - - - Returns a DynamicMetaObject which represents the value that will be returned when the member is accessed. - - The returned DynamicMetaObject may be strongly typed to a value type which needs boxing before being - returned from a standard DLR GetMemberBinder. The language is responsible for performing any boxing - so that it has an opportunity to perform custom boxing. - - - - if a member-injector is defined-on or registered-for this type call it - - - - Provides default binding for performing a call on the specified meta objects. - - The signature describing the call - The meta object to be called. - - Additional meta objects are the parameters for the call as specified by the CallSignature in the CallAction. - - A MetaObject representing the call or the error. - - - - Provides default binding for performing a call on the specified meta objects. - - The signature describing the call - The meta object to be called. - - Additional meta objects are the parameters for the call as specified by the CallSignature in the CallAction. - - Overload resolver factory. - A MetaObject representing the call or the error. - - - - Provides default binding for performing a call on the specified meta objects. - - The signature describing the call - The meta object to be called. - - Additional meta objects are the parameters for the call as specified by the CallSignature in the CallAction. - - Overload resolver factory. - The result should the object be uncallable. - A MetaObject representing the call or the error. - - - - Gets a TargetInfo object for performing a call on this object. - - If this object is a delegate we bind to the Invoke method. - If this object is a MemberGroup or MethodGroup we bind to the methods in the member group. - If this object is a BoundMemberTracker we bind to the methods with the bound instance. - If the underlying type has defined an operator Call method we'll bind to that method. - - - - - Binds to the methods in a method group. - - - - - Binds to the methods in a member group. - - TODO: We should really only have either MemberGroup or MethodGroup, not both. - - - - - Binds to the BoundMemberTracker and uses the instance in the tracker and restricts - based upon the object instance type. - - - - - Binds to the Invoke method on a delegate if this is a delegate type. - - - - - Attempts to bind to an operator Call method. - - - - - Performs binding against a set of overloaded methods using the specified arguments. The arguments are - consumed as specified by the CallSignature object. - - Overload resolver. - The methods to be called - A meta object which results from the call. - - - - Performs binding against a set of overloaded methods using the specified arguments. The arguments are - consumed as specified by the CallSignature object. - - Overload resolver. - The methods to be called - The name of the method or null to use the name from targets. - A meta object which results from the call. - - - - Performs binding against a set of overloaded methods using the specified arguments. The arguments are - consumed as specified by the CallSignature object. - - Overload resolver. - The methods to be called - Additional restrictions which should be applied to the resulting MetaObject. - A meta object which results from the call. - - - - Performs binding against a set of overloaded methods using the specified arguments. The arguments are - consumed as specified by the CallSignature object. - - Overload resolver. - The methods to be called - Additional restrictions which should be applied to the resulting MetaObject. - The name of the method or null to use the name from targets. - A meta object which results from the call. - - - - Performs binding against a set of overloaded methods using the specified arguments. The arguments are - consumed as specified by the CallSignature object. - - TODO. - TODO. - Overload resolver. - The methods to be called - Additional restrictions which should be applied to the resulting MetaObject. - The resulting binding target which can be used for producing error information. - The name of the method or null to use the name from targets. - A meta object which results from the call. - - - - Makes test for param arrays and param dictionary parameters. - - - - - Pulls out the right argument to build the splat test. MakeParamsTest makes the actual test. - - - - - Builds the restrictions for calling with a splatted argument array. Ensures that the - argument is still an ICollection of object and that it has the same number of arguments. - - - - - Builds the restrictions for calling with keyword arguments. The restrictions include - tests on the individual keys of the dictionary to ensure they have the same names. - - - - - Builds a MetaObject for performing a member get. Supports all built-in .NET members, the OperatorMethod - GetBoundMember, and StrongBox instances. - - - The name of the member to retrieve. This name is not processed by the DefaultBinder and - is instead handed off to the GetMember API which can do name mangling, case insensitive lookups, etc... - - - The MetaObject from which the member is retrieved. - - - The value being assigned to the target member. - - - - - Builds a MetaObject for performing a member get. Supports all built-in .NET members, the OperatorMethod - GetBoundMember, and StrongBox instances. - - - The name of the member to retrieve. This name is not processed by the DefaultBinder and - is instead handed off to the GetMember API which can do name mangling, case insensitive lookups, etc... - - - The MetaObject from which the member is retrieved. - - - The value being assigned to the target member. - - - Provides overload resolution and method binding for any calls which need to be performed for the SetMember. - - - - - Builds a MetaObject for performing a member get. Supports all built-in .NET members, the OperatorMethod - GetBoundMember, and StrongBox instances. - - - The name of the member to retrieve. This name is not processed by the DefaultBinder and - is instead handed off to the GetMember API which can do name mangling, case insensitive lookups, etc... - - - The MetaObject from which the member is retrieved. - - - The value being assigned to the target member. - - - Provides a DynamicMetaObject that is to be used as the result if the member cannot be set. If null then then a language - specific error code is provided by ActionBinder.MakeMissingMemberErrorForAssign which can be overridden by the language. - - - - - Builds a MetaObject for performing a member get. Supports all built-in .NET members, the OperatorMethod - GetBoundMember, and StrongBox instances. - - - The name of the member to retrieve. This name is not processed by the DefaultBinder and - is instead handed off to the GetMember API which can do name mangling, case insensitive lookups, etc... - - - The MetaObject from which the member is retrieved. - - - The value being assigned to the target member. - - - Provides overload resolution and method binding for any calls which need to be performed for the SetMember. - - - Provides a DynamicMetaObject that is to be used as the result if the member cannot be set. If null then then a language - specific error code is provided by ActionBinder.MakeMissingMemberErrorForAssign which can be overridden by the language. - - - - if a member-injector is defined-on or registered-for this type call it - - - - Provides a way for the binder to provide a custom error message when lookup fails. Just - doing this for the time being until we get a more robust error return mechanism. - - - - - Called when the user is accessing a protected or private member on a get. - - The default implementation allows access to the fields or properties using reflection. - - - - - Provides a way for the binder to provide a custom error message when lookup fails. Just - doing this for the time being until we get a more robust error return mechanism. - - - - - Helper class for flowing information about the GetMember request. - - - - - Helper class for flowing information about the GetMember request. - - - - - Encapsulates information about the target of the call. This includes an implicit instance for the call, - the methods that we'll be calling as well as any restrictions required to perform the call. - - - - - A MetaObject which was produced as the result of a failed binding. - - - - - Interceptor prototype. The interceptor is a call site binder that wraps - a real call site binder and can perform arbitrary operations on the expression - trees that the wrapped binder produces: - * Dumping the trees - * Additional rewriting - * Static compilation - * ... - - - - - Returns true if the method should not be displayed in the stack frame. - - - - - Specifies the action for which the default binder is requesting a member. - - - - - If the number of items added to the builder is greater than 4 returns a read-only collection builder containing all the items. - Returns null otherwise. - - - - - Returns null if no expression was added into the builder. - If only a single expression was added returns it. - Otherwise returns a containing the expressions added to the builder. - - - - - Wrapping a tree in this node enables jumps from finally blocks - It does this by generating control-flow logic in the tree - - Reducing this node requires a full tree walk of its body - (but not nested lambdas) - - WARNING: this node cannot contain jumps across blocks, because it - assumes any unknown jumps are jumps to an outer scope. - - - - - Factory methods. - - - - - Determines whether specified expression type represents an assignment. - - - True if the expression type represents an assignment. - - - Note that some other nodes can also assign to variables, members or array items: - MemberInit, NewArrayInit, Call with ref params, New with ref params, Dynamic with ref params. - - - - - Determines if the left child of the given expression is read or written to or both. - - - - - Converts an expression to a void type. - - An to convert to void. - An that has the property equal to and the and property set to void. - - - - Returns an expression that boxes a given value. Uses boxed objects cache for Int32 and Boolean types. - - - - - Creates a generator with type IEnumerable{T}, where T is the label.Type - - - - - - - - Null coalescing expression - {result} ::= ((tmp = {_left}) == null) ? {right} : tmp - '??' operator in C#. - - - - - True coalescing expression. - {result} ::= IsTrue(tmp = {left}) ? {right} : tmp - Generalized AND semantics. - - - - - False coalescing expression. - {result} ::= IsTrue(tmp = {left}) ? tmp : {right} - Generalized OR semantics. - - - - - True coalescing expression. - {result} ::= IsTrue(tmp = {left}) ? {right} : tmp - Generalized AND semantics. - - - - - False coalescing expression. - {result} ::= IsTrue(tmp = {left}) ? tmp : {right} - Generalized OR semantics. - - - - - Wraps the given value in a WeakReference and returns a tree that will retrieve - the value from the WeakReference. - - - - - Creates new instance of the LambdaBuilder with the specified name and return type. - - Return type of the lambda being built. - Name for the lambda being built. - new LambdaBuilder instance - - - - The helper to create the AST method call node. Will add conversions (Utils.Convert) - to parameters and instance if necessary. - - - - - The helper to create the AST method call node. Will add conversions (Utils.Convert) - to parameters and instance if necessary. - - - - - The complex call helper to create the AST method call node. - Will add conversions (Expression.Convert()), deals with default parameter values and params arrays. - - - - - The purpose of this rewriter is simple: ETs do not allow jumps (break, continue, return, goto) - that would go through a finally/fault. So we replace them with code that instead stores a flag, - and then jumps to the end of the finally/fault. At the end of the try-finally, we emit a switch - that then jumps to the correct label. - - A few things that make this more complicated: - - 1. If a finally contains a jump out, then jumps in the try/catch need to be replaced as well. - It's to support cases like this: - # returns 234 - def foo(): - try: return 123 - finally: return 234 - - We need to replace the "return 123" because after it jumps, we'll go to the finally, which - might decide to jump again, but once the IL finally exits, it ignores the finally jump and - keeps going with the original jump. The moral of the story is: if any jumps in finally are - rewritten, try/catch jumps must be also. - - 2. To generate better code, we only have one state variable, so if we have to jump out of - multiple finallys we just keep jumping. It looks sort of like this: - foo: - try { ... } finally { - try { ... } finally { - ... - if (...) { - // was: goto foo; - $flow = 1; goto endInnerFinally; - } - ... - endInnerFinally: - } - switch ($flow) { - case 1: goto endOuterFinally; - } - ... - endOuterFinally: - } - switch ($flow) { - case 1: $flow = 0; goto foo; - } - ... - - - - - - Implemented by expressions which can provide a version which is aware of light exceptions. - - Normally these expressions will simply reduce to a version which throws a real exception. - When the expression is used inside of a region of code which supports light exceptions - the light exception re-writer will call ReduceForLightExceptions. The expression can - then return a new expression which can return a light exception rather than throwing - a real .NET exception. - - - - - Implemented by binders which support light exceptions. Dynamic objects - binding against a binder which implements this interface can check - SupportsLightThrow to see if the binder currently supports safely - returning a light exception. Light exceptions can be created with - LightException.Throw. - - Binders also need to implement GetlightBinder. This method - returns a new call site binder which may return light exceptions if - the binder supports them. - - - - - Gets a binder which will support light exception if one is - available. - - - - - Returns true if a callsite binding against this binder can - return light exceptions. - - - - - Provides a method call to a method which may return light exceptions. - - The call is to a method which supports light exceptions. When reducing - an additional check and throw is added. When a block code of is re-written - for light exceptions this instead reduces to not throw a .NET exception. - - - - - Expression which produces a light exception value. This should be constructed - with the expression which creates the exception and this method will then call - a helper method which wraps the exception in our internal light exception class. - - - - - Used by compilers to provide additional debug information about LambdaExpression to DebugContext - - - - - Implemented by compilers to allow the traceback engine to get additional information. - - - - - Provides services to compilers for instrumenting code with tracebacks. - - - - - Creates a new instance of DebugContext - - - - - Transforms a LambdaExpression to a debuggable LambdaExpression - - - - - Transforms a LambdaExpression to a debuggable LambdaExpression - - - - - Resets a state associated with a source file that's maintained in the DebugContext - - - - - Threads - - - - - Hook - - - - - // This method is called from the generator to update the frame with generator's locals - - - - - Remaps the frame's state to use the generator for execution. - - Int32.MaxValue to map to latest version - - - - Thread - - - - - FrameOrder - - - - - Variables - - - - - CurrentSequencePointIndex - - - - - DebuggableLambdaBuilder is used to transform a DLR expression tree into a debuggable lambda expression. - - - - - Used to wrap a lambda that was already a generator prior to transform. - - - - - Used to rewrite expressions containing DebugInfoExpressions. - - - - - Combines source file and span. Also provides Contains and Intersects functionality. - - - - - Implementation of IDebugRuntimeVariables, which wraps IRuntimeVariables + FunctionInfo/DebugMarker - - - - - IDebugRuntimeVariables is used to wrap IRuntimeVariables and add properties for retrieving - FunctionInfo and DebugMarker from debuggable labmdas. - - - - - Default implementation of BaseDebugThread, which uses DLR's RuntimeVariablesExpression for lifting locals. - - - - - Default implementation of IDebugThreadFactory, which uses DLR's RuntimeVariablesExpression for lifting locals. - - - - - IDebugThreadFactory is used to abstract how frames and local variables are maintained at run/debug time. - - - - - GetTraceLocations - - - - - - SequencePoints - - - - - Name - - - - - CustomPayload - - - - - Callback that is fired by the traceback engine - - - - - Used to extract locals information from expressions. - - - - - Strongly-typed and parameterized string factory. - - - - - Implements IRuntimeVariables in a way that preserves scoping within the lambda. - - - - - TraceSession - - - - - Used to provide information about locals/parameters at debug time. - - - - - Type - - - - - Name - - - - - Parameter - - - - - Caches type member lookup. - - - When enumerating members (methods, properties, events) of a type (declared or inherited) Reflection enumerates all - runtime members of the type and its base types and caches the result. - When looking for a member of a specific name Reflection still enumerates all and filters out those that don't match the name. - That's inefficient when looking for members of multiple names one by one. - Instead we build a map of name to member list and then answer subsequent queries by simply looking up the dictionary. - - - - - Provides services for loading XAML and binding events to dynamic language code definitions. - - - - - Loads XAML from the specified stream and returns the deserialized object. Any event handlers - are bound to methods defined in the provided Scope and converted using the provided DynamicOperations - object. - - - - - Loads XAML from the specified filename and returns the deserialized object. Any event handlers - are bound to methods defined in the provided Scope and converted using the provided DynamicOperations - object. - - - - - Loads XAML from the specified XmlReader and returns the deserialized object. Any event handlers - are bound to methods defined in the provided Scope and converted using the provided DynamicOperations - object. - - - - - Loads XAML from the specified TextReader and returns the deserialized object. Any event handlers - are bound to methods defined in the provided Scope and converted using the provided DynamicOperations - object. - - - - - Loads XAML from the specified XamlXmlReader and returns the deserialized object. Any event handlers - are bound to methods defined in the provided Scope and converted using the provided DynamicOperations - object. - - - - - Dummy, should never be called - - - - - Returns the list of x:Name'd objects that we saw and should set on the root object. - - - - - Marks a method which may return a light exception. Such - methods need to have their return value checked and the exception - will need to be thrown if the caller is not light exception aware. - - - - - Internal re-writer class which creates code which is light exception aware. - - - - - Adds light exception handling to the provided expression which - is light exception aware. - - - - - Class used to be avoid overhead of creating expression trees when we're usually - - - - - Provides support for light exceptions. These exceptions are propagated by - returning an instance of a private wrapper class containing the exception. Code - which is aware of light exceptions will branch to apporiate exception handling - blocks when in a try and otherwise return the value up the stack. This avoids - using the underlying CLR exception mechanism with overhead such as creating stack - traces. - - When a light exception reaches the boundary of code which is not light exception - aware the caller must check to see if a light exception is being thrown and if - so raise a .NET exception. - - This class provides methods for re-writing expression trees to support light exceptions, - methods to create light throw objects, check if an object is a light - throw object, and turn such an object back into a .NET Exception which can be thrown. - - Light exceptions also don't build up stack traces or interoperate with filter blocks - via 2-pass exception handling. - - - - - Rewrites the provided expression to support light exceptions. - - Calls to the returned expression, if not from other light-weight aware calls, - need to call GetLightException on return to see if an exception was thrown - and if so throw it. - - - - - Returns a new expression which will lazily reduce to a light - expression re-written version of the same expression. - - - - - Returns a new expression which is re-written for light exceptions - but will throw an exception if it escapes the expression. If this - expression is part of a larger experssion which is later re-written - for light exceptions then it will propagate the light exception up. - - - - - Returns an object which represents a light exception. - - - - - Returns an object which represents a light exception. - - - - - Returns an object which represents a light exception. - - - - - If the binder supports light exceptions then a light exception throwing expression is returned. - - Otherwise a normal throwing expression is returned. - - - - - If the binder supports light exceptions then a light exception throwing expression is returned. - - Otherwise a normal throwing expression is returned. - - - - - Throws the exception if the value represents a light exception - - - - - Wraps the expression in a check and rethrow. - - - - - Checks to see if the provided value is a light exception. - - - - - Gets the light exception from an object which may contain a light - exception. Returns null if the object is not a light exception. - - Used for throwing the exception at non-light exception boundaries. - - - - - Returns true if the call site binder is a light exception binder and supports - light throws. Returns false otherwise. - - - - - - - Sealed wrapper class to indicate something is a light exception. - - - - - Stores information needed to emit debugging symbol information for a - source file, in particular the file name and unique language identifier - - - - - The source file name - - - - - Returns the language's unique identifier, if any - - - - - Returns the language vendor's unique identifier, if any - - - - - ArgBuilder provides an argument value used by the MethodBinder. One ArgBuilder exists for each - physical parameter defined on a method. - - Contrast this with ParameterWrapper which represents the logical argument passed to the method. - - - - - Provides the Expression which provides the value to be passed to the argument. - - - - - Provides the Expression which provides the value to be passed to the argument. - This method is called when result is intended to be used ByRef. - - - - - Provides an Expression which will update the provided value after a call to the method. - May return null if no update is required. - - - - - SimpleArgBuilder produces the value produced by the user as the argument value. It - also tracks information about the original parameter and is used to create extended - methods for params arrays and param dictionary functions. - - - - - Provides the implementation of performing AddAssign and SubtractAssign binary operations. - - The binder provided by the call site. - The handler for the operation. - The result of the operation. - true if the operation is complete, false if the call site should determine behavior. - - - - Adds a handler to an event. - - The handler to be added. - The original event with handler added. - - - - Removes handler from the event. - - The handler to be removed. - The original event with handler removed. - - - - Provides helper methods to bind COM objects dynamically. - - - - - Determines if an object is a COM object. - - The object to test. - true if the object is a COM object, false otherwise. - - - - Tries to perform binding of the dynamic get member operation. - - An instance of the that represents the details of the dynamic operation. - The target of the dynamic operation. - The new representing the result of the binding. - true if member evaluation may be delayed. - true if operation was bound successfully; otherwise, false. - - - - Tries to perform binding of the dynamic get member operation. - - An instance of the that represents the details of the dynamic operation. - The target of the dynamic operation. - The new representing the result of the binding. - true if operation was bound successfully; otherwise, false. - - - - Tries to perform binding of the dynamic set member operation. - - An instance of the that represents the details of the dynamic operation. - The target of the dynamic operation. - The representing the value for the set member operation. - The new representing the result of the binding. - true if operation was bound successfully; otherwise, false. - - - - Tries to perform binding of the dynamic invoke operation. - - An instance of the that represents the details of the dynamic operation. - The target of the dynamic operation. - An array of instances - arguments to the invoke member operation. - The new representing the result of the binding. - true if operation was bound successfully; otherwise, false. - - - - Tries to perform binding of the dynamic invoke member operation. - - An instance of the that represents the details of the dynamic operation. - The target of the dynamic operation. - An array of instances - arguments to the invoke member operation. - The new representing the result of the binding. - true if operation was bound successfully; otherwise, false. - - - - Tries to perform binding of the dynamic get index operation. - - An instance of the that represents the details of the dynamic operation. - The target of the dynamic operation. - An array of instances - arguments to the invoke member operation. - The new representing the result of the binding. - true if operation was bound successfully; otherwise, false. - - - - Tries to perform binding of the dynamic set index operation. - - An instance of the that represents the details of the dynamic operation. - The target of the dynamic operation. - An array of instances - arguments to the invoke member operation. - The representing the value for the set index operation. - The new representing the result of the binding. - true if operation was bound successfully; otherwise, false. - - - - Tries to perform binding of the dynamic Convert operation. - - An instance of the that represents the details of the dynamic operation. - The target of the dynamic operation. - The new representing the result of the binding. - true if operation was bound successfully; otherwise, false. - - - - Gets the member names associated with the object. - This function can operate only with objects for which returns true. - - The object for which member names are requested. - The collection of member names. - - - - Gets the member names of the data-like members associated with the object. - This function can operate only with objects for which returns true. - - The object for which member names are requested. - The collection of member names. - - - - Gets the data-like members and associated data for an object. - This function can operate only with objects for which returns true. - - The object for which data members are requested. - The enumeration of names of data members for which to retrieve values. - The collection of pairs that represent data member's names and their data. - - - - Special binder that indicates special semantics for COM GetMember operation. - - - - - This class implements an event sink for a particular RCW. - Unlike the implementation of events in TlbImp'd assemblies, - we will create only one event sink per RCW (theoretically RCW might have - several ComEventSink evenk sinks - but all these implement different source intefaces). - Each ComEventSink contains a list of ComEventSinkMethod objects - which represent - a single method on the source interface an a multicast delegate to redirect - the calls. Notice that we are chaining multicast delegates so that same - ComEventSinkMedhod can invoke multiple event handlers). - - ComEventSink implements an IDisposable pattern to Unadvise from the connection point. - Typically, when RCW is finalized the corresponding Dispose will be triggered by - ComEventSinksContainer finalizer. Notice that lifetime of ComEventSinksContainer - is bound to the lifetime of the RCW. - - - - - Contains a methods DISPID (in a string formatted of "[DISPID=N]" - and a chained list of delegates to invoke - - - - - ComEventSinkProxy class is responsible for handling QIs for sourceIid - on instances of ComEventSink. - - Background: When a COM even sink advises to a connection point it is - supposed to hand over the dispinterface. Now, some hosts will trust - the COM client to pass the correct pointer, but some will not. - E.g. Excel's implementation of Connection Points will not cause a - QI on the pointer that has been passed, however Word will QI the - pointer to return the required interface. - - ComEventSink does not, strongly speaking, implements the interface - that it claims to implement - it is just "faking" it by using IReflect. - Thus, Word's QIs on the pointer passed to ICP::Advise would fail. To - prevent this we take advangate of RealProxy's ability of - "dressing up" like other classes and hence successfully respond to QIs - for interfaces that it does not really support( it is OK to say - "I implement this interface" for event sinks only since the common - practice is to use IDistpach.Invoke when calling into event sinks). - - - - - ComEventSinksContainer is just a regular list with a finalizer. - This list is usually attached as a custom data for RCW object and - is finalized whenever RCW is finalized. - - - - - Layout of the IDispatch vtable - - - - - Invokes the object. If it falls back, just produce an error. - - - - - Splats the arguments to another nested dynamic site, which does the - real invocation of the IDynamicMetaObjectProvider. - - - - - Create a stub for the target of the optimized lopop. - - - - - - Gets expressions to access all the arguments. This includes the instance argument. - - - - - This is a helper class for runtime-callable-wrappers of COM instances. We create one instance of this type - for every generic RCW instance. - - - - - The runtime-callable wrapper - - - - - This is the factory method to get the ComObject corresponding to an RCW - - - - - - The parameter description of a method defined in a type library - - - - - Creates a representation for the paramter of a COM method - - - - - Creates a representation for the return value of a COM method - TODO: Return values should be represented by a different type - - - - - DBNull.Value if there is no default value - - - - - Look for typeinfo using IDispatch.GetTypeInfo - - - - Some COM objects just dont expose typeinfo. In these cases, this method will return null. - Some COM objects do intend to expose typeinfo, but may not be able to do so if the type-library is not properly - registered. This will be considered as acceptable or as an error condition depending on throwIfMissingExpectedTypeInfo - - - - - This method should be called when typeinfo is not available for an object. The function - will check if the typeinfo is expected to be missing. This can include error cases where - the same error is guaranteed to happen all the time, on all machines, under all circumstances. - In such cases, we just have to operate without the typeinfo. - - However, if accessing the typeinfo is failing in a transient way, we might want to throw - an exception so that we will eagerly predictably indicate the problem. - - - - - This class contains methods that either cannot be expressed in C#, or which require writing unsafe code. - Callers of these methods need to use them extremely carefully as incorrect use could cause GC-holes - and other problems. - - - - - - Ensure that "value" is a local variable in some caller's frame. So converting - the byref to an IntPtr is a safe operation. Alternatively, we could also allow - allowed "value" to be a pinned object. - - - - - We will emit an indirect call to an unmanaged function pointer from the vtable of the given interface pointer. - This approach can take only ~300 instructions on x86 compared with ~900 for Marshal.Release. We are relying on - the JIT-compiler to do pinvoke-stub-inlining and calling the pinvoke target directly. - - - - - We will emit an indirect call to an unmanaged function pointer from the vtable of the given IDispatch interface pointer. - It is not possible to express this in C#. Using an indirect pinvoke call allows us to do our own marshalling. - We can allocate the Variant arguments cheaply on the stack. We are relying on the JIT-compiler to do - pinvoke-stub-inlining and calling the pinvoke target directly. - The alternative of calling via a managed interface declaration of IDispatch would have a performance - penalty of going through a CLR stub that would have to re-push the arguments on the stack, etc. - Marshal.GetDelegateForFunctionPointer could be used here, but its too expensive (~2000 instructions on x86). - - - - - Cached information from a TLB. Only information that is required is saved. CoClasses are used - for event hookup. Enums are stored for accessing symbolic names from scripts. - - - - - Reads the latest registered type library for the corresponding GUID, - reads definitions of CoClass'es and Enum's from this library - and creates a IDynamicMetaObjectProvider that allows to instantiate coclasses - and get actual values for the enums. - - Type Library Guid - ComTypeLibDesc object - - - - Gets an ITypeLib object from OLE Automation compatible RCW , - reads definitions of CoClass'es and Enum's from this library - and creates a IDynamicMetaObjectProvider that allows to instantiate coclasses - and get actual values for the enums. - - OLE automation compatible RCW - ComTypeLibDesc object - - - - This represents a bound dispmember on a IDispatch object. - - - - - Strongly-typed and parameterized string factory. - - - Strongly-typed and parameterized string factory. - - - - - A string like "Unexpected VarEnum {0}." - - - - - A string like "Error while invoking {0}." - - - - - A string like "Error while invoking {0}." - - - - - A string like "Error while invoking {0}. Named arguments are not supported." - - - - - A string like "Error while invoking {0}." - - - - - A string like "Could not convert argument {0} for call to {1}." - - - - - A string like "Error while invoking {0}. A required parameter was omitted." - - - - - A string like "IDispatch::GetIDsOfNames behaved unexpectedly for {0}." - - - - - A string like "Could not get dispatch ID for {0} (error: {1})." - - - - - A string like "There are valid conversions from {0} to {1}." - - - - - A string like "Variant.GetAccessor cannot handle {0}." - - - - - A string like "Cannot access member {1} declared on type {0} because the type contains generic parameters." - - - - - A string like "Type '{0}' is missing or cannot be loaded." - - - - - A string like "static property "{0}" of "{1}" can only be read through a type, not an instance" - - - - - A string like "static property "{0}" of "{1}" can only be assigned to through a type, not an instance" - - - - - A string like "Type parameter is {0}. Expected a delegate." - - - - - A string like "Cannot cast from type '{0}' to type '{1}" - - - - - A string like "unknown member type: '{0}'. " - - - - - A string like "The operation requires a non-generic type for {0}, but this represents generic types only" - - - - - A string like "Invalid operation: '{0}'" - - - - - A string like "Cannot create default value for type {0}." - - - - - A string like "Unhandled convert: {0}" - - - - - A string like "{0}.{1} has no publiclly visible method." - - - - - A string like "Extension type {0} must be public." - - - - - A string like "Invalid type of argument {0}; expecting {1}." - - - - - A string like "Field {0} is read-only" - - - - - A string like "Property {0} is read-only" - - - - - A string like "Expected event from {0}.{1}, got event from {2}.{3}." - - - - - A string like "expected bound event, got {0}." - - - - - A string like "Expected type {0}, got {1}." - - - - - A string like "can only write to member {0}." - - - - - A string like "Invalid stream type: {0}." - - - - - A string like "can't add another casing for identifier {0}" - - - - - A string like "can't add new identifier {0}" - - - - - A string like "Type '{0}' doesn't provide a suitable public constructor or its implementation is faulty: {1}" - - - - - A string like "Cannot emit constant {0} ({1})" - - - - - A string like "No implicit cast from {0} to {1}" - - - - - A string like "No explicit cast from {0} to {1}" - - - - - A string like "name '{0}' not defined" - - - - - A string like "Cannot create instance of {0} because it contains generic parameters" - - - - - A string like "Non-verifiable assembly generated: {0}:\nAssembly preserved as {1}\nError text:\n{2}\n" - - - - - A string like "COM object is expected." - - - - - A string like "Cannot perform call." - - - - - A string like "COM object does not support events." - - - - - A string like "COM object does not support specified source interface." - - - - - A string like "Marshal.SetComObjectData failed." - - - - - A string like "This method exists only to keep the compiler happy." - - - - - A string like "ResolveComReference.CannotRetrieveTypeInformation." - - - - - A string like "Attempting to wrap an unsupported enum type." - - - - - A string like "Attempting to pass an event handler of an unsupported type." - - - - - A string like "Method precondition violated" - - - - - A string like "Invalid argument value" - - - - - A string like "Non-empty string required" - - - - - A string like "Non-empty collection required" - - - - - A string like "must by an Exception instance" - - - - - A string like "Type of test must be bool" - - - - - A string like "Type of the expression must be bool" - - - - - A string like "Empty string is not a valid path." - - - - - A string like "Invalid delegate type (Invoke method not found)." - - - - - A string like "expected only static property" - - - - - A string like "Property doesn't exist on the provided type" - - - - - A string like "Field doesn't exist on provided type" - - - - - A string like "Type doesn't have constructor with a given signature" - - - - - A string like "Type doesn't have a method with a given name." - - - - - A string like "Type doesn't have a method with a given name and signature." - - - - - A string like "Count must be non-negative." - - - - - A string like "arrayType must be an array type" - - - - - A string like "Either code or target must be specified." - - - - - A string like "RuleBuilder can only be used with delegates whose first argument is CallSite." - - - - - A string like "no instance for call." - - - - - A string like "Missing Test." - - - - - A string like "Missing Target." - - - - - A string like "Finally already defined." - - - - - A string like "Can not have fault and finally." - - - - - A string like "Fault already defined." - - - - - A string like "Global/top-level local variable names must be unique." - - - - - A string like "Generating code from non-serializable CallSiteBinder." - - - - - A string like "pecified path is invalid." - - - - - A string like "Dictionaries are not hashable." - - - - - A string like "language already registered." - - - - - A string like "The method or operation is not implemented." - - - - - A string like "No exception." - - - - - A string like "Already initialized." - - - - - A string like "CreateScopeExtension must return a scope extension." - - - - - A string like "Invalid number of parameters for the service." - - - - - A string like "Cannot change non-caching value." - - - - - A string like "No code to compile." - - - - - A string like "Queue empty." - - - - - A string like "Enumeration has not started. Call MoveNext." - - - - - A string like "Enumeration already finished." - - - - - A string like "Invalid output directory." - - - - - A string like "Invalid assembly name or file extension." - - - - - A string like "No default value for a given type." - - - - - A string like "Specified language provider type is not registered." - - - - - A string like "can't read from property" - - - - - A string like "can't write to property" - - - - - Strongly-typed and parameterized exception factory. - - - Strongly-typed and parameterized exception factory. - - - - - ArgumentException with message like "COM object does not support events." - - - - - ArgumentException with message like "COM object does not support specified source interface." - - - - - InvalidOperationException with message like "Marshal.SetComObjectData failed." - - - - - InvalidOperationException with message like "This method exists only to keep the compiler happy." - - - - - InvalidOperationException with message like "Unexpected VarEnum {0}." - - - - - System.Reflection.TargetParameterCountException with message like "Error while invoking {0}." - - - - - MissingMemberException with message like "Error while invoking {0}." - - - - - ArgumentException with message like "Error while invoking {0}. Named arguments are not supported." - - - - - OverflowException with message like "Error while invoking {0}." - - - - - ArgumentException with message like "Could not convert argument {0} for call to {1}." - - - - - ArgumentException with message like "Error while invoking {0}. A required parameter was omitted." - - - - - InvalidOperationException with message like "ResolveComReference.CannotRetrieveTypeInformation." - - - - - ArgumentException with message like "IDispatch::GetIDsOfNames behaved unexpectedly for {0}." - - - - - InvalidOperationException with message like "Attempting to wrap an unsupported enum type." - - - - - InvalidOperationException with message like "Attempting to pass an event handler of an unsupported type." - - - - - MissingMemberException with message like "Could not get dispatch ID for {0} (error: {1})." - - - - - System.Reflection.AmbiguousMatchException with message like "There are valid conversions from {0} to {1}." - - - - - NotImplementedException with message like "Variant.GetAccessor cannot handle {0}." - - - - - ArgumentException with message like "Either code or target must be specified." - - - - - InvalidOperationException with message like "Type parameter is {0}. Expected a delegate." - - - - - InvalidOperationException with message like "Cannot cast from type '{0}' to type '{1}" - - - - - InvalidOperationException with message like "unknown member type: '{0}'. " - - - - - InvalidOperationException with message like "RuleBuilder can only be used with delegates whose first argument is CallSite." - - - - - InvalidOperationException with message like "no instance for call." - - - - - InvalidOperationException with message like "Missing Test." - - - - - InvalidOperationException with message like "Missing Target." - - - - - TypeLoadException with message like "The operation requires a non-generic type for {0}, but this represents generic types only" - - - - - ArgumentException with message like "Invalid operation: '{0}'" - - - - - InvalidOperationException with message like "Finally already defined." - - - - - InvalidOperationException with message like "Can not have fault and finally." - - - - - InvalidOperationException with message like "Fault already defined." - - - - - ArgumentException with message like "Cannot create default value for type {0}." - - - - - ArgumentException with message like "Unhandled convert: {0}" - - - - - InvalidOperationException with message like "{0}.{1} has no publiclly visible method." - - - - - ArgumentException with message like "Global/top-level local variable names must be unique." - - - - - ArgumentException with message like "Generating code from non-serializable CallSiteBinder." - - - - - ArgumentException with message like "pecified path is invalid." - - - - - ArgumentTypeException with message like "Dictionaries are not hashable." - - - - - InvalidOperationException with message like "language already registered." - - - - - NotImplementedException with message like "The method or operation is not implemented." - - - - - InvalidOperationException with message like "No exception." - - - - - ArgumentException with message like "Extension type {0} must be public." - - - - - InvalidOperationException with message like "Already initialized." - - - - - InvalidImplementationException with message like "CreateScopeExtension must return a scope extension." - - - - - ArgumentException with message like "Invalid number of parameters for the service." - - - - - ArgumentException with message like "Invalid type of argument {0}; expecting {1}." - - - - - ArgumentException with message like "Cannot change non-caching value." - - - - - MissingMemberException with message like "Field {0} is read-only" - - - - - MissingMemberException with message like "Property {0} is read-only" - - - - - ArgumentException with message like "Expected event from {0}.{1}, got event from {2}.{3}." - - - - - ArgumentTypeException with message like "expected bound event, got {0}." - - - - - ArgumentTypeException with message like "Expected type {0}, got {1}." - - - - - MemberAccessException with message like "can only write to member {0}." - - - - - InvalidOperationException with message like "No code to compile." - - - - - ArgumentException with message like "Invalid stream type: {0}." - - - - - InvalidOperationException with message like "Queue empty." - - - - - InvalidOperationException with message like "Enumeration has not started. Call MoveNext." - - - - - InvalidOperationException with message like "Enumeration already finished." - - - - - InvalidOperationException with message like "can't add another casing for identifier {0}" - - - - - InvalidOperationException with message like "can't add new identifier {0}" - - - - - ArgumentException with message like "Invalid output directory." - - - - - ArgumentException with message like "Invalid assembly name or file extension." - - - - - ArgumentException with message like "Cannot emit constant {0} ({1})" - - - - - ArgumentException with message like "No implicit cast from {0} to {1}" - - - - - ArgumentException with message like "No explicit cast from {0} to {1}" - - - - - MissingMemberException with message like "name '{0}' not defined" - - - - - ArgumentException with message like "No default value for a given type." - - - - - ArgumentException with message like "Specified language provider type is not registered." - - - - - InvalidOperationException with message like "can't read from property" - - - - - InvalidOperationException with message like "can't write to property" - - - - - ArgumentException with message like "Cannot create instance of {0} because it contains generic parameters" - - - - - System.Security.VerificationException with message like "Non-verifiable assembly generated: {0}:\nAssembly preserved as {1}\nError text:\n{2}\n" - - - - - This is similar to ComTypes.EXCEPINFO, but lets us do our own custom marshaling - - - - - An object that implements IDispatch - - This currently has the following issues: - 1. If we prefer ComObjectWithTypeInfo over IDispatchComObject, then we will often not - IDispatchComObject since implementations of IDispatch often rely on a registered type library. - If we prefer IDispatchComObject over ComObjectWithTypeInfo, users get a non-ideal experience. - 2. IDispatch cannot distinguish between properties and methods with 0 arguments (and non-0 - default arguments?). So obj.foo() is ambiguous as it could mean invoking method foo, - or it could mean invoking the function pointer returned by property foo. - We are attempting to find whether we need to call a method or a property by examining - the ITypeInfo associated with the IDispatch. ITypeInfo tell's use what parameters the method - expects, is it a method or a property, what is the default property of the object, how to - create an enumerator for collections etc. - 3. IronPython processes the signature and converts ref arguments into return values. - However, since the signature of a DispMethod is not available beforehand, this conversion - is not possible. There could be other signature conversions that may be affected. How does - VB6 deal with ref arguments and IDispatch? - - We also support events for IDispatch objects: - Background: - COM objects support events through a mechanism known as Connect Points. - Connection Points are separate objects created off the actual COM - object (this is to prevent circular references between event sink - and event source). When clients want to sink events generated by - COM object they would implement callback interfaces (aka source - interfaces) and hand it over (advise) to the Connection Point. - - Implementation details: - When IDispatchComObject.TryGetMember request is received we first check - whether the requested member is a property or a method. If this check - fails we will try to determine whether an event is requested. To do - so we will do the following set of steps: - 1. Verify the COM object implements IConnectionPointContainer - 2. Attempt to find COM object's coclass's description - a. Query the object for IProvideClassInfo interface. Go to 3, if found - b. From object's IDispatch retrieve primary interface description - c. Scan coclasses declared in object's type library. - d. Find coclass implementing this particular primary interface - 3. Scan coclass for all its source interfaces. - 4. Check whether to any of the methods on the source interfaces matches - the request name - - Once we determine that TryGetMember requests an event we will return - an instance of BoundDispEvent class. This class has InPlaceAdd and - InPlaceSubtract operators defined. Calling InPlaceAdd operator will: - 1. An instance of ComEventSinksContainer class is created (unless - RCW already had one). This instance is hanged off the RCW in attempt - to bind the lifetime of event sinks to the lifetime of the RCW itself, - meaning event sink will be collected once the RCW is collected (this - is the same way event sinks lifetime is controlled by PIAs). - Notice: ComEventSinksContainer contains a Finalizer which will go and - unadvise all event sinks. - Notice: ComEventSinksContainer is a list of ComEventSink objects. - 2. Unless we have already created a ComEventSink for the required - source interface, we will create and advise a new ComEventSink. Each - ComEventSink implements a single source interface that COM object - supports. - 3. ComEventSink contains a map between method DISPIDs to the - multicast delegate that will be invoked when the event is raised. - 4. ComEventSink implements IReflect interface which is exposed as - custom IDispatch to COM consumers. This allows us to intercept calls - to IDispatch.Invoke and apply custom logic - in particular we will - just find and invoke the multicast delegate corresponding to the invoked - dispid. - - - - - ArgBuilder which always produces null. - - - - - If a managed user type (as opposed to a primitive type or a COM object) is passed as an argument to a COM call, we need - to determine the VarEnum type we will marshal it as. We have the following options: - 1. Raise an exception. Languages with their own version of primitive types would not be able to call - COM methods using the language's types (for eg. strings in IronRuby are not System.String). An explicit - cast would be needed. - 2. We could marshal it as VT_DISPATCH. Then COM code will be able to access all the APIs in a late-bound manner, - but old COM components will probably malfunction if they expect a primitive type. - 3. We could guess which primitive type is the closest match. This will make COM components be as easily - accessible as .NET methods. - 4. We could use the type library to check what the expected type is. However, the type library may not be available. - - VarEnumSelector implements option # 3 - - - - - Gets the managed type that an object needs to be coverted to in order for it to be able - to be represented as a Variant. - - In general, there is a many-to-many mapping between Type and VarEnum. However, this method - returns a simple mapping that is needed for the current implementation. The reason for the - many-to-many relation is: - 1. Int32 maps to VT_I4 as well as VT_ERROR, and Decimal maps to VT_DECIMAL and VT_CY. However, - this changes if you throw the wrapper types into the mix. - 2. There is no Type to represent COM types. __ComObject is a private type, and Object is too - general. - - - - - Creates a family of COM types such that within each family, there is a completely non-lossy - conversion from a type to an earlier type in the family. - - - - - Get the (one representative type for each) primitive type families that the argument can be converted to - - - - - If there is more than one type family that the argument can be converted to, we will throw a - AmbiguousMatchException instead of randomly picking a winner. - - - - - Is there a unique primitive type that has the best conversion for the argument - - - - - Get the COM Variant type that argument should be marshaled as for a call to COM - - - - - Variant is the basic COM type for late-binding. It can contain any other COM data type. - This type definition precisely matches the unmanaged data layout so that the struct can be passed - to and from COM calls. - - - - - Primitive types are the basic COM types. It includes valuetypes like ints, but also reference types - like BStrs. It does not include composite types like arrays and user-defined COM types (IUnknown/IDispatch). - - - - - Get the managed object representing the Variant. - - - - - - Release any unmanaged memory associated with the Variant - - - - - - VariantBuilder handles packaging of arguments into a Variant for a call to IDispatch.Invoke - - - - - Provides a simple expression which enables embedding FieldBuilder's - in an AST before the type is complete. - - - - - Used to dispatch a single interactive command. It can be used to control things like which Thread - the command is executed on, how long the command is allowed to execute, etc - - - - - Supports detecting the remote runtime being killed, and starting up a new one. - - Threading model: - - ConsoleRestartManager creates a separate thread on which to create and execute the consoles. - There are usually atleast three threads involved: - - 1. Main app thread: Instantiates ConsoleRestartManager and accesses its APIs. This thread has to stay - responsive to user input and so the ConsoleRestartManager APIs cannot be long-running or blocking. - Since the remote runtime process can terminate asynchronously, the current RemoteConsoleHost can - change at any time (if auto-restart is enabled). The app should typically not care which instance of - RemoteConsoleHost is currently being used. The flowchart of this thread is: - Create ConsoleRestartManager - ConsoleRestartManager.Start - Loop: - Respond to user input | Send user input to console for execution | BreakExecution | RestartConsole | GetMemberNames - ConsoleRestartManager.Terminate - TODO: Currently, BreakExecution and GetMemberNames are called by the main thread synchronously. - Since they execute code in the remote runtime, they could take arbitrarily long. We should change - this so that the main app thread can never be blocked indefinitely. - - 2. Console thread: Dedicated thread for creating RemoteConsoleHosts and executing code (which could - take a long time or block indefinitely). - Wait for ConsoleRestartManager.Start to be called - Loop: - Create RemoteConsoleHost - Wait for signal for: - Execute code | RestartConsole | Process.Exited - - 3. CompletionPort async callbacks: - Process.Exited | Process.OutputDataReceived | Process.ErrorDataReceived - - 4. Finalizer thred - Some objects may have a Finalize method (which possibly calls Dispose). Not many (if any) types - should have a Finalize method. - - - - - - Accessing _remoteConsoleHost from a thread other than console thread can result in race. - If _remoteConsoleHost is accessed while holding _accessLock, it is guaranteed to be - null or non-disposed. - - - - - This is created on the "creating thread", and goes on standby. Start needs to be called for activation. - - A host might want one of two behaviors: - 1. Keep the REPL loop alive indefinitely, even when a specific instance of the RemoteConsoleHost terminates normally - 2. Close the REPL loop when an instance of the RemoteConsoleHost terminates normally, and restart the loop - only if the instance terminates abnormally. - - - - Needs to be called for activation. - - - - - Request (from another thread) the console REPL loop to terminate - - - - - This allows the RemoteConsoleHost to abort a long-running operation. The RemoteConsoleHost itself - does not know which ThreadPool thread might be processing the remote call, and so it needs - cooperation from the remote runtime server. - - - - - Since OnOutputDataReceived is sent async, it can arrive late. The remote console - cannot know if all output from the current command has been received. So - RemoteCommandDispatcher writes out a marker to indicate the end of the output - - - - - Aborts the current active call to Execute by doing Thread.Abort - - true if a Thread.Abort was actually called. false if there is no active call to Execute - - - - Customize the CommandLine for remote scenarios - - - - - Command line hosting service. - - - - - Executes the comand line - depending upon the options provided we will - either run a single file, a single command, or enter the interactive loop. - - - - - Runs the command line. Languages can override this to provide custom behavior other than: - 1. Running a single command - 2. Running a file - 3. Entering the interactive console loop. - - - - - - Runs the specified filename - - - - - Starts the interactive loop. Performs any initialization necessary before - starting the loop and then calls RunInteractiveLoop to start the loop. - - Returns the exit code when the interactive loop is completed. - - - - - Runs the interactive loop. Repeatedly parse and run interactive actions - until an exit code is received. If any exceptions are unhandled displays - them to the console - - - - - Attempts to run a single interaction and handle any language-specific - exceptions. Base classes can override this and call the base implementation - surrounded with their own exception handling. - - Returns null if successful and execution should continue, or an exit code. - - - - - Parses a single interactive command or a set of statements and executes it. - - Returns null if successful and execution should continue, or the appropiate exit code. - - We check if the code read is an interactive command or statements is by checking for NewLine - If the code contains NewLine, it's a set of statements (most probably from SendToConsole) - If the code does not contain a NewLine, it's an interactive command typed by the user at the prompt - - - - - Private helper function to see if we should treat the current input as a blank link. - - We do this if we only have auto-indent text. - - - - - Read a statement, which can potentially be a multiple-line statement suite (like a class declaration). - - Should the console session continue, or did the user indicate - that it should be terminated? - Expression to evaluate. null for empty input - - - - Gets the next level for auto-indentation - - - - - Scope is not remotable, and this only works in the same AppDomain. - - - - - CommandDispatcher to ensure synchronize output from the remote runtime - - - - - ConsoleHost where the ScriptRuntime is hosted in a separate process (referred to as the remote runtime server) - - The RemoteConsoleHost spawns the remote runtime server and specifies an IPC channel name to use to communicate - with each other. The remote runtime server creates and initializes a ScriptRuntime and a ScriptEngine, and publishes - it over the specified IPC channel at a well-known URI. Note that the RemoteConsoleHost cannot easily participate - in the initialization of the ScriptEngine as classes like LanguageContext are not remotable. - - The RemoteConsoleHost then starts the interactive loop and executes commands on the ScriptEngine over the remoting channel. - The RemoteConsoleHost listens to stdout of the remote runtime server and echos it locally to the user. - - - - - Core functionality to implement an interactive console. This should be derived for concrete implementations - - - - - Request (from another thread) the console REPL loop to terminate - - The caller can specify the exitCode corresponding to the event triggering - the termination. This will be returned from CommandLine.Run - - - - To be called from entry point. - - - - - Console Host entry-point .exe name. - - - - - Allows the console to customize the environment variables, working directory, etc. - - At the least, processInfo.FileName should be initialized - - - - Aborts the current active call to Execute by doing Thread.Abort - - true if a Thread.Abort was actually called. false if there is no active call to Execute - - - - Called if the remote runtime process exits by itself. ie. without the remote console killing it. - - - - - The remote runtime server uses this class to publish an initialized ScriptEngine and ScriptRuntime - over a remoting channel. - - - - - Publish objects so that the host can use it, and then block indefinitely (until the input stream is open). - - Note that we should publish only one object, and then have other objects be accessible from it. Publishing - multiple objects can cause problems if the client does a call like "remoteProxy1(remoteProxy2)" as remoting - will not be able to know if the server object for both the proxies is on the same server. - - The IPC channel that the remote console expects to use to communicate with the ScriptEngine - A intialized ScriptScope that is ready to start processing script commands - - - Instruction can't be created due to insufficient privileges. - - - Instruction can't be created due to insufficient privileges. - - - - Gets the next type or null if no more types are available. - - - - - Uses reflection to create new instance of the appropriate ReflectedCaller - - - - - Fast creation works if we have a known primitive types for the entire - method siganture. If we have any non-primitive types then FastCreate - falls back to SlowCreate which works for all types. - - Fast creation is fast because it avoids using reflection (MakeGenericType - and Activator.CreateInstance) to create the types. It does this through - calling a series of generic methods picking up each strong type of the - signature along the way. When it runs out of types it news up the - appropriate CallInstruction with the strong-types that have been built up. - - One relaxation is that for return types which are non-primitive types - we can fallback to object due to relaxed delegates. - - - - - The number of arguments including "this" for instance methods. - - - - - This instruction implements a goto expression that can jump out of any expression. - It pops values (arguments) from the evaluation stack that the expression tree nodes in between - the goto expression and the target label node pushed and not consumed yet. - A goto expression can jump into a node that evaluates arguments only if it carries - a value and jumps right after the first argument (the carried value will be used as the first argument). - Goto can jump into an arbitrary child of a BlockExpression since the block doesn’t accumulate values - on evaluation stack as its child expressions are being evaluated. - - Goto needs to execute any finally blocks on the way to the target label. - - { - f(1, 2, try { g(3, 4, try { goto L } finally { ... }, 6) } finally { ... }, 7, 8) - L: ... - } - - The goto expression here jumps to label L while having 4 items on evaluation stack (1, 2, 3 and 4). - The jump needs to execute both finally blocks, the first one on stack level 4 the - second one on stack level 2. So, it needs to jump the first finally block, pop 2 items from the stack, - run second finally block and pop another 2 items from the stack and set instruction pointer to label L. - - Goto also needs to rethrow ThreadAbortException iff it jumps out of a catch handler and - the current thread is in "abort requested" state. - - - - - The first instruction of finally block. - - - - - The last instruction of finally block. - - - - - The last instruction of a catch exception handler. - - - - - The last instruction of a fault exception handler. - - - - - Implements dynamic call site with many arguments. Wraps the arguments into . - - - - - Contains compiler state corresponding to a LabelTarget - See also LabelScopeInfo. - - - - - Returns true if we can jump into this node - - - - - Attaches a cookie to the last emitted instruction. - - - - Instruction can't be created due to insufficient privileges. - - - - Manages creation of interpreted delegates. These delegates will get - compiled if they are executed often enough. - - - - - Used by LightLambda to get the compiled delegate. - - - - - Create a compiled delegate for the LightLambda, and saves it so - future calls to Run will execute the compiled code instead of - interpreting. - - - - - true if the compiled delegate has the same type as the lambda; - false if the type was changed for interpretation. - - - - - Provides notification that the LightLambda has been compiled. - - - - - A simple forth-style stack machine for executing Expression trees - without the need to compile to IL and then invoke the JIT. This trades - off much faster compilation time for a slower execution performance. - For code that is only run a small number of times this can be a - sweet spot. - - The core loop in the interpreter is the RunInstructions method. - - - - - Runs instructions within the given frame. - - - Interpreted stack frames are linked via Parent reference so that each CLR frame of this method corresponds - to an interpreted stack frame in the chain. It is therefore possible to combine CLR stack traces with - interpreted stack traces by aligning interpreted frames to the frames of this method. - Each group of subsequent frames of Run method corresponds to a single interpreted frame. - - - - - Visits a LambdaExpression, replacing the constants with direct accesses - to their StrongBox fields. This is very similar to what - ExpressionQuoter does for LambdaCompiler. - - Also inserts debug information tracking similar to what the interpreter - would do. - - - - - Local variable mapping. - - - - - The variable that holds onto the StrongBox{object}[] closure from - the interpreter - - - - - A stack of variables that are defined in nested scopes. We search - this first when resolving a variable in case a nested scope shadows - one of our variable instances. - - - - - Walks the lambda and produces a higher order function, which can be - used to bind the lambda to a closure array from the interpreter. - - The lambda to bind. - Variables which are being accessed defined in the outer scope. - A delegate that can be called to produce a delegate bound to the passed in closure array. - - - - Provides a list of variables, supporing read/write of the values - - - - - Gets a copy of the local variables which are defined in the current scope. - - - - - - Checks to see if the given variable is defined within the current local scope. - - - - - Gets the variables which are defined in an outer scope and available within the current scope. - - - - - Tracks where a variable is defined and what range of instructions it's used in - - - - - A single interpreted frame might be represented by multiple subsequent Interpreter.Run CLR frames. - This method filters out the duplicate CLR frames. - - - - - arbitrary precision integers - - - - - Calculates the natural logarithm of the BigInteger. - - - - - Calculates log base 10 of a BigInteger. - - - - - Return the value of this BigInteger as a little-endian twos-complement - byte array, using the fewest number of bytes possible. If the value is zero, - return an array of one byte whose element is 0x00. - - - - - Return the sign of this BigInteger: -1, 0, or 1. - - - - - Wraps all arguments passed to a dynamic site with more arguments than can be accepted by a Func/Action delegate. - The binder generating a rule for such a site should unwrap the arguments first and then perform a binding to them. - - - - - Provides support for converting objects to delegates using the DLR binders - available by the provided language context. - - Primarily this supports converting objects implementing IDynamicMetaObjectProvider - to the appropriate delegate type. - - If the provided object is already a delegate of the appropriate type then the - delegate will simply be returned. - - - - Table of dynamically generated delegates which are shared based upon method signature. - - - - Creates a delegate with a given signature that could be used to invoke this object from non-dynamic code (w/o code context). - A stub is created that makes appropriate conversions/boxing and calls the object. - The stub should be executed within a context of this object's language. - - The converted delegate. - The object is either a subclass of Delegate but not the requested type or does not implement IDynamicMetaObjectProvider. - - - - Represents the type of a null value. - - - - - Private constructor is never called since 'null' is the only valid instance. - - - - - These are some generally useful helper methods. Currently the only methods are those to - cached boxed representations of commonly used primitive types so that they can be shared. - This is useful to most dynamic languages that use object as a universal type. - - The methods in RuntimeHelepers are caleld by the generated code. From here the methods may - dispatch to other parts of the runtime to get bulk of the work done, but the entry points - should be here. - - - - - Used by prologue code that is injected in lambdas to ensure that delegate signature matches what - lambda body expects. Such code typically unwraps subset of the params array manually, - but then passes the rest in bulk if lambda body also expects params array. - - This calls ArrayUtils.ShiftLeft, but performs additional checks that - ArrayUtils.ShiftLeft assumes. - - - - - A singleton boxed boolean true. - - - - - A singleton boxed boolean false. - - - - - Gets a singleton boxed value for the given integer if possible, otherwise boxes the integer. - - The value to box. - The boxed value. - - - - Helper method to create an instance. Work around for Silverlight where Activator.CreateInstance - is SecuritySafeCritical. - - TODO: Why can't we just emit the right thing for default(T)? - It's always null for reference types and it's well defined for value types - - - - - EventInfo.EventHandlerType getter is marked SecuritySafeCritical in CoreCLR - This method is to get to the property without using Reflection - - - - - - - Provides the test to see if an interpreted call site should switch over to being compiled. - - - - - A parameterless generator, that is of type IEnumerable, IEnumerable{T}, - IEnumerator, or IEnumerator{T}. Its body can contain a series of - YieldExpressions. Each call into MoveNext on the enumerator reenters - the generator, and executes until it reaches a YieldReturn or YieldBreak - expression - - - - - The label used by YieldBreak and YieldReturn expressions to yield - from this generator - - - - - The body of the generator, which can contain YieldBreak and - YieldReturn expressions - - - - - Indicates whether the lhs instances are preserved when assignments - are made to expressions containing yields. - - - - - When finding a yield return or yield break, this rewriter flattens out - containing blocks, scopes, and expressions with stack state. All - scopes encountered have their variables promoted to the generator's - closure, so they survive yields. - - - - - Makes an assignment to this variable. Pushes the assignment as far - into the right side as possible, to allow jumps into it. - - - - - Returns true if the expression remains constant no matter when it is evaluated. - - - - - Represents either a YieldBreak or YieldReturn in a GeneratorExpression - If Value is non-null, it's a YieldReturn; otherwise it's a YieldBreak - and executing it will stop enumeration of the generator, causing - MoveNext to return false. - - - - - The value yieled from this expression, if it is a yield return - - - - - The label used to yield from this generator - - - - - Tests to see if the expression is a constant with the given value. - - The expression to examine - The constant value to check for. - true/false - - - - Tests to see if the expression is a constant with the given value. - - The expression to examine - The constant value to check for. - true/false - - - - Begins a catch block. - - - - - Begins an exception block for a filtered exception. - - - - - Begins an exception block for a non-filtered exception. - - - - - - Begins an exception fault block - - - - - Begins a finally block - - - - - Ends an exception block. - - - - - Begins a lexical scope. - - - - - Ends a lexical scope. - - - - - Declares a local variable of the specified type. - - - - - Declares a local variable of the specified type, optionally - pinning the object referred to by the variable. - - - - - Declares a new label. - - - - - Marks the label at the current position. - - - - - Emits an instruction. - - - - - Emits an instruction with a byte argument. - - - - - Emits an instruction with the metadata token for the specified contructor. - - - - - Emits an instruction with a double argument. - - - - - Emits an instruction with the metadata token for the specified field. - - - - - Emits an instruction with a float argument. - - - - - Emits an instruction with an int argument. - - - - - Emits an instruction with a label argument. - - - - - Emits an instruction with multiple target labels (switch). - - - - - Emits an instruction with a reference to a local variable. - - - - - Emits an instruction with a long argument. - - - - - Emits an instruction with the metadata token for a specified method. - - - - - Emits an instruction with a signed byte argument. - - - - - Emits an instruction with a short argument. - - - - - Emits an instruction with a signature token. - - - - - Emits an instruction with a string argument. - - - - - Emits an instruction with the metadata token for a specified type argument. - - - - - Emits a call or a virtual call to the varargs method. - - - - - Emits an unmanaged indirect call instruction. - - - - - Emits a managed indirect call instruction. - - - - - Marks a sequence point. - - - - - Specifies the namespace to be used in evaluating locals and watches for the - current active lexical scope. - - - - - Emits a Ldind* instruction for the appropriate type - - - - - Emits a Stind* instruction for the appropriate type. - - - - - Emits a Stelem* instruction for the appropriate type. - - - - - Boxes the value of the stack. No-op for reference types. Void is - converted to a null reference. For almost all value types this - method will box them in the standard way. Int32 and Boolean are - handled with optimized conversions that reuse the same object for - small values. For Int32 this is purely a performance optimization. - For Boolean this is use to ensure that True and False are always - the same objects. - - - - - Emits an array of constant values provided in the given list. - The array is strongly typed. - - - - - Emits an array of values of count size. The items are emitted via the callback - which is provided with the current item index to emit. - - - - - Emits an array construction code. - The code assumes that bounds for all dimensions - are already emitted. - - - - - Emits default(T) - Semantics match C# compiler behavior - - - - - A simple dictionary of queues, keyed off a particular type - This is useful for storing free lists of variables - - - - - Directory where snippet assembly will be saved if SaveSnippets is set. - - - - - Save snippets to an assembly (see also SnippetsDirectory, SnippetsFileName). - - - - - Gets the Compiler associated with the Type Initializer (cctor) creating it if necessary. - - - - - A tree rewriter which will find dynamic sites which consume dynamic sites and - turn them into a single combo dynamic site. The combo dynamic site will then run the - individual meta binders and produce the resulting code in a single dynamic site. - - - - - A reducible node which we use to generate the combo dynamic sites. Each time we encounter - a dynamic site we replace it with a ComboDynamicSiteExpression. When a child of a dynamic site - turns out to be a ComboDynamicSiteExpression we will then merge the child with the parent updating - the binding mapping info. If any of the inputs cause side effects then we'll stop the combination. - - - - - A binder which can combine multiple binders into a single dynamic site. The creator - of this needs to perform the mapping of parameters, constants, and sub-site expressions - and provide a List of BinderMappingInfo representing this data. From there the ComboBinder - just processes the list to create the resulting code. - - - - - Provides a mapping for inputs of combo action expressions. The input can map - to either an input of the new dynamic site, an input of a previous DynamicExpression, - or a ConstantExpression which has been pulled out of the dynamic site arguments. - - - - - Contains the mapping information for a single Combo Binder. This includes the original - meta-binder and the mapping of parameters, sub-sites, and constants into the binding. - - - - - Builds up a series of conditionals when the False clause isn't yet known. We can - keep appending conditions and if true's. Each subsequent true branch becomes the - false branch of the previous condition and body. Finally a non-conditional terminating - branch must be added. - - - - - Adds a new conditional and body. The first call this becomes the top-level - conditional, subsequent calls will have it added as false statement of the - previous conditional. - - - - - Adds the non-conditional terminating node. - - - - - Adds the non-conditional terminating node. - - - - - Gets the resulting meta object for the full body. FinishCondition - must have been called. - - - - - Adds a variable which will be scoped at the level of the final expression. - - - - - Marks a method as not having side effects. used by the combo binder - to allow calls to methods. - - - - - OperatorInfo provides a mapping from DLR ExpressionType to their associated .NET methods. - - - - - Given an operator returns the OperatorInfo associated with the operator or null - - - - - The operator the OperatorInfo provides info for. - - - - - The primary method name associated with the method. This method name is - usally in the form of op_Operator (e.g. op_Addition). - - - - - The secondary method name associated with the method. This method name is - usually a standard .NET method name with pascal casing (e.g. Add). - - - - - The builder for creating the LambdaExpression node. - - Since the nodes require that parameters and variables are created - before hand and then passed to the factories creating LambdaExpression - this builder keeps track of the different pieces and at the end creates - the LambdaExpression. - - TODO: This has some functionality related to CodeContext that should be - removed, in favor of languages handling their own local scopes - - - - - Creates a parameter on the lambda with a given name and type. - - Parameters maintain the order in which they are created, - however custom ordering is possible via direct access to - Parameters collection. - - - - - Creates a parameter on the lambda with a given name and type. - - Parameters maintain the order in which they are created, - however custom ordering is possible via direct access to - Parameters collection. - - - - - adds existing parameter to the lambda. - - Parameters maintain the order in which they are created, - however custom ordering is possible via direct access to - Parameters collection. - - - - - Creates a hidden parameter on the lambda with a given name and type. - - Parameters maintain the order in which they are created, - however custom ordering is possible via direct access to - Parameters collection. - - - - - Creates a params array argument on the labmda. - - The params array argument is added to the signature immediately. Before the lambda is - created, the builder validates that it is still the last (since the caller can modify - the order of parameters explicitly by maniuplating the parameter list) - - - - - Creates a local variable with specified name and type. - TODO: simplify by pushing logic into callers - - - - - Creates a local variable with specified name and type. - TODO: simplify by pushing logic into callers - - - - - Creates a temporary variable with specified name and type. - - - - - Adds the temporary variable to the list of variables maintained - by the builder. This is useful in cases where the variable is - created outside of the builder. - - - - - Creates the LambdaExpression from the builder. - After this operation, the builder can no longer be used to create other instances. - - Desired type of the lambda. - New LambdaExpression instance. - - - - Creates the LambdaExpression from the builder. - After this operation, the builder can no longer be used to create other instances. - - New LambdaExpression instance. - - - - Creates the generator LambdaExpression from the builder. - After this operation, the builder can no longer be used to create other instances. - - New LambdaExpression instance. - - - - Fixes up lambda body and parameters to match the signature of the given delegate if needed. - - - - - - Validates that the builder has enough information to create the lambda. - - - - - The name of the lambda. - Currently anonymous/unnamed lambdas are not allowed. - - - - - Return type of the lambda being created. - - - - - List of lambda's local variables for direct manipulation. - - - - - List of lambda's parameters for direct manipulation - - - - - The params array argument, if any. - - - - - The body of the lambda. This must be non-null. - - - - - The generated lambda should have dictionary of locals - instead of allocating them directly on the CLR stack. - - - - - The scope is visible (default). Invisible if false. - - - - - marks a field, class, or struct as being safe to have statics which can be accessed - from multiple runtimes. - - Static fields which are not read-only or marked with this attribute will be flagged - by a test which looks for state being shared between runtimes. Before applying this - attribute you should ensure that it is safe to share the state. This is typically - state which is lazy initialized or state which is caching values which are identical - in all runtimes and are immutable. - - - - - This class is useful for quickly collecting performance counts for expensive - operations. Usually this means operations involving either reflection or - code gen. Long-term we need to see if this can be plugged better into the - standard performance counter architecture. - - - - - temporary categories for quick investigation, use a custom key if you - need to track multiple items, and if you want to keep it then create - a new Categories entry and rename all your temporary entries. - - - - - Represents the context that is flowed for doing Compiler. Languages can derive - from this class to provide additional contextual information. - - - - - Source unit currently being compiled in the CompilerContext - - - - - Current error sink. - - - - - Sink for parser callbacks (e.g. brace matching, etc.). - - - - - Compiler specific options. - - - - - Indicates that a DynamicMetaObject might be convertible to a CLR type. - - - - - Gets custom data to be serialized when saving script codes to disk. - - - - - Indicates that a MetaObject is already representing a restricted type. Useful - when we're already restricted to a known type but this isn't captured in - the type info (e.g. the type is not sealed). - - - - - Returns Microsoft.Scripting.Runtime.DynamicNull if the object contains a null value, - otherwise, returns self.LimitType - - - - - Returns Microsoft.Scripting.Runtime.DynamicNull if the object contains a null value, - otherwise, returns self.RuntimeType - - - - - ScriptCode is an instance of compiled code that is bound to a specific LanguageContext - but not a specific ScriptScope. The code can be re-executed multiple times in different - scopes. Hosting API counterpart for this class is CompiledCode. - - - - - This takes an assembly name including extension and saves the provided ScriptCode objects into the assembly. - - The provided script codes can constitute code from multiple languages. The assemblyName can be either a fully qualified - or a relative path. The DLR will simply save the assembly to the desired location. The assembly is created by the DLR and - if a file already exists than an exception is raised. - - The DLR determines the internal format of the ScriptCode and the DLR can feel free to rev this as appropriate. - - - - - This will take an assembly object which the user has loaded and return a new set of ScriptCode’s which have - been loaded into the provided ScriptDomainManager. - - If the language associated with the ScriptCode’s has not already been loaded the DLR will load the - LanguageContext into the ScriptDomainManager based upon the saved LanguageContext type. - - If the LanguageContext or the version of the DLR the language was compiled against is unavailable a - TypeLoadException will be raised unless policy has been applied by the administrator to redirect bindings. - - - - - Sets the current position inside current token or one character behind it. - - - - - Sets the current position inside current token or one character behind it. - A relative displacement with respect to the current position in the token is specified. - - - - - Marks token end. Enables to read the current token. - - - - - Marks token start. It means the buffer can drop the current token. - Can be called even if no token has been read yet. - - - - - Reads till the end of line and returns the character that stopped the reading. - The returned character is not skipped. - - - - - Resizes an array to a speficied new size and copies a portion of the original array into its beginning. - - - - - Helper class to remove methods w/ identical signatures. Used for GetDefaultMembers - which returns members from all types in the hierarchy. - - - - - Handles input and output for the console. It is comparable to System.IO.TextReader, - System.IO.TextWriter, System.Console, etc - - - - - Read a single line of interactive input, or a block of multi-line statements. - - An event-driven GUI console can implement this method by creating a thread that - blocks and waits for an event indicating that input is available - - The indentation level to be used for the current suite of a compound statement. - The console can ignore this argument if it does not want to support auto-indentation - null if the input stream has been closed. A string with a command to execute otherwise. - It can be a multi-line string which should be processed as block of statements - - - - - - - - name == null means that the argument doesn't specify an option; the value contains the entire argument - name == "" means that the option name is empty (argument separator); the value is null then - - - - - Literal script command given using -c option - - - - - Filename to execute passed on the command line options. - - - - - Only print the version of the script interpreter and exit - - - - On error. - - - - The console input buffer. - - - - - Current position - index into the input buffer - - - - - The number of white-spaces displayed for the auto-indenation of the current line - - - - - Length of the output currently rendered on screen. - - - - - Command history - - - - - Tab options available in current context - - - - - Cursort anchor - position of cursor when the routine was called - - - - - The command line that this console is attached to. - - - - - Displays the next option in the option list, - or beeps if no options available for current input prefix. - If no input prefix, simply print tab. - - - - - - - Handle the enter key. Adds the current input (if not empty) to the history. - - - The input string. - - - - Class managing the command history. - - - - - List of available options - - - - - Cursor position management - - - - - Beginning position of the cursor - top coordinate. - - - - - Beginning position of the cursor - left coordinate. - - - - - Implementation of the complex number data type. - - - - - Helper methods that calls are generated to from the default DLR binders. - - - - - Helper function to combine an object array with a sequence of additional parameters that has been splatted for a function call. - - - - - EventInfo.EventHandlerType getter is marked SecuritySafeCritical in CoreCLR - This method is to get to the property without using Reflection - - - - - - - Implements explicit casts supported by the runtime. - - - Implements explicit casts supported by the runtime. - - - - - Explicitly casts the object to a given type (and returns it as object) - - - - - Used as the value for the ScriptingRuntimeHelpers.GetDelegate method caching system - - - - - Generates stub to receive the CLR call and then call the dynamic language code. - - - - - Used as the key for the LanguageContext.GetDelegate method caching system - - - - - A useful interface for taking slices of numeric arrays, inspired by Python's Slice objects. - - - - - The starting index of the slice or null if no first index defined - - - - - The ending index of the slice or null if no ending index defined - - - - - The length of step to take - - - - - Given an ID returns the object associated with that ID. - - - - - Gets a unique ID for an object - - - - - Goes over the hashtable and removes empty entries - - - - - Weak-ref wrapper caches the weak reference, our hash code, and the object ID. - - - - - WrapperComparer treats Wrapper as transparent envelope - - - - - Internal class which binds a LanguageContext, StreamContentProvider, and Encoding together to produce - a TextContentProvider which reads binary data with the correct language semantics. - - - - - Creates a dictionary of locals in this scope - - - - - Abstract base class used for optimized thread-safe dictionaries which have a set - of pre-defined string keys. - - Implementers derive from this class and override the GetExtraKeys, TrySetExtraValue, - and TryGetExtraValue methods. When looking up a value first the extra keys will be - searched using the optimized Try*ExtraValue functions. If the value isn't found there - then the value is stored in the underlying .NET dictionary. - - This dictionary can store object values in addition to string values. It also supports - null keys. - - - - - Gets a list of the extra keys that are cached by the the optimized implementation - of the module. - - - - - Try to set the extra value and return true if the specified key was found in the - list of extra values. - - - - - Try to get the extra value and returns true if the specified key was found in the - list of extra values. Returns true even if the value is Uninitialized. - - - - - Efficiently tracks (line,column) information as text is added, and - collects line mappings between the original and generated source code - so we can generate correct debugging information later - - - - - Marks the current position of the writer as corresponding to the - original location passed in - - the line pragma corresponding to the - current position in the generated code - - - - Provides a dictionary-like object used for caches which holds onto a maximum - number of elements specified at construction time. - - This class is not thread safe. - - - - - Creates a dictionary-like object used for caches. - - The maximum number of elements to store. - - - - Tries to get the value associated with 'key', returning true if it's found and - false if it's not present. - - - - - Adds a new element to the cache, replacing and moving it to the front if the - element is already present. - - - - - Returns the value associated with the given key, or throws KeyNotFoundException - if the key is not present. - - - - - Wraps the provided enumerable into a ReadOnlyCollection{T} - - Copies all of the data into a new array, so the data can't be - changed after creation. The exception is if the enumerable is - already a ReadOnlyCollection{T}, in which case we just return it. - - - - - List optimized for few writes and multiple reads. It provides thread-safe read and write access. - Iteration is not thread-safe by default, but GetCopyForRead allows for iteration - without taking a lock. - - - - - Gets a copy of the contents of the list. The copy will not change even if the original - CopyOnWriteList object is modified. This method should be used to iterate the list in - a thread-safe way if no lock is taken. Iterating on the original list is not guaranteed - to be thread-safe. - - The returned copy should not be modified by the caller. - - - - Returns the list of expressions represented by the instances. - - An array of instances to extract expressions from. - The array of expressions. - - - - Creates an instance of for a runtime value and the expression that represents it during the binding process. - - The runtime value to be represented by the . - An expression to represent this during the binding process. - The new instance of . - - - - Produces an interpreted binding using the given binder which falls over to a compiled - binding after hitCount tries. - - This method should be called whenever an interpreted binding is required. Sometimes it will - return a compiled binding if a previous binding was produced and it's hit count was exhausted. - In this case the binder will not be called back for a new binding - the previous one will - be used. - - The delegate type being used for the call site - The binder used for the call site - The number of calls before the binder should switch to a compiled mode. - The arguments that are passed for the binding (as received in a BindDelegate call) - A delegate which represents the interpreted binding. - - - - Expression which reduces to the normal test but under the interpreter adds a count down - check which enables compiling when the count down is reached. - - - - - Base class for storing information about the binding that a specific rule is applicable for. - - We have a derived generic class but this class enables us to refer to it w/o having the - generic type information around. - - This class tracks both the count down to when we should compile. When we compile we - take the Expression[T] that was used before and compile it. While this is happening - we continue to allow the interpreted code to run. When the compilation is complete we - store a thread static which tells us what binding failed and the current rule is no - longer functional. Finally the language binder will call us again and we'll retrieve - and return the compiled overload. - - - - - A hybrid dictionary which compares based upon object identity. - - - - - Calculates the quotient of two 32-bit signed integers rounded towards negative infinity. - - Dividend. - Divisor. - The quotient of the specified numbers rounded towards negative infinity, or (int)Floor((double)x/(double)y). - is 0. - The caller must check for overflow (x = Int32.MinValue, y = -1) - - - - Calculates the quotient of two 32-bit signed integers rounded towards negative infinity. - - Dividend. - Divisor. - The quotient of the specified numbers rounded towards negative infinity, or (int)Floor((double)x/(double)y). - is 0. - The caller must check for overflow (x = Int64.MinValue, y = -1) - - - - Calculates the remainder of floor division of two 32-bit signed integers. - - Dividend. - Divisor. - The remainder of of floor division of the specified numbers, or x - (int)Floor((double)x/(double)y) * y. - is 0. - - - - Calculates the remainder of floor division of two 32-bit signed integers. - - Dividend. - Divisor. - The remainder of of floor division of the specified numbers, or x - (int)Floor((double)x/(double)y) * y. - is 0. - - - - Behaves like Math.Round(value, MidpointRounding.AwayFromZero) - Needed because CoreCLR doesn't support this particular overload of Math.Round - - - - - Behaves like Math.Round(value, precision, MidpointRounding.AwayFromZero) - However, it works correctly on negative precisions and cases where precision is - outside of the [-15, 15] range. - - (This function is also needed because CoreCLR lacks this overload.) - - - - - Evaluates a polynomial in v0 where the coefficients are ordered in increasing degree - - - - - Evaluates a polynomial in v0 where the coefficients are ordered in increasing degree - if reverse is false, and increasing degree if reverse is true. - - - - - A numerically precise version of sin(v0 * pi) - - - - - A numerically precise version of |sin(v0 * pi)| - - - - - Take the quotient of the 2 polynomials forming the Lanczos approximation - with N=13 and G=13.144565 - - - - - Computes the Gamma function on positive values, using the Lanczos approximation. - Lanczos parameters are N=13 and G=13.144565. - - - - - Computes the Log-Gamma function on positive values, using the Lanczos approximation. - Lanczos parameters are N=13 and G=13.144565. - - - - - Thread safe dictionary that allows lazy-creation where readers will block for - the creation of the lazily created value. Call GetOrCreateValue w/ a key - and a callback function. If the value exists it is returned, if not the create - callback is called (w/o any locks held). The create call back will only be called - once for each key. - - - - - Helper class which stores the published value - - - - - Dictionary[TKey, TValue] is not thread-safe in the face of concurrent reads and writes. SynchronizedDictionary - provides a thread-safe implementation. It holds onto a Dictionary[TKey, TValue] instead of inheriting from - it so that users who need to do manual synchronization can access the underlying Dictionary[TKey, TValue]. - - - - - This returns the raw unsynchronized Dictionary[TKey, TValue]. Users are responsible for locking - on it before accessing it. Also, it should not be arbitrarily handed out to other code since deadlocks - can be caused if other code incorrectly locks on it. - - - - - Provides fast strongly typed thread local storage. This is significantly faster than - Thread.GetData/SetData. - - - - - True if the caller will guarantee that all cleanup happens as the thread - unwinds. - - This is typically used in a case where the thread local is surrounded by - a try/finally block. The try block pushes some state, the finally block - restores the previous state. Therefore when the thread exits the thread - local is back to it's original state. This allows the ThreadLocal object - to not check the current owning thread on retrieval. - - - - - Gets the current value if its not == null or calls the provided function - to create a new value. - - - - - Calls the provided update function with the current value and - replaces the current value with the result of the function. - - - - - Replaces the current value with a new one and returns the old value. - - - - - Gets the StorageInfo for the current thread. - - - - - Called when the fast path storage lookup fails. if we encountered the Empty storage - during the initial fast check then spin until we hit non-empty storage and try the fast - path again. - - - - - Creates the StorageInfo for the thread when one isn't already present. - - - - - Gets or sets the value for the current thread. - - - - - Helper class for storing the value. We need to track if a ManagedThreadId - has been re-used so we also store the thread which owns the value. - - - - - Returns a numerical code of the size of a type. All types get both a horizontal - and vertical code. Types that are lower in both dimensions have implicit conversions - to types that are higher in both dimensions. - - - - - Represents an array that has value equality. - - - - - Simple class for tracking a list of items and enumerating over them. - The items are stored in weak references; if the objects are collected, - they will not be seen when enumerating. - - The type of the collection element. - - - - Similar to Dictionary[TKey,TValue], but it also ensures that the keys will not be kept alive - if the only reference is from this collection. The value will be kept alive as long as the key - is alive. - - This currently has a limitation that the caller is responsible for ensuring that an object used as - a key is not also used as a value in *any* instance of a WeakHash. Otherwise, it will result in the - object being kept alive forever. This effectively means that the owner of the WeakHash should be the - only one who has access to the object used as a value. - - Currently, there is also no guarantee of how long the values will be kept alive even after the keys - get collected. This could be fixed by triggerring CheckCleanup() to be called on every garbage-collection - by having a dummy watch-dog object with a finalizer which calls CheckCleanup(). - - - - - Check if any of the keys have gotten collected - - Currently, there is also no guarantee of how long the values will be kept alive even after the keys - get collected. This could be fixed by triggerring CheckCleanup() to be called on every garbage-collection - by having a dummy watch-dog object with a finalizer which calls CheckCleanup(). - - - - - This class holds onto internal debugging options used in this assembly. - These options can be set via environment variables DLR_{option-name}. - Boolean options map "true" to true and other values to false. - - These options are for internal debugging only, and should not be - exposed through any public APIs. - - - - - Sets the value at the given index for a tuple of the given size. This set supports - walking through nested tuples to get the correct final index. - - - - - Gets the value at the given index for a tuple of the given size. This get - supports walking through nested tuples to get the correct final index. - - - - - Gets the unbound generic Tuple type which has at lease size slots or null if a large enough tuple is not available. - - - - - Creates a generic tuple with the specified types. - - If the number of slots fits within the maximum tuple size then we simply - create a single tuple. If it's greater then we create nested tuples - (e.g. a Tuple`2 which contains a Tuple`128 and a Tuple`8 if we had a size of 136). - - - - - Gets the number of usable slots in the provided Tuple type including slots available in nested tuples. - - - - - Creates a new instance of tupleType with the specified args. If the tuple is a nested - tuple the values are added in their nested forms. - - - - - Gets the values from a tuple including unpacking nested values. - - - - - Gets the series of properties that needs to be accessed to access a logical item in a potentially nested tuple. - - - - - Gets the series of properties that needs to be accessed to access a logical item in a potentially nested tuple. - - - - - Provides an expression for creating a tuple with the specified values. - - - - - TODO: Alternatively, it should be sufficient to remember indices for this, list, dict and block. - - - - - Convention for an individual argument at a callsite. - - Multiple different callsites can match against a single declaration. - Some argument kinds can be "unrolled" into multiple arguments, such as list and dictionary. - - - - - Simple unnamed positional argument. - In Python: foo(1,2,3) are all simple arguments. - - - - - Argument with associated name at the callsite - In Python: foo(a=1) - - - - - Argument containing a list of arguments. - In Python: foo(*(1,2*2,3)) would match 'def foo(a,b,c)' with 3 declared arguments such that (a,b,c)=(1,4,3). - it could also match 'def foo(*l)' with 1 declared argument such that l=(1,4,3) - - - - - Argument containing a dictionary of named arguments. - In Python: foo(**{'a':1, 'b':2}) - - - - - Represents a logical member of a type. The member could either be real concrete member on a type or - an extension member. - - This seperates the "physical" members that .NET knows exist on types from the members that - logically exist on a type. It also provides other abstractions above the level of .NET reflection - such as MemberGroups and NamespaceTracker's. - - It also provides a wrapper around the reflection APIs which cannot be extended from partial trust. - - - - - Gets the expression that creates the value. - - Returns null if it's an error to get the value. The caller can then call GetErrorForGet to get - the correct error Expression (or null if they should provide a default). - - - - - Gets an expression that assigns a value to the left hand side. - - Returns null if it's an error to assign to. The caller can then call GetErrorForSet to - get the correct error Expression (or null if a default error should be provided). - - - - - Gets an expression that assigns a value to the left hand side. - - Returns null if it's an error to assign to. The caller can then call GetErrorForSet to - get the correct error Expression (or null if a default error should be provided). - - - - - Gets an expression that performs a call on the object using the specified arguments. - - Returns null if it's an error to perform the specific operation. The caller can then call - GetErrorsForDoCall to get the correct error Expression (or null if a default error should be provided). - - - - - Returns the error associated with getting the value. - - A null return value indicates that the default error message should be provided by the caller. - - - - - Returns the error associated with accessing this member via a bound instance. - - A null return value indicates that the default error message should be provided by the caller. - - - - - Helper for getting values that have been bound. Called from BoundMemberTracker. Custom member - trackers can override this to provide their own behaviors when bound to an instance. - - - - - Helper for setting values that have been bound. Called from BoundMemberTracker. Custom member - trackers can override this to provide their own behaviors when bound to an instance. - - - - - Helper for setting values that have been bound. Called from BoundMemberTracker. Custom member - trackers can override this to provide their own behaviors when bound to an instance. - - - - - Binds the member tracker to the specified instance rturning a new member tracker if binding - is possible. If binding is not possible the existing member tracker will be returned. For example - binding to a static field results in returning the original MemberTracker. Binding to an instance - field results in a new BoundMemberTracker which will get GetBoundValue/SetBoundValue to pass the - instance through. - - - - - The type of member tracker. - - - - - The logical declaring type of the member. - - - - - The name of the member. - - - - - We ensure we only produce one MemberTracker for each member which logically lives on the declaring type. So - for example if you get a member from a derived class which is declared on the base class it should be the same - as getting the member from the base class. That’s easy enough until you get into extension members – here there - might be one extension member which is being applied to multiple types. Therefore we need to take into account the - extension type when ensuring that we only have 1 MemberTracker ever created. - - - - - Richly represents the signature of a callsite. - - - - - Array of additional meta information about the arguments, such as named arguments. - Null for a simple signature that's just an expression list. eg: foo(a*b,c,d) - - - - - Number of arguments in the signature. - - - - - True if the OldCallAction includes an ArgumentInfo of ArgumentKind.Dictionary or ArgumentKind.Named. - - - - - Gets the number of positional arguments the user provided at the call site. - - - - - All arguments are unnamed and matched by position. - - - - - A custom member tracker which enables languages to plug in arbitrary - members into the lookup process. - - - - - Encapsulates information about the result that should be produced when - a OldDynamicAction cannot be performed. The ErrorInfo can hold one of: - an expression which creates an Exception to be thrown - an expression which produces a value which should be returned - directly to the user and represents an error has occured (for - example undefined in JavaScript) - an expression which produces a value which should be returned - directly to the user but does not actually represent an error. - - ErrorInfo's are produced by an ActionBinder in response to a failed - binding. - - - - - Private constructor - consumers must use static From* factories - to create ErrorInfo objects. - - - - - Creates a new ErrorInfo which represents an exception that should - be thrown. - - - - - Creates a new ErrorInfo which represents a value which should be - returned to the user. - - - - - Crates a new ErrorInfo which represents a value which should be returned - to the user but does not represent an error. - - - - - - - The ErrorInfo expression produces an exception - - - - - The ErrorInfo expression produces a value which represents the error (e.g. undefined) - - - - - The ErrorInfo expression produces a value which is not an error - - - - - Gets the stub list for a COM Object. For COM objects we store the stub list - directly on the object using the Marshal APIs. This allows us to not have - any circular references to deal with via weak references which are challenging - in the face of COM. - - - - - Doesn't need to check PrivateBinding setting: no method that is part of the event is public the entire event is private. - If the code has already a reference to the event tracker instance for a private event its "static-ness" is not influenced - by private-binding setting. - - - - - Holds on a list of delegates hooked to the event. - We need the list because we cannot enumerate the delegates hooked to CLR event and we need to do so in - handler removal (we need to do custom delegate comparison there). If BCL enables the enumeration we could remove this. - - - - - Storage for the handlers - a key value pair of the callable object and the delegate handler. - - - - - Storage for the handlers - a key value pair of the callable object and the delegate handler. - - The delegate handler is closed over the callable object. Therefore as long as the object is alive the - delegate will stay alive and so will the callable object. That means it's fine to have a weak reference - to both of these objects. - - - - - Represents extension method. - - - - - The declaring type of the extension (the type this extension method extends) - - - - - The declaring type of the extension method. Since this is an extension method, - the declaring type is in fact the type this extension method extends, - not Method.DeclaringType - - - - - Represents a logical Property as a member of a Type. This Property can either be a real - concrete Property on a type (implemented with a ReflectedPropertyTracker) or an extension - property (implemented with an ExtensionPropertyTracker). - - - - - MemberGroups are a collection of MemberTrackers which are commonly produced - on-demand to talk about the available members. They can consist of a mix of - different member types or multiple membes of the same type. - - The most common source of MemberGroups is from ActionBinder.GetMember. From here - the DLR will perform binding to the MemberTrackers frequently producing the value - resulted from the user. If the result of the action produces a member it's self - the ActionBinder can provide the value exposed to the user via ReturnMemberTracker. - - ActionBinder provides default functionality for both getting members from a type - as well as exposing the members to the user. Getting members from the type maps - closely to reflection and exposing them to the user exposes the MemberTrackers - directly. - - - - - MethodGroup's represent a unique collection of method's. Typically this - unique set is all the methods which are overloaded by the same name including - methods with different arity. These methods represent a single logically - overloaded element of a .NET type. - - The base DLR binders will produce MethodGroup's when provided with a MemberGroup - which contains only methods. The MethodGroup's will be unique instances per - each unique group of methods. - - - - - Returns a BuiltinFunction bound to the provided type arguments. Returns null if the binding - cannot be performed. - - - - - NamespaceTracker represent a CLS namespace. - - - - - Provides a list of all the members of an instance. - - - - - Loads all the types from all assemblies that contribute to the current namespace (but not child namespaces) - - - - - Populates the tree with nodes for each part of the namespace - - - Full namespace name. It can be null (for top-level types) - - - - - As a fallback, so if the type does exist in any assembly. This would happen if a new type was added - that was not in the hardcoded list of types. - This code is not accurate because: - 1. We dont deal with generic types (TypeCollision). - 2. Previous calls to GetCustomMemberNames (eg. "from foo import *" in Python) would not have included this type. - 3. This does not deal with new namespaces added to the assembly - - - - - This stores all the public non-nested type names in a single namespace and from a single assembly. - This allows inspection of the namespace without eagerly loading all the types. Eagerly loading - types slows down startup, increases working set, and is semantically incorrect as it can trigger - TypeLoadExceptions sooner than required. - - - - - Enables implicit Type to TypeTracker conversions accross dynamic languages. - - - - - Represents the top reflected package which contains extra information such as - all the assemblies loaded and the built-in modules. - - - - - returns the package associated with the specified namespace and - updates the associated module to mark the package as imported. - - - - - Ensures that the assembly is loaded - - - true if the assembly was loaded for the first time. - false if the assembly had already been loaded before - - - - When an (interop) assembly is loaded, we scan it to discover the GUIDs of COM interfaces so that we can - associate the type definition with COM objects with that GUID. - Since scanning all loaded assemblies can be expensive, in the future, we might consider a more explicit - user binder to trigger scanning of COM types. - - - - Specifies that the member is a constructor, representing a ConstructorTracker - - - Specifies that the member is an event, representing a EventTracker - - - Specifies that the member is a field, representing a FieldTracker - - - Specifies that the member is a method, representing a MethodTracker - - - Specifies that the member is a property, representing a PropertyTracker - - - Specifies that the member is a property, representing a TypeTracker - - - Specifies that the member is a namespace, representing a NamespaceTracker - - - Specifies that the member is a group of method overloads, representing a MethodGroup - - - Specifies that the member is a group of types that very by arity, representing a TypeGroup - - - Specifies that the member is a custom meber, represetning a CustomTracker - - - Specifies that the member is a bound to an instance, representing a BoundMemberTracker - - - - A TypeCollision is used when we have a collision between - two types with the same name. Currently this is only possible w/ generic - methods that should logically have arity as a portion of their name. For eg: - System.EventHandler and System.EventHandler[T] - System.Nullable and System.Nullable[T] - System.IComparable and System.IComparable[T] - - The TypeCollision provides an indexer but also is a real type. When used - as a real type it is the non-generic form of the type. - - The indexer allows the user to disambiguate between the generic and - non-generic versions. Therefore users must always provide additional - information to get the generic version. - - - - The merged list so far. Could be null - The new type(s) to add to the merged list - The merged list. Could be a TypeTracker or TypeGroup - - - Gets the arity of generic parameters - - - No non-generic type is represented by this group. - - - - This returns the DeclaringType of all the types in the TypeGroup - - - - - This returns the base name of the TypeGroup (the name shared by all types minus arity) - - - - - This will return the result only for the non-generic type if one exists, and will throw - an exception if all types in the TypeGroup are generic - - - - - This will return the result only for the non-generic type if one exists, and will throw - an exception if all types in the TypeGroup are generic - - - - - True if the MethodBase is method which is going to construct an object - - - - - Returns the System.Type for any object, including null. The type of null - is represented by None.Type and all other objects just return the - result of Object.GetType - - - - - Simply returns a Type[] from calling GetType on each element of args. - - - - - EMITTED - Used by default method binder to check types of splatted arguments. - - - - - Given a MethodInfo which may be declared on a non-public type this attempts to - return a MethodInfo which will dispatch to the original MethodInfo but is declared - on a public type. - - Returns the original method if the method if a public version cannot be found. - - - - - Non-public types can have public members that we find when calling type.GetMember(...). This - filters out the non-visible members by attempting to resolve them to the correct visible type. - - If no correct visible type can be found then the member is not visible and we won't call it. - - - - - Sees if two MemberInfos point to the same underlying construct in IL. This - ignores the ReflectedType property which exists on MemberInfos which - causes direct comparisons to be false even if they are the same member. - - - - - Returns a value which indicates failure when a OldConvertToAction of ImplicitTry or - ExplicitTry. - - - - - Creates an interpreted delegate for the lambda. - - The lambda to compile. - A delegate which can interpret the lambda. - - - - Creates an interpreted delegate for the lambda. - - The lambda to compile. - The number of iterations before the interpreter starts compiling - A delegate which can interpret the lambda. - - - - Creates an interpreted delegate for the lambda. - - The lambda's delegate type. - The lambda to compile. - A delegate which can interpret the lambda. - - - - Creates an interpreted delegate for the lambda. - - The lambda to compile. - The number of iterations before the interpreter starts compiling - A delegate which can interpret the lambda. - - - - Compiles the lambda into a method definition. - - the lambda to compile - A which will be used to hold the lambda's IL. - A parameter that indicates if debugging information should be emitted to a PDB symbol store. - - - - Compiles the LambdaExpression. - - If the lambda is compiled with emitDebugSymbols, it will be - generated into a TypeBuilder. Otherwise, this method is the same as - calling LambdaExpression.Compile() - - This is a workaround for a CLR limitiation: DynamicMethods cannot - have debugging information. - - the lambda to compile - true to generate a debuggable method, false otherwise - the compiled delegate - - - - Compiles the LambdaExpression, emitting it into a new type, and - optionally making it debuggable. - - This is a workaround for a CLR limitiation: DynamicMethods cannot - have debugging information. - - the lambda to compile - Debugging information generator used by the compiler to mark sequence points and annotate local variables. - True if debug symbols (PDBs) are emitted by the . - the compiled delegate - - - - Reduces the provided DynamicExpression into site.Target(site, *args). - - - - - Removes all live objects and places them in static fields of a type. - - - - - Enables an object to be serializable to an Expression tree. The expression tree can then - be emitted into an assembly enabling the de-serialization of the object. - - - - - Serializes constants and dynamic sites so the code can be saved to disk - - - - - The MethodBinder will perform normal method binding. - - - - - The MethodBinder will return the languages definition of NotImplemented if the arguments are - incompatible with the signature. - - - - - The MethodBinder will set properties/fields for unused keyword arguments on the instance - that gets returned from the method. - - - - - The delegate representing the DLR Main function - - - - - An attribute that is applied to saved ScriptCode's to be used to re-create the ScriptCode - from disk. - - - - - Gets names stored in optimized scope. - - - - - Provides a mechanism for providing documentation stored in an assembly as metadata. - - Applying this attribute will enable documentation to be provided to the user at run-time - even if XML Documentation files are unavailable. - - - - - Updates an exception before it's getting re-thrown so - we can present a reasonable stack trace to the user. - - - - - Returns all the stack traces associates with an exception - - - - - Marks a class in the assembly as being an extension type for another type. - - - - - Marks a type in the assembly as being an extension type for another type. - - The type which is being extended - The type which provides the extension members. - - - - The type which contains extension members which are added to the type being extended. - - - - - The type which is being extended by the extension type. - - - - - Not all .NET enumerators throw exceptions if accessed in an invalid state. This type - can be used to throw exceptions from enumerators implemented in IronPython. - - - - - Event args for when a ScriptScope has had its contents changed. - - - - - Creates a new ModuleChangeEventArgs object with the specified name and type. - - - - - Creates a nwe ModuleChangeEventArgs with the specified name, type, and changed value. - - - - - Gets the name of the symbol that has changed. - - - - - Gets the way in which the symbol has changed: Set or Delete. - - - - - The the symbol has been set provides the new value. - - - - - The way in which a module has changed : Set or Delete - - - - - A new value has been set in the module (or a previous value has changed). - - - - - A value has been removed from the module. - - - - - A NullTextContentProvider to be provided when we have a pre-compiled ScriptCode which doesn't - have source code associated with it. - - - - - Singleton instance returned from an operator method when the operator method cannot provide a value. - - - - - Represents an ops-extension method which is added as an operator. - - The name must be a well-formed name such as "Add" that matches the CLS - naming conventions for adding overloads associated with op_* methods. - - - - - Represents an ops-extension method which is used to implement a property. - - - - - Provides a cache of reflection members. Only one set of values is ever handed out per a - specific request. - - - - - TODO: Make me private again - - - - - Indicates an extension method should be added as a static method, not a instance method. - - - - - Converts a generic ICollection of T into an array of T. - - If the collection is already an array of T the original collection is returned. - - - - - Converts a generic ICollection of T into an array of R using a given conversion. - - If the collection is already an array of R the original collection is returned. - - - - - Allows wrapping of proxy types (like COM RCWs) to expose their IEnumerable functionality - which is supported after casting to IEnumerable, even though Reflection will not indicate - IEnumerable as a supported interface - - - - - Requires the specified index to point inside the array. - - Array is null. - Index is outside the array. - - - - Requires the specified index to point inside the array. - - Index is outside the array. - - - - Requires the specified index to point inside the array or at the end - - Array is null. - Index is outside the array. - - - - Requires the specified index to point inside the array or at the end - - Array is null. - Index is outside the array. - - - - Requires the range [offset, offset + count] to be a subset of [0, array.Count]. - - Offset or count are out of range. - - - - Requires the range [offset, offset + count] to be a subset of [0, array.Count]. - - Offset or count are out of range. - - - - Requires the range [offset, offset + count] to be a subset of [0, array.Count]. - - Array is null. - Offset or count are out of range. - - - - Requires the range [offset, offset + count] to be a subset of [0, array.Count]. - - String is null. - Offset or count are out of range. - - - - Requires the array and all its items to be non-null. - - - - - Requires the enumerable collection and all its items to be non-null. - - - - - Presents a flat enumerable view of multiple dictionaries - - - - - Seeks the first character of a specified line in the text stream. - - The reader. - Line number. The current position is assumed to be line #1. - - Returns true if the line is found, false otherwise. - - - - - Reads characters to a string until end position or a terminator is reached. - Doesn't include the terminator into the resulting string. - Returns null, if the reader is at the end position. - - - - - Reads characters until end position or a terminator is reached. - Returns true if the character has been found (the reader is positioned right behind the character), - false otherwise. - - - - - Creates an open delegate for the given (dynamic)method. - - - - - Creates a closed delegate for the given (dynamic)method. - - - - - Gets a Func of CallSite, object * paramCnt, object delegate type - that's suitable for use in a non-strongly typed call site. - - - - - Returns true if the specified parameter is mandatory, i.e. is not optional and doesn't have a default value. - - - - - Yields all ancestors of the given type including the type itself. - Does not include implemented interfaces. - - - - - Like Type.GetInterfaces, but only returns the interfaces implemented by this type - and not its parents. - - - - - Enumerates extension methods in given assembly. Groups the methods by declaring namespace. - Uses a global cache if is true. - - - - - Binds occurances of generic parameters in against corresponding types in . - Invokes (parameter, type) for each such binding. - Returns false if the is structurally different from or if the binder returns false. - - - - - Determines if a given type matches the type that the method extends. - The match might be non-trivial if the extended type is an open generic type with constraints. - - - - - Splits text and optionally indents first lines - breaks along words, not characters. - - - - - Provides a StreamContentProvider for a stream of content backed by a file on disk. - - - - diff --git a/renderdocui/3rdparty/ironpython/Microsoft.Scripting.dll b/renderdocui/3rdparty/ironpython/Microsoft.Scripting.dll deleted file mode 100644 index 89909ef0f..000000000 Binary files a/renderdocui/3rdparty/ironpython/Microsoft.Scripting.dll and /dev/null differ diff --git a/renderdocui/3rdparty/ironpython/Microsoft.Scripting.xml b/renderdocui/3rdparty/ironpython/Microsoft.Scripting.xml deleted file mode 100644 index e802e5ba0..000000000 --- a/renderdocui/3rdparty/ironpython/Microsoft.Scripting.xml +++ /dev/null @@ -1,3812 +0,0 @@ - - - - Microsoft.Scripting - - - - - Provides documentation against live objects for use in a REPL window. - - - - - Gets the available members defined on the provided object. - - - - - Gets the overloads available for the provided object if it is invokable. - - - - - Gets the available members on the provided remote object. - - - - - Gets the overloads available for the provided remote object if it is invokable. - - - - - Provides documentation about a member in a live object. - - - - - The name of the member - - - - - The kind of the member if it's known. - - - - - Specifies the type of member. - - - - - Provides documentation for a single overload of an invokable object. - - - - - The name of the invokable object. - - - - - The documentation for the overload or null if no documentation is available. - - - - - The parameters for the invokable object. - - - - - Information about the return value. - - - - - Provides documentation for a single parameter. - - - - - The name of the parameter - - - - - The type name of the parameter or null if no type information is available. - - - - - Provides addition information about the parameter such as if it's a parameter array. - - - - - Gets the documentation string for this parameter or null if no documentation is available. - - - - - Indications extra information about a parameter such as if it's a parameter array. - - - - - This structure represents an immutable integer interval that describes a range of values, from Start to End. - - It is closed on the left and open on the right: [Start .. End). - - - - - Wraps a an IDictionary[object, object] and exposes it as an IDynamicMetaObjectProvider so that - users can access string attributes using member accesses. - - - - - Provides language specific documentation for live objects. - - - - - Helper for storing information about stack frames. - - - - - Exposes a IDictionary[string, object] as a dynamic object. Gets/sets/deletes turn - into accesses on the underlying dictionary. - - - - - Class that represents compiler options. - Note that this class is likely to change when hosting API becomes part of .Net - - - - - This overload will be called when a SourceUnit is not available. This can happen if the code is being executed remotely, - since SourceUnit cannot be marshaled across AppDomains. - - - - - Hosting API counterpart for . - - - - - Executes code in a default scope. - - - - - Execute code within a given scope and returns the result. - - - - - Executes code in in a default scope and converts to a given type. - - - - - Execute code within a given scope and converts result to a given type. - - - - - Executes the code in an empty scope. - Returns an ObjectHandle wrapping the resulting value of running the code. - - - - - Executes the code in the specified scope. - Returns an ObjectHandle wrapping the resulting value of running the code. - - - - - Executes the code in an empty scope. - Returns an ObjectHandle wrapping the resulting value of running the code. - - If an exception is thrown the exception is caught and an ObjectHandle to - the exception is provided. - - - Use this API to handle non-serializable exceptions (exceptions might not be serializable due to security restrictions) - or if an exception serialization loses information. - - - - - Executes the expression in the specified scope and return a result. - Returns an ObjectHandle wrapping the resulting value of running the code. - - If an exception is thrown the exception is caught and an ObjectHandle to - the exception is provided. - - - Use this API to handle non-serializable exceptions (exceptions might not be serializable due to security restrictions) - or if an exception serialization loses information. - - - - - Engine that compiled this code. - - - - - Default scope for this code. - - - - - The host can use this class to track for errors reported during script parsing and compilation. - Hosting API counterpart for . - - - - - Bridges ErrorSink and ErrorListener. - Errors reported by language compilers to ErrorSink are forwarded to the ErrorListener provided by the host. - - - This proxy is created in the scenario when the compiler is processing a single SourceUnit. - Therefore it could maintain one to one mapping from SourceUnit to ScriptSource. - In a case, which shouldn't happen, that the compiler reports an error in a different SourceUnit we just create - a new instance of the ScriptSource each time. - - TODO: Consider compilation of multiple source units and creating a hashtable mapping SourceUnits to ScriptSources - within the context of compilation unit. - - - - - Bridges ErrorListener and ErrorSink. It provides the reverse functionality as ErrorSinkProxyListener - - - - - Stores information needed to setup a language - - - - - Creates a new LanguageSetup - - assembly qualified type name of the language - provider - - - - Creates a new LanguageSetup with the provided options - TODO: remove this overload? - - - - - Creates a new LanguageSetup with the provided options - - - - - Gets an option as a strongly typed value. - - - - - The assembly qualified type name of the language provider - - - - - Display name of the language. If empty, it will be set to the first - name in the Names list. - - - - - Case-insensitive language names. - - - - - Case-insensitive file extension, optionally starts with a dot. - - - - - Option names are case-sensitive. - - - - - ObjectOperations provide a large catalogue of object operations such as member access, conversions, - indexing, and things like addition. There are several introspection and tool support services available - for more advanced hosts. - - You get ObjectOperation instances from ScriptEngine, and they are bound to their engines for the semantics - of the operations. There is a default instance of ObjectOperations you can share across all uses of the - engine. However, very advanced hosts can create new instances. - - - - - Returns true if the object can be called, false if it cannot. - - Even if an object is callable Call may still fail if an incorrect number of arguments or type of arguments are provided. - - - - - Invokes the provided object with the given parameters and returns the result. - - The prefered way of calling objects is to convert the object to a strongly typed delegate - using the ConvertTo methods and then invoking that delegate. - - - - - Invokes a member on the provided object with the given parameters and returns the result. - - - - - Creates a new instance from the provided object using the given parameters, and returns the result. - - - - - Gets the member name from the object obj. Throws an exception if the member does not exist or is write-only. - - - - - Gets the member name from the object obj and converts it to the type T. Throws an exception if the - member does not exist, is write-only, or cannot be converted. - - - - - Gets the member name from the object obj. Returns true if the member is successfully retrieved and - stores the value in the value out param. - - - - - Returns true if the object has a member named name, false if the member does not exist. - - - - - Removes the member name from the object obj. - - - - - Sets the member name on object obj to value. - - - - - Sets the member name on object obj to value. This overload can be used to avoid - boxing and casting of strongly typed members. - - - - - Gets the member name from the object obj. Throws an exception if the member does not exist or is write-only. - - - - - Gets the member name from the object obj and converts it to the type T. Throws an exception if the - member does not exist, is write-only, or cannot be converted. - - - - - Gets the member name from the object obj. Returns true if the member is successfully retrieved and - stores the value in the value out param. - - - - - Returns true if the object has a member named name, false if the member does not exist. - - - - - Removes the member name from the object obj. - - - - - Sets the member name on object obj to value. - - - - - Sets the member name on object obj to value. This overload can be used to avoid - boxing and casting of strongly typed members. - - - - - Converts the object obj to the type T. The conversion will be explicit or implicit depending on - what the langauge prefers. - - - - - Converts the object obj to the type type. The conversion will be explicit or implicit depending on - what the langauge prefers. - - - - - Converts the object obj to the type T. Returns true if the value can be converted, false if it cannot. - - The conversion will be explicit or implicit depending on what the langauge prefers. - - - - - Converts the object obj to the type type. Returns true if the value can be converted, false if it cannot. - - The conversion will be explicit or implicit depending on what the langauge prefers. - - - - - Converts the object obj to the type T including explicit conversions which may lose information. - - - - - Converts the object obj to the type type including explicit conversions which may lose information. - - - - - Converts the object obj to the type T including explicit conversions which may lose information. - - Returns true if the value can be converted, false if it cannot. - - - - - Converts the object obj to the type type including explicit conversions which may lose information. - - Returns true if the value can be converted, false if it cannot. - - - - - Converts the object obj to the type T including implicit conversions. - - - - - Converts the object obj to the type type including implicit conversions. - - - - - Converts the object obj to the type T including implicit conversions. - - Returns true if the value can be converted, false if it cannot. - - - - - Converts the object obj to the type type including implicit conversions. - - Returns true if the value can be converted, false if it cannot. - - - - - Performs a generic unary operation on the specified target and returns the result. - - - - - Performs a generic unary operation on the strongly typed target and returns the value as the specified type - - - - - Performs the generic binary operation on the specified targets and returns the result. - - - - - Peforms the generic binary operation on the specified strongly typed targets and returns - the strongly typed result. - - - - - Performs addition on the specified targets and returns the result. Throws an exception - if the operation cannot be performed. - - - - - Performs subtraction on the specified targets and returns the result. Throws an exception - if the operation cannot be performed. - - - - - Raises the first object to the power of the second object. Throws an exception - if the operation cannot be performed. - - - - - Multiplies the two objects. Throws an exception - if the operation cannot be performed. - - - - - Divides the first object by the second object. Throws an exception - if the operation cannot be performed. - - - - - Performs modulus of the 1st object by the second object. Throws an exception - if the operation cannot be performed. - - - - - Shifts the left object left by the right object. Throws an exception if the - operation cannot be performed. - - - - - Shifts the left object right by the right object. Throws an exception if the - operation cannot be performed. - - - - - Performs a bitwise-and of the two operands. Throws an exception if the operation - cannot be performed. - - - - - Performs a bitwise-or of the two operands. Throws an exception if the operation - cannot be performed. - - - - - Performs a exclusive-or of the two operands. Throws an exception if the operation - cannot be performed. - - - - - Compares the two objects and returns true if the left object is less than the right object. - Throws an exception if hte comparison cannot be performed. - - - - - Compares the two objects and returns true if the left object is greater than the right object. - Throws an exception if hte comparison cannot be performed. - - - - - Compares the two objects and returns true if the left object is less than or equal to the right object. - Throws an exception if hte comparison cannot be performed. - - - - - Compares the two objects and returns true if the left object is greater than or equal to the right object. - Throws an exception if hte comparison cannot be performed. - - - - - Compares the two objects and returns true if the left object is equal to the right object. - Throws an exception if the comparison cannot be performed. - - - - - Compares the two objects and returns true if the left object is not equal to the right object. - Throws an exception if hte comparison cannot be performed. - - - - - Returns a string which describes the object as it appears in source code - - - - - Returns a string representation of the object in a language specific object display format. - - - - - Returns a list of strings which contain the known members of the object. - - - - - Returns a string providing documentation for the specified object. - - - - - Returns a list of signatures applicable for calling the specified object in a form displayable to the user. - - - - - Returns true if the remote object is callable. - - - - - Invokes the specified remote object with the specified remote parameters. - - Though delegates are preferable for calls they may not always be usable for remote objects. - - - - - Invokes the specified remote object with the local parameters which will be serialized - to the remote app domain. - - - - - Creates a new remote instance from the provided remote object using the given parameters, and returns the result. - - - - - Creates a new remote instance from the provided remote object using the given parameters, and returns the result. - - - - - Sets the remote object as a member on the provided remote object. - - - - - Sets the member name on the remote object obj to value. This overload can be used to avoid - boxing and casting of strongly typed members. - - - - - Gets the member name on the remote object. Throws an exception if the member is not defined or - is write-only. - - - - - Gets the member name on the remote object. Throws an exception if the member is not defined or - is write-only. - - - - - Gets the member name on the remote object. Returns false if the member is not defined or - is write-only. - - - - - Tests to see if the member name is defined on the remote object. - - - - - Removes the member from the remote object - - - - - Converts the remote object into the specified type returning a handle to - the new remote object. The conversion will be explicit or implicit depending on - what the langauge prefers. - - - - - Converts the remote object into the specified type returning a handle to - the new remote object. The conversion will be explicit or implicit depending on - what the langauge prefers. - - - - - Converts the remote object into the specified type returning a handle to - the new remote object. Returns true if the value can be converted, - false if it cannot. The conversion will be explicit or implicit depending on - what the langauge prefers. - - - - - Converts the remote object into the specified type returning a handle to - the new remote object. Returns true if the value can be converted, - false if it cannot. The conversion will be explicit or implicit depending on - what the langauge prefers. - - - - - Converts the object obj to the type T including explicit conversions which may lose information. - - - - - Converts the object obj to the type type including explicit conversions which may lose information. - - - - - Converts the object obj to the type T including explicit conversions which may lose information. - - Returns true if the value can be converted, false if it cannot. - - - - - Converts the object obj to the type type including explicit conversions which may lose information. - - Returns true if the value can be converted, false if it cannot. - - - - - Converts the object obj to the type T including implicit conversions. - - - - - Converts the object obj to the type type including implicit conversions. - - - - - Converts the object obj to the type T including implicit conversions. - - Returns true if the value can be converted, false if it cannot. - - - - - Converts the object obj to the type type including implicit conversions. - - Returns true if the value can be converted, false if it cannot. - - - - - Unwraps the remote object and converts it into the specified type before - returning it. - - - - - Performs the specified unary operator on the remote object. - - - - - Performs the specified binary operator on the remote object. - - - - - Adds the two remote objects. Throws an exception if the operation cannot be performed. - - - - - Subtracts the 1st remote object from the second. Throws an exception if the operation cannot be performed. - - - - - Raises the 1st remote object to the power of the 2nd. Throws an exception if the operation cannot be performed. - - - - - Multiplies the two remote objects. Throws an exception if the operation cannot be performed. - - - - - Divides the 1st remote object by the 2nd. Throws an exception if the operation cannot be performed. - - - - - Performs modulus on the 1st remote object by the 2nd. Throws an exception if the operation cannot be performed. - - - - - Shifts the 1st remote object left by the 2nd remote object. Throws an exception if the operation cannot be performed. - - - - - Shifts the 1st remote object right by the 2nd remote object. Throws an exception if the operation cannot be performed. - - - - - Performs bitwise-and on the two remote objects. Throws an exception if the operation cannot be performed. - - - - - Performs bitwise-or on the two remote objects. Throws an exception if the operation cannot be performed. - - - - - Performs exclusive-or on the two remote objects. Throws an exception if the operation cannot be performed. - - - - - Compares the two remote objects and returns true if the 1st is less than the 2nd. Throws an exception if the operation cannot be performed. - - - - - Compares the two remote objects and returns true if the 1st is greater than the 2nd. Throws an exception if the operation cannot be performed. - - - - - Compares the two remote objects and returns true if the 1st is less than or equal to the 2nd. Throws an exception if the operation cannot be performed. - - - - - Compares the two remote objects and returns true if the 1st is greater than or equal to than the 2nd. Throws an exception if the operation cannot be performed. - - - - - Compares the two remote objects and returns true if the 1st is equal to the 2nd. Throws an exception if the operation cannot be performed. - - - - - Compares the two remote objects and returns true if the 1st is not equal to the 2nd. Throws an exception if the operation cannot be performed. - - - - - Returns a string representation of the object in a langauge specific object display format. - - - - - Returns a list of strings which contain the known members of the remote object. - - - - - Returns a string providing documentation for the specified remote object. - - - - - Returns a list of signatures applicable for calling the specified object in a form displayable to the user. - - - - - Helper to unwrap an object - in the future maybe we should validate the current app domain. - - - - - Helper to unwrap multiple objects - - - - - Reads an option whose value is expected to be a collection of non-null strings. - Reaturns a read-only copy of the option's value. - - - - - Dynamically choose between interpreting, simple compilation and compilation - that takes advantage of runtime history. - - - - - The number of iterations before the interpreter starts compiling.s - - - - - Display exception detail (callstack) when exception gets caught - - - - - Whether to gather performance statistics. - - - - - Initial file search paths provided by the host. - - - - - Abstracts system operations that are used by DLR and could potentially be platform specific. - The host can implement its PAL to adapt DLR to the platform it is running on. - For example, the Silverlight host adapts some file operations to work against files on the server. - - - - Invalid path. - - - Invalid path. - - - - Advanced APIs for HAPI providers. These methods should not be used by hosts. - They are provided for other hosting API implementers that would like to leverage existing HAPI and - extend it with language specific functionality, for example. - - - - is a null reference. - is remote. - - - e is a null reference. - is remote. - - - is a null reference. - is remote. - - - is a null reference. - is remote. - - - is a null reference. - is remote. - - - is a null reference. - is remote. - - - is a null reference. - is a null reference. - is a transparent proxy. - - - - Performs a callback in the ScriptEngine's app domain and returns the result. - - - - - Creates a new DocumentationOperations object from the given DocumentationProvider. - - - - - Represents a language in Hosting API. - Hosting API counterpart for . - - - - - Returns a new ObjectOperations object. See the Operations property for why you might want to call this. - - - - - Returns a new ObjectOperations object that inherits any semantics particular to the provided ScriptScope. - - See the Operations property for why you might want to call this. - - - - - Executes an expression. The execution is not bound to any particular scope. - - The engine doesn't support code execution. - is a null reference. - - - - Executes an expression within the specified scope. - - The engine doesn't support code execution. - is a null reference. - is a null reference. - - - - Executes an expression within a new scope and converts result to the given type. - - The engine doesn't support code execution. - is a null reference. - - - - Executes an expression within the specified scope and converts result to the given type. - - The engine doesn't support code execution. - is a null reference. - is a null reference. - - - - Executes content of the specified file in a new scope and returns that scope. - - The engine doesn't support code execution. - is a null reference. - - - - Executes content of the specified file against the given scope. - - The . - The engine doesn't support code execution. - is a null reference. - is a null reference. - - - - Executes the expression in the specified scope and return a result. - Returns an ObjectHandle wrapping the resulting value of running the code. - - - - - Executes the code in an empty scope. - Returns an ObjectHandle wrapping the resulting value of running the code. - - - - - Executes the expression in the specified scope and return a result. - Returns an ObjectHandle wrapping the resulting value of running the code. - - If an exception is thrown the exception is caught and an ObjectHandle to - the exception is provided. - - - Use this API in case the exception is not serializable (for example, due to security restrictions) or its serialization - loses information that you need to access. - - - - - Executes the code in an empty scope. - Returns an ObjectHandle wrapping the resulting value of running the code. - - If an exception is thrown the exception is caught and an ObjectHandle to - the exception is provided. - - - Use this API in case the exception is not serializable (for example, due to security restrictions) or its serialization - loses information that you need to access. - - - - - Creates a new ScriptScope whose storage is an arbitrary object. - - Accesses to the ScriptScope will turn into get, set, and delete members against the object. - - - - - This method returns the ScriptScope in which a ScriptSource of given path was executed. - - The ScriptSource.Path property is the key to finding the ScriptScope. Hosts need - to make sure they create a ScriptSource and set its Path property appropriately. - - GetScope is primarily useful for tools that need to map files to their execution scopes. For example, - an editor and interpreter tool might run a file Foo that imports or requires a file Bar. - - The editor's user might later open the file Bar and want to execute expressions in its context. - The tool would need to find Bar's ScriptScope for setting the appropriate context in its interpreter window. - This method helps with this scenario. - - - - - Return a ScriptSource object from string contents with the current engine as the language binding. - - The default SourceCodeKind is AutoDetect. - - The ScriptSource's Path property defaults to null. - - - - - Return a ScriptSource object from string contents with the current engine as the language binding. - - The ScriptSource's Path property defaults to null. - - - - - Return a ScriptSource object from string contents with the current engine as the language binding. - - The default SourceCodeKind is AutoDetect. - - - - - Return a ScriptSource object from string contents. These are helpers for creating ScriptSources' with the right language binding. - - - - - Return a ScriptSource object from file contents with the current engine as the language binding. - - The path's extension does NOT have to be in ScriptRuntime.GetRegisteredFileExtensions - or map to this language engine with ScriptRuntime.GetEngineByFileExtension. - - The default SourceCodeKind is File. - - The ScriptSource's Path property will be the path argument. - - The encoding defaults to System.Text.Encoding.Default. - - - - - Return a ScriptSource object from file contents with the current engine as the language binding. - - The path's extension does NOT have to be in ScriptRuntime.GetRegisteredFileExtensions - or map to this language engine with ScriptRuntime.GetEngineByFileExtension. - - The default SourceCodeKind is File. - - The ScriptSource's Path property will be the path argument. - - - - - Return a ScriptSource object from file contents with the current engine as the language binding. - - The path's extension does NOT have to be in ScriptRuntime.GetRegisteredFileExtensions - or map to this language engine with ScriptRuntime.GetEngineByFileExtension. - - The ScriptSource's Path property will be the path argument. - - - - - This method returns a ScriptSource object from a System.CodeDom.CodeObject. - This is a factory method for creating a ScriptSources with this language binding. - - The expected CodeDom support is extremely minimal for syntax-independent expression of semantics. - - Languages may do more, but hosts should only expect CodeMemberMethod support, - and only sub nodes consisting of the following: - CodeSnippetStatement - CodeSnippetExpression - CodePrimitiveExpression - CodeMethodInvokeExpression - CodeExpressionStatement (for holding MethodInvoke) - - - - - This method returns a ScriptSource object from a System.CodeDom.CodeObject. - This is a factory method for creating a ScriptSources with this language binding. - - The expected CodeDom support is extremely minimal for syntax-independent expression of semantics. - - Languages may do more, but hosts should only expect CodeMemberMethod support, - and only sub nodes consisting of the following: - CodeSnippetStatement - CodeSnippetExpression - CodePrimitiveExpression - CodeMethodInvokeExpression - CodeExpressionStatement (for holding MethodInvoke) - - - - - This method returns a ScriptSource object from a System.CodeDom.CodeObject. - This is a factory method for creating a ScriptSources with this language binding. - - The expected CodeDom support is extremely minimal for syntax-independent expression of semantics. - - Languages may do more, but hosts should only expect CodeMemberMethod support, - and only sub nodes consisting of the following: - CodeSnippetStatement - CodeSnippetExpression - CodePrimitiveExpression - CodeMethodInvokeExpression - CodeExpressionStatement (for holding MethodInvoke) - - - - - This method returns a ScriptSource object from a System.CodeDom.CodeObject. - This is a factory method for creating a ScriptSources with this language binding. - - The expected CodeDom support is extremely minimal for syntax-independent expression of semantics. - - Languages may do more, but hosts should only expect CodeMemberMethod support, - and only sub nodes consisting of the following: - CodeSnippetStatement - CodeSnippetExpression - CodePrimitiveExpression - CodeMethodInvokeExpression - CodeExpressionStatement (for holding MethodInvoke) - - - - - These methods return ScriptSource objects from stream contents with the current engine as the language binding. - - The default SourceCodeKind is File. - - The encoding defaults to Encoding.Default. - - - - - These methods return ScriptSource objects from stream contents with the current engine as the language binding. - - The default SourceCodeKind is File. - - - - - These methods return ScriptSource objects from stream contents with the current engine as the language binding. - - The encoding defaults to Encoding.Default. - - - - - This method returns a ScriptSource with the content provider supplied with the current engine as the language binding. - - This helper lets you own the content provider so that you can implement a stream over internal host data structures, such as an editor's text representation. - - - - - This method returns a language-specific service. - - It provides a point of extensibility for a language implementation - to offer more functionality than the standard engine members discussed here. - - Commonly available services include: - TokenCategorizer - Provides standardized tokenization of source code - ExceptionOperations - Provides formatting of exception objects. - DocumentationProvidera - Provides documentation for live object. - - - - - Sets the search paths used by the engine for loading files when a script wants - to import or require another file of code. - - The language doesn't allow to set search paths. - - - - Gets the search paths used by the engine for loading files when a script wants - to import or require another file of code. - - - - - Returns a default ObjectOperations for the engine. - - Because an ObjectOperations object caches rules for the types of - objects and operations it processes, using the default ObjectOperations for - many objects could degrade the caching benefits. Eventually the cache for - some operations could degrade to a point where ObjectOperations stops caching and - does a full search for an implementation of the requested operation for the given objects. - - Another reason to create a new ObjectOperations instance is to have it bound - to the specific view of a ScriptScope. Languages may attach per-language - behavior to a ScriptScope which would alter how the operations are performed. - - For simple hosting situations, this is sufficient behavior. - - - - - - - This property returns readon-only LanguageOptions this engine is using. - - - The values are determined during runtime initialization and read-only afterwards. - You can change the settings via a configuration file or explicitly using ScriptRuntimeSetup class. - - - - - This property returns the ScriptRuntime for the context in which this engine executes. - - - - - This property returns the engine's version as a string. The format is language-dependent. - - - - - ScriptHost is collocated with ScriptRuntime in the same app-domain. - The host can implement a derived class to consume some notifications and/or - customize operations like TryGetSourceUnit,ResolveSourceUnit, etc. - - The areguments to the the constructor of the derived class are specified in ScriptRuntimeSetup - instance that enters ScriptRuntime initialization. - - If the host is remote with respect to DLR (i.e. also with respect to ScriptHost) - and needs to access objects living in its app-domain it can pass MarshalByRefObject - as an argument to its ScriptHost subclass constructor. - - - - - The runtime the host is attached to. - - - - - Invoked after the initialization of the associated Runtime is finished. - The host can override this method to perform additional initialization of runtime (like loading assemblies etc.). - - - - - Invoked after a new language is loaded into the Runtime. - The host can override this method to perform additional initialization of language engines. - - - - - Provides hosting to DLR. Forwards DLR requests to the ScriptHost. - - - - - DLR requires any Hosting API provider to implement this class and provide its instance upon Runtime initialization. - DLR calls on it to perform basic host/system dependent operations. - - - - - Abstracts system operations that are used by DLR and could potentially be platform specific. - - - - - Provides host-redirectable IO streams used by DLR languages for default IO. - - - - - Used if the host stores the output as binary data. - - Binary stream to write data to. - Encoding used to convert textual data written to the output by the script. - - - - Used if the host handles both kinds of data (textual and binary) by itself. - - - - - Represents a Dynamic Language Runtime in Hosting API. - Hosting API counterpart for . - - - - - Creates ScriptRuntime in the current app-domain and initialized according to the the specified settings. - Creates an instance of host class specified in the setup and associates it with the created runtime. - Both Runtime and ScriptHost are collocated in the current app-domain. - - - - - Creates a new runtime with languages set up according to the current application configuration - (using System.Configuration). - - - - - Creates ScriptRuntime in the current app-domain and initialized according to the the specified settings. - Creates an instance of host class specified in the setup and associates it with the created runtime. - Both Runtime and ScriptHost are collocated in the specified app-domain. - - - - - - - - - Gets engine for the specified language. - - - - - Looks up the engine for the specified language. If the engine hasn't been created in this Runtime, it is instantiated here. - The method doesn't lock nor send notifications to the host. - - - - - path is empty, contains one or more of the invalid characters defined in GetInvalidPathChars or doesn't have an extension. - - - - path is null - file extension does not map to language engine - language does not have any search paths - file does exist in language's search path - - - - This method walks the assembly's namespaces and name bindings to ScriptRuntime.Globals - to represent the types available in the assembly. Each top-level namespace name gets - bound in Globals to a dynamic object representing the namespace. Within each top-level - namespace object, nested namespace names are bound to dynamic objects representing each - tier of nested namespaces. When this method encounters the same namespace-qualified name, - it merges names together objects representing the namespaces. - - - - - - This property returns the "global object" or name bindings of the ScriptRuntime as a ScriptScope. - - You can set the globals scope, which you might do if you created a ScriptScope with an - IAttributesCollection so that your host could late bind names. - - - - - Stores information needed to setup a ScriptRuntime - - - - - Reads setup from .NET configuration system (.config files). - If there is no configuration available returns an empty setup. - - - - - Reads setup from a specified XML stream. - - - - - Reads setup from a specified XML file. - - - - - The list of language setup information for languages to load into - the runtime - - - - - Indicates that the script runtime is in debug mode. - This means: - - 1) Symbols are emitted for debuggable methods (methods associated with SourceUnit). - 2) Debuggable methods are emitted to non-collectable types (this is due to CLR limitations on dynamic method debugging). - 3) JIT optimization is disabled for all methods - 4) Languages may disable optimizations based on this value. - - - - - Ignore CLR visibility checks - - - - - Can be any derived class of ScriptHost. When set, it allows the - host to override certain methods to control behavior of the runtime - - - - - Option names are case-sensitive. - - - - - Arguments passed to the host type when it is constructed - - - - - A ScriptScope is a unit of execution for code. It consists of a global Scope which - all code executes in. A ScriptScope can have an arbitrary initializer and arbitrary - reloader. - - ScriptScope is not thread safe. Host should either lock when multiple threads could - access the same module or should make a copy for each thread. - - Hosting API counterpart for . - - - - - Gets a value stored in the scope under the given name. - - The specified name is not defined in the scope. - is a null reference. - - - - Gets a value stored in the scope under the given name. - Converts the result to the specified type using the conversion that the language associated with the scope defines. - If no language is associated with the scope, the default CLR conversion is attempted. - - The specified name is not defined in the scope. - is a null reference. - - - - Tries to get a value stored in the scope under the given name. - - is a null reference. - - - - Tries to get a value stored in the scope under the given name. - Converts the result to the specified type using the conversion that the language associated with the scope defines. - If no language is associated with the scope, the default CLR conversion is attempted. - - is a null reference. - - - - Sets the name to the specified value. - - is a null reference. - - - - Gets a handle for a value stored in the scope under the given name. - - The specified name is not defined in the scope. - is a null reference. - - - - Tries to get a handle for a value stored in the scope under the given name. - Returns true if there is such name, false otherwise. - - is a null reference. - - - - Sets the name to the specified value. - - - The value held by the handle isn't from the scope's app-domain and isn't serializable or MarshalByRefObject. - - or is a null reference. - - - - Determines if this context or any outer scope contains the defined name. - - is a null reference. - - - - Removes the variable of the given name from this scope. - - true if the value existed in the scope before it has been removed. - is a null reference. - - - - Gets a list of variable names stored in the scope. - - - - - Gets an array of variable names and their values stored in the scope. - - - - - Gets an engine for the language associated with this scope. - Returns invariant engine if the scope is language agnostic. - - - - - Hosting counterpart for . - - - - - Compile the ScriptSource into CompileCode object that can be executed - repeatedly in its default scope or in other scopes without having to recompile the code. - - Code cannot be compiled. - - - - Errors are reported to the specified listener. - Returns null if the parser cannot compile the code due to errors. - - - - - Errors are reported to the specified listener. - Returns null if the parser cannot compile the code due to error(s). - - - - - Errors are reported to the specified listener. - Returns null if the parser cannot compile the code due to error(s). - - - - - Executes the code in the specified scope. - Returns an object that is the resulting value of running the code. - - When the ScriptSource is a file or statement, the engine decides what is - an appropriate value to return. Some languages return the value produced - by the last expression or statement, but languages that are not expression - based may return null. - - Code cannot be compiled. - - - - Executes the source code. The execution is not bound to any particular scope. - - - - - Executes the code in a specified scope and converts the result to the specified type. - The conversion is language specific. - - - - - Executes the code in an empty scope and converts the result to the specified type. - The conversion is language specific. - - - - - Executes the code in an empty scope. - Returns an ObjectHandle wrapping the resulting value of running the code. - - - - - Executes the code in the specified scope. - Returns an ObjectHandle wrapping the resulting value of running the code. - - - - - Executes the code in an empty scope. - Returns an ObjectHandle wrapping the resulting value of running the code. - - If an exception is thrown the exception is caught and an ObjectHandle to - the exception is provided. - - - Use this API to handle non-serializable exceptions (exceptions might not be serializable due to security restrictions) - or if an exception serialization loses information. - - - - - Executes the expression in the specified scope and return a result. - Returns an ObjectHandle wrapping the resulting value of running the code. - - If an exception is thrown the exception is caught and an ObjectHandle to - the exception is provided. - - - Use this API to handle non-serializable exceptions (exceptions might not be serializable due to security restrictions) - or if an exception serialization loses information. - - - - - Runs a specified code as if it was a program launched from OS command shell. - and returns a process exit code indicating the success or error condition - of executing the code. - - Exact behavior depends on the language. Some languages have a dedicated "exit" exception that - carries the exit code, in which case the exception is cought and the exit code is returned. - The default behavior returns the result of program's execution converted to an integer - using a language specific conversion. - - Code cannot be compiled. - - - - Detects the encoding of the content. - - - An encoding that is used by the reader of the script source to transcode its content to Unicode text. - Null if the content is already textual and no transcoding is performed. - - - Note that the default encoding specified when the script source is created could be overridden by - an encoding that is found in the content preamble (Unicode BOM or a language specific encoding preamble). - In that case the preamble encoding is returned. Otherwise, the default encoding is returned. - - An I/O error occurs. - - - - Reads specified range of lines (or less) from the source unit. - - 1-based number of the first line to fetch. - The number of lines to fetch. - - Which character sequences are considered line separators is language specific. - If language doesn't specify otherwise "\r", "\n", "\r\n" are recognized line separators. - - An I/O error occurs. - - - - Reads a specified line. - - 1-based line number. - Line content. Line separator is not included. - An I/O error occurs. - - Which character sequences are considered line separators is language specific. - If language doesn't specify otherwise "\r", "\n", "\r\n" are recognized line separators. - - - - - Gets script source content. - - Entire content. - An I/O error occurs. - - The result includes language specific preambles (e.g. "#coding:UTF-8" encoding preamble recognized by Ruby), - but not the preamble defined by the content encoding (e.g. BOM). - The entire content of the source unit is encoded by single encoding (if it is read from binary stream). - - - - - Identification of the source unit. Assigned by the host. - The format and semantics is host dependent (could be a path on file system or URL). - null for anonymous script source. - Cannot be an empty string. - - - - - Move the tokenizer past the next token and return its category. - - The token information associated with the token just scanned. - - - - Move the tokenizer past the next token. - - False if the end of stream has been reached, true otherwise. - - - - Get all tokens over a block of the stream. - - - - The scanner should return full tokens. If startLocation + length lands in the middle of a token, the full token - should be returned. - - s - Tokens are read until at least given amount of characters is read or the stream ends. - A enumeration of tokens. - - - - Scan from startLocation to at least startLocation + length. - - Tokens are read until at least given amount of characters is read or the stream ends. - - This method is used to determine state at arbitrary startLocation. - - False if the end of stream has been reached, true otherwise. - - - - The current internal state of the scanner. - - - - - The current startLocation of the scanner. - - - - - Represents a language context. Typically there is at most 1 context - associated with each language, but some languages may use more than one context - to identify code that should be treated differently. Contexts are used during - member and operator lookup. - - - - - Registers a language within the system with the specified name. - - - - - Looks up the context ID for the specified context identifier - - - - - Singleton for each language. - - - - - Must not be called under a lock as it can potentially call a user code. - - The language context's implementation failed to instantiate. - - - - Whether the application is in debug mode. - This means: - - 1) Symbols are emitted for debuggable methods (methods associated with SourceUnit). - 2) Debuggable methods are emitted to non-collectable types (this is due to CLR limitations on dynamic method debugging). - 3) JIT optimization is disabled for all methods - 4) Languages may disable optimizations based on this value. - - - - - Ignore CLR visibility checks. - - - - - ObjectOperations provide a large catalogue of object operations such as member access, conversions, - indexing, and things like addition. There are several introspection and tool support services available - for more advanced hosts. - - You get ObjectOperation instances from ScriptEngine, and they are bound to their engines for the semantics - of the operations. There is a default instance of ObjectOperations you can share across all uses of the - engine. However, very advanced hosts can create new instances. - - - - the number of sites required before we'll try cleaning up the cache... - - - the minimum difference between the average that is required to remove - - - the maximum number we'll remove on a single cache cleanup - - - the number of sites we should clear after if we can't make progress cleaning up otherwise - - - a dictionary of SiteKey's which are used to cache frequently used operations, logically a set - - - the # of sites we had created at the last cleanup - - - the total number of sites we've ever created - - - - Calls the provided object with the given parameters and returns the result. - - The prefered way of calling objects is to convert the object to a strongly typed delegate - using the ConvertTo methods and then invoking that delegate. - - - - - Invokes a member on the provided object with the given parameters and returns the result. - - - - - Invokes a member on the provided object with the given parameters and returns the result. - - - - - Creates a new instance from the provided object using the given parameters, and returns the result. - - - - - Gets the member name from the object obj. Throws an exception if the member does not exist or is write-only. - - - - - Gets the member name from the object obj and converts it to the type T. Throws an exception if the - member does not exist, is write-only, or cannot be converted. - - - - - Gets the member name from the object obj. Returns true if the member is successfully retrieved and - stores the value in the value out param. - - - - - Returns true if the object has a member named name, false if the member does not exist. - - - - - Removes the member name from the object obj. - - - - - Sets the member name on object obj to value. - - - - - Sets the member name on object obj to value. This overload can be used to avoid - boxing and casting of strongly typed members. - - - - - Gets the member name from the object obj. Throws an exception if the member does not exist or is write-only. - - - - - Gets the member name from the object obj and converts it to the type T. The conversion will be explicit or implicit - depending on what the langauge prefers. Throws an exception if the member does not exist, is write-only, or cannot be converted. - - - - - Gets the member name from the object obj. Returns true if the member is successfully retrieved and - stores the value in the value out param. - - - - - Returns true if the object has a member named name, false if the member does not exist. - - - - - Removes the member name from the object obj. Returns true if the member was successfully removed - or false if the member does not exist. - - - - - Sets the member name on object obj to value. - - - - - Sets the member name on object obj to value. This overload can be used to avoid - boxing and casting of strongly typed members. - - - - - Converts the object obj to the type T. The conversion will be explicit or implicit - depending on what the langauge prefers. - - - - - Converts the object obj to the type type. The conversion will be explicit or implicit - depending on what the langauge prefers. - - - - - Converts the object obj to the type T. Returns true if the value can be converted, false if it cannot. - - The conversion will be explicit or implicit depending on what the langauge prefers. - - - - - Converts the object obj to the type type. Returns true if the value can be converted, false if it cannot. - - The conversion will be explicit or implicit depending on what the langauge prefers. - - - - - Convers the object obj to the type T including explicit conversions which may lose information. - - - - - Converts the object obj to the type type including explicit conversions which may lose information. - - - - - Converts the object obj to the type type including explicit conversions which may lose information. - - Returns true if the value can be converted, false if it cannot. - - - - - Converts the object obj to the type T. Returns true if the value can be converted, false if it cannot. - - - - - Convers the object obj to the type T including implicit conversions. - - - - - Converts the object obj to the type type including implicit conversions. - - - - - Converts the object obj to the type type including implicit conversions. - - Returns true if the value can be converted, false if it cannot. - - - - - Converts the object obj to the type T. Returns true if the value can be converted, false if it cannot. - - - - - Performs a generic unary operation on the strongly typed target and returns the value as the specified type - - - - - Peforms the generic binary operation on the specified strongly typed targets and returns - the strongly typed result. - - - - - Returns a list of strings which contain the known members of the object. - - - - - Returns a string representation of the object in a language specific object display format. - - - - - Gets or creates a dynamic site w/ the specified type parameters for the provided binder. - - - This will either get the site from the cache or create a new site and return it. The cache - may be cleaned if it's gotten too big since the last usage. - - - - - Gets or creates a dynamic site w/ the specified type parameters for the provided binder. - - - This will either get the site from the cache or create a new site and return it. The cache - may be cleaned if it's gotten too big since the last usage. - - - - - Gets or creates a dynamic site w/ the specified type parameters for the provided binder. - - - This will either get the site from the cache or create a new site and return it. The cache - may be cleaned if it's gotten too big since the last usage. - - - - - Gets or creates a dynamic site w/ the specified type parameters for the provided binder. - - - This will either get the site from the cache or create a new site and return it. The cache - may be cleaned if it's gotten too big since the last usage. - - - - - Gets or creates a dynamic site w/ the specified type parameters for the provided binder. - - - This will either get the site from the cache or create a new site and return it. The cache - may be cleaned if it's gotten too big since the last usage. - - - - - Helper to create to get or create the dynamic site - called by the GetSite methods. - - - - - Removes items from the cache that have the lowest usage... - - - - - Helper class for tracking all of our unique dynamic sites and their - usage patterns. We hash on the combination of the binder and site type. - - We also track the hit count and the key holds the site associated w/ the - key. Logically this is a set based upon the binder and site-type but we - store it in a dictionary. - - - - - Singleton LanguageContext which represents a language-neutral LanguageContext - - - - - Provides language specific facilities which are typically called by the runtime. - - - - - Provides access to setting variables in scopes. - - By default this goes through ObjectOperations which can be rather slow. - Languages can override this to provide fast customized access which avoids - ObjectOperations. Languages can provide fast access to commonly used scope - types for that language. Typically this includes ScopeStorage and any other - classes which the language themselves uses for backing of a Scope. - - - - - Provides access to try getting variables in scopes. - - By default this goes through ObjectOperations which can be rather slow. - Languages can override this to provide fast customized access which avoids - ObjectOperations. Languages can provide fast access to commonly used scope - types for that language. Typically this includes ScopeStorage and any other - classes which the language themselves uses for backing of a Scope. - - - - - Provides access to getting variables in scopes and converting the result. - - By default this goes through ObjectOperations which can be rather slow. - Languages can override this to provide fast customized access which avoids - ObjectOperations. Languages can provide fast access to commonly used scope - types for that language. Typically this includes ScopeStorage and any other - classes which the language themselves uses for backing of a Scope. - - - - - Provides access to getting variables in scopes. - - By default this goes through ObjectOperations which can be rather slow. - Languages can override this to provide fast customized access which avoids - ObjectOperations. Languages can provide fast access to commonly used scope - types for that language. Typically this includes ScopeStorage and any other - classes which the language themselves uses for backing of a Scope. - - - - - Provides a text reader for source code that is to be read from a given stream. - - The stream open for reading. The stream must also allow seeking. - An encoding that should be used if the stream doesn't have Unicode or language specific preamble. - the path of the source unit if available - The reader. - An I/O error occurs. - - - - Creates the language specific CompilerOptions object for compilation of code not bound to any particular scope. - The language should flow any relevant options from LanguageContext to the newly created options instance. - - - - - Creates the language specific CompilerOptions object for compilation of code bound to a given scope. - - - - - Parses the source code within a specified compiler context. - The source unit to parse is held on by the context. - - null on failure. - Could also set the code properties and line/file mappings on the source unit. - - - - Creates a conversion binder. - - If explicitCast is true then the binder should do explicit conversions. - If explicitCast is false then the binder should do implicit conversions. - - If explicitCast is null it is up to the language to select the conversions - which closest match their normal behavior. - - - - - Gets the member names associated with the object - By default, only returns IDO names - - - - - Returns a string representation of the object in a language specific object display format. - - Dynamic sites container that could be used for any dynamic dispatches necessary for formatting. - Object to format. - A string representation of object. - - - - Provides the ContextId which includes members that should only be shown for this LanguageContext. - - ContextId's are used for filtering by Scope's. - - - - - Gets the ScriptDomainManager that this LanguageContext is running within. - - - - - Whether the language can parse code and create source units. - - - - - Internal class which binds a LanguageContext, StreamContentProvider, and Encoding together to produce - a TextContentProvider which reads binary data with the correct language semantics. - - - - - Provides a factory to create TextReader's over one source of textual content. - - TextContentProvider's are used when reading from a source which is already decoded - or has a known specific decoding. - - For example a text editor might provide a TextContentProvider whose backing is - an in-memory text buffer that the user can actively edit. - - - - - Creates a new TextReader which is backed by the content the TextContentProvider was created for. - - This method may be called multiple times. For example once to compile the code and again to get - the source code to display error messages. - - - - - This attribute marks a parameter that is not allowed to be null. - It is used by the method binding infrastructure to generate better error - messages and method selection. - - - - - This attribute marks a parameter whose type is an array that is not allowed to have null items. - It is used by the method binding infrastructure to generate better error - messages and method selection. - - - - - This attribute is used to mark a parameter that can accept any keyword parameters that - are not bound to normal arguments. The extra keyword parameters will be - passed in a dictionary which is created for the call. - - Most languages which support params dictionaries will support the following types: - IDictionary<string, anything> - IDictionary<object, anything> - Dictionary<string, anything> - Dictionary<object, anything> - IDictionary - IAttributesCollection (deprecated) - - For languages which don't have language level support the user will be required to - create and populate the dictionary by hand. - - This attribute is the dictionary equivalent of the System.ParamArrayAttribute. - - - public static void KeywordArgFunction([ParamsDictionary]IDictionary<string, object> dict) { - foreach (var v in dict) { - Console.WriteLine("Key: {0} Value: {1}", v.Key, v.Value); - } - } - - Called from Python: - - KeywordArgFunction(a = 2, b = "abc") - - will print: - Key: a Value = 2 - Key: b Value = abc - - - - - Represents a host-provided variables for executable code. The variables are - typically backed by a host-provided dictionary. Languages can also associate per-language - information with the context by using scope extensions. This can be used for tracking - state which is used across multiple executions, for providing custom forms of - storage (for example object keyed access), or other language specific semantics. - - Scope objects are thread-safe as long as their underlying storage is thread safe. - - Script hosts can choose to use thread safe or thread unsafe modules but must be sure - to constrain the code they right to be single-threaded if using thread unsafe - storage. - - - - - Creates a new scope with a new empty thread-safe dictionary. - - - - - Creates a new scope which is backed by an arbitrary object for it's storage. - - - - - - Gets the ScopeExtension associated with the provided ContextId. - - - - - Sets the ScopeExtension to the provided value for the given ContextId. - - The extension can only be set once. The returned value is either the new ScopeExtension - if no value was previously set or the previous value. - - - - - Provides optimized and cacheable support for scope storage. - - This is the default object used for storing values in a scope. - - - - The implementation uses a case-insensitive dictionary which holds - onto ScopeVariableIgnoreCase objects. The SVIC's hold onto ScopeVariable - objects for each possible casing. - - - - - Gets the named value from the scope optionally ignoring case. - - If the named value is not present an InvalidOperationException is raised. - - - - - Attempts to get the named value from the scope optionally ignoring the case. - - Returns true if the value is present, false if it is not. - - - - - Sets the named value in the scope optionally ignoring the case. - - - - - Deletes the named value from the scope optionally ignoring the case. - - - - - Checks if the named value is present in the scope optionally ignoring the case. - - - - - Gets the IScopeVariable for the scope optionally ignoring case. - - The IScopeVariable can be held onto and get/set/deleted without performing - a dictionary lookup on subsequent accesses. - - - - - Gets the ScopeVariable for the scope in a case-sensitive manner. - - The ScopeVariable can be held onto and get/set/deleted without performing - a dictionary lookup on subsequent accesses. - - - - - Gets the ScopeVariableIgnoreCase for the scope in a case-insensitive manner. - - The ScopeVariable can be held onto and get/set/deleted without performing - a dictionary lookup on subsequent accesses. - - - - - Returns all of the member names which currently have values in the scope. - - The list contains all available casings. - - - - - Returns all of the member names and their associated values from the scope. - - The list contains all available casings. - - - - - Provides convenient case-sensitive value access. - - - - - Provides a common interface for accessing both case sensitive and - case insensitive variable storage. - - - - - Atempts to get the value. If a value is assigned it returns true otherwise - it returns false. - - - - - Sets the current value in the scope. - - - - - Removes the current value from the scope. - - - - - True if the scope has a value, false if it does not. - - - - - Boxes the value for storage in a scope. Languages or consumers of the scope - can save this value and use it to get/set the current value in the scope for - commonly accessed values. - - ScopeVariables are case sensitive and will only refer to a single value. - - - - - Atempts to get the value. If a value is assigned it returns true otherwise - it returns false. - - - - - Sets the current value in the scope. - - - - - Removes the current value from the scope. - - - - - True if the scope has a value, false if it does not. - - - - - Boxes the value for storage in a scope. Languages or consumers of the scope - can save this value and use it to get/set the current value in the scope for - commonly accessed values. - - ScopeVariablesIgnoreCase are case insensitive and may access different casings - depending on how other gets/sets occur in the scope. - - - - - Atempts to get the value. If a value is assigned it returns true otherwise - it returns false. - - - - - Sets the current value in the scope. - - - - - Removes the current value from the scope. - - - - - True if the scope has a value, false if it does not. - - - - - ScriptCode is an instance of compiled code that is bound to a specific LanguageContext - but not a specific ScriptScope. The code can be re-executed multiple times in different - scopes. Hosting API counterpart for this class is CompiledCode. - - - - - A collection of environment variables. - - - - - Event for when a host calls LoadAssembly. After hooking this - event languages will need to call GetLoadedAssemblyList to - get any assemblies which were loaded before the language was - loaded. - - - - - Only host should redirect I/O. - - - - - Provides a factory to create streams over one source of binary content. - - StreamContentProvider's are used when opening a file of an unknown encoding. The - StreamContentProvider will be wrapped in a TextContentProvider provided by the language - which can support a language specific way of interpreting the binary data into text. - - For example some languages allow a marker at the beginning of the file which specifies - the encoding of the rest of the file. - - - - - Creates a new Stream which is backed by the content the StreamContentProvider was created for. - - For example if the StreamContentProvider was backing a file then GetStream re-opens the file and returns - the new stream. - - This method may be called multiple times. For example once to compile the code and again to get - the source code to display error messages. - - - - - Move the tokenizer past the next token and return its category. - - The token information associated with the token just scanned. - - - - Move the tokenizer past the next token. - - False if the end of stream has been reached, true otherwise. - - - - Get all tokens over a block of the stream. - - - - The scanner should return full tokens. If startLocation + length lands in the middle of a token, the full token - should be returned. - - - Tokens are read until at least given amount of characters is read or the stream ends. - A enumeration of tokens. - - - - Scan from startLocation to at least startLocation + length. - - The mininum number of characters to process while getting tokens. - - This method is used to determine state at arbitrary startLocation. - - False if the end of stream has been reached, true otherwise. - - - - The current internal state of the scanner. - - - - - The current startLocation of the scanner. - - - - - See also Microsoft.VisualStudio.Package.TokenTriggers. - - - - - Source code is a syntactically correct. - - - - - Source code represents an empty statement/expression. - - - - - Source code is already invalid and no suffix can make it syntactically correct. - - - - - Last token is incomplete. Source code can still be completed correctly. - - - - - Last statement is incomplete. Source code can still be completed correctly. - - - - - Defines a kind of the source code. The parser sets its initial state accordingly. - - - - - The code is an expression. - - - - - The code is a sequence of statements. - - - - - The code is a single statement. - - - - - The code is a content of a file. - - - - - The code is an interactive command. - - - - - The language parser auto-detects the kind. A syntax error is reported if it is not able to do so. - - - - - Source code reader. - - - - - Seeks the first character of a specified line in the text stream. - - Line number. The current position is assumed to be line #1. - - Returns true if the line is found, false otherwise. - - - - - Encoding that is used by the reader to convert binary data read from an underlying binary stream. - Null if the reader is reading from a textual source (not performing any byte to character transcoding). - - - - - Provides a StreamContentProvider for a stream of content backed by a file on disk. - - - - - Represents a location in source code. - - - - - Creates a new source location. - - The index in the source stream the location represents (0-based). - The line in the source stream the location represents (1-based). - The column in the source stream the location represents (1-based). - - - - Compares two specified location values to see if they are equal. - - One location to compare. - The other location to compare. - True if the locations are the same, False otherwise. - - - - Compares two specified location values to see if they are not equal. - - One location to compare. - The other location to compare. - True if the locations are not the same, False otherwise. - - - - Compares two specified location values to see if one is before the other. - - One location to compare. - The other location to compare. - True if the first location is before the other location, False otherwise. - - - - Compares two specified location values to see if one is after the other. - - One location to compare. - The other location to compare. - True if the first location is after the other location, False otherwise. - - - - Compares two specified location values to see if one is before or the same as the other. - - One location to compare. - The other location to compare. - True if the first location is before or the same as the other location, False otherwise. - - - - Compares two specified location values to see if one is after or the same as the other. - - One location to compare. - The other location to compare. - True if the first location is after or the same as the other location, False otherwise. - - - - Compares two specified location values. - - One location to compare. - The other location to compare. - 0 if the locations are equal, -1 if the left one is less than the right one, 1 otherwise. - - - - A location that is valid but represents no location at all. - - - - - An invalid location. - - - - - A minimal valid location. - - - - - The index in the source stream the location represents (0-based). - - - - - The line in the source stream the location represents (1-based). - - - - - The column in the source stream the location represents (1-based). - - - - - Whether the location is a valid location. - - True if the location is valid, False otherwise. - - - - Stores the location of a span of text in a source file. - - - - - Constructs a new span with a specific start and end location. - - The beginning of the span. - The end of the span. - - - - A valid span that represents no location. - - - - - An invalid span. - - - - - Compares two specified Span values to see if they are equal. - - One span to compare. - The other span to compare. - True if the spans are the same, False otherwise. - - - - Compares two specified Span values to see if they are not equal. - - One span to compare. - The other span to compare. - True if the spans are not the same, False otherwise. - - - - The start location of the span. - - - - - The end location of the span. Location of the first character behind the span. - - - - - Length of the span (number of characters inside the span). - - - - - Whether the locations in the span are valid. - - - - - Reads specified range of lines (or less) from the source unit. - Line numbers starts with 1. - - - - - Errors are reported to the specified sink. - Returns null if the parser cannot compile the code due to error(s). - - - - - Executes against a specified scope. - - - - - Executes against a specified scope and reports errors to the given error sink. - - - - - Executes in a new scope created by the language. - - - - - Executes in a new scope created by the language. - - - - - Executes in a new scope created by the language. - - - - - Identification of the source unit. Assigned by the host. - The format and semantics is host dependent (could be a path on file system or URL). - Empty string for anonymous source units. - - - - - LanguageContext of the language of the unit. - - - - - Unmapped span. - - - - - A token marking an end of stream. - - - - - A space, tab, or newline. - - - - - A block comment. - - - - - A single line comment. - - - - - A documentation comment. - - - - - A numeric literal. - - - - - A character literal. - - - - - A string literal. - - - - - A regular expression literal. - - - - - A keyword. - - - - - A directive (e.g. #line). - - - - - A punctuation character that has a specific meaning in a language. - - - - - A token that operates as a separator between two language elements. - - - - - An identifier (variable, $variable, @variable, @@variable, $variable$, function!, function?, [variable], i'variable', ...) - - - - - Braces, parenthesis, brackets. - - - - - Errors. - - - - - Converts a generic ICollection of T into an array of T. - - If the collection is already an array of T the original collection is returned. - - - - - Not all .NET enumerators throw exceptions if accessed in an invalid state. This type - can be used to throw exceptions from enumerators implemented in IronPython. - - - - - Wraps the provided enumerable into a ReadOnlyCollection{T} - - Copies all of the data into a new array, so the data can't be - changed after creation. The exception is if the enumerable is - already a ReadOnlyCollection{T}, in which case we just return it. - - - - - Console input stream (Console.OpenStandardInput) has a bug that manifests itself if reading small amounts of data. - This class wraps the standard input stream with a buffer that ensures that enough data are read from the underlying stream. - - - - - Requires the range [offset, offset + count] to be a subset of [0, array.Count]. - - Offset or count are out of range. - - - - Requires the range [offset, offset + count] to be a subset of [0, array.Count]. - - Offset or count are out of range. - - - - Requires the array and all its items to be non-null. - - - - - Requires the enumerable collection and all its items to be non-null. - - - - - Requires the range [offset, offset + count] to be a subset of [0, array.Count]. - - Array is null. - Offset or count are out of range. - - - - Presents a flat enumerable view of multiple dictionaries - - - - - Strongly-typed and parameterized string factory. - - - - - A string like "Cannot access member {1} declared on type {0} because the type contains generic parameters." - - - - - A string like "Type '{0}' is missing or cannot be loaded." - - - - - A string like "static property "{0}" of "{1}" can only be read through a type, not an instance" - - - - - A string like "static property "{0}" of "{1}" can only be assigned to through a type, not an instance" - - - - - A string like "Type parameter is {0}. Expected a delegate." - - - - - A string like "Cannot cast from type '{0}' to type '{1}" - - - - - A string like "unknown member type: '{0}'. " - - - - - A string like "The operation requires a non-generic type for {0}, but this represents generic types only" - - - - - A string like "Invalid operation: '{0}'" - - - - - A string like "Cannot create default value for type {0}." - - - - - A string like "Unhandled convert: {0}" - - - - - A string like "{0}.{1} has no publiclly visible method." - - - - - A string like "Extension type {0} must be public." - - - - - A string like "Invalid type of argument {0}; expecting {1}." - - - - - A string like "Field {0} is read-only" - - - - - A string like "Property {0} is read-only" - - - - - A string like "Expected event from {0}.{1}, got event from {2}.{3}." - - - - - A string like "expected bound event, got {0}." - - - - - A string like "Expected type {0}, got {1}." - - - - - A string like "can only write to member {0}." - - - - - A string like "Invalid stream type: {0}." - - - - - A string like "can't add another casing for identifier {0}" - - - - - A string like "can't add new identifier {0}" - - - - - A string like "Type '{0}' doesn't provide a suitable public constructor or its implementation is faulty: {1}" - - - - - A string like "Cannot emit constant {0} ({1})" - - - - - A string like "No implicit cast from {0} to {1}" - - - - - A string like "No explicit cast from {0} to {1}" - - - - - A string like "name '{0}' not defined" - - - - - A string like "Cannot create instance of {0} because it contains generic parameters" - - - - - A string like "Non-verifiable assembly generated: {0}:\nAssembly preserved as {1}\nError text:\n{2}\n" - - - - - A string like "Method precondition violated" - - - - - A string like "Invalid argument value" - - - - - A string like "Non-empty string required" - - - - - A string like "Non-empty collection required" - - - - - A string like "must by an Exception instance" - - - - - A string like "Type of test must be bool" - - - - - A string like "Type of the expression must be bool" - - - - - A string like "Empty string is not a valid path." - - - - - A string like "Invalid delegate type (Invoke method not found)." - - - - - A string like "expected only static property" - - - - - A string like "Property doesn't exist on the provided type" - - - - - A string like "Field doesn't exist on provided type" - - - - - A string like "Type doesn't have constructor with a given signature" - - - - - A string like "Type doesn't have a method with a given name." - - - - - A string like "Type doesn't have a method with a given name and signature." - - - - - A string like "Count must be non-negative." - - - - - A string like "arrayType must be an array type" - - - - - A string like "Either code or target must be specified." - - - - - A string like "RuleBuilder can only be used with delegates whose first argument is CallSite." - - - - - A string like "no instance for call." - - - - - A string like "Missing Test." - - - - - A string like "Missing Target." - - - - - A string like "Finally already defined." - - - - - A string like "Can not have fault and finally." - - - - - A string like "Fault already defined." - - - - - A string like "Global/top-level local variable names must be unique." - - - - - A string like "Generating code from non-serializable CallSiteBinder." - - - - - A string like "Specified path is invalid." - - - - - A string like "Dictionaries are not hashable." - - - - - A string like "language already registered." - - - - - A string like "The method or operation is not implemented." - - - - - A string like "No exception." - - - - - A string like "Already initialized." - - - - - A string like "CreateScopeExtension must return a scope extension." - - - - - A string like "Invalid number of parameters for the service." - - - - - A string like "Cannot change non-caching value." - - - - - A string like "No code to compile." - - - - - A string like "Queue empty." - - - - - A string like "Enumeration has not started. Call MoveNext." - - - - - A string like "Enumeration already finished." - - - - - A string like "Invalid output directory." - - - - - A string like "Invalid assembly name or file extension." - - - - - A string like "No default value for a given type." - - - - - A string like "Specified language provider type is not registered." - - - - - A string like "can't read from property" - - - - - A string like "can't write to property" - - - - - Strongly-typed and parameterized exception factory. - - - - - ArgumentException with message like "Either code or target must be specified." - - - - - InvalidOperationException with message like "Type parameter is {0}. Expected a delegate." - - - - - InvalidOperationException with message like "Cannot cast from type '{0}' to type '{1}" - - - - - InvalidOperationException with message like "unknown member type: '{0}'. " - - - - - InvalidOperationException with message like "RuleBuilder can only be used with delegates whose first argument is CallSite." - - - - - InvalidOperationException with message like "no instance for call." - - - - - InvalidOperationException with message like "Missing Test." - - - - - InvalidOperationException with message like "Missing Target." - - - - - TypeLoadException with message like "The operation requires a non-generic type for {0}, but this represents generic types only" - - - - - ArgumentException with message like "Invalid operation: '{0}'" - - - - - InvalidOperationException with message like "Finally already defined." - - - - - InvalidOperationException with message like "Can not have fault and finally." - - - - - InvalidOperationException with message like "Fault already defined." - - - - - ArgumentException with message like "Cannot create default value for type {0}." - - - - - ArgumentException with message like "Unhandled convert: {0}" - - - - - InvalidOperationException with message like "{0}.{1} has no publiclly visible method." - - - - - ArgumentException with message like "Global/top-level local variable names must be unique." - - - - - ArgumentException with message like "Generating code from non-serializable CallSiteBinder." - - - - - ArgumentException with message like "Specified path is invalid." - - - - - ArgumentTypeException with message like "Dictionaries are not hashable." - - - - - InvalidOperationException with message like "language already registered." - - - - - NotImplementedException with message like "The method or operation is not implemented." - - - - - InvalidOperationException with message like "No exception." - - - - - ArgumentException with message like "Extension type {0} must be public." - - - - - InvalidOperationException with message like "Already initialized." - - - - - InvalidImplementationException with message like "CreateScopeExtension must return a scope extension." - - - - - ArgumentException with message like "Invalid number of parameters for the service." - - - - - ArgumentException with message like "Invalid type of argument {0}; expecting {1}." - - - - - ArgumentException with message like "Cannot change non-caching value." - - - - - MissingMemberException with message like "Field {0} is read-only" - - - - - MissingMemberException with message like "Property {0} is read-only" - - - - - ArgumentException with message like "Expected event from {0}.{1}, got event from {2}.{3}." - - - - - ArgumentTypeException with message like "expected bound event, got {0}." - - - - - ArgumentTypeException with message like "Expected type {0}, got {1}." - - - - - MemberAccessException with message like "can only write to member {0}." - - - - - InvalidOperationException with message like "No code to compile." - - - - - ArgumentException with message like "Invalid stream type: {0}." - - - - - InvalidOperationException with message like "Queue empty." - - - - - InvalidOperationException with message like "Enumeration has not started. Call MoveNext." - - - - - InvalidOperationException with message like "Enumeration already finished." - - - - - InvalidOperationException with message like "can't add another casing for identifier {0}" - - - - - InvalidOperationException with message like "can't add new identifier {0}" - - - - - ArgumentException with message like "Invalid output directory." - - - - - ArgumentException with message like "Invalid assembly name or file extension." - - - - - ArgumentException with message like "Cannot emit constant {0} ({1})" - - - - - ArgumentException with message like "No implicit cast from {0} to {1}" - - - - - ArgumentException with message like "No explicit cast from {0} to {1}" - - - - - MissingMemberException with message like "name '{0}' not defined" - - - - - ArgumentException with message like "No default value for a given type." - - - - - ArgumentException with message like "Specified language provider type is not registered." - - - - - InvalidOperationException with message like "can't read from property" - - - - - InvalidOperationException with message like "can't write to property" - - - - - ArgumentException with message like "Cannot create instance of {0} because it contains generic parameters" - - - - - System.Security.VerificationException with message like "Non-verifiable assembly generated: {0}:\nAssembly preserved as {1}\nError text:\n{2}\n" - - - - - Gets a Func of CallSite, object * paramCnt, object delegate type - that's suitable for use in a non-strongly typed call site. - - - - diff --git a/renderdocui/3rdparty/ironpython/README.md b/renderdocui/3rdparty/ironpython/README.md deleted file mode 100644 index 189c1014c..000000000 --- a/renderdocui/3rdparty/ironpython/README.md +++ /dev/null @@ -1,5 +0,0 @@ -This is a distribution of [IronPython](http://ironpython.net/) 2.7.4, license is available in LICENSE.md. - -In this folder is compilelibs.sh which will rompress the Libs/ python standard library into a zip for distribution. - -Run compilelibs.sh and point it at an IronPython checkout and it will copy pythonlibs.zip to this folder, which will be copied by the packaging scripts next to renderdocui.exe to provide the python standard library in-program. diff --git a/renderdocui/3rdparty/ironpython/compilelibs.sh b/renderdocui/3rdparty/ironpython/compilelibs.sh deleted file mode 100644 index 982b1d7c7..000000000 --- a/renderdocui/3rdparty/ironpython/compilelibs.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -if [ $# -ne 1 ]; then - echo "Usage: $0 /path/to/IronPython/"; - exit; -fi - -IRONPYTHON="$1" -OUTDIR=$PWD - -cd $IRONPYTHON/Lib -zip -r $OUTDIR/pythonlibs.zip * diff --git a/renderdocui/Code/AppMain.cs b/renderdocui/Code/AppMain.cs deleted file mode 100644 index 627c98a8f..000000000 --- a/renderdocui/Code/AppMain.cs +++ /dev/null @@ -1,319 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Windows.Forms; -using System.Text.RegularExpressions; -using renderdoc; -using IronPython.Hosting; -using Microsoft.Scripting.Hosting; -using IronPython.Runtime.Exceptions; - -namespace renderdocui.Code -{ - class AppMain - { - [System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptions] - [STAThread] - static void Main(string[] args) - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - - Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); - AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); - Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); - - // command line arguments that we can call when we temporarily elevate the process - if(args.Contains("--registerRDCext")) - { - Helpers.InstallRDCAssociation(); - return; - } - - if(args.Contains("--registerCAPext")) - { - Helpers.InstallCAPAssociation(); - return; - } - - if (args.Contains("--registerVKLayer")) - { - Helpers.RegisterVulkanLayer(); - return; - } - - Win32PInvoke.LoadLibrary("renderdoc.dll"); - - // clean up any update that just happened - string updateFilesPath = Path.Combine(Path.GetTempPath(), "RenderDocUpdate"); - - try - { - if (Directory.Exists(updateFilesPath)) - Directory.Delete(updateFilesPath, true); - } - catch (Exception) - { - // ignore any exceptions from this - } - - string filename = ""; - - bool temp = false; - - // not real command line argument processing, but allow an argument to indicate we're being passed - // a temporary filename that we should take ownership of to delete when we're done (if the user doesn't - // save it) - foreach(var a in args) - { - if(a.ToUpperInvariant() == "--TEMPFILE") - temp = true; - } - - string remoteHost = ""; - uint remoteIdent = 0; - - for (int i = 0; i < args.Length; i++) - { - // accept --remoteaccess for backwards compatibility - if (i + 1 < args.Length && - (args[i].ToUpperInvariant() == "--REMOTEACCESS" || - args[i].ToUpperInvariant() == "--TARGETCONTROL")) - { - var regexp = @"^([a-zA-Z0-9_-]+:)?([0-9]+)$"; - - var match = Regex.Match(args[i+1], regexp); - - if (match.Success) - { - var host = match.Groups[1].Value; - if (host.Length > 0 && host[host.Length - 1] == ':') - host = host.Substring(0, host.Length - 1); - uint ident = 0; - if (uint.TryParse(match.Groups[2].Value, out ident)) - { - remoteHost = host; - remoteIdent = ident; - } - } - } - } - - List pyscripts = new List(); - - for (int i = 0; i + 1 < args.Length; i++) - { - if (args[i].ToUpperInvariant() == "--PYTHON" || - args[i].ToUpperInvariant() == "--PY" || - args[i].ToUpperInvariant() == "--SCRIPT") - { - if (File.Exists(args[i + 1])) - { - pyscripts.Add(args[i + 1]); - } - } - } - - if (args.Length > 0 && File.Exists(args[args.Length - 1]) && Path.GetExtension(args[args.Length - 1]) != ".py") - { - filename = args[args.Length - 1]; - } - - var cfg = new PersistantConfig(); - - // load up the config from user folder, handling errors if it's malformed and falling back to defaults - if (File.Exists(Core.ConfigFilename)) - { - try - { - cfg = PersistantConfig.Deserialize(Core.ConfigFilename); - } - catch (System.Xml.XmlException) - { - MessageBox.Show(String.Format("Error loading config file\n{0}\nA default config is loaded and will be saved out.", Core.ConfigFilename)); - } - catch (System.InvalidOperationException) - { - MessageBox.Show(String.Format("Error loading config file\n{0}\nA default config is loaded and will be saved out.", Core.ConfigFilename)); - } - catch (System.IO.IOException ex) - { - MessageBox.Show(String.Format("Error loading config file: {1}\n{0}\nA default config is loaded and will be saved out.", Core.ConfigFilename, ex.Message)); - } - } - - // propogate float formatting settings to the Formatter class used globally to format float values - cfg.SetupFormatting(); - - Application.CurrentCulture = new System.Globalization.CultureInfo("en-GB"); - - var core = new Core(filename, remoteHost, remoteIdent, temp, cfg); - - for(int i=0; i < args.Length; i++) - { - var a = args[i]; - - if (a.ToUpperInvariant() == "--UPDATEDONE") - { - cfg.CheckUpdate_UpdateAvailable = false; - cfg.CheckUpdate_UpdateResponse = ""; - - bool hasOtherJSON; - bool thisRegistered; - string[] otherJSONs; - - bool configured = Helpers.CheckVulkanLayerRegistration(out hasOtherJSON, out thisRegistered, out otherJSONs); - - // if nothing is configured (ie. no other JSON files), then set up our layer - // as part of the update process. - if (!configured && !hasOtherJSON && !thisRegistered) - { - Helpers.RegisterVulkanLayer(); - } - - Helpers.UpdateInstalledVersionNumber(); - } - - if (a.ToUpperInvariant() == "--UPDATEFAILED") - { - if(i < args.Length-1) - MessageBox.Show(String.Format("Error applying update: {0}", args[i+1]), "Error updating", MessageBoxButtons.OK, MessageBoxIcon.Error); - else - MessageBox.Show("Unknown error applying update", "Error updating", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - try - { - if (pyscripts.Count > 0) - { - var engine = Python.CreateEngine(); - - List searches = new List(engine.GetSearchPaths()); - - searches.Add(Directory.GetCurrentDirectory()); - - string libspath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "pythonlibs.zip"); - - if (File.Exists(libspath)) - searches.Add(libspath); - - engine.SetSearchPaths(searches); - - engine.Runtime.LoadAssembly(typeof(AppMain).Assembly); - - var scope = engine.CreateScope(); - - scope.SetVariable("pyrenderdoc", core); - - // try to import the RenderDoc namespace. - // This isn't equivalent to scope.ImportModule - try - { - engine.CreateScriptSourceFromString("import renderdoc").Execute(scope); - } - catch (Exception) - { - } - - try - { - core.Renderer.SetExceptionCatching(true); - foreach(var script in pyscripts) - engine.CreateScriptSourceFromString(File.ReadAllText(script)).Execute(scope); - core.Renderer.SetExceptionCatching(false); - } - catch (Exception) - { - core.Renderer.SetExceptionCatching(false); - - // IronPython throws so many exceptions, we don't want to kill the application - // so we just swallow Exception to cover all the bases - } - } - - Application.Run(core.AppWindow); - } - catch (Exception e) - { - HandleException(e); - } - - cfg.Serialize(Core.ConfigFilename); - } - - static void LogException(Exception ex) - { - StaticExports.LogText(ex.ToString()); - - if (ex.InnerException != null) - { - StaticExports.LogText("InnerException:"); - LogException(ex.InnerException); - } - } - - static void HandleException(Exception ex) - { - // we log out this string, which is matched against in renderdoccmd to pull out the callstack - // from the log even in the case where the user chooses not to submit the error log - StaticExports.LogText("\n\n"); - StaticExports.LogText("--- Begin C# Exception Data ---"); - if (ex != null) - { - LogException(ex); - - StaticExports.TriggerExceptionHandler(System.Runtime.InteropServices.Marshal.GetExceptionPointers(), true); - } - else - { - StaticExports.LogText("Exception is NULL"); - - StaticExports.TriggerExceptionHandler(IntPtr.Zero, true); - } - - System.Diagnostics.Process.GetCurrentProcess().Kill(); - } - - static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) - { - if (e.ExceptionObject is Exception) - HandleException(e.ExceptionObject as Exception); - else - HandleException(null); - } - - static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) - { - HandleException(e.Exception); - } - } -} diff --git a/renderdocui/Code/Cameras.cs b/renderdocui/Code/Cameras.cs deleted file mode 100644 index 869a30637..000000000 --- a/renderdocui/Code/Cameras.cs +++ /dev/null @@ -1,329 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using System.Drawing; -using renderdoc; - -namespace renderdocui.Code -{ - class TimedUpdate - { - public delegate void UpdateMethod(); - - public TimedUpdate(int msCount, UpdateMethod up) - { - m_Rate = msCount; - m_Update = up; - Start(); - } - - private int m_Rate; - private UpdateMethod m_Update = null; - private System.Threading.Timer m_CameraTick = null; - - private static void TickCB(object state) - { - if (!(state is TimedUpdate)) return; - - var me = (TimedUpdate)state; - - if (me.m_Update != null) me.m_Update(); - if (me.m_CameraTick != null) me.m_CameraTick.Change(me.m_Rate, System.Threading.Timeout.Infinite); - } - - public void Start() - { - m_CameraTick = new System.Threading.Timer(TickCB, this as object, m_Rate, System.Threading.Timeout.Infinite); - } - - public void Stop() - { - m_CameraTick.Dispose(); - m_CameraTick = null; - } - } - - abstract class CameraControls - { - protected CameraControls() - { - } - - abstract public bool Update(); - - abstract public Camera Camera { get; } - - abstract public void MouseWheel(object sender, MouseEventArgs e); - - virtual public void MouseClick(object sender, MouseEventArgs e) - { - m_DragStartPos = e.Location; - } - - virtual public void MouseMove(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.None) - { - m_DragStartPos = new Point(-1, -1); - } - else - { - if (m_DragStartPos.X < 0) - { - m_DragStartPos = e.Location; - } - - m_DragStartPos = e.Location; - } - } - - virtual public void KeyUp(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.A || e.KeyCode == Keys.D) - m_CurrentMove[0] = 0; - if (e.KeyCode == Keys.Q || e.KeyCode == Keys.E) - m_CurrentMove[1] = 0; - if (e.KeyCode == Keys.W || e.KeyCode == Keys.S) - m_CurrentMove[2] = 0; - - if (e.Shift) - m_CurrentSpeed = 3.0f; - else - m_CurrentSpeed = 1.0f; - } - - virtual public void KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.W) - m_CurrentMove[2] = 1; - if (e.KeyCode == Keys.S) - m_CurrentMove[2] = -1; - if (e.KeyCode == Keys.Q) - m_CurrentMove[1] = 1; - if (e.KeyCode == Keys.E) - m_CurrentMove[1] = -1; - if (e.KeyCode == Keys.D) - m_CurrentMove[0] = 1; - if (e.KeyCode == Keys.A) - m_CurrentMove[0] = -1; - - if (e.Shift) - m_CurrentSpeed = 3.0f; - else - m_CurrentSpeed = 1.0f; - } - - private float m_CurrentSpeed = 1.0f; - private int[] m_CurrentMove = new int[3] { 0, 0, 0 }; - - public float SpeedMultiplier = 0.05f; - - protected int[] CurrentMove { get { return m_CurrentMove; } } - protected float CurrentSpeed { get { return m_CurrentSpeed * SpeedMultiplier; } } - - private Point m_DragStartPos = new Point(-1, -1); - protected Point DragStartPos { get { return m_DragStartPos; } } - } - - class ArcballCamera : CameraControls - { - private Camera m_Camera = null; - - public override Camera Camera { get { return m_Camera; } } - - public ArcballCamera() - { - m_Camera = Camera.InitArcball(); - } - - public void Reset(Vec3f pos, float dist) - { - m_LookAt = pos; - m_Distance = Math.Abs(dist); - - m_Camera.ResetArcball(); - m_Camera.SetPosition(m_LookAt); - m_Camera.SetArcballDistance(m_Distance); - } - - public void SetDistance(float dist) - { - m_Distance = Math.Abs(dist); - m_Camera.SetArcballDistance(m_Distance); - } - - public override bool Update() - { - return false; - } - - public override void MouseWheel(object sender, MouseEventArgs e) - { - float mod = (1.0f - (float)e.Delta / 2500.0f); - - m_Distance = Math.Max(1e-6f, m_Distance * mod); - - m_Camera.SetArcballDistance(m_Distance); - - ((HandledMouseEventArgs)e).Handled = true; - } - - public override void MouseMove(object sender, MouseEventArgs e) - { - if (DragStartPos.X > 0) - { - if (e.Button == MouseButtons.Middle || - (e.Button == MouseButtons.Left && (Control.ModifierKeys & Keys.Alt) == Keys.Alt) - ) - { - float xdelta = (float)(e.X - DragStartPos.X) / 300.0f; - float ydelta = (float)(e.Y - DragStartPos.Y) / 300.0f; - - xdelta *= Math.Max(1.0f, m_Distance); - ydelta *= Math.Max(1.0f, m_Distance); - - Vec3f pos, fwd, right, up; - m_Camera.GetBasis(out pos, out fwd, out right, out up); - - m_LookAt.x -= right.x * xdelta; - m_LookAt.y -= right.y * xdelta; - m_LookAt.z -= right.z * xdelta; - - m_LookAt.x += up.x * ydelta; - m_LookAt.y += up.y * ydelta; - m_LookAt.z += up.z * ydelta; - - m_Camera.SetPosition(m_LookAt); - } - else if (e.Button == MouseButtons.Left) - { - Control c = sender as Control; - if (c != null) - m_Camera.RotateArcball(DragStartPos, e.Location, c.ClientRectangle.Size); - } - } - - base.MouseMove(sender, e); - } - - private float m_Distance = 10.0f; - private Vec3f m_LookAt = new Vec3f(); - public Vec3f LookAtPos - { - get { return m_LookAt; } - set { m_LookAt = value; m_Camera.SetPosition(m_LookAt); } - } - } - - class FlyCamera : CameraControls - { - private Camera m_Camera = null; - - public override Camera Camera { get { return m_Camera; } } - - public FlyCamera() - { - m_Camera = Camera.InitFPSLook(); - } - - public void Reset(Vec3f position) - { - m_Position = position; - m_Rotation = new Vec3f(); - - Camera.SetPosition(m_Position); - Camera.SetFPSRotation(m_Rotation); - } - - public override bool Update() - { - Vec3f pos, fwd, right, up; - m_Camera.GetBasis(out pos, out fwd, out right, out up); - - if (CurrentMove[0] != 0) - { - Vec3f dir = right; - dir.Mul((float)CurrentMove[0]); - - m_Position.x += dir.x * CurrentSpeed; - m_Position.y += dir.y * CurrentSpeed; - m_Position.z += dir.z * CurrentSpeed; - } - if (CurrentMove[1] != 0) - { - Vec3f dir = new Vec3f(0.0f, 1.0f, 0.0f); - //dir = up; - dir.Mul((float)CurrentMove[1]); - - m_Position.x += dir.x * CurrentSpeed; - m_Position.y += dir.y * CurrentSpeed; - m_Position.z += dir.z * CurrentSpeed; - } - if (CurrentMove[2] != 0) - { - Vec3f dir = fwd; - dir.Mul((float)CurrentMove[2]); - - m_Position.x += dir.x * CurrentSpeed; - m_Position.y += dir.y * CurrentSpeed; - m_Position.z += dir.z * CurrentSpeed; - } - - if (CurrentMove[0] != 0 || CurrentMove[1] != 0 || CurrentMove[2] != 0) - { - Camera.SetPosition(m_Position); - return true; - } - - return false; - } - - public override void MouseWheel(object sender, MouseEventArgs e) - { - } - - public override void MouseMove(object sender, MouseEventArgs e) - { - if (DragStartPos.X > 0 && e.Button == MouseButtons.Left) - { - m_Rotation.y -= (float)(e.X - DragStartPos.X) / 300.0f; - m_Rotation.x -= (float)(e.Y - DragStartPos.Y) / 300.0f; - - Camera.SetFPSRotation(m_Rotation); - } - - base.MouseMove(sender, e); - } - - private Vec3f m_Position = new Vec3f(); - private Vec3f m_Rotation = new Vec3f(); - } -} diff --git a/renderdocui/Code/CommonPipelineState.cs b/renderdocui/Code/CommonPipelineState.cs deleted file mode 100644 index 82a1d51da..000000000 --- a/renderdocui/Code/CommonPipelineState.cs +++ /dev/null @@ -1,1514 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using renderdoc; - -namespace renderdocui.Code -{ - public class BoundResource - { - public BoundResource() - { Id = ResourceId.Null; HighestMip = -1; FirstSlice = -1; typeHint = FormatComponentType.None; } - public BoundResource(ResourceId id) - { Id = id; HighestMip = -1; FirstSlice = -1; typeHint = FormatComponentType.None; } - - public ResourceId Id; - public int HighestMip; - public int FirstSlice; - public FormatComponentType typeHint; - }; - - public struct BoundVBuffer - { - public ResourceId Buffer; - public ulong ByteOffset; - public uint ByteStride; - }; - - public struct VertexInputAttribute - { - public string Name; - public int VertexBuffer; - public uint RelativeByteOffset; - public bool PerInstance; - public int InstanceRate; - public ResourceFormat Format; - public object[] GenericValue; - public bool Used; - }; - - public struct Viewport - { - public float x, y, width, height; - }; - - public class CommonPipelineState - { - private D3D11PipelineState m_D3D11 = null; - private D3D12PipelineState m_D3D12 = null; - private GLPipelineState m_GL = null; - private VulkanPipelineState m_Vulkan = null; - private APIProperties m_APIProps = null; - - public CommonPipelineState() - { - } - - public void SetStates(APIProperties props, D3D11PipelineState d3d11, D3D12PipelineState d3d12, GLPipelineState gl, VulkanPipelineState vk) - { - m_APIProps = props; - m_D3D11 = d3d11; - m_D3D12 = d3d12; - m_GL = gl; - m_Vulkan = vk; - } - - public GraphicsAPI DefaultType = GraphicsAPI.D3D11; - - private bool LogLoaded - { - get - { - return m_D3D11 != null || m_D3D12 != null || m_GL != null || m_Vulkan != null; - } - } - - private bool IsLogD3D11 - { - get - { - return LogLoaded && m_APIProps.pipelineType == GraphicsAPI.D3D11 && m_D3D11 != null; - } - } - - private bool IsLogD3D12 - { - get - { - return LogLoaded && m_APIProps.pipelineType == GraphicsAPI.D3D12 && m_D3D12 != null; - } - } - - private bool IsLogGL - { - get - { - return LogLoaded && m_APIProps.pipelineType == GraphicsAPI.OpenGL && m_GL != null; - } - } - - private bool IsLogVK - { - get - { - return LogLoaded && m_APIProps.pipelineType == GraphicsAPI.Vulkan && m_Vulkan != null; - } - } - - // add a bunch of generic properties that people can check to save having to see which pipeline state - // is valid and look at the appropriate part of it - public bool IsTessellationEnabled - { - get - { - if (LogLoaded) - { - if (IsLogD3D11) - return m_D3D11 != null && m_D3D11.m_HS.Shader != ResourceId.Null; - - if (IsLogD3D12) - return m_D3D12 != null && m_D3D12.m_HS.Shader != ResourceId.Null; - - if (IsLogGL) - return m_GL != null && m_GL.m_TES.Shader != ResourceId.Null; - - if (IsLogVK) - return m_Vulkan != null && m_Vulkan.m_TES.Shader != ResourceId.Null; - } - - return false; - } - } - - public bool SupportsResourceArrays - { - get - { - return LogLoaded && IsLogVK; - } - } - - public bool SupportsBarriers - { - get - { - return LogLoaded && (IsLogVK || IsLogD3D12); - } - } - - // whether or not the PostVS data is aligned in the typical fashion - // ie. vectors not crossing float4 boundaries). APIs that use stream-out - // or transform feedback have tightly packed data, but APIs that rewrite - // shaders to dump data might have these alignment requirements - public bool HasAlignedPostVSData - { - get - { - return LogLoaded && IsLogVK; - } - } - - public string GetImageLayout(ResourceId id) - { - if (LogLoaded) - { - if (IsLogVK && m_Vulkan.Images.ContainsKey(id)) - return m_Vulkan.Images[id].layouts[0].name; - - if (IsLogD3D12 && m_D3D12.Resources.ContainsKey(id)) - return m_D3D12.Resources[id].states[0].name; - } - - return "Unknown"; - } - - public string Abbrev(ShaderStageType stage) - { - if (IsLogD3D11 || (!LogLoaded && DefaultType == GraphicsAPI.D3D11) || - IsLogD3D12 || (!LogLoaded && DefaultType == GraphicsAPI.D3D12)) - { - switch (stage) - { - case ShaderStageType.Vertex: return "VS"; - case ShaderStageType.Hull: return "HS"; - case ShaderStageType.Domain: return "DS"; - case ShaderStageType.Geometry: return "GS"; - case ShaderStageType.Pixel: return "PS"; - case ShaderStageType.Compute: return "CS"; - } - } - else if (IsLogGL || (!LogLoaded && DefaultType == GraphicsAPI.OpenGL) || - IsLogVK || (!LogLoaded && DefaultType == GraphicsAPI.Vulkan)) - { - switch (stage) - { - case ShaderStageType.Vertex: return "VS"; - case ShaderStageType.Tess_Control: return "TCS"; - case ShaderStageType.Tess_Eval: return "TES"; - case ShaderStageType.Geometry: return "GS"; - case ShaderStageType.Fragment: return "FS"; - case ShaderStageType.Compute: return "CS"; - } - } - - return "?S"; - } - - public string OutputAbbrev() - { - if (IsLogGL || (!LogLoaded && DefaultType == GraphicsAPI.OpenGL) || - IsLogVK || (!LogLoaded && DefaultType == GraphicsAPI.Vulkan)) - { - return "FB"; - } - - return "RT"; - } - - // there's a lot of redundancy in these functions - - public Viewport GetViewport(int index) - { - Viewport ret = new Viewport(); - - // default to a 1x1 viewport just to avoid having to check for 0s all over - ret.x = ret.y = 0.0f; - ret.width = ret.height = 1.0f; - - if (LogLoaded) - { - if (IsLogD3D11 && m_D3D11.m_RS.Viewports.Length > 0) - { - ret.x = m_D3D11.m_RS.Viewports[0].TopLeft[0]; - ret.y = m_D3D11.m_RS.Viewports[0].TopLeft[1]; - ret.width = m_D3D11.m_RS.Viewports[0].Width; - ret.height = m_D3D11.m_RS.Viewports[0].Height; - } - else if (IsLogD3D12 && m_D3D12.m_RS.Viewports.Length > 0) - { - ret.x = m_D3D12.m_RS.Viewports[0].TopLeft[0]; - ret.y = m_D3D12.m_RS.Viewports[0].TopLeft[1]; - ret.width = m_D3D12.m_RS.Viewports[0].Width; - ret.height = m_D3D12.m_RS.Viewports[0].Height; - } - else if (IsLogGL && m_GL.m_RS.Viewports.Length > 0) - { - ret.x = m_GL.m_RS.Viewports[0].Left; - ret.y = m_GL.m_RS.Viewports[0].Bottom; - ret.width = m_GL.m_RS.Viewports[0].Width; - ret.height = m_GL.m_RS.Viewports[0].Height; - } - else if (IsLogVK && m_Vulkan.VP.viewportScissors.Length > 0) - { - ret.x = m_Vulkan.VP.viewportScissors[0].vp.x; - ret.y = m_Vulkan.VP.viewportScissors[0].vp.y; - ret.width = m_Vulkan.VP.viewportScissors[0].vp.Width; - ret.height = m_Vulkan.VP.viewportScissors[0].vp.Height; - } - } - - return ret; - } - - public ShaderBindpointMapping GetBindpointMapping(ShaderStageType stage) - { - if (LogLoaded) - { - if (IsLogD3D11) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_D3D11.m_VS.BindpointMapping; - case ShaderStageType.Domain: return m_D3D11.m_DS.BindpointMapping; - case ShaderStageType.Hull: return m_D3D11.m_HS.BindpointMapping; - case ShaderStageType.Geometry: return m_D3D11.m_GS.BindpointMapping; - case ShaderStageType.Pixel: return m_D3D11.m_PS.BindpointMapping; - case ShaderStageType.Compute: return m_D3D11.m_CS.BindpointMapping; - } - } - else if (IsLogD3D12) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_D3D12.m_VS.BindpointMapping; - case ShaderStageType.Domain: return m_D3D12.m_DS.BindpointMapping; - case ShaderStageType.Hull: return m_D3D12.m_HS.BindpointMapping; - case ShaderStageType.Geometry: return m_D3D12.m_GS.BindpointMapping; - case ShaderStageType.Pixel: return m_D3D12.m_PS.BindpointMapping; - case ShaderStageType.Compute: return m_D3D12.m_CS.BindpointMapping; - } - } - else if (IsLogGL) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_GL.m_VS.BindpointMapping; - case ShaderStageType.Tess_Control: return m_GL.m_TCS.BindpointMapping; - case ShaderStageType.Tess_Eval: return m_GL.m_TES.BindpointMapping; - case ShaderStageType.Geometry: return m_GL.m_GS.BindpointMapping; - case ShaderStageType.Fragment: return m_GL.m_FS.BindpointMapping; - case ShaderStageType.Compute: return m_GL.m_CS.BindpointMapping; - } - } - else if (IsLogVK) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_Vulkan.m_VS.BindpointMapping; - case ShaderStageType.Tess_Control: return m_Vulkan.m_TCS.BindpointMapping; - case ShaderStageType.Tess_Eval: return m_Vulkan.m_TES.BindpointMapping; - case ShaderStageType.Geometry: return m_Vulkan.m_GS.BindpointMapping; - case ShaderStageType.Fragment: return m_Vulkan.m_FS.BindpointMapping; - case ShaderStageType.Compute: return m_Vulkan.m_CS.BindpointMapping; - } - } - } - - return null; - } - - public ShaderReflection GetShaderReflection(ShaderStageType stage) - { - if (LogLoaded) - { - if (IsLogD3D11) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_D3D11.m_VS.ShaderDetails; - case ShaderStageType.Domain: return m_D3D11.m_DS.ShaderDetails; - case ShaderStageType.Hull: return m_D3D11.m_HS.ShaderDetails; - case ShaderStageType.Geometry: return m_D3D11.m_GS.ShaderDetails; - case ShaderStageType.Pixel: return m_D3D11.m_PS.ShaderDetails; - case ShaderStageType.Compute: return m_D3D11.m_CS.ShaderDetails; - } - } - else if (IsLogD3D12) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_D3D12.m_VS.ShaderDetails; - case ShaderStageType.Domain: return m_D3D12.m_DS.ShaderDetails; - case ShaderStageType.Hull: return m_D3D12.m_HS.ShaderDetails; - case ShaderStageType.Geometry: return m_D3D12.m_GS.ShaderDetails; - case ShaderStageType.Pixel: return m_D3D12.m_PS.ShaderDetails; - case ShaderStageType.Compute: return m_D3D12.m_CS.ShaderDetails; - } - } - else if (IsLogGL) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_GL.m_VS.ShaderDetails; - case ShaderStageType.Tess_Control: return m_GL.m_TCS.ShaderDetails; - case ShaderStageType.Tess_Eval: return m_GL.m_TES.ShaderDetails; - case ShaderStageType.Geometry: return m_GL.m_GS.ShaderDetails; - case ShaderStageType.Fragment: return m_GL.m_FS.ShaderDetails; - case ShaderStageType.Compute: return m_GL.m_CS.ShaderDetails; - } - } - else if (IsLogVK) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_Vulkan.m_VS.ShaderDetails; - case ShaderStageType.Tess_Control: return m_Vulkan.m_TCS.ShaderDetails; - case ShaderStageType.Tess_Eval: return m_Vulkan.m_TES.ShaderDetails; - case ShaderStageType.Geometry: return m_Vulkan.m_GS.ShaderDetails; - case ShaderStageType.Fragment: return m_Vulkan.m_FS.ShaderDetails; - case ShaderStageType.Compute: return m_Vulkan.m_CS.ShaderDetails; - } - } - } - - return null; - } - - public String GetShaderEntryPoint(ShaderStageType stage) - { - if (LogLoaded && IsLogVK) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_Vulkan.m_VS.entryPoint; - case ShaderStageType.Tess_Control: return m_Vulkan.m_TCS.entryPoint; - case ShaderStageType.Tess_Eval: return m_Vulkan.m_TES.entryPoint; - case ShaderStageType.Geometry: return m_Vulkan.m_GS.entryPoint; - case ShaderStageType.Fragment: return m_Vulkan.m_FS.entryPoint; - case ShaderStageType.Compute: return m_Vulkan.m_CS.entryPoint; - } - } - - return ""; - } - - public ResourceId GetShader(ShaderStageType stage) - { - if (LogLoaded) - { - if (IsLogD3D11) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_D3D11.m_VS.Shader; - case ShaderStageType.Domain: return m_D3D11.m_DS.Shader; - case ShaderStageType.Hull: return m_D3D11.m_HS.Shader; - case ShaderStageType.Geometry: return m_D3D11.m_GS.Shader; - case ShaderStageType.Pixel: return m_D3D11.m_PS.Shader; - case ShaderStageType.Compute: return m_D3D11.m_CS.Shader; - } - } - else if (IsLogD3D12) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_D3D12.m_VS.Shader; - case ShaderStageType.Domain: return m_D3D12.m_DS.Shader; - case ShaderStageType.Hull: return m_D3D12.m_HS.Shader; - case ShaderStageType.Geometry: return m_D3D12.m_GS.Shader; - case ShaderStageType.Pixel: return m_D3D12.m_PS.Shader; - case ShaderStageType.Compute: return m_D3D12.m_CS.Shader; - } - } - else if (IsLogGL) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_GL.m_VS.Shader; - case ShaderStageType.Tess_Control: return m_GL.m_TCS.Shader; - case ShaderStageType.Tess_Eval: return m_GL.m_TES.Shader; - case ShaderStageType.Geometry: return m_GL.m_GS.Shader; - case ShaderStageType.Fragment: return m_GL.m_FS.Shader; - case ShaderStageType.Compute: return m_GL.m_CS.Shader; - } - } - else if (IsLogVK) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_Vulkan.m_VS.Shader; - case ShaderStageType.Tess_Control: return m_Vulkan.m_TCS.Shader; - case ShaderStageType.Tess_Eval: return m_Vulkan.m_TES.Shader; - case ShaderStageType.Geometry: return m_Vulkan.m_GS.Shader; - case ShaderStageType.Fragment: return m_Vulkan.m_FS.Shader; - case ShaderStageType.Compute: return m_Vulkan.m_CS.Shader; - } - } - } - - return ResourceId.Null; - } - - public string GetShaderName(ShaderStageType stage) - { - if (LogLoaded) - { - if (IsLogD3D11) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_D3D11.m_VS.ShaderName; - case ShaderStageType.Domain: return m_D3D11.m_DS.ShaderName; - case ShaderStageType.Hull: return m_D3D11.m_HS.ShaderName; - case ShaderStageType.Geometry: return m_D3D11.m_GS.ShaderName; - case ShaderStageType.Pixel: return m_D3D11.m_PS.ShaderName; - case ShaderStageType.Compute: return m_D3D11.m_CS.ShaderName; - } - } - else if (IsLogD3D12) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_D3D12.PipelineName + " VS"; - case ShaderStageType.Domain: return m_D3D12.PipelineName + " DS"; - case ShaderStageType.Hull: return m_D3D12.PipelineName + " HS"; - case ShaderStageType.Geometry: return m_D3D12.PipelineName + " GS"; - case ShaderStageType.Pixel: return m_D3D12.PipelineName + " PS"; - case ShaderStageType.Compute: return m_D3D12.PipelineName + " CS"; - } - } - else if (IsLogGL) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_GL.m_VS.ShaderName; - case ShaderStageType.Tess_Control: return m_GL.m_TCS.ShaderName; - case ShaderStageType.Tess_Eval: return m_GL.m_TES.ShaderName; - case ShaderStageType.Geometry: return m_GL.m_GS.ShaderName; - case ShaderStageType.Fragment: return m_GL.m_FS.ShaderName; - case ShaderStageType.Compute: return m_GL.m_CS.ShaderName; - } - } - else if (IsLogVK) - { - switch (stage) - { - case ShaderStageType.Vertex: return m_Vulkan.m_VS.ShaderName; - case ShaderStageType.Domain: return m_Vulkan.m_TCS.ShaderName; - case ShaderStageType.Hull: return m_Vulkan.m_TES.ShaderName; - case ShaderStageType.Geometry: return m_Vulkan.m_GS.ShaderName; - case ShaderStageType.Pixel: return m_Vulkan.m_FS.ShaderName; - case ShaderStageType.Compute: return m_Vulkan.m_CS.ShaderName; - } - } - } - - return ""; - } - - public void GetIBuffer(out ResourceId buf, out ulong ByteOffset) - { - if (LogLoaded) - { - if (IsLogD3D11) - { - buf = m_D3D11.m_IA.ibuffer.Buffer; - ByteOffset = m_D3D11.m_IA.ibuffer.Offset; - - return; - } - else if (IsLogD3D12) - { - buf = m_D3D12.m_IA.ibuffer.Buffer; - ByteOffset = m_D3D12.m_IA.ibuffer.Offset; - - return; - } - else if (IsLogGL) - { - buf = m_GL.m_VtxIn.ibuffer; - ByteOffset = 0; // GL only has per-draw index offset - - return; - } - else if (IsLogVK) - { - buf = m_Vulkan.IA.ibuffer.buf; - ByteOffset = m_Vulkan.IA.ibuffer.offs; - - return; - } - } - - buf = ResourceId.Null; - ByteOffset = 0; - } - - public bool IsStripRestartEnabled() - { - if (LogLoaded) - { - if (IsLogD3D11) - { - // D3D11 this is always enabled - return true; - } - else if (IsLogD3D12) - { - return m_D3D12.m_IA.indexStripCutValue != 0; - } - else if (IsLogGL) - { - return m_GL.m_VtxIn.primitiveRestart; - } - else if (IsLogVK) - { - return m_Vulkan.IA.primitiveRestartEnable; - } - } - - return false; - } - - public uint GetStripRestartIndex(uint indexByteWidth) - { - if (LogLoaded) - { - if (IsLogD3D11 || IsLogVK) - { - // D3D11 or Vulkan this is always '-1' in whichever size of index we're using - return indexByteWidth == 2 ? ushort.MaxValue : uint.MaxValue; - } - else if (IsLogD3D12) - { - return m_D3D12.m_IA.indexStripCutValue; - } - else if (IsLogGL) - { - uint maxval = uint.MaxValue; - if (indexByteWidth == 2) - maxval = ushort.MaxValue; - else if (indexByteWidth == 1) - maxval = 0xff; - return Math.Min(maxval, m_GL.m_VtxIn.restartIndex); - } - } - - return uint.MaxValue; - } - - public BoundVBuffer[] GetVBuffers() - { - if (LogLoaded) - { - if (IsLogD3D11) - { - BoundVBuffer[] ret = new BoundVBuffer[m_D3D11.m_IA.vbuffers.Length]; - for (int i = 0; i < m_D3D11.m_IA.vbuffers.Length; i++) - { - ret[i].Buffer = m_D3D11.m_IA.vbuffers[i].Buffer; - ret[i].ByteOffset = m_D3D11.m_IA.vbuffers[i].Offset; - ret[i].ByteStride = m_D3D11.m_IA.vbuffers[i].Stride; - } - - return ret; - } - else if (IsLogD3D12) - { - BoundVBuffer[] ret = new BoundVBuffer[m_D3D12.m_IA.vbuffers.Length]; - for (int i = 0; i < m_D3D12.m_IA.vbuffers.Length; i++) - { - ret[i].Buffer = m_D3D12.m_IA.vbuffers[i].Buffer; - ret[i].ByteOffset = m_D3D12.m_IA.vbuffers[i].Offset; - ret[i].ByteStride = m_D3D12.m_IA.vbuffers[i].Stride; - } - - return ret; - } - else if (IsLogGL) - { - BoundVBuffer[] ret = new BoundVBuffer[m_GL.m_VtxIn.vbuffers.Length]; - for (int i = 0; i < m_GL.m_VtxIn.vbuffers.Length; i++) - { - ret[i].Buffer = m_GL.m_VtxIn.vbuffers[i].Buffer; - ret[i].ByteOffset = m_GL.m_VtxIn.vbuffers[i].Offset; - ret[i].ByteStride = m_GL.m_VtxIn.vbuffers[i].Stride; - } - - return ret; - } - else if (IsLogVK) - { - BoundVBuffer[] ret = new BoundVBuffer[m_Vulkan.VI.binds.Length]; - for (int i = 0; i < m_Vulkan.VI.binds.Length; i++) - { - ret[i].Buffer = i < m_Vulkan.VI.vbuffers.Length ? m_Vulkan.VI.vbuffers[i].buffer : ResourceId.Null; - ret[i].ByteOffset = i < m_Vulkan.VI.vbuffers.Length ? m_Vulkan.VI.vbuffers[i].offset : 0; - ret[i].ByteStride = m_Vulkan.VI.binds[i].bytestride; - } - - return ret; - } - } - - return null; - } - - public VertexInputAttribute[] GetVertexInputs() - { - if (LogLoaded) - { - if (IsLogD3D11) - { - uint[] byteOffs = new uint[128]; - for (int i = 0; i < 128; i++) - byteOffs[i] = 0; - - var layouts = m_D3D11.m_IA.layouts; - - VertexInputAttribute[] ret = new VertexInputAttribute[layouts.Length]; - for (int i = 0; i < layouts.Length; i++) - { - bool needsSemanticIdx = false; - for (int j = 0; j < layouts.Length; j++) - { - if (i != j && layouts[i].SemanticName == layouts[j].SemanticName) - { - needsSemanticIdx = true; - break; - } - } - - uint offs = layouts[i].ByteOffset; - if (offs == uint.MaxValue) // APPEND_ALIGNED - offs = byteOffs[layouts[i].InputSlot]; - else - byteOffs[layouts[i].InputSlot] = offs = layouts[i].ByteOffset; - - byteOffs[layouts[i].InputSlot] += layouts[i].Format.compByteWidth * layouts[i].Format.compCount; - - ret[i].Name = layouts[i].SemanticName + (needsSemanticIdx ? layouts[i].SemanticIndex.ToString() : ""); - ret[i].VertexBuffer = (int)layouts[i].InputSlot; - ret[i].RelativeByteOffset = offs; - ret[i].PerInstance = layouts[i].PerInstance; - ret[i].InstanceRate = (int)layouts[i].InstanceDataStepRate; - ret[i].Format = layouts[i].Format; - ret[i].GenericValue = null; - ret[i].Used = false; - - if (m_D3D11.m_IA.Bytecode != null) - { - for (int ia = 0; ia < m_D3D11.m_IA.Bytecode.InputSig.Length; ia++) - { - if (m_D3D11.m_IA.Bytecode.InputSig[ia].semanticName.ToUpperInvariant() == layouts[i].SemanticName.ToUpperInvariant() && - m_D3D11.m_IA.Bytecode.InputSig[ia].semanticIndex == layouts[i].SemanticIndex) - { - ret[i].Used = true; - break; - } - } - } - } - - return ret; - } - else if (IsLogD3D12) - { - uint[] byteOffs = new uint[128]; - for (int i = 0; i < 128; i++) - byteOffs[i] = 0; - - var layouts = m_D3D12.m_IA.layouts; - - VertexInputAttribute[] ret = new VertexInputAttribute[layouts.Length]; - for (int i = 0; i < layouts.Length; i++) - { - bool needsSemanticIdx = false; - for (int j = 0; j < layouts.Length; j++) - { - if (i != j && layouts[i].SemanticName == layouts[j].SemanticName) - { - needsSemanticIdx = true; - break; - } - } - - uint offs = layouts[i].ByteOffset; - if (offs == uint.MaxValue) // APPEND_ALIGNED - offs = byteOffs[layouts[i].InputSlot]; - else - byteOffs[layouts[i].InputSlot] = offs = layouts[i].ByteOffset; - - byteOffs[layouts[i].InputSlot] += layouts[i].Format.compByteWidth * layouts[i].Format.compCount; - - ret[i].Name = layouts[i].SemanticName + (needsSemanticIdx ? layouts[i].SemanticIndex.ToString() : ""); - ret[i].VertexBuffer = (int)layouts[i].InputSlot; - ret[i].RelativeByteOffset = offs; - ret[i].PerInstance = layouts[i].PerInstance; - ret[i].InstanceRate = (int)layouts[i].InstanceDataStepRate; - ret[i].Format = layouts[i].Format; - ret[i].GenericValue = null; - ret[i].Used = false; - - if (m_D3D12.m_VS.ShaderDetails != null) - { - for (int ia = 0; ia < m_D3D12.m_VS.ShaderDetails.InputSig.Length; ia++) - { - if (m_D3D12.m_VS.ShaderDetails.InputSig[ia].semanticName.ToUpperInvariant() == layouts[i].SemanticName.ToUpperInvariant() && - m_D3D12.m_VS.ShaderDetails.InputSig[ia].semanticIndex == layouts[i].SemanticIndex) - { - ret[i].Used = true; - break; - } - } - } - } - - return ret; - } - else if (IsLogGL) - { - var attrs = m_GL.m_VtxIn.attributes; - - int num = 0; - for (int i = 0; i < attrs.Length; i++) - { - int attrib = -1; - if (m_GL.m_VS.BindpointMapping != null && m_GL.m_VS.ShaderDetails != null) - attrib = m_GL.m_VS.BindpointMapping.InputAttributes[i]; - else - attrib = i; - - if (attrib >= 0) - num++; - } - - int a = 0; - VertexInputAttribute[] ret = new VertexInputAttribute[num]; - for (int i = 0; i < attrs.Length && a < num; i++) - { - ret[a].Name = String.Format("attr{0}", i); - ret[a].GenericValue = null; - ret[a].VertexBuffer = (int)attrs[i].BufferSlot; - ret[a].RelativeByteOffset = attrs[i].RelativeOffset; - ret[a].PerInstance = m_GL.m_VtxIn.vbuffers[attrs[i].BufferSlot].Divisor > 0; - ret[a].InstanceRate = (int)m_GL.m_VtxIn.vbuffers[attrs[i].BufferSlot].Divisor; - ret[a].Format = attrs[i].Format; - ret[a].Used = true; - - if (m_GL.m_VS.BindpointMapping != null && m_GL.m_VS.ShaderDetails != null) - { - int attrib = m_GL.m_VS.BindpointMapping.InputAttributes[i]; - - if (attrib >= 0 && attrib < m_GL.m_VS.ShaderDetails.InputSig.Length) - ret[a].Name = m_GL.m_VS.ShaderDetails.InputSig[attrib].varName; - - if (attrib == -1) continue; - - if (!attrs[i].Enabled) - { - uint compCount = m_GL.m_VS.ShaderDetails.InputSig[attrib].compCount; - FormatComponentType compType = m_GL.m_VS.ShaderDetails.InputSig[attrib].compType; - - ret[a].GenericValue = new object[compCount]; - - for (uint c = 0; c < compCount; c++) - { - if (compType == FormatComponentType.Float) - ret[a].GenericValue[c] = attrs[i].GenericValue.f[c]; - else if (compType == FormatComponentType.UInt) - ret[a].GenericValue[c] = attrs[i].GenericValue.u[c]; - else if (compType == FormatComponentType.SInt) - ret[a].GenericValue[c] = attrs[i].GenericValue.i[c]; - else if (compType == FormatComponentType.UScaled) - ret[a].GenericValue[c] = (float)attrs[i].GenericValue.u[c]; - else if (compType == FormatComponentType.SScaled) - ret[a].GenericValue[c] = (float)attrs[i].GenericValue.i[c]; - } - - ret[a].PerInstance = false; - ret[a].InstanceRate = 0; - ret[a].Format.compByteWidth = 4; - ret[a].Format.compCount = compCount; - ret[a].Format.compType = compType; - ret[a].Format.special = false; - ret[a].Format.srgbCorrected = false; - } - } - - a++; - } - - return ret; - } - else if (IsLogVK) - { - var attrs = m_Vulkan.VI.attrs; - - int num = 0; - for (int i = 0; i < attrs.Length; i++) - { - int attrib = -1; - if (m_Vulkan.m_VS.BindpointMapping != null && m_Vulkan.m_VS.ShaderDetails != null) - { - if(attrs[i].location < m_Vulkan.m_VS.BindpointMapping.InputAttributes.Length) - attrib = m_Vulkan.m_VS.BindpointMapping.InputAttributes[attrs[i].location]; - } - else - attrib = i; - - if (attrib >= 0) - num++; - } - - int a = 0; - VertexInputAttribute[] ret = new VertexInputAttribute[num]; - for (int i = 0; i < attrs.Length && a < num; i++) - { - ret[a].Name = String.Format("attr{0}", i); - ret[a].GenericValue = null; - ret[a].VertexBuffer = (int)attrs[i].binding; - ret[a].RelativeByteOffset = attrs[i].byteoffset; - ret[a].PerInstance = false; - if(attrs[i].binding < m_Vulkan.VI.binds.Length) - ret[a].PerInstance = m_Vulkan.VI.binds[attrs[i].binding].perInstance; - ret[a].InstanceRate = 1; - ret[a].Format = attrs[i].format; - ret[a].Used = true; - - if (m_Vulkan.m_VS.BindpointMapping != null && m_Vulkan.m_VS.ShaderDetails != null) - { - int attrib = -1; - - if (attrs[i].location < m_Vulkan.m_VS.BindpointMapping.InputAttributes.Length) - attrib = m_Vulkan.m_VS.BindpointMapping.InputAttributes[attrs[i].location]; - - if (attrib >= 0 && attrib < m_Vulkan.m_VS.ShaderDetails.InputSig.Length) - ret[a].Name = m_Vulkan.m_VS.ShaderDetails.InputSig[attrib].varName; - - if (attrib == -1) continue; - } - - a++; - } - - return ret; - } - } - - return null; - } - - public void GetConstantBuffer(ShaderStageType stage, uint BufIdx, uint ArrayIdx, out ResourceId buf, out ulong ByteOffset, out ulong ByteSize) - { - if (LogLoaded) - { - if (IsLogD3D11) - { - D3D11PipelineState.ShaderStage s = null; - - switch (stage) - { - case ShaderStageType.Vertex: s = m_D3D11.m_VS; break; - case ShaderStageType.Domain: s = m_D3D11.m_DS; break; - case ShaderStageType.Hull: s = m_D3D11.m_HS; break; - case ShaderStageType.Geometry: s = m_D3D11.m_GS; break; - case ShaderStageType.Pixel: s = m_D3D11.m_PS; break; - case ShaderStageType.Compute: s = m_D3D11.m_CS; break; - } - - if (s.ShaderDetails != null && BufIdx < s.ShaderDetails.ConstantBlocks.Length) - { - int bind = s.ShaderDetails.ConstantBlocks[BufIdx].bindPoint; - - if (bind < s.ConstantBuffers.Length) - { - buf = s.ConstantBuffers[bind].Buffer; - ByteOffset = (ulong)(s.ConstantBuffers[bind].VecOffset * 4 * sizeof(float)); - ByteSize = (ulong)(s.ConstantBuffers[bind].VecCount * 4 * sizeof(float)); - - return; - } - } - } - else if (IsLogD3D12) - { - D3D12PipelineState.ShaderStage s = null; - - switch (stage) - { - case ShaderStageType.Vertex: s = m_D3D12.m_VS; break; - case ShaderStageType.Domain: s = m_D3D12.m_DS; break; - case ShaderStageType.Hull: s = m_D3D12.m_HS; break; - case ShaderStageType.Geometry: s = m_D3D12.m_GS; break; - case ShaderStageType.Pixel: s = m_D3D12.m_PS; break; - case ShaderStageType.Compute: s = m_D3D12.m_CS; break; - } - - if (s.ShaderDetails != null && BufIdx < s.ShaderDetails.ConstantBlocks.Length) - { - var bind = s.BindpointMapping.ConstantBlocks[s.ShaderDetails.ConstantBlocks[BufIdx].bindPoint]; - - if (bind.bindset >= s.Spaces.Length || - bind.bind >= s.Spaces[bind.bindset].ConstantBuffers.Length) - { - buf = ResourceId.Null; - ByteOffset = 0; - ByteSize = 0; - return; - } - - var descriptor = s.Spaces[bind.bindset].ConstantBuffers[bind.bind]; - - buf = descriptor.Buffer; - ByteOffset = descriptor.Offset; - ByteSize = descriptor.ByteSize; - - return; - } - } - else if (IsLogGL) - { - GLPipelineState.ShaderStage s = null; - - switch (stage) - { - case ShaderStageType.Vertex: s = m_GL.m_VS; break; - case ShaderStageType.Tess_Control: s = m_GL.m_TCS; break; - case ShaderStageType.Tess_Eval: s = m_GL.m_TES; break; - case ShaderStageType.Geometry: s = m_GL.m_GS; break; - case ShaderStageType.Fragment: s = m_GL.m_FS; break; - case ShaderStageType.Compute: s = m_GL.m_CS; break; - } - - if(s.ShaderDetails != null && BufIdx < s.ShaderDetails.ConstantBlocks.Length) - { - if (s.ShaderDetails.ConstantBlocks[BufIdx].bindPoint >= 0) - { - int uboIdx = s.BindpointMapping.ConstantBlocks[s.ShaderDetails.ConstantBlocks[BufIdx].bindPoint].bind; - if (uboIdx >= 0 && uboIdx < m_GL.UniformBuffers.Length) - { - var b = m_GL.UniformBuffers[uboIdx]; - - buf = b.Resource; - ByteOffset = b.Offset; - ByteSize = b.Size; - - return; - } - } - } - } - else if (IsLogVK) - { - VulkanPipelineState.Pipeline pipe = m_Vulkan.graphics; - if (stage == ShaderStageType.Compute) - pipe = m_Vulkan.compute; - - VulkanPipelineState.ShaderStage s = null; - - switch (stage) - { - case ShaderStageType.Vertex: s = m_Vulkan.m_VS; break; - case ShaderStageType.Tess_Control: s = m_Vulkan.m_TCS; break; - case ShaderStageType.Tess_Eval: s = m_Vulkan.m_TES; break; - case ShaderStageType.Geometry: s = m_Vulkan.m_GS; break; - case ShaderStageType.Fragment: s = m_Vulkan.m_FS; break; - case ShaderStageType.Compute: s = m_Vulkan.m_CS; break; - } - - if (s.ShaderDetails != null && BufIdx < s.ShaderDetails.ConstantBlocks.Length) - { - var bind = s.BindpointMapping.ConstantBlocks[s.ShaderDetails.ConstantBlocks[BufIdx].bindPoint]; - - if (s.ShaderDetails.ConstantBlocks[BufIdx].bufferBacked == false) - { - // dummy values, it would be nice to fetch these properly - buf = ResourceId.Null; - ByteOffset = 0; - ByteSize = 1024; - return; - } - - var descriptorBind = pipe.DescSets[bind.bindset].bindings[bind.bind].binds[ArrayIdx]; - - buf = descriptorBind.res; - ByteOffset = descriptorBind.offset; - ByteSize = descriptorBind.size; - - return; - } - } - } - - buf = ResourceId.Null; - ByteOffset = 0; - ByteSize = 0; - } - - public Dictionary GetReadOnlyResources(ShaderStageType stage) - { - var ret = new Dictionary(); - - if (LogLoaded) - { - if (IsLogD3D11) - { - D3D11PipelineState.ShaderStage s = null; - - switch (stage) - { - case ShaderStageType.Vertex: s = m_D3D11.m_VS; break; - case ShaderStageType.Domain: s = m_D3D11.m_DS; break; - case ShaderStageType.Hull: s = m_D3D11.m_HS; break; - case ShaderStageType.Geometry: s = m_D3D11.m_GS; break; - case ShaderStageType.Pixel: s = m_D3D11.m_PS; break; - case ShaderStageType.Compute: s = m_D3D11.m_CS; break; - } - - for (int i = 0; i < s.SRVs.Length; i++) - { - var key = new BindpointMap(0, i); - var val = new BoundResource(); - - val.Id = s.SRVs[i].Resource; - val.HighestMip = (int)s.SRVs[i].HighestMip; - val.FirstSlice = (int)s.SRVs[i].FirstArraySlice; - val.typeHint = s.SRVs[i].Format.compType; - - ret.Add(key, new BoundResource[] { val }); - } - - return ret; - } - else if (IsLogD3D12) - { - D3D12PipelineState.ShaderStage s = null; - - switch (stage) - { - case ShaderStageType.Vertex: s = m_D3D12.m_VS; break; - case ShaderStageType.Domain: s = m_D3D12.m_DS; break; - case ShaderStageType.Hull: s = m_D3D12.m_HS; break; - case ShaderStageType.Geometry: s = m_D3D12.m_GS; break; - case ShaderStageType.Pixel: s = m_D3D12.m_PS; break; - case ShaderStageType.Compute: s = m_D3D12.m_CS; break; - } - - for (int space = 0; space < s.Spaces.Length; space++) - { - for (int reg = 0; reg < s.Spaces[space].SRVs.Length; reg++) - { - var bind = s.Spaces[space].SRVs[reg]; - var key = new BindpointMap(space, reg); - var val = new BoundResource(); - - // consider this register to not exist - it's in a gap defined by sparse root signature elements - if (bind.RootElement == uint.MaxValue) - continue; - - val = new BoundResource(); - val.Id = bind.Resource; - val.HighestMip = (int)bind.HighestMip; - val.FirstSlice = (int)bind.FirstArraySlice; - val.typeHint = bind.Format.compType; - - ret.Add(key, new BoundResource[] { val }); - } - } - - return ret; - } - else if (IsLogGL) - { - for (int i = 0; i < m_GL.Textures.Length; i++) - { - var key = new BindpointMap(0, i); - var val = new BoundResource(); - - val.Id = m_GL.Textures[i].Resource; - val.HighestMip = (int)m_GL.Textures[i].HighestMip; - val.FirstSlice = (int)m_GL.Textures[i].FirstSlice; - val.typeHint = FormatComponentType.None; - - ret.Add(key, new BoundResource[] { val }); - } - - return ret; - } - else if (IsLogVK) - { - VulkanPipelineState.Pipeline.DescriptorSet[] descsets = m_Vulkan.graphics.DescSets; - - if (stage == ShaderStageType.Compute) - descsets = m_Vulkan.compute.DescSets; - - ShaderStageBits mask = (ShaderStageBits)(1 << (int)stage); - - for (int set = 0; set < descsets.Length; set++) - { - var descset = descsets[set]; - for (int slot = 0; slot < descset.bindings.Length; slot++) - { - var bind = descset.bindings[slot]; - if ((bind.type == ShaderBindType.ImageSampler || - bind.type == ShaderBindType.InputAttachment || - bind.type == ShaderBindType.ReadOnlyImage || - bind.type == ShaderBindType.ReadOnlyTBuffer - ) && (bind.stageFlags & mask) == mask) - { - var key = new BindpointMap(set, slot); - var val = new BoundResource[bind.descriptorCount]; - - for (UInt32 i = 0; i < bind.descriptorCount; i++) - { - val[i] = new BoundResource(); - val[i].Id = bind.binds[i].res; - val[i].HighestMip = (int)bind.binds[i].baseMip; - val[i].FirstSlice = (int)bind.binds[i].baseLayer; - val[i].typeHint = bind.binds[i].viewfmt.compType; - } - - ret.Add(key, val); - } - } - } - - return ret; - } - } - - return ret; - } - - public Dictionary GetReadWriteResources(ShaderStageType stage) - { - var ret = new Dictionary(); - - if (LogLoaded) - { - if (IsLogD3D11) - { - if (stage == ShaderStageType.Compute) - { - for (int i = 0; i < m_D3D11.m_CS.UAVs.Length; i++) - { - var key = new BindpointMap(0, i); - var val = new BoundResource(); - - val.Id = m_D3D11.m_CS.UAVs[i].Resource; - val.HighestMip = (int)m_D3D11.m_CS.UAVs[i].HighestMip; - val.FirstSlice = (int)m_D3D11.m_CS.UAVs[i].FirstArraySlice; - val.typeHint = m_D3D11.m_CS.UAVs[i].Format.compType; - - ret.Add(key, new BoundResource[] { val }); - } - } - else - { - int uavstart = (int)m_D3D11.m_OM.UAVStartSlot; - - // up to UAVStartSlot treat these bindings as empty. - for (int i = 0; i < uavstart; i++) - { - var key = new BindpointMap(0, i); - var val = new BoundResource(); - - ret.Add(key, new BoundResource[] { val }); - } - - for (int i = 0; i < m_D3D11.m_OM.UAVs.Length - uavstart; i++) - { - // the actual UAV bindings start at the given slot - var key = new BindpointMap(0, i + uavstart); - var val = new BoundResource(); - - val.Id = m_D3D11.m_OM.UAVs[i].Resource; - val.HighestMip = (int)m_D3D11.m_OM.UAVs[i].HighestMip; - val.FirstSlice = (int)m_D3D11.m_OM.UAVs[i].FirstArraySlice; - val.typeHint = FormatComponentType.None; - - ret.Add(key, new BoundResource[] { val }); - } - } - - return ret; - } - else if (IsLogD3D12) - { - D3D12PipelineState.ShaderStage s = null; - - switch (stage) - { - case ShaderStageType.Vertex: s = m_D3D12.m_VS; break; - case ShaderStageType.Domain: s = m_D3D12.m_DS; break; - case ShaderStageType.Hull: s = m_D3D12.m_HS; break; - case ShaderStageType.Geometry: s = m_D3D12.m_GS; break; - case ShaderStageType.Pixel: s = m_D3D12.m_PS; break; - case ShaderStageType.Compute: s = m_D3D12.m_CS; break; - } - - for (int space = 0; space < s.Spaces.Length; space++) - { - for (int reg = 0; reg < s.Spaces[space].UAVs.Length; reg++) - { - var bind = s.Spaces[space].UAVs[reg]; - var key = new BindpointMap(space, reg); - var val = new BoundResource(); - - // consider this register to not exist - it's in a gap defined by sparse root signature elements - if (bind.RootElement == uint.MaxValue) - continue; - - val = new BoundResource(); - val.Id = bind.Resource; - val.HighestMip = (int)bind.HighestMip; - val.FirstSlice = (int)bind.FirstArraySlice; - val.typeHint = bind.Format.compType; - - ret.Add(key, new BoundResource[] { val }); - } - } - - return ret; - } - else if (IsLogGL) - { - for (int i = 0; i < m_GL.Images.Length; i++) - { - var key = new BindpointMap(0, i); - var val = new BoundResource(); - - val.Id = m_GL.Images[i].Resource; - val.HighestMip = (int)m_GL.Images[i].Level; - val.FirstSlice = (int)m_GL.Images[i].Layer; - val.typeHint = m_GL.Images[i].Format.compType; - - ret.Add(key, new BoundResource[] { val }); - } - - return ret; - } - else if (IsLogVK) - { - VulkanPipelineState.Pipeline.DescriptorSet[] descsets = m_Vulkan.graphics.DescSets; - - if (stage == ShaderStageType.Compute) - descsets = m_Vulkan.compute.DescSets; - - ShaderStageBits mask = (ShaderStageBits)(1 << (int)stage); - for (int set = 0; set < descsets.Length; set++) - { - var descset = descsets[set]; - for (int slot = 0; slot < descset.bindings.Length; slot++) - { - var bind = descset.bindings[slot]; - - if ((bind.type == ShaderBindType.ReadWriteBuffer || - bind.type == ShaderBindType.ReadWriteImage || - bind.type == ShaderBindType.ReadWriteTBuffer - ) && (bind.stageFlags & mask) == mask) - { - var key = new BindpointMap(set, slot); - var val = new BoundResource[bind.descriptorCount]; - - for (UInt32 i = 0; i < bind.descriptorCount; i++) - { - val[i] = new BoundResource(); - val[i].Id = bind.binds[i].res; - val[i].HighestMip = (int)bind.binds[i].baseMip; - val[i].FirstSlice = (int)bind.binds[i].baseLayer; - val[i].typeHint = bind.binds[i].viewfmt.compType; - } - - ret.Add(key, val); - } - } - } - - return ret; - } - } - - return ret; - } - - public BoundResource GetDepthTarget() - { - if (LogLoaded) - { - if (IsLogD3D11) - { - var ret = new BoundResource(); - ret.Id = m_D3D11.m_OM.DepthTarget.Resource; - ret.HighestMip = (int)m_D3D11.m_OM.DepthTarget.HighestMip; - ret.FirstSlice = (int)m_D3D11.m_OM.DepthTarget.FirstArraySlice; - ret.typeHint = m_D3D11.m_OM.DepthTarget.Format.compType; - return ret; - } - else if (IsLogD3D12) - { - var ret = new BoundResource(); - ret.Id = m_D3D12.m_OM.DepthTarget.Resource; - ret.HighestMip = (int)m_D3D12.m_OM.DepthTarget.HighestMip; - ret.FirstSlice = (int)m_D3D12.m_OM.DepthTarget.FirstArraySlice; - ret.typeHint = m_D3D12.m_OM.DepthTarget.Format.compType; - return ret; - } - else if (IsLogGL) - { - var ret = new BoundResource(); - ret.Id = m_GL.m_FB.m_DrawFBO.Depth.Obj; - ret.HighestMip = (int)m_GL.m_FB.m_DrawFBO.Depth.Mip; - ret.FirstSlice = (int)m_GL.m_FB.m_DrawFBO.Depth.Layer; - ret.typeHint = FormatComponentType.None; - return ret; - } - else if (IsLogVK) - { - var rp = m_Vulkan.Pass.renderpass; - var fb = m_Vulkan.Pass.framebuffer; - - if (rp.depthstencilAttachment >= 0 && rp.depthstencilAttachment < fb.attachments.Length) - { - var ret = new BoundResource(); - ret.Id = fb.attachments[rp.depthstencilAttachment].img; - ret.HighestMip = (int)fb.attachments[rp.depthstencilAttachment].baseMip; - ret.FirstSlice = (int)fb.attachments[rp.depthstencilAttachment].baseLayer; - ret.typeHint = fb.attachments[rp.depthstencilAttachment].viewfmt.compType; - return ret; - } - - return new BoundResource(); - } - } - - return new BoundResource(); - } - - public BoundResource[] GetOutputTargets() - { - if (LogLoaded) - { - if (IsLogD3D11) - { - BoundResource[] ret = new BoundResource[m_D3D11.m_OM.RenderTargets.Length]; - for (int i = 0; i < m_D3D11.m_OM.RenderTargets.Length; i++) - { - ret[i] = new BoundResource(); - ret[i].Id = m_D3D11.m_OM.RenderTargets[i].Resource; - ret[i].HighestMip = (int)m_D3D11.m_OM.RenderTargets[i].HighestMip; - ret[i].FirstSlice = (int)m_D3D11.m_OM.RenderTargets[i].FirstArraySlice; - ret[i].typeHint = m_D3D11.m_OM.RenderTargets[i].Format.compType; - } - - return ret; - } - else if (IsLogD3D12) - { - BoundResource[] ret = new BoundResource[m_D3D12.m_OM.RenderTargets.Length]; - for (int i = 0; i < m_D3D12.m_OM.RenderTargets.Length; i++) - { - ret[i] = new BoundResource(); - ret[i].Id = m_D3D12.m_OM.RenderTargets[i].Resource; - ret[i].HighestMip = (int)m_D3D12.m_OM.RenderTargets[i].HighestMip; - ret[i].FirstSlice = (int)m_D3D12.m_OM.RenderTargets[i].FirstArraySlice; - ret[i].typeHint = m_D3D12.m_OM.RenderTargets[i].Format.compType; - } - - return ret; - } - else if (IsLogGL) - { - BoundResource[] ret = new BoundResource[m_GL.m_FB.m_DrawFBO.DrawBuffers.Length]; - for (int i = 0; i < m_GL.m_FB.m_DrawFBO.DrawBuffers.Length; i++) - { - ret[i] = new BoundResource(); - - int db = m_GL.m_FB.m_DrawFBO.DrawBuffers[i]; - - if (db >= 0) - { - ret[i].Id = m_GL.m_FB.m_DrawFBO.Color[db].Obj; - ret[i].HighestMip = (int)m_GL.m_FB.m_DrawFBO.Color[db].Mip; - ret[i].FirstSlice = (int)m_GL.m_FB.m_DrawFBO.Color[db].Layer; - ret[i].typeHint = FormatComponentType.None; - } - } - - return ret; - } - else if (IsLogVK) - { - var rp = m_Vulkan.Pass.renderpass; - var fb = m_Vulkan.Pass.framebuffer; - - int idx = 0; - - BoundResource[] ret = new BoundResource[rp.colorAttachments.Length*2]; - for (int i = 0; i < rp.colorAttachments.Length; i++) - { - ret[idx] = new BoundResource(); - - if(rp.colorAttachments[i] < fb.attachments.Length) - { - ret[idx].Id = fb.attachments[rp.colorAttachments[i]].img; - ret[idx].HighestMip = (int)fb.attachments[rp.colorAttachments[i]].baseMip; - ret[idx].FirstSlice = (int)fb.attachments[rp.colorAttachments[i]].baseLayer; - ret[idx].typeHint = fb.attachments[rp.colorAttachments[i]].viewfmt.compType; - } - - idx++; - } - for (int i = 0; i < rp.resolveAttachments.Length; i++) - { - ret[idx] = new BoundResource(); - - if (rp.resolveAttachments[i] < fb.attachments.Length) - { - ret[idx].Id = fb.attachments[rp.resolveAttachments[i]].img; - ret[idx].HighestMip = (int)fb.attachments[rp.resolveAttachments[i]].baseMip; - ret[idx].FirstSlice = (int)fb.attachments[rp.resolveAttachments[i]].baseLayer; - ret[idx].typeHint = fb.attachments[rp.resolveAttachments[i]].viewfmt.compType; - } - - idx++; - } - - return ret; - } - } - - return new BoundResource[0]; - } - - // Still to add: - // [ShaderViewer] * {FetchTexture,FetchBuffer} GetFetchBufferOrFetchTexture(ShaderResource) - } -} diff --git a/renderdocui/Code/Core.cs b/renderdocui/Code/Core.cs deleted file mode 100644 index dbc60b7e3..000000000 --- a/renderdocui/Code/Core.cs +++ /dev/null @@ -1,947 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Diagnostics; -using System.Linq; -using System.IO; -using System.Text; -using System.Windows.Forms; -using System.Threading; -using renderdocui.Windows; -using renderdocui.Windows.Dialogs; -using renderdocui.Windows.PipelineState; -using renderdoc; - -namespace renderdocui.Code -{ - // Single core class. Between this and the RenderManager these classes govern the interaction - // between the UI and the actual implementation. - // - // This class primarily controls things that need to be propogated globally, it keeps a list of - // ILogViewerForms which are windows that would like to be notified of changes to the current event, - // when a log is opened or closed, etc. It also contains data that potentially every window will - // want access to - like a list of all buffers in the log and their properties, etc. - public class Core - { - #region Privates - - private RenderManager m_Renderer = new RenderManager(); - - private PersistantConfig m_Config = null; - - private bool m_LogLocal = false; - private bool m_LogLoaded = false; - - private FileSystemWatcher m_LogWatcher = null; - - private string m_LogFile = ""; - - private UInt32 m_EventID = 0; - - private APIProperties m_APIProperties = null; - - private FetchFrameInfo m_FrameInfo = null; - private FetchDrawcall[] m_DrawCalls = null; - private FetchBuffer[] m_Buffers = null; - private FetchTexture[] m_Textures = null; - - private D3D11PipelineState m_D3D11PipelineState = null; - private D3D12PipelineState m_D3D12PipelineState = null; - private GLPipelineState m_GLPipelineState = null; - private VulkanPipelineState m_VulkanPipelineState = null; - private CommonPipelineState m_PipelineState = new CommonPipelineState(); - - private List m_LogViewers = new List(); - private List m_ProgressListeners = new List(); - - private MainWindow m_MainWindow = null; - private EventBrowser m_EventBrowser = null; - private APIInspector m_APIInspector = null; - private DebugMessages m_DebugMessages = null; - private TimelineBar m_TimelineBar = null; - private TextureViewer m_TextureViewer = null; - private BufferViewer m_MeshViewer = null; - private PipelineStateViewer m_PipelineStateViewer = null; - private StatisticsViewer m_StatisticsViewer = null; - - #endregion - - #region Properties - - public static string ConfigDirectory - { - get - { - string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); - return Path.Combine(appdata, "renderdoc"); - } - } - - public static string ConfigFilename - { - get - { - return Path.Combine(ConfigDirectory, "UI.config"); - } - } - - public PersistantConfig Config { get { return m_Config; } } - public bool LogLoaded { get { return m_LogLoaded; } } - public bool LogLoading { get { return m_LogLoadingInProgress; } } - public string LogFileName { get { return m_LogFile; } set { if (LogLoaded) m_LogFile = value; } } - public bool IsLogLocal { get { return m_LogLocal; } set { m_LogLocal = value; } } - - public FetchFrameInfo FrameInfo { get { return m_FrameInfo; } } - - public APIProperties APIProps { get { return m_APIProperties; } } - - public UInt32 CurEvent { get { return m_EventID; } } - - public FetchDrawcall[] CurDrawcalls { get { return GetDrawcalls(); } } - - public FetchDrawcall CurDrawcall { get { return GetDrawcall(CurEvent); } } - - public FetchTexture[] CurTextures { get { return m_Textures; } } - public FetchBuffer[] CurBuffers { get { return m_Buffers; } } - - public FetchTexture GetTexture(ResourceId id) - { - if (id == ResourceId.Null) return null; - - for (int t = 0; t < m_Textures.Length; t++) - if (m_Textures[t].ID == id) - return m_Textures[t]; - - return null; - } - - public FetchBuffer GetBuffer(ResourceId id) - { - if (id == ResourceId.Null) return null; - - for (int b = 0; b < m_Buffers.Length; b++) - if (m_Buffers[b].ID == id) - return m_Buffers[b]; - - return null; - } - - public List DebugMessages = new List(); - public int UnreadMessageCount = 0; - public void AddMessages(DebugMessage[] msgs) - { - UnreadMessageCount += msgs.Length; - foreach(var msg in msgs) - DebugMessages.Add(msg); - } - - // the RenderManager can be used when you want to perform an operation, it will let you Invoke or - // BeginInvoke onto the thread that's used to access the renderdoc project. - public RenderManager Renderer { get { return m_Renderer; } } - - public Form AppWindow { get { return m_MainWindow; } } - - #endregion - - #region Pipeline State - - // direct access (note that only one of these will be valid for a log, check APIProps.pipelineType) - public D3D11PipelineState CurD3D11PipelineState { get { return m_D3D11PipelineState; } } - public D3D12PipelineState CurD3D12PipelineState { get { return m_D3D12PipelineState; } } - public GLPipelineState CurGLPipelineState { get { return m_GLPipelineState; } } - public VulkanPipelineState CurVulkanPipelineState { get { return m_VulkanPipelineState; } } - public CommonPipelineState CurPipelineState { get { return m_PipelineState; } } - - #endregion - - #region Init and Shutdown - - public Core(string paramFilename, string remoteHost, uint remoteIdent, bool temp, PersistantConfig config) - { - if (!Directory.Exists(ConfigDirectory)) - Directory.CreateDirectory(ConfigDirectory); - - m_Config = config; - m_MainWindow = new MainWindow(this, paramFilename, remoteHost, remoteIdent, temp); - } - - public void Shutdown() - { - if (m_Renderer != null) - m_Renderer.CloseThreadSync(); - } - - #endregion - - #region Log Loading & Capture - - private bool m_LogLoadingInProgress = false; - - private bool LogLoadCallback() - { - return !m_LogLoadingInProgress; - } - - // used to determine if two drawcalls can be considered in the same 'pass', - // ie. writing to similar targets, same type of call, etc. - // - // When a log has no markers, this is used to group up drawcalls into fake markers - private bool PassEquivalent(FetchDrawcall a, FetchDrawcall b) - { - // executing command lists can have children - if(a.children.Length > 0 || b.children.Length > 0) - return false; - - // don't group draws and compute executes - if ((a.flags & DrawcallFlags.Dispatch) != (b.flags & DrawcallFlags.Dispatch)) - return false; - - // don't group present with anything - if ((a.flags & DrawcallFlags.Present) != (b.flags & DrawcallFlags.Present)) - return false; - - // don't group things with different depth outputs - if (a.depthOut != b.depthOut) - return false; - - int numAOuts = 0, numBOuts = 0; - for (int i = 0; i < 8; i++) - { - if (a.outputs[i] != ResourceId.Null) numAOuts++; - if (b.outputs[i] != ResourceId.Null) numBOuts++; - } - - int numSame = 0; - - if (a.depthOut != ResourceId.Null) - { - numAOuts++; - numBOuts++; - numSame++; - } - - for (int i = 0; i < 8; i++) - { - if (a.outputs[i] != ResourceId.Null) - { - for (int j = 0; j < 8; j++) - { - if (a.outputs[i] == b.outputs[j]) - { - numSame++; - break; - } - } - } - else if (b.outputs[i] != ResourceId.Null) - { - for (int j = 0; j < 8; j++) - { - if (a.outputs[j] == b.outputs[i]) - { - numSame++; - break; - } - } - } - } - - // use a kind of heuristic to group together passes where the outputs are similar enough. - // could be useful for example if you're rendering to a gbuffer and sometimes you render - // without one target, but the draws are still batched up. - if (numSame > Math.Max(numAOuts, numBOuts) / 2 && Math.Max(numAOuts, numBOuts) > 1) - return true; - - if (numSame == Math.Max(numAOuts, numBOuts)) - return true; - - return false; - } - - private bool ContainsMarker(FetchDrawcall[] draws) - { - bool ret = false; - - foreach (var d in draws) - { - ret |= (d.flags & DrawcallFlags.PushMarker) > 0 && (d.flags & DrawcallFlags.CmdList) == 0 && d.children.Length > 0; - ret |= ContainsMarker(d.children); - } - - return ret; - } - - // if a log doesn't contain any markers specified at all by the user, then we can - // fake some up by determining batches of draws that are similar and giving them a - // pass number - private FetchDrawcall[] FakeProfileMarkers(FetchDrawcall[] draws) - { - if (Config.EventBrowser_AddFake == false) - return draws; - - if (ContainsMarker(draws)) - return draws; - - var ret = new List(); - - int depthpassID = 1; - int computepassID = 1; - int passID = 1; - - int start = 0; - int refdraw = 0; - - for (int i = 1; i < draws.Length; i++) - { - if ((draws[refdraw].flags & (DrawcallFlags.Copy | DrawcallFlags.Resolve | DrawcallFlags.SetMarker | DrawcallFlags.CmdList)) > 0) - { - refdraw = i; - continue; - } - - if ((draws[i].flags & (DrawcallFlags.Copy | DrawcallFlags.Resolve | DrawcallFlags.SetMarker | DrawcallFlags.CmdList)) > 0) - continue; - - if (PassEquivalent(draws[i], draws[refdraw])) - continue; - - int end = i-1; - - if (end - start < 2 || - draws[i].children.Length > 0 || draws[refdraw].children.Length > 0) - { - for (int j = start; j <= end; j++) - ret.Add(draws[j]); - - start = i; - refdraw = i; - continue; - } - - int minOutCount = 100; - int maxOutCount = 0; - - for (int j = start; j <= end; j++) - { - int outCount = 0; - foreach (var o in draws[j].outputs) - if (o != ResourceId.Null) - outCount++; - minOutCount = Math.Min(minOutCount, outCount); - maxOutCount = Math.Max(maxOutCount, outCount); - } - - FetchDrawcall mark = new FetchDrawcall(); - - mark.eventID = draws[start].eventID; - mark.drawcallID = draws[start].drawcallID; - mark.markerColour = new float[] { 0.0f, 0.0f, 0.0f, 0.0f }; - - mark.flags = DrawcallFlags.PushMarker; - mark.outputs = draws[end].outputs; - mark.depthOut = draws[end].depthOut; - - mark.name = "Guessed Pass"; - - minOutCount = Math.Max(1, minOutCount); - - if ((draws[refdraw].flags & DrawcallFlags.Dispatch) != 0) - mark.name = String.Format("Compute Pass #{0}", computepassID++); - else if (maxOutCount == 0) - mark.name = String.Format("Depth-only Pass #{0}", depthpassID++); - else if (minOutCount == maxOutCount) - mark.name = String.Format("Colour Pass #{0} ({1} Targets{2})", passID++, minOutCount, draws[end].depthOut == ResourceId.Null ? "" : " + Depth"); - else - mark.name = String.Format("Colour Pass #{0} ({1}-{2} Targets{3})", passID++, minOutCount, maxOutCount, draws[end].depthOut == ResourceId.Null ? "" : " + Depth"); - - mark.children = new FetchDrawcall[end - start + 1]; - - for (int j = start; j <= end; j++) - { - mark.children[j - start] = draws[j]; - draws[j].parent = mark; - } - - ret.Add(mark); - - start = i; - refdraw = i; - } - - if (start < draws.Length) - { - for (int j = start; j < draws.Length; j++) - ret.Add(draws[j]); - } - - return ret.ToArray(); - } - - // because some engines (*cough*unreal*cough*) provide a valid marker colour of - // opaque black for every marker, instead of transparent black (i.e. just 0) we - // want to check for that case and remove the colors, instead of displaying all - // the markers as black which is not what's intended. - // - // Valid marker colors = has at least one color somewhere that isn't (0.0, 0.0, 0.0, 1.0) - // or (0.0, 0.0, 0.0, 0.0) - // - // This will fail if no marker colors are set anyway, but then removing them is - // harmless. - private bool HasValidMarkerColors(FetchDrawcall[] draws) - { - if (draws.Length == 0) - return false; - - foreach (var d in draws) - { - if (d.markerColour[0] != 0.0f || - d.markerColour[1] != 0.0f || - d.markerColour[2] != 0.0f || - (d.markerColour[3] != 1.0f && d.markerColour[3] != 0.0f)) - { - return true; - } - - if (HasValidMarkerColors(d.children)) - return true; - } - - return false; - } - - private void RemoveMarkerColors(FetchDrawcall[] draws) - { - for (int i = 0; i < draws.Length; i++) - { - draws[i].markerColour[0] = 0.0f; - draws[i].markerColour[1] = 0.0f; - draws[i].markerColour[2] = 0.0f; - draws[i].markerColour[3] = 0.0f; - - RemoveMarkerColors(draws[i].children); - } - } - - // generally logFile == origFilename, but if the log was transferred remotely then origFilename - // is the log locally before being copied we can present to the user in dialogs, etc. - public void LoadLogfile(string logFile, string origFilename, bool temporary, bool local) - { - m_LogFile = origFilename; - - m_LogLocal = local; - - m_LogLoadingInProgress = true; - - if (File.Exists(Core.ConfigFilename)) - m_Config.Serialize(Core.ConfigFilename); - - float postloadProgress = 0.0f; - - bool progressThread = true; - - // start a modal dialog to prevent the user interacting with the form while the log is loading. - // We'll close it down when log loading finishes (whether it succeeds or fails) - ProgressPopup modal = new ProgressPopup(LogLoadCallback, true); - - Thread modalThread = Helpers.NewThread(new ThreadStart(() => - { - modal.SetModalText(string.Format("Loading Log: {0}", origFilename)); - - AppWindow.BeginInvoke(new Action(() => - { - modal.ShowDialog(AppWindow); - })); - })); - modalThread.Start(); - - // this thread continually ticks and notifies any threads of the progress, through a float - // that is updated by the main loading code - Thread thread = Helpers.NewThread(new ThreadStart(() => - { - modal.LogfileProgressBegin(); - - foreach (var p in m_ProgressListeners) - p.LogfileProgressBegin(); - - while (progressThread) - { - Thread.Sleep(2); - - float progress = 0.8f * m_Renderer.LoadProgress + 0.19f * postloadProgress + 0.01f; - - modal.LogfileProgress(progress); - - foreach (var p in m_ProgressListeners) - p.LogfileProgress(progress); - } - })); - thread.Start(); - - // this function call will block until the log is either loaded, or there's some failure - m_Renderer.OpenCapture(logFile); - - // if the renderer isn't running, we hit a failure case so display an error message - if (!m_Renderer.Running) - { - string errmsg = m_Renderer.InitException.Status.Str(); - - MessageBox.Show(String.Format("{0}\nFailed to open file for replay: {1}.\n\n" + - "Check diagnostic log in Help menu for more details.", origFilename, errmsg), - "Error opening log", MessageBoxButtons.OK, MessageBoxIcon.Error); - - progressThread = false; - thread.Join(); - - m_LogLoadingInProgress = false; - - modal.LogfileProgress(-1.0f); - - foreach (var p in m_ProgressListeners) - p.LogfileProgress(-1.0f); - - return; - } - - if (!temporary) - { - m_Config.AddRecentFile(m_Config.RecentLogFiles, origFilename, 10); - - if (File.Exists(Core.ConfigFilename)) - m_Config.Serialize(Core.ConfigFilename); - } - - m_EventID = 0; - - m_FrameInfo = null; - m_APIProperties = null; - - // fetch initial data like drawcalls, textures and buffers - m_Renderer.Invoke((ReplayRenderer r) => - { - m_FrameInfo = r.GetFrameInfo(); - - m_APIProperties = r.GetAPIProperties(); - - postloadProgress = 0.2f; - - m_DrawCalls = FakeProfileMarkers(r.GetDrawcalls()); - - bool valid = HasValidMarkerColors(m_DrawCalls); - - if (!valid) - RemoveMarkerColors(m_DrawCalls); - - postloadProgress = 0.4f; - - m_Buffers = r.GetBuffers(); - - postloadProgress = 0.7f; - var texs = new List(r.GetTextures()); - m_Textures = texs.OrderBy(o => o.name).ToArray(); - - postloadProgress = 0.9f; - - m_D3D11PipelineState = r.GetD3D11PipelineState(); - m_D3D12PipelineState = r.GetD3D12PipelineState(); - m_GLPipelineState = r.GetGLPipelineState(); - m_VulkanPipelineState = r.GetVulkanPipelineState(); - m_PipelineState.SetStates(m_APIProperties, m_D3D11PipelineState, m_D3D12PipelineState, m_GLPipelineState, m_VulkanPipelineState); - - UnreadMessageCount = 0; - AddMessages(m_FrameInfo.debugMessages); - - postloadProgress = 1.0f; - }); - - Thread.Sleep(20); - - DateTime today = DateTime.Now; - DateTime compare = today.AddDays(-21); - - if (compare.CompareTo(Config.DegradedLog_LastUpdate) >= 0 && m_APIProperties.degraded) - { - Config.DegradedLog_LastUpdate = today; - - MessageBox.Show(String.Format("{0}\nThis log opened with degraded support - " + - "this could mean missing hardware support caused a fallback to software rendering.\n\n" + - "This warning will not appear every time this happens, " + - "check debug errors/warnings window for more details.", origFilename), - "Degraded support of log", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - } - - m_LogLoaded = true; - progressThread = false; - - if (local) - { - try - { - m_LogWatcher = new FileSystemWatcher(Path.GetDirectoryName(m_LogFile), Path.GetFileName(m_LogFile)); - m_LogWatcher.EnableRaisingEvents = true; - m_LogWatcher.NotifyFilter = NotifyFilters.Size | NotifyFilters.FileName | NotifyFilters.LastAccess | NotifyFilters.LastWrite; - m_LogWatcher.Created += new FileSystemEventHandler(OnLogfileChanged); - m_LogWatcher.Changed += new FileSystemEventHandler(OnLogfileChanged); - m_LogWatcher.SynchronizingObject = m_MainWindow; // callbacks on UI thread please - } - catch (ArgumentException) - { - // likely an "invalid" directory name - FileSystemWatcher doesn't support UNC paths properly - } - } - - List logviewers = new List(); - logviewers.AddRange(m_LogViewers); - - // make sure we're on a consistent event before invoking log viewer forms - FetchDrawcall draw = m_DrawCalls.Last(); - while (draw.children != null && draw.children.Length > 0) - draw = draw.children.Last(); - - SetEventID(logviewers.ToArray(), draw.eventID, true); - - // notify all the registers log viewers that a log has been loaded - foreach (var logviewer in logviewers) - { - if (logviewer == null || !(logviewer is Control)) continue; - - Control c = (Control)logviewer; - if (c.InvokeRequired) - { - if (!c.IsDisposed) - { - c.Invoke(new Action(() => { - try - { - logviewer.OnLogfileLoaded(); - } - catch (Exception ex) - { - throw new AccessViolationException("Rethrown from Invoke:\n" + ex.ToString()); - } - })); - } - } - else if (!c.IsDisposed) - logviewer.OnLogfileLoaded(); - } - - m_LogLoadingInProgress = false; - - modal.LogfileProgress(1.0f); - - foreach (var p in m_ProgressListeners) - p.LogfileProgress(1.0f); - } - - void OnLogfileChanged(object sender, FileSystemEventArgs e) - { - m_Renderer.Invoke((ReplayRenderer r) => - { - r.FileChanged(); - r.SetFrameEvent(m_EventID > 0 ? m_EventID-1 : 1, true); - }); - - SetEventID(null, CurEvent); - } - - public void CloseLogfile() - { - if (!m_LogLoaded) return; - - m_LogFile = ""; - - m_Renderer.CloseThreadSync(); - - m_APIProperties = null; - m_FrameInfo = null; - m_DrawCalls = null; - m_Buffers = null; - m_Textures = null; - - m_D3D11PipelineState = null; - m_D3D12PipelineState = null; - m_GLPipelineState = null; - m_VulkanPipelineState = null; - m_PipelineState.SetStates(null, null,null, null, null); - - DebugMessages.Clear(); - UnreadMessageCount = 0; - - m_LogLoaded = false; - - if (m_LogWatcher != null) - m_LogWatcher.EnableRaisingEvents = false; - m_LogWatcher = null; - - foreach (var logviewer in m_LogViewers) - { - Control c = (Control)logviewer; - if (c.InvokeRequired) - c.Invoke(new Action(() => logviewer.OnLogfileClosed())); - else - logviewer.OnLogfileClosed(); - } - } - - public String TempLogFilename(String appname) - { - string folder = Config.TemporaryCaptureDirectory; - try - { - if (folder.Length == 0 || !Directory.Exists(folder)) - folder = Path.Combine(Path.GetTempPath(), "RenderDoc"); - } - catch (ArgumentException) - { - // invalid path or similar - folder = Path.GetTempPath(); - } - return Path.Combine(folder, appname + "_" + DateTime.Now.ToString(@"yyyy.MM.dd_HH.mm.ss") + ".rdc"); - } - - #endregion - - #region Log drawcalls - - public FetchDrawcall[] GetDrawcalls() - { - return m_DrawCalls; - } - - private FetchDrawcall GetDrawcall(FetchDrawcall[] draws, UInt32 eventID) - { - foreach (var d in draws) - { - if (d.children != null && d.children.Length > 0) - { - var draw = GetDrawcall(d.children, eventID); - if (draw != null) return draw; - } - - if (d.eventID == eventID) - return d; - } - - return null; - } - - public FetchDrawcall GetDrawcall(UInt32 eventID) - { - if (m_DrawCalls == null) - return null; - - return GetDrawcall(m_DrawCalls, eventID); - } - - #endregion - - #region Viewers - - // Some viewers we only allow one to exist at once, so we keep the instance here. - - public EventBrowser GetEventBrowser() - { - if (m_EventBrowser == null || m_EventBrowser.IsDisposed) - { - m_EventBrowser = new EventBrowser(this); - AddLogViewer(m_EventBrowser); - } - - return m_EventBrowser; - } - - public TextureViewer GetTextureViewer() - { - if (m_TextureViewer == null || m_TextureViewer.IsDisposed) - { - m_TextureViewer = new TextureViewer(this); - AddLogViewer(m_TextureViewer); - } - - return m_TextureViewer; - } - - public BufferViewer GetMeshViewer() - { - if (m_MeshViewer == null || m_MeshViewer.IsDisposed) - { - m_MeshViewer = new BufferViewer(this, true); - AddLogViewer(m_MeshViewer); - } - - return m_MeshViewer; - } - - public PipelineStateViewer GetPipelineStateViewer() - { - if (m_PipelineStateViewer == null || m_PipelineStateViewer.IsDisposed) - { - m_PipelineStateViewer = new PipelineStateViewer(this); - AddLogViewer(m_PipelineStateViewer); - } - - return m_PipelineStateViewer; - } - - public APIInspector GetAPIInspector() - { - if (m_APIInspector == null || m_APIInspector.IsDisposed) - { - m_APIInspector = new APIInspector(this); - AddLogViewer(m_APIInspector); - } - - return m_APIInspector; - } - - public DebugMessages GetDebugMessages() - { - if (m_DebugMessages == null || m_DebugMessages.IsDisposed) - { - m_DebugMessages = new DebugMessages(this); - AddLogViewer(m_DebugMessages); - } - - return m_DebugMessages; - } - - public TimelineBar TimelineBar - { - get - { - if (m_TimelineBar == null || m_TimelineBar.IsDisposed) - return null; - - return m_TimelineBar; - } - } - - private CaptureDialog m_CaptureDialog = null; - public CaptureDialog CaptureDialog - { - get - { - return m_CaptureDialog == null || m_CaptureDialog.IsDisposed ? null : m_CaptureDialog; - } - set - { - if (m_CaptureDialog == null || m_CaptureDialog.IsDisposed) - m_CaptureDialog = value; - } - } - - public TimelineBar GetTimelineBar() - { - if (m_TimelineBar == null || m_TimelineBar.IsDisposed) - { - m_TimelineBar = new TimelineBar(this); - AddLogViewer(m_TimelineBar); - } - - return m_TimelineBar; - } - - public StatisticsViewer GetStatisticsViewer() - { - if (m_StatisticsViewer == null || m_StatisticsViewer.IsDisposed) - { - m_StatisticsViewer = new StatisticsViewer(this); - AddLogViewer(m_StatisticsViewer); - } - - return m_StatisticsViewer; - } - - public void AddLogProgressListener(ILogLoadProgressListener p) - { - m_ProgressListeners.Add(p); - } - - public void AddLogViewer(ILogViewerForm f) - { - m_LogViewers.Add(f); - - if (LogLoaded) - { - f.OnLogfileLoaded(); - f.OnEventSelected(CurEvent); - } - } - - public void RemoveLogViewer(ILogViewerForm f) - { - m_LogViewers.Remove(f); - } - - #endregion - - #region Log Browsing - - public void RefreshStatus() - { - SetEventID(new ILogViewerForm[] { }, m_EventID, true); - } - - public void SetEventID(ILogViewerForm exclude, UInt32 eventID) - { - SetEventID(new ILogViewerForm[] { exclude }, eventID, false); - } - - private void SetEventID(ILogViewerForm[] exclude, UInt32 eventID, bool force) - { - m_EventID = eventID; - - m_Renderer.Invoke((ReplayRenderer r) => - { - r.SetFrameEvent(m_EventID, force); - m_D3D11PipelineState = r.GetD3D11PipelineState(); - m_D3D12PipelineState = r.GetD3D12PipelineState(); - m_GLPipelineState = r.GetGLPipelineState(); - m_VulkanPipelineState = r.GetVulkanPipelineState(); - m_PipelineState.SetStates(m_APIProperties, m_D3D11PipelineState, m_D3D12PipelineState, m_GLPipelineState, m_VulkanPipelineState); - }); - - foreach (var logviewer in m_LogViewers) - { - if(exclude.Contains(logviewer)) - continue; - - Control c = (Control)logviewer; - if (c.InvokeRequired) - c.Invoke(new Action(() => logviewer.OnEventSelected(eventID))); - else - logviewer.OnEventSelected(eventID); - } - } - - #endregion - } -} diff --git a/renderdocui/Code/FormatElement.cs b/renderdocui/Code/FormatElement.cs deleted file mode 100644 index 6e97b4938..000000000 --- a/renderdocui/Code/FormatElement.cs +++ /dev/null @@ -1,745 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2014-2017 Baldur Karlsson - * - * 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. - ******************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Text.RegularExpressions; -using renderdoc; - -namespace renderdocui.Code -{ - public class FormatElement - { - public FormatElement() - { - name = ""; - buffer = 0; - offset = 0; - perinstance = false; - instancerate = 1; - rowmajor = false; - matrixdim = 0; - format = new ResourceFormat(); - hex = false; - systemValue = SystemAttribute.None; - } - - public FormatElement(string Name, int buf, uint offs, bool pi, int ir, bool rowMat, uint matDim, ResourceFormat f, bool h) - { - name = Name; - buffer = buf; - offset = offs; - format = f; - perinstance = pi; - instancerate = ir; - rowmajor = rowMat; - matrixdim = matDim; - hex = h; - systemValue = SystemAttribute.None; - } - - public override bool Equals(Object obj) - { - return obj is FormatElement && this == (FormatElement)obj; - } - public override int GetHashCode() - { - int hash = name.GetHashCode() * 17; - hash = hash * 17 + buffer.GetHashCode(); - hash = hash * 17 + offset.GetHashCode(); - hash = hash * 17 + format.GetHashCode(); - hash = hash * 17 + perinstance.GetHashCode(); - hash = hash * 17 + rowmajor.GetHashCode(); - hash = hash * 17 + matrixdim.GetHashCode(); - hash = hash * 17 + hex.GetHashCode(); - return hash; - } - public static bool operator ==(FormatElement x, FormatElement y) - { - if ((object)x == null) return (object)y == null; - if ((object)y == null) return (object)x == null; - - return x.name == y.name && - x.buffer == y.buffer && - x.offset == y.offset && - x.format == y.format && - x.perinstance == y.perinstance && - x.rowmajor == y.rowmajor && - x.matrixdim == y.matrixdim && - x.hex == y.hex; - } - public static bool operator !=(FormatElement x, FormatElement y) - { - return !(x == y); - } - - public uint ByteSize - { - get - { - uint vecSize = format.compByteWidth * format.compCount; - - if (format.special) - { - if (format.specialFormat == SpecialFormat.R5G5B5A1 || - format.specialFormat == SpecialFormat.R5G6B5 || - format.specialFormat == SpecialFormat.R4G4B4A4) - vecSize = 2; - - if (format.specialFormat == SpecialFormat.R10G10B10A2 || - format.specialFormat == SpecialFormat.R11G11B10) - vecSize = 4; - } - - return vecSize * matrixdim; - } - } - - public object[] GetObjects(BinaryReader read) - { - var ret = new List(); - - if (format.special && format.specialFormat == SpecialFormat.R5G5B5A1) - { - ushort packed = read.ReadUInt16(); - - ret.Add((float)((packed >> 0) & 0x1f) / 31.0f); - ret.Add((float)((packed >> 5) & 0x1f) / 31.0f); - ret.Add((float)((packed >> 10) & 0x1f) / 31.0f); - ret.Add(((packed & 0x8000) > 0) ? 1.0f : 0.0f); - - if (format.bgraOrder) - { - object tmp = ret[2]; - ret[2] = ret[0]; - ret[0] = tmp; - } - } - else if (format.special && format.specialFormat == SpecialFormat.R5G6B5) - { - ushort packed = read.ReadUInt16(); - - ret.Add((float)((packed >> 0) & 0x1f) / 31.0f); - ret.Add((float)((packed >> 5) & 0x3f) / 63.0f); - ret.Add((float)((packed >> 11) & 0x1f) / 31.0f); - - if (format.bgraOrder) - { - object tmp = ret[2]; - ret[2] = ret[0]; - ret[0] = tmp; - } - } - else if (format.special && format.specialFormat == SpecialFormat.R4G4B4A4) - { - ushort packed = read.ReadUInt16(); - - ret.Add((float)((packed >> 0) & 0xf) / 15.0f); - ret.Add((float)((packed >> 4) & 0xf) / 15.0f); - ret.Add((float)((packed >> 8) & 0xf) / 15.0f); - ret.Add((float)((packed >> 12) & 0xf) / 15.0f); - - if (format.bgraOrder) - { - object tmp = ret[2]; - ret[2] = ret[0]; - ret[0] = tmp; - } - } - else if (format.special && format.specialFormat == SpecialFormat.R10G10B10A2) - { - // allow for vectors of this format - for raw buffer viewer - for (int i = 0; i < (format.compCount / 4); i++) - { - uint packed = read.ReadUInt32(); - - uint r = (packed >> 0) & 0x3ff; - uint g = (packed >> 10) & 0x3ff; - uint b = (packed >> 20) & 0x3ff; - uint a = (packed >> 30) & 0x003; - - if (format.bgraOrder) - { - uint tmp = b; - b = r; - r = tmp; - } - - if (format.compType == FormatComponentType.UInt) - { - ret.Add(r); - ret.Add(g); - ret.Add(b); - ret.Add(a); - } - else if (format.compType == FormatComponentType.UScaled) - { - ret.Add((float)r); - ret.Add((float)g); - ret.Add((float)b); - ret.Add((float)a); - } - else if (format.compType == FormatComponentType.SInt || - format.compType == FormatComponentType.SScaled) - { - int ir, ig, ib, ia; - - // interpret RGB as 10-bit signed integers - if(r <= 511) - ir = (int)r; - else - ir = ((int)r) - 1024; - - if (g <= 511) - ig = (int)g; - else - ig = ((int)g) - 1024; - - if (b <= 511) - ib = (int)b; - else - ib = ((int)b) - 1024; - - // 2-bit signed integer - if (a <= 1) - ia = (int)a; - else - ia = ((int)a) - 4; - - if (format.compType == FormatComponentType.SInt) - { - ret.Add(ir); - ret.Add(ig); - ret.Add(ib); - ret.Add(ia); - } - else if (format.compType == FormatComponentType.SScaled) - { - ret.Add((float)ir); - ret.Add((float)ig); - ret.Add((float)ib); - ret.Add((float)ia); - } - } - else - { - ret.Add((float)r / 1023.0f); - ret.Add((float)g / 1023.0f); - ret.Add((float)b / 1023.0f); - ret.Add((float)a / 3.0f); - } - } - } - else if (format.special && format.specialFormat == SpecialFormat.R11G11B10) - { - uint packed = read.ReadUInt32(); - - uint[] mantissas = new uint[] { - (packed >> 0) & 0x3f, (packed >> 11) & 0x3f, (packed >> 22) & 0x1f, - }; - uint[] leadbit = new uint[] { - 0x40, 0x40, 0x20, - }; - int[] exponents = new int[]{ - (int)(packed >> 6) & 0x1f, (int)(packed >> 17) & 0x1f, (int)(packed >> 27) & 0x1f, - }; - - for (int i = 0; i < 3; i++) - { - if (mantissas[i] == 0 && exponents[i] == 0) - { - ret.Add((float)0.0f); - } - else - { - if (exponents[i] == 0x1f) - { - // no sign bit, can't be negative infinity - if (mantissas[i] == 0) - ret.Add(float.PositiveInfinity); - else - ret.Add(float.NaN); - } - else if (exponents[i] != 0) - { - // normal value, add leading bit - uint combined = leadbit[i] | mantissas[i]; - - // calculate value - ret.Add(((float)combined / (float)leadbit[i]) * Math.Pow(2.0f, (float)exponents[i] - 15.0f)); - } - else if (exponents[i] == 0) - { - // we know xMantissa isn't 0 also, or it would have been caught above so - // this is a subnormal value, pretend exponent is 1 and don't add leading bit - - ret.Add(((float)mantissas[i] / (float)leadbit[i]) * Math.Pow(2.0f, (float)1.0f - 15.0f)); - } - } - } - } - else - { - int dim = (int)(Math.Max(matrixdim, 1) * format.compCount); - - for (int i = 0; i < dim; i++) - { - if (format.compType == FormatComponentType.Float) - { - if (format.compByteWidth == 8) - ret.Add(read.ReadDouble()); - else if (format.compByteWidth == 4) - ret.Add(read.ReadSingle()); - else if (format.compByteWidth == 2) - ret.Add(format.ConvertFromHalf(read.ReadUInt16())); - } - else if (format.compType == FormatComponentType.SInt) - { - if (format.compByteWidth == 4) - ret.Add((int)read.ReadInt32()); - else if (format.compByteWidth == 2) - ret.Add((int)read.ReadInt16()); - else if (format.compByteWidth == 1) - ret.Add((int)read.ReadSByte()); - } - else if (format.compType == FormatComponentType.UInt) - { - if (format.compByteWidth == 4) - ret.Add((uint)read.ReadUInt32()); - else if (format.compByteWidth == 2) - ret.Add((uint)read.ReadUInt16()); - else if (format.compByteWidth == 1) - ret.Add((uint)read.ReadByte()); - } - else if (format.compType == FormatComponentType.UScaled) - { - if (format.compByteWidth == 4) - ret.Add((float)read.ReadUInt32()); - else if (format.compByteWidth == 2) - ret.Add((float)read.ReadUInt16()); - else if (format.compByteWidth == 1) - ret.Add((float)read.ReadByte()); - } - else if (format.compType == FormatComponentType.SScaled) - { - if (format.compByteWidth == 4) - ret.Add((float)read.ReadInt32()); - else if (format.compByteWidth == 2) - ret.Add((float)read.ReadInt16()); - else if (format.compByteWidth == 1) - ret.Add((float)read.ReadSByte()); - } - else if (format.compType == FormatComponentType.Depth) - { - float f = (float)read.ReadUInt32(); - if (format.compByteWidth == 4) - ret.Add(f / (float)uint.MaxValue); - else if (format.compByteWidth == 3) - ret.Add(f / (float)0x00ffffff); - else if (format.compByteWidth == 2) - ret.Add(f / (float)0xffff); - } - else if (format.compType == FormatComponentType.Double) - { - ret.Add(read.ReadDouble()); - } - else - { - // unorm/snorm - - if (format.compByteWidth == 4) - { - renderdoc.StaticExports.LogText("Unexpected 4-byte unorm/snorm value"); - ret.Add((float)read.ReadUInt32() / (float)uint.MaxValue); // should never hit this - no 32bit unorm/snorm type - } - else if (format.compByteWidth == 2) - { - ret.Add(format.Interpret(read.ReadUInt16())); - } - else if (format.compByteWidth == 1) - { - ret.Add(format.Interpret(read.ReadByte())); - } - } - } - - if (format.bgraOrder) - { - object tmp = ret[2]; - ret[2] = ret[0]; - ret[0] = tmp; - } - } - - return ret.ToArray(); - } - - public ShaderVariable GetShaderVar(BinaryReader read) - { - object[] objs = GetObjects(read); - - ShaderVariable ret = new ShaderVariable(); - - ret.name = name; - ret.type = VarType.Float; - if (format.compType == FormatComponentType.UInt) - ret.type = VarType.UInt; - if (format.compType == FormatComponentType.SInt) - ret.type = VarType.Int; - if (format.compType == FormatComponentType.Double) - ret.type = VarType.Double; - - ret.columns = Math.Min(format.compCount, 4); - ret.rows = Math.Min(matrixdim, 4); - - ret.displayAsHex = hex; - - ret.members = new ShaderVariable[0] { }; - - ret.value.fv = new float[16]; - ret.value.uv = new uint[16]; - ret.value.iv = new int[16]; - ret.value.dv = new double[16]; - - for (uint row = 0; row < ret.rows; row++) - { - for (uint col = 0; col < ret.columns; col++) - { - uint dst = row * ret.columns + col; - uint src = row * format.compCount + col; - - object o = objs[src]; - - if (o is double) - ret.value.dv[dst] = (double)o; - else if (o is float) - ret.value.fv[dst] = (float)o; - else if (o is uint) - ret.value.uv[dst] = (uint)o; - else if (o is int) - ret.value.iv[dst] = (int)o; - } - } - - return ret; - } - - static public FormatElement[] ParseFormatString(string formatString, UInt64 maxLen, bool tightPacking, out string errors) - { - var elems = new List(); - - var formatReader = new StringReader(formatString); - - // regex doesn't account for trailing or preceeding whitespace, or comments - - var regExpr = @"^(row_major\s+)?" + // row_major matrix - @"(" + - @"uintten|unormten" + - @"|floateleven" + - @"|unormh|unormb" + - @"|snormh|snormb" + - @"|bool" + // bool is stored as 4-byte int - @"|byte|short|int" + // signed ints - @"|ubyte|ushort|uint" + // unsigned ints - @"|xbyte|xshort|xint" + // hex ints - @"|half|float|double" + // float types - @"|vec|uvec|ivec" + // OpenGL vector types - @"|mat|umat|imat" + // OpenGL matrix types - @")" + - @"([1-9])?" + // might be a vector - @"(x[1-9])?" + // or a matrix - @"(\s+[A-Za-z_][A-Za-z0-9_]*)?" + // get identifier name - @"(\[[0-9]+\])?" + // optional array dimension - @"(\s*:\s*[A-Za-z_][A-Za-z0-9_]*)?" + // optional semantic - @"$"; - - Regex regParser = new Regex(regExpr, RegexOptions.Compiled); - - bool success = true; - errors = ""; - - var text = formatReader.ReadToEnd(); - - text = text.Replace("{", "").Replace("}", ""); - - Regex c_comments = new Regex(@"/\*[^*]*\*+(?:[^*/][^*]*\*+)*/", RegexOptions.Compiled); - text = c_comments.Replace(text, ""); - - Regex cpp_comments = new Regex(@"//.*", RegexOptions.Compiled); - text = cpp_comments.Replace(text, ""); - - uint offset = 0; - - // get each line and parse it to determine the format the user wanted - foreach (var l in text.Split(';')) - { - var line = l; - line = line.Trim(); - - if (line.Length == 0) continue; - - var match = regParser.Match(line); - - if (!match.Success) - { - errors = "Couldn't parse line:\n" + line; - success = false; - break; - } - - var basetype = match.Groups[2].Value; - bool row_major = match.Groups[1].Success; - var vectorDim = match.Groups[3].Success ? match.Groups[3].Value : "1"; - var matrixDim = match.Groups[4].Success ? match.Groups[4].Value.Substring(1) : "1"; - var name = match.Groups[5].Success ? match.Groups[5].Value.Trim() : "data"; - var arrayDim = match.Groups[6].Success ? match.Groups[6].Value.Trim() : "[1]"; - arrayDim = arrayDim.Substring(1, arrayDim.Length - 2); - - if (match.Groups[4].Success) - { - var a = vectorDim; - vectorDim = matrixDim; - matrixDim = a; - } - - ResourceFormat fmt = new ResourceFormat(FormatComponentType.None, 0, 0); - - bool hex = false; - - FormatComponentType type = FormatComponentType.Float; - uint count = 0; - uint arrayCount = 1; - uint matrixCount = 0; - uint width = 0; - - // check for square matrix declarations like 'mat4' and 'mat3' - if (basetype == "mat" && !match.Groups[4].Success) - matrixDim = vectorDim; - - // calculate format - { - if (!uint.TryParse(vectorDim, out count)) - { - errors = "Invalid vector dimension on line:\n" + line; - success = false; - break; - } - if (!uint.TryParse(arrayDim, out arrayCount)) - { - arrayCount = 1; - } - arrayCount = Math.Max(0, arrayCount); - if (!uint.TryParse(matrixDim, out matrixCount)) - { - errors = "Invalid matrix second dimension on line:\n" + line; - success = false; - break; - } - - if (basetype == "bool") - { - type = FormatComponentType.UInt; - width = 4; - } - else if (basetype == "byte") - { - type = FormatComponentType.SInt; - width = 1; - } - else if (basetype == "ubyte" || basetype == "xbyte") - { - type = FormatComponentType.UInt; - width = 1; - } - else if (basetype == "short") - { - type = FormatComponentType.SInt; - width = 2; - } - else if (basetype == "ushort" || basetype == "xshort") - { - type = FormatComponentType.UInt; - width = 2; - } - else if (basetype == "int" || basetype == "ivec" || basetype == "imat") - { - type = FormatComponentType.SInt; - width = 4; - } - else if (basetype == "uint" || basetype == "xint" || basetype == "uvec" || basetype == "umat") - { - type = FormatComponentType.UInt; - width = 4; - } - else if (basetype == "half") - { - type = FormatComponentType.Float; - width = 2; - } - else if (basetype == "float" || basetype == "vec" || basetype == "mat") - { - type = FormatComponentType.Float; - width = 4; - } - else if (basetype == "double") - { - type = FormatComponentType.Double; - width = 8; - } - else if (basetype == "unormh") - { - type = FormatComponentType.UNorm; - width = 2; - } - else if (basetype == "unormb") - { - type = FormatComponentType.UNorm; - width = 1; - } - else if (basetype == "snormh") - { - type = FormatComponentType.SNorm; - width = 2; - } - else if (basetype == "snormb") - { - type = FormatComponentType.SNorm; - width = 1; - } - else if (basetype == "uintten") - { - fmt = new ResourceFormat(FormatComponentType.UInt, 4 * count, 1); - fmt.special = true; - fmt.specialFormat = SpecialFormat.R10G10B10A2; - } - else if (basetype == "unormten") - { - fmt = new ResourceFormat(FormatComponentType.UNorm, 4 * count, 1); - fmt.special = true; - fmt.specialFormat = SpecialFormat.R10G10B10A2; - } - else if (basetype == "floateleven") - { - fmt = new ResourceFormat(FormatComponentType.Float, 3 * count, 1); - fmt.special = true; - fmt.specialFormat = SpecialFormat.R11G11B10; - } - else - { - errors = "Unrecognised basic type on line:\n" + line; - success = false; - break; - } - } - - if (basetype == "xint" || basetype == "xshort" || basetype == "xbyte") - hex = true; - - if (fmt.compType == FormatComponentType.None) - fmt = new ResourceFormat(type, count, width); - - if (arrayCount == 1) - { - FormatElement elem = new FormatElement(name, 0, offset, false, 1, row_major, matrixCount, fmt, hex); - - uint advance = elem.ByteSize; - - if (!tightPacking) - { - // cbuffer packing always works in floats - advance = (advance + 3U) & (~3U); - - // cbuffer packing doesn't allow elements to cross float4 boundaries, nudge up if this was the case - if (offset / 16 != (offset + elem.ByteSize - 1) / 16) - { - elem.offset = offset = (offset + 0xFU) & (~0xFU); - } - } - - elems.Add(elem); - - offset += advance; - } - else - { - // when cbuffer packing, arrays are always aligned at float4 boundary - if (!tightPacking) - { - if (offset % 16 != 0) - { - offset = (offset + 0xFU) & (~0xFU); - } - } - - for (uint a = 0; a < arrayCount; a++) - { - FormatElement elem = new FormatElement(String.Format("{0}[{1}]", name, a), 0, offset, false, 1, row_major, matrixCount, fmt, hex); - - elems.Add(elem); - - uint advance = elem.ByteSize; - - // cbuffer packing each array element is always float4 aligned - if (!tightPacking) - { - advance = (advance + 0xFU) & (~0xFU); - } - - offset += advance; - } - } - } - - if (!success || elems.Count == 0) - { - elems.Clear(); - - var fmt = new ResourceFormat(FormatComponentType.UInt, 4, 4); - - if (maxLen > 0 && maxLen < 16) - fmt.compCount = 1; - if (maxLen > 0 && maxLen < 4) - fmt.compByteWidth = 1; - - elems.Add(new FormatElement("data", 0, 0, false, 1, false, 1, fmt, true)); - } - - return elems.ToArray(); - } - - public string name; - public int buffer; - public uint offset; - public bool perinstance; - public int instancerate; - public bool rowmajor; - public uint matrixdim; - public ResourceFormat format; - public bool hex; - public SystemAttribute systemValue; - } -} diff --git a/renderdocui/Code/Helpers.cs b/renderdocui/Code/Helpers.cs deleted file mode 100644 index 247028cb2..000000000 --- a/renderdocui/Code/Helpers.cs +++ /dev/null @@ -1,498 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.IO; -using System.Threading; -using System.Windows.Forms; -using WeifenLuo.WinFormsUI.Docking; -using Microsoft.Win32; -using System.Security.Principal; -using System.Diagnostics; -using System.Xml.Serialization; - -namespace renderdocui.Code -{ - static class Helpers - { - // simple helpers to wrap a given control in a DockContent, so it can be docked into a panel. - static public DockContent WrapDockContent(DockPanel panel, Control c) - { - return WrapDockContent(panel, c, c.Text); - } - - static public DockContent WrapDockContent(DockPanel panel, Control c, string Title) - { - DockContent w = new DockContent(); - c.Dock = DockStyle.Fill; - w.Controls.Add(c); - w.DockAreas &= ~DockAreas.Float; - w.Text = Title; - w.DockPanel = panel; - - w.DockHandler.GetPersistStringCallback = new GetPersistStringCallback(() => { return c.Name; }); - - Control win = panel as Control; - - while (win != null && !(win is Form)) - win = win.Parent; - - if (win != null && win is Form) - w.Icon = (win as Form).Icon; - - return w; - } - - static public DockPanelSkin MakeHighContrastDockPanelSkin() - { - DockPanelSkin ret = new DockPanelSkin(); - - ret.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.StartColor = SystemColors.ActiveCaption; - ret.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor = SystemColors.ActiveCaption; - ret.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.TextColor = SystemColors.ActiveCaptionText; - - ret.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor = SystemColors.InactiveCaption; - ret.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor = SystemColors.InactiveCaption; - ret.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.TextColor = SystemColors.InactiveCaptionText; - - ret.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient = ret.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient; - ret.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient = ret.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient; - - ret.DockPaneStripSkin.DocumentGradient.ActiveTabGradient = ret.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient; - ret.DockPaneStripSkin.DocumentGradient.InactiveTabGradient = ret.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient; - - return ret; - } - - public static T Clamp(this T val, T min, T max) where T : IComparable - { - if (val.CompareTo(min) < 0) return min; - else if (val.CompareTo(max) > 0) return max; - else return val; - } - - public static float Area(this System.Drawing.PointF val) - { - return val.X * val.Y; - } - public static float Aspect(this System.Drawing.PointF val) - { - return val.X / val.Y; - } - - public static uint AlignUp(this uint x, uint a) - { - return (x + (a - 1)) & (~(a - 1)); - } - - public static float GetLuminance(this System.Drawing.Color c) - { - return (float)(0.2126 * Math.Pow(c.R / 255.0, 2.2) + 0.7152 * Math.Pow(c.G / 255.0, 2.2) + 0.0722 * Math.Pow(c.B / 255.0, 2.2)); - } - - public static int CharCount(string s, char c) - { - int ret = 0; - - int offs = s.IndexOf(c); - - while (offs >= 0) - { - ret++; - offs = s.IndexOf(c, offs + 1); - } - - return ret; - } - - public static bool IsAlpha(this char c) - { - return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); - } - - public static string SafeGetFileName(string filename) - { - try - { - return System.IO.Path.GetFileName(filename); - } - catch (ArgumentException) - { - // invalid path or similar, just try to go from last \ or / onwards - - string ret = filename; - int idx = ret.LastIndexOfAny(new char[] { '/', '\\' }); - if (idx > 0) - ret = ret.Substring(idx + 1); - - return ret; - } - } - - public static bool IsElevated - { - get - { - return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); - } - } - - public static Thread NewThread(ParameterizedThreadStart s) - { - Thread ret = new Thread(s); - ret.CurrentCulture = Application.CurrentCulture; - return ret; - } - - public static Thread NewThread(ThreadStart s) - { - Thread ret = new Thread(s); - ret.CurrentCulture = Application.CurrentCulture; - return ret; - } - - public static void RefreshAssociations() - { - Win32PInvoke.SHChangeNotify(Win32PInvoke.HChangeNotifyEventID.SHCNE_ASSOCCHANGED, - Win32PInvoke.HChangeNotifyFlags.SHCNF_IDLIST | - Win32PInvoke.HChangeNotifyFlags.SHCNF_FLUSHNOWAIT | - Win32PInvoke.HChangeNotifyFlags.SHCNF_NOTIFYRECURSIVE, - IntPtr.Zero, IntPtr.Zero); - } - - public static void InstallRDCAssociation() - { - if (!IsElevated) - { - var process = new Process(); - process.StartInfo = new ProcessStartInfo(Application.ExecutablePath, "--registerRDCext"); - process.StartInfo.Verb = "runas"; - try - { - process.Start(); - } - catch (Exception) - { - // fire and forget - most likely caused by user saying no to UAC prompt - } - return; - } - - var path = Path.GetFullPath(Application.ExecutablePath); - - RegistryKey key = Registry.ClassesRoot.CreateSubKey("RenderDoc.RDCCapture.1"); - key.SetValue("", "RenderDoc Capture Log (.rdc)"); - key.CreateSubKey("shell").CreateSubKey("open").CreateSubKey("command").SetValue("", "\"" + path + "\" \"%1\""); - key.CreateSubKey("DefaultIcon").SetValue("", path); - key.CreateSubKey("CLSID").SetValue("", "{5D6BF029-A6BA-417A-8523-120492B1DCE3}"); - key.CreateSubKey("ShellEx").CreateSubKey("{e357fccd-a995-4576-b01f-234630154e96}").SetValue("", "{5D6BF029-A6BA-417A-8523-120492B1DCE3}"); - key.Close(); - - key = Registry.ClassesRoot.CreateSubKey(".rdc"); - key.SetValue("", "RenderDoc.RDCCapture.1"); - key.Close(); - - var dllpath = Path.Combine(Path.GetDirectoryName(path), "renderdoc.dll"); - - key = Registry.ClassesRoot.OpenSubKey("CLSID", true).CreateSubKey("{5D6BF029-A6BA-417A-8523-120492B1DCE3}"); - key.SetValue("", "RenderDoc Thumbnail Handler"); - key.CreateSubKey("InprocServer32").SetValue("", dllpath); - key.Close(); - - RefreshAssociations(); - } - - public static void InstallCAPAssociation() - { - if (!IsElevated) - { - var process = new Process(); - process.StartInfo = new ProcessStartInfo(Application.ExecutablePath, "--registerCAPext"); - process.StartInfo.Verb = "runas"; - try - { - process.Start(); - } - catch (Exception) - { - // fire and forget - most likely caused by user saying no to UAC prompt - } - return; - } - - var path = Path.GetFullPath(Application.ExecutablePath); - - RegistryKey key = Registry.ClassesRoot.CreateSubKey("RenderDoc.RDCSettings.1"); - key.SetValue("", "RenderDoc Capture Settings (.cap)"); - key.CreateSubKey("DefaultIcon").SetValue("", path); - key.CreateSubKey("shell").CreateSubKey("open").CreateSubKey("command").SetValue("", "\"" + path + "\" \"%1\""); - key.Close(); - - key = Registry.ClassesRoot.CreateSubKey(".cap"); - key.SetValue("", "RenderDoc.RDCSettings.1"); - key.Close(); - - RefreshAssociations(); - } - - public static string GetVulkanJSONPath(bool wow6432) - { - string basepath = Win32PInvoke.GetUniversalName(Path.GetDirectoryName(Application.ExecutablePath)); - if (wow6432) - basepath = Path.Combine(basepath, "x86"); - - return Path.Combine(basepath, "renderdoc.json"); - } - - private static RegistryKey GetVulkanImplicitLayersKey(bool write, bool wow6432) - { - try - { - string basepath = "SOFTWARE\\"; - if (wow6432) - basepath += "Wow6432Node\\"; - - if(write) - return Registry.LocalMachine.CreateSubKey(basepath + "Khronos\\Vulkan\\ImplicitLayers"); - else - return Registry.LocalMachine.OpenSubKey(basepath + "Khronos\\Vulkan\\ImplicitLayers"); - } - catch (Exception) - { - } - return null; - } - - public static bool CheckVulkanLayerRegistration(out bool hasOtherJSON, out bool thisRegistered, out string[] otherJSONs) - { - RegistryKey key = GetVulkanImplicitLayersKey(false, false); - - // if we couldn't even get the ImplicitLayers reg key the system doesn't have the - // vulkan runtime, so we return as if we are not registered (as that's the case). - // People not using vulkan can either ignore the message, or click to set it up - // and it will go away as we'll have rights to create it. - if (key == null) - { - hasOtherJSON = false; - otherJSONs = new string[] { }; - thisRegistered = false; - return false; - } - - string myJSON = Path.GetFullPath(GetVulkanJSONPath(false)); - - string[] names = key.GetValueNames(); - - // defaults - thisRegistered = false; - hasOtherJSON = false; - - List others = new List(); - - foreach (var n in names) - { - string fullpath; - - try - { - fullpath = Path.GetFullPath(n); - } - catch (Exception) - { - // invalid path or similar - fullpath = ""; - } - - if(String.Compare(fullpath, myJSON, StringComparison.CurrentCultureIgnoreCase) == 0) - { - thisRegistered = true; - } - else if(n.IndexOf("renderdoc.json") > 0) - { - hasOtherJSON = true; - others.Add(Path.GetFullPath(n)); - } - } - - // if we're 64-bit update that too. For 32-bit the above path covers it. - if (Environment.Is64BitProcess) - { - myJSON = Path.GetFullPath(GetVulkanJSONPath(true)); - key = GetVulkanImplicitLayersKey(false, true); - - if (key == null) - { - thisRegistered = false; - } - else - { - names = key.GetValueNames(); - - foreach (var n in names) - { - if (String.Compare(Path.GetFullPath(n), myJSON, StringComparison.CurrentCultureIgnoreCase) == 0) - { - thisRegistered = true; - } - else if (n.IndexOf("renderdoc.json") > 0) - { - hasOtherJSON = true; - others.Add(Path.GetFullPath(n)); - } - } - } - } - - if(hasOtherJSON) - otherJSONs = others.ToArray(); - else - otherJSONs = new string[] {}; - - // return true if all is OK - return !hasOtherJSON && thisRegistered; - } - - public static bool CheckVulkanLayerRegistration() - { - bool dummy1, dummy2; - string[] dummy3; - return CheckVulkanLayerRegistration(out dummy1, out dummy2, out dummy3); - } - - public static void UpdateInstalledVersionNumber() - { - if (!IsElevated) - return; - - try - { - string basepath = "SOFTWARE\\"; - - RegistryKey key = Registry.LocalMachine.CreateSubKey(basepath + "Microsoft\\Windows\\CurrentVersion\\Uninstall"); - - string[] subkeys = key.GetSubKeyNames(); - - foreach (var sub in subkeys) - { - RegistryKey prog = key.CreateSubKey(sub); - - string[] values = prog.GetValueNames(); - - if (Array.IndexOf(values, "DisplayName") >= 0 && - (string)prog.GetValue("DisplayName") == "RenderDoc" && - Array.IndexOf(values, "Publisher") >= 0 && - (string)prog.GetValue("Publisher") == "Baldur Karlsson") - { - var ver = System.Reflection.Assembly.GetEntryAssembly().GetName().Version; - uint majorversion = (uint)ver.Major; - uint minorversion = (uint)ver.Minor; - uint packedversion = (majorversion << 24) | (minorversion << 16); - - prog.SetValue("Version", packedversion, RegistryValueKind.DWord); - prog.SetValue("VersionMajor", majorversion, RegistryValueKind.DWord); - prog.SetValue("VersionMinor", minorversion, RegistryValueKind.DWord); - prog.SetValue("DisplayVersion", String.Format("{0}.{1}.0", majorversion, minorversion), RegistryValueKind.String); - } - } - } - catch (Exception) - { - } - } - - public static void RegisterVulkanLayer() - { - if (!IsElevated) - { - var process = new Process(); - process.StartInfo = new ProcessStartInfo(Application.ExecutablePath, "--registerVKLayer"); - process.StartInfo.Verb = "runas"; - try - { - process.Start(); - // wait for process to finish - process.WaitForExit(); - } - catch (Exception) - { - } - return; - } - - // we know we're elevated, so open the key for write - RegistryKey key = GetVulkanImplicitLayersKey(true, false); - - if (key != null) - { - string[] names = key.GetValueNames(); - - // for simplicity we just delete *all* renderdoc.json values, then - // add our own, even if it was there before. - foreach (var n in names) - if (n.IndexOf("renderdoc.json") > 0) - key.DeleteValue(n); - - key.SetValue(GetVulkanJSONPath(false), (uint)0, RegistryValueKind.DWord); - } - - // if we're 64-bit update that too. For 32-bit the above path covers it. - if (Environment.Is64BitProcess) - { - key = GetVulkanImplicitLayersKey(true, true); - - if (key != null) - { - string[] names = key.GetValueNames(); - - // for simplicity we just delete *all* renderdoc.json values, then - // add our own, even if it was there before. - foreach (var n in names) - if (n.IndexOf("renderdoc.json") > 0) - key.DeleteValue(n); - - key.SetValue(GetVulkanJSONPath(true), (uint)0, RegistryValueKind.DWord); - } - } - } - } - - // KeyValuePair isn't serializable, so we make our own that is - [Serializable] - public struct SerializableKeyValuePair - { - public SerializableKeyValuePair(K k, V v) : this() { Key = k; Value = v; } - - public K Key - { get; set; } - - public V Value - { get; set; } - } -} diff --git a/renderdocui/Code/LogViewerForm.cs b/renderdocui/Code/LogViewerForm.cs deleted file mode 100644 index 40de88c6d..000000000 --- a/renderdocui/Code/LogViewerForm.cs +++ /dev/null @@ -1,46 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace renderdocui.Code -{ - public interface ILogViewerForm - { - void OnLogfileLoaded(); - void OnLogfileClosed(); - void OnEventSelected(UInt32 eventID); - } - - public interface ILogLoadProgressListener - { - void LogfileProgressBegin(); - void LogfileProgress(float progress); - } -} diff --git a/renderdocui/Code/PersistantConfig.cs b/renderdocui/Code/PersistantConfig.cs deleted file mode 100644 index 25c2571bb..000000000 --- a/renderdocui/Code/PersistantConfig.cs +++ /dev/null @@ -1,436 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Threading; -using System.Xml; -using System.Xml.Serialization; -using renderdoc; -using System.Windows.Forms; - -namespace renderdocui.Code -{ - [Serializable] - public class RemoteHost - { - public string Hostname = ""; - public string RunCommand = ""; - - [XmlIgnore] - public bool ServerRunning = false; - [XmlIgnore] - public bool Connected = false; - [XmlIgnore] - public bool Busy = false; - [XmlIgnore] - public bool VersionMismatch = false; - - public void CheckStatus() - { - // special case - this is the local context - if (Hostname == "localhost") - { - ServerRunning = false; - VersionMismatch = Busy = false; - return; - } - - try - { - RemoteServer server = StaticExports.CreateRemoteServer(Hostname, 0); - ServerRunning = true; - VersionMismatch = Busy = false; - server.ShutdownConnection(); - - // since we can only have one active client at once on a remote server, we need - // to avoid DDOS'ing by doing multiple CheckStatus() one after the other so fast - // that the active client can't be properly shut down. Sleeping here for a short - // time gives that breathing room. - // Not the most elegant solution, but it is simple - - Thread.Sleep(15); - } - catch (ReplayCreateException ex) - { - if (ex.Status == ReplayCreateStatus.NetworkRemoteBusy) - { - ServerRunning = true; - Busy = true; - } - else if (ex.Status == ReplayCreateStatus.NetworkVersionMismatch) - { - ServerRunning = true; - Busy = true; - VersionMismatch = true; - } - else - { - ServerRunning = false; - Busy = false; - } - } - } - - public void Launch() - { - try - { - System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo("cmd.exe"); - startInfo.CreateNoWindow = true; - startInfo.UseShellExecute = false; - startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; - startInfo.Arguments = "/C " + RunCommand; - System.Diagnostics.Process cmd = System.Diagnostics.Process.Start(startInfo); - - // wait up to 2s for the command to exit - cmd.WaitForExit(2000); - } - catch (Exception) - { - MessageBox.Show(String.Format("Error running command to launch remote server:\n{0}", RunCommand), - "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - - [Serializable] - public class ExternalDisassembler - { - //indicates to the system that this placeholder points to the SPIR-V binary - [NonSerialized] - public static readonly string SPV_BIN_TAG = "{spv_bin}"; - //indicates to the system that this placeholder points to the disassembled SPIR-V - [NonSerialized] - public static readonly string SPV_DISAS_TAG = "{spv_disas}"; - //The TAGs below are for future usage to help identify in the argument list, - //the shader entry point and the shader stage (for flexibility) - [NonSerialized] - public static readonly string SPV_ENTRY_POINT_TAG = "{spv_entry_point}"; - [NonSerialized] - public static readonly string SPV_SHADER_STAGE_TAG = "{spv_shader_stage}"; - - public ExternalDisassembler(uint id, string name, - string executable, string args) - { - this.id = id; - this.name = name; - this.executable = executable; - this.args = args; - } - - protected ExternalDisassembler() - { - - } - - public uint id { get; set; } - public string name { get; set; } - public string executable { get; set; } - public string args { get; set; } - - public override bool Equals(object obj) - { - return obj.GetType() == typeof(ExternalDisassembler) && id == ((ExternalDisassembler)obj).id; - } - - public override int GetHashCode() - { - return GetType().GetHashCode() ^ id.GetHashCode(); - } - } - - [Serializable] - public class PersistantConfig - { - public string LastLogPath = ""; - public List RecentLogFiles = new List(); - public string LastCapturePath = ""; - public string LastCaptureExe = ""; - public List RecentCaptureSettings = new List(); - public string AdbExecutablePath = ""; - public uint MaxConnectTimeout = 30; - - // for historical reasons, this was named CaptureSavePath - [XmlElement("CaptureSavePath")] - public string TemporaryCaptureDirectory = ""; - public string DefaultCaptureSaveDirectory = ""; - - //The list should contain all the pre-configured, external, SPIR-V disassemblers - [XmlIgnore] // not directly serializable - private Dictionary ExternalDisassemblers = new Dictionary(); - public List> ExternalDisassemblersValues = new List>(); - public bool ExternalDisassemblerEnabled = false; - - public void SetExternalDisassemblers(int id, ExternalDisassembler value) - { - ExternalDisassemblers[id] = value; - } - - public ExternalDisassembler GetExternalDisassembler(int id) - { - if (ExternalDisassemblers.ContainsKey(id)) - return ExternalDisassemblers[id]; - - return null; - } - - //the default disassembler is at 0 - public ExternalDisassembler GetDefaultExternalDisassembler() - { - if(!ExternalDisassemblers.ContainsKey(0)) - { - //Add default external disassembler at key 0 - ExternalDisassemblers.Add(0, new ExternalDisassembler(0, "SPIRV-Cross", "", "")); - } - return ExternalDisassemblers[0]; - } - - public bool TextureViewer_ResetRange = false; - public bool TextureViewer_PerTexSettings = true; - public bool ShaderViewer_FriendlyNaming = true; - - public bool AlwaysReplayLocally = false; - public List RemoteHosts = new List(); - - public int LocalProxy = 0; - - [XmlIgnore] // not directly serializable - public Dictionary ConfigSettings = new Dictionary(); - public List> ConfigSettingsValues = new List>(); - - public void SetConfigSetting(string name, string value) - { - ConfigSettings[name] = value; - StaticExports.SetConfigSetting(name, value); - } - - public string GetConfigSetting(string name) - { - if(ConfigSettings.ContainsKey(name)) - return ConfigSettings[name]; - - return ""; - } - - public enum TimeUnit - { - Seconds = 0, - Milliseconds, - Microseconds, - Nanoseconds, - }; - - public static String UnitPrefix(TimeUnit t) - { - if (t == TimeUnit.Seconds) - return "s"; - else if (t == TimeUnit.Milliseconds) - return "ms"; - else if (t == TimeUnit.Microseconds) - return "µs"; - else if (t == TimeUnit.Nanoseconds) - return "ns"; - - return "s"; - } - - public TimeUnit EventBrowser_TimeUnit = TimeUnit.Microseconds; - public bool EventBrowser_HideEmpty = false; - public bool EventBrowser_HideAPICalls = false; - - public bool EventBrowser_ApplyColours = true; - public bool EventBrowser_ColourEventRow = true; - - public bool EventBrowser_AddFake = true; - - public int Formatter_MinFigures = 2; - public int Formatter_MaxFigures = 5; - public int Formatter_NegExp = 5; - public int Formatter_PosExp = 7; - - public bool Font_PreferMonospaced = false; - - [XmlIgnore] // not directly serializable - public System.Drawing.Font PreferredFont - { - get; - private set; - } - - public bool CheckUpdate_AllowChecks = true; - public bool CheckUpdate_UpdateAvailable = false; - public string CheckUpdate_UpdateResponse = ""; - public DateTime CheckUpdate_LastUpdate = new DateTime(2012, 06, 27); - - public DateTime DegradedLog_LastUpdate = new DateTime(2015, 01, 01); - - public bool Tips_SeenFirst = false; - - public bool AllowGlobalHook = false; - - public void SetupFormatting() - { - Formatter.MinFigures = Formatter_MinFigures; - Formatter.MaxFigures = Formatter_MaxFigures; - Formatter.ExponentialNegCutoff = Formatter_NegExp; - Formatter.ExponentialPosCutoff = Formatter_PosExp; - - PreferredFont = Font_PreferMonospaced - ? new System.Drawing.Font("Consolas", 9.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))) - : new System.Drawing.Font("Tahoma", 8.25F); - } - - public void AddRecentFile(List recentList, string file, int maxItems) - { - if (!recentList.Contains(Path.GetFullPath(file))) - { - recentList.Add(Path.GetFullPath(file)); - if (recentList.Count >= maxItems) - recentList.RemoveAt(0); - } - else - { - recentList.Remove(Path.GetFullPath(file)); - recentList.Add(Path.GetFullPath(file)); - } - } - - public PersistantConfig() - { - RecentLogFiles.Clear(); - RecentCaptureSettings.Clear(); - } - - public bool ReadOnly = false; - - public void Serialize(string file) - { - if (ReadOnly) return; - - StaticExports.SetConfigSetting("Disassembly_FriendlyNaming", - ShaderViewer_FriendlyNaming ? "1" : "0"); - - try - { - ConfigSettingsValues.Clear(); - foreach (var kv in ConfigSettings) - ConfigSettingsValues.Add(new SerializableKeyValuePair(kv.Key, kv.Value)); - - //external disassemblers - ExternalDisassemblersValues.Clear(); - foreach (var kv in ExternalDisassemblers) - ExternalDisassemblersValues.Add(new SerializableKeyValuePair(kv.Key, kv.Value)); - - XmlSerializer xs = new XmlSerializer(this.GetType()); - StreamWriter writer = File.CreateText(file); - xs.Serialize(writer, this); - writer.Flush(); - writer.Close(); - } - catch (System.IO.IOException ex) - { - // Can't recover, but let user know that we couldn't save their settings. - MessageBox.Show(String.Format("Error saving config file: {1}\n{0}", file, ex.Message)); - } - } - - public static PersistantConfig Deserialize(string file) - { - XmlSerializer xs = new XmlSerializer(typeof(PersistantConfig)); - StreamReader reader = File.OpenText(file); - PersistantConfig c = (PersistantConfig)xs.Deserialize(reader); - reader.Close(); - - StaticExports.SetConfigSetting("Disassembly_FriendlyNaming", - c.ShaderViewer_FriendlyNaming ? "1" : "0"); - - foreach (var kv in c.ConfigSettingsValues) - { - if (kv.Key != null && kv.Key.Length > 0 && - kv.Value != null) - { - c.SetConfigSetting(kv.Key, kv.Value); - } - } - - //external disassemblers - foreach (var kv in c.ExternalDisassemblersValues) - { - if (kv.Key >= 0 && kv.Value != null) - { - c.SetExternalDisassemblers(kv.Key, kv.Value); - } - } - - // localhost should always be available - bool foundLocalhost = false; - - for (int i = 0; i < c.RemoteHosts.Count; i++) - { - if (c.RemoteHosts[i].Hostname == "localhost") - { - foundLocalhost = true; - break; - } - } - - if (!foundLocalhost) - { - RemoteHost host = new RemoteHost(); - host.Hostname = "localhost"; - c.RemoteHosts.Add(host); - } - - return c; - } - - public void AddAndroidHosts() - { - for (int i = RemoteHosts.Count - 1; i >= 0; i--) - { - if (RemoteHosts[i].Hostname.StartsWith("adb:")) - RemoteHosts.RemoveAt(i); - } - - string adbExePath = File.Exists(AdbExecutablePath) ? AdbExecutablePath : ""; - - // Set the config setting as it will be reused when we start the remoteserver etc. - StaticExports.SetConfigSetting("adbExePath", adbExePath); - - string[] androidHosts = StaticExports.EnumerateAndroidDevices(); - foreach(string hostName in androidHosts) - { - RemoteHost host = new RemoteHost(); - host.Hostname = hostName; - RemoteHosts.Add(host); - } - } - } -} diff --git a/renderdocui/Code/RenderManager.cs b/renderdocui/Code/RenderManager.cs deleted file mode 100644 index 812e02a94..000000000 --- a/renderdocui/Code/RenderManager.cs +++ /dev/null @@ -1,691 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Reflection; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using renderdoc; - -namespace renderdocui.Code -{ - public delegate void InvokeMethod(ReplayRenderer r); - - // this class owns the thread that interacts with the main library, to ensure that we don't - // have to worry elsewhere about threading access. Elsewhere in the UI you can do Invoke or - // BeginInvoke and get a ReplayRenderer reference back to access through - public class RenderManager - { - private class InvokeHandle - { - public InvokeHandle(string t, InvokeMethod m) - { - tag = t; - method = m; - processed = false; - } - - public InvokeHandle(InvokeMethod m) - { - tag = ""; - method = m; - processed = false; - } - - public string tag; - public InvokeMethod method; - public bool paintInvoke = false; - volatile public bool processed; - public Exception ex = null; - }; - - //////////////////////////////////////////// - // variables - - private AutoResetEvent m_WakeupEvent = new AutoResetEvent(false); - private Thread m_Thread; - private string m_Logfile; - private bool m_Running; - private RemoteHost m_RemoteHost = null; - private RemoteServer m_Remote = null; - - private List m_renderQueue; - private InvokeHandle m_current = null; - - //////////////////////////////////////////// - // Interface - - public RenderManager() - { - Running = false; - - m_renderQueue = new List(); - } - - public void OpenCapture(string logfile) - { - if(Running) - return; - - m_Logfile = logfile; - - LoadProgress = 0.0f; - - InitException = null; - - m_Thread = Helpers.NewThread(new ThreadStart(this.RunThread)); - m_Thread.Priority = ThreadPriority.Highest; - m_Thread.Start(); - - while (m_Thread.IsAlive && !Running) ; - } - - public UInt32 ExecuteAndInject(string app, string workingDir, string cmdLine, EnvironmentModification[] env, string logfile, CaptureOptions opts) - { - if (m_Remote == null) - { - return StaticExports.ExecuteAndInject(app, workingDir, cmdLine, env, logfile, opts); - } - else - { - UInt32 ret = 0; - - lock (m_Remote) - { - ret = m_Remote.ExecuteAndInject(app, workingDir, cmdLine, env, opts); - } - - return ret; - } - } - - public void DeleteCapture(string logfile, bool local) - { - if (Running) - { - BeginInvoke((ReplayRenderer r) => { DeleteCapture(logfile, local); }); - return; - } - - if (local) - { - try - { - System.IO.File.Delete(logfile); - } - catch (Exception) - { - } - } - else - { - // this will be cleaned up automatically when the remote connection - // is closed. - if (m_Remote != null) - m_Remote.TakeOwnershipCapture(logfile); - } - } - - public string[] GetRemoteSupport() - { - string[] ret = new string[0]; - - if (m_Remote != null && !Running) - { - lock (m_Remote) - { - ret = m_Remote.RemoteSupportedReplays(); - } - } - - return ret; - } - - public delegate void DirectoryBrowseMethod(string path, DirectoryFile[] contents); - - public void GetHomeFolder(DirectoryBrowseMethod cb) - { - if (m_Remote != null) - { - if (Running && m_Thread != Thread.CurrentThread) - { - BeginInvoke((ReplayRenderer r) => { cb(m_Remote.GetHomeFolder(), null); }); - return; - } - - string home = ""; - - // prevent pings while fetching remote FS data - lock (m_Remote) - { - home = m_Remote.GetHomeFolder(); - } - - cb(home, null); - } - } - - public bool ListFolder(string path, DirectoryBrowseMethod cb) - { - if (m_Remote != null) - { - if (Running && m_Thread != Thread.CurrentThread) - { - BeginInvoke((ReplayRenderer r) => { cb(path, m_Remote.ListFolder(path)); }); - return true; - } - - DirectoryFile[] contents = new DirectoryFile[0]; - - // prevent pings while fetching remote FS data - lock(m_Remote) - { - contents = m_Remote.ListFolder(path); - } - - cb(path, contents); - - return true; - } - - return false; - } - - public string CopyCaptureToRemote(string localpath, Form window) - { - if (m_Remote != null) - { - bool copied = false; - float progress = 0.0f; - - renderdocui.Windows.ProgressPopup modal = - new renderdocui.Windows.ProgressPopup( - (renderdocui.Windows.ModalCloseCallback)(() => { return copied; }), - true); - modal.SetModalText("Transferring..."); - - Thread progressThread = Helpers.NewThread(new ThreadStart(() => - { - modal.LogfileProgressBegin(); - - while (!copied) - { - Thread.Sleep(2); - - modal.LogfileProgress(progress); - } - })); - progressThread.Start(); - - string remotepath = ""; - - // we should never have the thread running at this point, but let's be safe. - if (Running) - { - BeginInvoke((ReplayRenderer r) => - { - remotepath = m_Remote.CopyCaptureToRemote(localpath, ref progress); - - copied = true; - }); - } - else - { - Helpers.NewThread(new ThreadStart(() => - { - // prevent pings while copying off-thread - lock (m_Remote) - { - remotepath = m_Remote.CopyCaptureToRemote(localpath, ref progress); - } - - copied = true; - })).Start(); - } - - modal.ShowDialog(window); - - return remotepath; - } - - // if we don't have a remote connection we can't copy - throw new ApplicationException(); - } - - public void CopyCaptureFromRemote(string remotepath, string localpath, Form window) - { - if (m_Remote != null) - { - bool copied = false; - float progress = 0.0f; - - renderdocui.Windows.ProgressPopup modal = - new renderdocui.Windows.ProgressPopup( - (renderdocui.Windows.ModalCloseCallback)(() => { return copied; }), - true); - modal.SetModalText("Transferring..."); - - Thread progressThread = Helpers.NewThread(new ThreadStart(() => - { - modal.LogfileProgressBegin(); - - while (!copied) - { - Thread.Sleep(2); - - modal.LogfileProgress(progress); - } - })); - progressThread.Start(); - - if (Running) - { - BeginInvoke((ReplayRenderer r) => - { - m_Remote.CopyCaptureFromRemote(remotepath, localpath, ref progress); - - copied = true; - }); - } - else - { - Helpers.NewThread(new ThreadStart(() => - { - // prevent pings while copying off-thread - lock (m_Remote) - { - m_Remote.CopyCaptureFromRemote(remotepath, localpath, ref progress); - } - - copied = true; - })).Start(); - } - - modal.ShowDialog(window); - - // if the copy didn't succeed, throw - if (!System.IO.File.Exists(localpath)) - throw new System.IO.FileNotFoundException("File couldn't be transferred from remote host", remotepath); - } - else - { - System.IO.File.Copy(remotepath, localpath, true); - } - } - - public bool Running - { - get { return m_Running; } - set { m_Running = value; m_WakeupEvent.Set(); } - } - - public RemoteHost Remote - { - get { return m_RemoteHost; } - } - - public void ConnectToRemoteServer(RemoteHost host) - { - InitException = null; - - try - { - m_Remote = StaticExports.CreateRemoteServer(host.Hostname, 0); - m_RemoteHost = host; - m_RemoteHost.Connected = true; - } - catch (ReplayCreateException ex) - { - InitException = ex; - } - } - - public void DisconnectFromRemoteServer() - { - if (m_RemoteHost != null) - m_RemoteHost.Connected = false; - - if (m_Remote != null) - m_Remote.ShutdownConnection(); - - m_RemoteHost = null; - m_Remote = null; - } - - public void ShutdownServer() - { - if(m_Remote != null) - m_Remote.ShutdownServerAndConnection(); - - m_Remote = null; - } - - public void PingRemote() - { - if (m_Remote == null) - return; - - if (Monitor.TryEnter(m_Remote)) - { - try - { - // must only happen on render thread if running - if ((!Running || m_Thread == Thread.CurrentThread) && m_Remote != null) - { - if (!m_Remote.Ping()) - m_RemoteHost.ServerRunning = false; - } - } - finally - { - Monitor.Exit(m_Remote); - } - } - } - - public void CancelReplayLoop() - { - if (m_Thread == null || !Running) - return; - - m_Renderer.CancelReplayLoop(); - } - - public ReplayCreateException InitException = null; - - public void CloseThreadSync() - { - Running = false; - - while (m_Thread != null && m_Thread.IsAlive) ; - - m_renderQueue = new List(); - m_current = null; - } - - public float LoadProgress; - - [ThreadStatic] - private bool CatchExceptions = false; - - public void SetExceptionCatching(bool catching) - { - CatchExceptions = catching; - } - - // this tagged version is for cases when we might send a request - e.g. to pick a vertex or pixel - // - and want to pre-empt it with a new request before the first has returned. Either because some - // other work is taking a while or because we're sending requests faster than they can be - // processed. - // the manager processes only the request on the top of the queue, so when a new tagged invoke - // comes in, we remove any other requests in the queue before it that have the same tag - public void BeginInvoke(string tag, InvokeMethod m) - { - InvokeHandle cmd = new InvokeHandle(tag, m); - - if (tag != "") - { - lock (m_renderQueue) - { - bool added = false; - - for (int i = 0; i < m_renderQueue.Count;) - { - if (m_renderQueue[i].tag == tag) - { - m_renderQueue[i].processed = true; - if (!added) - { - m_renderQueue[i] = cmd; - added = true; - } - else - { - m_renderQueue.RemoveAt(i); - } - } - else - { - i++; - } - } - - if (!added) - m_renderQueue.Add(cmd); - } - - m_WakeupEvent.Set(); - } - else - { - PushInvoke(cmd); - } - } - - public void BeginInvoke(InvokeMethod m) - { - InvokeHandle cmd = new InvokeHandle(m); - - PushInvoke(cmd); - } - - public void Invoke(InvokeMethod m) - { - InvokeHandle cmd = new InvokeHandle(m); - - PushInvoke(cmd); - - while (!cmd.processed) ; - - if (cmd.ex != null) - throw cmd.ex; - } - - public void InvokeForPaint(string tag, InvokeMethod m) - { - if (m_Thread == null || !Running) - return; - - // special logic for painting invokes. Normally we want these to - // go off immediately, but if we have a remote connection active - // there could be slow operations on the pipe or currently being - // processed. - // So we check to see if the paint is likely to finish soon - // (0, or only other paint invokes on the queue, nothing active) - // and if so do it synchronously. Otherwise we just append to the - // queue and return immediately. - - bool waitable = true; - - InvokeHandle cmd = new InvokeHandle(tag, m); - cmd.paintInvoke = true; - - lock (m_renderQueue) - { - InvokeHandle current = m_current; - - if (current != null && !current.paintInvoke) - waitable = false; - - // any non-painting commands on the queue? can't wait - for (int i = 0; waitable && i < m_renderQueue.Count; i++) - if (!m_renderQueue[i].paintInvoke) - waitable = false; - - // remove any duplicated paints if we have a tag - bool added = false; - - if (tag != "") - { - for (int i = 0; i < m_renderQueue.Count;) - { - if (m_renderQueue[i].tag == tag) - { - m_renderQueue[i].processed = true; - if (!added) - { - m_renderQueue[i] = cmd; - added = true; - } - else - { - m_renderQueue.RemoveAt(i); - } - } - else - { - i++; - } - } - } - - if (!added) - m_renderQueue.Add(cmd); - } - - m_WakeupEvent.Set(); - - if (!waitable) - return; - - while (!cmd.processed) ; - - if (cmd.ex != null) - throw cmd.ex; - } - - private void PushInvoke(InvokeHandle cmd) - { - if (m_Thread == null || !Running) - { - cmd.processed = true; - return; - } - - lock (m_renderQueue) - { - m_renderQueue.Add(cmd); - } - - m_WakeupEvent.Set(); - } - - //////////////////////////////////////////// - // Internals - - private ReplayRenderer CreateReplayRenderer() - { - if (m_Remote != null) - return m_Remote.OpenCapture(-1, m_Logfile, ref LoadProgress); - else - return StaticExports.CreateReplayRenderer(m_Logfile, ref LoadProgress); - } - - private void DestroyReplayRenderer(ReplayRenderer renderer) - { - if (m_Remote != null) - m_Remote.CloseCapture(renderer); - else - renderer.Shutdown(); - } - - private ReplayRenderer m_Renderer; - - private void RunThread() - { - try - { - m_Renderer = CreateReplayRenderer(); - if(m_Renderer != null) - { - System.Diagnostics.Debug.WriteLine("Renderer created"); - - Running = true; - - m_current = null; - - while (Running) - { - lock (m_renderQueue) - { - if (m_renderQueue.Count > 0) - { - m_current = m_renderQueue[0]; - m_renderQueue.RemoveAt(0); - } - } - - if(m_current == null) - { - m_WakeupEvent.WaitOne(10); - continue; - } - - if (m_current.method != null) - { - if (CatchExceptions) - { - try - { - m_current.method(m_Renderer); - } - catch (Exception ex) - { - m_current.ex = ex; - } - } - else - { - m_current.method(m_Renderer); - } - } - - m_current.processed = true; - m_current = null; - } - - lock (m_renderQueue) - { - foreach (var cmd in m_renderQueue) - cmd.processed = true; - - m_renderQueue.Clear(); - } - - DestroyReplayRenderer(m_Renderer); - } - } - catch (ReplayCreateException ex) - { - InitException = ex; - } - } - } -} diff --git a/renderdocui/Code/Win32PInvoke.cs b/renderdocui/Code/Win32PInvoke.cs deleted file mode 100644 index bb6aa52da..000000000 --- a/renderdocui/Code/Win32PInvoke.cs +++ /dev/null @@ -1,158 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.InteropServices; - -namespace renderdocui.Code -{ - class Win32PInvoke - { - [DllImport("kernel32", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern IntPtr LoadLibrary(string lpFileName); - [DllImport("kernel32", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern IntPtr GetModuleHandle(string lpFileName); - - [StructLayout(LayoutKind.Sequential)] - public struct POINT - { - public int X; - public int Y; - - public POINT(int x, int y) - { - this.X = x; - this.Y = y; - } - } - - // for redirecting mousewheel - [DllImport("user32.dll")] - public static extern IntPtr WindowFromPoint(POINT pt); - [DllImport("user32.dll")] - public static extern IntPtr SendMessage(IntPtr wnd, int msg, IntPtr wp, IntPtr lp); - - // windows message from winuser.h - public enum Win32Message - { - WM_MOUSEWHEEL = 0x020A, - TCM_ADJUSTRECT = 0x1328, - }; - - [Flags] - public enum HChangeNotifyEventID - { - SHCNE_ALLEVENTS = 0x7FFFFFFF, - SHCNE_ASSOCCHANGED = 0x08000000, - SHCNE_ATTRIBUTES = 0x00000800, - SHCNE_CREATE = 0x00000002, - SHCNE_DELETE = 0x00000004, - SHCNE_DRIVEADD = 0x00000100, - SHCNE_DRIVEADDGUI = 0x00010000, - SHCNE_DRIVEREMOVED = 0x00000080, - SHCNE_EXTENDED_EVENT = 0x04000000, - SHCNE_FREESPACE = 0x00040000, - SHCNE_MEDIAINSERTED = 0x00000020, - SHCNE_MEDIAREMOVED = 0x00000040, - SHCNE_MKDIR = 0x00000008, - SHCNE_NETSHARE = 0x00000200, - SHCNE_NETUNSHARE = 0x00000400, - SHCNE_RENAMEFOLDER = 0x00020000, - SHCNE_RENAMEITEM = 0x00000001, - SHCNE_RMDIR = 0x00000010, - SHCNE_SERVERDISCONNECT = 0x00004000, - SHCNE_UPDATEDIR = 0x00001000, - SHCNE_UPDATEIMAGE = 0x00008000, - } - - [Flags] - public enum HChangeNotifyFlags - { - SHCNF_DWORD = 0x0003, - SHCNF_IDLIST = 0x0000, - SHCNF_PATHA = 0x0001, - SHCNF_PATHW = 0x0005, - SHCNF_PRINTERA = 0x0002, - SHCNF_PRINTERW = 0x0006, - SHCNF_FLUSH = 0x1000, - SHCNF_FLUSHNOWAIT = 0x2000, - SHCNF_NOTIFYRECURSIVE = 0x10000, - } - - [DllImport("shell32.dll")] - public static extern void SHChangeNotify(HChangeNotifyEventID wEventId, HChangeNotifyFlags uFlags, IntPtr dwItem1, IntPtr dwItem2); - - [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] - private static extern uint GetShortPathName(string lpszLongPath, char[] lpszShortPath, int cchBuffer); - - public static string ShortPath(string longpath) - { - char[] buffer = new char[256]; - - GetShortPathName(longpath, buffer, buffer.Length); - - return new string(buffer); - } - - [DllImport("mpr.dll", CharSet = CharSet.Unicode)] - private static extern uint WNetGetUniversalNameW(string lpLocalPath, int dwInfoLevel, IntPtr lpBuffer, ref int lpBufferSize); - private const int UNIVERSAL_NAME_INFO_LEVEL = 0x00000001; - private const uint ERROR_MORE_DATA = 234; - - public static string GetUniversalName(string localPath) - { - int size = 0; - - IntPtr buf = (IntPtr)IntPtr.Size; // don't initialise to zero, as otherwise the call fails - - uint ret = WNetGetUniversalNameW(localPath, UNIVERSAL_NAME_INFO_LEVEL, buf, ref size); - - if (ret != ERROR_MORE_DATA) - return localPath; - - buf = Marshal.AllocHGlobal(size); - - ret = WNetGetUniversalNameW(localPath, UNIVERSAL_NAME_INFO_LEVEL, buf, ref size); - - string universalPath = localPath; - - if (ret == 0) - { - // buf points to a struct that contains just a string pointer, that points - // immediately after it. So we need to advance by one IntPtr to get to the - // actual string - universalPath = Marshal.PtrToStringUni(IntPtr.Add(buf, IntPtr.Size)); - } - - Marshal.FreeHGlobal(buf); - - return universalPath; - } - } -} diff --git a/renderdocui/Controls/BufferFormatSpecifier.Designer.cs b/renderdocui/Controls/BufferFormatSpecifier.Designer.cs deleted file mode 100644 index 1bbaf8431..000000000 --- a/renderdocui/Controls/BufferFormatSpecifier.Designer.cs +++ /dev/null @@ -1,156 +0,0 @@ -namespace renderdocui.Windows.Dialogs -{ - partial class BufferFormatSpecifier - { - /// - /// 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() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BufferFormatSpecifier)); - this.formatGroupBox = new System.Windows.Forms.GroupBox(); - this.formatText = new System.Windows.Forms.TextBox(); - this.helpText = new System.Windows.Forms.Label(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.errors = new System.Windows.Forms.Label(); - this.apply = new System.Windows.Forms.Button(); - this.toggleHelp = new System.Windows.Forms.Button(); - this.formatGroupBox.SuspendLayout(); - this.tableLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // formatGroupBox - // - this.formatGroupBox.Controls.Add(this.formatText); - this.formatGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.formatGroupBox.Location = new System.Drawing.Point(3, 175); - this.formatGroupBox.Name = "formatGroupBox"; - this.formatGroupBox.Size = new System.Drawing.Size(448, 257); - this.formatGroupBox.TabIndex = 0; - this.formatGroupBox.TabStop = false; - this.formatGroupBox.Text = "Format"; - // - // formatText - // - this.formatText.Dock = System.Windows.Forms.DockStyle.Fill; - this.formatText.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.formatText.Location = new System.Drawing.Point(3, 16); - this.formatText.Multiline = true; - this.formatText.Name = "formatText"; - this.formatText.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.formatText.Size = new System.Drawing.Size(442, 238); - this.formatText.TabIndex = 0; - this.formatText.Text = "float4 asd; // blah blah\r\nfloat3 bar;"; - this.formatText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.formatText_KeyDown); - // - // helpText - // - this.helpText.AutoSize = true; - this.helpText.Location = new System.Drawing.Point(8, 8); - this.helpText.Margin = new System.Windows.Forms.Padding(8); - this.helpText.Name = "helpText"; - this.helpText.Size = new System.Drawing.Size(428, 156); - this.helpText.TabIndex = 1; - this.helpText.Text = resources.GetString("helpText.Text"); - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.Controls.Add(this.formatGroupBox, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.helpText, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.errors, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.apply, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.toggleHelp, 1, 0); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 3; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.Size = new System.Drawing.Size(535, 481); - this.tableLayoutPanel1.TabIndex = 0; - // - // errors - // - this.tableLayoutPanel1.SetColumnSpan(this.errors, 2); - this.errors.Dock = System.Windows.Forms.DockStyle.Fill; - this.errors.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.errors.ForeColor = System.Drawing.Color.DarkRed; - this.errors.Location = new System.Drawing.Point(3, 435); - this.errors.Name = "errors"; - this.errors.Size = new System.Drawing.Size(529, 46); - this.errors.TabIndex = 3; - // - // apply - // - this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.apply.Location = new System.Drawing.Point(464, 404); - this.apply.Margin = new System.Windows.Forms.Padding(8); - this.apply.Name = "apply"; - this.apply.Size = new System.Drawing.Size(63, 23); - this.apply.TabIndex = 1; - this.apply.Text = "Apply"; - this.apply.UseVisualStyleBackColor = true; - this.apply.Click += new System.EventHandler(this.apply_Click); - // - // toggleHelp - // - this.toggleHelp.Location = new System.Drawing.Point(457, 3); - this.toggleHelp.Name = "toggleHelp"; - this.toggleHelp.Size = new System.Drawing.Size(75, 23); - this.toggleHelp.TabIndex = 4; - this.toggleHelp.Text = "Toggle Help"; - this.toggleHelp.UseVisualStyleBackColor = true; - this.toggleHelp.Click += new System.EventHandler(this.toggleHelp_Click); - // - // BufferFormatSpecifier - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.tableLayoutPanel1); - this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Name = "BufferFormatSpecifier"; - this.Size = new System.Drawing.Size(535, 481); - this.formatGroupBox.ResumeLayout(false); - this.formatGroupBox.PerformLayout(); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.TextBox formatText; - private System.Windows.Forms.Button apply; - private System.Windows.Forms.Label errors; - private System.Windows.Forms.Button toggleHelp; - private System.Windows.Forms.Label helpText; - private System.Windows.Forms.GroupBox formatGroupBox; - } -} \ No newline at end of file diff --git a/renderdocui/Controls/BufferFormatSpecifier.cs b/renderdocui/Controls/BufferFormatSpecifier.cs deleted file mode 100644 index c3dba3e21..000000000 --- a/renderdocui/Controls/BufferFormatSpecifier.cs +++ /dev/null @@ -1,113 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using WeifenLuo.WinFormsUI.Docking; -using renderdoc; - -namespace renderdocui.Windows.Dialogs -{ - public partial class BufferFormatSpecifier : UserControl - { - IBufferFormatProcessor m_Viewer = null; - - public BufferFormatSpecifier(IBufferFormatProcessor viewer, string format) - { - InitializeComponent(); - - // WHY THE HELL do you require \r\n in text boxes? - formatText.Text = format.Replace("\r\n", "\n").Replace("\n", Environment.NewLine); - - errors.Visible = false; - - m_Viewer = viewer; - } - - private void apply_Click(object sender, EventArgs e) - { - SetErrors(""); - m_Viewer.ProcessBufferFormat(formatText.Text); - } - - public void SetErrors(string err) - { - errors.Text = err; - if (errors.Text.Length == 0) - errors.Visible = false; - else - errors.Visible = true; - } - - private void formatText_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.A && e.Control) - { - e.SuppressKeyPress = true; - formatText.SelectAll(); - } - } - - public void ToggleHelp() - { - helpText.Visible = !helpText.Visible; - - tableLayoutPanel1.SuspendLayout(); - - if (helpText.Visible) - { - tableLayoutPanel1.Controls.Remove(formatGroupBox); - tableLayoutPanel1.Controls.Add(formatGroupBox, 0, 1); - tableLayoutPanel1.SetRowSpan(formatGroupBox, 1); - } - else - { - tableLayoutPanel1.Controls.Remove(formatGroupBox); - tableLayoutPanel1.Controls.Add(formatGroupBox, 0, 0); - tableLayoutPanel1.SetRowSpan(formatGroupBox, 2); - } - - tableLayoutPanel1.ResumeLayout(false); - tableLayoutPanel1.PerformLayout(); - } - - private void toggleHelp_Click(object sender, EventArgs e) - { - ToggleHelp(); - } - } - - public interface IBufferFormatProcessor - { - void ProcessBufferFormat(string formatText); - } -} diff --git a/renderdocui/Controls/BufferFormatSpecifier.resx b/renderdocui/Controls/BufferFormatSpecifier.resx deleted file mode 100644 index 5062db335..000000000 --- a/renderdocui/Controls/BufferFormatSpecifier.resx +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - Type in a buffer format declaration. Comments and {} braces are skipped, : semantics are ignored. -Declare each element as an hlsl/glsl variable, e.g: "float4 first; float2 second; uint2 third;" or vec4/vec2. - -Basic types accepted: bool, byte, short, int, half, float, double. -Unsigned integer types: ubyte, ushort, uint -Hex-formatted integer types: xbyte, xshort, xint - -Additionally special formats: unorm[hb] (half, byte) and snorm[hb], uintten/unormten (10:10:10:2 packing), floateleven (11:11:10F packing) - -Vectors (e.g. float4), matrices ([row_major] half3x4) and arrays (float[16]) are supported. - - \ No newline at end of file diff --git a/renderdocui/Controls/DoubleClickSplitter.Designer.cs b/renderdocui/Controls/DoubleClickSplitter.Designer.cs deleted file mode 100644 index e430afdf3..000000000 --- a/renderdocui/Controls/DoubleClickSplitter.Designer.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace renderdocui.Controls -{ - partial class DoubleClickSplitter - { - /// - /// 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 Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - } - - #endregion - } -} diff --git a/renderdocui/Controls/DoubleClickSplitter.cs b/renderdocui/Controls/DoubleClickSplitter.cs deleted file mode 100644 index 052e5d331..000000000 --- a/renderdocui/Controls/DoubleClickSplitter.cs +++ /dev/null @@ -1,235 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -namespace renderdocui.Controls -{ - public partial class DoubleClickSplitter : SplitContainer - { - public DoubleClickSplitter() - { - InitializeComponent(); - - SplitterMoving += new SplitterCancelEventHandler(OnSplitterMoving); - } - - private int m_PanelMinsize = 0; - private int m_SplitterDistance = 0; - - private bool m_Panel1Collapse = true; - - [Description("If the first panel should be the one to collapse"), Category("Behavior")] - [DefaultValue(typeof(bool), "true")] - public bool Panel1Collapse { get { return m_Panel1Collapse; } set { m_Panel1Collapse = value; } } - - private bool m_Collapsed = false; - [Browsable(false)] - public bool Collapsed - { - get - { - return m_Collapsed; - } - set - { - if (m_Collapsed != value) - { - if (value) - { - m_PanelMinsize = Panel1Collapse ? Panel1MinSize : Panel2MinSize; - m_SplitterDistance = SplitterDistance; - - if (Panel1Collapse) - { - Panel1MinSize = 0; - SplitterDistance = 0; - } - else - { - Panel2MinSize = 0; - SplitterDistance = 10000; - } - } - else - { - if (Panel1Collapse) - Panel1MinSize = m_PanelMinsize; - else - Panel2MinSize = m_PanelMinsize; - - SplitterDistance = m_SplitterDistance; - } - } - - m_Collapsed = value; - } - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - try - { - if (m_Collapsed && Panel1Collapse) - SplitterDistance = Panel1MinSize; - else if (m_Collapsed && !Panel1Collapse) - { - if (Orientation == Orientation.Horizontal) - SplitterDistance = Height - Panel2MinSize; - else if(Orientation == Orientation.Vertical) - SplitterDistance = Width - Panel2MinSize; - } - } - catch (System.Exception) - { - // non fatal - } - - // arrow - { - var arrow_centre = new Point(SplitterRectangle.X + SplitterRectangle.Width / 2, SplitterRectangle.Y + SplitterRectangle.Height / 2); - - var oldmode = e.Graphics.SmoothingMode; - e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; - - Point[] dots = null; - - using(var brush = new SolidBrush(ForeColor)) - { - int dot_diameter = 0; - - if (Orientation == Orientation.Horizontal) - { - dot_diameter = SplitterRectangle.Height - Math.Max(0, SplitterRectangle.Height / 4); - - var arrow_size = new Size(SplitterRectangle.Height * 2, dot_diameter); - var arrow_pos = new Point(arrow_centre.X - arrow_size.Width / 2, arrow_centre.Y - arrow_size.Height / 2); - - if ((Panel1Collapse && !Collapsed) || (!Panel1Collapse && Collapsed)) - { - e.Graphics.FillPolygon(brush, new Point[] { - new Point(arrow_pos.X, arrow_pos.Y + arrow_size.Height), - new Point(arrow_pos.X +arrow_size.Width, arrow_pos.Y + arrow_size.Height), - new Point(arrow_pos.X + arrow_size.Width/2, arrow_pos.Y), - }); - } - else - { - e.Graphics.FillPolygon(brush, new Point[] { - new Point(arrow_pos.X, arrow_pos.Y), - new Point(arrow_pos.X +arrow_size.Width, arrow_pos.Y), - new Point(arrow_pos.X + arrow_size.Width/2, arrow_pos.Y + arrow_size.Height), - }); - } - - dots = new Point[] { - new Point(arrow_centre.X - SplitterRectangle.Width/4 - (int)(dot_diameter*1.5), arrow_centre.Y), - new Point(arrow_centre.X - SplitterRectangle.Width/4, arrow_centre.Y), - new Point(arrow_centre.X - SplitterRectangle.Width/4 + (int)(dot_diameter*1.5), arrow_centre.Y), - - new Point(arrow_centre.X + SplitterRectangle.Width/4 - (int)(dot_diameter*1.5), arrow_centre.Y), - new Point(arrow_centre.X + SplitterRectangle.Width/4, arrow_centre.Y), - new Point(arrow_centre.X + SplitterRectangle.Width/4 + (int)(dot_diameter*1.5), arrow_centre.Y), - }; - } - else - { - dot_diameter = SplitterRectangle.Width - Math.Max(0, SplitterRectangle.Width / 4); - - var arrow_size = new Size(dot_diameter, SplitterRectangle.Width * 2); - var arrow_pos = new Point(arrow_centre.X - arrow_size.Width / 2, arrow_centre.Y - arrow_size.Height / 2); - - if ((Panel1Collapse && !Collapsed) || (!Panel1Collapse && Collapsed)) - { - e.Graphics.FillPolygon(brush, new Point[] { - new Point(arrow_pos.X + arrow_size.Width, arrow_pos.Y), - new Point(arrow_pos.X +arrow_size.Width, arrow_pos.Y + arrow_size.Height), - new Point(arrow_pos.X, arrow_pos.Y + arrow_size.Height/2), - }); - } - else - { - e.Graphics.FillPolygon(brush, new Point[] { - new Point(arrow_pos.X, arrow_pos.Y), - new Point(arrow_pos.X, arrow_pos.Y +arrow_size.Height), - new Point(arrow_pos.X + arrow_size.Width, arrow_pos.Y + arrow_size.Height/2), - }); - } - - dots = new Point[] { - new Point(arrow_centre.X, arrow_centre.Y - SplitterRectangle.Height/4 - (int)(dot_diameter*1.5)), - new Point(arrow_centre.X, arrow_centre.Y - SplitterRectangle.Height/4), - new Point(arrow_centre.X, arrow_centre.Y - SplitterRectangle.Height/4 + (int)(dot_diameter*1.5)), - - new Point(arrow_centre.X, arrow_centre.Y + SplitterRectangle.Height/4 - (int)(dot_diameter*1.5)), - new Point(arrow_centre.X, arrow_centre.Y + SplitterRectangle.Height/4), - new Point(arrow_centre.X, arrow_centre.Y + SplitterRectangle.Height/4 + (int)(dot_diameter*1.5)), - }; - } - - if (dots != null) - { - foreach (var d in dots) - { - var rect = new Rectangle(new Point(d.X - dot_diameter / 2, d.Y - dot_diameter / 2), new Size(dot_diameter, dot_diameter)); - - e.Graphics.FillPie(brush, rect, 0, 360.0f); - } - } - } - - e.Graphics.SmoothingMode = oldmode; - } - } - - protected override void OnDoubleClick(EventArgs e) - { - if (SplitterRectangle.Contains(PointToClient(Control.MousePosition))) - { - Collapsed = !Collapsed; - - return; - } - - base.OnDoubleClick(e); - } - - void OnSplitterMoving(object sender, SplitterCancelEventArgs e) - { - if (Collapsed) - e.Cancel = true; - } - } -} diff --git a/renderdocui/Controls/NoscrollPanel.cs b/renderdocui/Controls/NoscrollPanel.cs deleted file mode 100644 index 9e2c2da03..000000000 --- a/renderdocui/Controls/NoscrollPanel.cs +++ /dev/null @@ -1,98 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace renderdocui.Controls -{ - public class NoScrollPanel : Panel - { - public MouseEventHandler MouseWheelHandler = null; - public KeyEventHandler KeyHandler = null; - - public NoScrollPanel() { } - - protected override void OnMouseWheel(MouseEventArgs e) - { - if (MouseWheelHandler != null) - MouseWheelHandler(this, e); - - base.OnMouseWheel(e); - } - - protected override bool ProcessCmdKey(ref Message msg, Keys keyData) - { - if (Focused && KeyHandler != null) - { - var args = new KeyEventArgs(keyData); - KeyHandler(this, args); - if(args.Handled) - return true; - } - return base.ProcessCmdKey(ref msg, keyData); - } - - public bool Painting = false; - - protected override void OnPaintBackground(PaintEventArgs pevent) - { - if (Controls.Count == 0 && !Painting) - { - pevent.Graphics.Clear(BackColor); - } - else if (Controls.Count == 1) - { - var pos = Controls[0].Location; - var size = Controls[0].Size; - - using (var brush = new SolidBrush(BackColor)) - { - var rightRect = new Rectangle(pos.X + size.Width, 0, ClientRectangle.Width - (pos.X + size.Width), ClientRectangle.Height); - var leftRect = new Rectangle(0, 0, pos.X, ClientRectangle.Height); - var topRect = new Rectangle(pos.X, 0, size.Width, pos.Y); - var bottomRect = new Rectangle(pos.X, pos.Y + size.Height, size.Width, ClientRectangle.Height - (pos.Y + size.Height)); - - pevent.Graphics.FillRectangle(brush, topRect); - pevent.Graphics.FillRectangle(brush, bottomRect); - pevent.Graphics.FillRectangle(brush, leftRect); - pevent.Graphics.FillRectangle(brush, rightRect); - } - } - } - - protected override Point ScrollToControl(Control activeControl) - { - // Returning the current location prevents the panel from - // scrolling to the active control when the panel loses and regains focus - return this.DisplayRectangle.Location; - } - } -} diff --git a/renderdocui/Controls/PipelineFlowchart.Designer.cs b/renderdocui/Controls/PipelineFlowchart.Designer.cs deleted file mode 100644 index 5873ef4e3..000000000 --- a/renderdocui/Controls/PipelineFlowchart.Designer.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace renderdocui.Controls -{ - partial class PipelineFlowchart - { - /// - /// 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 Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // PipelineFlowchart - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.Transparent; - this.Name = "PipelineFlowchart"; - this.Size = new System.Drawing.Size(988, 229); - this.Paint += new System.Windows.Forms.PaintEventHandler(this.PipelineFlowchart_Paint); - this.ResumeLayout(false); - - } - - #endregion - } -} diff --git a/renderdocui/Controls/PipelineFlowchart.cs b/renderdocui/Controls/PipelineFlowchart.cs deleted file mode 100644 index ea96fe4ea..000000000 --- a/renderdocui/Controls/PipelineFlowchart.cs +++ /dev/null @@ -1,388 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Data; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -namespace renderdocui.Controls -{ - public partial class PipelineFlowchart : UserControl - { - public PipelineFlowchart() - { - InitializeComponent(); - - this.DoubleBuffered = true; - SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true); - } - - public void SetStages(KeyValuePair[] stages) - { - m_StageNames = stages; - m_StagesEnabled = new bool[stages.Length]; - m_StageFlows = new bool[stages.Length]; - for(int i=0; i < stages.Length; i++) - m_StageFlows[i] = true; - - Invalidate(); - } - - #region Events - - private static readonly object SelectedStageChangedEvent = new object(); - - [Description("Event raised when the selected pipeline stage is changed."), Category("Behavior")] - public event EventHandler SelectedStageChanged - { - add { Events.AddHandler(SelectedStageChangedEvent, value); } - remove { Events.RemoveHandler(SelectedStageChangedEvent, value); } - } - protected virtual void OnSelectedStageChanged(EventArgs e) - { - EventHandler handler = (EventHandler)Events[SelectedStageChangedEvent]; - if (handler != null) - handler(this, e); - } - - #endregion - - #region Data Properties - - private bool[] m_StagesEnabled = null; - private bool[] m_StageFlows = null; - private KeyValuePair[] m_StageNames = null; - - public void SetStagesEnabled(bool[] enabled) - { - if (m_StagesEnabled != null && enabled.Length == m_StagesEnabled.Length) - m_StagesEnabled = enabled; - - Invalidate(); - } - - public void SetStageName(int index, KeyValuePair name) - { - if (index >= 0 && index < m_StageNames.Length) - m_StageNames[index] = name; - - Invalidate(); - } - - public void IsolateStage(int index) - { - if (m_StageNames != null && index >= 0 && index < m_StageNames.Length) - m_StageFlows[index] = false; - } - - private bool IsStageEnabled(int index) - { - return m_StagesEnabled != null && m_StagesEnabled[index]; - } - - private int m_HoverStage = -1; - private int m_SelectedStage = 0; - - [Browsable(false)] - public int SelectedStage - { - get - { - return m_SelectedStage; - } - set - { - if (value >= 0 && m_StageNames != null && value < m_StageNames.Length) - { - m_SelectedStage = value; - Invalidate(); - - OnSelectedStageChanged(new EventArgs()); - } - } - } - - #endregion - - #region Constants and positions/dimensions - - const int BoxBorderWidth = 3; - const int MinBoxDimension = 25; - const int MaxBoxCornerRadius = 20; - const float BoxCornerRadiusFraction = 1.0f / 6.0f; - const float ArrowHeadSize = 6.0f; - const int MinBoxMargin = 4; - const int BoxLabelMargin = 8; - const float BoxMarginFraction = 0.02f; - - private Rectangle TotalAreaRect - { - get - { - Rectangle rect = ClientRectangle; - - rect.Inflate(-1, -1); - - rect.X += Padding.Left; - rect.Width -= Padding.Left + Padding.Right; - - rect.Y += Padding.Top; - rect.Height -= Padding.Top + Padding.Bottom; - - rect.Inflate(-BoxBorderWidth, -BoxBorderWidth); - - return rect; - } - } - - private float BoxMargin - { - get - { - float margin = Math.Max(TotalAreaRect.Width, TotalAreaRect.Height) * BoxMarginFraction; - - margin = Math.Max(MinBoxMargin, margin); - - return margin; - } - } - - private int NumGaps { get { return m_StageNames == null ? 1 : m_StageNames.Length - 1; } } - private int NumItems { get { return m_StageNames == null ? 2 : m_StageNames.Length; } } - - private SizeF BoxSize - { - get - { - float boxeswidth = TotalAreaRect.Width - NumGaps * BoxMargin; - - float boxdim = Math.Min(TotalAreaRect.Height, boxeswidth / NumItems); - - boxdim = Math.Max(MinBoxDimension, boxdim); - - float oblongwidth = Math.Max(0, (boxeswidth - boxdim * NumItems) / NumItems); - - return new SizeF(boxdim + oblongwidth, boxdim); - } - } - - private RectangleF GetBoxRect(int i) - { - return new RectangleF(TotalAreaRect.X + i * (BoxSize.Width + BoxMargin), - TotalAreaRect.Y + TotalAreaRect.Height / 2 - BoxSize.Height / 2, - BoxSize.Width, BoxSize.Height); - } - - #endregion - - #region Painting - - GraphicsPath RoundedRect(RectangleF rect, int radius) - { - GraphicsPath ret = new GraphicsPath(); - - ret.StartFigure(); - - ret.AddArc(rect.X, rect.Y, 2 * radius, 2 * radius, 180, 90); - ret.AddLine(rect.X + radius, rect.Y, rect.X + rect.Width - radius, rect.Y); - ret.AddArc(rect.X + rect.Width - radius * 2, rect.Y, 2 * radius, 2 * radius, 270, 90); - ret.AddLine(rect.X + rect.Width, rect.Y + radius, rect.X + rect.Width, rect.Y + rect.Height - radius); - ret.AddArc(rect.X + rect.Width - 2*radius, rect.Y + rect.Height - 2 * radius, 2 * radius, 2 * radius, 0, 90); - ret.AddLine(rect.X + rect.Width - radius, rect.Y + rect.Height, rect.X + radius, rect.Y + rect.Height); - ret.AddArc(rect.X, rect.Y + rect.Height - 2*radius, 2 * radius, 2 * radius, 90, 90); - - ret.CloseFigure(); - - return ret; - } - - void DrawArrow(Graphics dc, Brush b, Pen p, float headsize, float y, float left, float right) - { - dc.DrawLine(p, new PointF(left, y), new PointF(right, y)); - - using (GraphicsPath head = new GraphicsPath()) - { - head.StartFigure(); - - head.AddLine(new PointF(right, y), new PointF(right - headsize, y - headsize)); - head.AddLine(new PointF(right - headsize, y - headsize), new PointF(right - headsize, y + headsize)); - - head.CloseFigure(); - - dc.FillPath(b, head); - } - } - - private void PipelineFlowchart_Paint(object sender, PaintEventArgs e) - { - if (m_StageNames == null) - return; - - var dc = e.Graphics; - - dc.CompositingQuality = CompositingQuality.HighQuality; - dc.SmoothingMode = SmoothingMode.AntiAlias; - - int radius = (int)Math.Min(MaxBoxCornerRadius, BoxSize.Height * BoxCornerRadiusFraction); - - float arrowY = TotalAreaRect.Y + TotalAreaRect.Height / 2; - - using (var pen = new Pen(SystemBrushes.WindowFrame, BoxBorderWidth)) - using (var selectedpen = new Pen(Brushes.Red, BoxBorderWidth)) - { - for (int i = 0; i < NumGaps; i++) - { - if (!m_StageFlows[i] || !m_StageFlows[i + 1]) - continue; - - float right = TotalAreaRect.X + (i + 1) * (BoxSize.Width + BoxMargin); - float left = right - BoxMargin; - - DrawArrow(dc, SystemBrushes.WindowFrame, pen, ArrowHeadSize, arrowY, left, right); - } - - for (int i = 0; i < NumItems; i++) - { - RectangleF boxrect = GetBoxRect(i); - - var backBrush = SystemBrushes.Window; - var textBrush = SystemBrushes.WindowText; - var outlinePen = pen; - - if (SystemInformation.HighContrast) - { - backBrush = SystemBrushes.ActiveCaption; - textBrush = SystemBrushes.ActiveCaptionText; - } - - if (!IsStageEnabled(i)) - { - backBrush = SystemBrushes.InactiveCaption; - textBrush = SystemBrushes.InactiveCaptionText; - } - - if (i == m_HoverStage) - { - backBrush = SystemBrushes.Info; - textBrush = SystemBrushes.InfoText; - } - - if (i == SelectedStage) - { - //backBrush = Brushes.Coral; - outlinePen = selectedpen; - } - - using (var boxpath = RoundedRect(boxrect, radius)) - { - dc.FillPath(backBrush, boxpath); - dc.DrawPath(outlinePen, boxpath); - } - - StringFormat format = new StringFormat(); - format.LineAlignment = StringAlignment.Center; - format.Alignment = StringAlignment.Center; - - var s = m_StageNames[i].Value; - - var size = dc.MeasureString(s, Font); - - // Decide whether we can draw the whole stage name or just the abbreviation. - // This can look a little awkward sometimes if it's sometimes abbreviated sometimes - // not. Maybe it should always abbreviate or not at all? - if (size.Width + BoxLabelMargin > (float)boxrect.Width) - { - s = s.Replace(" ", "\n"); - size = dc.MeasureString(s, Font); - - if (size.Width + BoxLabelMargin > (float)boxrect.Width || - size.Height + BoxLabelMargin > (float)boxrect.Height) - { - s = m_StageNames[i].Key; - size = dc.MeasureString(s, Font); - } - } - - dc.DrawString(s, Font, textBrush, new PointF(boxrect.X + boxrect.Width / 2, arrowY), format); - } - } - } - - #endregion - - #region Mouse Handling - - protected override void OnMouseMove(MouseEventArgs e) - { - base.OnMouseMove(e); - - int old = m_HoverStage; - m_HoverStage = -1; - - for(int i=0; i < NumItems; i++) - { - if (GetBoxRect(i).Contains(e.Location)) - { - m_HoverStage = i; - break; - } - } - - if(m_HoverStage != old) - Invalidate(); - } - - protected override void OnMouseLeave(EventArgs e) - { - base.OnMouseLeave(e); - - m_HoverStage = -1; - Invalidate(); - } - - protected override void OnMouseClick(MouseEventArgs e) - { - base.OnMouseClick(e); - - for (int i = 0; i < NumItems; i++) - { - if (GetBoxRect(i).Contains(e.Location)) - { - SelectedStage = i; - break; - } - } - } - - #endregion - } -} diff --git a/renderdocui/Controls/PipelineFlowchart.resx b/renderdocui/Controls/PipelineFlowchart.resx deleted file mode 100644 index 1af7de150..000000000 --- a/renderdocui/Controls/PipelineFlowchart.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - \ No newline at end of file diff --git a/renderdocui/Controls/RangeHistogram.Designer.cs b/renderdocui/Controls/RangeHistogram.Designer.cs deleted file mode 100644 index 40ffe9dfc..000000000 --- a/renderdocui/Controls/RangeHistogram.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -namespace renderdocui.Controls -{ - partial class RangeHistogram - { - /// - /// 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 Component 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.whiteToolTip = new System.Windows.Forms.ToolTip(this.components); - this.blackToolTip = new System.Windows.Forms.ToolTip(this.components); - this.SuspendLayout(); - // - // whiteToolTip - // - this.whiteToolTip.AutomaticDelay = 0; - this.whiteToolTip.UseAnimation = false; - this.whiteToolTip.UseFading = false; - // - // blackToolTip - // - this.blackToolTip.AutomaticDelay = 0; - this.blackToolTip.UseAnimation = false; - this.blackToolTip.UseFading = false; - // - // RangeHistogram - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.SystemColors.GradientActiveCaption; - this.DoubleBuffered = true; - this.Name = "RangeHistogram"; - this.Size = new System.Drawing.Size(150, 40); - this.Paint += new System.Windows.Forms.PaintEventHandler(this.RangeHistogram_Paint); - this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RangeHistogram_MouseDown); - this.MouseEnter += new System.EventHandler(this.RangeHistogram_MouseEnter); - this.MouseLeave += new System.EventHandler(this.RangeHistogram_MouseLeave); - this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.RangeHistogram_MouseMove); - this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.RangeHistogram_MouseUp); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.ToolTip whiteToolTip; - private System.Windows.Forms.ToolTip blackToolTip; - - } -} diff --git a/renderdocui/Controls/RangeHistogram.cs b/renderdocui/Controls/RangeHistogram.cs deleted file mode 100644 index 2be645097..000000000 --- a/renderdocui/Controls/RangeHistogram.cs +++ /dev/null @@ -1,533 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using renderdocui.Code; - -namespace renderdocui.Controls -{ - [Designer(typeof(System.Windows.Forms.Design.ControlDesigner))] - public partial class RangeHistogram : UserControl - { - public RangeHistogram() - { - InitializeComponent(); - } - - #region Events - - private static readonly object RangeUpdatedEvent = new object(); - public event EventHandler RangeUpdated - { - add { Events.AddHandler(RangeUpdatedEvent, value); } - remove { Events.RemoveHandler(RangeUpdatedEvent, value); } - } - protected virtual void OnRangeUpdated(RangeHistogramEventArgs e) - { - EventHandler handler = (EventHandler)Events[RangeUpdatedEvent]; - if (handler != null) - handler(this, e); - } - - #endregion - - #region Privates - - private float m_RangeMax = 1.0f; - private float m_RangeMin = 0.0f; - - private float m_WhitePoint = 1.0f; - private float m_BlackPoint = 0.0f; - - private float m_MinRangeSize = 0.001f; - - private int m_Margin = 4; - private int m_Border = 1; - private int m_MarkerSize = 6; - - #endregion - - #region Code Properties - - private uint[] m_HistogramData = null; - private float m_HistogramMin = 0.0f; - private float m_HistogramMax = 1.0f; - - // sets the range of data where the histogram data was calculated. - public void SetHistogramRange(float min, float max) - { - m_HistogramMin = min; - m_HistogramMax = max; - } - - // sets the minimum and maximum as well as the black and white points - public void SetRange(float min, float max) - { - m_RangeMin = min; - if (min < 0.0f) - m_RangeMax = Math.Max((min - float.Epsilon) * (1.0f - m_MinRangeSize), max); - else - m_RangeMax = Math.Max((min + float.Epsilon) * (1.0f + m_MinRangeSize), max); - - m_BlackPoint = m_RangeMin; - m_WhitePoint = m_RangeMax; - - Invalidate(); - OnRangeUpdated(new RangeHistogramEventArgs(BlackPoint, WhitePoint)); - } - - public bool ValidRange - { - get - { - if (float.IsInfinity(m_WhitePoint) || float.IsNaN(m_WhitePoint) || - float.IsInfinity(m_BlackPoint) || float.IsNaN(m_BlackPoint) || - float.IsInfinity(m_RangeMax) || float.IsNaN(m_RangeMax) || - float.IsInfinity(m_RangeMin) || float.IsNaN(m_RangeMin) || - float.IsInfinity(m_RangeMax - m_RangeMin) || float.IsNaN(m_RangeMax - m_RangeMin) || - float.IsInfinity(m_WhitePoint - m_BlackPoint) || float.IsNaN(m_WhitePoint - m_BlackPoint)) - { - return false; - } - - return true; - } - } - - [Browsable(false)] - public uint[] HistogramData - { - get - { - return m_HistogramData; - } - set - { - m_HistogramData = value; - Invalidate(); - } - } - - // black point and white point are the currently selected black/white points, within the - // minimum and maximum points. (ie. not 0 or 1) - [Browsable(false)] - public float BlackPoint - { - get - { - return m_BlackPoint; - } - set - { - if (value <= m_RangeMin) - m_BlackPoint = m_RangeMin = value; - else - m_BlackPoint = value; - - Invalidate(); - OnRangeUpdated(new RangeHistogramEventArgs(BlackPoint, WhitePoint)); - } - } - [Browsable(false)] - public float WhitePoint - { - get - { - return m_WhitePoint; - } - set - { - if (value >= m_RangeMax) - m_WhitePoint = m_RangeMax = value; - else - m_WhitePoint = value; - - Invalidate(); - OnRangeUpdated(new RangeHistogramEventArgs(BlackPoint, WhitePoint)); - } - } - - // range min/max are the current minimum and maximum values that can be set - // for the black and white points - [Browsable(false)] - public float RangeMin - { - get - { - return m_RangeMin; - } - } - [Browsable(false)] - public float RangeMax - { - get - { - return m_RangeMax; - } - } - - #endregion - - #region Designer Properties - - [Description("The smallest possible range that can be selected"), Category("Behavior")] - [DefaultValue(typeof(float), "0.001")] - public float MinRangeSize - { - get { return m_MinRangeSize; } - set { m_MinRangeSize = Math.Max(0.000001f, value); } - } - - [Description("The margin around the range display"), Category("Layout")] - [DefaultValue(typeof(int), "4")] - public int RangeMargin - { - get { return m_Margin; } - set { m_Margin = value; } - } - - [Description("The pixel border around the range bar itself"), Category("Appearance")] - [DefaultValue(typeof(int), "1")] - public int Border - { - get { return m_Border; } - set { m_Border = value; } - } - - [Description("The size in pixels of each marker"), Category("Appearance")] - [DefaultValue(typeof(int), "6")] - public int MarkerSize - { - get { return m_MarkerSize; } - set { m_MarkerSize = value; } - } - - #endregion - - #region Internal Properties - - private int m_TotalSpace { get { return m_Margin + m_Border; } } - private int m_RegionWidth { get { return this.Width - m_TotalSpace * 2; } } - - // these are internal only, they give [0, 1] from minimum to maximum of where the black and white points are - private float m_BlackDelta - { - get - { - if (!ValidRange) return 0.0f; - return GetDelta(BlackPoint); - } - set - { - BlackPoint = Math.Min(WhitePoint - MinRangeSize, value * (RangeMax - RangeMin) + RangeMin); - } - } - private float m_WhiteDelta - { - get - { - if (!ValidRange) return 1.0f; - return GetDelta(WhitePoint); - } - set - { - WhitePoint = Math.Max(BlackPoint + MinRangeSize, value * (RangeMax - RangeMin) + RangeMin); - } - } - - private float GetDelta(float val) - { - return (val - RangeMin) / (RangeMax - RangeMin); - } - - #endregion - - #region Tooltips - - private void ShowTooltips() - { - blackToolTip.Show(BlackPoint.ToString("F4"), this, - this.ClientRectangle.Left + (int)(this.ClientRectangle.Width * m_BlackDelta), this.ClientRectangle.Bottom); - - whiteToolTip.Show(WhitePoint.ToString("F4"), this, - this.ClientRectangle.Left + (int)(this.ClientRectangle.Width * m_WhiteDelta), this.ClientRectangle.Top - 15); - } - - #endregion - - #region Mouse Handlers - - private Point m_mousePrev = new Point(-1, -1); - - private enum DraggingMode - { - NONE, - WHITE, - BLACK, - } - private DraggingMode m_DragMode; - - // This handler tries to figure out which handle (white or black) you were trying to - // grab when you clicked. - private void RangeHistogram_MouseDown(object sender, MouseEventArgs e) - { - if(e.Button != MouseButtons.Left || !ValidRange) - return; - - Rectangle rect = this.ClientRectangle; - - rect.Inflate(-m_TotalSpace, -m_TotalSpace); - - int whiteX = (int)(m_WhiteDelta * rect.Width); - int blackX = (int)(m_BlackDelta * rect.Width); - - var whiteVec = new PointF(whiteX - e.Location.X, ClientRectangle.Height - e.Location.Y); - var blackVec = new PointF(blackX-e.Location.X, e.Location.Y); - - float whitedist = (float)Math.Sqrt(whiteVec.X * whiteVec.X + whiteVec.Y * whiteVec.Y); - float blackdist = (float)Math.Sqrt(blackVec.X * blackVec.X + blackVec.Y * blackVec.Y); - - System.Diagnostics.Trace.WriteLine(string.Format("white {0} black {1}", whitedist, blackdist)); - - if (whitedist < blackdist && whitedist < 18.0f) - m_DragMode = DraggingMode.WHITE; - else if (blackdist < whitedist && blackdist < 18.0f) - m_DragMode = DraggingMode.BLACK; - else if (e.Location.X > whiteX) - m_DragMode = DraggingMode.WHITE; - else if (e.Location.X < blackX) - m_DragMode = DraggingMode.BLACK; - - if (m_DragMode == DraggingMode.WHITE) - { - float newWhite = (float)(e.Location.X - m_TotalSpace) / (float)m_RegionWidth; - - m_WhiteDelta = Math.Max(m_BlackDelta + m_MinRangeSize, Math.Min(1.0f, newWhite)); - } - else if (m_DragMode == DraggingMode.BLACK) - { - float newBlack = (float)(e.Location.X - m_TotalSpace) / (float)m_RegionWidth; - - m_BlackDelta = Math.Min(m_WhiteDelta - m_MinRangeSize, Math.Max(0.0f, newBlack)); - } - - OnRangeUpdated(new RangeHistogramEventArgs(BlackPoint, WhitePoint)); - - if (m_DragMode != DraggingMode.NONE) - { - this.Invalidate(); - this.Update(); - } - - m_mousePrev.X = e.X; - m_mousePrev.Y = e.Y; - } - - private void RangeHistogram_MouseUp(object sender, MouseEventArgs e) - { - whiteToolTip.Hide(this); - blackToolTip.Hide(this); - - m_DragMode = DraggingMode.NONE; - - m_mousePrev.X = m_mousePrev.Y = -1; - } - - private void RangeHistogram_MouseMove(object sender, MouseEventArgs e) - { - if (ValidRange && e.Button == MouseButtons.Left && (e.X != m_mousePrev.X || e.Y != m_mousePrev.Y)) - { - if (m_DragMode == DraggingMode.WHITE) - { - float newWhite = (float)(e.Location.X - m_TotalSpace) / (float)m_RegionWidth; - - m_WhiteDelta = Math.Max(m_BlackDelta + m_MinRangeSize, Math.Min(1.0f, newWhite)); - } - else if (m_DragMode == DraggingMode.BLACK) - { - float newBlack = (float)(e.Location.X - m_TotalSpace) / (float)m_RegionWidth; - - m_BlackDelta = Math.Min(m_WhiteDelta - m_MinRangeSize, Math.Max(0.0f, newBlack)); - } - - OnRangeUpdated(new RangeHistogramEventArgs(BlackPoint, WhitePoint)); - - if (m_DragMode != DraggingMode.NONE) - { - this.Invalidate(); - this.Update(); - } - - m_mousePrev.X = e.X; - m_mousePrev.Y = e.Y; - - ShowTooltips(); - } - } - - private void RangeHistogram_MouseLeave(object sender, EventArgs e) - { - whiteToolTip.Hide(this); - blackToolTip.Hide(this); - } - - private void RangeHistogram_MouseEnter(object sender, EventArgs e) - { - ShowTooltips(); - } - - #endregion - - #region Other Handlers - - private void RangeHistogram_Paint(object sender, PaintEventArgs e) - { - Rectangle rect = this.ClientRectangle; - - e.Graphics.FillRectangle(SystemBrushes.Control, rect); - - rect.Inflate(-m_Margin, -m_Margin); - - e.Graphics.FillRectangle(SystemBrushes.ControlText, rect); - - rect.Inflate(-m_Border, -m_Border); - - e.Graphics.FillRectangle(ValidRange ? Brushes.DarkGray : Brushes.DarkRed, rect); - - int whiteX = (int)(m_WhiteDelta * rect.Width); - int blackX = (int)(m_BlackDelta * rect.Width); - - Rectangle blackPoint = new Rectangle(rect.Left, rect.Top, blackX, rect.Height); - Rectangle whitePoint = new Rectangle(rect.Left + whiteX, rect.Top, rect.Width - whiteX, rect.Height); - - e.Graphics.FillRectangle(Brushes.White, whitePoint); - e.Graphics.FillRectangle(Brushes.Black, blackPoint); - - if (!ValidRange) - return; - - if (HistogramData != null) - { - float minx = GetDelta(m_HistogramMin); - float maxx = GetDelta(m_HistogramMax); - - UInt32 maxval = UInt32.MinValue; - for (int i = 0; i < HistogramData.Length; i++) - { - float x = (float)i / (float)HistogramData.Length; - - float xdelta = minx + x * (maxx - minx); - - if (xdelta >= 0.0f && xdelta <= 1.0f) - { - maxval = Math.Max(maxval, HistogramData[i]); - } - } - - if (maxval == 0) - maxval = 1; - - for (int i = 0; i < HistogramData.Length; i++) - { - float x = (float)i / (float)HistogramData.Length; - float y = (float)HistogramData[i] / (float)maxval; - - float xdelta = minx + x * (maxx - minx); - - if (xdelta >= 0.0f && xdelta <= 1.0f) - { - float segwidth = Math.Max(rect.Width * (maxx - minx) / (float)HistogramData.Length, 1); - - RectangleF barRect = new RectangleF(new PointF(rect.Left + rect.Width * (minx + x * (maxx - minx)), rect.Bottom - rect.Height * y), - new SizeF(segwidth, rect.Height * y)); - - e.Graphics.FillRectangle(Brushes.Green, barRect); - } - } - } - - Point[] blackTriangle = { new Point(blackPoint.Right, m_MarkerSize*2), - new Point(blackPoint.Right+m_MarkerSize, 0), - new Point(blackPoint.Right-m_MarkerSize, 0) }; - - e.Graphics.FillPolygon(Brushes.DarkGray, blackTriangle); - - Point[] whiteTriangle = { new Point(whitePoint.Left, whitePoint.Bottom-m_MarkerSize*2+m_Margin), - new Point(whitePoint.Left+m_MarkerSize, whitePoint.Bottom+m_Margin), - new Point(whitePoint.Left-m_MarkerSize, whitePoint.Bottom+m_Margin) }; - - e.Graphics.FillPolygon(Brushes.DarkGray, whiteTriangle); - - blackTriangle[0].Y -= 2; - blackTriangle[1].Y += 1; - blackTriangle[2].Y += 1; - - blackTriangle[1].X -= 2; - blackTriangle[2].X += 2; - - whiteTriangle[0].Y += 2; - whiteTriangle[1].Y -= 1; - whiteTriangle[2].Y -= 1; - - whiteTriangle[1].X -= 2; - whiteTriangle[2].X += 2; - - e.Graphics.FillPolygon(Brushes.Black, blackTriangle); - e.Graphics.FillPolygon(Brushes.White, whiteTriangle); - } - - #endregion - } - - public class RangeHistogramEventArgs : EventArgs - { - private float m_black, m_white; - - public RangeHistogramEventArgs(float black, float white) - { - m_black = black; - m_white = white; - } - - public float BlackPoint - { - get { return m_black; } - } - - public float WhitePoint - { - get { return m_white; } - } - } - -} diff --git a/renderdocui/Controls/RangeHistogram.resx b/renderdocui/Controls/RangeHistogram.resx deleted file mode 100644 index 1749b810a..000000000 --- a/renderdocui/Controls/RangeHistogram.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - - 132, 17 - - \ No newline at end of file diff --git a/renderdocui/Controls/ResourcePreview.Designer.cs b/renderdocui/Controls/ResourcePreview.Designer.cs deleted file mode 100644 index a9425342a..000000000 --- a/renderdocui/Controls/ResourcePreview.Designer.cs +++ /dev/null @@ -1,131 +0,0 @@ -namespace renderdocui.Controls -{ - partial class ResourcePreview - { - /// - /// 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 Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.slotLabel = new System.Windows.Forms.Label(); - this.descriptionLabel = new System.Windows.Forms.Label(); - this.thumbnail = new renderdocui.Controls.NoScrollPanel(); - this.tableLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent; - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Controls.Add(this.slotLabel, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.descriptionLabel, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.thumbnail, 0, 0); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.Size = new System.Drawing.Size(110, 86); - this.tableLayoutPanel1.TabIndex = 0; - // - // slotLabel - // - this.slotLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.slotLabel.AutoSize = true; - this.slotLabel.BackColor = System.Drawing.SystemColors.ButtonShadow; - this.slotLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.slotLabel.ForeColor = System.Drawing.SystemColors.ControlText; - this.slotLabel.Location = new System.Drawing.Point(0, 60); - this.slotLabel.Margin = new System.Windows.Forms.Padding(0); - this.slotLabel.Name = "slotLabel"; - this.slotLabel.Size = new System.Drawing.Size(19, 26); - this.slotLabel.TabIndex = 1; - this.slotLabel.Text = "1"; - this.slotLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.slotLabel.MouseClick += new System.Windows.Forms.MouseEventHandler(this.child_MouseClick); - this.slotLabel.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.child_MouseDoubleClick); - // - // descriptionLabel - // - this.descriptionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.descriptionLabel.AutoEllipsis = true; - this.descriptionLabel.BackColor = System.Drawing.SystemColors.ButtonShadow; - this.descriptionLabel.ForeColor = System.Drawing.SystemColors.ControlText; - this.descriptionLabel.Location = new System.Drawing.Point(19, 60); - this.descriptionLabel.Margin = new System.Windows.Forms.Padding(0); - this.descriptionLabel.Name = "descriptionLabel"; - this.descriptionLabel.Size = new System.Drawing.Size(91, 26); - this.descriptionLabel.TabIndex = 2; - this.descriptionLabel.Text = "Texture2D 117"; - this.descriptionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.descriptionLabel.MouseClick += new System.Windows.Forms.MouseEventHandler(this.child_MouseClick); - this.descriptionLabel.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.child_MouseDoubleClick); - // - // thumbnail - // - this.thumbnail.BackColor = System.Drawing.Color.Chartreuse; - this.tableLayoutPanel1.SetColumnSpan(this.thumbnail, 2); - this.thumbnail.Dock = System.Windows.Forms.DockStyle.Fill; - this.thumbnail.Location = new System.Drawing.Point(0, 0); - this.thumbnail.Margin = new System.Windows.Forms.Padding(0); - this.thumbnail.Name = "thumbnail"; - this.thumbnail.Size = new System.Drawing.Size(110, 60); - this.thumbnail.TabIndex = 0; - this.thumbnail.Paint += new System.Windows.Forms.PaintEventHandler(this.thumbnail_Paint); - this.thumbnail.MouseClick += new System.Windows.Forms.MouseEventHandler(this.child_MouseClick); - this.thumbnail.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.child_MouseDoubleClick); - // - // ResourcePreview - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.Black; - this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.Controls.Add(this.tableLayoutPanel1); - this.Margin = new System.Windows.Forms.Padding(5, 0, 0, 0); - this.Name = "ResourcePreview"; - this.Padding = new System.Windows.Forms.Padding(3); - this.Size = new System.Drawing.Size(116, 92); - this.Load += new System.EventHandler(this.ResourcePreview_Load); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private Controls.NoScrollPanel thumbnail; - private System.Windows.Forms.Label slotLabel; - private System.Windows.Forms.Label descriptionLabel; - } -} diff --git a/renderdocui/Controls/ResourcePreview.cs b/renderdocui/Controls/ResourcePreview.cs deleted file mode 100644 index 8cf25fd77..000000000 --- a/renderdocui/Controls/ResourcePreview.cs +++ /dev/null @@ -1,177 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using renderdocui.Code; -using renderdoc; - -namespace renderdocui.Controls -{ - [Designer(typeof(System.Windows.Forms.Design.ControlDesigner))] - public partial class ResourcePreview : UserControl - { - private string m_Name; - private UInt64 m_Width; - private UInt32 m_Height, m_Depth, m_NumMips; - private Core m_Core; - private ReplayOutput m_Output; - private IntPtr m_Handle; - - public ResourcePreview(Core core, ReplayOutput output) - { - InitializeComponent(); - - descriptionLabel.Font = core.Config.PreferredFont; - - m_Name = "Unbound"; - m_Width = 1; - m_Height = 1; - m_Depth = 1; - m_NumMips = 0; - m_Unbound = true; - thumbnail.Painting = false; - - m_Unbound = true; - - slotLabel.Text = "0"; - - this.DoubleBuffered = true; - - SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); - - m_Handle = thumbnail.Handle; - - m_Core = core; - m_Output = output; - - Selected = false; - } - - public void Init() - { - descriptionLabel.Text = "Unbound"; - m_Unbound = true; - thumbnail.Painting = true; - } - - public void Init(string Name, UInt64 Width, UInt32 Height, UInt32 Depth, UInt32 NumMips) - { - m_Name = Name; - m_Width = Width; - m_Height = Height; - m_Depth = Depth; - m_NumMips = NumMips; - m_Unbound = false; - thumbnail.Painting = true; - - //descriptionLabel.Text = m_Width + "x" + m_Height + "x" + m_Depth + (m_NumMips > 0 ? "[" + m_NumMips + "]\n" : "\n") + m_Name; - descriptionLabel.Text = m_Name; - } - - public string SlotName - { - get { return slotLabel.Text; } - set { slotLabel.Text = value; } - } - - private bool m_Unbound = true; - public bool Unbound - { - get - { - return m_Unbound; - } - } - - private bool m_Selected; - public bool Selected - { - get { return m_Selected; } - set - { - m_Selected = value; - if (value) - { - BackColor = Color.Red; - } - else - { - BackColor = Color.Black; - } - } - } - - public IntPtr ThumbnailHandle - { - get { return m_Handle; } - } - - private void ResourcePreview_Load(object sender, EventArgs e) - { - Init(m_Name, m_Width, m_Height, m_Depth, m_NumMips); - } - - public void Clear() - { - thumbnail.Invalidate(); - } - - private void thumbnail_Paint(object sender, PaintEventArgs e) - { - if (m_Output == null || m_Core.Renderer == null) - { - e.Graphics.Clear(Color.Black); - return; - } - - if (m_Output != null) - m_Core.Renderer.InvokeForPaint("thumbpaint", (ReplayRenderer r) => { m_Output.Display(); }); - } - - public void SetSize(Size s) - { - MinimumSize = MaximumSize = s; - Size = s; - } - - private void child_MouseClick(object sender, MouseEventArgs e) - { - OnMouseClick(e); - } - - private void child_MouseDoubleClick(object sender, MouseEventArgs e) - { - OnMouseDoubleClick(e); - } - } -} diff --git a/renderdocui/Controls/ResourcePreview.resx b/renderdocui/Controls/ResourcePreview.resx deleted file mode 100644 index 1af7de150..000000000 --- a/renderdocui/Controls/ResourcePreview.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - \ No newline at end of file diff --git a/renderdocui/Controls/TablessControl.cs b/renderdocui/Controls/TablessControl.cs deleted file mode 100644 index f230a612d..000000000 --- a/renderdocui/Controls/TablessControl.cs +++ /dev/null @@ -1,51 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using renderdocui.Code; - -namespace renderdocui.Controls -{ - // thanks to Hans Passant - http://stackoverflow.com/a/6954785 - public class TablessControl : TabControl - { - protected override void WndProc(ref Message m) - { - // Hide tabs by trapping the TCM_ADJUSTRECT message - if (m.Msg == (int)Win32PInvoke.Win32Message.TCM_ADJUSTRECT && !DesignMode) - m.Result = (IntPtr)1; - else - base.WndProc(ref m); - } - } -} diff --git a/renderdocui/Controls/TextureListBox.cs b/renderdocui/Controls/TextureListBox.cs deleted file mode 100644 index 44e259438..000000000 --- a/renderdocui/Controls/TextureListBox.cs +++ /dev/null @@ -1,234 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using renderdoc; -using renderdocui.Code; - -namespace renderdocui.Controls -{ - public partial class TextureListBox : ListBox - { - private List m_FilteredTextures = new List(); - - private static readonly object GoIconClickEvent = new object(); - public event EventHandler GoIconClick - { - add { Events.AddHandler(GoIconClickEvent, value); } - remove { Events.RemoveHandler(GoIconClickEvent, value); } - } - protected virtual void OnGoIconClick(GoIconClickEventArgs e) - { - EventHandler handler = (EventHandler)Events[GoIconClickEvent]; - if (handler != null) - handler(this, e); - } - - public Core m_Core = null; - - public TextureListBox() - { - DrawMode = DrawMode.OwnerDrawFixed; - DrawItem += new DrawItemEventHandler(TextureListBox_DrawItem); - - this.DoubleBuffered = true; - SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); - - Items.Clear(); - Items.Add("foobar"); - } - - void TextureListBox_DrawItem(object sender, DrawItemEventArgs e) - { - if (Items.Count > 0 && e.Index >= 0) - { - Rectangle stringBounds = e.Bounds; - - var image = global::renderdocui.Properties.Resources.action; - - if (m_HoverHighlight == e.Index) - { - image = global::renderdocui.Properties.Resources.action_hover; - e.Graphics.DrawRectangle(Pens.LightGray, e.Bounds); - } - - e.Graphics.DrawImage(image, e.Bounds.Width - 16, e.Bounds.Y, 16, 16); - - stringBounds.Width -= 18; - - var sf = new StringFormat(StringFormat.GenericDefault); - - sf.Trimming = StringTrimming.EllipsisCharacter; - sf.FormatFlags |= StringFormatFlags.NoWrap; - - using (Brush b = new SolidBrush(ForeColor)) - { - e.Graphics.DrawString(Items[e.Index].ToString(), - Font, b, stringBounds, sf); - } - } - } - - private int m_HoverHighlight = -1; - - protected override void OnMouseDown(MouseEventArgs e) - { - base.OnMouseDown(e); - } - - protected override void OnMouseClick(MouseEventArgs e) - { - base.OnMouseClick(e); - - if (Items.Count > 0 && m_HoverHighlight >= 0) - { - var rect = GetItemRectangle(m_HoverHighlight); - - if (rect.Contains(e.Location)) - { - OnGoIconClick(new GoIconClickEventArgs(m_FilteredTextures[m_HoverHighlight].ID)); - } - } - } - - protected override void OnMouseMove(MouseEventArgs e) - { - base.OnMouseMove(e); - - bool curhover = m_HoverHighlight != -1; - bool hover = false; - - for(int i=0; i < Items.Count; i++) - { - var rect = GetItemRectangle(i); - - bool highlight = rect.Contains(e.Location); - - hover |= highlight; - - if (m_HoverHighlight != i && highlight) - { - m_HoverHighlight = i; - Invalidate(); - } - } - - if (hover) - { - Cursor = Cursors.Hand; - } - else - { - Cursor = Cursors.Arrow; - m_HoverHighlight = -1; - } - - if (hover != curhover) - Invalidate(); - } - - protected override void OnMouseLeave(EventArgs e) - { - base.OnMouseLeave(e); - - Cursor = Cursors.Arrow; - if (Items.Count > 0 && m_HoverHighlight >= 0) - Invalidate(GetItemRectangle(m_HoverHighlight)); - - m_HoverHighlight = -1; - } - - protected override void OnVisibleChanged(EventArgs e) - { - base.OnVisibleChanged(e); - - if (Visible) - { - FillTextureList("", true, true); - } - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - for (int i = 0; i < Items.Count; i++) - { - TextureListBox_DrawItem(this, new DrawItemEventArgs(e.Graphics, Font, GetItemRectangle(i), i, DrawItemState.Default)); - } - } - - public void FillTextureList(string filter, bool RTs, bool Texs) - { - m_FilteredTextures.Clear(); - Items.Clear(); - - if (m_Core == null ||!m_Core.LogLoaded) - { - return; - } - - for (int i = 0; i < m_Core.CurTextures.Length; i++) - { - bool include = false; - include |= (RTs && ((m_Core.CurTextures[i].creationFlags & TextureCreationFlags.RTV) > 0 || - (m_Core.CurTextures[i].creationFlags & TextureCreationFlags.DSV) > 0)); - include |= (Texs && (m_Core.CurTextures[i].creationFlags & TextureCreationFlags.RTV) == 0 && - (m_Core.CurTextures[i].creationFlags & TextureCreationFlags.DSV) == 0); - include |= (filter.Length > 0 && (m_Core.CurTextures[i].name.ToUpperInvariant().Contains(filter.ToUpperInvariant()))); - include |= (!RTs && !Texs && filter.Length == 0); - - if (include) - { - m_FilteredTextures.Add(m_Core.CurTextures[i]); - Items.Add(m_Core.CurTextures[i].name); - } - } - } - } - - public class GoIconClickEventArgs : EventArgs - { - private ResourceId id; - - public GoIconClickEventArgs(ResourceId i) - { - id = i; - } - - public ResourceId ID - { - get { return id; } - } - } -} diff --git a/renderdocui/Controls/ThumbnailStrip.Designer.cs b/renderdocui/Controls/ThumbnailStrip.Designer.cs deleted file mode 100644 index a0b65a614..000000000 --- a/renderdocui/Controls/ThumbnailStrip.Designer.cs +++ /dev/null @@ -1,106 +0,0 @@ -namespace renderdocui.Controls -{ - partial class ThumbnailStrip - { - /// - /// 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 Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - this.panel = new System.Windows.Forms.Panel(); - this.hscroll = new System.Windows.Forms.HScrollBar(); - this.vscroll = new System.Windows.Forms.VScrollBar(); - tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - tableLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // tableLayoutPanel1 - // - tableLayoutPanel1.ColumnCount = 2; - tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - tableLayoutPanel1.Controls.Add(this.panel, 0, 0); - tableLayoutPanel1.Controls.Add(this.hscroll, 0, 1); - tableLayoutPanel1.Controls.Add(this.vscroll, 1, 0); - tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - tableLayoutPanel1.Name = "tableLayoutPanel1"; - tableLayoutPanel1.RowCount = 2; - tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - tableLayoutPanel1.Size = new System.Drawing.Size(791, 246); - tableLayoutPanel1.TabIndex = 1; - // - // panel - // - this.panel.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel.Location = new System.Drawing.Point(0, 0); - this.panel.Margin = new System.Windows.Forms.Padding(0); - this.panel.Name = "panel"; - this.panel.Size = new System.Drawing.Size(775, 230); - this.panel.TabIndex = 0; - this.panel.ControlAdded += new System.Windows.Forms.ControlEventHandler(this.panel_ControlAddRemove); - this.panel.ControlRemoved += new System.Windows.Forms.ControlEventHandler(this.panel_ControlAddRemove); - this.panel.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panel_MouseClick); - // - // hscroll - // - this.hscroll.Dock = System.Windows.Forms.DockStyle.Bottom; - this.hscroll.Location = new System.Drawing.Point(0, 230); - this.hscroll.Name = "hscroll"; - this.hscroll.Size = new System.Drawing.Size(775, 16); - this.hscroll.TabIndex = 1; - this.hscroll.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hscroll_Scroll); - // - // vscroll - // - this.vscroll.Dock = System.Windows.Forms.DockStyle.Right; - this.vscroll.Location = new System.Drawing.Point(775, 0); - this.vscroll.Name = "vscroll"; - this.vscroll.Size = new System.Drawing.Size(16, 230); - this.vscroll.TabIndex = 2; - this.vscroll.Scroll += new System.Windows.Forms.ScrollEventHandler(this.vscroll_Scroll); - // - // ThumbnailStrip - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(tableLayoutPanel1); - this.Margin = new System.Windows.Forms.Padding(0); - this.Name = "ThumbnailStrip"; - this.Size = new System.Drawing.Size(791, 246); - this.Layout += new System.Windows.Forms.LayoutEventHandler(this.ThumbnailStrip_Layout); - tableLayoutPanel1.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Panel panel; - private System.Windows.Forms.HScrollBar hscroll; - private System.Windows.Forms.VScrollBar vscroll; - } -} diff --git a/renderdocui/Controls/ThumbnailStrip.cs b/renderdocui/Controls/ThumbnailStrip.cs deleted file mode 100644 index cb76c09fd..000000000 --- a/renderdocui/Controls/ThumbnailStrip.cs +++ /dev/null @@ -1,229 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -namespace renderdocui.Controls -{ - public partial class ThumbnailStrip : UserControl - { - public ThumbnailStrip() - { - InitializeComponent(); - - MouseWheel += new MouseEventHandler(ThumbnailStrip_MouseWheel); - } - - void ThumbnailStrip_MouseWheel(object sender, MouseEventArgs e) - { - const int WHEEL_DELTA = 120; - - int movement = e.Delta / WHEEL_DELTA; - - if (vscroll.Visible) - vscroll.Value = Code.Helpers.Clamp(vscroll.Value - movement * vscroll.SmallChange, vscroll.Minimum, vscroll.Maximum - vscroll.LargeChange); - if (hscroll.Visible) - hscroll.Value = Code.Helpers.Clamp(hscroll.Value - movement * hscroll.SmallChange, hscroll.Minimum, hscroll.Maximum - hscroll.LargeChange); - - RefreshLayout(); - } - - private List m_Thumbnails = new List(); - public ResourcePreview[] Thumbnails { get { return m_Thumbnails.ToArray(); } } - - public void AddThumbnail(ResourcePreview r) - { - panel.Controls.Add(r); - m_Thumbnails.Add(r); - } - - public void ClearThumbnails() - { - m_Thumbnails.Clear(); - panel.Controls.Clear(); - } - - public void RefreshLayout() - { - Rectangle avail = ClientRectangle; - avail.Inflate(new Size(-6, -6)); - - int numVisible = 0; - foreach (ResourcePreview c in Thumbnails) - if (c.Visible) numVisible++; - - // depending on overall aspect ratio, we either lay out the strip horizontally or - // vertically. This tries to account for whether the strip is docked along one side - // or another of the texture viewer - if (avail.Width > avail.Height) - { - avail.Width += 6; // controls implicitly have a 6 margin on the right - - int aspectWidth = (int)(avail.Height * 1.3f); - - vscroll.Visible = false; - - int noscrollWidth = numVisible * (aspectWidth + 6); - - if (noscrollWidth <= avail.Width) - { - hscroll.Visible = false; - - int x = avail.X; - foreach (ResourcePreview c in Thumbnails) - { - if (c.Visible) - { - c.Location = new Point(x, avail.Y); - c.SetSize(new Size(aspectWidth, avail.Height)); - - x += aspectWidth + 6; - } - } - } - else - { - hscroll.Visible = true; - - avail.Height = avail.Height - SystemInformation.HorizontalScrollBarHeight; - - aspectWidth = (int)(avail.Height * 1.3f); - - int totalWidth = numVisible * (aspectWidth + 6); - hscroll.Enabled = totalWidth > avail.Width; - - if (hscroll.Enabled) - { - hscroll.Maximum = totalWidth - avail.Width; - hscroll.LargeChange = Code.Helpers.Clamp(avail.Height, 1, hscroll.Maximum/2); - hscroll.SmallChange = Math.Max(1, hscroll.LargeChange / 2); - } - - int x = avail.X - (int)(hscroll.Maximum*(float)hscroll.Value/(float)(hscroll.Maximum-hscroll.LargeChange)); - foreach (ResourcePreview c in Thumbnails) - { - if (c.Visible) - { - c.Location = new Point(x, avail.Y); - c.SetSize(new Size(aspectWidth, avail.Height)); - - x += aspectWidth + 6; - } - } - } - } - else - { - avail.Height += 6; // controls implicitly have a 6 margin on the bottom - - int aspectHeight = (int)(avail.Width / 1.3f); - - hscroll.Visible = false; - - int noscrollHeight = numVisible * (aspectHeight + 6); - - if (noscrollHeight <= avail.Height) - { - vscroll.Visible = false; - - int y = avail.Y; - foreach (ResourcePreview c in Thumbnails) - { - if (c.Visible) - { - c.Location = new Point(avail.X, y); - c.SetSize(new Size(avail.Width, aspectHeight)); - - y += aspectHeight + 6; - } - } - } - else - { - vscroll.Visible = true; - - avail.Width = avail.Width - SystemInformation.VerticalScrollBarWidth; - - aspectHeight = (int)(avail.Width / 1.3f); - - int totalHeight = numVisible * (aspectHeight + 6); - vscroll.Enabled = totalHeight > avail.Height; - - if (vscroll.Enabled) - { - vscroll.Maximum = totalHeight - avail.Height; - vscroll.LargeChange = Code.Helpers.Clamp(avail.Width, 1, vscroll.Maximum / 2); - vscroll.SmallChange = Math.Max(1, vscroll.LargeChange / 2); - } - - int y = avail.Y - (int)(vscroll.Maximum * (float)vscroll.Value / (float)(vscroll.Maximum - vscroll.LargeChange)); - foreach (ResourcePreview c in Thumbnails) - { - if (c.Visible) - { - c.Location = new Point(avail.X, y); - c.SetSize(new Size(avail.Width, aspectHeight)); - - y += aspectHeight + 6; - } - } - } - } - } - - private void ThumbnailStrip_Layout(object sender, LayoutEventArgs e) - { - RefreshLayout(); - } - - private void panel_ControlAddRemove(object sender, ControlEventArgs e) - { - RefreshLayout(); - } - - private void panel_MouseClick(object sender, MouseEventArgs e) - { - OnMouseClick(e); - } - - private void hscroll_Scroll(object sender, ScrollEventArgs e) - { - RefreshLayout(); - } - - private void vscroll_Scroll(object sender, ScrollEventArgs e) - { - RefreshLayout(); - } - } -} diff --git a/renderdocui/Controls/ThumbnailStrip.resx b/renderdocui/Controls/ThumbnailStrip.resx deleted file mode 100644 index 9acfc2241..000000000 --- a/renderdocui/Controls/ThumbnailStrip.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - False - - \ No newline at end of file diff --git a/renderdocui/Controls/ToolStripSpringTextBox.cs b/renderdocui/Controls/ToolStripSpringTextBox.cs deleted file mode 100644 index 82e8402a8..000000000 --- a/renderdocui/Controls/ToolStripSpringTextBox.cs +++ /dev/null @@ -1,115 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace renderdocui.Controls -{ - // toolstrip textbox that resizes to fit - // http://msdn.microsoft.com/en-us/library/ms404304(v=vs.90).aspx - public class ToolStripSpringTextBox : ToolStripTextBox - { - public bool ResizeToFit = true; - - public override Size GetPreferredSize(Size constrainingSize) - { - if (!ResizeToFit) - return base.GetPreferredSize(constrainingSize); - - // Use the default size if the text box is on the overflow menu - // or is on a vertical ToolStrip. - if (IsOnOverflow || Owner.Orientation == Orientation.Vertical) - { - return DefaultSize; - } - - // Declare a variable to store the total available width as - // it is calculated, starting with the display width of the - // owning ToolStrip. - Int32 width = Owner.DisplayRectangle.Width; - - // Subtract the width of the overflow button if it is displayed. - if (Owner.OverflowButton.Visible) - { - width = width - Owner.OverflowButton.Width - - Owner.OverflowButton.Margin.Horizontal; - } - - // Declare a variable to maintain a count of ToolStripSpringTextBox - // items currently displayed in the owning ToolStrip. - Int32 springBoxCount = 0; - - foreach (ToolStripItem item in Owner.Items) - { - // Ignore items on the overflow menu. - if (item.IsOnOverflow) continue; - - if (item is ToolStripSpringTextBox) - { - // For ToolStripSpringTextBox items, increment the count and - // subtract the margin width from the total available width. - springBoxCount++; - width -= item.Margin.Horizontal; - } - else - { - // For all other items, subtract the full width from the total - // available width. - width = width - item.Width - item.Margin.Horizontal; - } - } - - // If there are multiple ToolStripSpringTextBox items in the owning - // ToolStrip, divide the total available width between them. - if (springBoxCount > 1) width /= springBoxCount; - - // If the available width is less than the default width, use the - // default width, forcing one or more items onto the overflow menu. - if (width < DefaultSize.Width) width = DefaultSize.Width; - - // Retrieve the preferred size from the base class, but change the - // width to the calculated width. - Size size = base.GetPreferredSize(constrainingSize); - size.Width = width; - return size; - } - - protected override bool ProcessCmdKey(ref Message m, Keys keyData) - { - if (keyData == Keys.Escape) - { - OnKeyPress(new KeyPressEventArgs('\0')); - return true; - } - else - { - return false; - } - } - } -} diff --git a/renderdocui/Controls/TreeListView/LICENSE.htm b/renderdocui/Controls/TreeListView/LICENSE.htm deleted file mode 100644 index 13f08839b..000000000 --- a/renderdocui/Controls/TreeListView/LICENSE.htm +++ /dev/null @@ -1,251 +0,0 @@ - - -The Code Project Open License (CPOL) - - - - -

The Code Project Open License (CPOL) 1.02

-
- -
-
- -

Preamble

-

- This License governs Your use of the Work. This License is intended to allow developers - to use the Source Code and Executable Files provided as part of the Work in any - application in any form. -

-

- The main points subject to the terms of the License are:

-
    -
  • Source Code and Executable Files can be used in commercial applications;
  • -
  • Source Code and Executable Files can be redistributed; and
  • -
  • Source Code can be modified to create derivative works.
  • -
  • No claim of suitability, guarantee, or any warranty whatsoever is provided. The software is - provided "as-is".
  • -
  • The Article accompanying the Work may not be distributed or republished without the - Author's consent
  • -
- -

- This License is entered between You, the individual or other entity reading or otherwise - making use of the Work licensed pursuant to this License and the individual or other - entity which offers the Work under the terms of this License ("Author").

- -

License

-

- THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CODE PROJECT OPEN - LICENSE ("LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE - LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT - LAW IS PROHIBITED.

-

- BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HEREIN, YOU ACCEPT AND AGREE TO BE - BOUND BY THE TERMS OF THIS LICENSE. THE AUTHOR GRANTS YOU THE RIGHTS CONTAINED HEREIN - IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. IF YOU DO NOT - AGREE TO ACCEPT AND BE BOUND BY THE TERMS OF THIS LICENSE, YOU CANNOT MAKE ANY - USE OF THE WORK.

- -
    -
  1. Definitions. - -
      -
    1. "Articles" means, collectively, all articles written by Author - which describes how the Source Code and Executable Files for the Work may be used - by a user.
    2. -
    3. "Author" means the individual or entity that offers the Work under the terms - of this License.
    4. -
    5. "Derivative Work" means a work based upon the Work or upon the - Work and other pre-existing works.
    6. -
    7. "Executable Files" refer to the executables, binary files, configuration - and any required data files included in the Work.
    8. -
    9. "Publisher" means the provider of the website, magazine, CD-ROM, DVD or other - medium from or by which the Work is obtained by You.
    10. -
    11. "Source Code" refers to the collection of source code and configuration files - used to create the Executable Files.
    12. -
    13. "Standard Version" refers to such a Work if it has not been modified, or - has been modified in accordance with the consent of the Author, such consent being - in the full discretion of the Author.
    14. -
    15. "Work" refers to the collection of files distributed by the Publisher, including - the Source Code, Executable Files, binaries, data files, documentation, whitepapers - and the Articles.
    16. -
    17. "You" is you, an individual or entity wishing to use the Work and exercise - your rights under this License. -
    18. -
    -
  2. - -
  3. Fair Use/Fair Use Rights. Nothing in this License is intended to - reduce, limit, or restrict any rights arising from fair use, fair dealing, first - sale or other limitations on the exclusive rights of the copyright owner under copyright - law or other applicable laws. -
  4. - -
  5. License Grant. Subject to the terms and conditions of this License, - the Author hereby grants You a worldwide, royalty-free, non-exclusive, perpetual - (for the duration of the applicable copyright) license to exercise the rights in - the Work as stated below: - -
      -
    1. You may use the standard version of the Source Code or Executable Files in Your - own applications.
    2. -
    3. You may apply bug fixes, portability fixes and other modifications obtained from - the Public Domain or from the Author. A Work modified in such a way shall still - be considered the standard version and will be subject to this License.
    4. -
    5. You may otherwise modify Your copy of this Work (excluding the Articles) in any - way to create a Derivative Work, provided that You insert a prominent notice in - each changed file stating how, when and where You changed that file.
    6. -
    7. You may distribute the standard version of the Executable Files and Source Code - or Derivative Work in aggregate with other (possibly commercial) programs as part - of a larger (possibly commercial) software distribution.
    8. -
    9. The Articles discussing the Work published in any form by the author may not be - distributed or republished without the Author's consent. The author retains - copyright to any such Articles. You may use the Executable Files and Source Code - pursuant to this License but you may not repost or republish or otherwise distribute - or make available the Articles, without the prior written consent of the Author.
    10. -
    - - Any subroutines or modules supplied by You and linked into the Source Code or Executable - Files of this Work shall not be considered part of this Work and will not be subject - to the terms of this License. -
  6. - -
  7. Patent License. Subject to the terms and conditions of this License, - each Author hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, - irrevocable (except as stated in this section) patent license to make, have made, use, import, - and otherwise transfer the Work.
  8. - -
  9. Restrictions. The license granted in Section 3 above is expressly - made subject to and limited by the following restrictions: - -
      -
    1. You agree not to remove any of the original copyright, patent, trademark, and - attribution notices and associated disclaimers that may appear in the Source Code - or Executable Files.
    2. -
    3. You agree not to advertise or in any way imply that this Work is a product of Your - own.
    4. -
    5. The name of the Author may not be used to endorse or promote products derived from - the Work without the prior written consent of the Author.
    6. -
    7. You agree not to sell, lease, or rent any part of the Work. This does not restrict - you from including the Work or any part of the Work inside a larger software - distribution that itself is being sold. The Work by itself, though, cannot be sold, - leased or rented.
    8. -
    9. You may distribute the Executable Files and Source Code only under the terms of - this License, and You must include a copy of, or the Uniform Resource Identifier - for, this License with every copy of the Executable Files or Source Code You distribute - and ensure that anyone receiving such Executable Files and Source Code agrees that - the terms of this License apply to such Executable Files and/or Source Code. You - may not offer or impose any terms on the Work that alter or restrict the terms of - this License or the recipients' exercise of the rights granted hereunder. You - may not sublicense the Work. You must keep intact all notices that refer to this - License and to the disclaimer of warranties. You may not distribute the Executable - Files or Source Code with any technological measures that control access or use - of the Work in a manner inconsistent with the terms of this License.
    10. -
    11. You agree not to use the Work for illegal, immoral or improper purposes, or on pages - containing illegal, immoral or improper material. The Work is subject to applicable - export laws. You agree to comply with all such laws and regulations that may apply - to the Work after Your receipt of the Work. -
    12. -
    -
  10. - -
  11. Representations, Warranties and Disclaimer. THIS WORK IS PROVIDED - "AS IS", "WHERE IS" AND "AS AVAILABLE", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES - OR CONDITIONS OR GUARANTEES. YOU, THE USER, ASSUME ALL RISK IN ITS USE, INCLUDING - COPYRIGHT INFRINGEMENT, PATENT INFRINGEMENT, SUITABILITY, ETC. AUTHOR EXPRESSLY - DISCLAIMS ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES OR CONDITIONS, INCLUDING - WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF MERCHANTABILITY, MERCHANTABLE QUALITY - OR FITNESS FOR A PARTICULAR PURPOSE, OR ANY WARRANTY OF TITLE OR NON-INFRINGEMENT, - OR THAT THE WORK (OR ANY PORTION THEREOF) IS CORRECT, USEFUL, BUG-FREE OR FREE OF - VIRUSES. YOU MUST PASS THIS DISCLAIMER ON WHENEVER YOU DISTRIBUTE THE WORK OR DERIVATIVE - WORKS. -
  12. - -
  13. Indemnity. You agree to defend, indemnify and hold harmless the Author and - the Publisher from and against any claims, suits, losses, damages, liabilities, - costs, and expenses (including reasonable legal or attorneys’ fees) resulting from - or relating to any use of the Work by You. -
  14. - -
  15. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE - LAW, IN NO EVENT WILL THE AUTHOR OR THE PUBLISHER BE LIABLE TO YOU ON ANY LEGAL - THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES - ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK OR OTHERWISE, EVEN IF THE AUTHOR - OR THE PUBLISHER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -
  16. - -
  17. Termination. - -
      -
    1. This License and the rights granted hereunder will terminate automatically upon - any breach by You of any term of this License. Individuals or entities who have - received Derivative Works from You under this License, however, will not have their - licenses terminated provided such individuals or entities remain in full compliance - with those licenses. Sections 1, 2, 6, 7, 8, 9, 10 and 11 will survive any termination - of this License.
    2. - -
    3. If You bring a copyright, trademark, patent or any other infringement claim against - any contributor over infringements You claim are made by the Work, your License - from such contributor to the Work ends automatically.
    4. - -
    5. Subject to the above terms and conditions, this License is perpetual (for the duration - of the applicable copyright in the Work). Notwithstanding the above, the Author - reserves the right to release the Work under different license terms or to stop - distributing the Work at any time; provided, however that any such election will - not serve to withdraw this License (or any other license that has been, or is required - to be, granted under the terms of this License), and this License will continue - in full force and effect unless terminated as stated above. -
    6. -
    -
  18. - -
  19. Publisher. The parties hereby confirm that the Publisher shall - not, under any circumstances, be responsible for and shall not have any liability - in respect of the subject matter of this License. The Publisher makes no warranty - whatsoever in connection with the Work and shall not be liable to You or any party - on any legal theory for any damages whatsoever, including without limitation any - general, special, incidental or consequential damages arising in connection to this - license. The Publisher reserves the right to cease making the Work available to - You at any time without notice
  20. - -
  21. Miscellaneous - -
      -
    1. This License shall be governed by the laws of the location of the head office of - the Author or if the Author is an individual, the laws of location of the principal - place of residence of the Author.
    2. -
    3. If any provision of this License is invalid or unenforceable under applicable law, - it shall not affect the validity or enforceability of the remainder of the terms - of this License, and without further action by the parties to this License, such - provision shall be reformed to the minimum extent necessary to make such provision - valid and enforceable.
    4. -
    5. No term or provision of this License shall be deemed waived and no breach consented - to unless such waiver or consent shall be in writing and signed by the party to - be charged with such waiver or consent.
    6. -
    7. This License constitutes the entire agreement between the parties with respect to - the Work licensed herein. There are no understandings, agreements or representations - with respect to the Work not specified herein. The Author shall not be bound by - any additional provisions that may appear in any communication from You. This License - may not be modified without the mutual written agreement of the Author and You. -
    8. -
    - -
  22. -
- -
-
- - - diff --git a/renderdocui/Controls/TreeListView/README.txt b/renderdocui/Controls/TreeListView/README.txt deleted file mode 100644 index 9f8fe3929..000000000 --- a/renderdocui/Controls/TreeListView/README.txt +++ /dev/null @@ -1,7 +0,0 @@ -This control is almost entirely taken from http://www.codeproject.com/Articles/23746/TreeView-with-Columns by jkristia. - -Minor changes have been made to clean up, rename or reorganise - as well as a few fixes to the non-visual styles rendering path -and some additional changes for my use of the control (like having the tree controls in a column other than the first, which mostly -'Just Worked' (tm) ). - -So all credit goes to the above author! \ No newline at end of file diff --git a/renderdocui/Controls/TreeListView/TreeListColumn.Design.cs b/renderdocui/Controls/TreeListView/TreeListColumn.Design.cs deleted file mode 100644 index aea21daeb..000000000 --- a/renderdocui/Controls/TreeListView/TreeListColumn.Design.cs +++ /dev/null @@ -1,184 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Drawing; -using System.Text; -using System.Diagnostics; - -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Reflection; -using System.Windows.Forms; -using System.Windows.Forms.Design; - -// Taken from http://www.codeproject.com/Articles/23746/TreeView-with-Columns with minor tweaks -// and fixes for my purposes. -namespace TreelistView -{ - // http://msdn2.microsoft.com/en-us/library/9zky1t4k.aspx - - // Extending Design-Time Support - // ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxdeveloping/html/d6ac8a6a-42fd-4bc8-bf33-b212811297e2.htm - // http://msdn2.microsoft.com/en-us/library/37899azc.aspx - - // description of the property grid - // http://msdn2.microsoft.com/en-us/library/aa302326.aspx - // http://msdn2.microsoft.com/en-us/library/aa302334.aspx - - // another good one explaining - // http://www.codeproject.com/KB/cs/dzcollectioneditor.aspx?print=true - public class ColumnCollectionEditor : CollectionEditor - { - public ColumnCollectionEditor(Type type) : base(type) - { - } - protected override bool CanSelectMultipleInstances() - { - return false; - } - protected override Type CreateCollectionItemType() - { - return base.CreateCollectionItemType(); - } - protected override object CreateInstance(Type itemType) - { - TreeListView owner = this.Context.Instance as TreeListView; - // create new default fieldname - string fieldname; - string caption; - int cnt = owner.Columns.Count; - do - { - fieldname = "fieldname" + cnt.ToString(); - caption = "Column_" + cnt.ToString(); - cnt++; - } - while (owner.Columns[fieldname] != null); - return new TreeListColumn(fieldname, caption); - } - protected override string GetDisplayText(object value) - { - string Caption = (string)value.GetType().GetProperty("Caption").GetGetMethod().Invoke(value, null); - string Fieldname = (string)value.GetType().GetProperty("Fieldname").GetGetMethod().Invoke(value, null); - - if (Caption.Length > 0) - return string.Format("{0} ({1})", Caption, Fieldname); - return base.GetDisplayText(value); - } - public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) - { - object result = base.EditValue(context, provider, value); - TreeListView owner = this.Context.Instance as TreeListView; - owner.Invalidate(); - return result; - } - } - - internal class ColumnConverter : ExpandableObjectConverter - { - public override bool CanConvertTo(ITypeDescriptorContext context, Type destType) - { - if (destType == typeof(InstanceDescriptor) || destType == typeof(string)) - return true; - else - return base.CanConvertTo(context, destType); - } - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo info, object value, Type destType) - { - if (destType == typeof(string)) - { - string Caption = (string)value.GetType().GetProperty("Caption").GetGetMethod().Invoke(value, null); - string Fieldname = (string)value.GetType().GetProperty("Fieldname").GetGetMethod().Invoke(value, null); - - return String.Format("{0}, {1}", Caption, Fieldname); - } - if (destType == typeof(InstanceDescriptor)) - { - ConstructorInfo cinfo = typeof(TreeListColumn).GetConstructor(new Type[] { typeof(string), typeof(string) }); - - string Caption = (string)value.GetType().GetProperty("Caption").GetGetMethod().Invoke(value, null); - string Fieldname = (string)value.GetType().GetProperty("Fieldname").GetGetMethod().Invoke(value, null); - - return new InstanceDescriptor(cinfo, new object[] {Fieldname, Caption}, false); - } - return base.ConvertTo(context, info, value, destType); - } - } - class ColumnsTypeConverter : ExpandableObjectConverter - { - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - if (destinationType == typeof(TreeListColumnCollection)) - return true; - return base.CanConvertTo(context, destinationType); - } - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) - { - if (destinationType == typeof(string)) - return "(Columns Collection)"; - return base.ConvertTo(context, culture, value, destinationType); - } - } - - /// - /// Designer for the tree view control. - /// - class TreeListViewDesigner : ControlDesigner - { - IComponentChangeService onChangeService; - public override void Initialize(IComponent component) - { - base.Initialize(component); - - onChangeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); - if (onChangeService != null) - onChangeService.ComponentChanged += new ComponentChangedEventHandler(OnComponentChanged); - - // we need to be notified when columsn have been resized. - TreeListView tree = Control as TreeListView; - tree.AfterResizingColumn += new MouseEventHandler(OnAfterResizingColumn); - } - void OnAfterResizingColumn(object sender, MouseEventArgs e) - { - // This is to notify that component has changed. - // This is causing the code InitializeComponent code to be updated - RaiseComponentChanged(null, null, null); - } - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - } - void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - // repaint the control when any properties have changed - if(Control != null) - Control.Invalidate(); - } - protected override bool GetHitTest(Point point) - { - // if mouse is over node, columns or scrollbar then return true - // which will cause the mouse event to be forwarded to the control - TreeListView tree = Control as TreeListView; - point = tree.PointToClient(point); - - Node node = tree.CalcHitNode(point); - if (node != null) - return true; - - TreelistView.HitInfo colinfo = tree.CalcColumnHit(point); - if ((int)(colinfo.HitType & HitInfo.eHitType.kColumnHeader) > 0) - return true; - - if (tree.HitTestScrollbar(point)) - return true; - return base.GetHitTest(point); - } - - protected override void PostFilterProperties(IDictionary properties) - { - //properties.Remove("Cursor"); - base.PostFilterProperties(properties); - } - } -} diff --git a/renderdocui/Controls/TreeListView/TreeListColumn.cs b/renderdocui/Controls/TreeListView/TreeListColumn.cs deleted file mode 100644 index b352d86bb..000000000 --- a/renderdocui/Controls/TreeListView/TreeListColumn.cs +++ /dev/null @@ -1,624 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Drawing; -using System.Text; -using System.Diagnostics; - -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Reflection; -using System.Windows.Forms; - -// Taken from http://www.codeproject.com/Articles/23746/TreeView-with-Columns with minor tweaks -// and fixes for my purposes. -namespace TreelistView -{ - public class HitInfo - { - public enum eHitType - { - kColumnHeader = 0x0001, - kColumnHeaderResize = 0x0002, - } - - public eHitType HitType = 0; - public TreeListColumn Column = null; - } - - /// - /// DesignTimeVisible(false) prevents the columns from showing in the component tray (bottom of screen) - /// If the class implement IComponent it must also implement default (void) constructor and when overriding - /// the collection editors CreateInstance the return object must be used (if implementing IComponent), the reason - /// is that ISite is needed, and ISite is set when base.CreateInstance is called. - /// If no default constructor then the object will not be added to the collection in the initialize. - /// In addition if implementing IComponent then name and generatemember is shown in the property grid - /// Columns should just be added to the collection, no need for member, so no need to implement IComponent - /// - [DesignTimeVisible(false)] - [TypeConverter(typeof(ColumnConverter))] - public class TreeListColumn - { - TreeList.TextFormatting m_headerFormat = new TreeList.TextFormatting(); - TreeList.TextFormatting m_cellFormat = new TreeList.TextFormatting(); - [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public TreeList.TextFormatting HeaderFormat - { - get { return m_headerFormat; } - } - [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public TreeList.TextFormatting CellFormat - { - get { return m_cellFormat; } - } - - TreeListColumnCollection m_owner = null; - Rectangle m_calculatedRect; - int m_visibleIndex = -1; - int m_colIndex = -1; - int m_width = 50; - string m_fieldName = string.Empty; - string m_caption = string.Empty; - - bool m_Moving = false; - - internal TreeListColumnCollection Owner - { - get { return m_owner; } - set { m_owner = value; } - } - internal Rectangle internalCalculatedRect - { - get { return m_calculatedRect; } - set { m_calculatedRect = value; } - } - internal int internalVisibleIndex - { - get { return m_visibleIndex; } - set { m_visibleIndex = value; } - } - internal int internalIndex - { - get { return m_colIndex; } - set { m_colIndex = value; } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool Moving - { - get { return m_Moving; } - set - { - m_Moving = value; - } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public Rectangle CalculatedRect - { - get { return internalCalculatedRect; } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public TreeListView TreeList - { - get - { - if (Owner == null) - return null; - return Owner.Owner; - } - } - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public Font Font - { - get { return m_owner.Font; } - } - public int Width - { - get { return m_width; } - set - { - if (m_width == value) - return; - m_width = value; - if (m_owner != null && m_owner.DesignMode) - m_owner.RecalcVisibleColumsRect(); - } - } - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public string Caption - { - get { return m_caption; } - set - { - m_caption = value; - if (m_owner != null) - m_owner.Invalidate(); - } - } - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public string Fieldname - { - get { return m_fieldName; } - set - { - if (m_owner == null || m_owner.DesignMode == false) - throw new Exception("Fieldname can only be set at design time, Use Constructor to set programatically"); - if (value.Length == 0) - throw new Exception("empty Fieldname not value"); - if (m_owner[value] != null) - throw new Exception("fieldname already exist in collection"); - m_fieldName = value; - } - } - - public TreeListColumn(string fieldName) - { - m_fieldName = fieldName; - } - public TreeListColumn(string fieldName, string caption) - { - m_fieldName = fieldName; - m_caption = caption; - } - public TreeListColumn(string fieldName, string caption, int width) - { - m_fieldName = fieldName; - m_caption = caption; - m_width = width; - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public int VisibleIndex - { - get { return internalVisibleIndex; } - set - { - if (m_owner != null) - m_owner.SetVisibleIndex(this, value); - } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public int Index - { - get { return internalIndex; } - } - public bool ishot = false; - public virtual void Draw(Graphics dc, ColumnHeaderPainter painter, Rectangle r) - { - painter.DrawHeader(dc, r, this, this.HeaderFormat, ishot, m_Moving); - } - - bool m_autoSize = false; - float m_autoSizeRatio = 100; - int m_autoSizeMinSize; - - [DefaultValue(false)] - public bool AutoSize - { - get { return m_autoSize; } - set { m_autoSize = value; } - } - [DefaultValue(100f)] - public float AutoSizeRatio - { - get { return m_autoSizeRatio; } - set { m_autoSizeRatio = value; } - } - public int AutoSizeMinSize - { - get { return m_autoSizeMinSize; } - set { m_autoSizeMinSize = value; } - } - int m_calculatedAutoSize; - internal int CalculatedAutoSize - { - get { return m_calculatedAutoSize; } - set { m_calculatedAutoSize = value; } - } - } - - [Description("This is the columns collection")] - //[TypeConverterAttribute(typeof(ColumnsTypeConverter))] - [Editor(typeof(ColumnCollectionEditor),typeof(System.Drawing.Design.UITypeEditor))] - public class TreeListColumnCollection : IList, IList - { - ColumnHeaderPainter m_painter; - TreeList.CollumnSetting m_options; - TreeListView m_owner; - List m_columns = new List(); - List m_visibleCols = new List(); - Dictionary m_columnMap = new Dictionary(); - - [Browsable(false)] - public TreeList.CollumnSetting Options - { - get { return m_options; } - } - [Browsable(false)] - public ColumnHeaderPainter Painter - { - get { return m_painter; } - set { m_painter = value; } - } - [Browsable(false)] - public TreeListView Owner - { - get { return m_owner; } - } - [Browsable(false)] - public Font Font - { - get { return m_owner.Font; } - } - [Browsable(false)] - public TreeListColumn[] VisibleColumns - { - get { return m_visibleCols.ToArray(); } - } - [Browsable(false)] - public int ColumnsWidth - { - get - { - int width = 0; - foreach (TreeListColumn col in m_visibleCols) - { - if (col.AutoSize) - width += col.CalculatedAutoSize; - else - width += col.Width; - } - return width; - } - } - public TreeListColumnCollection(TreeListView owner) - { - m_owner = owner; - m_options = new TreeList.CollumnSetting(owner); - m_painter = new ColumnHeaderPainter(owner); - } - public TreeListColumn this[int index] - { - get - { - return m_columns[index]; - } - set - { - m_columns[index] = value; - } - } - public TreeListColumn this[string fieldname] - { - get - { - TreeListColumn col; - m_columnMap.TryGetValue(fieldname, out col); - return col; - } - } - public void SetVisibleIndex(TreeListColumn col, int index) - { - m_visibleCols.Remove(col); - if (index >= 0) - { - if (index < m_visibleCols.Count) - m_visibleCols.Insert(index, col); - else - m_visibleCols.Add(col); - } - RecalcVisibleColumsRect(); - } - public HitInfo CalcHitInfo(Point point, int horzOffset) - { - HitInfo info = new HitInfo(); - info.Column = CalcHitColumn(point, horzOffset); - if ((info.Column != null) && (point.Y < Options.HeaderHeight)) - { - info.HitType |= HitInfo.eHitType.kColumnHeader; - int right = info.Column.CalculatedRect.Right - horzOffset; - if (info.Column.AutoSize == false || info.Column.internalIndex+1 < m_columns.Count) - { - if (point.X >= right - 4 && point.X <= right) - info.HitType |= HitInfo.eHitType.kColumnHeaderResize; - } - } - return info; - } - public TreeListColumn CalcHitColumn(Point point, int horzOffset) - { - if (point.X < Options.LeftMargin) - return null; - foreach (TreeListColumn col in m_visibleCols) - { - int left = col.CalculatedRect.Left - horzOffset; - int right = col.CalculatedRect.Right - horzOffset; - if (point.X >= left && point.X <= right) - return col; - } - return null; - } - public void RecalcVisibleColumsRect() - { - RecalcVisibleColumsRect(false); - } - public void RecalcVisibleColumsRect(bool isColumnResizing) - { - if (IsInitializing) - return; - int x = 0;//m_leftMargin; - if (m_owner.RowOptions.ShowHeader) - x = m_owner.RowOptions.HeaderWidth; - int y = 0; - int h = Options.HeaderHeight; - int index = 0; - foreach(TreeListColumn col in m_columns) - { - col.internalVisibleIndex = -1; - col.internalIndex = index++; - } - - // calculate size requierd by fix columns and auto adjusted columns - // at the same time calculate total ratio value - int widthFixedColumns = 0; - int widthAutoSizeColumns = 0; - float totalRatio = 0; - foreach (TreeListColumn col in m_visibleCols) - { - if (col.AutoSize) - { - widthAutoSizeColumns += col.AutoSizeMinSize; - totalRatio += col.AutoSizeRatio; - } - else - widthFixedColumns += col.Width; - } - - int clientWidth = m_owner.ClientRectangle.Width - m_owner.RowHeaderWidth(); - // find ratio 'unit' value - float remainingWidth = clientWidth - (widthFixedColumns + widthAutoSizeColumns); - float ratioUnit = 0; - if (totalRatio > 0 && remainingWidth > 0) - ratioUnit = remainingWidth / totalRatio; - - for (index = 0; index < m_visibleCols.Count; index++) - { - TreeListColumn col = m_visibleCols[index]; - int width = col.Width; - if (col.AutoSize) - { - // if doing column resizing then keep adjustable columns fixed at last width - if (m_options.FreezeWhileResizing && isColumnResizing) - width = col.CalculatedAutoSize; - else - width = Math.Max(10, col.AutoSizeMinSize + (int)Math.Round(ratioUnit * col.AutoSizeRatio - 1.0f)); - col.CalculatedAutoSize = width; - } - col.internalCalculatedRect = new Rectangle(x, y, width, h); - col.internalVisibleIndex = index; - x += width; - } - Invalidate(); - } - public void Draw(Graphics dc, Rectangle rect, int horzOffset) - { - foreach (TreeListColumn col in m_visibleCols) - { - Rectangle r = col.CalculatedRect; - r.X -= horzOffset; - if (r.Left > rect.Right) - break; - col.Draw(dc, m_painter, r); - } - // drwa row header filler - if (m_owner.RowOptions.ShowHeader) - { - Rectangle r = new Rectangle(0, 0, m_owner.RowOptions.HeaderWidth, Options.HeaderHeight); - m_painter.DrawHeaderFiller(dc, r); - } - } - public void AddRange(IEnumerable columns) - { - foreach (TreeListColumn col in columns) - Add(col); - } - /// - /// AddRange(Item[]) is required for the designer. - /// - /// - public void AddRange(TreeListColumn[] columns) - { - foreach (TreeListColumn col in columns) - Add(col); - } - public void Add(TreeListColumn item) - { - bool designmode = Owner.DesignMode; - if (!designmode) - { - Debug.Assert(m_columnMap.ContainsKey(item.Fieldname) == false); - Debug.Assert(item.Owner == null, "column.Owner == null"); - } - else - { - m_columns.Remove(item); - m_visibleCols.Remove(item); - } - - item.Owner = this; - m_columns.Add(item); - m_visibleCols.Add(item); - m_columnMap[item.Fieldname] = item; - RecalcVisibleColumsRect(); - //return item; - } - public void Clear() - { - m_columnMap.Clear(); - m_columns.Clear(); - m_visibleCols.Clear(); - } - public bool Contains(TreeListColumn item) - { - return m_columns.Contains(item); - } - [Browsable(false)] - public int Count - { - get { return m_columns.Count; } - } - [Browsable(false)] - public bool IsReadOnly - { - get { return false; } - } - #region IList Members - - public int IndexOf(TreeListColumn item) - { - return m_columns.IndexOf(item); - } - - public void Insert(int index, TreeListColumn item) - { - m_columns.Insert(index, item); - } - - public void RemoveAt(int index) - { - if (index >= 0 && index < m_columns.Count) - { - TreeListColumn col = m_columns[index]; - SetVisibleIndex(col, -1); - m_columnMap.Remove(col.Fieldname); - } - m_columns.RemoveAt(index); - } - - #endregion - #region ICollection Members - - - public void CopyTo(TreeListColumn[] array, int arrayIndex) - { - m_columns.CopyTo(array, arrayIndex); - } - - public bool Remove(TreeListColumn item) - { - SetVisibleIndex(item, -1); - m_columnMap.Remove(item.Fieldname); - return m_columns.Remove(item); - } - - #endregion - #region IEnumerable Members - - public IEnumerator GetEnumerator() - { - return m_columns.GetEnumerator(); - } - - #endregion - #region IEnumerable Members - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - #endregion - #region IList Members - int IList.Add(object value) - { - Add((TreeListColumn)value); - return Count - 1; - } - bool IList.Contains(object value) - { - return Contains((TreeListColumn)value); - } - int IList.IndexOf(object value) - { - return IndexOf((TreeListColumn)value); - } - void IList.Insert(int index, object value) - { - Insert(index, (TreeListColumn)value); - } - - bool IList.IsFixedSize - { - get { return false; } - } - - void IList.Remove(object value) - { - Remove((TreeListColumn)value); - } - - object IList.this[int index] - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - #endregion - #region ICollection Members - - public void CopyTo(Array array, int index) - { - throw new Exception("The method or operation is not implemented."); - } - - public bool IsSynchronized - { - get { throw new Exception("The method or operation is not implemented."); } - } - - public object SyncRoot - { - get { throw new Exception("The method or operation is not implemented."); } - } - - #endregion - - internal bool DesignMode - { - get - { - if (m_owner != null) - return m_owner.DesignMode; - return false; - } - } - internal void Invalidate() - { - if (m_owner != null) - m_owner.Invalidate(); - } - bool IsInitializing = false; - internal void BeginInit() - { - IsInitializing = true; - } - internal void EndInit() - { - IsInitializing = false; - RecalcVisibleColumsRect(); - } - } -} diff --git a/renderdocui/Controls/TreeListView/TreeListNode.cs b/renderdocui/Controls/TreeListView/TreeListNode.cs deleted file mode 100644 index 605b28c08..000000000 --- a/renderdocui/Controls/TreeListView/TreeListNode.cs +++ /dev/null @@ -1,1139 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using System.Diagnostics; - -// Taken from http://www.codeproject.com/Articles/23746/TreeView-with-Columns with minor tweaks -// and fixes for my purposes. -namespace TreelistView -{ - public class Node - { - NodeCollection m_owner = null; - Node m_prevSibling = null; - Node m_nextSibling = null; - NodeCollection m_children = null; - bool m_hasChildren = false; - bool m_expanded = false; - Image m_image = null; - Image m_hoverImage = null; - int m_treeColumn = -1; - int m_id = -1; - object m_tag = null; - bool m_clippedText = false; - bool m_bold = false; - bool m_italic = false; - float m_treeLineWidth = 0.0f; - Color m_backCol = Color.Transparent; - Color m_foreCol = Color.Transparent; - Color m_treeLineCol = Color.Transparent; - Color m_defbackCol = Color.Transparent; - - Color[] m_backCols = null; - - private TreeListView m_ownerview = null; - public TreeListView OwnerView - { - get - { - if (m_ownerview != null) - return m_ownerview; - - if (m_owner != null) - m_ownerview = m_owner.OwnerView; - - return m_ownerview; - } - - set - { - m_ownerview = value; - } - } - - public Node Parent - { - get - { - if (m_owner != null) - return m_owner.Owner; - return null; - } - } - public Node PrevSibling - { - get { return m_prevSibling; } - } - public Node NextSibling - { - get { return m_nextSibling; } - } - public bool HasChildren - { - get - { - if (m_children != null && m_children.IsEmpty() == false) - return true; - return m_hasChildren; - } - set - { - m_hasChildren = value; - } - } - public bool ClippedText - { - get { return m_clippedText; } - set { m_clippedText = value; } - } - public Image Image - { - get { return m_image; } - set { m_image = value; } - } - public Image HoverImage - { - get { return m_hoverImage != null ? m_hoverImage : m_image; } - set { m_hoverImage = value; } - } - public int TreeColumn - { - get { return m_treeColumn; } - set { m_treeColumn = value; } - } - public virtual NodeCollection Owner - { - get { return m_owner; } - } - public virtual NodeCollection Nodes - { - get - { - if (m_children == null) - { - m_children = new NodeCollection(this); - m_children.OwnerView = OwnerView; - } - return m_children; - } - } - public bool Expanded - { - get { return m_expanded && HasChildren; } - set - { - if (m_expanded == value) - return; - NodeCollection root = GetRootCollection(); - if (root != null) - root.NodetifyBeforeExpand(this, value); - - int oldcount = VisibleNodeCount; - m_expanded = value; - if (m_expanded) - UpdateOwnerTotalCount(1, VisibleNodeCount); - else - UpdateOwnerTotalCount(oldcount, 1); - - if (root != null) - root.NodetifyAfterExpand(this, value); - } - } - public void Collapse() - { - Expanded = false; - } - public void CollapseAll() - { - Expanded = false; - if (HasChildren) - { - foreach (Node node in Nodes) - node.CollapseAll(); - } - } - public void Expand() - { - Expanded = true; - } - public void ExpandAll() - { - Expanded = true; - if (HasChildren) - { - foreach (Node node in Nodes) - node.ExpandAll(); - } - } - public object Tag - { - get { return m_tag; } - set { m_tag = value; } - } - - public bool Italic - { - get { return m_italic; } - set { m_italic = value; } - } - public bool Bold - { - get { return m_bold; } - set { m_bold = value; } - } - public float TreeLineWidth - { - get { return m_treeLineWidth; } - set { m_treeLineWidth = value; } - } - public Color BackColor - { - get { return m_backCol; } - set { m_backCol = value; } - } - public Color ForeColor - { - get { return m_foreCol; } - set { m_foreCol = value; } - } - public Color TreeLineColor - { - get { return m_treeLineCol; } - set { m_treeLineCol = value; } - } - public Color DefaultBackColor - { - get { return m_defbackCol; } - set { m_defbackCol = value; } - } - public Color[] IndexedBackColor - { - get - { - return m_backCols; - } - } - - public Node() - { - m_data = new object[1]; - m_backCols = new Color[1] { Color.Transparent }; - } - public Node(string text) - { - m_data = new object[1] { text }; - m_backCols = new Color[1] { Color.Transparent }; - } - public Node(object[] fields) - { - SetData(fields); - } - public int Count - { - get - { - return m_data.Length; - } - } - object[] m_data = null; - public object this [string fieldname] - { - get - { - return this[Owner.FieldIndex(fieldname)]; - } - set - { - if (Owner == null) - return; - this[Owner.FieldIndex(fieldname)] = value; - } - } - public object this [int index] - { - get - { - if (index < 0 || index >= m_data.Length) - return null; - return m_data[index]; - } - set - { - AssertData(index); - m_data[index] = value; - } - } - public object[] GetData() - { - return m_data; - } - public void SetData(object[] fields) - { - m_data = new object[fields.Length]; - fields.CopyTo(m_data, 0); - - m_backCols = new Color[fields.Length]; - for (int i = 0; i < fields.Length; i++) m_backCols[i] = Color.Transparent; - } - public int VisibleNodeCount - { - get - { - // can not use Expanded property here as it returns false node has no children - if (m_expanded) - return m_childVisibleCount + 1; - return 1; - } - } - /// - /// MakeVisible will expand all the parents up the tree. - /// - public void MakeVisible() - { - Node parent = Parent; - while (parent != null) - { - parent.Expanded = true; - parent = parent.Parent; - } - } - /// - /// IsVisible returns true if all parents are expanded, else false - /// - public bool IsVisible() - { - Node parent = Parent; - while (parent != null) - { - // parent not expanded, so this node is not visible - if (parent.Expanded == false) - return false; - // parent not hooked up to a collection, so this node is not visible - if (parent.Owner == null) - return false; - parent = parent.Parent; - } - return true; - } - public Node GetRoot() - { - Node parent = this; - while (parent.Parent != null) - parent = parent.Parent; - return parent; - } - public NodeCollection GetRootCollection() - { - return GetRoot().Owner; - } - internal void InsertBefore(Node insertBefore, NodeCollection owner) - { - this.m_owner = owner; - Node next = insertBefore; - Node prev = null; - if (next != null) - { - prev = insertBefore.PrevSibling; - next.m_prevSibling = this; - } - if (prev != null) - prev.m_nextSibling = this; - - this.m_nextSibling = next; - this.m_prevSibling = prev; - UpdateOwnerTotalCount(0, VisibleNodeCount); - } - internal void InsertAfter(Node insertAfter, NodeCollection owner) - { - this.m_owner = owner; - Node prev = insertAfter; - Node next = null; - if (prev != null) - { - next = prev.NextSibling; - prev.m_nextSibling = this; - this.m_prevSibling = prev; - } - if (next != null) - next.m_prevSibling = this; - this.m_nextSibling = next; - UpdateOwnerTotalCount(0, VisibleNodeCount); - } - internal void Remove() - { - Node prev = this.PrevSibling; - Node next = this.NextSibling; - if (prev != null) - prev.m_nextSibling = next; - if (next != null) - next.m_prevSibling = prev; - - this.m_nextSibling = null; - this.m_prevSibling = null; - UpdateOwnerTotalCount(VisibleNodeCount, 0); - this.m_owner = null; - this.m_id = -1; - } - internal static void SetHasChildren(Node node, bool hasChildren) - { - if (node != null) - node.m_hasChildren = hasChildren; - } - public int NodeIndex - { - get { return Id;} - } - internal int Id - { - get - { - if (m_owner == null) - return -1; - m_owner.UpdateChildIds(false); - return m_id; - } - set { m_id = value; } - } - int m_childVisibleCount = 0; - void UpdateTotalCount(int oldValue, int newValue) - { - int old = VisibleNodeCount; - m_childVisibleCount += (newValue - oldValue); - UpdateOwnerTotalCount(old, VisibleNodeCount); - } - void UpdateOwnerTotalCount(int oldValue, int newValue) - { - if (Owner != null) - Owner.internalUpdateNodeCount(oldValue, newValue); - if (Parent != null) - Parent.UpdateTotalCount(oldValue, newValue); - } - - void AssertData(int index) - { - Debug.Assert(index >= 0, "index >= 0"); - Debug.Assert(index < m_data.Length, "index < m_data.Length"); - } - } - public class NodeCollection : IEnumerable - { - internal int m_version = 0; - int m_nextId = 0; - int m_IdDirty = 0; - - private TreeListView m_ownerview = null; - public TreeListView OwnerView - { - get - { - if(m_ownerview != null) - return m_ownerview; - - if(m_owner != null) - m_ownerview = m_owner.OwnerView; - - return m_ownerview; - } - - set - { - m_ownerview = value; - } - } - - Node[] m_nodesInternal = null; - Node m_owner = null; - Node m_firstNode = null; - Node m_lastNode = null; - int m_count = 0; - public Node Owner - { - get { return m_owner; } - } - public Node FirstNode - { - get { return m_firstNode; } - } - public Node LastNode - { - get { return m_lastNode; } - } - public bool IsEmpty() - { - return m_firstNode == null; - } - public int Count - { - get { return m_count; } - } - public NodeCollection(Node owner) - { - m_owner = owner; - } - public virtual void Clear() - { - m_version++; - while (m_firstNode != null) - { - Node node = m_firstNode; - m_firstNode = node.NextSibling; - node.Remove(); - } - m_firstNode = null; - m_lastNode = null; - m_count = 0; - m_totalNodeCount = 0; - m_IdDirty = 0; - m_nextId = 0; - ClearInternalArray(); - Node.SetHasChildren(m_owner, m_count != 0); - } - public Node Add(string text) - { - return Add(new Node(text)); - } - public Node Add(object[] data) - { - return Add(new Node(data)); - } - public Node Add(Node newnode) - { - m_version++; - ClearInternalArray(); - Debug.Assert(newnode != null && newnode.Owner == null, "Add(Node newnode)"); - newnode.InsertAfter(m_lastNode, this); - m_lastNode = newnode; - if (m_firstNode == null) - m_firstNode = newnode; - newnode.Id = m_nextId++; - m_count++; - newnode.OwnerView = OwnerView; - return newnode; - } - public void Remove(Node node) - { - if (m_lastNode == null) - return; - m_version++; - ClearInternalArray(); - Debug.Assert(node != null && object.ReferenceEquals(node.Owner, this), "Remove(Node node)"); - - Node prev = node.PrevSibling; - Node next = node.NextSibling; - node.Remove(); - - if (prev == null) // first node - m_firstNode = next; - if (next == null) // last node - m_lastNode = prev; - m_IdDirty++; - m_count--; - Node.SetHasChildren(m_owner, m_count != 0); - } - public void InsertAfter(Node node, Node insertAfter) - { - m_version++; - ClearInternalArray(); - Debug.Assert(node.Owner == null, "node.Owner == null"); - if (insertAfter == null) - { - node.InsertBefore(m_firstNode, this); - m_firstNode = node; - } - else - { - node.InsertAfter(insertAfter, this); - } - if (m_lastNode == insertAfter) - { - m_lastNode = node; - node.Id = m_nextId++; - } - else - m_IdDirty++; - m_count++; - } - public Node this [int index] - { - get - { - Debug.Assert(index >= 0 && index < Count, "Index out of range"); - if (index >= Count) - throw new IndexOutOfRangeException(string.Format("Node this [{0}], Collection Count {1}", index, Count)); - EnsureInternalArray(); - return m_nodesInternal[index]; - } - } - - public Node NodeAtIndex(int index) - { - Node node = FirstNode; - while (index-- > 0 && node != null) - node = node.NextSibling; - return node; - } - public int GetNodeIndex(Node node) - { - int index = 0; - Node tmp = FirstNode; - while (tmp != null && tmp != node) - { - tmp = tmp.NextSibling; - index++; - } - if (tmp == null) - return -1; - return index; - } - public virtual int FieldIndex(string fieldname) - { - NodeCollection rootCollection = this; - while (rootCollection.Owner != null && rootCollection.Owner.Owner != null) - rootCollection = rootCollection.Owner.Owner; - return rootCollection.GetFieldIndex(fieldname); - } - public Node FirstVisibleNode() - { - return FirstNode; - } - public Node LastVisibleNode(bool recursive) - { - if (recursive) - return FindNodesBottomLeaf(LastNode, true); - return LastNode; - } - public virtual void NodetifyBeforeExpand(Node nodeToExpand, bool expanding) - { - } - public virtual void NodetifyAfterExpand(Node nodeToExpand, bool expanding) - { - } - internal void UpdateChildIds(bool recursive) - { - if (recursive == false && m_IdDirty == 0) - return; - m_IdDirty = 0; - m_nextId = 0; - foreach (Node node in this) - { - node.Id = m_nextId++; - if (node.HasChildren && recursive) - node.Nodes.UpdateChildIds(true); - } - } - protected virtual int GetFieldIndex(string fieldname) - { - return -1; - } - public Node slowGetNodeFromVisibleIndex(int index) - { - int startindex = index; - RecursiveNodesEnumerator iterator = new RecursiveNodesEnumerator(m_firstNode, true); - while (iterator.MoveNext()) - { - index--; - if (index < 0) - { - return iterator.Current as Node; - } - } - return null; - } - - public System.Collections.Generic.IEnumerator GetEnumerator() - { - var enm = new NodesEnumerator(m_firstNode); - - while (enm.MoveNext()) - { - yield return (Node)enm.Current; - } - } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return new NodesEnumerator(m_firstNode); - } - /// - /// TotalRowCount returns the total number of 'visible' nodes. Visible meaning visible for the - /// tree view, This is used to determine the size of the scroll bar - /// If 10 nodes each has 10 children and 9 of them are expanded, then 100 will be returned. - /// - /// - public virtual int slowTotalRowCount(bool mustBeVisible) - { - int cnt = 0; - RecursiveNodesEnumerator iterator = new RecursiveNodesEnumerator(this, mustBeVisible); - while (iterator.MoveNext()) - cnt++; - //Debug.Assert(cnt == m_totalNodeCount); - return cnt; - } - public virtual int VisibleNodeCount - { - get { return m_totalNodeCount; } - } - /// - /// Returns the number of pixels required to show all visible nodes - /// - - void EnsureInternalArray() - { - if (m_nodesInternal != null) - { - Debug.Assert(m_nodesInternal.Length == Count, "m_nodesInternal.Length == Count"); - return; - } - m_nodesInternal = new Node[Count]; - int index = 0; - foreach (Node xnode in this) - m_nodesInternal[index++] = xnode; - } - void ClearInternalArray() - { - m_nodesInternal = null; - } - - int m_totalNodeCount = 0; - protected virtual void UpdateNodeCount(int oldvalue, int newvalue) - { - m_totalNodeCount += (newvalue - oldvalue); - } - internal void internalUpdateNodeCount(int oldvalue, int newvalue) - { - UpdateNodeCount(oldvalue, newvalue); - } - internal class NodesEnumerator : IEnumerator - { - Node m_firstNode; - Node m_current = null; - public NodesEnumerator(Node firstNode) - { - m_firstNode = firstNode; - } - public object Current - { - get { return m_current; } - } - public bool MoveNext() - { - if (m_firstNode == null) - return false; - if (m_current == null) - { - m_current = m_firstNode; - return true; - } - m_current = m_current.NextSibling; - return m_current != null; - } - public void Reset() - { - m_current = null; - } - } - internal class RecursiveNodesEnumerator : IEnumerator - { - class NodeCollIterator : IEnumerator - { - Node m_firstNode; - Node m_current; - bool m_visible; - public NodeCollIterator(NodeCollection collection, bool mustBeVisible) - { - m_firstNode = collection.FirstNode; - m_visible = mustBeVisible; - } - public Node Current - { - get { return m_current; } - } - object IEnumerator.Current - { - get { return m_current; } - } - public bool MoveNext() - { - if (m_firstNode == null) - return false; - if (m_current == null) - { - m_current = m_firstNode; - return true; - } - if (m_current.HasChildren && m_current.Nodes.FirstNode != null) - { - if (m_visible == false || m_current.Expanded) - { - m_current = m_current.Nodes.FirstNode; - return true; - } - } - if (m_current == m_firstNode) - { - m_firstNode = m_firstNode.NextSibling; - m_current = m_firstNode; - return m_current != null; - } - if (m_current.NextSibling != null) - { - m_current = m_current.NextSibling; - return true; - } - - // search up the parent tree - while (m_current.Parent != null) - { - m_current = m_current.Parent; - // back at collection level, now go to next sibling - if (m_current == m_firstNode) - { - m_firstNode = m_firstNode.NextSibling; - m_current = m_firstNode; - return m_current != null; - } - if (m_current.NextSibling != null) - { - m_current = m_current.NextSibling; - return true; - } - } - m_current = null; - return false; - } - public void Reset() - { - m_current = null; - } - public void Dispose() - { - throw new Exception("The method or operation is not implemented."); - } - } - IEnumerator m_enumerator = null; - public RecursiveNodesEnumerator(Node firstNode, bool mustBeVisible) - { - m_enumerator = new ForwardNodeEnumerator(firstNode, mustBeVisible); - } - public RecursiveNodesEnumerator(NodeCollection collection, bool mustBeVisible) - { - m_enumerator = new NodeCollIterator(collection, mustBeVisible); - } - public Node Current - { - get { return m_enumerator.Current; } - } - object IEnumerator.Current - { - get { return m_enumerator.Current; } - } - public bool MoveNext() - { - return m_enumerator.MoveNext(); - } - public void Reset() - { - m_enumerator.Reset(); - } - public void Dispose() - { - m_enumerator.Dispose(); - } - } - internal class ForwardNodeEnumerator : IEnumerator - { - Node m_firstNode; - Node m_current; - bool m_visible; - public ForwardNodeEnumerator(Node firstNode, bool mustBeVisible) - { - m_firstNode = firstNode; - m_visible = mustBeVisible; - } - public Node Current - { - get { return m_current; } - } - public void Dispose() - { - } - object IEnumerator.Current - { - get { return m_current; } - } - public bool MoveNext() - { - if (m_firstNode == null) - return false; - if (m_current == null) - { - m_current = m_firstNode; - return true; - } - if (m_current.HasChildren && m_current.Nodes.FirstNode != null) - { - if (m_visible == false || m_current.Expanded) - { - m_current = m_current.Nodes.FirstNode; - return true; - } - } - if (m_current.NextSibling != null) - { - m_current = m_current.NextSibling; - return true; - } - // search up the paret tree until we find a parent with a sibling - while (m_current.Parent != null && m_current.Parent.NextSibling == null) - { - m_current = m_current.Parent; - } - - if (m_current.Parent != null && m_current.Parent.NextSibling != null) - { - m_current = m_current.Parent.NextSibling; - return true; - } - m_current = null; - return false; - } - public void Reset() - { - m_current = m_firstNode; - } - } - internal class ReverseNodeEnumerator : IEnumerator - { - Node m_firstNode; - Node m_current; - bool m_visible; - public ReverseNodeEnumerator(Node firstNode, bool mustBeVisible) - { - m_firstNode = firstNode; - m_visible = mustBeVisible; - } - public Node Current - { - get { return m_current; } - } - public void Dispose() - { - } - object IEnumerator.Current - { - get { return m_current; } - } - public bool MoveNext() - { - if (m_firstNode == null) - return false; - if (m_current == null) - { - m_current = m_firstNode; - return true; - } - if (m_current.PrevSibling != null) - { - m_current = FindNodesBottomLeaf(m_current.PrevSibling, m_visible); - return true; - } - if (m_current.Parent != null) - { - m_current = m_current.Parent; - return true; - } - m_current = null; - return false; - } - public void Reset() - { - m_current = m_firstNode; - } - } - - public static Node GetNextNode(Node startingNode, int searchOffset) - { - if (searchOffset == 0) - return startingNode; - if (searchOffset > 0) - { - ForwardNodeEnumerator iterator = new ForwardNodeEnumerator(startingNode, true); - while (searchOffset-- >= 0 && iterator.MoveNext()); - return iterator.Current; - } - if (searchOffset < 0) - { - ReverseNodeEnumerator iterator = new ReverseNodeEnumerator(startingNode, true); - while (searchOffset++ <= 0 && iterator.MoveNext()); - return iterator.Current; - } - return null; - } - - public static IEnumerable ReverseNodeIterator(Node firstNode, Node lastNode, bool mustBeVisible) - { - bool m_done = false; - ReverseNodeEnumerator iterator = new ReverseNodeEnumerator(firstNode, mustBeVisible); - while (iterator.MoveNext()) - { - if (m_done) - break; - if (iterator.Current == lastNode) - m_done = true; - yield return iterator.Current; - } - } - public static IEnumerable ForwardNodeIterator(Node firstNode, Node lastNode, bool mustBeVisible) - { - bool m_done = false; - ForwardNodeEnumerator iterator = new ForwardNodeEnumerator(firstNode, mustBeVisible); - while (iterator.MoveNext()) - { - if (m_done) - break; - if (iterator.Current == lastNode) - m_done = true; - yield return iterator.Current; - } - } - public static IEnumerable ForwardNodeIterator(Node firstNode, bool mustBeVisible) - { - ForwardNodeEnumerator iterator = new ForwardNodeEnumerator(firstNode, mustBeVisible); - while (iterator.MoveNext()) - yield return iterator.Current; - } - public static int GetVisibleNodeIndex(Node node) - { - if (node == null || node.IsVisible() == false || node.GetRootCollection() == null) - return -1; - - // Finding the node index is done by searching up the tree and use the visible node count from each node. - // First all previous siblings are searched, then when first sibling in the node collection is reached - // the node is switch to the parent node and the again a search is done up the sibling list. - // This way only higher up the tree are being iterated while nodes at the same level are skipped. - // Worst case scenario is if all nodes are at the same level. In that case the search is a linear search. - - // adjust count for the visible count of the current node. - int count = -node.VisibleNodeCount; - while (node != null) - { - count += node.VisibleNodeCount; - if (node.PrevSibling != null) - node = node.PrevSibling; - else - { - node = node.Parent; - if (node != null) - count -= node.VisibleNodeCount - 1; // -1 is for the node itself - } - } - return count; - } - public static Node FindNodesBottomLeaf(Node node, bool mustBeVisible) - { - if (node == null) - return node; - if (mustBeVisible && node.Expanded == false) - return node; - if (node.HasChildren == false || node.Nodes.LastNode == null) - return node; - node = node.Nodes.LastNode; - return FindNodesBottomLeaf(node, mustBeVisible); - } - } - public class NodesSelection : IEnumerable - { - List m_nodes = new List(); - Dictionary m_nodesMap = new Dictionary(); - public void Clear() - { - m_nodes.Clear(); - m_nodesMap.Clear(); - } - public System.Collections.Generic.IEnumerator GetEnumerator() - { - foreach (var n in m_nodes) - { - yield return n; - } - } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return m_nodes.GetEnumerator(); - } - public Node this[int index] - { - get { return m_nodes[index]; } - } - public int Count - { - get { return m_nodes.Count; } - } - public void Add(Node node) - { - m_nodes.Add(node); - m_nodesMap.Add(node, 0); - } - public void Remove(Node node) - { - m_nodes.Remove(node); - m_nodesMap.Remove(node); - } - public bool Contains(Node node) - { - return m_nodesMap.ContainsKey(node); - } - - private class NodeSorter : IComparer - { - private Stack BuildIds(Node node) - { - Stack ids = new Stack(); - while (node != null) - { - node.Owner.UpdateChildIds(false); - ids.Push(node.Id); - node = node.Parent; - } - return ids; - } - private int NextId(Stack ids) - { - if (ids.Count > 0) - return ids.Pop(); - else - return -1; - } - public int Compare(Node left, Node right) - { - Stack leftIds = BuildIds(left); - Stack rightIds = BuildIds(right); - int deepest = Math.Max(leftIds.Count, rightIds.Count); - while(deepest > 0) - { - int lid = NextId(leftIds); - int rid = NextId(rightIds); - - if (lid < rid) - return -1; - else if (lid > rid) - return 1; - - deepest -= 1; - } - return 0; - } - } - - public void Sort() - { - NodeSorter Sorter = new NodeSorter(); - SortedList list = new SortedList(m_nodes.Count, Sorter); - foreach (Node node in m_nodes) - list.Add(node, node); - m_nodes = new List(list.Values); - } - - } -} diff --git a/renderdocui/Controls/TreeListView/TreeListOptions.cs b/renderdocui/Controls/TreeListView/TreeListOptions.cs deleted file mode 100644 index 43a71c3c7..000000000 --- a/renderdocui/Controls/TreeListView/TreeListOptions.cs +++ /dev/null @@ -1,347 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -// Taken from http://www.codeproject.com/Articles/23746/TreeView-with-Columns with minor tweaks -// and fixes for my purposes. -namespace TreelistView.TreeList -{ - [TypeConverterAttribute(typeof(OptionsSettingTypeConverter))] - public class TextFormatting - { - ContentAlignment m_alignment = ContentAlignment.MiddleLeft; - Color m_foreColor = SystemColors.ControlText; - Color m_backColor = Color.Transparent; - Padding m_padding = new Padding(0,0,0,0); - public TextFormatFlags GetFormattingFlags() - { - TextFormatFlags flags = 0; - switch (TextAlignment) - { - case ContentAlignment.TopLeft: - flags = TextFormatFlags.Top | TextFormatFlags.Left; - break; - case ContentAlignment.TopCenter: - flags = TextFormatFlags.Top | TextFormatFlags.HorizontalCenter; - break; - case ContentAlignment.TopRight: - flags = TextFormatFlags.Top | TextFormatFlags.Right; - break; - case ContentAlignment.MiddleLeft: - flags = TextFormatFlags.VerticalCenter | TextFormatFlags.Left; - break; - case ContentAlignment.MiddleCenter: - flags = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter; - break; - case ContentAlignment.MiddleRight: - flags = TextFormatFlags.VerticalCenter | TextFormatFlags.Right; - break; - case ContentAlignment.BottomLeft: - flags = TextFormatFlags.Bottom | TextFormatFlags.Left; - break; - case ContentAlignment.BottomCenter: - flags = TextFormatFlags.Bottom | TextFormatFlags.HorizontalCenter; - break; - case ContentAlignment.BottomRight: - flags = TextFormatFlags.Bottom | TextFormatFlags.Right; - break; - } - return flags; - } - - [DefaultValue(typeof(Padding), "0,0,0,0")] - public Padding Padding - { - get { return m_padding; } - set { m_padding = value; } - } - [DefaultValue(typeof(ContentAlignment), "MiddleLeft")] - public ContentAlignment TextAlignment - { - get { return m_alignment; } - set { m_alignment = value; } - } - [DefaultValue(typeof(Color), "ControlText")] - public Color ForeColor - { - get { return m_foreColor; } - set { m_foreColor = value; } - } - [DefaultValue(typeof(Color), "Transparent")] - public Color BackColor - { - get { return m_backColor; } - set { m_backColor = value; } - } - public TextFormatting() - { - } - public TextFormatting(TextFormatting aCopy) - { - m_alignment = aCopy.m_alignment; - m_foreColor = aCopy.m_foreColor; - m_backColor = aCopy.m_backColor; - m_padding = aCopy.m_padding; - } - } - - [TypeConverterAttribute(typeof(OptionsSettingTypeConverter))] - public class ViewSetting - { - TreeListView m_owner; - BorderStyle m_borderStyle = BorderStyle.None; - int m_indent = 16; - bool m_showLine = true; - bool m_showPlusMinus = true; - bool m_padForPlusMinus = true; - bool m_showGridLines = true; - bool m_rearrangeableColumns = false; - bool m_hoverHand = true; - - [Category("Behavior")] - [DefaultValue(typeof(int), "16")] - public int Indent - { - get { return m_indent; } - set - { - m_indent = value; - m_owner.Invalidate(); - } - } - - [Category("Behavior")] - [DefaultValue(typeof(bool), "True")] - public bool ShowLine - { - get { return m_showLine; } - set - { - m_showLine = value; - m_owner.Invalidate(); - } - } - - [Category("Behavior")] - [DefaultValue(typeof(bool), "True")] - public bool ShowPlusMinus - { - get { return m_showPlusMinus; } - set - { - m_showPlusMinus = value; - m_owner.Invalidate(); - } - } - - [Category("Behavior")] - [DefaultValue(typeof(bool), "True")] - public bool PadForPlusMinus - { - get { return m_padForPlusMinus; } - set - { - m_padForPlusMinus = value; - m_owner.Invalidate(); - } - } - - [Category("Behavior")] - [DefaultValue(typeof(bool), "True")] - public bool ShowGridLines - { - get { return m_showGridLines; } - set - { - m_showGridLines = value; - m_owner.Invalidate(); - } - } - - [Category("Behavior")] - [DefaultValue(typeof(bool), "False")] - public bool UserRearrangeableColumns - { - get { return m_rearrangeableColumns; } - set - { - m_rearrangeableColumns = value; - } - } - - [Category("Behavior")] - [DefaultValue(typeof(bool), "True")] - public bool HoverHandTreeColumn - { - get { return m_hoverHand; } - set - { - m_hoverHand = value; - } - } - - [Category("Appearance")] - [DefaultValue(typeof(BorderStyle), "None")] - public BorderStyle BorderStyle - { - get { return m_borderStyle; } - set - { - if (m_borderStyle != value) - { - m_borderStyle = value; - m_owner.internalUpdateStyles(); - m_owner.Invalidate(); - } - } - } - - public ViewSetting(TreeListView owner) - { - m_owner = owner; - } - } - - [TypeConverterAttribute(typeof(OptionsSettingTypeConverter))] - public class CollumnSetting - { - bool m_FreezeWhileResizing = false; - int m_leftMargin = 5; - int m_headerHeight = 20; - TreeListView m_owner; - - [DefaultValue(false)] - public bool FreezeWhileResizing - { - get { return m_FreezeWhileResizing; } - set - { - m_FreezeWhileResizing = value; - } - } - [DefaultValue(5)] - public int LeftMargin - { - get { return m_leftMargin; } - set - { - m_leftMargin = value; - m_owner.Columns.RecalcVisibleColumsRect(); - m_owner.Invalidate(); - } - } - [DefaultValue(20)] - public int HeaderHeight - { - get { return m_headerHeight; } - set - { - m_headerHeight = value; - m_owner.Columns.RecalcVisibleColumsRect(); - m_owner.Invalidate(); - } - } - public CollumnSetting(TreeListView owner) - { - m_owner = owner; - } - } - - [TypeConverterAttribute(typeof(OptionsSettingTypeConverter))] - public class RowSetting - { - TreeListView m_owner; - bool m_showHeader = true; - bool m_hoverHighlight = false; - int m_headerWidth = 15; - int m_itemHeight = 16; - [DefaultValue(true)] - public bool ShowHeader - { - get { return m_showHeader; } - set - { - if (m_showHeader == value) - return; - m_showHeader = value; - m_owner.Columns.RecalcVisibleColumsRect(); - m_owner.Invalidate(); - } - } - [DefaultValue(false)] - public bool HoverHighlight - { - get { return m_hoverHighlight; } - set - { - if (m_hoverHighlight == value) - return; - m_hoverHighlight = value; - m_owner.Invalidate(); - } - } - [DefaultValue(15)] - public int HeaderWidth - { - get { return m_headerWidth; } - set - { - if (m_headerWidth == value) - return; - m_headerWidth = value; - m_owner.Columns.RecalcVisibleColumsRect(); - m_owner.Invalidate(); - } - } - - [Category("Behavior")] - [DefaultValue(typeof(int), "16")] - public int ItemHeight - { - get { return m_itemHeight; } - set - { - m_itemHeight = value; - m_owner.Invalidate(); - } - } - - public RowSetting(TreeListView owner) - { - m_owner = owner; - } - } - - class OptionsSettingTypeConverter : ExpandableObjectConverter - { - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - if (destinationType == typeof(ViewSetting)) - return true; - if (destinationType == typeof(RowSetting)) - return true; - if (destinationType == typeof(CollumnSetting)) - return true; - if (destinationType == typeof(TextFormatting)) - return true; - return base.CanConvertTo(context, destinationType); - } - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) - { - if (destinationType == typeof(string) && value.GetType() == typeof(ViewSetting)) - return "(View Options)"; - if (destinationType == typeof(string) && value.GetType() == typeof(RowSetting)) - return "(Row Header Options)"; - if (destinationType == typeof(string) && value.GetType() == typeof(CollumnSetting)) - return "(Columns Options)"; - if (destinationType == typeof(string) && value.GetType() == typeof(TextFormatting)) - return "(Formatting)"; - return base.ConvertTo(context, culture, value, destinationType); - } - } -} diff --git a/renderdocui/Controls/TreeListView/TreeListPainter.cs b/renderdocui/Controls/TreeListView/TreeListPainter.cs deleted file mode 100644 index 47a797157..000000000 --- a/renderdocui/Controls/TreeListView/TreeListPainter.cs +++ /dev/null @@ -1,446 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Text; -using System.Windows.Forms; -using System.Windows.Forms.VisualStyles; -using System.Runtime.InteropServices; - -// Taken from http://www.codeproject.com/Articles/23746/TreeView-with-Columns with minor tweaks -// and fixes for my purposes. -namespace TreelistView -{ - public class VisualStyleItemBackground // can't find system provided visual style for this. - { - [StructLayout(LayoutKind.Sequential)] - public class RECT - { - public int left; - public int top; - public int right; - public int bottom; - public RECT() - { - } - - public RECT(Rectangle r) - { - this.left = r.X; - this.top = r.Y; - this.right = r.Right; - this.bottom = r.Bottom; - } - } - - [DllImport("uxtheme.dll", CharSet=CharSet.Auto)] - public static extern int DrawThemeBackground(IntPtr hTheme, IntPtr hdc, int partId, int stateId, [In] RECT pRect, [In] RECT pClipRect); - - [DllImport("uxtheme.dll", CharSet=CharSet.Auto)] - public static extern IntPtr OpenThemeData(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszClassList); - - [DllImport("uxtheme.dll", CharSet=CharSet.Auto)] - public static extern int CloseThemeData(IntPtr hTheme); - - //http://www.ookii.org/misc/vsstyle.h - //http://msdn2.microsoft.com/en-us/library/bb773210(VS.85).aspx - enum ITEMSTATES - { - LBPSI_HOT = 1, - LBPSI_HOTSELECTED = 2, - LBPSI_SELECTED = 3, - LBPSI_SELECTEDNOTFOCUS = 4, - }; - - enum LISTBOXPARTS - { - LBCP_BORDER_HSCROLL = 1, - LBCP_BORDER_HVSCROLL = 2, - LBCP_BORDER_NOSCROLL = 3, - LBCP_BORDER_VSCROLL = 4, - LBCP_ITEM = 5, - }; - - public enum Style - { - Normal, - Inactive, // when not focused - } - Style m_style; - public VisualStyleItemBackground(Style style) - { - m_style = style; - } - public void DrawBackground(Control owner, Graphics dc, Rectangle r, Color col) - { - /* - IntPtr themeHandle = OpenThemeData(owner.Handle, "Explorer"); - if (themeHandle != IntPtr.Zero) - { - DrawThemeBackground(themeHandle, dc.GetHdc(), (int)LISTBOXPARTS.LBCP_ITEM, (int)ITEMSTATES.LBPSI_SELECTED, new RECT(r), new RECT(r)); - dc.ReleaseHdc(); - CloseThemeData(themeHandle); - return; - } - */ - - Pen pen = new Pen(col); - GraphicsPath path = new GraphicsPath(); - path.AddLine(r.Left + 2, r.Top, r.Right - 2, r.Top); - path.AddLine(r.Right, r.Top + 2, r.Right, r.Bottom - 2); - path.AddLine(r.Right - 2, r.Bottom, r.Left + 2, r.Bottom); - path.AddLine(r.Left, r.Bottom - 2, r.Left, r.Top + 2); - path.CloseFigure(); - dc.DrawPath(pen, path); - - //r.Inflate(-1, -1); - LinearGradientBrush brush = new LinearGradientBrush(r, Color.FromArgb(120, col), col, 90); - dc.FillRectangle(brush, r); - // for some reason in some cases the 'white' end of the gradient brush is drawn with the starting color - // therefore this redraw of the 'top' line of the rectangle - //dc.DrawLine(Pens.White, r.Left + 1, r.Top, r.Right - 1, r.Top); - - pen.Dispose(); - brush.Dispose(); - path.Dispose(); - } - } - - public delegate string CellDataToString(TreeListColumn column, object data); - - public class CellPainter - { - public static Rectangle AdjustRectangle(Rectangle r, Padding padding) - { - r.X += padding.Left; - r.Width -= padding.Left + padding.Right; - r.Y += padding.Top; - r.Height -= padding.Top + padding.Bottom; - return r; - } - protected TreeListView m_owner; - protected CellDataToString m_converter = null; - - public CellDataToString CellDataConverter - { - get { return m_converter; } - set { m_converter = value; } - } - - public CellPainter(TreeListView owner) - { - m_owner = owner; - } - public virtual void DrawSelectionBackground(Graphics dc, Rectangle nodeRect, Node node) - { - Point mousePoint = m_owner.PointToClient(Cursor.Position); - Node hoverNode = m_owner.CalcHitNode(mousePoint); - - if (m_owner.NodesSelection.Contains(node) || m_owner.FocusedNode == node) - { - Color col = m_owner.Focused ? SystemColors.Highlight : SystemColors.Control; - - if (!Application.RenderWithVisualStyles) - { - // have to fill the solid background only before the node is painted - dc.FillRectangle(SystemBrushes.FromSystemColor(col), nodeRect); - } - else - { - col = m_owner.Focused ? SystemColors.Highlight : Color.FromArgb(180, SystemColors.ControlDark); - - // have to draw the transparent background after the node is painted - VisualStyleItemBackground.Style style = VisualStyleItemBackground.Style.Normal; - if (m_owner.Focused == false) - style = VisualStyleItemBackground.Style.Inactive; - VisualStyleItemBackground rendere = new VisualStyleItemBackground(style); - rendere.DrawBackground(m_owner, dc, nodeRect, col); - } - } - else if (hoverNode == node && m_owner.RowOptions.HoverHighlight) - { - Color col = SystemColors.ControlLight; - - if (SystemInformation.HighContrast) - { - col = SystemColors.ButtonHighlight; - } - - if (!Application.RenderWithVisualStyles) - { - // have to fill the solid background only before the node is painted - dc.FillRectangle(SystemBrushes.FromSystemColor(col), nodeRect); - } - else - { - // have to draw the transparent background after the node is painted - VisualStyleItemBackground.Style style = VisualStyleItemBackground.Style.Normal; - if (m_owner.Focused == false) - style = VisualStyleItemBackground.Style.Inactive; - VisualStyleItemBackground rendere = new VisualStyleItemBackground(style); - rendere.DrawBackground(m_owner, dc, nodeRect, col); - } - } - - if (m_owner.Focused && (m_owner.FocusedNode == node)) - { - nodeRect.Height += 1; - nodeRect.Inflate(-1,-1); - ControlPaint.DrawFocusRectangle(dc, nodeRect); - } - } - public virtual void PaintCellBackground(Graphics dc, - Rectangle cellRect, - Node node, - TreeListColumn column, - TreeList.TextFormatting format, - object data) - { - Color c = Color.Transparent; - - Point mousePoint = m_owner.PointToClient(Cursor.Position); - Node hoverNode = m_owner.CalcHitNode(mousePoint); - - if (format.BackColor != Color.Transparent) - c = format.BackColor; - - if (!m_owner.NodesSelection.Contains(node) && m_owner.FocusedNode != node && - !(hoverNode == node && m_owner.RowOptions.HoverHighlight) && - node.DefaultBackColor != Color.Transparent) - c = node.DefaultBackColor; - - if (node.BackColor != Color.Transparent && !m_owner.NodesSelection.Contains(node) && m_owner.SelectedNode != node) - c = node.BackColor; - - if (column.Index < node.IndexedBackColor.Length && node.IndexedBackColor[column.Index] != Color.Transparent) - c = node.IndexedBackColor[column.Index]; - - if (c != Color.Transparent) - { - Rectangle r = cellRect; - r.X -= Math.Max(0, column.CalculatedRect.Width - cellRect.Width); - r.Width += Math.Max(0, column.CalculatedRect.Width - cellRect.Width); - SolidBrush brush = new SolidBrush(c); - dc.FillRectangle(brush, r); - brush.Dispose(); - } - } - - public virtual void PaintCellText(Graphics dc, - Rectangle cellRect, - Node node, - TreeListColumn column, - TreeList.TextFormatting format, - object data) - { - if (data != null) - { - cellRect = AdjustRectangle(cellRect, format.Padding); - //dc.DrawRectangle(Pens.Black, cellRect); - - Color color = format.ForeColor; - if (node.ForeColor != Color.Transparent) - color = node.ForeColor; - if (m_owner.FocusedNode == node && Application.RenderWithVisualStyles == false && m_owner.Focused) - color = SystemColors.HighlightText; - TextFormatFlags flags= TextFormatFlags.EndEllipsis | format.GetFormattingFlags(); - - Font f = m_owner.Font; - Font disposefont = null; - - if(node.Bold && node.Italic) - disposefont = f = new Font(f, FontStyle.Bold|FontStyle.Italic); - else if (node.Bold) - disposefont = f = new Font(f, FontStyle.Bold); - else if (node.Italic) - disposefont = f = new Font(f, FontStyle.Italic); - - string datastring = ""; - - if(m_converter != null) - datastring = m_converter(column, data); - else - datastring = data.ToString(); - - TextRenderer.DrawText(dc, datastring, f, cellRect, color, flags); - - Size sz = TextRenderer.MeasureText(dc, datastring, f, new Size(1000000, 10000), flags); - - int treecolumn = node.TreeColumn; - if (treecolumn < 0) - treecolumn = node.OwnerView.TreeColumn; - - if (column.Index == treecolumn) - node.ClippedText = (sz.Width > cellRect.Width || sz.Height > cellRect.Height); - - if (disposefont != null) disposefont.Dispose(); - } - } - public virtual void PaintCellPlusMinus(Graphics dc, Rectangle glyphRect, Node node, TreeListColumn column, TreeList.TextFormatting format) - { - if (!Application.RenderWithVisualStyles) - { - // find square rect first - int diff = glyphRect.Height-glyphRect.Width; - glyphRect.Y += diff/2; - glyphRect.Height -= diff; - - // draw 8x8 box centred - while (glyphRect.Height > 8) - { - glyphRect.Height -= 2; - glyphRect.Y += 1; - glyphRect.X += 1; - } - - // make a box - glyphRect.Width = glyphRect.Height; - - // clear first - SolidBrush brush = new SolidBrush(format.BackColor); - if (format.BackColor == Color.Transparent) - brush = new SolidBrush(m_owner.BackColor); - dc.FillRectangle(brush, glyphRect); - brush.Dispose(); - - // draw outline - Pen p = new Pen(SystemColors.ControlDark); - dc.DrawRectangle(p, glyphRect); - p.Dispose(); - - p = new Pen(SystemColors.ControlText); - - // reduce box for internal lines - glyphRect.X += 2; glyphRect.Y += 2; - glyphRect.Width -= 4; glyphRect.Height -= 4; - - // draw horizontal line always - dc.DrawLine(p, glyphRect.X, glyphRect.Y + glyphRect.Height / 2, glyphRect.X + glyphRect.Width, glyphRect.Y + glyphRect.Height / 2); - - // draw vertical line if this should be a + - if(!node.Expanded) - dc.DrawLine(p, glyphRect.X + glyphRect.Width / 2, glyphRect.Y, glyphRect.X + glyphRect.Width / 2, glyphRect.Y + glyphRect.Height); - - p.Dispose(); - return; - } - - VisualStyleElement element = VisualStyleElement.TreeView.Glyph.Closed; - if (node.Expanded) - element = VisualStyleElement.TreeView.Glyph.Opened; - - if (VisualStyleRenderer.IsElementDefined(element)) - { - VisualStyleRenderer renderer = new VisualStyleRenderer(element); - renderer.DrawBackground(dc, glyphRect); - } - } - } - public class ColumnHeaderPainter - { - TreeListView m_owner; - public ColumnHeaderPainter(TreeListView owner) - { - m_owner = owner; - } - - public static Rectangle AdjustRectangle(Rectangle r, Padding padding) - { - r.X += padding.Left; - r.Width -= padding.Left + padding.Right; - r.Y += padding.Top; - r.Height -= padding.Top + padding.Bottom; - return r; - } - public virtual void DrawHeaderFiller(Graphics dc, Rectangle r) - { - if (!Application.RenderWithVisualStyles) - { - ControlPaint.DrawButton(dc, r, ButtonState.Flat); - return; - } - VisualStyleElement element = VisualStyleElement.Header.Item.Normal; - if (VisualStyleRenderer.IsElementDefined(element)) - { - VisualStyleRenderer renderer = new VisualStyleRenderer(element); - renderer.DrawBackground(dc, r); - } - } - public void DrawHeaderText(Graphics dc, Rectangle cellRect, TreeListColumn column, TreeList.TextFormatting format) - { - Color color = format.ForeColor; - TextFormatFlags flags = TextFormatFlags.EndEllipsis | format.GetFormattingFlags(); - TextRenderer.DrawText(dc, column.Caption, column.Font, cellRect, color, flags); - } - public virtual void DrawHeader(Graphics dc, Rectangle cellRect, TreeListColumn column, TreeList.TextFormatting format, bool isHot, bool highlight) - { - Rectangle textRect = AdjustRectangle(cellRect, format.Padding); - if (!Application.RenderWithVisualStyles) - { - ControlPaint.DrawButton(dc, cellRect, - m_owner.ViewOptions.UserRearrangeableColumns && highlight ? ButtonState.Pushed : ButtonState.Flat); - DrawHeaderText(dc, textRect, column, format); - return; - } - VisualStyleElement element = VisualStyleElement.Header.Item.Normal; - if (isHot || highlight) - element = VisualStyleElement.Header.Item.Hot; - if (VisualStyleRenderer.IsElementDefined(element)) - { - VisualStyleRenderer renderer = new VisualStyleRenderer(element); - renderer.DrawBackground(dc, cellRect); - - if (format.BackColor != Color.Transparent) - { - SolidBrush brush = new SolidBrush(format.BackColor); - dc.FillRectangle(brush, cellRect); - brush.Dispose(); - } - //dc.DrawRectangle(Pens.Black, cellRect); - - DrawHeaderText(dc, textRect, column, format); - } - } - public virtual void DrawVerticalGridLines(TreeListColumnCollection columns, Graphics dc, Rectangle r, int hScrollOffset) - { - foreach (TreeListColumn col in columns.VisibleColumns) - { - int rightPos = col.CalculatedRect.Right - hScrollOffset; - if (rightPos < 0) - continue; - Pen p = new Pen(columns.Owner.GridLineColour); - dc.DrawLine(p, rightPos, r.Top, rightPos, r.Bottom); - p.Dispose(); - } - } - } - public class RowPainter - { - public void DrawHeader(Graphics dc, Rectangle r, bool isHot) - { - if (!Application.RenderWithVisualStyles) - { - if (r.Width > 0 && r.Height > 0) - { - ControlPaint.DrawButton(dc, r, ButtonState.Flat); - } - return; - } - - VisualStyleElement element = VisualStyleElement.Header.Item.Normal; - if (isHot) - element = VisualStyleElement.Header.Item.Hot; - if (VisualStyleRenderer.IsElementDefined(element)) - { - VisualStyleRenderer renderer = new VisualStyleRenderer(element); - renderer.DrawBackground(dc, r); - } - } - public void DrawHorizontalGridLine(Graphics dc, Rectangle r, Color col) - { - Pen p = new Pen(col); - dc.DrawLine(p, r.Left, r.Bottom, r.Right, r.Bottom); - p.Dispose(); - } - } -} diff --git a/renderdocui/Controls/TreeListView/TreeListView.cs b/renderdocui/Controls/TreeListView/TreeListView.cs deleted file mode 100644 index 7ba47a898..000000000 --- a/renderdocui/Controls/TreeListView/TreeListView.cs +++ /dev/null @@ -1,1560 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Drawing.Design; -using System.Windows.Forms; -using System.ComponentModel; -using System.Runtime.InteropServices; -using System.Windows.Forms.VisualStyles; - -// Taken from http://www.codeproject.com/Articles/23746/TreeView-with-Columns with minor tweaks -// and fixes for my purposes. -namespace TreelistView -{ - [Designer(typeof(TreeListViewDesigner))] - public class TreeListView : Control, ISupportInitialize - { - public event TreeViewEventHandler AfterSelect; - protected virtual void OnAfterSelect(Node node) - { - raiseAfterSelect(node); - } - protected virtual void raiseAfterSelect(Node node) - { - if (AfterSelect != null && node != null) - AfterSelect(this, new TreeViewEventArgs(null)); - } - - public delegate void NotifyBeforeExpandHandler(Node node, bool isExpanding); - public event NotifyBeforeExpandHandler NotifyBeforeExpand; - public virtual void OnNotifyBeforeExpand(Node node, bool isExpanding) - { - raiseNotifyBeforeExpand(node, isExpanding); - } - protected virtual void raiseNotifyBeforeExpand(Node node, bool isExpanding) - { - if (NotifyBeforeExpand != null) - NotifyBeforeExpand(node, isExpanding); - } - - public delegate void NotifyAfterHandler(Node node, bool isExpanding); - public event NotifyAfterHandler NotifyAfterExpand; - public virtual void OnNotifyAfterExpand(Node node, bool isExpanded) - { - raiseNotifyAfterExpand(node, isExpanded); - } - protected virtual void raiseNotifyAfterExpand(Node node, bool isExpanded) - { - if (NotifyAfterExpand != null) - NotifyAfterExpand(node, isExpanded); - } - - public delegate void NodeDoubleClickedHandler(Node node); - public event NodeDoubleClickedHandler NodeDoubleClicked; - public virtual void OnNodeDoubleClicked(Node node) - { - raiseNodeDoubleClicked(node); - } - protected virtual void raiseNodeDoubleClicked(Node node) - { - if (NodeDoubleClicked != null) - NodeDoubleClicked(node); - } - - public delegate void NodeClickedHandler(Node node); - public event NodeClickedHandler NodeClicked; - public virtual void OnNodeClicked(Node node) - { - raiseNodeClicked(node); - } - protected virtual void raiseNodeClicked(Node node) - { - if (NodeClicked != null) - NodeClicked(node); - } - - TreeListViewNodes m_nodes; - TreeListColumnCollection m_columns; - TreeList.RowSetting m_rowSetting; - TreeList.ViewSetting m_viewSetting; - - Color m_GridLineColour = SystemColors.Control; - Image m_SelectedImage = null; - - [Category("Columns")] - [Browsable(true)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public TreeListColumnCollection Columns - { - get { return m_columns; } - } - - [Category("Options")] - [Browsable(true)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public TreeList.CollumnSetting ColumnsOptions - { - get { return m_columns.Options; } - } - - [Category("Options")] - [Browsable(true)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public TreeList.RowSetting RowOptions - { - get { return m_rowSetting; } - } - - [Category("Options")] - [Browsable(true)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public TreeList.ViewSetting ViewOptions - { - get { return m_viewSetting; } - } - - [Category("Behavior")] - [DefaultValue(typeof(bool), "True")] - public bool MultiSelect - { - get { return m_multiSelect; } - set { m_multiSelect = value; } - } - - [Category("Behavior")] - [DefaultValue(typeof(int), "0")] - public int TreeColumn - { - get { return m_treeColumn; } - set - { - m_treeColumn = value; - - if(value >= m_columns.Count) - throw new ArgumentOutOfRangeException("Tree column index invalid"); - } - } - - private int GetTreeColumn(Node n) - { - if (n != null && n.TreeColumn >= 0) - return n.TreeColumn; - - return m_treeColumn; - } - - [Category("Behavior")] - [DefaultValue(typeof(bool), "False")] - public bool AlwaysDisplayVScroll - { - get { return m_vScrollAlways; } - set { m_vScrollAlways = value; } - } - - [Category("Behavior")] - [DefaultValue(typeof(bool), "False")] - public bool AlwaysDisplayHScroll - { - get { return m_hScrollAlways; } - set { m_hScrollAlways = value; } - } - - [Category("Appearance")] - [DefaultValue(typeof(Image), null)] - public Image SelectedImage - { - get { return m_SelectedImage; } - set { m_SelectedImage = value; } - } - - [DefaultValue(typeof(Color), "Window")] - public new Color BackColor - { - get { return base.BackColor; } - set { base.BackColor = value; } - } - - [Category("Appearance")] - [DefaultValue(typeof(Color), "Control")] - public Color GridLineColour - { - get { return m_GridLineColour; } - set { m_GridLineColour = value; } - } - - //[Browsable(false)] - public TreeListViewNodes Nodes - { - get { return m_nodes; } - } - public TreeListView() - { - this.DoubleBuffered = true; - this.BackColor = SystemColors.Window; - this.TabStop = true; - - m_tooltip = new ToolTip(); - m_tooltipVisible = false; - m_tooltip.InitialDelay = 0; - m_tooltip.UseAnimation = false; - m_tooltip.UseFading = false; - - m_tooltipNode = null; - m_tooltipTimer = new Timer(); - m_tooltipTimer.Stop(); - m_tooltipTimer.Interval = 500; - m_tooltipTimer.Tick += new EventHandler(tooltipTick); - - m_rowPainter = new RowPainter(); - m_cellPainter = new CellPainter(this); - - m_nodes = new TreeListViewNodes(this); - m_rowSetting = new TreeList.RowSetting(this); - m_viewSetting = new TreeList.ViewSetting(this); - m_columns = new TreeListColumnCollection(this); - AddScrollBars(); - } - - protected override void Dispose(bool disposing) - { - m_tooltipTimer.Stop(); - if(m_tooltipVisible) - m_tooltip.Hide(this); - m_tooltip.Dispose(); - base.Dispose(disposing); - } - - void tooltipTick(object sender, EventArgs e) - { - m_tooltipTimer.Stop(); - - if (m_tooltipNode == null) - { - m_tooltip.Hide(this); - m_tooltipVisible = false; - return; - } - - Node node = m_tooltipNode; - - Point p = PointToClient(Cursor.Position); - - if (!ClientRectangle.Contains(p)) - { - m_tooltip.Hide(this); - m_tooltipVisible = false; - return; - } - - int visibleRowIndex = CalcHitRow(PointToClient(Cursor.Position)); - - Rectangle rowRect = CalcRowRectangle(visibleRowIndex); - rowRect.X = RowHeaderWidth() - HScrollValue(); - rowRect.Width = Columns.ColumnsWidth; - - // draw the current node - foreach (TreeListColumn col in Columns.VisibleColumns) - { - if (col.Index == GetTreeColumn(node)) - { - Rectangle cellRect = rowRect; - cellRect.X = col.CalculatedRect.X - HScrollValue(); - - int lineindet = 10; - // add left margin - cellRect.X += Columns.Options.LeftMargin; - - // add indent size - cellRect.X += GetIndentSize(node) + 5; - - cellRect.X += lineindet; - - Rectangle plusminusRect = GetPlusMinusRectangle(node, col, visibleRowIndex); - - if (!ViewOptions.ShowLine && (!ViewOptions.ShowPlusMinus || (!ViewOptions.PadForPlusMinus && plusminusRect == Rectangle.Empty))) - cellRect.X -= (lineindet + 5); - - if (SelectedImage != null && (NodesSelection.Contains(node) || FocusedNode == node)) - cellRect.X += (SelectedImage.Width + 2); - - Image icon = GetHoverNodeBitmap(node); - - if (icon != null) - cellRect.X += (icon.Width + 2); - - string datastring = ""; - - object data = GetData(node, col); - - if(data == null) - data = ""; - - if (CellPainter.CellDataConverter != null) - datastring = CellPainter.CellDataConverter(col, data); - else - datastring = data.ToString(); - - if(datastring.Length > 0) - { - m_tooltip.Show(datastring, this, cellRect.X, cellRect.Y); - m_tooltipVisible = true; - } - } - } - } - - public void RecalcLayout() - { - if (m_firstVisibleNode == null) - m_firstVisibleNode = Nodes.FirstNode; - if (Nodes.Count == 0) - m_firstVisibleNode = null; - - UpdateScrollBars(); - m_columns.RecalcVisibleColumsRect(); - UpdateScrollBars(); - m_columns.RecalcVisibleColumsRect(); - - int vscroll = VScrollValue(); - if (vscroll == 0) - m_firstVisibleNode = Nodes.FirstNode; - else - m_firstVisibleNode = NodeCollection.GetNextNode(Nodes.FirstNode, vscroll); - Invalidate(); - } - void AddScrollBars() - { - // I was not able to get the wanted behavior by using ScrollableControl with AutoScroll enabled. - // horizontal scrolling is ok to do it by pixels, but for vertical I want to maintain the headers - // and only scroll the rows. - // I was not able to manually overwrite the vscroll bar handling to get this behavior, instead I opted for - // custom implementation of scrollbars - - // to get the 'filler' between hscroll and vscroll I dock scroll + filler in a panel - m_hScroll = new HScrollBar(); - m_hScroll.Scroll += new ScrollEventHandler(OnHScroll); - m_hScroll.Dock = DockStyle.Fill; - - m_vScroll = new VScrollBar(); - m_vScroll.Scroll += new ScrollEventHandler(OnVScroll); - m_vScroll.Dock = DockStyle.Right; - - m_hScrollFiller = new Panel(); - m_hScrollFiller.BackColor = Color.Transparent; - m_hScrollFiller.Size = new Size(m_vScroll.Width-1, m_hScroll.Height); - m_hScrollFiller.Dock = DockStyle.Right; - - Controls.Add(m_vScroll); - - m_hScrollPanel = new Panel(); - m_hScrollPanel.Height = m_hScroll.Height; - m_hScrollPanel.Dock = DockStyle.Bottom; - m_hScrollPanel.Controls.Add(m_hScroll); - m_hScrollPanel.Controls.Add(m_hScrollFiller); - Controls.Add(m_hScrollPanel); - - // try and force handle creation here, as it can fail randomly - // at runtime with weird side-effects (See github #202). - bool handlesCreated = false; - handlesCreated |= m_hScroll.Handle.ToInt64() > 0; - handlesCreated |= m_vScroll.Handle.ToInt64() > 0; - handlesCreated |= m_hScrollFiller.Handle.ToInt64() > 0; - handlesCreated |= m_hScrollPanel.Handle.ToInt64() > 0; - - if (!handlesCreated) - renderdoc.StaticExports.LogText("Couldn't create any handles!"); - } - - ToolTip m_tooltip; - Node m_tooltipNode; - Timer m_tooltipTimer; - bool m_tooltipVisible; - VScrollBar m_vScroll; - HScrollBar m_hScroll; - Panel m_hScrollFiller; - Panel m_hScrollPanel; - bool m_multiSelect = true; - int m_treeColumn = 0; - bool m_vScrollAlways = false; - bool m_hScrollAlways = false; - Node m_firstVisibleNode = null; - - RowPainter m_rowPainter; - CellPainter m_cellPainter; - [Browsable(false)] - public CellPainter CellPainter - { - get { return m_cellPainter; } - set { m_cellPainter = value; } - } - - TreeListColumn m_resizingColumn; - int m_resizingColumnScrollOffset; - int m_resizingColumnLeft; - - TreeListColumn m_movingColumn; - - NodesSelection m_nodesSelection = new NodesSelection(); - Node m_focusedNode = null; - - [Browsable(false)] - public NodesSelection NodesSelection - { - get { return m_nodesSelection; } - } - - public void SortNodesSelection() - { - m_nodesSelection.Sort(); - } - - public void SelectAll() - { - FocusedNode = null; - NodesSelection.Clear(); - foreach (Node node in NodeCollection.ForwardNodeIterator(m_firstVisibleNode, true)) - { - NodesSelection.Add(node); - } - Invalidate(); - } - - [Browsable(false)] - public Node SelectedNode - { - get { return m_nodesSelection.Count == 0 ? FocusedNode : m_nodesSelection[0]; } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public Node FocusedNode - { - get { return m_focusedNode; } - set - { - Node curNode = FocusedNode; - if (object.ReferenceEquals(curNode, value)) - return; - if (MultiSelect == false) - NodesSelection.Clear(); - - int oldrow = NodeCollection.GetVisibleNodeIndex(curNode); - int newrow = NodeCollection.GetVisibleNodeIndex(value); - - m_focusedNode = value; - OnAfterSelect(value); - InvalidateRow(oldrow); - InvalidateRow(newrow); - EnsureVisible(m_focusedNode); - } - } - public void EnsureVisible(Node node) - { - int screenvisible = MaxVisibleRows() - 1; - int visibleIndex = NodeCollection.GetVisibleNodeIndex(node); - if (visibleIndex < VScrollValue()) - { - SetVScrollValue(visibleIndex); - } - if (visibleIndex > VScrollValue() + screenvisible) - { - SetVScrollValue(visibleIndex - screenvisible); - } - } - public Node CalcHitNode(Point mousepoint) - { - if (!ClientRectangle.Contains(mousepoint)) - return null; - - int hitrow = CalcHitRow(mousepoint); - if (hitrow < 0) - return null; - return NodeCollection.GetNextNode(m_firstVisibleNode, hitrow); - } - public Node GetHitNode() - { - return CalcHitNode(PointToClient(Control.MousePosition)); - } - public TreelistView.HitInfo CalcColumnHit(Point mousepoint) - { - return Columns.CalcHitInfo(mousepoint, HScrollValue()); - } - public bool HitTestScrollbar(Point mousepoint) - { - if (m_hScroll.Visible && mousepoint.Y >= ClientRectangle.Height - m_hScroll.Height) - return true; - return false; - } - - protected override void OnSizeChanged(EventArgs e) - { - base.OnSizeChanged(e); - if (ClientRectangle.Width > 0 && ClientRectangle.Height > 0) - { - Columns.RecalcVisibleColumsRect(); - UpdateScrollBars(); - Columns.RecalcVisibleColumsRect(); - } - } - protected override void OnVisibleChanged(EventArgs e) - { - base.OnVisibleChanged(e); - RecalcLayout(); - } - protected virtual void BeforeShowContextMenu() - { - } - protected void InvalidateRow(int absoluteRowIndex) - { - int visibleRowIndex = absoluteRowIndex - VScrollValue(); - Rectangle r = CalcRowRectangle(visibleRowIndex); - if (r != Rectangle.Empty) - { - r.Inflate(1,1); - Invalidate(r); - } - } - - void OnVScroll(object sender, ScrollEventArgs e) - { - int diff = e.NewValue - e.OldValue; - //assumedScrollPos += diff; - if (e.NewValue == 0) - { - m_firstVisibleNode = Nodes.FirstNode; - diff = 0; - } - m_firstVisibleNode = NodeCollection.GetNextNode(m_firstVisibleNode, diff); - Invalidate(); - } - void OnHScroll(object sender, ScrollEventArgs e) - { - Invalidate(); - } - public void SetVScrollValue(int value) - { - if (value < 0) - value = 0; - int max = m_vScroll.Maximum - m_vScroll.LargeChange + 1; - if (value > max) - value = max; - - if ((value >= 0 && value <= max) && (value != m_vScroll.Value)) - { - ScrollEventArgs e = new ScrollEventArgs(ScrollEventType.ThumbPosition, m_vScroll.Value, value, ScrollOrientation.VerticalScroll); - // setting the scroll value does not cause a Scroll event - m_vScroll.Value = value; - // so we have to fake it - OnVScroll(m_vScroll, e); - } - } - public int VScrollValue() - { - if (m_vScroll.Visible == false) - return 0; - return m_vScroll.Value; - } - int HScrollValue() - { - if (m_hScroll.Visible == false) - return 0; - return m_hScroll.Value; - } - void UpdateScrollBars() - { - if (ClientRectangle.Width < 0) - return; - int maxvisiblerows = MaxVisibleRows(); - int totalrows = Nodes.VisibleNodeCount; - m_vScroll.SmallChange = 1; - m_vScroll.LargeChange = Math.Max(1, maxvisiblerows); - m_vScroll.Enabled = true; - m_vScroll.Minimum = 0; - m_vScroll.Maximum = Math.Max(1,totalrows - 1); - if (maxvisiblerows >= totalrows) - { - m_vScroll.Visible = false; - SetVScrollValue(0); - - if (m_vScrollAlways) - { - m_vScroll.Visible = true; - m_vScroll.Enabled = false; - } - } - else - { - m_vScroll.Visible = true; - - int maxscrollvalue = m_vScroll.Maximum - m_vScroll.LargeChange; - if (maxscrollvalue < m_vScroll.Value) - SetVScrollValue(maxscrollvalue); - } - - m_hScroll.Enabled = true; - if (ClientRectangle.Width > MinWidth()) - { - m_hScrollPanel.Visible = false; - m_hScroll.Value = 0; - - if (m_hScrollAlways) - { - m_hScroll.Enabled = false; - m_hScrollPanel.Visible = true; - m_hScroll.Minimum = 0; - m_hScroll.Maximum = 0; - m_hScroll.SmallChange = 1; - m_hScroll.LargeChange = 1; - m_hScrollFiller.Visible = m_vScroll.Visible; - } - } - else - { - m_hScroll.Minimum = 0; - m_hScroll.Maximum = Math.Max(1, MinWidth()); - m_hScroll.SmallChange = 5; - m_hScroll.LargeChange = Math.Max(1, ClientRectangle.Width); - m_hScrollFiller.Visible = m_vScroll.Visible; - m_hScrollPanel.Visible = true; - } - } - int m_hotrow = -1; - int CalcHitRow(Point mousepoint) - { - if (mousepoint.Y <= Columns.Options.HeaderHeight) - return -1; - return (mousepoint.Y - Columns.Options.HeaderHeight) / RowOptions.ItemHeight; - } - int VisibleRowToYPoint(int visibleRowIndex) - { - return Columns.Options.HeaderHeight + (visibleRowIndex * RowOptions.ItemHeight); - } - Rectangle CalcRowRectangle(int visibleRowIndex) - { - Rectangle r = ClientRectangle; - r.Y = VisibleRowToYPoint(visibleRowIndex); - if (r.Top < Columns.Options.HeaderHeight || r.Top > ClientRectangle.Height) - return Rectangle.Empty; - r.Height = RowOptions.ItemHeight; - return r; - } - - void MultiSelectAdd(Node clickedNode, Keys modifierKeys) - { - if (Control.ModifierKeys == Keys.None) - { - foreach (Node node in NodesSelection) - { - int newrow = NodeCollection.GetVisibleNodeIndex(node); - InvalidateRow(newrow); - } - NodesSelection.Clear(); - NodesSelection.Add(clickedNode); - } - if (Control.ModifierKeys == Keys.Shift) - { - if (NodesSelection.Count == 0) - NodesSelection.Add(clickedNode); - else - { - int startrow = NodeCollection.GetVisibleNodeIndex(NodesSelection[0]); - int currow = NodeCollection.GetVisibleNodeIndex(clickedNode); - if (currow > startrow) - { - Node startingNode = NodesSelection[0]; - NodesSelection.Clear(); - foreach (Node node in NodeCollection.ForwardNodeIterator(startingNode, clickedNode, true)) - NodesSelection.Add(node); - Invalidate(); - } - if (currow < startrow) - { - Node startingNode = NodesSelection[0]; - NodesSelection.Clear(); - foreach (Node node in NodeCollection.ReverseNodeIterator(startingNode, clickedNode, true)) - NodesSelection.Add(node); - Invalidate(); - } - } - } - if (Control.ModifierKeys == Keys.Control) - { - if (NodesSelection.Contains(clickedNode)) - NodesSelection.Remove(clickedNode); - else - NodesSelection.Add(clickedNode); - } - InvalidateRow(NodeCollection.GetVisibleNodeIndex(clickedNode)); - FocusedNode = clickedNode; - } - internal event MouseEventHandler AfterResizingColumn; - protected override void OnMouseClick(MouseEventArgs e) - { - if (e.Button == MouseButtons.Left) - { - Point mousePoint = new Point(e.X, e.Y); - Node clickedNode = CalcHitNode(mousePoint); - if (clickedNode != null && Columns.Count > 0) - { - int clickedRow = CalcHitRow(mousePoint); - Rectangle glyphRect = Rectangle.Empty; - - int treeColumn = GetTreeColumn(clickedNode); - - if (treeColumn >= 0) - glyphRect = GetPlusMinusRectangle(clickedNode, Columns[treeColumn], clickedRow); - if (clickedNode.HasChildren && glyphRect != Rectangle.Empty && glyphRect.Contains(mousePoint)) - clickedNode.Expanded = !clickedNode.Expanded; - - var columnHit = CalcColumnHit(mousePoint); - - if (glyphRect == Rectangle.Empty && columnHit.Column != null && - columnHit.Column.Index == treeColumn && GetNodeBitmap(clickedNode) != null) - { - OnNodeClicked(clickedNode); - } - - if (MultiSelect) - { - MultiSelectAdd(clickedNode, Control.ModifierKeys); - } - else - FocusedNode = clickedNode; - } - /* - else - { - FocusedNode = null; - NodesSelection.Clear(); - }*/ - } - base.OnMouseClick(e); - } - protected override void OnMouseMove(MouseEventArgs e) - { - base.OnMouseMove(e); - - if (m_movingColumn != null) - { - m_movingColumn.Moving = true; - Cursor = Cursors.SizeAll; - - var idx = m_movingColumn.VisibleIndex; - if (idx + 1 < Columns.VisibleColumns.Length) - { - var nextcol = Columns.VisibleColumns[idx + 1]; - if (nextcol.CalculatedRect.X + (nextcol.CalculatedRect.Width * 3) / 4 < e.X) - { - Columns.SetVisibleIndex(m_movingColumn, idx + 1); - } - } - if (idx - 1 >= 0) - { - var prevcol = Columns.VisibleColumns[idx - 1]; - if (prevcol.CalculatedRect.Right - (prevcol.CalculatedRect.Width * 3) / 4 > e.X) - { - Columns.SetVisibleIndex(m_movingColumn, idx - 1); - } - } - - Columns.RecalcVisibleColumsRect(true); - Invalidate(); - return; - } - if (m_resizingColumn != null) - { - // if we've clicked on an autosize column, actually resize the next one along. - if (m_resizingColumn.AutoSize) - { - if (Columns.VisibleColumns.Length > m_resizingColumn.VisibleIndex + 1) - { - TreeListColumn realResizeColumn = Columns.VisibleColumns[m_resizingColumn.VisibleIndex + 1]; - - int right = realResizeColumn.CalculatedRect.Right - m_resizingColumnScrollOffset; - int width = right - e.X; - if (width < 10) - width = 10; - - bool resize = true; - - if (Columns.VisibleColumns.Length > realResizeColumn.VisibleIndex + 1) - if (Columns.VisibleColumns[realResizeColumn.VisibleIndex + 1].CalculatedRect.Width <= 10 && m_resizingColumn.Width < width) - resize = false; - - if (realResizeColumn.VisibleIndex > 1) - if (Columns.VisibleColumns[realResizeColumn.VisibleIndex - 1].CalculatedRect.Width <= 10 && m_resizingColumn.Width < width) - resize = false; - - if (resize) - { - realResizeColumn.Width = width; - } - } - } - else - { - int left = m_resizingColumnLeft; - int width = e.X - left; - if (width < 10) - width = 10; - - bool resize = true; - - if (Columns.VisibleColumns.Length > m_resizingColumn.VisibleIndex + 1) - if (Columns.VisibleColumns[m_resizingColumn.VisibleIndex + 1].CalculatedRect.Width <= 10 && m_resizingColumn.Width < width) - resize = false; - - if (m_resizingColumn.internalIndex > 1) - if (Columns.VisibleColumns[m_resizingColumn.VisibleIndex - 1].CalculatedRect.Width <= 10 && m_resizingColumn.Width < width) - resize = false; - - if (resize) - m_resizingColumn.Width = width; - } - - Columns.RecalcVisibleColumsRect(true); - Invalidate(); - return; - } - - TreeListColumn hotcol = null; - TreelistView.HitInfo info = Columns.CalcHitInfo(new Point(e.X, e.Y), HScrollValue()); - if ((int)(info.HitType & HitInfo.eHitType.kColumnHeader) > 0) - hotcol = info.Column; - - Node clickedNode = CalcHitNode(new Point(e.X, e.Y)); - - if ((int)(info.HitType & HitInfo.eHitType.kColumnHeaderResize) > 0) - Cursor = Cursors.VSplit; - else if (info.Column != null && - info.Column.Index == GetTreeColumn(clickedNode) && - GetNodeBitmap(clickedNode) != null && - m_viewSetting.HoverHandTreeColumn) - Cursor = Cursors.Hand; - else - Cursor = Cursors.Arrow; - - if (!this.DesignMode && clickedNode != null && clickedNode.ClippedText) - { - m_tooltipNode = clickedNode; - m_tooltipTimer.Start(); - } - else - { - m_tooltipNode = null; - m_tooltip.Hide(this); - m_tooltipVisible = false; - m_tooltipTimer.Stop(); - } - - if (GetHoverNodeBitmap(clickedNode) != null && - GetNodeBitmap(clickedNode) != GetHoverNodeBitmap(clickedNode)) - Invalidate(); - - SetHotColumn(hotcol, true); - - int vScrollOffset = VScrollValue(); - - int newhotrow = -1; - if (hotcol == null) - { - int row = (e.Y - Columns.Options.HeaderHeight) / RowOptions.ItemHeight; - newhotrow = row + vScrollOffset; - } - if (newhotrow != m_hotrow) - { - InvalidateRow(m_hotrow); - m_hotrow = newhotrow; - InvalidateRow(m_hotrow); - } - } - protected override void OnMouseLeave(EventArgs e) - { - base.OnMouseLeave(e); - SetHotColumn(null, false); - Cursor = Cursors.Arrow; - Invalidate(); - } - protected override void OnMouseWheel(MouseEventArgs e) - { - m_tooltip.Hide(this); - m_tooltipVisible = false; - m_tooltipTimer.Stop(); - - int value = m_vScroll.Value - (e.Delta * SystemInformation.MouseWheelScrollLines / 120); - if (m_vScroll.Visible) - SetVScrollValue(value); - base.OnMouseWheel(e); - } - protected override void OnMouseDown(MouseEventArgs e) - { - m_tooltip.Hide(this); - m_tooltipVisible = false; - m_tooltipTimer.Stop(); - - this.Focus(); - if (e.Button == MouseButtons.Right) - { - Point mousePoint = new Point(e.X, e.Y); - Node clickedNode = CalcHitNode(mousePoint); - if (clickedNode != null) - { - // if multi select the selection is cleard if clicked node is not in selection - if (MultiSelect) - { - if (NodesSelection.Contains(clickedNode) == false) - MultiSelectAdd(clickedNode, Control.ModifierKeys); - } - FocusedNode = clickedNode; - Invalidate(); - } - BeforeShowContextMenu(); - } - - if (e.Button == MouseButtons.Left) - { - TreelistView.HitInfo info = Columns.CalcHitInfo(new Point(e.X, e.Y), HScrollValue()); - if ((int)(info.HitType & HitInfo.eHitType.kColumnHeaderResize) > 0) - { - m_resizingColumn = info.Column; - m_resizingColumnScrollOffset = HScrollValue(); - m_resizingColumnLeft = m_resizingColumn.CalculatedRect.Left - m_resizingColumnScrollOffset; - return; - } - if ((int)(info.HitType & HitInfo.eHitType.kColumnHeader) > 0 && m_viewSetting.UserRearrangeableColumns) - { - m_movingColumn = info.Column; - return; - } - } - base.OnMouseDown(e); - } - protected override void OnMouseUp(MouseEventArgs e) - { - if (m_resizingColumn != null) - { - m_resizingColumn = null; - Columns.RecalcVisibleColumsRect(); - UpdateScrollBars(); - Invalidate(); - if (AfterResizingColumn != null) - AfterResizingColumn(this, e); - } - if (m_movingColumn != null) - { - m_movingColumn.Moving = false; - m_movingColumn = null; - Cursor = Cursors.Arrow; - Columns.RecalcVisibleColumsRect(); - UpdateScrollBars(); - Invalidate(); - } - base.OnMouseUp(e); - } - protected override void OnMouseDoubleClick(MouseEventArgs e) - { - base.OnMouseDoubleClick(e); - Point mousePoint = new Point(e.X, e.Y); - Node clickedNode = CalcHitNode(mousePoint); - if (clickedNode != null && clickedNode.HasChildren) - clickedNode.Expanded = !clickedNode.Expanded; - if (clickedNode != null) - OnNodeDoubleClicked(clickedNode); - } - - // Somewhere I read that it could be risky to do any handling in GetFocus / LostFocus. - // The reason is that it will throw exception incase you make a call which recreates the windows handle (e.g. - // change the border style. Instead one should always use OnEnter and OnLeave instead. That is why I'm using - // OnEnter and OnLeave instead, even though I'm only doing Invalidate. - protected override void OnEnter(EventArgs e) - { - base.OnEnter(e); - Invalidate(); - } - protected override void OnLeave(EventArgs e) - { - m_tooltipNode = null; - m_tooltip.Hide(this); - m_tooltipVisible = false; - m_tooltipTimer.Stop(); - base.OnLeave(e); - Invalidate(); - } - - protected override void OnLostFocus(EventArgs e) - { - m_tooltipNode = null; - m_tooltip.Hide(this); - m_tooltipVisible = false; - m_tooltipTimer.Stop(); - base.OnLostFocus(e); - Invalidate(); - } - - void SetHotColumn(TreeListColumn col, bool ishot) - { - int scrolloffset = HScrollValue(); - if (col != m_hotColumn) - { - if (m_hotColumn != null) - { - m_hotColumn.ishot = false; - Rectangle r = m_hotColumn.CalculatedRect; - r.X -= scrolloffset; - Invalidate(r); - } - m_hotColumn = col; - if (m_hotColumn != null) - { - m_hotColumn.ishot = ishot; - Rectangle r = m_hotColumn.CalculatedRect; - r.X -= scrolloffset; - Invalidate(r); - } - } - } - internal int RowHeaderWidth() - { - if (RowOptions.ShowHeader) - return RowOptions.HeaderWidth; - return 0; - } - int MinWidth() - { - return RowHeaderWidth() + Columns.ColumnsWidth; - } - int MaxVisibleRows(out int remainder) - { - remainder = 0; - if (ClientRectangle.Height < 0) - return 0; - int height = ClientRectangle.Height - Columns.Options.HeaderHeight; - //return (int) Math.Ceiling((double)(ClientRectangle.Height - Columns.HeaderHeight) / (double)Nodes.ItemHeight); - remainder = (ClientRectangle.Height - Columns.Options.HeaderHeight) % RowOptions.ItemHeight ; - return Math.Max(0, (ClientRectangle.Height - Columns.Options.HeaderHeight) / RowOptions.ItemHeight); - } - int MaxVisibleRows() - { - int unused; - return MaxVisibleRows(out unused); - } - public void BeginUpdate() - { - m_nodes.BeginUpdate(); - } - public void EndUpdate() - { - m_nodes.EndUpdate(); - RecalcLayout(); - Invalidate(); - } - protected override CreateParams CreateParams - { - get - { - const int WS_BORDER = 0x00800000; - const int WS_EX_CLIENTEDGE = 0x00000200; - CreateParams p = base.CreateParams; - p.Style &= ~(int)WS_BORDER; - p.ExStyle &= ~(int)WS_EX_CLIENTEDGE; - switch (ViewOptions.BorderStyle) - { - case BorderStyle.Fixed3D: - p.ExStyle |= (int)WS_EX_CLIENTEDGE; - break; - case BorderStyle.FixedSingle: - p.Style |= (int)WS_BORDER; - break; - default: - break; - } - return p; - } - } - - TreeListColumn m_hotColumn = null; - - object GetDataDesignMode(Node node, TreeListColumn column) - { - string id = string.Empty; - while (node != null) - { - id = node.Owner.GetNodeIndex(node).ToString() + ":" + id; - node = node.Parent; - } - return "" + id; - } - protected virtual object GetData(Node node, TreeListColumn column) - { - if (node[column.Index] != null) - return node[column.Index]; - return null; - } - public new Rectangle ClientRectangle - { - get - { - Rectangle r = base.ClientRectangle; - if (m_vScroll.Visible) - r.Width -= m_vScroll.Width+1; - if (m_hScroll.Visible) - r.Height -= m_hScroll.Height+1; - return r; - } - } - - protected virtual TreelistView.TreeList.TextFormatting GetFormatting(TreelistView.Node node, TreelistView.TreeListColumn column) - { - return column.CellFormat; - } - protected virtual void PaintCellPlusMinus(Graphics dc, Rectangle glyphRect, Node node, TreeListColumn column) - { - CellPainter.PaintCellPlusMinus(dc, glyphRect, node, column, GetFormatting(node, column)); - } - protected virtual void PaintCellBackground(Graphics dc, Rectangle cellRect, Node node, TreeListColumn column) - { - if (this.DesignMode) - CellPainter.PaintCellBackground(dc, cellRect, node, column, GetFormatting(node, column), GetDataDesignMode(node, column)); - else - CellPainter.PaintCellBackground(dc, cellRect, node, column, GetFormatting(node, column), GetData(node, column)); - } - protected virtual void PaintCellText(Graphics dc, Rectangle cellRect, Node node, TreeListColumn column) - { - if (this.DesignMode) - CellPainter.PaintCellText(dc, cellRect, node, column, GetFormatting(node, column), GetDataDesignMode(node, column)); - else - CellPainter.PaintCellText(dc, cellRect, node, column, GetFormatting(node, column), GetData(node, column)); - } - protected virtual void PaintImage(Graphics dc, Rectangle imageRect, Node node, Image image) - { - if (image != null) - dc.DrawImage(image, imageRect.X, imageRect.Y, imageRect.Width, imageRect.Height); - } - protected virtual void PaintNode(Graphics dc, Rectangle rowRect, Node node, TreeListColumn[] visibleColumns, int visibleRowIndex) - { - CellPainter.DrawSelectionBackground(dc, rowRect, node); - foreach (TreeListColumn col in visibleColumns) - { - if (col.CalculatedRect.Right - HScrollValue() < RowHeaderWidth()) - continue; - - Rectangle cellRect = rowRect; - cellRect.X = col.CalculatedRect.X - HScrollValue(); - cellRect.Width = col.CalculatedRect.Width; - - dc.SetClip(cellRect); - - if (col.Index == GetTreeColumn(node)) - { - int lineindet = 10; - // add left margin - cellRect.X += Columns.Options.LeftMargin; - cellRect.Width -= Columns.Options.LeftMargin; - - // add indent size - int indentSize = GetIndentSize(node) + 5; - cellRect.X += indentSize; - cellRect.Width -= indentSize; - - // save rectangle for line drawing below - Rectangle lineCellRect = cellRect; - - cellRect.X += lineindet; - cellRect.Width -= lineindet; - - Rectangle glyphRect = GetPlusMinusRectangle(node, col, visibleRowIndex); - Rectangle plusminusRect = glyphRect; - - if (!ViewOptions.ShowLine && (!ViewOptions.ShowPlusMinus || (!ViewOptions.PadForPlusMinus && plusminusRect == Rectangle.Empty))) - { - cellRect.X -= (lineindet + 5); - cellRect.Width += (lineindet + 5); - } - - Point mousePoint = PointToClient(Cursor.Position); - Node hoverNode = CalcHitNode(mousePoint); - - Image icon = hoverNode != null && hoverNode == node ? GetHoverNodeBitmap(node) : GetNodeBitmap(node); - - PaintCellBackground(dc, cellRect, node, col); - - if (ViewOptions.ShowLine) - PaintLines(dc, lineCellRect, node); - - if (SelectedImage != null && (NodesSelection.Contains(node) || FocusedNode == node)) - { - // center the image vertically - glyphRect.Y = cellRect.Y + (cellRect.Height / 2) - (SelectedImage.Height / 2); - glyphRect.X = cellRect.X; - glyphRect.Width = SelectedImage.Width; - glyphRect.Height = SelectedImage.Height; - - PaintImage(dc, glyphRect, node, SelectedImage); - cellRect.X += (glyphRect.Width + 2); - cellRect.Width -= (glyphRect.Width + 2); - } - - if (icon != null) - { - // center the image vertically - glyphRect.Y = cellRect.Y + (cellRect.Height / 2) - (icon.Height / 2); - glyphRect.X = cellRect.X; - glyphRect.Width = icon.Width; - glyphRect.Height = icon.Height; - - PaintImage(dc, glyphRect, node, icon); - cellRect.X += (glyphRect.Width + 2); - cellRect.Width -= (glyphRect.Width + 2); - } - - PaintCellText(dc, cellRect, node, col); - - if (plusminusRect != Rectangle.Empty && ViewOptions.ShowPlusMinus) - PaintCellPlusMinus(dc, plusminusRect, node, col); - } - else - { - PaintCellBackground(dc, cellRect, node, col); - PaintCellText(dc, cellRect, node, col); - } - - dc.ResetClip(); - } - } - protected virtual void PaintLines(Graphics dc, Rectangle cellRect, Node node) - { - Pen pen = new Pen(Color.Gray); - pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; - - int halfPoint = cellRect.Top + (cellRect.Height / 2); - // line should start from center at first root node - if (node.Parent == null && node.PrevSibling == null) - { - cellRect.Y += (cellRect.Height / 2); - cellRect.Height -= (cellRect.Height / 2); - } - if (node.NextSibling != null || node.HasChildren) // draw full height line - dc.DrawLine(pen, cellRect.X, cellRect.Top, cellRect.X, cellRect.Bottom); - else - dc.DrawLine(pen, cellRect.X, cellRect.Top, cellRect.X, halfPoint); - dc.DrawLine(pen, cellRect.X, halfPoint, cellRect.X + 10, halfPoint); - - // now draw the lines for the parents sibling - Node parent = node.Parent; - while (parent != null) - { - Pen linePen = null; - if (parent.TreeLineColor != Color.Transparent || parent.TreeLineWidth > 0.0f) - linePen = new Pen(parent.TreeLineColor, parent.TreeLineWidth); - - cellRect.X -= ViewOptions.Indent; - dc.DrawLine(linePen != null ? linePen : pen, cellRect.X, cellRect.Top, cellRect.X, cellRect.Bottom); - parent = parent.Parent; - - if (linePen != null) - linePen.Dispose(); - } - - pen.Dispose(); - } - protected virtual int GetIndentSize(Node node) - { - int indent = 0; - Node parent = node.Parent; - while (parent != null) - { - indent += ViewOptions.Indent; - parent = parent.Parent; - } - return indent; - } - protected virtual Rectangle GetPlusMinusRectangle(Node node, TreeListColumn firstColumn, int visibleRowIndex) - { - if (node.HasChildren == false) - return Rectangle.Empty; - int hScrollOffset = HScrollValue(); - if (firstColumn.CalculatedRect.Right - hScrollOffset < RowHeaderWidth()) - return Rectangle.Empty; - //System.Diagnostics.Debug.Assert(firstColumn.VisibleIndex == 0); - - Rectangle glyphRect = firstColumn.CalculatedRect; - glyphRect.X -= hScrollOffset; - glyphRect.X += GetIndentSize(node); - glyphRect.X += Columns.Options.LeftMargin; - glyphRect.Width = 10; - glyphRect.Y = VisibleRowToYPoint(visibleRowIndex); - glyphRect.Height = RowOptions.ItemHeight; - return glyphRect; - } - protected virtual Image GetNodeBitmap(Node node) - { - if (node != null) - return node.Image; - return null; - } - protected virtual Image GetHoverNodeBitmap(Node node) - { - if (node != null) - return node.HoverImage; - return null; - } - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - int hScrollOffset = HScrollValue(); - int remainder = 0; - int visiblerows = MaxVisibleRows(out remainder); - if (remainder > 0) - visiblerows++; - - bool drawColumnHeaders = true; - // draw columns - if (drawColumnHeaders) - { - Rectangle headerRect = e.ClipRectangle; - Columns.Draw(e.Graphics, headerRect, hScrollOffset); - } - - int visibleRowIndex = 0; - TreeListColumn[] visibleColumns = this.Columns.VisibleColumns; - int columnsWidth = Columns.ColumnsWidth; - foreach (Node node in NodeCollection.ForwardNodeIterator(m_firstVisibleNode, true)) - { - Rectangle rowRect = CalcRowRectangle(visibleRowIndex); - if (rowRect == Rectangle.Empty || rowRect.Bottom <= e.ClipRectangle.Top || rowRect.Top >= e.ClipRectangle.Bottom) - { - if (visibleRowIndex > visiblerows) - break; - visibleRowIndex++; - continue; - } - rowRect.X = RowHeaderWidth() - hScrollOffset; - rowRect.Width = columnsWidth; - - // draw the current node - PaintNode(e.Graphics, rowRect, node, visibleColumns, visibleRowIndex); - - // drow row header for current node - Rectangle headerRect = rowRect; - headerRect.X = 0; - headerRect.Width = RowHeaderWidth(); - - int absoluteRowIndex = visibleRowIndex + VScrollValue(); - headerRect.Width = RowHeaderWidth(); - m_rowPainter.DrawHeader(e.Graphics, headerRect, absoluteRowIndex == m_hotrow); - - visibleRowIndex++; - } - - visibleRowIndex = 0; - foreach (Node node in NodeCollection.ForwardNodeIterator(m_firstVisibleNode, true)) - { - Rectangle rowRect = CalcRowRectangle(visibleRowIndex); - // draw horizontal grid line for current node - if (ViewOptions.ShowGridLines) - { - Rectangle r = rowRect; - r.X = RowHeaderWidth(); - r.Width = columnsWidth - hScrollOffset; - m_rowPainter.DrawHorizontalGridLine(e.Graphics, r, GridLineColour); - } - - visibleRowIndex++; - } - - // draw vertical grid lines - if (ViewOptions.ShowGridLines) - { - // visible row count - int remainRows = Nodes.VisibleNodeCount - m_vScroll.Value; - if (visiblerows > remainRows) - visiblerows = remainRows; - - Rectangle fullRect = ClientRectangle; - if (drawColumnHeaders) - fullRect.Y += Columns.Options.HeaderHeight; - fullRect.Height = visiblerows * RowOptions.ItemHeight; - Columns.Painter.DrawVerticalGridLines(Columns, e.Graphics, fullRect, hScrollOffset); - } - } - - protected override bool IsInputKey(Keys keyData) - { - if ((int)(keyData & Keys.Shift) > 0) - return true; - switch (keyData) - { - case Keys.Left: - case Keys.Right: - case Keys.Down: - case Keys.Up: - case Keys.PageUp: - case Keys.PageDown: - case Keys.Home: - case Keys.End: - return true; - } - return false; - } - protected override void OnKeyDown(KeyEventArgs e) - { - Node newnode = null; - if (e.KeyCode == Keys.PageUp) - { - int remainder = 0; - int diff = MaxVisibleRows(out remainder)-1; - newnode = NodeCollection.GetNextNode(FocusedNode, -diff); - if (newnode == null) - newnode = Nodes.FirstVisibleNode(); - } - if (e.KeyCode == Keys.PageDown) - { - int remainder = 0; - int diff = MaxVisibleRows(out remainder)-1; - newnode = NodeCollection.GetNextNode(FocusedNode, diff); - if (newnode == null) - newnode = Nodes.LastVisibleNode(true); - } - - if (e.KeyCode == Keys.Down) - { - newnode = NodeCollection.GetNextNode(FocusedNode, 1); - } - if (e.KeyCode == Keys.Up) - { - newnode = NodeCollection.GetNextNode(FocusedNode, -1); - } - if (e.KeyCode == Keys.Home) - { - newnode = Nodes.FirstNode; - } - if (e.KeyCode == Keys.End) - { - newnode = Nodes.LastVisibleNode(true); - } - if (e.KeyCode == Keys.Left) - { - if (FocusedNode != null) - { - if (FocusedNode.Expanded) - { - FocusedNode.Collapse(); - EnsureVisible(FocusedNode); - return; - } - if (FocusedNode.Parent != null) - { - FocusedNode = FocusedNode.Parent; - EnsureVisible(FocusedNode); - } - } - } - if (e.KeyCode == Keys.Right) - { - if (FocusedNode != null) - { - if (FocusedNode.Expanded == false && FocusedNode.HasChildren) - { - FocusedNode.Expand(); - EnsureVisible(FocusedNode); - return; - } - if (FocusedNode.Expanded == true && FocusedNode.HasChildren) - { - FocusedNode = FocusedNode.Nodes.FirstNode; - EnsureVisible(FocusedNode); - } - } - } - if (newnode != null) - { - if (MultiSelect) - { - // tree behavior is - // keys none, the selected node is added as the focused and selected node - // keys control, only focused node is moved, the selected nodes collection is not modified - // keys shift, selection from first selected node to current node is done - if (Control.ModifierKeys == Keys.Control) - FocusedNode = newnode; - else - MultiSelectAdd(newnode, Control.ModifierKeys); - } - else - FocusedNode = newnode; - EnsureVisible(FocusedNode); - } - base.OnKeyDown(e); - } - - internal void internalUpdateStyles() - { - base.UpdateStyles(); - } - - #region ISupportInitialize Members - - public void BeginInit() - { - Columns.BeginInit(); - } - public void EndInit() - { - Columns.EndInit(); - } - - #endregion - internal new bool DesignMode - { - get { return base.DesignMode; } - } - } - - public class TreeListViewNodes : NodeCollection - { - TreeListView m_tree; - bool m_isUpdating = false; - public void BeginUpdate() - { - m_isUpdating = true; - } - public void EndUpdate() - { - m_isUpdating = false; - } - public TreeListViewNodes(TreeListView owner) : base(null) - { - m_tree = owner; - OwnerView = owner; - } - protected override void UpdateNodeCount(int oldvalue, int newvalue) - { - base.UpdateNodeCount(oldvalue, newvalue); - if (!m_isUpdating) - m_tree.RecalcLayout(); - } - public override void Clear() - { - base.Clear(); - m_tree.RecalcLayout(); - } - public override void NodetifyBeforeExpand(Node nodeToExpand, bool expanding) - { - if (!m_tree.DesignMode) - m_tree.OnNotifyBeforeExpand(nodeToExpand, expanding); - } - public override void NodetifyAfterExpand(Node nodeToExpand, bool expanded) - { - m_tree.OnNotifyAfterExpand(nodeToExpand, expanded); - } - protected override int GetFieldIndex(string fieldname) - { - TreeListColumn col = m_tree.Columns[fieldname]; - if (col != null) - return col.Index; - return -1; - } - } -} diff --git a/renderdocui/Interop/Camera.cs b/renderdocui/Interop/Camera.cs deleted file mode 100644 index 18345c528..000000000 --- a/renderdocui/Interop/Camera.cs +++ /dev/null @@ -1,144 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -namespace renderdoc -{ - public class Camera - { - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr Camera_InitArcball(); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr Camera_InitFPSLook(); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void Camera_Shutdown(IntPtr real); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void Camera_SetPosition(IntPtr real, float x, float y, float z); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void Camera_SetFPSRotation(IntPtr real, float x, float y, float z); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void Camera_SetArcballDistance(IntPtr real, float dist); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void Camera_ResetArcball(IntPtr real); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void Camera_RotateArcball(IntPtr real, float ax, float ay, float bx, float by); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void Camera_GetBasis(IntPtr real, IntPtr pos, IntPtr fwd, IntPtr right, IntPtr up); - - private IntPtr m_Real = IntPtr.Zero; - - public IntPtr Real { get { return m_Real; } } - - public static Camera InitArcball() - { - return new Camera(Camera_InitArcball()); - } - - public static Camera InitFPSLook() - { - return new Camera(Camera_InitFPSLook()); - } - - private Camera(IntPtr real) - { - m_Real = real; - } - - public void Shutdown() - { - Camera_Shutdown(m_Real); - } - - public void SetPosition(Vec3f p) - { - Camera_SetPosition(m_Real, p.x, p.y, p.z); - } - - public void SetFPSRotation(Vec3f r) - { - Camera_SetFPSRotation(m_Real, r.x, r.y, r.z); - } - - public void SetArcballDistance(float dist) - { - Camera_SetArcballDistance(m_Real, dist); - } - - public void ResetArcball() - { - Camera_ResetArcball(m_Real); - } - - public void RotateArcball(System.Drawing.Point from, System.Drawing.Point to, System.Drawing.Size winSize) - { - float ax = ((float)from.X / (float)winSize.Width) * 2.0f - 1.0f; - float ay = ((float)from.Y / (float)winSize.Height) * 2.0f - 1.0f; - float bx = ((float)to.X / (float)winSize.Width) * 2.0f - 1.0f; - float by = ((float)to.Y / (float)winSize.Height) * 2.0f - 1.0f; - - // this isn't a 'true arcball' but it handles extreme aspect ratios - // better. We basically 'centre' around the from point always being - // 0,0 (straight out of the screen) as if you're always dragging - // the arcball from the middle, and just use the relative movement - int minDimension = Math.Min(winSize.Width, winSize.Height); - - ax = ay = 0; - bx = ((float)(to.X - from.X) / (float)minDimension) * 2.0f; - by = ((float)(to.Y - from.Y) / (float)minDimension) * 2.0f; - - ay = -ay; - by = -by; - - Camera_RotateArcball(m_Real, ax, ay, bx, by); - } - - public void GetBasis(out Vec3f pos, out Vec3f fwd, out Vec3f right, out Vec3f up) - { - IntPtr p = CustomMarshal.Alloc(typeof(FloatVector)); - IntPtr f = CustomMarshal.Alloc(typeof(FloatVector)); - IntPtr r = CustomMarshal.Alloc(typeof(FloatVector)); - IntPtr u = CustomMarshal.Alloc(typeof(FloatVector)); - - Camera_GetBasis(m_Real, p, f, r, u); - - pos = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(p, typeof(FloatVector), false)); - fwd = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(f, typeof(FloatVector), false)); - right = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(r, typeof(FloatVector), false)); - up = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(u, typeof(FloatVector), false)); - - CustomMarshal.Free(p); - CustomMarshal.Free(f); - CustomMarshal.Free(r); - CustomMarshal.Free(u); - } - } -} diff --git a/renderdocui/Interop/CaptureOptions.cs b/renderdocui/Interop/CaptureOptions.cs deleted file mode 100644 index c7bc04256..000000000 --- a/renderdocui/Interop/CaptureOptions.cs +++ /dev/null @@ -1,84 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; - -namespace renderdoc -{ - [DebuggerDisplay("{m_ID}")] - [StructLayout(LayoutKind.Sequential)] - public struct ResourceId - { - private UInt64 m_ID; - - public override string ToString() - { - return String.Format("{0}", m_ID); - } - - public override bool Equals(Object obj) - { - return obj is ResourceId && this == (ResourceId)obj; - } - public override int GetHashCode() - { - return m_ID.GetHashCode(); - } - public static bool operator ==(ResourceId x, ResourceId y) - { - return x.m_ID == y.m_ID; - } - public static bool operator !=(ResourceId x, ResourceId y) - { - return !(x == y); - } - - public static ResourceId Null = new ResourceId(0); - - public ResourceId(UInt64 id) - { - m_ID = id; - } - }; - - [StructLayout(LayoutKind.Sequential)] - public class CaptureOptions - { - public bool AllowVSync; - public bool AllowFullscreen; - public bool APIValidation; - public bool CaptureCallstacks; - public bool CaptureCallstacksOnlyDraws; - public UInt32 DelayForDebugger; - public bool VerifyMapWrites; - public bool HookIntoChildren; - public bool RefAllResources; - public bool SaveAllInitials; - public bool CaptureAllCmdLists; - public bool DebugOutputMute; - }; -}; diff --git a/renderdocui/Interop/CustomMarshaling.cs b/renderdocui/Interop/CustomMarshaling.cs deleted file mode 100644 index 26f155b9b..000000000 --- a/renderdocui/Interop/CustomMarshaling.cs +++ /dev/null @@ -1,631 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Linq; -using System.Runtime.InteropServices; -using System.Reflection; -using System.Collections.Generic; - -namespace renderdoc -{ - // corresponds to rdctype::array on the C side - [StructLayout(LayoutKind.Sequential)] - public struct templated_array - { - public IntPtr elems; - public Int32 count; - }; - - public enum CustomUnmanagedType - { - TemplatedArray = 0, - UTF8TemplatedString, - FixedArray, - Union, - Skip, - CustomClass, - CustomClassPointer, - } - - public enum CustomFixedType - { - None = 0, - Float, - UInt32, - Int32, - UInt16, - Double, - } - - // custom attribute that we can apply to structures we want to serialise - public sealed class CustomMarshalAsAttribute : Attribute - { - public CustomMarshalAsAttribute(CustomUnmanagedType unmanagedType) - { - m_UnmanagedType = unmanagedType; - } - - public CustomUnmanagedType CustomType - { - get { return m_UnmanagedType; } - } - - public int FixedLength - { - get { return m_FixedLen; } - set { m_FixedLen = value; } - } - - public CustomFixedType FixedType - { - get { return m_FixedType; } - set { m_FixedType = value; } - } - - private CustomUnmanagedType m_UnmanagedType; - private int m_FixedLen; - private CustomFixedType m_FixedType = CustomFixedType.None; - } - - // custom marshalling code to handle converting complex data types with our given formatting - // over to .NET managed copies. - public static class CustomMarshal - { - [DllImport("kernel32.dll", EntryPoint = "RtlFillMemory", SetLastError = false)] - private static extern void FillMemory(IntPtr destination, int length, byte fill); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_FreeArrayMem(IntPtr mem); - - // utility functions usable by wrappers around actual functions calling into the C++ core - public static IntPtr Alloc(Type T) - { - IntPtr mem = Marshal.AllocHGlobal(CustomMarshal.SizeOf(T)); - FillMemory(mem, CustomMarshal.SizeOf(T), 0); - - return mem; - } - - public static IntPtr Alloc(Type T, int arraylen) - { - IntPtr mem = Marshal.AllocHGlobal(CustomMarshal.SizeOf(T)*arraylen); - FillMemory(mem, CustomMarshal.SizeOf(T) * arraylen, 0); - - return mem; - } - - public static IntPtr MakeUTF8String(string s) - { - int len = System.Text.Encoding.UTF8.GetByteCount(s); - - IntPtr mem = Marshal.AllocHGlobal(len + 1); - byte[] bytes = new byte[len + 1]; - bytes[len] = 0; // add NULL terminator - System.Text.Encoding.UTF8.GetBytes(s, 0, s.Length, bytes, 0); - - Marshal.Copy(bytes, 0, mem, len+1); - - return mem; - } - - public static void Free(IntPtr mem) - { - Marshal.FreeHGlobal(mem); - } - - // note that AlignOf and AddFieldSize and others are called rarely as the results - // are cached lower down - - // match C/C++ alignment rules - private static int AlignOf(FieldInfo field) - { - var cma = GetCustomAttr(field); - - if (cma != null && - (cma.CustomType == CustomUnmanagedType.UTF8TemplatedString || - cma.CustomType == CustomUnmanagedType.TemplatedArray || - cma.CustomType == CustomUnmanagedType.CustomClassPointer) - ) - return IntPtr.Size; - - if (cma != null && cma.CustomType == CustomUnmanagedType.Skip) - return 1; - - if (field.FieldType.IsPrimitive || - (field.FieldType.IsArray && field.FieldType.GetElementType().IsPrimitive)) - return Marshal.SizeOf(NonArrayType(field.FieldType)); - - // Get instance fields of the structure type. - FieldInfo[] fieldInfo = NonArrayType(field.FieldType).GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); - - int align = 1; - - foreach (FieldInfo f in fieldInfo) - align = Math.Max(align, AlignOf(f)); - - return align; - } - - private static Type NonArrayType(Type t) - { - return t.IsArray ? t.GetElementType() : t; - } - - private static Dictionary m_CustomAttrCache = new Dictionary(); - - private static CustomMarshalAsAttribute GetCustomAttr(Type t, FieldInfo[] fields, int fieldIdx) - { - lock (m_CustomAttrCache) - { - if (!m_CustomAttrCache.ContainsKey(t)) - { - var arr = new CustomMarshalAsAttribute[fields.Length]; - - for (int i = 0; i < fields.Length; i++) - arr[i] = GetCustomAttr(fields[i]); - - m_CustomAttrCache.Add(t, arr); - } - - return m_CustomAttrCache[t][fieldIdx]; - } - } - - private static CustomMarshalAsAttribute GetCustomAttr(FieldInfo field) - { - if (CustomAttributeDefined(field)) - { - object[] attributes = field.GetCustomAttributes(false); - foreach (object attribute in attributes) - { - if (attribute is CustomMarshalAsAttribute) - { - return (attribute as CustomMarshalAsAttribute); - } - } - } - - return null; - } - - // add a field's size to the size parameter, respecting alignment - private static void AddFieldSize(FieldInfo field, ref long size) - { - int a = AlignOf(field); - int alignment = (int)size % a; - if (alignment != 0) size += a - alignment; - - var cma = GetCustomAttr(field); - if (cma != null) - { - switch (cma.CustomType) - { - case CustomUnmanagedType.CustomClass: - size += SizeOf(field.FieldType); - break; - case CustomUnmanagedType.CustomClassPointer: - size += IntPtr.Size; - break; - case CustomUnmanagedType.Union: - { - FieldInfo[] fieldInfo = field.FieldType.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); - - long unionsize = 0; - - foreach (FieldInfo unionfield in fieldInfo) - { - long maxsize = 0; - - AddFieldSize(unionfield, ref maxsize); - - unionsize = Math.Max(unionsize, maxsize); - } - - size += unionsize; - break; - } - case CustomUnmanagedType.TemplatedArray: - case CustomUnmanagedType.UTF8TemplatedString: - size += Marshal.SizeOf(typeof(templated_array)); - break; - case CustomUnmanagedType.FixedArray: - size += cma.FixedLength * SizeOf(NonArrayType(field.FieldType)); - break; - case CustomUnmanagedType.Skip: - break; - default: - throw new NotImplementedException("Unexpected attribute"); - } - } - else - { - size += SizeOf(field.FieldType); - } - - alignment = (int)size % a; - if (alignment != 0) size += a - alignment; - } - - // cache for sizes of types, since this will get called a lot - private static Dictionary m_SizeCache = new Dictionary(); - - // return the size of the C++ equivalent of this type (so that we can allocate enough) - // space to pass a pointer for example. - private static int SizeOf(Type structureType) - { - if (structureType.IsPrimitive || - (structureType.IsArray && structureType.GetElementType().IsPrimitive)) - return Marshal.SizeOf(structureType); - - lock (m_SizeCache) - { - if (m_SizeCache.ContainsKey(structureType)) - return m_SizeCache[structureType]; - - // Get instance fields of the structure type. - FieldInfo[] fieldInfo = structureType.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); - - long size = 0; - - int a = 1; - - foreach (FieldInfo field in fieldInfo) - { - AddFieldSize(field, ref size); - a = Math.Max(a, AlignOf(field)); - } - - int alignment = (int)size % a; - if (alignment != 0) size += a - alignment; - - m_SizeCache.Add(structureType, (int)size); - - return (int)size; - } - } - - // caching the offset to the nth field from a base pointer to the type - private static Dictionary m_OffsetCache = new Dictionary(); - // caching how much to align up a pointer by to the first field (above offsets take care after that) - private static Dictionary m_OffsetAlignCache = new Dictionary(); - - // offset a pointer to the idx'th field of a type - private static IntPtr OffsetPtr(Type structureType, FieldInfo[] fieldInfo, int idx, IntPtr ptr) - { - if (fieldInfo.Length == 0) - return ptr; - - lock (m_OffsetCache) - { - if (!m_OffsetAlignCache.ContainsKey(structureType)) - { - Int64[] cacheOffsets = new Int64[fieldInfo.Length]; - int initialAlign = AlignOf(fieldInfo[0]); - - Int64 p = 0; - - for (int i = 0; i < fieldInfo.Length; i++) - { - FieldInfo field = fieldInfo[i]; - - int a = AlignOf(field); - int alignment = (int)p % a; - if (alignment != 0) p += a - alignment; - - cacheOffsets[i] = p; - - AddFieldSize(field, ref p); - } - - m_OffsetAlignCache.Add(structureType, initialAlign); - m_OffsetCache.Add(structureType, cacheOffsets); - } - - { - var p = ptr.ToInt64(); - - int a = m_OffsetAlignCache[structureType]; - int alignment = (int)p % a; - if (alignment != 0) p += a - alignment; - - p += m_OffsetCache[structureType][idx]; - - return new IntPtr(p); - } - } - } - - private static bool CustomAttributeDefined(FieldInfo field) - { - return field.IsDefined(typeof(CustomMarshalAsAttribute), false); - } - - // this function takes a pointer to a templated array (ie. a pointer to a list of Types, and a length) - // and returns an array of that object type, and cleans up the memory if specified. - public static object GetTemplatedArray(IntPtr sourcePtr, Type structureType, bool freeMem) - { - templated_array arr = (templated_array)Marshal.PtrToStructure(sourcePtr, typeof(templated_array)); - - if (structureType == typeof(byte)) - { - byte[] val = new byte[arr.count]; - if(val.Length > 0) - Marshal.Copy(arr.elems, val, 0, val.Length); - - if (freeMem) - RENDERDOC_FreeArrayMem(arr.elems); - - return val; - } - else - { - Array val = Array.CreateInstance(structureType, arr.count); - - int sizeInBytes = SizeOf(structureType); - - for (int i = 0; i < val.Length; i++) - { - IntPtr p = new IntPtr((arr.elems.ToInt64() + i * sizeInBytes)); - - val.SetValue(PtrToStructure(p, structureType, freeMem), i); - } - - if (freeMem) - RENDERDOC_FreeArrayMem(arr.elems); - - return val; - } - } - - public static string PtrToStringUTF8(IntPtr elems, int count) - { - byte[] buffer = new byte[count]; - if (count > 0) - Marshal.Copy(elems, buffer, 0, buffer.Length); - return System.Text.Encoding.UTF8.GetString(buffer); - } - - public static string PtrToStringUTF8(IntPtr elems) - { - int len = 0; - while (Marshal.ReadByte(elems, len) != 0) ++len; - return PtrToStringUTF8(elems, len); - } - - // specific versions of the above GetTemplatedArray for convenience. - public static string TemplatedArrayToString(IntPtr sourcePtr, bool freeMem) - { - templated_array arr = (templated_array)Marshal.PtrToStructure(sourcePtr, typeof(templated_array)); - - string val = PtrToStringUTF8(arr.elems, arr.count); - - if (freeMem) - RENDERDOC_FreeArrayMem(arr.elems); - - return val; - } - - public static string[] TemplatedArrayToStringArray(IntPtr sourcePtr, bool freeMem) - { - templated_array arr = (templated_array)Marshal.PtrToStructure(sourcePtr, typeof(templated_array)); - - int arrSize = SizeOf(typeof(templated_array)); - - string[] ret = new string[arr.count]; - for (int i = 0; i < arr.count; i++) - { - IntPtr ptr = new IntPtr((arr.elems.ToInt64() + i * arrSize)); - - ret[i] = TemplatedArrayToString(ptr, freeMem); - } - - if (freeMem) - RENDERDOC_FreeArrayMem(arr.elems); - - return ret; - } - - public static object PtrToStructure(IntPtr sourcePtr, Type structureType, bool freeMem) - { - return PtrToStructure(sourcePtr, structureType, freeMem, false); - } - - // take a pointer to a C++ structure of a given type, and convert it into the managed equivalent, - // while handling alignment etc and freeing memory returned if it should be caller-freed - private static object PtrToStructure(IntPtr sourcePtr, Type structureType, bool freeMem, bool isUnion) - { - if (sourcePtr == IntPtr.Zero) - return null; - - // Get instance fields of the structure type. - FieldInfo[] fields = structureType.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance) - .OrderBy(field => field.MetadataToken).ToArray(); - - object ret = Activator.CreateInstance(structureType); - - try - { - for (int fieldIdx = 0; fieldIdx < fields.Length; fieldIdx++) - { - FieldInfo field = fields[fieldIdx]; - - IntPtr fieldPtr = isUnion ? sourcePtr : OffsetPtr(structureType, fields, fieldIdx, sourcePtr); - - // no custom attribute, so just use the regular Marshal code - var cma = GetCustomAttr(structureType, fields, fieldIdx); - if (cma == null) - { - if (field.FieldType.IsEnum) - field.SetValue(ret, (VarType)Marshal.ReadInt32(fieldPtr)); - else - field.SetValue(ret, Marshal.PtrToStructure(fieldPtr, field.FieldType)); - } - else - { - switch (cma.CustomType) - { - case CustomUnmanagedType.CustomClass: - field.SetValue(ret, PtrToStructure(fieldPtr, field.FieldType, freeMem)); - break; - case CustomUnmanagedType.CustomClassPointer: - IntPtr ptr = Marshal.ReadIntPtr(fieldPtr); - if (ptr == IntPtr.Zero) - field.SetValue(ret, null); - else - field.SetValue(ret, PtrToStructure(ptr, field.FieldType, freeMem)); - break; - case CustomUnmanagedType.Union: - field.SetValue(ret, PtrToStructure(fieldPtr, field.FieldType, freeMem, true)); - break; - case CustomUnmanagedType.Skip: - break; - case CustomUnmanagedType.FixedArray: - { - if(cma.FixedType == CustomFixedType.Float) - { - float[] val = new float[cma.FixedLength]; - Marshal.Copy(fieldPtr, val, 0, cma.FixedLength); - field.SetValue(ret, val); - } - else if (cma.FixedType == CustomFixedType.UInt16) - { - Int16[] val = new Int16[cma.FixedLength]; - Marshal.Copy(fieldPtr, val, 0, cma.FixedLength); - UInt16[] realval = new UInt16[cma.FixedLength]; - for (int i = 0; i < val.Length; i++) - realval[i] = unchecked((UInt16)val[i]); - field.SetValue(ret, val); - } - else if (cma.FixedType == CustomFixedType.Int32) - { - Int32[] val = new Int32[cma.FixedLength]; - Marshal.Copy(fieldPtr, val, 0, cma.FixedLength); - field.SetValue(ret, val); - } - else if (cma.FixedType == CustomFixedType.Double) - { - double[] val = new double[cma.FixedLength]; - Marshal.Copy(fieldPtr, val, 0, cma.FixedLength); - field.SetValue(ret, val); - } - else if (cma.FixedType == CustomFixedType.UInt32) - { - Int32[] val = new Int32[cma.FixedLength]; - Marshal.Copy(fieldPtr, val, 0, cma.FixedLength); - UInt32[] realval = new UInt32[cma.FixedLength]; - for (int i = 0; i < val.Length; i++) - realval[i] = unchecked((UInt32)val[i]); - field.SetValue(ret, realval); - } - else - { - var arrayType = NonArrayType(field.FieldType); - int sizeInBytes = SizeOf(arrayType); - - Array val = Array.CreateInstance(arrayType, cma.FixedLength); - - for (int i = 0; i < val.Length; i++) - { - IntPtr p = new IntPtr((fieldPtr.ToInt64() + i * sizeInBytes)); - - val.SetValue(PtrToStructure(p, arrayType, freeMem), i); - } - - field.SetValue(ret, val); - } - break; - } - case CustomUnmanagedType.UTF8TemplatedString: - case CustomUnmanagedType.TemplatedArray: - { - // templated_array must be pointer-aligned - long alignment = fieldPtr.ToInt64() % IntPtr.Size; - if (alignment != 0) - { - fieldPtr = new IntPtr(fieldPtr.ToInt64() + IntPtr.Size - alignment); - } - - templated_array arr = (templated_array)Marshal.PtrToStructure(fieldPtr, typeof(templated_array)); - if (field.FieldType == typeof(string)) - { - if (arr.elems == IntPtr.Zero) - field.SetValue(ret, ""); - else - field.SetValue(ret, PtrToStringUTF8(arr.elems, arr.count)); - } - else - { - var arrayType = NonArrayType(field.FieldType); - int sizeInBytes = SizeOf(arrayType); - - if (field.FieldType.IsArray && arrayType == typeof(byte)) - { - byte[] val = new byte[arr.count]; - if(val.Length > 0) - Marshal.Copy(arr.elems, val, 0, val.Length); - field.SetValue(ret, val); - } - else if (field.FieldType.IsArray) - { - Array val = Array.CreateInstance(arrayType, arr.count); - - for (int i = 0; i < val.Length; i++) - { - IntPtr p = new IntPtr((arr.elems.ToInt64() + i * sizeInBytes)); - - val.SetValue(PtrToStructure(p, arrayType, freeMem), i); - } - - field.SetValue(ret, val); - } - else - { - throw new NotImplementedException("non-array element marked to marshal as TemplatedArray"); - } - } - if(freeMem) - RENDERDOC_FreeArrayMem(arr.elems); - break; - } - default: - throw new NotImplementedException("Unexpected attribute"); - } - } - } - - MethodInfo postMarshal = structureType.GetMethod("PostMarshal", BindingFlags.NonPublic | BindingFlags.Instance); - if (postMarshal != null) - postMarshal.Invoke(ret, new object[] { }); - } - catch (Exception ex) - { - System.Diagnostics.Debug.Fail(ex.Message); - } - - return ret; - } - } -} \ No newline at end of file diff --git a/renderdocui/Interop/D3D11PipelineState.cs b/renderdocui/Interop/D3D11PipelineState.cs deleted file mode 100644 index 10686fa42..000000000 --- a/renderdocui/Interop/D3D11PipelineState.cs +++ /dev/null @@ -1,357 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Runtime.InteropServices; - -namespace renderdoc -{ - [StructLayout(LayoutKind.Sequential)] - public class D3D11PipelineState - { - [StructLayout(LayoutKind.Sequential)] - public class InputAssembler - { - private void PostMarshal() - { - if (_ptr_Bytecode != IntPtr.Zero) - { - Bytecode = (ShaderReflection)CustomMarshal.PtrToStructure(_ptr_Bytecode, typeof(ShaderReflection), false); - Bytecode.origPtr = _ptr_Bytecode; - } - else - { - Bytecode = null; - } - - _ptr_Bytecode = IntPtr.Zero; - } - - [StructLayout(LayoutKind.Sequential)] - public class LayoutInput - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string SemanticName; - public UInt32 SemanticIndex; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ResourceFormat Format; - public UInt32 InputSlot; - public UInt32 ByteOffset; - public bool PerInstance; - public UInt32 InstanceDataStepRate; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public LayoutInput[] layouts; - public ResourceId layout; - private IntPtr _ptr_Bytecode; - [CustomMarshalAs(CustomUnmanagedType.Skip)] - public ShaderReflection Bytecode; - public bool customName; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string LayoutName; - - [StructLayout(LayoutKind.Sequential)] - public class VertexBuffer - { - public ResourceId Buffer; - public UInt32 Stride; - public UInt32 Offset; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public VertexBuffer[] vbuffers; - - [StructLayout(LayoutKind.Sequential)] - public class IndexBuffer - { - public ResourceId Buffer; - public UInt32 Offset; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public IndexBuffer ibuffer; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public InputAssembler m_IA; - - [StructLayout(LayoutKind.Sequential)] - public class ShaderStage - { - private void PostMarshal() - { - if (_ptr_ShaderDetails != IntPtr.Zero) - { - ShaderDetails = (ShaderReflection)CustomMarshal.PtrToStructure(_ptr_ShaderDetails, typeof(ShaderReflection), false); - ShaderDetails.origPtr = _ptr_ShaderDetails; - } - else - { - ShaderDetails = null; - } - - _ptr_ShaderDetails = IntPtr.Zero; - } - - public ResourceId Shader; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string ShaderName; - public bool customName; - private IntPtr _ptr_ShaderDetails; - [CustomMarshalAs(CustomUnmanagedType.Skip)] - public ShaderReflection ShaderDetails; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderBindpointMapping BindpointMapping; - - public ShaderStageType stage; - - [StructLayout(LayoutKind.Sequential)] - public class ResourceView - { - public ResourceId View; - public ResourceId Resource; - public ShaderResourceType Type; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ResourceFormat Format; - - public bool Structured; - public UInt32 BufferStructCount; - public UInt32 ElementSize; - - // Buffer - public UInt32 FirstElement; - public UInt32 NumElements; - - // BufferEx - public D3DBufferViewFlags Flags; - - // Texture - public UInt32 HighestMip; - public UInt32 NumMipLevels; - - // Texture Array - public UInt32 ArraySize; - public UInt32 FirstArraySlice; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ResourceView[] SRVs; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ResourceView[] UAVs; - - [StructLayout(LayoutKind.Sequential)] - public class Sampler - { - public ResourceId Samp; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string SamplerName; - public bool customSamplerName; - - public AddressMode AddressU, AddressV, AddressW; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public float[] BorderColor; - public CompareFunc Comparison; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public TextureFilter Filter; - public UInt32 MaxAniso; - public float MaxLOD; - public float MinLOD; - public float MipLODBias; - - public bool UseBorder() - { - return AddressU == AddressMode.ClampBorder || - AddressV == AddressMode.ClampBorder || - AddressW == AddressMode.ClampBorder; - } - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Sampler[] Samplers; - - [StructLayout(LayoutKind.Sequential)] - public class CBuffer - { - public ResourceId Buffer; - public UInt32 VecOffset; - public UInt32 VecCount; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public CBuffer[] ConstantBuffers; - - [StructLayout(LayoutKind.Sequential)] - public class ClassInstance - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - string name; - }; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ClassInstance[] ClassInstances; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderStage m_VS, m_HS, m_DS, m_GS, m_PS, m_CS; - - [StructLayout(LayoutKind.Sequential)] - public class Streamout - { - [StructLayout(LayoutKind.Sequential)] - public class Output - { - public ResourceId Buffer; - public UInt32 Offset; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Output[] Outputs; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Streamout m_SO; - - [StructLayout(LayoutKind.Sequential)] - public class Rasterizer - { - [StructLayout(LayoutKind.Sequential)] - public class Viewport - { - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 2)] - public float[] TopLeft; - public float Width, Height; - public float MinDepth, MaxDepth; - public bool Enabled; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Viewport[] Viewports; - - [StructLayout(LayoutKind.Sequential)] - public class Scissor - { - public Int32 left, top, right, bottom; - public bool Enabled; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Scissor[] Scissors; - - [StructLayout(LayoutKind.Sequential)] - public class RasterizerState - { - public ResourceId State; - public TriangleFillMode FillMode; - public TriangleCullMode CullMode; - public bool FrontCCW; - public Int32 DepthBias; - public float DepthBiasClamp; - public float SlopeScaledDepthBias; - public bool DepthClip; - public bool ScissorEnable; - public bool MultisampleEnable; - public bool AntialiasedLineEnable; - public UInt32 ForcedSampleCount; - public bool ConservativeRasterization; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public RasterizerState m_State; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Rasterizer m_RS; - - [StructLayout(LayoutKind.Sequential)] - public class OutputMerger - { - [StructLayout(LayoutKind.Sequential)] - public class DepthStencilState - { - public ResourceId State; - public bool DepthEnable; - public CompareFunc DepthFunc; - public bool DepthWrites; - public bool StencilEnable; - public byte StencilReadMask; - public byte StencilWriteMask; - - [StructLayout(LayoutKind.Sequential)] - public class StencilFace - { - public StencilOp FailOp; - public StencilOp DepthFailOp; - public StencilOp PassOp; - public CompareFunc Func; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public StencilFace m_FrontFace, m_BackFace; - - public UInt32 StencilRef; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public DepthStencilState m_State; - - [StructLayout(LayoutKind.Sequential)] - public class BlendState - { - public ResourceId State; - - public bool AlphaToCoverage; - public bool IndependentBlend; - - [StructLayout(LayoutKind.Sequential)] - public class RTBlend - { - [StructLayout(LayoutKind.Sequential)] - public class BlendEquation - { - public BlendMultiplier Source; - public BlendMultiplier Destination; - public BlendOp Operation; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public BlendEquation m_Blend, m_AlphaBlend; - - public LogicOp Logic; - - public bool Enabled; - public bool LogicEnabled; - public byte WriteMask; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public RTBlend[] Blends; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public float[] BlendFactor; - public UInt32 SampleMask; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public BlendState m_BlendState; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderStage.ResourceView[] RenderTargets; - - public UInt32 UAVStartSlot; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderStage.ResourceView[] UAVs; - - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderStage.ResourceView DepthTarget; - public bool DepthReadOnly; - public bool StencilReadOnly; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public OutputMerger m_OM; - }; -} diff --git a/renderdocui/Interop/D3D12PipelineState.cs b/renderdocui/Interop/D3D12PipelineState.cs deleted file mode 100644 index 6f58848b9..000000000 --- a/renderdocui/Interop/D3D12PipelineState.cs +++ /dev/null @@ -1,381 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Runtime.InteropServices; -using System.Collections.Generic; - -namespace renderdoc -{ - [StructLayout(LayoutKind.Sequential)] - public class D3D12PipelineState - { - public ResourceId pipeline; - public bool customName; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string PipelineName; - - public ResourceId rootSig; - - [StructLayout(LayoutKind.Sequential)] - public class InputAssembler - { - [StructLayout(LayoutKind.Sequential)] - public class LayoutInput - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string SemanticName; - public UInt32 SemanticIndex; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ResourceFormat Format; - public UInt32 InputSlot; - public UInt32 ByteOffset; - public bool PerInstance; - public UInt32 InstanceDataStepRate; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public LayoutInput[] layouts; - - [StructLayout(LayoutKind.Sequential)] - public class VertexBuffer - { - public ResourceId Buffer; - public UInt64 Offset; - public UInt32 Size; - public UInt32 Stride; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public VertexBuffer[] vbuffers; - - [StructLayout(LayoutKind.Sequential)] - public class IndexBuffer - { - public ResourceId Buffer; - public UInt64 Offset; - public UInt32 Size; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public IndexBuffer ibuffer; - - public UInt32 indexStripCutValue; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public InputAssembler m_IA; - - [StructLayout(LayoutKind.Sequential)] - public class ResourceView - { - public bool Immediate; - public UInt32 RootElement; - public UInt32 TableIndex; - - public ResourceId Resource; - public ShaderResourceType Type; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ResourceFormat Format; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public TextureSwizzle[] swizzle; - - public D3DBufferViewFlags BufferFlags; - public UInt32 BufferStructCount; - public UInt32 ElementSize; - public UInt64 FirstElement; - public UInt32 NumElements; - - public ResourceId CounterResource; - public UInt64 CounterByteOffset; - - // Texture - public UInt32 HighestMip; - public UInt32 NumMipLevels; - - // Texture Array - public UInt32 ArraySize; - public UInt32 FirstArraySlice; - - public float MinLODClamp; - }; - - [StructLayout(LayoutKind.Sequential)] - public class Sampler - { - public bool Immediate; - public UInt32 RootElement; - public UInt32 TableIndex; - - public AddressMode AddressU, AddressV, AddressW; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public float[] BorderColor; - public CompareFunc Comparison; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public TextureFilter Filter; - public UInt32 MaxAniso; - public float MaxLOD; - public float MinLOD; - public float MipLODBias; - - public bool UseBorder() - { - return AddressU == AddressMode.ClampBorder || - AddressV == AddressMode.ClampBorder || - AddressW == AddressMode.ClampBorder; - } - }; - - [StructLayout(LayoutKind.Sequential)] - public class CBuffer - { - public bool Immediate; - public UInt32 RootElement; - public UInt32 TableIndex; - - public ResourceId Buffer; - public UInt64 Offset; - public UInt32 ByteSize; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] RootValues; - }; - - [StructLayout(LayoutKind.Sequential)] - public class ShaderStage - { - private void PostMarshal() - { - if (_ptr_ShaderDetails != IntPtr.Zero) - { - ShaderDetails = (ShaderReflection)CustomMarshal.PtrToStructure(_ptr_ShaderDetails, typeof(ShaderReflection), false); - ShaderDetails.origPtr = _ptr_ShaderDetails; - } - else - { - ShaderDetails = null; - } - - _ptr_ShaderDetails = IntPtr.Zero; - } - - public ResourceId Shader; - private IntPtr _ptr_ShaderDetails; - [CustomMarshalAs(CustomUnmanagedType.Skip)] - public ShaderReflection ShaderDetails; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderBindpointMapping BindpointMapping; - - public ShaderStageType stage; - - [StructLayout(LayoutKind.Sequential)] - public class RegisterSpace - { - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public CBuffer[] ConstantBuffers; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Sampler[] Samplers; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ResourceView[] SRVs; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ResourceView[] UAVs; - }; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public RegisterSpace[] Spaces; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderStage m_VS, m_HS, m_DS, m_GS, m_PS, m_CS; - - [StructLayout(LayoutKind.Sequential)] - public class Streamout - { - [StructLayout(LayoutKind.Sequential)] - public class Output - { - public ResourceId Buffer; - public UInt64 Offset; - public UInt64 Size; - - public ResourceId WrittenCountBuffer; - public UInt64 WrittenCountOffset; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Output[] Outputs; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Streamout m_SO; - - [StructLayout(LayoutKind.Sequential)] - public class Rasterizer - { - public UInt32 SampleMask; - - [StructLayout(LayoutKind.Sequential)] - public class Viewport - { - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 2)] - public float[] TopLeft; - public float Width, Height; - public float MinDepth, MaxDepth; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Viewport[] Viewports; - - [StructLayout(LayoutKind.Sequential)] - public class Scissor - { - public Int32 left, top, right, bottom; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Scissor[] Scissors; - - [StructLayout(LayoutKind.Sequential)] - public class RasterizerState - { - public TriangleFillMode FillMode; - public TriangleCullMode CullMode; - public bool FrontCCW; - public Int32 DepthBias; - public float DepthBiasClamp; - public float SlopeScaledDepthBias; - public bool DepthClip; - public bool MultisampleEnable; - public bool AntialiasedLineEnable; - public UInt32 ForcedSampleCount; - public bool ConservativeRasterization; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public RasterizerState m_State; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Rasterizer m_RS; - - [StructLayout(LayoutKind.Sequential)] - public class OutputMerger - { - [StructLayout(LayoutKind.Sequential)] - public class DepthStencilState - { - public bool DepthEnable; - public bool DepthWrites; - public CompareFunc DepthFunc; - public bool StencilEnable; - public byte StencilReadMask; - public byte StencilWriteMask; - - [StructLayout(LayoutKind.Sequential)] - public class StencilFace - { - public StencilOp FailOp; - public StencilOp DepthFailOp; - public StencilOp PassOp; - public CompareFunc Func; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public StencilFace m_FrontFace, m_BackFace; - - public UInt32 StencilRef; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public DepthStencilState m_State; - - [StructLayout(LayoutKind.Sequential)] - public class BlendState - { - public bool AlphaToCoverage; - public bool IndependentBlend; - - [StructLayout(LayoutKind.Sequential)] - public class RTBlend - { - [StructLayout(LayoutKind.Sequential)] - public class BlendEquation - { - public BlendMultiplier Source; - public BlendMultiplier Destination; - public BlendOp Operation; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public BlendEquation m_Blend, m_AlphaBlend; - - public LogicOp Logic; - - public bool Enabled; - public bool LogicEnabled; - public byte WriteMask; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public RTBlend[] Blends; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public float[] BlendFactor; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public BlendState m_BlendState; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ResourceView[] RenderTargets; - - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ResourceView DepthTarget; - public bool DepthReadOnly; - public bool StencilReadOnly; - - public UInt32 multiSampleCount; - public UInt32 multiSampleQuality; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public OutputMerger m_OM; - - [StructLayout(LayoutKind.Sequential)] - public class ResourceData - { - public ResourceId id; - - [StructLayout(LayoutKind.Sequential)] - public class ResourceState - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string name; - }; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ResourceState[] states; - }; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - private ResourceData[] Resources_; - - // add to dictionary for convenience - private void PostMarshal() - { - Resources = new Dictionary(); - - foreach (ResourceData i in Resources_) - Resources.Add(i.id, i); - } - - [CustomMarshalAs(CustomUnmanagedType.Skip)] - public Dictionary Resources; - }; -} diff --git a/renderdocui/Interop/Enums.cs b/renderdocui/Interop/Enums.cs deleted file mode 100644 index f8334d0fd..000000000 --- a/renderdocui/Interop/Enums.cs +++ /dev/null @@ -1,1052 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Runtime.InteropServices; - -// from replay_enums.h - -namespace renderdoc -{ - [Flags] - public enum DirectoryFileProperty - { - Directory = 0x1, - Hidden = 0x2, - Executable = 0x4, - - ErrorUnknown = 0x2000, - ErrorAccessDenied = 0x4000, - ErrorInvalidPath = 0x8000, - }; - - public enum VarType - { - Float = 0, - Int, - UInt, - Double, - }; - - public enum FormatComponentType - { - None = 0, - Float, - UNorm, - SNorm, - UInt, - SInt, - UScaled, - SScaled, - Depth, - Double, - }; - - public enum TextureSwizzle - { - Red, - Green, - Blue, - Alpha, - Zero, - One, - }; - - public enum AddressMode - { - Wrap, - Mirror, - MirrorOnce, - ClampEdge, - ClampBorder, - }; - - public enum ShaderResourceType - { - None, - Buffer, - Texture1D, - Texture1DArray, - Texture2D, - TextureRect, - Texture2DArray, - Texture2DMS, - Texture2DMSArray, - Texture3D, - TextureCube, - TextureCubeArray, - }; - - public enum ShaderBindType - { - Unknown = 0, - ConstantBuffer, - Sampler, - ImageSampler, - ReadOnlyImage, - ReadWriteImage, - ReadOnlyTBuffer, - ReadWriteTBuffer, - ReadOnlyBuffer, - ReadWriteBuffer, - InputAttachment, - }; - - public enum SystemAttribute - { - None = 0, - Position, - PointSize, - ClipDistance, - CullDistance, - RTIndex, - ViewportIndex, - VertexIndex, - PrimitiveIndex, - InstanceIndex, - DispatchSize, - DispatchThreadIndex, - GroupIndex, - GroupFlatIndex, - GroupThreadIndex, - GSInstanceIndex, - OutputControlPointIndex, - DomainLocation, - IsFrontFace, - MSAACoverage, - MSAASamplePosition, - MSAASampleIndex, - PatchNumVertices, - OuterTessFactor, - InsideTessFactor, - ColourOutput, - DepthOutput, - DepthOutputGreaterEqual, - DepthOutputLessEqual, - }; - - // replay_render.h - - public enum OutputType - { - None = 0, - TexDisplay, - MeshDisplay, - }; - - public enum MeshDataStage - { - Unknown = 0, - VSIn, - VSOut, - GSOut, - }; - - public enum TextureDisplayOverlay - { - None = 0, - Drawcall, - Wireframe, - Depth, - Stencil, - BackfaceCull, - ViewportScissor, - NaN, - Clipping, - ClearBeforePass, - ClearBeforeDraw, - QuadOverdrawPass, - QuadOverdrawDraw, - TriangleSizePass, - TriangleSizeDraw, - }; - - public enum FileType - { - DDS, - PNG, - JPG, - BMP, - TGA, - HDR, - EXR, - }; - - public enum AlphaMapping - { - Discard, - BlendToColour, - BlendToCheckerboard, - Preserve, - }; - - public enum SpecialFormat - { - Unknown = 0, - BC1, - BC2, - BC3, - BC4, - BC5, - BC6, - BC7, - ETC2, - EAC, - ASTC, - R10G10B10A2, - R11G11B10, - R5G6B5, - R5G5B5A1, - R9G9B9E5, - R4G4B4A4, - R4G4, - D16S8, - D24S8, - D32S8, - S8, - YUV, - }; - - public enum QualityHint - { - DontCare, - Nicest, - Fastest, - }; - - public enum GraphicsAPI - { - D3D11, - D3D12, - OpenGL, - Vulkan, - }; - - public enum PrimitiveTopology - { - Unknown, - PointList, - LineList, - LineStrip, - LineLoop, - TriangleList, - TriangleStrip, - TriangleFan, - LineList_Adj, - LineStrip_Adj, - TriangleList_Adj, - TriangleStrip_Adj, - PatchList, - PatchList_1CPs = PatchList, - PatchList_2CPs, - PatchList_3CPs, - PatchList_4CPs, - PatchList_5CPs, - PatchList_6CPs, - PatchList_7CPs, - PatchList_8CPs, - PatchList_9CPs, - PatchList_10CPs, - PatchList_11CPs, - PatchList_12CPs, - PatchList_13CPs, - PatchList_14CPs, - PatchList_15CPs, - PatchList_16CPs, - PatchList_17CPs, - PatchList_18CPs, - PatchList_19CPs, - PatchList_20CPs, - PatchList_21CPs, - PatchList_22CPs, - PatchList_23CPs, - PatchList_24CPs, - PatchList_25CPs, - PatchList_26CPs, - PatchList_27CPs, - PatchList_28CPs, - PatchList_29CPs, - PatchList_30CPs, - PatchList_31CPs, - PatchList_32CPs, - }; - - [Flags] - public enum BufferCreationFlags - { - VB = 0x1, - IB = 0x2, - CB = 0x4, - UAV = 0x8, - Indirect = 0x10, - }; - - [Flags] - public enum TextureCreationFlags - { - SRV = 0x1, - RTV = 0x2, - DSV = 0x4, - UAV = 0x8, - SwapBuffer = 0x10, - }; - - [Flags] - public enum D3DBufferViewFlags - { - Raw = 0x1, - Append = 0x2, - Counter = 0x4, - }; - - public enum ShaderStageType - { - Vertex = 0, - First = Vertex, - - Hull, - Tess_Control = Hull, - - Domain, - Tess_Eval = Domain, - - Geometry, - - Pixel, - Fragment = Pixel, - - Compute, - - Count, - }; - - [Flags] - public enum ShaderStageBits - { - None = 0, - Vertex = (1 << ShaderStageType.Vertex), - Hull = (1 << ShaderStageType.Hull), - Tess_Control = (1 << ShaderStageType.Tess_Control), - Domain = (1 << ShaderStageType.Domain), - Tess_Eval = (1 << ShaderStageType.Tess_Eval), - Geometry = (1 << ShaderStageType.Geometry), - Pixel = (1 << ShaderStageType.Pixel), - Fragment = (1 << ShaderStageType.Fragment), - Compute = (1 << ShaderStageType.Compute), - All = (Vertex | Hull | Domain | Geometry | Pixel | Fragment | Compute), - }; - - [Flags] - public enum ShaderDebugStateFlags - { - SampleLoadGather = 0x1, - GeneratedNanOrInf = 0x2, - }; - - public enum DebugMessageSource - { - API = 0, - RedundantAPIUse, - IncorrectAPIUse, - GeneralPerformance, - GCNPerformance, - RuntimeWarning, - UnsupportedConfiguration, - }; - - public enum DebugMessageCategory - { - Defined = 0, - Miscellaneous, - Initialization, - Cleanup, - Compilation, - Creation, - Setting, - Getting, - Manipulation, - Execution, - Shaders, - Deprecated, - Undefined, - Portability, - Performance, - }; - - public enum DebugMessageSeverity - { - High = 0, - Medium, - Low, - Info, - }; - - public enum ResourceUsage - { - None, - - VertexBuffer, - IndexBuffer, - - VS_Constants, - HS_Constants, - DS_Constants, - GS_Constants, - PS_Constants, - CS_Constants, - All_Constants, - - SO, - - VS_Resource, - HS_Resource, - DS_Resource, - GS_Resource, - PS_Resource, - CS_Resource, - All_Resource, - - VS_RWResource, - HS_RWResource, - DS_RWResource, - GS_RWResource, - PS_RWResource, - CS_RWResource, - All_RWResource, - - InputTarget, - ColourTarget, - DepthStencilTarget, - - Indirect, - - Clear, - - GenMips, - Resolve, - ResolveSrc, - ResolveDst, - Copy, - CopySrc, - CopyDst, - - Barrier, - }; - - [Flags] - public enum DrawcallFlags - { - // types - Clear = 0x0001, - Drawcall = 0x0002, - Dispatch = 0x0004, - CmdList = 0x0008, - SetMarker = 0x0010, - PushMarker = 0x0020, - PopMarker = 0x0040, // this is only for internal tracking use - Present = 0x0080, - MultiDraw = 0x0100, - Copy = 0x0200, - Resolve = 0x0400, - GenMips = 0x0800, - PassBoundary = 0x1000, - - // flags - UseIBuffer = 0x010000, - Instanced = 0x020000, - Auto = 0x040000, - Indirect = 0x080000, - ClearColour = 0x100000, - ClearDepthStencil = 0x200000, - BeginPass = 0x400000, - EndPass = 0x800000, - APICalls = 0x1000000, - }; - - public enum SolidShadeMode - { - None = 0, - Solid, - Lit, - Secondary, - }; - - public enum TriangleFillMode - { - Solid = 0, - Wireframe, - Point - }; - - public enum TriangleCullMode - { - None = 0, - Front, - Back, - FrontAndBack, - }; - - public enum FilterMode - { - NoFilter, - Point, - Linear, - Cubic, - Anisotropic, - }; - - public enum FilterFunc - { - Normal, - Comparison, - Minimum, - Maximum, - }; - - public enum CompareFunc - { - Never, - AlwaysTrue, - Less, - LessEqual, - Greater, - GreaterEqual, - Equal, - NotEqual, - }; - - public enum StencilOp - { - Keep, - Zero, - Replace, - IncSat, - DecSat, - IncWrap, - DecWrap, - Invert, - }; - - public enum BlendMultiplier - { - Zero, - One, - SrcCol, - InvSrcCol, - DstCol, - InvDstCol, - SrcAlpha, - InvSrcAlpha, - DstAlpha, - InvDstAlpha, - SrcAlphaSat, - FactorRGB, - InvFactorRGB, - FactorAlpha, - InvFactorAlpha, - Src1Col, - InvSrc1Col, - Src1Alpha, - InvSrc1Alpha, - }; - - public enum BlendOp - { - Add, - Subtract, - ReversedSubtract, - Minimum, - Maximum, - }; - - public enum LogicOp - { - NoOp, - Clear, - Set, - Copy, - CopyInverted, - Invert, - And, - Nand, - Or, - Xor, - Nor, - Equivalent, - AndReverse, - AndInverted, - OrReverse, - OrInverted, - }; - - public enum GPUCounters : uint - { - FirstGeneric = 1, - EventGPUDuration = FirstGeneric, - InputVerticesRead, - IAPrimitives, - GSPrimitives, - RasterizerInvocations, - RasterizedPrimitives, - SamplesWritten, - VSInvocations, - HSInvocations, - DSInvocations, - TESInvocations = DSInvocations, - GSInvocations, - PSInvocations, - CSInvocations, - - FirstAMD = 1000000, - - FirstIntel = 2000000, - - FirstNvidia = 3000000, - }; - - public enum CounterUnits - { - Absolute, - Seconds, - Percentage, - }; - - public enum ReplaySupport - { - Unsupported, - Supported, - SuggestRemote, - }; - - public enum ReplayCreateStatus - { - Success = 0, - UnknownError, - InternalError, - FileNotFound, - InjectionFailed, - IncompatibleProcess, - NetworkIOFailed, - NetworkRemoteBusy, - NetworkVersionMismatch, - FileIOFailed, - FileIncompatibleVersion, - FileCorrupted, - ImageUnsupported, - APIUnsupported, - APIInitFailed, - APIIncompatibleVersion, - APIHardwareUnsupported, - }; - - public enum TargetControlMessageType - { - Unknown = 0, - Disconnected, - Busy, - Noop, - NewCapture, - CaptureCopied, - RegisterAPI, - NewChild, - }; - - public enum EnvironmentModificationType - { - Set, - Append, - Prepend, - }; - - public enum EnvironmentSeparator - { - Platform, - SemiColon, - Colon, - None, - }; - - public static class EnumString - { - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern UInt32 RENDERDOC_VertexOffset(PrimitiveTopology topology, UInt32 prim); - - public static UInt32 GetVertexOffset(this PrimitiveTopology topology, UInt32 primitiveIndex) - { - return RENDERDOC_VertexOffset(topology, primitiveIndex); - } - - public static bool IsD3D(this GraphicsAPI apitype) - { - return (apitype == GraphicsAPI.D3D11 || apitype == GraphicsAPI.D3D12); - } - - public static string Str(this DebugMessageSource source) - { - switch (source) - { - case DebugMessageSource.API: return "API's debug messages"; - case DebugMessageSource.RedundantAPIUse: return "Redundant use of API"; - case DebugMessageSource.IncorrectAPIUse: return "Incorrect use of API"; - case DebugMessageSource.GeneralPerformance: return "General Performance issues"; - case DebugMessageSource.GCNPerformance: return "GCN (AMD) Performance issues"; - case DebugMessageSource.RuntimeWarning: return "Issues raised while debugging"; - case DebugMessageSource.UnsupportedConfiguration: return "Unsupported Software or Hardware Configuration"; - } - - return "Unknown Source"; - } - - public static string Str(this VarType type) - { - switch (type) - { - case VarType.Double: return "double"; - case VarType.Float: return "float"; - case VarType.Int: return "int"; - case VarType.UInt: return "uint"; - } - - return "Unknown Type"; - } - - public static string Str(this TextureSwizzle swiz) - { - switch (swiz) - { - case TextureSwizzle.Red: return "R"; - case TextureSwizzle.Green: return "G"; - case TextureSwizzle.Blue: return "B"; - case TextureSwizzle.Alpha: return "A"; - case TextureSwizzle.Zero: return "0"; - case TextureSwizzle.One: return "1"; - } - - return "Unknown"; - } - - public static string Str(this ReplayCreateStatus status) - { - switch (status) - { - case ReplayCreateStatus.Success: return "Success"; - case ReplayCreateStatus.UnknownError: return "Unknown Error"; - case ReplayCreateStatus.InternalError: return "Internal Error"; - case ReplayCreateStatus.FileNotFound: return "File not found"; - case ReplayCreateStatus.InjectionFailed: return "RenderDoc injection failed"; - case ReplayCreateStatus.IncompatibleProcess: return "Process is incompatible (likely 64-bit/32-bit issue)"; - case ReplayCreateStatus.NetworkIOFailed: return "Network I/O operation failed"; - case ReplayCreateStatus.NetworkRemoteBusy: return "Remote side of network connection is busy"; - case ReplayCreateStatus.NetworkVersionMismatch: return "Version mismatch between network clients"; - case ReplayCreateStatus.FileIOFailed: return "File I/O operation failed"; - case ReplayCreateStatus.FileIncompatibleVersion: return "File is of an incompatible version"; - case ReplayCreateStatus.FileCorrupted: return "File is corrupted or unrecognisable format"; - case ReplayCreateStatus.ImageUnsupported: return "The contents or format of the image is not supported"; - case ReplayCreateStatus.APIUnsupported: return "API used is not supported"; - case ReplayCreateStatus.APIInitFailed: return "Replay API failed to initialise"; - case ReplayCreateStatus.APIIncompatibleVersion: return "API-specific data used is of an incompatible version"; - case ReplayCreateStatus.APIHardwareUnsupported: return "Your hardware or software configuration doesn't meet this API's minimum requirements"; - } - - return "Unknown Error Code"; - } - - public static string Str(this PrimitiveTopology topo) - { - switch (topo) - { - case PrimitiveTopology.Unknown: return "Unknown"; - case PrimitiveTopology.PointList: return "Point List"; - case PrimitiveTopology.LineList: return "Line List"; - case PrimitiveTopology.LineStrip: return "Line Strip"; - case PrimitiveTopology.LineLoop: return "Line Loop"; - case PrimitiveTopology.TriangleList: return "Triangle List"; - case PrimitiveTopology.TriangleStrip: return "Triangle Strip"; - case PrimitiveTopology.TriangleFan: return "Triangle Fan"; - case PrimitiveTopology.LineList_Adj: return "Line List with Adjacency"; - case PrimitiveTopology.LineStrip_Adj: return "Line Strip with Adjacency"; - case PrimitiveTopology.TriangleList_Adj: return "Triangle List with Adjacency"; - case PrimitiveTopology.TriangleStrip_Adj: return "Triangle Strip with Adjacency"; - default: break; - } - - if (topo >= PrimitiveTopology.PatchList) - return String.Format("Patch List {0} Control Points", (int)topo - (int)PrimitiveTopology.PatchList_1CPs + 1); - - return "Unknown"; - } - - public static string Str(this ShaderResourceType type) - { - switch (type) - { - case ShaderResourceType.None: return "None"; - case ShaderResourceType.Buffer: return "Buffer"; - case ShaderResourceType.Texture1D: return "1D"; - case ShaderResourceType.Texture1DArray: return "1D Array"; - case ShaderResourceType.Texture2D: return "2D"; - case ShaderResourceType.TextureRect: return "Rect"; - case ShaderResourceType.Texture2DArray: return "2D Array"; - case ShaderResourceType.Texture2DMS: return "2D MS"; - case ShaderResourceType.Texture2DMSArray: return "2D MS Array"; - case ShaderResourceType.Texture3D: return "3D"; - case ShaderResourceType.TextureCube: return "Cube"; - case ShaderResourceType.TextureCubeArray: return "Cube Array"; - } - - return "Unknown resource type"; - } - - public static string Str(this ResourceUsage usage, GraphicsAPI apitype) - { - if (apitype.IsD3D()) - { - switch (usage) - { - case ResourceUsage.VertexBuffer: return "Vertex Buffer"; - case ResourceUsage.IndexBuffer: return "Index Buffer"; - - case ResourceUsage.VS_Constants: return "VS - Constant Buffer"; - case ResourceUsage.GS_Constants: return "GS - Constant Buffer"; - case ResourceUsage.HS_Constants: return "HS - Constant Buffer"; - case ResourceUsage.DS_Constants: return "DS - Constant Buffer"; - case ResourceUsage.CS_Constants: return "CS - Constant Buffer"; - case ResourceUsage.PS_Constants: return "PS - Constant Buffer"; - case ResourceUsage.All_Constants: return "All - Constant Buffer"; - - case ResourceUsage.SO: return "Stream Out"; - - case ResourceUsage.VS_Resource: return "VS - Resource"; - case ResourceUsage.GS_Resource: return "GS - Resource"; - case ResourceUsage.HS_Resource: return "HS - Resource"; - case ResourceUsage.DS_Resource: return "DS - Resource"; - case ResourceUsage.CS_Resource: return "CS - Resource"; - case ResourceUsage.PS_Resource: return "PS - Resource"; - case ResourceUsage.All_Resource: return "All - Resource"; - - case ResourceUsage.VS_RWResource: return "VS - UAV"; - case ResourceUsage.HS_RWResource: return "HS - UAV"; - case ResourceUsage.DS_RWResource: return "DS - UAV"; - case ResourceUsage.GS_RWResource: return "GS - UAV"; - case ResourceUsage.PS_RWResource: return "PS - UAV"; - case ResourceUsage.CS_RWResource: return "CS - UAV"; - case ResourceUsage.All_RWResource: return "All - UAV"; - - case ResourceUsage.InputTarget: return "Colour Input"; - case ResourceUsage.ColourTarget: return "Rendertarget"; - case ResourceUsage.DepthStencilTarget: return "Depthstencil"; - - case ResourceUsage.Indirect: return "Indirect argument"; - - case ResourceUsage.Clear: return "Clear"; - - case ResourceUsage.GenMips: return "Generate Mips"; - case ResourceUsage.Resolve: return "Resolve"; - case ResourceUsage.ResolveSrc: return "Resolve - Source"; - case ResourceUsage.ResolveDst: return "Resolve - Dest"; - case ResourceUsage.Copy: return "Copy"; - case ResourceUsage.CopySrc: return "Copy - Source"; - case ResourceUsage.CopyDst: return "Copy - Dest"; - - case ResourceUsage.Barrier: return "Barrier"; - } - } - else if (apitype == GraphicsAPI.OpenGL || apitype == GraphicsAPI.Vulkan) - { - bool vk = (apitype == GraphicsAPI.Vulkan); - - switch (usage) - { - case ResourceUsage.VertexBuffer: return "Vertex Buffer"; - case ResourceUsage.IndexBuffer: return "Index Buffer"; - - case ResourceUsage.VS_Constants: return "VS - Uniform Buffer"; - case ResourceUsage.GS_Constants: return "GS - Uniform Buffer"; - case ResourceUsage.HS_Constants: return "HS - Uniform Buffer"; - case ResourceUsage.DS_Constants: return "DS - Uniform Buffer"; - case ResourceUsage.CS_Constants: return "CS - Uniform Buffer"; - case ResourceUsage.PS_Constants: return "PS - Uniform Buffer"; - case ResourceUsage.All_Constants: return "All - Uniform Buffer"; - - case ResourceUsage.SO: return "Transform Feedback"; - - case ResourceUsage.VS_Resource: return "VS - Texture"; - case ResourceUsage.GS_Resource: return "GS - Texture"; - case ResourceUsage.HS_Resource: return "HS - Texture"; - case ResourceUsage.DS_Resource: return "DS - Texture"; - case ResourceUsage.CS_Resource: return "CS - Texture"; - case ResourceUsage.PS_Resource: return "PS - Texture"; - case ResourceUsage.All_Resource: return "All - Texture"; - - case ResourceUsage.VS_RWResource: return "VS - Image/SSBO"; - case ResourceUsage.HS_RWResource: return "HS - Image/SSBO"; - case ResourceUsage.DS_RWResource: return "DS - Image/SSBO"; - case ResourceUsage.GS_RWResource: return "GS - Image/SSBO"; - case ResourceUsage.PS_RWResource: return "PS - Image/SSBO"; - case ResourceUsage.CS_RWResource: return "CS - Image/SSBO"; - case ResourceUsage.All_RWResource: return "All - Image/SSBO"; - - case ResourceUsage.InputTarget: return "FBO Input"; - case ResourceUsage.ColourTarget: return "FBO Colour"; - case ResourceUsage.DepthStencilTarget: return "FBO Depthstencil"; - - case ResourceUsage.Indirect: return "Indirect argument"; - - case ResourceUsage.Clear: return "Clear"; - - case ResourceUsage.GenMips: return "Generate Mips"; - case ResourceUsage.Resolve: return vk ? "Resolve" : "Framebuffer blit"; - case ResourceUsage.ResolveSrc: return vk ? "Resolve - Source" : "Framebuffer blit - Source"; - case ResourceUsage.ResolveDst: return vk ? "Resolve - Dest" : "Framebuffer blit - Dest"; - case ResourceUsage.Copy: return "Copy"; - case ResourceUsage.CopySrc: return "Copy - Source"; - case ResourceUsage.CopyDst: return "Copy - Dest"; - - case ResourceUsage.Barrier: return "Barrier"; - } - } - - return "Unknown Usage String"; - } - - public static string Str(this ShaderStageType stage, GraphicsAPI apitype) - { - if (apitype.IsD3D()) - { - switch (stage) - { - case ShaderStageType.Vertex: return "Vertex"; - case ShaderStageType.Hull: return "Hull"; - case ShaderStageType.Domain: return "Domain"; - case ShaderStageType.Geometry: return "Geometry"; - case ShaderStageType.Pixel: return "Pixel"; - case ShaderStageType.Compute: return "Compute"; - } - } - else if (apitype == GraphicsAPI.OpenGL || apitype == GraphicsAPI.Vulkan) - { - switch (stage) - { - case ShaderStageType.Vertex: return "Vertex"; - case ShaderStageType.Tess_Control: return "Tess. Control"; - case ShaderStageType.Tess_Eval: return "Tess. Eval"; - case ShaderStageType.Geometry: return "Geometry"; - case ShaderStageType.Fragment: return "Fragment"; - case ShaderStageType.Compute: return "Compute"; - } - } - - return stage.ToString(); - } - - public static string Str(this SystemAttribute systemValue) - { - switch (systemValue) - { - case SystemAttribute.None: return ""; - case SystemAttribute.Position: return "SV_Position"; - case SystemAttribute.ClipDistance: return "SV_ClipDistance"; - case SystemAttribute.CullDistance: return "SV_CullDistance"; - case SystemAttribute.RTIndex: return "SV_RenderTargetIndex"; - case SystemAttribute.ViewportIndex: return "SV_ViewportIndex"; - case SystemAttribute.VertexIndex: return "SV_VertexID"; - case SystemAttribute.PrimitiveIndex: return "SV_PrimitiveID"; - case SystemAttribute.InstanceIndex: return "SV_InstanceID"; - case SystemAttribute.DispatchThreadIndex: return "SV_DispatchThreadID"; - case SystemAttribute.GroupIndex: return "SV_GroupID"; - case SystemAttribute.GroupFlatIndex: return "SV_GroupIndex"; - case SystemAttribute.GroupThreadIndex: return "SV_GroupThreadID"; - case SystemAttribute.GSInstanceIndex: return "SV_GSInstanceID"; - case SystemAttribute.OutputControlPointIndex: return "SV_OutputControlPointID"; - case SystemAttribute.DomainLocation: return "SV_DomainLocation"; - case SystemAttribute.IsFrontFace: return "SV_IsFrontFace"; - case SystemAttribute.MSAACoverage: return "SV_Coverage"; - case SystemAttribute.MSAASampleIndex: return "SV_SampleIndex"; - case SystemAttribute.OuterTessFactor: return "SV_TessFactor"; - case SystemAttribute.InsideTessFactor: return "SV_InsideTessFactor"; - case SystemAttribute.ColourOutput: return "SV_Target"; - case SystemAttribute.DepthOutput: return "SV_Depth"; - case SystemAttribute.DepthOutputGreaterEqual: return "SV_DepthGreaterEqual"; - case SystemAttribute.DepthOutputLessEqual: return "SV_DepthLessEqual"; - } - - return "SV_Unknown"; - } - - public static string Str(this ShaderBindType bindType) - { - switch (bindType) - { - case ShaderBindType.ConstantBuffer: return "Constants"; - case ShaderBindType.Sampler: return "Sampler"; - case ShaderBindType.ImageSampler: return "Image&Sampler"; - case ShaderBindType.ReadOnlyImage: return "Image"; - case ShaderBindType.ReadWriteImage: return "RW Image"; - case ShaderBindType.ReadOnlyTBuffer: return "TBuffer"; - case ShaderBindType.ReadWriteTBuffer: return "RW TBuffer"; - case ShaderBindType.ReadOnlyBuffer: return "Buffer"; - case ShaderBindType.ReadWriteBuffer: return "RW Buffer"; - case ShaderBindType.InputAttachment: return "Input"; - default: break; - } - - return "Unknown"; - } - - public static string Str(this FormatComponentType compType) - { - switch (compType) - { - case FormatComponentType.None: return "Typeless"; - case FormatComponentType.Float: return "Float"; - case FormatComponentType.UNorm: return "UNorm"; - case FormatComponentType.SNorm: return "SNorm"; - case FormatComponentType.UInt: return "UInt"; - case FormatComponentType.SInt: return "SInt"; - case FormatComponentType.UScaled: return "UScaled"; - case FormatComponentType.SScaled: return "SScaled"; - case FormatComponentType.Depth: return "Depth/Stencil"; - case FormatComponentType.Double: return "Double"; - default: break; - } - - return "Unknown"; - } - - public static string Str(this EnvironmentSeparator sep) - { - switch (sep) - { - case EnvironmentSeparator.Platform: return "Platform style"; - case EnvironmentSeparator.SemiColon: return "Semi-colon (;)"; - case EnvironmentSeparator.Colon: return "Colon (:)"; - case EnvironmentSeparator.None: return "No Separator"; - default: break; - } - - return "Unknown"; - } - } -} diff --git a/renderdocui/Interop/FetchInfo.cs b/renderdocui/Interop/FetchInfo.cs deleted file mode 100644 index b8e94ab65..000000000 --- a/renderdocui/Interop/FetchInfo.cs +++ /dev/null @@ -1,913 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; -using renderdocui.Code; - -namespace renderdoc -{ - public struct Vec3f - { - public Vec3f(float X, float Y, float Z) { x = X; y = Y; z = Z; } - public Vec3f(Vec3f v) { x = v.x; y = v.y; z = v.z; } - public Vec3f(FloatVector v) { x = v.x; y = v.y; z = v.z; } - - public float Length() - { - return (float)Math.Sqrt(x * x + y * y + z * z); - } - - public Vec3f Sub(Vec3f o) - { - return new Vec3f(x - o.x, - y - o.y, - z - o.z); - } - - public void Mul(float f) - { - x *= f; - y *= f; - z *= f; - } - - public float x, y, z; - }; - - public struct Vec4f - { - public float x, y, z, w; - }; - - [StructLayout(LayoutKind.Sequential)] - public struct FloatVector - { - public FloatVector(float X, float Y, float Z, float W) { x = X; y = Y; z = Z; w = W; } - public FloatVector(float X, float Y, float Z) { x = X; y = Y; z = Z; w = 1; } - public FloatVector(Vec3f v) { x = v.x; y = v.y; z = v.z; w = 1; } - public FloatVector(Vec3f v, float W) { x = v.x; y = v.y; z = v.z; w = W; } - - public float x, y, z, w; - }; - - [StructLayout(LayoutKind.Sequential)] - public struct DirectoryFile : IComparable - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string filename; - public DirectoryFileProperty flags; - public UInt32 lastmod; - public UInt64 size; - - public override string ToString() - { - return String.Format("{0} ({1})", filename, flags); - } - - public int CompareTo(DirectoryFile o) - { - // sort directories first - bool thisdir = flags.HasFlag(DirectoryFileProperty.Directory); - bool odir = o.flags.HasFlag(DirectoryFileProperty.Directory); - - if (thisdir && !odir) - return -1; - if (!thisdir && odir) - return 1; - - // can't have duplicates with same filename, so just compare filenames - return filename.CompareTo(o.filename); - } - }; - - [StructLayout(LayoutKind.Sequential)] - public class ResourceFormat - { - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern float RENDERDOC_HalfToFloat(UInt16 half); - - public ResourceFormat() - { - special = false; - specialFormat = SpecialFormat.Unknown; - - compType = FormatComponentType.None; - compCount = 0; - compByteWidth = 0; - bgraOrder = false; - srgbCorrected = false; - - strname = ""; - } - - public ResourceFormat(FormatComponentType type, UInt32 count, UInt32 byteWidth) - { - special = false; - specialFormat = SpecialFormat.Unknown; - - compType = type; - compCount = count; - compByteWidth = byteWidth; - bgraOrder = false; - srgbCorrected = false; - - strname = ""; - } - - // indicates it's not a type represented with the members below - // usually this means non-uniform across components or block compressed - public bool special; - public SpecialFormat specialFormat; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string strname; - - public UInt32 compCount; - public UInt32 compByteWidth; - public FormatComponentType compType; - - public bool bgraOrder; - public bool srgbCorrected; - - public override string ToString() - { - return strname; - } - - public override bool Equals(Object obj) - { - return obj is ResourceFormat && this == (ResourceFormat)obj; - } - public override int GetHashCode() - { - int hash = specialFormat.GetHashCode() * 17; - hash = hash * 17 + compCount.GetHashCode(); - hash = hash * 17 + compByteWidth.GetHashCode(); - hash = hash * 17 + compType.GetHashCode(); - hash = hash * 17 + bgraOrder.GetHashCode(); - hash = hash * 17 + srgbCorrected.GetHashCode(); - return hash; - } - public static bool operator ==(ResourceFormat x, ResourceFormat y) - { - if ((object)x == null) return (object)y == null; - if ((object)y == null) return (object)x == null; - - if (x.special || y.special) - return x.special == y.special && x.specialFormat == y.specialFormat && x.compType == y.compType; - - return x.compCount == y.compCount && - x.compByteWidth == y.compByteWidth && - x.compType == y.compType && - x.bgraOrder == y.bgraOrder && - x.srgbCorrected == y.srgbCorrected; - } - public static bool operator !=(ResourceFormat x, ResourceFormat y) - { - return !(x == y); - } - - public float ConvertFromHalf(UInt16 comp) - { - return RENDERDOC_HalfToFloat(comp); - } - - public object Interpret(UInt16 comp) - { - if (compByteWidth != 2 || compType == FormatComponentType.Float) throw new ArgumentException(); - - if (compType == FormatComponentType.SInt) - { - return (Int16)comp; - } - else if (compType == FormatComponentType.UInt) - { - return comp; - } - else if (compType == FormatComponentType.SScaled) - { - return (float)((Int16)comp); - } - else if (compType == FormatComponentType.UScaled) - { - return (float)comp; - } - else if (compType == FormatComponentType.UNorm) - { - return (float)comp / (float)UInt16.MaxValue; - } - else if (compType == FormatComponentType.SNorm) - { - Int16 cast = (Int16)comp; - - float f = -1.0f; - - if (cast == -32768) - f = -1.0f; - else - f = ((float)cast) / 32767.0f; - - return f; - } - - throw new ArgumentException(); - } - - public object Interpret(byte comp) - { - if (compByteWidth != 1 || compType == FormatComponentType.Float) throw new ArgumentException(); - - if (compType == FormatComponentType.SInt) - { - return (sbyte)comp; - } - else if (compType == FormatComponentType.UInt) - { - return comp; - } - else if (compType == FormatComponentType.SScaled) - { - return (float)((sbyte)comp); - } - else if (compType == FormatComponentType.UScaled) - { - return (float)comp; - } - else if (compType == FormatComponentType.UNorm) - { - return ((float)comp) / 255.0f; - } - else if (compType == FormatComponentType.SNorm) - { - sbyte cast = (sbyte)comp; - - float f = -1.0f; - - if (cast == -128) - f = -1.0f; - else - f = ((float)cast) / 127.0f; - - return f; - } - - throw new ArgumentException(); - } - }; - - [StructLayout(LayoutKind.Sequential)] - public class TextureFilter - { - public FilterMode minify; - public FilterMode magnify; - public FilterMode mip; - public FilterFunc func; - - public override string ToString() - { - string[] filters = { minify.ToString(), magnify.ToString(), mip.ToString() }; - string[] filterPrefixes = { "Min", "Mag", "Mip" }; - - string filter = "", filtPrefix = "", filtVal = ""; - - for (int a = 0; a < 3; a++) - { - if (a == 0 || filters[a] == filters[a - 1]) - { - if (filtPrefix != "") - filtPrefix += "/"; - filtPrefix += filterPrefixes[a]; - } - else - { - filter += filtPrefix + ": " + filtVal + ", "; - - filtPrefix = filterPrefixes[a]; - } - filtVal = filters[a]; - } - - filter += filtPrefix + ": " + filtVal; - - return filter; - } - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchBuffer - { - public ResourceId ID; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string name; - public bool customName; - public BufferCreationFlags creationFlags; - public UInt64 length; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchTexture - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string name; - public bool customName; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ResourceFormat format; - public UInt32 dimension; - public ShaderResourceType resType; - public UInt32 width, height, depth; - public ResourceId ID; - public bool cubemap; - public UInt32 mips; - public UInt32 arraysize; - public TextureCreationFlags creationFlags; - public UInt32 msQual, msSamp; - public UInt64 byteSize; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameConstantBindStats - { - public UInt32 calls; - public UInt32 sets; - public UInt32 nulls; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] bindslots; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] sizes; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameSamplerBindStats - { - public UInt32 calls; - public UInt32 sets; - public UInt32 nulls; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] bindslots; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameResourceBindStats - { - public UInt32 calls; - public UInt32 sets; - public UInt32 nulls; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] types; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] bindslots; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameUpdateStats - { - public UInt32 calls; - public UInt32 clients; - public UInt32 servers; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] types; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] sizes; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameDrawStats - { - public UInt32 calls; - public UInt32 instanced; - public UInt32 indirect; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] counts; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameDispatchStats - { - public UInt32 calls; - public UInt32 indirect; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameIndexBindStats - { - public UInt32 calls; - public UInt32 sets; - public UInt32 nulls; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameVertexBindStats - { - public UInt32 calls; - public UInt32 sets; - public UInt32 nulls; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] bindslots; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameLayoutBindStats - { - public UInt32 calls; - public UInt32 sets; - public UInt32 nulls; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameShaderStats - { - public UInt32 calls; - public UInt32 sets; - public UInt32 nulls; - public UInt32 redundants; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameBlendStats - { - public UInt32 calls; - public UInt32 sets; - public UInt32 nulls; - public UInt32 redundants; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameDepthStencilStats - { - public UInt32 calls; - public UInt32 sets; - public UInt32 nulls; - public UInt32 redundants; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameRasterizationStats - { - public UInt32 calls; - public UInt32 sets; - public UInt32 nulls; - public UInt32 redundants; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] viewports; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] rects; - } - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameOutputStats - { - public UInt32 calls; - public UInt32 sets; - public UInt32 nulls; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] bindslots; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchFrameStatistics - { - public UInt32 recorded; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = (int)ShaderStageType.Count)] - public FetchFrameConstantBindStats[] constants; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = (int)ShaderStageType.Count)] - public FetchFrameSamplerBindStats[] samplers; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = (int)ShaderStageType.Count)] - public FetchFrameResourceBindStats[] resources; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FetchFrameUpdateStats updates; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FetchFrameDrawStats draws; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FetchFrameDispatchStats dispatches; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FetchFrameIndexBindStats indices; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FetchFrameVertexBindStats vertices; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FetchFrameLayoutBindStats layouts; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = (int)ShaderStageType.Count)] - public FetchFrameShaderStats[] shaders; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FetchFrameBlendStats blends; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FetchFrameDepthStencilStats depths; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FetchFrameRasterizationStats rasters; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FetchFrameOutputStats outputs; - }; - -[StructLayout(LayoutKind.Sequential)] - public class FetchFrameInfo - { - public UInt32 frameNumber; - public UInt64 fileOffset; - public UInt64 uncompressedFileSize; - public UInt64 compressedFileSize; - public UInt64 persistentSize; - public UInt64 initDataSize; - public UInt64 captureTime; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FetchFrameStatistics stats; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public DebugMessage[] debugMessages; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchAPIEvent - { - public UInt32 eventID; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt64[] callstack; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string eventDesc; - - public UInt64 fileOffset; - }; - - [StructLayout(LayoutKind.Sequential)] - public class DebugMessage - { - public UInt32 eventID; - public DebugMessageCategory category; - public DebugMessageSeverity severity; - public DebugMessageSource source; - public UInt32 messageID; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string description; - }; - - [StructLayout(LayoutKind.Sequential)] - public class EventUsage - { - public UInt32 eventID; - public ResourceUsage usage; - public ResourceId view; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FetchDrawcall - { - public UInt32 eventID, drawcallID; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string name; - - public DrawcallFlags flags; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public float[] markerColour; - - public System.Drawing.Color GetColor() - { - float red = markerColour[0]; - float green = markerColour[1]; - float blue = markerColour[2]; - float alpha = markerColour[3]; - - return System.Drawing.Color.FromArgb( - (int)(alpha * 255.0f), - (int)(red * 255.0f), - (int)(green * 255.0f), - (int)(blue * 255.0f) - ); - } - - public System.Drawing.Color GetTextColor(System.Drawing.Color defaultTextCol) - { - float backLum = GetColor().GetLuminance(); - float textLum = defaultTextCol.GetLuminance(); - - bool backDark = backLum < 0.2f; - bool textDark = textLum < 0.2f; - - // if they're contrasting, use the text colour desired - if (backDark != textDark) - return defaultTextCol; - - // otherwise pick a contrasting colour - if (backDark) - return System.Drawing.Color.White; - else - return System.Drawing.Color.Black; - } - - public UInt32 numIndices; - public UInt32 numInstances; - public Int32 baseVertex; - public UInt32 indexOffset; - public UInt32 vertexOffset; - public UInt32 instanceOffset; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 3)] - public UInt32[] dispatchDimension; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 3)] - public UInt32[] dispatchThreadsDimension; - - public UInt32 indexByteWidth; - public PrimitiveTopology topology; - - public ResourceId copySource; - public ResourceId copyDestination; - - public Int64 parentDrawcall; - public Int64 previousDrawcall; - public Int64 nextDrawcall; - - [CustomMarshalAs(CustomUnmanagedType.Skip)] - public FetchDrawcall parent; - [CustomMarshalAs(CustomUnmanagedType.Skip)] - public FetchDrawcall previous; - [CustomMarshalAs(CustomUnmanagedType.Skip)] - public FetchDrawcall next; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 8)] - public ResourceId[] outputs; - public ResourceId depthOut; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public FetchAPIEvent[] events; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public FetchDrawcall[] children; - }; - - [StructLayout(LayoutKind.Sequential)] - public struct MeshFormat - { - public ResourceId idxbuf; - public UInt64 idxoffs; - public UInt32 idxByteWidth; - public Int32 baseVertex; - - public ResourceId buf; - public UInt64 offset; - public UInt32 stride; - - public UInt32 compCount; - public UInt32 compByteWidth; - public FormatComponentType compType; - public bool bgraOrder; - public SpecialFormat specialFormat; - - public FloatVector meshColour; - - public bool showAlpha; - - public PrimitiveTopology topo; - public UInt32 numVerts; - - public bool unproject; - public float nearPlane; - public float farPlane; - }; - - [StructLayout(LayoutKind.Sequential)] - public class MeshDisplay - { - public MeshDataStage type = MeshDataStage.Unknown; - - public IntPtr cam = IntPtr.Zero; - - public bool ortho = false; - public float fov = 90.0f; - public float aspect = 0.0f; - - public bool showPrevInstances = false; - public bool showAllInstances = false; - public bool showWholePass = false; - public UInt32 curInstance = 0; - - public UInt32 highlightVert; - public MeshFormat position; - public MeshFormat secondary; - - public FloatVector minBounds = new FloatVector(); - public FloatVector maxBounds = new FloatVector(); - public bool showBBox = false; - - public SolidShadeMode solidShadeMode = SolidShadeMode.None; - public bool wireframeDraw = true; - }; - - [StructLayout(LayoutKind.Sequential)] - public class TextureDisplay - { - public ResourceId texid = ResourceId.Null; - public FormatComponentType typeHint = FormatComponentType.None; - public float rangemin = 0.0f; - public float rangemax = 1.0f; - public float scale = 1.0f; - public bool Red = true, Green = true, Blue = true, Alpha = false; - public bool FlipY = false; - public float HDRMul = -1.0f; - public bool linearDisplayAsGamma = true; - public ResourceId CustomShader = ResourceId.Null; - public UInt32 mip = 0; - public UInt32 sliceFace = 0; - public UInt32 sampleIdx = 0; - public bool rawoutput = false; - - public float offx = 0.0f, offy = 0.0f; - - public FloatVector lightBackgroundColour = new FloatVector(0.81f, 0.81f, 0.81f); - public FloatVector darkBackgroundColour = new FloatVector(0.57f, 0.57f, 0.57f); - - public TextureDisplayOverlay overlay = TextureDisplayOverlay.None; - }; - - [StructLayout(LayoutKind.Sequential)] - public class TextureSave - { - public ResourceId id = ResourceId.Null; - - public FormatComponentType typeHint = FormatComponentType.None; - - public FileType destType = FileType.DDS; - - public Int32 mip = -1; - - [StructLayout(LayoutKind.Sequential)] - public class ComponentMapping - { - public float blackPoint; - public float whitePoint; - }; - - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ComponentMapping comp = new ComponentMapping(); - - [StructLayout(LayoutKind.Sequential)] - public class SampleMapping - { - public bool mapToArray; - - public UInt32 sampleIndex; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public SampleMapping sample = new SampleMapping(); - - [StructLayout(LayoutKind.Sequential)] - public class SliceMapping - { - public Int32 sliceIndex; - - public bool slicesAsGrid; - - public Int32 sliceGridWidth; - - public bool cubeCruciform; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public SliceMapping slice = new SliceMapping(); - - public int channelExtract = -1; - - public AlphaMapping alpha = AlphaMapping.Discard; - public FloatVector alphaCol = new FloatVector(0.81f, 0.81f, 0.81f); - public FloatVector alphaColSecondary = new FloatVector(0.57f, 0.57f, 0.57f); - - public int jpegQuality = 90; - }; - - [StructLayout(LayoutKind.Sequential)] - public class APIProperties - { - public GraphicsAPI pipelineType; - public GraphicsAPI localRenderer; - public bool degraded; - - public string ShaderExtension - { - get - { - return pipelineType.IsD3D() ? ".hlsl" : ".glsl"; - } - } - }; - - [StructLayout(LayoutKind.Sequential)] - public class CounterDescription - { - public UInt32 counterID; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string name; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string description; - public FormatComponentType resultCompType; - public UInt32 resultByteWidth; - public CounterUnits units; - }; - - [StructLayout(LayoutKind.Sequential)] - public class CounterResult - { - public UInt32 eventID; - public UInt32 counterID; - - [StructLayout(LayoutKind.Sequential)] - public struct ValueUnion - { - public float f; - public double d; - public UInt32 u32; - public UInt64 u64; - }; - - [CustomMarshalAs(CustomUnmanagedType.Union)] - public ValueUnion value; - }; - - [StructLayout(LayoutKind.Sequential)] - public class PixelValue - { - [StructLayout(LayoutKind.Sequential)] - public struct ValueUnion - { - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4, FixedType = CustomFixedType.UInt32)] - public UInt32[] u; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4, FixedType = CustomFixedType.Float)] - public float[] f; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4, FixedType = CustomFixedType.Int32)] - public Int32[] i; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4, FixedType = CustomFixedType.UInt16)] - public UInt16[] u16; - }; - - [CustomMarshalAs(CustomUnmanagedType.Union)] - public ValueUnion value; - }; - - [StructLayout(LayoutKind.Sequential)] - public class ModificationValue - { - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public PixelValue col; - public float depth; - public Int32 stencil; - }; - - [StructLayout(LayoutKind.Sequential)] - public class PixelModification - { - public UInt32 eventID; - - public bool uavWrite; - public bool unboundPS; - - public UInt32 fragIndex; - public UInt32 primitiveID; - - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ModificationValue preMod; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ModificationValue shaderOut; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ModificationValue postMod; - - public bool sampleMasked; - public bool backfaceCulled; - public bool depthClipped; - public bool viewClipped; - public bool scissorClipped; - public bool shaderDiscarded; - public bool depthTestFailed; - public bool stencilTestFailed; - - public bool EventPassed() - { - return !sampleMasked && !backfaceCulled && !depthClipped && - !viewClipped && !scissorClipped && !shaderDiscarded && - !depthTestFailed && !stencilTestFailed; - } - }; -} diff --git a/renderdocui/Interop/Formatter.cs b/renderdocui/Interop/Formatter.cs deleted file mode 100644 index 068547150..000000000 --- a/renderdocui/Interop/Formatter.cs +++ /dev/null @@ -1,162 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace renderdoc -{ - public class Formatter - { - public static String Format(double f) - { - if (f != 0 && (Math.Abs(f) < m_ExponentialNegValue || Math.Abs(f) > m_ExponentialPosValue)) - return String.Format(m_EFormatter, f); - - return String.Format(m_FFormatter, f); - } - - public static String Format(float f) - { - if (f != 0 && (Math.Abs(f) < m_ExponentialNegValue || Math.Abs(f) > m_ExponentialPosValue)) - return String.Format(m_EFormatter, f); - - return String.Format(m_FFormatter, f); - } - - public static String Format(UInt32 u) - { - return String.Format("{0}", u); - } - - public static String Format(UInt32 u, bool hex) - { - return String.Format(hex ? "{0:X8}" : "{0}", u); - } - - public static String Format(Int32 i) - { - return String.Format("{0}", i); - } - - public static int MaxFigures - { - get - { - return m_MaxFigures; - } - - set - { - if (value >= 2) - m_MaxFigures = value; - else - m_MaxFigures = 2; - - UpdateFormatters(); - } - } - - public static int MinFigures - { - get - { - return m_MinFigures; - } - - set - { - if (value >= 0) - m_MinFigures = value; - else - m_MinFigures = 0; - - UpdateFormatters(); - } - } - - public static int ExponentialNegCutoff - { - get - { - return m_ExponentialNegCutoff; - } - - set - { - if (value >= 0) - m_ExponentialNegCutoff = value; - else - m_ExponentialNegCutoff = 0; - - m_ExponentialNegValue = Math.Pow(10.0, -m_ExponentialNegCutoff); - } - } - - public static int ExponentialPosCutoff - { - get - { - return m_ExponentialPosCutoff; - } - - set - { - if (value >= 0) - m_ExponentialPosCutoff = value; - else - m_ExponentialPosCutoff = 0; - - m_ExponentialPosValue = Math.Pow(10.0, m_ExponentialPosCutoff); - } - } - - private static int m_MinFigures = 2; - private static int m_MaxFigures = 5; - private static int m_ExponentialNegCutoff = 5; - private static int m_ExponentialPosCutoff = 7; - - private static double m_ExponentialNegValue = 0.00001; // 10(-5) - private static double m_ExponentialPosValue = 10000000.0; // 10(7) - private static string m_EFormatter = "{0:E5}"; - private static string m_FFormatter = "{0:0.00###}"; - - private static void UpdateFormatters() - { - m_FFormatter = "{0:0."; - - int i = 0; - - for (; i < m_MinFigures; i++) m_FFormatter += "0"; - for (; i < m_MaxFigures; i++) m_FFormatter += "#"; - - m_EFormatter = m_FFormatter + "e+00}"; - - m_FFormatter += "}"; - } - }; -} diff --git a/renderdocui/Interop/GLPipelineState.cs b/renderdocui/Interop/GLPipelineState.cs deleted file mode 100644 index 8cefd6db6..000000000 --- a/renderdocui/Interop/GLPipelineState.cs +++ /dev/null @@ -1,408 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Runtime.InteropServices; - -namespace renderdoc -{ - [StructLayout(LayoutKind.Sequential)] - public class GLPipelineState - { - [StructLayout(LayoutKind.Sequential)] - public class VertexInputs - { - [StructLayout(LayoutKind.Sequential)] - public class VertexAttribute - { - public bool Enabled; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ResourceFormat Format; - - [StructLayout(LayoutKind.Sequential)] - public struct GenericValueUnion - { - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4, FixedType = CustomFixedType.Float)] - public float[] f; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4, FixedType = CustomFixedType.UInt32)] - public UInt32[] u; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4, FixedType = CustomFixedType.Int32)] - public Int32[] i; - }; - - [CustomMarshalAs(CustomUnmanagedType.Union)] - public GenericValueUnion GenericValue; - - public UInt32 BufferSlot; - public UInt32 RelativeOffset; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public VertexAttribute[] attributes; - - [StructLayout(LayoutKind.Sequential)] - public class VertexBuffer - { - public ResourceId Buffer; - public UInt32 Stride; - public UInt32 Offset; - public UInt32 Divisor; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public VertexBuffer[] vbuffers; - - public ResourceId ibuffer; - public bool primitiveRestart; - public UInt32 restartIndex; - - public bool provokingVertexLast; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public VertexInputs m_VtxIn; - - [StructLayout(LayoutKind.Sequential)] - public class ShaderStage - { - private void PostMarshal() - { - if (_ptr_ShaderDetails != IntPtr.Zero) - { - ShaderDetails = (ShaderReflection)CustomMarshal.PtrToStructure(_ptr_ShaderDetails, typeof(ShaderReflection), false); - ShaderDetails.origPtr = _ptr_ShaderDetails; - } - else - { - ShaderDetails = null; - } - - _ptr_ShaderDetails = IntPtr.Zero; - } - - public ResourceId Shader; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string ShaderName; - public bool customShaderName; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string ProgramName; - public bool customProgramName; - - public bool PipelineActive; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string PipelineName; - public bool customPipelineName; - - private IntPtr _ptr_ShaderDetails; - [CustomMarshalAs(CustomUnmanagedType.Skip)] - public ShaderReflection ShaderDetails; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderBindpointMapping BindpointMapping; - - public ShaderStageType stage; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] Subroutines; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderStage m_VS, m_TCS, m_TES, m_GS, m_FS, m_CS; - - [StructLayout(LayoutKind.Sequential)] - public class FixedVertexProcessing - { - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 2)] - public float[] defaultInnerLevel; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public float[] defaultOuterLevel; - public bool discard; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 8)] - public bool[] clipPlanes; - public bool clipOriginLowerLeft; - public bool clipNegativeOneToOne; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FixedVertexProcessing m_VtxProcess; - - [StructLayout(LayoutKind.Sequential)] - public class Texture - { - public ResourceId Resource; - public UInt32 FirstSlice; - public UInt32 HighestMip; - public ShaderResourceType ResType; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public TextureSwizzle[] Swizzle; - public Int32 DepthReadChannel; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Texture[] Textures; - - [StructLayout(LayoutKind.Sequential)] - public class Sampler - { - public ResourceId Samp; - public AddressMode AddressS, AddressT, AddressR; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public float[] BorderColor; - public CompareFunc Comparison; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public TextureFilter Filter; - public bool SeamlessCube; - public float MaxAniso; - public float MaxLOD; - public float MinLOD; - public float MipLODBias; - - public bool UseBorder() - { - return AddressS == AddressMode.ClampBorder || - AddressT == AddressMode.ClampBorder || - AddressR == AddressMode.ClampBorder; - } - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Sampler[] Samplers; - - [StructLayout(LayoutKind.Sequential)] - public class Buffer - { - public ResourceId Resource; - - public UInt64 Offset; - public UInt64 Size; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Buffer[] AtomicBuffers; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Buffer[] UniformBuffers; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Buffer[] ShaderStorageBuffers; - - [StructLayout(LayoutKind.Sequential)] - public class ImageLoadStore - { - public ResourceId Resource; - public UInt32 Level; - public bool Layered; - public UInt32 Layer; - public ShaderResourceType ResType; - public bool readAllowed; - public bool writeAllowed; - public ResourceFormat Format; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ImageLoadStore[] Images; - - [StructLayout(LayoutKind.Sequential)] - public class Feedback - { - public ResourceId Obj; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public ResourceId[] BufferBinding; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public UInt64[] Offset; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public UInt64[] Size; - public bool Active; - public bool Paused; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Feedback m_Feedback; - - [StructLayout(LayoutKind.Sequential)] - public class Rasterizer - { - [StructLayout(LayoutKind.Sequential)] - public class Viewport - { - public float Left, Bottom; - public float Width, Height; - public double MinDepth, MaxDepth; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Viewport[] Viewports; - - [StructLayout(LayoutKind.Sequential)] - public class Scissor - { - public Int32 Left, Bottom; - public Int32 Width, Height; - public bool Enabled; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Scissor[] Scissors; - - [StructLayout(LayoutKind.Sequential)] - public class RasterizerState - { - public TriangleFillMode FillMode; - public TriangleCullMode CullMode; - public bool FrontCCW; - public float DepthBias; - public float SlopeScaledDepthBias; - public float OffsetClamp; - public bool DepthClamp; - - public bool MultisampleEnable; - public bool SampleShading; - public bool SampleMask; - public UInt32 SampleMaskValue; - public bool SampleCoverage; - public bool SampleCoverageInvert; - public float SampleCoverageValue; - public bool SampleAlphaToCoverage; - public bool SampleAlphaToOne; - public float MinSampleShadingRate; - - public bool ProgrammablePointSize; - public float PointSize; - public float LineWidth; - public float PointFadeThreshold; - public bool PointOriginUpperLeft; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public RasterizerState m_State; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Rasterizer m_RS; - - [StructLayout(LayoutKind.Sequential)] - public class DepthState - { - public bool DepthEnable; - public CompareFunc DepthFunc; - public bool DepthWrites; - public bool DepthBounds; - public double NearBound; - public double FarBound; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public DepthState m_DepthState; - - [StructLayout(LayoutKind.Sequential)] - public class StencilState - { - public bool StencilEnable; - - [StructLayout(LayoutKind.Sequential)] - public class StencilFace - { - public StencilOp FailOp; - public StencilOp DepthFailOp; - public StencilOp PassOp; - public CompareFunc Func; - public byte Ref; - public byte ValueMask; - public byte WriteMask; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public StencilFace m_FrontFace, m_BackFace; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public StencilState m_StencilState; - - [StructLayout(LayoutKind.Sequential)] - public class FrameBuffer - { - public bool FramebufferSRGB; - - [StructLayout(LayoutKind.Sequential)] - public class Attachment - { - public ResourceId Obj; - public UInt32 Layer; - public UInt32 Mip; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public TextureSwizzle[] Swizzle; - }; - - [StructLayout(LayoutKind.Sequential)] - public class FBO - { - public ResourceId Obj; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Attachment[] Color; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Attachment Depth; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Attachment Stencil; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Int32[] DrawBuffers; - public Int32 ReadBuffer; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FBO m_DrawFBO, m_ReadFBO; - - [StructLayout(LayoutKind.Sequential)] - public class BlendState - { - [StructLayout(LayoutKind.Sequential)] - public class RTBlend - { - [StructLayout(LayoutKind.Sequential)] - public class BlendEquation - { - public BlendMultiplier Source; - public BlendMultiplier Destination; - public BlendOp Operation; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public BlendEquation m_Blend, m_AlphaBlend; - - public LogicOp Logic; - - public bool Enabled; - public byte WriteMask; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public RTBlend[] Blends; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public float[] BlendFactor; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public BlendState m_BlendState; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public FrameBuffer m_FB; - - [StructLayout(LayoutKind.Sequential)] - public class Hints - { - public QualityHint Derivatives; - public QualityHint LineSmooth; - public QualityHint PolySmooth; - public QualityHint TexCompression; - public bool LineSmoothEnabled; - public bool PolySmoothEnabled; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Hints m_Hints; - } -} diff --git a/renderdocui/Interop/ReplayRenderer.cs b/renderdocui/Interop/ReplayRenderer.cs deleted file mode 100644 index f29266faf..000000000 --- a/renderdocui/Interop/ReplayRenderer.cs +++ /dev/null @@ -1,1277 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Runtime.InteropServices; -using System.Collections.Generic; - -namespace renderdoc -{ - // this isn't an Interop struct, since it needs to be passed C# -> C++ and - // it's not POD which we don't support. It's here just as a utility container - public class EnvironmentModification - { - public string variable; - public string value; - - public EnvironmentModificationType type; - public EnvironmentSeparator separator; - - public string GetTypeString() - { - string ret; - - if (type == EnvironmentModificationType.Append) - ret = String.Format("Append, {0}", separator.Str()); - else if (type == EnvironmentModificationType.Prepend) - ret = String.Format("Prepend, {0}", separator.Str()); - else - ret = "Set"; - - return ret; - } - - public string GetDescription() - { - string ret; - - if (type == EnvironmentModificationType.Append) - ret = String.Format("Append {0} with {1} using {2}", variable, value, separator.Str()); - else if (type == EnvironmentModificationType.Prepend) - ret = String.Format("Prepend {0} with {1} using {2}", variable, value, separator.Str()); - else - ret = String.Format("Set {0} to {1}", variable, value); - - return ret; - } - } - - [StructLayout(LayoutKind.Sequential)] - public class TargetControlMessage - { - public TargetControlMessageType Type; - - [StructLayout(LayoutKind.Sequential)] - public struct NewCaptureData - { - public UInt32 ID; - public UInt64 timestamp; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public byte[] thumbnail; - public Int32 thumbWidth; - public Int32 thumbHeight; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string path; - public bool local; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public NewCaptureData NewCapture; - - [StructLayout(LayoutKind.Sequential)] - public struct RegisterAPIData - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string APIName; - }; - - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public RegisterAPIData RegisterAPI; - - [StructLayout(LayoutKind.Sequential)] - public struct BusyData - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string ClientName; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public BusyData Busy; - - [StructLayout(LayoutKind.Sequential)] - public struct NewChildData - { - public UInt32 PID; - public UInt32 ident; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public NewChildData NewChild; - }; - - public class ReplayOutput - { - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayOutput_SetTextureDisplay(IntPtr real, TextureDisplay o); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayOutput_SetMeshDisplay(IntPtr real, MeshDisplay o); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayOutput_ClearThumbnails(IntPtr real); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayOutput_AddThumbnail(IntPtr real, UInt32 windowSystem, IntPtr wnd, ResourceId texID, FormatComponentType typeHint); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayOutput_Display(IntPtr real); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayOutput_SetPixelContext(IntPtr real, UInt32 windowSystem, IntPtr wnd); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayOutput_SetPixelContextLocation(IntPtr real, UInt32 x, UInt32 y); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayOutput_DisablePixelContext(IntPtr real); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayOutput_GetCustomShaderTexID(IntPtr real, ref ResourceId texid); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayOutput_GetDebugOverlayTexID(IntPtr real, ref ResourceId texid); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayOutput_GetMinMax(IntPtr real, IntPtr outminval, IntPtr outmaxval); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayOutput_GetHistogram(IntPtr real, float minval, float maxval, bool[] channels, IntPtr outhistogram); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayOutput_PickPixel(IntPtr real, ResourceId texID, bool customShader, - UInt32 x, UInt32 y, UInt32 sliceFace, UInt32 mip, UInt32 sample, IntPtr outval); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern UInt32 ReplayOutput_PickVertex(IntPtr real, UInt32 eventID, UInt32 x, UInt32 y, IntPtr outPickedInstance); - - private IntPtr m_Real = IntPtr.Zero; - - public ReplayOutput(IntPtr real) { m_Real = real; } - - public void SetTextureDisplay(TextureDisplay o) - { - ReplayOutput_SetTextureDisplay(m_Real, o); - } - public void SetMeshDisplay(MeshDisplay o) - { - ReplayOutput_SetMeshDisplay(m_Real, o); - } - - public void ClearThumbnails() - { - ReplayOutput_ClearThumbnails(m_Real); - } - public bool AddThumbnail(IntPtr wnd, ResourceId texID, FormatComponentType typeHint) - { - // 1 == eWindowingSystem_Win32 - return ReplayOutput_AddThumbnail(m_Real, 1u, wnd, texID, typeHint); - } - - public void Display() - { - ReplayOutput_Display(m_Real); - } - - public bool SetPixelContext(IntPtr wnd) - { - // 1 == eWindowingSystem_Win32 - return ReplayOutput_SetPixelContext(m_Real, 1u, wnd); - } - public void SetPixelContextLocation(UInt32 x, UInt32 y) - { - ReplayOutput_SetPixelContextLocation(m_Real, x, y); - } - public void DisablePixelContext() - { - ReplayOutput_DisablePixelContext(m_Real); - } - - public ResourceId GetCustomShaderTexID() - { - ResourceId ret = ResourceId.Null; - - ReplayOutput_GetCustomShaderTexID(m_Real, ref ret); - - return ret; - } - - public ResourceId GetDebugOverlayTexID() - { - ResourceId ret = ResourceId.Null; - - ReplayOutput_GetDebugOverlayTexID(m_Real, ref ret); - - return ret; - } - - public void GetMinMax(out PixelValue minval, out PixelValue maxval) - { - IntPtr mem1 = CustomMarshal.Alloc(typeof(PixelValue)); - IntPtr mem2 = CustomMarshal.Alloc(typeof(PixelValue)); - - ReplayOutput_GetMinMax(m_Real, mem1, mem2); - - minval = (PixelValue)CustomMarshal.PtrToStructure(mem1, typeof(PixelValue), true); - maxval = (PixelValue)CustomMarshal.PtrToStructure(mem2, typeof(PixelValue), true); - - CustomMarshal.Free(mem1); - CustomMarshal.Free(mem2); - } - - public void GetHistogram(float minval, float maxval, - bool Red, bool Green, bool Blue, bool Alpha, - out UInt32[] histogram) - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - bool[] channels = new bool[] { Red, Green, Blue, Alpha }; - - ReplayOutput_GetHistogram(m_Real, minval, maxval, channels, mem); - - histogram = (UInt32[])CustomMarshal.GetTemplatedArray(mem, typeof(UInt32), true); - - CustomMarshal.Free(mem); - } - - public PixelValue PickPixel(ResourceId texID, bool customShader, UInt32 x, UInt32 y, UInt32 sliceFace, UInt32 mip, UInt32 sample) - { - IntPtr mem = CustomMarshal.Alloc(typeof(PixelValue)); - - ReplayOutput_PickPixel(m_Real, texID, customShader, x, y, sliceFace, mip, sample, mem); - - PixelValue ret = (PixelValue)CustomMarshal.PtrToStructure(mem, typeof(PixelValue), false); - - CustomMarshal.Free(mem); - - return ret; - } - - public UInt32 PickVertex(UInt32 eventID, UInt32 x, UInt32 y, out UInt32 pickedInstance) - { - IntPtr mem = CustomMarshal.Alloc(typeof(UInt32)); - - UInt32 pickedVertex = ReplayOutput_PickVertex(m_Real, eventID, x, y, mem); - pickedInstance = (UInt32)CustomMarshal.PtrToStructure(mem, typeof(UInt32), true); - - CustomMarshal.Free(mem); - - return pickedVertex; - } - - }; - - public class ReplayRenderer - { - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_Shutdown(IntPtr real); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetAPIProperties(IntPtr real, IntPtr propsOut); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr ReplayRenderer_CreateOutput(IntPtr real, UInt32 windowSystem, IntPtr WindowHandle, OutputType type); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_ShutdownOutput(IntPtr real, IntPtr replayOutput); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr ReplayRenderer_ReplayLoop(IntPtr real, UInt32 windowSystem, IntPtr WindowHandle, ResourceId texid); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr ReplayRenderer_CancelReplayLoop(IntPtr real); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_FileChanged(IntPtr real); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_HasCallstacks(IntPtr real); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_InitResolver(IntPtr real); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_SetFrameEvent(IntPtr real, UInt32 eventID, bool force); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetD3D11PipelineState(IntPtr real, IntPtr mem); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetD3D12PipelineState(IntPtr real, IntPtr mem); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetGLPipelineState(IntPtr real, IntPtr mem); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetVulkanPipelineState(IntPtr real, IntPtr mem); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetDisassemblyTargets(IntPtr real, IntPtr targets); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_DisassembleShader(IntPtr real, IntPtr refl, IntPtr target, IntPtr isa); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_BuildCustomShader(IntPtr real, IntPtr entry, IntPtr source, UInt32 compileFlags, ShaderStageType type, ref ResourceId shaderID, IntPtr errorMem); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_FreeCustomShader(IntPtr real, ResourceId id); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_BuildTargetShader(IntPtr real, IntPtr entry, IntPtr source, UInt32 compileFlags, ShaderStageType type, ref ResourceId shaderID, IntPtr errorMem); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_ReplaceResource(IntPtr real, ResourceId from, ResourceId to); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_RemoveReplacement(IntPtr real, ResourceId id); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_FreeTargetResource(IntPtr real, ResourceId id); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetFrameInfo(IntPtr real, IntPtr outframe); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetDrawcalls(IntPtr real, IntPtr outdraws); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_FetchCounters(IntPtr real, IntPtr counters, UInt32 numCounters, IntPtr outresults); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_EnumerateCounters(IntPtr real, IntPtr outcounters); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_DescribeCounter(IntPtr real, UInt32 counter, IntPtr outdesc); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetTextures(IntPtr real, IntPtr outtexs); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetBuffers(IntPtr real, IntPtr outbufs); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetResolve(IntPtr real, UInt64[] callstack, UInt32 callstackLen, IntPtr outtrace); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetDebugMessages(IntPtr real, IntPtr outmsgs); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_PixelHistory(IntPtr real, ResourceId target, UInt32 x, UInt32 y, UInt32 slice, UInt32 mip, UInt32 sampleIdx, FormatComponentType typeHint, IntPtr history); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_DebugVertex(IntPtr real, UInt32 vertid, UInt32 instid, UInt32 idx, UInt32 instOffset, UInt32 vertOffset, IntPtr outtrace); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_DebugPixel(IntPtr real, UInt32 x, UInt32 y, UInt32 sample, UInt32 primitive, IntPtr outtrace); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_DebugThread(IntPtr real, UInt32[] groupid, UInt32[] threadid, IntPtr outtrace); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetUsage(IntPtr real, ResourceId id, IntPtr outusage); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetCBufferVariableContents(IntPtr real, ResourceId shader, IntPtr entryPoint, UInt32 cbufslot, ResourceId buffer, UInt64 offs, IntPtr outvars); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_SaveTexture(IntPtr real, TextureSave saveData, IntPtr path); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetPostVSData(IntPtr real, UInt32 instID, MeshDataStage stage, IntPtr outdata); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetBufferData(IntPtr real, ResourceId buff, UInt64 offset, UInt64 len, IntPtr outdata); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void ReplayRenderer_GetTextureData(IntPtr real, ResourceId tex, UInt32 arrayIdx, UInt32 mip, IntPtr outdata); - - private IntPtr m_Real = IntPtr.Zero; - - public IntPtr Real { get { return m_Real; } } - - public ReplayRenderer(IntPtr real) { m_Real = real; } - - public void Shutdown() - { - if (m_Real != IntPtr.Zero) - { - ReplayRenderer_Shutdown(m_Real); - m_Real = IntPtr.Zero; - } - } - - public APIProperties GetAPIProperties() - { - IntPtr mem = CustomMarshal.Alloc(typeof(APIProperties)); - - ReplayRenderer_GetAPIProperties(m_Real, mem); - - APIProperties ret = (APIProperties)CustomMarshal.PtrToStructure(mem, typeof(APIProperties), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public void ReplayLoop(IntPtr WindowHandle, ResourceId texid) - { - if (WindowHandle == IntPtr.Zero) - return; - - // 1 == eWindowingSystem_Win32 - ReplayRenderer_ReplayLoop(m_Real, 1u, WindowHandle, texid); - } - - public void CancelReplayLoop() - { - ReplayRenderer_CancelReplayLoop(m_Real); - } - - public ReplayOutput CreateOutput(IntPtr WindowHandle, OutputType type) - { - // 0 == eWindowingSystem_Unknown - // 1 == eWindowingSystem_Win32 - IntPtr ret = ReplayRenderer_CreateOutput(m_Real, WindowHandle == IntPtr.Zero ? 0u : 1u, WindowHandle, type); - - if (ret == IntPtr.Zero) - return null; - - return new ReplayOutput(ret); - } - - public void FileChanged() - { ReplayRenderer_FileChanged(m_Real); } - - public bool HasCallstacks() - { return ReplayRenderer_HasCallstacks(m_Real); } - - public bool InitResolver() - { return ReplayRenderer_InitResolver(m_Real); } - - public void SetFrameEvent(UInt32 eventID, bool force) - { ReplayRenderer_SetFrameEvent(m_Real, eventID, force); } - - public GLPipelineState GetGLPipelineState() - { - IntPtr mem = CustomMarshal.Alloc(typeof(GLPipelineState)); - - ReplayRenderer_GetGLPipelineState(m_Real, mem); - - GLPipelineState ret = (GLPipelineState)CustomMarshal.PtrToStructure(mem, typeof(GLPipelineState), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public D3D11PipelineState GetD3D11PipelineState() - { - IntPtr mem = CustomMarshal.Alloc(typeof(D3D11PipelineState)); - - ReplayRenderer_GetD3D11PipelineState(m_Real, mem); - - D3D11PipelineState ret = (D3D11PipelineState)CustomMarshal.PtrToStructure(mem, typeof(D3D11PipelineState), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public D3D12PipelineState GetD3D12PipelineState() - { - IntPtr mem = CustomMarshal.Alloc(typeof(D3D12PipelineState)); - - ReplayRenderer_GetD3D12PipelineState(m_Real, mem); - - D3D12PipelineState ret = (D3D12PipelineState)CustomMarshal.PtrToStructure(mem, typeof(D3D12PipelineState), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public VulkanPipelineState GetVulkanPipelineState() - { - IntPtr mem = CustomMarshal.Alloc(typeof(VulkanPipelineState)); - - ReplayRenderer_GetVulkanPipelineState(m_Real, mem); - - VulkanPipelineState ret = (VulkanPipelineState)CustomMarshal.PtrToStructure(mem, typeof(VulkanPipelineState), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public string[] GetDisassemblyTargets() - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - ReplayRenderer_GetDisassemblyTargets(m_Real, mem); - - string[] ret = CustomMarshal.TemplatedArrayToStringArray(mem, true); - - CustomMarshal.Free(mem); - - return ret; - } - - public string DisassembleShader(ShaderReflection refl, string target) - { - IntPtr disasmMem = CustomMarshal.Alloc(typeof(templated_array)); - IntPtr target_mem = CustomMarshal.MakeUTF8String(target); - - ReplayRenderer_DisassembleShader(m_Real, refl.origPtr, target_mem, disasmMem); - - string disasm = CustomMarshal.TemplatedArrayToString(disasmMem, true); - - CustomMarshal.Free(target_mem); - - CustomMarshal.Free(disasmMem); - - return disasm; - } - - public ResourceId BuildCustomShader(string entry, string source, UInt32 compileFlags, ShaderStageType type, out string errors) - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - ResourceId ret = ResourceId.Null; - - IntPtr entry_mem = CustomMarshal.MakeUTF8String(entry); - IntPtr source_mem = CustomMarshal.MakeUTF8String(source); - - ReplayRenderer_BuildCustomShader(m_Real, entry_mem, source_mem, compileFlags, type, ref ret, mem); - - CustomMarshal.Free(entry_mem); - CustomMarshal.Free(source_mem); - - errors = CustomMarshal.TemplatedArrayToString(mem, true); - - CustomMarshal.Free(mem); - - return ret; - } - - public void FreeCustomShader(ResourceId id) - { ReplayRenderer_FreeCustomShader(m_Real, id); } - - public ResourceId BuildTargetShader(string entry, string source, UInt32 compileFlags, ShaderStageType type, out string errors) - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - ResourceId ret = ResourceId.Null; - - IntPtr entry_mem = CustomMarshal.MakeUTF8String(entry); - IntPtr source_mem = CustomMarshal.MakeUTF8String(source); - - ReplayRenderer_BuildTargetShader(m_Real, entry_mem, source_mem, compileFlags, type, ref ret, mem); - - CustomMarshal.Free(entry_mem); - CustomMarshal.Free(source_mem); - - errors = CustomMarshal.TemplatedArrayToString(mem, true); - - CustomMarshal.Free(mem); - - return ret; - } - - public void ReplaceResource(ResourceId from, ResourceId to) - { ReplayRenderer_ReplaceResource(m_Real, from, to); } - public void RemoveReplacement(ResourceId id) - { ReplayRenderer_RemoveReplacement(m_Real, id); } - public void FreeTargetResource(ResourceId id) - { ReplayRenderer_FreeTargetResource(m_Real, id); } - - public FetchFrameInfo GetFrameInfo() - { - IntPtr mem = CustomMarshal.Alloc(typeof(FetchFrameInfo)); - - ReplayRenderer_GetFrameInfo(m_Real, mem); - - FetchFrameInfo ret = (FetchFrameInfo)CustomMarshal.PtrToStructure(mem, typeof(FetchFrameInfo), true); - - CustomMarshal.Free(mem); - - return ret; - } - - private void PopulateDraws(ref Dictionary map, FetchDrawcall[] draws) - { - if (draws.Length == 0) return; - - foreach (var d in draws) - { - map.Add((Int64)d.eventID, d); - PopulateDraws(ref map, d.children); - } - } - - private void FixupDraws(Dictionary map, FetchDrawcall[] draws) - { - if (draws.Length == 0) return; - - foreach (var d in draws) - { - if (d.previousDrawcall != 0 && map.ContainsKey(d.previousDrawcall)) d.previous = map[d.previousDrawcall]; - if (d.nextDrawcall != 0 && map.ContainsKey(d.nextDrawcall)) d.next = map[d.nextDrawcall]; - if (d.parentDrawcall != 0 && map.ContainsKey(d.parentDrawcall)) d.parent = map[d.parentDrawcall]; - - FixupDraws(map, d.children); - } - } - - public Dictionary> FetchCounters(UInt32[] counters) - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - IntPtr countersmem = CustomMarshal.Alloc(typeof(UInt32), counters.Length); - - // there's no Marshal.Copy for uint[], which is stupid. - for (int i = 0; i < counters.Length; i++) - Marshal.WriteInt32(countersmem, sizeof(UInt32) * i, (int)counters[i]); - - ReplayRenderer_FetchCounters(m_Real, countersmem, (uint)counters.Length, mem); - - CustomMarshal.Free(countersmem); - - Dictionary> ret = null; - - { - CounterResult[] resultArray = (CounterResult[])CustomMarshal.GetTemplatedArray(mem, typeof(CounterResult), true); - - // fixup previous/next/parent pointers - ret = new Dictionary>(); - - foreach (var result in resultArray) - { - if (!ret.ContainsKey(result.eventID)) - ret.Add(result.eventID, new List()); - - ret[result.eventID].Add(result); - } - } - - CustomMarshal.Free(mem); - - return ret; - } - - public UInt32[] EnumerateCounters() - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - ReplayRenderer_EnumerateCounters(m_Real, mem); - - UInt32[] ret = (UInt32[])CustomMarshal.GetTemplatedArray(mem, typeof(UInt32), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public CounterDescription DescribeCounter(UInt32 counterID) - { - IntPtr mem = CustomMarshal.Alloc(typeof(CounterDescription)); - - ReplayRenderer_DescribeCounter(m_Real, counterID, mem); - - CounterDescription ret = (CounterDescription)CustomMarshal.PtrToStructure(mem, typeof(CounterDescription), false); - - CustomMarshal.Free(mem); - - return ret; - } - - public FetchDrawcall[] GetDrawcalls() - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - ReplayRenderer_GetDrawcalls(m_Real, mem); - - FetchDrawcall[] ret = null; - - { - ret = (FetchDrawcall[])CustomMarshal.GetTemplatedArray(mem, typeof(FetchDrawcall), true); - - // fixup previous/next/parent pointers - var map = new Dictionary(); - PopulateDraws(ref map, ret); - FixupDraws(map, ret); - } - - CustomMarshal.Free(mem); - - return ret; - } - - public FetchTexture[] GetTextures() - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - ReplayRenderer_GetTextures(m_Real, mem); - - FetchTexture[] ret = (FetchTexture[])CustomMarshal.GetTemplatedArray(mem, typeof(FetchTexture), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public FetchBuffer[] GetBuffers() - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - ReplayRenderer_GetBuffers(m_Real, mem); - - FetchBuffer[] ret = (FetchBuffer[])CustomMarshal.GetTemplatedArray(mem, typeof(FetchBuffer), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public string[] GetResolve(UInt64[] callstack) - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - UInt32 len = (UInt32)callstack.Length; - - ReplayRenderer_GetResolve(m_Real, callstack, len, mem); - - string[] ret = CustomMarshal.TemplatedArrayToStringArray(mem, true); - - CustomMarshal.Free(mem); - - return ret; - } - - public DebugMessage[] GetDebugMessages() - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - ReplayRenderer_GetDebugMessages(m_Real, mem); - - DebugMessage[] ret = (DebugMessage[])CustomMarshal.GetTemplatedArray(mem, typeof(DebugMessage), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public PixelModification[] PixelHistory(ResourceId target, UInt32 x, UInt32 y, UInt32 slice, UInt32 mip, UInt32 sampleIdx, FormatComponentType typeHint) - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - ReplayRenderer_PixelHistory(m_Real, target, x, y, slice, mip, sampleIdx, typeHint, mem); - - PixelModification[] ret = (PixelModification[])CustomMarshal.GetTemplatedArray(mem, typeof(PixelModification), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public ShaderDebugTrace DebugVertex(UInt32 vertid, UInt32 instid, UInt32 idx, UInt32 instOffset, UInt32 vertOffset) - { - IntPtr mem = CustomMarshal.Alloc(typeof(ShaderDebugTrace)); - - ReplayRenderer_DebugVertex(m_Real, vertid, instid, idx, instOffset, vertOffset, mem); - - ShaderDebugTrace ret = (ShaderDebugTrace)CustomMarshal.PtrToStructure(mem, typeof(ShaderDebugTrace), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public ShaderDebugTrace DebugPixel(UInt32 x, UInt32 y, UInt32 sample, UInt32 primitive) - { - IntPtr mem = CustomMarshal.Alloc(typeof(ShaderDebugTrace)); - - ReplayRenderer_DebugPixel(m_Real, x, y, sample, primitive, mem); - - ShaderDebugTrace ret = (ShaderDebugTrace)CustomMarshal.PtrToStructure(mem, typeof(ShaderDebugTrace), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public ShaderDebugTrace DebugThread(UInt32[] groupid, UInt32[] threadid) - { - IntPtr mem = CustomMarshal.Alloc(typeof(ShaderDebugTrace)); - - ReplayRenderer_DebugThread(m_Real, groupid, threadid, mem); - - ShaderDebugTrace ret = (ShaderDebugTrace)CustomMarshal.PtrToStructure(mem, typeof(ShaderDebugTrace), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public EventUsage[] GetUsage(ResourceId id) - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - ReplayRenderer_GetUsage(m_Real, id, mem); - - EventUsage[] ret = (EventUsage[])CustomMarshal.GetTemplatedArray(mem, typeof(EventUsage), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public ShaderVariable[] GetCBufferVariableContents(ResourceId shader, string entryPoint, UInt32 cbufslot, ResourceId buffer, UInt64 offs) - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - IntPtr entry_mem = CustomMarshal.MakeUTF8String(entryPoint); - - ReplayRenderer_GetCBufferVariableContents(m_Real, shader, entry_mem, cbufslot, buffer, offs, mem); - - ShaderVariable[] ret = (ShaderVariable[])CustomMarshal.GetTemplatedArray(mem, typeof(ShaderVariable), true); - - CustomMarshal.Free(entry_mem); - CustomMarshal.Free(mem); - - return ret; - } - - public bool SaveTexture(TextureSave saveData, string path) - { - IntPtr path_mem = CustomMarshal.MakeUTF8String(path); - - bool ret = ReplayRenderer_SaveTexture(m_Real, saveData, path_mem); - - CustomMarshal.Free(path_mem); - - return ret; - } - - public MeshFormat GetPostVSData(UInt32 instID, MeshDataStage stage) - { - IntPtr mem = CustomMarshal.Alloc(typeof(MeshFormat)); - - ReplayRenderer_GetPostVSData(m_Real, instID, stage, mem); - - MeshFormat ret = (MeshFormat)CustomMarshal.PtrToStructure(mem, typeof(MeshFormat), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public byte[] GetBufferData(ResourceId buff, UInt64 offset, UInt64 len) - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - ReplayRenderer_GetBufferData(m_Real, buff, offset, len, mem); - - byte[] ret = (byte[])CustomMarshal.GetTemplatedArray(mem, typeof(byte), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public byte[] GetTextureData(ResourceId tex, UInt32 arrayIdx, UInt32 mip) - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - ReplayRenderer_GetTextureData(m_Real, tex, arrayIdx, mip, mem); - - byte[] ret = (byte[])CustomMarshal.GetTemplatedArray(mem, typeof(byte), true); - - CustomMarshal.Free(mem); - - return ret; - } - }; - - public class RemoteServer - { - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RemoteServer_ShutdownConnection(IntPtr real); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RemoteServer_ShutdownServerAndConnection(IntPtr real); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool RemoteServer_Ping(IntPtr real); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RemoteServer_LocalProxies(IntPtr real, IntPtr outlist); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RemoteServer_RemoteSupportedReplays(IntPtr real, IntPtr outlist); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RemoteServer_GetHomeFolder(IntPtr real, IntPtr outfolder); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RemoteServer_ListFolder(IntPtr real, IntPtr path, IntPtr outlist); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern UInt32 RemoteServer_ExecuteAndInject(IntPtr real, IntPtr app, IntPtr workingDir, IntPtr cmdLine, IntPtr env, CaptureOptions opts); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RemoteServer_TakeOwnershipCapture(IntPtr real, IntPtr filename); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RemoteServer_CopyCaptureToRemote(IntPtr real, IntPtr filename, ref float progress, IntPtr remotepath); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RemoteServer_CopyCaptureFromRemote(IntPtr real, IntPtr remotepath, IntPtr localpath, ref float progress); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern ReplayCreateStatus RemoteServer_OpenCapture(IntPtr real, UInt32 proxyid, IntPtr logfile, ref float progress, ref IntPtr rendPtr); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RemoteServer_CloseCapture(IntPtr real, IntPtr rendPtr); - - // static exports for lists of environment modifications - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr RENDERDOC_MakeEnvironmentModificationList(int numElems); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_SetEnvironmentModification(IntPtr mem, int idx, IntPtr variable, IntPtr value, - EnvironmentModificationType type, EnvironmentSeparator separator); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_FreeEnvironmentModificationList(IntPtr mem); - - private IntPtr m_Real = IntPtr.Zero; - - public RemoteServer(IntPtr real) { m_Real = real; } - - public void ShutdownConnection() - { - if (m_Real != IntPtr.Zero) - { - RemoteServer_ShutdownConnection(m_Real); - m_Real = IntPtr.Zero; - } - } - - public void ShutdownServerAndConnection() - { - if (m_Real != IntPtr.Zero) - { - RemoteServer_ShutdownServerAndConnection(m_Real); - m_Real = IntPtr.Zero; - } - } - - public string GetHomeFolder() - { - IntPtr homepath_mem = CustomMarshal.Alloc(typeof(templated_array)); - - RemoteServer_GetHomeFolder(m_Real, homepath_mem); - - string home = CustomMarshal.TemplatedArrayToString(homepath_mem, true); - - CustomMarshal.Free(homepath_mem); - - // normalise to /s and with no trailing /s - home = home.Replace('\\', '/'); - if (home[home.Length - 1] == '/') - home = home.Remove(0, home.Length - 1); - - return home; - } - - public DirectoryFile[] ListFolder(string path) - { - IntPtr path_mem = CustomMarshal.MakeUTF8String(path); - IntPtr out_mem = CustomMarshal.Alloc(typeof(templated_array)); - - RemoteServer_ListFolder(m_Real, path_mem, out_mem); - - DirectoryFile[] ret = (DirectoryFile[])CustomMarshal.GetTemplatedArray(out_mem, typeof(DirectoryFile), true); - - CustomMarshal.Free(out_mem); - CustomMarshal.Free(path_mem); - - Array.Sort(ret); - - return ret; - } - - public bool Ping() - { - return RemoteServer_Ping(m_Real); - } - - public string[] LocalProxies() - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - RemoteServer_LocalProxies(m_Real, mem); - - string[] ret = CustomMarshal.TemplatedArrayToStringArray(mem, true); - - CustomMarshal.Free(mem); - - return ret; - } - - public string[] RemoteSupportedReplays() - { - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - RemoteServer_RemoteSupportedReplays(m_Real, mem); - - string[] ret = CustomMarshal.TemplatedArrayToStringArray(mem, true); - - CustomMarshal.Free(mem); - - return ret; - } - - public UInt32 ExecuteAndInject(string app, string workingDir, string cmdLine, EnvironmentModification[] env, CaptureOptions opts) - { - IntPtr app_mem = CustomMarshal.MakeUTF8String(app); - IntPtr workingDir_mem = CustomMarshal.MakeUTF8String(workingDir); - IntPtr cmdLine_mem = CustomMarshal.MakeUTF8String(cmdLine); - - IntPtr env_mem = RENDERDOC_MakeEnvironmentModificationList(env.Length); - - for (int i = 0; i < env.Length; i++) - { - IntPtr var_mem = CustomMarshal.MakeUTF8String(env[i].variable); - IntPtr val_mem = CustomMarshal.MakeUTF8String(env[i].value); - - RENDERDOC_SetEnvironmentModification(env_mem, i, var_mem, val_mem, env[i].type, env[i].separator); - - CustomMarshal.Free(var_mem); - CustomMarshal.Free(val_mem); - } - - UInt32 ret = RemoteServer_ExecuteAndInject(m_Real, app_mem, workingDir_mem, cmdLine_mem, env_mem, opts); - - RENDERDOC_FreeEnvironmentModificationList(env_mem); - - CustomMarshal.Free(app_mem); - CustomMarshal.Free(workingDir_mem); - CustomMarshal.Free(cmdLine_mem); - - return ret; - } - - public void TakeOwnershipCapture(string filename) - { - IntPtr filename_mem = CustomMarshal.MakeUTF8String(filename); - - RemoteServer_TakeOwnershipCapture(m_Real, filename_mem); - - CustomMarshal.Free(filename_mem); - } - - public string CopyCaptureToRemote(string filename, ref float progress) - { - IntPtr remotepath = CustomMarshal.Alloc(typeof(templated_array)); - - IntPtr filename_mem = CustomMarshal.MakeUTF8String(filename); - - RemoteServer_CopyCaptureToRemote(m_Real, filename_mem, ref progress, remotepath); - - CustomMarshal.Free(filename_mem); - - string remote = CustomMarshal.TemplatedArrayToString(remotepath, true); - - CustomMarshal.Free(remotepath); - - return remote; - } - - public void CopyCaptureFromRemote(string remotepath, string localpath, ref float progress) - { - IntPtr remotepath_mem = CustomMarshal.MakeUTF8String(remotepath); - IntPtr localpath_mem = CustomMarshal.MakeUTF8String(localpath); - - RemoteServer_CopyCaptureFromRemote(m_Real, remotepath_mem, localpath_mem, ref progress); - - CustomMarshal.Free(remotepath_mem); - CustomMarshal.Free(localpath_mem); - } - - public ReplayRenderer OpenCapture(int proxyid, string logfile, ref float progress) - { - IntPtr rendPtr = IntPtr.Zero; - - IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile); - - ReplayCreateStatus ret = RemoteServer_OpenCapture(m_Real, proxyid == -1 ? UInt32.MaxValue : (UInt32)proxyid, logfile_mem, ref progress, ref rendPtr); - - CustomMarshal.Free(logfile_mem); - - if (rendPtr == IntPtr.Zero || ret != ReplayCreateStatus.Success) - { - throw new ReplayCreateException(ret, "Failed to set up local proxy replay with remote connection"); - } - - return new ReplayRenderer(rendPtr); - } - - public void CloseCapture(ReplayRenderer renderer) - { - RemoteServer_CloseCapture(m_Real, renderer.Real); - } - }; - - public class TargetControl - { - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void TargetControl_Shutdown(IntPtr real); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr TargetControl_GetTarget(IntPtr real); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr TargetControl_GetAPI(IntPtr real); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern UInt32 TargetControl_GetPID(IntPtr real); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr TargetControl_GetBusyClient(IntPtr real); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void TargetControl_TriggerCapture(IntPtr real, UInt32 numFrames); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void TargetControl_QueueCapture(IntPtr real, UInt32 frameNumber); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void TargetControl_CopyCapture(IntPtr real, UInt32 remoteID, IntPtr localpath); - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void TargetControl_DeleteCapture(IntPtr real, UInt32 remoteID); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void TargetControl_ReceiveMessage(IntPtr real, IntPtr outmsg); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern UInt32 RENDERDOC_EnumerateRemoteConnections(IntPtr host, UInt32[] idents); - - private IntPtr m_Real = IntPtr.Zero; - private bool m_Connected; - - public TargetControl(IntPtr real) - { - m_Real = real; - - if (real == IntPtr.Zero) - { - m_Connected = false; - Target = ""; - API = ""; - BusyClient = ""; - } - else - { - m_Connected = true; - Target = CustomMarshal.PtrToStringUTF8(TargetControl_GetTarget(m_Real)); - API = CustomMarshal.PtrToStringUTF8(TargetControl_GetAPI(m_Real)); - PID = TargetControl_GetPID(m_Real); - BusyClient = CustomMarshal.PtrToStringUTF8(TargetControl_GetBusyClient(m_Real)); - } - - CaptureExists = false; - CaptureCopied = false; - InfoUpdated = false; - } - - public static UInt32[] GetRemoteIdents(string host) - { - UInt32 numIdents = RENDERDOC_EnumerateRemoteConnections(IntPtr.Zero, null); - - UInt32[] idents = new UInt32[numIdents]; - - IntPtr host_mem = CustomMarshal.MakeUTF8String(host); - - RENDERDOC_EnumerateRemoteConnections(host_mem, idents); - - CustomMarshal.Free(host_mem); - - return idents; - } - - public bool Connected { get { return m_Connected; } } - - public void Shutdown() - { - m_Connected = false; - if (m_Real != IntPtr.Zero) TargetControl_Shutdown(m_Real); - m_Real = IntPtr.Zero; - } - - public void TriggerCapture(UInt32 numFrames) - { - TargetControl_TriggerCapture(m_Real, numFrames); - } - - public void QueueCapture(UInt32 frameNum) - { - TargetControl_QueueCapture(m_Real, frameNum); - } - - public void CopyCapture(UInt32 id, string localpath) - { - IntPtr localpath_mem = CustomMarshal.MakeUTF8String(localpath); - - TargetControl_CopyCapture(m_Real, id, localpath_mem); - - CustomMarshal.Free(localpath_mem); - } - - public void DeleteCapture(UInt32 id) - { - TargetControl_DeleteCapture(m_Real, id); - } - - public void ReceiveMessage() - { - if (m_Real != IntPtr.Zero) - { - TargetControlMessage msg = null; - - { - IntPtr mem = CustomMarshal.Alloc(typeof(TargetControlMessage)); - - TargetControl_ReceiveMessage(m_Real, mem); - - if (mem != IntPtr.Zero) - msg = (TargetControlMessage)CustomMarshal.PtrToStructure(mem, typeof(TargetControlMessage), true); - - CustomMarshal.Free(mem); - } - - if (msg == null) - return; - - if (msg.Type == TargetControlMessageType.Disconnected) - { - m_Connected = false; - TargetControl_Shutdown(m_Real); - m_Real = IntPtr.Zero; - } - else if (msg.Type == TargetControlMessageType.NewCapture) - { - CaptureFile = msg.NewCapture; - CaptureExists = true; - } - else if (msg.Type == TargetControlMessageType.CaptureCopied) - { - CaptureFile.ID = msg.NewCapture.ID; - CaptureFile.path = msg.NewCapture.path; - CaptureCopied = true; - } - else if (msg.Type == TargetControlMessageType.RegisterAPI) - { - API = msg.RegisterAPI.APIName; - InfoUpdated = true; - } - else if (msg.Type == TargetControlMessageType.NewChild) - { - NewChild = msg.NewChild; - ChildAdded = true; - } - } - } - - public string BusyClient; - public string Target; - public string API; - public UInt32 PID; - - public bool CaptureExists; - public bool ChildAdded; - public bool CaptureCopied; - public bool InfoUpdated; - - public TargetControlMessage.NewCaptureData CaptureFile = new TargetControlMessage.NewCaptureData(); - - public TargetControlMessage.NewChildData NewChild = new TargetControlMessage.NewChildData(); - }; -}; diff --git a/renderdocui/Interop/Shader.cs b/renderdocui/Interop/Shader.cs deleted file mode 100644 index 823b63137..000000000 --- a/renderdocui/Interop/Shader.cs +++ /dev/null @@ -1,516 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Runtime.InteropServices; - -namespace renderdoc -{ - [StructLayout(LayoutKind.Sequential)] - public class ShaderVariable - { - public UInt32 rows, columns; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string name; - - public VarType type; - - public bool displayAsHex; - - [StructLayout(LayoutKind.Sequential)] - public struct ValueUnion - { - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 16, FixedType = CustomFixedType.UInt32)] - public UInt32[] uv; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 16, FixedType = CustomFixedType.Float)] - public float[] fv; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 16, FixedType = CustomFixedType.Int32)] - public Int32[] iv; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 16, FixedType = CustomFixedType.Double)] - public double[] dv; - }; - - [CustomMarshalAs(CustomUnmanagedType.Union)] - public ValueUnion value; - - public bool isStruct; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderVariable[] members; - - public override string ToString() - { - if (members.Length > 0) - return ""; - if (rows == 1) return Row(0); - - string ret = ""; - for (int i = 0; i < (int)rows; i++) - { - if (i > 0) ret += ", "; - ret += "{" + Row(i) + "}"; - } - - return "{ " + ret + " }"; - } - - public string RowTypeString() - { - if (members.Length > 0) - { - if (isStruct) - return "struct"; - else - return "flibbertygibbet"; - } - - if (rows == 0 && columns == 0) - return "-"; - - string typeStr = type.Str(); - - if(displayAsHex && type == VarType.UInt) - typeStr = "xint"; - - if (columns == 1) - return typeStr; - - return String.Format("{0}{1}", typeStr, columns); - } - - public string TypeString() - { - if (members.Length > 0) - { - if (isStruct) - return "struct"; - else - return String.Format("{0}[{1}]", members[0].TypeString(), members.Length); - } - - string typeStr = type.Str(); - - if (displayAsHex && type == VarType.UInt) - typeStr = "xint"; - - if (rows == 1 && columns == 1) return typeStr; - if (rows == 1) return String.Format("{0}{1}", typeStr, columns); - else return String.Format("{0}{1}x{2}", typeStr, rows, columns); - } - - public string RowValuesToString(int cols, double x, double y, double z, double w) - { - if (cols == 1) return Formatter.Format(x); - else if (cols == 2) return Formatter.Format(x) + ", " + Formatter.Format(y); - else if (cols == 3) return Formatter.Format(x) + ", " + Formatter.Format(y) + ", " + Formatter.Format(z); - else return Formatter.Format(x) + ", " + Formatter.Format(y) + ", " + Formatter.Format(z) + ", " + Formatter.Format(w); - } - - public string RowValuesToString(int cols, float x, float y, float z, float w) - { - if (cols == 1) return Formatter.Format(x); - else if (cols == 2) return Formatter.Format(x) + ", " + Formatter.Format(y); - else if (cols == 3) return Formatter.Format(x) + ", " + Formatter.Format(y) + ", " + Formatter.Format(z); - else return Formatter.Format(x) + ", " + Formatter.Format(y) + ", " + Formatter.Format(z) + ", " + Formatter.Format(w); - } - - public string RowValuesToString(int cols, UInt32 x, UInt32 y, UInt32 z, UInt32 w) - { - if (cols == 1) return Formatter.Format(x, displayAsHex); - else if (cols == 2) return Formatter.Format(x, displayAsHex) + ", " + Formatter.Format(y, displayAsHex); - else if (cols == 3) return Formatter.Format(x, displayAsHex) + ", " + Formatter.Format(y, displayAsHex) + ", " + Formatter.Format(z, displayAsHex); - else return Formatter.Format(x, displayAsHex) + ", " + Formatter.Format(y, displayAsHex) + ", " + Formatter.Format(z, displayAsHex) + ", " + Formatter.Format(w, displayAsHex); - } - - public string RowValuesToString(int cols, Int32 x, Int32 y, Int32 z, Int32 w) - { - if (cols == 1) return Formatter.Format(x); - else if (cols == 2) return Formatter.Format(x) + ", " + Formatter.Format(y); - else if (cols == 3) return Formatter.Format(x) + ", " + Formatter.Format(y) + ", " + Formatter.Format(z); - else return Formatter.Format(x) + ", " + Formatter.Format(y) + ", " + Formatter.Format(z) + ", " + Formatter.Format(w); - } - - public string Row(int row, VarType t) - { - if(t == VarType.Double) - return RowValuesToString((int)columns, value.dv[row * columns + 0], value.dv[row * columns + 1], value.dv[row * columns + 2], value.dv[row * columns + 3]); - else if(t == VarType.Int) - return RowValuesToString((int)columns, value.iv[row * columns + 0], value.iv[row * columns + 1], value.iv[row * columns + 2], value.iv[row * columns + 3]); - else if(t == VarType.UInt) - return RowValuesToString((int)columns, value.uv[row * columns + 0], value.uv[row * columns + 1], value.uv[row * columns + 2], value.uv[row * columns + 3]); - else - return RowValuesToString((int)columns, value.fv[row * columns + 0], value.fv[row * columns + 1], value.fv[row * columns + 2], value.fv[row * columns + 3]); - } - - public string Row(int row) - { - return Row(row, type); - } - }; - - [StructLayout(LayoutKind.Sequential)] - public class ShaderDebugState - { - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderVariable[] registers; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderVariable[] outputs; - - [StructLayout(LayoutKind.Sequential)] - public struct IndexableTempArray - { - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderVariable[] temps; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public IndexableTempArray[] indexableTemps; - - public UInt32 nextInstruction; - public ShaderDebugStateFlags flags; - }; - - [StructLayout(LayoutKind.Sequential)] - public class ShaderDebugTrace - { - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderVariable[] inputs; - - [StructLayout(LayoutKind.Sequential)] - public struct CBuffer - { - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderVariable[] variables; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public CBuffer[] cbuffers; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderDebugState[] states; - }; - - [StructLayout(LayoutKind.Sequential)] - public class SigParameter - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string varName; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string semanticName; - - public UInt32 semanticIndex; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string semanticIdxName; - - public bool needSemanticIndex; - - public UInt32 regIndex; - public SystemAttribute systemValue; - - public FormatComponentType compType; - - public byte regChannelMask; - public byte channelUsedMask; - public UInt32 compCount; - public UInt32 stream; - - public UInt32 arrayIndex; - - public string TypeString - { - get - { - string ret = ""; - - if (compType == FormatComponentType.Float) - ret += "float"; - else if (compType == FormatComponentType.UInt || compType == FormatComponentType.UScaled) - ret += "uint"; - else if (compType == FormatComponentType.SInt || compType == FormatComponentType.SScaled) - ret += "int"; - else if (compType == FormatComponentType.UNorm) - ret += "unorm float"; - else if (compType == FormatComponentType.SNorm) - ret += "snorm float"; - else if (compType == FormatComponentType.Depth) - ret += "float"; - - if (compCount > 1) - ret += compCount; - - return ret; - } - } - - public string D3DSemanticString - { - get - { - if (systemValue == SystemAttribute.None) - return semanticIdxName; - - string ret = systemValue.Str(); - - // need to include the index if it's a system value semantic that's numbered - if (systemValue == SystemAttribute.ColourOutput || - systemValue == SystemAttribute.CullDistance || - systemValue == SystemAttribute.ClipDistance) - ret += semanticIndex; - - return ret; - } - } - - public static string GetComponentString(byte mask) - { - string ret = ""; - - if ((mask & 0x1) > 0) ret += "R"; - if ((mask & 0x2) > 0) ret += "G"; - if ((mask & 0x4) > 0) ret += "B"; - if ((mask & 0x8) > 0) ret += "A"; - - return ret; - } - }; - - [StructLayout(LayoutKind.Sequential)] - public class ShaderVariableType - { - [StructLayout(LayoutKind.Sequential)] - public struct ShaderVarDescriptor - { - public VarType type; - public UInt32 rows; - public UInt32 cols; - public UInt32 elements; - public bool rowMajorStorage; - public UInt32 arrayStride; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string name; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderVarDescriptor descriptor; - - public string Name { get { return descriptor.name; } } - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderConstant[] members; - }; - - [StructLayout(LayoutKind.Sequential)] - public class ShaderConstant - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string name; - - [StructLayout(LayoutKind.Sequential)] - public struct RegSpan - { - public UInt32 vec; - public UInt32 comp; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public RegSpan reg; - - public UInt64 defaultValue; - - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderVariableType type; - }; - - [StructLayout(LayoutKind.Sequential)] - public class ConstantBlock - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string name; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderConstant[] variables; - - public bool bufferBacked; - public Int32 bindPoint; - public UInt32 byteSize; - }; - - [StructLayout(LayoutKind.Sequential)] - public class ShaderResource - { - public bool IsSampler; - public bool IsTexture; - public bool IsSRV; - - public ShaderResourceType resType; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string name; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderVariableType variableType; - public Int32 bindPoint; - }; - - [StructLayout(LayoutKind.Sequential)] - public class ShaderDebugChunk - { - public UInt32 compileFlags; - - public struct DebugFile - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - private string filename_; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string filetext; - - public string FullFilename - { - get - { - return filename_; - } - } - - // get filename handling possibly invalid characters - public string BaseFilename - { - get - { - return renderdocui.Code.Helpers.SafeGetFileName(filename_); - } - set - { - filename_ = value; - } - } - }; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public DebugFile[] files; - }; - - [StructLayout(LayoutKind.Sequential)] - public class ShaderReflection - { - public ResourceId ID; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string EntryPoint; - - [CustomMarshalAs(CustomUnmanagedType.Skip)] - public IntPtr origPtr; - - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderDebugChunk DebugInfo; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public byte[] RawBytes; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 3)] - public UInt32[] DispatchThreadsDimension; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public SigParameter[] InputSig; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public SigParameter[] OutputSig; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ConstantBlock[] ConstantBlocks; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderResource[] ReadOnlyResources; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ShaderResource[] ReadWriteResources; - - [StructLayout(LayoutKind.Sequential)] - public struct Interface - { - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string Name; - }; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Interface[] Interfaces; - }; - - [StructLayout(LayoutKind.Sequential)] - public class BindpointMap - { - public Int32 bindset; - public Int32 bind; - public bool used; - public UInt32 arraySize; - - public BindpointMap() - { - } - - public BindpointMap(Int32 set, Int32 slot) - { - bindset = set; - bind = slot; - used = false; - arraySize = 1; - } - - public override bool Equals(Object obj) - { - return obj is BindpointMap && this == (BindpointMap)obj; - } - public override int GetHashCode() - { - int hash = bindset.GetHashCode() * 17; - hash = hash * 17 + bind.GetHashCode(); - return hash; - } - public static bool operator ==(BindpointMap x, BindpointMap y) - { - if ((object)x == null) return (object)y == null; - if ((object)y == null) return (object)x == null; - - return x.bindset == y.bindset && - x.bind == y.bind; - } - public static bool operator !=(BindpointMap x, BindpointMap y) - { - return !(x == y); - } - }; - - [StructLayout(LayoutKind.Sequential)] - public class ShaderBindpointMapping - { - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public int[] InputAttributes; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public BindpointMap[] ConstantBlocks; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public BindpointMap[] ReadOnlyResources; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public BindpointMap[] ReadWriteResources; - }; -}; diff --git a/renderdocui/Interop/StaticExports.cs b/renderdocui/Interop/StaticExports.cs deleted file mode 100644 index c6fe4827d..000000000 --- a/renderdocui/Interop/StaticExports.cs +++ /dev/null @@ -1,440 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -using System; -using System.Runtime.InteropServices; -using System.Text; - -namespace renderdoc -{ - public class ReplayCreateException : Exception - { - public ReplayCreateException(ReplayCreateStatus status) - : base(String.Format("Replay creation failure: {0}", status.Str())) - { - Status = status; - } - - public ReplayCreateException(ReplayCreateStatus status, string msg) - : base(msg) - { - Status = status; - } - - public ReplayCreateStatus Status; - } - - public class StaticExports - { - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern ReplaySupport RENDERDOC_SupportLocalReplay(IntPtr logfile, IntPtr outdriver, IntPtr outident); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern ReplayCreateStatus RENDERDOC_CreateReplayRenderer(IntPtr logfile, ref float progress, ref IntPtr rendPtr); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool RENDERDOC_StartGlobalHook(IntPtr pathmatch, IntPtr logfile, CaptureOptions opts); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool RENDERDOC_IsGlobalHookActive(); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_StopGlobalHook(); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern UInt32 RENDERDOC_ExecuteAndInject(IntPtr app, IntPtr workingDir, IntPtr cmdLine, IntPtr env, - IntPtr logfile, CaptureOptions opts, bool waitForExit); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern UInt32 RENDERDOC_InjectIntoProcess(UInt32 pid, IntPtr env, IntPtr logfile, CaptureOptions opts, bool waitForExit); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr RENDERDOC_CreateTargetControl(IntPtr host, UInt32 ident, IntPtr clientName, bool forceConnection); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern UInt32 RENDERDOC_EnumerateRemoteTargets(IntPtr host, UInt32 nextIdent); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern ReplayCreateStatus RENDERDOC_CreateRemoteServerConnection(IntPtr host, UInt32 port, ref IntPtr outrend); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_GetDefaultCaptureOptions(IntPtr outopts); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_BecomeRemoteServer(IntPtr host, UInt32 port, ref bool killReplay); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_TriggerExceptionHandler(IntPtr exceptionPtrs, bool crashed); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_LogText(IntPtr text); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr RENDERDOC_GetLogFile(); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr RENDERDOC_GetConfigSetting(IntPtr name); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr RENDERDOC_GetVersionString(); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_SetConfigSetting(IntPtr name, IntPtr value); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool RENDERDOC_GetThumbnail(IntPtr filename, FileType type, UInt32 maxsize, IntPtr outmem); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr RENDERDOC_MakeEnvironmentModificationList(int numElems); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_SetEnvironmentModification(IntPtr mem, int idx, IntPtr variable, IntPtr value, - EnvironmentModificationType type, EnvironmentSeparator separator); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_FreeEnvironmentModificationList(IntPtr mem); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern ReplaySupport RENDERDOC_EnumerateAndroidDevices(IntPtr driverName); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern ReplaySupport RENDERDOC_StartAndroidRemoteServer(IntPtr device); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_StartSelfHostCapture(IntPtr dllname); - - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern void RENDERDOC_EndSelfHostCapture(IntPtr dllname); - - public static void StartSelfHostCapture(string dllname) - { - IntPtr mem = CustomMarshal.MakeUTF8String(dllname); - - RENDERDOC_StartSelfHostCapture(mem); - - CustomMarshal.Free(mem); - } - - public static void EndSelfHostCapture(string dllname) - { - IntPtr mem = CustomMarshal.MakeUTF8String(dllname); - - RENDERDOC_EndSelfHostCapture(mem); - - CustomMarshal.Free(mem); - } - - public static ReplaySupport SupportLocalReplay(string logfile, out string driverName, out string recordMachineIdent) - { - IntPtr name_mem = CustomMarshal.Alloc(typeof(templated_array)); - IntPtr ident_mem = CustomMarshal.Alloc(typeof(templated_array)); - - IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile); - - ReplaySupport ret = RENDERDOC_SupportLocalReplay(logfile_mem, name_mem, ident_mem); - - CustomMarshal.Free(logfile_mem); - - driverName = CustomMarshal.TemplatedArrayToString(name_mem, true); - recordMachineIdent = CustomMarshal.TemplatedArrayToString(ident_mem, true); - - CustomMarshal.Free(name_mem); - CustomMarshal.Free(ident_mem); - - return ret; - } - - public static ReplayRenderer CreateReplayRenderer(string logfile, ref float progress) - { - IntPtr rendPtr = IntPtr.Zero; - - IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile); - - ReplayCreateStatus ret = RENDERDOC_CreateReplayRenderer(logfile_mem, ref progress, ref rendPtr); - - CustomMarshal.Free(logfile_mem); - - if (rendPtr == IntPtr.Zero || ret != ReplayCreateStatus.Success) - { - throw new ReplayCreateException(ret, "Failed to load log for local replay"); - } - - return new ReplayRenderer(rendPtr); - } - - public static bool StartGlobalHook(string pathmatch, string logfile, CaptureOptions opts) - { - IntPtr pathmatch_mem = CustomMarshal.MakeUTF8String(pathmatch); - IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile); - - bool ret = RENDERDOC_StartGlobalHook(pathmatch_mem, logfile_mem, opts); - - CustomMarshal.Free(logfile_mem); - CustomMarshal.Free(pathmatch_mem); - - return ret; - } - - public static bool IsGlobalHookActive() - { - return RENDERDOC_IsGlobalHookActive(); - } - - public static void StopGlobalHook() - { - RENDERDOC_StopGlobalHook(); - } - - public static UInt32 ExecuteAndInject(string app, string workingDir, string cmdLine, EnvironmentModification[] env, string logfile, CaptureOptions opts) - { - IntPtr app_mem = CustomMarshal.MakeUTF8String(app); - IntPtr workingDir_mem = CustomMarshal.MakeUTF8String(workingDir); - IntPtr cmdLine_mem = CustomMarshal.MakeUTF8String(cmdLine); - IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile); - - IntPtr env_mem = RENDERDOC_MakeEnvironmentModificationList(env.Length); - - for(int i=0; i < env.Length; i++) - { - IntPtr var_mem = CustomMarshal.MakeUTF8String(env[i].variable); - IntPtr val_mem = CustomMarshal.MakeUTF8String(env[i].value); - - RENDERDOC_SetEnvironmentModification(env_mem, i, var_mem, val_mem, env[i].type, env[i].separator); - - CustomMarshal.Free(var_mem); - CustomMarshal.Free(val_mem); - } - - UInt32 ret = RENDERDOC_ExecuteAndInject(app_mem, workingDir_mem, cmdLine_mem, env_mem, logfile_mem, opts, false); - - RENDERDOC_FreeEnvironmentModificationList(env_mem); - - CustomMarshal.Free(app_mem); - CustomMarshal.Free(workingDir_mem); - CustomMarshal.Free(cmdLine_mem); - CustomMarshal.Free(logfile_mem); - - return ret; - } - - public static UInt32 InjectIntoProcess(UInt32 pid, EnvironmentModification[] env, string logfile, CaptureOptions opts) - { - IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile); - - IntPtr env_mem = RENDERDOC_MakeEnvironmentModificationList(env.Length); - - for (int i = 0; i < env.Length; i++) - { - IntPtr var_mem = CustomMarshal.MakeUTF8String(env[i].variable); - IntPtr val_mem = CustomMarshal.MakeUTF8String(env[i].value); - - RENDERDOC_SetEnvironmentModification(env_mem, i, var_mem, val_mem, env[i].type, env[i].separator); - - CustomMarshal.Free(var_mem); - CustomMarshal.Free(val_mem); - } - - UInt32 ret = RENDERDOC_InjectIntoProcess(pid, env_mem, logfile_mem, opts, false); - - RENDERDOC_FreeEnvironmentModificationList(env_mem); - - CustomMarshal.Free(logfile_mem); - - return ret; - } - - public static TargetControl CreateTargetControl(string host, UInt32 ident, string clientName, bool forceConnection) - { - IntPtr host_mem = CustomMarshal.MakeUTF8String(host); - IntPtr clientName_mem = CustomMarshal.MakeUTF8String(clientName); - - IntPtr rendPtr = RENDERDOC_CreateTargetControl(host_mem, ident, clientName_mem, forceConnection); - - CustomMarshal.Free(host_mem); - CustomMarshal.Free(clientName_mem); - - if (rendPtr == IntPtr.Zero) - { - throw new ReplayCreateException(ReplayCreateStatus.NetworkIOFailed, "Failed to open remote access connection"); - } - - return new TargetControl(rendPtr); - } - - public delegate void RemoteConnectionFound(UInt32 ident); - - public static void EnumerateRemoteTargets(string host, RemoteConnectionFound callback) - { - IntPtr host_mem = CustomMarshal.MakeUTF8String(host); - - UInt32 nextIdent = 0; - - while (true) - { - // just a sanity check to make sure we don't hit some unexpected case - UInt32 prevIdent = nextIdent; - - nextIdent = RENDERDOC_EnumerateRemoteTargets(host_mem, nextIdent); - - if (nextIdent == 0 || prevIdent >= nextIdent) - break; - - callback(nextIdent); - } - - CustomMarshal.Free(host_mem); - } - - public static RemoteServer CreateRemoteServer(string host, uint port) - { - IntPtr rendPtr = IntPtr.Zero; - - IntPtr host_mem = CustomMarshal.MakeUTF8String(host); - - ReplayCreateStatus ret = RENDERDOC_CreateRemoteServerConnection(host_mem, port, ref rendPtr); - - CustomMarshal.Free(host_mem); - - if (rendPtr == IntPtr.Zero || ret != ReplayCreateStatus.Success) - { - throw new ReplayCreateException(ret, "Failed to connect to remote replay host"); - } - - return new RemoteServer(rendPtr); - } - - public static void BecomeRemoteServer(string host, uint port, ref bool killReplay) - { - IntPtr host_mem = CustomMarshal.MakeUTF8String(host); - - RENDERDOC_BecomeRemoteServer(host_mem, port, ref killReplay); - - CustomMarshal.Free(host_mem); - } - - public static void TriggerExceptionHandler(IntPtr exceptionPtrs, bool crashed) - { - RENDERDOC_TriggerExceptionHandler(exceptionPtrs, crashed); - } - - public static void LogText(string text) - { - IntPtr text_mem = CustomMarshal.MakeUTF8String(text); - - RENDERDOC_LogText(text_mem); - - CustomMarshal.Free(text_mem); - } - - public static string GetLogFilename() - { - return CustomMarshal.PtrToStringUTF8(RENDERDOC_GetLogFile()); - } - - public static string GetVersionString() - { - return CustomMarshal.PtrToStringUTF8(RENDERDOC_GetVersionString()); - } - - public static string GetConfigSetting(string name) - { - IntPtr name_mem = CustomMarshal.MakeUTF8String(name); - - string ret = CustomMarshal.PtrToStringUTF8(RENDERDOC_GetConfigSetting(name_mem)); - - CustomMarshal.Free(name_mem); - - return ret; - } - - public static void SetConfigSetting(string name, string value) - { - IntPtr name_mem = CustomMarshal.MakeUTF8String(name); - IntPtr value_mem = CustomMarshal.MakeUTF8String(value); - - RENDERDOC_SetConfigSetting(name_mem, value_mem); - - CustomMarshal.Free(name_mem); - CustomMarshal.Free(value_mem); - } - - public static byte[] GetThumbnail(string filename, FileType type, UInt32 maxsize) - { - UInt32 len = 0; - - IntPtr filename_mem = CustomMarshal.MakeUTF8String(filename); - - IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - - bool success = RENDERDOC_GetThumbnail(filename_mem, type, maxsize, mem); - - if (!success || len == 0) - { - CustomMarshal.Free(filename_mem); - return null; - } - - byte[] ret = (byte[])CustomMarshal.GetTemplatedArray(mem, typeof(byte), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public static CaptureOptions GetDefaultCaptureOptions() - { - IntPtr mem = CustomMarshal.Alloc(typeof(CaptureOptions)); - - RENDERDOC_GetDefaultCaptureOptions(mem); - - CaptureOptions ret = (CaptureOptions)CustomMarshal.PtrToStructure(mem, typeof(CaptureOptions), true); - - CustomMarshal.Free(mem); - - return ret; - } - - public static string[] EnumerateAndroidDevices() - { - IntPtr driverListInt = CustomMarshal.Alloc(typeof(templated_array)); - - RENDERDOC_EnumerateAndroidDevices(driverListInt); - - string driverList = CustomMarshal.TemplatedArrayToString(driverListInt, true); - CustomMarshal.Free(driverListInt); - - return driverList.Split(new char[]{','}, StringSplitOptions.RemoveEmptyEntries); - } - - public static void StartAndroidRemoteServer(string device) - { - IntPtr device_mem = CustomMarshal.MakeUTF8String(device); - - RENDERDOC_StartAndroidRemoteServer(device_mem); - - CustomMarshal.Free(device_mem); - } - } -} diff --git a/renderdocui/Interop/VulkanPipelineState.cs b/renderdocui/Interop/VulkanPipelineState.cs deleted file mode 100644 index 7984a13a1..000000000 --- a/renderdocui/Interop/VulkanPipelineState.cs +++ /dev/null @@ -1,443 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * - * 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. - ******************************************************************************/ - -using System; -using System.Runtime.InteropServices; -using System.Collections.Generic; - -namespace renderdoc -{ - [StructLayout(LayoutKind.Sequential)] - public class VulkanPipelineState - { - [StructLayout(LayoutKind.Sequential)] - public class Pipeline - { - public ResourceId obj; - public UInt32 flags; - - [StructLayout(LayoutKind.Sequential)] - public class DescriptorSet - { - public ResourceId layout; - public ResourceId descset; - - [StructLayout(LayoutKind.Sequential)] - public class DescriptorBinding - { - public UInt32 descriptorCount; - public ShaderBindType type; - public ShaderStageBits stageFlags; - - [StructLayout(LayoutKind.Sequential)] - public class BindingElement - { - public ResourceId view; - public ResourceId res; - public ResourceId sampler; - public bool immutableSampler; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string SamplerName; - public bool customSamplerName; - - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ResourceFormat viewfmt; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public TextureSwizzle[] swizzle; - - public UInt32 baseMip; - public UInt32 baseLayer; - public UInt32 numMip; - public UInt32 numLayer; - - public UInt64 offset; - public UInt64 size; - - public TextureFilter Filter; - - public AddressMode addrU; - public AddressMode addrV; - public AddressMode addrW; - - public float mipBias; - public float maxAniso; - public CompareFunc comparison; - public float minlod, maxlod; - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public float[] BorderColor; - public bool unnormalized; - - public bool UseBorder() - { - return addrU == AddressMode.ClampBorder || - addrV == AddressMode.ClampBorder || - addrW == AddressMode.ClampBorder; - } - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public BindingElement[] binds; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public DescriptorBinding[] bindings; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public DescriptorSet[] DescSets; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Pipeline compute; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Pipeline graphics; - - [StructLayout(LayoutKind.Sequential)] - public class InputAssembly - { - public bool primitiveRestartEnable; - - [StructLayout(LayoutKind.Sequential)] - public class IndexBuffer - { - public ResourceId buf; - public UInt64 offs; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public IndexBuffer ibuffer; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public InputAssembly IA; - - [StructLayout(LayoutKind.Sequential)] - public class VertexInput - { - [StructLayout(LayoutKind.Sequential)] - public class Attribute - { - public UInt32 location; - public UInt32 binding; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ResourceFormat format; - public UInt32 byteoffset; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Attribute[] attrs; - - [StructLayout(LayoutKind.Sequential)] - public class Binding - { - public UInt32 vbufferBinding; - public UInt32 bytestride; - public bool perInstance; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Binding[] binds; - - [StructLayout(LayoutKind.Sequential)] - public class VertexBuffer - { - public ResourceId buffer; - public UInt64 offset; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public VertexBuffer[] vbuffers; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public VertexInput VI; - - [StructLayout(LayoutKind.Sequential)] - public class ShaderStage - { - private void PostMarshal() - { - if (_ptr_ShaderDetails != IntPtr.Zero) - { - ShaderDetails = (ShaderReflection)CustomMarshal.PtrToStructure(_ptr_ShaderDetails, typeof(ShaderReflection), false); - ShaderDetails.origPtr = _ptr_ShaderDetails; - } - else - { - ShaderDetails = null; - } - - _ptr_ShaderDetails = IntPtr.Zero; - } - - public ResourceId Shader; - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string entryPoint; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string ShaderName; - public bool customName; - private IntPtr _ptr_ShaderDetails; - [CustomMarshalAs(CustomUnmanagedType.Skip)] - public ShaderReflection ShaderDetails; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderBindpointMapping BindpointMapping; - - public ShaderStageType stage; - - [StructLayout(LayoutKind.Sequential)] - struct SpecInfo - { - public UInt32 specID; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public byte[] data; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - SpecInfo[] specialization; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ShaderStage m_VS, m_TCS, m_TES, m_GS, m_FS, m_CS; - - [StructLayout(LayoutKind.Sequential)] - public class Tessellation - { - public UInt32 numControlPoints; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Tessellation Tess; - - [StructLayout(LayoutKind.Sequential)] - public class ViewState - { - [StructLayout(LayoutKind.Sequential)] - public class ViewportScissor - { - [StructLayout(LayoutKind.Sequential)] - public class Viewport - { - public float x, y; - public float Width, Height; - public float MinDepth, MaxDepth; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Viewport vp; - - [StructLayout(LayoutKind.Sequential)] - public class Scissor - { - public Int32 x, y, width, height; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Scissor scissor; - }; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ViewportScissor[] viewportScissors; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ViewState VP; - - [StructLayout(LayoutKind.Sequential)] - public class Raster - { - public bool depthClampEnable; - public bool rasterizerDiscardEnable; - public bool FrontCCW; - public TriangleFillMode FillMode; - public TriangleCullMode CullMode; - - // from dynamic state - public float depthBias; - public float depthBiasClamp; - public float slopeScaledDepthBias; - public float lineWidth; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Raster RS; - - [StructLayout(LayoutKind.Sequential)] - public class MultiSample - { - public UInt32 rasterSamples; - public bool sampleShadingEnable; - public float minSampleShading; - public UInt32 sampleMask; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public MultiSample MSAA; - - [StructLayout(LayoutKind.Sequential)] - public class ColorBlend - { - public bool alphaToCoverageEnable; - public bool alphaToOneEnable; - public bool logicOpEnable; - - public LogicOp Logic; - - [StructLayout(LayoutKind.Sequential)] - public class Attachment - { - public bool blendEnable; - - [StructLayout(LayoutKind.Sequential)] - public class BlendEquation - { - public BlendMultiplier Source; - public BlendMultiplier Destination; - public BlendOp Operation; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public BlendEquation m_Blend, m_AlphaBlend; - - public byte WriteMask; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Attachment[] attachments; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public float[] blendConst; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ColorBlend CB; - - - [StructLayout(LayoutKind.Sequential)] - public class DepthStencil - { - public bool depthTestEnable; - public bool depthWriteEnable; - public bool depthBoundsEnable; - public CompareFunc depthCompareOp; - - public bool stencilTestEnable; - [StructLayout(LayoutKind.Sequential)] - public class StencilFace - { - public StencilOp FailOp; - public StencilOp DepthFailOp; - public StencilOp PassOp; - public CompareFunc Func; - - public UInt32 stencilref, compareMask, writeMask; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public StencilFace front, back; - - public float minDepthBounds; - public float maxDepthBounds; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public DepthStencil DS; - - [StructLayout(LayoutKind.Sequential)] - public class CurrentPass - { - [StructLayout(LayoutKind.Sequential)] - public class RenderPass - { - public ResourceId obj; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] inputAttachments; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] colorAttachments; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] resolveAttachments; - public Int32 depthstencilAttachment; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public RenderPass renderpass; - - [StructLayout(LayoutKind.Sequential)] - public class Framebuffer - { - public ResourceId obj; - - [StructLayout(LayoutKind.Sequential)] - public class Attachment - { - public ResourceId view; - public ResourceId img; - - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public ResourceFormat viewfmt; - - [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] - public TextureSwizzle[] swizzle; - - public UInt32 baseMip; - public UInt32 baseLayer; - public UInt32 numMip; - public UInt32 numLayer; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Attachment[] attachments; - - public UInt32 width, height, layers; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public Framebuffer framebuffer; - - [StructLayout(LayoutKind.Sequential)] - public class RenderArea - { - public Int32 x, y, width, height; - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public RenderArea renderArea; - - }; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - public CurrentPass Pass; - - [StructLayout(LayoutKind.Sequential)] - public class ImageData - { - public ResourceId image; - - [StructLayout(LayoutKind.Sequential)] - public class ImageLayout - { - public UInt32 baseMip; - public UInt32 baseLayer; - public UInt32 numMip; - public UInt32 numLayer; - - [CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)] - public string name; - }; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public ImageLayout[] layouts; - }; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - private ImageData[] images_; - - // add to dictionary for convenience - private void PostMarshal() - { - Images = new Dictionary(); - - foreach (ImageData i in images_) - Images.Add(i.image, i); - } - - [CustomMarshalAs(CustomUnmanagedType.Skip)] - public Dictionary Images; - }; -} diff --git a/renderdocui/Plugins/PluginHelpers.cs b/renderdocui/Plugins/PluginHelpers.cs deleted file mode 100644 index 39bbfcb7e..000000000 --- a/renderdocui/Plugins/PluginHelpers.cs +++ /dev/null @@ -1,92 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Reflection; - -namespace renderdocplugin -{ - class PluginHelpers - { - private static Dictionary m_LoadedPlugins = null; - - public static String PluginDirectory - { - get - { - var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - dir = Path.Combine(dir, "plugins"); - - return dir; - } - } - - public static List GetPlugins() - { - if (m_LoadedPlugins != null) - return new List(m_LoadedPlugins.Keys); - - m_LoadedPlugins = new Dictionary(); - - if(!Directory.Exists(PluginDirectory)) - return new List(); - - foreach (string pluginFile in Directory.EnumerateFiles(PluginDirectory, "*.dll")) - { - try - { - Assembly myDllAssembly = Assembly.LoadFile(pluginFile); - - var basename = Path.GetFileNameWithoutExtension(pluginFile); - - m_LoadedPlugins.Add(basename, myDllAssembly); - } - catch (Exception) - { - // silently ignore invalid/bad assemblies. - } - } - - return new List(m_LoadedPlugins.Keys); - } - - public static T GetPluginInterface(string assemblyName) - { - if (!m_LoadedPlugins.ContainsKey(assemblyName)) - return default(T); - - var type = typeof(T); - - var ass = m_LoadedPlugins[assemblyName]; - - return (T)ass.CreateInstance(assemblyName + "." + type.Name); - } - } -} diff --git a/renderdocui/Plugins/ReplayManagerPlugin.cs b/renderdocui/Plugins/ReplayManagerPlugin.cs deleted file mode 100644 index 970d59cb3..000000000 --- a/renderdocui/Plugins/ReplayManagerPlugin.cs +++ /dev/null @@ -1,39 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System.Collections.Generic; - -namespace renderdocplugin -{ - public interface ReplayManagerPlugin - { - string GetTargetType(); - List GetOnlineTargets(); - bool IsReplayRunning(string target); - void RunReplay(string target); - void CloseReplay(); - } -} diff --git a/renderdocui/Properties/AssemblyInfo.cs b/renderdocui/Properties/AssemblyInfo.cs deleted file mode 100644 index 3e75bfea5..000000000 --- a/renderdocui/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,67 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Resources; - -// 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("RenderDoc")] -[assembly: AssemblyDescription("RenderDoc UI replay app + launcher - https://renderdoc.org/")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Baldur Karlsson")] -[assembly: AssemblyProduct("RenderDoc UI")] -[assembly: AssemblyCopyright("Copyright © 2017 Baldur Karlsson")] -[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)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c3444b4d-32e9-4a50-845f-c59e25d5524b")] - -// 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")] - -// this can be replaced with the git hash of the commit being built from e.g. in a script -[assembly: AssemblyInformationalVersion("NO_GIT_COMMIT_HASH_DEFINED")] -[assembly: NeutralResourcesLanguageAttribute("en-GB")] diff --git a/renderdocui/Properties/Resources.Designer.cs b/renderdocui/Properties/Resources.Designer.cs deleted file mode 100644 index 3a5239ea4..000000000 --- a/renderdocui/Properties/Resources.Designer.cs +++ /dev/null @@ -1,703 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 renderdocui.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", "4.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("renderdocui.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 accept { - get { - object obj = ResourceManager.GetObject("accept", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap action { - get { - object obj = ResourceManager.GetObject("action", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap action_hover { - get { - object obj = ResourceManager.GetObject("action_hover", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap add { - get { - object obj = ResourceManager.GetObject("add", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap arrow_in { - get { - object obj = ResourceManager.GetObject("arrow_in", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap arrow_join { - get { - object obj = ResourceManager.GetObject("arrow_join", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap arrow_undo { - get { - object obj = ResourceManager.GetObject("arrow_undo", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap asterisk_orange { - get { - object obj = ResourceManager.GetObject("asterisk_orange", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap back { - get { - object obj = ResourceManager.GetObject("back", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap chart_curve { - get { - object obj = ResourceManager.GetObject("chart_curve", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap cog { - get { - object obj = ResourceManager.GetObject("cog", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap color_wheel { - get { - object obj = ResourceManager.GetObject("color_wheel", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap connect { - get { - object obj = ResourceManager.GetObject("connect", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap cross { - get { - object obj = ResourceManager.GetObject("cross", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap crosshatch { - get { - object obj = ResourceManager.GetObject("crosshatch", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap delete { - get { - object obj = ResourceManager.GetObject("delete", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap disconnect { - get { - object obj = ResourceManager.GetObject("disconnect", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap down_arrow { - get { - object obj = ResourceManager.GetObject("down_arrow", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap find { - get { - object obj = ResourceManager.GetObject("find", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap fit_window { - get { - object obj = ResourceManager.GetObject("fit_window", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap flag_green { - get { - object obj = ResourceManager.GetObject("flag_green", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap flip_y { - get { - object obj = ResourceManager.GetObject("flip_y", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap folder_page { - get { - object obj = ResourceManager.GetObject("folder_page", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap forward { - get { - object obj = ResourceManager.GetObject("forward", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap hourglass { - get { - object obj = ResourceManager.GetObject("hourglass", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap house { - get { - object obj = ResourceManager.GetObject("house", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). - /// - internal static System.Drawing.Icon icon { - get { - object obj = ResourceManager.GetObject("icon", resourceCulture); - return ((System.Drawing.Icon)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap information { - get { - object obj = ResourceManager.GetObject("information", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap logo { - get { - object obj = ResourceManager.GetObject("logo", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap new_window { - get { - object obj = ResourceManager.GetObject("new_window", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap page_white_code { - get { - object obj = ResourceManager.GetObject("page_white_code", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap page_white_database { - get { - object obj = ResourceManager.GetObject("page_white_database", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap page_white_delete { - get { - object obj = ResourceManager.GetObject("page_white_delete", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap page_white_edit { - get { - object obj = ResourceManager.GetObject("page_white_edit", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap page_white_link { - get { - object obj = ResourceManager.GetObject("page_white_link", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap plugin_add { - get { - object obj = ResourceManager.GetObject("plugin_add", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap red_x_16 { - get { - object obj = ResourceManager.GetObject("red_x_16", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap runback { - get { - object obj = ResourceManager.GetObject("runback", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap runcursor { - get { - object obj = ResourceManager.GetObject("runcursor", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap runfwd { - get { - object obj = ResourceManager.GetObject("runfwd", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap runnaninf { - get { - object obj = ResourceManager.GetObject("runnaninf", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap runsample { - get { - object obj = ResourceManager.GetObject("runsample", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap save { - get { - object obj = ResourceManager.GetObject("save", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap stepnext { - get { - object obj = ResourceManager.GetObject("stepnext", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap stepprev { - get { - object obj = ResourceManager.GetObject("stepprev", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap tick { - get { - object obj = ResourceManager.GetObject("tick", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap time { - get { - object obj = ResourceManager.GetObject("time", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap timeline_marker { - get { - object obj = ResourceManager.GetObject("timeline_marker", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap topo_linelist { - get { - object obj = ResourceManager.GetObject("topo_linelist", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap topo_linelist_adj { - get { - object obj = ResourceManager.GetObject("topo_linelist_adj", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap topo_linestrip { - get { - object obj = ResourceManager.GetObject("topo_linestrip", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap topo_linestrip_adj { - get { - object obj = ResourceManager.GetObject("topo_linestrip_adj", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap topo_patch { - get { - object obj = ResourceManager.GetObject("topo_patch", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap topo_pointlist { - get { - object obj = ResourceManager.GetObject("topo_pointlist", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap topo_trilist { - get { - object obj = ResourceManager.GetObject("topo_trilist", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap topo_trilist_adj { - get { - object obj = ResourceManager.GetObject("topo_trilist_adj", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap topo_tristrip { - get { - object obj = ResourceManager.GetObject("topo_tristrip", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap topo_tristrip_adj { - get { - object obj = ResourceManager.GetObject("topo_tristrip_adj", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap up_arrow { - get { - object obj = ResourceManager.GetObject("up_arrow", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap upfolder { - get { - object obj = ResourceManager.GetObject("upfolder", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap wand { - get { - object obj = ResourceManager.GetObject("wand", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap wireframe_mesh { - get { - object obj = ResourceManager.GetObject("wireframe_mesh", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap wrench { - get { - object obj = ResourceManager.GetObject("wrench", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap zoom { - get { - object obj = ResourceManager.GetObject("zoom", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/renderdocui/Properties/Resources.resx b/renderdocui/Properties/Resources.resx deleted file mode 100644 index edfbd9a66..000000000 --- a/renderdocui/Properties/Resources.resx +++ /dev/null @@ -1,313 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - ..\Resources\topologies\topo_linestrip.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\new_window.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\flag_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\stepnext.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow_undo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\accept.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\timeline_marker.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\runback.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\page_white_database.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\topologies\topo_linelist.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\find.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\resources\rightarrow_gray_16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\zoom.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\topologies\topo_trilist_adj.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\cross.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\128.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\red_x_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\wand.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\topologies\topo_trilist.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\stepprev.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\runfwd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\tick.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\asterisk_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\color_wheel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\fit_window.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\topologies\topo_tristrip_adj.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\time.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\disconnect.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\page_white_delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\hourglass.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\wireframe_mesh.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow_in.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\connect.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\topologies\topo_pointlist.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\save.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\wrench.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\topologies\topo_tristrip.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\topologies\topo_linelist_adj.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\runcursor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\page_white_edit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\flip_y.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\topologies\topo_patch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\plugin_add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow_join.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\crosshatch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\resources\cog.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\page_white_link.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\topologies\topo_linestrip_adj.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\resources\rightarrow_green_16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\information.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\chart_curve.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\folder_page.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\page_white_code.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\down_arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\up_arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\house.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\back.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\forward.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\upfolder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\runsample.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\runnaninf.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/renderdocui/Properties/Settings.Designer.cs b/renderdocui/Properties/Settings.Designer.cs deleted file mode 100644 index 474ffb43a..000000000 --- a/renderdocui/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18408 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace renderdocui.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.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/renderdocui/Properties/Settings.settings b/renderdocui/Properties/Settings.settings deleted file mode 100644 index 8e615f25f..000000000 --- a/renderdocui/Properties/Settings.settings +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/renderdocui/Resources/128.png b/renderdocui/Resources/128.png deleted file mode 100644 index bd3f5cbb5..000000000 Binary files a/renderdocui/Resources/128.png and /dev/null differ diff --git a/renderdocui/Resources/RightArrow_Gray_16x16.png b/renderdocui/Resources/RightArrow_Gray_16x16.png deleted file mode 100644 index 566ff8416..000000000 Binary files a/renderdocui/Resources/RightArrow_Gray_16x16.png and /dev/null differ diff --git a/renderdocui/Resources/RightArrow_Green_16x16.png b/renderdocui/Resources/RightArrow_Green_16x16.png deleted file mode 100644 index b244731cb..000000000 Binary files a/renderdocui/Resources/RightArrow_Green_16x16.png and /dev/null differ diff --git a/renderdocui/Resources/accept.png b/renderdocui/Resources/accept.png deleted file mode 100644 index 89c8129a4..000000000 Binary files a/renderdocui/Resources/accept.png and /dev/null differ diff --git a/renderdocui/Resources/add.png b/renderdocui/Resources/add.png deleted file mode 100644 index 6332fefea..000000000 Binary files a/renderdocui/Resources/add.png and /dev/null differ diff --git a/renderdocui/Resources/arrow_in.png b/renderdocui/Resources/arrow_in.png deleted file mode 100644 index 745c65134..000000000 Binary files a/renderdocui/Resources/arrow_in.png and /dev/null differ diff --git a/renderdocui/Resources/arrow_join.png b/renderdocui/Resources/arrow_join.png deleted file mode 100644 index a128413d8..000000000 Binary files a/renderdocui/Resources/arrow_join.png and /dev/null differ diff --git a/renderdocui/Resources/arrow_undo.png b/renderdocui/Resources/arrow_undo.png deleted file mode 100644 index 6972c5e59..000000000 Binary files a/renderdocui/Resources/arrow_undo.png and /dev/null differ diff --git a/renderdocui/Resources/asterisk_orange.png b/renderdocui/Resources/asterisk_orange.png deleted file mode 100644 index 1ebebde54..000000000 Binary files a/renderdocui/Resources/asterisk_orange.png and /dev/null differ diff --git a/renderdocui/Resources/back.png b/renderdocui/Resources/back.png deleted file mode 100644 index 5ab6096ad..000000000 Binary files a/renderdocui/Resources/back.png and /dev/null differ diff --git a/renderdocui/Resources/chart_curve.png b/renderdocui/Resources/chart_curve.png deleted file mode 100644 index 01e933a61..000000000 Binary files a/renderdocui/Resources/chart_curve.png and /dev/null differ diff --git a/renderdocui/Resources/cog.png b/renderdocui/Resources/cog.png deleted file mode 100644 index 67de2c6cc..000000000 Binary files a/renderdocui/Resources/cog.png and /dev/null differ diff --git a/renderdocui/Resources/cog_go.png b/renderdocui/Resources/cog_go.png deleted file mode 100644 index 3262767cd..000000000 Binary files a/renderdocui/Resources/cog_go.png and /dev/null differ diff --git a/renderdocui/Resources/color_wheel.png b/renderdocui/Resources/color_wheel.png deleted file mode 100644 index 809fb00e5..000000000 Binary files a/renderdocui/Resources/color_wheel.png and /dev/null differ diff --git a/renderdocui/Resources/connect.png b/renderdocui/Resources/connect.png deleted file mode 100644 index 024138eb3..000000000 Binary files a/renderdocui/Resources/connect.png and /dev/null differ diff --git a/renderdocui/Resources/cross.png b/renderdocui/Resources/cross.png deleted file mode 100644 index 1514d51a3..000000000 Binary files a/renderdocui/Resources/cross.png and /dev/null differ diff --git a/renderdocui/Resources/crosshatch.png b/renderdocui/Resources/crosshatch.png deleted file mode 100644 index 09275f9c0..000000000 Binary files a/renderdocui/Resources/crosshatch.png and /dev/null differ diff --git a/renderdocui/Resources/delete.png b/renderdocui/Resources/delete.png deleted file mode 100644 index 08f249365..000000000 Binary files a/renderdocui/Resources/delete.png and /dev/null differ diff --git a/renderdocui/Resources/disconnect.png b/renderdocui/Resources/disconnect.png deleted file mode 100644 index b335cb11c..000000000 Binary files a/renderdocui/Resources/disconnect.png and /dev/null differ diff --git a/renderdocui/Resources/down_arrow.png b/renderdocui/Resources/down_arrow.png deleted file mode 100644 index 482dd7895..000000000 Binary files a/renderdocui/Resources/down_arrow.png and /dev/null differ diff --git a/renderdocui/Resources/find.png b/renderdocui/Resources/find.png deleted file mode 100644 index 154747964..000000000 Binary files a/renderdocui/Resources/find.png and /dev/null differ diff --git a/renderdocui/Resources/fit_window.png b/renderdocui/Resources/fit_window.png deleted file mode 100644 index 2e9bc42be..000000000 Binary files a/renderdocui/Resources/fit_window.png and /dev/null differ diff --git a/renderdocui/Resources/flag_green.png b/renderdocui/Resources/flag_green.png deleted file mode 100644 index e4bc611f8..000000000 Binary files a/renderdocui/Resources/flag_green.png and /dev/null differ diff --git a/renderdocui/Resources/flip_y.png b/renderdocui/Resources/flip_y.png deleted file mode 100644 index e3fb21ea0..000000000 Binary files a/renderdocui/Resources/flip_y.png and /dev/null differ diff --git a/renderdocui/Resources/folder_page.png b/renderdocui/Resources/folder_page.png deleted file mode 100644 index 1ef6e1143..000000000 Binary files a/renderdocui/Resources/folder_page.png and /dev/null differ diff --git a/renderdocui/Resources/forward.png b/renderdocui/Resources/forward.png deleted file mode 100644 index 3eefcde92..000000000 Binary files a/renderdocui/Resources/forward.png and /dev/null differ diff --git a/renderdocui/Resources/glsl.xml b/renderdocui/Resources/glsl.xml deleted file mode 100644 index 553c91f8b..000000000 --- a/renderdocui/Resources/glsl.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - in out inout static const - - break continue do for while switch case default if else true false discard return - - radians degrees sin cos tan asin acos atan sinh cosh tanh asinh acosh atanh pow - exp log exp2 log2 sqrt inversesqrt abs sign floor trunc round - roundEven ceil fract mod modf min max clamp mix step - smoothstep isnan isinf floatBitsToInt floatBitsToUint intBitsToFloat uintBitsToFloat fma frexp ldexp - - packUnorm2x16 packSnorm2x16 packUnorm4x8 packSnorm4x8 unpackUnorm2x16 unpackSnorm2x16 unpackUnorm4x8 unpackSnorm4x8 packDouble2x32 unpackDouble2x32 packHalf2x16 unpackHalf2x16 - length distance dot cross normalize faceforward reflect refract matrixCompMult outerProduct transpose determinant inverse lessThan - lessThanEqual greaterThan greaterThanEqual equal notEqual any all not uaddCarry - usubBorrow umulExtended imulExtended bitfieldExtract bitfieldInsert bitfieldReverse bitCount findLSB findMSB - - textureSize textureQueryLod textureQueryLevels textureSamples texture textureProj textureLod textureOffset texelFetch texelFetchOffset textureProjOffset textureLodOffset - textureProjLod textureProjLodOffset textureGrad textureGradOffset textureProjGrad textureProjGradOffset textureGather textureGatherOffset textureGatherOffsets - - atomicCounterIncrement atomicCounterDecrement atomicCounter atomicAdd atomicMin atomicMax atomicAnd atomicOr atomicXor atomicExchange atomicCompSwap - - imageSize imageSamples imageLoad imageStore imageAtomicAdd imageAtomicMin imageAtomicMax imageAtomicAnd imageAtomicOr imageAtomicXor imageAtomicExchange imageAtomicCompSwap - - dFdx dFdy dFdxFine dFdyFine dFdxCoarse dFdyCoarse fwidth fwidthFine fwidthCoarse interpolateAtCentroid - interpolateAtSample interpolateAtOffset EmitStreamVertex EndStreamPrimitive EmitVertex EndPrimitive - barrier memoryBarrier memoryBarrierAtomicCounter memoryBarrierBuffer memoryBarrierShared memoryBarrierImage groupMemoryBarrier - - gl_CullDistance gl_FragCoord gl_FragDepth gl_FrontFacing gl_GlobalInvocationID gl_HelperInvocation gl_in gl_InstanceID gl_InvocationID gl_Layer gl_LocalInvocationID - gl_LocalInvocationIndex gl_MaxPatchVertices gl_NumWorkGroups gl_out gl_PatchVerticesIn gl_PerVertex gl_PointCoord gl_PointSize gl_Position gl_PrimitiveID - gl_PrimitiveIDIn gl_SampleID gl_SampleMask gl_SampleMaskIn gl_SamplePosition gl_TessCoord gl_TessLevelInner - gl_TessLevelOuter gl_VertexID gl_ViewportIndex gl_WorkGroupID gl_WorkGroupSize - - gl_MaxComputeWorkGroupCount gl_MaxComputeWorkGroupSize gl_MaxComputeUniformComponents gl_MaxComputeTextureImageUnits gl_MaxComputeImageUniforms gl_MaxComputeAtomicCounters gl_MaxComputeAtomicCounterBuffers gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingComponents gl_MaxVertexOutputComponents gl_MaxGeometryInputComponents gl_MaxGeometryOutputComponents gl_MaxFragmentInputComponents gl_MaxVertexTextureImageUnits gl_MaxCombinedTextureImageUnits - gl_MaxTextureImageUnits gl_MaxImageUnits gl_MaxCombinedImageUnitsAndFragmentOutputs gl_MaxCombinedShaderOutputResources gl_MaxImageSamples gl_MaxVertexImageUniforms gl_MaxTessControlImageUniforms gl_MaxTessEvaluationImageUniforms gl_MaxGeometryImageUniforms gl_MaxFragmentImageUniforms gl_MaxCombinedImageUniforms gl_MaxFragmentUniformComponents gl_MaxDrawBuffers gl_MaxClipDistances gl_MaxGeometryTextureImageUnits gl_MaxGeometryOutputVertices - gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents gl_MaxGeometryVaryingComponents gl_MaxTessControlInputComponents gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits gl_MaxTessControlUniformComponents gl_MaxTessControlTotalOutputComponents gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents gl_MaxTessEvaluationTextureImageUnits gl_MaxTessEvaluationUniformComponents gl_MaxTessPatchComponents gl_MaxPatchVertices gl_MaxTessGenLevel gl_MaxViewports gl_MaxVertexUniformVectors gl_MaxFragmentUniformVectors - gl_MaxVaryingVectors gl_MaxVertexAtomicCounters gl_MaxTessControlAtomicCounters gl_MaxTessEvaluationAtomicCounters gl_MaxGeometryAtomicCounters gl_MaxFragmentAtomicCounters gl_MaxCombinedAtomicCounters gl_MaxAtomicCounterBindings gl_MaxVertexAtomicCounterBuffers gl_MaxTessControlAtomicCounterBuffers gl_MaxTessEvaluationAtomicCounterBuffers gl_MaxGeometryAtomicCounterBuffers gl_MaxFragmentAtomicCounterBuffers gl_MaxCombinedAtomicCounterBuffers gl_MaxAtomicCounterBufferSize gl_MinProgramTexelOffset - gl_MaxProgramTexelOffset gl_MaxTransformFeedbackBuffers gl_MaxTransformFeedbackInterleavedComponents gl_MaxCullDistances gl_MaxCombinedClipAndCullDistances gl_MaxSamples gl_MaxVertexImageUniforms gl_MaxFragmentImageUniforms gl_MaxComputeImageUniforms gl_MaxCombinedImageUniforms gl_MaxCombinedShaderOutputResources gl_DepthRangeParameters gl_DepthRange gl_NumSamples - - - float double int void bool - - mat2 mat3 mat4 dmat2 dmat3 dmat4 - mat2x2 mat2x3 mat2x4 dmat2x2 dmat2x3 dmat2x4 - mat3x2 mat3x3 mat3x4 dmat3x2 dmat3x3 dmat3x4 - mat4x2 mat4x3 mat4x4 dmat4x2 dmat4x3 dmat4x4 - vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 dvec2 dvec3 dvec4 - uint uvec2 uvec3 uvec4 - - atomic_uint patch sample buffer subroutine struct - - invariant precise layout - - lowp mediump highp precision - attribute uniform varying shared - coherent volatile restrict readonly writeonly - centroid flat smooth noperspective - - sampler1D sampler2D sampler3D samplerCube - sampler1DShadow sampler2DShadow samplerCubeShadow - sampler1DArray sampler2DArray - sampler1DArrayShadow sampler2DArrayShadow - isampler1D isampler2D isampler3D isamplerCube - isampler1DArray isampler2DArray - usampler1D usampler2D usampler3D usamplerCube - usampler1DArray usampler2DArray - sampler2DRect sampler2DRectShadow isampler2DRect usampler2DRect - samplerBuffer isamplerBuffer usamplerBuffer - sampler2DMS isampler2DMS usampler2DMS - sampler2DMSArray isampler2DMSArray usampler2DMSArray - samplerCubeArray samplerCubeArrayShadow isamplerCubeArray usamplerCubeArray - - image1D iimage1D uimage1D - image2D iimage2D uimage2D - image3D iimage3D uimage3D - image2DRect iimage2DRect uimage2DRect - imageCube iimageCube uimageCube - imageBuffer iimageBuffer uimageBuffer - image1DArray iimage1DArray uimage1DArray - image2DArray iimage2DArray uimage2DArray - imageCubeArray iimageCubeArray uimageCubeArray - image2DMS iimage2DMS uimage2DMS - image2DMSArray iimage2DMSArray uimage2DMSArray - - - - -